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_SelectionTool
21 #define TrenchBroom_SelectionTool
22 
23 #include "Model/Hit.h"
24 #include "View/Tool.h"
25 #include "View/ToolController.h"
26 #include "View/ViewTypes.h"
27 
28 namespace TrenchBroom {
29     namespace Renderer {
30         class RenderContext;
31     }
32 
33     namespace View {
34         class InputState;
35 
36         class SelectionTool : public ToolControllerBase<NoPickingPolicy, NoKeyPolicy, MousePolicy, MouseDragPolicy, RenderPolicy, NoDropPolicy>, public Tool {
37         private:
38             MapDocumentWPtr m_document;
39         public:
40             SelectionTool(MapDocumentWPtr document);
41         private:
42             Tool* doGetTool();
43 
44             bool doMouseClick(const InputState& inputState);
45             bool doMouseDoubleClick(const InputState& inputState);
46 
47             bool handleClick(const InputState& inputState) const;
48             bool isFaceClick(const InputState& inputState) const;
49             bool isMultiClick(const InputState& inputState) const;
50 
51             const Model::Hit& firstHit(const InputState& inputState, Model::Hit::HitType type) const;
52 
53             void doMouseScroll(const InputState& inputState);
54             void adjustGrid(const InputState& inputState);
55             void drillSelection(const InputState& inputState);
56 
57             bool doStartMouseDrag(const InputState& inputState);
58             bool doMouseDrag(const InputState& inputState);
59             void doEndMouseDrag(const InputState& inputState);
60             void doCancelMouseDrag();
61 
62             void doSetRenderOptions(const InputState& inputState, Renderer::RenderContext& renderContext) const;
63 
64             bool doCancel();
65         };
66     }
67 }
68 
69 #endif /* defined(TrenchBroom_SelectionTool) */
70