Diffstat (limited to 'noncore/apps/opie-reader/QTReader.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReader.h | 342 |
1 files changed, 243 insertions, 99 deletions
diff --git a/noncore/apps/opie-reader/QTReader.h b/noncore/apps/opie-reader/QTReader.h index f89de63..7b0ebc8 100644 --- a/noncore/apps/opie-reader/QTReader.h +++ b/noncore/apps/opie-reader/QTReader.h | |||
@@ -1,272 +1,416 @@ | |||
1 | #ifndef __QTREADER_H | 1 | #ifndef __QTREADER_H |
2 | #define __QTREADER_H | 2 | #define __QTREADER_H |
3 | 3 | ||
4 | //#define _SCROLLPIPE | 4 | //#define _SCROLLPIPE |
5 | 5 | #include "static.h" | |
6 | #include <qwidget.h> | 6 | #include <qwidget.h> |
7 | //#include <qpainter.h> | 7 | //#include <qpainter.h> |
8 | #include "my_list.h" | 8 | #include "my_list.h" |
9 | #include "BuffDoc.h" | 9 | #include "BuffDoc.h" |
10 | #include "FontControl.h" | 10 | #include "FontControl.h" |
11 | 11 | ||
12 | //#include <qtimer.h> | 12 | //#include <qtimer.h> |
13 | 13 | ||
14 | class CDrawBuffer; | 14 | class CDrawBuffer; |
15 | //class CBuffer; | 15 | //class CBuffer; |
16 | #include <qpixmap.h> | ||
16 | class QPainter; | 17 | class QPainter; |
17 | class QTimer; | 18 | class QTimer; |
18 | class QPixmap; | 19 | class QImage; |
20 | |||
21 | #include "BGType.h" | ||
22 | #include "striphtml.h" | ||
23 | |||
24 | #define ROTATION_ENABLED | ||
25 | #define SPECIALSCROLL | ||
26 | #define DOUBLEBUFFER | ||
27 | #ifdef DOUBLEBUFFER | ||
28 | class QPainter; | ||
29 | #endif | ||
30 | |||
31 | class CStyle; | ||
19 | 32 | ||
20 | class QTReader : public QWidget | 33 | class QTReader : public QWidget |
21 | { | 34 | { |
22 | Q_OBJECT | 35 | Q_OBJECT |
23 | |||
24 | static tchar pluckernextpart[]; | ||
25 | static tchar jplucknextpart[]; | ||
26 | friend class QTReaderApp; | 36 | friend class QTReaderApp; |
27 | void suspend(); | 37 | #ifdef DOUBLEBUFFER |
38 | QPixmap *dbuff; | ||
39 | QPainter* dbp; | ||
40 | #endif | ||
41 | void drawSingleLine(int lineno); | ||
42 | void gotoLink(); | ||
43 | void emitRedraw(); | ||
44 | CStyle* m_currentlinkstyle; | ||
45 | int m_currentlink; | ||
46 | int m_currentlinkoffset; | ||
47 | QPixmap m_bgpm; | ||
48 | bool m_bgIsScaled; | ||
49 | bground m_bgtype; | ||
50 | int m_scrollpos; | ||
51 | unsigned short m_scrollstep; | ||
52 | void blitRot(int dx, int sx, int sw, int sh, CDrawBuffer* txt); | ||
53 | void setBackgroundBitmap(const QPixmap& _pm, bground bg) | ||
54 | { | ||
55 | m_bgpm = _pm; | ||
56 | m_bgtype = bg; | ||
57 | m_bgIsScaled = false; | ||
58 | } | ||
59 | |||
60 | QColor m_bg, m_default_bg, m_default_fg, m_negative_fg; | ||
61 | static tchar pluckernextpart[]; | ||
62 | static tchar jplucknextpart[]; | ||
63 | CList<Bkmk>* pBkmklist; | ||
64 | void setHyphenThreshold(int _v) { buffdoc.setHyphenThreshold(_v); } | ||
65 | void ResetScroll(); | ||
28 | void increaseScroll(); | 66 | void increaseScroll(); |
29 | void reduceScroll(); | 67 | void reduceScroll(); |
30 | void drawText(QPainter& p, int x, int y, tchar* text); | 68 | void drawText(QPainter& p, int x, int y, tchar* text); |
31 | int m_delay; | 69 | void DrawScroll( QPainter *p, int w, int h ); |
70 | void dorollingscroll(bool); | ||
71 | void doinplacescroll(); | ||
72 | void dostaticscroll(); | ||
73 | void suspend(); | ||
74 | void redrawScroll(QPainter* p); | ||
75 | int m_delay, m_scrolltype; | ||
32 | unsigned int m_overlap; | 76 | unsigned int m_overlap; |
33 | bool m_autoScroll, m_swapmouse; | 77 | bool m_autoScroll, m_swapmouse; |
78 | void drawBackground(); | ||
79 | #ifdef ROTATION_ENABLED | ||
80 | bool m_rotated; | ||
81 | void setrotated(bool); | ||
82 | #endif | ||
34 | void autoscroll(); | 83 | void autoscroll(); |
35 | QTimer* timer; | 84 | QTimer* timer; |
36 | int m_scrolldy1, m_scrolldy2, m_encd, m_scrollpart; | 85 | int m_scrolldy1, m_scrolldy2, m_encd, m_scrollpart, m_totalscroll; |
37 | void focusInEvent(QFocusEvent*); | 86 | void focusInEvent(QFocusEvent*); |
38 | void focusOutEvent(QFocusEvent*); | 87 | void focusOutEvent(QFocusEvent*); |
39 | void processmousepositionevent( QMouseEvent* _e ); | 88 | void processmousepositionevent( QMouseEvent* _e ); |
40 | void processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno); | 89 | void processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno); |
41 | bool ChangeFont(int); | 90 | bool ChangeFont(int); |
42 | bool getline(CDrawBuffer*); | 91 | bool getline(CDrawBuffer*); |
43 | int m_charWidth; | 92 | int m_charWidth; |
44 | int m_charpc; | 93 | int m_charpc; |
45 | unsigned char m_border; | 94 | unsigned short m_absleft_border, m_absright_border; |
95 | unsigned short m_left_border, m_right_border; | ||
46 | FontControl m_fontControl; | 96 | FontControl m_fontControl; |
47 | void setBaseSize(unsigned char _s) { m_fontControl.setBaseSize(_s); } | 97 | void setBaseSize(unsigned char _s) { m_fontControl.setBaseSize(_s); } |
48 | unsigned char getBaseSize() { return m_fontControl.getBaseSize(); } | 98 | unsigned char getBaseSize() { return m_fontControl.getBaseSize(); } |
49 | #ifdef _SCROLLPIPE | 99 | #ifdef _SCROLLPIPE |
50 | FILE* m_pipeout; | 100 | FILE* m_pipeout; |
51 | QString m_pipetarget; | 101 | QString m_pipetarget; |
52 | bool m_isPaused; | 102 | bool m_isPaused; |
53 | bool m_pauseAfterEachPara; | 103 | bool m_pauseAfterEachPara; |
54 | #endif | 104 | #endif |
55 | public: | 105 | public: |
56 | QTReader( QWidget *parent=0, const char *name=0, WFlags f = 0); | 106 | QTReader( QWidget *parent=0, const char *name=0, WFlags f = 0); |
57 | // QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0); | 107 | // QTReader( const QString& filename, QWidget *parent=0, const tchar *name=0, WFlags f = 0); |
58 | ~QTReader(); | 108 | ~QTReader(); |
109 | QString about(); | ||
110 | CList<Bkmk>* Bkmklist() { return pBkmklist; } | ||
111 | void setBackground(const QColor& _c) | ||
112 | { | ||
113 | m_default_bg = _c; | ||
114 | reset_bg(); | ||
115 | } | ||
116 | void setForeground(const QColor& _c) | ||
117 | { | ||
118 | m_default_fg = _c; | ||
119 | int r,g,b; | ||
120 | m_default_fg.rgb(&r, &g, &b); | ||
121 | r = 255-r; | ||
122 | g = 255-g; | ||
123 | b = 255-b; | ||
124 | m_negative_fg.setRgb(r,g,b); | ||
125 | } | ||
59 | void zoomin(); | 126 | void zoomin(); |
60 | void zoomout(); | 127 | void zoomout(); |
61 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) | 128 | void setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) |
62 | { | 129 | { |
63 | buffdoc.setSaveData(data, len, src, srclen); | 130 | buffdoc.setSaveData(data, len, src, srclen); |
64 | } | 131 | } |
65 | void putSaveData(unsigned char*& src, unsigned short& srclen) | 132 | void putSaveData(unsigned char*& src, unsigned short& srclen) |
66 | { | 133 | { |
67 | buffdoc.putSaveData(src, srclen); | 134 | buffdoc.putSaveData(src, srclen); |
68 | } | 135 | } |
69 | bool empty(); | 136 | bool empty(); |
70 | void setContinuous(bool _b); | 137 | void setContinuous(bool _b); |
71 | void toggle_autoscroll(); | 138 | void toggle_autoscroll(); |
72 | void setautoscroll(bool); | 139 | void setautoscroll(bool); |
73 | void disableAutoscroll() { m_autoScroll = false; } | 140 | void disableAutoscroll() { m_autoScroll = false; } |
74 | void copy() | 141 | void copy() |
75 | { | 142 | { |
76 | /* | 143 | /* |
77 | size_t nd = locate(); | 144 | size_t nd = locate(); |
78 | jumpto(m_mark); | 145 | jumpto(m_mark); |
79 | QString text; | 146 | QString text; |
80 | while (m_mark < nd) | 147 | while (m_mark < nd) |
81 | { | 148 | { |
82 | text += buffdoc.getch(); | 149 | text += buffdoc.getch(); |
83 | m_mark++; | 150 | m_mark++; |
84 | } | 151 | } |
85 | QApplication::clipboard()->setText(text); | 152 | QApplication::clipboard()->setText(text); |
86 | jumpto(nd); | 153 | jumpto(nd); |
87 | */ | 154 | */ |
88 | }; | 155 | }; |
89 | void clear() {}; | 156 | void clear() {}; |
90 | void setText(const QString& n, const QString& s) { m_string = n; load_file((const char*)s); }; | 157 | void setText(const QString& n, const QString& s) { m_string = n; load_file((const char*)s); }; |
91 | /* | 158 | /* |
92 | void setText(bool oldfile) | 159 | void setText(bool oldfile) |
93 | { | 160 | { |
94 | if (oldfile) | 161 | if (oldfile) |
95 | { | 162 | { |
96 | m_string = m_lastfile; | 163 | m_string = m_lastfile; |
97 | load_file((const tchar*)m_string); | 164 | load_file((const tchar*)m_string); |
98 | } | 165 | } |
99 | else | 166 | else |
100 | { | 167 | { |
101 | m_string = QString::null; | 168 | m_string = QString::null; |
102 | } | 169 | } |
103 | }; | 170 | }; |
104 | */ | 171 | */ |
105 | void setlead(int _lead) | 172 | void setlead(int _lead) |
106 | { | 173 | { |
107 | m_fontControl.setlead(_lead); | 174 | m_fontControl.setlead(_lead); |
108 | } | 175 | } |
109 | int getlead() | 176 | int getlead() |
110 | { | 177 | { |
111 | return m_fontControl.getlead(); | 178 | return m_fontControl.getlead(); |
112 | } | 179 | } |
113 | void setextraspace(int _lead) | 180 | void setextraspace(int _lead) |
114 | { | 181 | { |
115 | m_fontControl.setextraspace(_lead); | 182 | m_fontControl.setextraspace(_lead); |
116 | } | 183 | } |
117 | int getextraspace() | 184 | int getextraspace() |
118 | { | 185 | { |
119 | return m_fontControl.getextraspace(); | 186 | return m_fontControl.getextraspace(); |
120 | } | 187 | } |
121 | void setpagemode(bool _b) | 188 | void setpagemode(bool _b) |
122 | { | 189 | { |
123 | m_bpagemode = _b; | 190 | m_bpagemode = _b; |
124 | } | 191 | } |
125 | void setmono(bool _b) | 192 | void setmono(bool _b) |
126 | { | 193 | { |
127 | m_bMonoSpaced = _b; | 194 | m_bMonoSpaced = _b; |
128 | ChangeFont(m_fontControl.currentsize()); | 195 | ChangeFont(m_fontControl.currentsize()); |
129 | locate(pagelocate()); | 196 | locate(pagelocate()); |
130 | } | 197 | } |
131 | void setencoding(int _f) | 198 | void setencoding(int _f) |
132 | { | 199 | { |
133 | m_encd = _f; | 200 | m_encd = _f; |
134 | setfilter(getfilter()); | 201 | setfilter(getfilter()); |
135 | } | 202 | } |
136 | MarkupType PreferredMarkup(); | 203 | MarkupType PreferredMarkup(); |
137 | CEncoding* getencoding() | 204 | CEncoding* getencoding() |
138 | { | 205 | { |
139 | // odebug << "m_encd:" << m_encd << oendl; | 206 | // qDebug("m_encd:%d", m_encd); |
140 | switch (m_encd) | 207 | switch (m_encd) |
141 | { | 208 | { |
142 | case 4: | 209 | case 4: |
143 | // odebug << "palm" << oendl; | 210 | // qDebug("palm"); |
144 | return new CPalm; | 211 | return new CPalm; |
145 | case 1: | 212 | case 1: |
146 | // odebug << "utf8" << oendl; | 213 | // qDebug("utf8"); |
147 | return new CUtf8; | 214 | return new CUtf8; |
148 | case 2: | 215 | case 2: |
149 | // odebug << "ucs16be" << oendl; | 216 | // qDebug("ucs16be"); |
150 | return new CUcs16be; | 217 | return new CUcs16be; |
151 | case 3: | 218 | case 3: |
152 | // odebug << "ucs16le" << oendl; | 219 | // qDebug("ucs16le"); |
153 | return new CUcs16le; | 220 | return new CUcs16le; |
154 | case 0: | 221 | case 0: |
155 | // odebug << "ascii" << oendl; | 222 | // qDebug("ascii"); |
156 | return new CAscii; | 223 | return new CAscii; |
157 | default: | 224 | default: |
158 | return new CGeneral8Bit(m_encd-MAX_ENCODING+1); | 225 | return new CGeneral8Bit(m_encd-MAX_ENCODING+1); |
159 | } | 226 | } |
160 | } | 227 | } |
228 | HighlightFilter* m_highlightfilter; | ||
161 | CFilterChain* getfilter() | 229 | CFilterChain* getfilter() |
162 | { | 230 | { |
163 | CFilterChain * filt = new CFilterChain(getencoding()); | 231 | CFilterChain * filt = new CFilterChain(getencoding()); |
164 | if (bstripcr) filt->addfilter(new stripcr); | 232 | if (bstripcr) filt->addfilter(new stripcr); |
165 | 233 | ||
166 | if (btextfmt || (bautofmt && (PreferredMarkup() == cTEXT))) filt->addfilter(new textfmt); | 234 | if (btextfmt || (bautofmt && (PreferredMarkup() == cTEXT))) filt->addfilter(new textfmt); |
167 | if (bpeanut || (bautofmt && (PreferredMarkup() == cPML))) filt->addfilter(new PeanutFormatter); | 235 | if (bpeanut || (bautofmt && (PreferredMarkup() == cPML))) filt->addfilter(new PeanutFormatter); |
168 | if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml); | 236 | // if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml(m_lastfile)); |
237 | |||
238 | #ifdef __STATIC | ||
239 | if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new striphtml(m_lastfile)); | ||
240 | if (bautofmt && (PreferredMarkup() == cCHM)) | ||
241 | { | ||
242 | filt->addfilter(new striphtml(m_lastfile)); | ||
243 | } | ||
244 | #else | ||
245 | if (bstriphtml || (bautofmt && (PreferredMarkup() == cHTML))) filt->addfilter(new ExternFilter("HTMLfilter", m_lastfile)); | ||
246 | if (bautofmt && (PreferredMarkup() == cCHM)) | ||
247 | { | ||
248 | ExternFilter* f = new ExternFilter("HTMLfilter",m_lastfile); | ||
249 | ((striphtml*)f->filter())->setchm(true); | ||
250 | filt->addfilter(f); | ||
251 | } | ||
252 | #endif | ||
253 | m_highlightfilter = new HighlightFilter(this); | ||
254 | filt->addfilter(m_highlightfilter); | ||
169 | 255 | ||
170 | if (bdehyphen) filt->addfilter(new dehyphen); | 256 | if (bdehyphen) filt->addfilter(new dehyphen); |
171 | if (bunindent) filt->addfilter(new unindent); | 257 | if (bunindent) filt->addfilter(new unindent); |
172 | if (brepara) filt->addfilter(new repara); | 258 | if (brepara) filt->addfilter(new repara(m_reparastring)); |
173 | if (bonespace) filt->addfilter(new OnePara); | 259 | if (bonespace) filt->addfilter(new OnePara); |
174 | if (bindenter) filt->addfilter(new indenter(bindenter)); | 260 | if (bindenter) filt->addfilter(new indenter(bindenter)); |
175 | if (bdblspce) filt->addfilter(new dblspce); | 261 | if (bdblspce) filt->addfilter(new dblspce); |
176 | #ifdef REPALM | ||
177 | if (brepalm) filt->addfilter(new repalm); | ||
178 | #endif | ||
179 | if (bremap) filt->addfilter(new remap); | ||
180 | if (bdepluck) filt->addfilter(new DePluck(pluckernextpart)); | 262 | if (bdepluck) filt->addfilter(new DePluck(pluckernextpart)); |
181 | if (bdejpluck) filt->addfilter(new DePluck(jplucknextpart)); | 263 | if (bdejpluck) filt->addfilter(new DePluck(jplucknextpart)); |
264 | if (brepalm) filt->addfilter(new repalm); | ||
265 | if (bkern) filt->addfilter(new kern); | ||
266 | if (bremap) filt->addfilter(new remap); | ||
182 | if (bmakebold) filt->addfilter(new embolden); | 267 | if (bmakebold) filt->addfilter(new embolden); |
183 | if (bfulljust) filt->addfilter(new FullJust); | 268 | if (bfulljust) filt->addfilter(new FullJust); |
269 | int r,g,b; | ||
270 | m_default_bg.rgb(&r, &g, &b); | ||
271 | if (r != 255 || g != 255 || b != 255) | ||
272 | filt->addfilter(new setbg(r,g,b)); | ||
273 | m_default_fg.rgb(&r, &g, &b); | ||
274 | if (r != 0 || g != 0 || b != 0) | ||
275 | filt->addfilter(new setfg(r,g,b)); | ||
276 | // if (bNegative) filt->addfilter(new makeNegative); | ||
277 | if (bInverse) filt->addfilter(new makeInverse); | ||
184 | return filt; | 278 | return filt; |
185 | } | 279 | } |
186 | 280 | ||
187 | 281 | ||
188 | private slots: | 282 | private slots: |
283 | void dopageup(); | ||
284 | void lineDown(); | ||
285 | void lineUp(); | ||
286 | void dopagedn(); | ||
189 | void goHome(); | 287 | void goHome(); |
190 | void goBack(); | 288 | void goBack(); |
191 | void goForward(); | 289 | void goForward(); |
192 | void doscroll(); | 290 | void doscroll(); |
193 | void drawIt( QPainter * ); | ||
194 | void paintEvent( QPaintEvent * ); | 291 | void paintEvent( QPaintEvent * ); |
195 | // void resizeEvent( QResizeEvent * p ) { update(); } | 292 | #ifdef DOUBLEBUFFER |
293 | void resizeEvent( QResizeEvent * p ); | ||
294 | #endif | ||
196 | void keyPressEvent(QKeyEvent*); | 295 | void keyPressEvent(QKeyEvent*); |
197 | void drawFonts(QPainter*); | ||
198 | private: | 296 | private: |
297 | // void drawIt( QPainter * ); | ||
298 | void redrawall(); | ||
299 | void drawFonts(); | ||
300 | void DrawStraight(QPainter* p, int w, int h); | ||
301 | QColor m_scrollcolor, m_scrollbarcolor; | ||
199 | void setTwoTouch(bool _b); | 302 | void setTwoTouch(bool _b); |
200 | void init(); | 303 | void init(); |
201 | void mousePressEvent( QMouseEvent* ); | 304 | void mousePressEvent( QMouseEvent* ); |
202 | void mouseReleaseEvent( QMouseEvent* ); | 305 | void mouseReleaseEvent( QMouseEvent* ); |
203 | // void mouseDoubleClickEvent( QMouseEvent* ); | 306 | // void mouseDoubleClickEvent( QMouseEvent* ); |
204 | QString m_string, m_fontname; | 307 | QString m_string, m_fontname, m_reparastring; |
205 | void setfont(); | 308 | void setfont(); |
206 | //myoutput stuff | 309 | //myoutput stuff |
207 | private: | 310 | private: |
311 | #ifdef SPECIALSCROLL | ||
312 | int m_scrolldy; | ||
313 | #endif | ||
208 | bool mouseUpOn; | 314 | bool mouseUpOn; |
209 | linkType getcurrentpos(int x, int y, size_t& start, size_t& offset, size_t& tgt); | 315 | 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*&); |
210 | bool m_twotouch, m_touchone; | 316 | bool m_twotouch, m_touchone; |
211 | size_t m_startpos, m_startoffset; | 317 | size_t m_startpos, m_startoffset; |
212 | void dopageup(unsigned int); | 318 | void dopageup(unsigned int); |
213 | void dopageup(); | ||
214 | void lineDown(); | ||
215 | void lineUp(); | ||
216 | void dopagedn(); | ||
217 | long real_delay(); | 319 | long real_delay(); |
218 | int m_textsize; | 320 | int m_textsize; |
219 | int m_lastwidth, m_lastheight; | 321 | int m_lastwidth, m_lastheight; |
220 | CBufferFace<CDrawBuffer*> textarray; | 322 | CBufferFace<CDrawBuffer*> textarray; |
221 | CBufferFace<size_t> locnarray; | 323 | CBufferFace<size_t> locnarray; |
222 | unsigned int numlines; | 324 | unsigned int numlines; |
223 | // bool m_showlast; | 325 | // bool m_showlast; |
224 | bool bstripcr, btextfmt, bstriphtml, bdehyphen, bdepluck, bdejpluck, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace, bfulljust; | 326 | bool bstripcr, btextfmt, bstriphtml, bdehyphen, bdepluck, bdejpluck, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace, bfulljust, /*bNegative,*/ bInverse; |
225 | #ifdef REPALM | 327 | bool bkern, brepalm; |
226 | bool brepalm; | ||
227 | #endif | ||
228 | bool m_bpagemode, m_bMonoSpaced, m_continuousDocument; | 328 | bool m_bpagemode, m_bMonoSpaced, m_continuousDocument; |
229 | unsigned char bindenter; | 329 | unsigned char bindenter; |
230 | QString m_lastfile; | 330 | QString m_lastfile; |
231 | size_t m_lastposn; | 331 | size_t m_lastposn; |
232 | public: | ||
233 | bool bDoUpdates; | 332 | bool bDoUpdates; |
333 | public: | ||
334 | void setDoUpdates(bool b) { bDoUpdates = b; } | ||
335 | void setStripCR(bool b) { bstripcr = b; } | ||
234 | void NavUp(); | 336 | void NavUp(); |
235 | void NavDown(); | 337 | void NavDown(); |
236 | tchar getch() { return buffdoc.getch(); } | 338 | tchar getch() { return buffdoc.getch(); } |
237 | bool synch(size_t, size_t); | 339 | bool synch(size_t, size_t); |
238 | bool tight; | 340 | bool tight; |
239 | bool load_file(const char *newfile, unsigned int lcn=0); | 341 | bool load_file(const char *newfile, unsigned int lcn=0); |
240 | BuffDoc buffdoc; | 342 | BuffDoc buffdoc; |
241 | CList<Bkmk>* getbkmklist() { return buffdoc.getbkmklist(); } | 343 | CList<Bkmk>* getbkmklist() { return buffdoc.getbkmklist(); } |
242 | bool locate(unsigned long n); | 344 | bool locate(unsigned long n); |
243 | void jumpto(unsigned long n) { buffdoc.unsuspend(); buffdoc.locate(n); } | 345 | void jumpto(unsigned long n) { buffdoc.locate(n); } |
244 | unsigned long locate() { buffdoc.unsuspend(); return buffdoc.locate(); } | 346 | unsigned long locate() { return buffdoc.locate(); } |
245 | unsigned long explocate() { buffdoc.unsuspend(); return buffdoc.explocate(); } | 347 | unsigned long explocate() { return buffdoc.explocate(); } |
246 | unsigned long pagelocate() { return locnarray[0]; } | 348 | unsigned long pagelocate() { return locnarray[0]; } |
247 | unsigned long mylastpos; | 349 | unsigned long mylastpos; |
248 | void setfilter(CFilterChain *f) { buffdoc.unsuspend(); buffdoc.setfilter(f); locate(pagelocate()); } | 350 | void getNextLink(); |
351 | void setfilter(CFilterChain *f) { buffdoc.setfilter(f); if (bDoUpdates) locate(pagelocate()); } | ||
249 | void restore() { jumpto(mylastpos); } | 352 | void restore() { jumpto(mylastpos); } |
250 | void goUp(); | 353 | void goUp(); |
251 | void refresh() { locate(pagelocate()); } | 354 | void refresh(bool full = false); |
252 | void goDown(); | 355 | void goDown(); |
253 | // bool bold; | 356 | // bool bold; |
254 | int textsize() { return m_textsize; } | 357 | int textsize() { return m_textsize; } |
255 | void textsize(int ts) { m_textsize = ts; } | 358 | void textsize(int ts) { m_textsize = ts; } |
256 | bool fillbuffer(int ru = 0, int ht = 0, int newht = -1); | 359 | bool fillbuffer(int ru = 0, int ht = -1, int newht = -1); |
360 | void CalculateScrollParameters(); | ||
257 | unsigned int screenlines(); | 361 | unsigned int screenlines(); |
258 | void sizes(unsigned long& fs, unsigned long& ts) { buffdoc.unsuspend(); buffdoc.sizes(fs,ts); } | 362 | void sizes(unsigned long& fs, unsigned long& ts) { buffdoc.sizes(fs,ts); } |
259 | static const char *fonts[]; | 363 | static const char *fonts[]; |
260 | // unsigned int *fontsizes; | 364 | // unsigned int *fontsizes; |
261 | int m_ascent, m_descent, m_linespacing; | 365 | int m_ascent, m_descent, m_linespacing; |
366 | int m_topmargin, m_bottommargin; | ||
367 | int m_abstopmargin, m_absbottommargin; | ||
262 | QFontMetrics* m_fm; | 368 | QFontMetrics* m_fm; |
263 | QString firstword(); | 369 | QString firstword(); |
264 | 370 | bool hyphenate; | |
371 | void reset_bg() | ||
372 | { | ||
373 | int r,g,b; | ||
374 | m_default_bg.rgb(&r, &g, &b); | ||
375 | if (bInverse) | ||
376 | { | ||
377 | r = 255-r; | ||
378 | g = 255-g; | ||
379 | b = 255-b; | ||
380 | } | ||
381 | m_bg.setRgb(r,g,b); | ||
382 | /* | ||
383 | int h,s,v; | ||
384 | m_bg.hsv(&h, &s, &v); | ||
385 | if (bNegative) | ||
386 | { | ||
387 | v = 255-v; | ||
388 | m_bg.setHsv(h,s,v); | ||
389 | } | ||
390 | */ | ||
391 | setBackgroundColor( m_bg ); | ||
392 | } | ||
393 | void setInverse(bool b) | ||
394 | { | ||
395 | bInverse = b; | ||
396 | reset_bg(); | ||
397 | } | ||
398 | /* | ||
399 | void setNegative() | ||
400 | { | ||
401 | bNegative = !bNegative; | ||
402 | reset_bg(); | ||
403 | } | ||
404 | */ | ||
265 | signals: | 405 | signals: |
266 | void OnRedraw(); | 406 | void OnRedraw(); |
267 | void OnWordSelected(const QString&, size_t, const QString&); | 407 | void OnWordSelected(const QString&, size_t, size_t, const QString&); |
268 | void OnShowPicture(QImage&); | 408 | void OnShowPicture(QImage&); |
269 | void OnURLSelected(const QString&); | 409 | void OnURLSelected(const QString&, const size_t); |
410 | void NewFileRequest(const QString&); | ||
411 | void HandleKeyRequest(QKeyEvent*); | ||
412 | void SetScrollState(bool); | ||
413 | void RefreshBitmap(); | ||
270 | }; | 414 | }; |
271 | 415 | ||
272 | #endif | 416 | #endif |