updated year in copyright info
[xboard.git] / winboard / woptions.c
index 0941cce..461ce73 100644 (file)
@@ -1,25 +1,27 @@
 /*\r
  * woptions.c -- Options dialog box routines for WinBoard\r
- * $Id: woptions.c,v 2.1 2003/10/27 19:21:02 mann Exp $\r
  *\r
- * Copyright 2000 Free Software Foundation, Inc.\r
+ * Copyright 2000, 2009, 2010 Free Software Foundation, Inc.\r
+ *\r
+ * Enhancements Copyright 2005 Alessandro Scotti\r
  *\r
  * ------------------------------------------------------------------------\r
- * This program is free software; you can redistribute it and/or modify\r
+ *\r
+ * GNU XBoard is free software: you can redistribute it and/or modify\r
  * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
+ * the Free Software Foundation, either version 3 of the License, or (at\r
+ * your option) any later version.\r
  *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
+ * GNU XBoard is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+ * General Public License for more details.\r
  *\r
  * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
- * ------------------------------------------------------------------------\r
- */\r
+ * along with this program. If not, see http://www.gnu.org/licenses/.  *\r
+ *\r
+ *------------------------------------------------------------------------\r
+ ** See the file ChangeLog for a revision history.  */\r
 \r
 #include "config.h"\r
 \r
 #include <stdio.h>\r
 #include <stdlib.h>\r
 #include <shlobj.h>    /* [AS] Requires NT 4.0 or Win95 */\r
+#include <ctype.h>\r
 \r
 #include "common.h"\r
+#include "frontend.h"\r
 #include "winboard.h"\r
 #include "backend.h"\r
 #include "woptions.h"\r
 #include "defaults.h"\r
-#include "wedittags.h"\r
 #include <richedit.h>\r
 \r
 #if __GNUC__\r
@@ -61,11 +64,13 @@ extern HWND hwndConsole;
 extern char *defaultTextAttribs[];\r
 extern HWND commentDialog;\r
 extern HWND moveHistoryDialog;\r
+extern HWND engineOutputDialog;\r
 extern char installDir[];\r
 extern HWND hCommPort;    /* currently open comm port */\r
 extern DCB dcb;\r
 extern BOOLEAN chessProgram;\r
-extern startedFromPositionFile; /* [HGM] loadPos */\r
+extern int startedFromPositionFile; /* [HGM] loadPos */\r
+extern int searchTime;\r
 \r
 /* types */\r
 \r
@@ -126,6 +131,7 @@ void SelectComboValue(HANDLE hwndCombo, ComboData *cd, unsigned value);
 VOID SetLoadOptionEnables(HWND hDlg);\r
 VOID SetSaveOptionEnables(HWND hDlg);\r
 VOID SetTimeControlEnables(HWND hDlg);\r
+void NewSettingEvent(int option, char *command, int value);\r
 \r
 /*---------------------------------------------------------------------------*\\r
  *\r
@@ -218,12 +224,8 @@ GeneralOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       appData.saveExtendedInfoInPGN= IS_CHECKED(OPT_SaveExtPGN);\r
       appData.hideThinkingFromHuman= IS_CHECKED(OPT_HideThinkFromHuman);\r
       appData.showEvalInMoveHistory= IS_CHECKED(OPT_ExtraInfoInMoveHistory);\r
-#if 0\r
-      ShowThinkingEvent(             IS_CHECKED(OPT_ShowThinking));\r
-#else\r
       appData.showThinking         = IS_CHECKED(OPT_ShowThinking);\r
       ShowThinkingEvent(); // [HGM] thinking: tests four options\r
-#endif\r
       appData.testLegality         = IS_CHECKED(OPT_TestLegality);\r
       appData.highlightMoveWithArrow=IS_CHECKED(OPT_HighlightMoveArrow);\r
 \r
@@ -310,7 +312,7 @@ PaintSampleSquare(
   HBRUSH  brushSquareOutline;\r
   HBRUSH  brushPiece;\r
   HBRUSH  brushPieceDetail;\r
-  HBRUSH  oldBrushPiece;\r
+  HBRUSH  oldBrushPiece = NULL;\r
   HBRUSH  oldBrushSquare;\r
   HBITMAP oldBitmapMem;\r
   HBITMAP oldBitmapTemp;\r
@@ -368,38 +370,16 @@ PaintSampleSquare(
       oldBrushPiece = SelectObject(hdcMem, brushPiece);\r
       BitBlt(hdcMem, x, y, SAMPLE_SQ_SIZE, SAMPLE_SQ_SIZE, \r
             hdcTemp, 0, 0, 0x00B8074A);\r
-#if 0\r
-      /* Use pieceDetailColor for outline of white pieces */\r
-      SelectObject(hdcTemp, pieces[OUTLINE]);\r
-      SelectObject(hdcMem, brushPieceDetail);\r
-      BitBlt(hdcMem, x, y, SAMPLE_SQ_SIZE, SAMPLE_SQ_SIZE, \r
-            hdcTemp, 0, 0, 0x00B8074A);\r
-#else\r
       /* Use black for outline of white pieces */\r
       SelectObject(hdcTemp, pieces[OUTLINE]);\r
       BitBlt(hdcMem, x, y, SAMPLE_SQ_SIZE, SAMPLE_SQ_SIZE, \r
             hdcTemp, 0, 0, SRCAND);\r
