author | mark <mark> | 2002-02-04 22:53:18 (UTC) |
---|---|---|
committer | mark <mark> | 2002-02-04 22:53:18 (UTC) |
commit | af8212fa21bf4c747707ee314ba838b46bd8211d (patch) (side-by-side diff) | |
tree | a907a3f80615c8ee931c158bae580f5e52042e61 /inputmethods/jumpx | |
parent | 61b7a750723422ad33332cbdbcb5294cc35a6326 (diff) | |
download | opie-af8212fa21bf4c747707ee314ba838b46bd8211d.zip opie-af8212fa21bf4c747707ee314ba838b46bd8211d.tar.gz opie-af8212fa21bf4c747707ee314ba838b46bd8211d.tar.bz2 |
Importing qjumpx
-rw-r--r-- | inputmethods/jumpx/Makefile | 220 | ||||
-rw-r--r-- | inputmethods/jumpx/Makefile.in | 121 | ||||
-rw-r--r-- | inputmethods/jumpx/char10.png | bin | 0 -> 1117 bytes | |||
-rw-r--r-- | inputmethods/jumpx/char11.png | bin | 0 -> 1362 bytes | |||
-rw-r--r-- | inputmethods/jumpx/font.txt | 1 | ||||
-rw-r--r-- | inputmethods/jumpx/icon.xpm | 18 | ||||
-rw-r--r-- | inputmethods/jumpx/jumpx.pro | 12 | ||||
-rw-r--r-- | inputmethods/jumpx/keyboard.cpp | 524 | ||||
-rw-r--r-- | inputmethods/jumpx/keyboard.h | 71 | ||||
-rw-r--r-- | inputmethods/jumpx/keyboard.o | bin | 0 -> 9848 bytes | |||
-rw-r--r-- | inputmethods/jumpx/keyboardimpl.cpp | 97 | ||||
-rw-r--r-- | inputmethods/jumpx/keyboardimpl.h | 43 | ||||
-rw-r--r-- | inputmethods/jumpx/keyboardimpl.o | bin | 0 -> 4468 bytes | |||
-rw-r--r-- | inputmethods/jumpx/layout12.png | bin | 0 -> 1939 bytes | |||
-rw-r--r-- | inputmethods/jumpx/moc_keyboard.cpp | 177 | ||||
-rw-r--r-- | inputmethods/jumpx/moc_keyboard.o | bin | 0 -> 12956 bytes | |||
-rw-r--r-- | inputmethods/jumpx/opie-jumpx.control | 10 | ||||
-rwxr-xr-x | inputmethods/jumpx/opie-jumpx.postinst | 2 | ||||
-rwxr-xr-x | inputmethods/jumpx/opie-jumpx.postrm | 2 |
19 files changed, 1298 insertions, 0 deletions
diff --git a/inputmethods/jumpx/Makefile b/inputmethods/jumpx/Makefile new file mode 100644 index 0000000..e053984 --- a/dev/null +++ b/inputmethods/jumpx/Makefile @@ -0,0 +1,220 @@ +############################################################################# +# Automatically generated from Makefile.in +# Build options from +############################################################################# + +# Compiling +INTERFACE_DECL_PATH = . +SYSCONF_CXX = g++ +SYSCONF_CC = gcc +DASHCROSS = + +# Compiling with support libraries +SYSCONF_CXXFLAGS_X11 = +SYSCONF_CXXFLAGS_QT = -I$(QTDIR)/include +SYSCONF_CXXFLAGS_OPENGL = -I/usr/X11R6/include + +# Compiling YACC output +SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses + +# Linking with support libraries +SYSCONF_RPATH_X11 = +SYSCONF_RPATH_QT = -Wl,-rpath,$(QTDIR)/lib +SYSCONF_RPATH_OPENGL = -Wl,-rpath,/usr/X11R6/lib + +# Linking with support libraries +# X11 +SYSCONF_LFLAGS_X11 = +SYSCONF_LIBS_X11 = +# Qt, Qt+OpenGL +SYSCONF_LFLAGS_QT = -L$(QTDIR)/lib +SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX) +SYSCONF_LIBS_QT_OPENGL = +# OpenGL +SYSCONF_LFLAGS_OPENGL = -L/usr/X11R6/lib +SYSCONF_LIBS_OPENGL = +# Yacc +SYSCONF_LIBS_YACC = + +# Linking applications +SYSCONF_LINK = gcc +SYSCONF_LFLAGS = +SYSCONF_LIBS = + +# Link flags for shared objects +SYSCONF_LFLAGS_SHOBJ = -shared + +# Flags for threading +SYSCONF_CFLAGS_THREAD = -D_REENTRANT +SYSCONF_CXXFLAGS_THREAD = -D_REENTRANT +SYSCONF_LFLAGS_THREAD = +SYSCONF_LIBS_THREAD = -lpthread + +# Meta-object compiler +SYSCONF_MOC = $(QTDIR)/bin/moc + +# UI compiler +SYSCONF_UIC = $(QTDIR)/bin/uic + +# Linking shared libraries +# - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2 +# - Place target in $(DESTDIR) - which has a trailing / +# - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH) +# +SYSCONF_LINK_SHLIB = gcc +SYSCONF_LINK_TARGET_SHARED = lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH) +SYSCONF_LINK_LIB_SHARED = $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \ + $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \ + $(OBJECTS) $(OBJMOC) $(LIBS) && \ + mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \ + cd $(DESTDIR) && \ + rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \ + ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \ + ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \ + ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN) + +# Linking static libraries +# - Build the $(TARGET) library, eg. lib$(TARGET).a +# - Place target in $(DESTDIR) - which has a trailing / +# +SYSCONF_AR = ar cqs +SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a +SYSCONF_LINK_LIB_STATIC = rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \ + $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC) +# Compiling application source +SYSCONF_CXXFLAGS = -pipe -DQWS -fno-exceptions -fno-rtti -O2 -Wall -W +SYSCONF_CFLAGS = -pipe -O2 -Wall -W +# Default link type (static linking is still be used where required) +SYSCONF_LINK_LIB = $(SYSCONF_LINK_LIB_SHARED) +SYSCONF_LINK_TARGET = $(SYSCONF_LINK_TARGET_SHARED) +# Compiling library source +SYSCONF_CXXFLAGS_LIB = -fPIC +SYSCONF_CFLAGS_LIB = -fPIC +# Compiling shared-object source +SYSCONF_CXXFLAGS_SHOBJ = -fPIC +SYSCONF_CFLAGS_SHOBJ = -fPIC +# Linking Qt +SYSCONF_LIBS_QTLIB = $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT) +# Linking Qt applications +SYSCONF_LIBS_QTAPP = +############################################################################# + +####### Compiler, tools and options + +CXX = $(SYSCONF_CXX) $(QT_CXX_MT) +CXXFLAGS= $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) $(SYSCONF_CXXFLAGS_LIB) +CC = $(SYSCONF_CC) $(QT_C_MT) +CFLAGS = $(SYSCONF_CFLAGS) $(SYSCONF_CFLAGS_LIB) +INCPATH = -I../../include +LFLAGS = $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) +LIBS = $(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS_QTAPP) +MOC = $(SYSCONF_MOC) +UIC = $(SYSCONF_UIC) + +####### Target + +DESTDIR = ../../plugins/inputmethods/ +VER_MAJ = 1 +VER_MIN = 0 +VER_PATCH = 0 +TARGET = qjumpx +TARGET1 = lib$(TARGET).so.$(VER_MAJ) + +####### Files + +HEADERS = keyboard.h \ + keyboardimpl.h +SOURCES = keyboard.cpp \ + keyboardimpl.cpp +OBJECTS = keyboard.o \ + keyboardimpl.o +INTERFACES = +UICDECLS = +UICIMPLS = +SRCMOC = moc_keyboard.cpp +OBJMOC = moc_keyboard.o + + +####### Implicit rules + +.SUFFIXES: .cpp .cxx .cc .C .c + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< + +####### Build rules + + +all: $(DESTDIR)$(SYSCONF_LINK_TARGET) + +$(DESTDIR)$(SYSCONF_LINK_TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) + $(SYSCONF_LINK_LIB) + +moc: $(SRCMOC) + +tmake: Makefile.in + +Makefile.in: jumpx.pro + tmake jumpx.pro -o Makefile.in + +clean: + -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) + -rm -f *~ core + -rm -f allmoc.cpp + +####### Extension Modules + +listpromodules: + @echo + +listallmodules: + @echo + +listaddonpromodules: + @echo + +listaddonentmodules: + @echo + + +REQUIRES= + +####### Sub-libraries + + +###### Combined headers + + + +####### Compile + +keyboard.o: keyboard.cpp \ + keyboard.h \ + ../../include/qpe/resource.h + +keyboardimpl.o: keyboardimpl.cpp \ + keyboard.h \ + keyboardimpl.h \ + ../../include/qpe/inputmethodinterface.h \ + ../../include/qpe/qcom.h \ + ../../include/qpe/quuid.h + +moc_keyboard.o: moc_keyboard.cpp \ + keyboard.h + +moc_keyboard.cpp: keyboard.h + $(MOC) keyboard.h -o moc_keyboard.cpp + + diff --git a/inputmethods/jumpx/Makefile.in b/inputmethods/jumpx/Makefile.in new file mode 100644 index 0000000..b6347d5 --- a/dev/null +++ b/inputmethods/jumpx/Makefile.in @@ -0,0 +1,121 @@ +############################################################################# + +####### Compiler, tools and options + +CXX = $(SYSCONF_CXX) $(QT_CXX_MT) +CXXFLAGS= $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) $(SYSCONF_CXXFLAGS_LIB) +CC = $(SYSCONF_CC) $(QT_C_MT) +CFLAGS = $(SYSCONF_CFLAGS) $(SYSCONF_CFLAGS_LIB) +INCPATH = -I../../include +LFLAGS = $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT) +LIBS = $(SUBLIBS) -lqpe $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS_QTAPP) +MOC = $(SYSCONF_MOC) +UIC = $(SYSCONF_UIC) + +####### Target + +DESTDIR = ../../plugins/inputmethods/ +VER_MAJ = 1 +VER_MIN = 0 +VER_PATCH = 0 +TARGET = qjumpx +TARGET1 = lib$(TARGET).so.$(VER_MAJ) + +####### Files + +HEADERS = keyboard.h \ + keyboardimpl.h +SOURCES = keyboard.cpp \ + keyboardimpl.cpp +OBJECTS = keyboard.o \ + keyboardimpl.o +INTERFACES = +UICDECLS = +UICIMPLS = +SRCMOC = moc_keyboard.cpp +OBJMOC = moc_keyboard.o + + +####### Implicit rules + +.SUFFIXES: .cpp .cxx .cc .C .c + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< + +####### Build rules + + +all: $(DESTDIR)$(SYSCONF_LINK_TARGET) + +$(DESTDIR)$(SYSCONF_LINK_TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) + $(SYSCONF_LINK_LIB) + +moc: $(SRCMOC) + +tmake: Makefile.in + +Makefile.in: jumpx.pro + tmake jumpx.pro -o Makefile.in + +clean: + -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) + -rm -f *~ core + -rm -f allmoc.cpp + +####### Extension Modules + +listpromodules: + @echo + +listallmodules: + @echo + +listaddonpromodules: + @echo + +listaddonentmodules: + @echo + + +REQUIRES= + +####### Sub-libraries + + +###### Combined headers + + + +####### Compile + +keyboard.o: keyboard.cpp \ + keyboard.h \ + ../../include/qpe/resource.h + +keyboardimpl.o: keyboardimpl.cpp \ + keyboard.h \ + keyboardimpl.h \ + ../../include/qpe/inputmethodinterface.h \ + ../../include/qpe/qcom.h \ + ../../include/qpe/quuid.h + +moc_keyboard.o: moc_keyboard.cpp \ + keyboard.h + +moc_keyboard.cpp: keyboard.h + $(MOC) keyboard.h -o moc_keyboard.cpp + + diff --git a/inputmethods/jumpx/char10.png b/inputmethods/jumpx/char10.png Binary files differnew file mode 100644 index 0000000..f2fdefa --- a/dev/null +++ b/inputmethods/jumpx/char10.png diff --git a/inputmethods/jumpx/char11.png b/inputmethods/jumpx/char11.png Binary files differnew file mode 100644 index 0000000..df15c5f --- a/dev/null +++ b/inputmethods/jumpx/char11.png diff --git a/inputmethods/jumpx/font.txt b/inputmethods/jumpx/font.txt new file mode 100644 index 0000000..4c195f7 --- a/dev/null +++ b/inputmethods/jumpx/font.txt @@ -0,0 +1 @@ +abcdefghijklmnopqrtsuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ -+*!:'.%/$ _=#?;",|\& ()[]{}<>@~
\ No newline at end of file diff --git a/inputmethods/jumpx/icon.xpm b/inputmethods/jumpx/icon.xpm new file mode 100644 index 0000000..7ee793e --- a/dev/null +++ b/inputmethods/jumpx/icon.xpm @@ -0,0 +1,18 @@ +/* XPM */ +static char * icon_xpm[] = { +"26 13 2 1", +" c None", +". c #000000", +" ... ... ... ... ... ... ", +". . . . . . . ", +". . . . . . . ", +". . . . . . . ", +" ....... ... ... ....... ", +". . . . . ", +". . . . . ", +". . . . . ", +" ....... ... ... ....... ", +". . . . . . . ", +". . . . . . . ", +". . . . . . . ", +" ... ... ... ... ... ... "}; diff --git a/inputmethods/jumpx/jumpx.pro b/inputmethods/jumpx/jumpx.pro new file mode 100644 index 0000000..433a798 --- a/dev/null +++ b/inputmethods/jumpx/jumpx.pro @@ -0,0 +1,12 @@ +TEMPLATE = lib +CONFIG += qt warn_on release +HEADERS = keyboard.h \ + keyboardimpl.h +SOURCES = keyboard.cpp \ + keyboardimpl.cpp +TARGET = qjumpx +DESTDIR = ../../plugins/inputmethods +INCLUDEPATH += ../../include/qpe +DEPENDPATH += ../../include/qpe +LIBS += -lqpe +VERSION = 1.0.0 diff --git a/inputmethods/jumpx/keyboard.cpp b/inputmethods/jumpx/keyboard.cpp new file mode 100644 index 0000000..0b8fc14 --- a/dev/null +++ b/inputmethods/jumpx/keyboard.cpp @@ -0,0 +1,524 @@ +/**************************************************************************************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 <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; + +static const int num2x1 = 171; +static const int num2x2 = 178; +static const int num2w = num2x2 - num2x1; + +static const int mod2x1 = 179; +static const int mod2x2 = 203; +static const int mod2w = mod2x2 - mod2x1; + +static const int cursorx1 = 207; +static const int cursorw = 16; + +static const int myParenID = -10; + + +typedef struct mapElement +{ + int qcode; + ushort unicode; +}; + +static const mapElement mod1Map[] = { + { Qt::Key_Escape, 27 }, + { Qt::Key_Tab, 9 }, + { Qt::Key_Return, 13 }, + { Qt::Key_Alt, 0 }, + { Qt::Key_Control, 0 }, +}; + +static const uchar *const letterMap[] = { + (const uchar *const)"zvchwk", + (const uchar *const)"fitaly", + (const uchar *const)" ne ", + (const uchar *const)"gdorsb", + (const uchar *const)"qjumpx", +}; + +static const uchar *const letterMapShift[] = { + (const uchar *const)"ZVCHWK", + (const uchar *const)"FITALY", + (const uchar *const)" NE ", + (const uchar *const)"GDORSB", + (const uchar *const)"QJUMPX", +}; + +static const uchar *const num1Map = (const uchar *const)"12345"; + +static const uchar *const specialMap[] = { + (const uchar *const)"-+", + (const uchar *const)"*!", + (const uchar *const)",'", + (const uchar *const)".%", + (const uchar *const)"/$", +}; + +static const uchar *const specialMapShift[] = { + (const uchar *const)"_=", + (const uchar *const)"#?", + (const uchar *const)";\"", + (const uchar *const)":|", + (const uchar *const)"\\&", +}; + +static const uchar *const specialMapParen[] = { + (const uchar *const)"()", + (const uchar *const)"[]", + (const uchar *const)"{}", + (const uchar *const)"<>", + (const uchar *const)"@~", +}; + +static const uchar *const num2Map = (const uchar *const)"67890"; + +static const mapElement mod2Map[] = { + { Qt::Key_Backspace, 8 }, + { Qt::Key_Delete, 0 }, + { Qt::Key_Return, 13 }, + { Qt::Key_Shift, 0 }, + { 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 }, +}; + + +Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : + QFrame(parent, name, f), + shift(0), paren(0), ctrl(0), alt(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("jumpx/released"); + pressedPlain = pressedShift = pressedParen = Resource::loadPixmap("jumpx/pressed"); + pressedDigit = Resource::loadPixmap("jumpx/pressed"); + + QPixmap tmp; + + tmp = Resource::loadPixmap("jumpx/releasedShift"); + bitBlt(&releasedShift, letterx1, 0, &tmp); + + tmp = Resource::loadPixmap("jumpx/releasedParen"); + bitBlt(&releasedParen, specialx1, 0, &tmp); + + tmp = Resource::loadPixmap("jumpx/pressedShift"); + bitBlt(&pressedShift, letterx1, 0, &tmp); + + tmp = Resource::loadPixmap("jumpx/pressedParen"); + bitBlt(&pressedParen, specialx1, 0, &tmp); + + tmp = Resource::loadPixmap("jumpx/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); +} + +void Keyboard::mousePressEvent(QMouseEvent *e) +{ + pressedx = -1; + pressedKeyUnicode = pressedKeyQcode = pressedMod = 0; + + int x = e->x(); + int y = e->y(); + + int row = (y - 1) / letterh; + + if ( x <= mod1x2 ) // mod1 + { + pressedx = mod1x1; + pressedy = row * letterh; + pressedw = mod1w + 1; + pressedh = letterh + 1; + if ( row == 2 ) // return + { + pressed2x = mod2x1; + pressed2y = 2 * letterh; + pressed2w = mod2w + 1; + pressed2h = letterh + 1; + isnoncont = true; + } + else if ( row == 3 ) // alt + alt = 1; + else if ( row == 4 ) // ctrl + ctrl = 1; + pressedKeyUnicode = mod1Map[row].unicode; + pressedKeyQcode = mod1Map[row].qcode; + } + else if ( x >= letterx1 && x <= letterx2 ) // letter + { + int column = (x - letterx1 - 1) / letterw; + QChar temp; + if ( shift ) + temp = QChar( letterMapShift[row][column] ); + else + temp = QChar( letterMap[row][column] ); + if ( temp == ' ' ) // space + { + if ( column < 3 ) + { + pressedx = letterx1; + pressed2x = letterx1 + letterw * 4; + } + else + { + pressedx = letterx1 + letterw * 4; + pressed2x = letterx1; + } + pressedy = pressed2y = row * letterh; + pressedw = pressed2w = letterw * 2 + 1; + pressedh = pressed2h = letterh + 1; + isnoncont = true; + } + else + { + pressedx = letterx1 + column * letterw; + pressedy = row * letterh; + pressedw = letterw + 1; + pressedh = letterh + 1; + } + pressedKeyUnicode = temp.unicode(); + pressedKeyQcode = slideKeyQcodeH = slideKeyQcodeV = temp.upper().unicode(); + if ( temp == ' ' ) + { + slideKeyUnicodeH = slideKeyUnicodeV = 8; + slideKeyQcodeH = slideKeyQcodeV = Qt::Key_Backspace; + } + else if ( temp == temp.lower() ) + { + slideKeyUnicodeH = slideKeyUnicodeV = temp.upper().unicode(); + slidePixH = slidePixV = &pressedShift; + } + else + { + slideKeyUnicodeH = slideKeyUnicodeV = temp.lower().unicode(); + slidePixH = slidePixV = &pressedPlain; + } + enableMouseTracking = true; + } + else if ( x >= num1x1 && x <= num1x2 ) // num1 + { + pressedx = num1x1; + pressedy = row * letterh; + pressedw = num1w + 1; + pressedh = letterh + 1; + QChar temp = QChar( num1Map[row] ); + pressedKeyUnicode = pressedKeyQcode = temp.unicode(); + } + else if ( x >= specialx1 && x <= specialx2 ) // special + { + int column = (x - specialx1 - 1) / specialw; + pressedx = specialx1 + column * specialw; + pressedy = row * letterh; + pressedw = specialw + 1; + pressedh = letterh + 1; + QChar temp; + if ( shift ) + temp = QChar( specialMapShift[row][column] ); + else if ( paren ) + temp = QChar( specialMapParen[row][column] ); + else + temp = QChar( specialMap[row][column] ); + pressedKeyUnicode = pressedKeyQcode = temp.unicode(); + slideKeyUnicodeH = slideKeyQcodeH = slideKeyUnicodeV = slideKeyQcodeV = + QChar('0').unicode() + ( 5 * column + row + 1 ) % 10; + slidePixH = slidePixV = &pressedDigit; + if ( shift ) + { + slideKeyUnicodeV = slideKeyQcodeV = + QChar( specialMap[row][column] ).unicode(); + slidePixV = &pressedPlain; + } + else if ( !(shift || paren) ) + { + slideKeyUnicodeV = slideKeyQcodeV = + QChar( specialMapShift[row][column] ).unicode(); + slidePixV = &pressedShift; + } + enableMouseTracking = true; + } + else if ( x >= num2x1 && x <= num2x2 ) // num2 + { + pressedx = num2x1; + pressedy = row * letterh; + pressedw = num2w + 1; + pressedh = letterh + 1; + QChar temp = QChar( num2Map[row] ); + pressedKeyUnicode = pressedKeyQcode = temp.unicode(); + } + else if ( x >= mod2x1 && x <= mod2x2 ) // mod2 + { + pressedx = mod2x1; + pressedy = row * letterh; + pressedw = mod2w + 1; + pressedh = letterh + 1; + if ( row == 2 ) // return + { + pressed2x = mod1x1; + pressed2y = 2 * letterh; + pressed2w = mod2w + 1; + pressed2h = letterh + 1; + isnoncont = true; + } + pressedKeyUnicode = mod2Map[row].unicode; + pressedKeyQcode = mod2Map[row].qcode; + + if ( row == 3 ) // shift + { + paren = 0; + switch ( shift ) + { + case 0: + { + shift = 1; + releasedPix = &releasedShift; + pressedPix = &pressedShift; + bitBlt( &offscreen, 0, 0, releasedPix ); + break; + } + case 1: + { + shift = 2; + break; + } + case 2: + { + shift = 0; + releasedPix = &releasedPlain; + pressedPix = &pressedPlain; + bitBlt( &offscreen, 0, 0, releasedPix ); + break; + } + } + } + else if ( row == 4 ) // parenthesis + { + shift = 0; + switch ( paren ) + { + case 0: + { + paren = 1; + releasedPix = &releasedParen; + pressedPix = &pressedParen; + bitBlt( &offscreen, 0, 0, releasedPix ); + break; + } + case 1: + { + paren = 2; + break; + } + case 2: + { + paren = 0; + releasedPix = &releasedPlain; + pressedPix = &pressedPlain; + bitBlt( &offscreen, 0, 0, releasedPix ); + break; + } + } + } + } + else if ( x >= cursorx1 ) // cursor + { + int column = (x - cursorx1 - 1) / cursorw; + if ( row == 2 || row == 4 ) + pressedx = cursorx1 + cursorw / 2; + else + pressedx = cursorx1 + column * cursorw; + pressedy = row * letterh; + pressedw = cursorw + 1; + pressedh = letterh + 1; + pressedKeyQcode = cursorMap[row][column]; + } + + pressedMod = ( shift ? Qt::ShiftButton : 0 ) | + ( ctrl ? Qt::ControlButton : 0 ) | + ( alt ? Qt::AltButton : 0 ); + + emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false ); + delayTimer->start( autorepeatDelaytime, true ); + + if ( pressedx == -1 ) + return; + + bitBlt( &offscreen, pressedx, pressedy, + pressedPix, pressedx, pressedy, pressedw, pressedh ); + if ( isnoncont ) + bitBlt( &offscreen, pressed2x, pressed2y, + pressedPix, pressed2x, pressed2y, pressed2w, pressed2h ); + + repaint( false ); +} + +void Keyboard::mouseReleaseEvent(QMouseEvent*) +{ + //cout << pressedx << " " << pressedy << " " << pressedw << " " << pressedh << endl; + + delayTimer->stop(); + rateTimer->stop(); + enableMouseTracking = false; + + if ( pressedx == -1 ) + return; + + if ( shift == 2 && pressedKeyQcode == Qt::Key_Shift ) + return; + if ( paren == 2 && pressedKeyQcode == myParenID ) + return; + + if ( shift == 1 && pressedKeyQcode != Qt::Key_Shift ) + { + shift = 0; + releasedPix = &releasedPlain; + pressedPix = &pressedPlain; + bitBlt( &offscreen, 0, 0, releasedPix ); + } + + if ( paren == 1 && pressedKeyQcode != myParenID ) + { + paren = 0; + releasedPix = &releasedPlain; + pressedPix = &pressedPlain; + bitBlt( &offscreen, 0, 0, releasedPix ); + } + + if ( alt && pressedKeyQcode != Qt::Key_Alt ) + alt = 0; + if ( ctrl && pressedKeyQcode != Qt::Key_Control ) + ctrl = 0; + + bitBlt( &offscreen, pressedx, pressedy, + releasedPix, pressedx, pressedy, pressedw, pressedh ); + + if ( isnoncont ) + { + isnoncont = false; + bitBlt( &offscreen, pressed2x, pressed2y, + releasedPix, pressed2x, pressed2y, pressed2w, pressed2h ); + } + + repaint( false ); +} + +void Keyboard::mouseMoveEvent(QMouseEvent *e) +{ + if ( !enableMouseTracking ) + return; + + if ( e->x() < pressedx || e->x() >= pressedx + pressedw ) + { + pressedKeyUnicode = slideKeyUnicodeH; + pressedKeyQcode = slideKeyQcodeH; + slidePix = slidePixH; + } + else if ( e->y() < pressedy || e->y() >= pressedy + pressedh ) + { + pressedKeyUnicode = slideKeyUnicodeV; + pressedKeyQcode = slideKeyQcodeV; + slidePix = slidePixV; + } + else + return; + + enableMouseTracking = false; + + delayTimer->stop(); + rateTimer->stop(); + + bitBlt( &offscreen, pressedx, pressedy, + slidePix, pressedx, pressedy, pressedw, pressedh ); + + emit key( 8, Qt::Key_Backspace, pressedMod, true, false ); + emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, false ); + delayTimer->start( autorepeatDelaytime, true ); + + repaint( false ); +} + +void Keyboard::delayTimerDone() +{ + emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true ); + rateTimer->start( 1000/autorepeatRate, false ); +} + +void Keyboard::rateTimerDone() +{ + emit key( pressedKeyUnicode, pressedKeyQcode, pressedMod, true, true ); +} + +QSize Keyboard::sizeHint() const +{ + return offscreen.size(); +} + +void Keyboard::resetState() +{ + //cout << "resetState()" << endl; +} diff --git a/inputmethods/jumpx/keyboard.h b/inputmethods/jumpx/keyboard.h new file mode 100644 index 0000000..1be095d --- a/dev/null +++ b/inputmethods/jumpx/keyboard.h @@ -0,0 +1,71 @@ +/**************************************************************************************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 <qframe.h> +#include <qpixmap.h> +#include <qtimer.h> + +class Keyboard : public QFrame +{ + Q_OBJECT +public: + Keyboard( QWidget* parent=0, const char* name=0, WFlags f=0 ); + + void resetState(); + + void mousePressEvent(QMouseEvent*); + void mouseReleaseEvent(QMouseEvent*); + void mouseMoveEvent(QMouseEvent*); + void resizeEvent(QResizeEvent*); + void paintEvent(QPaintEvent* e); + //void timerEvent(QTimerEvent* e); + + QSize sizeHint() const; + +signals: + void key( ushort unicode, ushort qcode, ushort modifiers, bool, bool ); + +private slots: + void delayTimerDone(); + void rateTimerDone(); + +private: + int shift; // 0, 1, 2 + int paren; // 0, 1, 2 + int ctrl; // 0, 1 + int alt; // 0, 1 + + int pressedKeyUnicode, pressedKeyQcode, pressedMod; + int pressedx, pressedy, pressedw, pressedh; + bool isnoncont; + int pressed2x, pressed2y, pressed2w, pressed2h; + + int slideKeyUnicodeH, slideKeyQcodeH, slideKeyUnicodeV, slideKeyQcodeV; + bool enableMouseTracking; + QPixmap *slidePix, *slidePixH, *slidePixV; + + QPixmap releasedPlain; + QPixmap releasedShift; + QPixmap releasedParen; + + QPixmap pressedPlain; + QPixmap pressedShift; + QPixmap pressedParen; + QPixmap pressedDigit; + + QPixmap offscreen; + + QPixmap *releasedPix; + QPixmap *pressedPix; + + QTimer *delayTimer; + QTimer *rateTimer; +}; diff --git a/inputmethods/jumpx/keyboard.o b/inputmethods/jumpx/keyboard.o Binary files differnew file mode 100644 index 0000000..b565f09 --- a/dev/null +++ b/inputmethods/jumpx/keyboard.o diff --git a/inputmethods/jumpx/keyboardimpl.cpp b/inputmethods/jumpx/keyboardimpl.cpp new file mode 100644 index 0000000..92abb09 --- a/dev/null +++ b/inputmethods/jumpx/keyboardimpl.cpp @@ -0,0 +1,97 @@ +/**************************************************************************************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 <qapplication.h> +#include <qpixmap.h> +#include "keyboard.h" +#include "keyboardimpl.h" + +/* XPM */ +static const char * icon_xpm[] = { +"26 13 2 1", +" c None", +". c #000000", +" ... ... ... ... ... ... ", +". . . . . . . ", +". . . . . . . ", +". . . . . . . ", +" ....... ... ... ....... ", +". . . . . ", +". . . . . ", +". . . . . ", +" ....... ... ... ....... ", +". . . . . . . ", +". . . . . . . ", +". . . . . . . ", +" ... ... ... ... ... ... "}; + + +KeyboardImpl::KeyboardImpl() + : input(0), icn(0), ref(0) +{ +} + +KeyboardImpl::~KeyboardImpl() +{ + delete input; + delete icn; +} + +QWidget *KeyboardImpl::inputMethod( QWidget *parent, Qt::WFlags f ) +{ + if ( !input ) + input = new Keyboard( parent, "Keyboard", f ); + return input; +} + +void KeyboardImpl::resetState() +{ + if ( input ) + input->resetState(); +} + +QPixmap *KeyboardImpl::icon() +{ + if ( !icn ) + icn = new QPixmap( (const char **)icon_xpm ); + return icn; +} + +QString KeyboardImpl::name() +{ + return qApp->translate( "InputMethods", "JumpX" ); +} + +void KeyboardImpl::onKeyPress( QObject *receiver, const char *slot ) +{ + if ( input ) + QObject::connect( input, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot ); +} + +#ifndef QT_NO_COMPONENT +QRESULT KeyboardImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) +{ + *iface = 0; + if ( uuid == IID_QUnknown ) + *iface = this; + else if ( uuid == IID_InputMethod ) + *iface = this; + + if ( *iface ) + (*iface)->addRef(); + return QS_OK; +} + +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( KeyboardImpl ) +} +#endif diff --git a/inputmethods/jumpx/keyboardimpl.h b/inputmethods/jumpx/keyboardimpl.h new file mode 100644 index 0000000..a82ec4a --- a/dev/null +++ b/inputmethods/jumpx/keyboardimpl.h @@ -0,0 +1,43 @@ +/**************************************************************************************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. +** +*********************************************************************************************/ +#ifndef KEYBOARDIMPL_H +#define KEYBOARDIMPL_H + +#include <qpe/inputmethodinterface.h> + +class Keyboard; +class QPixmap; + +class KeyboardImpl : public InputMethodInterface +{ +public: + KeyboardImpl(); + virtual ~KeyboardImpl(); + +#ifndef QT_NO_COMPONENT + QRESULT queryInterface( const QUuid&, QUnknownInterface** ); + Q_REFCOUNT +#endif + + virtual QWidget *inputMethod( QWidget *parent, Qt::WFlags f ); + virtual void resetState(); + virtual QPixmap *icon(); + virtual QString name(); + virtual void onKeyPress( QObject *receiver, const char *slot ); + +private: + Keyboard *input; + QPixmap *icn; + ulong ref; +}; + +#endif diff --git a/inputmethods/jumpx/keyboardimpl.o b/inputmethods/jumpx/keyboardimpl.o Binary files differnew file mode 100644 index 0000000..133b8a4 --- a/dev/null +++ b/inputmethods/jumpx/keyboardimpl.o diff --git a/inputmethods/jumpx/layout12.png b/inputmethods/jumpx/layout12.png Binary files differnew file mode 100644 index 0000000..81f0ef1 --- a/dev/null +++ b/inputmethods/jumpx/layout12.png diff --git a/inputmethods/jumpx/moc_keyboard.cpp b/inputmethods/jumpx/moc_keyboard.cpp new file mode 100644 index 0000000..59d9bb3 --- a/dev/null +++ b/inputmethods/jumpx/moc_keyboard.cpp @@ -0,0 +1,177 @@ +/**************************************************************************** +** Keyboard meta object code from reading C++ file 'keyboard.h' +** +** Created: Mon Feb 4 21:38:24 2002 +** by: The Qt MOC ($Id$) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#if !defined(Q_MOC_OUTPUT_REVISION) +#define Q_MOC_OUTPUT_REVISION 9 +#elif Q_MOC_OUTPUT_REVISION != 9 +#error "Moc format conflict - please regenerate all moc files" +#endif + +#include "keyboard.h" +#include <qmetaobject.h> +#include <qapplication.h> + + + +const char *Keyboard::className() const +{ + return "Keyboard"; +} + +QMetaObject *Keyboard::metaObj = 0; + +void Keyboard::initMetaObject() +{ + if ( metaObj ) + return; + if ( qstrcmp(QFrame::className(), "QFrame") != 0 ) + badSuperclassWarning("Keyboard","QFrame"); + (void) staticMetaObject(); +} + +#ifndef QT_NO_TRANSLATION + +QString Keyboard::tr(const char* s) +{ + return qApp->translate( "Keyboard", s, 0 ); +} + +QString Keyboard::tr(const char* s, const char * c) +{ + return qApp->translate( "Keyboard", s, c ); +} + +#endif // QT_NO_TRANSLATION + +QMetaObject* Keyboard::staticMetaObject() +{ + if ( metaObj ) + return metaObj; + (void) QFrame::staticMetaObject(); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + typedef void (Keyboard::*m1_t0)(); + typedef void (QObject::*om1_t0)(); + typedef void (Keyboard::*m1_t1)(); + typedef void (QObject::*om1_t1)(); + m1_t0 v1_0 = &Keyboard::delayTimerDone; + om1_t0 ov1_0 = (om1_t0)v1_0; + m1_t1 v1_1 = &Keyboard::rateTimerDone; + om1_t1 ov1_1 = (om1_t1)v1_1; + QMetaData *slot_tbl = QMetaObject::new_metadata(2); + QMetaData::Access *slot_tbl_access = QMetaObject::new_metaaccess(2); + slot_tbl[0].name = "delayTimerDone()"; + slot_tbl[0].ptr = (QMember)ov1_0; + slot_tbl_access[0] = QMetaData::Private; + slot_tbl[1].name = "rateTimerDone()"; + slot_tbl[1].ptr = (QMember)ov1_1; + slot_tbl_access[1] = QMetaData::Private; + typedef void (Keyboard::*m2_t0)(ushort,ushort,ushort,bool,bool); + typedef void (QObject::*om2_t0)(ushort,ushort,ushort,bool,bool); + m2_t0 v2_0 = &Keyboard::key; + om2_t0 ov2_0 = (om2_t0)v2_0; + QMetaData *signal_tbl = QMetaObject::new_metadata(1); + signal_tbl[0].name = "key(ushort,ushort,ushort,bool,bool)"; + signal_tbl[0].ptr = (QMember)ov2_0; + metaObj = QMetaObject::new_metaobject( + "Keyboard", "QFrame", + slot_tbl, 2, + signal_tbl, 1, +#ifndef QT_NO_PROPERTIES + 0, 0, + 0, 0, +#endif // QT_NO_PROPERTIES + 0, 0 ); + metaObj->set_slot_access( slot_tbl_access ); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + return metaObj; +} + +#include <qobjectdefs.h> +#include <qsignalslotimp.h> + +// SIGNAL key +void Keyboard::key( ushort t0, ushort t1, ushort t2, bool t3, bool t4 ) +{ + // No builtin function for signal parameter type ushort,ushort,ushort,bool,bool + QConnectionList *clist = receivers("key(ushort,ushort,ushort,bool,bool)"); + if ( !clist || signalsBlocked() ) + return; + typedef void (QObject::*RT0)(); + typedef void (QObject::*RT1)(ushort); + typedef void (QObject::*RT2)(ushort,ushort); + typedef void (QObject::*RT3)(ushort,ushort,ushort); + typedef void (QObject::*RT4)(ushort,ushort,ushort,bool); + typedef void (QObject::*RT5)(ushort,ushort,ushort,bool,bool); + RT0 r0; + RT1 r1; + RT2 r2; + RT3 r3; + RT4 r4; + RT5 r5; + QConnectionListIt it(*clist); + QConnection *c; + QSenderObject *object; + while ( (c=it.current()) ) { + ++it; + object = (QSenderObject*)c->object(); + object->setSender( this ); + switch ( c->numArgs() ) { + case 0: +#ifdef Q_FP_CCAST_BROKEN + r0 = reinterpret_cast<RT0>(*(c->member())); +#else + r0 = (RT0)*(c->member()); +#endif + (object->*r0)(); + break; + case 1: +#ifdef Q_FP_CCAST_BROKEN + r1 = reinterpret_cast<RT1>(*(c->member())); +#else + r1 = (RT1)*(c->member()); +#endif + (object->*r1)(t0); + break; + case 2: +#ifdef Q_FP_CCAST_BROKEN + r2 = reinterpret_cast<RT2>(*(c->member())); +#else + r2 = (RT2)*(c->member()); +#endif + (object->*r2)(t0, t1); + break; + case 3: +#ifdef Q_FP_CCAST_BROKEN + r3 = reinterpret_cast<RT3>(*(c->member())); +#else + r3 = (RT3)*(c->member()); +#endif + (object->*r3)(t0, t1, t2); + break; + case 4: +#ifdef Q_FP_CCAST_BROKEN + r4 = reinterpret_cast<RT4>(*(c->member())); +#else + r4 = (RT4)*(c->member()); +#endif + (object->*r4)(t0, t1, t2, t3); + break; + case 5: +#ifdef Q_FP_CCAST_BROKEN + r5 = reinterpret_cast<RT5>(*(c->member())); +#else + r5 = (RT5)*(c->member()); +#endif + (object->*r5)(t0, t1, t2, t3, t4); + break; + } + } +} diff --git a/inputmethods/jumpx/moc_keyboard.o b/inputmethods/jumpx/moc_keyboard.o Binary files differnew file mode 100644 index 0000000..732bf7b --- a/dev/null +++ b/inputmethods/jumpx/moc_keyboard.o diff --git a/inputmethods/jumpx/opie-jumpx.control b/inputmethods/jumpx/opie-jumpx.control new file mode 100644 index 0000000..1b58924 --- a/dev/null +++ b/inputmethods/jumpx/opie-jumpx.control @@ -0,0 +1,10 @@ +Files: plugins/inputmethods/libqjumpx.so* pics/jumpx/* +Priority: optional +Section: opie/inputmethods +Maintainer: Markus Gritsch <gritsch@iue.tuwien.ac.at> +Architecture: arm +Version: $QPE_VERSION-$SUB_VERSION +Depends: opie-base ($QPE_VERSION) +License: GPL +Description: JumpX input method + Keyboard-like input method for the Opie environment. diff --git a/inputmethods/jumpx/opie-jumpx.postinst b/inputmethods/jumpx/opie-jumpx.postinst new file mode 100755 index 0000000..c254b01 --- a/dev/null +++ b/inputmethods/jumpx/opie-jumpx.postinst @@ -0,0 +1,2 @@ +#!/bin/sh +/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadInputMethods()" diff --git a/inputmethods/jumpx/opie-jumpx.postrm b/inputmethods/jumpx/opie-jumpx.postrm new file mode 100755 index 0000000..c254b01 --- a/dev/null +++ b/inputmethods/jumpx/opie-jumpx.postrm @@ -0,0 +1,2 @@ +#!/bin/sh +/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadInputMethods()" |