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_ViewEditor 21 #define TrenchBroom_ViewEditor 22 23 #include "Model/BrushContentType.h" 24 #include "View/ViewTypes.h" 25 26 #include <wx/panel.h> 27 28 #include <vector> 29 30 class wxCheckBox; 31 class wxChoice; 32 class wxWindow; 33 34 namespace TrenchBroom { 35 namespace Assets { 36 class EntityDefinitionManager; 37 } 38 39 namespace Model { 40 class EditorContext; 41 } 42 43 namespace View { 44 class PopupButton; 45 46 class EntityDefinitionCheckBoxList : public wxPanel { 47 private: 48 typedef std::vector<wxCheckBox*> CheckBoxList; 49 50 Assets::EntityDefinitionManager& m_entityDefinitionManager; 51 Model::EditorContext& m_editorContext; 52 53 CheckBoxList m_groupCheckBoxes; 54 CheckBoxList m_defCheckBoxes; 55 public: 56 EntityDefinitionCheckBoxList(wxWindow* parent, Assets::EntityDefinitionManager& entityDefinitionManager, Model::EditorContext& editorContext); 57 58 void refresh(); 59 60 void OnGroupCheckBoxChanged(wxCommandEvent& event); 61 void OnDefCheckBoxChanged(wxCommandEvent& event); 62 void OnShowAllClicked(wxCommandEvent& event); 63 void OnHideAllClicked(wxCommandEvent& event); 64 private: 65 void hideAll(bool hidden); 66 void createGui(); 67 }; 68 69 class ViewEditor : public wxPanel { 70 private: 71 typedef std::vector<wxCheckBox*> CheckBoxList; 72 73 MapDocumentWPtr m_document; 74 75 wxCheckBox* m_showEntityClassnamesCheckBox; 76 wxCheckBox* m_showEntityBoundsCheckBox; 77 wxCheckBox* m_showPointEntitiesCheckBox; 78 wxCheckBox* m_showPointEntityModelsCheckBox; 79 80 EntityDefinitionCheckBoxList* m_entityDefinitionCheckBoxList; 81 82 wxCheckBox* m_showBrushesCheckBox; 83 CheckBoxList m_brushContentTypeCheckBoxes; 84 85 wxChoice* m_faceRenderModeChoice; 86 wxCheckBox* m_shadeFacesCheckBox; 87 wxCheckBox* m_showFogCheckBox; 88 wxCheckBox* m_showEdgesCheckBox; 89 wxChoice* m_entityLinkModeChoice; 90 public: 91 ViewEditor(wxWindow* parent, MapDocumentWPtr document); 92 ~ViewEditor(); 93 94 void OnShowEntityClassnamesChanged(wxCommandEvent& event); 95 void OnShowEntityBoundsChanged(wxCommandEvent& event); 96 void OnShowPointEntitiesChanged(wxCommandEvent& event); 97 void OnShowPointEntityModelsChanged(wxCommandEvent& event); 98 void OnShowBrushesChanged(wxCommandEvent& event); 99 void OnShowBrushContentTypeChanged(wxCommandEvent& event); 100 void OnFaceRenderModeChanged(wxCommandEvent& event); 101 void OnShadeFacesChanged(wxCommandEvent& event); 102 void OnShowFogChanged(wxCommandEvent& event); 103 void OnShowEdgesChanged(wxCommandEvent& event); 104 void OnEntityLinkModeChanged(wxCommandEvent& event); 105 private: 106 void bindObservers(); 107 void unbindObservers(); 108 109 void documentWasNewedOrLoaded(MapDocument* document); 110 void editorContextDidChange(); 111 void mapViewConfigDidChange(); 112 void entityDefinitionsDidChange(); 113 114 void createGui(); 115 116 wxWindow* createEntityDefinitionsPanel(); 117 wxWindow* createEntitiesPanel(); 118 wxWindow* createBrushesPanel(); 119 void createBrushContentTypeFilter(wxWindow* parent); 120 void createEmptyBrushContentTypeFilter(wxWindow* parent); 121 void createBrushContentTypeFilter(wxWindow* parent, const Model::BrushContentType::List& contentTypes); 122 123 wxWindow* createRendererPanel(); 124 125 void refreshGui(); 126 void refreshEntityDefinitionsPanel(); 127 void refreshEntitiesPanel(); 128 void refreshBrushesPanel(); 129 void refreshRendererPanel(); 130 }; 131 132 class ViewPopupEditor : public wxPanel { 133 private: 134 PopupButton* m_button; 135 ViewEditor* m_editor; 136 public: 137 ViewPopupEditor(wxWindow* parent, MapDocumentWPtr document); 138 }; 139 } 140 } 141 142 #endif /* defined(TrenchBroom_ViewEditor) */ 143