Rev 459 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
102 | Franz | 1 | /*************************************************************************** |
2 | story.h - description |
||
3 | ------------------- |
||
4 | begin : Tue Nov 11 2003 |
||
5 | copyright : (C) 2003 by Franz Schmid |
||
6 | email : Franz.Schmid@altmuehlnet.de |
||
7 | ***************************************************************************/ |
||
8 | |||
9 | /*************************************************************************** |
||
10 | * * |
||
11 | * This program is free software; you can redistribute it and/or modify * |
||
12 | * it under the terms of the GNU General Public License as published by * |
||
13 | * the Free Software Foundation; either version 2 of the License, or * |
||
14 | * (at your option) any later version. * |
||
15 | * * |
||
16 | ***************************************************************************/ |
||
17 | |||
18 | #ifndef STORY_H |
||
19 | #define STORY_H |
||
20 | |||
21 | #include <qvariant.h> |
||
351 | Franz | 22 | #include <qmainwindow.h> |
102 | Franz | 23 | #include <qptrlist.h> |
24 | #include <qtable.h> |
||
25 | #include <qtextedit.h> |
||
103 | Franz | 26 | #include <qpopupmenu.h> |
27 | #include <qmenubar.h> |
||
124 | Franz | 28 | #include <qstatusbar.h> |
29 | #include <qlabel.h> |
||
126 | Franz | 30 | #include <qbuttongroup.h> |
351 | Franz | 31 | #include <qspinbox.h> |
32 | #include <qtoolbutton.h> |
||
33 | #include <qtoolbar.h> |
||
34 | #include <qlayout.h> |
||
371 | Franz | 35 | #include <qsplitter.h> |
459 | subik | 36 | #include <qcheckbox.h> |
102 | Franz | 37 | #include "pageitem.h" |
351 | Franz | 38 | #include "mspinbox.h" |
39 | #include "spalette.h" |
||
40 | #include "fontcombo.h" |
||
41 | #include "styleselect.h" |
||
42 | #include "alignselect.h" |
||
43 | #include "shadebutton.h" |
||
102 | Franz | 44 | |
462 | fschmid | 45 | struct PtiSmall { |
351 | Franz | 46 | int csize; |
47 | int cshade; |
||
48 | int cshade2; |
||
49 | int cstyle; |
||
50 | int cab; |
||
51 | int cscale; |
||
52 | double cextra; |
||
53 | QString ch; |
||
54 | QString cfont; |
||
55 | QString ccolor; |
||
56 | QString cstroke; |
||
57 | }; |
||
58 | |||
102 | Franz | 59 | class SEditor : public QTextEdit |
60 | { |
||
61 | Q_OBJECT |
||
62 | |||
63 | public: |
||
351 | Franz | 64 | SEditor (QWidget* parent, ScribusDoc *docc); |
102 | Franz | 65 | ~SEditor() {}; |
351 | Franz | 66 | void setAlign(int style); |
67 | void saveItemText(PageItem* b); |
||
68 | void loadItemText(PageItem* b); |
||
69 | void loadText(QString tx, PageItem* b); |
||
366 | Franz | 70 | void updateAll(); |
351 | Franz | 71 | void updateFromChars(int p); |
72 | void updateSel(int code, struct PtiSmall *hg); |
||
73 | void deleteSel(); |
||
74 | void setStyle(int Csty); |
||
75 | void setFarbe(QString farbe, int shad); |
||
76 | void insChars(QString t); |
||
363 | Franz | 77 | void insStyledText(); |
78 | void copyStyledText(); |
||
351 | Franz | 79 | |
80 | typedef QPtrList<PtiSmall> ChList; |
||
81 | QPtrList<ChList> StyledText; |
||
373 | Franz | 82 | QValueList<int> ParagStyles; |
351 | Franz | 83 | ScribusDoc* doc; |
253 | Franz | 84 | bool UniCinp; |
353 | Franz | 85 | bool wasMod; |
371 | Franz | 86 | bool ready; |
253 | Franz | 87 | int UniCinC; |
351 | Franz | 88 | int CurrentStyle; |
89 | int CurrentABStil; |
||
90 | int CurrFontSize; |
||
91 | int CurrTextFillSh; |
||
92 | int CurrTextStrokeSh; |
||
93 | int CurrTextScale; |
||
94 | double CurrTextKern; |
||
95 | QString CurrTextStroke; |
||
96 | QString CurrTextFill; |
||
97 | QString CurrFont; |
||
253 | Franz | 98 | QString UniCinS; |
363 | Franz | 99 | QString tBuffer; |
100 | ChList cBuffer; |
||
376 | Franz | 101 | int ClipData; |
385 | Franz | 102 | bool StoredSel; |
103 | int SelParaStart; |
||
104 | int SelParaEnd; |
||
105 | int SelCharStart; |
||
106 | int SelCharEnd; |
||
102 | Franz | 107 | |
374 | Franz | 108 | protected: |
109 | void keyPressEvent(QKeyEvent *k); |
||
385 | Franz | 110 | void focusOutEvent(QFocusEvent *e); |
374 | Franz | 111 | QPopupMenu* createPopupMenu(const QPoint & pos); |
112 | |||
351 | Franz | 113 | public slots: |
114 | void cut(); |
||
363 | Franz | 115 | void copy(); |
351 | Franz | 116 | void paste(); |
376 | Franz | 117 | void ClipChange(); |
399 | Franz | 118 | void SelClipChange(); |
351 | Franz | 119 | |
102 | Franz | 120 | signals: |
351 | Franz | 121 | void setProps(int, int); |
372 | Franz | 122 | void SideBarUp(bool); |
123 | void SideBarUpdate(); |
||
376 | Franz | 124 | void PasteAvail(); |
102 | Franz | 125 | }; |
126 | |||
462 | fschmid | 127 | class SideBar : public QLabel |
371 | Franz | 128 | { |
129 | Q_OBJECT |
||
130 | |||
462 | fschmid | 131 | public: |
371 | Franz | 132 | SideBar(QWidget *pa); |
133 | ~SideBar() {}; |
||
134 | int offs; |
||
374 | Franz | 135 | int CurrentPar; |
371 | Franz | 136 | SEditor *editor; |
374 | Franz | 137 | QPopupMenu *pmen; |
372 | Franz | 138 | bool noUpdt; |
373 | Franz | 139 | bool inRep; |
371 | Franz | 140 | |
374 | Franz | 141 | protected: |
142 | void paintEvent(QPaintEvent *e); |
||
143 | void mouseReleaseEvent(QMouseEvent *m); |
||
144 | |||
145 | signals: |
||
146 | void ChangeStyle(int, int); |
||
147 | |||
371 | Franz | 148 | public slots: |
374 | Franz | 149 | void setPStyle(int s); |
371 | Franz | 150 | void doMove(int x, int y); |
151 | void doRepaint(); |
||
372 | Franz | 152 | void setRepaint(bool r); |
371 | Franz | 153 | }; |
154 | |||
462 | fschmid | 155 | class SToolBColorF : public QToolBar |
102 | Franz | 156 | { |
157 | Q_OBJECT |
||
158 | |||
462 | fschmid | 159 | public: |
351 | Franz | 160 | SToolBColorF(QMainWindow* parent, ScribusDoc *doc); |
161 | ~SToolBColorF() {}; |
||
162 | QLabel* FillIcon; |
||
163 | QComboBox* TxFill; |
||
164 | ShadeButton *PM2; |
||
124 | Franz | 165 | |
351 | Franz | 166 | public slots: |
167 | void SetColor(int c); |
||
168 | void SetShade(int s); |
||
169 | void newShadeHandler(); |
||
170 | |||
124 | Franz | 171 | signals: |
351 | Franz | 172 | void NewColor(int, int); |
102 | Franz | 173 | }; |
174 | |||
462 | fschmid | 175 | class SToolBColorS : public QToolBar |
102 | Franz | 176 | { |
177 | Q_OBJECT |
||
178 | |||
462 | fschmid | 179 | public: |
351 | Franz | 180 | SToolBColorS(QMainWindow* parent, ScribusDoc *doc); |
181 | ~SToolBColorS() {}; |
||
182 | QLabel* StrokeIcon; |
||
183 | QComboBox* TxStroke; |
||
184 | ShadeButton *PM1; |
||
185 | |||
186 | public slots: |
||
187 | void SetColor(int c); |
||
188 | void SetShade(int s); |
||
189 | void newShadeHandler(); |
||
190 | |||
191 | signals: |
||
192 | void NewColor(int, int); |
||
193 | }; |
||
194 | |||
462 | fschmid | 195 | class SToolBStyle : public QToolBar |
351 | Franz | 196 | { |
197 | Q_OBJECT |
||
198 | |||
462 | fschmid | 199 | public: |
351 | Franz | 200 | SToolBStyle(QMainWindow* parent); |
201 | ~SToolBStyle() {}; |
||
202 | StyleSelect* SeStyle; |
||
203 | QLabel* kerningLabel; |
||
204 | MSpinBox* Extra; |
||
205 | |||
206 | public slots: |
||
207 | void newKernHandler(); |
||
208 | void SetStyle(int s); |
||
209 | void SetKern(double k); |
||
210 | |||
211 | signals: |
||
212 | void NewKern(double); |
||
213 | void NewStyle(int); |
||
214 | }; |
||
215 | |||
462 | fschmid | 216 | class SToolBAlign : public QToolBar |
351 | Franz | 217 | { |
218 | Q_OBJECT |
||
219 | |||
462 | fschmid | 220 | public: |
351 | Franz | 221 | SToolBAlign(QMainWindow* parent); |
222 | ~SToolBAlign() {}; |
||
223 | AlignSelect* GroupAlign; |
||
224 | Spalette *Spal; |
||
225 | |||
226 | public slots: |
||
227 | void newStyleHandler(int s); |
||
228 | void SetAlign(int s); |
||
229 | |||
230 | signals: |
||
231 | void NewAlign(int); |
||
232 | void NewStyle(int); |
||
233 | }; |
||
234 | |||
462 | fschmid | 235 | class SToolBFont : public QToolBar |
351 | Franz | 236 | { |
237 | Q_OBJECT |
||
238 | |||
462 | fschmid | 239 | public: |
351 | Franz | 240 | SToolBFont(QMainWindow* parent); |
241 | ~SToolBFont() {}; |
||
242 | FontCombo* Fonts; |
||
243 | MSpinBox* Size; |
||
244 | QSpinBox* ChScale; |
||
245 | |||
246 | public slots: |
||
247 | void SetFont(QString f); |
||
248 | void SetSize(double s); |
||
249 | void SetScale(int s); |
||
250 | void newSizeHandler(); |
||
251 | |||
252 | signals: |
||
253 | void NewFont(const QString &); |
||
254 | void NewSize(double); |
||
255 | void NewScale(int); |
||
256 | }; |
||
257 | |||
258 | class StoryEditor : public QMainWindow |
||
259 | { |
||
260 | Q_OBJECT |
||
261 | |||
102 | Franz | 262 | public: |
263 | StoryEditor( QWidget* parent, ScribusDoc *docc, PageItem* ite ); |
||
264 | ~StoryEditor() {}; |
||
351 | Franz | 265 | void closeEvent(QCloseEvent *); |
266 | int exec(); |
||
267 | void changeAlign(int align); |
||
268 | int result; |
||
102 | Franz | 269 | |
103 | Franz | 270 | QPopupMenu* fmenu; |
271 | QPopupMenu* emenu; |
||
357 | Franz | 272 | QPopupMenu* settingsMenu; |
353 | Franz | 273 | QToolBar* FileTools; |
274 | QToolButton* DatNeu; |
||
275 | QToolButton* DatOpe; |
||
276 | QToolButton* DatSav; |
||
357 | Franz | 277 | QToolButton* DatFin; |
353 | Franz | 278 | QToolButton* DatClo; |
279 | QToolButton* DatCan; |
||
280 | QToolButton* DatRel; |
||
281 | QToolButton* DatUpdt; |
||
351 | Franz | 282 | SToolBFont* FontTools; |
283 | SToolBAlign* AlignTools; |
||
284 | SToolBColorF* FillTools; |
||
285 | SToolBColorS* StrokeTools; |
||
286 | SToolBStyle* StyleTools; |
||
371 | Franz | 287 | QSplitter* EdSplit; |
288 | SideBar* EditorBar; |
||
351 | Franz | 289 | SEditor* Editor; |
126 | Franz | 290 | QButtonGroup* ButtonGroup1; |
291 | QButtonGroup* ButtonGroup2; |
||
292 | QLabel* WordCT1; |
||
293 | QLabel* WordCT3; |
||
124 | Franz | 294 | QLabel* ParCT; |
295 | QLabel* ParC; |
||
296 | QLabel* WordCT; |
||
297 | QLabel* WordC; |
||
298 | QLabel* CharCT; |
||
299 | QLabel* CharC; |
||
300 | QLabel* WordCT2; |
||
301 | QLabel* WordC2; |
||
302 | QLabel* CharCT2; |
||
303 | QLabel* CharC2; |
||
459 | subik | 304 | /*! Enables/disables the "smart" selection (#1203) - 10/16/2004 pv */ |
462 | fschmid | 305 | bool smartSelection; |
306 | int smartSel; |
||
351 | Franz | 307 | |
102 | Franz | 308 | ScribusDoc* doc; |
309 | PageItem* CurrItem; |
||
310 | bool TextChanged; |
||
113 | Franz | 311 | int Mcopy; |
312 | int Mcut; |
||
313 | int Mdel; |
||
314 | int Mpaste; |
||
315 | int Mupdt; |
||
351 | Franz | 316 | int fid52; |
353 | Franz | 317 | bool firstSet; |
102 | Franz | 318 | |
319 | public slots: |
||
357 | Franz | 320 | void setBackPref(); |
321 | void setFontPref(); |
||
351 | Franz | 322 | void newTxFill(int c, int s); |
323 | void newTxStroke(int c, int s); |
||
324 | void newTxFont(const QString &f); |
||
325 | void newTxSize(double s); |
||
326 | void newTxScale(int s); |
||
327 | void newTxStyle(int s); |
||
328 | void newTxKern(double s); |
||
329 | void updateProps(int p, int ch); |
||
330 | void newAlign(int st); |
||
374 | Franz | 331 | void changeAlignSB(int pa, int align); |
124 | Franz | 332 | void updateStatus(); |
103 | Franz | 333 | void Do_leave(); |
351 | Franz | 334 | void Do_leave2(); |
295 | Franz | 335 | void Do_saveDocument(); |
351 | Franz | 336 | bool Do_new(); |
337 | void slotFileRevert(); |
||
338 | |||
352 | Franz | 339 | void Do_selectAll(); |
103 | Franz | 340 | void Do_copy(); |
341 | void Do_paste(); |
||
342 | void Do_cut(); |
||
343 | void Do_del(); |
||
253 | Franz | 344 | void Do_insSp(); |
357 | Franz | 345 | void Do_fontPrev(); |
113 | Franz | 346 | void CopyAvail(bool u); |
376 | Franz | 347 | void PasteAvail(); |
102 | Franz | 348 | void updateTextFrame(); |
189 | Franz | 349 | void SearchText(); |
112 | Franz | 350 | void slotEditStyles(); |
102 | Franz | 351 | void modifiedText(); |
162 | Franz | 352 | void LoadTextFile(); |
353 | void SaveTextFile(); |
||
445 | fschmid | 354 | // 10/12/2004 - pv - #1203: wrong selection on double click |
355 | void doubleClick(int para, int pos); |
||
462 | fschmid | 356 | void ToggleSmart(); |
102 | Franz | 357 | |
107 | Franz | 358 | signals: |
359 | void DocChanged(); |
||
112 | Franz | 360 | void EditSt(); |
107 | Franz | 361 | |
102 | Franz | 362 | protected: |
351 | Franz | 363 | QHBoxLayout* StoryEd2Layout; |
126 | Franz | 364 | QGridLayout* ButtonGroup1Layout; |
365 | QGridLayout* ButtonGroup2Layout; |
||
102 | Franz | 366 | |
367 | }; |
||
368 | |||
369 | #endif |
||
370 |