summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/QTReader.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/QTReader.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/QTReader.h56
1 files changed, 48 insertions, 8 deletions
diff --git a/noncore/apps/opie-reader/QTReader.h b/noncore/apps/opie-reader/QTReader.h
index 78230b4..3d5f57d 100644
--- a/noncore/apps/opie-reader/QTReader.h
+++ b/noncore/apps/opie-reader/QTReader.h
@@ -13,12 +13,15 @@ class CDrawBuffer;
13//class CBuffer; 13//class CBuffer;
14class QPainter; 14class QPainter;
15class QTimer; 15class QTimer;
16class QPixmap;
17class statedata;
16 18
17class QTReader : public QWidget 19class QTReader : public QWidget
18{ 20{
19 Q_OBJECT 21 Q_OBJECT
20 22
21 friend class QTReaderApp; 23 friend class QTReaderApp;
24 void suspend() { buffdoc.suspend(); }
22 void drawText(QPainter& p, int x, int y, tchar* text); 25 void drawText(QPainter& p, int x, int y, tchar* text);
23 int m_delay; 26 int m_delay;
24 unsigned int m_overlap; 27 unsigned int m_overlap;
@@ -37,7 +40,18 @@ public:
37 QTReader( QWidget *parent=0, const char *name=0, WFlags f = 0); 40 QTReader( QWidget *parent=0, const char *name=0, WFlags f = 0);
38 // QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0); 41 // QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0);
39 ~QTReader(); 42 ~QTReader();
43 void zoomin();
44 void zoomout();
45 void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
46 {
47 buffdoc.setSaveData(data, len, src, srclen);
48 }
49 void putSaveData(unsigned char*& src, unsigned short& srclen)
50 {
51 buffdoc.putSaveData(src, srclen);
52 }
40 bool empty(); 53 bool empty();
54 void setContinuous(bool _b);
41 void toggle_autoscroll(); 55 void toggle_autoscroll();
42 void setautoscroll(bool); 56 void setautoscroll(bool);
43 void disableAutoscroll() { m_autoScroll = false; } 57 void disableAutoscroll() { m_autoScroll = false; }
@@ -108,6 +122,18 @@ public:
108 bstripcr = _b; 122 bstripcr = _b;
109 setfilter(getfilter()); 123 setfilter(getfilter());
110 } 124 }
125 void setonespace(bool _b)
126 {
127 bonespace = _b;
128 setfilter(getfilter());
129 }
130#ifdef REPALM
131 void setrepalm(bool _b)
132 {
133 brepalm = _b;
134 setfilter(getfilter());
135 }
136#endif
111 void setstriphtml(bool _b) 137 void setstriphtml(bool _b)
112 { 138 {
113 bstriphtml = _b; 139 bstriphtml = _b;
@@ -190,8 +216,12 @@ public:
190 if (bdehyphen) filt->addfilter(new dehyphen); 216 if (bdehyphen) filt->addfilter(new dehyphen);
191 if (bunindent) filt->addfilter(new unindent); 217 if (bunindent) filt->addfilter(new unindent);
192 if (brepara) filt->addfilter(new repara); 218 if (brepara) filt->addfilter(new repara);
219 if (bonespace) filt->addfilter(new OnePara);
193 if (bindenter) filt->addfilter(new indenter(bindenter)); 220 if (bindenter) filt->addfilter(new indenter(bindenter));
194 if (bdblspce) filt->addfilter(new dblspce); 221 if (bdblspce) filt->addfilter(new dblspce);
222#ifdef REPALM
223 if (brepalm) filt->addfilter(new repalm);
224#endif
195 if (bremap) filt->addfilter(new remap); 225 if (bremap) filt->addfilter(new remap);
196 if (bmakebold) filt->addfilter(new embolden); 226 if (bmakebold) filt->addfilter(new embolden);
197 return filt; 227 return filt;
@@ -216,9 +246,10 @@ private slots:
216 //myoutput stuff 246 //myoutput stuff
217 private: 247 private:
218 bool mouseUpOn; 248 bool mouseUpOn;
219 bool getcurrentpos(int x, int y, size_t& start, size_t& offset, size_t& tgt); 249 linkType getcurrentpos(int x, int y, size_t& start, size_t& offset, size_t& tgt);
220 bool m_twotouch, m_touchone; 250 bool m_twotouch, m_touchone;
221 size_t m_startpos, m_startoffset; 251 size_t m_startpos, m_startoffset;
252 void dopageup(unsigned int);
222 void dopageup(); 253 void dopageup();
223 void lineDown(); 254 void lineDown();
224 void lineUp(); 255 void lineUp();
@@ -229,24 +260,31 @@ private slots:
229 CBufferFace<CDrawBuffer*> textarray; 260 CBufferFace<CDrawBuffer*> textarray;
230 CBufferFace<size_t> locnarray; 261 CBufferFace<size_t> locnarray;
231 unsigned int numlines; 262 unsigned int numlines;
232 bool bstripcr, btextfmt, bstriphtml, bdehyphen, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt; 263 bool bstripcr, btextfmt, bstriphtml, bdehyphen, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace;
233 bool m_bpagemode, m_bMonoSpaced; 264#ifdef REPALM
265 bool brepalm;
266#endif
267 bool m_bpagemode, m_bMonoSpaced, m_continuousDocument;
234 unsigned char bindenter; 268 unsigned char bindenter;
235 QString m_lastfile; 269 QString m_lastfile;
236 size_t m_lastposn; 270 size_t m_lastposn;
237 public: 271 public:
272 bool bDoUpdates;
273 bool m_navkeys;
274 void NavUp();
275 void NavDown();
238 int getch() { return buffdoc.getch(); } 276 int getch() { return buffdoc.getch(); }
239 bool tight; 277 bool tight;
240 bool load_file(const char *newfile, unsigned int lcn=0); 278 bool load_file(const char *newfile, unsigned int lcn=0);
241 BuffDoc buffdoc; 279 BuffDoc buffdoc;
242 CList<Bkmk>* getbkmklist() { return buffdoc.getbkmklist(); } 280 CList<Bkmk>* getbkmklist() { return buffdoc.getbkmklist(); }
243 bool locate(unsigned long n); 281 bool locate(unsigned long n);
244 void jumpto(unsigned long n) { buffdoc.locate(n); } 282 void jumpto(unsigned long n) { buffdoc.unsuspend(); buffdoc.locate(n); }
245 unsigned long locate() { return buffdoc.locate(); } 283 unsigned long locate() { buffdoc.unsuspend(); return buffdoc.locate(); }
246 unsigned long explocate() { return buffdoc.explocate(); } 284 unsigned long explocate() { buffdoc.unsuspend(); return buffdoc.explocate(); }
247 unsigned long pagelocate() { return locnarray[0]; } 285 unsigned long pagelocate() { return locnarray[0]; }
248 unsigned long mylastpos; 286 unsigned long mylastpos;
249 void setfilter(CFilterChain *f) { buffdoc.setfilter(f); locate(pagelocate()); } 287 void setfilter(CFilterChain *f) { buffdoc.unsuspend(); buffdoc.setfilter(f); locate(pagelocate()); }
250 void restore() { jumpto(mylastpos); } 288 void restore() { jumpto(mylastpos); }
251 void goUp(); 289 void goUp();
252 void refresh() { locate(pagelocate()); } 290 void refresh() { locate(pagelocate()); }
@@ -256,17 +294,19 @@ private slots:
256 void textsize(int ts) { m_textsize = ts; } 294 void textsize(int ts) { m_textsize = ts; }
257 bool fillbuffer(int ru = 0, int ht = 0); 295 bool fillbuffer(int ru = 0, int ht = 0);
258 unsigned int screenlines(); 296 unsigned int screenlines();
259 void sizes(unsigned long& fs, unsigned long& ts) { buffdoc.sizes(fs,ts); } 297 void sizes(unsigned long& fs, unsigned long& ts) { buffdoc.unsuspend(); buffdoc.sizes(fs,ts); }
260 static const char *fonts[]; 298 static const char *fonts[];
261// unsigned int *fontsizes; 299// unsigned int *fontsizes;
262 int m_ascent, m_descent, m_linespacing; 300 int m_ascent, m_descent, m_linespacing;
263 QFontMetrics* m_fm; 301 QFontMetrics* m_fm;
264 QString firstword(); 302 QString firstword();
303 void setstate(const statedata& sd);
265 304
266 signals: 305 signals:
267 void OnRedraw(); 306 void OnRedraw();
268 void OnWordSelected(const QString&, size_t, const QString&); 307 void OnWordSelected(const QString&, size_t, const QString&);
269 void OnActionPressed(); 308 void OnActionPressed();
309 void OnShowPicture(QPixmap&);
270}; 310};
271 311
272#endif 312#endif