summaryrefslogtreecommitdiff
path: root/inputmethods/multikey
authorhash <hash>2002-08-22 16:30:01 (UTC)
committer hash <hash>2002-08-22 16:30:01 (UTC)
commit4b0db964f77e4b3caa1f95ea753c89094b86e0d6 (patch) (unidiff)
tree1be74ef5d6bf3101815b5ecdafb21c0db470715e /inputmethods/multikey
parent8503abdc93f6f3ce93cee0f1176faa919dbd04f5 (diff)
downloadopie-4b0db964f77e4b3caa1f95ea753c89094b86e0d6.zip
opie-4b0db964f77e4b3caa1f95ea753c89094b86e0d6.tar.gz
opie-4b0db964f77e4b3caa1f95ea753c89094b86e0d6.tar.bz2
xpm images now are the same color as the text
Diffstat (limited to 'inputmethods/multikey') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp19
-rw-r--r--inputmethods/multikey/keyboard.h6
2 files changed, 13 insertions, 12 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index e3d3928..3f6f73b 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -177,7 +177,7 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
177 keyWidth * defaultKeyWidth - 1, keyHeight - 1, 177 keyWidth * defaultKeyWidth - 1, keyHeight - 1,
178 pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); 178 pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor);
179 179
180 QPixmap *pix = keys->pix(row,col); 180 QImage *pix = keys->pix(row,col);
181 181
182 ushort c = keys->uni(row, col); 182 ushort c = keys->uni(row, col);
183 183
@@ -195,7 +195,7 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
195 } 195 }
196 else 196 else
197 // center the image in the middle of the key 197 // center the image in the middle of the key
198 p.drawPixmap( x + (defaultKeyWidth * keyWidth - pix->width())/2, 198 p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2,
199 y + (keyHeight - pix->height())/2 + 1, 199 y + (keyHeight - pix->height())/2 + 1,
200 *pix ); 200 *pix );
201 201
@@ -219,7 +219,7 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
219 219
220 for (int col = 0; col < keys->numKeys(row); col++) { 220 for (int col = 0; col < keys->numKeys(row); col++) {
221 221
222 QPixmap *pix = keys->pix(row, col); 222 QImage *pix = keys->pix(row, col);
223 int keyWidth = keys->width(row, col); 223 int keyWidth = keys->width(row, col);
224 224
225 225
@@ -244,9 +244,10 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
244 } 244 }
245 else { 245 else {
246 // center the image in the middle of the key 246 // center the image in the middle of the key
247 p.drawPixmap( x + (keyWidthPix - pix->width())/2, 247 pix->setColor(1, textcolor.rgb());
248 p.drawImage( x + (keyWidthPix - pix->width())/2,
248 y + (keyHeight - pix->height())/2 + 1, 249 y + (keyHeight - pix->height())/2 + 1,
249 QPixmap(*pix) ); 250 QImage(*pix) );
250 } 251 }
251 252
252 p.setPen(keycolor_lines); 253 p.setPen(keycolor_lines);
@@ -1044,7 +1045,7 @@ void Keys::setKeysFromFile(const char * filename) {
1044 QString buf; 1045 QString buf;
1045 QString comment; 1046 QString comment;
1046 char * xpm[256]; //couldnt be larger than that... could it? 1047 char * xpm[256]; //couldnt be larger than that... could it?
1047 QPixmap *xpm2pix = 0; 1048 QImage *xpm2pix = 0;
1048 1049
1049 buf = t.readLine(); 1050 buf = t.readLine();
1050 while (buf) { 1051 while (buf) {
@@ -1090,7 +1091,7 @@ void Keys::setKeysFromFile(const char * filename) {
1090 } 1091 }
1091 if (xpmLineCount) { 1092 if (xpmLineCount) {
1092 1093
1093 xpm2pix = new QPixmap((const char **)xpm); 1094 xpm2pix = new QImage((const char **)xpm);
1094 for (int i = 0; i < xpmLineCount; i++) 1095 for (int i = 0; i < xpmLineCount; i++)
1095 1096
1096 delete [] (xpm[i]); 1097 delete [] (xpm[i]);
@@ -1159,7 +1160,7 @@ void Keys::setKeysFromFile(const char * filename) {
1159 1160
1160// Keys::setKey {{{2 1161// Keys::setKey {{{2
1161void Keys::setKey(const int row, const int qcode, const ushort unicode, 1162void Keys::setKey(const int row, const int qcode, const ushort unicode,
1162 const int width, QPixmap *pix) { 1163 const int width, QImage *pix) {
1163 1164
1164 Key * key; 1165 Key * key;
1165 key = new Key; 1166 key = new Key;
@@ -1216,7 +1217,7 @@ int Keys::qcode(const int row, const int col) {
1216 return keys[row].at(col)->qcode; 1217 return keys[row].at(col)->qcode;
1217} 1218}
1218 1219
1219QPixmap *Keys::pix(const int row, const int col) { 1220QImage *Keys::pix(const int row, const int col) {
1220 1221
1221 return keys[row].at(col)->pix; 1222 return keys[row].at(col)->pix;
1222 1223
diff --git a/inputmethods/multikey/keyboard.h b/inputmethods/multikey/keyboard.h
index b692975..1aa7a35 100644
--- a/inputmethods/multikey/keyboard.h
+++ b/inputmethods/multikey/keyboard.h
@@ -63,11 +63,11 @@ public:
63 bool *pressedPtr(const int row, const int col); 63 bool *pressedPtr(const int row, const int col);
64 ushort shift(const ushort); 64 ushort shift(const ushort);
65 ushort meta(const ushort); 65 ushort meta(const ushort);
66 QPixmap *pix(const int row, const int col); 66 QImage *pix(const int row, const int col);
67 int numKeys(const int row); 67 int numKeys(const int row);
68 void setKeysFromFile(const char *filename); 68 void setKeysFromFile(const char *filename);
69 void setKey(const int row, const int qcode, const ushort unicode, 69 void setKey(const int row, const int qcode, const ushort unicode,
70 const int width, QPixmap *pix); 70 const int width, QImage *pix);
71 void setPressed(const int row, const int col, const bool pressed); 71 void setPressed(const int row, const int col, const bool pressed);
72 QString lang; 72 QString lang;
73 QString label; 73 QString label;
@@ -81,7 +81,7 @@ private:
81 81
82 // only needed for keys like ctrl that can have multiple keys pressed at once 82 // only needed for keys like ctrl that can have multiple keys pressed at once
83 bool *pressed; 83 bool *pressed;
84 QPixmap *pix; 84 QImage *pix;
85 }; 85 };
86 86
87 QList<Key> keys[6]; 87 QList<Key> keys[6];