Pencil2D  ff90c0872e88be3bf81c548cd60f01983012ec49
Pencil2D is an animation software for both bitmap and vector graphics. It is free, multi-platform, and open source.
 All Classes Functions
toolmanager.h
1 /*
2 
3 Pencil - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2012-2017 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 TOOLMANAGER_H
19 #define TOOLMANAGER_H
20 
21 #include <QObject>
22 #include <QHash>
23 #include "basetool.h"
24 #include "basemanager.h"
25 
26 class ScribbleArea;
27 
28 class ToolManager : public BaseManager
29 {
30  Q_OBJECT
31 public:
32  explicit ToolManager( QObject* parent );
33 
34  bool init() override;
35  Status load( Object* ) override;
36  Status save( Object* ) override;
37 
38  BaseTool* currentTool() { return mCurrentTool; }
39  BaseTool* getTool( ToolType eToolType );
40  void setDefaultTool();
41  void setCurrentTool( ToolType eToolType );
42  void cleanupAllToolsData();
43 
44  void tabletSwitchToEraser();
45  void tabletRestorePrevTool();
46  int propertySwitch( bool condition, int property );
47 
48 Q_SIGNALS:
49  void penWidthValueChanged( float );
50  void penFeatherValueChanged( float );
51  void toleranceValueChanged( qreal );
52 
53  void toolChanged( ToolType );
54  void toolPropertyChanged( ToolType, ToolPropertyType );
55 
56 public slots:
57  void resetAllTools();
58 
59  void noInpolSelected() { setInpolLevel( 0 ); }
60  void SimplepolSelected() { setInpolLevel( 1 ); }
61  void StrongpolSelected() { setInpolLevel( 2 ); }
62  void ExtremepolSelected() { setInpolLevel( 3 ); }
63 
64  void setWidth( float );
65  void setFeather( float );
66  void setUseFeather( bool );
67  void setInvisibility( bool );
68  void setPreserveAlpha( bool );
69  void setVectorMergeEnabled( bool );
70  void setBezier( bool );
71  void setPressure( bool );
72  void setAA( int );
73  void setInpolLevel( int );
74  void setTolerance( int );
75  void setUseFillContour( bool );
76 
77 private:
78  BaseTool* mCurrentTool = nullptr;
79  ToolType meTabletBackupTool = PENCIL;
80  bool mIsSwitchedToEraser = false;
81  QHash<ToolType, BaseTool*> mToolSetHash;
82 
83  int oldValue = 0;
84 
85 };
86 
87 #endif // TOOLMANAGER_H
Definition: object.h:71