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))); |
| 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))) |