Skyscraper 2.0
moveobject.cpp
Go to the documentation of this file.
1/*
2 Skyscraper 2.0 Alpha - Move Object 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(MoveObject)
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 "debugpanel.h"
31#include "vm.h"
32#include "enginecontext.h"
33#include "moveobject.h"
34
35namespace Skyscraper {
36
37//(*IdInit(MoveObject)
38const long MoveObject::ID_STATICTEXT1 = wxNewId();
39const long MoveObject::ID_lblPosition = wxNewId();
40const long MoveObject::ID_STATICTEXT3 = wxNewId();
41const long MoveObject::ID_STATICTEXT4 = wxNewId();
42const long MoveObject::ID_STATICTEXT2 = wxNewId();
43const long MoveObject::ID_lblRotation = wxNewId();
44const long MoveObject::ID_STATICLINE2 = wxNewId();
45const long MoveObject::ID_rPosition = wxNewId();
46const long MoveObject::ID_rRotation = wxNewId();
47const long MoveObject::ID_STATICTEXT28 = wxNewId();
48const long MoveObject::ID_txtMoveSpeed = wxNewId();
49const long MoveObject::ID_bZPlus = wxNewId();
50const long MoveObject::ID_bYPlus = wxNewId();
51const long MoveObject::ID_bXNeg = wxNewId();
52const long MoveObject::ID_chkHold = wxNewId();
53const long MoveObject::ID_bXPlus = wxNewId();
54const long MoveObject::ID_bZNeg = wxNewId();
55const long MoveObject::ID_bYNeg = wxNewId();
56const long MoveObject::ID_STATICTEXT16 = wxNewId();
57const long MoveObject::ID_STATICTEXT21 = wxNewId();
58const long MoveObject::ID_txtPositionX = wxNewId();
59const long MoveObject::ID_bPositionX = wxNewId();
60const long MoveObject::ID_STATICTEXT22 = wxNewId();
61const long MoveObject::ID_txtPositionY = wxNewId();
62const long MoveObject::ID_bPositionY = wxNewId();
63const long MoveObject::ID_STATICTEXT23 = wxNewId();
64const long MoveObject::ID_txtPositionZ = wxNewId();
65const long MoveObject::ID_bPositionZ = wxNewId();
66const long MoveObject::ID_STATICLINE1 = wxNewId();
67const long MoveObject::ID_STATICTEXT27 = wxNewId();
68const long MoveObject::ID_STATICTEXT24 = wxNewId();
69const long MoveObject::ID_txtRotationX = wxNewId();
70const long MoveObject::ID_bRotationX = wxNewId();
71const long MoveObject::ID_STATICTEXT25 = wxNewId();
72const long MoveObject::ID_txtRotationY = wxNewId();
73const long MoveObject::ID_bRotationY = wxNewId();
74const long MoveObject::ID_STATICTEXT26 = wxNewId();
75const long MoveObject::ID_txtRotationZ = wxNewId();
76const long MoveObject::ID_bRotationZ = wxNewId();
77const long MoveObject::ID_STATICLINE3 = wxNewId();
78//*)
79
80BEGIN_EVENT_TABLE(MoveObject,wxDialog)
81//(*EventTable(MoveObject)
82//*)
83END_EVENT_TABLE()
84
85MoveObject::MoveObject(DebugPanel* root, wxWindow* parent,wxWindowID id, EngineContext *engine, int object_number)
86{
87 //(*Initialize(MoveObject)
88 wxFlexGridSizer* FlexGridSizer11;
89 wxFlexGridSizer* FlexGridSizer12;
90 wxFlexGridSizer* FlexGridSizer14;
91 wxFlexGridSizer* FlexGridSizer1;
92 wxFlexGridSizer* FlexGridSizer4;
93 wxFlexGridSizer* FlexGridSizer5;
94 wxFlexGridSizer* FlexGridSizer6;
95 wxFlexGridSizer* FlexGridSizer7;
96 wxFlexGridSizer* FlexGridSizer9;
97 wxGridSizer* GridSizer1;
98 wxStaticBoxSizer* StaticBoxSizer2;
99 wxStaticBoxSizer* StaticBoxSizer4;
100
101 Create(parent, wxID_ANY, _("Move Object"), wxDefaultPosition, wxDefaultSize, wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|wxMINIMIZE_BOX, _T("wxID_ANY"));
102 FlexGridSizer1 = new wxFlexGridSizer(2, 2, 0, 0);
103 FlexGridSizer9 = new wxFlexGridSizer(0, 1, 0, 0);
104 StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Control"));
105 FlexGridSizer5 = new wxFlexGridSizer(0, 1, 0, 0);
106 GridSizer1 = new wxGridSizer(0, 2, 0, 0);
107 StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Position:"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T("ID_STATICTEXT1"));
108 GridSizer1->Add(StaticText1, 1, wxALL|wxEXPAND, 5);
109 lblPosition = new wxStaticText(this, ID_lblPosition, _("0, 0, 0"), wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE|wxALIGN_CENTRE, _T("ID_lblPosition"));
110 GridSizer1->Add(lblPosition, 1, wxALL|wxEXPAND, 5);
111 StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("Relative Position:"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T("ID_STATICTEXT3"));
112 GridSizer1->Add(StaticText3, 1, wxALL|wxEXPAND, 5);
113 lblRelPosition = new wxStaticText(this, ID_STATICTEXT4, _("0, 0, 0"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T("ID_STATICTEXT4"));
114 GridSizer1->Add(lblRelPosition, 1, wxALL|wxEXPAND, 5);
115 StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Rotation:"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T("ID_STATICTEXT2"));
116 GridSizer1->Add(StaticText2, 1, wxALL|wxEXPAND, 5);
117 lblRotation = new wxStaticText(this, ID_lblRotation, _("0, 0, 0"), wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE|wxALIGN_CENTRE, _T("ID_lblRotation"));
118 GridSizer1->Add(lblRotation, 1, wxALL|wxEXPAND, 5);
119 FlexGridSizer5->Add(GridSizer1, 1, wxEXPAND, 5);
120 StaticLine2 = new wxStaticLine(this, ID_STATICLINE2, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE2"));
121 FlexGridSizer5->Add(StaticLine2, 1, wxBOTTOM|wxEXPAND, 5);
122 FlexGridSizer11 = new wxFlexGridSizer(0, 2, 0, 0);
123 rPosition = new wxRadioButton(this, ID_rPosition, _("Position"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_rPosition"));
124 rPosition->SetValue(true);
125 FlexGridSizer11->Add(rPosition, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
126 rRotation = new wxRadioButton(this, ID_rRotation, _("Rotation"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_rRotation"));
127 FlexGridSizer11->Add(rRotation, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
128 FlexGridSizer5->Add(FlexGridSizer11, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
129 FlexGridSizer14 = new wxFlexGridSizer(0, 2, 0, 0);
130 StaticText20 = new wxStaticText(this, ID_STATICTEXT28, _("Speed"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT28"));
131 FlexGridSizer14->Add(StaticText20, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
132 txtMoveSpeed = new wxTextCtrl(this, ID_txtMoveSpeed, _("1.0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_txtMoveSpeed"));
133 txtMoveSpeed->SetMinSize(wxSize(90,-1));
134 FlexGridSizer14->Add(txtMoveSpeed, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
135 FlexGridSizer5->Add(FlexGridSizer14, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
136 FlexGridSizer12 = new wxFlexGridSizer(0, 3, 0, 0);
137 FlexGridSizer12->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
138 bZPlus = new wxButton(this, ID_bZPlus, _("Z+"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_bZPlus"));
139 FlexGridSizer12->Add(bZPlus, 1, wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL, 5);
140 bYPlus = new wxButton(this, ID_bYPlus, _("Y+"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_bYPlus"));
141 FlexGridSizer12->Add(bYPlus, 1, wxBOTTOM|wxLEFT|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
142 bXNeg = new wxButton(this, ID_bXNeg, _("X-"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_bXNeg"));
143 FlexGridSizer12->Add(bXNeg, 1, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
144 chkHold = new wxCheckBox(this, ID_chkHold, _("Hold"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_chkHold"));
145 chkHold->SetValue(false);
146 FlexGridSizer12->Add(chkHold, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
147 bXPlus = new wxButton(this, ID_bXPlus, _("X+"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_bXPlus"));
148 FlexGridSizer12->Add(bXPlus, 1, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
149 FlexGridSizer12->Add(-1,-1,1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
150 bZNeg = new wxButton(this, ID_bZNeg, _("Z-"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_bZNeg"));
151 FlexGridSizer12->Add(bZNeg, 1, wxALIGN_TOP|wxALIGN_CENTER_HORIZONTAL, 5);
152 bYNeg = new wxButton(this, ID_bYNeg, _("Y-"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_bYNeg"));
153 FlexGridSizer12->Add(bYNeg, 1, wxTOP|wxLEFT|wxALIGN_LEFT|wxALIGN_TOP, 5);
154 FlexGridSizer5->Add(FlexGridSizer12, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
155 StaticBoxSizer2->Add(FlexGridSizer5, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
156 FlexGridSizer9->Add(StaticBoxSizer2, 1, wxTOP|wxRIGHT|wxALIGN_TOP|wxALIGN_CENTER_HORIZONTAL, 5);
157 StaticBoxSizer4 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Set"));
158 FlexGridSizer6 = new wxFlexGridSizer(0, 1, 0, 0);
159 StaticText16 = new wxStaticText(this, ID_STATICTEXT16, _("Position"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT16"));
160 FlexGridSizer6->Add(StaticText16, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
161 FlexGridSizer4 = new wxFlexGridSizer(0, 3, 0, 0);
162 StaticText22 = new wxStaticText(this, ID_STATICTEXT21, _("X:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT21"));
163 FlexGridSizer4->Add(StaticText22, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
164 txtPositionX = new wxTextCtrl(this, ID_txtPositionX, _("0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_txtPositionX"));
165 txtPositionX->SetMinSize(wxSize(90,-1));
166 FlexGridSizer4->Add(txtPositionX, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
167 bPositionX = new wxButton(this, ID_bPositionX, _("Set"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator, _T("ID_bPositionX"));
168 FlexGridSizer4->Add(bPositionX, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
169 StaticText23 = new wxStaticText(this, ID_STATICTEXT22, _("Y:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT22"));
170 FlexGridSizer4->Add(StaticText23, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
171 txtPositionY = new wxTextCtrl(this, ID_txtPositionY, _("0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_txtPositionY"));
172 txtPositionY->SetMinSize(wxSize(90,-1));
173 FlexGridSizer4->Add(txtPositionY, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
174 bPositionY = new wxButton(this, ID_bPositionY, _("Set"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator, _T("ID_bPositionY"));
175 FlexGridSizer4->Add(bPositionY, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
176 StaticText24 = new wxStaticText(this, ID_STATICTEXT23, _("Z:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT23"));
177 FlexGridSizer4->Add(StaticText24, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
178 txtPositionZ = new wxTextCtrl(this, ID_txtPositionZ, _("0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_txtPositionZ"));
179 txtPositionZ->SetMinSize(wxSize(90,-1));
180 FlexGridSizer4->Add(txtPositionZ, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
181 bPositionZ = new wxButton(this, ID_bPositionZ, _("Set"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator, _T("ID_bPositionZ"));
182 FlexGridSizer4->Add(bPositionZ, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
183 FlexGridSizer6->Add(FlexGridSizer4, 1, wxTOP|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
184 StaticLine1 = new wxStaticLine(this, ID_STATICLINE1, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE1"));
185 FlexGridSizer6->Add(StaticLine1, 1, wxTOP|wxEXPAND, 5);
186 StaticText28 = new wxStaticText(this, ID_STATICTEXT27, _("Rotation"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT27"));
187 FlexGridSizer6->Add(StaticText28, 1, wxTOP|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
188 FlexGridSizer7 = new wxFlexGridSizer(0, 3, 0, 0);
189 StaticText25 = new wxStaticText(this, ID_STATICTEXT24, _("X:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT24"));
190 FlexGridSizer7->Add(StaticText25, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
191 txtRotationX = new wxTextCtrl(this, ID_txtRotationX, _("0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_txtRotationX"));
192 txtRotationX->SetMinSize(wxSize(90,-1));
193 FlexGridSizer7->Add(txtRotationX, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
194 bRotationX = new wxButton(this, ID_bRotationX, _("Set"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator, _T("ID_bRotationX"));
195 FlexGridSizer7->Add(bRotationX, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
196 StaticText26 = new wxStaticText(this, ID_STATICTEXT25, _("Y:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT25"));
197 FlexGridSizer7->Add(StaticText26, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
198 txtRotationY = new wxTextCtrl(this, ID_txtRotationY, _("0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_txtRotationY"));
199 txtRotationY->SetMinSize(wxSize(90,-1));
200 FlexGridSizer7->Add(txtRotationY, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
201 bRotationY = new wxButton(this, ID_bRotationY, _("Set"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator, _T("ID_bRotationY"));
202 FlexGridSizer7->Add(bRotationY, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
203 StaticText27 = new wxStaticText(this, ID_STATICTEXT26, _("Z:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT26"));
204 FlexGridSizer7->Add(StaticText27, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
205 txtRotationZ = new wxTextCtrl(this, ID_txtRotationZ, _("0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_txtRotationZ"));
206 txtRotationZ->SetMinSize(wxSize(90,-1));
207 FlexGridSizer7->Add(txtRotationZ, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
208 bRotationZ = new wxButton(this, ID_bRotationZ, _("Set"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator, _T("ID_bRotationZ"));
209 FlexGridSizer7->Add(bRotationZ, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
210 FlexGridSizer6->Add(FlexGridSizer7, 1, wxTOP|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
211 StaticLine3 = new wxStaticLine(this, ID_STATICLINE3, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE3"));
212 FlexGridSizer6->Add(StaticLine3, 1, wxTOP|wxEXPAND, 5);
213 StaticBoxSizer4->Add(FlexGridSizer6, 1, wxBOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
214 FlexGridSizer9->Add(StaticBoxSizer4, 1, wxTOP|wxBOTTOM|wxALIGN_TOP|wxALIGN_CENTER_HORIZONTAL, 5);
215 FlexGridSizer1->Add(FlexGridSizer9, 1, wxALIGN_RIGHT|wxALIGN_TOP, 5);
216 SetSizer(FlexGridSizer1);
217 FlexGridSizer1->Fit(this);
218 FlexGridSizer1->SetSizeHints(this);
219 Center();
220
221 Connect(ID_rPosition,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&MoveObject::On_rPosition_Select);
222 Connect(ID_rRotation,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&MoveObject::On_rRotation_Select);
223 Connect(ID_bZPlus,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MoveObject::On_bZPlus_Click);
224 Connect(ID_bYPlus,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MoveObject::On_bYPlus_Click);
225 Connect(ID_bXNeg,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MoveObject::On_bXNeg_Click);
226 Connect(ID_chkHold,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&MoveObject::On_chkHold_Click);
227 Connect(ID_bXPlus,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MoveObject::On_bXPlus_Click);
228 Connect(ID_bZNeg,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MoveObject::On_bZNeg_Click);
229 Connect(ID_bYNeg,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MoveObject::On_bYNeg_Click);
230 Connect(ID_bPositionX,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MoveObject::On_bPositionX_Click);
231 Connect(ID_bPositionY,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MoveObject::On_bPositionY_Click);
232 Connect(ID_bPositionZ,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MoveObject::On_bPositionZ_Click);
233 Connect(ID_bRotationX,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MoveObject::On_bRotationX_Click);
234 Connect(ID_bRotationY,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MoveObject::On_bRotationY_Click);
235 Connect(ID_bRotationZ,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&MoveObject::On_bRotationZ_Click);
236 //*)
237 object_num = object_number;
238 object = 0;
239 Simcore = 0;
240 this->engine = engine;
241 panel = root;
242 OnInit();
243}
244
249
251{
252 if (!engine)
253 return;
254
256 hold_vector = Vector3(0, 0, 0);
257}
258
260{
261 if (!engine)
262 return;
263
264 //validate engine
265 if (panel->GetRoot()->IsValidEngine(engine) == false)
266 {
267 engine = 0;
268 Simcore = 0;
269 Close();
270 return;
271 }
272
274
275 if (!Simcore)
276 return;
277
278 object = Simcore->GetObject(object_num);
279
280 if (object)
281 {
282 Vector3 pos = object->GetPosition();
283 Vector3 relpos = object->GetPosition(true);
284 Vector3 rot = object->GetRotation();
285 lblPosition->SetLabel(TruncateNumber(pos.x, 2) + wxT(", ") + TruncateNumber(pos.y, 2) + wxT(", ") + TruncateNumber(pos.z, 2));
286 lblRelPosition->SetLabel(TruncateNumber(relpos.x, 2) + wxT(", ") + TruncateNumber(relpos.y, 2) + wxT(", ") + TruncateNumber(relpos.z, 2));
287 lblRotation->SetLabel(TruncateNumber(rot.x, 2) + wxT(", ") + TruncateNumber(rot.y, 2) + wxT(", ") + TruncateNumber(rot.z, 2));
288
289 //move if hold vector is not zero
290 if (hold_vector != Vector3(0, 0, 0))
291 {
292 if (rPosition->GetValue() == true)
293 Simcore->MoveObject(object, hold_vector, true, true, true, true);
294 else
295 Simcore->RotateObject(object, hold_vector, 1, true, true, true, true);
296 }
297 }
298 else
299 Close();
300}
301
302void MoveObject::On_rPosition_Select(wxCommandEvent& event)
303{
304
305}
306
307void MoveObject::On_rRotation_Select(wxCommandEvent& event)
308{
309
310}
311
312void MoveObject::On_bZPlus_Click(wxCommandEvent& event)
313{
314 if (!Simcore)
315 return;
316
317 if (chkHold->GetValue() == true)
318 {
319 hold_vector += Vector3(0, 0, atof(txtMoveSpeed->GetValue()));
320 return;
321 }
322
323 if (rPosition->GetValue() == true)
324 Simcore->MoveObject(object, Vector3(0, 0, 1) * atof(txtMoveSpeed->GetValue()), true, true, true, true);
325 else
326 Simcore->RotateObject(object, Vector3(0, 0, 1), atof(txtMoveSpeed->GetValue()), true, true, true, true);
327}
328
329void MoveObject::On_bYPlus_Click(wxCommandEvent& event)
330{
331 if (!Simcore)
332 return;
333
334 if (chkHold->GetValue() == true)
335 {
336 hold_vector += Vector3(0, atof(txtMoveSpeed->GetValue()), 0);
337 return;
338 }
339
340 if (rPosition->GetValue() == true)
341 Simcore->MoveObject(object, Vector3(0, 1, 0) * atof(txtMoveSpeed->GetValue()), true, true, true, true);
342 else
343 Simcore->RotateObject(object, Vector3(0, 1, 0), atof(txtMoveSpeed->GetValue()), true, true, true, true);
344}
345
346void MoveObject::On_bXNeg_Click(wxCommandEvent& event)
347{
348 if (!Simcore)
349 return;
350
351 if (chkHold->GetValue() == true)
352 {
353 hold_vector -= Vector3(atof(txtMoveSpeed->GetValue()), 0, 0);
354 return;
355 }
356
357 if (rPosition->GetValue() == true)
358 Simcore->MoveObject(object, Vector3(-1, 0, 0) * atof(txtMoveSpeed->GetValue()), true, true, true, true);
359 else
360 Simcore->RotateObject(object, Vector3(-1, 0, 0), atof(txtMoveSpeed->GetValue()), true, true, true, true);
361}
362
363void MoveObject::On_bXPlus_Click(wxCommandEvent& event)
364{
365 if (!Simcore)
366 return;
367
368 if (chkHold->GetValue() == true)
369 {
370 hold_vector += Vector3(atof(txtMoveSpeed->GetValue()), 0, 0);
371 return;
372 }
373
374 if (rPosition->GetValue() == true)
375 Simcore->MoveObject(object, Vector3(1, 0, 0) * atof(txtMoveSpeed->GetValue()), true, true, true, true);
376 else
377 Simcore->RotateObject(object, Vector3(1, 0, 0), atof(txtMoveSpeed->GetValue()), true, true, true, true);
378}
379
380void MoveObject::On_bZNeg_Click(wxCommandEvent& event)
381{
382 if (!Simcore)
383 return;
384
385 if (chkHold->GetValue() == true)
386 {
387 hold_vector -= Vector3(0, 0, atof(txtMoveSpeed->GetValue()));
388 return;
389 }
390
391 if (rPosition->GetValue() == true)
392 Simcore->MoveObject(object, Vector3(0, 0, -1) * atof(txtMoveSpeed->GetValue()), true, true, true, true);
393 else
394 Simcore->RotateObject(object, Vector3(0, 0, -1), atof(txtMoveSpeed->GetValue()), true, true, true, true);
395}
396
397void MoveObject::On_bYNeg_Click(wxCommandEvent& event)
398{
399 if (!Simcore)
400 return;
401
402 if (chkHold->GetValue() == true)
403 {
404 hold_vector -= Vector3(0, atof(txtMoveSpeed->GetValue()), 0);
405 return;
406 }
407
408 if (rPosition->GetValue() == true)
409 Simcore->MoveObject(object, Vector3(0, -1, 0) * atof(txtMoveSpeed->GetValue()), true, true, true, true);
410 else
411 Simcore->RotateObject(object, Vector3(0, -1, 0), atof(txtMoveSpeed->GetValue()), true, true, true, true);
412}
413
414void MoveObject::On_bPositionX_Click(wxCommandEvent& event)
415{
416 if (Simcore)
417 Simcore->MoveObject(object, Vector3(atof(txtPositionX->GetValue()), 0.0, 0.0), false, true, false, false);
418}
419
420void MoveObject::On_bPositionY_Click(wxCommandEvent& event)
421{
422 if (Simcore)
423 Simcore->MoveObject(object, Vector3(0.0, atof(txtPositionY->GetValue()), 0.0), false, false, true, false);
424}
425
426void MoveObject::On_bPositionZ_Click(wxCommandEvent& event)
427{
428 if (Simcore)
429 Simcore->MoveObject(object, Vector3(0.0, 0.0, atof(txtPositionZ->GetValue())), false, false, false, true);
430}
431
432void MoveObject::On_bRotationX_Click(wxCommandEvent& event)
433{
434 if (Simcore)
435 Simcore->RotateObject(object, Vector3(atof(txtRotationX->GetValue()), 0.0, 0.0), 0, false, true, false, false);
436}
437
438void MoveObject::On_bRotationY_Click(wxCommandEvent& event)
439{
440 if (Simcore)
441 Simcore->RotateObject(object, Vector3(0.0, atof(txtRotationY->GetValue()), 0.0), 0, false, false, true, false);
442}
443
444void MoveObject::On_bRotationZ_Click(wxCommandEvent& event)
445{
446 if (Simcore)
447 Simcore->RotateObject(object, Vector3(0.0, 0.0, atof(txtRotationZ->GetValue())), 0, false, false, false, true);
448}
449
450void MoveObject::On_chkHold_Click(wxCommandEvent& event)
451{
452 if (chkHold->GetValue() == false)
453 hold_vector = Vector3(0, 0, 0);
454}
455
456}
virtual Vector3 GetPosition(bool relative=false)
Definition object.cpp:321
bool MoveObject(Object *object, Vector3 position, bool relative, bool X, bool Y, bool Z)
Definition sbs.cpp:2724
bool RotateObject(Object *object, Vector3 rotation, Real speed, bool relative, bool X, bool Y, bool Z)
Definition sbs.cpp:2749
Object * GetObject(int number)
Definition sbs.cpp:2452
static const long ID_STATICTEXT24
Definition moveobject.h:77
void On_bRotationX_Click(wxCommandEvent &event)
static const long ID_chkHold
Definition moveobject.h:61
static const long ID_txtRotationZ
Definition moveobject.h:84
static const long ID_txtMoveSpeed
Definition moveobject.h:57
static const long ID_txtRotationX
Definition moveobject.h:78
static const long ID_bRotationZ
Definition moveobject.h:85
static const long ID_bPositionX
Definition moveobject.h:68
void On_rPosition_Select(wxCommandEvent &event)
void On_bRotationZ_Click(wxCommandEvent &event)
void On_bXPlus_Click(wxCommandEvent &event)
static const long ID_txtPositionZ
Definition moveobject.h:73
wxStaticText * lblRelPosition
Definition moveobject.h:157
static const long ID_rRotation
Definition moveobject.h:55
static const long ID_STATICTEXT27
Definition moveobject.h:76
static const long ID_STATICTEXT3
Definition moveobject.h:49
static const long ID_txtRotationY
Definition moveobject.h:81
wxTextCtrl * txtPositionX
Definition moveobject.h:160
static const long ID_STATICTEXT28
Definition moveobject.h:56
void On_bPositionX_Click(wxCommandEvent &event)
void On_bYNeg_Click(wxCommandEvent &event)
static const long ID_bXPlus
Definition moveobject.h:62
void On_bPositionZ_Click(wxCommandEvent &event)
EngineContext * engine
Definition moveobject.h:174
wxTextCtrl * txtPositionZ
Definition moveobject.h:162
static const long ID_bPositionY
Definition moveobject.h:71
void On_bXNeg_Click(wxCommandEvent &event)
static const long ID_bRotationX
Definition moveobject.h:79
void On_bRotationY_Click(wxCommandEvent &event)
static const long ID_lblPosition
Definition moveobject.h:48
static const long ID_bYNeg
Definition moveobject.h:64
wxTextCtrl * txtRotationX
Definition moveobject.h:163
static const long ID_STATICTEXT4
Definition moveobject.h:50
void On_chkHold_Click(wxCommandEvent &event)
static const long ID_STATICTEXT2
Definition moveobject.h:51
void On_bYPlus_Click(wxCommandEvent &event)
static const long ID_bZPlus
Definition moveobject.h:58
static const long ID_STATICLINE2
Definition moveobject.h:53
wxTextCtrl * txtPositionY
Definition moveobject.h:161
static const long ID_lblRotation
Definition moveobject.h:52
static const long ID_STATICTEXT25
Definition moveobject.h:80
void On_bZNeg_Click(wxCommandEvent &event)
static const long ID_bRotationY
Definition moveobject.h:82
wxRadioButton * rPosition
Definition moveobject.h:139
static const long ID_bXNeg
Definition moveobject.h:60
static const long ID_bYPlus
Definition moveobject.h:59
static const long ID_txtPositionX
Definition moveobject.h:67
static const long ID_STATICTEXT1
Definition moveobject.h:47
static const long ID_STATICTEXT22
Definition moveobject.h:69
void On_bPositionY_Click(wxCommandEvent &event)
wxTextCtrl * txtRotationY
Definition moveobject.h:164
static const long ID_bZNeg
Definition moveobject.h:63
static const long ID_STATICTEXT23
Definition moveobject.h:72
static const long ID_rPosition
Definition moveobject.h:54
static const long ID_bPositionZ
Definition moveobject.h:74
static const long ID_STATICTEXT21
Definition moveobject.h:66
wxStaticText * lblPosition
Definition moveobject.h:156
static const long ID_STATICLINE1
Definition moveobject.h:75
void On_bZPlus_Click(wxCommandEvent &event)
static const long ID_STATICLINE3
Definition moveobject.h:86
wxStaticText * lblRotation
Definition moveobject.h:158
static const long ID_txtPositionY
Definition moveobject.h:70
wxTextCtrl * txtMoveSpeed
Definition moveobject.h:159
wxTextCtrl * txtRotationZ
Definition moveobject.h:165
static const long ID_STATICTEXT16
Definition moveobject.h:65
void On_rRotation_Select(wxCommandEvent &event)
static const long ID_STATICTEXT26
Definition moveobject.h:83
bool IsValidEngine(EngineContext *engine)
Definition vm.cpp:506
Ogre::Vector3 Vector3
Definition globals.h:58
wxString TruncateNumber(float value, int decimals)