X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwsettings.c;h=257fcd2d0d491b264ff573903bb103842a02c22d;hb=414a2914d0c5fd2ac5ee27f514346716f1b892b2;hp=a1a6142fa330d4d490f85d1dae37a5e24ae6dc01;hpb=3512e2a362ede1907c75f89e3d6f5945414b46a5;p=xboard.git diff --git a/winboard/wsettings.c b/winboard/wsettings.c index a1a6142..257fcd2 100644 --- a/winboard/wsettings.c +++ b/winboard/wsettings.c @@ -13,8 +13,10 @@ #include "config.h" #include +#include #include "common.h" #include "backend.h" +#include "backendz.h" int layoutList[2*MAX_OPTIONS]; int checkList[2*MAX_OPTIONS]; @@ -33,10 +35,13 @@ PrintOpt(int i, int right, ChessProgramState *cps) } else { Option opt = cps->option[i]; switch(opt.type) { + case Slider: case Spin: fprintf(debugFP, "%20.20s [ +/-]", opt.name); break; case TextBox: + case FileName: + case PathName: fprintf(debugFP, "%20.20s [______________________________________]", opt.name); break; case CheckBox: @@ -47,7 +52,9 @@ PrintOpt(int i, int right, ChessProgramState *cps) break; case Button: case SaveButton: + case ResetButton: fprintf(debugFP, "[ %26.26s ]", opt.name); + case Message: break; } } @@ -68,7 +75,7 @@ CreateOptionDialogTest(int *list, int nr, ChessProgramState *cps) void LayoutOptions(int firstOption, int endOption, char *groupName, Option *optionList) { - int n, i, b = strlen(groupName), stop, prefix, right, nextOption, firstButton = buttons; + int i, b = strlen(groupName), stop, prefix, right, nextOption, firstButton = buttons; Control lastType, nextType; nextOption = firstOption; @@ -80,10 +87,15 @@ LayoutOptions(int firstOption, int endOption, char *groupName, Option *optionLis switch(nextType = optionList[nextOption].type) { case CheckBox: checkList[checks++] = nextOption; lastType = CheckBox; break; case ComboBox: comboList[combos++] = nextOption; lastType = ComboBox; break; + case ResetButton: case SaveButton: case Button: buttonList[buttons++] = nextOption; lastType = Button; break; case TextBox: + case FileName: + case PathName: + case Slider: case Spin: stop++; + case Message: ; // cannot happen } nextOption++; } @@ -165,7 +177,7 @@ DesignOptionDialog(ChessProgramState *cps) while(k < cps->nrOptions) { // k steps through 'solitary' options // look if we hit a group of options having names that start with the same word int groupSize = 1, groupNameLength = 50; - sscanf(cps->option[k].name, "%s", &buf); // get first word of option name + sscanf(cps->option[k].name, "%s", buf); // get first word of option name while(k + groupSize < cps->nrOptions && strstr(cps->option[k+groupSize].name, buf) == cps->option[k+groupSize].name) { int j; @@ -266,6 +278,7 @@ SetOptionValues(HWND hDlg, ChessProgramState *cps) break; case Button: case SaveButton: + default: break; } } @@ -291,14 +304,13 @@ GetOptionValues(HWND hDlg, ChessProgramState *cps) // read out all controls, and if value is altered, remember it and send it to the engine { HANDLE hwndCombo; - int i, k, new, changed; + int i, k, new=0, changed=0; char **choices, newText[MSG_SIZ], buf[MSG_SIZ]; BOOL success; for(i=0; ioption[j].name ); switch(cps->option[j].type) { case Spin: new = GetDlgItemInt( hDlg, 2001+2*i, &success, TRUE ); @@ -334,6 +346,7 @@ GetOptionValues(HWND hDlg, ChessProgramState *cps) if(changed) cps->option[j].value = new; break; case Button: + default: break; // are treated instantly, so they have been sent already } if(changed == 2) sprintf(buf, "option %s=%d\n", cps->option[j].name, new); else @@ -344,8 +357,6 @@ GetOptionValues(HWND hDlg, ChessProgramState *cps) LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - static int * lpIndexFRC; - BOOL index_is_ok; char buf[MSG_SIZ]; int i, j; @@ -562,6 +573,7 @@ void AddOption(int x, int y, Control type, int i) { switch(type) { + case Slider: case Spin: AddControl(x, y+1, 95, 9, 0x0082, SS_ENDELLIPSIS | WS_VISIBLE | WS_CHILD, i); AddControl(x+95, y, 50, 11, 0x0081, ES_AUTOHSCROLL | ES_NUMBER | WS_BORDER | WS_VISIBLE | WS_CHILD | WS_TABSTOP, i+1); @@ -586,8 +598,10 @@ void AddOption(int x, int y, Control type, int i) AddControl(x+95, y-1, 50, 500, 0x0085, CBS_AUTOHSCROLL | CBS_DROPDOWN | WS_VISIBLE | WS_CHILD | WS_TABSTOP, i+1); break; case Button: + case ResetButton: case SaveButton: AddControl(x-2, y, 65, 13, 0x0080, BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD, i); + case Message: break; } @@ -600,7 +614,7 @@ CreateDialogTemplate(int *layoutList, int nr, ChessProgramState *cps) template.header.cdit = 0; template.header.cx = 307; - buttonRows = (buttons + 1 + 3)/4; // 4 per row, ronded up + buttonRows = (buttons + 1 + 3)/4; // 4 per row, rounded up if(nr > 50) { breakPoint = (nr+2*buttonRows+1)/2 & ~1; template.header.cx = 625; @@ -634,11 +648,13 @@ CreateDialogTemplate(int *layoutList, int nr, ChessProgramState *cps) template.title[8] = cps == &first ? '1' : '2'; template.header.cy = y += 18*buttonRows+2; template.header.style &= ~WS_VSCROLL; - if(y > 300, 0) { +#if 0 + if(y > 300) { template.header.cx = 295; template.header.cy = 300; template.header.style |= WS_VSCROLL; } +#endif } void