author | llornkcor <llornkcor> | 2002-09-14 02:19:09 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-14 02:19:09 (UTC) |
commit | 2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975 (patch) (unidiff) | |
tree | eeed16b5f80dd5883991a7a06133f5f7a6936256 /noncore/apps/opie-reader/QTReaderApp.h | |
parent | 5a95ed6a000a56849b8f093deea500214856c626 (diff) | |
download | opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.zip opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.tar.gz opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.tar.bz2 |
update by Tim
Diffstat (limited to 'noncore/apps/opie-reader/QTReaderApp.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/QTReaderApp.h | 73 |
1 files changed, 65 insertions, 8 deletions
diff --git a/noncore/apps/opie-reader/QTReaderApp.h b/noncore/apps/opie-reader/QTReaderApp.h index 48575e9..22c57e4 100644 --- a/noncore/apps/opie-reader/QTReaderApp.h +++ b/noncore/apps/opie-reader/QTReaderApp.h | |||
@@ -14,81 +14,124 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef __QTREADERAPP_H | 20 | #ifndef __QTREADERAPP_H |
21 | #define __QTREADERAPP_H | 21 | #define __QTREADERAPP_H |
22 | 22 | ||
23 | //#define __ISEARCH | 23 | //#define __ISEARCH |
24 | 24 | ||
25 | #define MAX_ENCODING 6 | 25 | #define MAX_ENCODING 6 |
26 | #define MAX_ACTIONS 3 | ||
26 | 27 | ||
27 | #include <qmainwindow.h> | 28 | #include <qmainwindow.h> |
28 | #include "QTReader.h" | 29 | #include "CExpander.h" |
29 | #include <qlist.h> | 30 | #include <qlist.h> |
30 | #include <qpe/filemanager.h> | 31 | #include <qpe/filemanager.h> |
31 | #include <qmap.h> | 32 | #include <qmap.h> |
32 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
33 | #include <qstack.h> | 34 | #include <qstack.h> |
34 | #include <qlistbox.h> | 35 | #include <qlistbox.h> |
35 | #include "Queue.h" | 36 | //#include "Queue.h" |
36 | 37 | ||
37 | class QWidgetStack; | 38 | class QWidgetStack; |
38 | class QToolButton; | 39 | class QToolButton; |
39 | class QPopupMenu; | 40 | class QPopupMenu; |
40 | class QToolBar; | 41 | class QToolBar; |
42 | class QPEToolBar; | ||
41 | class CBkmkSelector; | 43 | class CBkmkSelector; |
42 | class QProgressBar; | 44 | class QProgressBar; |
43 | class QAction; | 45 | class QAction; |
46 | class CAnnoEdit; | ||
47 | class QFloatBar; | ||
48 | class CDrawBuffer; | ||
49 | class QTReader; | ||
50 | |||
51 | enum ActionTypes | ||
52 | { | ||
53 | cesOpenFile = 0, | ||
54 | cesAutoScroll, | ||
55 | cesActionMark | ||
56 | }; | ||
44 | 57 | ||
45 | #ifdef __ISEARCH | 58 | #ifdef __ISEARCH |
46 | struct searchrecord | 59 | struct searchrecord |
47 | { | 60 | { |
48 | QString s; | 61 | QString s; |
49 | size_t pos; | 62 | size_t pos; |
50 | searchrecord(const QString& _s, size_t _pos) : s(_s), pos(_pos) {} | 63 | searchrecord(const QString& _s, size_t _pos) : s(_s), pos(_pos) {} |
51 | }; | 64 | }; |
52 | #endif | 65 | #endif |
53 | 66 | ||
54 | class infowin; | 67 | class infowin; |
55 | 68 | ||
56 | class QTReaderApp : public QMainWindow | 69 | class QTReaderApp : public QMainWindow |
57 | { | 70 | { |
58 | Q_OBJECT | 71 | Q_OBJECT |
59 | 72 | ||
60 | unsigned long m_savedpos; | 73 | unsigned long m_savedpos; |
74 | bool m_annoIsEditing; | ||
61 | 75 | ||
62 | public: | 76 | public: |
63 | QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 77 | QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
64 | ~QTReaderApp(); | 78 | ~QTReaderApp(); |
65 | 79 | ||
66 | void openFile( const QString & ); | 80 | void openFile( const QString & ); |
67 | 81 | ||
68 | void setScrollState(bool _b); | 82 | void setScrollState(bool _b); |
69 | 83 | ||
70 | protected: | 84 | protected: |
85 | void setfontHelper(const QString& lcn, int size = 0); | ||
86 | QAction* m_bkmkAvail; | ||
87 | CAnnoEdit* m_annoWin; | ||
88 | Bkmk* m_anno; | ||
71 | void closeEvent( QCloseEvent *e ); | 89 | void closeEvent( QCloseEvent *e ); |
72 | void readbkmks(); | 90 | void readbkmks(); |
73 | void do_mono(const QString&); | 91 | void do_mono(const QString&); |
74 | void do_jump(const QString&); | 92 | void do_jump(const QString&); |
75 | void do_overlap(const QString&); | 93 | void do_overlap(const QString&); |
76 | void do_settarget(const QString&); | 94 | void do_settarget(const QString&); |
77 | int EncNameToInt(const QString&); | 95 | int EncNameToInt(const QString&); |
78 | void saveprefs(); | 96 | ActionTypes ActNameToInt(const QString&); |
97 | bool m_doAnnotation; | ||
98 | bool m_doDictionary; | ||
99 | bool m_doClipboard; | ||
79 | 100 | ||
101 | public: | ||
102 | void saveprefs(); | ||
80 | private slots: | 103 | private slots: |
104 | void setTwoTouch(bool _b); | ||
105 | void restoreFocus(); | ||
106 | void OnAnnotation(bool _b) | ||
107 | { | ||
108 | m_doAnnotation = _b; | ||
109 | } | ||
110 | void OnDictionary(bool _b) | ||
111 | { | ||
112 | m_doDictionary = _b; | ||
113 | } | ||
114 | void OnClipboard(bool _b) | ||
115 | { | ||
116 | m_doClipboard = _b; | ||
117 | } | ||
118 | void OnWordSelected(const QString&, size_t, const QString&); | ||
119 | void addAnno(const QString&, const QString&, size_t); | ||
120 | void addAnno(const QString&, const QString&); | ||
121 | void addanno(); | ||
122 | void showAnnotation(); | ||
81 | void do_setfont(const QString&); | 123 | void do_setfont(const QString&); |
82 | void encodingSelected(QAction*); | 124 | void encodingSelected(QAction*); |
125 | void buttonActionSelected(QAction*); | ||
83 | void msgHandler(const QCString&, const QByteArray&); | 126 | void msgHandler(const QCString&, const QByteArray&); |
84 | void monospace(bool); | 127 | void monospace(bool); |
85 | void jump(); | 128 | void jump(); |
86 | void setoverlap(); | 129 | void setoverlap(); |
87 | void settarget(); | 130 | void settarget(); |
88 | void setspacing(); | 131 | void setspacing(); |
89 | void setfont(); | 132 | void setfont(); |
90 | void clearBkmkList(); | 133 | void clearBkmkList(); |
91 | void listBkmkFiles(); | 134 | void listBkmkFiles(); |
92 | void editMark(); | 135 | void editMark(); |
93 | void autoScroll(bool); | 136 | void autoScroll(bool); |
94 | void addbkmk(); | 137 | void addbkmk(); |
@@ -118,89 +161,103 @@ private slots: | |||
118 | void regClose(); | 161 | void regClose(); |
119 | 162 | ||
120 | #ifdef __ISEARCH | 163 | #ifdef __ISEARCH |
121 | // void search( const QString& ); | 164 | // void search( const QString& ); |
122 | #else | 165 | #else |
123 | void search(); | 166 | void search(); |
124 | #endif | 167 | #endif |
125 | 168 | ||
126 | void openFile( const DocLnk & ); | 169 | void openFile( const DocLnk & ); |
127 | void showEditTools(); | 170 | void showEditTools(); |
128 | 171 | ||
129 | void stripcr(bool); | 172 | void stripcr(bool); |
173 | void peanut(bool _b); | ||
174 | void remap(bool); | ||
175 | void embolden(bool); | ||
176 | void autofmt(bool); | ||
177 | void textfmt(bool); | ||
130 | void striphtml(bool); | 178 | void striphtml(bool); |
131 | void dehyphen(bool); | 179 | void dehyphen(bool); |
132 | void unindent(bool); | 180 | void unindent(bool); |
133 | void repara(bool); | 181 | void repara(bool); |
134 | void setbold(bool); | ||
135 | void dblspce(bool); | 182 | void dblspce(bool); |
136 | void pagemode(bool); | 183 | void pagemode(bool); |
137 | // void gotobkmk(const QString& bm); | 184 | // void gotobkmk(const QString& bm); |
138 | void gotobkmk(int); | 185 | void gotobkmk(int); |
139 | void cancelbkmk(); | 186 | void cancelbkmk(); |
140 | void do_gotomark(); | 187 | void do_gotomark(); |
141 | void do_delmark(); | 188 | void do_delmark(); |
142 | void do_autogen(); | 189 | void do_autogen(); |
143 | void do_regaction(); | 190 | void do_regaction(); |
191 | void OnRedraw(); | ||
192 | void OnActionPressed(); | ||
144 | 193 | ||
145 | private: | 194 | private: |
195 | QString m_targetapp, m_targetmsg; | ||
146 | void listbkmk(); | 196 | void listbkmk(); |
147 | void do_regedit(); | 197 | void do_regedit(); |
148 | void colorChanged( const QColor &c ); | 198 | void colorChanged( const QColor &c ); |
149 | void clear(); | 199 | void clear(); |
150 | void updateCaption(); | 200 | void updateCaption(); |
151 | void do_autogen(const QString&); | 201 | void do_autogen(const QString&); |
152 | void do_addbkmk(const QString&); | 202 | void do_addbkmk(const QString&); |
203 | bool findNextBookmark(size_t start); | ||
153 | 204 | ||
154 | private: | 205 | private: |
155 | 206 | ||
156 | QAction* m_scrollButton; | 207 | QAction* m_scrollButton; |
157 | 208 | ||
158 | QAction* m_EncodingAction[MAX_ENCODING]; | 209 | QAction* m_EncodingAction[MAX_ENCODING]; |
159 | 210 | ||
211 | QAction* m_buttonAction[MAX_ACTIONS]; | ||
212 | |||
160 | CBkmkSelector* bkmkselector; | 213 | CBkmkSelector* bkmkselector; |
161 | 214 | ||
215 | ActionTypes m_spaceTarget; | ||
162 | size_t searchStart; | 216 | size_t searchStart; |
163 | #ifdef __ISEARCH | 217 | #ifdef __ISEARCH |
164 | QStack<searchrecord>* searchStack; | 218 | QStack<searchrecord>* searchStack; |
165 | bool dosearch(size_t start, CBuffer& test, const QString& arg); | 219 | bool dosearch(size_t start, CDrawBuffer& test, const QString& arg); |
166 | #else | 220 | #else |
167 | bool dosearch(size_t start, CBuffer& test, const QRegExp& arg); | 221 | bool dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg); |
168 | #endif | 222 | #endif |
169 | QWidgetStack *editorStack; | 223 | QWidgetStack *editorStack; |
170 | QTReader* reader; | 224 | QTReader* reader; |
171 | QComboBox* m_fontSelector; | 225 | QComboBox* m_fontSelector; |
172 | QToolBar *menu, *editBar, *searchBar, *regBar, *m_fontBar; | 226 | QPEToolBar /* *menu,*/ *editBar; |
227 | QFloatBar *searchBar, *regBar/*, *m_fontBar*/; | ||
228 | QToolBar /* *searchBar, *regBar,*/ *m_fontBar; | ||
173 | QLineEdit *searchEdit, *regEdit; | 229 | QLineEdit *searchEdit, *regEdit; |
174 | DocLnk *doc; | 230 | DocLnk *doc; |
175 | bool searchVisible; | 231 | bool searchVisible; |
176 | bool regVisible; | 232 | bool regVisible; |
177 | bool m_fontVisible; | 233 | bool m_fontVisible, m_twoTouch; |
178 | bool bFromDocView; | 234 | bool bFromDocView; |
179 | static unsigned long m_uid; | 235 | static unsigned long m_uid; |
180 | long unsigned get_unique_id() { return m_uid++; } | 236 | long unsigned get_unique_id() { return m_uid++; } |
181 | /* | 237 | /* |
182 | void resizeEvent( QResizeEvent * r) | 238 | void resizeEvent( QResizeEvent * r) |
183 | { | 239 | { |
184 | qDebug("resize:(%u,%u)", r->oldSize().width(), r->oldSize().height()); | 240 | qDebug("resize:(%u,%u)", r->oldSize().width(), r->oldSize().height()); |
185 | qDebug("resize:(%u,%u)", r->size().width(), r->size().height()); | 241 | qDebug("resize:(%u,%u)", r->size().width(), r->size().height()); |
186 | // bgroup->move( width()-bgroup->width(), 0 ); | 242 | // bgroup->move( width()-bgroup->width(), 0 ); |
187 | } | 243 | } |
188 | */ | 244 | */ |
189 | CList<Bkmk>* pBkmklist; | 245 | CList<Bkmk>* pBkmklist; |
190 | infowin* m_infoWin; | 246 | infowin* m_infoWin; |
191 | QProgressBar* pbar; | 247 | QProgressBar* pbar; |
192 | bool m_fBkmksChanged; | 248 | bool m_fBkmksChanged; |
193 | int m_nRegAction; | 249 | int m_nRegAction; |
194 | QString m_autogenstr; | 250 | QString m_autogenstr; |
251 | bool m_dontSave; | ||
195 | }; | 252 | }; |
196 | 253 | ||
197 | const int cAutoGen = 0; | 254 | const int cAutoGen = 0; |
198 | const int cAddBkmk = 1; | 255 | const int cAddBkmk = 1; |
199 | const int cDelBkmk = 2; | 256 | const int cDelBkmk = 2; |
200 | const int cGotoBkmk = 3; | 257 | const int cGotoBkmk = 3; |
201 | const int cRmBkmkFile = 4; | 258 | const int cRmBkmkFile = 4; |
202 | const int cJump = 5; | 259 | const int cJump = 5; |
203 | const int cMonoSpace = 6; | 260 | const int cMonoSpace = 6; |
204 | const int cOverlap = 7; | 261 | const int cOverlap = 7; |
205 | const int cSetTarget = 8; | 262 | const int cSetTarget = 8; |
206 | #endif | 263 | #endif |