Rev 1 | Rev 29 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 26 | ||
---|---|---|---|
Line 61... | Line 61... | ||
61 | static int CALLBACK DialogProc_ThisDialog (HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam) |
61 | static int CALLBACK DialogProc_ThisDialog (HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam) |
62 | { |
62 | { |
63 | // message handler for the dialog box |
63 | // message handler for the dialog box |
64 | 64 | ||
65 | static wchar_t accountcreation_url[MAX_PATH]; |
65 | static wchar_t accountcreation_url[MAX_PATH]; |
- | 66 | static wchar_t value_string[32]; |
|
66 | 67 | ||
67 | unsigned short wParam_hiword; |
68 | unsigned short wParam_hiword; |
68 | unsigned short wParam_loword; |
69 | unsigned short wParam_loword; |
69 | wchar_t *port_string; |
70 | wchar_t *port_string; |
70 | int is_checked; |
71 | int is_checked; |
Line 97... | Line 98... | ||
97 | 98 | ||
98 | // setup page 1 (computer play) |
99 | // setup page 1 (computer play) |
99 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINESEARCHDEPTH), LOCALIZE (L"Options_EnginePredictionLevel")); |
100 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINESEARCHDEPTH), LOCALIZE (L"Options_EnginePredictionLevel")); |
100 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_EASY), LOCALIZE (L"Options_Easy")); |
101 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_EASY), LOCALIZE (L"Options_Easy")); |
101 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_HARD), LOCALIZE (L"Options_Hard")); |
102 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_HARD), LOCALIZE (L"Options_Hard")); |
- | 103 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d", options.engine.depth); |
|
- | 104 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINESEARCHDEPTHVALUE), value_string); |
|
- | 105 | ||
102 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS), LOCALIZE (L"Options_AllowEngineBlunders")); |
106 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS), LOCALIZE (L"Options_AllowEngineBlunders")); |
103 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_1PCCHANCE), LOCALIZE (L"Options_1PercentChance")); |
107 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_1PCCHANCE), LOCALIZE (L"Options_1PercentChance")); |
104 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_100PCCHANCE), LOCALIZE (L"Options_100PercentChance")); |
108 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_100PCCHANCE), LOCALIZE (L"Options_100PercentChance")); |
- | 109 | if (options.engine.blunder_chances != 0) |
|
- | 110 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d %%", options.engine.blunder_chances); |
|
- | 111 | else |
|
- | 112 | value_string[0] = 0; |
|
- | 113 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINEBLUNDERSVALUE), value_string); |
|
- | 114 | ||
105 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINERESIGNS), LOCALIZE (L"Options_AllowEngineResigns")); |
115 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINERESIGNS), LOCALIZE (L"Options_AllowEngineResigns")); |
106 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_YIELDING), LOCALIZE (L"Options_Yielding")); |
116 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_YIELDING), LOCALIZE (L"Options_Yielding")); |
107 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OBSTINATE), LOCALIZE (L"Options_Obstinate")); |
117 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OBSTINATE), LOCALIZE (L"Options_Obstinate")); |
- | 118 | if (options.engine.obstinacy_level != -1) |
|
- | 119 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d", 1 + options.engine.obstinacy_level); |
|
- | 120 | else |
|
- | 121 | value_string[0] = 0; |
|
- | 122 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINERESIGNVALUE), value_string); |
|
108 | 123 | ||
109 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS), (options.engine.blunder_chances > 0 ? BST_CHECKED : BST_UNCHECKED)); |
124 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS), (options.engine.blunder_chances > 0 ? BST_CHECKED : BST_UNCHECKED)); |
110 | EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), (options.engine.blunder_chances > 0)); |
125 | EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), (options.engine.blunder_chances > 0)); |
111 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_1PCCHANCE), (options.engine.blunder_chances > 0)); |
126 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_1PCCHANCE), (options.engine.blunder_chances > 0)); |
112 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_100PCCHANCE), (options.engine.blunder_chances > 0)); |
127 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_100PCCHANCE), (options.engine.blunder_chances > 0)); |
Line 252... | Line 267... | ||
252 | options.want_sepiafilter = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_USESEPIAFORHISTORY)) != 0); |
267 | options.want_sepiafilter = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_USESEPIAFORHISTORY)) != 0); |
253 | options.want_autorotateon1vs1 = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ROTATEBOARD)) != 0); |
268 | options.want_autorotateon1vs1 = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ROTATEBOARD)) != 0); |
254 | options.want_sounds = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_PLAYSOUNDS)) != 0); |
269 | options.want_sounds = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_PLAYSOUNDS)) != 0); |
255 | 270 | ||
256 | options.engine.depth = SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL), TBM_GETPOS, 0, 0); |
271 | options.engine.depth = SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL), TBM_GETPOS, 0, 0); |
257 | if (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS))) |
- | |
258 | options.engine.blunder_chances = SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), TBM_GETPOS, 0, 0); |
- | |
259 | else |
- | |
260 | options.engine.blunder_chances = 0; |
- | |
261 | if (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINERESIGNS))) |
- | |
262 | options.engine.obstinacy_level = SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), TBM_GETPOS, 0, 0); |
- | |
263 | else |
- | |
264 | options.engine.obstinacy_level = -1; |
- | |
265 | options.rotate_speed = SendMessage (TabControl_GetItem (tab_control, SLIDER_OPTIONS_ROTATESPEED), TBM_GETPOS, 0, 0); |
272 | options.rotate_speed = SendMessage (TabControl_GetItem (tab_control, SLIDER_OPTIONS_ROTATESPEED), TBM_GETPOS, 0, 0); |
266 | 273 | ||
267 | EndDialog (hWnd, 0); // close the dialog box |
274 | EndDialog (hWnd, 0); // close the dialog box |
268 | } |
275 | } |
269 | 276 | ||
Line 283... | Line 290... | ||
283 | { |
290 | { |
284 | is_checked = Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS)); |
291 | is_checked = Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS)); |
285 | EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), is_checked); |
292 | EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), is_checked); |
286 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_1PCCHANCE), is_checked); |
293 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_1PCCHANCE), is_checked); |
287 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_100PCCHANCE), is_checked); |
294 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_100PCCHANCE), is_checked); |
- | 295 | if (is_checked) |
|
- | 296 | { |
|
- | 297 | options.engine.blunder_chances = SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), TBM_GETPOS, 0, 0); |
|
- | 298 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d %%", options.engine.blunder_chances); |
|
- | 299 | } |
|
- | 300 | else |
|
- | 301 | { |
|
- | 302 | options.engine.blunder_chances = 0; |
|
- | 303 | value_string[0] = 0; |
|
- | 304 | } |
|
- | 305 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINEBLUNDERSVALUE), value_string); |
|
288 | } |
306 | } |
289 | 307 | ||
290 | // else is it the allow engine resigns check box ? if so, enable or disable the blunder chance slider |
308 | // else is it the allow engine resigns check box ? if so, enable or disable the blunder chance slider |
291 | else if (wParam_loword == CHECKBOX_OPTIONS_ALLOWENGINERESIGNS) |
309 | else if (wParam_loword == CHECKBOX_OPTIONS_ALLOWENGINERESIGNS) |
292 | { |
310 | { |
293 | is_checked = Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINERESIGNS)); |
311 | is_checked = Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINERESIGNS)); |
294 | EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), is_checked); |
312 | EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), is_checked); |
295 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_YIELDING), is_checked); |
313 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_YIELDING), is_checked); |
296 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_OBSTINATE), is_checked); |
314 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_OBSTINATE), is_checked); |
- | 315 | if (is_checked) |
|
- | 316 | { |
|
- | 317 | options.engine.obstinacy_level = SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), TBM_GETPOS, 0, 0); |
|
- | 318 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d", 1 + options.engine.obstinacy_level); |
|
- | 319 | } |
|
- | 320 | else |
|
- | 321 | { |
|
- | 322 | options.engine.obstinacy_level = -1; |
|
- | 323 | value_string[0] = 0; |
|
- | 324 | } |
|
- | 325 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINERESIGNVALUE), value_string); |
|
297 | } |
326 | } |
298 | 327 | ||
299 | // else is it the enable filtering check box ? if so, enable or disable the high quality checkbox |
328 | // else is it the enable filtering check box ? if so, enable or disable the high quality checkbox |
300 | else if (wParam_loword == CHECKBOX_OPTIONS_TEXTUREFILTERING) |
329 | else if (wParam_loword == CHECKBOX_OPTIONS_TEXTUREFILTERING) |
301 | EnableWindow (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_HIGHQUALITYFILTERING), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_TEXTUREFILTERING))); |
330 | EnableWindow (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_HIGHQUALITYFILTERING), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_TEXTUREFILTERING))); |
302 | 331 | ||
303 | // else is it the show game clock check box ? if so, enable or disable the game clock color button |
332 | // else is it the show game clock check box ? if so, enable or disable the game clock color button |
304 | else if (wParam_loword == CHECKBOX_OPTIONS_SHOWCLOCK) |
333 | else if (wParam_loword == CHECKBOX_OPTIONS_SHOWCLOCK) |
305 | EnableWindow (TabControl_GetItem (tab_control, BUTTON_COLORCLOCK), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWCLOCK))); |
334 | EnableWindow (TabControl_GetItem (tab_control, BUTTON_COLORCLOCK), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWCLOCK))); |
306 | 335 | ||
307 | // else is it the game clock color button ? |
336 | // else is it the game clock color button ? |
Line 311... | Line 340... | ||
311 | memset (&cc, 0, sizeof (cc)); |
340 | memset (&cc, 0, sizeof (cc)); |
312 | cc.lStructSize = sizeof (cc); |
341 | cc.lStructSize = sizeof (cc); |
313 | cc.hwndOwner = hWnd; |
342 | cc.hwndOwner = hWnd; |
314 | cc.lpCustColors = (unsigned long *) custom_colors; |
343 | cc.lpCustColors = (unsigned long *) custom_colors; |
315 | cc.rgbResult = selectedcolor_clock; |
344 | cc.rgbResult = selectedcolor_clock; |
316 | cc.Flags = CC_FULLOPEN | CC_RGBINIT; |
345 | cc.Flags = CC_FULLOPEN | CC_RGBINIT; |
317 | 346 | ||
318 | // fire it up |
347 | // fire it up |
319 | if (ChooseColor (&cc)) |
348 | if (ChooseColor (&cc)) |
320 | selectedcolor_clock = cc.rgbResult; // save away returned color |
349 | selectedcolor_clock = cc.rgbResult; // save away returned color |
321 | } |
350 | } |
322 | 351 | ||
323 | // else is it the show game history check box ? if so, enable or disable the game history color button |
352 | // else is it the show game history check box ? if so, enable or disable the game history color button |
324 | else if (wParam_loword == CHECKBOX_OPTIONS_SHOWHISTORY) |
353 | else if (wParam_loword == CHECKBOX_OPTIONS_SHOWHISTORY) |
325 | EnableWindow (TabControl_GetItem (tab_control, BUTTON_COLORHISTORY), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWHISTORY))); |
354 | EnableWindow (TabControl_GetItem (tab_control, BUTTON_COLORHISTORY), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWHISTORY))); |
326 | 355 | ||
327 | // else is it the game history color button ? |
356 | // else is it the game history color button ? |
328 | else if (wParam_loword == BUTTON_COLORHISTORY) |
357 | else if (wParam_loword == BUTTON_COLORHISTORY) |
329 | { |
358 | { |
330 | // prepare a color pick dialog box |
359 | // prepare a color pick dialog box |
331 | memset (&cc, 0, sizeof (cc)); |
360 | memset (&cc, 0, sizeof (cc)); |
332 | cc.lStructSize = sizeof (cc); |
361 | cc.lStructSize = sizeof (cc); |
333 | cc.hwndOwner = hWnd; |
362 | cc.hwndOwner = hWnd; |
334 | cc.lpCustColors = (unsigned long *) custom_colors; |
363 | cc.lpCustColors = (unsigned long *) custom_colors; |
Line 343... | Line 372... | ||
343 | // else is it the create/manage account hyperlink ? |
372 | // else is it the create/manage account hyperlink ? |
344 | else if (wParam_loword == STATICTEXT_OPTIONS_SERVERURL) |
373 | else if (wParam_loword == STATICTEXT_OPTIONS_SERVERURL) |
345 | { |
374 | { |
346 | swprintf_s (accountcreation_url, WCHAR_SIZEOF (accountcreation_url), ACCOUNTCREATION_URL, os_language); // build account creation url |
375 | swprintf_s (accountcreation_url, WCHAR_SIZEOF (accountcreation_url), ACCOUNTCREATION_URL, os_language); // build account creation url |
347 | ShellExecute (NULL, L"open", accountcreation_url, NULL, NULL, SW_MAXIMIZE); // open the accounts page in the default browser, maximized |
376 | ShellExecute (NULL, L"open", accountcreation_url, NULL, NULL, SW_MAXIMIZE); // open the accounts page in the default browser, maximized |
- | 377 | } |
|
- | 378 | } |
|
- | 379 | ||
- | 380 | // else is it a notification for a slider moving ? |
|
- | 381 | else if (message == WM_HSCROLL) |
|
- | 382 | { |
|
- | 383 | // is it the engine prediction level slider ? if so, update the slider value text |
|
- | 384 | if ((HWND) lParam == TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL)) |
|
- | 385 | { |
|
- | 386 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d", SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL), TBM_GETPOS, 0, 0)); |
|
- | 387 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINESEARCHDEPTHVALUE), value_string); |
|
- | 388 | } |
|
- | 389 | ||
- | 390 | // else is it the engine blunders slider ? if so, update the slider value text |
|
- | 391 | else if ((HWND) lParam == TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE)) |
|
- | 392 | { |
|
- | 393 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d %%", SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), TBM_GETPOS, 0, 0)); |
|
- | 394 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINEBLUNDERSVALUE), value_string); |
|
- | 395 | } |
|
- | 396 | ||
- | 397 | // else is it the engine obstinacy slider ? if so, update the slider value text |
|
- | 398 | else if ((HWND) lParam == TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY)) |
|
- | 399 | { |
|
- | 400 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d", 1 + SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), TBM_GETPOS, 0, 0)); |
|
- | 401 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINERESIGNVALUE), value_string); |
|
348 | } |
402 | } |
349 | } |
403 | } |
350 | 404 | ||
351 | // else is it a notification for the tab control ? |
405 | // else is it a notification for the tab control ? |
352 | else if ((message == WM_NOTIFY) && (((NMHDR *) lParam)->hwndFrom == GetDlgItem (hWnd, TABBOX_OPTIONS))) |
406 | else if ((message == WM_NOTIFY) && (((NMHDR *) lParam)->hwndFrom == GetDlgItem (hWnd, TABBOX_OPTIONS))) |