Diffstat (limited to 'inputmethods/dvorak/dvorak.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | inputmethods/dvorak/dvorak.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/inputmethods/dvorak/dvorak.cpp b/inputmethods/dvorak/dvorak.cpp index 97afa0a..2137f22 100644 --- a/inputmethods/dvorak/dvorak.cpp +++ b/inputmethods/dvorak/dvorak.cpp | |||
@@ -1,196 +1,196 @@ | |||
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 "dvorak.h" | 21 | #include "dvorak.h" |
22 | 22 | ||
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | 24 | ||
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 | 31 | ||
32 | #define USE_SMALL_BACKSPACE | 32 | #define USE_SMALL_BACKSPACE |
33 | 33 | ||
34 | using namespace Dvorak; | 34 | using namespace Dvorak; |
35 | 35 | ||
36 | Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : | 36 | Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : |
37 | QFrame(parent, name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), | 37 | QFrame(parent, name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), |
38 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), | 38 | alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), |
39 | unicode(-1), qkeycode(0), modifiers(0) | 39 | unicode(-1), qkeycode(0), modifiers(0) |
40 | { | 40 | { |
41 | // setPalette(QPalette(QColor(240,240,230))); // Beige! | 41 | // setPalette(QPalette(QColor(240,240,230))); // Beige! |
42 | // setFont( QFont( "Helvetica", 8 ) ); | 42 | // setFont( QFont( "Helvetica", 8 ) ); |
43 | // setPalette(QPalette(QColor(200,200,200))); // Gray | 43 | // setPalette(QPalette(QColor(200,200,200))); // Gray |
44 | setPalette(QPalette(QColor(220,220,220))); // Gray | 44 | setPalette(QPalette(QColor(220,220,220))); // Gray |
45 | 45 | ||
46 | picks = new KeyboardPicks( this ); | 46 | picks = new KeyboardPicks( this ); |
47 | picks->setFont( QFont( "smallsmooth", 9 ) ); | 47 | picks->setFont( QFont( "smallsmooth", 9 ) ); |
48 | setFont( QFont( "smallsmooth", 9 ) ); | 48 | setFont( QFont( "smallsmooth", 9 ) ); |
49 | picks->initialise(); | 49 | picks->initialise(); |
50 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), | 50 | QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), |
51 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); | 51 | this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); |
52 | 52 | ||
53 | repeatTimer = new QTimer( this ); | 53 | repeatTimer = new QTimer( this ); |
54 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); | 54 | connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); |
55 | } | 55 | } |
56 | 56 | ||
57 | void Keyboard::resizeEvent(QResizeEvent*) | 57 | void Keyboard::resizeEvent(QResizeEvent*) |
58 | { | 58 | { |
59 | int ph = picks->sizeHint().height(); | 59 | int ph = picks->sizeHint().height(); |
60 | picks->setGeometry( 0, 0, width(), ph ); | 60 | picks->setGeometry( 0, 0, width(), ph ); |
61 | keyHeight = (height()-ph)/5; | 61 | keyHeight = (height()-ph)/5; |
62 | int nk; | 62 | int nk; |
63 | if ( useOptiKeys ) { | 63 | if ( useOptiKeys ) { |
64 | nk = 15; | 64 | nk = 15; |
65 | } else if ( useLargeKeys ) { | 65 | } else if ( useLargeKeys ) { |
66 | nk = 15; | 66 | nk = 15; |
67 | } else { | 67 | } else { |
68 | nk = 19; | 68 | nk = 19; |
69 | } | 69 | } |
70 | defaultKeyWidth = width()/nk; | 70 | defaultKeyWidth = width()/nk; |
71 | xoffs = (width()-defaultKeyWidth*nk)/2; | 71 | xoffs = (width()-defaultKeyWidth*nk)/2; |
72 | } | 72 | } |
73 | 73 | ||
74 | void KeyboardPicks::initialise() | 74 | void KeyboardPicks::initialise() |
75 | { | 75 | { |
76 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 76 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
77 | mode = 0; | 77 | mode = 0; |
78 | dc = new KeyboardConfig(this); | 78 | dc = new KeyboardConfig(this); |
79 | configs.append(dc); | 79 | configs.append(dc); |
80 | } | 80 | } |
81 | 81 | ||
82 | QSize KeyboardPicks::sizeHint() const | 82 | QSize KeyboardPicks::sizeHint() const |
83 | { | 83 | { |
84 | return QSize(240,fontMetrics().lineSpacing()); | 84 | return QSize(240,fontMetrics().lineSpacing()); |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | void KeyboardConfig::generateText(const QString &s) | 88 | void KeyboardConfig::generateText(const QString &s) |
89 | { | 89 | { |
90 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 90 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
91 | for (int i=0; i<(int)backspaces; i++) { | 91 | for (int i=0; i<(int)backspaces; i++) { |
92 | parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); | 92 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); |
93 | parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); | 93 | parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); |
94 | } | 94 | } |
95 | for (int i=0; i<(int)s.length(); i++) { | 95 | for (int i=0; i<(int)s.length(); i++) { |
96 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); | 96 | parent->emitKey( s[i].unicode(), 0, 0, true, false ); |
97 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); | 97 | parent->emitKey( s[i].unicode(), 0, 0, false, false ); |
98 | } | 98 | } |
99 | parent->emitKey( 0, Qt::Key_Space, 0, true, false ); | 99 | parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); |
100 | parent->emitKey( 0, Qt::Key_Space, 0, false, false ); | 100 | parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); |
101 | backspaces = 0; | 101 | backspaces = 0; |
102 | #endif | 102 | #endif |
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | //PC keyboard layout and scancodes | 106 | //PC keyboard layout and scancodes |
107 | 107 | ||
108 | /* | 108 | /* |
109 | Format: length, code, length, code, ..., 0 | 109 | Format: length, code, length, code, ..., 0 |
110 | 110 | ||
111 | length is measured in half the width of a standard key. | 111 | length is measured in half the width of a standard key. |
112 | If code < 0x80 we have length/2 consecutive standard keys, | 112 | If code < 0x80 we have length/2 consecutive standard keys, |
113 | starting with scancode code. | 113 | starting with scancode code. |
114 | 114 | ||
115 | Special keys are hardcoded, one at a time, with length of key | 115 | Special keys are hardcoded, one at a time, with length of key |
116 | and code >= 0x80, these are NOT standard PC scancodes, but are looked | 116 | and code >= 0x80, these are NOT standard PC scancodes, but are looked |
117 | up in specialM[]. (The special keys are not keymappable.) | 117 | up in specialM[]. (The special keys are not keymappable.) |
118 | 118 | ||
119 | */ | 119 | */ |
120 | 120 | ||
121 | static const uchar * const keyboard_opti[5] = { | 121 | static const uchar * const keyboard_opti[5] = { |
122 | (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", | 122 | (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", |
123 | (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", | 123 | (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", |
124 | (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", | 124 | (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", |
125 | (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", | 125 | (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", |
126 | (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" | 126 | (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" |
127 | }; | 127 | }; |
128 | 128 | ||
129 | static const uchar * const keyboard_standard[5] = { | 129 | static const uchar * const keyboard_standard[5] = { |
130 | 130 | ||
131 | #ifdef USE_SMALL_BACKSPACE | 131 | #ifdef USE_SMALL_BACKSPACE |
132 | (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", | 132 | (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", |
133 | #else | 133 | #else |
134 | (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", | 134 | (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", |
135 | #endif | 135 | #endif |
136 | //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP | 136 | //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP |
137 | 137 | ||
138 | (const uchar *const)"\003\201\002'\002,\002.\002p\002y\002f\002g\002c\002r\002l\002/\002=\002\\\001\224\002\223\002\221\002\220\002\222", | 138 | (const uchar *const)"\003\201\002'\002,\002.\002p\002y\002f\002g\002c\002r\002l\002/\002=\002\\\001\224\002\223\002\221\002\220\002\222", |
139 | //TAB + qwerty.. + backslash //+ DEL + END + PGDN | 139 | //TAB + qwerty.. + backslash //+ DEL + END + PGDN |
140 | 140 | ||
141 | (const uchar *const)"\004\202\002a\002o\002e\002u\002i\002d\002h\002t\002n\002s\002-\004\203", | 141 | (const uchar *const)"\004\202\002a\002o\002e\002u\002i\002d\002h\002t\002n\002s\002-\004\203", |
142 | //CAPS + asdf.. + RETURN | 142 | //CAPS + asdf.. + RETURN |
143 | 143 | ||
144 | (const uchar *const)"\005\204\002;\002q\002j\002k\002x\002b\002m\002w\002v\002z\005\204\002\223\002\223\002\211", | 144 | (const uchar *const)"\005\204\002;\002q\002j\002k\002x\002b\002m\002w\002v\002z\005\204\002\223\002\223\002\211", |
145 | //SHIFT + zxcv... //+ UP | 145 | //SHIFT + zxcv... //+ UP |
146 | 146 | ||
147 | (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" | 147 | (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" |
148 | //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT | 148 | //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT |
149 | 149 | ||
150 | }; | 150 | }; |
151 | 151 | ||
152 | 152 | ||
153 | struct ShiftMap { | 153 | struct ShiftMap { |
154 | char normal; | 154 | char normal; |
155 | char shifted; | 155 | char shifted; |
156 | }; | 156 | }; |
157 | 157 | ||
158 | 158 | ||
159 | static const ShiftMap shiftMap[] = { | 159 | static const ShiftMap shiftMap[] = { |
160 | { '`', '~' }, | 160 | { '`', '~' }, |
161 | { '1', '!' }, | 161 | { '1', '!' }, |
162 | { '2', '@' }, | 162 | { '2', '@' }, |
163 | { '3', '#' }, | 163 | { '3', '#' }, |
164 | { '4', '$' }, | 164 | { '4', '$' }, |
165 | { '5', '%' }, | 165 | { '5', '%' }, |
166 | { '6', '^' }, | 166 | { '6', '^' }, |
167 | { '7', '&' }, | 167 | { '7', '&' }, |
168 | { '8', '*' }, | 168 | { '8', '*' }, |
169 | { '9', '(' }, | 169 | { '9', '(' }, |
170 | { '0', ')' }, | 170 | { '0', ')' }, |
171 | { '-', '_' }, | 171 | { '-', '_' }, |
172 | { '=', '+' }, | 172 | { '=', '+' }, |
173 | { '\\', '|' }, | 173 | { '\\', '|' }, |
174 | { '[', '{' }, | 174 | { '[', '{' }, |
175 | { ']', '}' }, | 175 | { ']', '}' }, |
176 | { ';', ':' }, | 176 | { ';', ':' }, |
177 | { '\'', '"' }, | 177 | { '\'', '"' }, |
178 | { ',', '<' }, | 178 | { ',', '<' }, |
179 | { '.', '>' }, | 179 | { '.', '>' }, |
180 | { '/', '?' } | 180 | { '/', '?' } |
181 | }; | 181 | }; |
182 | 182 | ||
183 | 183 | ||
184 | /* XPM */ | 184 | /* XPM */ |
185 | static const char * const uparrow_xpm[]={ | 185 | static const char * const uparrow_xpm[]={ |
186 | "9 9 2 1", | 186 | "9 9 2 1", |
187 | "a c #000000", | 187 | "a c #000000", |
188 | ". c None", | 188 | ". c None", |
189 | ".........", | 189 | ".........", |
190 | "....a....", | 190 | "....a....", |
191 | "...aaa...", | 191 | "...aaa...", |
192 | "..aaaaa..", | 192 | "..aaaaa..", |
193 | "....a....", | 193 | "....a....", |
194 | "....a....", | 194 | "....a....", |
195 | "....a....", | 195 | "....a....", |
196 | "....a....", | 196 | "....a....", |