Scribus
Open source desktop publishing at your fingertips
canvasgesture_resize.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_GESTURE_RESIZE_H
19 #define CANVAS_GESTURE_RESIZE_H
20 
21 #include <QRect>
22 
23 #include "scribusapi.h"
24 #include "canvas.h"
25 #include "canvasgesture.h"
26 #include "canvasmode.h"
27 #include "undotransaction.h"
28 
29 class QDragEnterEvent;
30 class QDragMoveEvent;
31 class QDragLeaveEvent;
32 class QDropEvent;
33 class QEvent;
34 class QInputMethodEvent;
35 class QMouseEvent;
36 class QKeyEvent;
37 class QPainter;
38 class QRubberBand;
39 class PageItem;
40 
47 class SCRIBUS_API ResizeGesture : public CanvasGesture
48 {
49 public:
50  explicit ResizeGesture (CanvasMode* parent);
51  virtual ~ResizeGesture() {}
52 
56  void prepare(Canvas::FrameHandle framehandle = Canvas::SOUTHEAST);
57  void clear();
58 
59  virtual void drawControls(QPainter* p);
60  virtual void activate(bool);
61  virtual void deactivate(bool);
62  virtual void mouseReleaseEvent(QMouseEvent *m);
63  virtual void mouseMoveEvent(QMouseEvent *m);
69  virtual void mousePressEvent(QMouseEvent *m);
70 
71  Canvas::FrameHandle frameHandle() const { return m_handle; }
72 
73 private:
74  void adjustBounds(QMouseEvent *m);
75  void doResize(bool scaleContent);
76  Canvas::FrameHandle m_handle;
77  double m_rotation;
78  double m_origRatio;
79  QPoint m_mousePressPoint;
80  QRectF m_bounds;
81  QRectF m_origBounds;
82  QRectF m_mousePressBounds;
83  UndoTransaction m_transaction;
84  double m_extraWidth;
85  double m_extraHeight;
86  double m_extraX;
87  double m_extraY;
88 };
89 
90 
91 #endif
Definition: undotransaction.h:45
Definition: canvasgesture_resize.h:47
virtual void deactivate(bool forGesture)
Definition: canvasmode.h:91
virtual void drawControls(QPainter *p)
Definition: canvasmode.h:121
Definition: canvasmode.h:72
Definition: canvasgesture.h:47
Definition: pageitem.h:92
virtual void activate(bool fromGesture)
Definition: canvasmode.h:86