All Classes Namespaces Functions Variables Enumerations Properties Pages
movetool.h
1 /*
2 
3 Pencil2D - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2012-2020 Matthew Chiawen Chang
6 
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; version 2 of the License.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 */
17 
18 #ifndef MOVETOOL_H
19 #define MOVETOOL_H
20 
21 #include "basetool.h"
22 #include "movemode.h"
23 #include "preferencemanager.h"
24 
25 class Layer;
26 class VectorImage;
27 
28 
29 class MoveTool : public BaseTool
30 {
31  Q_OBJECT
32 public:
33  explicit MoveTool(QObject* parent);
34  ToolType type() override;
35  void loadSettings() override;
36  QCursor cursor() override;
37 
38  void pointerPressEvent(PointerEvent*) override;
39  void pointerReleaseEvent(PointerEvent*) override;
40  void pointerMoveEvent(PointerEvent*) override;
41 
42  bool leavingThisTool() override;
43  bool switchingLayer() override;
44 
45  void resetToDefault() override;
46  void setShowSelectionInfo(const bool b) override;
47 
48 private:
49  void cancelChanges();
50  void applyTransformation();
51  void applySelectionChanges();
52  void paintTransformedSelection();
53  void setAnchorToLastPoint();
54  void updateTransformation();
55  void updateSettings(const SETTING setting);
56 
57  int showTransformWarning();
58 
59  void beginInteraction(Qt::KeyboardModifiers keyMod, Layer* layer);
61  void transformSelection(Qt::KeyboardModifiers keyMod, Layer* layer);
62  void storeClosestVectorCurve(Layer* layer);
63 
64  void setCurveSelected(VectorImage* vectorImage, Qt::KeyboardModifiers keyMod);
65  void setAreaSelected(VectorImage* vectorImage, Qt::KeyboardModifiers keyMod);
66 
67  QPointF offsetFromPressPos();
68 
69  Layer* currentPaintableLayer();
70 
71  QPointF anchorOriginPoint;
72  Layer* mCurrentLayer = nullptr;
73  qreal mRotatedAngle = 0.0;
74  int mRotationIncrement = 0;
75  MoveMode mPerspMode;
76 };
77 
78 #endif
typedef KeyboardModifiers
Q_OBJECTQ_OBJECT
Definition: layer.h:38
void createVectorSelection(Qt::KeyboardModifiers keyMod, Layer *layer)
MoveTool::createVectorSelection In vector the selection rectangle is based on the bounding box of the...
Definition: movetool.cpp:268
void storeClosestVectorCurve(Layer *layer)
MoveTool::storeClosestVectorCurve stores the curves closest to the mouse position in mClosestCurves...
Definition: movetool.cpp:318
QObject * parent() const const