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.
24 typedef struct _Panel
{
30 CallbackRec callbacks
;
38 #define ICON_FILE "expert"
40 static void showData(_Panel
* panel
)
42 WMUserDefaults
*udb
= WMGetStandardUserDefaults();
44 WMSetButtonSelected(panel
->swi
[0], GetBoolForKey("DisableMiniwindows"));
45 WMSetButtonSelected(panel
->swi
[1], WMGetUDBoolForKey(udb
, "NoXSetStuff"));
46 WMSetButtonSelected(panel
->swi
[2], GetBoolForKey("SaveSessionOnExit"));
47 WMSetButtonSelected(panel
->swi
[3], GetBoolForKey("UseSaveUnders"));
48 WMSetButtonSelected(panel
->swi
[4], GetBoolForKey("DontConfirmKill"));
49 WMSetButtonSelected(panel
->swi
[5], GetBoolForKey("DisableBlinking"));
50 WMSetButtonSelected(panel
->swi
[6], GetBoolForKey("AntialiasedText"));
51 WMSetButtonSelected(panel
->swi
[7], GetBoolForKey("SingleClickLaunch"));
52 WMSetButtonSelected(panel
->swi
[8], GetBoolForKey("CycleActiveHeadOnly"));
53 WMSetButtonSelected(panel
->swi
[9], GetBoolForKey("ShowClipTitle"));
54 WMSetButtonSelected(panel
->swi
[10], GetBoolForKey("BounceAppIconsWhenUrgent"));
55 WMSetButtonSelected(panel
->swi
[11], GetBoolForKey("RaiseAppIconsWhenBouncing"));
56 WMSetButtonSelected(panel
->swi
[12], GetBoolForKey("OpaqueMoveResizeKeyboard"));
59 static void createPanel(Panel
* p
)
61 _Panel
*panel
= (_Panel
*) p
;
66 panel
->box
= WMCreateBox(panel
->parent
);
67 WMSetViewExpandsToParent(WMWidgetView(panel
->box
), 2, 2, 2, 2);
69 sv
= WMCreateScrollView(panel
->box
);
70 WMResizeWidget(sv
, 500, 215);
71 WMMoveWidget(sv
, 12, 10);
72 WMSetScrollViewRelief(sv
, WRSunken
);
73 WMSetScrollViewHasVerticalScroller(sv
, True
);
74 WMSetScrollViewHasHorizontalScroller(sv
, False
);
76 f
= WMCreateFrame(panel
->box
);
77 WMResizeWidget(f
, 495, sizeof(panel
->swi
) / sizeof(char *) * 25 + 8);
78 WMSetFrameRelief(f
, WRFlat
);
80 for (i
= 0; i
< sizeof(panel
->swi
) / sizeof(char *); i
++) {
81 panel
->swi
[i
] = WMCreateSwitchButton(f
);
82 WMResizeWidget(panel
->swi
[i
], FRAME_WIDTH
- 40, 25);
83 WMMoveWidget(panel
->swi
[i
], 5, 5 + i
* 25);
86 WMSetButtonText(panel
->swi
[0],
87 _("Disable miniwindows (icons for minimized windows). For use with KDE/GNOME."));
88 WMSetButtonText(panel
->swi
[1], _("Do not set non-WindowMaker specific parameters (do not use xset)."));
89 WMSetButtonText(panel
->swi
[2], _("Automatically save session when exiting Window Maker."));
90 WMSetButtonText(panel
->swi
[3], _("Use SaveUnder in window frames, icons, menus and other objects."));
91 WMSetButtonText(panel
->swi
[4], _("Disable confirmation panel for the Kill command."));
92 WMSetButtonText(panel
->swi
[5], _("Disable selection animation for selected icons."));
93 WMSetButtonText(panel
->swi
[6], _("Smooth font edges (needs restart)."));
94 WMSetButtonText(panel
->swi
[7], _("Launch applications and restore windows with a single click."));
95 WMSetButtonText(panel
->swi
[8], _("Cycle windows only on the active head."));
96 WMSetButtonText(panel
->swi
[9], _("Show workspace title on Clip."));
97 WMSetButtonText(panel
->swi
[10], _("Bounce AppIcons when the application wants attention."));
98 WMSetButtonText(panel
->swi
[11], _("Raise AppIcons when bouncing."));
99 WMSetButtonText(panel
->swi
[12], _("Opaque Move,Resize with keyboard."));
101 /* If the item is default true, enable the button here */
102 WMSetButtonEnabled(panel
->swi
[6], True
);
103 WMSetButtonEnabled(panel
->swi
[9], True
);
104 WMSetButtonEnabled(panel
->swi
[10], True
);
106 WMMapSubwidgets(panel
->box
);
107 WMSetScrollViewContentView(sv
, WMWidgetView(f
));
108 WMRealizeWidget(panel
->box
);
113 static void storeDefaults(_Panel
* panel
)
115 WMUserDefaults
*udb
= WMGetStandardUserDefaults();
117 SetBoolForKey(WMGetButtonSelected(panel
->swi
[0]), "DisableMiniwindows");
119 WMSetUDBoolForKey(udb
, WMGetButtonSelected(panel
->swi
[1]), "NoXSetStuff");
121 SetBoolForKey(WMGetButtonSelected(panel
->swi
[2]), "SaveSessionOnExit");
122 SetBoolForKey(WMGetButtonSelected(panel
->swi
[3]), "UseSaveUnders");
123 SetBoolForKey(WMGetButtonSelected(panel
->swi
[4]), "DontConfirmKill");
124 SetBoolForKey(WMGetButtonSelected(panel
->swi
[5]), "DisableBlinking");
125 SetBoolForKey(WMGetButtonSelected(panel
->swi
[6]), "AntialiasedText");
126 SetBoolForKey(WMGetButtonSelected(panel
->swi
[7]), "SingleClickLaunch");
127 SetBoolForKey(WMGetButtonSelected(panel
->swi
[8]), "CycleActiveHeadOnly");
128 SetBoolForKey(WMGetButtonSelected(panel
->swi
[9]), "ShowClipTitle");
129 SetBoolForKey(WMGetButtonSelected(panel
->swi
[10]), "BounceAppIconsWhenUrgent");
130 SetBoolForKey(WMGetButtonSelected(panel
->swi
[11]), "RaiseAppIconsWhenBouncing");
131 SetBoolForKey(WMGetButtonSelected(panel
->swi
[12]), "OpaqueMoveResizeKeyboard");
134 Panel
*InitExpert(WMScreen
* scr
, WMWidget
* parent
)
138 panel
= wmalloc(sizeof(_Panel
));
139 memset(panel
, 0, sizeof(_Panel
));
141 panel
->sectionName
= _("Expert User Preferences");
143 panel
->description
= _("Options for people who know what they're doing...\n"
144 "Also have some other misc. options.");
146 panel
->parent
= parent
;
148 panel
->callbacks
.createWidgets
= createPanel
;
149 panel
->callbacks
.updateDomain
= storeDefaults
;
151 AddSection(panel
, ICON_FILE
);