Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • 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 ~ToolManager() override;
35
36 bool init() override;
37 Status load(Object*) override;
38 Status save(Object*) override;
39
40 BaseTool* currentTool() const;
41 BaseTool* getTool(ToolType eToolType);
42 void setDefaultTool();
43 void setCurrentTool(ToolType eToolType);
44 void tabletSwitchToEraser();
45 void tabletRestorePrevTool();
46 bool setTemporaryTool(ToolType eToolType, QFlags<Qt::Key> keys, Qt::KeyboardModifiers modifiers);
47 bool setTemporaryTool(ToolType eToolType, Qt::MouseButtons buttons);
48 bool tryClearTemporaryTool(Qt::Key key);
49 bool tryClearTemporaryTool(Qt::MouseButton button);
50 void clearTemporaryTool();
51 void cleanupAllToolsData();
52 bool leavingThisTool();
53
54 int propertySwitch(bool condition, int property);
55
56signals:
57 void toolChanged(ToolType);
58 void toolPropertyChanged(ToolType, ToolPropertyType);
59
60public slots:
61 void resetAllTools();
62
63 void setWidth(float);
64 void setFeather(float);
65
66 void setUseFeather(bool);
67 void setInvisibility(bool);
68 void setPreserveAlpha(bool);
69 void setVectorMergeEnabled(bool);
70 void setBezier(bool);
71 void setClosedPath(bool);
72 void setPressure(bool);
73 void setAA(int);
74 void setFillMode(int);
75 void setStabilizerLevel(int);
76 void setTolerance(int);
77 void setBucketColorToleranceEnabled(bool enabled);
78 void setBucketFillExpandEnabled(bool enabled);
79 void setBucketFillReferenceMode(int referenceMode);
80 void setBucketFillExpand(int);
81 void setUseFillContour(bool);
82 void setShowSelectionInfo(bool b);
83 void setShowCameraPath(bool);
84 void resetCameraPath();
85 void setCameraPathDotColor(int);
86 void resetCameraTransform(CameraFieldOption option);
87
90 bool bucketReferenceModeIsCurrentLayer(int referenceMode) const;
91
92private:
93 void setTemporaryTool(ToolType eToolType);
94
95 BaseTool* mCurrentTool = nullptr;
96 BaseTool* mTabletEraserTool = nullptr;
97 BaseTool* mTemporaryTool = nullptr;
98 Qt::KeyboardModifiers mTemporaryTriggerModifiers = Qt::NoModifier;
99 QFlags<Qt::Key> mTemporaryTriggerKeys;
100 Qt::MouseButtons mTemporaryTriggerMouseButtons = Qt::NoButton;
101
102 QHash<ToolType, BaseTool*> mToolSetHash;
103
104 int mOldValue = 0;
105
106};
107
108#endif // TOOLMANAGER_H
BaseManager
Definition: basemanager.h:29
BaseTool
Definition: basetool.h:70
Editor
Definition: editor.h:71
Object
Definition: object.h:42
ScribbleArea
Definition: scribblearea.h:51
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:314
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 Thu Jun 5 2025 14:06:43 for Pencil2D by doxygen 1.9.6 based on revision 4c63407997b2c03e5048716586dec6fbbb755173