Remember engine lines selected in Startup Dialog (WB)
authorH.G.Muller <hgm@hgm-xboard.(none)>
Fri, 2 Dec 2016 07:48:20 +0000 (08:48 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Fri, 13 Jan 2017 15:39:24 +0000 (16:39 +0100)
The comboboxes in the Startup Dialog do contain complete engine lines
from the Engine List, so selecting an engine from there should also allow
use of the Make Persistent button in the Engine Settings dialogs. To this
end the selected lines are now remembered incurrentEngine[].

backend.c
backend.h
winboard/winboard.c

index faeccf5..12aadc1 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -1593,8 +1593,6 @@ MatchEvent (int mode)
        NextMatchGame();
 }
 
-char *comboLine = NULL; // [HGM] recent: WinBoard's first-engine combobox line
-
 void
 InitBackEnd3 P((void))
 {
@@ -1626,7 +1624,7 @@ InitBackEnd3 P((void))
        free(programVersion);
        programVersion = (char*) malloc(8 + strlen(PACKAGE_STRING) + strlen(first.tidy));
        sprintf(programVersion, "%s + %s", PACKAGE_STRING, first.tidy);
-       FloatToFront(&appData.recentEngineList, comboLine ? comboLine : appData.firstChessProgram);
+       FloatToFront(&appData.recentEngineList, currentEngine[0] ? currentEngine[0] : appData.firstChessProgram);
     }
 
     if (appData.icsActive) {
index 83c61ff..74926b6 100644 (file)
--- a/backend.h
+++ b/backend.h
@@ -413,7 +413,7 @@ extern ChessProgramStats programStats;
 extern int opponentKibitzes; // used by wengineo.c
 extern int errorExitStatus;
 extern char *recentEngines;
-extern char *comboLine;
+extern char *currentEngine[];
 extern Boolean partnerUp, twoBoards;
 extern char engineVariant[];
 void SaveEngineSettings P((int n));
index 293b643..519f924 100644 (file)
@@ -6451,11 +6451,12 @@ StartupDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
         safeStrCpy(buf, "/fcp=", sizeof(buf)/sizeof(buf[0]) );\r
        GetDlgItemText(hDlg, OPT_ChessEngineName, buf + strlen(buf), sizeof(buf) - strlen(buf));\r
         p = buf;\r
-       comboLine = strdup(p+5); // [HGM] recent: remember complete line of first combobox\r
+       currentEngine[0] = strdup(p+5); // [HGM] recent: remember complete line of first combobox\r
        ParseArgs(StringGet, &p);\r
        safeStrCpy(buf, singleList ? "/fcp=" : "/scp=", sizeof(buf)/sizeof(buf[0]) );\r
        GetDlgItemText(hDlg, OPT_SecondChessEngineName, buf + strlen(buf), sizeof(buf) - strlen(buf));\r
         p = buf;\r
+       currentEngine[1] = strdup(p+5); // [HGM] also remember engine line of 2nd for saving its settings\r
        SwapEngines(singleList); // temporarily swap first and second, to load a second 'first', ...\r
        ParseArgs(StringGet, &p);\r
        SwapEngines(singleList); // ... and then make it 'second'\r