author | llornkcor <llornkcor> | 2002-12-20 01:35:01 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-12-20 01:35:01 (UTC) |
commit | 876e1a4724a7bd75dc642e295de354241096e028 (patch) (unidiff) | |
tree | a37c5dcc9d78e04bb6b859ab89d8cf81e6745087 /noncore/apps/opie-reader/QTReader.h | |
parent | 5fd6636ba3d94b48dd543887316c47c5388a43c2 (diff) | |
download | opie-876e1a4724a7bd75dc642e295de354241096e028.zip opie-876e1a4724a7bd75dc642e295de354241096e028.tar.gz opie-876e1a4724a7bd75dc642e295de354241096e028.tar.bz2 |
update - sorry it took so long. hope this works correctly
Diffstat (limited to 'noncore/apps/opie-reader/QTReader.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReader.h | 56 |
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 | |||
@@ -10,18 +10,21 @@ | |||
10 | //#include <qtimer.h> | 10 | //#include <qtimer.h> |
11 | 11 | ||
12 | class CDrawBuffer; | 12 | class CDrawBuffer; |
13 | //class CBuffer; | 13 | //class CBuffer; |
14 | class QPainter; | 14 | class QPainter; |
15 | class QTimer; | 15 | class QTimer; |
16 | class QPixmap; | ||
17 | class statedata; | ||
16 | 18 | ||
17 | class QTReader : public QWidget | 19 | class 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; |
25 | bool m_autoScroll; | 28 | bool m_autoScroll; |
26 | void autoscroll(); | 29 | void autoscroll(); |
27 | QTimer* timer; | 30 | QTimer* timer; |
@@ -34,13 +37,24 @@ class QTReader : public QWidget | |||
34 | int m_charpc; | 37 | int m_charpc; |
35 | FontControl m_fontControl; | 38 | FontControl m_fontControl; |
36 | public: | 39 | 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; } |
44 | void copy() | 58 | void copy() |
45 | { | 59 | { |
46 | /* | 60 | /* |
@@ -105,12 +119,24 @@ public: | |||
105 | } | 119 | } |
106 | void setstripcr(bool _b) | 120 | void setstripcr(bool _b) |
107 | { | 121 | { |
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; |
114 | setfilter(getfilter()); | 140 | setfilter(getfilter()); |
115 | } | 141 | } |
116 | void setdehyphen(bool _b) | 142 | void setdehyphen(bool _b) |
@@ -187,14 +213,18 @@ public: | |||
187 | if (bpeanut || (bautofmt && (PreferredMarkup() == cPML))) filt->addfilter(new PeanutFormatter); | 213 | if (bpeanut || (bautofmt && (PreferredMarkup() == cPML))) filt->addfilter(new PeanutFormatter); |
188 | if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml); | 214 | if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml); |
189 | 215 | ||
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; |
198 | } | 228 | } |
199 | 229 | ||
200 | 230 | ||
@@ -213,60 +243,70 @@ private slots: | |||
213 | // void mouseDoubleClickEvent( QMouseEvent* ); | 243 | // void mouseDoubleClickEvent( QMouseEvent* ); |
214 | QString m_string, m_fontname; | 244 | QString m_string, m_fontname; |
215 | void setfont(); | 245 | void setfont(); |
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(); |
225 | void dopagedn(); | 256 | void dopagedn(); |
226 | long real_delay(); | 257 | long real_delay(); |
227 | int m_textsize; | 258 | int m_textsize; |
228 | int m_lastwidth, m_lastheight; | 259 | int m_lastwidth, m_lastheight; |
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()); } |
253 | void goDown(); | 291 | void goDown(); |
254 | // bool bold; | 292 | // bool bold; |
255 | int textsize() { return m_textsize; } | 293 | int textsize() { return m_textsize; } |
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 |