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_SwitchableMapViewContainer 21 #define TrenchBroom_SwitchableMapViewContainer 22 23 #include "TrenchBroom.h" 24 #include "VecMath.h" 25 #include "View/MapViewLayout.h" 26 #include "View/MapView.h" 27 #include "View/ViewTypes.h" 28 29 #include <wx/panel.h> 30 31 class wxWindow; 32 33 namespace TrenchBroom { 34 class Logger; 35 36 namespace Renderer { 37 class MapRenderer; 38 } 39 40 namespace IO { 41 class Path; 42 } 43 44 namespace View { 45 class GLContextManager; 46 class Inspector; 47 class MapViewContainer; 48 class MapViewBar; 49 class MapViewToolBox; 50 class Tool; 51 52 class SwitchableMapViewContainer : public wxPanel, public MapView { 53 private: 54 Logger* m_logger; 55 MapDocumentWPtr m_document; 56 GLContextManager& m_contextManager; 57 58 MapViewBar* m_mapViewBar; 59 MapViewToolBox* m_toolBox; 60 61 Renderer::MapRenderer* m_mapRenderer; 62 63 MapViewContainer* m_mapView; 64 public: 65 SwitchableMapViewContainer(wxWindow* parent, Logger* logger, MapDocumentWPtr document, GLContextManager& contextManager); 66 ~SwitchableMapViewContainer(); 67 68 void connectTopWidgets(Inspector* inspector); 69 70 bool viewportHasFocus() const; 71 void switchToMapView(MapViewLayout viewId); 72 73 bool anyToolActive() const; 74 void deactivateTool(); 75 bool createComplexBrushToolActive() const; 76 bool canToggleCreateComplexBrushTool() const; 77 void toggleCreateComplexBrushTool(); 78 bool clipToolActive() const; 79 bool canToggleClipTool() const; 80 void toggleClipTool(); 81 bool rotateObjectsToolActive() const; 82 bool canToggleRotateObjectsTool() const; 83 void toggleRotateObjectsTool(); 84 bool vertexToolActive() const; 85 bool canToggleVertexTool() const; 86 void toggleVertexTool(); 87 88 bool canMoveCameraToNextTracePoint() const; 89 bool canMoveCameraToPreviousTracePoint() const; 90 void moveCameraToNextTracePoint(); 91 void moveCameraToPreviousTracePoint(); 92 93 bool canMaximizeCurrentView() const; 94 bool currentViewMaximized() const; 95 void toggleMaximizeCurrentView(); 96 private: 97 void bindObservers(); 98 void unbindObservers(); 99 void refreshViews(Tool* tool); 100 private: // implement MapView interface 101 bool doGetIsCurrent() const; 102 void doSetToolBoxDropTarget(); 103 void doClearDropTarget(); 104 bool doCanSelectTall(); 105 void doSelectTall(); 106 bool doCanFlipObjects() const; 107 void doFlipObjects(Math::Direction direction); 108 Vec3 doGetPasteObjectsDelta(const BBox3& bounds, const BBox3& referenceBounds) const; 109 void doFocusCameraOnSelection(bool animate); 110 void doMoveCameraToPosition(const Vec3& position, bool animate); 111 void doMoveCameraToCurrentTracePoint(); 112 private: // implement ViewEffectsService interface 113 void doFlashSelection(); 114 }; 115 } 116 } 117 118 #endif /* defined(TrenchBroom_SwitchableMapViewContainer) */ 119