author | llornkcor <llornkcor> | 2002-09-14 02:19:09 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-14 02:19:09 (UTC) |
commit | 2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975 (patch) (side-by-side diff) | |
tree | eeed16b5f80dd5883991a7a06133f5f7a6936256 /noncore/apps/opie-reader/QTReader.h | |
parent | 5a95ed6a000a56849b8f093deea500214856c626 (diff) | |
download | opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.zip opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.tar.gz opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.tar.bz2 |
update by Tim
Diffstat (limited to 'noncore/apps/opie-reader/QTReader.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReader.h | 99 |
1 files changed, 77 insertions, 22 deletions
diff --git a/noncore/apps/opie-reader/QTReader.h b/noncore/apps/opie-reader/QTReader.h index 2efb988..78230b4 100644 --- a/noncore/apps/opie-reader/QTReader.h +++ b/noncore/apps/opie-reader/QTReader.h @@ -4,8 +4,13 @@ #include <qwidget.h> -#include <qpainter.h> -#include <qclipboard.h> -#include "CBuffer.h" +//#include <qpainter.h> #include "my_list.h" #include "BuffDoc.h" -#include <qtimer.h> +#include "FontControl.h" + +//#include <qtimer.h> + +class CDrawBuffer; +//class CBuffer; +class QPainter; +class QTimer; @@ -22,9 +27,10 @@ class QTReader : public QWidget QTimer* timer; - int m_scrolldy, m_encd; + int m_scrolldy1, m_scrolldy2, m_encd; void focusInEvent(QFocusEvent*); void focusOutEvent(QFocusEvent*); - void ChangeFont(int); - bool getline(CBuffer*); + bool ChangeFont(int); + bool getline(CDrawBuffer*); int m_charWidth; int m_charpc; + FontControl m_fontControl; public: @@ -68,2 +74,33 @@ public: */ + void setpeanut(bool _b) + { + bpeanut = _b; + setfilter(getfilter()); + } + void setremap(bool _b) + { + bremap = _b; + setfilter(getfilter()); + } + void setmakebold(bool _b) + { + bmakebold = _b; + setfilter(getfilter()); + } + void setautofmt(bool _b) + { + bautofmt = _b; + if (bautofmt) + { + btextfmt = false; + bstriphtml = false;; + bpeanut = false; + } + setfilter(getfilter()); + } + void settextfmt(bool _b) + { + btextfmt = _b; + setfilter(getfilter()); + } void setstripcr(bool _b) @@ -115,4 +152,4 @@ public: m_bMonoSpaced = _b; - ChangeFont(fontsizes[m_textsize]); - locate(pagepos); + ChangeFont(m_fontControl.currentsize()); + locate(pagelocate()); } @@ -123,2 +160,3 @@ public: } + MarkupType PreferredMarkup(); CEncoding* getencoding() @@ -146,3 +184,7 @@ public: if (bstripcr) filt->addfilter(new stripcr); - if (bstriphtml) filt->addfilter(new striphtml); + + if (btextfmt || (bautofmt && (PreferredMarkup() == cTEXT))) filt->addfilter(new textfmt); + if (bpeanut || (bautofmt && (PreferredMarkup() == cPML))) filt->addfilter(new PeanutFormatter); + if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml); + if (bdehyphen) filt->addfilter(new dehyphen); @@ -152,2 +194,4 @@ public: if (bdblspce) filt->addfilter(new dblspce); + if (bremap) filt->addfilter(new remap); + if (bmakebold) filt->addfilter(new embolden); return filt; @@ -164,3 +208,5 @@ private slots: private: + void setTwoTouch(bool _b); void init(); + void mousePressEvent( QMouseEvent* ); void mouseReleaseEvent( QMouseEvent* ); @@ -168,5 +214,9 @@ private slots: QString m_string, m_fontname; - void setfont(QPainter*); + void setfont(); //myoutput stuff private: + bool mouseUpOn; + bool getcurrentpos(int x, int y, size_t& start, size_t& offset, size_t& tgt); + bool m_twotouch, m_touchone; + size_t m_startpos, m_startoffset; void dopageup(); @@ -177,9 +227,8 @@ private slots: int m_textsize; - int m_lastwidth; - CBuffer** textarray; - size_t* locnarray; + int m_lastwidth, m_lastheight; + CBufferFace<CDrawBuffer*> textarray; + CBufferFace<size_t> locnarray; unsigned int numlines; - bool bstripcr, bstriphtml, bdehyphen, bunindent, brepara, bdblspce, btight, m_bBold; + bool bstripcr, btextfmt, bstriphtml, bdehyphen, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt; bool m_bpagemode, m_bMonoSpaced; - QString m_targetapp, m_targetmsg; unsigned char bindenter; @@ -196,8 +245,9 @@ private slots: unsigned long locate() { return buffdoc.locate(); } - unsigned long pagelocate() { return pagepos; } - unsigned long pagepos, mylastpos; - void setfilter(CFilterChain *f) { buffdoc.setfilter(f); locate(pagepos); } + unsigned long explocate() { return buffdoc.explocate(); } + unsigned long pagelocate() { return locnarray[0]; } + unsigned long mylastpos; + void setfilter(CFilterChain *f) { buffdoc.setfilter(f); locate(pagelocate()); } void restore() { jumpto(mylastpos); } void goUp(); - void refresh() { locate(pagepos); } + void refresh() { locate(pagelocate()); } void goDown(); @@ -206,3 +256,3 @@ private slots: void textsize(int ts) { m_textsize = ts; } - bool fillbuffer(); + bool fillbuffer(int ru = 0, int ht = 0); unsigned int screenlines(); @@ -210,3 +260,3 @@ private slots: static const char *fonts[]; - unsigned int *fontsizes; +// unsigned int *fontsizes; int m_ascent, m_descent, m_linespacing; @@ -214,2 +264,7 @@ private slots: QString firstword(); + + signals: + void OnRedraw(); + void OnWordSelected(const QString&, size_t, const QString&); + void OnActionPressed(); }; |