Scribus
Open source desktop publishing at your fingertips
canvasmode_editmeshpatch.h
1 /*
2  For general Scribus (>=1.3.2) copyright and licensing information please refer
3  to the COPYING file provided with the program. Following this notice may exist
4  a copyright and/or license notice that predates the release of Scribus 1.3.2
5  for which a new license (GPL+exception) is in place.
6  */
7 /***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15 /***************************************************************************
16  canvasmode_editmeshpatch.h - description
17  -------------------
18  begin : Sun Sep 25 2011
19  copyright : (C) 2011 by Franz Schmid
20  email : Franz.Schmid@altmuehlnet.de
21  ***************************************************************************/
22 
23 #ifndef CANVASMODE_EDITMESHPATCH_H
24 #define CANVASMODE_EDITMESHPATCH_H
25 
26 #include <QObject>
27 #include <QTime>
28 #include <QPolygonF>
29 
30 #include "canvasmode.h"
31 #include "fpointarray.h"
32 
33 class meshPoint;
34 class PageItem;
35 class PageItem_TextFrame;
36 class ScribusMainWindow;
37 class ScribusView;
38 
39 
40 // This class encapsulate the old code for mouse interaction from scribusview.cpp
41 
43 {
44 public:
45  explicit CanvasMode_EditMeshPatch(ScribusView* view);
46  virtual ~CanvasMode_EditMeshPatch();
47 
48  virtual void enterEvent(QEvent *);
49  virtual void leaveEvent(QEvent *);
50 
51  virtual void activate(bool);
52  virtual void deactivate(bool);
53  virtual void mouseDoubleClickEvent(QMouseEvent *m);
54  virtual void mouseReleaseEvent(QMouseEvent *m);
55  virtual void mouseMoveEvent(QMouseEvent *m);
56  virtual void mousePressEvent(QMouseEvent *m);
57  virtual void keyPressEvent(QKeyEvent *e);
58  virtual bool handleKeyEvents() { return true; }
59  virtual void drawControls(QPainter* p);
60  void drawControlsMeshPoint(QPainter* psx, meshPoint mp, bool isSelected);
61  void drawControlsMeshPatch(QPainter* pp, PageItem* currItem);
62 
63 private:
64  void snapToOtherPatch(double &x, double &y);
65  typedef enum
66  {
67  noPointDefined,
68  useTL,
69  useTR,
70  useBR,
71  useBL
72  } eMPatchPoint;
73 
74  typedef enum
75  {
76  noControlPointDefined,
77  useControlT,
78  useControlB,
79  useControlL,
80  useControlR,
81  useControlC
82  } eMGradientPoint;
83 
84  inline bool GetItem(PageItem** pi);
85 
86  meshPoint* old_mesh;
87  double Mxp, Myp;
88  ScribusMainWindow* m_ScMW;
89  eMPatchPoint m_patchPoint;
90  eMGradientPoint m_gradientPoint;
91  bool m_keyRepeat;
92  int m_click_count;
93  QPolygonF m_clickPointPolygon;
94  QPointF m_currentPoint;
95  PageItem *currItem;
96 };
97 
98 #endif
Definition: canvasmode_editmeshpatch.h:42
virtual void activate(bool)
Definition: canvasmode_editmeshpatch.cpp:291
virtual void drawControls(QPainter *p)
Definition: canvasmode_editmeshpatch.cpp:86
Definition: pageitem_textframe.h:45
This Class is the base class for your application. It sets up the main window and providing a menubar...
Definition: scribus.h:123
Definition: mesh.h:33
Definition: canvasmode.h:72
virtual void deactivate(bool)
Definition: canvasmode_editmeshpatch.cpp:312
Definition: pageitem.h:92
Definition: scribusview.h:87