1 |
douglas |
63 |
// Renegade Map Selector |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// RenegadeMapSelector.cpp |
6 |
|
|
|
7 |
douglas |
75 |
#include "RenegadeMapSelector.h" |
8 |
|
|
#include "RenegadeConfig.h" |
9 |
|
|
|
10 |
douglas |
66 |
#ifdef _WIN32 |
11 |
douglas |
86 |
|
12 |
douglas |
66 |
#include <io.h> |
13 |
|
|
#include <fcntl.h> |
14 |
douglas |
67 |
#include "resource.h" |
15 |
douglas |
86 |
|
16 |
douglas |
75 |
#else |
17 |
douglas |
86 |
|
18 |
|
|
#include "MapSelector.h" |
19 |
|
|
|
20 |
douglas |
66 |
#endif |
21 |
|
|
|
22 |
douglas |
63 |
bool debug = false; |
23 |
|
|
string program; |
24 |
douglas |
67 |
RenegadeConfig* config; |
25 |
douglas |
63 |
|
26 |
douglas |
66 |
#ifndef _WIN32 |
27 |
douglas |
86 |
|
28 |
douglas |
66 |
inline string fix(const string& ansi) { return ansi; } |
29 |
douglas |
73 |
inline void munge(void) { debug = true; } |
30 |
douglas |
77 |
|
31 |
douglas |
66 |
#else |
32 |
douglas |
86 |
|
33 |
douglas |
66 |
inline string fix(const wstring& wide) |
34 |
douglas |
63 |
{ |
35 |
|
|
char* buffer = new char[wide.length() + 1]; |
36 |
|
|
|
37 |
|
|
WideCharToMultiByte(CP_ACP, 0, wide.c_str(), -1, buffer, wide.length() + 1, |
38 |
|
|
NULL, NULL); |
39 |
|
|
|
40 |
|
|
string ansi = buffer; |
41 |
|
|
delete [] buffer; |
42 |
|
|
|
43 |
|
|
return ansi; |
44 |
|
|
} |
45 |
|
|
|
46 |
douglas |
67 |
inline void munge(void) |
47 |
douglas |
66 |
{ |
48 |
douglas |
67 |
if (debug) return; |
49 |
|
|
|
50 |
douglas |
66 |
AllocConsole(); |
51 |
|
|
SetConsoleTitle("Renegade Map Selector"); |
52 |
|
|
|
53 |
|
|
int hin = _open_osfhandle(long(GetStdHandle(STD_INPUT_HANDLE)), _O_TEXT); |
54 |
|
|
int hout = _open_osfhandle(long(GetStdHandle(STD_OUTPUT_HANDLE)), _O_TEXT); |
55 |
|
|
int herr = _open_osfhandle(long(GetStdHandle(STD_ERROR_HANDLE)), _O_TEXT); |
56 |
|
|
|
57 |
|
|
FILE* fin = _fdopen(hin, "r"); |
58 |
|
|
FILE* fout = _fdopen(hout, "w"); |
59 |
|
|
FILE* ferr = _fdopen(herr, "w"); |
60 |
|
|
|
61 |
|
|
*stdin = *fin; |
62 |
|
|
*stdout = *fout; |
63 |
|
|
*stderr = *ferr; |
64 |
|
|
|
65 |
|
|
setvbuf(stdin, NULL, _IONBF, 0); |
66 |
|
|
setvbuf(stdout, NULL, _IONBF, 0); |
67 |
|
|
setvbuf(stderr, NULL, _IONBF, 0); |
68 |
|
|
|
69 |
|
|
cin.sync_with_stdio(); |
70 |
|
|
cout.sync_with_stdio(); |
71 |
|
|
cerr.sync_with_stdio(); |
72 |
douglas |
67 |
|
73 |
|
|
debug = true; |
74 |
douglas |
66 |
} |
75 |
douglas |
86 |
|
76 |
douglas |
66 |
#endif |
77 |
|
|
|
78 |
douglas |
73 |
#ifdef _WIN32 |
79 |
douglas |
63 |
int CALLBACK selector(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); |
80 |
|
|
|
81 |
|
|
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR |
82 |
|
|
lpCmdLine, int nShowCmd) |
83 |
|
|
{ |
84 |
|
|
int argc; |
85 |
|
|
unsigned short** argv = CommandLineToArgvW(GetCommandLineW(), &argc); |
86 |
douglas |
73 |
#else |
87 |
douglas |
77 |
void selector(void); |
88 |
|
|
|
89 |
douglas |
73 |
int main(int argc, char* argv[]) |
90 |
|
|
{ |
91 |
douglas |
84 |
if (!gtk_init_check(&argc, &argv)) |
92 |
|
|
{ |
93 |
|
|
cerr << argv[0] << ": Cannot open display, need a clue-by-four?\n"; |
94 |
|
|
|
95 |
|
|
return 1; |
96 |
|
|
} |
97 |
douglas |
73 |
#endif |
98 |
douglas |
63 |
|
99 |
douglas |
68 |
string error; |
100 |
douglas |
67 |
string file = "svrcfg_cnc.ini"; |
101 |
|
|
|
102 |
douglas |
66 |
program = fix(argv[0]); |
103 |
douglas |
63 |
|
104 |
|
|
for (int index = 1; index < argc; index++) |
105 |
|
|
{ |
106 |
douglas |
66 |
string arg = fix(argv[index]); |
107 |
douglas |
63 |
|
108 |
|
|
if (arg == "-D") |
109 |
|
|
{ |
110 |
douglas |
67 |
munge(); |
111 |
douglas |
63 |
} |
112 |
douglas |
67 |
else if (arg == "-file") |
113 |
|
|
{ |
114 |
|
|
if (++index < argc) |
115 |
|
|
{ |
116 |
|
|
file = fix(argv[index]); |
117 |
|
|
} |
118 |
|
|
else |
119 |
|
|
{ |
120 |
|
|
error = "The argument -file must be followed by a filename."; |
121 |
|
|
|
122 |
douglas |
73 |
#ifdef _WIN32 |
123 |
douglas |
67 |
MessageBox(NULL, error.c_str(), "Bad Arguments", MB_ICONERROR); |
124 |
douglas |
77 |
#else |
125 |
douglas |
86 |
message(NULL, error, "Bad Arguments", GTK_MESSAGE_ERROR); |
126 |
douglas |
73 |
#endif |
127 |
douglas |
67 |
return 1; |
128 |
|
|
} |
129 |
|
|
} |
130 |
douglas |
89 |
else |
131 |
|
|
{ |
132 |
|
|
error = "The argument " + arg + " is not a valid argument."; |
133 |
|
|
|
134 |
|
|
#ifdef _WIN32 |
135 |
|
|
MessageBox(NULL, error.c_str(), "Unknown Arguments", MB_ICONWARN); |
136 |
|
|
#else |
137 |
|
|
message(NULL, error, "Unknown Arguments", GTK_MESSAGE_WARNING); |
138 |
|
|
#endif |
139 |
|
|
} |
140 |
douglas |
63 |
} |
141 |
|
|
|
142 |
douglas |
73 |
#ifdef _WIN32 |
143 |
douglas |
67 |
GlobalFree(argv); |
144 |
douglas |
73 |
#endif |
145 |
douglas |
63 |
|
146 |
douglas |
67 |
if (debug) cerr << "file = " << file << "\n"; |
147 |
|
|
|
148 |
|
|
config = new RenegadeConfig(file); |
149 |
douglas |
68 |
if (!config->load()) |
150 |
|
|
{ |
151 |
|
|
error = "Could not open " + file + "."; |
152 |
douglas |
67 |
|
153 |
douglas |
73 |
#ifdef _WIN32 |
154 |
douglas |
68 |
MessageBox(NULL, error.c_str(), "Bad File", MB_ICONERROR); |
155 |
douglas |
77 |
#else |
156 |
douglas |
86 |
message(NULL, error, "Bad File", GTK_MESSAGE_ERROR); |
157 |
douglas |
73 |
#endif |
158 |
douglas |
68 |
return 1; |
159 |
|
|
} |
160 |
|
|
|
161 |
douglas |
73 |
#ifdef _WIN32 |
162 |
douglas |
63 |
DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAP_SELECTOR), NULL, selector); |
163 |
douglas |
75 |
#else |
164 |
douglas |
86 |
MapSelector selector; |
165 |
douglas |
73 |
#endif |
166 |
douglas |
63 |
|
167 |
douglas |
67 |
delete config; |
168 |
|
|
|
169 |
douglas |
73 |
#ifdef _WIN32 |
170 |
douglas |
70 |
if (debug) |
171 |
|
|
{ |
172 |
|
|
cout << "Press enter key to exit . . ."; |
173 |
|
|
cin.get(); |
174 |
|
|
} |
175 |
douglas |
73 |
#endif |
176 |
douglas |
68 |
|
177 |
douglas |
63 |
return 0; |
178 |
|
|
} |
179 |
|
|
|
180 |
douglas |
73 |
#ifdef _WIN32 |
181 |
douglas |
86 |
|
182 |
douglas |
63 |
int CALLBACK selector(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
183 |
|
|
{ |
184 |
|
|
switch (uMsg) |
185 |
|
|
{ |
186 |
|
|
case WM_INITDIALOG: |
187 |
|
|
{ |
188 |
douglas |
78 |
RECT rc, rcDlg, rcDesktop; |
189 |
|
|
|
190 |
|
|
GetWindowRect(GetDesktopWindow(), &rcDesktop); |
191 |
|
|
GetWindowRect(hwndDlg, &rcDlg); |
192 |
|
|
CopyRect(&rc, &rcDesktop); |
193 |
|
|
|
194 |
|
|
OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top); |
195 |
|
|
OffsetRect(&rc, -rc.left, -rc.top); |
196 |
|
|
OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom); |
197 |
|
|
|
198 |
|
|
SetWindowPos(hwndDlg, HWND_TOP, rcDesktop.left + (rc.right / 2), |
199 |
|
|
rcDesktop.top + (rc.bottom / 2), 0, 0, SWP_NOSIZE); |
200 |
|
|
} |
201 |
|
|
{ |
202 |
douglas |
63 |
char* directory = new char[MAX_PATH + 1]; |
203 |
|
|
GetCurrentDirectory(MAX_PATH + 1, directory); |
204 |
douglas |
66 |
if (debug) cerr << "directory = " << directory << "\n"; |
205 |
douglas |
63 |
|
206 |
douglas |
88 |
char* data = new char[strlen(directory) + 12]; |
207 |
douglas |
63 |
sprintf(data, "%s\\data\\*.mix", directory); |
208 |
|
|
delete [] directory; |
209 |
douglas |
66 |
if (debug) cerr << "data = " << data << "\n"; |
210 |
douglas |
63 |
|
211 |
|
|
DlgDirList(hwndDlg, data, IDC_AVAILABLE, 0, DDL_ARCHIVE); |
212 |
douglas |
68 |
SetCurrentDirectory(".."); |
213 |
douglas |
63 |
|
214 |
|
|
delete [] data; |
215 |
|
|
} |
216 |
douglas |
69 |
{ |
217 |
|
|
vector<string> maps = config->getMaps(); |
218 |
|
|
|
219 |
|
|
for (unsigned index = 0; index < maps.size(); index++) |
220 |
|
|
{ |
221 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_ADDSTRING, 0, |
222 |
|
|
long(maps[index].c_str())); |
223 |
|
|
} |
224 |
|
|
} |
225 |
douglas |
63 |
break; |
226 |
|
|
case WM_COMMAND: |
227 |
|
|
switch (LOWORD(wParam)) |
228 |
|
|
{ |
229 |
|
|
case IDOK: |
230 |
douglas |
69 |
if (GetListBoxInfo(GetDlgItem(hwndDlg, IDC_SELECTED)) == 0) |
231 |
|
|
{ |
232 |
|
|
MessageBox(hwndDlg, "You need at least one map.", "No Maps", |
233 |
|
|
MB_ICONEXCLAMATION); |
234 |
|
|
|
235 |
|
|
return false; |
236 |
|
|
} |
237 |
|
|
else |
238 |
|
|
{ |
239 |
|
|
vector<string> maps; |
240 |
|
|
|
241 |
|
|
for (unsigned index = 0; index < GetListBoxInfo(GetDlgItem( |
242 |
|
|
hwndDlg, IDC_SELECTED)); index++) |
243 |
|
|
{ |
244 |
|
|
char* name = new char[SendMessage(GetDlgItem(hwndDlg, |
245 |
|
|
IDC_SELECTED), LB_GETTEXTLEN, index, 0) + 1]; |
246 |
|
|
|
247 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_GETTEXT, |
248 |
|
|
index, long(name)); |
249 |
|
|
maps.push_back(name); |
250 |
|
|
|
251 |
|
|
delete [] name; |
252 |
|
|
} |
253 |
|
|
|
254 |
|
|
config->setMaps(maps); |
255 |
|
|
} |
256 |
douglas |
67 |
config->save(); |
257 |
douglas |
63 |
case IDCANCEL: |
258 |
|
|
EndDialog(hwndDlg, wParam); |
259 |
|
|
return true; |
260 |
douglas |
69 |
case IDC_ADD_MAP: |
261 |
douglas |
70 |
{ |
262 |
|
|
unsigned count = SendMessage(GetDlgItem(hwndDlg, |
263 |
|
|
IDC_AVAILABLE), LB_GETSELCOUNT, 0, 0); |
264 |
|
|
unsigned* additions = new unsigned[count]; |
265 |
|
|
|
266 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_AVAILABLE), LB_GETSELITEMS, |
267 |
|
|
count, long(additions)); |
268 |
|
|
|
269 |
|
|
if (debug) cerr << "additions = {\n"; |
270 |
|
|
for (unsigned index = 0; index < count; index++) |
271 |
|
|
{ |
272 |
|
|
if (debug) cerr << " [" << index << "] = " << |
273 |
|
|
additions[index] << "\n"; |
274 |
|
|
|
275 |
|
|
char* name = new char[SendMessage(GetDlgItem(hwndDlg, |
276 |
|
|
IDC_AVAILABLE), LB_GETTEXTLEN, additions[index], 0) + 1 |
277 |
|
|
]; |
278 |
|
|
|
279 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_AVAILABLE), LB_GETTEXT, |
280 |
|
|
additions[index], long(name)); |
281 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
282 |
|
|
LB_ADDSTRING, 0, long(name)); |
283 |
|
|
|
284 |
|
|
delete [] name; |
285 |
|
|
} |
286 |
|
|
if (debug) cerr << "}\n"; |
287 |
|
|
|
288 |
|
|
delete [] additions; |
289 |
|
|
|
290 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_AVAILABLE), LB_SETSEL, |
291 |
|
|
false, -1); |
292 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_ADD_MAP), false); |
293 |
|
|
} |
294 |
douglas |
69 |
break; |
295 |
|
|
case IDC_REMOVE_MAP: |
296 |
douglas |
70 |
{ |
297 |
|
|
unsigned count = SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
298 |
|
|
LB_GETSELCOUNT, 0, 0); |
299 |
|
|
unsigned* removals = new unsigned[count]; |
300 |
|
|
|
301 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_GETSELITEMS, |
302 |
|
|
count, long(removals)); |
303 |
|
|
|
304 |
|
|
if (debug) cerr << "removals = {\n"; |
305 |
|
|
for (unsigned index = count; index > 0; index--) |
306 |
|
|
{ |
307 |
|
|
if (debug) cerr << " [" << index - 1 << "] = " << |
308 |
|
|
removals[index - 1] << "\n"; |
309 |
|
|
|
310 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
311 |
|
|
LB_DELETESTRING, removals[index - 1], 0); |
312 |
|
|
} |
313 |
|
|
if (debug) cerr << "}\n"; |
314 |
|
|
|
315 |
|
|
delete [] removals; |
316 |
|
|
|
317 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE_MAP), false); |
318 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_UP_MAP), false); |
319 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_DOWN_MAP), false); |
320 |
|
|
} |
321 |
douglas |
69 |
break; |
322 |
|
|
case IDC_UP_MAP: |
323 |
douglas |
74 |
{ |
324 |
|
|
unsigned count = SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
325 |
|
|
LB_GETSELCOUNT, 0, 0); |
326 |
|
|
unsigned* ups = new unsigned[count]; |
327 |
|
|
|
328 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_GETSELITEMS, |
329 |
|
|
count, long(ups)); |
330 |
|
|
|
331 |
|
|
unsigned insert = ups[0] - 1; |
332 |
|
|
|
333 |
|
|
if (debug) cerr << "ups = {\n"; |
334 |
|
|
for (unsigned index = 0; index < count; index++) |
335 |
|
|
{ |
336 |
|
|
if (debug) cerr << " [" << index << "] = " << ups[index] |
337 |
|
|
<< "\n"; |
338 |
|
|
|
339 |
|
|
char* up = new char[SendMessage(GetDlgItem(hwndDlg, |
340 |
|
|
IDC_SELECTED), LB_GETTEXTLEN, ups[index], 0) + 1]; |
341 |
|
|
|
342 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_GETTEXT, |
343 |
|
|
ups[index], long(up)); |
344 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
345 |
|
|
LB_DELETESTRING, ups[index], 0); |
346 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
347 |
|
|
LB_INSERTSTRING, insert, long(up)); |
348 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_SETSEL, |
349 |
|
|
true, insert++); |
350 |
|
|
} |
351 |
|
|
if (debug) cerr << "}\n"; |
352 |
|
|
|
353 |
|
|
delete [] ups; |
354 |
|
|
|
355 |
|
|
if (SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
356 |
|
|
LB_GETSEL, 0, 0) == 0) |
357 |
|
|
{ |
358 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_UP_MAP), true); |
359 |
|
|
} |
360 |
|
|
else |
361 |
|
|
{ |
362 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_UP_MAP), false); |
363 |
|
|
} |
364 |
|
|
|
365 |
|
|
if (SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
366 |
|
|
LB_GETSEL, SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED |
367 |
|
|
), LB_GETCOUNT, 0, 0) - 1, 0) == 0) |
368 |
|
|
{ |
369 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_DOWN_MAP), true); |
370 |
|
|
} |
371 |
|
|
} |
372 |
douglas |
69 |
break; |
373 |
|
|
case IDC_DOWN_MAP: |
374 |
douglas |
74 |
{ |
375 |
|
|
unsigned count = SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
376 |
|
|
LB_GETSELCOUNT, 0, 0); |
377 |
|
|
unsigned* downs = new unsigned[count]; |
378 |
|
|
|
379 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_GETSELITEMS, |
380 |
|
|
count, long(downs)); |
381 |
|
|
|
382 |
|
|
unsigned insert = downs[count - 1] + 1; |
383 |
|
|
|
384 |
|
|
if (debug) cerr << "downs = {\n"; |
385 |
|
|
for (unsigned index = count; index > 0; index--) |
386 |
|
|
{ |
387 |
|
|
if (debug) cerr << " [" << index << "] = " << downs[index |
388 |
|
|
- 1] << "\n"; |
389 |
|
|
|
390 |
|
|
char* down = new char[SendMessage(GetDlgItem(hwndDlg, |
391 |
|
|
IDC_SELECTED), LB_GETTEXTLEN, downs[index - 1], 0) + |
392 |
|
|
1]; |
393 |
|
|
|
394 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_GETTEXT, |
395 |
|
|
downs[index - 1], long(down)); |
396 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
397 |
|
|
LB_DELETESTRING, downs[index - 1], 0); |
398 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
399 |
|
|
LB_INSERTSTRING, insert, long(down)); |
400 |
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), LB_SETSEL, |
401 |
|
|
true, insert--); |
402 |
|
|
} |
403 |
|
|
if (debug) cerr << "}\n"; |
404 |
|
|
|
405 |
|
|
delete [] downs; |
406 |
|
|
|
407 |
|
|
if (SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
408 |
|
|
LB_GETSEL, 0, 0) == 0) |
409 |
|
|
{ |
410 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_UP_MAP), true); |
411 |
|
|
} |
412 |
|
|
|
413 |
|
|
if (SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
414 |
|
|
LB_GETSEL, SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED |
415 |
|
|
), LB_GETCOUNT, 0, 0) - 1, 0) == 0) |
416 |
|
|
{ |
417 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_DOWN_MAP), true); |
418 |
|
|
} |
419 |
|
|
else |
420 |
|
|
{ |
421 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_DOWN_MAP), false); |
422 |
|
|
} |
423 |
|
|
} |
424 |
douglas |
69 |
break; |
425 |
|
|
case IDC_AVAILABLE: |
426 |
|
|
switch (HIWORD(wParam)) |
427 |
|
|
{ |
428 |
|
|
case LBN_SELCHANGE: |
429 |
|
|
if (SendMessage(GetDlgItem(hwndDlg, IDC_AVAILABLE), |
430 |
|
|
LB_GETSELCOUNT, 0, 0) > 0) |
431 |
|
|
{ |
432 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_ADD_MAP), true); |
433 |
|
|
} |
434 |
|
|
else |
435 |
|
|
{ |
436 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_ADD_MAP), false); |
437 |
|
|
} |
438 |
|
|
break; |
439 |
|
|
} |
440 |
|
|
break; |
441 |
|
|
case IDC_SELECTED: |
442 |
|
|
switch (HIWORD(wParam)) |
443 |
|
|
{ |
444 |
|
|
case LBN_SELCHANGE: |
445 |
|
|
if (SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
446 |
|
|
LB_GETSELCOUNT, 0, 0) > 0) |
447 |
|
|
{ |
448 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE_MAP), true); |
449 |
|
|
|
450 |
|
|
if (SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
451 |
|
|
LB_GETSEL, 0, 0) == 0) |
452 |
|
|
{ |
453 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_UP_MAP), true); |
454 |
|
|
} |
455 |
|
|
else |
456 |
|
|
{ |
457 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_UP_MAP), false); |
458 |
|
|
} |
459 |
|
|
|
460 |
|
|
if (SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED), |
461 |
|
|
LB_GETSEL, SendMessage(GetDlgItem(hwndDlg, IDC_SELECTED |
462 |
|
|
), LB_GETCOUNT, 0, 0) - 1, 0) == 0) |
463 |
|
|
{ |
464 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_DOWN_MAP), true); |
465 |
|
|
} |
466 |
|
|
else |
467 |
|
|
{ |
468 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_DOWN_MAP), false); |
469 |
|
|
} |
470 |
|
|
} |
471 |
|
|
else |
472 |
|
|
{ |
473 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE_MAP), false); |
474 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_UP_MAP), false); |
475 |
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_DOWN_MAP), false); |
476 |
|
|
} |
477 |
|
|
break; |
478 |
|
|
} |
479 |
|
|
break; |
480 |
douglas |
63 |
} |
481 |
|
|
break; |
482 |
|
|
} |
483 |
|
|
|
484 |
|
|
return false; |
485 |
|
|
} |
486 |
douglas |
77 |
|
487 |
douglas |
73 |
#endif |