Subversion Repositories Games.Chess Giants

Rev

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

Rev 29 Rev 33
Line 62... Line 62...
62
{
62
{
63
   // message handler for the dialog box
63
   // message handler for the dialog box
64
 
64
 
65
   static wchar_t temp_string[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
   static WIN32_FIND_DATA wfd;
67
 
68
 
68
   unsigned short wParam_hiword;
69
   unsigned short wParam_hiword;
69
   unsigned short wParam_loword;
70
   unsigned short wParam_loword;
70
   wchar_t *port_string;
71
   wchar_t *port_string;
-
 
72
   int wanted_engine;
-
 
73
   int engine_count;
-
 
74
   HANDLE hFind;
71
   int is_checked;
75
   int is_checked;
72
 
76
 
73
   // filter out the commonly used message values
77
   // filter out the commonly used message values
74
   wParam_hiword = HIWORD (wParam);
78
   wParam_hiword = HIWORD (wParam);
75
   wParam_loword = LOWORD (wParam);
79
   wParam_loword = LOWORD (wParam);
Line 95... Line 99...
95
      TabControl_AddPage (tab_control, LOCALIZE (L"Options_OnlineGameParameters"), DIALOG_OPTIONS_INTERNET);
99
      TabControl_AddPage (tab_control, LOCALIZE (L"Options_OnlineGameParameters"), DIALOG_OPTIONS_INTERNET);
96
      TabControl_AddPage (tab_control, LOCALIZE (L"Options_DisplayParameters"), DIALOG_OPTIONS_DISPLAY);
100
      TabControl_AddPage (tab_control, LOCALIZE (L"Options_DisplayParameters"), DIALOG_OPTIONS_DISPLAY);
97
      TabControl_AddPage (tab_control, LOCALIZE (L"Options_GameplayParameters"), DIALOG_OPTIONS_GAMEPLAY);
101
      TabControl_AddPage (tab_control, LOCALIZE (L"Options_GameplayParameters"), DIALOG_OPTIONS_GAMEPLAY);
98
 
102
 
99
      // setup page 1 (computer play)
103
      // setup page 1 (computer play)
-
 
104
      SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINEPROGRAMNAME), LOCALIZE (L"Options_EngineProgramName"));
-
 
105
      engine_count = 0;
-
 
106
      wanted_engine = 0;
-
 
107
      swprintf_s (temp_string, sizeof (temp_string), L"%s\\engines\\*.*", app_path); // build the search pattern string out of the path
-
 
108
      hFind = FindFirstFile (temp_string, &wfd); // initiate search from that point
-
 
109
      if (hFind != INVALID_HANDLE_VALUE)
-
 
110
      {
-
 
111
         // start examining search results...
-
 
112
         do
-
 
113
         {
-
 
114
            if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || (wfd.cFileName[0] == L'.'))
-
 
115
               continue; // skip everything that is NOT a directory, and every directories that begin with a dot
-
 
116
            ComboBox_AddString (TabControl_GetItem (tab_control, COMBOBOX_ENGINE), wfd.cFileName); // add it to the combo box
-
 
117
            if (wcscmp (wfd.cFileName, options.engine.program) == 0)
-
 
118
               wanted_engine = engine_count;
-
 
119
            engine_count++; // we've identified one engine more
-
 
120
         } while (FindNextFile (hFind, &wfd)); // ...and don't stop as long as there are files to go
-
 
121
         FindClose (hFind); // close the search handle
-
 
122
      }
-
 
123
      ComboBox_SetCurSel (TabControl_GetItem (tab_control, COMBOBOX_ENGINE), wanted_engine); // select the first entry
-
 
124
 
100
      SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINESEARCHDEPTH), LOCALIZE (L"Options_EnginePredictionLevel"));
125
      SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINESEARCHDEPTH), LOCALIZE (L"Options_EnginePredictionLevel"));
101
      SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_EASY), LOCALIZE (L"Options_Easy"));
126
      SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_EASY), LOCALIZE (L"Options_Easy"));
102
      SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_HARD), LOCALIZE (L"Options_Hard"));
127
      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);
128
      swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d", options.engine.depth);
104
      SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINESEARCHDEPTHVALUE), value_string);
129
      SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINESEARCHDEPTHVALUE), value_string);
Line 206... Line 231...
206
 
231
 
207
      // set the selected color to the current game clock color (convert from RGBA to GDI BGR)
232
      // set the selected color to the current game clock color (convert from RGBA to GDI BGR)
208
      selectedcolor_clock = ((options.clock_color & 0x0000ff00) << 8)
233
      selectedcolor_clock = ((options.clock_color & 0x0000ff00) << 8)
209
                            | ((options.clock_color & 0x00ff0000) >> 8)
234
                            | ((options.clock_color & 0x00ff0000) >> 8)
210
                            | ((options.clock_color & 0xff000000) >> 24);
235
                            | ((options.clock_color & 0xff000000) >> 24);
211
 
236
 
212
      // set the selected color to the current game history color (convert from RGBA to GDI BGR)
237
      // set the selected color to the current game history color (convert from RGBA to GDI BGR)
213
      selectedcolor_history = ((options.history_color & 0x0000ff00) << 8)
238
      selectedcolor_history = ((options.history_color & 0x0000ff00) << 8)
214
                              | ((options.history_color & 0x00ff0000) >> 8)
