X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwsettings.c;h=768a3867c9b6276184be32cf85801f8e6b076d0f;hb=5e0403d88fc0c96cfcc246ddb7f08462b584ae62;hp=bfad5880333ffdf3041a080621d17ff504dbc370;hpb=01bccb194cfca30703d9b49b05a6f2837d67f0f0;p=xboard.git diff --git a/winboard/wsettings.c b/winboard/wsettings.c index bfad588..768a386 100644 --- a/winboard/wsettings.c +++ b/winboard/wsettings.c @@ -37,7 +37,7 @@ char *engineName, *engineDir, *engineChoice, *engineLine, *nickName, *params; Boolean isUCI, hasBook, storeVariant, v1, addToList, useNick, isUCCI; extern Option installOptions[], matchOptions[]; char *engineNr[] = { N_("First"), N_("Second"), NULL }; -char *engineList[1000] = {" "}, *engineMnemonic[1000] = {""}; +char *engineList[MAXENGINES] = {" "}, *engineMnemonic[MAXENGINES] = {""}; void (*okFunc)(); ChessProgramState *activeCps; Option *activeList; @@ -366,7 +366,7 @@ GetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList) if(!cps) { char *p; p = (optionList[j].type != FileName ? strdup(text) : InterpretFileName(text, homeDir)); // all files relative to homeDir! - FREE(*(char**)optionList[j].target); *(char**)optionList[j].target = p; + FREE(*(char**)optionList[j].target); *(char**)optionList[j].target = p; free(text); text = p; while(*p++ = *text++) if(p[-1] == '\r') p--; // crush CR break; @@ -387,9 +387,9 @@ GetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList) if(!success) break; new = -1; for(k=0; k 0) { if(*(char**)optionList[j].target) free(*(char**)optionList[j].target); *(char**)optionList[j].target = strdup(optionList[j].choice[new]); break; @@ -480,6 +480,7 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa } if(j < 0) break; if(comboCallback && activeList[j].type == ComboBox && HIWORD(wParam) == CBN_SELCHANGE) { + if(j > 5) break; // Yegh! Must solve problem with more than one ombobox in dialog (*comboCallback)(hDlg); break; } else @@ -628,6 +629,7 @@ EngineOptionsPopup(HWND hwnd, ChessProgramState *cps) int InstallOK() { + if(engineLine[0] == '#') { DisplayError(_("Select single engine from the group"), 0); return 0; } if(isUCCI) isUCI = 2; if(engineChoice[0] == engineNr[0][0]) Load(&first, 0); else Load(&second, 1); return 1; @@ -670,10 +672,27 @@ GenericPopup(HWND hwnd, Option *optionList) return; } -void LoadEnginePopUp(HWND hwnd) +int +EnterGroup(HWND hDlg) { - int n=0; + char buf[MSG_SIZ]; + HANDLE hwndCombo = GetDlgItem(hDlg, 2001+2*1); + int i = ComboBox_GetCurSel(hwndCombo); + if(i == 0) buf[0] = NULLCHAR; // back to top level + else if(engineList[i][0] == '#') safeStrCpy(buf, engineList[i], MSG_SIZ); // group header, open group + else return 0; // normal line, select engine + installOptions[0].max = NamesToList(firstChessProgramNames, engineList, engineMnemonic, buf); // replace list by only the group contents + SendMessage(hwndCombo, CB_RESETCONTENT, 0, 0); + SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) buf); + for(i=1; i