summaryrefslogtreecommitdiff
path: root/inputmethods/pickboard
Side-by-side diff
Diffstat (limited to 'inputmethods/pickboard') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/pickboard/.cvsignore3
-rw-r--r--inputmethods/pickboard/Makefile.in147
-rw-r--r--inputmethods/pickboard/pickboard.cpp89
-rw-r--r--inputmethods/pickboard/pickboard.h43
-rw-r--r--inputmethods/pickboard/pickboard.pro12
-rw-r--r--inputmethods/pickboard/pickboardcfg.cpp731
-rw-r--r--inputmethods/pickboard/pickboardcfg.h213
-rw-r--r--inputmethods/pickboard/pickboardimpl.cpp101
-rw-r--r--inputmethods/pickboard/pickboardimpl.h51
-rw-r--r--inputmethods/pickboard/pickboardpicks.cpp418
-rw-r--r--inputmethods/pickboard/pickboardpicks.h66
-rw-r--r--inputmethods/pickboard/qpe-pickboard.control9
-rwxr-xr-xinputmethods/pickboard/qpe-pickboard.postinst2
-rwxr-xr-xinputmethods/pickboard/qpe-pickboard.postrm2
14 files changed, 1887 insertions, 0 deletions
diff --git a/inputmethods/pickboard/.cvsignore b/inputmethods/pickboard/.cvsignore
new file mode 100644
index 0000000..edfa921
--- a/dev/null
+++ b/inputmethods/pickboard/.cvsignore
@@ -0,0 +1,3 @@
+moc_*
+*.moc
+Makefile
diff --git a/inputmethods/pickboard/Makefile.in b/inputmethods/pickboard/Makefile.in
new file mode 100644
index 0000000..d72e82d
--- a/dev/null
+++ b/inputmethods/pickboard/Makefile.in
@@ -0,0 +1,147 @@
+#############################################################################
+
+####### 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$(QPEDIR)/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 = qpickboard
+TARGET1 = lib$(TARGET).so.$(VER_MAJ)
+
+####### Files
+
+HEADERS = pickboard.h \
+ pickboardcfg.h \
+ pickboardimpl.h \
+ pickboardpicks.h
+SOURCES = pickboard.cpp \
+ pickboardcfg.cpp \
+ pickboardimpl.cpp \
+ pickboardpicks.cpp
+OBJECTS = pickboard.o \
+ pickboardcfg.o \
+ pickboardimpl.o \
+ pickboardpicks.o
+INTERFACES =
+UICDECLS =
+UICIMPLS =
+SRCMOC = moc_pickboard.cpp \
+ moc_pickboardcfg.cpp \
+ moc_pickboardpicks.cpp
+OBJMOC = moc_pickboard.o \
+ moc_pickboardcfg.o \
+ moc_pickboardpicks.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:
+ tmake pickboard.pro
+
+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
+
+pickboard.o: pickboard.cpp \
+ pickboard.h \
+ pickboardpicks.h \
+ pickboardcfg.h
+
+pickboardcfg.o: pickboardcfg.cpp \
+ pickboardcfg.h \
+ pickboardpicks.h
+
+pickboardimpl.o: pickboardimpl.cpp \
+ pickboard.h \
+ pickboardimpl.h
+
+pickboardpicks.o: pickboardpicks.cpp \
+ pickboardpicks.h \
+ pickboardcfg.h
+
+moc_pickboard.o: moc_pickboard.cpp \
+ pickboard.h
+
+moc_pickboardcfg.o: moc_pickboardcfg.cpp \
+ pickboardcfg.h
+
+moc_pickboardpicks.o: moc_pickboardpicks.cpp \
+ pickboardpicks.h
+
+moc_pickboard.cpp: pickboard.h
+ $(MOC) pickboard.h -o moc_pickboard.cpp
+
+moc_pickboardcfg.cpp: pickboardcfg.h
+ $(MOC) pickboardcfg.h -o moc_pickboardcfg.cpp
+
+moc_pickboardpicks.cpp: pickboardpicks.h
+ $(MOC) pickboardpicks.h -o moc_pickboardpicks.cpp
+
+
diff --git a/inputmethods/pickboard/pickboard.cpp b/inputmethods/pickboard/pickboard.cpp
new file mode 100644
index 0000000..087144e
--- a/dev/null
+++ b/inputmethods/pickboard/pickboard.cpp
@@ -0,0 +1,89 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** 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.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include "pickboard.h"
+#include "pickboardpicks.h"
+#include "pickboardcfg.h"
+
+#include <qpe/global.h>
+
+#include <qpainter.h>
+#include <qlist.h>
+#include <qbitmap.h>
+#include <qlayout.h>
+#include <qvbox.h>
+#include <qdialog.h>
+#include <qscrollview.h>
+#include <qpopupmenu.h>
+#include <qhbuttongroup.h>
+#include <qpushbutton.h>
+#include <qmessagebox.h>
+#include <qwindowsystem_qws.h>
+
+/* XPM */
+static const char * const menu_xpm[]={
+"9 9 2 1",
+"a c #000000",
+". c None",
+".........",
+".........",
+".........",
+"....a....",
+"...aaa...",
+"..aaaaa..",
+".aaaaaaa.",
+".........",
+"........."};
+
+class PickboardPrivate {
+public:
+ PickboardPrivate(Pickboard* parent)
+ {
+ picks = new PickboardPicks(parent);
+ picks->initialise();
+ menu = new QPushButton(parent);
+ menu->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding));
+ menu->setPixmap(QPixmap((const char **)menu_xpm));
+ QObject::connect(menu,SIGNAL(clicked()),picks,SLOT(doMenu()));
+ QObject::connect(picks,SIGNAL(key(ushort,ushort,ushort,bool,bool)),
+ parent,SIGNAL(key(ushort,ushort,ushort,bool,bool)));
+ }
+
+ PickboardPicks* picks;
+ QPushButton* menu;
+};
+
+Pickboard::Pickboard(QWidget* parent, const char* name, WFlags f) :
+ QFrame(parent,name,f)
+{
+ (new QHBoxLayout(this))->setAutoAdd(TRUE);
+ d = new PickboardPrivate(this);
+ setFont( QFont( "smallsmooth", 9 ) );
+}
+
+Pickboard::~Pickboard()
+{
+ delete d;
+}
+
+void Pickboard::resetState()
+{
+ d->picks->resetState();
+}
+
diff --git a/inputmethods/pickboard/pickboard.h b/inputmethods/pickboard/pickboard.h
new file mode 100644
index 0000000..5fff875
--- a/dev/null
+++ b/inputmethods/pickboard/pickboard.h
@@ -0,0 +1,43 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** 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.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef PICKBOARD_H
+#define PICKBOARD_H
+
+#include <qframe.h>
+
+class PickboardPrivate;
+
+class Pickboard : public QFrame
+{
+ Q_OBJECT
+public:
+ Pickboard(QWidget* parent=0, const char* name=0, WFlags f=0);
+ ~Pickboard();
+
+ void resetState();
+
+signals:
+ void key( ushort, ushort, ushort, bool, bool );
+
+private:
+ PickboardPrivate* d;
+};
+
+#endif
diff --git a/inputmethods/pickboard/pickboard.pro b/inputmethods/pickboard/pickboard.pro
new file mode 100644
index 0000000..50bc342
--- a/dev/null
+++ b/inputmethods/pickboard/pickboard.pro
@@ -0,0 +1,12 @@
+TEMPLATE = lib
+CONFIG += qt warn_on release
+HEADERS = pickboard.h pickboardcfg.h pickboardimpl.h pickboardpicks.h
+SOURCES = pickboard.cpp pickboardcfg.cpp pickboardimpl.cpp pickboardpicks.cpp
+TARGET = qpickboard
+DESTDIR = ../../plugins/inputmethods
+INCLUDEPATH += $(QPEDIR)/include
+DEPENDPATH += ../$(QPEDIR)/include ../../taskbar
+LIBS += -lqpe
+VERSION = 1.0.0
+
+TRANSLATIONS += ../../i18n/de/libqpickboard.ts
diff --git a/inputmethods/pickboard/pickboardcfg.cpp b/inputmethods/pickboard/pickboardcfg.cpp
new file mode 100644
index 0000000..e8b47cb
--- a/dev/null
+++ b/inputmethods/pickboard/pickboardcfg.cpp
@@ -0,0 +1,731 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** 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.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+
+#include "pickboardcfg.h"
+#include "pickboardpicks.h"
+
+#include <qpe/global.h>
+
+#include <qpainter.h>
+#include <qlist.h>
+#include <qbitmap.h>
+#include <qlayout.h>
+#include <qvbox.h>
+#include <qdialog.h>
+#include <qscrollview.h>
+#include <qpopupmenu.h>
+#include <qhbuttongroup.h>
+#include <qpushbutton.h>
+#include <qmessagebox.h>
+#include <qwindowsystem_qws.h>
+
+static const char * pickboard_help =
+ "<h1>The Pickboard</h1>"
+ "<i>The smallest and fastest way to type.</i>"
+ "<p>"
+ "Enter a word by tapping letter-groups and picking the word."
+ "<br>Enter spaces with \"Space\", or other keys through \"KEY\"."
+ "<br>Use \"Shift\" to capitalize words that are not normally capitalized."
+ "<br>Press \"Shift\" twice for an all-capitals word."
+ "<br>Add custom words by picking them, then selecting \"Add...\" from the menu on the right."
+ ;
+
+const int intermatchmargin=5;
+
+
+PickboardConfig::~PickboardConfig() { }
+
+void PickboardConfig::updateRows(int from, int to)
+{
+ if ( from != to ) { // (all)
+ parent->update();
+ } else {
+ QFontMetrics fm = parent->fontMetrics();
+ parent->update(QRect(0,1+fm.descent() + from * fm.lineSpacing(), parent->width(),
+ fm.lineSpacing()));
+ }
+}
+
+void PickboardConfig::updateItem(int r, int)
+{
+ updateRows(r,r);
+}
+
+void PickboardConfig::changeMode(int m)
+{
+ parent->setMode(m);
+}
+void PickboardConfig::generateText(const QString& s)
+{
+#if defined(Q_WS_QWS) || defined(_WS_QWS_)
+ for (int i=0; i<(int)s.length(); i++) {
+ parent->emitKey(s[i].unicode(), 0, 0, true, false);
+ parent->emitKey(s[i].unicode(), 0, 0, false, false);
+ }
+#endif
+}
+void PickboardConfig::generateKey( int k )
+{
+#if defined(Q_WS_QWS) || defined(_WS_QWS_)
+ parent->emitKey(0, k, 0, true, false);
+ parent->emitKey(0, k, 0, false, false);
+#endif
+}
+
+void PickboardConfig::pickPoint(const QPoint& p, bool press)
+{
+ if ( press ) {
+ int ls=parent->height()/nrows;
+ int y=0;
+ pressx = -1;
+ for (int r=0; r<nrows; r++) {
+ if ( p.y() >= y && p.y() < y+ls ) {
+ pressrow = r;
+ pressx = p.x();
+ pickInRow( pressrow, pressx, TRUE );
+ return;
+ }
+ y += ls;
+ }
+ } else if ( pressx >= 0 ) {
+ pickInRow( pressrow, pressx, FALSE );
+ pressx = -1;
+ }
+}
+
+void PickboardConfig::fillMenu(QPopupMenu& menu)
+{
+ menu.insertItem("Reset",100);
+ menu.insertSeparator();
+ menu.insertItem("Help",1);
+}
+
+void PickboardConfig::doMenu(int i)
+{
+ switch (i) {
+ case 100:
+ if ( parent->currentMode() ) {
+ changeMode(0);
+ updateRows(0,1);
+ }
+ break;
+ case 1: {
+ QMessageBox help("Pickboard Help", pickboard_help,
+ QMessageBox::NoIcon, 1, 0, 0);
+ help.showMaximized();
+ help.exec();
+ }
+ }
+}
+
+void StringConfig::draw(QPainter* p)
+{
+ QFontMetrics fm = p->fontMetrics();
+
+ for (int r=0; r<nrows; r++) {
+ p->translate(0,fm.lineSpacing());
+ p->setPen(rowColor(r));
+
+ int tw=0;
+ QString s;
+ int i=0;
+ for (; !(s=text(r,i)).isNull(); ++i) {
+ int w = fm.width(s);
+ tw += w;
+ }
+ bool spread = spreadRow(r);// && parent->width() > tw;
+ int xw = spread ? (parent->width()-tw)/(i-1) : 3;
+ int x = spread ? (parent->width()-tw-xw*(i-1))/2 : 2;
+
+ i=0;
+ for (; !(s=text(r,i)).isNull(); ++i) {
+ int w = fm.width(s)+xw;
+ if ( highlight(r,i) ) {
+ p->fillRect(x-xw/2,1+fm.descent()-fm.lineSpacing(),w,fm.lineSpacing(),Qt::black);
+ p->setPen(Qt::white);
+ }else{
+ p->setPen(Qt::black);
+ }
+ p->drawText(x,-fm.descent()-1,s);
+ x += w;
+ }
+ }
+}
+
+void StringConfig::pickInRow(int r, int xpos, bool press)
+{
+ QFontMetrics fm = parent->fontMetrics();
+
+ int tw=0;
+ QString s;
+ int i=0;
+ for (; !(s=text(r,i)).isNull(); ++i) {
+ int w = fm.width(s);
+ tw += w;
+ }
+ bool spread = spreadRow(r) && parent->width() > tw;
+ int xw = spread ? (parent->width()-tw)/(i-1) : 3;
+ int x = spread ? (parent->width()-tw-xw*(i-1))/2 : 2;
+
+ i=0;
+ for (; !(s=text(r,i)).isNull(); ++i) {
+ int x2 = x + fm.width(s)+xw;
+ if ( xpos >= x && xpos < x2 ) {
+ pick(press, r, i);
+ return;
+ }
+ x = x2;
+ }
+}
+
+void StringConfig::updateItem(int r, int item)
+{
+ QFontMetrics fm = parent->fontMetrics();
+
+ int y = r * fm.lineSpacing();
+
+ int tw=0;
+ QString s;
+ int i=0;
+ for (; !(s=text(r,i)).isNull(); ++i) {
+ int w = fm.width(s);
+ tw += w;
+ }
+ bool spread = spreadRow(r) && parent->width() > tw;
+ int xw = spread ? (parent->width()-tw)/(i-1) : 3;
+ int x = spread ? (parent->width()-tw-xw*(i-1))/2 : 2;
+
+ i=0;
+ for (; !(s=text(r,i)).isNull(); ++i) {
+ int w = fm.width(s)+xw;
+ if ( i == item ) {
+ parent->update(QRect(x-xw/2,y+1+fm.descent(),w,fm.lineSpacing()));
+ return;
+ }
+ x += w;
+ }
+}
+
+bool StringConfig::highlight(int,int) const
+{
+ return FALSE;
+}
+
+LetterButton::LetterButton(const QChar& letter, QWidget* parent) :
+ QPushButton(letter,parent)
+{
+ setToggleButton(TRUE);
+ setAutoDefault(FALSE);
+ connect(this,SIGNAL(clicked()),this,SLOT(toggleCase()));
+ skip=TRUE;
+}
+
+void LetterButton::toggleCase()
+{
+ if ( skip ) {
+ // Don't toggle case the first time
+ skip=FALSE;
+ return;
+ }
+
+ QChar ch = text()[0];
+ QChar nch = ch.lower();
+ if ( ch == nch )
+ nch = ch.upper();
+ setText(nch);
+}
+
+LetterChoice::LetterChoice(QWidget* parent, const QString& set) :
+ QButtonGroup(parent)
+{
+ QHBoxLayout *l = new QHBoxLayout(this);
+ setFrameStyle(0);
+ setExclusive(TRUE);
+ for (int i=0; i<(int)set.length(); i++) {
+ LetterButton* b = new LetterButton(set[i],this);
+ l->addWidget(b,1,AlignCenter);
+ connect(b,SIGNAL(clicked()),this,SLOT(change()));
+ }
+}
+
+void LetterChoice::change()
+{
+ LetterButton* b = (LetterButton*)sender();
+ ch = b->text()[0];
+ emit changed();
+}
+
+
+PickboardAdd::PickboardAdd(QWidget* owner, const QStringList& setlist) :
+ QDialog( owner, 0, TRUE )
+{
+ QVBoxLayout* l = new QVBoxLayout(this);
+ l->setAutoAdd(TRUE);
+
+ QScrollView *sv = new QScrollView(this);
+ sv->setResizePolicy(QScrollView::AutoOneFit);
+ setMaximumHeight(200); // ### QDialog shouldn't allow us to be bigger than the screen
+ QVBox *letters = new QVBox(sv);
+ letters->setSpacing(0);
+ lc = new LetterChoice*[setlist.count()];
+ nlc = (int)setlist.count();
+ for (int i=0; i<nlc; i++) {
+ lc[i] = new LetterChoice(letters,setlist[i]);
+ connect(lc[i],SIGNAL(changed()),this,SLOT(checkAllDone()));
+ }
+ sv->addChild(letters);
+ QHBox* hb = new QHBox(this);
+ hb->setSpacing(0);
+ yes = new QPushButton("OK",hb);
+ yes->setEnabled(FALSE);
+ QPushButton *no = new QPushButton("Cancel",hb);
+ connect(yes, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(no, SIGNAL(clicked()), this, SLOT(reject()));
+}
+
+PickboardAdd::~PickboardAdd()
+{
+ delete [] lc;
+}
+
+QString PickboardAdd::word() const
+{
+ QString str;
+ for (int i=0; i<nlc; i++) {
+ str += lc[i]->choice();
+ }
+ return str;
+}
+
+bool PickboardAdd::exec()
+{
+ QPoint pos = parentWidget()->mapToGlobal(QPoint(0,0));
+ pos.ry() -= height();
+ if ( QDialog::exec() ) {
+ Global::addWords(QStringList(word()));
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+void PickboardAdd::checkAllDone()
+{
+ if ( !yes->isEnabled() ) {
+ for (int i=0; i<nlc; i++) {
+ if ( lc[i]->choice().isNull() )
+ return;
+ }
+ yes->setEnabled(TRUE);
+ }
+}
+
+
+void DictFilterConfig::doMenu(int i)
+{
+ switch (i) {
+ case 300:
+ if ( input.count() == 0 ) {
+ QMessageBox::information(0, "Adding Words",
+ "To add words, pick the letters,\nthen "
+ "open the Add dialog. In that\ndialog, tap "
+ "the correct letters\nfrom the list "
+ "(tap twice for\ncapitals).");
+ } else {
+ PickboardAdd add(parent,capitalize(input));
+ if ( add.exec() )
+ generateText(add.word());
+ input.clear();
+ matches.clear();
+ updateRows(0,0);
+ }
+ break;
+ case 100:
+ if ( !input.isEmpty() ) {
+ input.clear();
+ matches.clear();
+ StringConfig::doMenu(i);
+ updateRows(0,1);
+ break;
+ } // else fall through
+ default:
+ StringConfig::doMenu(i);
+ }
+ shift = 0;
+ lit0 = -1;
+}
+
+QString DictFilterConfig::text(int r, int i)
+{
+ QStringList l = r ? sets : input.isEmpty() ? othermodes : matches;
+ return i < (int)l.count() ?
+ (input.isEmpty() ? l[i] : capitalize(l[i]))
+ : QString::null;
+}
+
+bool DictFilterConfig::spreadRow(int r)
+{
+ return r ? TRUE : input.isEmpty() ? TRUE : FALSE;
+}
+
+QStringList DictFilterConfig::capitalize(const QStringList& l)
+{
+ switch ( shift ) {
+ case 1: {
+ QStringList r;
+ QStringList::ConstIterator it = l.begin();
+ r.append((*it).upper());
+ for (++it; it != l.end(); ++it)
+ r.append(*it);
+ return r;
+ } case 2: {
+ QStringList r;
+ for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it)
+ r.append((*it).upper());
+ return r;
+ }
+ }
+ return l;
+}
+
+QString DictFilterConfig::capitalize(const QString& s)
+{
+ switch ( shift ) {
+ case 1: {
+ QString u = s;
+ u[0] = u[0].upper();
+ return u;
+ break;
+ } case 2:
+ return s.upper();
+ break;
+ }
+ return s;
+}
+
+void DictFilterConfig::pick(bool press, int row, int item)
+{
+ if ( row == 0 ) {
+ if ( press ) {
+ if ( input.isEmpty() ) {
+ lit0 = item;
+ if ( othermodes[item] == "Space" ) {
+ updateItem(row,item);
+ generateText(" ");
+ } else if ( othermodes[item] == "Back" ) {
+ updateItem(row,item);
+ generateKey(Qt::Key_Backspace);
+ } else if ( othermodes[item] == "Enter" ) {
+ updateItem(row,item);
+ generateKey(Qt::Key_Return);
+ } else if ( othermodes[item] == "Shift" ) {
+ updateItem(row,item);
+ shift = (shift+1)%3;
+ }
+ }
+ } else {
+ if ( !input.isEmpty() ) {
+ input.clear();
+ if ( item>=0 ) {
+ generateText(capitalize(matches[item]));
+ }
+ shift = 0;
+ matches.clear();
+ updateRows(0,0);
+ } else if ( item < 3 ) {
+ lit0 = -1;
+ changeMode(item+1); // I'm mode 0! ####
+ updateRows(0,1);
+ }
+ if ( lit0 >= 0 ) {
+ if ( !shift || othermodes[lit0] != "Shift" ) {
+ updateItem(0,lit0);
+ lit0 = -1;
+ }
+ }
+ }
+ } else {
+ lit0 = -1;
+ if ( press && item >= 0 ) {
+ lit1 = item;
+ add(sets[item]);
+ updateItem(1,item);
+ updateRows(0,0);
+ } else {
+ updateItem(1,lit1);
+ lit1 = -1;
+ }
+ }
+}
+
+bool DictFilterConfig::scanMatch(const QString& set, const QChar& l) const
+{
+ return set == "?" || set == "*" || set.contains(l);
+}
+
+//static int visit=0;
+//static int lvisit=0;
+
+void DictFilterConfig::scan(const QDawg::Node* n, int ipos, const QString& str, int length, bool extend)
+{
+ if ( n ) {
+ do {
+//visit++;
+ bool pastend = ipos >= (int)input.count();
+ if ( pastend && extend || !pastend && scanMatch(input[ipos],n->letter().lower()) ) {
+ if ( length>1 ) {
+ if ( !pastend && input[ipos] == "*" ) {
+ scan(n->jump(),ipos+1,str+n->letter(),length-1,FALSE);
+ scan(n->jump(),ipos,str+n->letter(),length,FALSE);
+ } else {
+ scan(n->jump(),ipos+1,str+n->letter(),length-1,extend);
+ }
+ } else {
+ if ( n->isWord() ) {
+ matches.append(str+n->letter());
+ }
+ }
+ }
+ n = n->next();
+ } while (n);
+ }
+}
+
+void DictFilterConfig::scanLengths(const QDawg::Node* n, int ipos, int& length_bitarray)
+{
+ if ( n ) {
+ do {
+//lvisit++;
+ bool pastend = ipos >= (int)input.count();
+ if ( pastend || scanMatch(input[ipos],n->letter().lower()) ) {
+ scanLengths(n->jump(),ipos+1,length_bitarray);
+ if ( n->isWord() )
+ length_bitarray |= (1<<(ipos+1));
+ }
+ n = n->next();
+ } while (n);
+ }
+}
+
+void DictFilterConfig::add(const QString& set)
+{
+ QFontMetrics fm = parent->fontMetrics();
+ input.append(set.lower());
+ matches.clear();
+//visit=0;
+//lvisit=0;
+ int length_bitarray = 0;
+ if ( input.count() > 4 ) {
+ scanLengths(Global::addedDawg().root(),0,length_bitarray);
+ scanLengths(Global::fixedDawg().root(),0,length_bitarray);
+ } else {
+ length_bitarray = 0xffffffff;
+ }
+ for (int len=input.count(); len<22 /* 32 */; ++len) {
+ if ( length_bitarray & (1<<len) ) {
+ scan(Global::addedDawg().root(),0,"",len,TRUE);
+ scan(Global::fixedDawg().root(),0,"",len,TRUE);
+ int x = 2;
+ for (QStringList::Iterator it=matches.begin(); it!=matches.end(); ++it) {
+ x += fm.width(*it)+intermatchmargin;
+ if ( x >= parent->width() ) {
+//qDebug("%d+%d visits",lvisit,visit);
+ return; // RETURN - No point finding more
+ }
+ }
+ }
+ if ( len == 1 && input.count() == 1 ) {
+ // Allow all single-characters to show as "matches"
+ for ( int i=0; i<(int)set.length(); i++ ) {
+ QChar ch = set[i].lower();
+ matches.append(ch);
+ }
+ }
+ }
+//qDebug("%d+%d visits",lvisit,visit);
+}
+
+bool DictFilterConfig::highlight(int r,int c) const
+{
+ return r == 0 ? c == lit0 : c == lit1;
+}
+
+
+void DictFilterConfig::addSet(const QString& s)
+{
+ sets.append(s);
+}
+
+void DictFilterConfig::addMode(const QString& s)
+{
+ othermodes.append(s);
+}
+
+void DictFilterConfig::fillMenu(QPopupMenu& menu)
+{
+ menu.insertItem("Add...",300);
+ StringConfig::fillMenu(menu);
+}
+
+QValueList<QPixmap> KeycodeConfig::row(int i)
+{
+ return i ? keypm2 : keypm1;
+}
+
+void KeycodeConfig::pickInRow(int r, int xpos, bool press)
+{
+ QValueList<QPixmap> pl = row(r);
+ QValueList<QPixmap>::Iterator it;
+ int item=0;
+ int x=xmarg;
+ for (it=pl.begin(); it!=pl.end(); ++it) {
+ int x2 = x + (*it).width();
+ if ( (*it).height() > 1 )
+ x2 += xw;
+ if ( xpos >= x && xpos < x2 ) {
+ pick(press, r, item);
+ return;
+ }
+ x = x2;
+ item++;
+ }
+}
+
+void KeycodeConfig::pick(bool press, int row, int item)
+{
+ if ( !press ) {
+ if ( item >= 0 ) {
+ int k = row == 0 ? keys1[item] : keys2[item];
+ if ( k )
+ generateKey(k);
+ }
+ changeMode(0);
+ updateRows(0,1);
+ }
+}
+
+void KeycodeConfig::draw(QPainter* p)
+{
+ int y=3;
+ QValueList<QPixmap>::Iterator it;
+ for (int r=0; r<nrows; r++) {
+ QValueList<QPixmap> pl = row(r);
+ int x = xmarg;
+ for (it=pl.begin(); it!=pl.end(); ++it) {
+ if ( (*it).height() == 1 ) {
+ // just a gap
+ x += (*it).width();
+ } else {
+ p->drawPixmap(x,y,*it);
+ x += (*it).width()+xw;
+ }
+ }
+ y += parent->height()/nrows;
+ }
+}
+
+
+void KeycodeConfig::addKey(int r, const QPixmap& pm, int code)
+{
+ if ( r == 0 ) {
+ keypm1.append(pm);
+ keys1.append(code);
+ } else {
+ keypm2.append(pm);
+ keys2.append(code);
+ }
+}
+void KeycodeConfig::addGap(int r, int w)
+{
+ QBitmap pm(w,1); // ick.
+ addKey(r,pm,0);
+}
+
+QString CharConfig::text(int r, int i)
+{
+ QStringList l = r ? chars2 : chars1;
+ return i < (int)l.count() ? l[i] : QString::null;
+}
+bool CharConfig::spreadRow(int)
+{
+ return TRUE;
+}
+
+void CharConfig::pick(bool press, int row, int item)
+{
+ if ( !press ) {
+ if ( item >= 0 ) {
+ generateText(row == 0 ? chars1[item] : chars2[item]);
+ }
+ changeMode(0);
+ updateRows(0,1);
+ }
+}
+
+void CharConfig::addChar(int r, const QString& s)
+{
+ if ( r ) chars2.append(s); else chars1.append(s);
+}
+
+QString CharStringConfig::text(int r, int i)
+{
+ QStringList l = r ? chars : QStringList(input);
+ return i < (int)l.count() ? l[i] : QString::null;
+}
+
+bool CharStringConfig::spreadRow(int i)
+{
+ return i ? TRUE : FALSE;
+}
+
+void CharStringConfig::pick(bool press, int row, int item)
+{
+ if ( row == 0 ) {
+ if ( !press ) {
+ if ( item>=0 ) {
+ generateText(input);
+ }
+ input = "";
+ changeMode(0);
+ updateRows(0,1);
+ }
+ } else {
+ if ( press && item >= 0 ) {
+ input.append(chars[item]);
+ updateRows(0,0);
+ }
+ }
+}
+
+void CharStringConfig::addChar(const QString& s)
+{
+ chars.append(s);
+}
+
+void CharStringConfig::doMenu(int i)
+{
+ if ( i == 100 ) {
+ input = "";
+ updateRows(0,0);
+ }
+
+ StringConfig::doMenu(i);
+}
+
diff --git a/inputmethods/pickboard/pickboardcfg.h b/inputmethods/pickboard/pickboardcfg.h
new file mode 100644
index 0000000..e0dc0dd
--- a/dev/null
+++ b/inputmethods/pickboard/pickboardcfg.h
@@ -0,0 +1,213 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** 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.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef PICKBOARDCFG_H
+#define PICKBOARDCFG_H
+
+#include <qpe/qdawg.h>
+
+#include <qpushbutton.h>
+#include <qhbuttongroup.h>
+#include <qdialog.h>
+#include <qlist.h>
+
+// Internal stuff...
+
+class PickboardPicks;
+
+class LetterButton : public QPushButton {
+ Q_OBJECT
+public:
+ LetterButton(const QChar& letter, QWidget* parent);
+private slots:
+ void toggleCase();
+private:
+ bool skip;
+};
+
+class LetterChoice : public QButtonGroup {
+ Q_OBJECT
+public:
+ LetterChoice(QWidget* parent, const QString& set);
+
+ QChar choice() { return ch; }
+
+signals:
+ void changed();
+
+private slots:
+ void change();
+
+private:
+ QChar ch;
+};
+
+class PickboardAdd : public QDialog {
+ Q_OBJECT
+public:
+ PickboardAdd(QWidget* owner, const QStringList& setlist);
+ ~PickboardAdd();
+
+ QString word() const;
+ bool exec();
+
+private slots:
+ void checkAllDone();
+
+private:
+ QPushButton *yes;
+ LetterChoice **lc;
+ int nlc;
+};
+
+class PickboardConfig : QObject {
+public:
+ PickboardConfig(PickboardPicks* p) : parent(p), nrows(2), pressx(-1) { }
+ virtual ~PickboardConfig();
+ virtual void pickPoint(const QPoint& p, bool press);
+ virtual void draw(QPainter*)=0;
+ virtual void fillMenu(QPopupMenu&);
+ virtual void doMenu(int);
+
+protected:
+ void updateRows(int from, int to);
+ virtual void updateItem(int r, int i);
+ virtual void pickInRow(int r, int xpos, bool press)=0;
+
+ void changeMode(int m);
+ virtual void generateText(const QString& s);
+ void generateKey( int k );
+
+ virtual void pick(bool press, int row, int item)=0;
+
+protected:
+ PickboardPicks* parent;
+ int nrows;
+private:
+ int pressrow, pressx;
+};
+
+class StringConfig : public PickboardConfig {
+public:
+ StringConfig(PickboardPicks* p) : PickboardConfig(p) { }
+
+ void draw(QPainter* p);
+
+protected:
+ virtual QString text(int r, int i)=0;
+ virtual bool spreadRow(int i)=0;
+ virtual QColor rowColor(int) { return Qt::black; }
+ virtual void pickInRow(int r, int xpos, bool press);
+ virtual void updateItem(int r, int i);
+ virtual bool highlight(int,int) const;
+};
+
+class CharStringConfig : public StringConfig {
+ QString input;
+ QStringList chars;
+public:
+ CharStringConfig(PickboardPicks* p) : StringConfig(p) { }
+
+ void addChar(const QString& s);
+ virtual void doMenu(int);
+
+protected:
+ QString text(int r, int i);
+ bool spreadRow(int i);
+ void pick(bool press, int row, int item);
+};
+
+class DictFilterConfig : public StringConfig {
+ QStringList matches;
+ QStringList sets;
+ QStringList othermodes;
+ int lit0;
+ int lit1;
+ int shift;
+ QString capitalize(const QString& s);
+ QStringList capitalize(const QStringList& s);
+
+public:
+ QStringList input;
+ DictFilterConfig(PickboardPicks* p) : StringConfig(p)
+ {
+ shift = 0;
+ lit0 = -1;
+ lit1 = -1;
+ }
+
+ void addSet(const QString& s);
+ void addMode(const QString& s);
+
+ void fillMenu(QPopupMenu& menu);
+ void doMenu(int i);
+
+ void add(const QString& set);
+
+protected:
+ QString text(int r, int i);
+
+ bool spreadRow(int i);
+
+ void pick(bool press, int row, int item);
+
+ bool scanMatch(const QString& set, const QChar& l) const;
+ void scan(const QDawg::Node* n, int ipos, const QString& str, int length, bool extend);
+ void scanLengths(const QDawg::Node* n, int ipos, int& bitarray);
+
+ bool highlight(int r,int c) const;
+};
+
+class CharConfig : public StringConfig {
+ QStringList chars1;
+ QStringList chars2;
+public:
+ CharConfig(PickboardPicks* p) : StringConfig(p) { }
+ void addChar(int r, const QString& s);
+
+protected:
+ QString text(int r, int i);
+ bool spreadRow(int);
+ void pick(bool press, int row, int item);
+};
+
+class KeycodeConfig : public PickboardConfig {
+ QValueList<int> keys1;
+ QValueList<int> keys2;
+ QValueList<QPixmap> keypm1;
+ QValueList<QPixmap> keypm2;
+ static const int xw = 8;
+ static const int xmarg = 8;
+
+public:
+ KeycodeConfig(PickboardPicks* p) : PickboardConfig(p) { }
+ void addKey(int r, const QPixmap& pm, int code);
+ void addGap(int r, int w);
+
+ void draw(QPainter* p);
+
+protected:
+ void pickInRow(int r, int xpos, bool press);
+ QValueList<QPixmap> row(int i);
+
+ void pick(bool press, int row, int item);
+};
+
+
+#endif
diff --git a/inputmethods/pickboard/pickboardimpl.cpp b/inputmethods/pickboard/pickboardimpl.cpp
new file mode 100644
index 0000000..a4e8f02
--- a/dev/null
+++ b/inputmethods/pickboard/pickboardimpl.cpp
@@ -0,0 +1,101 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** 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.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include <qapplication.h>
+#include <qobject.h>
+#include <qpixmap.h>
+#include "pickboard.h"
+#include "pickboardimpl.h"
+
+/* XPM */
+static const char * pb_xpm[]={
+"28 7 2 1",
+"# c #303030",
+" c None",
+" ########################## ",
+" # # # # # # # ",
+" # # # # # # # ",
+" ########################## ",
+" # # # # # # ",
+" # # # # # # ",
+" ########################## "};
+
+
+PickboardImpl::PickboardImpl()
+ : pickboard(0), icn(0), ref(0)
+{
+}
+
+PickboardImpl::~PickboardImpl()
+{
+ delete pickboard;
+ delete icn;
+}
+
+QWidget *PickboardImpl::inputMethod( QWidget *parent, Qt::WFlags f )
+{
+ if ( !pickboard )
+ pickboard = new Pickboard( parent, "pickboard", f );
+ return pickboard;
+}
+
+void PickboardImpl::resetState()
+{
+ if ( pickboard )
+ pickboard->resetState();
+}
+
+QPixmap *PickboardImpl::icon()
+{
+ if ( !icn )
+ icn = new QPixmap( (const char **)pb_xpm );
+ return icn;
+}
+
+QString PickboardImpl::name()
+{
+ return qApp->translate( "InputMethods", "Pickboard" );
+}
+
+void PickboardImpl::onKeyPress( QObject *receiver, const char *slot )
+{
+ if ( pickboard )
+ QObject::connect( pickboard, SIGNAL(key(ushort,ushort,ushort,bool,bool)), receiver, slot );
+}
+
+#ifndef QT_NO_COMPONENT
+QRESULT PickboardImpl::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( PickboardImpl )
+}
+#endif
+
diff --git a/inputmethods/pickboard/pickboardimpl.h b/inputmethods/pickboard/pickboardimpl.h
new file mode 100644
index 0000000..4f23665
--- a/dev/null
+++ b/inputmethods/pickboard/pickboardimpl.h
@@ -0,0 +1,51 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** 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.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef PICKBOARDIMPL_H
+#define PICKBOARDIMPL_H
+
+#include <qpe/inputmethodinterface.h>
+
+class Pickboard;
+class QPixmap;
+
+class PickboardImpl : public InputMethodInterface
+{
+public:
+ PickboardImpl();
+ virtual ~PickboardImpl();
+
+#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:
+ Pickboard *pickboard;
+ QPixmap *icn;
+ ulong ref;
+};
+
+#endif
diff --git a/inputmethods/pickboard/pickboardpicks.cpp b/inputmethods/pickboard/pickboardpicks.cpp
new file mode 100644
index 0000000..a80bbf8
--- a/dev/null
+++ b/inputmethods/pickboard/pickboardpicks.cpp
@@ -0,0 +1,418 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** 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.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#include "pickboardpicks.h"
+#include "pickboardcfg.h"
+
+#include <qpe/global.h>
+
+#include <qpainter.h>
+#include <qlist.h>
+#include <qbitmap.h>
+#include <qlayout.h>
+#include <qvbox.h>
+#include <qdialog.h>
+#include <qscrollview.h>
+#include <qpopupmenu.h>
+#include <qhbuttongroup.h>
+#include <qpushbutton.h>
+#include <qmessagebox.h>
+#include <qwindowsystem_qws.h>
+
+void PickboardPicks::doMenu()
+{
+ QWidget* cause = (QWidget*)sender(); // evil
+
+ QPopupMenu popup(this);
+ config()->fillMenu(popup);
+
+ QPoint pos = cause->mapToGlobal(cause->rect().topRight());
+ QSize sz = popup.sizeHint();
+ pos.ry() -= sz.height();
+ pos.rx() -= sz.width();
+ popup.move(pos);
+ config()->doMenu(popup.exec());
+}
+
+static const char *BS_xpm[] = {
+"5 7 2 1",
+"a c #000000",
+". c None",
+"...aa",
+"..aaa",
+".aaaa",
+"aaaaa",
+".aaaa",
+"..aaa",
+"...aa",
+};
+static const char *Del_xpm[] = {
+"14 7 2 1",
+"a c #000000",
+". c None",
+"aaa..aaaa.a...",
+"a..a.a....a...",
+"a..a.a....a...",
+"a..a.aaa..a...",
+"a..a.a....a...",
+"a..a.a....a...",
+"aaa..aaaa.aaaa"
+};
+static const char *Home_xpm[] = {
+"20 7 2 1",
+"a c #000000",
+". c None",
+"a..a..aa..a...a.aaaa",
+"a..a.a..a.aa.aa.a...",
+"a..a.a..a.a.a.a.a...",
+"aaaa.a..a.a.a.a.aaa.",
+"a..a.a..a.a...a.a...",
+"a..a.a..a.a...a.a...",
+"a..a..aa..a...a.aaaa"
+};
+static const char *PgUp_xpm[] = {
+"20 7 2 1",
+"a c #000000",
+". c None",
+"aaa.......a..a......",
+"a..a......a..a......",
+"a..a.aa...a..a.aaa..",
+"aaa.a.....a..a.a..a.",
+"a...a.aa..a..a.aaa..",
+"a...a..a..a..a.a....",
+"a....aaa...aa..a...."
+};
+static const char *PgDn_xpm[] = {
+"20 7 2 1",
+"a c #000000",
+". c None",
+"aaa.......aaa.......",
+"a..a......a..a......",
+"a..a.aa...a..a.a..a.",
+"aaa.a.....a..a.aa.a.",
+"a...a.aa..a..a.a.aa.",
+"a...a..a..a..a.a..a.",
+"a....aaa..aaa..a..a."
+};
+static const char *End_xpm[] = {
+"14 7 2 1",
+"a c #000000",
+". c None",
+"aaaa.a..a.aaa.",
+"a....aa.a.a..a",
+"a....a.aa.a..a",
+"aaa..a..a.a..a",
+"a....a..a.a..a",
+"a....a..a.a..a",
+"aaaa.a..a.aaa."
+};
+static const char *Enter_xpm[] = {
+"14 7 2 1",
+"a c #000000",
+". c None",
+".............a",
+".............a",
+"..a..........a",
+".aa.........a.",
+"aaaaaaaaaaaa..",
+".aa...........",
+"..a..........."
+};
+static const char *Esc_xpm[] = {
+"14 7 2 1",
+"a c #000000",
+". c None",
+"aaaa..aa...aa.",
+"a....a..a.a..a",
+"a....a....a...",
+"aaa...aa..a...",
+"a.......a.a...",
+"a....a..a.a..a",
+"aaaa..aa...aa."
+};
+static const char *Ins_xpm[] = {
+"13 7 2 1",
+"a c #000000",
+". c None",
+"aaa.a..a..aa.",
+".a..aa.a.a..a",
+".a..a.aa.a...",
+".a..a..a..aa.",
+".a..a..a....a",
+".a..a..a.a..a",
+"aaa.a..a..aa."
+};
+static const char *Up_xpm[] = {
+"7 7 2 1",
+"a c #000000",
+". c None",
+"...a...",
+"..aaa..",
+".a.a.a.",
+"a..a..a",
+"...a...",
+"...a...",
+"...a..."
+};
+static const char *Left_xpm[] = {
+"7 7 2 1",
+"a c #000000",
+". c None",
+"...a...",
+"..a....",
+".a.....",
+"aaaaaaa",
+".a.....",
+"..a....",
+"...a..."
+};
+static const char *Down_xpm[] = {
+"7 7 2 1",
+"a c #000000",
+". c None",
+"...a...",
+"...a...",
+"...a...",
+"a..a..a",
+".a.a.a.",
+"..aaa..",
+"...a..."
+};
+static const char *Right_xpm[] = {
+"7 7 2 1",
+"a c #000000",
+". c None",
+"...a...",
+"....a..",
+".....a.",
+"aaaaaaa",
+".....a.",
+"....a..",
+"...a..."
+};
+static const char *BackTab_xpm[] = {
+"8 7 2 1",
+"a c #000000",
+". c None",
+"a.......",
+"a..a....",
+"a.aa....",
+"aaaaaaaa",
+"a.aa....",
+"a..a....",
+"a......."
+};
+static const char *Tab_xpm[] = {
+"8 7 2 1",
+"a c #000000",
+". c None",
+".......a",
+"....a..a",
+"....aa.a",
+"aaaaaaaa",
+"....aa.a",
+"....a..a",
+".......a"
+};
+static const char *Space_xpm[] = {
+"9 9 2 1",
+"a c #000000",
+". c None",
+"aaaaaaaaa",
+"a.......a",
+"a.......a",
+"a.......a",
+"a.......a",
+"a.......a",
+"a.......a",
+"a.......a",
+"aaaaaaaaa"
+};
+
+PickboardPicks::PickboardPicks(QWidget* parent, const char* name, WFlags f ) :
+ QFrame(parent,name,f)
+{
+}
+
+void PickboardPicks::initialise(void)
+{
+ setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
+ mode = 0;
+
+ DictFilterConfig* dc = new DictFilterConfig(this);
+ dc->addSet("ABC");
+ dc->addSet("DEF");
+ dc->addSet("GHI");
+ dc->addSet("JKL");
+ dc->addSet("MNO");
+ dc->addSet("PQR");
+ dc->addSet("STU");
+ dc->addSet("VWX");
+ dc->addSet("YZ-'");
+ dc->addMode("123");
+ dc->addMode("@*!?");
+ dc->addMode("KEY");
+ dc->addMode("Space");
+ dc->addMode("Back");
+ dc->addMode("Enter");
+ dc->addMode("Shift");
+ configs.append(dc);
+
+ CharStringConfig* number = new CharStringConfig(this);
+ number->addChar("0");
+ number->addChar("1");
+ number->addChar("2");
+ number->addChar("3");
+ number->addChar("4");
+ number->addChar("5");
+ number->addChar("6");
+ number->addChar("7");
+ number->addChar("8");
+ number->addChar("9");
+ number->addChar("."); // #### or "," in some locales
+ configs.append(number);
+
+ CharConfig* punc = new CharConfig(this);
+
+ punc->addChar(0,"\"");
+ punc->addChar(0,"`");
+ punc->addChar(0,"'");
+ punc->addChar(0,"\253");
+ punc->addChar(0,"\273");
+ punc->addChar(0,"\277");
+ punc->addChar(1,"(");
+ punc->addChar(1,")");
+ punc->addChar(1,"[");
+ punc->addChar(1,"]");
+ punc->addChar(1,"{");
+ punc->addChar(1,"}");
+
+ punc->addChar(0,"+");
+ punc->addChar(0,"-");
+ punc->addChar(0,"*");
+ punc->addChar(0,"/");
+ punc->addChar(0,"=");
+ punc->addChar(0,"_");
+ punc->addChar(0,"$");
+ punc->addChar(0,"&");
+ punc->addChar(1,"|");
+ punc->addChar(1,"@");
+ punc->addChar(1,"\\");
+ punc->addChar(1,"#");
+ punc->addChar(1,"^");
+ punc->addChar(1,"~");
+ punc->addChar(1,"<");
+ punc->addChar(1,">");
+
+ punc->addChar(0,".");
+ punc->addChar(0,"?");
+ punc->addChar(0,"!");
+ punc->addChar(0,",");
+ punc->addChar(0,";");
+ punc->addChar(1,":");
+ punc->addChar(1,"\267");
+ punc->addChar(1,"\277");
+ punc->addChar(1,"\241");
+ punc->addChar(1,"\367");
+
+ punc->addChar(0,"$");
+ punc->addChar(0,"\242");
+ punc->addChar(0,"\245");
+ punc->addChar(1,"\243");
+ punc->addChar(1,"\244");
+ punc->addChar(1,"\260");
+
+ configs.append(punc);
+
+ KeycodeConfig* keys = new KeycodeConfig(this);
+ keys->addKey(0,QPixmap(Esc_xpm),Key_Escape);
+ keys->addKey(0,QPixmap(BS_xpm),Key_Backspace);
+ keys->addGap(0,10);
+
+ keys->addKey(0,QPixmap(Ins_xpm),Key_Insert);
+ keys->addKey(0,QPixmap(Home_xpm),Key_Home);
+ keys->addKey(0,QPixmap(PgUp_xpm),Key_PageUp);
+
+ keys->addGap(0,25);
+ keys->addKey(0,QPixmap(Up_xpm),Key_Up);
+ keys->addGap(0,15);
+
+ keys->addKey(1,QPixmap(BackTab_xpm),Key_Tab);
+ keys->addGap(1,3);
+ keys->addKey(1,QPixmap(Tab_xpm),Key_Tab);
+ keys->addGap(1,10);
+
+ keys->addKey(1,QPixmap(Del_xpm),Key_Delete);
+ keys->addGap(1,2);
+ keys->addKey(1,QPixmap(End_xpm),Key_End);
+ keys->addGap(1,3);
+ keys->addKey(1,QPixmap(PgDn_xpm),Key_PageDown);
+
+ keys->addGap(1,10);
+ keys->addKey(1,QPixmap(Left_xpm),Key_Left);
+ keys->addKey(1,QPixmap(Down_xpm),Key_Down);
+ keys->addKey(1,QPixmap(Right_xpm),Key_Right);
+
+ keys->addGap(1,13);
+ keys->addKey(1,QPixmap(Space_xpm),Key_Space);
+
+ keys->addGap(0,10);
+ keys->addKey(0,QPixmap(Enter_xpm),Key_Return);
+
+ configs.append(keys);
+}
+
+PickboardPicks::~PickboardPicks()
+{
+}
+
+QSize PickboardPicks::sizeHint() const
+{
+ return QSize(240,fontMetrics().lineSpacing()*2+3);
+}
+
+void PickboardPicks::drawContents(QPainter* p)
+{
+ config()->draw(p);
+}
+
+void PickboardPicks::mousePressEvent(QMouseEvent* e)
+{
+ config()->pickPoint(e->pos(),TRUE);
+}
+
+void PickboardPicks::mouseDoubleClickEvent(QMouseEvent* e)
+{
+ config()->pickPoint(e->pos(),TRUE);
+}
+
+void PickboardPicks::mouseReleaseEvent(QMouseEvent* e)
+{
+ config()->pickPoint(e->pos(),FALSE);
+}
+
+void PickboardPicks::setMode(int m)
+{
+ mode = m;
+}
+
+void PickboardPicks::resetState()
+{
+ config()->doMenu(100);
+}
diff --git a/inputmethods/pickboard/pickboardpicks.h b/inputmethods/pickboard/pickboardpicks.h
new file mode 100644
index 0000000..1881e92
--- a/dev/null
+++ b/inputmethods/pickboard/pickboardpicks.h
@@ -0,0 +1,66 @@
+/**********************************************************************
+** Copyright (C) 2000 Trolltech AS. All rights reserved.
+**
+** This file is part of Qtopia Environment.
+**
+** 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.
+**
+** See http://www.trolltech.com/gpl/ for GPL licensing information.
+**
+** Contact info@trolltech.com if any conditions of this licensing are
+** not clear to you.
+**
+**********************************************************************/
+#ifndef PICKBOARDPICKS_H
+#define PICKBOARDPICKS_H
+
+#include <qframe.h>
+#include <qlist.h>
+
+// Internal stuff...
+
+class PickboardConfig;
+
+class PickboardPicks : public QFrame {
+ Q_OBJECT
+public:
+ PickboardPicks(QWidget* parent=0, const char* name=0, WFlags f=0);
+ ~PickboardPicks();
+ QSize sizeHint() const;
+ void initialise();
+ void setMode(int);
+ int currentMode() const { return mode; }
+
+ void mousePressEvent(QMouseEvent*);
+
+ void emitKey( ushort scan, ushort uni, ushort mod, bool press, bool repeat )
+ { key(scan,uni,mod,press, repeat); }
+ void resetState();
+
+signals:
+ void key( ushort scan, ushort uni, ushort mod, bool, bool );
+
+public slots:
+ void doMenu();
+
+protected:
+ void drawContents( QPainter * );
+ void mouseDoubleClickEvent(QMouseEvent*);
+ void mouseReleaseEvent(QMouseEvent*);
+
+protected:
+ int mode;
+ QList<PickboardConfig> configs;
+
+private:
+ PickboardConfig* config() { return configs.at(mode); }
+};
+
+
+#endif
diff --git a/inputmethods/pickboard/qpe-pickboard.control b/inputmethods/pickboard/qpe-pickboard.control
new file mode 100644
index 0000000..8d12181
--- a/dev/null
+++ b/inputmethods/pickboard/qpe-pickboard.control
@@ -0,0 +1,9 @@
+Files: plugins/inputmethods/libqpickboard.so*
+Priority: optional
+Section: qpe/inputmethods
+Maintainer: Warwick Allison <warwick@trolltech.com>
+Architecture: arm
+Version: $QPE_VERSION-3
+Depends: qpe-base ($QPE_VERSION)
+Description: Pickboard input method
+ Pickboard dictionary-based input method for the Qtopia environment.
diff --git a/inputmethods/pickboard/qpe-pickboard.postinst b/inputmethods/pickboard/qpe-pickboard.postinst
new file mode 100755
index 0000000..c254b01
--- a/dev/null
+++ b/inputmethods/pickboard/qpe-pickboard.postinst
@@ -0,0 +1,2 @@
+#!/bin/sh
+/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadInputMethods()"
diff --git a/inputmethods/pickboard/qpe-pickboard.postrm b/inputmethods/pickboard/qpe-pickboard.postrm
new file mode 100755
index 0000000..c254b01
--- a/dev/null
+++ b/inputmethods/pickboard/qpe-pickboard.postrm
@@ -0,0 +1,2 @@
+#!/bin/sh
+/opt/QtPalmtop/bin/qcop QPE/TaskBar "reloadInputMethods()"