-rw-r--r-- | inputmethods/keyboard/keyboard.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/inputmethods/keyboard/keyboard.cpp b/inputmethods/keyboard/keyboard.cpp index fb88f2a..39d44cd 100644 --- a/inputmethods/keyboard/keyboard.cpp +++ b/inputmethods/keyboard/keyboard.cpp | |||
@@ -1,433 +1,440 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "keyboard.h" | 21 | #include "keyboard.h" |
22 | 22 | ||
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | 24 | #include <qpe/config.h> | |
25 | #include <qwindowsystem_qws.h> | 25 | #include <qwindowsystem_qws.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qfontmetrics.h> | 27 | #include <qfontmetrics.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | #include <ctype.h> | 29 | #include <ctype.h> |
30 | 30 | ||
31 | #include <sys/utsname.h> | 31 | #include <sys/utsname.h> |
32 | 32 | ||
33 | using namespace KeyboardInput; | 33 | using namespace KeyboardInput; |
34 | 34 | ||
35 | #define USE_SMALL_BACKSPACE | 35 | #define USE_SMALL_BACKSPACE |
36 | 36 | ||
37 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : | 37 | Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : |
38 | QFrame(parent, _name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), | 38 | QFrame(parent, _name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), |
39 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), | 39 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), |
40 | unicode(-1), qkeycode(0), modifiers(0) | 40 | unicode(-1), qkeycode(0), modifiers(0) |
41 | { | 41 | { |
42 | // setPalette(QPalette(QColor(240,240,230))); // Beige! | 42 | // setPalette(QPalette(QColor(240,240,230))); // Beige! |
43 | // setFont( QFont( "Helvetica", 8 ) ); | 43 | // setFont( QFont( "Helvetica", 8 ) ); |
44 | // setPalette(QPalette(QColor(200,200,200))); // Gray | 44 | // setPalette(QPalette(QColor(200,200,200))); // Gray |
45 | setPalette(QPalette(QColor(220,220,220))); // Gray | 45 | setPalette(QPalette(QColor(220,220,220))); // Gray |
46 | 46 | ||
47 | // get the default font | ||
48 | Config *config = new Config( "qpe" ); | ||
49 | config->setGroup( "Appearance" ); | ||
50 | QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); | ||
51 | int fontSize = config->readNumEntry( "FontSize", 10 ); | ||
52 | delete config; | ||
53 | |||
47 | picks = new KeyboardPicks( this ); | 54 | picks = new KeyboardPicks( this ); |
48 | picks->setFont( QFont( "smallsmooth", 9 ) ); | 55 | picks->setFont( QFont( familyStr, fontSize ) ); |
49 | setFont( QFont( "smallsmooth", 9 ) ); | 56 | setFont( QFont( familyStr, fontSize ) ); |
50 | picks->initialise(); | 57 | picks->initialise(); |
51 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 58 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
52 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 59 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
53 | 60 | ||
54 | repeatTimer = new QTimer( this ); | 61 | repeatTimer = new QTimer( this ); |
55 | 62 | ||
56 | // temporary quick and dirty fix for the "sticky keyboard bug" | 63 | // temporary quick and dirty fix for the "sticky keyboard bug" |
57 | // on ipaq. | 64 | // on ipaq. |
58 | // struct utsname name; | 65 | // struct utsname name; |
59 | // if (uname(&name) != -1) | 66 | // if (uname(&name) != -1) |
60 | // { | 67 | // { |
61 | //QString release=name.release; | 68 | //QString release=name.release; |
62 | //qWarning("System release: %s\n", name.release); | 69 | //qWarning("System release: %s\n", name.release); |
63 | //if(release.find("embedix",0,TRUE) !=-1) | 70 | //if(release.find("embedix",0,TRUE) !=-1) |
64 | // { | 71 | // { |
65 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 72 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
66 | // } | 73 | // } |
67 | // } | 74 | // } |
68 | } | 75 | } |
69 | 76 | ||
70 | void Keyboard::resizeEvent(QResizeEvent*) | 77 | void Keyboard::resizeEvent(QResizeEvent*) |
71 | { | 78 | { |
72 | int ph = picks->sizeHint().height(); | 79 | int ph = picks->sizeHint().height(); |
73 | picks->setGeometry( 0, 0, width(), ph ); | 80 | picks->setGeometry( 0, 0, width(), ph ); |
74 | keyHeight = (height()-ph)/5; | 81 | keyHeight = (height()-ph)/5; |
75 | int nk; | 82 | int nk; |
76 | if ( useOptiKeys ) { | 83 | if ( useOptiKeys ) { |
77 | nk = 15; | 84 | nk = 15; |
78 | } else if ( useLargeKeys ) { | 85 | } else if ( useLargeKeys ) { |
79 | nk = 15; | 86 | nk = 15; |
80 | } else { | 87 | } else { |
81 | nk = 19; | 88 | nk = 19; |
82 | } | 89 | } |
83 | defaultKeyWidth = width()/nk; | 90 | defaultKeyWidth = width()/nk; |
84 | xoffs = (width()-defaultKeyWidth*nk)/2; | 91 | xoffs = (width()-defaultKeyWidth*nk)/2; |
85 | } | 92 | } |
86 | 93 | ||
87 | void KeyboardPicks::initialise() | 94 | void KeyboardPicks::initialise() |
88 | { | 95 | { |
89 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 96 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
90 | mode = 0; | 97 | mode = 0; |
91 | dc = new KeyboardConfig(this); | 98 | dc = new KeyboardConfig(this); |
92 | configs.append(dc); | 99 | configs.append(dc); |
93 | } | 100 | } |
94 | 101 | ||
95 | QSize KeyboardPicks::sizeHint() const | 102 | QSize KeyboardPicks::sizeHint() const |
96 | { | 103 | { |
97 | return QSize(240,fontMetrics().lineSpacing()); | 104 | return QSize(240,fontMetrics().lineSpacing()); |
98 | } | 105 | } |
99 | 106 | ||
100 | 107 | ||
101 | void KeyboardConfig::generateText(const QString &s) | 108 | void KeyboardConfig::generateText(const QString &s) |
102 | { | 109 | { |
103 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 110 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
104 | for (int i=0; i<(int)backspaces; i++) { | 111 | for (int i=0; i<(int)backspaces; i++) { |
105 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); | 112 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); |
106 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); | 113 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); |
107 | } | 114 | } |
108 | for (int i=0; i<(int)s.length(); i++) { | 115 | for (int i=0; i<(int)s.length(); i++) { |
109 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); | 116 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); |
110 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); | 117 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); |
111 | } | 118 | } |
112 | parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); | 119 | parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); |
113 | parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); | 120 | parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); |
114 | backspaces = 0; | 121 | backspaces = 0; |
115 | #endif | 122 | #endif |
116 | } | 123 | } |
117 | 124 | ||
118 | 125 | ||
119 | //PC keyboard layout and scancodes | 126 | //PC keyboard layout and scancodes |
120 | 127 | ||
121 | /* | 128 | /* |
122 | Format: length, code, length, code, ..., 0 | 129 | Format: length, code, length, code, ..., 0 |
123 | 130 | ||
124 | length is measured in half the width of a standard key. | 131 | length is measured in half the width of a standard key. |
125 | If code < 0x80 we have length/2 consecutive standard keys, | 132 | If code < 0x80 we have length/2 consecutive standard keys, |
126 | starting with scancode code. | 133 | starting with scancode code. |
127 | 134 | ||
128 | Special keys are hardcoded, one at a time, with length of key | 135 | Special keys are hardcoded, one at a time, with length of key |
129 | and code >= 0x80, these are NOT standard PC scancodes, but are looked | 136 | and code >= 0x80, these are NOT standard PC scancodes, but are looked |
130 | up in specialM[]. (The special keys are not keymappable.) | 137 | up in specialM[]. (The special keys are not keymappable.) |
131 | 138 | ||
132 | */ | 139 | */ |
133 | 140 | ||
134 | static const uchar * const keyboard_opti[5] = { | 141 | static const uchar * const keyboard_opti[5] = { |
135 | (const uchar *const) "\001\223\003\240\002\20\002\41\002\26\002\62\002\56\002\45\002\54\003\200\001\223\002\226\002\235\002\234\002\236", | 142 | (const uchar *const) "\001\223\003\240\002\20\002\41\002\26\002\62\002\56\002\45\002\54\003\200\001\223\002\226\002\235\002\234\002\236", |
136 | (const uchar *const) "\001\223\003\201\004\207\002\30\002\24\002\43\004\207\003\203\001\223\006\002\002\065", | 143 | (const uchar *const) "\001\223\003\201\004\207\002\30\002\24\002\43\004\207\003\203\001\223\006\002\002\065", |
137 | (const uchar *const) "\001\223\003\202\002\60\002\37\002\23\002\22\002\36\002\21\002\55\003\203\001\223\006\005\002\055", | 144 | (const uchar *const) "\001\223\003\202\002\60\002\37\002\23\002\22\002\36\002\21\002\55\003\203\001\223\006\005\002\055", |
138 | (const uchar *const) "\001\223\003\205\004\207\002\27\002\61\002\40\004\207\003\204\001\223\006\010\002\014", | 145 | (const uchar *const) "\001\223\003\205\004\207\002\27\002\61\002\40\004\207\003\204\001\223\006\010\002\014", |
139 | (const uchar *const) "\001\223\003\206\002\44\002\31\002\57\002\42\002\46\002\25\002\207\003\204\001\223\002\013\002\064\002\015\002\230" | 146 | (const uchar *const) "\001\223\003\206\002\44\002\31\002\57\002\42\002\46\002\25\002\207\003\204\001\223\002\013\002\064\002\015\002\230" |
140 | }; | 147 | }; |
141 | 148 | ||
142 | 149 | ||
143 | static const uchar * const keyboard_standard[5] = { | 150 | static const uchar * const keyboard_standard[5] = { |
144 | 151 | ||
145 | #ifdef USE_SMALL_BACKSPACE | 152 | #ifdef USE_SMALL_BACKSPACE |
146 | (const uchar *const)"\002\240\002`\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\002\200\002\223\002\215\002\216\002\217", | 153 | (const uchar *const)"\002\240\002`\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\002\200\002\223\002\215\002\216\002\217", |
147 | #else | 154 | #else |
148 | (const uchar *const)"\002\051\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\004\200\002\223\002\215\002\216\002\217", | 155 | (const uchar *const)"\002\051\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\004\200\002\223\002\215\002\216\002\217", |
149 | #endif | 156 | #endif |
150 | //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP | 157 | //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP |
151 | 158 | ||
152 | (const uchar *const)"\003\201\002q\002w\002e\002r\002t\002y\002u\002i\002o\002p\002[\002]\002\\\001\224\002\223\002\221\002\220\002\222", | 159 | (const uchar *const)"\003\201\002q\002w\002e\002r\002t\002y\002u\002i\002o\002p\002[\002]\002\\\001\224\002\223\002\221\002\220\002\222", |
153 | //TAB + qwerty.. + backslash //+ DEL + END + PGDN | 160 | //TAB + qwerty.. + backslash //+ DEL + END + PGDN |
154 | 161 | ||
155 | (const uchar *const)"\004\202\002a\002s\002d\002f\002g\002h\002j\002k\002l\002;\002'\004\203", | 162 | (const uchar *const)"\004\202\002a\002s\002d\002f\002g\002h\002j\002k\002l\002;\002'\004\203", |
156 | //CAPS + asdf.. + RETURN | 163 | //CAPS + asdf.. + RETURN |
157 | 164 | ||
158 | (const uchar *const)"\005\204\002z\002x\002c\002v\002b\002n\002m\002,\002.\002/\005\204\002\223\002\223\002\211", | 165 | (const uchar *const)"\005\204\002z\002x\002c\002v\002b\002n\002m\002,\002.\002/\005\204\002\223\002\223\002\211", |
159 | //SHIFT + zxcv... //+ UP | 166 | //SHIFT + zxcv... //+ UP |
160 | 167 | ||
161 | (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" | 168 | (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" |
162 | //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT | 169 | //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT |
163 | 170 | ||
164 | }; | 171 | }; |
165 | 172 | ||
166 | 173 | ||
167 | struct ShiftMap { | 174 | struct ShiftMap { |
168 | char normal; | 175 | char normal; |
169 | char shifted; | 176 | char shifted; |
170 | }; | 177 | }; |
171 | 178 | ||
172 | 179 | ||
173 | static const ShiftMap shiftMap[] = { | 180 | static const ShiftMap shiftMap[] = { |
174 | { '`', '~' }, | 181 | { '`', '~' }, |
175 | { '1', '!' }, | 182 | { '1', '!' }, |
176 | { '2', '@' }, | 183 | { '2', '@' }, |
177 | { '3', '#' }, | 184 | { '3', '#' }, |
178 | { '4', '$' }, | 185 | { '4', '$' }, |
179 | { '5', '%' }, | 186 | { '5', '%' }, |
180 | { '6', '^' }, | 187 | { '6', '^' }, |
181 | { '7', '&' }, | 188 | { '7', '&' }, |
182 | { '8', '*' }, | 189 | { '8', '*' }, |
183 | { '9', '(' }, | 190 | { '9', '(' }, |
184 | { '0', ')' }, | 191 | { '0', ')' }, |
185 | { '-', '_' }, | 192 | { '-', '_' }, |
186 | { '=', '+' }, | 193 | { '=', '+' }, |
187 | { '\\', '|' }, | 194 | { '\\', '|' }, |
188 | { '[', '{' }, | 195 | { '[', '{' }, |
189 | { ']', '}' }, | 196 | { ']', '}' }, |
190 | { ';', ':' }, | 197 | { ';', ':' }, |
191 | { '\'', '"' }, | 198 | { '\'', '"' }, |
192 | { ',', '<' }, | 199 | { ',', '<' }, |
193 | { '.', '>' }, | 200 | { '.', '>' }, |
194 | { '/', '?' } | 201 | { '/', '?' } |
195 | }; | 202 | }; |
196 | 203 | ||
197 | 204 | ||
198 | /* XPM */ | 205 | /* XPM */ |
199 | static const char * const uparrow_xpm[]={ | 206 | static const char * const uparrow_xpm[]={ |
200 | "9 9 2 1", | 207 | "9 9 2 1", |
201 | "a c #000000", | 208 | "a c #000000", |
202 | ". c None", | 209 | ". c None", |
203 | ".........", | 210 | ".........", |
204 | "....a....", | 211 | "....a....", |
205 | "...aaa...", | 212 | "...aaa...", |
206 | "..aaaaa..", | 213 | "..aaaaa..", |
207 | "....a....", | 214 | "....a....", |
208 | "....a....", | 215 | "....a....", |
209 | "....a....", | 216 | "....a....", |
210 | "....a....", | 217 | "....a....", |
211 | "........."}; | 218 | "........."}; |
212 | /* XPM */ | 219 | /* XPM */ |
213 | static const char * const leftarrow_xpm[]={ | 220 | static const char * const leftarrow_xpm[]={ |
214 | "9 9 2 1", | 221 | "9 9 2 1", |
215 | "a c #000000", | 222 | "a c #000000", |
216 | ". c None", | 223 | ". c None", |
217 | ".........", | 224 | ".........", |
218 | ".........", | 225 | ".........", |
219 | "...a.....", | 226 | "...a.....", |
220 | "..aa.....", | 227 | "..aa.....", |
221 | ".aaaaaaa.", | 228 | ".aaaaaaa.", |
222 | "..aa.....", | 229 | "..aa.....", |
223 | "...a.....", | 230 | "...a.....", |
224 | ".........", | 231 | ".........", |
225 | "........."}; | 232 | "........."}; |
226 | /* XPM */ | 233 | /* XPM */ |
227 | static const char * const downarrow_xpm[]={ | 234 | static const char * const downarrow_xpm[]={ |
228 | "9 9 2 1", | 235 | "9 9 2 1", |
229 | "a c #000000", | 236 | "a c #000000", |
230 | ". c None", | 237 | ". c None", |
231 | ".........", | 238 | ".........", |
232 | "....a....", | 239 | "....a....", |
233 | "....a....", | 240 | "....a....", |
234 | "....a....", | 241 | "....a....", |
235 | "....a....", | 242 | "....a....", |
236 | "..aaaaa..", | 243 | "..aaaaa..", |
237 | "...aaa...", | 244 | "...aaa...", |
238 | "....a....", | 245 | "....a....", |
239 | "........."}; | 246 | "........."}; |
240 | /* XPM */ | 247 | /* XPM */ |
241 | static const char * const rightarrow_xpm[]={ | 248 | static const char * const rightarrow_xpm[]={ |
242 | "9 9 2 1", | 249 | "9 9 2 1", |
243 | "a c #000000", | 250 | "a c #000000", |
244 | ". c None", | 251 | ". c None", |
245 | ".........", | 252 | ".........", |
246 | ".........", | 253 | ".........", |
247 | ".....a...", | 254 | ".....a...", |
248 | ".....aa..", | 255 | ".....aa..", |
249 | ".aaaaaaa.", | 256 | ".aaaaaaa.", |
250 | ".....aa..", | 257 | ".....aa..", |
251 | ".....a...", | 258 | ".....a...", |
252 | ".........", | 259 | ".........", |
253 | "........."}; | 260 | "........."}; |
254 | /* XPM */ | 261 | /* XPM */ |
255 | static const char * const insert_xpm[]={ | 262 | static const char * const insert_xpm[]={ |
256 | "9 9 2 1", | 263 | "9 9 2 1", |
257 | "a c #000000", | 264 | "a c #000000", |
258 | ". c None", | 265 | ". c None", |
259 | ".........", | 266 | ".........", |
260 | "a........", | 267 | "a........", |
261 | "a.aaa.aaa", | 268 | "a.aaa.aaa", |
262 | "a.a.a.a..", | 269 | "a.a.a.a..", |
263 | "a.a.a..a.", | 270 | "a.a.a..a.", |
264 | "a.a.a...a", | 271 | "a.a.a...a", |
265 | "a.a.a.aaa", | 272 | "a.a.a.aaa", |
266 | ".........", | 273 | ".........", |
267 | "........."}; | 274 | "........."}; |
268 | /* XPM */ | 275 | /* XPM */ |
269 | static const char * const delete_xpm[]={ | 276 | static const char * const delete_xpm[]={ |
270 | "9 9 2 1", | 277 | "9 9 2 1", |
271 | "a c #000000", | 278 | "a c #000000", |
272 | ". c None", | 279 | ". c None", |
273 | ".........", | 280 | ".........", |
274 | "aa......a", | 281 | "aa......a", |
275 | "a.a.aaa.a", | 282 | "a.a.aaa.a", |
276 | "a.a.a.a.a", | 283 | "a.a.a.a.a", |
277 | "a.a.aaa.a.", | 284 | "a.a.aaa.a.", |
278 | "a.a.a...a", | 285 | "a.a.a...a", |
279 | "aaa.aaa.a", | 286 | "aaa.aaa.a", |
280 | ".........", | 287 | ".........", |
281 | "........."}; | 288 | "........."}; |
282 | /* XPM */ | 289 | /* XPM */ |
283 | static const char * const home_xpm[]={ | 290 | static const char * const home_xpm[]={ |
284 | "9 9 2 1", | 291 | "9 9 2 1", |
285 | "a c #000000", | 292 | "a c #000000", |
286 | ". c None", | 293 | ". c None", |
287 | "....a....", | 294 | "....a....", |
288 | "...a.a...", | 295 | "...a.a...", |
289 | "..a...a..", | 296 | "..a...a..", |
290 | ".a.....a.", | 297 | ".a.....a.", |
291 | "aa.aaa.aa", | 298 | "aa.aaa.aa", |
292 | ".a.a.a.a.", | 299 | ".a.a.a.a.", |
293 | ".a.a.a.a.", | 300 | ".a.a.a.a.", |
294 | ".aaaaaaa.", | 301 | ".aaaaaaa.", |
295 | "........."}; | 302 | "........."}; |
296 | /* XPM */ | 303 | /* XPM */ |
297 | static const char * const end_xpm[]={ | 304 | static const char * const end_xpm[]={ |
298 | "10 9 2 1", | 305 | "10 9 2 1", |
299 | "a c #000000", | 306 | "a c #000000", |
300 | ". c None", | 307 | ". c None", |
301 | "..........", | 308 | "..........", |
302 | "aa.......a", | 309 | "aa.......a", |
303 | "a..aaa.aaa", | 310 | "a..aaa.aaa", |
304 | "aa.a.a.a.a", | 311 | "aa.a.a.a.a", |
305 | "a..a.a.a.a", | 312 | "a..a.a.a.a", |
306 | "a..a.a.a.a", | 313 | "a..a.a.a.a", |
307 | "aa.a.a.aaa", | 314 | "aa.a.a.aaa", |
308 | "..........", | 315 | "..........", |
309 | ".........."}; | 316 | ".........."}; |
310 | /* XPM */ | 317 | /* XPM */ |
311 | static const char * const pageup_xpm[]={ | 318 | static const char * const pageup_xpm[]={ |
312 | "9 9 2 1", | 319 | "9 9 2 1", |
313 | "a c #000000", | 320 | "a c #000000", |
314 | ". c None", | 321 | ". c None", |
315 | ".aaa.aaa.", | 322 | ".aaa.aaa.", |
316 | ".a.a.a.a.", | 323 | ".a.a.a.a.", |
317 | ".aaa..aa.", | 324 | ".aaa..aa.", |
318 | ".a...aaa.", | 325 | ".a...aaa.", |
319 | ".........", | 326 | ".........", |
320 | ".a.a.aaa.", | 327 | ".a.a.aaa.", |
321 | ".a.a.a.a.", | 328 | ".a.a.a.a.", |
322 | ".aaa.aaa.", | 329 | ".aaa.aaa.", |
323 | ".....a..."}; | 330 | ".....a..."}; |
324 | /* XPM */ | 331 | /* XPM */ |
325 | static const char * const pagedown_xpm[]={ | 332 | static const char * const pagedown_xpm[]={ |
326 | "9 9 2 1", | 333 | "9 9 2 1", |
327 | "a c #000000", | 334 | "a c #000000", |
328 | ". c None", | 335 | ". c None", |
329 | ".aaa.aaa.", | 336 | ".aaa.aaa.", |
330 | ".a.a.a.a.", | 337 | ".a.a.a.a.", |
331 | ".aaa..aa.", | 338 | ".aaa..aa.", |
332 | ".a...aaa.", | 339 | ".a...aaa.", |
333 | ".........", | 340 | ".........", |
334 | "...a.....", | 341 | "...a.....", |
335 | ".aaa.aaa.", | 342 | ".aaa.aaa.", |
336 | ".a.a.a.a.", | 343 | ".a.a.a.a.", |
337 | ".aaa.a.a."}; | 344 | ".aaa.a.a."}; |
338 | /* XPM */ | 345 | /* XPM */ |
339 | static const char * const expand_xpm[]={ | 346 | static const char * const expand_xpm[]={ |
340 | "4 9 2 1", | 347 | "4 9 2 1", |
341 | "a c #408040", | 348 | "a c #408040", |
342 | ". c None", | 349 | ". c None", |
343 | "a...", | 350 | "a...", |
344 | "aa..", | 351 | "aa..", |
345 | "aaa.", | 352 | "aaa.", |
346 | "aaaa", | 353 | "aaaa", |
347 | "aaaa", | 354 | "aaaa", |
348 | "aaaa", | 355 | "aaaa", |
349 | "aaa.", | 356 | "aaa.", |
350 | "aa..", | 357 | "aa..", |
351 | "a..."}; | 358 | "a..."}; |
352 | /* XPM */ | 359 | /* XPM */ |
353 | #ifdef USE_SMALL_BACKSPACE | 360 | #ifdef USE_SMALL_BACKSPACE |
354 | static const char * const backspace_xpm[]={ | 361 | static const char * const backspace_xpm[]={ |
355 | "9 9 2 1", | 362 | "9 9 2 1", |
356 | "a c #000000", | 363 | "a c #000000", |
357 | ". c None", | 364 | ". c None", |
358 | ".........", | 365 | ".........", |
359 | ".........", | 366 | ".........", |
360 | "...a.....", | 367 | "...a.....", |
361 | "..aa.....", | 368 | "..aa.....", |
362 | ".aaaaaaaa", | 369 | ".aaaaaaaa", |
363 | "..aa.....", | 370 | "..aa.....", |
364 | "...a.....", | 371 | "...a.....", |
365 | ".........", | 372 | ".........", |
366 | "........."}; | 373 | "........."}; |
367 | #else | 374 | #else |
368 | static const char * const backspace_xpm[]={ | 375 | static const char * const backspace_xpm[]={ |
369 | "21 9 2 1", | 376 | "21 9 2 1", |
370 | "a c #000000", | 377 | "a c #000000", |
371 | ". c None", | 378 | ". c None", |
372 | ".....................", | 379 | ".....................", |
373 | ".....................", | 380 | ".....................", |
374 | ".....aaa..a..........", | 381 | ".....aaa..a..........", |
375 | ".a...a..a.a.a.aaa.aaa", | 382 | ".a...a..a.a.a.aaa.aaa", |
376 | "aaaa.aaa..aa..aa..a.a", | 383 | "aaaa.aaa..aa..aa..a.a", |
377 | ".a...a..a.aaa..aa.a.a", | 384 | ".a...a..a.aaa..aa.a.a", |
378 | ".....aaaa.a.a.aaa.aa.", | 385 | ".....aaaa.a.a.aaa.aa.", |
379 | "..................a..", | 386 | "..................a..", |
380 | "....................."}; | 387 | "....................."}; |
381 | #endif | 388 | #endif |
382 | /* XPM */ | 389 | /* XPM */ |
383 | static const char * const escape_xpm[]={ | 390 | static const char * const escape_xpm[]={ |
384 | "9 9 2 1", | 391 | "9 9 2 1", |
385 | "a c #000000", | 392 | "a c #000000", |
386 | ". c None", | 393 | ". c None", |
387 | ".........", | 394 | ".........", |
388 | ".........", | 395 | ".........", |
389 | ".aa.aa.aa", | 396 | ".aa.aa.aa", |
390 | ".a..a..a.", | 397 | ".a..a..a.", |
391 | ".aa.aa.a.", | 398 | ".aa.aa.a.", |
392 | ".a...a.a.", | 399 | ".a...a.a.", |
393 | ".aa.aa.aa", | 400 | ".aa.aa.aa", |
394 | ".........", | 401 | ".........", |
395 | "........."}; | 402 | "........."}; |
396 | 403 | ||
397 | 404 | ||
398 | enum { BSCode = 0x80, TabCode, CapsCode, RetCode, | 405 | enum { BSCode = 0x80, TabCode, CapsCode, RetCode, |
399 | ShiftCode, CtrlCode, AltCode, SpaceCode, BackSlash, | 406 | ShiftCode, CtrlCode, AltCode, SpaceCode, BackSlash, |
400 | UpCode, LeftCode, DownCode, RightCode, Blank, Expand, | 407 | UpCode, LeftCode, DownCode, RightCode, Blank, Expand, |
401 | Opti, ResetDict, | 408 | Opti, ResetDict, |
402 | Divide, Multiply, Add, Subtract, Decimal, Equal, | 409 | Divide, Multiply, Add, Subtract, Decimal, Equal, |
403 | Percent, Sqrt, Inverse, Escape }; | 410 | Percent, Sqrt, Inverse, Escape }; |
404 | 411 | ||
405 | typedef struct SpecialMap { | 412 | typedef struct SpecialMap { |
406 | int qcode; | 413 | int qcode; |
407 | ushort unicode; | 414 | ushort unicode; |
408 | const char * label; | 415 | const char * label; |
409 | const char * const * xpm; | 416 | const char * const * xpm; |
410 | }; | 417 | }; |
411 | 418 | ||
412 | 419 | ||
413 | static const SpecialMap specialM[] = { | 420 | static const SpecialMap specialM[] = { |
414 | { Qt::Key_Backspace, 8,"<", backspace_xpm }, | 421 | { Qt::Key_Backspace, 8,"<", backspace_xpm }, |
415 | { Qt::Key_Tab, 9,"Tab", NULL }, | 422 | { Qt::Key_Tab, 9,"Tab", NULL }, |
416 | { Qt::Key_CapsLock, 0,"Caps", NULL }, | 423 | { Qt::Key_CapsLock, 0,"Caps", NULL }, |
417 | { Qt::Key_Return, 13,"Ret", NULL }, | 424 | { Qt::Key_Return, 13,"Ret", NULL }, |
418 | { Qt::Key_Shift, 0,"Shift", NULL }, | 425 | { Qt::Key_Shift, 0,"Shift", NULL }, |
419 | { Qt::Key_Control, 0,"Ctrl", NULL }, | 426 | { Qt::Key_Control, 0,"Ctrl", NULL }, |
420 | { Qt::Key_Alt, 0,"Alt", NULL }, | 427 | { Qt::Key_Alt, 0,"Alt", NULL }, |
421 | { Qt::Key_Space, ' ',"", NULL }, | 428 | { Qt::Key_Space, ' ',"", NULL }, |
422 | { BackSlash, 43,"\\", NULL }, | 429 | { BackSlash, 43,"\\", NULL }, |
423 | 430 | ||
424 | // Need images? | 431 | // Need images? |
425 | { Qt::Key_Up, 0,"^", uparrow_xpm }, | 432 | { Qt::Key_Up, 0,"^", uparrow_xpm }, |
426 | { Qt::Key_Left, 0,"<", leftarrow_xpm }, | 433 | { Qt::Key_Left, 0,"<", leftarrow_xpm }, |
427 | { Qt::Key_Down, 0,"v", downarrow_xpm }, | 434 | { Qt::Key_Down, 0,"v", downarrow_xpm }, |
428 | { Qt::Key_Right, 0,">", rightarrow_xpm }, | 435 | { Qt::Key_Right, 0,">", rightarrow_xpm }, |
429 | { Qt::Key_Insert, 0,"I", insert_xpm }, | 436 | { Qt::Key_Insert, 0,"I", insert_xpm }, |
430 | { Qt::Key_Home, 0,"H", home_xpm }, | 437 | { Qt::Key_Home, 0,"H", home_xpm }, |
431 | { Qt::Key_PageUp, 0,"U", pageup_xpm }, | 438 | { Qt::Key_PageUp, 0,"U", pageup_xpm }, |
432 | { Qt::Key_End, 0,"E", end_xpm }, | 439 | { Qt::Key_End, 0,"E", end_xpm }, |
433 | { Qt::Key_Delete, 0,"X", delete_xpm }, | 440 | { Qt::Key_Delete, 0,"X", delete_xpm }, |