summaryrefslogtreecommitdiff
path: root/inputmethods/handwriting
authorbrad <brad>2004-03-21 12:42:10 (UTC)
committer brad <brad>2004-03-21 12:42:10 (UTC)
commitde722623b49574659f6ef5b065076cb1609f81dd (patch) (unidiff)
tree0d2ca78cfe42c71787a3e160b245285e18d900d3 /inputmethods/handwriting
parent2560326d09f90f0afce24577cafbfd4c1f5e4b23 (diff)
downloadopie-de722623b49574659f6ef5b065076cb1609f81dd.zip
opie-de722623b49574659f6ef5b065076cb1609f81dd.tar.gz
opie-de722623b49574659f6ef5b065076cb1609f81dd.tar.bz2
Fixes for graffiti handling. Contains a dirty hack that will be rectified when I commit the Graffiti charset.
Diffstat (limited to 'inputmethods/handwriting') (more/less context) (show whitespace changes)
-rw-r--r--inputmethods/handwriting/qimpenchar.h2
-rw-r--r--inputmethods/handwriting/qimpenprofile.cpp3
-rw-r--r--inputmethods/handwriting/qimpensetup.cpp17
-rw-r--r--inputmethods/handwriting/qimpensetup.h1
4 files changed, 19 insertions, 4 deletions
diff --git a/inputmethods/handwriting/qimpenchar.h b/inputmethods/handwriting/qimpenchar.h
index e4e7645..92ee2c1 100644
--- a/inputmethods/handwriting/qimpenchar.h
+++ b/inputmethods/handwriting/qimpenchar.h
@@ -108,25 +108,25 @@ public:
108 unsigned int count() const { return chars.count(); } 108 unsigned int count() const { return chars.count(); }
109 void clear() { chars.clear(); } 109 void clear() { chars.clear(); }
110 110
111 void setDescription( const QString &d ) { desc = d; } 111 void setDescription( const QString &d ) { desc = d; }
112 QString description() const { return desc; } 112 QString description() const { return desc; }
113 void setTitle( const QString &t ) { csTitle = t; } 113 void setTitle( const QString &t ) { csTitle = t; }
114 QString title() const { return csTitle; } 114 QString title() const { return csTitle; }
115 115
116 QIMPenCharMatchList match( QIMPenChar *ch ); 116 QIMPenCharMatchList match( QIMPenChar *ch );
117 void addChar( QIMPenChar *ch ); 117 void addChar( QIMPenChar *ch );
118 void removeChar( QIMPenChar *ch ); 118 void removeChar( QIMPenChar *ch );
119 QIMPenChar *at( int i ); 119 QIMPenChar *at( int i );
120 void setHidden ( const bool &b ) { phidden = &b; } 120 void setHidden ( const bool &b ) { phidden = b; }
121 bool hidden() const { return phidden; } 121 bool hidden() const { return phidden; }
122 122
123 unsigned maximumStrokes() const { return maxStrokes; } 123 unsigned maximumStrokes() const { return maxStrokes; }
124 124
125 void up( QIMPenChar *ch ); 125 void up( QIMPenChar *ch );
126 void down( QIMPenChar *ch ); 126 void down( QIMPenChar *ch );
127 127
128 enum Domain { System, User }; 128 enum Domain { System, User };
129 enum Type { Unknown=0x00, Lower=0x01, Upper=0x02, Combining=0x04, 129 enum Type { Unknown=0x00, Lower=0x01, Upper=0x02, Combining=0x04,
130 Numeric=0x08, Punctuation=0x10, Symbol=0x20, Shortcut=0x40 }; 130 Numeric=0x08, Punctuation=0x10, Symbol=0x20, Shortcut=0x40 };
131 131
132 const QIMPenCharList &characters() const { return chars; } 132 const QIMPenCharList &characters() const { return chars; }
diff --git a/inputmethods/handwriting/qimpenprofile.cpp b/inputmethods/handwriting/qimpenprofile.cpp
index b1a6592..67343c3 100644
--- a/inputmethods/handwriting/qimpenprofile.cpp
+++ b/inputmethods/handwriting/qimpenprofile.cpp
@@ -133,41 +133,44 @@ void QIMPenProfile::loadData()
133 delete cs; 133 delete cs;
134 } 134 }
135 } 135 }
136 // lowercase latin1 136 // lowercase latin1
137 s = config.readEntry( "Lowercase" ); 137 s = config.readEntry( "Lowercase" );
138 if ( !s.isEmpty() ) { 138 if ( !s.isEmpty() ) {
139 if ( mono() ) { 139 if ( mono() ) {
140 cs = new QIMPenCharSet ( baseDir + "qimpen/" + s ); 140 cs = new QIMPenCharSet ( baseDir + "qimpen/" + s );
141 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 141 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
142 if ( !cs->isEmpty() ) { 142 if ( !cs->isEmpty() ) {
143 cs->setTitle( cs->title().upper() ); 143 cs->setTitle( cs->title().upper() );
144 cs->setType( QIMPenCharSet::Upper ); 144 cs->setType( QIMPenCharSet::Upper );
145 cs->setDescription( "Hidden uppercase" );
145 cs->setHidden ( true ); 146 cs->setHidden ( true );
146 QIMPenCharIterator it( cs->characters() ); 147 QIMPenCharIterator it( cs->characters() );
147 for ( ; it.current(); ++it ) { 148 for ( ; it.current(); ++it ) {
148 uint ch = it.current()->character(); 149 uint ch = it.current()->character();
149 if ( ch >= 'a' && ch <= 'z' ) 150 if ( ch >= 'a' && ch <= 'z' )
150 it.current()->setCharacter( QChar(ch).upper() ); 151 it.current()->setCharacter( QChar(ch).upper() );
151 } 152 }
152 if ( combining ) 153 if ( combining )
153 combining->addCombined( cs ); 154 combining->addCombined( cs );
154 sets.append( cs ); 155 sets.append( cs );
155 } else { 156 } else {
156 delete cs; 157 delete cs;
157 } 158 }
158 } 159 }
159 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 160 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
160 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 161 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
161 if ( !cs->isEmpty() ) { 162 if ( !cs->isEmpty() ) {
163 if ( mono () )
164 cs->setDescription( "Latin Characters" );
162 if ( combining ) 165 if ( combining )
163 combining->addCombined( cs ); 166 combining->addCombined( cs );
164 sets.append( cs ); 167 sets.append( cs );
165 } else { 168 } else {
166 delete cs; 169 delete cs;
167 } 170 }
168 } 171 }
169 // numeric (may comtain punctuation and symbols) 172 // numeric (may comtain punctuation and symbols)
170 s = config.readEntry( "Numeric" ); 173 s = config.readEntry( "Numeric" );
171 if ( !s.isEmpty() ) { 174 if ( !s.isEmpty() ) {
172 cs = new QIMPenCharSet( baseDir + "qimpen/" + s ); 175 cs = new QIMPenCharSet( baseDir + "qimpen/" + s );
173 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User ); 176 cs->load( Global::applicationFileName("qimpen",s), QIMPenCharSet::User );
diff --git a/inputmethods/handwriting/qimpensetup.cpp b/inputmethods/handwriting/qimpensetup.cpp
index d1297a9..3f4841d 100644
--- a/inputmethods/handwriting/qimpensetup.cpp
+++ b/inputmethods/handwriting/qimpensetup.cpp
@@ -317,25 +317,25 @@ QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent,
317 currentCode = 0; 317 currentCode = 0;
318 inputChar = new QIMPenChar(); 318 inputChar = new QIMPenChar();
319 319
320 QVBoxLayout *tvb = new QVBoxLayout( this, 5 ); 320 QVBoxLayout *tvb = new QVBoxLayout( this, 5 );
321 321
322 QGridLayout *gl = new QGridLayout( tvb, 4, 2 ); 322 QGridLayout *gl = new QGridLayout( tvb, 4, 2 );
323 gl->setRowStretch( 1, 1 ); 323 gl->setRowStretch( 1, 1 );
324 gl->addRowSpacing( 2, 35 ); 324 gl->addRowSpacing( 2, 35 );
325 gl->addRowSpacing( 3, 35 ); 325 gl->addRowSpacing( 3, 35 );
326 326
327 charSetCombo = new QComboBox( this ); 327 charSetCombo = new QComboBox( this );
328 gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 ); 328 gl->addMultiCellWidget( charSetCombo, 0, 0, 0, 1 );
329 connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSet(int))); 329 connect( charSetCombo, SIGNAL(activated(int)), SLOT(selectCharSetVisible(int)));
330 QIMPenCharSetIterator it( profile->charSets() ); 330 QIMPenCharSetIterator it( profile->charSets() );
331 for ( ; it.current(); ++it ) { 331 for ( ; it.current(); ++it ) {
332 charSetCombo->insertItem( it.current()->description() ); 332 charSetCombo->insertItem( it.current()->description() );
333 } 333 }
334 334
335 charList = new QListBox( this ); 335 charList = new QListBox( this );
336 charList->setMinimumHeight( charList->sizeHint().height() ); 336 charList->setMinimumHeight( charList->sizeHint().height() );
337 connect( charList, SIGNAL(highlighted(int)), SLOT(selectChar(int)) ); 337 connect( charList, SIGNAL(highlighted(int)), SLOT(selectChar(int)) );
338 gl->addWidget( charList, 1, 0 ); 338 gl->addWidget( charList, 1, 0 );
339 339
340 pw = new QIMPenWidget( this ); 340 pw = new QIMPenWidget( this );
341 pw->setFixedHeight( 75 ); 341 pw->setFixedHeight( 75 );
@@ -379,41 +379,41 @@ QIMPenEdit::QIMPenEdit( QIMPenProfile *p, QWidget *parent,
379 379
380 //-- 380 //--
381#if !defined(Q_WS_QWS) 381#if !defined(Q_WS_QWS)
382 hb = new QHBoxLayout( tvb ); 382 hb = new QHBoxLayout( tvb );
383 pb = new QPushButton( tr("OK"), this ); 383 pb = new QPushButton( tr("OK"), this );
384 connect( pb, SIGNAL(clicked()), SLOT(accept()) ); 384 connect( pb, SIGNAL(clicked()), SLOT(accept()) );
385 hb->addWidget( pb ); 385 hb->addWidget( pb );
386 386
387 pb = new QPushButton( tr("Cancel"), this ); 387 pb = new QPushButton( tr("Cancel"), this );
388 connect( pb, SIGNAL(clicked()), SLOT(reject()) ); 388 connect( pb, SIGNAL(clicked()), SLOT(reject()) );
389 hb->addWidget( pb ); 389 hb->addWidget( pb );
390#endif 390#endif
391 selectCharSet( 0 ); 391 selectCharSetVisible( 0 );
392 charList->setFocus(); 392 charList->setFocus();
393 393
394 resize( minimumSize() ); 394 resize( minimumSize() );
395 enableButtons(); 395 enableButtons();
396} 396}
397 397
398void QIMPenEdit::setProfile( QIMPenProfile *p ) 398void QIMPenEdit::setProfile( QIMPenProfile *p )
399{ 399{
400 profile = p; 400 profile = p;
401 charSetCombo->clear(); 401 charSetCombo->clear();
402 QIMPenCharSetIterator it( profile->charSets() ); 402 QIMPenCharSetIterator it( profile->charSets() );
403 for ( ; it.current(); ++it ) { 403 for ( ; it.current(); ++it ) {
404 if ( ! it.current()->hidden() ) 404 if ( ! it.current()->hidden() )
405 charSetCombo->insertItem( it.current()->description() ); 405 charSetCombo->insertItem( it.current()->description() );
406 } 406 }
407 selectCharSet( 0 ); 407 selectCharSetVisible( 0 );
408 charList->setFocus(); 408 charList->setFocus();
409 enableButtons(); 409 enableButtons();
410} 410}
411 411
412void QIMPenEdit::selectCharSet( QIMPenCharSet *c ) 412void QIMPenEdit::selectCharSet( QIMPenCharSet *c )
413{ 413{
414 int i = 0; 414 int i = 0;
415 QIMPenCharSetIterator it( profile->charSets() ); 415 QIMPenCharSetIterator it( profile->charSets() );
416 for ( ; it.current(); ++it, i++ ) { 416 for ( ; it.current(); ++it, i++ ) {
417 if ( it.current() == c ) { 417 if ( it.current() == c ) {
418 charSetCombo->setCurrentItem( i ); 418 charSetCombo->setCurrentItem( i );
419 selectCharSet( i ); 419 selectCharSet( i );
@@ -540,24 +540,35 @@ void QIMPenEdit::selectChar( int i )
540 for ( ; it.current(); ++it ) { 540 for ( ; it.current(); ++it ) {
541 if ( it.current()->character() == currentCode && 541 if ( it.current()->character() == currentCode &&
542 !it.current()->testFlag( QIMPenChar::Deleted ) ) { 542 !it.current()->testFlag( QIMPenChar::Deleted ) ) {
543 setCurrentChar( it.current() ); 543 setCurrentChar( it.current() );
544 break; 544 break;
545 } 545 }
546 } 546 }
547 if ( !it.current() ) 547 if ( !it.current() )
548 setCurrentChar( 0 ); 548 setCurrentChar( 0 );
549 inputChar->clear(); 549 inputChar->clear();
550} 550}
551 551
552void QIMPenEdit::selectCharSetVisible( int c )
553{
554 int i = 0;
555 QIMPenCharSetIterator it( profile->charSets() );
556 for ( ; it.current(); ++it, i++ ) {
557 if ( charSetCombo->text( c ) == it.current()->description() ) {
558 selectCharSet( i );
559 }
560 }
561}
562
552void QIMPenEdit::selectCharSet( int i ) 563void QIMPenEdit::selectCharSet( int i )
553{ 564{
554 if ( currentSet ) 565 if ( currentSet )
555 pw->removeCharSet( 0 ); 566 pw->removeCharSet( 0 );
556 currentSet = profile->charSets().at( i ); 567 currentSet = profile->charSets().at( i );
557 fillCharList(); 568 fillCharList();
558 pw->insertCharSet( currentSet ); 569 pw->insertCharSet( currentSet );
559 inputChar->clear(); 570 inputChar->clear();
560 if ( charList->count() ) { 571 if ( charList->count() ) {
561 charList->setSelected( 0, TRUE ); 572 charList->setSelected( 0, TRUE );
562 selectChar(0); 573 selectChar(0);
563 } 574 }
diff --git a/inputmethods/handwriting/qimpensetup.h b/inputmethods/handwriting/qimpensetup.h
index 5d3064b..93b981b 100644
--- a/inputmethods/handwriting/qimpensetup.h
+++ b/inputmethods/handwriting/qimpensetup.h
@@ -91,24 +91,25 @@ protected:
91 void fillCharList(); 91 void fillCharList();
92 void enableButtons(); 92 void enableButtons();
93 QIMPenChar *findPrev(); 93 QIMPenChar *findPrev();
94 QIMPenChar *findNext(); 94 QIMPenChar *findNext();
95 void setCurrentChar( QIMPenChar * ); 95 void setCurrentChar( QIMPenChar * );
96 96
97protected slots: 97protected slots:
98 void prevChar(); 98 void prevChar();
99 void nextChar(); 99 void nextChar();
100 void clearChar(); 100 void clearChar();
101 void selectChar( int ); 101 void selectChar( int );
102 void selectCharSet( int ); 102 void selectCharSet( int );
103 void selectCharSetVisible( int );
103 void addChar(); 104 void addChar();
104 void addNewChar(); 105 void addNewChar();
105 void removeChar(); 106 void removeChar();
106 void defaultChars(); 107 void defaultChars();
107 void newStroke( QIMPenStroke * ); 108 void newStroke( QIMPenStroke * );
108 109
109protected: 110protected:
110 QIMPenWidget *pw; 111 QIMPenWidget *pw;
111 QComboBox *charSetCombo; 112 QComboBox *charSetCombo;
112 QListBox *charList; 113 QListBox *charList;
113 QPushButton *newBtn; 114 QPushButton *newBtn;
114 QPushButton *addBtn; 115 QPushButton *addBtn;