Diffstat (limited to 'noncore/apps/opie-reader/QTReader.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReader.h | 96 |
1 files changed, 28 insertions, 68 deletions
diff --git a/noncore/apps/opie-reader/QTReader.h b/noncore/apps/opie-reader/QTReader.h index 3bcdde4..9daa07a 100644 --- a/noncore/apps/opie-reader/QTReader.h +++ b/noncore/apps/opie-reader/QTReader.h | |||
@@ -19,14 +19,12 @@ class QImage; | |||
19 | 19 | ||
20 | #include "BGType.h" | 20 | #include "BGType.h" |
21 | #include "striphtml.h" | ||
22 | 21 | ||
23 | #define ROTATION_ENABLED | ||
24 | #define SPECIALSCROLL | 22 | #define SPECIALSCROLL |
25 | #define DOUBLEBUFFER | 23 | |
26 | #ifdef DOUBLEBUFFER | ||
27 | class QPainter; | 24 | class QPainter; |
28 | #endif | 25 | class COutput; |
29 | 26 | ||
30 | class CStyle; | 27 | class CStyle; |
28 | #define USETIMER | ||
31 | 29 | ||
32 | class QTReader : public QWidget | 30 | class QTReader : public QWidget |
@@ -34,8 +32,13 @@ class QTReader : public QWidget | |||
34 | Q_OBJECT | 32 | Q_OBJECT |
35 | friend class QTReaderApp; | 33 | friend class QTReaderApp; |
36 | #ifdef DOUBLEBUFFER | 34 | #ifdef USETIMER |
35 | QTimer* m_dragtimer; | ||
36 | unsigned long m_dragtarget; | ||
37 | #endif | ||
38 | COutput* m_output; | ||
39 | bool checkoutput(); | ||
40 | bool m_outofdate, m_drageligible; | ||
37 | QPixmap *dbuff; | 41 | QPixmap *dbuff; |
38 | QPainter* dbp; | 42 | QPainter* dbp; |
39 | #endif | ||
40 | void drawSingleLine(int lineno); | 43 | void drawSingleLine(int lineno); |
41 | void gotoLink(); | 44 | void gotoLink(); |
@@ -75,9 +78,7 @@ class QTReader : public QWidget | |||
75 | unsigned int m_overlap; | 78 | unsigned int m_overlap; |
76 | bool m_autoScroll, m_swapmouse; | 79 | bool m_autoScroll, m_swapmouse; |
77 | void drawBackground(); | 80 | void drawBackground(QPainter*); |
78 | #ifdef ROTATION_ENABLED | ||
79 | bool m_rotated; | 81 | bool m_rotated; |
80 | void setrotated(bool); | 82 | void setrotated(bool); |
81 | #endif | ||
82 | void autoscroll(); | 83 | void autoscroll(); |
83 | QTimer* timer; | 84 | QTimer* timer; |
@@ -96,4 +97,5 @@ class QTReader : public QWidget | |||
96 | void setBaseSize(unsigned char _s) { m_fontControl.setBaseSize(_s); } | 97 | void setBaseSize(unsigned char _s) { m_fontControl.setBaseSize(_s); } |
97 | unsigned char getBaseSize() { return m_fontControl.getBaseSize(); } | 98 | unsigned char getBaseSize() { return m_fontControl.getBaseSize(); } |
99 | QString m_outputName; | ||
98 | #ifdef _SCROLLPIPE | 100 | #ifdef _SCROLLPIPE |
99 | FILE* m_pipeout; | 101 | FILE* m_pipeout; |
@@ -107,4 +109,5 @@ public: | |||
107 | ~QTReader(); | 109 | ~QTReader(); |
108 | QString about(); | 110 | QString about(); |
111 | void readAloud(); | ||
109 | CList<Bkmk>* Bkmklist() { return pBkmklist; } | 112 | CList<Bkmk>* Bkmklist() { return pBkmklist; } |
110 | void setBackground(const QColor& _c) | 113 | void setBackground(const QColor& _c) |
@@ -154,5 +157,5 @@ public: | |||
154 | }; | 157 | }; |
155 | void clear() {}; | 158 | void clear() {}; |
156 | void setText(const QString& n, const QString& s) { m_string = n; load_file((const char*)s); }; | 159 | void setText(const QString& n, const QString& s, unsigned int lcn = 0) { m_string = n; load_file((const char*)s, lcn); }; |
157 | /* | 160 | /* |
158 | void setText(bool oldfile) | 161 | void setText(bool oldfile) |
@@ -226,58 +229,10 @@ public: | |||
226 | } | 229 | } |
227 | HighlightFilter* m_highlightfilter; | 230 | HighlightFilter* m_highlightfilter; |
228 | CFilterChain* getfilter() | 231 | CFilterChain* getfilter(); |
229 | { | ||
230 | CFilterChain * filt = new CFilterChain(getencoding()); | ||
231 | if (bstripcr) filt->addfilter(new stripcr); | ||
232 | |||
233 | if (btextfmt || (bautofmt && (PreferredMarkup() == cTEXT))) filt->addfilter(new textfmt); | ||
234 | if (bpeanut || (bautofmt && (PreferredMarkup() == cPML))) filt->addfilter(new PeanutFormatter); | ||
235 | // if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml(m_lastfile)); | ||
236 | |||
237 | #ifdef __STATIC | ||
238 | if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml(m_lastfile)); | ||
239 | if (bautofmt && (PreferredMarkup() == cCHM)) | ||
240 | { | ||
241 | filt->addfilter(new striphtml(m_lastfile)); | ||
242 | } | ||
243 | #else | ||
244 | if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new ExternFilter("HTMLfilter", m_lastfile)); | ||
245 | if (bautofmt && (PreferredMarkup() == cCHM)) | ||
246 | { | ||
247 | ExternFilter* f = new ExternFilter("HTMLfilter",m_lastfile); | ||
248 | ((striphtml*)f->filter())->setchm(true); | ||
249 | filt->addfilter(f); | ||
250 | } | ||
251 | #endif | ||
252 | m_highlightfilter = new HighlightFilter(this); | ||
253 | filt->addfilter(m_highlightfilter); | ||
254 | |||
255 | if (bdehyphen) filt->addfilter(new dehyphen); | ||
256 | if (bunindent) filt->addfilter(new unindent); | ||
257 | if (brepara) filt->addfilter(new repara(m_reparastring)); | ||
258 | if (bonespace) filt->addfilter(new OnePara); | ||
259 | if (bindenter) filt->addfilter(new indenter(bindenter)); | ||
260 | if (bdblspce) filt->addfilter(new dblspce); | ||
261 | if (bdepluck) filt->addfilter(new DePluck(pluckernextpart)); | ||
262 | if (bdejpluck) filt->addfilter(new DePluck(jplucknextpart)); | ||
263 | if (brepalm) filt->addfilter(new repalm); | ||
264 | if (bkern) filt->addfilter(new kern); | ||
265 | if (bremap) filt->addfilter(new remap); | ||
266 | if (bmakebold) filt->addfilter(new embolden); | ||
267 | if (bfulljust) filt->addfilter(new FullJust); | ||
268 | int r,g,b; | ||
269 | m_default_bg.rgb(&r, &g, &b); | ||
270 | if (r != 255 || g != 255 || b != 255) | ||
271 | filt->addfilter(new setbg(r,g,b)); | ||
272 | m_default_fg.rgb(&r, &g, &b); | ||
273 | if (r != 0 || g != 0 || b != 0) | ||
274 | filt->addfilter(new setfg(r,g,b)); | ||
275 | // if (bNegative) filt->addfilter(new makeNegative); | ||
276 | if (bInverse) filt->addfilter(new makeInverse); | ||
277 | return filt; | ||
278 | } | ||
279 | |||
280 | 232 | ||
281 | private slots: | 233 | private slots: |
234 | #ifdef USETIMER | ||
235 | void actionDrag(); | ||
236 | #endif | ||
282 | void dopageup(); | 237 | void dopageup(); |
283 | void lineDown(); | 238 | void lineDown(); |
@@ -289,7 +244,7 @@ private slots: | |||
289 | void doscroll(); | 244 | void doscroll(); |
290 | void paintEvent( QPaintEvent * ); | 245 | void paintEvent( QPaintEvent * ); |
291 | #ifdef DOUBLEBUFFER | 246 | |
292 | void resizeEvent( QResizeEvent * p ); | 247 | void resizeEvent( QResizeEvent * p ); |
293 | #endif | 248 | |
294 | void keyPressEvent(QKeyEvent*); | 249 | void keyPressEvent(QKeyEvent*); |
295 | private: | 250 | private: |
@@ -301,4 +256,5 @@ private slots: | |||
301 | void setTwoTouch(bool _b); | 256 | void setTwoTouch(bool _b); |
302 | void init(); | 257 | void init(); |
258 | void mouseMoveEvent( QMouseEvent* ); | ||
303 | void mousePressEvent( QMouseEvent* ); | 259 | void mousePressEvent( QMouseEvent* ); |
304 | void mouseReleaseEvent( QMouseEvent* ); | 260 | void mouseReleaseEvent( QMouseEvent* ); |
@@ -306,4 +262,7 @@ private slots: | |||
306 | QString m_string, m_fontname, m_reparastring; | 262 | QString m_string, m_fontname, m_reparastring; |
307 | void setfont(); | 263 | void setfont(); |
264 | bool m_doubleBuffered; | ||
265 | |||
266 | void setDoubleBuffer(bool _b); | ||
308 | //myoutput stuff | 267 | //myoutput stuff |
309 | private: | 268 | private: |
@@ -312,5 +271,5 @@ private slots: | |||
312 | #endif | 271 | #endif |
313 | bool mouseUpOn; | 272 | bool mouseUpOn; |
314 | linkType getcurrentpos(int x, int y, int w, int h, int& lineno, size_t& start, size_t& offset, size_t& tgt, size_t& tgtoffset, size_t& pictgt, QImage*&); | 273 | linkType getcurrentpos(int x, int y, int w, int h, int& lineno, size_t& start, size_t& offset, size_t& tgt, size_t& tgtoffset, size_t& pictgt, QImage*&, size_t&); |
315 | bool m_twotouch, m_touchone; | 274 | bool m_twotouch, m_touchone; |
316 | size_t m_startpos, m_startoffset; | 275 | size_t m_startpos, m_startoffset; |
@@ -323,6 +282,6 @@ private slots: | |||
323 | unsigned int numlines; | 282 | unsigned int numlines; |
324 | // bool m_showlast; | 283 | // bool m_showlast; |
325 | bool bstripcr, btextfmt, bstriphtml, bdehyphen, bdepluck, bdejpluck, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace, bfulljust, /*bNegative,*/ bInverse; | 284 | bool bstripcr, btextfmt, bstriphtml, bdehyphen, bdepluck, bdejpluck, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace, bfulljust, /*bNegative,*/ bInverse, bNoInlineTables; |
326 | bool bkern, brepalm; | 285 | bool bkern, brepalm, bunderlineLink; |
327 | bool m_bpagemode, m_bMonoSpaced, m_continuousDocument; | 286 | bool m_bpagemode, m_bMonoSpaced, m_continuousDocument; |
328 | unsigned char bindenter; | 287 | unsigned char bindenter; |
@@ -331,4 +290,5 @@ private slots: | |||
331 | bool bDoUpdates; | 290 | bool bDoUpdates; |
332 | public: | 291 | public: |
292 | bool doOutput(const QString& wrd); | ||
333 | void setDoUpdates(bool b) { bDoUpdates = b; } | 293 | void setDoUpdates(bool b) { bDoUpdates = b; } |
334 | void setStripCR(bool b) { bstripcr = b; } | 294 | void setStripCR(bool b) { bstripcr = b; } |