Scribus
Open source desktop publishing at your fingertips
canvasmode_create.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 
17 
18 #ifndef CANVAS_MODE_CREATE_H
19 #define CANVAS_MODE_CREATE_H
20 
21 #include "canvasmode.h"
22 #include "fpointarray.h"
23 #include "text/frect.h"
24 #include "undotransaction.h"
25 
26 class PageItem;
27 class ScribusMainWindow;
28 class ScribusView;
29 
33 class CreateMode : public CanvasMode
34 {
35  Q_OBJECT
36 
37 public:
38  explicit CreateMode(ScribusView* view);
39  virtual ~CreateMode() {}
40 
41  virtual void enterEvent(QEvent *);
42  virtual void leaveEvent(QEvent *);
43 
44  virtual void activate(bool);
45  virtual void deactivate(bool);
46  virtual void mouseDoubleClickEvent(QMouseEvent *m);
47  virtual void mouseReleaseEvent(QMouseEvent *m);
48  virtual void mouseMoveEvent(QMouseEvent *m);
49  virtual void mousePressEvent(QMouseEvent *m);
50  virtual void drawControls(QPainter* p);
51 
52 // protected:
53 // void setResizeCursor(int);
54 
55 private:
56  inline bool GetItem(PageItem** pi);
57  void selectPage(QMouseEvent *m);
58  void SetupDrawNoResize(int nr);
59 
60  PageItem* doCreateNewObject(void);
61  bool doOneClick(FPoint& startPoint, FPoint& endPoint);
62 
63  // We do not use PageItem::ItemType and PageItem::FrameType here
64  // for the pure sake of not including pageitem.h
65  void getFrameItemTypes(int& itemType, int& frameType);
66 
75  FRect adjustedRect(FPoint &firstPoint, FPoint &secondPoint);
76 
77  bool inItemCreation;
78  bool m_MouseButtonPressed;
79  FPoint mouseGlobalCoord;
80  FPoint canvasPressCoord;
81  FPoint canvasCurrCoord;
82  FPoint createObjectPos;
83  int createObjectMode;
84  int createObjectSubMode;
85  Qt::KeyboardModifiers modifiers;
86  UndoTransaction m_createTransaction;
87 };
88 
89 
90 #endif
Definition: undotransaction.h:45
virtual void drawControls(QPainter *p)
Definition: canvasmode_create.cpp:78
Definition: canvasmode_create.h:33
This Class is the base class for your application. It sets up the main window and providing a menubar...
Definition: scribus.h:123
virtual void deactivate(bool)
Definition: canvasmode_create.cpp:220
A point with floating point precision.
Definition: fpoint.h:43
virtual void activate(bool)
Definition: canvasmode_create.cpp:201
Definition: canvasmode.h:72
Definition: pageitem.h:92
The FRect class defines a rectangle in the plane.
Definition: frect.h:50
Definition: scribusview.h:87