Change to the linux kernel coding style
[wmaker-crm.git] / WPrefs.app / Configurations.c
Commit [+]AuthorDateLineData
9d2e6ef9 scottc1998-09-29 22:36:29 +00001/* Configurations.c- misc. configurations
6830b057 dan2004-10-12 21:28:27 +00002 *
9af1c6c4 dan1998-10-21 14:43:47 +00003 * WPrefs - Window Maker Preferences Program
6830b057 dan2004-10-12 21:28:27 +00004 *
4153e2fd dan2003-01-16 23:30:45 +00005 * Copyright (c) 1998-2003 Alfredo K. Kojima
6830b057 dan2004-10-12 21:28:27 +00006 *
9d2e6ef9 scottc1998-09-29 22:36:29 +00007 * 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.
11 *
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.
16 *
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
6830b057 dan2004-10-12 21:28:27 +000019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
9d2e6ef9 scottc1998-09-29 22:36:29 +000020 * USA.
21 */
22
9d2e6ef9 scottc1998-09-29 22:36:29 +000023#include "WPrefs.h"
24
25typedef struct _Panel {
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020026 WMBox *box;
27 char *sectionName;
9d2e6ef9 scottc1998-09-29 22:36:29 +000028
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020029 char *description;
d3f29988 kojima1999-04-25 01:49:46 +000030
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020031 CallbackRec callbacks;
6830b057 dan2004-10-12 21:28:27 +000032
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020033 WMWidget *parent;
9d2e6ef9 scottc1998-09-29 22:36:29 +000034
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020035 WMFrame *icoF;
36 WMButton *icoB[5];
9d2e6ef9 scottc1998-09-29 22:36:29 +000037
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020038 WMFrame *shaF;
39 WMButton *shaB[5];
9d2e6ef9 scottc1998-09-29 22:36:29 +000040
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020041 WMFrame *titlF;
42 WMButton *oldsB;
43 WMButton *newsB;
9d2e6ef9 scottc1998-09-29 22:36:29 +000044
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020045 WMFrame *animF;
46 WMButton *animB;
47 WMButton *supB;
48 WMButton *sfxB;
49 WMLabel *noteL;
9d2e6ef9 scottc1998-09-29 22:36:29 +000050
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020051 WMFrame *smoF;
52 WMButton *smoB;
c2434e89 kojima1999-05-01 17:44:43 +000053
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020054 WMFrame *dithF;
55 WMButton *dithB;
56 WMSlider *dithS;
57 WMLabel *dithL;
58 WMLabel *dith1L;
59 WMLabel *dith2L;
6830b057 dan2004-10-12 21:28:27 +000060
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020061 int cmapSize;
9d2e6ef9 scottc1998-09-29 22:36:29 +000062} _Panel;
63
9d2e6ef9 scottc1998-09-29 22:36:29 +000064#define ICON_FILE "configs"
65
66#define OLDS_IMAGE "oldstyle"
67#define NEWS_IMAGE "newstyle"
68
69#define ANIM_IMAGE "animations"
70#define SUPERF_IMAGE "moreanim"
71#define SOUND_IMAGE "sound"
c2434e89 kojima1999-05-01 17:44:43 +000072#define SMOOTH_IMAGE "smooth"
9d2e6ef9 scottc1998-09-29 22:36:29 +000073
74#define SPEED_IMAGE "speed%i"
75#define SPEED_IMAGE_S "speed%is"
76
77#define ARQUIVO_XIS "xis"
78
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020079static void updateLabel(WMWidget * self, void *data);
9d2e6ef9 scottc1998-09-29 22:36:29 +000080
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020081static void showData(_Panel * panel)
9d2e6ef9 scottc1998-09-29 22:36:29 +000082{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020083 WMPerformButtonClick(panel->icoB[GetSpeedForKey("IconSlideSpeed")]);
6830b057 dan2004-10-12 21:28:27 +000084
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020085 WMPerformButtonClick(panel->shaB[GetSpeedForKey("ShadeSpeed")]);
6830b057 dan2004-10-12 21:28:27 +000086
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020087 if (GetBoolForKey("NewStyle")) {
88 WMPerformButtonClick(panel->newsB);
89 } else {
90 WMPerformButtonClick(panel->oldsB);
91 }
6830b057 dan2004-10-12 21:28:27 +000092
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020093 WMSetButtonSelected(panel->animB, !GetBoolForKey("DisableAnimations"));
6830b057 dan2004-10-12 21:28:27 +000094
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020095 WMSetButtonSelected(panel->supB, GetBoolForKey("Superfluous"));
9d2e6ef9 scottc1998-09-29 22:36:29 +000096
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020097 WMSetButtonSelected(panel->sfxB, !GetBoolForKey("DisableSound"));
c2434e89 kojima1999-05-01 17:44:43 +000098
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020099 WMSetButtonSelected(panel->smoB, GetBoolForKey("SmoothWorkspaceBack"));
c2434e89 kojima1999-05-01 17:44:43 +0000100
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200101 WMSetButtonSelected(panel->dithB, GetBoolForKey("DisableDithering"));
6830b057 dan2004-10-12 21:28:27 +0000102
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200103 WMSetSliderValue(panel->dithS, GetIntegerForKey("ColormapSize"));
9d2e6ef9 scottc1998-09-29 22:36:29 +0000104
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200105 updateLabel(panel->dithS, panel);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000106}
107
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200108static void updateLabel(WMWidget * self, void *data)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000109{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200110 WMSlider *sPtr = (WMSlider *) self;
111 _Panel *panel = (_Panel *) data;
112 char buffer[64];
113 float fl;
6830b057 dan2004-10-12 21:28:27 +0000114
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200115 fl = WMGetSliderValue(sPtr);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000116
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200117 panel->cmapSize = (int)fl;
6830b057 dan2004-10-12 21:28:27 +0000118
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200119 sprintf(buffer, "%i", panel->cmapSize * panel->cmapSize * panel->cmapSize);
120 WMSetLabelText(panel->dithL, buffer);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000121}
122
9d2e6ef9 scottc1998-09-29 22:36:29 +0000123static void
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200124createImages(WMScreen * scr, RContext * rc, RImage * xis, char *file, WMPixmap ** icon1, WMPixmap ** icon2)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000125{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200126 RImage *icon;
127 char *path;
128 RColor gray = { 0xae, 0xaa, 0xae };
129
130 *icon1 = NULL;
131 *icon2 = NULL;
132
133 path = LocateImage(file);
134 if (!path) {
135 return;
136 }
137
138 *icon1 = WMCreatePixmapFromFile(scr, path);
139 if (!*icon1) {
140 wwarning(_("could not load icon %s"), path);
141 wfree(path);
142 return;
143 }
144 icon = RLoadImage(rc, path, 0);
145 if (!icon) {
146 wwarning(_("could not load icon %s"), path);
147 wfree(path);
148 return;
149 }
150 RCombineImageWithColor(icon, &gray);
151 if (xis) {
152 RCombineImagesWithOpaqueness(icon, xis, 180);
153 if (!(*icon2 = WMCreatePixmapFromRImage(scr, icon, 127)))
154 wwarning(_("could not process icon %s:"), file, RMessageForError(RErrorCode));
155 }
156 RReleaseImage(icon);
157 wfree(path);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000158}
159
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200160static void createPanel(Panel * p)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000161{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200162 _Panel *panel = (_Panel *) p;
163 WMScreen *scr = WMWidgetScreen(panel->parent);
164 char *buf1, *buf2;
165 WMPixmap *icon, *altIcon;
166 RImage *xis = NULL;
167 int i;
168 RContext *rc = WMScreenRContext(scr);
169 WMFont *font = WMSystemFontOfSize(scr, 10);
170 char *path;
171
172 path = LocateImage(ARQUIVO_XIS);
173 if (path) {
174 xis = RLoadImage(rc, path, 0);
175 if (!xis) {
176 wwarning(_("could not load image file %s"), path);
177 }
178 wfree(path);
179 }
180
181 panel->box = WMCreateBox(panel->parent);
182 WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000183
184 /*********** Icon Slide Speed **********/
6830b057 dan2004-10-12 21:28:27 +0000185
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200186 panel->icoF = WMCreateFrame(panel->box);
187 WMResizeWidget(panel->icoF, 230, 45);
188 WMMoveWidget(panel->icoF, 15, 10);
189 WMSetFrameTitle(panel->icoF, _("Icon Slide Speed"));
6830b057 dan2004-10-12 21:28:27 +0000190
9d2e6ef9 scottc1998-09-29 22:36:29 +0000191 /*********** Shade Animation Speed **********/
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200192 panel->shaF = WMCreateFrame(panel->box);
193 WMResizeWidget(panel->shaF, 230, 45);
194 WMMoveWidget(panel->shaF, 15, 60);
195 WMSetFrameTitle(panel->shaF, _("Shade Animation Speed"));
196
197 buf1 = wmalloc(strlen(SPEED_IMAGE) + 1);
198 buf2 = wmalloc(strlen(SPEED_IMAGE_S) + 1);
199
200 for (i = 0; i < 5; i++) {
201 panel->icoB[i] = WMCreateCustomButton(panel->icoF, WBBStateChangeMask);
202 panel->shaB[i] = WMCreateCustomButton(panel->shaF, WBBStateChangeMask);
203 WMResizeWidget(panel->icoB[i], 40, 24);
204 WMMoveWidget(panel->icoB[i], 10 + (40 * i), 15);
205 WMResizeWidget(panel->shaB[i], 40, 24);
206 WMMoveWidget(panel->shaB[i], 10 + (40 * i), 15);
207 WMSetButtonBordered(panel->icoB[i], False);
208 WMSetButtonImagePosition(panel->icoB[i], WIPImageOnly);
209 if (i > 0) {
210 WMGroupButtons(panel->icoB[0], panel->icoB[i]);
211 }
212 WMSetButtonBordered(panel->shaB[i], False);
213 WMSetButtonImagePosition(panel->shaB[i], WIPImageOnly);
214 if (i > 0) {
215 WMGroupButtons(panel->shaB[0], panel->shaB[i]);
216 }
217 sprintf(buf1, SPEED_IMAGE, i);
218 sprintf(buf2, SPEED_IMAGE_S, i);
219 path = LocateImage(buf1);
220 if (path) {
221 icon = WMCreatePixmapFromFile(scr, path);
222 if (icon) {
223 WMSetButtonImage(panel->icoB[i], icon);
224 WMSetButtonImage(panel->shaB[i], icon);
225 WMReleasePixmap(icon);
226 } else {
227 wwarning(_("could not load icon file %s"), path);
228 }
229 wfree(path);
230 }
231 path = LocateImage(buf2);
232 if (path) {
233 icon = WMCreatePixmapFromFile(scr, path);
234 if (icon) {
235 WMSetButtonAltImage(panel->icoB[i], icon);
236 WMSetButtonAltImage(panel->shaB[i], icon);
237 WMReleasePixmap(icon);
238 } else {
239 wwarning(_("could not load icon file %s"), path);
240 }
241 wfree(path);
242 }
243 }
244 wfree(buf1);
245 wfree(buf2);
246
247 WMMapSubwidgets(panel->icoF);
248 WMMapSubwidgets(panel->shaF);
c2434e89 kojima1999-05-01 17:44:43 +0000249
250 /***************** Smoothed Scaling *****************/
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200251 panel->smoF = WMCreateFrame(panel->box);
252 WMResizeWidget(panel->smoF, 115, 110);
253 WMMoveWidget(panel->smoF, 18, 115);
254 WMSetFrameTitle(panel->smoF, _("Smooth Scaling"));
255 WMSetBalloonTextForView(_("Smooth scaled background images, neutralizing\n"
256 "the `pixelization' effect. This will slow\n"
257 "down loading of background images considerably."), WMWidgetView(panel->smoF));
258
259 panel->smoB = WMCreateButton(panel->smoF, WBTToggle);
260 WMResizeWidget(panel->smoB, 64, 64);
261 WMMoveWidget(panel->smoB, 25, 25);
262 WMSetButtonImagePosition(panel->smoB, WIPImageOnly);
263 path = LocateImage(SMOOTH_IMAGE);
264 if (path) {
265 RImage *image, *scaled;
266
267 image = RLoadImage(WMScreenRContext(scr), path, 0);
268 wfree(path);
269
270 scaled = RScaleImage(image, 61, 61);
271 icon = WMCreatePixmapFromRImage(scr, scaled, 128);
272 RReleaseImage(scaled);
273 if (icon) {
274 WMSetButtonImage(panel->smoB, icon);
275 WMReleasePixmap(icon);
276 }
277
278 scaled = RSmoothScaleImage(image, 61, 61);
279 icon = WMCreatePixmapFromRImage(scr, scaled, 128);
280 RReleaseImage(scaled);
281 if (icon) {
282 WMSetButtonAltImage(panel->smoB, icon);
283 WMReleasePixmap(icon);
284 }
285
286 RReleaseImage(image);
287 }
288
289 WMMapSubwidgets(panel->smoF);
c2434e89 kojima1999-05-01 17:44:43 +0000290
9d2e6ef9 scottc1998-09-29 22:36:29 +0000291 /***************** Titlebar Style Size ****************/
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200292 panel->titlF = WMCreateFrame(panel->box);
293 WMResizeWidget(panel->titlF, 105, 110);
294 WMMoveWidget(panel->titlF, 140, 115);
295 WMSetFrameTitle(panel->titlF, _("Titlebar Style"));
296
297 panel->newsB = WMCreateButton(panel->titlF, WBTOnOff);
298 WMResizeWidget(panel->newsB, 74, 40);
299 WMMoveWidget(panel->newsB, 15, 20);
300 WMSetButtonImagePosition(panel->newsB, WIPImageOnly);
301 path = LocateImage(NEWS_IMAGE);
302 if (path) {
303 icon = WMCreatePixmapFromFile(scr, path);
304 if (icon) {
305 WMSetButtonImage(panel->newsB, icon);
306 WMReleasePixmap(icon);
307 }
308 }
309
310 panel->oldsB = WMCreateButton(panel->titlF, WBTOnOff);
311 WMResizeWidget(panel->oldsB, 74, 40);
312 WMMoveWidget(panel->oldsB, 15, 60);
313 WMSetButtonImagePosition(panel->oldsB, WIPImageOnly);
314 path = LocateImage(OLDS_IMAGE);
315 if (path) {
316 icon = WMCreatePixmapFromFile(scr, path);
317 if (icon) {
318 WMSetButtonImage(panel->oldsB, icon);
319 WMReleasePixmap(icon);
320 }
321 wfree(path);
322 }
323
324 WMGroupButtons(panel->newsB, panel->oldsB);
325
326 WMMapSubwidgets(panel->titlF);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000327
328 /**************** Features ******************/
6830b057 dan2004-10-12 21:28:27 +0000329
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200330 panel->animF = WMCreateFrame(panel->box);
331 WMResizeWidget(panel->animF, 255, 115);
332 WMMoveWidget(panel->animF, 255, 10);
333 WMSetFrameTitle(panel->animF, _("Animations and Sound"));
334
335 panel->animB = WMCreateButton(panel->animF, WBTToggle);
336 WMResizeWidget(panel->animB, 64, 64);
337 WMMoveWidget(panel->animB, 15, 20);
338 WMSetButtonFont(panel->animB, font);
339 WMSetButtonText(panel->animB, _("Animations"));
340 WMSetButtonImagePosition(panel->animB, WIPAbove);
341 createImages(scr, rc, xis, ANIM_IMAGE, &altIcon, &icon);
342 if (icon) {
343 WMSetButtonImage(panel->animB, icon);
344 WMReleasePixmap(icon);
345 }
346 if (altIcon) {
347 WMSetButtonAltImage(panel->animB, altIcon);
348 WMReleasePixmap(altIcon);
349 }
350 WMSetBalloonTextForView(_("Disable/enable animations such as those shown\n"
351 "for window miniaturization, shading etc."), WMWidgetView(panel->animB));
352
353 panel->supB = WMCreateButton(panel->animF, WBTToggle);
354 WMResizeWidget(panel->supB, 64, 64);
355 WMMoveWidget(panel->supB, 95, 20);
356 WMSetButtonFont(panel->supB, font);
357 WMSetButtonText(panel->supB, _("Superfluous"));
358 WMSetButtonImagePosition(panel->supB, WIPAbove);
359 createImages(scr, rc, xis, SUPERF_IMAGE, &altIcon, &icon);
360 if (icon) {
361 WMSetButtonImage(panel->supB, icon);
362 WMReleasePixmap(icon);
363 }
364 if (altIcon) {
365 WMSetButtonAltImage(panel->supB, altIcon);
366 WMReleasePixmap(altIcon);
367 }
368 WMSetBalloonTextForView(_("Disable/enable `superfluous' features and\n"
369 "animations. These include the `ghosting' of the\n"
370 "dock when it's being moved to another side and\n"
371 "the explosion animation when undocking icons."), WMWidgetView(panel->supB));
372
373 panel->sfxB = WMCreateButton(panel->animF, WBTToggle);
374 WMResizeWidget(panel->sfxB, 64, 64);
375 WMMoveWidget(panel->sfxB, 175, 20);
376 WMSetButtonFont(panel->sfxB, font);
377 WMSetButtonText(panel->sfxB, _("Sounds"));
378 WMSetButtonImagePosition(panel->sfxB, WIPAbove);
379 createImages(scr, rc, xis, SOUND_IMAGE, &altIcon, &icon);
380 if (icon) {
381 WMSetButtonImage(panel->sfxB, icon);
382 WMReleasePixmap(icon);
383 }
384 if (altIcon) {
385 WMSetButtonAltImage(panel->sfxB, altIcon);
386 WMReleasePixmap(altIcon);
387 }
388 WMSetBalloonTextForView(_("Disable/enable support for sound effects played\n"
389 "for actions like shading and closing a window.\n"
390 "You will need a module distributed separately\n"
391 "for this. You can get it at:\n"
392 "http://largo.windowmaker.info/files.php#WSoundServer"),
393 WMWidgetView(panel->sfxB));
394
395 panel->noteL = WMCreateLabel(panel->animF);
396 WMResizeWidget(panel->noteL, 235, 28);
397 WMMoveWidget(panel->noteL, 10, 85);
398 WMSetLabelFont(panel->noteL, font);
399 WMSetLabelText(panel->noteL, _("Note: sound requires a module distributed\nseparately"));
400
401 WMMapSubwidgets(panel->animF);
6830b057 dan2004-10-12 21:28:27 +0000402
9d2e6ef9 scottc1998-09-29 22:36:29 +0000403 /*********** Dithering **********/
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200404 panel->cmapSize = 4;
405
406 panel->dithF = WMCreateFrame(panel->box);
407 WMResizeWidget(panel->dithF, 255, 95);
408 WMMoveWidget(panel->dithF, 255, 130);
409 WMSetFrameTitle(panel->dithF, _("Dithering colormap for 8bpp"));
410
411 WMSetBalloonTextForView(_("Number of colors to reserve for Window Maker\n"
412 "on displays that support only 8bpp (PseudoColor)."),
413 WMWidgetView(panel->dithF));
414
415 panel->dithB = WMCreateSwitchButton(panel->dithF);
416 WMResizeWidget(panel->dithB, 235, 32);
417 WMMoveWidget(panel->dithB, 15, 15);
418 WMSetButtonText(panel->dithB, _("Disable dithering in any visual/depth"));
419
420 panel->dithL = WMCreateLabel(panel->dithF);
421 WMResizeWidget(panel->dithL, 75, 16);
422 WMMoveWidget(panel->dithL, 90, 50);
423 WMSetLabelTextAlignment(panel->dithL, WACenter);
424 WMSetLabelText(panel->dithL, "64");
425
426 panel->dithS = WMCreateSlider(panel->dithF);
427 WMResizeWidget(panel->dithS, 95, 16);
428 WMMoveWidget(panel->dithS, 80, 65);
429 WMSetSliderMinValue(panel->dithS, 2);
430 WMSetSliderMaxValue(panel->dithS, 6);
431 WMSetSliderContinuous(panel->dithS, True);
432 WMSetSliderAction(panel->dithS, updateLabel, panel);
433
434 panel->dith1L = WMCreateLabel(panel->dithF);
435 WMResizeWidget(panel->dith1L, 70, 35);
436 WMMoveWidget(panel->dith1L, 5, 50);
437 WMSetLabelTextAlignment(panel->dith1L, WACenter);
438 WMSetLabelFont(panel->dith1L, font);
439 WMSetLabelText(panel->dith1L, _("More colors for\napplications"));
440
441 panel->dith2L = WMCreateLabel(panel->dithF);
442 WMResizeWidget(panel->dith2L, 70, 35);
443 WMMoveWidget(panel->dith2L, 180, 50);
444 WMSetLabelTextAlignment(panel->dith2L, WACenter);
445 WMSetLabelFont(panel->dith2L, font);
446 WMSetLabelText(panel->dith2L, _("More colors for\nWindow Maker"));
447
448 WMMapSubwidgets(panel->dithF);
449
450 WMRealizeWidget(panel->box);
451 WMMapSubwidgets(panel->box);
452
453 if (xis)
454 RReleaseImage(xis);
455 WMReleaseFont(font);
456
457 showData(panel);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000458}
459
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200460static void storeData(_Panel * panel)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000461{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200462 int i;
9d2e6ef9 scottc1998-09-29 22:36:29 +0000463
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200464 for (i = 0; i < 5; i++) {
465 if (WMGetButtonSelected(panel->icoB[i]))
466 break;
467 }
468 SetSpeedForKey(i, "IconSlideSpeed");
9d2e6ef9 scottc1998-09-29 22:36:29 +0000469
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200470 for (i = 0; i < 5; i++) {
471 if (WMGetButtonSelected(panel->shaB[i]))
472 break;
473 }
474 SetSpeedForKey(i, "ShadeSpeed");
9d2e6ef9 scottc1998-09-29 22:36:29 +0000475
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200476 SetBoolForKey(WMGetButtonSelected(panel->newsB), "NewStyle");
6830b057 dan2004-10-12 21:28:27 +0000477
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200478 SetBoolForKey(!WMGetButtonSelected(panel->animB), "DisableAnimations");
479 SetBoolForKey(WMGetButtonSelected(panel->supB), "Superfluous");
480 SetBoolForKey(!WMGetButtonSelected(panel->sfxB), "DisableSound");
c2434e89 kojima1999-05-01 17:44:43 +0000481
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200482 SetBoolForKey(WMGetButtonSelected(panel->smoB), "SmoothWorkspaceBack");
6830b057 dan2004-10-12 21:28:27 +0000483
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200484 SetBoolForKey(WMGetButtonSelected(panel->dithB), "DisableDithering");
485 SetIntegerForKey(WMGetSliderValue(panel->dithS), "ColormapSize");
9d2e6ef9 scottc1998-09-29 22:36:29 +0000486}
487
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200488Panel *InitConfigurations(WMScreen * scr, WMWidget * parent)
9d2e6ef9 scottc1998-09-29 22:36:29 +0000489{
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200490 _Panel *panel;
9d2e6ef9 scottc1998-09-29 22:36:29 +0000491
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200492 panel = wmalloc(sizeof(_Panel));
493 memset(panel, 0, sizeof(_Panel));
9d2e6ef9 scottc1998-09-29 22:36:29 +0000494
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200495 panel->sectionName = _("Other Configurations");
9d2e6ef9 scottc1998-09-29 22:36:29 +0000496
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200497 panel->description = _("Animation speeds, titlebar styles, various option\n"
498 "toggling and number of colors to reserve for\n" "Window Maker on 8bit displays.");
d3f29988 kojima1999-04-25 01:49:46 +0000499
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200500 panel->parent = parent;
9d2e6ef9 scottc1998-09-29 22:36:29 +0000501
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +0200502 panel->callbacks.createWidgets = createPanel;
503 panel->callbacks.updateDomain = storeData;
9d2e6ef9 scottc1998-09-29 22:36:29 +0000504
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200505 AddSection(panel, ICON_FILE);
9d2e6ef9 scottc1998-09-29 22:36:29 +0000506
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +0200507 return panel;
9d2e6ef9 scottc1998-09-29 22:36:29 +0000508}