author | brad <brad> | 2004-04-05 13:31:49 (UTC) |
---|---|---|
committer | brad <brad> | 2004-04-05 13:31:49 (UTC) |
commit | d3f1c6026d3cbba9fd8f8a5bc722c9e8488c045b (patch) (side-by-side diff) | |
tree | f313bde2c45d1a90ef5949f77c48943b57a312cd /inputmethods | |
parent | 743adf3ed3032feb15e71002613a4643d059aa09 (diff) | |
download | opie-d3f1c6026d3cbba9fd8f8a5bc722c9e8488c045b.zip opie-d3f1c6026d3cbba9fd8f8a5bc722c9e8488c045b.tar.gz opie-d3f1c6026d3cbba9fd8f8a5bc722c9e8488c045b.tar.bz2 |
qDebug -> odebug
-rw-r--r-- | inputmethods/handwriting/qimpenchar.cpp | 9 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpeninput.cpp | 24 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpenmatch.cpp | 35 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpenstroke.cpp | 15 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpenwordpick.cpp | 2 |
5 files changed, 45 insertions, 40 deletions
diff --git a/inputmethods/handwriting/qimpenchar.cpp b/inputmethods/handwriting/qimpenchar.cpp index 929f370..db5d135 100644 --- a/inputmethods/handwriting/qimpenchar.cpp +++ b/inputmethods/handwriting/qimpenchar.cpp @@ -13,32 +13,33 @@ ** ** 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 <qfile.h> #include <qtl.h> #include <math.h> #include <limits.h> #include <errno.h> #include <qdatastream.h> #include "qimpencombining.h" #include "qimpenchar.h" +#include "opie2/odebug.h" #define QIMPEN_MATCH_THRESHOLD 200000 const QIMPenSpecialKeys qimpen_specialKeys[] = { { Qt::Key_Escape, "[Esc]" }, { Qt::Key_Tab, "[Tab]" }, { Qt::Key_Backspace, "[BackSpace]" }, { Qt::Key_Return, "[Return]" }, { QIMPenChar::Caps, "[Uppercase]" }, { QIMPenChar::CapsLock, "[Caps Lock]" }, { QIMPenChar::Shortcut, "[Shortcut]" }, { QIMPenChar::Punctuation, "[Punctuation]" }, { QIMPenChar::Symbol, "[Symbol]" }, { QIMPenChar::Extended, "[Extended]" }, { Qt::Key_unknown, 0 } }; @@ -154,48 +155,48 @@ int QIMPenChar::match( QIMPenChar *pen ) maxErr = err; ++it1; ++it2; while ( err < 400000 && it1.current() && it2.current() ) { QPoint p1 = it1.current()->boundingRect().center() - strokes.getFirst()->boundingRect().center(); QPoint p2 = it2.current()->boundingRect().center() - pen->strokes.getFirst()->boundingRect().center(); int xdiff = QABS( p1.x() - p2.x() ) - 6; int ydiff = QABS( p1.y() - p2.y() ) - 5; if ( xdiff < 0 ) xdiff = 0; if ( ydiff < 0 ) ydiff = 0; if ( xdiff > 10 || ydiff > 10 ) { // not a chance #ifdef DEBUG_QIMPEN - qDebug( "char %c, stroke starting pt diff excessive", pen->ch ); + odebug << "char " << pen->ch <<", stroke starting pt diff excessive" << oendl; #endif return INT_MAX; } diff += xdiff*xdiff + ydiff*ydiff; err = it1.current()->match( it2.current() ); if ( err > maxErr ) maxErr = err; ++it1; ++it2; } maxErr += diff * diff * 6; // magic weighting :) #ifdef DEBUG_QIMPEN - qDebug( "char: %c, maxErr %d, diff %d, (%d)", pen->ch, maxErr, diff, strokes.count() ); + odebug << "char: " << pen->ch << ", maxErr " << maxErr << ", diff " << diff << ", " << strokes.count() << oendl; #endif return maxErr; } /*! Return the bounding rect of this character. It may have sides with negative coords since its origin is where the user started drawing the character. */ QRect QIMPenChar::boundingRect() { QRect br; QIMPenStroke *st = strokes.first(); while ( st ) { br |= st->boundingRect(); st = strokes.next(); @@ -445,34 +446,34 @@ QIMPenCharMatchList QIMPenCharSet::match( QIMPenChar *ch ) break; } } if ( it == matches.end() ) { QIMPenCharMatch m; m.error = err; m.penChar = tmplChar; matches.append( m ); } } } } qHeapSort( matches ); /* QIMPenCharMatchList::Iterator it; for ( it = matches.begin(); it != matches.end(); ++it ) { - qDebug( "Match: \'%c\', error %d, strokes %d", (*it).penChar->character(), - (*it).error, (*it).penChar->penStrokes().count() ); + + odebug << "Match: \'" << (*it).penChar->character() "\', error " << (*it).error ", strokes " <<(*it).penChar->penStrokes().count() << oendl; } */ return matches; } /*! Add a character \a ch to this set. QIMPenCharSet will delete this character when it is no longer needed. */ void QIMPenCharSet::addChar( QIMPenChar *ch ) { if ( ch->penStrokes().count() > maxStrokes ) maxStrokes = ch->penStrokes().count(); chars.append( ch ); } diff --git a/inputmethods/handwriting/qimpeninput.cpp b/inputmethods/handwriting/qimpeninput.cpp index d073cdf..6ea1bb4 100644 --- a/inputmethods/handwriting/qimpeninput.cpp +++ b/inputmethods/handwriting/qimpeninput.cpp @@ -23,32 +23,33 @@ #include "qimpeninput.h" #include "qimpencombining.h" #include "qimpenwordpick.h" #include "qimpenmatch.h" #include "qimpenhelp.h" #include <qpe/qpeapplication.h> #include <qpe/qdawg.h> #include <qpe/config.h> #include <qpe/global.h> #include <qlayout.h> #include <qpushbutton.h> #include <qlabel.h> #include <qtimer.h> #include <qdir.h> +#include <opie2/odebug.h> #include <limits.h> // We'll use little pixmaps for the buttons to save screen space. /* XPM */ static const char * const pen_xpm[] = { "12 12 4 1", " c None", ". c #000000", "+ c #FFFFFF", "@ c #808080", " . ", " .+. ", " ..@@.", " .+@.. ", @@ -306,33 +307,33 @@ void QIMPenInput::selectProfile( const QString &name ) void QIMPenInput::wordPicked( const QString &w ) { int bs = matcher->word().length(); for ( int i = 0; i < bs; i++ ) keypress( Qt::Key_Backspace << 16 ); for ( unsigned int i = 0; i < w.length(); i++ ) keypress( w[i].unicode() ); matcher->resetState(); wordPicker->clear(); } void QIMPenInput::selectCharSet( int idx ) { if ( mode == Switch ) { - //qDebug( "Switch back to normal" ); + //odebug << "Switch back to normal" << oendl; pw->changeCharSet( baseSets.at(currCharSet), currCharSet ); mode = Normal; } currCharSet = idx; } void QIMPenInput::beginStroke() { } void QIMPenInput::strokeEntered( QIMPenStroke * ) { pw->greyStroke(); } void QIMPenInput::erase() @@ -340,75 +341,76 @@ void QIMPenInput::erase() keypress( Qt::Key_Backspace << 16 ); } void QIMPenInput::matchedCharacters( const QIMPenCharMatchList &cl ) { const QIMPenChar *ch = cl.first().penChar; int scan = ch->character() >> 16; if ( scan < QIMPenChar::ModeBase ) return; // We matched a special character... switch ( scan ) { case QIMPenChar::Caps: if ( profile->style() == QIMPenProfile::ToggleCases ) { -// qDebug( "Caps" ); +// odebug << "Caps" << oendl; +// if ( mode == SwitchLock ) { -// qDebug( "Switch to normal" ); +// odebug << "Switch to normal" << oendl; pw->changeCharSet( profile->lowercase(), currCharSet ); mode = Switch; } else { -// qDebug( "Switch to upper" ); +// odebug << "Switch to upper" << oendl; pw->changeCharSet( profile->uppercase(), currCharSet ); mode = Switch; } } break; case QIMPenChar::CapsLock: if ( profile->style() == QIMPenProfile::ToggleCases ) { -// qDebug( "CapsLock" ); +// odebug << "CapsLock" << oendl; if ( mode == Switch && baseSets.at(currCharSet) == profile->uppercase() ) { -// qDebug( "Switch to normal" ); +// odebug << "Switch to normal" << oendl; pw->changeCharSet( profile->lowercase(), currCharSet ); // change our base set back to lower. baseSets.remove( currCharSet ); baseSets.insert( currCharSet, profile->lowercase() ); mode = Normal; } else { -// qDebug( "Switch to caps lock" ); +// odebug << "Switch to caps lock" << oendl; pw->changeCharSet( profile->uppercase(), currCharSet ); // change our base set to upper. baseSets.remove( currCharSet ); baseSets.insert( currCharSet, profile->uppercase() ); mode = SwitchLock; } } break; case QIMPenChar::Punctuation: if ( profile->punctuation() ) { - //qDebug( "Switch to punctuation" ); + //odebug << "Switch to punctuation" << oendl; pw->changeCharSet( profile->punctuation(), currCharSet ); mode = Switch; } break; case QIMPenChar::Symbol: if ( profile->symbol() ) { - //qDebug( "Switch to symbol" ); + //odebug << "Switch to symbol" << oendl ; pw->changeCharSet( profile->symbol(), currCharSet ); mode = Switch; } break; case QIMPenChar::Shortcut: if ( shortcutCharSet ) { pw->changeCharSet( shortcutCharSet, currCharSet ); mode = Switch; } break; case QIMPenChar::Extended: handleExtended( ch->data() ); break; } } @@ -430,49 +432,49 @@ void QIMPenInput::keypress( uint scan_uni ) scan_uni = 9; break; case Key_Return: scan_uni = 13; break; case Key_Backspace: scan_uni = 8; break; case Key_Escape: scan_uni = 27; break; default: break; } if ( mode == Switch ) { -// qDebug( "Switch back to normal" ); +// odebug << "Switch back to normal" << oendl ; pw->changeCharSet( baseSets.at(currCharSet), currCharSet ); if ( baseSets.at(currCharSet) == profile->uppercase() ) mode = SwitchLock; else mode = Normal; } emit key( scan_uni&0xffff, scan, 0, true, false ); emit key( scan_uni&0xffff, scan, 0, false, false ); } void QIMPenInput::handleExtended( const QString &ex ) { if ( ex.find( "Select" ) == 0 ) { QString set = ex.mid( 7 ); - qDebug( "Select new profile: %s", set.latin1() ); + odebug << "Select new profile: " << set.latin1() << oendl; selectProfile( set ); } } void QIMPenInput::help() { if ( helpDlg ) delete (HandwritingHelp*) helpDlg; helpDlg = new HandwritingHelp( profile, 0, 0, WDestructiveClose ); helpDlg->showMaximized(); helpDlg->show(); helpDlg->raise(); } /*! Open the setup dialog diff --git a/inputmethods/handwriting/qimpenmatch.cpp b/inputmethods/handwriting/qimpenmatch.cpp index 0d3e25a..a0448b6 100644 --- a/inputmethods/handwriting/qimpenmatch.cpp +++ b/inputmethods/handwriting/qimpenmatch.cpp @@ -12,32 +12,33 @@ ** 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 "qimpenmatch.h" #include <qpe/qdawg.h> #include <qpe/global.h> #include <qapplication.h> #include <qtimer.h> +#include <opie2/odebug.h> #include <limits.h> #define ERROR_THRESHOLD 200000 #define LOOKAHEAD_ERROR 2500 //#define DEBUG_QIMPEN QIMPenMatch::QIMPenMatch( QObject *parent, const char *name ) : QObject( parent, name ) { strokes.setAutoDelete( TRUE ); wordChars.setAutoDelete( TRUE ); wordMatches.setAutoDelete( TRUE ); multiTimer = new QTimer( this ); connect( multiTimer, SIGNAL(timeout()), this, SLOT(endMulti()) ); @@ -55,198 +56,198 @@ QIMPenMatch::~QIMPenMatch() { } void QIMPenMatch::setCharSet( QIMPenCharSet *cs ) { charSet = cs; } void QIMPenMatch::beginStroke() { multiTimer->stop(); } void QIMPenMatch::strokeEntered( QIMPenStroke *st ) { #ifdef DEBUG_QIMPEN - qDebug( "---------- new stroke -------------" ); + odebug << "---------- new stroke -------------" << oendl; #endif strokes.append( new QIMPenStroke( *st ) ); QIMPenChar testChar; QIMPenStrokeIterator it(strokes); for ( ; it.current(); ++it ) { testChar.addStroke( it.current() ); } QIMPenCharMatchList ml; if ( strokes.count() > 1 && multiCharSet ) { #ifdef DEBUG_QIMPEN - qDebug( "Matching against multi set" ); + odebug << "Matching against multi set" << oendl; #endif ml = multiCharSet->match( &testChar ); } else { #ifdef DEBUG_QIMPEN - qDebug( "Matching against single set" ); + odebug << "Matching against single set" << oendl; #endif ml = charSet->match( &testChar ); } processMatches( ml ); } void QIMPenMatch::processMatches( QIMPenCharMatchList &ml ) { #ifdef DEBUG_QIMPEN - qDebug( "Entering strokes.count() = %d", strokes.count() ); + odebug << "Entering strokes.count() = " << strokes.count() << oendl; #endif QIMPenCharMatch candidate1 = { INT_MAX, 0 }; QIMPenCharMatch candidate2 = { INT_MAX, 0 }; QIMPenCharMatchList ml2; if ( ml.count() ) {//&& // ml.first().penChar->penStrokes().count() == strokes.count() ) { candidate1 = ml.first(); #ifdef DEBUG_QIMPEN - qDebug( QString("Candidate1 = %1").arg(QChar(candidate1.penChar->character())) ); + odebug << "Candidate1 = " << candidate1.penChar->character() << oendl; #endif } if ( strokes.count() > 1 ) { // See if the last stroke can match a new character QIMPenChar testChar; QIMPenStroke *st = strokes.at(strokes.count()-1); testChar.addStroke( st ); ml2 = charSet->match( &testChar ); if ( ml2.count() ) { candidate2 = ml2.first(); #ifdef DEBUG_QIMPEN - qDebug( QString("Candidate2 = %1").arg(QChar(candidate2.penChar->character())) ); + odebug << "Candidate2 = " << candidate2.penChar->character() << oendl; #endif } } bool eraseLast = FALSE; bool output = TRUE; if ( candidate1.penChar && candidate2.penChar ) { // Hmmm, a multi-stroke or a new character are both possible. // Bias the multi-stroke case. if ( QMAX(candidate2.error, prevMatchError)*3 < candidate1.error ) { int i = strokes.count()-1; while ( i-- ) { strokes.removeFirst(); emit removeStroke(); } prevMatchChar = candidate2.penChar; prevMatchError = candidate2.error; multiCharSet = charSet; ml = ml2; #ifdef DEBUG_QIMPEN - qDebug( "** Using Candidate2" ); + odebug << "** Using Candidate2" << oendl; #endif } else { if ( (prevMatchChar->character() >> 16) != Qt::Key_Backspace && (prevMatchChar->character() >> 16) < QIMPenChar::ModeBase ) eraseLast = TRUE; prevMatchChar = candidate1.penChar; prevMatchError = candidate1.error; #ifdef DEBUG_QIMPEN - qDebug( "** Using Candidate1, with erase" ); + odebug << "** Using Candidate1, with erase" << oendl; #endif } } else if ( candidate1.penChar ) { if ( strokes.count() != 1 ) eraseLast = TRUE; else multiCharSet = charSet; prevMatchChar = candidate1.penChar; prevMatchError = candidate1.error; #ifdef DEBUG_QIMPEN - qDebug( "** Using Candidate1" ); + odebug << "** Using Candidate1" << oendl; #endif } else if ( candidate2.penChar ) { int i = strokes.count()-1; while ( i-- ) { strokes.removeFirst(); emit removeStroke(); } prevMatchChar = candidate2.penChar; prevMatchError = candidate2.error; multiCharSet = charSet; ml = ml2; #ifdef DEBUG_QIMPEN - qDebug( "** Using Candidate2" ); + odebug << "** Using Candidate2" << oendl; #endif } else { if ( !ml.count() ) { #ifdef DEBUG_QIMPEN - qDebug( "** Failed" ); + odebug << "** Failed" << oendl; #endif canErase = FALSE; } else { #ifdef DEBUG_QIMPEN - qDebug( "Need more strokes" ); + odebug << "Need more strokes" << oendl; #endif if ( strokes.count() == 1 ) canErase = FALSE; multiCharSet = charSet; } output = FALSE; emit noMatch(); } if ( eraseLast && canErase ) { #ifdef DEBUG_QIMPEN - qDebug( "deleting last" ); + odebug << "deleting last" << oendl; #endif emit erase(); wordChars.removeLast(); wordEntered.truncate( wordEntered.length() - 1 ); } if ( output ) { emit matchedCharacters( ml ); uint code = prevMatchChar->character() >> 16; if ( code < QIMPenChar::ModeBase ) { updateWordMatch( ml ); emit keypress( prevMatchChar->character() ); } canErase = TRUE; } if ( strokes.count() ) multiTimer->start( multiTimeout, TRUE ); } void QIMPenMatch::updateWordMatch( QIMPenCharMatchList &ml ) { if ( !ml.count() || !doWordMatching ) return; int ch = ml.first().penChar->character(); QChar qch( ch ); int code = ch >> 16; if ( qch.isPunct() || qch.isSpace() || code == Qt::Key_Enter || code == Qt::Key_Return || code == Qt::Key_Tab || code == Qt::Key_Escape ) { -// qDebug( "Word Matching: Clearing word" ); +// odebug << "Word Matching: Clearing word" << oendl; wordChars.clear(); wordMatches.clear(); wordEntered = QString(); } else if ( code == Qt::Key_Backspace ) { - //qDebug( "Word Matching: Handle backspace" ); + //odebug << "Word Matching: Handle backspace" << oendl; wordChars.removeLast(); wordEntered.truncate( wordEntered.length() - 1 ); matchWords(); } else { QIMPenChar *matchCh; wordChars.append( new QIMPenCharMatchList() ); wordEntered += ml.first().penChar->character(); QIMPenCharMatchList::Iterator it; for ( it = ml.begin(); it != ml.end(); ++it ) { matchCh = (*it).penChar; if ( matchCh->penStrokes().count() == strokes.count() ) { QChar ch(matchCh->character()); if ( !ch.isPunct() && !ch.isSpace() ) { @@ -268,37 +269,37 @@ void QIMPenMatch::matchWords() if ( badMatches < 200 ) errorThreshold += (200 - badMatches) * 100; } else errorThreshold = ERROR_THRESHOLD; wordMatches.clear(); goodMatches = 0; badMatches = 0; if ( wordChars.count() > 0 ) { maxGuess = (int)wordChars.count() * 2; if ( maxGuess < 3 ) maxGuess = 3; QString str; scanDict( Global::fixedDawg().root(), 0, str, 0 ); /* QListIterator<MatchWord> it( wordMatches); for ( ; it.current(); ++it ) { - qDebug( QString("Match word: %1").arg(it.current()->word) ); + odebug << "Match word: " << it.current()->word << oendl; } */ } - //qDebug( "Possibles: Good %d, total %d", goodMatches, wordMatches.count() ); + //odebug << "Possibles: Good " << goodMatches << ", total " << wordMatches.count() << oendl; wordMatches.sort(); } void QIMPenMatch::scanDict( const QDawg::Node* n, int ipos, const QString& str, int error ) { if ( !n ) return; if ( error / (ipos+1) > errorThreshold ) return; while (n) { if ( goodMatches > 20 ) break; if ( ipos < (int)wordChars.count() ) { int i; QChar testCh = QChar(n->letter()); diff --git a/inputmethods/handwriting/qimpenstroke.cpp b/inputmethods/handwriting/qimpenstroke.cpp index 3567d6d..14e435a 100644 --- a/inputmethods/handwriting/qimpenstroke.cpp +++ b/inputmethods/handwriting/qimpenstroke.cpp @@ -11,58 +11,59 @@ ** 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 <qfile.h> #include <qtl.h> #include <math.h> #include <limits.h> #include <qdatastream.h> #include "qimpenstroke.h" +#include "opie2/odebug.h" #define QIMPEN_CORRELATION_POINTS 25 //#define DEBUG_QIMPEN /*! \class QIMPenStroke qimpenstroke.h Handles a single stroke. Can calculate closeness of match to another stroke. */ QIMPenStroke::QIMPenStroke() { } QIMPenStroke::QIMPenStroke( const QIMPenStroke &st ) { startPoint = st.startPoint; lastPoint = st.lastPoint; links = st.links.copy(); } QIMPenStroke &QIMPenStroke::operator=( const QIMPenStroke &s ) { clear(); - //qDebug( "copy strokes %d", s.links.count() ); + //odebug << "copy strokes " << s.links.count() << oendl; startPoint = s.startPoint; lastPoint = s.lastPoint; links = s.links.copy(); return *this; } void QIMPenStroke::clear() { startPoint = QPoint(0,0); lastPoint = QPoint( 0, 0 ); links.resize( 0 ); tsig.resize( 0 ); dsig.resize( 0 ); asig.resize( 0 ); } @@ -136,53 +137,53 @@ bool QIMPenStroke::addPoint( QPoint p ) return TRUE; } /*! Finish inputting a stroke. */ void QIMPenStroke::endInput() { if ( links.count() < 3 ) { QIMPenGlyphLink gl; links.resize(1); gl.dx = 1; gl.dy = 0; links[0] = gl; } - //qDebug("Points: %d", links.count() ); + //odebug << "Points: " << links.count() << oendl; } /*! Return an indicator of the closeness of this stroke to \a pen. Lower value is better. */ unsigned int QIMPenStroke::match( QIMPenStroke *pen ) { double lratio; if ( links.count() > pen->links.count() ) lratio = (links.count()+2) / (pen->links.count()+2); else lratio = (pen->links.count()+2) / (links.count()+2); lratio -= 1.0; if ( lratio > 2.0 ) { #ifdef DEBUG_QIMPEN - qDebug( "stroke length too different" ); + odebug << "stroke length too different" << oendl; #endif return 400000; } createSignatures(); pen->createSignatures(); // Starting point offset int vdiff = QABS(startPoint.y() - pen->startPoint.y()); // Insanely offset? if ( vdiff > 18 ) { return 400000; } vdiff -= 4; @@ -202,65 +203,65 @@ unsigned int QIMPenStroke::match( QIMPenStroke *pen ) // do a correlation with the three available signatures. int err1 = INT_MAX; int err2 = INT_MAX; int err3 = INT_MAX; // base has extra points at the start and end to enable // correlation of a sliding window with the pen supplied. QArray<int> base = createBase( tsig, 2 ); for ( int i = 0; i < 4; i++ ) { int e = calcError( base, pen->tsig, i, TRUE ); if ( e < err1 ) err1 = e; } if ( err1 > 40 ) { // no need for more matching #ifdef DEBUG_QIMPEN - qDebug( "tsig too great: %d", err1 ); + odebug << "tsig too great: " << err1 << oendl; #endif return 400000; } // maybe a sliding window is worthwhile for these too. err2 = calcError( dsig, pen->dsig, 0, FALSE ); if ( err2 > 100 ) { #ifdef DEBUG_QIMPEN - qDebug( "dsig too great: %d", err2 ); + odebug << "dsig too great: " << err2 << oendl; #endif return 400000; } err3 = calcError( asig, pen->asig, 0, TRUE ); if ( err3 > 60 ) { #ifdef DEBUG_QIMPEN - qDebug( "asig too great: %d", err3 ); + odebug << "asig too great: " << err3 << oendl; #endif return 400000; } // Some magic numbers here - the addition reduces the weighting of // the error and compensates for the different error scales. I // consider the tangent signature to be the best indicator, so it // has the most weight. This ain't rocket science. // Basically, these numbers are the tuning factors. unsigned int err = (err1+1) * ( err2 + 60 ) * ( err3 + 20 ) + vdiff * 1000 + evdiff * 500 + (unsigned int)(lratio * 5000.0); #ifdef DEBUG_QIMPEN - qDebug( "err %d ( %d, %d, %d, %d)", err, err1, err2, err3, vdiff ); + odebug << "err " << err << "( " << err1 << ", " << err2 << ", " << err3 << ", " << vdiff << oendl; #endif return err; } /*! Return the bounding rect of this stroke. */ QRect QIMPenStroke::boundingRect() { if ( !bounding.isValid() ) { int x = startPoint.x(); int y = startPoint.y(); bounding = QRect( x, y, 1, 1 ); for ( unsigned i = 0; i < links.count(); i++ ) { diff --git a/inputmethods/handwriting/qimpenwordpick.cpp b/inputmethods/handwriting/qimpenwordpick.cpp index 8ee103d..39745c6 100644 --- a/inputmethods/handwriting/qimpenwordpick.cpp +++ b/inputmethods/handwriting/qimpenwordpick.cpp @@ -91,23 +91,23 @@ void QIMPenWordPick::paintEvent( QPaintEvent * ) if ( !idx ) x += 3; idx++; } } void QIMPenWordPick::mousePressEvent( QMouseEvent *e ) { clickWord = onWord( e->pos() ); repaint(); } void QIMPenWordPick::mouseReleaseEvent( QMouseEvent *e ) { int wordIdx = onWord( e->pos() ); if ( wordIdx >= 0 && wordIdx == clickWord ) { - //qDebug( "Clicked %s", words[wordIdx].latin1() ); + //odebug << "Clicked " << words[wordIdx].latin1() << oendl; emit wordClicked( words[wordIdx] ); } clickWord = -1; repaint(); } |