Reorder variants, to comply with Polyglot book specs
[xboard.git] / winboard / woptions.c
index b997fd4..9c1942b 100644 (file)
@@ -1,7 +1,7 @@
 /*\r
  * woptions.c -- Options dialog box routines for WinBoard\r
  *\r
- * Copyright 2000, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.\r
+ * Copyright 2000, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.\r
  *\r
  * Enhancements Copyright 2005 Alessandro Scotti\r
  *\r
@@ -212,6 +212,9 @@ GeneralOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     CHECK_BOX(OPT_SmartMove, appData.oneClick); // [HGM] one-click\r
     CHECK_BOX(OPT_AutoTags, appData.autoDisplayTags); // [HGM]\r
     CHECK_BOX(OPT_AutoComment, appData.autoDisplayComment); // [HGM]\r
+    CHECK_BOX(OPT_Headers, appData.headers); // [HGM]\r
+    CHECK_BOX(OPT_Variations, appData.variations); // [HGM]\r
+    CHECK_BOX(OPT_AutoExtend, appData.autoExtend); // [HGM]\r
 \r
 #undef CHECK_BOX\r
 \r
@@ -263,6 +266,9 @@ GeneralOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       appData.oneClick             =IS_CHECKED(OPT_SmartMove); // [HGM] one-click\r
       appData.autoDisplayTags      =IS_CHECKED(OPT_AutoTags); // [HGM]\r
       appData.autoDisplayComment   =IS_CHECKED(OPT_AutoComment); // [HGM]\r
+      appData.headers              =IS_CHECKED(OPT_Headers); // [HGM]\r
+      appData.variations           =IS_CHECKED(OPT_Variations); // [HGM]\r
+      appData.autoExtend           =IS_CHECKED(OPT_AutoExtend); // [HGM]\r
 \r
 #undef IS_CHECKED\r
 \r
@@ -434,7 +440,7 @@ PaintSampleSquare(
   /*\r
    * clean up\r
    */\r
-  SelectObject(hdcMem, oldBrushPiece);\r
+  SelectObject(hdcMem, oldBrushSquare);\r
   SelectObject(hdcMem, oldPen);\r
   DeleteObject(brushPiece);\r
   DeleteObject(brushPieceDetail);\r
