1 /* Preferences.c- misc personal preferences
3 * WPrefs - Window Maker Preferences Program
5 * Copyright (c) 1998 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
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
26 typedef struct _Panel
{
33 CallbackRec callbacks
;
50 #endif /* XKB_MODELOCK */
56 #define ICON_FILE "ergonomic"
60 showData(_Panel
*panel
)
64 str
= GetStringForKey("ResizeDisplay");
67 if (strcasecmp(str
, "corner")==0)
68 WMSetPopUpButtonSelectedItem(panel
->sizeP
, 0);
69 else if (strcasecmp(str
, "center")==0)
70 WMSetPopUpButtonSelectedItem(panel
->sizeP
, 1);
71 else if (strcasecmp(str
, "floating")==0)
72 WMSetPopUpButtonSelectedItem(panel
->sizeP
, 2);
73 else if (strcasecmp(str
, "line")==0)
74 WMSetPopUpButtonSelectedItem(panel
->sizeP
, 3);
76 str
= GetStringForKey("MoveDisplay");
79 if (strcasecmp(str
, "corner")==0)
80 WMSetPopUpButtonSelectedItem(panel
->posiP
, 0);
81 else if (strcasecmp(str
, "center")==0)
82 WMSetPopUpButtonSelectedItem(panel
->posiP
, 1);
83 else if (strcasecmp(str
, "floating")==0)
84 WMSetPopUpButtonSelectedItem(panel
->posiP
, 2);
87 WMSetButtonSelected(panel
->raisB
, GetBoolForKey("CirculateRaise"));
89 WMSetButtonSelected(panel
->modeB
, GetBoolForKey("KbdModeLock"));
90 #endif /* XKB_MODELOCK */
92 WMSetButtonSelected(panel
->ballB
[0], GetBoolForKey("WindowTitleBalloons"));
93 WMSetButtonSelected(panel
->ballB
[1], GetBoolForKey("MiniwindowTitleBalloons"));
94 WMSetButtonSelected(panel
->ballB
[2], GetBoolForKey("AppIconBalloons"));
95 WMSetButtonSelected(panel
->ballB
[3], GetBoolForKey("HelpBalloons"));
100 storeData(_Panel
*panel
)
104 switch (WMGetPopUpButtonSelectedItem(panel
->sizeP
)) {
118 SetStringForKey(str
, "ResizeDisplay");
120 switch (WMGetPopUpButtonSelectedItem(panel
->posiP
)) {
131 SetStringForKey(str
, "MoveDisplay");
133 SetBoolForKey(WMGetButtonSelected(panel
->raisB
), "CirculateRaise");
135 SetBoolForKey(WMGetButtonSelected(panel
->modeB
), "KbdModeLock");
136 #endif /* XKB_MODELOCK */
137 SetBoolForKey(WMGetButtonSelected(panel
->ballB
[0]), "WindowTitleBalloons");
138 SetBoolForKey(WMGetButtonSelected(panel
->ballB
[1]), "MiniwindowTitleBalloons");
139 SetBoolForKey(WMGetButtonSelected(panel
->ballB
[2]), "AppIconBalloons");
140 SetBoolForKey(WMGetButtonSelected(panel
->ballB
[3]), "HelpBalloons");
145 createPanel(Panel
*p
)
147 _Panel
*panel
= (_Panel
*)p
;
150 panel
->frame
= WMCreateFrame(panel
->win
);
151 WMResizeWidget(panel
->frame
, FRAME_WIDTH
, FRAME_HEIGHT
);
152 WMMoveWidget(panel
->frame
, FRAME_LEFT
, FRAME_TOP
);
155 /***************** Size Display ****************/
156 panel
->sizeF
= WMCreateFrame(panel
->frame
);
157 WMResizeWidget(panel
->sizeF
, 240, 60);
158 WMMoveWidget(panel
->sizeF
, 20, 10);
159 WMSetFrameTitle(panel
->sizeF
, _("Size Display"));
161 WMSetBalloonTextForView(_("The position or style of the window size\n"
162 "display that's shown when a window is resized."),
163 WMWidgetView(panel
->sizeF
));
165 panel
->sizeP
= WMCreatePopUpButton(panel
->sizeF
);
166 WMResizeWidget(panel
->sizeP
, 200, 20);
167 WMMoveWidget(panel
->sizeP
, 22, 24);
168 WMAddPopUpButtonItem(panel
->sizeP
, _("Corner of screen"));
169 WMAddPopUpButtonItem(panel
->sizeP
, _("Center of screen"));
170 WMAddPopUpButtonItem(panel
->sizeP
, _("Center of resized window"));
171 WMAddPopUpButtonItem(panel
->sizeP
, _("Technical drawing-like"));
173 WMMapSubwidgets(panel
->sizeF
);
175 /***************** Position Display ****************/
176 panel
->posiF
= WMCreateFrame(panel
->frame
);
177 WMResizeWidget(panel
->posiF
, 240, 60);
178 WMMoveWidget(panel
->posiF
, 20, 75);
179 WMSetFrameTitle(panel
->posiF
, _("Position Display"));
181 WMSetBalloonTextForView(_("The position or style of the window position\n"
182 "display that's shown when a window is moved."),
183 WMWidgetView(panel
->posiF
));
185 panel
->posiP
= WMCreatePopUpButton(panel
->posiF
);
186 WMResizeWidget(panel
->posiP
, 200, 20);
187 WMMoveWidget(panel
->posiP
, 22, 24);
188 WMAddPopUpButtonItem(panel
->posiP
, _("Corner of screen"));
189 WMAddPopUpButtonItem(panel
->posiP
, _("Center of screen"));
190 WMAddPopUpButtonItem(panel
->posiP
, _("Center of resized window"));
192 WMMapSubwidgets(panel
->posiF
);
194 /***************** Balloon Text ****************/
195 panel
->ballF
= WMCreateFrame(panel
->frame
);
196 WMResizeWidget(panel
->ballF
, 235, 125);
197 WMMoveWidget(panel
->ballF
, 270, 10);
198 WMSetFrameTitle(panel
->ballF
, _("Show balloon text for..."));
200 for (i
=0; i
<4; i
++) {
201 panel
->ballB
[i
] = WMCreateSwitchButton(panel
->ballF
);
202 WMResizeWidget(panel
->ballB
[i
], 205, 20);
203 WMMoveWidget(panel
->ballB
[i
], 15, 20+i
*25);
205 WMSetButtonText(panel
->ballB
[0], _("incomplete window titles"));
206 WMSetButtonText(panel
->ballB
[1], _("miniwindow titles"));
207 WMSetButtonText(panel
->ballB
[2], _("application/dock icons"));
208 WMSetButtonText(panel
->ballB
[3], _("internal help"));
210 WMMapSubwidgets(panel
->ballF
);
212 /***************** Options ****************/
213 panel
->optF
= WMCreateFrame(panel
->frame
);
214 WMResizeWidget(panel
->optF
, 485, 75);
215 WMMoveWidget(panel
->optF
, 20, 145);
217 panel
->raisB
= WMCreateSwitchButton(panel
->optF
);
218 WMResizeWidget(panel
->raisB
, 440, 20);
219 WMMoveWidget(panel
->raisB
, 20, 15);
220 WMSetButtonText(panel
->raisB
, _("Raise window when switching focus with keyboard (CirculateRaise)."));
223 panel
->modeB
= WMCreateSwitchButton(panel
->optF
);
224 WMResizeWidget(panel
->modeB
, 440, 20);
225 WMMoveWidget(panel
->modeB
, 20, 40);
226 WMSetButtonText(panel
->modeB
, _("Keep keyboard language status for each window."));
229 WMMapSubwidgets(panel
->optF
);
231 WMRealizeWidget(panel
->frame
);
232 WMMapSubwidgets(panel
->frame
);
240 InitPreferences(WMScreen
*scr
, WMWindow
*win
)
244 panel
= wmalloc(sizeof(_Panel
));
245 memset(panel
, 0, sizeof(_Panel
));
247 panel
->sectionName
= _("Miscellaneous Ergonomic Preferences");
248 panel
->description
= _("Various settings like balloon text, geometry\n"
253 panel
->callbacks
.createWidgets
= createPanel
;
254 panel
->callbacks
.updateDomain
= storeData
;
256 AddSection(panel
, ICON_FILE
);