ee8d6251ca3fbdd36c2d674d2e9e8bac50699613
1 /* Expert.c- expert user options
3 * WPrefs - Window Maker Preferences Program
5 * Copyright (c) 1998-2003 Alfredo K. Kojima
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 typedef struct _Panel
{
36 CallbackRec callbacks
;
40 WMButton
*swi
[NUMITEMS
];
44 #define ICON_FILE "expert"
46 static void showData(_Panel
* panel
)
48 WMUserDefaults
*udb
= WMGetStandardUserDefaults();
50 WMSetButtonSelected(panel
->swi
[0], GetBoolForKey("DisableMiniwindows"));
51 WMSetButtonSelected(panel
->swi
[1], WMGetUDBoolForKey(udb
, "NoXSetStuff"));
52 WMSetButtonSelected(panel
->swi
[2], GetBoolForKey("SaveSessionOnExit"));
53 WMSetButtonSelected(panel
->swi
[3], GetBoolForKey("UseSaveUnders"));
54 WMSetButtonSelected(panel
->swi
[4], GetBoolForKey("DontConfirmKill"));
55 WMSetButtonSelected(panel
->swi
[5], GetBoolForKey("DisableBlinking"));
56 if (GetStringForKey("AntialiasedText"))
57 WMSetButtonSelected(panel
->swi
[6], GetBoolForKey("AntialiasedText"));
58 WMSetButtonSelected(panel
->swi
[7], GetBoolForKey("CycleActiveHeadOnly"));
59 if (GetStringForKey("ShowClipTitle"))
60 WMSetButtonSelected(panel
->swi
[8], GetBoolForKey("ShowClipTitle"));
61 if (GetStringForKey("HighlightActiveApp"))
62 WMSetButtonSelected(panel
->swi
[9], GetBoolForKey("HighlightActiveApp"));
64 WMSetButtonSelected(panel
->swi
[10], GetBoolForKey("KbdModeLock"));
65 #endif /* XKB_MODELOCK */
68 static void createPanel(Panel
* p
)
70 _Panel
*panel
= (_Panel
*) p
;
75 panel
->box
= WMCreateBox(panel
->parent
);
76 WMSetViewExpandsToParent(WMWidgetView(panel
->box
), 2, 2, 2, 2);
78 sv
= WMCreateScrollView(panel
->box
);
79 WMResizeWidget(sv
, 500, 215);
80 WMMoveWidget(sv
, 12, 10);
81 WMSetScrollViewRelief(sv
, WRSunken
);
82 WMSetScrollViewHasVerticalScroller(sv
, True
);
83 WMSetScrollViewHasHorizontalScroller(sv
, False
);
85 f
= WMCreateFrame(panel
->box
);
86 WMResizeWidget(f
, 495, NUMITEMS
* 25 + 8);
87 WMSetFrameRelief(f
, WRFlat
);
89 for (i
= 0; i
< NUMITEMS
; i
++) {
90 panel
->swi
[i
] = WMCreateSwitchButton(f
);
91 WMResizeWidget(panel
->swi
[i
], FRAME_WIDTH
- 40, 25);
92 WMMoveWidget(panel
->swi
[i
], 5, 5 + i
* 25);
95 WMSetButtonText(panel
->swi
[0],
96 _("Disable miniwindows (icons for minimized windows). For use with KDE/GNOME."));
97 WMSetButtonText(panel
->swi
[1], _("Do not set non-WindowMaker specific parameters (do not use xset)."));
98 WMSetButtonText(panel
->swi
[2], _("Automatically save session when exiting Window Maker."));
99 WMSetButtonText(panel
->swi
[3], _("Use SaveUnder in window frames, icons, menus and other objects."));
100 WMSetButtonText(panel
->swi
[4], _("Disable confirmation panel for the Kill command."));
101 WMSetButtonText(panel
->swi
[5], _("Disable selection animation for selected icons."));
102 WMSetButtonText(panel
->swi
[6], _("Smooth font edges (needs restart)."));
103 WMSetButtonText(panel
->swi
[7], _("Cycle windows only on the active head."));
104 WMSetButtonText(panel
->swi
[8], _("Show workspace title on Clip."));
105 WMSetButtonText(panel
->swi
[9], _("Highlight the icon of the application when it has the focus."));
107 WMSetButtonText(panel
->swi
[10], _("Enable keyboard language switch button in window titlebars."));
108 #endif /* XKB_MODELOCK */
110 /* If the item is default true, switch it on here */
111 WMSetButtonSelected(panel
->swi
[6], True
);
112 WMSetButtonSelected(panel
->swi
[8], True
);
113 WMSetButtonSelected(panel
->swi
[9], True
);
115 WMMapSubwidgets(panel
->box
);
116 WMSetScrollViewContentView(sv
, WMWidgetView(f
));
117 WMRealizeWidget(panel
->box
);
122 static void storeDefaults(_Panel
* panel
)
124 WMUserDefaults
*udb
= WMGetStandardUserDefaults();
126 SetBoolForKey(WMGetButtonSelected(panel
->swi
[0]), "DisableMiniwindows");
128 WMSetUDBoolForKey(udb
, WMGetButtonSelected(panel
->swi
[1]), "NoXSetStuff");
130 SetBoolForKey(WMGetButtonSelected(panel
->swi
[2]), "SaveSessionOnExit");
131 SetBoolForKey(WMGetButtonSelected(panel
->swi
[3]), "UseSaveUnders");
132 SetBoolForKey(WMGetButtonSelected(panel
->swi
[4]), "DontConfirmKill");
133 SetBoolForKey(WMGetButtonSelected(panel
->swi
[5]), "DisableBlinking");
134 SetBoolForKey(WMGetButtonSelected(panel
->swi
[6]), "AntialiasedText");
135 SetBoolForKey(WMGetButtonSelected(panel
->swi
[7]), "CycleActiveHeadOnly");
136 SetBoolForKey(WMGetButtonSelected(panel
->swi
[8]), "ShowClipTitle");
137 SetBoolForKey(WMGetButtonSelected(panel
->swi
[9]), "HighlightActiveApp");
139 SetBoolForKey(WMGetButtonSelected(panel
->swi
[10]), "KbdModeLock");
140 #endif /* XKB_MODELOCK */
143 Panel
*InitExpert(WMScreen
* scr
, WMWidget
* parent
)
147 panel
= wmalloc(sizeof(_Panel
));
149 panel
->sectionName
= _("Expert User Preferences");
151 panel
->description
= _("Options for people who know what they're doing...\n"
152 "Also has some other misc. options.");
154 panel
->parent
= parent
;
156 panel
->callbacks
.createWidgets
= createPanel
;
157 panel
->callbacks
.updateDomain
= storeDefaults
;
159 AddSection(panel
, ICON_FILE
);