Skyscraper 2.0
meshcontrol.cpp
Go to the documentation of this file.
1/*
2 Skyscraper 2.0 Alpha - Mesh Control Form
3 Copyright (C)2003-2024 Ryan Thoryk
4 https://www.skyscrapersim.net
5 https://sourceforge.net/projects/skyscraper/
6 Contact - ryan@skyscrapersim.net
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21*/
22
23//(*InternalHeaders(MeshControl)
24#include <wx/intl.h>
25#include <wx/string.h>
26//*)
27#include "globals.h"
28#include "sbs.h"
29#include "camera.h"
30#include "floor.h"
31#include "elevator.h"
32#include "shaft.h"
33#include "stairs.h"
34#include "debugpanel.h"
35#include "meshcontrol.h"
36
37namespace Skyscraper {
38
39//(*IdInit(MeshControl)
40const long MeshControl::ID_chkExternal = wxNewId();
41const long MeshControl::ID_chkBuildings = wxNewId();
42const long MeshControl::ID_chkLandscape = wxNewId();
43const long MeshControl::ID_chkSky = wxNewId();
44const long MeshControl::ID_chkElevators = wxNewId();
45const long MeshControl::ID_chkFloor = wxNewId();
46const long MeshControl::ID_chkShafts = wxNewId();
47const long MeshControl::ID_chkStairs = wxNewId();
48const long MeshControl::ID_chkInterfloor = wxNewId();
49const long MeshControl::ID_chkColumnFrame = wxNewId();
50const long MeshControl::ID_chkAllFloors = wxNewId();
51const long MeshControl::ID_chkAllShafts = wxNewId();
52const long MeshControl::ID_chkAllStairs = wxNewId();
53const long MeshControl::ID_chkAllInterfloors = wxNewId();
54const long MeshControl::ID_chkAllColumnFrames = wxNewId();
55const long MeshControl::ID_bOk = wxNewId();
56//*)
57
58BEGIN_EVENT_TABLE(MeshControl,wxDialog)
59 //(*EventTable(MeshControl)
60 //*)
61END_EVENT_TABLE()
62
63MeshControl::MeshControl(DebugPanel* parent,wxWindowID id)
64{
65 //(*Initialize(MeshControl)
66 wxBoxSizer* BoxSizer3;
67 wxStaticBoxSizer* StaticBoxSizer1;
68 wxStaticBoxSizer* StaticBoxSizer2;
69 wxStaticBoxSizer* StaticBoxSizer3;
70
71 Create(parent, wxID_ANY, _("Realtime Object Control"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
72 BoxSizer1 = new wxBoxSizer(wxVERTICAL);
73 BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
74 StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("Global Objects"));
75 chkExternal = new wxCheckBox(this, ID_chkExternal, _("External"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkExternal"));
76 chkExternal->SetValue(false);
77 StaticBoxSizer1->Add(chkExternal, 0, wxTOP|wxBOTTOM|wxALIGN_LEFT, 5);
78 chkBuildings = new wxCheckBox(this, ID_chkBuildings, _("Buildings"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkBuildings"));
79 chkBuildings->SetValue(false);
80 StaticBoxSizer1->Add(chkBuildings, 0, wxBOTTOM|wxALIGN_LEFT, 5);
81 chkLandscape = new wxCheckBox(this, ID_chkLandscape, _("Landscape"), wxDefaultPosition, wxSize(100,-1), 0, wxDefaultValidator, _T("ID_chkLandscape"));
82 chkLandscape->SetValue(false);
83 StaticBoxSizer1->Add(chkLandscape, 0, wxBOTTOM|wxALIGN_LEFT, 5);
84 chkSky = new wxCheckBox(this, ID_chkSky, _("Sky"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkSky"));
85 chkSky->SetValue(false);
86 StaticBoxSizer1->Add(chkSky, 0, wxBOTTOM|wxALIGN_LEFT, 5);
87 chkElevators = new wxCheckBox(this, ID_chkElevators, _("Elevators"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkElevators"));
88 chkElevators->SetValue(false);
89 StaticBoxSizer1->Add(chkElevators, 1, wxBOTTOM|wxALIGN_LEFT, 5);
90 BoxSizer2->Add(StaticBoxSizer1, 1, wxALIGN_TOP, 5);
91 BoxSizer3 = new wxBoxSizer(wxVERTICAL);
92 StaticBoxSizer2 = new wxStaticBoxSizer(wxVERTICAL, this, _("Per-Floor Objects"));
93 chkFloor = new wxCheckBox(this, ID_chkFloor, _("Level"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkFloor"));
94 chkFloor->SetValue(false);
95 StaticBoxSizer2->Add(chkFloor, 0, wxTOP|wxBOTTOM|wxEXPAND, 5);
96 chkShafts = new wxCheckBox(this, ID_chkShafts, _("Shafts"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkShafts"));
97 chkShafts->SetValue(false);
98 StaticBoxSizer2->Add(chkShafts, 1, wxBOTTOM|wxEXPAND, 5);
99 chkStairs = new wxCheckBox(this, ID_chkStairs, _("Stairs"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkStairs"));
100 chkStairs->SetValue(false);
101 StaticBoxSizer2->Add(chkStairs, 1, wxBOTTOM|wxEXPAND, 5);
102 chkInterfloor = new wxCheckBox(this, ID_chkInterfloor, _("Interfloor"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkInterfloor"));
103 chkInterfloor->SetValue(false);
104 StaticBoxSizer2->Add(chkInterfloor, 1, wxBOTTOM|wxEXPAND, 5);
105 chkColumnFrame = new wxCheckBox(this, ID_chkColumnFrame, _("Column Frame"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkColumnFrame"));
106 chkColumnFrame->SetValue(false);
107 StaticBoxSizer2->Add(chkColumnFrame, 1, wxBOTTOM|wxALIGN_LEFT, 5);
108 BoxSizer3->Add(StaticBoxSizer2, 1, wxEXPAND, 5);
109 StaticBoxSizer3 = new wxStaticBoxSizer(wxVERTICAL, this, _("Grouped Objects"));
110 chkAllFloors = new wxCheckBox(this, ID_chkAllFloors, _("All Floors"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkAllFloors"));
111 chkAllFloors->SetValue(false);
112 StaticBoxSizer3->Add(chkAllFloors, 1, wxTOP|wxBOTTOM|wxALIGN_LEFT, 5);
113 chkAllShafts = new wxCheckBox(this, ID_chkAllShafts, _("All Shafts"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkAllShafts"));
114 chkAllShafts->SetValue(false);
115 StaticBoxSizer3->Add(chkAllShafts, 1, wxBOTTOM|wxALIGN_LEFT, 5);
116 chkAllStairs = new wxCheckBox(this, ID_chkAllStairs, _("All Stairs"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkAllStairs"));
117 chkAllStairs->SetValue(false);
118 StaticBoxSizer3->Add(chkAllStairs, 1, wxBOTTOM|wxALIGN_LEFT, 5);
119 chkAllInterfloors = new wxCheckBox(this, ID_chkAllInterfloors, _("All Interfloors"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkAllInterfloors"));
120 chkAllInterfloors->SetValue(false);
121 StaticBoxSizer3->Add(chkAllInterfloors, 1, wxBOTTOM|wxALIGN_LEFT, 5);
122 chkAllColumnFrames = new wxCheckBox(this, ID_chkAllColumnFrames, _("All Column Frames"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkAllColumnFrames"));
123 chkAllColumnFrames->SetValue(false);
124 StaticBoxSizer3->Add(chkAllColumnFrames, 1, wxBOTTOM|wxALIGN_LEFT, 5);
125 BoxSizer3->Add(StaticBoxSizer3, 1, wxEXPAND, 5);
126 BoxSizer2->Add(BoxSizer3, 1, wxLEFT|wxEXPAND, 5);
127 BoxSizer1->Add(BoxSizer2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
128 bOk = new wxButton(this, ID_bOk, _("OK"), wxPoint(75,145), wxDefaultSize, 0, wxDefaultValidator, _T("ID_bOk"));
129 BoxSizer1->Add(bOk, 0, wxBOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10);
130 SetSizer(BoxSizer1);
131 BoxSizer1->Fit(this);
132 BoxSizer1->SetSizeHints(this);
133 Center();
134
135 Connect(ID_chkExternal,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkExternal_Click);
136 Connect(ID_chkBuildings,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkBuildings_Click);
137 Connect(ID_chkLandscape,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkLandscape_Click);
138 Connect(ID_chkSky,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkSky_Click);
139 Connect(ID_chkElevators,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkElevators_Click);
140 Connect(ID_chkFloor,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkFloor_Click);
141 Connect(ID_chkShafts,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkShafts_Click);
142 Connect(ID_chkStairs,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkStairs_Click);
143 Connect(ID_chkInterfloor,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkInterfloor_Click);
144 Connect(ID_chkColumnFrame,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkColumnFrame_Click);
145 Connect(ID_chkAllFloors,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkAllFloors_Click);
146 Connect(ID_chkAllShafts,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkAllShafts_Click);
147 Connect(ID_chkAllStairs,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkAllStairs_Click);
148 Connect(ID_chkAllInterfloors,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkAllInterfloors_Click);
149 Connect(ID_chkAllColumnFrames,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MeshControl::On_chkAllColumnFrames_Click);
150 Connect(ID_bOk,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MeshControl::On_bOk_Click);
151 //*)
152 Simcore = 0;
153 panel = parent;
154 OnInit();
155}
156
160
161
163{
165
166 chkElevators->SetValue(true);
167}
168
170{
171 //if active engine has changed, refresh values
172 if (Simcore != panel->GetSystem())
173 OnInit();
174
175 if (!Simcore)
176 return;
177
179 if (floor)
180 {
181 chkFloor->SetValue(floor->IsEnabled);
182 chkColumnFrame->SetValue(floor->IsColumnFrameEnabled);
183 chkInterfloor->SetValue(floor->IsInterfloorEnabled);
184 }
185 chkSky->SetValue(Simcore->IsSkyboxEnabled);
189}
190
191void MeshControl::On_bOk_Click(wxCommandEvent& event)
192{
193 Hide();
194}
195
196void MeshControl::On_chkSky_Click(wxCommandEvent& event)
197{
198 Simcore->EnableSkybox(chkSky->GetValue());
199}
200
201void MeshControl::On_chkLandscape_Click(wxCommandEvent& event)
202{
204}
205
206void MeshControl::On_chkBuildings_Click(wxCommandEvent& event)
207{
209}
210
211void MeshControl::On_chkExternal_Click(wxCommandEvent& event)
212{
213 Simcore->EnableExternal(chkExternal->GetValue());
214}
215
216void MeshControl::On_chkFloor_Click(wxCommandEvent& event)
217{
220}
221
222void MeshControl::On_chkElevators_Click(wxCommandEvent& event)
223{
224 for (int i = 1; i <= Simcore->GetElevatorCount(); i++)
225 {
226 if (Simcore->GetElevator(i))
227 Simcore->GetElevator(i)->Enabled(chkElevators->GetValue());
228 }
229}
230
231void MeshControl::On_chkShafts_Click(wxCommandEvent& event)
232{
233 for (int i = 1; i <= Simcore->GetShaftCount(); i++)
234 {
235 if (Simcore->GetShaft(i))
236 {
238 if (level)
239 level->Enabled(chkShafts->GetValue(), true);
240 }
241 }
242}
243
244void MeshControl::On_chkStairs_Click(wxCommandEvent& event)
245{
246 for (int i = 1; i <= Simcore->GetStairwellCount(); i++)
247 {
248 if (Simcore->GetStairwell(i))
249 {
251 if (level)
252 level->Enabled(chkStairs->GetValue());
253 }
254 }
255}
256
257void MeshControl::On_chkAllFloors_Click(wxCommandEvent& event)
258{
259 for (int i = -Simcore->Basements; i < Simcore->Floors; i++)
260 {
261 if (Simcore->GetFloor(i))
262 Simcore->GetFloor(i)->Enabled(chkAllFloors->GetValue());
263 }
264}
265
266void MeshControl::On_chkAllShafts_Click(wxCommandEvent& event)
267{
268 for (int i = 1; i <= Simcore->GetShaftCount(); i++)
269 {
270 if (Simcore->GetShaft(i))
271 Simcore->GetShaft(i)->EnableWhole(chkAllShafts->GetValue(), true, true);
272 }
273}
274
275void MeshControl::On_chkAllStairs_Click(wxCommandEvent& event)
276{
277 for (int i = 1; i <= Simcore->GetStairwellCount(); i++)
278 {
279 if (Simcore->GetStairwell(i))
280 Simcore->GetStairwell(i)->EnableWhole(chkAllStairs->GetValue(), true);
281 }
282}
283
289
291{
292 for (int i = -Simcore->Basements; i < Simcore->Floors; i++)
293 {
294 if (Simcore->GetFloor(i))
296 }
297}
298
304
306{
307 for (int i = -Simcore->Basements; i < Simcore->Floors; i++)
308 {
309 if (Simcore->GetFloor(i))
311 }
312}
313
314}
int CurrentFloor
Definition camera.h:49
void Enabled(bool value)
bool IsEnabled
Definition floor.h:46
void EnableInterfloor(bool value)
Definition floor.cpp:883
void EnableColumnFrame(bool value)
Definition floor.cpp:876
bool IsColumnFrameEnabled
Definition floor.h:47
bool IsInterfloorEnabled
Definition floor.h:48
void Enabled(bool value)
Definition floor.cpp:377
Shaft * GetShaft(int number)
Definition sbs.cpp:1753
Elevator * GetElevator(int number)
Definition sbs.cpp:1746
void EnableBuildings(bool value)
Definition sbs.cpp:1475
int GetElevatorCount()
Definition sbs.cpp:1703
bool IsBuildingsEnabled
Definition sbs.h:170
Floor * GetFloor(int number)
Definition sbs.cpp:1739
Stairwell * GetStairwell(int number)
Definition sbs.cpp:1760
Camera * camera
Definition sbs.h:160
int Basements
Definition sbs.h:159
void EnableLandscape(bool value)
Definition sbs.cpp:1482
bool IsExternalEnabled
Definition sbs.h:171
void EnableSkybox(bool value)
Definition sbs.cpp:1498
int GetStairwellCount()
Definition sbs.cpp:1727
void EnableExternal(bool value)
Definition sbs.cpp:1489
bool IsLandscapeEnabled
Definition sbs.h:172
int Floors
Definition sbs.h:158
bool IsSkyboxEnabled
Definition sbs.h:173
int GetShaftCount()
Definition sbs.cpp:1721
void Enabled(bool value, bool EnableShaftDoors)
Definition shaft.cpp:848
void EnableWhole(bool value, bool EnableShaftDoors, bool force=false)
Definition shaft.cpp:145
Level * GetLevel(int floor)
Definition shaft.cpp:135
void Enabled(bool value)
Definition stairs.cpp:778
void EnableWhole(bool value, bool force=false)
Definition stairs.cpp:134
Level * GetLevel(int floor)
Definition stairs.cpp:112
SBS::SBS * GetSystem()
Definition debugpanel.h:131
void On_chkAllColumnFrames_Click(wxCommandEvent &event)
wxCheckBox * chkAllInterfloors
Definition meshcontrol.h:90
wxCheckBox * chkAllStairs
Definition meshcontrol.h:92
void On_chkExternal_Click(wxCommandEvent &event)
void On_chkLandscape_Click(wxCommandEvent &event)
static const long ID_chkAllShafts
Definition meshcontrol.h:54
void On_chkInterfloor_Click(wxCommandEvent &event)
void On_chkBuildings_Click(wxCommandEvent &event)
static const long ID_chkElevators
Definition meshcontrol.h:47
wxCheckBox * chkExternal
Definition meshcontrol.h:96
void On_bOk_Click(wxCommandEvent &event)
static const long ID_chkExternal
Definition meshcontrol.h:43
wxCheckBox * chkAllShafts
Definition meshcontrol.h:91
static const long ID_chkAllInterfloors
Definition meshcontrol.h:56
void On_chkAllFloors_Click(wxCommandEvent &event)
void On_chkSky_Click(wxCommandEvent &event)
static const long ID_chkShafts
Definition meshcontrol.h:49
void On_chkFloor_Click(wxCommandEvent &event)
wxCheckBox * chkLandscape
Definition meshcontrol.h:99
static const long ID_bOk
Definition meshcontrol.h:58
static const long ID_chkAllColumnFrames
Definition meshcontrol.h:57
static const long ID_chkInterfloor
Definition meshcontrol.h:51
static const long ID_chkStairs
Definition meshcontrol.h:50
static const long ID_chkFloor
Definition meshcontrol.h:48
wxCheckBox * chkInterfloor
Definition meshcontrol.h:98
void On_chkAllShafts_Click(wxCommandEvent &event)
wxCheckBox * chkBuildings
Definition meshcontrol.h:93
void On_chkShafts_Click(wxCommandEvent &event)
void On_chkAllStairs_Click(wxCommandEvent &event)
void On_chkColumnFrame_Click(wxCommandEvent &event)
wxCheckBox * chkColumnFrame
Definition meshcontrol.h:94
static const long ID_chkAllFloors
Definition meshcontrol.h:53
void On_chkStairs_Click(wxCommandEvent &event)
void On_chkElevators_Click(wxCommandEvent &event)
static const long ID_chkColumnFrame
Definition meshcontrol.h:52
wxCheckBox * chkAllFloors
Definition meshcontrol.h:89
void On_chkAllInterfloors_Click(wxCommandEvent &event)
wxCheckBox * chkAllColumnFrames
Definition meshcontrol.h:88
static const long ID_chkAllStairs
Definition meshcontrol.h:55
static const long ID_chkLandscape
Definition meshcontrol.h:45
static const long ID_chkBuildings
Definition meshcontrol.h:44
static const long ID_chkSky
Definition meshcontrol.h:46
wxCheckBox * chkElevators
Definition meshcontrol.h:95