security fix: replaced strcpy with safeStrCpy from backend.c
[xboard.git] / winboard / woptions.c
index fd0ac4c..9460aa0 100644 (file)
@@ -44,6 +44,9 @@
 #include <string.h>\r
 #endif\r
 \r
+#define _(s) T_(s)\r
+#define N_(s) s\r
+\r
 /* Imports from winboard.c */\r
 \r
 extern MyFont *font[NUM_SIZES][NUM_FONTS];\r
@@ -131,7 +134,6 @@ 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
@@ -146,15 +148,18 @@ GeneralOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   static Boolean oldShowCoords;\r
   static Boolean oldBlindfold;\r
   static Boolean oldShowButtonBar;\r
+  static Boolean oldAutoLogo;\r
 \r
   switch (message) {\r
   case WM_INITDIALOG: /* message: initialize dialog box */\r
     oldShowCoords = appData.showCoords;\r
     oldBlindfold  = appData.blindfold;\r
     oldShowButtonBar = appData.showButtonBar;\r
+    oldAutoLogo  = appData.autoLogo;\r
 \r
     /* Center the dialog over the application window */\r
     CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
+    Translate(hDlg, DLG_GeneralOptions);\r
 \r
     /* Initialize the dialog items */\r
 #define CHECK_BOX(x,y) CheckDlgButton(hDlg, (x), (BOOL)(y))\r
@@ -181,6 +186,7 @@ GeneralOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     CHECK_BOX(OPT_SaveExtPGN, appData.saveExtendedInfoInPGN);\r
     CHECK_BOX(OPT_ExtraInfoInMoveHistory, appData.showEvalInMoveHistory);\r
     CHECK_BOX(OPT_HighlightMoveArrow, appData.highlightMoveWithArrow);\r
+    CHECK_BOX(OPT_AutoLogo, appData.autoLogo); // [HGM] logo\r
 \r
 #undef CHECK_BOX\r
 \r
@@ -228,6 +234,7 @@ GeneralOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       ShowThinkingEvent(); // [HGM] thinking: tests four options\r
       appData.testLegality         = IS_CHECKED(OPT_TestLegality);\r
       appData.highlightMoveWithArrow=IS_CHECKED(OPT_HighlightMoveArrow);\r
+      appData.autoLogo             =IS_CHECKED(OPT_AutoLogo); // [HGM] logo\r
 \r
 #undef IS_CHECKED\r
 \r
@@ -249,7 +256,10 @@ GeneralOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
        */\r
       EndDialog(hDlg, TRUE);\r
 \r
-      if (oldShowButtonBar != appData.showButtonBar) {\r
+      if (oldAutoLogo != appData.autoLogo) { // [HGM] logo: remove any logos when we switch autologo off\r
+       if(oldAutoLogo) first.programLogo = second.programLogo = NULL;\r
+       InitDrawingSizes(boardSize, 0);\r
+      } else if (oldShowButtonBar != appData.showButtonBar) {\r
        InitDrawingSizes(boardSize, 0);\r
       } else if ((oldShowCoords != appData.showCoords) || \r
                 (oldBlindfold != appData.blindfold)) {\r
@@ -491,6 +501,7 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   case WM_INITDIALOG: /* message: initialize dialog box */\r
     /* Center the dialog over the application window */\r
     CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
+    Translate(hDlg, DLG_BoardOptions);\r
     /* Initialize the dialog items */\r
     switch (boardSize) {\r
     case SizeTiny:\r
@@ -788,6 +799,7 @@ NewVariantDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   case WM_INITDIALOG: /* message: initialize dialog box */\r
     /* Center the dialog over the application window */\r
     CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
+    Translate(hDlg, DLG_NewVariant);\r
     /* Initialize the dialog items */\r
     switch (gameInfo.variant) {\r
     case VariantNormal:\r
@@ -907,12 +919,12 @@ NewVariantDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       if(!appData.noChessProgram) { char *name = VariantName(v), buf[MSG_SIZ];\r
        if (first.protocolVersion > 1 && StrStr(first.variants, name) == NULL) {\r
            /* [HGM] in protocol 2 we check if variant is suported by engine */\r
-           sprintf(buf, "Variant %s not supported by %s", name, first.tidy);\r
+           sprintf(buf, _("Variant %s not supported by %s"), name, first.tidy);\r
            DisplayError(buf, 0);\r
-           return TRUE; /* treat as "Cancel" if first engine does not support it */\r
+           return TRUE; /* treat as _("Cancel") if first engine does not support it */\r
        } else\r
        if (second.initDone && second.protocolVersion > 1 && StrStr(second.variants, name) == NULL) {\r
-           sprintf(buf, "Warning: second engine (%s) does not support this!", second.tidy);\r
+           sprintf(buf, _("Warning: second engine (%s) does not support this!"), second.tidy);\r
            DisplayError(buf, 0);   /* use of second engine is optional; only warn user */\r
        }\r
       }\r
@@ -1016,7 +1028,7 @@ MyCreateFont(HWND hwnd, MyFont *font)
   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
+  safeStrCpy(font->mfp.faceName, font->lf.lfFaceName, sizeof(font->mfp.faceName)/sizeof(font->mfp.faceName[0]) );\r
   return TRUE;\r
 }\r
 \r
@@ -1030,7 +1042,7 @@ UpdateSampleText(HWND hDlg, int id, MyColorizeAttribs *mca)
     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
+  safeStrCpy(cf.szFaceName, font[boardSize][CONSOLE_FONT]->mfp.faceName, sizeof(cf.szFaceName)/sizeof(cf.szFaceName[0]) );\r
   /* \r
    * The 20.0 below is in fact documented. yHeight is expressed in twips.\r
    * A twip is 1/20 of a font's point size. See documentation of CHARFORMAT.\r
@@ -1055,6 +1067,7 @@ ColorizeTextDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     mca = colorizeAttribs[cc];\r
     /* Center the dialog over the application window */\r
     CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
+    Translate(hDlg, DLG_Colorize);\r
     /* Initialize the dialog items */\r
     CheckDlgButton(hDlg, OPT_Bold, (mca.effects & CFE_BOLD) != 0);\r
     CheckDlgButton(hDlg, OPT_Italic, (mca.effects & CFE_ITALIC) != 0);\r
@@ -1069,7 +1082,7 @@ ColorizeTextDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     /* set the background color */\r
     SendDlgItemMessage(hDlg, OPT_Sample, EM_SETBKGNDCOLOR, FALSE, background);\r
 \r
-    SetDlgItemText(hDlg, OPT_Sample, mca.name);\r
+    SetDlgItemText(hDlg, OPT_Sample, T_(mca.name));\r
     UpdateSampleText(hDlg, OPT_Sample, &mca);\r
     return TRUE;\r
 \r
@@ -1166,10 +1179,12 @@ IcsOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 \r
     /* Center the dialog over the application window */\r
     CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
+    Translate(hDlg, DLG_IcsOptions);\r
 \r
     /* Initialize the dialog items */\r
 #define CHECK_BOX(x,y) CheckDlgButton(hDlg, (x), (BOOL)(y))\r
 \r
+    CHECK_BOX(OPT_AutoKibitz, appData.autoKibitz);\r
     CHECK_BOX(OPT_AutoComment, appData.autoComment);\r
     CHECK_BOX(OPT_AutoObserve, appData.autoObserve);\r
     CHECK_BOX(OPT_GetMoveList, appData.getMoveList);\r
@@ -1205,16 +1220,16 @@ IcsOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     SendDlgItemMessage(hDlg, OPT_SampleSeek,      EM_SETBKGNDCOLOR, 0, cbc);\r
     SendDlgItemMessage(hDlg, OPT_SampleNormal,    EM_SETBKGNDCOLOR, 0, cbc);\r
 \r
-    SetDlgItemText(hDlg, OPT_SampleShout,     mca[ColorShout].name);\r
-    SetDlgItemText(hDlg, OPT_SampleSShout,    mca[ColorSShout].name);\r
-    SetDlgItemText(hDlg, OPT_SampleChannel1,  mca[ColorChannel1].name);\r
-    SetDlgItemText(hDlg, OPT_SampleChannel,   mca[ColorChannel].name);\r
-    SetDlgItemText(hDlg, OPT_SampleKibitz,    mca[ColorKibitz].name);\r
-    SetDlgItemText(hDlg, OPT_SampleTell,      mca[ColorTell].name);\r
-    SetDlgItemText(hDlg, OPT_SampleChallenge, mca[ColorChallenge].name);\r
-    SetDlgItemText(hDlg, OPT_SampleRequest,   mca[ColorRequest].name);\r
-    SetDlgItemText(hDlg, OPT_SampleSeek,      mca[ColorSeek].name);\r
-    SetDlgItemText(hDlg, OPT_SampleNormal,    mca[ColorNormal].name);\r
+    SetDlgItemText(hDlg, OPT_SampleShout,     T_(mca[ColorShout].name));\r
+    SetDlgItemText(hDlg, OPT_SampleSShout,    T_(mca[ColorSShout].name));\r
+    SetDlgItemText(hDlg, OPT_SampleChannel1,  T_(mca[ColorChannel1].name));\r
+    SetDlgItemText(hDlg, OPT_SampleChannel,   T_(mca[ColorChannel].name));\r
+    SetDlgItemText(hDlg, OPT_SampleKibitz,    T_(mca[ColorKibitz].name));\r
+    SetDlgItemText(hDlg, OPT_SampleTell,      T_(mca[ColorTell].name));\r
+    SetDlgItemText(hDlg, OPT_SampleChallenge, T_(mca[ColorChallenge].name));\r
+    SetDlgItemText(hDlg, OPT_SampleRequest,   T_(mca[ColorRequest].name));\r
+    SetDlgItemText(hDlg, OPT_SampleSeek,      T_(mca[ColorSeek].name));\r
+    SetDlgItemText(hDlg, OPT_SampleNormal,    T_(mca[ColorNormal].name));\r
 \r
     UpdateSampleText(hDlg, OPT_SampleShout,     &mca[ColorShout]);\r
     UpdateSampleText(hDlg, OPT_SampleSShout,    &mca[ColorSShout]);\r
@@ -1243,8 +1258,8 @@ IcsOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       /* Read changed options from the dialog box */\r
       GetDlgItemText(hDlg, OPT_IcsAlarmTime, buf, MSG_SIZ);\r
       if (sscanf(buf, "%d", &number) != 1 || (number < 0)){\r
-         MessageBox(hDlg, "Invalid ICS Alarm Time",\r
-                    "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
+         MessageBox(hDlg, _("Invalid ICS Alarm Time"),\r
+                    _("Option Error"), MB_OK|MB_ICONEXCLAMATION);\r
          return FALSE;\r
       }\r
 \r
@@ -1254,6 +1269,7 @@ IcsOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       appData.premove          = IS_CHECKED(OPT_Premove);\r
       appData.premoveWhite     = IS_CHECKED(OPT_PremoveWhite);\r
       appData.premoveBlack     = IS_CHECKED(OPT_PremoveBlack);\r
+      appData.autoKibitz       = IS_CHECKED(OPT_AutoKibitz);\r
       appData.autoComment      = IS_CHECKED(OPT_AutoComment);\r
       appData.autoObserve      = IS_CHECKED(OPT_AutoObserve);\r
       appData.getMoveList      = IS_CHECKED(OPT_GetMoveList);\r
@@ -1490,7 +1506,7 @@ SetSampleFontText(HWND hwnd, int id, const MyFont *mf)
   cf.dwEffects = 0;\r
   if (mf->lf.lfWeight == FW_BOLD) cf.dwEffects |= CFE_BOLD;\r
   if (mf->lf.lfItalic) cf.dwEffects |= CFE_ITALIC;\r
-  strcpy(cf.szFaceName, mf->mfp.faceName);\r
+  safeStrCpy(cf.szFaceName, mf->mfp.faceName, sizeof(cf.szFaceName)/sizeof(cf.szFaceName[0]) );\r
   /*\r
    * yHeight is expressed in twips.  A twip is 1/20 of a font's point\r
    * size. See documentation of CHARFORMAT.  --msw\r
@@ -1517,7 +1533,7 @@ CopyFont(MyFont *dest, const MyFont *src)
   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
+  lsafeStrCpy(dest->mfp.faceName, src->mfp.faceName, sizeof(dest->mfp.faceName)/sizeof(dest->mfp.faceName[0]) );\r
   CreateFontInMF(dest);\r
 }\r
 \r
@@ -1537,6 +1553,7 @@ FontOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     for (i=0; i < NUM_FONTS; i++)\r
       CopyFont(&workFont[i], font[boardSize][i]);\r
 \r
+    Translate(hDlg, DLG_Fonts);\r
     if (!appData.icsActive)\r
       EnableWindow(GetDlgItem(hDlg, OPT_ChooseConsoleFont), FALSE);\r
 \r
@@ -1716,22 +1733,22 @@ FontsOptionsPopup(HWND hwnd)
 \r
 \r
 SoundComboData soundComboData[] = {\r
-  {"Move", NULL},\r
-  {"Bell", NULL},\r
-  {"ICS Alarm", NULL},\r
-  {"ICS Win", NULL},\r
-  {"ICS Loss", NULL},\r
-  {"ICS Draw", NULL},\r
-  {"ICS Unfinished", NULL},\r
-  {"Shout", NULL},\r
-  {"SShout/CShout", NULL},\r
-  {"Channel 1", NULL},\r
-  {"Channel", NULL},\r
-  {"Kibitz", NULL},\r
-  {"Tell", NULL},\r
-  {"Challenge", NULL},\r
-  {"Request", NULL},\r
-  {"Seek", NULL},\r
+  {N_("Move"), NULL},\r
+  {N_("Bell"), NULL},\r
+  {N_("ICS Alarm"), NULL},\r
+  {N_("ICS Win"), NULL},\r
+  {N_("ICS Loss"), NULL},\r
+  {N_("ICS Draw"), NULL},\r
+  {N_("ICS Unfinished"), NULL},\r
+  {N_("Shout"), NULL},\r
+  {N_("SShout/CShout"), NULL},\r
+  {N_("Channel 1"), NULL},\r
+  {N_("Channel"), NULL},\r
+  {N_("Kibitz"), NULL},\r
+  {N_("Tell"), NULL},\r
+  {N_("Challenge"), NULL},\r
+  {N_("Request"), NULL},\r
+  {N_("Seek"), NULL},\r
   {NULL, NULL},\r
 };\r
 \r
@@ -1777,7 +1794,7 @@ InitSoundCombo(HWND hwndCombo, SoundComboData *scd)
 \r
   /* send the labels to the combo box */\r
   while (scd->label) {\r
-    err = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) scd->label);\r
+    err = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) T_(scd->label));\r
     if (err != cnt++) {\r
       sprintf(buf, "InitSoundCombo(): err '%d', cnt '%d'\n",\r
          (int)err, (int)cnt);\r
@@ -1905,6 +1922,7 @@ SoundOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   case WM_INITDIALOG:\r
     /* Center the dialog over the application window */\r
     CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
+    Translate(hDlg, DLG_Sound);\r
 \r
     /* Initialize the built-in sounds combo */\r
     hBISN = GetDlgItem(hDlg, OPT_BuiltInSoundName);\r
@@ -2020,7 +2038,7 @@ SoundOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 \r
     case OPT_BrowseSound:\r
       f = OpenFileDialog(hDlg, "rb", NULL, "wav", SOUND_FILT,\r
-       "Browse for Sound File", NULL, NULL, buf);\r
+       _("Browse for Sound File"), NULL, NULL, buf);\r
       if (f != NULL) {\r
        fclose(f);\r
        SetDlgItemText(hDlg, OPT_WavFileName, buf);\r
@@ -2145,7 +2163,7 @@ ParseCommSettings(char *arg, DCB *dcb)
   if (cd->label == NULL) goto cant_parse;\r
   return;\r
 cant_parse:\r
-    ExitArgError("Can't parse com port settings", arg);\r
+    ExitArgError(_("Can't parse com port settings"), arg);\r
 }\r
 \r
 \r
@@ -2225,6 +2243,7 @@ CommPortOptionsDialog(HWND hDlg, UINT message, WPARAM wParam,     LPARAM lParam)
   case WM_INITDIALOG: /* message: initialize dialog box */\r
     /* Center the dialog over the application window */\r
     CenterWindow (hDlg, GetWindow(hDlg, GW_OWNER));\r
+    Translate(hDlg, DLG_CommPort);\r
     /* Initialize the dialog items */\r
     /* !! There should probably be some synchronization\r
        in accessing hCommPort and dcb.  Or does modal nature\r
@@ -2304,8 +2323,8 @@ CommPortOptionsDialog(HWND hDlg, UINT message, WPARAM wParam,     LPARAM lParam)
       hwndCombo = GetDlgItem(hDlg, OPT_DataRate);\r
       SendMessage(hwndCombo, WM_GETTEXT, (WPARAM) MSG_SIZ, (LPARAM) buf);\r
       if (sscanf(buf, "%u", &value) != 1) {\r
-       MessageBox(hDlg, "Invalid data rate",\r
-                  "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
+       MessageBox(hDlg, _("Invalid data rate"),\r
+                  _("Option Error"), MB_OK|MB_ICONEXCLAMATION);\r
        return TRUE;\r
       }\r
       dcb.BaudRate = value;\r
@@ -2350,9 +2369,9 @@ CommPortOptionsDialog(HWND hDlg, UINT message, WPARAM wParam,     LPARAM lParam)
        err = GetLastError();\r
        switch(MessageBox(hDlg, \r
                         "Failed to set comm port state;\r\ninvalid options?",\r
-                        "Option Error", MB_ABORTRETRYIGNORE|MB_ICONQUESTION)) {\r
+                        _("Option Error"), MB_ABORTRETRYIGNORE|MB_ICONQUESTION)) {\r
        case IDABORT:\r
-         DisplayFatalError("Failed to set comm port state", err, 1);\r
+         DisplayFatalError(_("Failed to set comm port state"), err, 1);\r
          exit(1);  /*is it ok to do this from here?*/\r
 \r
        case IDRETRY:\r
@@ -2413,6 +2432,7 @@ LoadOptions(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   case WM_INITDIALOG: /* message: initialize dialog box */\r
     /* Center the dialog over the application window */\r
     CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
+    Translate(hDlg, DLG_LoadOptions);\r
     /* Initialize the dialog items */\r
     if (appData.timeDelay >= 0.0) {\r
       CheckDlgButton(hDlg, OPT_Autostep, TRUE);\r
@@ -2431,8 +2451,8 @@ LoadOptions(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       if (IsDlgButtonChecked(hDlg, OPT_Autostep)) {\r
        GetDlgItemText(hDlg, OPT_ASTimeDelay, buf, MSG_SIZ);\r
        if (sscanf(buf, "%f", &fnumber) != 1) {\r
-         MessageBox(hDlg, "Invalid load game step rate",\r
-                    "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
+         MessageBox(hDlg, _("Invalid load game step rate"),\r
+                    _("Option Error"), MB_OK|MB_ICONEXCLAMATION);\r
          return FALSE;\r
        }\r
        appData.timeDelay = fnumber;\r
@@ -2498,6 +2518,7 @@ SaveOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   case WM_INITDIALOG: /* message: initialize dialog box */\r
     /* Center the dialog over the application window */\r
     CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
+    Translate(hDlg, DLG_SaveOptions);\r
     /* Initialize the dialog items */\r
     if (*appData.saveGameFile != NULLCHAR) {\r
       CheckDlgButton(hDlg, OPT_Autosave, (UINT) TRUE);\r
@@ -2529,8 +2550,8 @@ SaveOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
        } else /*if (IsDlgButtonChecked(hDlg, OPT_AVToFile))*/ {\r
          GetDlgItemText(hDlg, OPT_AVFilename, buf, MSG_SIZ);\r
          if (*buf == NULLCHAR) {\r
-           MessageBox(hDlg, "Invalid save game file name",\r
-                      "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
+           MessageBox(hDlg, _("Invalid save game file name"),\r
+                      _("Option Error"), MB_OK|MB_ICONEXCLAMATION);\r
            return FALSE;\r
          }\r
          if ((isalpha(buf[0]) && buf[1] == ':') ||\r
@@ -2565,7 +2586,7 @@ SaveOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     case OPT_AVBrowse:\r
       f = OpenFileDialog(hDlg, "a", NULL, \r
                         appData.oldSaveStyle ? "gam" : "pgn", \r
-                        GAME_FILT, "Browse for Auto Save File", \r
+                        GAME_FILT, _("Browse for Auto Save File"), \r
                         NULL, NULL, buf);\r
       if (f != NULL) {\r
        fclose(f);\r
@@ -2628,6 +2649,7 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   case WM_INITDIALOG: /* message: initialize dialog box */\r
     /* Center the dialog over the application window */\r
     CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
+    Translate(hDlg, DLG_TimeControl);\r
     /* Initialize the dialog items */\r
     if (appData.clockMode && !appData.icsActive) {\r
       if (searchTime) {\r
@@ -2668,8 +2690,8 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       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
+         MessageBox(hDlg, _("Invalid max time per move"),\r
+                    _("Option Error"), MB_OK|MB_ICONEXCLAMATION);\r
          return FALSE;\r
        }\r
       } else\r
@@ -2677,28 +2699,28 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
        increment = -1;\r
        mps = GetDlgItemInt(hDlg, OPT_TCMoves, &ok, FALSE);\r
        if (!ok || mps <= 0) {\r
-         MessageBox(hDlg, "Invalid moves per time control",\r
-                    "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
+         MessageBox(hDlg, _("Invalid moves per time control"),\r
+                    _("Option Error"), MB_OK|MB_ICONEXCLAMATION);\r
          return FALSE;\r
        }\r
        GetDlgItemText(hDlg, OPT_TCTime, buf, MSG_SIZ);\r
        if (!ParseTimeControl(buf, increment, mps)) {\r
-         MessageBox(hDlg, "Invalid minutes per time control",\r
-                    "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
+         MessageBox(hDlg, _("Invalid minutes per time control"),\r
+                    _("Option Error"), MB_OK|MB_ICONEXCLAMATION);\r
          return FALSE;\r
        }\r
       tc = buf;\r
       } else {\r
        increment = GetDlgItemInt(hDlg, OPT_TCInc, &ok, FALSE);\r
        if (!ok || increment < 0) {\r
-         MessageBox(hDlg, "Invalid increment",\r
-                    "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
+         MessageBox(hDlg, _("Invalid increment"),\r
+                    _("Option Error"), MB_OK|MB_ICONEXCLAMATION);\r
          return FALSE;\r
        }\r
        GetDlgItemText(hDlg, OPT_TCTime2, buf, MSG_SIZ);\r
        if (!ParseTimeControl(buf, increment, mps)) {\r
-         MessageBox(hDlg, "Invalid initial time",\r
-                    "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
+         MessageBox(hDlg, _("Invalid initial time"),\r
+                    _("Option Error"), MB_OK|MB_ICONEXCLAMATION);\r
          return FALSE;\r
        }\r
       tc = buf;\r
@@ -2706,8 +2728,8 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       odds1 = GetDlgItemInt(hDlg, OPT_TCOdds1, &ok, FALSE);\r
       odds2 = GetDlgItemInt(hDlg, OPT_TCOdds2, &ok2, FALSE);\r
       if (!ok || !ok2 || odds1 <= 0 || odds2 <= 0) {\r
-         MessageBox(hDlg, "Invalid time-odds factor",\r
-                    "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
+         MessageBox(hDlg, _("Invalid time-odds factor"),\r
+                    _("Option Error"), MB_OK|MB_ICONEXCLAMATION);\r
          return FALSE;\r
       }\r
       searchTime = st;\r
@@ -2737,7 +2759,7 @@ VOID
 TimeControlOptionsPopup(HWND hwnd)\r
 {\r
   if (gameMode != BeginningOfGame) {\r
-    DisplayError("Changing time control during a game is not implemented", 0);\r
+    DisplayError(_("Changing time control during a game is not implemented"), 0);\r
   } else {\r
     FARPROC lpProc = MakeProcInstance((FARPROC)TimeControl, hInst);\r
     DialogBox(hInst, MAKEINTRESOURCE(DLG_TimeControl), hwnd, (DLGPROC) lpProc);\r
@@ -2762,6 +2784,7 @@ LRESULT CALLBACK EnginePlayOptionsDialog(HWND hDlg, UINT message, WPARAM wParam,
 \r
     /* Center the dialog over the application window */\r
     CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
+    Translate(hDlg, DLG_EnginePlayOptions);\r
 \r
     /* Initialize the dialog items */\r
     CHECK_BOX(IDC_EpPeriodicUpdates, appData.periodicUpdates);\r
@@ -2866,7 +2889,7 @@ static BOOL BrowseForFolder( const char * title, char * path )
 \r
     ZeroMemory( &bi, sizeof(bi) );\r
 \r
-    bi.lpszTitle = title == 0 ? "Choose Folder" : title;\r
+    bi.lpszTitle = title == 0 ? _("Choose Folder") : title;\r
     bi.ulFlags = BIF_RETURNONLYFSDIRS;\r
 \r
     pidl = SHBrowseForFolder( &bi );\r
@@ -2897,6 +2920,7 @@ LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM
 \r
     /* Center the dialog over the application window */\r
     CenterWindow (hDlg, GetWindow (hDlg, GW_OWNER));\r
+    Translate(hDlg, DLG_OptionsUCI);\r
 \r
     /* Initialize the dialog items */\r
     SetDlgItemText( hDlg, IDC_PolyglotDir, appData.polyglotDir );\r
@@ -2910,6 +2934,9 @@ LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM
     // [HGM] book: tick boxes for own book use\r
     CheckDlgButton( hDlg, IDC_OwnBook1, (BOOL) appData.firstHasOwnBookUCI );\r
     CheckDlgButton( hDlg, IDC_OwnBook2, (BOOL) appData.secondHasOwnBookUCI );\r
+    SetDlgItemInt( hDlg, IDC_BookDep, appData.bookDepth, TRUE );\r
+    SetDlgItemInt( hDlg, IDC_BookStr, appData.bookStrength, TRUE );\r
+    SetDlgItemInt( hDlg, IDC_Games, appData.defaultMatchGames, TRUE );\r
 \r
     SendDlgItemMessage( hDlg, IDC_PolyglotDir, EM_SETSEL, 0, -1 );\r
 \r
@@ -2930,10 +2957,13 @@ LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM
       // [HGM] smp: get nr of cores:\r
       oldCores = appData.smpCores;\r
       appData.smpCores = GetDlgItemInt(hDlg, IDC_Cores, NULL, FALSE );\r
-      if(appData.smpCores != oldCores) NewSettingEvent(FALSE, "cores", appData.smpCores);\r
+      if(appData.smpCores != oldCores) NewSettingEvent(FALSE, &(first.maxCores), "cores", appData.smpCores);\r
       // [HGM] book: read tick boxes for own book use\r
       appData.firstHasOwnBookUCI  = (Boolean) IsDlgButtonChecked( hDlg, IDC_OwnBook1 );\r
       appData.secondHasOwnBookUCI = (Boolean) IsDlgButtonChecked( hDlg, IDC_OwnBook2 );\r
+      appData.bookDepth = GetDlgItemInt(hDlg, IDC_BookDep, NULL, FALSE );\r
+      appData.bookStrength = GetDlgItemInt(hDlg, IDC_BookStr, NULL, FALSE );\r
+      appData.defaultMatchGames = GetDlgItemInt(hDlg, IDC_Games, NULL, FALSE );\r
 \r
       if(gameMode == BeginningOfGame) Reset(TRUE, TRUE);\r
       EndDialog(hDlg, TRUE);\r
@@ -2954,7 +2984,7 @@ LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM
 \r
           OPENFILENAME ofn;\r
 \r
-          strcpy( buf, "" );\r
+          safeStrCpy( buf, "" , sizeof( buf)/sizeof( buf[0]) );\r
 \r
           ZeroMemory( &ofn, sizeof(ofn) );\r
 \r
@@ -2964,7 +2994,7 @@ LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM
           ofn.lpstrFilter = filter;\r
           ofn.lpstrFile = buf;\r
           ofn.nMaxFile = sizeof(buf);\r
-          ofn.lpstrTitle = "Choose Book";\r
+          ofn.lpstrTitle = _("Choose Book");\r
           ofn.Flags = OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_HIDEREADONLY;\r
 \r
           if( GetOpenFileName( &ofn ) ) {\r
@@ -2974,19 +3004,19 @@ LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM
       return TRUE;\r
 \r
     case IDC_BrowseForPolyglotDir:\r
-      if( BrowseForFolder( "Choose Polyglot Directory", buf ) ) {\r
+      if( BrowseForFolder( _("Choose Polyglot Directory"), buf ) ) {\r
         SetDlgItemText( hDlg, IDC_PolyglotDir, buf );\r
 \r
         strcat( buf, "\\polyglot.exe" );\r
 \r
         if( GetFileAttributes(buf) == 0xFFFFFFFF ) {\r
-            MessageBox( hDlg, "Polyglot was not found in the specified folder!", "Warning", MB_OK | MB_ICONWARNING );\r
+            MessageBox( hDlg, _("Polyglot was not found in the specified folder!"), "Warning", MB_OK | MB_ICONWARNING );\r
         }\r
       }\r
       return TRUE;\r
 \r
     case IDC_BrowseForEGTB:\r
-      if( BrowseForFolder( "Choose EGTB Directory:", buf ) ) {\r
+      if( BrowseForFolder( _("Choose EGTB Directory:"), buf ) ) {\r
         SetDlgItemText( hDlg, IDC_PathToEGTB, buf );\r
       }\r
       return TRUE;\r