Diffstat (limited to 'noncore/apps/opie-reader/QTReader.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReader.h | 138 |
1 files changed, 49 insertions, 89 deletions
diff --git a/noncore/apps/opie-reader/QTReader.h b/noncore/apps/opie-reader/QTReader.h index 3d5f57d..dfbdfb9 100644 --- a/noncore/apps/opie-reader/QTReader.h +++ b/noncore/apps/opie-reader/QTReader.h @@ -2,4 +2,6 @@ #define __QTREADER_H +//#define _SCROLLPIPE + #include <qwidget.h> //#include <qpainter.h> @@ -15,5 +17,4 @@ class QPainter; class QTimer; class QPixmap; -class statedata; class QTReader : public QWidget @@ -21,20 +22,35 @@ class QTReader : public QWidget Q_OBJECT + static tchar pluckernextpart[]; + static tchar jplucknextpart[]; friend class QTReaderApp; - void suspend() { buffdoc.suspend(); } + void suspend(); + void increaseScroll(); + void reduceScroll(); void drawText(QPainter& p, int x, int y, tchar* text); int m_delay; unsigned int m_overlap; - bool m_autoScroll; + bool m_autoScroll, m_swapmouse; void autoscroll(); QTimer* timer; - int m_scrolldy1, m_scrolldy2, m_encd; + int m_scrolldy1, m_scrolldy2, m_encd, m_scrollpart; void focusInEvent(QFocusEvent*); void focusOutEvent(QFocusEvent*); + void processmousepositionevent( QMouseEvent* _e ); + void processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno); bool ChangeFont(int); bool getline(CDrawBuffer*); int m_charWidth; int m_charpc; + unsigned char m_border; FontControl m_fontControl; + void setBaseSize(unsigned char _s) { m_fontControl.setBaseSize(_s); } + unsigned char getBaseSize() { return m_fontControl.getBaseSize(); } +#ifdef _SCROLLPIPE + FILE* m_pipeout; + QString m_pipetarget; + bool m_isPaused; + bool m_pauseAfterEachPara; +#endif public: QTReader( QWidget *parent=0, const char *name=0, WFlags f = 0); @@ -87,86 +103,19 @@ public: }; */ - void setpeanut(bool _b) - { - bpeanut = _b; - setfilter(getfilter()); - } - void setremap(bool _b) + void setlead(int _lead) { - bremap = _b; - setfilter(getfilter()); + m_fontControl.setlead(_lead); } - void setmakebold(bool _b) + int getlead() { - bmakebold = _b; - setfilter(getfilter()); + return m_fontControl.getlead(); } - void setautofmt(bool _b) - { - bautofmt = _b; - if (bautofmt) + void setextraspace(int _lead) { - btextfmt = false; - bstriphtml = false;; - bpeanut = false; - } - setfilter(getfilter()); + m_fontControl.setextraspace(_lead); } - void settextfmt(bool _b) + int getextraspace() { - btextfmt = _b; - setfilter(getfilter()); - } - void setstripcr(bool _b) - { - bstripcr = _b; - setfilter(getfilter()); - } - void setonespace(bool _b) - { - bonespace = _b; - setfilter(getfilter()); - } -#ifdef REPALM - void setrepalm(bool _b) - { - brepalm = _b; - setfilter(getfilter()); - } -#endif - void setstriphtml(bool _b) - { - bstriphtml = _b; - setfilter(getfilter()); - } - void setdehyphen(bool _b) - { - bdehyphen = _b; - setfilter(getfilter()); - } - void setunindent(bool _b) - { - bunindent = _b; - setfilter(getfilter()); - } - void setrepara(bool _b) - { - brepara = _b; - setfilter(getfilter()); - } - void setdblspce(bool _b) - { - bdblspce = _b; - setfilter(getfilter()); - } - void indentplus() - { - if (bindenter < 15) bindenter += 2; - setfilter(getfilter()); - } - void indentminus() - { - if (bindenter > 1) bindenter -= 2; - setfilter(getfilter()); + return m_fontControl.getextraspace(); } void setpagemode(bool _b) @@ -188,19 +137,24 @@ public: CEncoding* getencoding() { +// qDebug("m_encd:%d", m_encd); switch (m_encd) { - case 5: - return new Ccp1252; case 4: +// qDebug("palm"); return new CPalm; case 1: +// qDebug("utf8"); return new CUtf8; case 2: +// qDebug("ucs16be"); return new CUcs16be; case 3: +// qDebug("ucs16le"); return new CUcs16le; case 0: - default: +// qDebug("ascii"); return new CAscii; + default: + return new CGeneral8Bit(m_encd-MAX_ENCODING+1); } } @@ -224,5 +178,8 @@ public: #endif if (bremap) filt->addfilter(new remap); + if (bdepluck) filt->addfilter(new DePluck(pluckernextpart)); + if (bdejpluck) filt->addfilter(new DePluck(jplucknextpart)); if (bmakebold) filt->addfilter(new embolden); + if (bfulljust) filt->addfilter(new FullJust); return filt; } @@ -230,4 +187,7 @@ public: private slots: + void goHome(); + void goBack(); + void goForward(); void doscroll(); void drawIt( QPainter * ); @@ -261,5 +221,6 @@ private slots: CBufferFace<size_t> locnarray; unsigned int numlines; - bool bstripcr, btextfmt, bstriphtml, bdehyphen, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace; +// bool m_showlast; + bool bstripcr, btextfmt, bstriphtml, bdehyphen, bdepluck, bdejpluck, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace, bfulljust; #ifdef REPALM bool brepalm; @@ -271,8 +232,8 @@ private slots: public: bool bDoUpdates; - bool m_navkeys; void NavUp(); void NavDown(); - int getch() { return buffdoc.getch(); } + tchar getch() { return buffdoc.getch(); } + bool synch(size_t, size_t); bool tight; bool load_file(const char *newfile, unsigned int lcn=0); @@ -293,5 +254,5 @@ private slots: int textsize() { return m_textsize; } void textsize(int ts) { m_textsize = ts; } - bool fillbuffer(int ru = 0, int ht = 0); + bool fillbuffer(int ru = 0, int ht = 0, int newht = -1); unsigned int screenlines(); void sizes(unsigned long& fs, unsigned long& ts) { buffdoc.unsuspend(); buffdoc.sizes(fs,ts); } @@ -301,11 +262,10 @@ private slots: QFontMetrics* m_fm; QString firstword(); - void setstate(const statedata& sd); signals: void OnRedraw(); void OnWordSelected(const QString&, size_t, const QString&); - void OnActionPressed(); - void OnShowPicture(QPixmap&); + void OnShowPicture(QImage&); + void OnURLSelected(const QString&); }; |