1 /*
2  Copyright (C) 2010-2014 Kristian Duske
3 
4  This file is part of TrenchBroom.
5 
6  TrenchBroom is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  TrenchBroom 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  You should have received a copy of the GNU General Public License
17  along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef TrenchBroom_MapViewToolBox
21 #define TrenchBroom_MapViewToolBox
22 
23 #include "View/ToolBox.h"
24 #include "View/ViewTypes.h"
25 
26 class wxBookCtrlBase;
27 
28 namespace TrenchBroom {
29     namespace Renderer {
30         class Camera;
31     }
32 
33     namespace View {
34         class ClipTool;
35         class CreateComplexBrushTool;
36         class CreateEntityTool;
37         class CreateSimpleBrushTool;
38         class MoveObjectsTool;
39         class ResizeBrushesTool;
40         class RotateObjectsTool;
41         class VertexTool;
42         class Selection;
43 
44         class MapViewToolBox : public ToolBox {
45         private:
46             MapDocumentWPtr m_document;
47 
48             ClipTool* m_clipTool;
49             CreateComplexBrushTool* m_createComplexBrushTool;
50             CreateEntityTool* m_createEntityTool;
51             CreateSimpleBrushTool* m_createSimpleBrushTool;
52             MoveObjectsTool* m_moveObjectsTool;
53             ResizeBrushesTool* m_resizeBrushesTool;
54             RotateObjectsTool* m_rotateObjectsTool;
55             VertexTool* m_vertexTool;
56         public:
57             MapViewToolBox(MapDocumentWPtr document, wxBookCtrlBase* bookCtrl);
58             ~MapViewToolBox();
59         public: // tools
60             ClipTool* clipTool();
61             CreateComplexBrushTool* createComplexBrushTool();
62             CreateEntityTool* createEntityTool();
63             CreateSimpleBrushTool* createSimpleBrushTool();
64             MoveObjectsTool* moveObjectsTool();
65             ResizeBrushesTool* resizeBrushesTool();
66             RotateObjectsTool* rotateObjectsTool();
67             VertexTool* vertexTool();
68 
69             void toggleCreateComplexBrushTool();
70             bool createComplexBrushToolActive() const;
71             void performCreateComplexBrush();
72 
73             void toggleClipTool();
74             bool clipToolActive() const;
75             void toggleClipSide();
76             void performClip();
77             void removeLastClipPoint();
78 
79             void toggleRotateObjectsTool();
80             bool rotateObjectsToolActive() const;
81             double rotateToolAngle() const;
82             const Vec3 rotateToolCenter() const;
83             void moveRotationCenter(const Vec3& delta);
84 
85             void toggleVertexTool();
86             bool vertexToolActive() const;
87             void moveVertices(const Vec3& delta);
88         private: // Tool related methods
89             void createTools(MapDocumentWPtr document, wxBookCtrlBase* bookCtrl);
90             void destroyTools();
91         private: // notification
92             void registerTool(Tool* tool, wxBookCtrlBase* bookCtrl);
93             void bindObservers();
94             void unbindObservers();
95             void toolActivated(Tool* tool);
96             void toolDeactivated(Tool* tool);
97             void updateEditorContext();
98         };
99     }
100 }
101 
102 #endif /* defined(TrenchBroom_MapViewToolBox) */
103