X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwsettings.c;h=6fc5c40682a7f677319e72d6271504a1e407ec18;hb=f29ff21f23c2a22fc55e14ba48c53d704c22289d;hp=47cc1a3d4215d371012f53001d9999b1f5d946ef;hpb=00d7f7869e045cbed5037d39e1e56224692eb766;p=xboard.git diff --git a/winboard/wsettings.c b/winboard/wsettings.c index 47cc1a3..6fc5c40 100644 --- a/winboard/wsettings.c +++ b/winboard/wsettings.c @@ -285,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 ); @@ -362,7 +362,7 @@ GetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList) if(cps) len = MSG_SIZ - strlen(optionList[j].name) - 9, text = newText; else len = GetWindowTextLength(GetDlgItem(hDlg, 2001+2*i)) + 1, text = (char*) malloc(len); success = GetDlgItemText( hDlg, 2001+2*i, text, len ); - if(!success) break; + if(!success) text[0] = NULLCHAR; // empty string can be valid input if(!cps) { char *p; p = (optionList[j].type != FileName ? strdup(text) : InterpretFileName(text, homeDir)); // all files relative to homeDir! @@ -425,7 +425,7 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa // CenterWindow(hDlg, GetWindow(hDlg, GW_OWNER)); SetOptionValues(hDlg, activeCps, activeList); -// SetFocus(GetDlgItem(hDlg, IDC_NFG_Edit)); + SetFocus(GetDlgItem(hDlg, IDCANCEL)); break; @@ -486,6 +486,7 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa if( activeList[j].type == SaveButton) GetOptionValues(hDlg, activeCps, activeList); else if( activeList[j].type != Button) break; + else if( !activeCps ) { (*(ButtonCallback*) activeList[j].target)(hDlg); break; } snprintf(buf, MSG_SIZ, "option %s\n", activeList[j].name); SendToProgram(buf, activeCps); } @@ -535,7 +536,7 @@ void AddOption(int x, int y, Control type, int i) break; case Label: extra = activeList[layoutList[i/2]].value; - AddControl(x+extra, y+1, 290-extra, 9, 0x0082, SS_ENDELLIPSIS | WS_VISIBLE | WS_CHILD, i); + AddControl(x+extra, y+1, 290-extra, 9, 0x0082, SS_ENDELLIPSIS | WS_VISIBLE | WS_CHILD | WS_TABSTOP, i); break; case FileName: case PathName: @@ -555,7 +556,7 @@ void AddOption(int x, int y, Control type, int i) case Button: case ResetButton: case SaveButton: - AddControl(x-2, y, 65, 13, 0x0080, BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD, i); + AddControl(x-2, y, 65, 13, 0x0080, BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, i); case Message: default: break; @@ -566,7 +567,7 @@ void AddOption(int x, int y, Control type, int i) void CreateDialogTemplate(int *layoutList, int nr, Option *optionList) { - int i, j, x=1, y=0, buttonRows, breakPoint = -1, k=0; + int i, ii, j, x=1, y=0, buttonRows, breakPoint = -1, k=0; template.header.cdit = 0; template.header.cx = 307; @@ -576,31 +577,32 @@ CreateDialogTemplate(int *layoutList, int nr, Option *optionList) template.header.cx = 625; } - 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