explicit restore to MAX_MAXIMUS instead of empty flag at handleMaximize
[wmaker-crm.git] / WPrefs.app / KeyboardSettings.c
blob3dc27ebceae97462d9a9fe694339af822eb854fd
1 /* KeyboardSettings.c- keyboard options (equivalent to xset)
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.
22 #include "WPrefs.h"
24 typedef struct _Panel {
25 WMBox *box;
27 char *sectionName;
29 char *description;
31 CallbackRec callbacks;
33 WMWidget *parent;
35 WMFrame *delaF;
36 WMButton *delaB[4];
37 WMLabel *dmsL;
38 WMTextField *dmsT;
40 WMFrame *rateF;
41 WMButton *rateB[4];
42 WMLabel *rmsL;
43 WMTextField *rmsT;
45 WMTextField *testT;
46 } _Panel;
48 #define ICON_FILE "keyboard"
50 static void createPanel(Panel * p)
52 _Panel *panel = (_Panel *) p;
53 WMScreen *scr = WMWidgetScreen(panel->parent);
54 int i;
55 WMColor *color;
56 WMFont *font;
58 color = WMDarkGrayColor(scr);
59 font = WMSystemFontOfSize(scr, 10);
61 panel->box = WMCreateBox(panel->parent);
62 WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
64 /**************** Initial Key Repeat ***************/
65 panel->delaF = WMCreateFrame(panel->box);
66 WMResizeWidget(panel->delaF, 495, 60);
67 WMMoveWidget(panel->delaF, 15, 10);
68 WMSetFrameTitle(panel->delaF, _("Initial Key Repeat"));
70 for (i = 0; i < 4; i++) {
71 panel->delaB[i] = WMCreateButton(panel->delaF, WBTOnOff);
72 WMResizeWidget(panel->delaB[i], 60, 20);
73 WMMoveWidget(panel->delaB[i], 70 + i * 60, 25);
74 if (i > 0)
75 WMGroupButtons(panel->delaB[0], panel->delaB[i]);
76 switch (i) {
77 case 0:
78 WMSetButtonText(panel->delaB[i], "....a");
79 break;
80 case 1:
81 WMSetButtonText(panel->delaB[i], "...a");
82 break;
83 case 2:
84 WMSetButtonText(panel->delaB[i], "..a");
85 break;
86 case 3:
87 WMSetButtonText(panel->delaB[i], ".a");
88 break;
91 panel->dmsT = WMCreateTextField(panel->delaF);
92 WMResizeWidget(panel->dmsT, 50, 20);
93 WMMoveWidget(panel->dmsT, 345, 25);
94 /* WMSetTextFieldAlignment(panel->dmsT, WARight); */
96 panel->dmsL = WMCreateLabel(panel->delaF);
97 WMResizeWidget(panel->dmsL, 30, 16);
98 WMMoveWidget(panel->dmsL, 400, 30);
99 WMSetLabelTextColor(panel->dmsL, color);
100 WMSetLabelFont(panel->dmsL, font);
101 WMSetLabelText(panel->dmsL, "msec");
103 WMMapSubwidgets(panel->delaF);
105 /**************** Key Repeat Rate ***************/
106 panel->rateF = WMCreateFrame(panel->box);
107 WMResizeWidget(panel->rateF, 495, 60);
108 WMMoveWidget(panel->rateF, 15, 95);
109 WMSetFrameTitle(panel->rateF, _("Key Repeat Rate"));
111 for (i = 0; i < 4; i++) {
112 panel->rateB[i] = WMCreateButton(panel->rateF, WBTOnOff);
113 WMResizeWidget(panel->rateB[i], 60, 20);
114 WMMoveWidget(panel->rateB[i], 70 + i * 60, 25);
115 if (i > 0)
116 WMGroupButtons(panel->rateB[0], panel->rateB[i]);
117 switch (i) {
118 case 0:
119 WMSetButtonText(panel->rateB[i], "a....a");
120 break;
121 case 1:
122 WMSetButtonText(panel->rateB[i], "a...a");
123 break;
124 case 2:
125 WMSetButtonText(panel->rateB[i], "a..a");
126 break;
127 case 3:
128 WMSetButtonText(panel->rateB[i], "a.a");
129 break;
132 panel->rmsT = WMCreateTextField(panel->rateF);
133 WMResizeWidget(panel->rmsT, 50, 20);
134 WMMoveWidget(panel->rmsT, 345, 25);
135 /* WMSetTextFieldAlignment(panel->rmsT, WARight); */
137 panel->rmsL = WMCreateLabel(panel->rateF);
138 WMResizeWidget(panel->rmsL, 30, 16);
139 WMMoveWidget(panel->rmsL, 400, 30);
140 WMSetLabelTextColor(panel->rmsL, color);
141 WMSetLabelFont(panel->rmsL, font);
142 WMSetLabelText(panel->rmsL, "msec");
144 WMMapSubwidgets(panel->rateF);
146 panel->testT = WMCreateTextField(panel->box);
147 WMResizeWidget(panel->testT, 480, 20);
148 WMMoveWidget(panel->testT, 20, 180);
149 WMSetTextFieldText(panel->testT, _("Type here to test"));
151 WMReleaseColor(color);
152 WMReleaseFont(font);
154 WMRealizeWidget(panel->box);
155 WMMapSubwidgets(panel->box);
158 Panel *InitKeyboardSettings(WMScreen * scr, WMWidget * parent)
160 _Panel *panel;
162 panel = wmalloc(sizeof(_Panel));
164 panel->sectionName = _("Keyboard Preferences");
166 panel->description = _("Not done");
168 panel->parent = parent;
170 panel->callbacks.createWidgets = createPanel;
172 AddSection(panel, ICON_FILE);
174 return panel;