Rev 456 | Rev 705 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3 | paul | 1 | /*************************************************************************** |
2 | scribusview.h - description |
||
3 | ------------------- |
||
4 | begin : Fre Apr 6 21:47:55 CEST 2001 |
||
5 | copyright : (C) 2001 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 SCRIBUSVIEW_H |
||
19 | #define SCRIBUSVIEW_H |
||
20 | |||
330 | Franz | 21 | #include <vector> |
3 | paul | 22 | // include files for QT |
23 | #include <qscrollview.h> |
||
24 | #include <qptrlist.h> |
||
25 | #include <qlineedit.h> |
||
26 | #include <qscrollbar.h> |
||
27 | #include <qpushbutton.h> |
||
28 | #include <qpopupmenu.h> |
||
29 | #include <qlabel.h> |
||
30 | #include <qtoolbutton.h> |
||
31 | #include <qprogressdialog.h> |
||
160 | Franz | 32 | #include <qspinbox.h> |
3 | paul | 33 | // application specific includes |
34 | #include "scribusdoc.h" |
||
456 | fschmid | 35 | #include "scpainter.h" |
3 | paul | 36 | #include "page.h" |
37 | #include "hruler.h" |
||
38 | #include "vruler.h" |
||
68 | Franz | 39 | #include "mspinbox.h" |
199 | Franz | 40 | #include "pageselector.h" |
41 | |||
3 | paul | 42 | extern QPixmap loadIcon(QString nam); |
43 | |||
44 | /** |
||
45 | * This class provides an incomplete base for your application view. |
||
46 | */ |
||
47 | |||
48 | class ScribusView : public QScrollView |
||
49 | { |
||
168 | Franz | 50 | Q_OBJECT |
51 | |||
52 | public: |
||
3 | paul | 53 | ScribusView(QWidget *parent=0, ScribusDoc *doc=0, preV *prefs=0); |
54 | ~ScribusView() {}; |
||
55 | /** Vergroesserungseingabefeld */ |
||
68 | Franz | 56 | MSpinBox* LE; |
199 | Franz | 57 | PageSelector* PGS; |
168 | Franz | 58 | QToolButton *UN; |
59 | Hruler *HR; |
||
60 | Vruler *VR; |
||
456 | fschmid | 61 | /** Dokument zu dem die Seite gehoert */ |
62 | ScribusDoc *Doc; |
||
63 | preV *Prefs; |
||
64 | double Scale; |
||
65 | double OldScale; |
||
66 | double GroupX; |
||
67 | double GroupY; |
||
68 | double GroupW; |
||
69 | double GroupH; |
||
70 | double oldW; |
||
71 | int oldCp; |
||
72 | int Mxp; |
||
73 | int Myp; |
||
74 | int Dxp; |
||
75 | int Dyp; |
||
76 | int HowTo; |
||
77 | int SeRx; |
||
78 | int SeRy; |
||
79 | int GyM; |
||
80 | int GxM; |
||
81 | int ClRe; |
||
82 | int ClRe2; |
||
83 | int SegP1; |
||
84 | int SegP2; |
||
85 | int RotMode; |
||
86 | int DrHY; |
||
87 | int DrVX; |
||
88 | bool EdPoints; |
||
89 | bool Mpressed; |
||
90 | bool Imoved; |
||
91 | bool MoveGY; |
||
92 | bool MoveGX; |
||
93 | bool HaveSelRect; |
||
94 | bool mCG; |
||
95 | bool EditContour; |
||
96 | bool GroupSel; |
||
97 | bool DraggedGroup; |
||
98 | bool DraggedGroupFirst; |
||
99 | bool HanMove; |
||
100 | bool MidButt; |
||
101 | bool updateOn; |
||
102 | bool FirstPoly; |
||
103 | bool Magnify; |
||
104 | bool MoveSym; |
||
105 | bool CursVis; |
||
106 | FPoint RCenter; |
||
107 | FPointArray RecordP; |
||
108 | void DrawMasterItems(ScPainter *painter, Page *page, QRect clip); |
||
109 | void DrawPageItems(ScPainter *painter, QRect clip); |
||
110 | void DrawPageMarks(ScPainter *p, Page* page, QRect clip); |
||
168 | Franz | 111 | Page* addPage(int nr); |
456 | fschmid | 112 | QPtrList<PageItem> SelItem; |
113 | QValueList<int> SelNode; |
||
114 | /** Deletes a Page */ |
||
168 | Franz | 115 | void delPage(int Nr); |
3 | paul | 116 | /** verschiebt Seiten */ |
168 | Franz | 117 | void movePage(int from, int to, int ziel, int art); |
118 | void reformPages(); |
||
3 | paul | 119 | void LaMenu(); |
168 | Franz | 120 | void ShowTemplate(int nr); |
121 | void HideTemplate(); |
||
122 | int CountElements(); |
||
123 | QPixmap PageToPixmap(int Nr, int maxGr); |
||
3 | paul | 124 | QPixmap MPageToPixmap(QString name, int maxGr); |
168 | Franz | 125 | void RecalcPictures(ProfilesL *Pr, QProgressBar *dia = 0); |
456 | fschmid | 126 | void FromHRuler(QMouseEvent *m); |
127 | void FromVRuler(QMouseEvent *m); |
||
128 | void SetYGuide(QMouseEvent *m); |
||
129 | void SetXGuide(QMouseEvent *m); |
||
130 | bool ApplyGuides(double *x, double *y); |
||
131 | void SnapToGuides(PageItem* b); |
||
132 | QPoint ApplyGrid(QPoint in); |
||
133 | FPoint ApplyGridF(FPoint in); |
||
134 | FPoint transformPointI(FPoint in, double dx, double dy, double rot, double sx, double sy); |
||
135 | FPoint transformPoint(FPoint in, double dx, double dy, double rot, double sx, double sy); |
||
136 | void getBoundingRect(PageItem *b, double *x1, double *y1, double *x2, double *y2); |
||
137 | QRect getRedrawBounding(PageItem* b); |
||
138 | void setRedrawBounding(PageItem* b); |
||
139 | void setGroupRect(); |
||
140 | void getGroupRect(double *x, double *y, double *w, double *h); |
||
141 | void getGroupRectScreen(double *x, double *y, double *w, double *h); |
||
142 | void paintGroupRect(bool norm = true); |
||
143 | void PaintSizeRect(QPainter *p, QRect neu); |
||
144 | void ToView(QPainter *p); |
||
145 | void RefreshItem(PageItem *b); |
||
146 | bool MoveItem(double newX, double newY, PageItem* ite, bool fromMP = false); |
||
147 | void MoveItemI(double newX, double newY, int ite); |
||
148 | void UpdateClip(PageItem* b); |
||
631 | fschmid | 149 | void SetPolyClip(PageItem *b, int up); |
456 | fschmid | 150 | void ConvertClip(PageItem *b); |
151 | void UpdatePolyClip(PageItem *b); |
||
152 | void MarkClip(PageItem *b); |
||
153 | bool PointOnLine(QPoint Start, QPoint Ende, QRect MArea); |
||
154 | void MirrorPolyH(); |
||
155 | void MirrorPolyV(); |
||
156 | void TransformPoly(int mode, int rot = 1, int scaling = 1); |
||
157 | void Reset1Control(); |
||
158 | void ResetControl(); |
||
159 | void MoveClipPoint(PageItem *b, FPoint np); |
||
160 | bool SizeItem(double newX, double newY, int ite, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true); |
||
161 | void moveGroup(double x, double y, bool fromMP = false); |
||
162 | void MoveRotated(PageItem *b, FPoint npv, bool fromMP = false); |
||
163 | bool MoveSizeItem(FPoint newX, FPoint newY, int ite, bool fromMP = false); |
||
164 | void RotateGroup(double win); |
||
165 | void scaleGroup(double scx, double scy); |
||
166 | void RotateItem(double win, int ite); |
||
167 | void AdjustItemSize(PageItem *b); |
||
168 | FPoint GetMinClipF(FPointArray Clip); |
||
169 | void AdvanceSel(PageItem *b, int oldPos, int len, int dir, int expandSel, int state); |
||
170 | void setNewPos(PageItem *b, int oldPos, int len, int dir); |
||
171 | void ExpandSel(PageItem *b, int dir, int oldPos); |
||
172 | void deselectAll(PageItem *b); |
||
173 | bool slotSetCurs(int x, int y); |
||
174 | void slotDoCurs(bool draw); |
||
175 | void HandleCurs(QPainter *p, PageItem *b, QRect mpo); |
||
176 | void HandleSizer(QPainter *p, PageItem *b, QRect mpo); |
||
177 | void storeUndoInf(PageItem* b); |
||
178 | bool GetItem(PageItem **b, int nr = -1); |
||
179 | void Deselect(bool prop = true); |
||
180 | int OnPage(double x2, double y2); |
||
181 | int OnPage(PageItem *b); |
||
182 | void GroupOnPage(PageItem* b); |
||
183 | void SelectItemNr(int nr, bool draw = true); |
||
184 | bool SeleItem(QMouseEvent *m); |
||
185 | void SetupDraw(int Nr); |
||
186 | void updateGradientVectors(PageItem *b); |
||
187 | void EmitValues(PageItem *b); |
||
188 | void Transform(PageItem *b, QPainter *p); |
||
189 | void TransformM(PageItem *b, QPainter *p); |
||
190 | void SetFrameShape(PageItem *b, int count, double *vals); |
||
191 | void SetRectFrame(PageItem *b); |
||
192 | void SetOvalFrame(PageItem *b); |
||
193 | void SetFrameRound(PageItem *b); |
||
194 | void SetFrameRect(); |
||
195 | void SetFrameRounded(); |
||
196 | void SetFrameOval(); |
||
197 | int PaintEllipse(double x, double y, double b, double h, double w, QString fill, QString outline); |
||
198 | int PaintPict(double x, double y, double b, double h); |
||
199 | int PaintRect(double x, double y, double b, double h, double w, QString fill, QString outline); |
||
200 | int PaintLine(double x, double y, double b, double h, double w, QString outline); |
||
201 | int PaintText(double x, double y, double b, double h, double w, QString outline); |
||
202 | int PaintPoly(double x, double y, double b, double h, double w, QString fill, QString outline); |
||
203 | int PaintPolyLine(double x, double y, double b, double h, double w, QString fill, QString outline); |
||
204 | void insertColor(QString nam, double c, double m, double y, double k); |
||
205 | void ChLineWidth(double w); |
||
206 | void ChLineArt(PenStyle w); |
||
207 | void ChLineJoin(PenJoinStyle w); |
||
208 | void ChLineEnd(PenCapStyle w); |
||
209 | void ChLineSpa(double w); |
||
210 | void ChLocalXY(double x, double y); |
||
211 | void ChLocalSc(double x, double y); |
||
212 | void ItemFont(QString fon); |
||
213 | void ItemPen(QString farbe); |
||
214 | void ItemTextBrush(QString farbe); |
||
215 | void ItemTextBrushS(int sha); |
||
216 | void ItemTextPen(QString farbe); |
||
217 | void ItemTextPenS(int sha); |
||
218 | void ItemTextScale(int sha); |
||
219 | void ItemBrush(QString farbe); |
||
220 | void ItemBrushShade(int sha); |
||
221 | void ItemPenShade(int sha); |
||
222 | void ItemGradFill(int typ); |
||
223 | void chTyStyle(int s); |
||
224 | void SetAbStyle(int s); |
||
225 | void chAbStyle(PageItem *b, int s); |
||
226 | void chKerning(double us); |
||
227 | void chFSize(int size); |
||
228 | void FlipImageH(); |
||
229 | void FlipImageV(); |
||
230 | void LoadPict(QString fn, int ItNr); |
||
231 | void AdjustPreview(PageItem *b, bool reload = true); |
||
232 | void AdjustPictScale(PageItem *b, bool reload = true); |
||
233 | void PasteItem(struct CLBuf *Buffer, bool loading, bool drag = false); |
||
234 | void BuildAObj(); |
||
235 | void doAlign(QValueList<uint> &Object, int moveCode, double xp, double xdisp, double ydisp, double minx = 0.0); |
||
236 | void AlignObj(bool xa, bool ya, bool Vth, bool Vtv, double xdisp, double ydisp, int xart, int yart); |
||
237 | struct AlignObjs { int ObjNr; |
||
238 | int Group; |
||
239 | double x1; |
||
240 | double y1; |
||
241 | double x2; |
||
242 | double y2; |
||
243 | QPtrList<PageItem> Objects; |
||
244 | }; |
||
245 | QValueList<AlignObjs> AObjects; |
||
246 | void QueryFarben(); |
||
247 | void ToPathText(); |
||
248 | void FromPathText(); |
||
249 | void UniteObj(); |
||
250 | void SplitObj(); |
||
238 | Franz | 251 | void rememberPreviousSettings(int mx=0, int my=0); |
3 | paul | 252 | |
253 | public slots: // Public slots |
||
168 | Franz | 254 | /** Fhrt die Vergr�erung/Verkleinerung aus; */ |
255 | void slotDoZoom(); |
||
256 | /** Vergr�ert die Ansicht */ |
||
238 | Franz | 257 | void slotZoomIn(int mx=0,int my=0); |
3 | paul | 258 | /** Verkleinert die Ansicht */ |
238 | Franz | 259 | void slotZoomOut(int mx=0,int my=0); |
168 | Franz | 260 | /** Vergr�ert die Ansicht */ |
238 | Franz | 261 | void slotZoomIn2(int mx=0,int my=0); |
3 | paul | 262 | /** Verkleinert die Ansicht */ |
238 | Franz | 263 | void slotZoomOut2(int mx=0,int my=0); |
456 | fschmid | 264 | /** Redraws everything */ |
168 | Franz | 265 | void DrawNew(); |
266 | void setMenTxt(int Seite); |
||
3 | paul | 267 | void setLayMenTxt(int l); |
168 | Franz | 268 | void GotoPa(int Seite); |
3 | paul | 269 | void GotoLa(int l); |
168 | Franz | 270 | void GotoPage(int Seite); |
271 | void ChgUnit(int art); |
||
272 | void SetCPo(int x, int y); |
||
3 | paul | 273 | void SetCCPo(int x, int y); |
456 | fschmid | 274 | void TogglePic(); |
275 | void UpdatePic(); |
||
276 | void FrameToPic(); |
||
277 | void GimpExited(); |
||
278 | void CallGimp(); |
||
279 | void ToggleBookmark(); |
||
280 | void ToggleAnnotation(); |
||
281 | void ToggleLock(); |
||
282 | void ToggleResize(); |
||
283 | void sentToScrap(); |
||
284 | void sentToLayer(int id); |
||
285 | void LoremIpsum(); |
||
286 | void ToBack(); |
||
287 | void ToFront(); |
||
288 | void LowerItem(); |
||
289 | void RaiseItem(); |
||
290 | void ToPicFrame(); |
||
291 | void ToPolyFrame(); |
||
292 | void ToTextFrame(); |
||
293 | void ToBezierFrame(); |
||
294 | void Bezier2Poly(); |
||
295 | void ClearItem(); |
||
296 | void DeleteItem(); |
||
297 | void PasteToPage(); |
||
298 | void TextToPath(); |
||
299 | void BlinkCurs(); |
||
168 | Franz | 300 | |
3 | paul | 301 | private: // Private attributes |
168 | Franz | 302 | QPushButton *SB1; |
303 | QPushButton *SB2; |
||
304 | QPushButton *LY; |
||
305 | QPopupMenu *Unitmen; |
||
3 | paul | 306 | QPopupMenu *Laymen; |
456 | fschmid | 307 | QPopupMenu *pmen3; |
168 | Franz | 308 | bool Ready; |
238 | Franz | 309 | int oldX; |
310 | int oldY; |
||
168 | Franz | 311 | |
3 | paul | 312 | private slots: |
168 | Franz | 313 | void Zval(); |
314 | void setRulerPos(int x, int y); |
||
315 | |||
3 | paul | 316 | protected: // Protected methods |
456 | fschmid | 317 | virtual void drawContents(QPainter *p, int clipx, int clipy, int clipw, int cliph); |
318 | virtual void leaveEvent(QEvent *); |
||
319 | virtual void contentsDragEnterEvent(QDragEnterEvent *e); |
||
320 | virtual void contentsDragMoveEvent(QDragMoveEvent *e); |
||
321 | virtual void contentsDragLeaveEvent(QDragLeaveEvent *e); |
||
322 | virtual void contentsDropEvent(QDropEvent *e); |
||
323 | virtual void contentsMouseDoubleClickEvent(QMouseEvent *m); |
||
324 | virtual void contentsMouseReleaseEvent(QMouseEvent *m); |
||
325 | virtual void contentsMouseMoveEvent(QMouseEvent *m); |
||
326 | virtual void contentsMousePressEvent(QMouseEvent *m); |
||
3 | paul | 327 | virtual void contentsWheelEvent ( QWheelEvent *ev ); |
328 | virtual void setHBarGeometry(QScrollBar &bar, int x, int y, int w, int h); |
||
329 | virtual void setVBarGeometry(QScrollBar &bar, int x, int y, int w, int h); |
||
168 | Franz | 330 | |
3 | paul | 331 | signals: |
332 | void changeUN(int); |
||
333 | void changeLA(int); |
||
456 | fschmid | 334 | void ItemPos(double, double); |
335 | void HaveSel(int); |
||
336 | void ItemGeom(double, double); |
||
337 | void DocChanged(); |
||
338 | void PolyOpen(); |
||
339 | void PStatus(int, uint); |
||
340 | void UndoAvail(); |
||
341 | void SetAngle(double); |
||
342 | void SetSizeValue(double); |
||
343 | void SetLineArt(PenStyle, PenCapStyle, PenJoinStyle); |
||
344 | void SetLocalValues(double, double, double, double); |
||
345 | void ItemFarben(QString, QString, int, int); |
||
346 | void ItemGradient(int); |
||
347 | void ItemTrans(double, double); |
||
348 | void ItemTextAttr(double); |
||
349 | void ItemTextUSval(double); |
||
350 | void ItemTextCols(int, double); |
||
351 | void SetDistValues(double, double, double, double); |
||
352 | void ItemTextAbs(int); |
||
353 | void ItemTextFont(QString); |
||
354 | void ItemTextSize(int); |
||
355 | void ItemTextSca(int); |
||
356 | void ItemTextFarben(QString, QString, int, int); |
||
357 | void ItemTextStil(int); |
||
358 | void UpdtObj(uint, uint); |
||
359 | void ItemRadius(double); |
||
360 | void HasTextSel(); |
||
361 | void HasNoTextSel(); |
||
362 | void MVals(double, double, double, double, double, double, int); |
||
363 | void PaintingDone(); |
||
364 | void LoadPic(); |
||
365 | void AppendText(); |
||
366 | void EditText(); |
||
367 | void DoGroup(); |
||
368 | void DoUnGroup(); |
||
369 | void CutItem(); |
||
370 | void CopyItem(); |
||
371 | void Amode(int); |
||
372 | void AddBM(PageItem *); |
||
373 | void DelBM(PageItem *); |
||
374 | void NewBMNr(int, int); |
||
375 | void ChBMText(PageItem *); |
||
376 | void ToScrap(QString); |
||
377 | void LoadElem(QString, int, int, bool, bool, ScribusDoc *, ScribusView *); |
||
378 | void LevelChanged(uint); |
||
379 | void RasterPic(bool); |
||
380 | void HavePoint(bool, bool); |
||
381 | void ClipPo(double, double); |
||
382 | void AnnotProps(); |
||
383 | void EndNodeEdit(); |
||
384 | void Hrule(int); |
||
385 | void Vrule(int); |
||
386 | void EditGuides(); |
||
387 | void MousePos(double, double); |
||
3 | paul | 388 | }; |
389 | #endif |