Rev 192 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | pmbaty | 1 | // dialog_options.cpp |
| 2 | |||
| 3 | #include "../common.h" |
||
| 4 | |||
| 5 | |||
| 6 | // dialog template |
||
| 7 | #define THIS_DIALOG DIALOG_OPTIONS |
||
| 8 | |||
| 9 | |||
| 10 | // global variables used in this module only |
||
| 11 | static void *tab_control; |
||
| 12 | static wchar_t server_string[MAX_PATH]; |
||
| 13 | static COLORREF custom_colors[16]; |
||
| 14 | static CHOOSECOLOR cc; |
||
| 15 | static unsigned long selectedcolor_clock; |
||
| 16 | static unsigned long selectedcolor_history; |
||
| 17 | |||
| 18 | |||
| 19 | // prototypes of local functions |
||
| 20 | static void StartThread_ThisDialog (void *thread_parms); |
||
| 21 | static int CALLBACK DialogProc_ThisDialog (HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam); |
||
| 22 | static void StartThread_DialogBoxLoad (void *thread_parms); |
||
| 23 | |||
| 24 | |||
| 25 | void DialogBox_Options (void) |
||
| 26 | { |
||
| 27 | // helper function to fire up the modeless dialog box |
||
| 28 | |||
| 140 | pmbaty | 29 | is_dialogbox_displayed = true; |
| 1 | pmbaty | 30 | _beginthread (StartThread_ThisDialog, 0, NULL); // fire up a new one |
| 31 | |||
| 32 | return; // return as soon as the thread is fired up |
||
| 33 | } |
||
| 34 | |||
| 35 | |||
| 36 | void DialogBox_Options_Validated (void) |
||
| 37 | { |
||
| 38 | // callback function called by the main game thread when the dialog box is validated |
||
| 39 | |||
| 40 | // remember this callback is no longer to be called |
||
| 41 | is_dialogbox_options_validated = false; |
||
| 42 | |||
| 43 | return; // finished |
||
| 44 | } |
||
| 45 | |||
| 46 | |||
| 47 | static void StartThread_ThisDialog (void *thread_parms) |
||
| 48 | { |
||
| 49 | // this function runs in a separate thread, for that's the only way (seemingly) |
||
| 50 | // to implement a non-modal message box using the Common Controls library. |
||
| 51 | |||
| 52 | // display the dialog box |
||
| 53 | if (DialogBox (hAppInstance, MAKEINTRESOURCE (THIS_DIALOG), hMainWnd, DialogProc_ThisDialog) == 1) |
||
| 54 | is_dialogbox_options_validated = true; |
||
| 140 | pmbaty | 55 | TabControl_Destroy (tab_control); // FIXME: move to this dialog's WM_DESTROY ? |
| 56 | is_dialogbox_displayed = false; |
||
| 1 | pmbaty | 57 | |
| 58 | |||
| 124 | pmbaty | 59 | the_board.reevaluate = true; // refresh the GUI buttons if needed |
| 1 | pmbaty | 60 | return; // _endthread() implied |
| 61 | } |
||
| 62 | |||
| 63 | |||
| 64 | static int CALLBACK DialogProc_ThisDialog (HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam) |
||
| 65 | { |
||
| 66 | // message handler for the dialog box |
||
| 67 | |||
| 29 | pmbaty | 68 | static wchar_t temp_string[MAX_PATH]; |
| 26 | pmbaty | 69 | static wchar_t value_string[32]; |
| 1 | pmbaty | 70 | |
| 71 | unsigned short wParam_hiword; |
||
| 72 | unsigned short wParam_loword; |
||
| 73 | wchar_t *port_string; |
||
| 59 | pmbaty | 74 | int language_index; |
| 119 | pmbaty | 75 | int engine_index; |
| 1 | pmbaty | 76 | int is_checked; |
| 189 | pmbaty | 77 | int level; |
| 193 | pmbaty | 78 | HWND hCtlWnd; |
| 1 | pmbaty | 79 | |
| 80 | // filter out the commonly used message values |
||
| 81 | wParam_hiword = HIWORD (wParam); |
||
| 82 | wParam_loword = LOWORD (wParam); |
||
| 83 | |||
| 84 | // have we just fired up this window ? |
||
| 85 | if (message == WM_INITDIALOG) |
||
| 86 | { |
||
| 87 | // center the window |
||
| 88 | CenterWindow (hWnd, hMainWnd); |
||
| 89 | |||
| 90 | // set dialog icons (small one for title bar & big one for task manager) |
||
| 91 | SendMessage (hWnd, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon (hAppInstance, MAKEINTRESOURCE (ICON_MAIN))); |
||
| 92 | SendMessage (hWnd, WM_SETICON, ICON_BIG, (LPARAM) LoadIcon (hAppInstance, MAKEINTRESOURCE (ICON_MAIN))); |
||
| 93 | |||
| 94 | // set window title and control texts |
||
| 95 | SetWindowText (hWnd, LOCALIZE (L"Options_Title")); |
||
| 96 | SetWindowText (GetDlgItem (hWnd, BUTTON_OK), LOCALIZE (L"Button_OK")); |
||
| 97 | SetWindowText (GetDlgItem (hWnd, BUTTON_CANCEL), LOCALIZE (L"Button_Cancel")); |
||
| 98 | |||
| 99 | // create the tab control and populate it |
||
| 100 | tab_control = TabControl_New (GetDlgItem (hWnd, TABBOX_OPTIONS), (WNDPROC) DialogProc_ThisDialog); |
||
| 101 | TabControl_AddPage (tab_control, LOCALIZE (L"Options_OfflineGameParameters"), DIALOG_OPTIONS_ENGINE); |
||
| 102 | TabControl_AddPage (tab_control, LOCALIZE (L"Options_OnlineGameParameters"), DIALOG_OPTIONS_INTERNET); |
||
| 103 | TabControl_AddPage (tab_control, LOCALIZE (L"Options_DisplayParameters"), DIALOG_OPTIONS_DISPLAY); |
||
| 104 | TabControl_AddPage (tab_control, LOCALIZE (L"Options_GameplayParameters"), DIALOG_OPTIONS_GAMEPLAY); |
||
| 105 | |||
| 106 | // setup page 1 (computer play) |
||
| 33 | pmbaty | 107 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINEPROGRAMNAME), LOCALIZE (L"Options_EngineProgramName")); |
| 119 | pmbaty | 108 | for (engine_index = 0; engine_index < options.engine.program_count; engine_index++) |
| 192 | pmbaty | 109 | if (kernel32_version >= options.engine.programs[engine_index].kernel32_minver) |
| 110 | ComboBox_AddString (TabControl_GetItem (tab_control, COMBOBOX_ENGINE), options.engine.programs[engine_index].friendly_name); // add all SUPPORTED engine programs to the combo box |
||
| 119 | pmbaty | 111 | ComboBox_SetCurSel (TabControl_GetItem (tab_control, COMBOBOX_ENGINE), options.engine.selected_program); // select the right entry |
| 33 | pmbaty | 112 | |
| 1 | pmbaty | 113 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINESEARCHDEPTH), LOCALIZE (L"Options_EnginePredictionLevel")); |
| 114 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_EASY), LOCALIZE (L"Options_Easy")); |
||
| 115 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_HARD), LOCALIZE (L"Options_Hard")); |
||
| 26 | pmbaty | 116 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d", options.engine.depth); |
| 117 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINESEARCHDEPTHVALUE), value_string); |
||
| 118 | |||
| 1 | pmbaty | 119 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS), LOCALIZE (L"Options_AllowEngineBlunders")); |
| 120 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_1PCCHANCE), LOCALIZE (L"Options_1PercentChance")); |
||
| 121 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_100PCCHANCE), LOCALIZE (L"Options_100PercentChance")); |
||
| 40 | pmbaty | 122 | if (options.engine.blunder_chances > 0) |
| 26 | pmbaty | 123 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d %%", options.engine.blunder_chances); |
| 124 | else |
||
| 125 | value_string[0] = 0; |
||
| 126 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINEBLUNDERSVALUE), value_string); |
||
| 127 | |||
| 1 | pmbaty | 128 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINERESIGNS), LOCALIZE (L"Options_AllowEngineResigns")); |
| 129 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_YIELDING), LOCALIZE (L"Options_Yielding")); |
||
| 130 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OBSTINATE), LOCALIZE (L"Options_Obstinate")); |
||
| 26 | pmbaty | 131 | if (options.engine.obstinacy_level != -1) |
| 132 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d", 1 + options.engine.obstinacy_level); |
||
| 133 | else |
||
| 134 | value_string[0] = 0; |
||
| 135 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINERESIGNVALUE), value_string); |
||
| 29 | pmbaty | 136 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_EXPERTSETTINGS), LOCALIZE (L"Options_ExpertSettingsHelpText")); |
| 137 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_IAMANEXPERT), LOCALIZE (L"Options_IAmAnExpert")); |
||
| 138 | SetWindowText (TabControl_GetItem (tab_control, BUTTON_EXPERTSETTINGS), LOCALIZE (L"Options_ExpertSettings")); |
||
| 1 | pmbaty | 139 | |
| 140 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS), (options.engine.blunder_chances > 0 ? BST_CHECKED : BST_UNCHECKED)); |
||
| 141 | EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), (options.engine.blunder_chances > 0)); |
||
| 142 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_1PCCHANCE), (options.engine.blunder_chances > 0)); |
||
| 143 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_100PCCHANCE), (options.engine.blunder_chances > 0)); |
||
| 144 | EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), (options.engine.blunder_chances > 0)); |
||
| 145 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINERESIGNS), (options.engine.obstinacy_level >= 0 ? BST_CHECKED : BST_UNCHECKED)); |
||
| 146 | EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), (options.engine.obstinacy_level >= 0)); |
||
| 147 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_YIELDING), (options.engine.obstinacy_level >= 0)); |
||
| 148 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_OBSTINATE), (options.engine.obstinacy_level >= 0)); |
||
| 29 | pmbaty | 149 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_IAMANEXPERT), (options.engine.is_expert_mode ? BST_CHECKED : BST_UNCHECKED)); |
| 150 | EnableWindow (TabControl_GetItem (tab_control, BUTTON_EXPERTSETTINGS), options.engine.is_expert_mode); |
||
| 151 | SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL), TBM_SETRANGE, true, MAKELONG (1, options.engine.max_depth * (options.engine.is_expert_mode ? 3 : 1))); |
||
| 1 | pmbaty | 152 | SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL), TBM_SETPOS, true, options.engine.depth); |
| 153 | SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), TBM_SETRANGE, true, MAKELONG (1, 100)); |
||
| 154 | SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), TBM_SETPOS, true, (options.engine.blunder_chances > 0 ? options.engine.blunder_chances : 1)); |
||
| 155 | SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), TBM_SETRANGE, true, MAKELONG (0, 9)); |
||
| 156 | SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), TBM_SETPOS, true, (options.engine.obstinacy_level >= 0 ? options.engine.obstinacy_level : 9)); |
||
| 157 | |||
| 158 | // setup page 2 (Internet play) |
||
| 159 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_SERVERADDRESS), LOCALIZE (L"Options_ServerAddress")); |
||
| 160 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_SERVERLOGIN), LOCALIZE (L"Options_ServerLogin")); |
||
| 161 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_SERVERPASSWORD), LOCALIZE (L"Options_ServerPassword")); |
||
| 162 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWSERVERMESSAGES), LOCALIZE (L"Options_ShowServerMessages")); |
||
| 163 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWPUBLICCHAT), LOCALIZE (L"Options_ShowPublicChat")); |
||
| 164 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_SERVERURL), LOCALIZE (L"Options_CreateAccount")); |
||
| 165 | ConvertStaticToHyperlink (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_SERVERURL)); |
||
| 166 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_SERVERWARNING), LOCALIZE (L"Options_ServerWarning")); |
||
| 167 | |||
| 168 | swprintf_s (server_string, WCHAR_SIZEOF (server_string), L"%s:%d", options.network.server_address, options.network.server_port); |
||
| 169 | SetWindowText (TabControl_GetItem (tab_control, EDITBOX_SERVERADDRESS), server_string); |
||
| 170 | EnableWindow (TabControl_GetItem (tab_control, EDITBOX_SERVERADDRESS), false); // FIXME: as long as we don't support ICC, don't allow users to change server address |
||
| 171 | SetWindowText (TabControl_GetItem (tab_control, EDITBOX_LOGIN), options.network.login); |
||
| 172 | SetWindowText (TabControl_GetItem (tab_control, EDITBOX_PASSWORD), options.network.password); |
||
| 173 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWPUBLICCHAT), (options.network.want_publicchat ? BST_CHECKED : BST_UNCHECKED)); |
||
| 174 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWSERVERMESSAGES), (options.network.want_servermessages ? BST_CHECKED : BST_UNCHECKED)); |
||
| 175 | |||
| 176 | // setup page 3 (display) |
||
| 59 | pmbaty | 177 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_LANGUAGE), LOCALIZE (L"Options_Language")); |
| 124 | pmbaty | 178 | ComboBox_AddString (TabControl_GetItem (tab_control, COMBOBOX_LANGUAGE), LOCALIZE (L"Options_SystemLanguage")); |
| 59 | pmbaty | 179 | for (language_index = 0; language_index < language_count; language_index++) |
| 180 | ComboBox_AddString (TabControl_GetItem (tab_control, COMBOBOX_LANGUAGE), languages[language_index].name); // add it to the combo box |
||
| 124 | pmbaty | 181 | if (is_language_auto) |
| 182 | ComboBox_SetCurSel (TabControl_GetItem (tab_control, COMBOBOX_LANGUAGE), 0); // select the right entry |
||
| 183 | else |
||
| 184 | ComboBox_SetCurSel (TabControl_GetItem (tab_control, COMBOBOX_LANGUAGE), 1 + language_id); // select the right entry |
||
| 59 | pmbaty | 185 | |
| 1 | pmbaty | 186 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_FULLSCREEN), LOCALIZE (L"Options_Fullscreen")); |
| 187 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_TEXTUREFILTERING), LOCALIZE (L"Options_TextureFiltering")); |
||
| 188 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_HIGHQUALITYFILTERING), LOCALIZE (L"Options_HiQualityFiltering")); |
||
| 189 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SPECULARLIGHTING), LOCALIZE (L"Options_SpecularLighting")); |
||
| 190 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWREFLECTIONS), LOCALIZE (L"Options_ShowReflections")); |
||
| 193 | pmbaty | 191 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_USESEPIAFORHISTORY), LOCALIZE (L"Options_UseSepiaForHistory")); |
| 192 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_STARTWITHTOPVIEW), LOCALIZE (L"Options_StartWithTopView")); |
||
| 1 | pmbaty | 193 | |
| 193 | pmbaty | 194 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_PARTLETTERS), LOCALIZE (L"Options_PartLetters")); |
| 195 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_PARTNAME_ROOK), LOCALIZE (L"Part_Rook")); |
||
| 196 | hCtlWnd = TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_ROOK); SetWindowText (hCtlWnd, options.part_letters.rook); SendMessage (hCtlWnd, EM_LIMITTEXT, 1, 0); |
||
| 197 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_PARTNAME_KNIGHT), LOCALIZE (L"Part_Knight")); |
||
| 198 | hCtlWnd = TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_KNIGHT); SetWindowText (hCtlWnd, options.part_letters.knight); SendMessage (hCtlWnd, EM_LIMITTEXT, 1, 0); |
||
| 199 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_PARTNAME_BISHOP), LOCALIZE (L"Part_Bishop")); |
||
| 200 | hCtlWnd = TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_BISHOP); SetWindowText (hCtlWnd, options.part_letters.bishop); SendMessage (hCtlWnd, EM_LIMITTEXT, 1, 0); |
||
| 201 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_PARTNAME_QUEEN), LOCALIZE (L"Part_Queen")); |
||
| 202 | hCtlWnd = TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_QUEEN); SetWindowText (hCtlWnd, options.part_letters.queen); SendMessage (hCtlWnd, EM_LIMITTEXT, 1, 0); |
||
| 203 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_PARTNAME_KING), LOCALIZE (L"Part_King")); |
||
| 204 | hCtlWnd = TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_KING); SetWindowText (hCtlWnd, options.part_letters.king); SendMessage (hCtlWnd, EM_LIMITTEXT, 1, 0); |
||
| 205 | SetWindowText (TabControl_GetItem (tab_control, BUTTON_STANDARD), LOCALIZE (L"Standard")); |
||
| 206 | |||
| 1 | pmbaty | 207 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_FULLSCREEN), (options.want_fullscreen ? BST_CHECKED : BST_UNCHECKED)); |
| 208 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_TEXTUREFILTERING), (options.want_filtering ? BST_CHECKED : BST_UNCHECKED)); |
||
| 209 | EnableWindow (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_HIGHQUALITYFILTERING), options.want_filtering); |
||
| 210 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_HIGHQUALITYFILTERING), (options.want_hiquality ? BST_CHECKED : BST_UNCHECKED)); |
||
| 211 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SPECULARLIGHTING), (options.want_specularlighting ? BST_CHECKED : BST_UNCHECKED)); |
||
| 212 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWREFLECTIONS), (options.want_reflections ? BST_CHECKED : BST_UNCHECKED)); |
||
| 193 | pmbaty | 213 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_USESEPIAFORHISTORY), (options.want_sepiafilter ? BST_CHECKED : BST_UNCHECKED)); |
| 214 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_STARTWITHTOPVIEW), (options.want_startwithtopview ? BST_CHECKED : BST_UNCHECKED)); |
||
| 1 | pmbaty | 215 | |
| 216 | // setup page 4 (gameplay) |
||
| 217 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWLASTMOVE), LOCALIZE (L"Options_ShowLastMove")); |
||
| 218 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWPOSSIBLEMOVES), LOCALIZE (L"Options_ShowPossibleMoves")); |
||
| 219 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWTHREATS), LOCALIZE (L"Options_ShowThreats")); |
||
| 220 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWANIMATIONS), LOCALIZE (L"Options_ShowAnimations")); |
||
| 130 | pmbaty | 221 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWSLIDINGANIMATIONS), LOCALIZE (L"Options_ShowSlidingAnimations")); |
| 1 | pmbaty | 222 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWTAKENPARTS), LOCALIZE (L"Options_ShowTakenParts")); |
| 223 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWTURN), LOCALIZE (L"Options_ShowTurn")); |
||
| 224 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWCLOCK), LOCALIZE (L"Options_ShowClock")); |
||
| 225 | SetWindowText (TabControl_GetItem (tab_control, BUTTON_COLORCLOCK), LOCALIZE (L"Button_Color")); |
||
| 226 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWHISTORY), LOCALIZE (L"Options_ShowHistory")); |
||
| 227 | SetWindowText (TabControl_GetItem (tab_control, BUTTON_COLORHISTORY), LOCALIZE (L"Button_Color")); |
||
| 193 | pmbaty | 228 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_PREFERBLACKSIDE), LOCALIZE (L"Options_PreferBlackSide")); |
| 1 | pmbaty | 229 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ROTATEBOARD), LOCALIZE (L"Options_RotateBoard")); |
| 230 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_ROTATESPEED), LOCALIZE (L"Options_RotateSpeed")); |
||
| 231 | SetWindowText (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_PLAYSOUNDS), LOCALIZE (L"Options_PlaySounds")); |
||
| 232 | |||
| 233 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWLASTMOVE), (options.want_lastmove ? BST_CHECKED : BST_UNCHECKED)); |
||
| 234 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWPOSSIBLEMOVES), (options.want_possiblemoves ? BST_CHECKED : BST_UNCHECKED)); |
||
| 235 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWTHREATS), (options.want_threats ? BST_CHECKED : BST_UNCHECKED)); |
||
| 236 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWANIMATIONS), (options.want_animations ? BST_CHECKED : BST_UNCHECKED)); |
||
| 130 | pmbaty | 237 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWSLIDINGANIMATIONS), (options.want_slidinganimations ? BST_CHECKED : BST_UNCHECKED)); |
| 1 | pmbaty | 238 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWTAKENPARTS), (options.want_takenparts ? BST_CHECKED : BST_UNCHECKED)); |
| 239 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWTURN), (options.want_turn ? BST_CHECKED : BST_UNCHECKED)); |
||
| 240 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWCLOCK), (options.want_clock ? BST_CHECKED : BST_UNCHECKED)); |
||
| 241 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWHISTORY), (options.want_history ? BST_CHECKED : BST_UNCHECKED)); |
||
| 193 | pmbaty | 242 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_PREFERBLACKSIDE), (options.want_playblackside ? BST_CHECKED : BST_UNCHECKED)); |
| 1 | pmbaty | 243 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ROTATEBOARD), (options.want_autorotateon1vs1 ? BST_CHECKED : BST_UNCHECKED)); |
| 244 | Button_SetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_PLAYSOUNDS), (options.want_sounds ? BST_CHECKED : BST_UNCHECKED)); |
||
| 245 | SendMessage (TabControl_GetItem (tab_control, SLIDER_OPTIONS_ROTATESPEED), TBM_SETRANGE, true, MAKELONG (5, 80)); |
||
| 246 | SendMessage (TabControl_GetItem (tab_control, SLIDER_OPTIONS_ROTATESPEED), TBM_SETPOS, true, options.rotate_speed); |
||
| 247 | |||
| 248 | // set the selected color to the current game clock color (convert from RGBA to GDI BGR) |
||
| 249 | selectedcolor_clock = ((options.clock_color & 0x0000ff00) << 8) |
||
| 250 | | ((options.clock_color & 0x00ff0000) >> 8) |
||
| 251 | | ((options.clock_color & 0xff000000) >> 24); |
||
| 252 | |||
| 253 | // set the selected color to the current game history color (convert from RGBA to GDI BGR) |
||
| 254 | selectedcolor_history = ((options.history_color & 0x0000ff00) << 8) |
||
| 255 | | ((options.history_color & 0x00ff0000) >> 8) |
||
| 256 | | ((options.history_color & 0xff000000) >> 24); |
||
| 257 | |||
| 258 | // set focus on the first settable item |
||
| 193 | pmbaty | 259 | hCtlWnd = TabControl_GetItem (tab_control, EDITBOX_LOGIN); |
| 260 | SendMessage (hCtlWnd, EM_SETSEL, 0, -1); // select all text |
||
| 261 | SetFocus (hCtlWnd); |
||
| 1 | pmbaty | 262 | } |
| 263 | |||
| 264 | // else did we click the close button on the title bar ? |
||
| 265 | else if (message == WM_CLOSE) |
||
| 266 | EndDialog (hWnd, 0); // close the dialog box |
||
| 267 | |||
| 268 | // else did we take action on one of the controls ? |
||
| 269 | else if (message == WM_COMMAND) |
||
| 270 | { |
||
| 271 | // did we cancel the dialog box ? (IDCANCEL is a system-wide dialog box handler value, that catches the ESC key) |
||
| 272 | if (wParam_loword == IDCANCEL) |
||
| 273 | EndDialog (hWnd, 0); // close the dialog box |
||
| 274 | |||
| 275 | // else was it the OK button ? |
||
| 276 | else if (wParam_loword == BUTTON_OK) |
||
| 277 | { |
||
| 278 | // grab the new parameters and close the dialog box |
||
| 279 | |||
| 280 | // set the server address, login and password |
||
| 281 | GetWindowText (TabControl_GetItem (tab_control, EDITBOX_SERVERADDRESS), server_string, WCHAR_SIZEOF (server_string)); |
||
| 282 | options.network.server_address[0] = 0; // default values |
||
| 283 | options.network.server_port = 0; |
||
| 284 | port_string = wcschr (server_string, L':'); // find the address:port separator |
||
| 285 | if (port_string != NULL) |
||
| 286 | { |
||
| 287 | port_string[0] = 0; // split the string |
||
| 288 | options.network.server_port = _wtoi (&port_string[1]); // and read the port |
||
| 289 | } |
||
| 290 | wcscpy_s (options.network.server_address, WCHAR_SIZEOF (options.network.server_address), server_string); // now read the address |
||
| 291 | GetWindowText (TabControl_GetItem (tab_control, EDITBOX_LOGIN), options.network.login, WCHAR_SIZEOF (options.network.login)); |
||
| 292 | GetWindowText (TabControl_GetItem (tab_control, EDITBOX_PASSWORD), options.network.password, WCHAR_SIZEOF (options.network.password)); |
||
| 293 | |||
| 59 | pmbaty | 294 | // display |
| 124 | pmbaty | 295 | language_index = ComboBox_GetCurSel (TabControl_GetItem (tab_control, COMBOBOX_LANGUAGE)); |
| 296 | is_language_auto = (language_index == 0); // first, see if the system language is selected |
||
| 297 | if (!is_language_auto) |
||
| 298 | language_id = language_index - 1; // because slot #0 of the list is taken by "System Language" |
||
| 59 | pmbaty | 299 | CreateOrUpdateApplicationMenu (); // on language change, update the application menu |
| 193 | pmbaty | 300 | options.want_fullscreen = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_FULLSCREEN)) != 0); |
| 301 | options.want_filtering = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_TEXTUREFILTERING)) != 0); |
||
| 302 | options.want_specularlighting = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SPECULARLIGHTING)) != 0); |
||
| 303 | options.want_reflections = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWREFLECTIONS)) != 0); |
||
| 304 | options.want_sepiafilter = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_USESEPIAFORHISTORY)) != 0); |
||
| 305 | options.want_startwithtopview = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_STARTWITHTOPVIEW)) != 0); |
||
| 59 | pmbaty | 306 | |
| 193 | pmbaty | 307 | // make sure part letters are unique, only save them if they are |
| 308 | GetWindowText (TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_ROOK), &temp_string[0], WCHAR_SIZEOF (temp_string) - 0); |
||
| 309 | GetWindowText (TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_KNIGHT), &temp_string[2], WCHAR_SIZEOF (temp_string) - 2); |
||
| 310 | GetWindowText (TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_BISHOP), &temp_string[4], WCHAR_SIZEOF (temp_string) - 4); |
||
| 311 | GetWindowText (TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_QUEEN), &temp_string[6], WCHAR_SIZEOF (temp_string) - 6); |
||
| 312 | GetWindowText (TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_KING), &temp_string[8], WCHAR_SIZEOF (temp_string) - 8); |
||
| 313 | temp_string[1] = temp_string[3] = temp_string[5] = temp_string[7] = temp_string[9] = 0; // terminate the strings ourselves |
||
| 314 | if ( (temp_string[2] != temp_string[0]) && (temp_string[4] != temp_string[0]) && (temp_string[4] != temp_string[2]) && (temp_string[6] != temp_string[0]) && (temp_string[6] != temp_string[2]) |
||
| 315 | && (temp_string[6] != temp_string[4]) && (temp_string[8] != temp_string[0]) && (temp_string[8] != temp_string[2]) && (temp_string[8] != temp_string[4]) && (temp_string[8] != temp_string[6])) |
||
| 316 | { |
||
| 317 | wcscpy_s (options.part_letters.rook, WCHAR_SIZEOF (options.part_letters.rook), &temp_string[0]); |
||
| 318 | wcscpy_s (options.part_letters.knight, WCHAR_SIZEOF (options.part_letters.knight), &temp_string[2]); |
||
| 319 | wcscpy_s (options.part_letters.bishop, WCHAR_SIZEOF (options.part_letters.bishop), &temp_string[4]); |
||
| 320 | wcscpy_s (options.part_letters.queen, WCHAR_SIZEOF (options.part_letters.queen), &temp_string[6]); |
||
| 321 | wcscpy_s (options.part_letters.king, WCHAR_SIZEOF (options.part_letters.king), &temp_string[8]); |
||
| 322 | } |
||
| 323 | |||
| 59 | pmbaty | 324 | // gameplay |
| 325 | options.network.want_servermessages = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWSERVERMESSAGES)) != 0); |
||
| 326 | options.network.want_publicchat = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWPUBLICCHAT)) != 0); |
||
| 1 | pmbaty | 327 | options.want_lastmove = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWLASTMOVE)) != 0); |
| 328 | options.want_possiblemoves = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWPOSSIBLEMOVES)) != 0); |
||
| 329 | options.want_threats = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWTHREATS)) != 0); |
||
| 330 | options.want_animations = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWANIMATIONS)) != 0); |
||
| 130 | pmbaty | 331 | options.want_slidinganimations = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWSLIDINGANIMATIONS)) != 0); |
| 1 | pmbaty | 332 | options.want_takenparts = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWTAKENPARTS)) != 0); |
| 333 | options.want_turn = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWTURN)) != 0); |
||
| 334 | options.want_clock = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWCLOCK)) != 0); |
||
| 335 | options.clock_color = 0 | ((selectedcolor_clock & 0x000000ff) << 24) |
||
| 336 | | ((selectedcolor_clock & 0x0000ff00) << 8) |
||
| 337 | | ((selectedcolor_clock & 0x00ff0000) >> 8); // convert from GDI BGR to RGBA |
||
| 338 | options.want_history = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWHISTORY)) != 0); |
||
| 339 | options.history_color = 0 | ((selectedcolor_history & 0x000000ff) << 24) |
||
| 340 | | ((selectedcolor_history & 0x0000ff00) << 8) |
||
| 341 | | ((selectedcolor_history & 0x00ff0000) >> 8); // convert from GDI BGR to RGBA |
||
| 193 | pmbaty | 342 | options.want_playblackside = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_PREFERBLACKSIDE)) != 0); |
| 1 | pmbaty | 343 | options.want_autorotateon1vs1 = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ROTATEBOARD)) != 0); |
| 344 | options.want_sounds = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_PLAYSOUNDS)) != 0); |
||
| 40 | pmbaty | 345 | options.rotate_speed = SendMessage (TabControl_GetItem (tab_control, SLIDER_OPTIONS_ROTATESPEED), TBM_GETPOS, 0, 0); |
| 1 | pmbaty | 346 | |
| 40 | pmbaty | 347 | // engine options |
| 348 | ComboBox_GetLBText (TabControl_GetItem (tab_control, COMBOBOX_ENGINE), ComboBox_GetCurSel (TabControl_GetItem (tab_control, COMBOBOX_ENGINE)), temp_string); |
||
| 119 | pmbaty | 349 | for (engine_index = 0; engine_index < options.engine.program_count; engine_index++) |
| 150 | pmbaty | 350 | if ((_wcsicmp (temp_string, options.engine.programs[engine_index].friendly_name) == 0) && (engine_index != options.engine.selected_program)) |
| 119 | pmbaty | 351 | { |
| 352 | options.engine.selected_program = engine_index; |
||
| 178 | pmbaty | 353 | if ((the_board.game_state == STATE_SETUPPOSITION) || ((the_board.game_state == STATE_PLAYING) && (the_board.move_count > 1))) |
| 354 | MessageBox (hWnd, LOCALIZE (L"Options_ChessEngineChangeWillAffectNextGame"), LOCALIZE (L"ImportantMessage"), MB_ICONINFORMATION | MB_OK); |
||
| 119 | pmbaty | 355 | } |
| 40 | pmbaty | 356 | |
| 1 | pmbaty | 357 | options.engine.depth = SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL), TBM_GETPOS, 0, 0); |
| 40 | pmbaty | 358 | if (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS))) |
| 359 | options.engine.blunder_chances = SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), TBM_GETPOS, 0, 0); |
||
| 360 | else |
||
| 361 | options.engine.blunder_chances = 0; |
||
| 362 | if (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINERESIGNS))) |
||
| 363 | options.engine.obstinacy_level = SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), TBM_GETPOS, 0, 0); |
||
| 364 | else |
||
| 365 | options.engine.obstinacy_level = -1; |
||
| 1 | pmbaty | 366 | |
| 367 | EndDialog (hWnd, 0); // close the dialog box |
||
| 368 | } |
||
| 369 | |||
| 370 | // else was it the cancel button ? |
||
| 371 | else if (wParam_loword == BUTTON_CANCEL) |
||
| 372 | EndDialog (hWnd, 0); // close the dialog box |
||
| 373 | |||
| 29 | pmbaty | 374 | // else was it the expert settings button ? |
| 375 | else if (wParam_loword == BUTTON_EXPERTSETTINGS) |
||
| 376 | { |
||
| 189 | pmbaty | 377 | swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), L"%s\\engines\\%s\\init.txt", app_path, options.engine.programs[ComboBox_GetCurSel (TabControl_GetItem (tab_control, COMBOBOX_ENGINE))].folder); |
| 29 | pmbaty | 378 | ShellExecute (NULL, L"open", temp_string, NULL, NULL, SW_SHOWNORMAL); // open the engine initialization text file |
| 379 | } |
||
| 380 | |||
| 193 | pmbaty | 381 | // else are we focusing to a part abbreviation edit box ? |
| 382 | else if ((HIWORD (wParam) == EN_SETFOCUS) && ( (wParam_loword == EDITBOX_OPTIONS_PARTLETTER_ROOK) || (wParam_loword == EDITBOX_OPTIONS_PARTLETTER_KNIGHT) || (wParam_loword == EDITBOX_OPTIONS_PARTLETTER_BISHOP) |
||
| 383 | || (wParam_loword == EDITBOX_OPTIONS_PARTLETTER_QUEEN) || (wParam_loword == EDITBOX_OPTIONS_PARTLETTER_KING))) |
||
| 384 | PostMessage ((HWND) lParam, EM_SETSEL, 0, -1); // select the whole text |
||
| 385 | |||
| 386 | // else are we editing a part abbreviation edit box ? |
||
| 387 | else if ((HIWORD (wParam) == EN_CHANGE) && ( (wParam_loword == EDITBOX_OPTIONS_PARTLETTER_ROOK) || (wParam_loword == EDITBOX_OPTIONS_PARTLETTER_KNIGHT) || (wParam_loword == EDITBOX_OPTIONS_PARTLETTER_BISHOP) |
||
| 388 | || (wParam_loword == EDITBOX_OPTIONS_PARTLETTER_QUEEN) || (wParam_loword == EDITBOX_OPTIONS_PARTLETTER_KING))) |
||
| 389 | { |
||
| 390 | static bool do_not_hook = false; |
||
| 391 | if (!do_not_hook) |
||
| 392 | { |
||
| 393 | size_t len; |
||
| 394 | GetWindowText ((HWND) lParam, temp_string, WCHAR_SIZEOF (temp_string)); |
||
| 395 | len = wcslen (temp_string); |
||
| 396 | temp_string[0] = (len > 0 ? towupper (temp_string[0]) : 0); |
||
| 397 | temp_string[1] = 0; |
||
| 398 | do_not_hook = true; // FIXME: dirty |
||
| 399 | SetWindowText ((HWND) lParam, temp_string); // update text |
||
| 400 | PostMessage ((HWND) lParam, EM_SETSEL, 0, -1); // select the whole text |
||
| 401 | do_not_hook = false; // FIXME: dirty |
||
| 402 | } |
||
| 403 | } |
||
| 404 | |||
| 405 | // else was it the "standard part abbreviations" button ? |
||
| 406 | else if (wParam_loword == BUTTON_STANDARD) |
||
| 407 | { |
||
| 408 | // reset part abbreviation letters to the international defaults |
||
| 409 | wcscpy_s (options.part_letters.rook, WCHAR_SIZEOF (options.part_letters.rook), L"R"); SetWindowText (TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_ROOK), options.part_letters.rook); |
||
| 410 | wcscpy_s (options.part_letters.knight, WCHAR_SIZEOF (options.part_letters.rook), L"N"); SetWindowText (TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_KNIGHT), options.part_letters.knight); |
||
| 411 | wcscpy_s (options.part_letters.bishop, WCHAR_SIZEOF (options.part_letters.rook), L"B"); SetWindowText (TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_BISHOP), options.part_letters.bishop); |
||
| 412 | wcscpy_s (options.part_letters.queen, WCHAR_SIZEOF (options.part_letters.rook), L"Q"); SetWindowText (TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_QUEEN), options.part_letters.queen); |
||
| 413 | wcscpy_s (options.part_letters.king, WCHAR_SIZEOF (options.part_letters.rook), L"K"); SetWindowText (TabControl_GetItem (tab_control, EDITBOX_OPTIONS_PARTLETTER_KING), options.part_letters.king); |
||
| 414 | } |
||
| 415 | |||
| 1 | pmbaty | 416 | // else is it the rotate board check box ? if so, enable or disable the speed slider |
| 417 | else if (wParam_loword == CHECKBOX_OPTIONS_ROTATEBOARD) |
||
| 418 | { |
||
| 419 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_OPTIONS_ROTATESPEED), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ROTATEBOARD))); |
||
| 420 | EnableWindow (TabControl_GetItem (tab_control, SLIDER_OPTIONS_ROTATESPEED), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ROTATEBOARD))); |
||
| 421 | } |
||
| 422 | |||
| 29 | pmbaty | 423 | // 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 |
| 424 | else if (wParam_loword == CHECKBOX_OPTIONS_IAMANEXPERT) |
||
| 425 | { |
||
| 426 | options.engine.is_expert_mode = (Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_IAMANEXPERT)) == BST_CHECKED); |
||
| 427 | EnableWindow (TabControl_GetItem (tab_control, BUTTON_EXPERTSETTINGS), options.engine.is_expert_mode); |
||
| 428 | SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL), TBM_SETRANGE, true, MAKELONG (1, options.engine.max_depth * (options.engine.is_expert_mode ? 3 : 1))); |
||
| 429 | } |
||
| 430 | |||
| 1 | pmbaty | 431 | // else is it the allow engine blunders check box ? if so, enable or disable the blunder chance slider |
| 432 | else if (wParam_loword == CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS) |
||
| 433 | { |
||
| 434 | is_checked = Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINEBLUNDERS)); |
||
| 435 | EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), is_checked); |
||
| 436 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_1PCCHANCE), is_checked); |
||
| 437 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_100PCCHANCE), is_checked); |
||
| 26 | pmbaty | 438 | if (is_checked) |
| 40 | pmbaty | 439 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d %%", SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), TBM_GETPOS, 0, 0)); |
| 26 | pmbaty | 440 | else |
| 441 | value_string[0] = 0; |
||
| 442 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINEBLUNDERSVALUE), value_string); |
||
| 1 | pmbaty | 443 | } |
| 444 | |||
| 445 | // else is it the allow engine resigns check box ? if so, enable or disable the blunder chance slider |
||
| 446 | else if (wParam_loword == CHECKBOX_OPTIONS_ALLOWENGINERESIGNS) |
||
| 447 | { |
||
| 448 | is_checked = Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_ALLOWENGINERESIGNS)); |
||
| 449 | EnableWindow (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), is_checked); |
||
| 450 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_YIELDING), is_checked); |
||
| 451 | EnableWindow (TabControl_GetItem (tab_control, STATICTEXT_OBSTINATE), is_checked); |
||
| 26 | pmbaty | 452 | if (is_checked) |
| 40 | pmbaty | 453 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d", 1 + SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), TBM_GETPOS, 0, 0)); |
| 26 | pmbaty | 454 | else |
| 455 | value_string[0] = 0; |
||
| 456 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINERESIGNVALUE), value_string); |
||
| 1 | pmbaty | 457 | } |
| 458 | |||
| 459 | // else is it the enable filtering check box ? if so, enable or disable the high quality checkbox |
||
| 460 | else if (wParam_loword == CHECKBOX_OPTIONS_TEXTUREFILTERING) |
||
| 461 | EnableWindow (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_HIGHQUALITYFILTERING), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_TEXTUREFILTERING))); |
||
| 462 | |||
| 130 | pmbaty | 463 | // else is it the show animations check box ? if so, enable or disable the show sliding animations checkbox too |
| 464 | else if (wParam_loword == CHECKBOX_OPTIONS_SHOWANIMATIONS) |
||
| 465 | EnableWindow (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWSLIDINGANIMATIONS), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWANIMATIONS))); |
||
| 466 | |||
| 1 | pmbaty | 467 | // else is it the show game clock check box ? if so, enable or disable the game clock color button |
| 468 | else if (wParam_loword == CHECKBOX_OPTIONS_SHOWCLOCK) |
||
| 469 | EnableWindow (TabControl_GetItem (tab_control, BUTTON_COLORCLOCK), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWCLOCK))); |
||
| 470 | |||
| 471 | // else is it the game clock color button ? |
||
| 472 | else if (wParam_loword == BUTTON_COLORCLOCK) |
||
| 473 | { |
||
| 474 | // prepare a color pick dialog box |
||
| 475 | memset (&cc, 0, sizeof (cc)); |
||
| 476 | cc.lStructSize = sizeof (cc); |
||
| 477 | cc.hwndOwner = hWnd; |
||
| 478 | cc.lpCustColors = (unsigned long *) custom_colors; |
||
| 479 | cc.rgbResult = selectedcolor_clock; |
||
| 480 | cc.Flags = CC_FULLOPEN | CC_RGBINIT; |
||
| 481 | |||
| 482 | // fire it up |
||
| 483 | if (ChooseColor (&cc)) |
||
| 484 | selectedcolor_clock = cc.rgbResult; // save away returned color |
||
| 485 | } |
||
| 486 | |||
| 487 | // else is it the show game history check box ? if so, enable or disable the game history color button |
||
| 488 | else if (wParam_loword == CHECKBOX_OPTIONS_SHOWHISTORY) |
||
| 489 | EnableWindow (TabControl_GetItem (tab_control, BUTTON_COLORHISTORY), Button_GetCheck (TabControl_GetItem (tab_control, CHECKBOX_OPTIONS_SHOWHISTORY))); |
||
| 490 | |||
| 491 | // else is it the game history color button ? |
||
| 492 | else if (wParam_loword == BUTTON_COLORHISTORY) |
||
| 493 | { |
||
| 494 | // prepare a color pick dialog box |
||
| 495 | memset (&cc, 0, sizeof (cc)); |
||
| 496 | cc.lStructSize = sizeof (cc); |
||
| 497 | cc.hwndOwner = hWnd; |
||
| 498 | cc.lpCustColors = (unsigned long *) custom_colors; |
||
| 499 | cc.rgbResult = selectedcolor_history; |
||
| 500 | cc.Flags = CC_FULLOPEN | CC_RGBINIT; |
||
| 501 | |||
| 502 | // fire it up |
||
| 503 | if (ChooseColor (&cc)) |
||
| 504 | selectedcolor_history = cc.rgbResult; // save away returned color |
||
| 505 | } |
||
| 506 | |||
| 507 | // else is it the create/manage account hyperlink ? |
||
| 508 | else if (wParam_loword == STATICTEXT_OPTIONS_SERVERURL) |
||
| 509 | { |
||
| 59 | pmbaty | 510 | swprintf_s (temp_string, WCHAR_SIZEOF (temp_string), ACCOUNTCREATION_URL, languages[language_id].name); // build account creation url |
| 29 | pmbaty | 511 | ShellExecute (NULL, L"open", temp_string, NULL, NULL, SW_MAXIMIZE); // open the accounts page in the default browser, maximized |
| 1 | pmbaty | 512 | } |
| 513 | } |
||
| 514 | |||
| 26 | pmbaty | 515 | // else is it a notification for a slider moving ? |
| 516 | else if (message == WM_HSCROLL) |
||
| 517 | { |
||
| 518 | // is it the engine prediction level slider ? if so, update the slider value text |
||
| 519 | if ((HWND) lParam == TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL)) |
||
| 520 | { |
||
| 189 | pmbaty | 521 | level = SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_DIFFICULTYLEVEL), TBM_GETPOS, 0, 0); // retrieve the difficulty level |
| 522 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d", level); |
||
| 26 | pmbaty | 523 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINESEARCHDEPTHVALUE), value_string); |
| 189 | pmbaty | 524 | if ((level > 20) && (wParam_loword == SB_THUMBPOSITION)) |
| 525 | MessageBox (hWnd, LOCALIZE (L"Options_ExcessiveDifficulty"), LOCALIZE (L"ImportantMessage"), MB_ICONWARNING | MB_OK); // if the user is a dumb fuck, let him know that he is (FIXME: this displays twice) |
||
| 26 | pmbaty | 526 | } |
| 527 | |||
| 528 | // else is it the engine blunders slider ? if so, update the slider value text |
||
| 529 | else if ((HWND) lParam == TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE)) |
||
| 530 | { |
||
| 531 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d %%", SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_BLUNDERCHANCE), TBM_GETPOS, 0, 0)); |
||
| 532 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINEBLUNDERSVALUE), value_string); |
||
| 533 | } |
||
| 534 | |||
| 535 | // else is it the engine obstinacy slider ? if so, update the slider value text |
||
| 536 | else if ((HWND) lParam == TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY)) |
||
| 537 | { |
||
| 538 | swprintf_s (value_string, WCHAR_SIZEOF (value_string), L"%d", 1 + SendMessage (TabControl_GetItem (tab_control, SLIDER_ENGINE_OBSTINACY), TBM_GETPOS, 0, 0)); |
||
| 539 | SetWindowText (TabControl_GetItem (tab_control, STATICTEXT_ENGINERESIGNVALUE), value_string); |
||
| 540 | } |
||
| 541 | } |
||
| 542 | |||
| 1 | pmbaty | 543 | // else is it a notification for the tab control ? |
| 544 | else if ((message == WM_NOTIFY) && (((NMHDR *) lParam)->hwndFrom == GetDlgItem (hWnd, TABBOX_OPTIONS))) |
||
| 545 | TabControl_Notify ((NMHDR *) lParam); |
||
| 546 | |||
| 547 | // call the default dialog message processing function to keep things going |
||
| 548 | return (false); |
||
| 549 | } |