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/_key_dlg_8cpp_source.html | 316 +++++++++++++++++++++++++++++ 1 file changed, 316 insertions(+) create mode 100644 Doc/doxygen/html/_key_dlg_8cpp_source.html (limited to 'Doc/doxygen/html/_key_dlg_8cpp_source.html') diff --git a/Doc/doxygen/html/_key_dlg_8cpp_source.html b/Doc/doxygen/html/_key_dlg_8cpp_source.html new file mode 100644 index 0000000..07b8fca --- /dev/null +++ b/Doc/doxygen/html/_key_dlg_8cpp_source.html @@ -0,0 +1,316 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/Stars45/KeyDlg.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
KeyDlg.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: KeyDlg.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12 */
+
13 
+
14 #include "MemDebug.h"
+
15 #include "KeyDlg.h"
+
16 #include "KeyMap.h"
+
17 #include "MenuScreen.h"
+
18 #include "Starshatter.h"
+
19 #include "FormatUtil.h"
+
20 
+
21 #include "Game.h"
+
22 #include "ListBox.h"
+
23 #include "ComboBox.h"
+
24 #include "Button.h"
+
25 #include "Joystick.h"
+
26 
+
27 // +--------------------------------------------------------------------+
+
28 // DECLARE MAPPING FUNCTIONS:
+
29 
+
30 DEF_MAP_CLIENT(KeyDlg, OnApply);
+
31 DEF_MAP_CLIENT(KeyDlg, OnCancel);
+
32 DEF_MAP_CLIENT(KeyDlg, OnClear);
+
33 
+
34 // +--------------------------------------------------------------------+
+
35 
+ +
37 : FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr),
+
38 key_key(0), key_shift(0), key_joy(0), key_clear(0),
+
39 command(0), current_key(0), new_key(0), clear(0),
+
40 apply(0), cancel(0)
+
41 {
+
42  Init(def);
+
43 }
+
44 
+ +
46 {
+
47 }
+
48 
+
49 void
+ +
51 {
+
52  if (apply)
+
53  return;
+
54 
+
55  command = FindControl(201);
+
56  current_key = FindControl(202);
+
57  new_key = FindControl(203);
+
58 
+
59  clear = (Button*) FindControl(300);
+ +
61 
+
62  apply = (Button*) FindControl(1);
+ +
64 
+
65  cancel = (Button*) FindControl(2);
+ +
67 }
+
68 
+
69 // +--------------------------------------------------------------------+
+
70 
+
71 void
+ +
73 {
+
74  int key = 0;
+
75  int shift = 0;
+
76  int joy = 0;
+
77  Joystick* joystick = Joystick::GetInstance();
+
78 
+
79  if (joystick) joystick->Acquire();
+
80 
+
81  for (int i = 0; i < 256; i++) {
+
82  int vk = KeyMap::GetMappableVKey(i);
+
83 
+
84  if (vk >= KEY_JOY_1 && vk <= KEY_JOY_16) {
+
85  if (joystick && joystick->KeyDown(vk))
+
86  joy = vk;
+
87  }
+
88 
+
89  else if (vk >= KEY_POV_0_UP && vk <= KEY_POV_3_RIGHT) {
+
90  if (joystick && joystick->KeyDown(vk))
+
91  joy = vk;
+
92  }
+
93 
+
94  else if (GetAsyncKeyState(vk)) {
+
95  if (vk == VK_SHIFT || vk == VK_MENU)
+
96  shift = vk;
+
97  else
+
98  key = vk;
+
99  }
+
100  }
+
101 
+
102  if (key) {
+
103  key_key = key;
+
104  key_shift = shift;
+
105 
+
106  new_key->SetText(KeyMap::DescribeKey(key, shift, joy));
+
107  }
+
108 
+
109  else if (joy) {
+
110  key_joy = joy;
+
111  new_key->SetText(KeyMap::DescribeKey(key, shift, joy));
+
112  }
+
113 }
+
114 
+
115 // +--------------------------------------------------------------------+
+
116 
+
117 void
+ +
119 {
+ +
121 
+ +
123 
+
124  if (stars) {
+
125  KeyMap& keymap = stars->GetKeyMap();
+
126 
+
127  if (command)
+ +
129 
+
130  if (current_key)
+ +
132  }
+
133 
+
134  key_clear = false;
+
135  new_key->SetText("");
+
136  SetFocus();
+
137 }
+
138 
+
139 // +--------------------------------------------------------------------+
+
140 
+
141 void
+ +
143 {
+
144  key_index = i;
+
145  key_key = 0;
+
146  key_shift = 0;
+
147 }
+
148 
+
149 // +--------------------------------------------------------------------+
+
150 
+
151 void
+ +
153 {
+
154  key_clear = true;
+
155 
+
156  key_key = 0;
+
157  key_shift = 0;
+
158  key_joy = 0;
+
159 }
+
160 
+
161 // +--------------------------------------------------------------------+
+
162 
+
163 void
+ +
165 {
+ +
167 
+
168  if (stars) {
+
169  KeyMap& keymap = stars->GetKeyMap();
+
170  KeyMapEntry* map = keymap.GetKeyMap(key_index);
+
171 
+
172  if (key_clear) {
+
173  map->key = 0;
+
174  map->alt = 0;
+
175  map->joy = 0;
+
176  }
+
177 
+
178  if (key_key) {
+
179  map->key = key_key;
+
180  map->alt = key_shift;
+
181  }
+
182 
+
183  if (key_joy) {
+
184  map->joy = key_joy;
+
185  }
+
186  }
+
187 
+
188  if (manager)
+
189  manager->ShowCtlDlg();
+
190 }
+
191 
+
192 void
+ +
194 {
+
195  if (manager)
+
196  manager->ShowCtlDlg();
+
197 }
+
198 
+
199 // +--------------------------------------------------------------------+
+
+
+ + + + -- cgit v1.1