@@ -843,7 +849,7 @@ int radioButton[] = {
     -1,\r
     -1,\r
     OPT_VariantShogi,\r
-    OPT_VariantXiangqi,\r
+    -1, // Chu\r
     OPT_VariantCourier,\r
     OPT_VariantGothic,\r
     OPT_VariantCapablanca,\r
@@ -858,10 +864,12 @@ int radioButton[] = {
     OPT_VariantGreat,\r
     -1, // Twilight,\r
     OPT_VariantMakruk,\r
-    OPT_VariantASEAN,\r
     OPT_VariantSChess,\r
     OPT_VariantGrand,\r
     OPT_VariantSpartan, // Spartan\r
+    OPT_VariantXiangqi,\r
+    OPT_VariantASEAN,\r
+    OPT_VariantLion,\r
     -2 // sentinel\r
 };\r
 \r
@@ -869,6 +877,7 @@ VariantClass
 VariantWhichRadio(HWND hDlg)\r
 {\r
   int i=0, j;\r
+  *engineVariant = NULLCHAR;\r
   while((j = radioButton[i++]) != -2) {\r
        if(j == -1) continue; // no menu button\r
        if(IsDlgButtonChecked(hDlg, j) &&\r
@@ -886,12 +895,15 @@ VariantWhichRadio(HWND hDlg)
 void\r
 VariantShowRadio(HWND hDlg)\r
 {\r
+  char c = *engineVariant;\r
   int i=0, j;\r
   CheckDlgButton(hDlg, radioButton[gameInfo.variant], TRUE);\r
+  *engineVariant = NULLCHAR; // [HGM] kludge to prevent VariantName will always return engineVariant\r
   while((j = radioButton[i++]) != -2) {\r
        if(j == -1) continue; // no menu button\r
        EnableWindow(GetDlgItem(hDlg, j), appData.noChessProgram || strstr(first.variants, VariantName(i-1)));\r
   }\r
+  *engineVariant = c;\r
   for(i=0; i<9; i++) { // initialize engine-defined variants\r
     char *v = EngineDefinedVariant(&first, i); // get name of #i\r
     if(v) { // there is such a variant\r
@@ -1417,6 +1429,8 @@ IcsOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       break;\r
 \r
 \r
+\r
+\r
     case OPT_ChooseNormalColor:\r
       ColorizeTextPopup(hDlg, ColorNormal);\r
       UpdateSampleText(hDlg, OPT_SampleNormal, &mca[ColorNormal]);\r
@@ -1795,6 +1809,7 @@ FontsOptionsPopup(HWND hwnd)
 SoundComboData soundComboData[] = {\r
   {N_("Move"), NULL},\r
   {N_("Bell"), NULL},\r
+  {N_("Roar"), NULL},\r
   {N_("ICS Alarm"), NULL},\r
   {N_("ICS Win"), NULL},\r
   {N_("ICS Loss"), NULL},\r
@@ -2520,6 +2535,7 @@ LoadOptions(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     SetDlgItemInt(hDlg, OPT_Stretch, appData.stretch, FALSE);\r
     CheckDlgButton(hDlg, OPT_Reversed, appData.ignoreColors);\r
     CheckDlgButton(hDlg, OPT_Mirror, appData.findMirror);\r
+    SetDlgItemText(hDlg, OPT_Counts,  "");\r
     switch (appData.searchMode) {\r
     case 1:\r
       CheckDlgButton(hDlg, OPT_Exact, TRUE);\r
@@ -2564,6 +2580,10 @@ LoadOptions(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       appData.searchMode = LoadOptionsWhichRadio(hDlg);\r
       appData.ignoreColors = IsDlgButtonChecked(hDlg, OPT_Reversed);\r
       appData.findMirror   = IsDlgButtonChecked(hDlg, OPT_Mirror);\r
+      GetDlgItemText(hDlg, OPT_Counts, buf, MSG_SIZ);\r
+      appData.minPieces = appData.maxPieces = 0;\r
+      sscanf(buf, "%d-%d", &appData.minPieces, &appData.maxPieces);\r
+      if(appData.maxPieces < appData.minPieces) appData.maxPieces = appData.minPieces;\r
       EndDialog(hDlg, TRUE);\r
       return TRUE;\r
 \r
@@ -3062,6 +3082,8 @@ LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM
     SetDlgItemInt( hDlg, IDC_Games, appData.defaultMatchGames, TRUE );\r
 \r
     SendDlgItemMessage( hDlg, IDC_PolyglotDir, EM_SETSEL, 0, -1 );\r
+    // [HGM] Yet another ponder duplicate\r
+    CheckDlgButton( hDlg, OPT_PonderNextMove, (BOOL) appData.ponderNextMove );\r
 \r
     return TRUE;\r
 \r
@@ -3081,10 +3103,11 @@ LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM
       GetDlgItemText( hDlg, IDC_BookFile, buf, sizeof(buf) );\r
       appData.polyglotBook = strdup(buf);\r
       appData.usePolyglotBook = (Boolean) IsDlgButtonChecked( hDlg, IDC_UseBook );\r
-      // [HGM] smp: get nr of cores:\r
+      // [HGM] smp: get nr of cores and ponder:\r
       oldCores = appData.smpCores;\r
       appData.smpCores = GetDlgItemInt(hDlg, IDC_Cores, NULL, FALSE );\r
       if(appData.smpCores != oldCores) NewSettingEvent(FALSE, &(first.maxCores), "cores", appData.smpCores);\r
+      PonderNextMoveEvent((Boolean) IsDlgButtonChecked( hDlg, OPT_PonderNextMove ));\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
@@ -3119,6 +3142,7 @@ LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM
           ofn.hwndOwner = hDlg;\r
           ofn.hInstance = hInst;\r
           ofn.lpstrFilter = filter;\r
+\r
           ofn.lpstrFile = buf;\r
           ofn.nMaxFile = sizeof(buf);\r
           ofn.lpstrTitle = _("Choose Book");\r