X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwsettings.c;h=04957e788a7f8feaa69964a9e72b9b64ac93ef93;hb=67306fc1d19afd45158b2dc16c1dfbc1bdecb4b7;hp=215ea189c89c0b2345754a315c8e5811656bfb33;hpb=5fcd68c64763478d3e05f58d4c21508e8dab97d5;p=xboard.git diff --git a/winboard/wsettings.c b/winboard/wsettings.c index 215ea18..04957e7 100644 --- a/winboard/wsettings.c +++ b/winboard/wsettings.c @@ -1,7 +1,8 @@ /* * woptions.h -- Options dialog box routines for WinBoard * - * Copyright 2003, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. + * Copyright 2003, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free + * Software Foundation, Inc. * * ------------------------------------------------------------------------ * @@ -455,6 +456,7 @@ GetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList) } char *defaultExt[] = { NULL, "pgn", "fen", "exe", "trn", "bin", "log", "ini" }; +HWND settingsDlg; LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { @@ -467,7 +469,7 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa // CenterWindow(hDlg, GetWindow(hDlg, GW_OWNER)); SetOptionValues(hDlg, activeCps, activeList); - + settingsDlg = hDlg; SetFocus(GetDlgItem(hDlg, IDCANCEL)); break; @@ -477,12 +479,12 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa case IDOK: if(!GetOptionValues(hDlg, activeCps, activeList)) return FALSE; EndDialog( hDlg, 0 ); - comboCallback = NULL; activeCps = NULL; + comboCallback = NULL; activeCps = NULL; settingsDlg = NULL; return TRUE; case IDCANCEL: EndDialog( hDlg, 1 ); - comboCallback = NULL; activeCps = NULL; + comboCallback = NULL; activeCps = NULL; settingsDlg = NULL; return TRUE; default: @@ -539,6 +541,12 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa GetOptionValues(hDlg, activeCps, activeList); else if( activeList[j].type != Button) break; else if( !activeCps ) { (*(ButtonCallback*) activeList[j].target)(hDlg); break; } + if(j == 0) { // WinBoard save button + SaveEngineSettings(activeCps == &second); + EndDialog( hDlg, 0 ); + comboCallback = NULL; activeCps = NULL; settingsDlg = NULL; + return TRUE; + } snprintf(buf, MSG_SIZ, "option %s\n", activeList[j].name); SendToProgram(buf, activeCps); } @@ -575,8 +583,8 @@ void AddOption(int x, int y, Control type, int i) int extra, num = ES_NUMBER; switch(type) { -// case Slider+100: -// num = 0; // needs text control for accepting negative numbers + case Spin+100: + num = 0; // needs text control for accepting negative numbers case Slider: case Spin: AddControl(x, y+1, 95, 9, 0x0082, SS_ENDELLIPSIS | WS_VISIBLE | WS_CHILD, i); @@ -691,6 +699,19 @@ EngineOptionsPopup(HWND hwnd, ChessProgramState *cps) return; } +void +RefreshSettingsDialog (ChessProgramState *cps, int val) +{ + int isUp = (settingsDlg != NULL); + if(val == 1) { + if(activeCps == cps && isUp) SetOptionValues(settingsDlg, cps, activeList); + return; + } + if(settingsDlg) EndDialog(settingsDlg, 1); + comboCallback = NULL; activeCps = NULL; settingsDlg = NULL; + if(val == 3 || isUp) EngineOptionsPopup(hwndMain, cps); +} + int EnterGroup P((HWND hDlg)); static int engineNr, selected; @@ -720,7 +741,7 @@ Option installOptions[] = { { 0, 0, 0, NULL, (void*) &storeVariant, NULL, NULL, CheckBox, N_("Force current variant with this engine") }, { 0, 0, 0, NULL, (void*) &isUCI, NULL, NULL, CheckBox, N_("UCI") }, { 0, 0, 0, NULL, (void*) &v1, NULL, NULL, CheckBox, N_("WB protocol v1 (skip waiting for features)") }, - { 0, 0, 0, NULL, (void*) &isUCCI, NULL, NULL, CheckBox, N_("UCCI / USI (uses specified /uxiAdapter)") }, + { 0, 0, 0, NULL, (void*) &isUCCI, NULL, NULL, CheckBox, N_("UCCI/USI/Arena960 (through /uxiAdapter)") }, { 0, 1, 0, NULL, (void*) &InstallOK, "", NULL, EndMark , "" } }; @@ -769,6 +790,7 @@ EnterGroup(HWND hDlg) void LoadEnginePopUp(HWND hwnd, int nr) { + if(*engineListFile) ParseSettingsFile(engineListFile, &engineListFile); // contains engine list isUCI = isUCCI = storeVariant = v1 = useNick = FALSE; addToList = hasBook = TRUE; // defaults engineNr = nr; if(engineDir) free(engineDir); engineDir = strdup(""); @@ -886,6 +908,7 @@ int MatchOK() void PseudoOK(HWND hDlg) { + if(matchMode) return; okFunc = 0; GetOptionValues(hDlg, activeCps, activeList); EndDialog( hDlg, 0 ); @@ -893,7 +916,12 @@ void PseudoOK(HWND hDlg) if(autoinc) appData.loadGameIndex = appData.loadPositionIndex = -(twice + 1); else if(!appData.loadGameFile[0]) appData.loadGameIndex = -2*twice; // kludge to pass value of "twice" for use in GUI book + if(!autoinc && !twice) { // prevent auto-inc being remembered in index value if checkboxes not ticked + if(appData.loadGameIndex < 0) appData.loadGameIndex = 0; + if(appData.loadPositionIndex < 0) appData.loadPositionIndex = 0; + } if(swiss) { appData.defaultMatchGames = 1; appData.tourneyType = -1; } + ASSIGN(appData.tourneyFile, tfName); } char *GetParticipants(HWND hDlg)