Implement -reset option feature in WinBoard
authorH.G. Muller <h.g.muller@hccnet.nl>
Sat, 29 Jan 2011 19:11:30 +0000 (20:11 +0100)
committerArun Persaud <apersaud@lbl.gov>
Tue, 1 Feb 2011 15:53:09 +0000 (07:53 -0800)
backend.c
winboard/wsettings.c

index 17e77ae..e0f6ec9 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -13908,6 +13908,8 @@ ParseOption(Option *opt, ChessProgramState *cps)
            opt->type = Button;
        } else if(p = strstr(opt->name, " -save")) {
            opt->type = SaveButton;
+       } else if(p = strstr(opt->name, " -reset")) {
+           opt->type = ResetButton;
        } else return FALSE;
        *p = 0; // terminate option name
        // now look if the command-line options define a setting for this engine option.
index ccfae75..df992aa 100644 (file)
@@ -419,7 +419,10 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
                if(j < 0) break;\r
                if( activeCps->option[j].type  == SaveButton)\r
                     GetOptionValues(hDlg, activeCps);\r
-               else if( activeCps->option[j].type  != Button) break;\r
+               else if( activeCps->option[j].type  == ResetButton) {\r
+                    ClearOptions(activeCps);\r
+                    EndDialog( hDlg, 0 );\r
+               } else if( activeCps->option[j].type  != Button) break;\r
                snprintf(buf, MSG_SIZ, "option %s\n", activeCps->option[j].name);\r
                SendToProgram(buf, activeCps);\r
            }\r