changed indentation to use spaces only
[wmaker-crm.git] / WPrefs.app / KeyboardSettings.c
blob5f46ec2906335a5b27ffb23a653d46737397187d
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
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 * USA.
24 #include "WPrefs.h"
26 typedef struct _Panel {
27 WMBox *box;
29 char *sectionName;
31 char *description;
33 CallbackRec callbacks;
35 WMWidget *parent;
37 WMFrame *delaF;
38 WMButton *delaB[4];
39 WMLabel *dmsL;
40 WMTextField *dmsT;
42 WMFrame *rateF;
43 WMButton *rateB[4];
44 WMLabel *rmsL;
45 WMTextField *rmsT;
47 WMTextField *testT;
48 } _Panel;
51 #define ICON_FILE "keyboard"
54 static void
55 createPanel(Panel *p)
57 _Panel *panel = (_Panel*)p;
58 WMScreen *scr = WMWidgetScreen(panel->parent);
59 int i;
60 WMColor *color;
61 WMFont *font;
63 color = WMDarkGrayColor(scr);
64 font = WMSystemFontOfSize(scr, 10);
66 panel->box = WMCreateBox(panel->parent);
67 WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
69 /**************** Initial Key Repeat ***************/
70 panel->delaF = WMCreateFrame(panel->box);
71 WMResizeWidget(panel->delaF, 495, 60);
72 WMMoveWidget(panel->delaF, 15, 10);
73 WMSetFrameTitle(panel->delaF, _("Initial Key Repeat"));
75 for (i = 0; i < 4; i++) {
76 panel->delaB[i] = WMCreateButton(panel->delaF, WBTOnOff);
77 WMResizeWidget(panel->delaB[i], 60, 20);
78 WMMoveWidget(panel->delaB[i], 70+i*60, 25);
79 if (i>0)
80 WMGroupButtons(panel->delaB[0], panel->delaB[i]);
81 switch (i) {
82 case 0:
83 WMSetButtonText(panel->delaB[i], "....a");
84 break;
85 case 1:
86 WMSetButtonText(panel->delaB[i], "...a");
87 break;
88 case 2:
89 WMSetButtonText(panel->delaB[i], "..a");
90 break;
91 case 3:
92 WMSetButtonText(panel->delaB[i], ".a");
93 break;
96 panel->dmsT = WMCreateTextField(panel->delaF);
97 WMResizeWidget(panel->dmsT, 50, 20);
98 WMMoveWidget(panel->dmsT, 345, 25);
99 /* WMSetTextFieldAlignment(panel->dmsT, WARight);*/
101 panel->dmsL = WMCreateLabel(panel->delaF);
102 WMResizeWidget(panel->dmsL, 30, 16);
103 WMMoveWidget(panel->dmsL, 400, 30);
104 WMSetLabelTextColor(panel->dmsL, color);
105 WMSetLabelFont(panel->dmsL, font);
106 WMSetLabelText(panel->dmsL, "msec");
108 WMMapSubwidgets(panel->delaF);
110 /**************** Key Repeat Rate ***************/
111 panel->rateF = WMCreateFrame(panel->box);
112 WMResizeWidget(panel->rateF, 495, 60);
113 WMMoveWidget(panel->rateF, 15, 95);
114 WMSetFrameTitle(panel->rateF, _("Key Repeat Rate"));
116 for (i = 0; i < 4; i++) {
117 panel->rateB[i] = WMCreateButton(panel->rateF, WBTOnOff);
118 WMResizeWidget(panel->rateB[i], 60, 20);
119 WMMoveWidget(panel->rateB[i], 70+i*60, 25);
120 if (i>0)
121 WMGroupButtons(panel->rateB[0], panel->rateB[i]);
122 switch (i) {
123 case 0:
124 WMSetButtonText(panel->rateB[i], "a....a");
125 break;
126 case 1:
127 WMSetButtonText(panel->rateB[i], "a...a");
128 break;
129 case 2:
130 WMSetButtonText(panel->rateB[i], "a..a");
131 break;
132 case 3:
133 WMSetButtonText(panel->rateB[i], "a.a");
134 break;
137 panel->rmsT = WMCreateTextField(panel->rateF);
138 WMResizeWidget(panel->rmsT, 50, 20);
139 WMMoveWidget(panel->rmsT, 345, 25);
140 /* WMSetTextFieldAlignment(panel->rmsT, WARight);*/
142 panel->rmsL = WMCreateLabel(panel->rateF);
143 WMResizeWidget(panel->rmsL, 30, 16);
144 WMMoveWidget(panel->rmsL, 400, 30);
145 WMSetLabelTextColor(panel->rmsL, color);
146 WMSetLabelFont(panel->rmsL, font);
147 WMSetLabelText(panel->rmsL, "msec");
149 WMMapSubwidgets(panel->rateF);
151 panel->testT = WMCreateTextField(panel->box);
152 WMResizeWidget(panel->testT, 480, 20);
153 WMMoveWidget(panel->testT, 20, 180);
154 WMSetTextFieldText(panel->testT, _("Type here to test"));
156 WMReleaseColor(color);
157 WMReleaseFont(font);
159 WMRealizeWidget(panel->box);
160 WMMapSubwidgets(panel->box);
165 Panel*
166 InitKeyboardSettings(WMScreen *scr, WMWidget *parent)
168 _Panel *panel;
170 panel = wmalloc(sizeof(_Panel));
171 memset(panel, 0, sizeof(_Panel));
173 panel->sectionName = _("Keyboard Preferences");
175 panel->description = _("Not done");
177 panel->parent = parent;
179 panel->callbacks.createWidgets = createPanel;
181 AddSection(panel, ICON_FILE);
183 return panel;