changes from H.G. Muller; version 4.3.13
[xboard.git] / winboard / woptions.c
index 1d92129..f2a797e 100644 (file)
@@ -65,6 +65,7 @@ extern char installDir[];
 extern HWND hCommPort;    /* currently open comm port */\r
 extern DCB dcb;\r
 extern BOOLEAN chessProgram;\r
+extern startedFromPositionFile; /* [HGM] loadPos */\r
 \r
 /* types */\r
 \r
@@ -495,7 +496,7 @@ BoardOptionsWhichRadio(HWND hDlg)
 LRESULT CALLBACK\r
 BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
 {\r
-  static Boolean  mono;\r
+  static Boolean  mono, white, flip;\r
   static BoardSize size;\r
   static COLORREF lsc, dsc, wpc, bpc, hsc, phc;\r
   static HBITMAP pieces[3];\r
@@ -564,6 +565,12 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     if (appData.monoMode)\r
       CheckDlgButton(hDlg, OPT_Monochrome, TRUE);\r
 \r
+    if (appData.allWhite)\r
+      CheckDlgButton(hDlg, OPT_AllWhite, TRUE);\r
+\r
+    if (appData.upsideDown)\r
+      CheckDlgButton(hDlg, OPT_UpsideDown, TRUE);\r
+\r
     pieces[0] = DoLoadBitmap(hInst, "n", SAMPLE_SQ_SIZE, "s");\r
     pieces[1] = DoLoadBitmap(hInst, "n", SAMPLE_SQ_SIZE, "w");\r
     pieces[2] = DoLoadBitmap(hInst, "n", SAMPLE_SQ_SIZE, "o");\r
@@ -575,6 +582,8 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     hsc = highlightSquareColor;\r
     phc = premoveHighlightColor;\r
     mono = appData.monoMode;\r
+    white= appData.allWhite;\r
+    flip = appData.upsideDown;\r
     size = boardSize;\r
 \r
     SetBoardOptionEnables(hDlg);\r
@@ -619,6 +628,8 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
          (wpc  != whitePieceColor) ||\r
          (bpc  != blackPieceColor) ||\r
          (hsc  != highlightSquareColor) ||\r
+          (flip != appData.upsideDown) ||\r
+          (white != appData.allWhite) ||\r
          (phc  != premoveHighlightColor)) {\r
 \r
          lightSquareColor = lsc;\r
@@ -628,6 +639,8 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
          highlightSquareColor = hsc;\r
          premoveHighlightColor = phc;\r
          appData.monoMode = mono;\r
+          appData.allWhite = white;\r
+          appData.upsideDown = flip;\r
 \r
          InitDrawingColors();\r
          InitDrawingSizes(boardSize, 0);\r
@@ -695,7 +708,11 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       hsc = ParseColorName(HIGHLIGHT_SQUARE_COLOR);\r
       phc = ParseColorName(PREMOVE_HIGHLIGHT_COLOR);\r
       mono = FALSE;\r
+      white= FALSE;\r
+      flip = FALSE;\r
       CheckDlgButton(hDlg, OPT_Monochrome, FALSE);\r
+      CheckDlgButton(hDlg, OPT_AllWhite,   FALSE);\r
+      CheckDlgButton(hDlg, OPT_UpsideDown, FALSE);\r
       PaintColorBlock(hDlg, OPT_LightSquareColor, lsc);\r
       PaintColorBlock(hDlg, OPT_DarkSquareColor,  dsc);\r
       PaintColorBlock(hDlg, OPT_WhitePieceColor,  wpc);\r
@@ -713,6 +730,16 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       mono = !mono;\r
       SetBoardOptionEnables(hDlg);\r
       break;\r
+\r
+    case OPT_AllWhite:\r
+      white = !white;\r
+      SetBoardOptionEnables(hDlg);\r
+      break;\r
+\r
+    case OPT_UpsideDown:\r
+      flip = !flip;\r
+      SetBoardOptionEnables(hDlg);\r
+      break;\r
     }\r
     break;\r
   }\r
@@ -747,7 +774,10 @@ VariantWhichRadio(HWND hDlg)
          (IsDlgButtonChecked(hDlg, OPT_VariantSuicide) ? VariantSuicide :\r
          (IsDlgButtonChecked(hDlg, OPT_VariantAtomic) ? VariantAtomic :\r
          (IsDlgButtonChecked(hDlg, OPT_VariantShatranj) ? VariantShatranj :\r
-          VariantNormal )))))))))))))));\r
+         (IsDlgButtonChecked(hDlg, OPT_VariantFRC) ? VariantFischeRandom :\r
+         (IsDlgButtonChecked(hDlg, OPT_VariantCylinder) ? VariantCylinder :\r
+         (IsDlgButtonChecked(hDlg, OPT_VariantFalcon) ? VariantFalcon :\r
+          VariantNormal ))))))))))))))))));\r
 }\r
 \r
 LRESULT CALLBACK\r
@@ -810,6 +840,9 @@ NewVariantDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     case VariantShatranj:\r
       CheckDlgButton(hDlg, OPT_VariantShatranj, TRUE);\r
       break;\r
+    case VariantFischeRandom:\r
+      CheckDlgButton(hDlg, OPT_VariantFRC, TRUE);\r
+      break;\r
     }\r
 \r
     SetDlgItemInt( hDlg, IDC_Files, -1, TRUE );\r
@@ -848,6 +881,8 @@ NewVariantDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       if(!n2_ok) appData.NrRanks = -1;\r
       if(!n3_ok) appData.holdingsSize = -1;\r
 \r
+      startedFromPositionFile = FALSE; /* [HGM] loadPos: no longer valid in new variant */\r
+      appData.pieceToCharTable = NULL;\r
       Reset(TRUE, TRUE);\r
 \r
       return TRUE;\r