Rev 1206 | Rev 1221 | 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" |
838 | cbradney | 37 | class Hruler; |
38 | class Vruler; |
||
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: |
||
1065 | cbradney | 53 | ScribusView(QWidget *parent=0, ScribusDoc *doc=0, ApplicationPrefs *prefs=0); |
3 | paul | 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; |
||
1065 | cbradney | 63 | ApplicationPrefs *Prefs; |
456 | fschmid | 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; |
705 | fschmid | 113 | QPtrList<PageItem> linkedFramesToShow; |
456 | fschmid | 114 | QValueList<int> SelNode; |
971 | fschmid | 115 | struct AlignObjs |
116 | { |
||
117 | int ObjNr; |
||
118 | int Group; |
||
119 | double x1; |
||
120 | double y1; |
||
121 | double x2; |
||
122 | double y2; |
||
123 | QPtrList<PageItem> Objects; |
||
124 | }; |
||
125 | QValueList<AlignObjs> AObjects; |
||
126 | struct oldPageVar |
||
127 | { |
||
128 | uint newPg; |
||
129 | double oldXO; |
||
130 | double oldYO; |
||
131 | }; |
||
456 | fschmid | 132 | /** Deletes a Page */ |
168 | Franz | 133 | void delPage(int Nr); |
3 | paul | 134 | /** verschiebt Seiten */ |
168 | Franz | 135 | void movePage(int from, int to, int ziel, int art); |
136 | void reformPages(); |
||
3 | paul | 137 | void LaMenu(); |
168 | Franz | 138 | void ShowTemplate(int nr); |
139 | void HideTemplate(); |
||
140 | int CountElements(); |
||
141 | QPixmap PageToPixmap(int Nr, int maxGr); |
||
3 | paul | 142 | QPixmap MPageToPixmap(QString name, int maxGr); |
168 | Franz | 143 | void RecalcPictures(ProfilesL *Pr, QProgressBar *dia = 0); |
456 | fschmid | 144 | void FromHRuler(QMouseEvent *m); |
145 | void FromVRuler(QMouseEvent *m); |
||
1115 | tsoots | 146 | void SetYGuide(QMouseEvent *m, int oldIndex); |
147 | void SetXGuide(QMouseEvent *m, int oldIndex); |
||
456 | fschmid | 148 | bool ApplyGuides(double *x, double *y); |
149 | void SnapToGuides(PageItem* b); |
||
150 | QPoint ApplyGrid(QPoint in); |
||
151 | FPoint ApplyGridF(FPoint in); |
||
152 | FPoint transformPointI(FPoint in, double dx, double dy, double rot, double sx, double sy); |
||
153 | FPoint transformPoint(FPoint in, double dx, double dy, double rot, double sx, double sy); |
||
154 | void getBoundingRect(PageItem *b, double *x1, double *y1, double *x2, double *y2); |
||
155 | QRect getRedrawBounding(PageItem* b); |
||
156 | void setRedrawBounding(PageItem* b); |
||
157 | void setGroupRect(); |
||
158 | void getGroupRect(double *x, double *y, double *w, double *h); |
||
159 | void getGroupRectScreen(double *x, double *y, double *w, double *h); |
||
160 | void paintGroupRect(bool norm = true); |
||
161 | void PaintSizeRect(QPainter *p, QRect neu); |
||
162 | void ToView(QPainter *p); |
||
163 | void RefreshItem(PageItem *b); |
||
164 | bool MoveItem(double newX, double newY, PageItem* ite, bool fromMP = false); |
||
925 | fschmid | 165 | void MoveItemI(double newX, double newY, int ite, bool redraw = true); |
456 | fschmid | 166 | void UpdateClip(PageItem* b); |
631 | fschmid | 167 | void SetPolyClip(PageItem *b, int up); |
456 | fschmid | 168 | void ConvertClip(PageItem *b); |
169 | void UpdatePolyClip(PageItem *b); |
||
170 | void MarkClip(PageItem *b); |
||
171 | bool PointOnLine(QPoint Start, QPoint Ende, QRect MArea); |
||
172 | void MirrorPolyH(); |
||
173 | void MirrorPolyV(); |
||
174 | void TransformPoly(int mode, int rot = 1, int scaling = 1); |
||
175 | void Reset1Control(); |
||
176 | void ResetControl(); |
||
177 | void MoveClipPoint(PageItem *b, FPoint np); |
||
178 | bool SizeItem(double newX, double newY, int ite, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true); |
||
1206 | tsoots | 179 | bool SizeItem(double newX, double newY, PageItem *pi, bool fromMP, bool DoUpdateClip, bool redraw); |
456 | fschmid | 180 | void moveGroup(double x, double y, bool fromMP = false); |
181 | void MoveRotated(PageItem *b, FPoint npv, bool fromMP = false); |
||
182 | bool MoveSizeItem(FPoint newX, FPoint newY, int ite, bool fromMP = false); |
||
183 | void RotateGroup(double win); |
||
184 | void scaleGroup(double scx, double scy); |
||
185 | void RotateItem(double win, int ite); |
||
1211 | tsoots | 186 | void RotateItem(double win, PageItem *pi); |
456 | fschmid | 187 | void AdjustItemSize(PageItem *b); |
188 | void AdvanceSel(PageItem *b, int oldPos, int len, int dir, int expandSel, int state); |
||
189 | void setNewPos(PageItem *b, int oldPos, int len, int dir); |
||
190 | void ExpandSel(PageItem *b, int dir, int oldPos); |
||
191 | void deselectAll(PageItem *b); |
||
192 | bool slotSetCurs(int x, int y); |
||
193 | void slotDoCurs(bool draw); |
||
194 | void HandleCurs(QPainter *p, PageItem *b, QRect mpo); |
||
795 | fschmid | 195 | void HandleSizer(QPainter *p, PageItem *b, QRect mpo, QMouseEvent *m); |
456 | fschmid | 196 | void storeUndoInf(PageItem* b); |
197 | bool GetItem(PageItem **b, int nr = -1); |
||
198 | void Deselect(bool prop = true); |
||
199 | int OnPage(double x2, double y2); |
||
200 | int OnPage(PageItem *b); |
||
201 | void GroupOnPage(PageItem* b); |
||
202 | void SelectItemNr(int nr, bool draw = true); |
||
795 | fschmid | 203 | void selectPage(QMouseEvent *m); |
456 | fschmid | 204 | bool SeleItem(QMouseEvent *m); |
205 | void SetupDraw(int Nr); |
||
206 | void updateGradientVectors(PageItem *b); |
||
207 | void EmitValues(PageItem *b); |
||
208 | void Transform(PageItem *b, QPainter *p); |
||
209 | void TransformM(PageItem *b, QPainter *p); |
||
210 | void SetFrameShape(PageItem *b, int count, double *vals); |
||
211 | void SetRectFrame(PageItem *b); |
||
212 | void SetOvalFrame(PageItem *b); |
||
213 | void SetFrameRound(PageItem *b); |
||
214 | void SetFrameRect(); |
||
215 | void SetFrameRounded(); |
||
216 | void SetFrameOval(); |
||
217 | int PaintEllipse(double x, double y, double b, double h, double w, QString fill, QString outline); |
||
218 | int PaintPict(double x, double y, double b, double h); |
||
219 | int PaintRect(double x, double y, double b, double h, double w, QString fill, QString outline); |
||
220 | int PaintLine(double x, double y, double b, double h, double w, QString outline); |
||
221 | int PaintText(double x, double y, double b, double h, double w, QString outline); |
||
222 | int PaintPoly(double x, double y, double b, double h, double w, QString fill, QString outline); |
||
223 | int PaintPolyLine(double x, double y, double b, double h, double w, QString fill, QString outline); |
||
224 | void insertColor(QString nam, double c, double m, double y, double k); |
||
225 | void ChLineWidth(double w); |
||
226 | void ChLineArt(PenStyle w); |
||
227 | void ChLineJoin(PenJoinStyle w); |
||
228 | void ChLineEnd(PenCapStyle w); |
||
229 | void ChLineSpa(double w); |
||
230 | void ChLocalXY(double x, double y); |
||
231 | void ChLocalSc(double x, double y); |
||
232 | void ItemFont(QString fon); |
||
233 | void ItemPen(QString farbe); |
||
234 | void ItemTextBrush(QString farbe); |
||
235 | void ItemTextBrushS(int sha); |
||
236 | void ItemTextPen(QString farbe); |
||
237 | void ItemTextPenS(int sha); |
||
238 | void ItemTextScale(int sha); |
||
239 | void ItemBrush(QString farbe); |
||
240 | void ItemBrushShade(int sha); |
||
241 | void ItemPenShade(int sha); |
||
242 | void ItemGradFill(int typ); |
||
243 | void chTyStyle(int s); |
||
244 | void SetAbStyle(int s); |
||
245 | void chAbStyle(PageItem *b, int s); |
||
246 | void chKerning(double us); |
||
247 | void chFSize(int size); |
||
248 | void FlipImageH(); |
||
249 | void FlipImageV(); |
||
1151 | fschmid | 250 | void LoadPict(QString fn, int ItNr, bool reload = false); |
456 | fschmid | 251 | void AdjustPreview(PageItem *b, bool reload = true); |
252 | void AdjustPictScale(PageItem *b, bool reload = true); |
||
1065 | cbradney | 253 | void PasteItem(struct CopyPasteBuffer *Buffer, bool loading, bool drag = false); |
456 | fschmid | 254 | void BuildAObj(); |
255 | void doAlign(QValueList<uint> &Object, int moveCode, double xp, double xdisp, double ydisp, double minx = 0.0); |
||
256 | void AlignObj(bool xa, bool ya, bool Vth, bool Vtv, double xdisp, double ydisp, int xart, int yart); |
||
257 | void QueryFarben(); |
||
258 | void ToPathText(); |
||
259 | void FromPathText(); |
||
260 | void UniteObj(); |
||
261 | void SplitObj(); |
||
238 | Franz | 262 | void rememberPreviousSettings(int mx=0, int my=0); |
1211 | tsoots | 263 | bool mousePressed(); |
3 | paul | 264 | |
265 | public slots: // Public slots |
||
1151 | fschmid | 266 | /** Fhrt die Vergr�erung/Verkleinerung aus; */ |
168 | Franz | 267 | void slotDoZoom(); |
1151 | fschmid | 268 | /** Vergr�ert die Ansicht */ |
238 | Franz | 269 | void slotZoomIn(int mx=0,int my=0); |
3 | paul | 270 | /** Verkleinert die Ansicht */ |
238 | Franz | 271 | void slotZoomOut(int mx=0,int my=0); |
1151 | fschmid | 272 | /** Vergr�ert die Ansicht */ |
238 | Franz | 273 | void slotZoomIn2(int mx=0,int my=0); |
3 | paul | 274 | /** Verkleinert die Ansicht */ |
238 | Franz | 275 | void slotZoomOut2(int mx=0,int my=0); |
456 | fschmid | 276 | /** Redraws everything */ |
168 | Franz | 277 | void DrawNew(); |
278 | void setMenTxt(int Seite); |
||
3 | paul | 279 | void setLayMenTxt(int l); |
168 | Franz | 280 | void GotoPa(int Seite); |
3 | paul | 281 | void GotoLa(int l); |
168 | Franz | 282 | void GotoPage(int Seite); |
283 | void ChgUnit(int art); |
||
284 | void SetCPo(int x, int y); |
||
3 | paul | 285 | void SetCCPo(int x, int y); |
456 | fschmid | 286 | void TogglePic(); |
287 | void UpdatePic(); |
||
288 | void FrameToPic(); |
||
289 | void ToggleBookmark(); |
||
290 | void ToggleAnnotation(); |
||
291 | void ToggleLock(); |
||
292 | void ToggleResize(); |
||
293 | void sentToScrap(); |
||
294 | void sentToLayer(int id); |
||
295 | void LoremIpsum(); |
||
296 | void ToBack(); |
||
297 | void ToFront(); |
||
298 | void LowerItem(); |
||
299 | void RaiseItem(); |
||
300 | void ToPicFrame(); |
||
301 | void ToPolyFrame(); |
||
302 | void ToTextFrame(); |
||
303 | void ToBezierFrame(); |
||
304 | void Bezier2Poly(); |
||
305 | void ClearItem(); |
||
306 | void DeleteItem(); |
||
307 | void PasteToPage(); |
||
308 | void TextToPath(); |
||
309 | void BlinkCurs(); |
||
1155 | fschmid | 310 | void updatePict(QString name); |
311 | void removePict(QString name); |
||
168 | Franz | 312 | |
3 | paul | 313 | private: // Private attributes |
168 | Franz | 314 | QPushButton *SB1; |
315 | QPushButton *SB2; |
||
316 | QPushButton *LY; |
||
317 | QPopupMenu *Unitmen; |
||
3 | paul | 318 | QPopupMenu *Laymen; |
456 | fschmid | 319 | QPopupMenu *pmen3; |
168 | Franz | 320 | bool Ready; |
238 | Franz | 321 | int oldX; |
322 | int oldY; |
||
1211 | tsoots | 323 | bool _mousePressed; |
168 | Franz | 324 | |
3 | paul | 325 | private slots: |
168 | Franz | 326 | void Zval(); |
327 | void setRulerPos(int x, int y); |
||
328 | |||
3 | paul | 329 | protected: // Protected methods |
456 | fschmid | 330 | virtual void drawContents(QPainter *p, int clipx, int clipy, int clipw, int cliph); |
331 | virtual void leaveEvent(QEvent *); |
||
332 | virtual void contentsDragEnterEvent(QDragEnterEvent *e); |
||
333 | virtual void contentsDragMoveEvent(QDragMoveEvent *e); |
||
334 | virtual void contentsDragLeaveEvent(QDragLeaveEvent *e); |
||
335 | virtual void contentsDropEvent(QDropEvent *e); |
||
336 | virtual void contentsMouseDoubleClickEvent(QMouseEvent *m); |
||
337 | virtual void contentsMouseReleaseEvent(QMouseEvent *m); |
||
338 | virtual void contentsMouseMoveEvent(QMouseEvent *m); |
||
339 | virtual void contentsMousePressEvent(QMouseEvent *m); |
||
3 | paul | 340 | virtual void contentsWheelEvent ( QWheelEvent *ev ); |
341 | virtual void setHBarGeometry(QScrollBar &bar, int x, int y, int w, int h); |
||
342 | virtual void setVBarGeometry(QScrollBar &bar, int x, int y, int w, int h); |
||
1211 | tsoots | 343 | virtual void mousePressEvent(QMouseEvent *e); |
344 | virtual void mouseReleaseEvent(QMouseEvent *e); |
||
168 | Franz | 345 | |
3 | paul | 346 | signals: |
347 | void changeUN(int); |
||
348 | void changeLA(int); |
||
456 | fschmid | 349 | void ItemPos(double, double); |
350 | void HaveSel(int); |
||
351 | void ItemGeom(double, double); |
||
352 | void DocChanged(); |
||
353 | void PolyOpen(); |
||
354 | void PStatus(int, uint); |
||
355 | void UndoAvail(); |
||
356 | void SetAngle(double); |
||
357 | void SetSizeValue(double); |
||
358 | void SetLineArt(PenStyle, PenCapStyle, PenJoinStyle); |
||
359 | void SetLocalValues(double, double, double, double); |
||
360 | void ItemFarben(QString, QString, int, int); |
||
361 | void ItemGradient(int); |
||
362 | void ItemTrans(double, double); |
||
363 | void ItemTextAttr(double); |
||
364 | void ItemTextUSval(double); |
||
365 | void ItemTextCols(int, double); |
||
366 | void SetDistValues(double, double, double, double); |
||
367 | void ItemTextAbs(int); |
||
368 | void ItemTextFont(QString); |
||
369 | void ItemTextSize(int); |
||
370 | void ItemTextSca(int); |
||
371 | void ItemTextFarben(QString, QString, int, int); |
||
372 | void ItemTextStil(int); |
||
373 | void UpdtObj(uint, uint); |
||
374 | void ItemRadius(double); |
||
375 | void HasTextSel(); |
||
376 | void HasNoTextSel(); |
||
377 | void MVals(double, double, double, double, double, double, int); |
||
378 | void PaintingDone(); |
||
379 | void LoadPic(); |
||
380 | void AppendText(); |
||
381 | void EditText(); |
||
382 | void DoGroup(); |
||
383 | void DoUnGroup(); |
||
384 | void CutItem(); |
||
385 | void CopyItem(); |
||
386 | void Amode(int); |
||
387 | void AddBM(PageItem *); |
||
388 | void DelBM(PageItem *); |
||
389 | void NewBMNr(int, int); |
||
390 | void ChBMText(PageItem *); |
||
391 | void ToScrap(QString); |
||
392 | void LoadElem(QString, int, int, bool, bool, ScribusDoc *, ScribusView *); |
||
393 | void LevelChanged(uint); |
||
394 | void RasterPic(bool); |
||
395 | void HavePoint(bool, bool); |
||
396 | void ClipPo(double, double); |
||
397 | void AnnotProps(); |
||
398 | void EndNodeEdit(); |
||
399 | void Hrule(int); |
||
400 | void Vrule(int); |
||
401 | void EditGuides(); |
||
402 | void MousePos(double, double); |
||
1155 | fschmid | 403 | void callGimp(); |
3 | paul | 404 | }; |
405 | #endif |