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.h150
1 files changed, 55 insertions, 95 deletions
diff --git a/noncore/apps/opie-reader/QTReader.h b/noncore/apps/opie-reader/QTReader.h
index 3d5f57d..dfbdfb9 100644
--- a/noncore/apps/opie-reader/QTReader.h
+++ b/noncore/apps/opie-reader/QTReader.h
@@ -3,2 +3,4 @@
3 3
4//#define _SCROLLPIPE
5
4#include <qwidget.h> 6#include <qwidget.h>
@@ -16,3 +18,2 @@ class QTimer;
16class QPixmap; 18class QPixmap;
17class statedata;
18 19
@@ -22,4 +23,8 @@ class QTReader : public QWidget
22 23
24 static tchar pluckernextpart[];
25 static tchar jplucknextpart[];
23 friend class QTReaderApp; 26 friend class QTReaderApp;
24 void suspend() { buffdoc.suspend(); } 27 void suspend();
28 void increaseScroll();
29 void reduceScroll();
25 void drawText(QPainter& p, int x, int y, tchar* text); 30 void drawText(QPainter& p, int x, int y, tchar* text);
@@ -27,8 +32,10 @@ class QTReader : public QWidget
27 unsigned int m_overlap; 32 unsigned int m_overlap;
28 bool m_autoScroll; 33 bool m_autoScroll, m_swapmouse;
29 void autoscroll(); 34 void autoscroll();
30 QTimer* timer; 35 QTimer* timer;
31 int m_scrolldy1, m_scrolldy2, m_encd; 36 int m_scrolldy1, m_scrolldy2, m_encd, m_scrollpart;
32 void focusInEvent(QFocusEvent*); 37 void focusInEvent(QFocusEvent*);
33 void focusOutEvent(QFocusEvent*); 38 void focusOutEvent(QFocusEvent*);
39 void processmousepositionevent( QMouseEvent* _e );
40 void processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno);
34 bool ChangeFont(int); 41 bool ChangeFont(int);
@@ -37,3 +44,12 @@ class QTReader : public QWidget
37 int m_charpc; 44 int m_charpc;
45 unsigned char m_border;
38 FontControl m_fontControl; 46 FontControl m_fontControl;
47 void setBaseSize(unsigned char _s) { m_fontControl.setBaseSize(_s); }
48 unsigned char getBaseSize() { return m_fontControl.getBaseSize(); }
49#ifdef _SCROLLPIPE
50 FILE* m_pipeout;
51 QString m_pipetarget;
52 bool m_isPaused;
53 bool m_pauseAfterEachPara;
54#endif
39public: 55public:
@@ -88,85 +104,18 @@ public:
88 */ 104 */
89 void setpeanut(bool _b) 105 void setlead(int _lead)
90 {
91 bpeanut = _b;
92 setfilter(getfilter());
93 }
94 void setremap(bool _b)
95 {
96 bremap = _b;
97 setfilter(getfilter());
98 }
99 void setmakebold(bool _b)
100 {
101 bmakebold = _b;
102 setfilter(getfilter());
103 }
104 void setautofmt(bool _b)
105 {
106 bautofmt = _b;
107 if (bautofmt)
108 { 106 {
109 btextfmt = false; 107 m_fontControl.setlead(_lead);
110 bstriphtml = false;; 108 }
111 bpeanut = false; 109 int getlead()
110 {
111 return m_fontControl.getlead();
112 }
113 void setextraspace(int _lead)
114 {
115 m_fontControl.setextraspace(_lead);
116 }
117 int getextraspace()
118 {
119 return m_fontControl.getextraspace();
112 } 120 }
113 setfilter(getfilter());
114 }
115 void settextfmt(bool _b)
116 {
117 btextfmt = _b;
118 setfilter(getfilter());
119 }
120 void setstripcr(bool _b)
121 {
122 bstripcr = _b;
123 setfilter(getfilter());
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
137 void setstriphtml(bool _b)
138 {
139 bstriphtml = _b;
140 setfilter(getfilter());
141 }
142 void setdehyphen(bool _b)
143 {
144 bdehyphen = _b;
145 setfilter(getfilter());
146 }
147 void setunindent(bool _b)
148 {
149 bunindent = _b;
150 setfilter(getfilter());
151 }
152 void setrepara(bool _b)
153 {
154 brepara = _b;
155 setfilter(getfilter());
156 }
157 void setdblspce(bool _b)
158 {
159 bdblspce = _b;
160 setfilter(getfilter());
161 }
162 void indentplus()
163 {
164 if (bindenter < 15) bindenter += 2;
165 setfilter(getfilter());
166 }
167 void indentminus()
168 {
169 if (bindenter > 1) bindenter -= 2;
170 setfilter(getfilter());
171 }
172 void setpagemode(bool _b) 121 void setpagemode(bool _b)
@@ -189,17 +138,22 @@ public:
189 { 138 {
139 // qDebug("m_encd:%d", m_encd);
190 switch (m_encd) 140 switch (m_encd)
191 { 141 {
192 case 5:
193 return new Ccp1252;
194 case 4: 142 case 4:
143 // qDebug("palm");
195 return new CPalm; 144 return new CPalm;
196 case 1: 145 case 1:
146 // qDebug("utf8");
197 return new CUtf8; 147 return new CUtf8;
198 case 2: 148 case 2:
149 // qDebug("ucs16be");
199 return new CUcs16be; 150 return new CUcs16be;
200 case 3: 151 case 3:
152 // qDebug("ucs16le");
201 return new CUcs16le; 153 return new CUcs16le;
202 case 0: 154 case 0:
203 default: 155 // qDebug("ascii");
204 return new CAscii; 156 return new CAscii;
157 default:
158 return new CGeneral8Bit(m_encd-MAX_ENCODING+1);
205 } 159 }
@@ -225,3 +179,6 @@ public:
225 if (bremap) filt->addfilter(new remap); 179 if (bremap) filt->addfilter(new remap);
180 if (bdepluck) filt->addfilter(new DePluck(pluckernextpart));
181 if (bdejpluck) filt->addfilter(new DePluck(jplucknextpart));
226 if (bmakebold) filt->addfilter(new embolden); 182 if (bmakebold) filt->addfilter(new embolden);
183 if (bfulljust) filt->addfilter(new FullJust);
227 return filt; 184 return filt;
@@ -231,2 +188,5 @@ public:
231private slots: 188private slots:
189 void goHome();
190 void goBack();
191 void goForward();
232 void doscroll(); 192 void doscroll();
@@ -262,3 +222,4 @@ private slots:
262 unsigned int numlines; 222 unsigned int numlines;
263 bool bstripcr, btextfmt, bstriphtml, bdehyphen, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace; 223// bool m_showlast;
224 bool bstripcr, btextfmt, bstriphtml, bdehyphen, bdepluck, bdejpluck, bunindent, brepara, bdblspce, btight, bmakebold, bremap, bpeanut, bautofmt, bonespace, bfulljust;
264#ifdef REPALM 225#ifdef REPALM
@@ -272,6 +233,6 @@ private slots:
272 bool bDoUpdates; 233 bool bDoUpdates;
273 bool m_navkeys;
274 void NavUp(); 234 void NavUp();
275 void NavDown(); 235 void NavDown();
276 int getch() { return buffdoc.getch(); } 236 tchar getch() { return buffdoc.getch(); }
237 bool synch(size_t, size_t);
277 bool tight; 238 bool tight;
@@ -294,3 +255,3 @@ private slots:
294 void textsize(int ts) { m_textsize = ts; } 255 void textsize(int ts) { m_textsize = ts; }
295 bool fillbuffer(int ru = 0, int ht = 0); 256 bool fillbuffer(int ru = 0, int ht = 0, int newht = -1);
296 unsigned int screenlines(); 257 unsigned int screenlines();
@@ -302,3 +263,2 @@ private slots:
302 QString firstword(); 263 QString firstword();
303 void setstate(const statedata& sd);
304 264
@@ -307,4 +267,4 @@ private slots:
307 void OnWordSelected(const QString&, size_t, const QString&); 267 void OnWordSelected(const QString&, size_t, const QString&);
308 void OnActionPressed(); 268 void OnShowPicture(QImage&);
309 void OnShowPicture(QPixmap&); 269 void OnURLSelected(const QString&);
310}; 270};