Subversion Repositories Games.Chess Giants

Rev

Rev 26 | Rev 33 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 26 Rev 29
Line 60... Line 60...
60
 
60
 
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 temp_string[MAX_PATH];
66
   static wchar_t value_string[32];
66
   static wchar_t value_string[32];
67
 
67
 
68
   unsigned short wParam_hiword;
68
   unsigned short wParam_hiword;
69
   unsigned short wParam_loword;
69
   unsigned short wParam_loword;
70
   wchar_t *port_string;
70
   wchar_t *port_string;
Line 118... Line 118...
118
      if (options.engine.obstinacy_level != -1)
118
      if (options.engine.obstinacy_level != -1)
119
         swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d", 1 + options.engine.obstinacy_level);
119
         swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d", 1 + options.engine.obstinacy_level);
120
      else
120
      else
121
         value_string[0] = 0;
121
         value_string[0] = 0;
122
      SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINERESIGNVALUE), value_string);
122
      SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINERESIGNVALUE), value_string);
-
 
123
      SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_EXPERTSETTINGS), LOCALIZE (L"Options_ExpertSettingsHelpText"));
-
 
124
      SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_IAMANEXPERT), LOCALIZE (L"Options_IAmAnExpert"));
-
 
125
      SetWindowText (TabControl_GetItem (tab_control, BUTTON_EXPERTSETTINGS), LOCALIZE (L"Options_ExpertSettings"));
123
 
126
 
124
      Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS), (options.engine.blunder_chances > 0 ? BST_CHECKED : BST_UNCHECKED));
127
      Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS), (options.engine.blunder_chances > 0 ? BST_CHECKED : BST_UNCHECKED));
125
      EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), (options.engine.blunder_chances > 0));
128
      EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), (options.engine.blunder_chances > 0));
126
      EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_1PCCHANCE), (options.engine.blunder_chances > 0));
129
      EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_1PCCHANCE), (options.engine.blunder_chances > 0));
127
      EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_100PCCHANCE), (options.engine.blunder_chances > 0));
130
      EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_100PCCHANCE), (options.engine.blunder_chances > 0));
128
      EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), (options.engine.blunder_chances > 0));
131
      EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), (options.engine.blunder_chances > 0));
129
      Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINERESIGNS), (options.engine.obstinacy_level >= 0 ? BST_CHECKED : BST_UNCHECKED));
132
      Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINERESIGNS), (options.engine.obstinacy_level >= 0 ? BST_CHECKED : BST_UNCHECKED));
130
      EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), (options.engine.obstinacy_level >= 0));
133
      EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), (options.engine.obstinacy_level >= 0));
131
      EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_YIELDING), (options.engine.obstinacy_level >= 0));
134
      EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_YIELDING), (options.engine.obstinacy_level >= 0));
132
      EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_OBSTINATE), (options.engine.obstinacy_level >= 0));
135
      EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_OBSTINATE), (options.engine.obstinacy_level >= 0));
-
 
136
      Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_IAMANEXPERT), (options.engine.is_expert_mode ? BST_CHECKED : BST_UNCHECKED));
-
 
137
      EnableWindow (TabControl_GetItem (tab_control, BUTTON_EXPERTSETTINGS), options.engine.is_expert_mode);
133
      SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL), TBM_SETRANGE, true, MAKELONG (1, options.engine.max_depth));
138
      SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL), TBM_SETRANGE, true, MAKELONG (1, options.engine.max_depth * (options.engine.is_expert_mode ? 3 : 1)));
134
      SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL), TBM_SETPOS, true, options.engine.depth);
139
      SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL), TBM_SETPOS, true, options.engine.depth);
135
      SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), TBM_SETRANGE, true, MAKELONG (1, 100));
140
      SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), TBM_SETRANGE, true, MAKELONG (1, 100));
136
      SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), TBM_SETPOS, true, (options.engine.blunder_chances > 0 ? options.engine.blunder_chances : 1));
141
      SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), TBM_SETPOS, true, (options.engine.blunder_chances > 0 ? options.engine.blunder_chances : 1));
137
      SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), TBM_SETRANGE, true, MAKELONG (0, 9));
142
      SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), TBM_SETRANGE, true, MAKELONG (0, 9));