-#endif\r
     } else {\r
-#if 0\r
-      /* Use pieceDetailColor for details of black pieces */\r
-      /* Requires filled-in solid bitmaps (BLACK_PIECE class); the\r
-        WHITE_PIECE ones aren't always the right shape. */\r
-      oldBitmapTemp = SelectObject(hdcTemp, pieces[BLACK]);\r
-      oldBrushPiece = SelectObject(hdcMem, brushPieceDetail);\r
-      BitBlt(hdcMem, x, y, SAMPLE_SQ_SIZE, SAMPLE_SQ_SIZE, \r
-            hdcTemp, 0, 0, 0x00B8074A);\r
-      SelectObject(hdcTemp, pieces[SOLID]);\r
-      SelectObject(hdcMem, brushPiece);\r
-      BitBlt(hdcMem, x, y, SAMPLE_SQ_SIZE, SAMPLE_SQ_SIZE, \r
-            hdcTemp, 0, 0, 0x00B8074A);\r
-#else\r
       /* Use square color for details of black pieces */\r
       oldBitmapTemp = SelectObject(hdcTemp, pieces[SOLID]);\r
       oldBrushPiece = SelectObject(hdcMem, brushPiece);\r
       BitBlt(hdcMem, x, y, SAMPLE_SQ_SIZE, SAMPLE_SQ_SIZE, \r
             hdcTemp, 0, 0, 0x00B8074A);\r
-#endif\r
     }\r
     SelectObject(hdcMem, oldBrushPiece);\r
     SelectObject(hdcTemp, oldBitmapTemp);\r
@@ -566,6 +546,7 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       break;\r
     case SizeTitanic:\r
       CheckDlgButton(hDlg, OPT_SizeTitanic, TRUE);\r
+    default: ; // should not happen, but suppresses warning on pedantic compilers\r
     }\r
 \r
     if (appData.monoMode)\r
