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 @@ | |||
4 | #include <qwidget.h> | 4 | #include <qwidget.h> |
5 | #include <qpainter.h> | 5 | //#include <qpainter.h> |
6 | #include <qclipboard.h> | ||
7 | #include "CBuffer.h" | ||
8 | #include "my_list.h" | 6 | #include "my_list.h" |
9 | #include "BuffDoc.h" | 7 | #include "BuffDoc.h" |
10 | #include <qtimer.h> | 8 | #include "FontControl.h" |
9 | |||
10 | //#include <qtimer.h> | ||
11 | |||
12 | class CDrawBuffer; | ||
13 | //class CBuffer; | ||
14 | class QPainter; | ||
15 | class QTimer; | ||
11 | 16 | ||
@@ -22,9 +27,10 @@ class QTReader : public QWidget | |||
22 | QTimer* timer; | 27 | QTimer* timer; |
23 | int m_scrolldy, m_encd; | 28 | int m_scrolldy1, m_scrolldy2, m_encd; |
24 | void focusInEvent(QFocusEvent*); | 29 | void focusInEvent(QFocusEvent*); |
25 | void focusOutEvent(QFocusEvent*); | 30 | void focusOutEvent(QFocusEvent*); |
26 | void ChangeFont(int); | 31 | bool ChangeFont(int); |
27 | bool getline(CBuffer*); | 32 | bool getline(CDrawBuffer*); |
28 | int m_charWidth; | 33 | int m_charWidth; |
29 | int m_charpc; | 34 | int m_charpc; |
35 | FontControl m_fontControl; | ||
30 | public: | 36 | public: |
@@ -68,2 +74,33 @@ public: | |||
68 | */ | 74 | */ |
75 | void setpeanut(bool _b) | ||
76 | { | ||
77 | bpeanut = _b; | ||
78 | setfilter(getfilter()); | ||
79 | } | ||
80 | void setremap(bool _b) | ||
81 | { | ||
82 | bremap = _b; | ||
83 | setfilter(getfilter()); | ||
84 | } | ||
85 | void setmakebold(bool _b) | ||
86 | { | ||
87 | bmakebold = _b; | ||
88 | setfilter(getfilter()); | ||
89 | } | ||
90 | void setautofmt(bool _b) | ||
91 | { | ||
92 | bautofmt = _b; | ||
93 | if (bautofmt) | ||
94 | { | ||
95 | btextfmt = false; | ||
96 | bstriphtml = false;; | ||
97 | bpeanut = false; | ||
98 | } | ||
99 | setfilter(getfilter()); | ||
100 | } | ||
101 | void settextfmt(bool _b) | ||
102 | { | ||
103 | btextfmt = _b; | ||
104 | setfilter(getfilter()); | ||
105 | } | ||
69 | void setstripcr(bool _b) | 106 | void setstripcr(bool _b) |
@@ -115,4 +152,4 @@ public: | |||
115 | m_bMonoSpaced = _b; | 152 | m_bMonoSpaced = _b; |
116 | ChangeFont(fontsizes[m_textsize]); | 153 | ChangeFont(m_fontControl.currentsize()); |
117 | locate(pagepos); | 154 | locate(pagelocate()); |
118 | } | 155 | } |
@@ -123,2 +160,3 @@ public: | |||
123 | } | 160 | } |
161 | MarkupType PreferredMarkup(); | ||
124 | CEncoding* getencoding() | 162 | CEncoding* getencoding() |
@@ -146,3 +184,7 @@ public: | |||
146 | if (bstripcr) filt->addfilter(new stripcr); | 184 | if (bstripcr) filt->addfilter(new stripcr); |
147 | if (bstriphtml) filt->addfilter(new striphtml); | 185 | |
186 | if (btextfmt || (bautofmt && (PreferredMarkup() == cTEXT))) filt->addfilter(new textfmt); | ||
187 | if (bpeanut || (bautofmt && (PreferredMarkup() == cPML))) filt->addfilter(new PeanutFormatter); | ||
188 | if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml); | ||
189 | |||
148 | if (bdehyphen) filt->addfilter(new dehyphen); | 190 | if (bdehyphen) filt->addfilter(new dehyphen); |
@@ -152,2 +194,4 @@ public: | |||
152 | if (bdblspce) filt->addfilter(new dblspce); | 194 | if (bdblspce) filt->addfilter(new dblspce); |
195 | if (bremap) filt->addfilter(new remap); | ||
196 | if (bmakebold) filt->addfilter(new embolden); | ||
153 | return filt; | 197 | return filt; |
@@ -164,3 +208,5 @@ private slots: | |||
164 | private: | 208 | private: |
209 | void setTwoTouch(bool _b); | ||
165 | void init(); | 210 | void init(); |
211 | void mousePressEvent( QMouseEvent* ); | ||
166 | void mouseReleaseEvent( QMouseEvent* ); | 212 | void mouseReleaseEvent( QMouseEvent* ); |
@@ -168,5 +214,9 @@ private slots: | |||
168 | QString m_string, m_fontname; | 214 | QString m_string, m_fontname; |
169 | void setfont(QPainter*); | 215 | void setfont(); |
170 | //myoutput stuff | 216 | //myoutput stuff |
171 | private: | 217 | private: |
218 | bool mouseUpOn; | ||
219 | bool getcurrentpos(int x, int y, size_t& start, size_t& offset, size_t& tgt); | ||
220 | bool m_twotouch, m_touchone; | ||
221 | size_t m_startpos, m_startoffset; | ||
172 | void dopageup(); | 222 | void dopageup(); |
@@ -177,9 +227,8 @@ private slots: | |||
177 | int m_textsize; | 227 | int m_textsize; |
178 | int m_lastwidth; | 228 | int m_lastwidth, m_lastheight; |
179 | CBuffer** textarray; | 229 | CBufferFace<CDrawBuffer*> textarray; |
180 | size_t* locnarray; | 230 | CBufferFace<size_t> locnarray; |
181 | unsigned int numlines; | 231 | unsigned int numlines; |
182 | bool bstripcr, bstriphtml, bdehyphen, bunindent, brepara, bdblspce, btight, m_bBold; | 232 | bool bstripcr, btextfmt, bstriphtml, bdehyphen, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt; |
183 | bool m_bpagemode, m_bMonoSpaced; | 233 | bool m_bpagemode, m_bMonoSpaced; |
184 | QString m_targetapp, m_targetmsg; | ||
185 | unsigned char bindenter; | 234 | unsigned char bindenter; |
@@ -196,8 +245,9 @@ private slots: | |||
196 | unsigned long locate() { return buffdoc.locate(); } | 245 | unsigned long locate() { return buffdoc.locate(); } |
197 | unsigned long pagelocate() { return pagepos; } | 246 | unsigned long explocate() { return buffdoc.explocate(); } |
198 | unsigned long pagepos, mylastpos; | 247 | unsigned long pagelocate() { return locnarray[0]; } |
199 | void setfilter(CFilterChain *f) { buffdoc.setfilter(f); locate(pagepos); } | 248 | unsigned long mylastpos; |
249 | void setfilter(CFilterChain *f) { buffdoc.setfilter(f); locate(pagelocate()); } | ||
200 | void restore() { jumpto(mylastpos); } | 250 | void restore() { jumpto(mylastpos); } |
201 | void goUp(); | 251 | void goUp(); |
202 | void refresh() { locate(pagepos); } | 252 | void refresh() { locate(pagelocate()); } |
203 | void goDown(); | 253 | void goDown(); |
@@ -206,3 +256,3 @@ private slots: | |||
206 | void textsize(int ts) { m_textsize = ts; } | 256 | void textsize(int ts) { m_textsize = ts; } |
207 | bool fillbuffer(); | 257 | bool fillbuffer(int ru = 0, int ht = 0); |
208 | unsigned int screenlines(); | 258 | unsigned int screenlines(); |
@@ -210,3 +260,3 @@ private slots: | |||
210 | static const char *fonts[]; | 260 | static const char *fonts[]; |
211 | unsigned int *fontsizes; | 261 | // unsigned int *fontsizes; |
212 | int m_ascent, m_descent, m_linespacing; | 262 | int m_ascent, m_descent, m_linespacing; |
@@ -214,2 +264,7 @@ private slots: | |||
214 | QString firstword(); | 264 | QString firstword(); |
265 | |||
266 | signals: | ||
267 | void OnRedraw(); | ||
268 | void OnWordSelected(const QString&, size_t, const QString&); | ||
269 | void OnActionPressed(); | ||
215 | }; | 270 | }; |