Pencil2D Animation
Download Community News Docs Contribute

core_lib/src/managers/toolmanager.h Source File

  • Main Page
  • Related Pages
  • Classes
  • Files
  •  
  • File List
Loading...
Searching...
No Matches
  • core_lib
  • src
  • managers
toolmanager.h
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5Copyright (C) 2012-2020 Matthew Chiawen Chang
6
7This program is free software; you can redistribute it and/or
8modify it under the terms of the GNU General Public License
9as published by the Free Software Foundation; version 2 of the License.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16*/
17
18#ifndef TOOLMANAGER_H
19#define TOOLMANAGER_H
20
21#include <QObject>
22#include <QHash>
23#include "basetool.h"
24#include "basemanager.h"
25#include "camerafieldoption.h"
26
27class ScribbleArea;
28
29class ToolManager : public BaseManager
30{
31 Q_OBJECT
32public:
33 explicit ToolManager(Editor* editor);
34
35 bool init() override;
36 Status load(Object*) override;
37 Status save(Object*) override;
38
39 BaseTool* currentTool() const;
40 BaseTool* getTool(ToolType eToolType);
41 void setDefaultTool();
42 void setCurrentTool(ToolType eToolType);
43 void tabletSwitchToEraser();
44 void tabletRestorePrevTool();
45 bool setTemporaryTool(ToolType eToolType, QFlags<Qt::Key> keys, Qt::KeyboardModifiers modifiers);
46 bool setTemporaryTool(ToolType eToolType, Qt::MouseButtons buttons);
47 bool tryClearTemporaryTool(Qt::Key key);
48 bool tryClearTemporaryTool(Qt::MouseButton button);
49 void clearTemporaryTool();
50 void cleanupAllToolsData();
51 bool leavingThisTool();
52
53 int propertySwitch(bool condition, int property);
54
55signals:
56 void penWidthValueChanged(float);
57 void penFeatherValueChanged(float);
58 void toleranceValueChanged(qreal);
59
60 void toolChanged(ToolType);
61 void toolPropertyChanged(ToolType, ToolPropertyType);
62
63public slots:
64 void resetAllTools();
65
66 void setWidth(float);
67 void setFeather(float);
68 void setUseFeather(bool);
69 void setInvisibility(bool);
70 void setPreserveAlpha(bool);
71 void setVectorMergeEnabled(bool);
72 void setBezier(bool);
73 void setPressure(bool);
74 void setAA(int);
75 void setFillMode(int);
76 void setStabilizerLevel(int);
77 void setTolerance(int);
78 void setBucketColorToleranceEnabled(bool enabled);
79 void setBucketFillExpandEnabled(bool enabled);
80 void setBucketFillToLayerMode(int layerMode);
81 void setBucketFillReferenceMode(int referenceMode);
82 void setBucketFillExpand(int);
83 void setUseFillContour(bool);
84 void setShowSelectionInfo(bool b);
85 void setShowCameraPath(bool);
86 void resetCameraPath();
87 void setCameraPathDotColor(int);
88 void resetCameraTransform(CameraFieldOption option);
89
92 bool bucketReferenceModeIsCurrentLayer(int referenceMode) const;
93
94private:
95 void setTemporaryTool(ToolType eToolType);
96
97 BaseTool* mCurrentTool = nullptr;
98 BaseTool* mTabletEraserTool = nullptr;
99 BaseTool* mTemporaryTool = nullptr;
100 Qt::KeyboardModifiers mTemporaryTriggerModifiers = Qt::NoModifier;
101 QFlags<Qt::Key> mTemporaryTriggerKeys;
102 Qt::MouseButtons mTemporaryTriggerMouseButtons = Qt::NoButton;
103
104 QHash<ToolType, BaseTool*> mToolSetHash;
105
106 int mOldValue = 0;
107
108};
109
110#endif // TOOLMANAGER_H
BaseManager
Definition: basemanager.h:29
BaseTool
Definition: basetool.h:70
Editor
Definition: editor.h:68
Object
Definition: object.h:42
ScribbleArea
Definition: scribblearea.h:52
Status
Definition: pencilerror.h:40
ToolManager
Definition: toolmanager.h:30
ToolManager::bucketReferenceModeIsCurrentLayer
bool bucketReferenceModeIsCurrentLayer(int referenceMode) const
Layer mode will be enforced by the the choice the reference mode selected.
Definition: toolmanager.cpp:309
QFlags
QHash
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QObject::property
QVariant property(const char *name) const const
Qt::Key
Key
Qt::KeyboardModifiers
typedef KeyboardModifiers
Qt::MouseButtons
typedef MouseButtons
Generated on Sun Sep 24 2023 19:39:34 for Pencil2D by doxygen 1.9.6 based on revision 1395c86cb17dafbb32de44cbabe1f4c58636468d