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 private:
46  void cancelChanges();
47  void applyTransformation();
48  void applySelectionChanges();
49  void paintTransformedSelection();
50  void setAnchorToLastPoint();
51  void updateTransformation();
52  void updateSettings(const SETTING setting);
53 
54  int showTransformWarning();
55 
56  void beginInteraction(Qt::KeyboardModifiers keyMod, Layer* layer);
58  void transformSelection(Qt::KeyboardModifiers keyMod, Layer* layer);
59  void storeClosestVectorCurve(Layer* layer);
60 
61  void setCurveSelected(VectorImage* vectorImage, Qt::KeyboardModifiers keyMod);
62  void setAreaSelected(VectorImage* vectorImage, Qt::KeyboardModifiers keyMod);
63 
64  QPointF offsetFromPressPos();
65 
66  Layer* currentPaintableLayer();
67 
68  QPointF anchorOriginPoint;
69  Layer* mCurrentLayer = nullptr;
70  qreal mRotatedAngle = 0.0;
71  int mRotationIncrement = 0;
72 };
73 
74 #endif
typedef KeyboardModifiers
Q_OBJECTQ_OBJECT
Definition: layer.h:39
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:226
void storeClosestVectorCurve(Layer *layer)
MoveTool::storeClosestVectorCurve stores the curves closest to the mouse position in mClosestCurves...
Definition: movetool.cpp:276
QObject * parent() const const