summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/QTReader.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/QTReader.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/QTReader.h96
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
@@ -18,25 +18,28 @@ class QTimer;
18class QImage; 18class 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
27class QPainter; 24class QPainter;
28#endif 25class COutput;
29 26
30class CStyle; 27class CStyle;
28#define USETIMER
31 29
32class QTReader : public QWidget 30class QTReader : public QWidget
33{ 31{
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();
42 void emitRedraw(); 45 void emitRedraw();
@@ -74,11 +77,9 @@ class QTReader : public QWidget
74 int m_delay, m_scrolltype; 77 int m_delay, m_scrolltype;
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;
84 int m_scrolldy1, m_scrolldy2, m_encd, m_scrollpart, m_totalscroll; 85 int m_scrolldy1, m_scrolldy2, m_encd, m_scrollpart, m_totalscroll;
@@ -95,6 +96,7 @@ class QTReader : public QWidget
95 FontControl m_fontControl; 96 FontControl m_fontControl;
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;
100 QString m_pipetarget; 102 QString m_pipetarget;
@@ -106,6 +108,7 @@ public:
106 // QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0); 108 // QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0);
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)
111 { 114 {
@@ -153,7 +156,7 @@ public:
153*/ 156*/
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)
159 { 162 {
@@ -225,60 +228,12 @@ public:
225 } 228 }
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
281private slots: 233private slots:
234#ifdef USETIMER
235 void actionDrag();
236#endif
282 void dopageup(); 237 void dopageup();
283 void lineDown(); 238 void lineDown();
284 void lineUp(); 239 void lineUp();
@@ -288,9 +243,9 @@ private slots:
288 void goForward(); 243 void goForward();
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:
296 // void drawIt( QPainter * ); 251 // void drawIt( QPainter * );
@@ -300,18 +255,22 @@ private slots:
300 QColor m_scrollcolor, m_scrollbarcolor; 255 QColor m_scrollcolor, m_scrollbarcolor;
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* );
305// void mouseDoubleClickEvent( QMouseEvent* ); 261// void mouseDoubleClickEvent( QMouseEvent* );
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:
310#ifdef SPECIALSCROLL 269#ifdef SPECIALSCROLL
311 int m_scrolldy; 270 int m_scrolldy;
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;
317 void dopageup(unsigned int); 276 void dopageup(unsigned int);
@@ -322,14 +281,15 @@ private slots:
322 CBufferFace<size_t> locnarray; 281 CBufferFace<size_t> locnarray;
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;
329 QString m_lastfile; 288 QString m_lastfile;
330 size_t m_lastposn; 289 size_t m_lastposn;
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; }
335 void NavUp(); 295 void NavUp();