| 1 | /* |
|---|
| 2 | ================================================================================= |
|---|
| 3 | This file is part of Cafu, the open-source game engine and graphics engine |
|---|
| 4 | for multiplayer, cross-platform, real-time 3D action. |
|---|
| 5 | Copyright (C) 2002-2012 Carsten Fuchs Software. |
|---|
| 6 | |
|---|
| 7 | Cafu is free software: you can redistribute it and/or modify it under the terms |
|---|
| 8 | of the GNU General Public License as published by the Free Software Foundation, |
|---|
| 9 | either version 3 of the License, or (at your option) any later version. |
|---|
| 10 | |
|---|
| 11 | Cafu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|---|
| 12 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|---|
| 13 | PURPOSE. See the GNU General Public License for more details. |
|---|
| 14 | |
|---|
| 15 | You should have received a copy of the GNU General Public License |
|---|
| 16 | along with Cafu. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | |
|---|
| 18 | For support and more information about Cafu, visit us at <http://www.cafu.de>. |
|---|
| 19 | ================================================================================= |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | #ifndef CAFU_TOOL_OPTIONS_BARS_HPP_INCLUDED |
|---|
| 23 | #define CAFU_TOOL_OPTIONS_BARS_HPP_INCLUDED |
|---|
| 24 | |
|---|
| 25 | /// \file |
|---|
| 26 | /// This file contains the declarations of the tool options bars. |
|---|
| 27 | /// The bars are all derived from wxPanels, and add only little functionality. |
|---|
| 28 | /// Having them as separate classes makes many things a lot cleaner and clearer, though. |
|---|
| 29 | |
|---|
| 30 | #include "wx/wx.h" |
|---|
| 31 | #include "wx/spinctrl.h" |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | class ToolClipT; |
|---|
| 35 | class MapDocumentT; |
|---|
| 36 | class ToolMorphT; |
|---|
| 37 | class wxSpinEvent; |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | /// The options bar for the Selection tool. |
|---|
| 41 | class OptionsBar_SelectionToolT : public wxPanel |
|---|
| 42 | { |
|---|
| 43 | public: |
|---|
| 44 | |
|---|
| 45 | /// The constructor. |
|---|
| 46 | /// @param Parent is the parent window of this panel. |
|---|
| 47 | OptionsBar_SelectionToolT(wxWindow* Parent); |
|---|
| 48 | |
|---|
| 49 | bool IsIgnoreGroupsChecked() { return m_IgnoreGroups->IsChecked(); } |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | private: |
|---|
| 53 | |
|---|
| 54 | wxCheckBox* m_IgnoreGroups; ///< The "Ignore Groups" checkbox. |
|---|
| 55 | }; |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | /// The options bar for the Camera tool. |
|---|
| 59 | class OptionsBar_CameraToolT : public wxPanel |
|---|
| 60 | { |
|---|
| 61 | public: |
|---|
| 62 | |
|---|
| 63 | /// The constructor. |
|---|
| 64 | OptionsBar_CameraToolT(wxWindow* Parent); |
|---|
| 65 | }; |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | /// The options bar for the New Brush tool. |
|---|
| 69 | class OptionsBar_NewBrushToolT : public wxPanel |
|---|
| 70 | { |
|---|
| 71 | public: |
|---|
| 72 | |
|---|
| 73 | struct BrushTypeInfoT |
|---|
| 74 | { |
|---|
| 75 | const char* Name; |
|---|
| 76 | unsigned long NrOfFaces; |
|---|
| 77 | unsigned long NrOfFacesMin; |
|---|
| 78 | unsigned long NrOfFacesMax; |
|---|
| 79 | }; |
|---|
| 80 | |
|---|
| 81 | /// The constructor. |
|---|
| 82 | OptionsBar_NewBrushToolT(wxWindow* Parent); |
|---|
| 83 | |
|---|
| 84 | const int GetNrOfFaces () const { return m_NrOfFacesSpinControl->GetValue(); } |
|---|
| 85 | const int GetBrushIndex() const { return m_BrushPrimitiveChoice->GetSelection(); } |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | private: |
|---|
| 89 | |
|---|
| 90 | wxChoice* m_BrushPrimitiveChoice; ///< The wxChoice for the current brush primitive. |
|---|
| 91 | wxSpinCtrl* m_NrOfFacesSpinControl; ///< The wxSpinCtrl for the number of faces of the brush primitive. |
|---|
| 92 | |
|---|
| 93 | /// The event handlers. |
|---|
| 94 | void OnSelChangeBrushPrimitives(wxCommandEvent& Event); |
|---|
| 95 | void OnSpinCtrlNrOfFaces (wxSpinEvent& Event); |
|---|
| 96 | |
|---|
| 97 | /// IDs for the controls whose events we are interested in. |
|---|
| 98 | enum |
|---|
| 99 | { |
|---|
| 100 | ID_CHOICE_BRUSH_PRIMITIVES=wxID_HIGHEST+1, |
|---|
| 101 | ID_SPINCTRL_NR_OF_FACES |
|---|
| 102 | }; |
|---|
| 103 | |
|---|
| 104 | DECLARE_EVENT_TABLE() |
|---|
| 105 | }; |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | /// The options bar for the New Entity tool. |
|---|
| 109 | class OptionsBar_NewEntityToolT : public wxPanel |
|---|
| 110 | { |
|---|
| 111 | public: |
|---|
| 112 | |
|---|
| 113 | /// The constructor. |
|---|
| 114 | /// @param Parent is the parent window of this panel. |
|---|
| 115 | /// @param MapDoc is a reference to our document. |
|---|
| 116 | OptionsBar_NewEntityToolT(wxWindow* Parent, MapDocumentT& MapDoc); |
|---|
| 117 | |
|---|
| 118 | wxChoice* m_PointEntityChoice; |
|---|
| 119 | wxChoice* m_SolidEntityChoice; |
|---|
| 120 | }; |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | /// The options bar for the New Bezier Patch tool. |
|---|
| 124 | class OptionsBar_NewBezierPatchToolT : public wxPanel |
|---|
| 125 | { |
|---|
| 126 | public: |
|---|
| 127 | |
|---|
| 128 | /// The constructor. |
|---|
| 129 | OptionsBar_NewBezierPatchToolT(wxWindow* Parent, MapDocumentT& MapDoc); |
|---|
| 130 | |
|---|
| 131 | unsigned long GetPatchResX() const; |
|---|
| 132 | unsigned long GetPatchResY() const; |
|---|
| 133 | bool WithConvexEndCaps() const { return m_CheckConvex ->GetValue(); } |
|---|
| 134 | bool WithConcaveEndCaps() const { return m_CheckConcave->GetValue(); } |
|---|
| 135 | |
|---|
| 136 | wxChoice* m_ChoicePatchType; |
|---|
| 137 | wxSpinCtrl* m_SpinCtrlSubdivsHorz; |
|---|
| 138 | wxSpinCtrl* m_SpinCtrlSubdivsVert; |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | private: |
|---|
| 142 | |
|---|
| 143 | MapDocumentT& m_MapDoc; ///< A reference to our document. |
|---|
| 144 | // wxChoice* m_ChoicePatchType; |
|---|
| 145 | wxChoice* m_ChoicePatchResX; |
|---|
| 146 | wxChoice* m_ChoicePatchResY; |
|---|
| 147 | // wxSpinCtrl* m_SpinCtrlSubdivsHorz; |
|---|
| 148 | // wxSpinCtrl* m_SpinCtrlSubdivsVert; |
|---|
| 149 | wxCheckBox* m_CheckConvex; |
|---|
| 150 | wxCheckBox* m_CheckConcave; |
|---|
| 151 | |
|---|
| 152 | void OnPatchTypeChoice(wxCommandEvent& Event); ///< Handles events that occur when a patch type is choosen from the patch type choice box. |
|---|
| 153 | |
|---|
| 154 | /// IDs for the controls whose events we are interested in. |
|---|
| 155 | enum |
|---|
| 156 | { |
|---|
| 157 | ID_PATCHTYPE, |
|---|
| 158 | ID_SUBDIVSHORZ, |
|---|
| 159 | ID_SUBDIVSVERT |
|---|
| 160 | }; |
|---|
| 161 | |
|---|
| 162 | DECLARE_EVENT_TABLE() |
|---|
| 163 | }; |
|---|
| 164 | |
|---|
| 165 | |
|---|
| 166 | /// The options bar for the New Terrain tool. |
|---|
| 167 | class OptionsBar_NewTerrainToolT : public wxPanel |
|---|
| 168 | { |
|---|
| 169 | public: |
|---|
| 170 | |
|---|
| 171 | /// The constructor. |
|---|
| 172 | OptionsBar_NewTerrainToolT(wxWindow* Parent, MapDocumentT& MapDoc); |
|---|
| 173 | |
|---|
| 174 | wxComboBox* m_ComboBoxHeightmapName; /// The heightmap name combobox: "a text field plus the MRU list". It is maintained by the MapTerrainT helper. |
|---|
| 175 | wxCheckBox* m_CheckBoxAddWallsAndCeil; /// The New Terrain tool should add walls and a ceiling if this is checked. |
|---|
| 176 | wxCheckBox* m_CheckBoxAddFloor; /// The New Terrain tool should add a floor if this is checked. |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | private: |
|---|
| 180 | |
|---|
| 181 | /// A reference to our document. |
|---|
| 182 | MapDocumentT& m_MapDoc; |
|---|
| 183 | |
|---|
| 184 | /// The Browse button event handler. |
|---|
| 185 | void OnButtonBrowse(wxCommandEvent& Event); |
|---|
| 186 | |
|---|
| 187 | /// IDs for the controls whose events we are interested in. |
|---|
| 188 | enum |
|---|
| 189 | { |
|---|
| 190 | ID_BUTTON_BROWSE=wxID_HIGHEST+1, |
|---|
| 191 | }; |
|---|
| 192 | |
|---|
| 193 | DECLARE_EVENT_TABLE() |
|---|
| 194 | }; |
|---|
| 195 | |
|---|
| 196 | |
|---|
| 197 | /// The options bar for the New Light tool. |
|---|
| 198 | class OptionsBar_NewLightToolT : public wxPanel |
|---|
| 199 | { |
|---|
| 200 | public: |
|---|
| 201 | |
|---|
| 202 | /// The constructor. |
|---|
| 203 | /// @param Parent is the parent window of this panel. |
|---|
| 204 | /// @param MapDoc is a reference to our document. |
|---|
| 205 | OptionsBar_NewLightToolT(wxWindow* Parent, MapDocumentT& MapDoc); |
|---|
| 206 | |
|---|
| 207 | wxChoice* m_LightChoice; ///< The wxChoice with point entities that are some "light source" entity class. |
|---|
| 208 | }; |
|---|
| 209 | |
|---|
| 210 | |
|---|
| 211 | /// The options bar for the New Decal tool. |
|---|
| 212 | class OptionsBar_NewDecalToolT : public wxPanel |
|---|
| 213 | { |
|---|
| 214 | public: |
|---|
| 215 | |
|---|
| 216 | /// The constructor. |
|---|
| 217 | OptionsBar_NewDecalToolT(wxWindow* Parent); |
|---|
| 218 | }; |
|---|
| 219 | |
|---|
| 220 | |
|---|
| 221 | /// The options bar for the Edit Face Properties tool. |
|---|
| 222 | class OptionsBar_EditFacePropsToolT : public wxPanel |
|---|
| 223 | { |
|---|
| 224 | public: |
|---|
| 225 | |
|---|
| 226 | /// The constructor. |
|---|
| 227 | OptionsBar_EditFacePropsToolT(wxWindow* Parent); |
|---|
| 228 | }; |
|---|
| 229 | |
|---|
| 230 | |
|---|
| 231 | /// The options bar for the Clip Brushes tool. |
|---|
| 232 | class OptionsBar_ClipBrushesToolT : public wxPanel |
|---|
| 233 | { |
|---|
| 234 | public: |
|---|
| 235 | |
|---|
| 236 | /// This enumeration describes the clip mode of the clip brushes tool. |
|---|
| 237 | enum ClipModeT { KeepFront, KeepBack, KeepBoth }; |
|---|
| 238 | |
|---|
| 239 | |
|---|
| 240 | /// The constructor. |
|---|
| 241 | OptionsBar_ClipBrushesToolT(wxWindow* Parent, ToolClipT& ToolClipBrushes); |
|---|
| 242 | |
|---|
| 243 | /// Returns the current clip mode. |
|---|
| 244 | ClipModeT GetClipMode() const; |
|---|
| 245 | |
|---|
| 246 | /// Switches to the next clip mode, and wraps if necessary. |
|---|
| 247 | /// This also calls the NoteClipModeChanged() method of the m_ToolClipBrushes |
|---|
| 248 | /// (as if the user had changed the clip mode manually). |
|---|
| 249 | void CycleClipMode(); |
|---|
| 250 | |
|---|
| 251 | |
|---|
| 252 | private: |
|---|
| 253 | |
|---|
| 254 | ToolClipT& m_ToolClipBrushes; ///< Our clip brushes tool. |
|---|
| 255 | wxRadioButton* m_RB_ClipModeKeepFront; ///< The wxRadioButton for keeping the front part. |
|---|
| 256 | wxRadioButton* m_RB_ClipModeKeepBack; ///< The wxRadioButton for keeping the back part. |
|---|
| 257 | wxRadioButton* m_RB_ClipModeKeepBoth; ///< The wxRadioButton for keeping both parts. |
|---|
| 258 | |
|---|
| 259 | /// The event handler. |
|---|
| 260 | void OnSelChangeClipMode(wxCommandEvent& CE); |
|---|
| 261 | |
|---|
| 262 | /// IDs for the controls whose events we are interested in. |
|---|
| 263 | enum |
|---|
| 264 | { |
|---|
| 265 | ID_RB_CLIPMODE_KEEP_FRONT=wxID_HIGHEST+1, |
|---|
| 266 | ID_RB_CLIPMODE_KEEP_BACK, |
|---|
| 267 | ID_RB_CLIPMODE_KEEP_BOTH |
|---|
| 268 | }; |
|---|
| 269 | |
|---|
| 270 | DECLARE_EVENT_TABLE() |
|---|
| 271 | }; |
|---|
| 272 | |
|---|
| 273 | |
|---|
| 274 | /// The options bar for the Edit Vertices tool. |
|---|
| 275 | class OptionsBar_EditVerticesToolT : public wxPanel |
|---|
| 276 | { |
|---|
| 277 | public: |
|---|
| 278 | |
|---|
| 279 | enum EditModeT { EditVertices, EditEdges, EditBoth }; |
|---|
| 280 | |
|---|
| 281 | |
|---|
| 282 | /// The constructor. |
|---|
| 283 | OptionsBar_EditVerticesToolT(wxWindow* Parent, ToolMorphT& ToolEditVertices); |
|---|
| 284 | |
|---|
| 285 | /// Returns the current edit mode. |
|---|
| 286 | EditModeT GetEditMode() const; |
|---|
| 287 | |
|---|
| 288 | /// Returns true if the current edit mode is EditVertices or EditBoth. |
|---|
| 289 | bool IsEditingVertices() const; |
|---|
| 290 | |
|---|
| 291 | /// Returns true if the current edit mode is EditEdges or EditBoth. |
|---|
| 292 | bool IsEditingEdges() const; |
|---|
| 293 | |
|---|
| 294 | /// Switches to the next edit mode, and wraps if necessary. |
|---|
| 295 | /// This also calls the NoteEditModeChanged() method of the m_ToolEditVertices |
|---|
| 296 | /// (as if the user had changed the edit mode manually). |
|---|
| 297 | void CycleEditMode(); |
|---|
| 298 | |
|---|
| 299 | |
|---|
| 300 | private: |
|---|
| 301 | |
|---|
| 302 | ToolMorphT& m_ToolEditVertices; ///< Our edit vertices tool. |
|---|
| 303 | wxRadioButton* m_RB_EditModeVertices; ///< The wxRadioButton for editing the vertices. |
|---|
| 304 | wxRadioButton* m_RB_EditModeEdges; ///< The wxRadioButton for editing the edges. |
|---|
| 305 | wxRadioButton* m_RB_EditModeBoth; ///< The wxRadioButton for editing both the vertices and edges. |
|---|
| 306 | |
|---|
| 307 | /// The event handler. |
|---|
| 308 | void OnSelChangeEditMode(wxCommandEvent& CE); |
|---|
| 309 | |
|---|
| 310 | /// The "Insert Vertex" button event handler. |
|---|
| 311 | void OnButtonInsertVertex(wxCommandEvent& Event); |
|---|
| 312 | |
|---|
| 313 | /// IDs for the controls whose events we are interested in. |
|---|
| 314 | enum |
|---|
| 315 | { |
|---|
| 316 | ID_RB_EDITMODE_VERTICES=wxID_HIGHEST+1, |
|---|
| 317 | ID_RB_EDITMODE_EDGES, |
|---|
| 318 | ID_RB_EDITMODE_BOTH, |
|---|
| 319 | ID_BUTTON_INSERT_VERTEX |
|---|
| 320 | }; |
|---|
| 321 | |
|---|
| 322 | DECLARE_EVENT_TABLE() |
|---|
| 323 | }; |
|---|
| 324 | |
|---|
| 325 | #endif |
|---|