git-svn-id: https://scorched3d.svn.sourceforge.net/svnroot/scorched3d/trunk/scorched...
[scorched3d/parasti.git] / src / launcher / wxdialogs / display.cpp
blob7f67b682d0af8f348c920cdb754e687856cbc177
1 ////////////////////////////////////////////////////////////////////////////////
2 // Scorched3D (c) 2000-2003
3 //
4 // This file is part of Scorched3D.
5 //
6 // Scorched3D 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 2 of the License, or
9 // (at your option) any later version.
11 // Scorched3D 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.
16 // You should have received a copy of the GNU General Public License
17 // along with Scorched3D; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ////////////////////////////////////////////////////////////////////////////////
21 #include "Display-def.cpp"
23 static void createMainControls(wxWindow *parent, wxSizer *sizer)
26 // Display settings
27 wxStaticBox *displayBox = new wxStaticBox(parent, -1, wxT("&Display"));
28 wxStaticBoxSizer *displaySizer = new wxStaticBoxSizer(displayBox, wxVERTICAL);
29 wxFlexGridSizer *displaySizer2 = new wxFlexGridSizer(2, 3, 5, 5);
30 wxStaticText *resText = new wxStaticText(parent, -1, wxT("&Resolution :"));
31 IDC_DISPLAY_CTRL =
32 new wxComboBox(parent, -1,
33 wxT(""),
34 wxDefaultPosition, wxSize(315, -1),
35 0, 0, wxCB_READONLY);
36 IDC_FULLSCREEN_CTRL =
37 new wxCheckBox(parent, -1, wxT("Full Screen"));
38 IDC_MORERES_CTRL =
39 new wxCheckBox(parent, ID_MORERES, wxT("More Resolutions"));
40 displaySizer2->Add(resText, 0, wxALIGN_CENTER_VERTICAL);
41 displaySizer2->Add(IDC_DISPLAY_CTRL, 0);
42 displaySizer2->Add(IDC_FULLSCREEN_CTRL, 0, wxALIGN_CENTRE_VERTICAL);
43 wxStaticText *brightText = new wxStaticText(parent, -1, wxT("&Brightness :"));
44 IDC_SLIDER1_CTRL =
45 new wxSlider(parent, -1,
46 0,0,0,
47 wxDefaultPosition, wxSize(315, -1),
48 wxSL_HORIZONTAL | wxSL_AUTOTICKS);
49 displaySizer2->Add(brightText, 0, wxALIGN_CENTER_VERTICAL);
50 displaySizer2->Add(IDC_SLIDER1_CTRL, 0);
51 displaySizer2->Add(IDC_MORERES_CTRL, 0, wxALIGN_CENTRE_VERTICAL);
52 displaySizer->Add(displaySizer2, 0);
54 wxFlexGridSizer *displaySizer3 = new wxFlexGridSizer(1, 7, 5, 5);
56 displaySizer3->Add(new wxStaticText(parent, -1, wxT("&Dialog/Font Sizes :")));
57 IDC_TINYDIALOGS_CTRL = new wxRadioButton(parent, -1, wxT("Tiny"),
58 wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
59 IDC_SMALLDIALOGS_CTRL = new wxRadioButton(parent, -1, wxT("Small"));
60 IDC_MEDIUMDIALOGS_CTRL = new wxRadioButton(parent, -1, wxT("Medium"));
61 IDC_LARGEDIALOGS_CTRL = new wxRadioButton(parent, -1, wxT("Large"));
62 wxStaticText *frameLimitText = new wxStaticText(parent, -1, wxT(" Limit Framerate :"));
63 IDC_FRAMELIMIT_CTRL =
64 new wxTextCtrl(parent, -1, wxString(), wxDefaultPosition, wxSize(60, -1));
65 displaySizer3->Add(IDC_TINYDIALOGS_CTRL);
66 displaySizer3->Add(IDC_SMALLDIALOGS_CTRL);
67 displaySizer3->Add(IDC_MEDIUMDIALOGS_CTRL);
68 displaySizer3->Add(IDC_LARGEDIALOGS_CTRL);
69 displaySizer3->Add(frameLimitText, -1, wxALIGN_CENTRE_VERTICAL);
70 displaySizer3->Add(IDC_FRAMELIMIT_CTRL);
71 displaySizer->Add(displaySizer3, 0, wxTOP | wxBOTTOM, 10);
72 sizer->Add(displaySizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
74 wxStaticText *aliasText = new wxStaticText(parent, -1, wxT("Anti Aliasing :"));
75 displaySizer2->Add(aliasText, 0);
76 IDC_ANTIALIAS_CTRL = new wxComboBox(parent, -1,
77 wxT(""),
78 wxDefaultPosition, wxSize(60, -1),
79 0, 0, wxCB_READONLY);
80 displaySizer2->Add(IDC_ANTIALIAS_CTRL, 0);
81 IDC_FOCUSPAUSE_CTRL =
82 new wxCheckBox(parent, -1, wxT("Pause graphics when not focused"));
83 displaySizer2->Add(IDC_FOCUSPAUSE_CTRL, 0);
88 // Sound settings
89 wxStaticBox *soundBox = new wxStaticBox(parent, -1, wxT("&Sound"));
90 wxStaticBoxSizer *soundSizerMain = new wxStaticBoxSizer(soundBox, wxVERTICAL);
91 wxFlexGridSizer *soundSizer1 = new wxFlexGridSizer(4, 2);
92 wxStaticText *volumeText = new wxStaticText(parent, -1, wxT("Sound Volume :"));
93 wxStaticText *musicVolumeText = new wxStaticText(parent, -1, wxT("Music Volume :"));
94 wxStaticText *ambientVolumeText = new wxStaticText(parent, -1, wxT("Ambient Volume :"));
95 IDC_VOLUME_CTRL =
96 new wxSlider(parent, -1,
97 0,0,0,
98 wxDefaultPosition, wxSize(315, -1),
99 wxSL_HORIZONTAL | wxSL_AUTOTICKS);
100 IDC_SOUNDCHANNELS_CTRL =
101 new wxComboBox(parent, -1,
102 wxT(""),
103 wxDefaultPosition, wxSize(55, -1),
104 0, 0, wxCB_READONLY);
105 IDC_MUSICVOLUME_CTRL =
106 new wxSlider(parent, -1,
107 0,0,0,
108 wxDefaultPosition, wxSize(315, -1),
109 wxSL_HORIZONTAL | wxSL_AUTOTICKS);
110 IDC_AMBIENTVOLUME_CTRL =
111 new wxSlider(parent, -1,
112 0,0,0,
113 wxDefaultPosition, wxSize(315, -1),
114 wxSL_HORIZONTAL | wxSL_AUTOTICKS);
115 IDC_NOSOUND_CTRL =
116 new wxCheckBox(parent, -1, wxT("No Sound"));
117 IDC_NOMUSIC_CTRL =
118 new wxCheckBox(parent, -1, wxT("No Music"));
119 soundSizer1->Add(volumeText, 0, wxRIGHT, 10);
120 soundSizer1->Add(IDC_VOLUME_CTRL, 0, wxRIGHT, 10);
121 soundSizer1->Add(IDC_SOUNDCHANNELS_CTRL, 0, wxRIGHT, 5);
122 soundSizer1->Add(new wxStaticText(parent, -1, wxT("Channels")), 0, wxALIGN_CENTRE_VERTICAL);
123 soundSizer1->Add(ambientVolumeText, 0, wxRIGHT, 10);
124 soundSizer1->Add(IDC_AMBIENTVOLUME_CTRL, 0, wxRIGHT, 10);
125 soundSizer1->Add(IDC_NOSOUND_CTRL, 0, wxRIGHT, 0);
126 soundSizer1->Add(new wxStaticText(parent, -1, wxT("")), 0, wxRIGHT, 0);
127 soundSizer1->Add(musicVolumeText, 0, wxRIGHT, 10);
128 soundSizer1->Add(IDC_MUSICVOLUME_CTRL, 0, wxRIGHT, 10);
129 soundSizer1->Add(IDC_NOMUSIC_CTRL, 0, wxRIGHT, 0);
130 soundSizerMain->Add(soundSizer1, 0, wxGROW | wxTOP, 5);
131 sizer->Add(soundSizerMain, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
135 // Load settings
136 wxStaticBox *speedBox = new wxStaticBox(parent, -1,
137 wxT("Game Speed Options"));
138 wxStaticBoxSizer *speedSizer = new wxStaticBoxSizer(speedBox, wxHORIZONTAL);
140 wxGridSizer *loadSizer = new wxFlexGridSizer(2, 2);
141 IDC_LOADDEFAULTS_CTRL = new wxButton(parent, ID_LOADDEFAULTS, wxT("&Normal Settings"), wxDefaultPosition, wxSize(120,-1));
142 IDC_LOADMEDIUM_CTRL = new wxButton(parent, ID_LOADMEDIUM, wxT("Faster Settings"), wxDefaultPosition, wxSize(120,-1));
143 IDC_LOADFASTEST_CTRL = new wxButton(parent, ID_LOADFASTEST, wxT("Fastest Settings"), wxDefaultPosition, wxSize(120,-1));
144 IDC_LOADSAFE_CTRL = new wxButton(parent, ID_LOADSAFE, wxT("Safe Options"), wxDefaultPosition, wxSize(120,-1));
145 loadSizer->Add(IDC_LOADDEFAULTS_CTRL, 0, wxALL, 2);
146 loadSizer->Add(new wxStaticText(parent, -1, wxT("Load the normal starting settings for Scorched3D. (FAST machines)")),
147 0, wxALL, 2);
148 loadSizer->Add(IDC_LOADMEDIUM_CTRL, 0, wxALL, 2);
149 loadSizer->Add(new wxStaticText(parent, -1, wxT("Load a faster set of settings for Scorched3D. (MEDIUM machines)\n"
150 "Note: This will result in a slightly reduced graphical experience.")),
151 0, wxALL, 2);
152 loadSizer->Add(IDC_LOADFASTEST_CTRL, 0, wxALL, 2);
153 loadSizer->Add(new wxStaticText(parent, -1, wxT("Load the fastest settings for Scorched3D. (SLOW machines)\n"
154 "Note: This will result in a greatly reduced graphical and audio experience.")),
155 0, wxALL, 2);
156 loadSizer->Add(IDC_LOADSAFE_CTRL, 0, wxALL, 2);
157 loadSizer->Add(new wxStaticText(parent, -1, wxT("Load the safest settings for Scorched3D.\n"
158 "Note: This will result in a greatly reduced overall experience but may prevent crashes.")),
159 0, wxALL, 2);
161 speedSizer->Add(loadSizer, 0, wxGROW);
162 sizer->Add(speedSizer, 0, wxGROW | wxTOP | wxALIGN_CENTER, 5);
166 static void createOtherControls(wxWindow *parent, wxSizer *sizer)
169 // Misc switches
170 wxStaticBox *miscBox = new wxStaticBox(parent, -1,
171 wxT("Misc. Options"));
172 wxStaticBoxSizer *miscSizer = new wxStaticBoxSizer(miscBox, wxHORIZONTAL);
173 wxGridSizer *miscSizer2 = new wxGridSizer(3, 3, 10, 10);
174 IDC_INVERT_CTRL =
175 new wxCheckBox(parent, -1, wxT("Invert key elevation"));
176 miscSizer2->Add(IDC_INVERT_CTRL, 0);
177 IDC_INVERTMOUSE_CTRL =
178 new wxCheckBox(parent, -1, wxT("Invert mouse elevation"));
179 miscSizer2->Add(IDC_INVERTMOUSE_CTRL, 0);
180 //IDC_SWAPYAXIS_CTRL =
181 // new wxCheckBox(parent, -1, wxT("Invert mouse y axis (OS X)"));
182 //miscSizer2->Add(IDC_SWAPYAXIS_CTRL, 0);
183 IDC_TIMER_CTRL =
184 new wxCheckBox(parent, -1, wxT("Show frames per second"));
185 miscSizer2->Add(IDC_TIMER_CTRL, 0);
186 IDC_SMOUSE_CTRL =
187 new wxCheckBox(parent, -1, wxT("Software Mouse"));
188 miscSizer2->Add(IDC_SMOUSE_CTRL, 0);
189 IDC_VALIDATESERVER_CTRL =
190 new wxCheckBox(parent, -1, wxT("Validate Server Ip"));
191 miscSizer2->Add(IDC_VALIDATESERVER_CTRL, 0);
192 IDC_SIDESCROLL_CTRL =
193 new wxCheckBox(parent, -1, wxT("Side Scrolling"));
194 miscSizer2->Add(IDC_SIDESCROLL_CTRL, 0);
195 IDC_PLAYERCAMERA_CTRL =
196 new wxCheckBox(parent, -1, wxT("Remember camera pos"));
197 miscSizer2->Add(IDC_PLAYERCAMERA_CTRL, 0);
198 IDC_LOGGING_CTRL =
199 new wxCheckBox(parent, -1, wxT("Client Logging"));
200 miscSizer2->Add(IDC_LOGGING_CTRL, 0);
201 miscSizer->Add(miscSizer2, 0, wxGROW);
202 sizer->Add(miscSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
206 static void createTroubleControls(wxWindow *parent, wxSizer *sizer)
208 // Texture sizes (small med large)
209 wxStaticBox *textureBox = new wxStaticBox(parent, -1, wxT("Level of Detail settings"));
210 wxStaticBoxSizer *textureSizer = new wxStaticBoxSizer(textureBox, wxHORIZONTAL);
211 wxGridSizer *textureSizer2 = new wxGridSizer(3, 4, 10, 10);
212 wxStaticText *texSizeText = new wxStaticText(parent, -1, wxT("Texture Sizes :"));
213 textureSizer2->Add(texSizeText, 0, wxALIGN_CENTER_VERTICAL);
214 IDC_SMALLTEX_CTRL = new wxRadioButton(parent, -1, wxT("Small (3dfx/faster)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
215 textureSizer2->Add(IDC_SMALLTEX_CTRL, 0);
216 IDC_MEDIUMTEX_CTRL = new wxRadioButton(parent, -1, wxT("Medium"));
217 textureSizer2->Add(IDC_MEDIUMTEX_CTRL, 0);
218 IDC_LARGETEX_CTRL = new wxRadioButton(parent, -1, wxT("Large (slower)"));
219 textureSizer2->Add(IDC_LARGETEX_CTRL, 0);
220 wxStaticText *tankSizeText = new wxStaticText(parent, -1, wxT("Tank Detail :"));
221 textureSizer2->Add(tankSizeText, 0, wxALIGN_CENTER_VERTICAL);
222 IDC_LOWTANK_CTRL = new wxRadioButton(parent, -1, wxT("Low (faster)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
223 textureSizer2->Add(IDC_LOWTANK_CTRL, 0);
224 IDC_MEDIUMTANK_CTRL = new wxRadioButton(parent, -1, wxT("Medium"));
225 textureSizer2->Add(IDC_MEDIUMTANK_CTRL, 0);
226 IDC_HIGHTANK_CTRL = new wxRadioButton(parent, -1, wxT("Max (slower)"));
227 textureSizer2->Add(IDC_HIGHTANK_CTRL, 0);
228 wxStaticText *effectSizeText = new wxStaticText(parent, -1, wxT("Effects Detail :"));
229 textureSizer2->Add(effectSizeText, 0, wxALIGN_CENTER_VERTICAL);
230 IDC_LOWEFFECTS_CTRL = new wxRadioButton(parent, -1, wxT("Low (faster)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
231 textureSizer2->Add(IDC_LOWEFFECTS_CTRL, 0);
232 IDC_MEDIUMEFFECTS_CTRL = new wxRadioButton(parent, -1, wxT("Medium"));
233 textureSizer2->Add(IDC_MEDIUMEFFECTS_CTRL, 0);
234 IDC_HIGHEFFECTS_CTRL = new wxRadioButton(parent, -1, wxT("High (slower)"));
235 textureSizer2->Add(IDC_HIGHEFFECTS_CTRL, 0);
236 textureSizer->Add(textureSizer2, 0, wxGROW);
237 sizer->Add(textureSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
239 // Detail switches
241 wxStaticBox *waterDetailBox = new wxStaticBox(parent, -1,
242 wxT("Graphics Detail"));
243 wxStaticBoxSizer *waterDetailSizer = new wxStaticBoxSizer(waterDetailBox, wxHORIZONTAL);
244 wxGridSizer *waterDetailSizer2 = new wxGridSizer(3, 1, 10, 10);
246 IDC_NOWATERREF_CTRL =
247 new wxCheckBox(parent, -1, wxT("Don't draw water reflections - Large Framerate Improvement"));
248 waterDetailSizer2->Add(IDC_NOWATERREF_CTRL, 0);
249 IDC_NOWATERMOVEMENT_CTRL =
250 new wxCheckBox(parent, -1, wxT("Don't draw water movement - Large Framerate Improvement"));
251 waterDetailSizer2->Add(IDC_NOWATERMOVEMENT_CTRL, 0);
252 IDC_NOWATER_CTRL =
253 new wxCheckBox(parent, -1, wxT("Don't draw water - Large Framerate Improvement"));
254 waterDetailSizer2->Add(IDC_NOWATER_CTRL, 0);
255 IDC_NOWATERWAVES_CTRL =
256 new wxCheckBox(parent, -1, wxT("Don't draw water breakers - Small Loading Speed Improvement"));
257 waterDetailSizer2->Add(IDC_NOWATERWAVES_CTRL, 0);
258 IDC_NOWATERLOD_CTRL =
259 new wxCheckBox(parent, -1, wxT("Draw simplistic water - Medium Framerate Improvement"));
260 waterDetailSizer2->Add(IDC_NOWATERLOD_CTRL, 0);
261 IDC_NOSHADERS_CTRL =
262 new wxCheckBox(parent, -1, wxT("No GL shaders - Large Framerate Improvement"));
263 waterDetailSizer2->Add(IDC_NOSHADERS_CTRL, 0);
264 IDC_NOOBJECTSHADOWS_CTRL =
265 new wxCheckBox(parent, -1, wxT("No GL shadows for objects - Medium Framerate Improvement"));
266 waterDetailSizer2->Add(IDC_NOOBJECTSHADOWS_CTRL, 0);
267 IDC_NOSHADOWS_CTRL =
268 new wxCheckBox(parent, -1, wxT("No GL shadows - Large Framerate Improvement"));
269 waterDetailSizer2->Add(IDC_NOSHADOWS_CTRL, 0);
271 waterDetailSizer->Add(waterDetailSizer2, 0, wxGROW);
272 sizer->Add(waterDetailSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
275 // Graphics Settings
277 wxStaticBox *glDetailBox = new wxStaticBox(parent, -1,
278 wxT("Compatability Settings"));
279 wxStaticBoxSizer *glDetailSizer = new wxStaticBoxSizer(glDetailBox, wxHORIZONTAL);
280 wxGridSizer *glDetailSizer2 = new wxGridSizer(3, 3, 10, 10);
282 IDC_NOEXT_CTRL =
283 new wxCheckBox(parent, -1, wxT("No GL Extensions"));
284 glDetailSizer2->Add(IDC_NOEXT_CTRL, 0);
285 IDC_NOMULTITEX_CTRL =
286 new wxCheckBox(parent, -1, wxT("No multi texture"));
287 glDetailSizer2->Add(IDC_NOMULTITEX_CTRL, 0);
288 IDC_NOLANDSCAPESCORCH_CTRL =
289 new wxCheckBox(parent, -1, wxT("No TexSubImaging"));
290 glDetailSizer2->Add(IDC_NOLANDSCAPESCORCH_CTRL, 0);
291 IDC_NOCOMPILEDARRAYS_CTRL =
292 new wxCheckBox(parent, -1, wxT("No compiled arrays"));
293 glDetailSizer2->Add(IDC_NOCOMPILEDARRAYS_CTRL, 0);
294 IDC_NOENVCOMBINE_CTRL =
295 new wxCheckBox(parent, -1, wxT("No combined textures"));
296 glDetailSizer2->Add(IDC_NOENVCOMBINE_CTRL, 0);
297 IDC_NOCUBEMAP_CTRL =
298 new wxCheckBox(parent, -1, wxT("No cube map"));
299 glDetailSizer2->Add(IDC_NOCUBEMAP_CTRL, 0);
300 IDC_NOSPHEREMAP_CTRL =
301 new wxCheckBox(parent, -1, wxT("No sphere map"));
302 glDetailSizer2->Add(IDC_NOSPHEREMAP_CTRL, 0);
303 IDC_NOMIPMAPS_CTRL =
304 new wxCheckBox(parent, -1, wxT("No HW mip maps"));
305 glDetailSizer2->Add(IDC_NOMIPMAPS_CTRL, 0);
306 IDC_NOVBO_CTRL =
307 new wxCheckBox(parent, -1, wxT("No VBO"));
308 glDetailSizer2->Add(IDC_NOVBO_CTRL, 0);
310 glDetailSizer->Add(glDetailSizer2, 0, wxGROW);
311 sizer->Add(glDetailSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
315 wxStaticBox *miscDetailBox = new wxStaticBox(parent, -1,
316 wxT("Misc Detail"));
317 wxStaticBoxSizer *miscDetailSizer = new wxStaticBoxSizer(miscDetailBox, wxHORIZONTAL);
318 wxGridSizer *miscDetailSizer2 = new wxGridSizer(3, 3, 10, 10);
320 IDC_NODETAILTEX_CTRL =
321 new wxCheckBox(parent, -1, wxT("Don't use detail textures"));
322 miscDetailSizer2->Add(IDC_NODETAILTEX_CTRL, 0);
323 IDC_NOSURROUND_CTRL =
324 new wxCheckBox(parent, -1, wxT("Don't draw surround"));
325 miscDetailSizer2->Add(IDC_NOSURROUND_CTRL, 0);
326 IDC_SINGLESKYLAYER_CTRL =
327 new wxCheckBox(parent, -1, wxT("Single sky layer"));
328 miscDetailSizer2->Add(IDC_SINGLESKYLAYER_CTRL, 0);
329 IDC_NOSKYANI_CTRL =
330 new wxCheckBox(parent, -1, wxT("Don't animate sky"));
331 miscDetailSizer2->Add(IDC_NOSKYANI_CTRL, 0);
332 IDC_NOSKINS_CTRL =
333 new wxCheckBox(parent, -1, wxT("No model skins"));
334 miscDetailSizer2->Add(IDC_NOSKINS_CTRL, 0);
335 IDC_NODYNAMICLIGHT_CTRL =
336 new wxCheckBox(parent, -1, wxT("No model dynamic lighting"));
337 miscDetailSizer2->Add(IDC_NODYNAMICLIGHT_CTRL, 0);
338 IDC_NOPRECIPITATION_CTRL =
339 new wxCheckBox(parent, -1, wxT("No precipitation"));
340 miscDetailSizer2->Add(IDC_NOPRECIPITATION_CTRL, 0);
341 IDC_NODEPTHSORT_CTRL =
342 new wxCheckBox(parent, -1, wxT("No sprite depth sorting"));
343 miscDetailSizer2->Add(IDC_NODEPTHSORT_CTRL, 0);
344 IDC_NOBACKDROP_CTRL =
345 new wxCheckBox(parent, -1, wxT("No progress backdrop"));
346 miscDetailSizer2->Add(IDC_NOBACKDROP_CTRL, 0);
348 miscDetailSizer->Add(miscDetailSizer2, 0, wxGROW);
349 sizer->Add(miscDetailSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
353 static void createIdentControls(wxWindow *parent, wxSizer *sizer)
356 // User name edit box
357 wxStaticBox *userNameBox = new wxStaticBox(parent, -1,
358 wxT("Online User Name"));
359 wxStaticBoxSizer *userNameSizer = new wxStaticBoxSizer(userNameBox, wxVERTICAL);
360 IDC_USERNAME_CTRL = new wxTextCtrl(parent, -1, wxString(), wxDefaultPosition, wxSize(300, -1));
361 userNameSizer->Add(IDC_USERNAME_CTRL, 0, wxALIGN_CENTER);
362 sizer->Add(userNameSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
366 // TankModel edit box
367 wxStaticBox *tankModelBox = new wxStaticBox(parent, -1,
368 wxT("Online Tank Model"));
369 wxStaticBoxSizer *tankModelSizer = new wxStaticBoxSizer(tankModelBox, wxVERTICAL);
370 IDC_TANKMODEL_CTRL = new wxTextCtrl(parent, -1, wxString(), wxDefaultPosition, wxSize(300, -1));
371 tankModelSizer->Add(IDC_TANKMODEL_CTRL, 0, wxALIGN_CENTER);
372 sizer->Add(tankModelSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
375 // User id edit box
376 wxStaticBox *userBox = new wxStaticBox(parent, -1,
377 wxT("User ID (Uniquely identifies this player for stats, not generated from any user information.)"));
378 wxStaticBoxSizer *userSizer = new wxStaticBoxSizer(userBox, wxVERTICAL);
379 IDC_USERID_CTRL = new wxGrid(parent, -1, wxDefaultPosition, wxDefaultSize);
380 IDC_USERID_CTRL->CreateGrid(0, 3);
381 IDC_USERID_CTRL->SetColLabelValue(0, wxT("Published Ip"));
382 IDC_USERID_CTRL->SetColLabelValue(1, wxT("Current Ip"));
383 IDC_USERID_CTRL->SetColLabelValue(2, wxT("Unique Id"));
384 IDC_USERID_CTRL->SetColLabelSize(20);
385 IDC_USERID_CTRL->SetRowLabelSize(0);
387 userSizer->Add(IDC_USERID_CTRL, 1, wxALIGN_CENTER | wxGROW);
388 IDC_HOSTDESC_CTRL = new wxTextCtrl(parent, -1, wxString(), wxDefaultPosition, wxSize(300, -1), wxTE_READONLY);
389 userSizer->Add(IDC_HOSTDESC_CTRL, 0, wxALIGN_CENTER);
390 sizer->Add(userSizer, 1, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
393 static void refreshIdentControls()
395 UniqueIdStore idStore;
396 idStore.loadStore();
398 if (int(idStore.getIds().size()) > IDC_USERID_CTRL->GetNumberRows())
400 IDC_USERID_CTRL->AppendRows(
401 int(idStore.getIds().size()) - IDC_USERID_CTRL->GetNumberRows());
404 // User id edit box
405 int pos = 0;
406 IDC_USERID_CTRL->ClearGrid();
407 std::list<UniqueIdStore::Entry>::iterator itor;
408 for (itor = idStore.getIds().begin();
409 itor != idStore.getIds().end();
410 itor++, pos++)
412 UniqueIdStore::Entry &entry = *itor;
413 IDC_USERID_CTRL->SetCellValue(pos, 0, wxString(entry.published.c_str(), wxConvUTF8));
414 IDC_USERID_CTRL->SetCellValue(pos, 1, wxString(NetInterface::getIpName(entry.ip), wxConvUTF8));
415 IDC_USERID_CTRL->SetCellValue(pos, 2, wxString(entry.id.c_str(), wxConvUTF8));
416 IDC_USERID_CTRL->SetReadOnly(pos, 0);
417 IDC_USERID_CTRL->SetReadOnly(pos, 1);
419 IDC_USERID_CTRL->EnableEditing(true);
420 IDC_USERID_CTRL->AutoSizeColumns(true);
421 IDC_USERID_CTRL->ForceRefresh();
424 class KeyButtonData : public wxObjectRefData
426 public:
427 KeyButtonData(const char *key, unsigned int position);
428 virtual ~KeyButtonData();
430 std::string key_;
431 unsigned int position_;
434 KeyButtonData::KeyButtonData(const char *key, unsigned int position) :
435 wxObjectRefData(),
436 key_(key), position_(position)
440 KeyButtonData::~KeyButtonData()
444 static std::list<wxButton *> keyboardKeyList;
446 static void createKeysControls(wxWindow *parent, wxSizer *topsizer)
448 wxScrolledWindow *scrolledWindow = new wxScrolledWindow(parent, -1,
449 wxDefaultPosition, wxSize(480, 250));
450 wxSizer *sizer = new wxFlexGridSizer(5, 1);
452 keyboardKeyList.clear();
453 if (!Keyboard::instance()->loadKeyFile())
455 S3D::dialogExit("Keyboard", "Failed to process keyboad file keys.xml");
458 int lastGroup = 0;
459 std::list<std::string> &keys =
460 Keyboard::instance()->getKeyList();
461 std::list<std::string>::iterator itor;
462 for (itor = keys.begin();
463 itor != keys.end();
464 itor++)
466 KeyboardKey *key = Keyboard::instance()->getKey((*itor).c_str());
468 // Add a spacer line
469 if (key->getGroup() != lastGroup)
471 lastGroup = key->getGroup();
472 for (unsigned int i=0; i<5; i++)
474 sizer->Add(new wxStaticText(
475 scrolledWindow, -1, wxString("", wxConvUTF8)), 0, wxALIGN_LEFT);
479 // Add the key name
480 wxStaticText *text = new wxStaticText(
481 scrolledWindow, -1, wxString(key->getTitle(), wxConvUTF8));
482 text->SetToolTip(wxString(key->getDescription(), wxConvUTF8));
483 sizer->Add(text, 0, wxALIGN_LEFT);
485 // Add the keys
486 for (unsigned int i=0; i<4; i++)
488 wxButton *button = new wxButton(scrolledWindow, ID_KEY, wxT(""),
489 wxDefaultPosition, wxSize(120, -1));
490 button->SetRefData(new KeyButtonData(key->getName(), i));
491 button->SetToolTip(wxString(key->getDescription(), wxConvUTF8));
492 sizer->Add(button, 0, wxLEFT | wxALIGN_CENTER, 5);
493 keyboardKeyList.push_back(button);
497 // Setup the scrolled area size
498 scrolledWindow->SetAutoLayout(TRUE);
499 scrolledWindow->SetSizer(sizer);
500 wxSize minSize = sizer->CalcMin();
501 scrolledWindow->SetScrollbars(10, 10,
502 (minSize.GetWidth() + 10) / 10, (minSize.GetHeight() + 10) / 10);
503 topsizer->Add(scrolledWindow, 1, wxGROW | wxALL | wxALIGN_CENTER, 2);
505 // Add the load default keys button
506 IDC_LOADKEYDEFAULTS_CTRL = new wxButton(parent, ID_KEYDEFAULTS, wxT("Load Default Keys"));
507 topsizer->Add(IDC_LOADKEYDEFAULTS_CTRL, 0, wxCENTER | wxALL, 2);
510 static wxListBox *modbox = 0;
511 static void updateModList()
513 modbox->Clear();
514 ModDirs dirs;
515 if (dirs.loadModDirs())
517 std::list<ModInfo>::iterator itor;
518 for (itor = dirs.getDirs().begin();
519 itor != dirs.getDirs().end();
520 itor++)
522 ModInfo &info = (*itor);
523 modbox->Append(wxString(info.getName(), wxConvUTF8));
528 static void createModsControls(wxWindow *parent, wxSizer *topsizer)
530 wxStaticBox *modsBox = new wxStaticBox(parent, -1, wxT("Mods"));
531 wxStaticBoxSizer *modsSizer = new wxStaticBoxSizer(modsBox, wxVERTICAL);
533 modbox = new wxListBox(parent, -1,
534 wxDefaultPosition, wxSize(150, 200), 0, 0, wxLB_SINGLE);
535 updateModList();
536 modsSizer->Add(modbox, 0, wxALIGN_CENTER | wxALL, 5);
538 wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
539 wxButton *exportBut = new wxButton(parent, ID_EXPORT, wxT("Export"));
540 wxButton *importBut = new wxButton(parent, ID_IMPORT, wxT("Import"));
541 buttonSizer->Add(exportBut, 0, wxRIGHT, 5);
542 buttonSizer->Add(importBut, 0, wxLEFT, 5);
543 modsSizer->Add(buttonSizer, 0, wxALIGN_CENTER);
545 topsizer->Add(modsSizer, 0, wxGROW);