summaryrefslogtreecommitdiff
path: root/inputmethods/kjumpx/keyboard.cpp
Side-by-side diff
Diffstat (limited to 'inputmethods/kjumpx/keyboard.cpp') (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/kjumpx/keyboard.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/inputmethods/kjumpx/keyboard.cpp b/inputmethods/kjumpx/keyboard.cpp
index dc44805..4e99f40 100644
--- a/inputmethods/kjumpx/keyboard.cpp
+++ b/inputmethods/kjumpx/keyboard.cpp
@@ -1,38 +1,38 @@
/**************************************************************************************94x78**
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
*********************************************************************************************/
#include "keyboard.h"
-#include <qpe/resource.h>
+#include <opie2/oresource.h>
//#include <iostream.h>
static const int autorepeatDelaytime = 500; // ms
static const int autorepeatRate = 20; // chars per second
static const int mod1x1 = 0;
static const int mod1x2 = 23;
static const int mod1w = mod1x2 - mod1x1;
static const int letterx1 = 27;
static const int letterx2 = 129;
static const int letterw = 17;
static const int letterh = 14;
static const int num1x1 = 130;
static const int num1x2 = 137;
static const int num1w = num1x2 - num1x1;
static const int specialx1 = 138;
static const int specialx2 = 170;
static const int specialw = 16;
@@ -132,67 +132,67 @@ static const mapElement mod2Map[] = {
{ myParenID, 0 },
};
static const int cursorMap[][2] = {
{ Qt::Key_Home, Qt::Key_PageUp },
{ Qt::Key_End, Qt::Key_PageDown },
{ Qt::Key_Up, Qt::Key_Up },
{ Qt::Key_Left, Qt::Key_Right },
{ Qt::Key_Down, Qt::Key_Down },
};
using namespace KJumpX;
Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) :
QFrame(parent, name, f),
shift(0), paren(0), ctrl(0), alt(0), lang(1), lastKey(0),
pressedKeyUnicode(0), pressedKeyQcode(0), pressedMod(0),
isnoncont(false),
slideKeyUnicodeH(0), slideKeyQcodeH(0), slideKeyUnicodeV(0), slideKeyQcodeV(0),
enableMouseTracking(false), slidePix(NULL), slidePixH(NULL), slidePixV(NULL),
releasedPix(NULL), pressedPix(NULL)
{
//setPalette(QPalette(QColor(240,240,230))); // Beige!
- releasedPlain = releasedShift = releasedParen = Resource::loadPixmap("kjumpx/released");
- pressedPlain = pressedShift = pressedParen = Resource::loadPixmap("kjumpx/pressed");
- pressedDigit = Resource::loadPixmap("kjumpx/pressed");
+ releasedPlain = releasedShift = releasedParen = Opie::Core::OResource::loadPixmap("kjumpx/released");
+ pressedPlain = pressedShift = pressedParen = Opie::Core::OResource::loadPixmap("kjumpx/pressed");
+ pressedDigit = Opie::Core::OResource::loadPixmap("kjumpx/pressed");
QPixmap tmp;
- tmp = Resource::loadPixmap("kjumpx/releasedShift");
+ tmp = Opie::Core::OResource::loadPixmap("kjumpx/releasedShift");
bitBlt(&releasedShift, letterx1, 0, &tmp);
- tmp = Resource::loadPixmap("kjumpx/releasedParen");
+ tmp = Opie::Core::OResource::loadPixmap("kjumpx/releasedParen");
bitBlt(&releasedParen, specialx1, 0, &tmp);
- tmp = Resource::loadPixmap("kjumpx/pressedShift");
+ tmp = Opie::Core::OResource::loadPixmap("kjumpx/pressedShift");
bitBlt(&pressedShift, letterx1, 0, &tmp);
- tmp = Resource::loadPixmap("kjumpx/pressedParen");
+ tmp = Opie::Core::OResource::loadPixmap("kjumpx/pressedParen");
bitBlt(&pressedParen, specialx1, 0, &tmp);
- tmp = Resource::loadPixmap("kjumpx/pressedDigit");
+ tmp = Opie::Core::OResource::loadPixmap("kjumpx/pressedDigit");
bitBlt(&pressedDigit, specialx1, 0, &tmp);
offscreen = QPixmap( releasedPlain );
releasedPix = &releasedPlain;
pressedPix = &pressedPlain;
slidePix = &pressedPlain;
delayTimer = new QTimer(this);
rateTimer = new QTimer(this);
connect( delayTimer, SIGNAL( timeout() ), this, SLOT( delayTimerDone() ) );
connect( rateTimer, SIGNAL( timeout() ), this, SLOT( rateTimerDone() ) );
}
void Keyboard::resizeEvent(QResizeEvent*)
{
//cout << "resizeEvent()" << endl;
}
void Keyboard::paintEvent(QPaintEvent*)
{
bitBlt(this, 0, 0, &offscreen);
}
@@ -543,137 +543,137 @@ QSize Keyboard::sizeHint() const
{
return offscreen.size();
}
void Keyboard::resetState()
{
//cout << "resetState()" << endl;
}
/*
*
* TODO
* one major problem with this implementation is that you can't move the
* cursor after inputing korean chars, otherwise it will eat up and replace
* the char before the cursor you move to. fix that
*
* make a kor/eng swaping key
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* how korean input works
*
* all following chars means unicode char value and are in hex
*
- * ÃÊÀ½ = schar (start char)
- * ÁßÀ½ = mchar (middle char)
- * ³¡À½ = echar (end char)
+ * �= = schar (start char)
+ * �= = mchar (middle char)
+ * = = echar (end char)
*
* there are 19 schars. unicode position is at 1100 - 1112
* there are 21 mchars. unicode position is at 1161 - 1175
* there are 27 echars. unicode position is at 11a8 - 11c2
*
* the map with everything combined is at ac00 - d7a3
*
* to find a combination of schar + mchar in the map, lookup
* ((schar - 0x1100) * 587) + ((mchar - 0x1161) * 27) + (echar - 0x11a8) + 0xac00)
*
*/
QChar Keyboard::parseKoreanInput (ushort c) {
static ushort schar, mchar, echar;
if ((lastKey < 0x1100 || 0x11c2 < lastKey) && (lastKey < 0xac00 || 0xd7a3 < lastKey)
&& !(lastKey == 0 && (shift || paren || ctrl || alt))) {
//printf ("reset...\n");
schar = 0, mchar = 0, echar = 0;
}
//printf ("in %x %x %x %x %x\n", schar, mchar, echar, c, lastKey);
if ( 0x1100 <= c && c <= 0x1112 ) { // schar or echar was input
if (schar == 0 || (schar != 0 && mchar == 0)) {
schar = c; mchar = 0; echar = 0;
return QChar(c);
}
else if (mchar != 0) {
if (echar == 0) {
if (!(echar = constoe(c))) {
schar = c; mchar = 0; echar = 0;
return QChar(c);
}
}
else { // must figure out what the echar is
- if (echar == 0x11a8) { // ¤¡
+ if (echar == 0x11a8) { //
- if (c == 0x1100) echar = 0x11a9; // ¤¡ + ¤¡
- else if (c == 0x1109) echar = 0x11aa; // ¤¡ + ¤µ
+ if (c == 0x1100) echar = 0x11a9; // +
+ else if (c == 0x1109) echar = 0x11aa; // +
else {
schar = c; mchar = 0; echar = 0;
return QChar(c);
}
- } else if (echar == 0x11ab) { // ¤¤
+ } else if (echar == 0x11ab) { //
- if (c == 0x110c) echar = 0x11ac; // ¤¤ + ¤¸
- else if (c == 0x1112) echar = 0x11ad; // ¤¤ + ¤¾
+ if (c == 0x110c) echar = 0x11ac; // +
+ else if (c == 0x1112) echar = 0x11ad; // +
else {
schar = c; mchar = 0; echar = 0;
return QChar(c);
}
- } else if (echar == 0x11af) { // ¤©
+ } else if (echar == 0x11af) { //
- if (c == 0x1100) echar = 0x11b0; // ¤© + ¤¡
- else if (c == 0x1106) echar = 0x11b1; // ¤© + ¤±
- else if (c == 0x1107) echar = 0x11b2; // ¤© + ¤²
- else if (c == 0x1109) echar = 0x11b3; // ¤© + ¤µ
- else if (c == 0x1110) echar = 0x11b4; // ¤© + ¤¼
- else if (c == 0x1111) echar = 0x11b5; // ¤© + ¤½
- else if (c == 0x1112) echar = 0x11b6; // ¤© + ¤¾
+ if (c == 0x1100) echar = 0x11b0; // +
+ else if (c == 0x1106) echar = 0x11b1; // +
+ else if (c == 0x1107) echar = 0x11b2; // +
+ else if (c == 0x1109) echar = 0x11b3; // +
+ else if (c == 0x1110) echar = 0x11b4; // +
+ else if (c == 0x1111) echar = 0x11b5; // +
+ else if (c == 0x1112) echar = 0x11b6; // +
else {
schar = c; mchar = 0; echar = 0;
return QChar(c);
}
- } else if (echar == 0x11b8) { // ¤²
+ } else if (echar == 0x11b8) { //
- if (c == 0x1109) echar = 0x11b9; // ¤² + ¤µ
+ if (c == 0x1109) echar = 0x11b9; // +
else {
schar = c; mchar = 0; echar = 0;
return QChar(c);
}
- } else if (echar == 0x11ba) { // ¤µ
+ } else if (echar == 0x11ba) { //
- if (c == 0x1109) echar = 0x11bb; // ¤µ + ¤µ
+ if (c == 0x1109) echar = 0x11bb; // +
else {
schar = c; mchar = 0; echar = 0;
return QChar(c);
}
} else { // if any other char, cannot combine chars
schar = c; mchar = 0; echar = 0;
return QChar(c);
}
lastKey = echar;
}
}
}
else if (0x1161 <= c && c <= 0x1175) { // mchar was input
if (schar != 0 && mchar == 0) { mchar = c; }
else if (schar != 0 && mchar != 0 && echar == 0) {
switch (mchar) {
case 0x1169: