X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwsettings.c;h=6fc5c40682a7f677319e72d6271504a1e407ec18;hb=f29ff21f23c2a22fc55e14ba48c53d704c22289d;hp=58040c9305433ecbb70051095fdd936ccc6ac416;hpb=af0e7e39409348d713114eb0e41858f552076a21;p=xboard.git diff --git a/winboard/wsettings.c b/winboard/wsettings.c index 58040c9..6fc5c40 100644 --- a/winboard/wsettings.c +++ b/winboard/wsettings.c @@ -12,6 +12,7 @@ #include "config.h" #include +#include #include #include #include "common.h" @@ -33,15 +34,16 @@ int breaks[MAX_OPTIONS]; int checks, combos, buttons, layout, groups; char title[MSG_SIZ]; char *engineName, *engineDir, *engineChoice, *engineLine, *nickName, *params; -Boolean isUCI, hasBook, storeVariant, v1, addToList; +Boolean isUCI, hasBook, storeVariant, v1, addToList, useNick, isUCCI; extern Option installOptions[], matchOptions[]; char *engineNr[] = { N_("First"), N_("Second"), NULL }; char *engineList[1000] = {" "}, *engineMnemonic[1000] = {""}; void (*okFunc)(); ChessProgramState *activeCps; Option *activeList; -void InstallOK P((void)); -typedef void ButtonCallback(HWND h); +int InstallOK P((void)); +typedef int ButtonCallback(HWND h); +ButtonCallback *comboCallback; void PrintOpt(int i, int right, Option *optionList) @@ -160,6 +162,10 @@ LayoutOptions(int firstOption, int endOption, char *groupName, Option *optionLis breaks[layout/2] = lastType == Button ? 0 : 100; layoutList[layout++] = -1; layoutList[layout++] = nextOption - 1; + for(i=optionList[nextOption-1].min; i>0; i--) { // extra high text edit + layoutList[layout++] = -1; + layoutList[layout++] = -1; + } } else if(nextType == Spin) { // A spin will go in the next available position (right to left!). If it had to be prefixed with // a check or combo, this next position must be to the right, and the prefix goes left to it. @@ -256,6 +262,17 @@ struct { 0x0000, 0x0000, L"Engine #1 Settings ", 8, L"MS Sans Serif" }; +char * +AddCR(char *s) +{ + char *p=s, *q; + int n=0; + while(p = strchr(p, '\n')) p++, n++; // count linefeeds + p = q = malloc(strlen(s) + n + 1); + while(*p++ = *s++) if(p[-1] == '\n') p[-1] = '\r', *p++ = '\n'; + return q; +} + void SetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList) // Put all current option values in controls, and write option names next to them @@ -268,7 +285,7 @@ SetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList) int j=layoutList[i]; if(j == -2) SetDlgItemText( hDlg, 2000+2*i, ". . ." ); if(j<0) continue; - name = optionList[j].name; + name = cps ? optionList[j].name : _(optionList[j].name); if(strstr(name, "Polyglot ") == name) name += 9; SetDlgItemText( hDlg, 2000+2*i, name ); //if(appData.debugMode) fprintf(debugFP, "# %s = %d\n",optionList[j].name, optionList[j].value ); @@ -279,7 +296,9 @@ SetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList) case TextBox: case FileName: case PathName: - SetDlgItemText( hDlg, 2001+2*i, cps ? optionList[j].textValue : *(char**)optionList[j].target ); + name = AddCR(cps ? optionList[j].textValue : *(char**)optionList[j].target); // stupid CR... + SetDlgItemText( hDlg, 2001+2*i, name); + free(name); break; case CheckBox: CheckDlgButton( hDlg, 2000+2*i, (cps ? optionList[j].value : *(Boolean*)optionList[j].target) != 0); @@ -315,13 +334,13 @@ SetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList) } -void +int GetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList) // read out all controls, and if value is altered, remember it and send it to the engine { HANDLE hwndCombo; - int i, k, new=0, changed=0; - char **choices, newText[MSG_SIZ], buf[MSG_SIZ]; + int i, k, new=0, changed=0, len; + char **choices, newText[MSG_SIZ], buf[MSG_SIZ], *text; BOOL success; for(i=0; i>1)-2, 301, 13*(boxList[k+1]-boxList[k]>>1)+8, 0x0082, WS_VISIBLE | WS_CHILD | SS_BLACKFRAME, 2400); AddControl(x+60, y+13*(i>>1)-6, 10*groupNameList[k]/3, 10, - 0x0082, SS_ENDELLIPSIS | WS_VISIBLE | WS_CHILD, 2*(i+MAX_OPTIONS)); + 0x0082, SS_ENDELLIPSIS | WS_VISIBLE | WS_CHILD, 2*(ii+MAX_OPTIONS)); } j = layoutList[i]; if(j >= 0) AddOption(x+155-150*(i&1), y+13*(i>>1)+5, optionList[j].type, 2*i); - if(k < groups && i+1 == boxList[k+1]) { + if(k < groups && ii+1 == boxList[k+1]) { k += 2; y += 4; } - if(i+1 == breakPoint) { x += 318; y = -13*(breakPoint>>1); } + if(ii+1 == breakPoint) { x += 318; y = -13*(breakPoint>>1); } } // add butons at the bottom of dialog window y += 13*(nr>>1)+5; - AddControl(x+225, y+18*(buttonRows-1), 30, 15, 0x0080, BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD, IDOK-2000); - AddControl(x+260, y+18*(buttonRows-1), 40, 15, 0x0080, BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD, IDCANCEL-2000); for(i=0; i