Make DoSleep front-end wrapper for msec sleep
[xboard.git] / winboard / wsettings.c
index bfad588..3ceaf34 100644 (file)
@@ -694,6 +694,7 @@ char *tfName;
 int MatchOK()\r
 {\r
     if(autoinc) appData.loadGameIndex = appData.loadPositionIndex = -(twice + 1);\r
+    if(!appData.loadGameFile[0]) appData.loadGameIndex = -2*twice; // kludge to pass value of "twice" for use in GUI book\r
     if(swiss) { appData.defaultMatchGames = 1; appData.tourneyType = -1; }\r
     if(CreateTourney(tfName) && !matchMode) { // CreateTourney reloads original settings if file already existed\r
        MatchEvent(2);\r
@@ -726,6 +727,26 @@ void UpgradeParticipant(HWND hDlg)
     Substitute(participants, FALSE);\r
 }\r
 \r
+void Inspect(HWND hDlg)\r
+{\r
+    FILE *f;\r
+    char name[MSG_SIZ];\r
+    GetDlgItemText(hDlg, 2001+2*1, name, MSG_SIZ );\r
+    if(name && name[0] && (f = fopen(name, "r")) ) {\r
+       char *saveSaveFile;\r
+       saveSaveFile = appData.saveGameFile; appData.saveGameFile = NULL; // this is a persistent option, protect from change\r
+       ParseArgsFromFile(f);\r
+       autoinc = ((appData.loadPositionFile[0] ? appData.loadGameIndex : appData.loadPositionIndex) < 0);\r
+       twice = ((appData.loadPositionFile[0] ? appData.loadGameIndex : appData.loadPositionIndex) == -2);\r
+       swiss = appData.tourneyType < 0;\r
+       SetOptionValues(hDlg, NULL, activeList);\r
+       FREE(appData.saveGameFile); appData.saveGameFile = saveSaveFile;\r
+    }\r
+}\r
+\r
+void TimeControlOptionsPopup P((HWND hDlg));\r
+void UciOptionsPopup P((HWND hDlg));\r
+\r
 Option tourneyOptions[] = {\r
   { 0,  0,          4, NULL, (void*) &tfName, "", NULL, FileName, N_("Tournament file:") },\r
   { 30, 0,          0, NULL, NULL, NULL, NULL, Label, N_("If you specify an existing file, the rest of this dialog will be ignored.") },\r
@@ -749,6 +770,9 @@ Option tourneyOptions[] = {
   { 0,  0, 1000000000, NULL, (void*) &appData.matchPause, "", NULL, Spin, N_("Pause between Games (ms):") },\r
   { 0,  0,          0, NULL, (void*) &ReplaceParticipant, "", NULL, Button, N_("Replace Engine") },\r
   { 0,  0,          0, NULL, (void*) &UpgradeParticipant, "", NULL, Button, N_("Upgrade Engine") },\r
+  { 0,  0,          0, NULL, (void*) &TimeControlOptionsPopup, "", NULL, Button, N_("Time Control...") },\r
+  { 0,  0,          0, NULL, (void*) &UciOptionsPopup, "", NULL, Button, N_("Common Engine...") },\r
+  { 0,  0,          0, NULL, (void*) &Inspect, "", NULL, Button, N_("Inspect TourneyFile") },\r
   { 0, 0, 0, NULL, (void*) &MatchOK, "", NULL, EndMark , "" }\r
 };\r
 \r
@@ -771,7 +795,7 @@ void TourneyPopup(HWND hwnd)
     NamesToList(firstChessProgramNames, engineList, engineMnemonic);\r
     comboCallback = &AddToTourney;\r
     autoinc = appData.loadGameIndex < 0 || appData.loadPositionIndex < 0;\r
-    twice = TRUE; swiss = appData.tourneyType < 0;\r
+    twice = FALSE; swiss = appData.tourneyType < 0;\r
     while(engineList[n]) n++; tourneyOptions[3].max = n-1;\r
     snprintf(title, MSG_SIZ, _("Tournament and Match Options"));\r
     ASSIGN(tfName, appData.tourneyFile[0] ? appData.tourneyFile : MakeName(appData.defName));\r