@@ -789,16 +770,18 @@ VariantWhichRadio(HWND hDlg)
          (IsDlgButtonChecked(hDlg, OPT_VariantJanus) ? VariantJanus :\r
          (IsDlgButtonChecked(hDlg, OPT_VariantWildcastle) ? VariantWildCastle :\r
          (IsDlgButtonChecked(hDlg, OPT_VariantNocastle) ? VariantNoCastle :\r
-          VariantNormal ))))))))))))))))))))))));\r
+         (IsDlgButtonChecked(hDlg, OPT_Variant3Check) ? Variant3Check :\r
+         (IsDlgButtonChecked(hDlg, OPT_VariantGreat) ? VariantGreat :\r
+         (IsDlgButtonChecked(hDlg, OPT_VariantGiveaway) ? VariantGiveaway :\r
+         (IsDlgButtonChecked(hDlg, OPT_VariantTwilight) ? VariantTwilight :\r
+         (IsDlgButtonChecked(hDlg, OPT_VariantMakruk) ? VariantMakruk :\r
+          VariantNormal )))))))))))))))))))))))))))));\r
 }\r
 \r
 LRESULT CALLBACK\r
 NewVariantDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
 {\r
-  static Boolean  mono;\r
   static VariantClass v;\r
-  static COLORREF lsc, dsc, wpc, bpc, hsc, phc;\r
-  static HBITMAP pieces[3];\r
   static int n1_ok, n2_ok, n3_ok;\r
 \r
   switch (message) {\r
@@ -865,6 +848,8 @@ NewVariantDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       CheckDlgButton(hDlg, OPT_VariantCylinder, TRUE);\r
       break;\r
     case Variant3Check:\r
+      CheckDlgButton(hDlg, OPT_Variant3Check, TRUE);\r
+      break;\r
     case VariantSuper:\r
       CheckDlgButton(hDlg, OPT_VariantSuper, TRUE);\r
       break;\r
@@ -880,6 +865,19 @@ NewVariantDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     case VariantNoCastle:\r
       CheckDlgButton(hDlg, OPT_VariantNocastle, TRUE);\r
       break;\r
+    case VariantGreat:\r
+      CheckDlgButton(hDlg, OPT_VariantGreat, TRUE);\r
+      break;\r
+    case VariantGiveaway:\r
+      CheckDlgButton(hDlg, OPT_VariantGiveaway, TRUE);\r
+      break;\r
+    case VariantTwilight:\r
+      CheckDlgButton(hDlg, OPT_VariantTwilight, TRUE);\r
+      break;\r
+    case VariantMakruk:\r
+      CheckDlgButton(hDlg, OPT_VariantMakruk, TRUE);\r
+      break;\r
+    default: ;\r
     }\r
 \r
     SetDlgItemInt( hDlg, IDC_Files, -1, TRUE );\r
@@ -1017,6 +1015,7 @@ MyCreateFont(HWND hwnd, MyFont *font)
   font->mfp.italic = font->lf.lfItalic;\r
   font->mfp.underline = font->lf.lfUnderline;\r
   font->mfp.strikeout = font->lf.lfStrikeOut;\r
+  font->mfp.charset = font->lf.lfCharSet;\r
   strcpy(font->mfp.faceName, font->lf.lfFaceName);\r
   return TRUE;\r
 }\r
@@ -1028,7 +1027,7 @@ UpdateSampleText(HWND hDlg, int id, MyColorizeAttribs *mca)
   CHARFORMAT cf;\r
   cf.cbSize = sizeof(CHARFORMAT);\r
   cf.dwMask = \r
-    CFM_COLOR|CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE|CFM_STRIKEOUT|CFM_FACE|CFM_SIZE;\r
+    CFM_COLOR|CFM_CHARSET|CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE|CFM_STRIKEOUT|CFM_FACE|CFM_SIZE;\r
   cf.crTextColor = mca->color;\r
   cf.dwEffects = mca->effects;\r
   strcpy(cf.szFaceName, font[boardSize][CONSOLE_FONT]->mfp.faceName);\r
@@ -1272,7 +1271,9 @@ IcsOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       appData.colorize =\r
        (Boolean)!IsDlgButtonChecked(hDlg, OPT_DontColorize);\r
 \r