239
                              | ((options.history_color & 0x00ff0000) >> 8)
215
                              | ((options.history_color & 0xff000000) >> 24);
240
                              | ((options.history_color & 0xff000000) >> 24);
216
 
241
 
Line 280... Line 305...
280
      }
305
      }
281
 
306
 
282
      // else was it the cancel button ?
307
      // else was it the cancel button ?
283
      else if (wParam_loword == BUTTON_CANCEL)
308
      else if (wParam_loword == BUTTON_CANCEL)
284
         EndDialog (hWnd, 0); // close the dialog box
309
         EndDialog (hWnd, 0); // close the dialog box
285
 
310
 
286
      // else was it the expert settings button ?
311
      // else was it the expert settings button ?
287
      else if (wParam_loword == BUTTON_EXPERTSETTINGS)
312
      else if (wParam_loword == BUTTON_EXPERTSETTINGS)
288
      {
313
      {
289
         swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), L"%s\\engine\\init.txt", app_path);
314
         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
315
         ShellExecute (NULL, L"open", temp_string, NULL, NULL, SW_SHOWNORMAL); // open the engine initialization text file
Line 353... Line 378...
353
      else if (wParam_loword == CHECKBOX_OPTIONS_SHOWCLOCK)
378
      else if (wParam_loword == CHECKBOX_OPTIONS_SHOWCLOCK)
354
         EnableWindow (TabControl_GetItem (tab_control, BUTTON_COLORCLOCK), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWCLOCK)));
379
         EnableWindow (TabControl_GetItem (tab_control, BUTTON_COLORCLOCK), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWCLOCK)));
355
 
380
 
356
      // else is it the game clock color button ?
381
      // else is it the game clock color button ?
357
      else if (wParam_loword == BUTTON_COLORCLOCK)
382
      else if (wParam_loword == BUTTON_COLORCLOCK)
358
      {
383
      {
359
         // prepare a color pick dialog box
384
         // prepare a color pick dialog box
360
         memset (&cc, 0, sizeof (cc));
385
         memset (&cc, 0, sizeof (cc));
361
         cc.lStructSize = sizeof (cc);
386
         cc.lStructSize = sizeof (cc);
362
         cc.hwndOwner = hWnd;
387
         cc.hwndOwner = hWnd;
363
         cc.lpCustColors = (unsigned long *) custom_colors;
388
         cc.lpCustColors = (unsigned long *) custom_colors;
364
         cc.rgbResult = selectedcolor_clock;
389
         cc.rgbResult = selectedcolor_clock;
Line 373... Line 398...
373
      else if (wParam_loword == CHECKBOX_OPTIONS_SHOWHISTORY)
398
      else if (wParam_loword == CHECKBOX_OPTIONS_SHOWHISTORY)
374
         EnableWindow (TabControl_GetItem (tab_control, BUTTON_COLORHISTORY), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWHISTORY)));
399
         EnableWindow (TabControl_GetItem (tab_control, BUTTON_COLORHISTORY), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWHISTORY)));
375
 
400
 
376
      // else is it the game history color button ?
401
      // else is it the game history color button ?
377
      else if (wParam_loword == BUTTON_COLORHISTORY)
402
      else if (wParam_loword == BUTTON_COLORHISTORY)
378
      {
403
      {
379
         // prepare a color pick dialog box
404
         // prepare a color pick dialog box
380
         memset (&cc, 0, sizeof (cc));
405
         memset (&cc, 0, sizeof (cc));
381
         cc.lStructSize = sizeof (cc);
406
         cc.lStructSize = sizeof (cc);
382
         cc.hwndOwner = hWnd;
407
         cc.hwndOwner = hWnd;
383
         cc.lpCustColors = (unsigned long *) custom_colors;
408
         cc.lpCustColors = (unsigned long *) custom_colors;
Line 392... Line 417...
392
      // else is it the create/manage account hyperlink ?
417
      // else is it the create/manage account hyperlink ?
393
      else if (wParam_loword == STATICTEXT_OPTIONS_SERVERURL)
418
      else if (wParam_loword == STATICTEXT_OPTIONS_SERVERURL)
394
      {
419
      {
395
         swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), ACCOUNTCREATION_URL, os_language); // build account creation url
420
         swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), ACCOUNTCREATION_URL, os_language); // build account creation url
396
         ShellExecute (NULL, L"open", temp_string, NULL, NULL, SW_MAXIMIZE); // open the accounts page in the default browser, maximized
421
         ShellExecute (NULL, L"open", temp_string, NULL, NULL, SW_MAXIMIZE); // open the accounts page in the default browser, maximized
-
 
422
      }
-
 
423
 
-
 
424
      // else is it a notification for the engine droplist ?
-
 
425
      else if (wParam_loword == COMBOBOX_ENGINE)
-
 
426
      {
-
 
427
         ComboBox_GetLBText (TabControl_GetItem (tab_control, COMBOBOX_ENGINE), ComboBox_GetCurSel (TabControl_GetItem (tab_control, COMBOBOX_ENGINE)), options.engine.program);
397
      }
428
      }
398
   }
429
   }
399
 
430
 
400
   // else is it a notification for a slider moving ?
431
   // else is it a notification for a slider moving ?
401
   else if (message == WM_HSCROLL)
432
   else if (message == WM_HSCROLL)