138
      SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), TBM_SETPOS, true, (options.engine.obstinacy_level >= 0 ? options.engine.obstinacy_level : 9));
143
      SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), TBM_SETPOS, true, (options.engine.obstinacy_level >= 0 ? options.engine.obstinacy_level : 9));
Line 275... Line 280...
275
      }
280
      }
276
 
281
 
277
      // else was it the cancel button ?
282
      // else was it the cancel button ?
278
      else if (wParam_loword == BUTTON_CANCEL)
283
      else if (wParam_loword == BUTTON_CANCEL)
279
         EndDialog (hWnd, 0); // close the dialog box
284
         EndDialog (hWnd, 0); // close the dialog box
-
 
285
 
-
 
286
      // else was it the expert settings button ?
-
 
287
      else if (wParam_loword == BUTTON_EXPERTSETTINGS)
-
 
288
      {
-
 
289
         swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), L"%s\\engine\\init.txt", app_path);
-
 
290
         ShellExecute (NULL, L"open", temp_string, NULL, NULL, SW_SHOWNORMAL); // open the engine initialization text file
-
 
291
      }
280
 
292
 
281
      // else is it the rotate board check box ? if so, enable or disable the speed slider
293
      // else is it the rotate board check box ? if so, enable or disable the speed slider
282
      else if (wParam_loword == CHECKBOX_OPTIONS_ROTATEBOARD)
294
      else if (wParam_loword == CHECKBOX_OPTIONS_ROTATEBOARD)
283
      {
295
      {
284
         EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_ROTATESPEED), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ROTATEBOARD)));
296
         EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_ROTATESPEED), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ROTATEBOARD)));
285
         EnableWindow (TabControl_GetItem (tab_control, SLIDER_OPTIONS_ROTATESPEED), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ROTATEBOARD)));
297
         EnableWindow (TabControl_GetItem (tab_control, SLIDER_OPTIONS_ROTATESPEED), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ROTATEBOARD)));
-
 
298
      }
-
 
299
 
-
 
300
      // else is it the I am an expert check box ? if so, enable or disable the expert settings button and adjust the engine level slider
-
 
301
      else if (wParam_loword == CHECKBOX_OPTIONS_IAMANEXPERT)
-
 
302
      {
-
 
303
         options.engine.is_expert_mode = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_IAMANEXPERT)) == BST_CHECKED);
-
 
304
         EnableWindow (TabControl_GetItem (tab_control, BUTTON_EXPERTSETTINGS), options.engine.is_expert_mode);
-
 
305
         SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL), TBM_SETRANGE, true, MAKELONG (1, options.engine.max_depth * (options.engine.is_expert_mode ? 3 : 1)));
286
      }
306
      }
287
 
307
 
288
      // else is it the allow engine blunders check box ? if so, enable or disable the blunder chance slider
308
      // else is it the allow engine blunders check box ? if so, enable or disable the blunder chance slider
289
      else if (wParam_loword == CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS)
309
      else if (wParam_loword == CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS)
290
      {
310
      {
Line 370... Line 390...
370
      }
390
      }
371
 
391
 
372
      // else is it the create/manage account hyperlink ?
392
      // else is it the create/manage account hyperlink ?
373
      else if (wParam_loword == STATICTEXT_OPTIONS_SERVERURL)
393
      else if (wParam_loword == STATICTEXT_OPTIONS_SERVERURL)
374
      {
394
      {
375
         swprintf_s (accountcreation_url, WCHAR_SIZEOF (accountcreation_url), ACCOUNTCREATION_URL, os_language); // build account creation url
395
         swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), ACCOUNTCREATION_URL, os_language); // build account creation url
376
         ShellExecute (NULL, L"open", accountcreation_url, NULL, NULL, SW_MAXIMIZE); // open the accounts page in the default browser, maximized
396
         ShellExecute (NULL, L"open", temp_string, NULL, NULL, SW_MAXIMIZE); // open the accounts page in the default browser, maximized
377
      }
397
      }
378
   }
398
   }
379
 
399
 
380
   // else is it a notification for a slider moving ?
400
   // else is it a notification for a slider moving ?
381
   else if (message == WM_HSCROLL)
401
   else if (message == WM_HSCROLL)