-      if (!appData.colorize) {\r
+    ChangedConsoleFont();\r
+\r
+    if (!appData.colorize) {\r
        CHARFORMAT cf;\r
        COLORREF background = ParseColorName(COLOR_BKGD);\r
        /*\r
@@ -1471,21 +1472,6 @@ SetSampleFontText(HWND hwnd, int id, const MyFont *mf)
   rectFormat.left   = center.x - (size.cx / 2) - 1;\r
   rectFormat.right  = center.x + (size.cx / 2) + 1;\r
 \r
-#if 0\r
-  fprintf(debugFP, "\nfont: %s\n"\r
-                   "center.x   %d, centerY %d\n"\r
-                  "size.cx    %d, size.cy %d\n"\r
-                  "client.top %d, bottom %d, left %d, right %d\n"\r
-                  "format.top %d, bottom %d, left %d, right %d\n",\r
-                  buf,\r
-                  center.x, center.y,\r
-                  size.cx, size.cy,\r
-                  rectClient.top, rectClient.bottom, rectClient.left,\r
-                  rectClient.right,\r
-                  rectFormat.top, rectFormat.bottom, rectFormat.left,\r
-                  rectFormat.right);\r
-#endif\r
-\r
   cf.cbSize = sizeof(CHARFORMAT);\r
   cf.dwMask = CFM_FACE|CFM_SIZE|CFM_CHARSET|CFM_BOLD|CFM_ITALIC;\r
   cf.dwEffects = 0;\r
@@ -1517,6 +1503,7 @@ CopyFont(MyFont *dest, const MyFont *src)
   dest->mfp.italic    = src->mfp.italic;\r
   dest->mfp.underline = src->mfp.underline;\r
   dest->mfp.strikeout = src->mfp.strikeout;\r
+  dest->mfp.charset   = src->mfp.charset;\r
   lstrcpy(dest->mfp.faceName, src->mfp.faceName);\r
   CreateFontInMF(dest);\r
 }\r
@@ -1617,7 +1604,17 @@ FontOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
        SendDlgItemMessage(moveHistoryDialog, IDC_MoveHistory,\r
          WM_SETFONT, (WPARAM)font[boardSize][MOVEHISTORY_FONT]->hf, \r
          MAKELPARAM(TRUE, 0));\r
-       InvalidateRect(editTagsDialog, NULL, TRUE);\r
+        SendMessage( moveHistoryDialog, WM_INITDIALOG, 0, 0 );\r
+//     InvalidateRect(editTagsDialog, NULL, TRUE); // [HGM] this ws improperly cloned?\r
+      }\r
+\r
+      if( engineOutputDialog != NULL ) {\r
+       SendDlgItemMessage(engineOutputDialog, IDC_EngineMemo1,\r
+         WM_SETFONT, (WPARAM)font[boardSize][MOVEHISTORY_FONT]->hf, \r
+         MAKELPARAM(TRUE, 0));\r
+       SendDlgItemMessage(engineOutputDialog, IDC_EngineMemo2,\r
+         WM_SETFONT, (WPARAM)font[boardSize][MOVEHISTORY_FONT]->hf, \r
+         MAKELPARAM(TRUE, 0));\r
       }\r
 \r
       if (hwndConsole) {\r
@@ -1770,7 +1767,7 @@ InitSoundCombo(HWND hwndCombo, SoundComboData *scd)
     err = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) scd->label);\r
     if (err != cnt++) {\r
       sprintf(buf, "InitSoundCombo(): err '%d', cnt '%d'\n",\r
-         err, cnt);\r
+         (int)err, (int)cnt);\r
       MessageBox(NULL, buf, NULL, MB_OK);\r
     }\r
     scd++;\r
@@ -1889,6 +1886,7 @@ SoundOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   SoundClass sc;\r
   ColorClass cc;\r
   SoundComboData *scd;\r
+  int oldMute;\r
 \r
   switch (message) {\r
   case WM_INITDIALOG:\r
@@ -1969,6 +1967,8 @@ SoundOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
        }\r
       }\r
 \r
+       mute = FALSE; // [HGM] mute: switch sounds automatically on if we select one\r
+      CheckMenuItem(GetMenu(hwndMain),IDM_MuteSounds,MF_BYCOMMAND|MF_UNCHECKED);\r
       ResetSoundComboData(soundComboData);\r
       EndDialog(hDlg, TRUE);\r
       return TRUE;\r
@@ -1998,8 +1998,10 @@ SoundOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       tmp.name = strdup(SoundDialogGetName(hDlg, radio));\r
       tmp.data = NULL;\r
       MyLoadSound(&tmp);\r
+       oldMute = mute; mute = FALSE; // [HGM] mute: always sound when user presses play, ignorig mute setting\r
       MyPlaySound(&tmp);\r
-      if (tmp.data  != NULL) free(tmp.data);\r
+       mute = oldMute;\r
+      if (tmp.data  != NULL) FreeResource(tmp.data); // technically obsolete fn, but tmp.data is NOT malloc'd mem\r
       if (tmp.name != NULL) free(tmp.name);\r
       return TRUE;\r
 \r
@@ -2165,7 +2167,7 @@ VOID PrintCommSettings(FILE *f, char *name, DCB *dcb)
     flow = cdFlow[FLOW_NONE].label;\r
   }\r
   fprintf(f, "/%s=%d,%d,%s,%s,%s\n", name,\r
-    dcb->BaudRate, dcb->ByteSize, parity, stopBits, flow);\r
+    (int)dcb->BaudRate, dcb->ByteSize, parity, stopBits, flow);\r
 }\r
 \r
 \r
@@ -2227,7 +2229,7 @@ CommPortOptionsDialog(HWND hDlg, UINT message, WPARAM wParam,     LPARAM lParam)
 \r
     hwndCombo = GetDlgItem(hDlg, OPT_DataRate);\r
     InitCombo(hwndCombo, cdDataRate);\r
-    sprintf(buf, "%u", dcb.BaudRate);\r
+    sprintf(buf, "%u", (int)dcb.BaudRate);\r
     if (SendMessage(hwndCombo, CB_SELECTSTRING, (WPARAM) -1, (LPARAM) buf) == CB_ERR) {\r
       SendMessage(hwndCombo, CB_SETCURSEL, (WPARAM) -1, (LPARAM) 0);\r
       SendMessage(hwndCombo, WM_SETTEXT, (WPARAM) 0, (LPARAM) buf);\r
@@ -2586,24 +2588,27 @@ SetTimeControlEnables(HWND hDlg)
 {\r
   UINT state;\r
 \r
-  state = IsDlgButtonChecked(hDlg, OPT_TCUseMoves);\r
-  EnableWindow(GetDlgItem(hDlg, OPT_TCTime), state);\r
-  EnableWindow(GetDlgItem(hDlg, OPT_TCMoves), state);\r
-  EnableWindow(GetDlgItem(hDlg, OPT_TCtext1), state);\r
-  EnableWindow(GetDlgItem(hDlg, OPT_TCtext2), state);\r
+  state = IsDlgButtonChecked(hDlg, OPT_TCUseMoves)\r
+       + 2*IsDlgButtonChecked(hDlg, OPT_TCUseFixed);\r
+  EnableWindow(GetDlgItem(hDlg, OPT_TCTime), state == 1);\r
+  EnableWindow(GetDlgItem(hDlg, OPT_TCMoves), state == 1);\r
+  EnableWindow(GetDlgItem(hDlg, OPT_TCtext1), state == 1);\r
+  EnableWindow(GetDlgItem(hDlg, OPT_TCtext2), state == 1);\r
   EnableWindow(GetDlgItem(hDlg, OPT_TCTime2), !state);\r
   EnableWindow(GetDlgItem(hDlg, OPT_TCInc), !state);\r
   EnableWindow(GetDlgItem(hDlg, OPT_TCitext1), !state);\r
   EnableWindow(GetDlgItem(hDlg, OPT_TCitext2), !state);\r
   EnableWindow(GetDlgItem(hDlg, OPT_TCitext3), !state);\r
+  EnableWindow(GetDlgItem(hDlg, OPT_TCFixed), state == 2);\r
+  EnableWindow(GetDlgItem(hDlg, OPT_TCftext), state == 2);\r
 }\r
 \r
 \r
 LRESULT CALLBACK\r
 TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
 {\r
-  char buf[MSG_SIZ];\r
-  int mps, increment, odds1, odds2;\r
+  char buf[MSG_SIZ], *tc;\r
+  int mps, increment, odds1, odds2, st;\r
   BOOL ok, ok2;\r
 \r
   switch (message) {\r
@@ -2612,8 +2617,13 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
     /* Initialize the dialog items */\r
     if (appData.clockMode && !appData.icsActive) {\r
+      if (searchTime) {\r
+       CheckRadioButton(hDlg, OPT_TCUseMoves, OPT_TCUseFixed,\r
+                        OPT_TCUseFixed);\r
+       SetDlgItemInt(hDlg, OPT_TCFixed, searchTime, FALSE);\r
+      } else\r
       if (appData.timeIncrement == -1) {\r
-       CheckRadioButton(hDlg, OPT_TCUseMoves, OPT_TCUseInc,\r
+       CheckRadioButton(hDlg, OPT_TCUseMoves, OPT_TCUseFixed,\r
                         OPT_TCUseMoves);\r
        SetDlgItemText(hDlg, OPT_TCTime, appData.timeControl);\r
        SetDlgItemInt(hDlg, OPT_TCMoves, appData.movesPerSession,\r
@@ -2621,7 +2631,7 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
        SetDlgItemText(hDlg, OPT_TCTime2, "");\r
        SetDlgItemText(hDlg, OPT_TCInc, "");\r
       } else {\r
-       CheckRadioButton(hDlg, OPT_TCUseMoves, OPT_TCUseInc,\r
+       CheckRadioButton(hDlg, OPT_TCUseMoves, OPT_TCUseFixed,\r
                         OPT_TCUseInc);\r
        SetDlgItemText(hDlg, OPT_TCTime, "");\r
        SetDlgItemText(hDlg, OPT_TCMoves, "");\r
@@ -2637,7 +2647,19 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   case WM_COMMAND: /* message: received a command */\r
     switch (LOWORD(wParam)) {\r
     case IDOK:\r
+      mps = appData.movesPerSession;\r
+      increment = appData.timeIncrement;\r
+      tc = appData.timeControl;\r
+      st = 0;\r
       /* Read changed options from the dialog box */\r
+      if (IsDlgButtonChecked(hDlg, OPT_TCUseFixed)) {\r
+       st = GetDlgItemInt(hDlg, OPT_TCFixed, &ok, FALSE);\r
+       if (!ok || st <= 0) {\r
+         MessageBox(hDlg, "Invalid max time per move",\r
+                    "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
+         return FALSE;\r
+       }\r
+      } else\r
       if (IsDlgButtonChecked(hDlg, OPT_TCUseMoves)) {\r
        increment = -1;\r
        mps = GetDlgItemInt(hDlg, OPT_TCMoves, &ok, FALSE);\r
@@ -2652,9 +2674,9 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
                     "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
          return FALSE;\r
        }\r
+      tc = buf;\r
       } else {\r
        increment = GetDlgItemInt(hDlg, OPT_TCInc, &ok, FALSE);\r
-       mps = appData.movesPerSession;\r
        if (!ok || increment < 0) {\r
          MessageBox(hDlg, "Invalid increment",\r
                     "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
@@ -2666,6 +2688,7 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
                     "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
          return FALSE;\r
        }\r
+      tc = buf;\r
       }\r
       odds1 = GetDlgItemInt(hDlg, OPT_TCOdds1, &ok, FALSE);\r
       odds2 = GetDlgItemInt(hDlg, OPT_TCOdds2, &ok2, FALSE);\r
@@ -2674,7 +2697,8 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
                     "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
          return FALSE;\r
       }\r
-      appData.timeControl = strdup(buf);\r
+      searchTime = st;\r
+      appData.timeControl = strdup(tc);\r
       appData.movesPerSession = mps;\r
       appData.timeIncrement = increment;\r
       appData.firstTimeOdds  = first.timeOdds  = odds1;\r
@@ -2761,12 +2785,8 @@ LRESULT CALLBACK EnginePlayOptionsDialog(HWND hDlg, UINT message, WPARAM wParam,
       PeriodicUpdatesEvent(          IS_CHECKED(IDC_EpPeriodicUpdates));\r
       PonderNextMoveEvent(           IS_CHECKED(IDC_EpPonder));\r
       appData.hideThinkingFromHuman= IS_CHECKED(IDC_EpHideThinkingHuman); // [HGM] thinking: moved up\r
-#if 0\r
-      ShowThinkingEvent(             IS_CHECKED(IDC_EpShowThinking));\r
-#else\r
       appData.showThinking   = IS_CHECKED(IDC_EpShowThinking);\r
       ShowThinkingEvent(); // [HGM] thinking: tests all options that need thinking output\r
-#endif\r
       appData.testClaims    = IS_CHECKED(IDC_TestClaims);\r
       appData.checkMates    = IS_CHECKED(IDC_DetectMates);\r
       appData.materialDraws = IS_CHECKED(IDC_MaterialDraws);\r
@@ -2777,8 +2797,8 @@ LRESULT CALLBACK EnginePlayOptionsDialog(HWND hDlg, UINT message, WPARAM wParam,
       appData.ruleMoves = GetDlgItemInt(hDlg, IDC_RuleMoves, NULL, FALSE );\r
       appData.drawRepeats = (int) GetDlgItemInt(hDlg, IDC_DrawRepeats, NULL, FALSE );\r
 \r
-      appData.firstScoreIsAbsolute  = IS_CHECKED(IDC_ScoreAbs1);\r
-      appData.secondScoreIsAbsolute = IS_CHECKED(IDC_ScoreAbs2);\r
+      first.scoreIsAbsolute  = appData.firstScoreIsAbsolute  = IS_CHECKED(IDC_ScoreAbs1);\r
+      second.scoreIsAbsolute = appData.secondScoreIsAbsolute = IS_CHECKED(IDC_ScoreAbs2);\r
 \r
       EndDialog(hDlg, TRUE);\r
       return TRUE;\r