variation-support patch
[xboard.git] / winboard / winboard.c
index 3870fc8..774d2b7 100644 (file)
@@ -193,8 +193,8 @@ static HBRUSH lightSquareBrush, darkSquareBrush,
   blackSquareBrush, /* [HGM] for band between board and holdings */\r
   explodeBrush,     /* [HGM] atomic */\r
   whitePieceBrush, blackPieceBrush, iconBkgndBrush /*, outlineBrush*/;\r
-static POINT gridEndpoints[(BOARD_SIZE + 1) * 4];\r
-static DWORD gridVertexCounts[(BOARD_SIZE + 1) * 2];\r
+static POINT gridEndpoints[(BOARD_RANKS + BOARD_FILES + 2) * 2];\r
+static DWORD gridVertexCounts[BOARD_RANKS + BOARD_FILES + 2];\r
 static HPEN gridPen = NULL;\r
 static HPEN highlightPen = NULL;\r
 static HPEN premovePen = NULL;\r
@@ -216,7 +216,7 @@ static HBITMAP darkBackTexture = NULL;
 static int liteBackTextureMode = BACK_TEXTURE_MODE_PLAIN;\r
 static int darkBackTextureMode = BACK_TEXTURE_MODE_PLAIN;\r
 static int backTextureSquareSize = 0;\r
-static struct { int x; int y; int mode; } backTextureSquareInfo[BOARD_SIZE][BOARD_SIZE];\r
+static struct { int x; int y; int mode; } backTextureSquareInfo[BOARD_RANKS][BOARD_FILES];\r
 \r
 #if __GNUC__ && !defined(_winmajor)\r
 #define oldDialog 0 /* cygwin doesn't define _winmajor; mingw does */\r
@@ -2167,9 +2167,9 @@ InitAppData(LPSTR lpCmdLine)
   ParseArgs(StringGet, &lpCmdLine);\r
 \r
   /* [HGM] make sure board size is acceptable */\r
-  if(appData.NrFiles > BOARD_SIZE ||\r
-     appData.NrRanks > BOARD_SIZE   )\r
-      DisplayFatalError("Recompile with BOARD_SIZE > 12, to support this size", 0, 2);\r
+  if(appData.NrFiles > BOARD_FILES ||\r
+     appData.NrRanks > BOARD_RANKS   )\r
+      DisplayFatalError("Recompile with BOARD_RANKS or BOARD_FILES, to support this size", 0, 2);\r
 \r
   /* [HGM] After parsing the options from the .ini file, and overruling them\r
    * with options from the command line, we now make an even higher priority\r
@@ -4158,8 +4158,8 @@ DrawBoardOnDC(HDC hdc, Board board, HDC tmphdc)
   if( liteBackTexture != NULL || darkBackTexture != NULL ) {\r
       static int backTextureBoardSize; /* [HGM] boardsize: also new texture if board format changed */\r
       if( backTextureSquareSize != squareSize \r
-       || backTextureBoardSize != BOARD_WIDTH+BOARD_SIZE*BOARD_HEIGHT) {\r
-         backTextureBoardSize = BOARD_WIDTH+BOARD_SIZE*BOARD_HEIGHT;\r
+       || backTextureBoardSize != BOARD_WIDTH+BOARD_FILES*BOARD_HEIGHT) {\r
+         backTextureBoardSize = BOARD_WIDTH+BOARD_FILES*BOARD_HEIGHT;\r
           backTextureSquareSize = squareSize;\r
           RebuildTextureSquareInfo();\r
       }\r
@@ -7110,13 +7110,8 @@ TypeInMoveDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
        }\r
        // [HGM] movenum: allow move number to be typed in any mode\r
        if(sscanf(move, "%d", &n) == 1 && n != 0 ) {\r
-         currentMove = 2*n-1;\r
-         if(currentMove > forwardMostMove)  currentMove = forwardMostMove;\r
-         if(currentMove < backwardMostMove) currentMove = backwardMostMove;\r
+         ToNrEvent(2*n-1);\r
          EndDialog(hDlg, TRUE);\r
-         DrawPosition(TRUE, boards[currentMove]);\r
-         if(currentMove > backwardMostMove) DisplayMove(currentMove - 1);\r
-         else DisplayMessage("", "");\r
          return TRUE;\r
        }\r
       }\r
@@ -8493,6 +8488,13 @@ typedef struct {
 } Enables;\r
 \r
 VOID\r
+GreyRevert(Boolean grey)\r
+{ // [HGM] vari: for retracting variations in local mode\r
+  HMENU hmenu = GetMenu(hwndMain);\r
+  EnableMenuItem(hmenu, IDM_Revert, MF_BYCOMMAND|(grey ? MF_GRAYED : MF_ENABLED));\r
+}\r
+\r
+VOID\r
 SetMenuEnables(HMENU hmenu, Enables *enab)\r
 {\r
   while (enab->item > 0) {\r