From 8898ad9b25fca6afe2374d293a981db02a83d7e9 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Thu, 31 May 2012 14:46:27 +0000 Subject: Committing the documentation to svn to have it accessible online --- Doc/doxygen/html/_ctl_dlg_8cpp_source.html | 578 +++++++++++++++++++++++++++++ 1 file changed, 578 insertions(+) create mode 100644 Doc/doxygen/html/_ctl_dlg_8cpp_source.html (limited to 'Doc/doxygen/html/_ctl_dlg_8cpp_source.html') diff --git a/Doc/doxygen/html/_ctl_dlg_8cpp_source.html b/Doc/doxygen/html/_ctl_dlg_8cpp_source.html new file mode 100644 index 0000000..67efd48 --- /dev/null +++ b/Doc/doxygen/html/_ctl_dlg_8cpp_source.html @@ -0,0 +1,578 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/Stars45/CtlDlg.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
CtlDlg.cpp
+
+
+Go to the documentation of this file.
1 /* Project Starshatter 4.5
+
2  Destroyer Studios LLC
+
3  Copyright © 1997-2004. All Rights Reserved.
+
4 
+
5  SUBSYSTEM: Stars.exe
+
6  FILE: CtlDlg.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  Control Options (keyboard/joystick) Dialog Active Window class
+
13 */
+
14 
+
15 #include "MemDebug.h"
+
16 #include "CtlDlg.h"
+
17 #include "KeyDlg.h"
+
18 #include "MenuScreen.h"
+
19 #include "Starshatter.h"
+
20 #include "Ship.h"
+
21 
+
22 #include "DataLoader.h"
+
23 #include "Button.h"
+
24 #include "ComboBox.h"
+
25 #include "ListBox.h"
+
26 #include "Slider.h"
+
27 #include "Video.h"
+
28 #include "Keyboard.h"
+
29 #include "Joystick.h"
+
30 #include "MachineInfo.h"
+
31 
+
32 // +--------------------------------------------------------------------+
+
33 // DECLARE MAPPING FUNCTIONS:
+
34 
+
35 DEF_MAP_CLIENT(CtlDlg, OnCommand);
+
36 DEF_MAP_CLIENT(CtlDlg, OnCategory);
+
37 DEF_MAP_CLIENT(CtlDlg, OnControlModel);
+
38 DEF_MAP_CLIENT(CtlDlg, OnJoySelect);
+
39 DEF_MAP_CLIENT(CtlDlg, OnJoyThrottle);
+
40 DEF_MAP_CLIENT(CtlDlg, OnJoyRudder);
+
41 DEF_MAP_CLIENT(CtlDlg, OnJoySensitivity);
+
42 DEF_MAP_CLIENT(CtlDlg, OnJoyAxis);
+
43 DEF_MAP_CLIENT(CtlDlg, OnMouseSelect);
+
44 DEF_MAP_CLIENT(CtlDlg, OnMouseSensitivity);
+
45 DEF_MAP_CLIENT(CtlDlg, OnMouseInvert);
+
46 DEF_MAP_CLIENT(CtlDlg, OnApply);
+
47 DEF_MAP_CLIENT(CtlDlg, OnCancel);
+
48 DEF_MAP_CLIENT(CtlDlg, OnAudio);
+
49 DEF_MAP_CLIENT(CtlDlg, OnVideo);
+
50 DEF_MAP_CLIENT(CtlDlg, OnOptions);
+
51 DEF_MAP_CLIENT(CtlDlg, OnControls);
+
52 DEF_MAP_CLIENT(CtlDlg, OnMod);
+
53 
+
54 // +--------------------------------------------------------------------+
+
55 
+ +
57 : FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr),
+
58 selected_category(0), command_index(0), control_model(0),
+
59 joy_select(0), joy_throttle(0), joy_rudder(0), joy_sensitivity(0),
+
60 mouse_select(0), mouse_sensitivity(0), mouse_invert(0),
+
61 apply(0), cancel(0), vid_btn(0), aud_btn(0), ctl_btn(0), opt_btn(0), mod_btn(0),
+
62 closed(true)
+
63 {
+
64  Init(def);
+
65 }
+
66 
+ +
68 {
+
69 }
+
70 
+
71 // +--------------------------------------------------------------------+
+
72 
+
73 void
+ +
75 {
+
76  if (apply)
+
77  return;
+
78 
+
79  for (int i = 0; i < 4; i++) {
+
80  category[i] = (Button*) FindControl(101 + i);
+ +
82  }
+
83 
+
84  commands = (ListBox*) FindControl(200);
+ +
86 
+ + +
89 
+ + +
92 
+ + +
95 
+ + +
98 
+ +
100 
+ + + + + +
106  }
+
107 
+ + +
110 
+ + +
113 
+ + + + + + +
120  }
+
121 
+ + +
124 
+
125  apply = (Button*) FindControl(1);
+ +
127 
+
128  cancel = (Button*) FindControl(2);
+ +
130 
+
131  vid_btn = (Button*) FindControl(901);
+ +
133 
+
134  aud_btn = (Button*) FindControl(902);
+ +
136 
+
137  ctl_btn = (Button*) FindControl(903);
+ +
139 
+
140  opt_btn = (Button*) FindControl(904);
+ +
142 
+
143  mod_btn = (Button*) FindControl(905);
+
144  if (mod_btn) {
+ +
146  }
+
147 }
+
148 
+
149 // +--------------------------------------------------------------------+
+
150 
+
151 void
+ +
153 {
+
154  if (!IsShown())
+ +
156 
+
157  if (closed)
+
158  ShowCategory();
+
159  else
+
160  UpdateCategory();
+
161 
+
162  if (vid_btn) vid_btn->SetButtonState(0);
+
163  if (aud_btn) aud_btn->SetButtonState(0);
+
164  if (ctl_btn) ctl_btn->SetButtonState(1);
+
165  if (opt_btn) opt_btn->SetButtonState(0);
+
166  if (mod_btn) mod_btn->SetButtonState(0);
+
167 
+
168  closed = false;
+
169 }
+
170 
+
171 // +--------------------------------------------------------------------+
+
172 
+
173 void
+ +
175 {
+
176  if (Keyboard::KeyDown(VK_RETURN)) {
+
177  OnApply(0);
+
178  }
+
179 }
+
180 
+
181 // +--------------------------------------------------------------------+
+
182 
+
183 void
+ +
185 {
+
186  if (!commands || !category[0])
+
187  return;
+
188 
+
189  for (int i = 0; i < 4; i++) {
+
190  if (i == selected_category)
+
191  category[i]->SetButtonState(1);
+
192  else
+
193  category[i]->SetButtonState(0);
+
194  }
+
195 
+
196  commands->ClearItems();
+ +
198  commands->SetLeading(2);
+
199 
+ +
201 
+
202  if (stars) {
+
203  KeyMap& keymap = stars->GetKeyMap();
+
204  int n = 0;
+
205 
+
206  for (int i = 0; i < 256; i++) {
+
207  KeyMapEntry* k = keymap.GetKeyMap(i);
+
208 
+
209  switch (k->act) {
+
210  case 0:
+
211  break;
+
212 
+
213  case KEY_CONTROL_MODEL:
+
214  control_model = k->key;
+ +
216  break;
+
217 
+
218  case KEY_JOY_SELECT:
+
219  joy_select = k->key;
+ +
221  break;
+
222 
+
223  case KEY_JOY_RUDDER:
+
224  joy_rudder = k->key;
+ +
226  break;
+
227 
+
228  case KEY_JOY_THROTTLE:
+
229  joy_throttle = k->key;
+ +
231  break;
+
232 
+
233  case KEY_JOY_SENSE:
+
234  joy_sensitivity = k->key;
+ +
236  break;
+
237 
+
238  case KEY_JOY_SWAP:
+
239  break;
+
240 
+
241  case KEY_JOY_DEAD_ZONE:
+
242  break;
+
243 
+
244  case KEY_MOUSE_SELECT:
+
245  mouse_select = k->key;
+ +
247  break;
+
248 
+
249  case KEY_MOUSE_SENSE:
+
250  mouse_sensitivity = k->key;
+ +
252  break;
+
253 
+
254  case KEY_MOUSE_INVERT:
+
255  mouse_invert = k->key;
+ +
257  break;
+
258 
+
259  case KEY_AXIS_YAW:
+
260  case KEY_AXIS_PITCH:
+
261  case KEY_AXIS_ROLL:
+
262  case KEY_AXIS_THROTTLE:
+
263 
+
264  case KEY_AXIS_YAW_INVERT:
+ + + +
268  break;
+
269 
+
270  default:
+
271  if (keymap.GetCategory(i) == selected_category) {
+
272  commands->AddItemWithData(keymap.DescribeAction(i), (DWORD) i);
+
273  commands->SetItemText(n++, 1, keymap.DescribeKey(i));
+
274  }
+
275  break;
+
276  }
+
277  }
+
278  }
+
279 }
+
280 
+
281 // +--------------------------------------------------------------------+
+
282 
+
283 void
+ +
285 {
+
286  if (!commands)
+
287  return;
+
288 
+ +
290  KeyMap& keymap = stars->GetKeyMap();
+
291 
+
292  for (int i = 0; i < commands->NumItems(); i++) {
+
293  int key = commands->GetItemData(i);
+
294  commands->SetItemText(i, 1, keymap.DescribeKey(key));
+
295  }
+
296 }
+
297 
+
298 // +--------------------------------------------------------------------+
+
299 
+
300 void
+ +
302 {
+
303  selected_category = 0;
+
304 
+
305  for (int i = 0; i < 4; i++)
+
306  if (event->window == category[i])
+
307  selected_category = i;
+
308 
+
309  ShowCategory();
+
310 }
+
311 
+
312 // +--------------------------------------------------------------------+
+
313 
+
314 static DWORD command_click_time = 0;
+
315 
+
316 void
+ +
318 {
+
319  int list_index = commands->GetListIndex();
+
320 
+
321  // double-click:
+
322  if (list_index == command_index && Game::RealTime() - command_click_time < 350) {
+
323  KeyDlg* key_dlg = 0;
+
324 
+
325  if (manager)
+
326  key_dlg = manager->GetKeyDlg();
+
327 
+
328  if (key_dlg) {
+
329  key_dlg->SetKeyMapIndex(commands->GetItemData(list_index));
+
330  }
+
331 
+
332  if (manager)
+
333  manager->ShowKeyDlg();
+
334  }
+
335 
+
336  command_click_time = Game::RealTime();
+
337  command_index = list_index;
+
338 }
+
339 
+
340 // +--------------------------------------------------------------------+
+
341 
+
342 void
+ +
344 {
+ +
346 }
+
347 
+
348 // +--------------------------------------------------------------------+
+
349 
+
350 void
+ +
352 {
+ +
354 }
+
355 
+
356 void
+ +
358 {
+ +
360 }
+
361 
+
362 void
+ +
364 {
+ +
366 }
+
367 
+
368 void
+ +
370 {
+ +
372 }
+
373 
+
374 void
+ +
376 {
+
377  if (manager)
+
378  manager->ShowJoyDlg();
+
379 }
+
380 
+
381 // +--------------------------------------------------------------------+
+
382 
+
383 void
+ +
385 {
+ +
387 }
+
388 
+
389 void
+ +
391 {
+ +
393 }
+
394 
+
395 void
+ +
397 {
+ +
399 }
+
400 
+
401 // +--------------------------------------------------------------------+
+
402 
+ + + + + +
408 
+
409 // +--------------------------------------------------------------------+
+
410 
+
411 void
+ +
413 {
+
414  if (manager)
+ +
416 }
+
417 
+
418 void
+ +
420 {
+
421  if (manager)
+ +
423 }
+
424 
+
425 // +--------------------------------------------------------------------+
+
426 
+
427 void
+ +
429 {
+
430  if (closed) return;
+
431 
+ +
433 
+
434  if (stars) {
+
435  KeyMap& keymap = stars->GetKeyMap();
+
436 
+ +
438 
+
439  keymap.Bind(KEY_JOY_SELECT, joy_select, 0);
+
440  keymap.Bind(KEY_JOY_RUDDER, joy_rudder, 0);
+
441  keymap.Bind(KEY_JOY_THROTTLE, joy_throttle, 0);
+
442  keymap.Bind(KEY_JOY_SENSE, joy_sensitivity, 0);
+
443 
+
444  keymap.Bind(KEY_MOUSE_SELECT, mouse_select, 0);
+ +
446  keymap.Bind(KEY_MOUSE_INVERT, mouse_invert, 0);
+
447 
+
448  keymap.SaveKeyMap("key.cfg", 256);
+
449 
+
450  stars->MapKeys();
+ +
452  }
+
453 
+
454  closed = true;
+
455 }
+
456 
+
457 void
+ +
459 {
+
460  closed = true;
+
461 }
+
+
+ + + + -- cgit v1.1