* Massachusetts. \r
*\r
* Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,\r
- * 2007, 2008, 2009 Free Software Foundation, Inc.\r
+ * 2007, 2008, 2009, 2010 Free Software Foundation, Inc.\r
*\r
* Enhancements Copyright 2005 Alessandro Scotti\r
*\r
Boolean chessProgram;\r
//static int boardX, boardY;\r
int minX, minY; // [HGM] placement: volatile limits on upper-left corner\r
-static int squareSize, lineGap, minorSize;\r
+int squareSize, lineGap, minorSize;\r
static int winW, winH;\r
static RECT messageRect, whiteRect, blackRect, leftLogoRect, rightLogoRect; // [HGM] logo\r
static int logoHeight = 0;\r
blackRect.right = blackRect.left + boardWidth/2 - 1;\r
blackRect.top = whiteRect.top;\r
blackRect.bottom = whiteRect.bottom;\r
+\r
+ logoHeight = 0; // [HGM] logo: suppress logo after change to tiny layout!\r
}\r
\r
messageRect.left = OUTER_MARGIN + MESSAGE_LINE_LEFTMARGIN;\r
DeleteDC(tmphdc);\r
}\r
\r
+static HDC hdcSeek;\r
+\r
+// [HGM] seekgraph\r
+void DrawSeekAxis( int x, int y, int xTo, int yTo )\r
+{\r
+ POINT stPt;\r
+ HPEN hp = SelectObject( hdcSeek, gridPen );\r
+ MoveToEx( hdcSeek, boardRect.left+x, boardRect.top+y, &stPt );\r
+ LineTo( hdcSeek, boardRect.left+xTo, boardRect.top+yTo );\r
+ SelectObject( hdcSeek, hp );\r
+}\r
+\r
+// front-end wrapper for drawing functions to do rectangles\r
+void DrawSeekBackground( int left, int top, int right, int bottom )\r
+{\r
+ HPEN hp;\r
+ RECT rc;\r
+\r
+ if (hdcSeek == NULL) {\r
+ hdcSeek = GetDC(hwndMain);\r
+ if (!appData.monoMode) {\r
+ SelectPalette(hdcSeek, hPal, FALSE);\r
+ RealizePalette(hdcSeek);\r
+ }\r
+ }\r
+ hp = SelectObject( hdcSeek, gridPen );\r
+ rc.top = boardRect.top+top; rc.left = boardRect.left+left; \r
+ rc.bottom = boardRect.top+bottom; rc.right = boardRect.left+right;\r
+ FillRect( hdcSeek, &rc, lightSquareBrush );\r
+ SelectObject( hdcSeek, hp );\r
+}\r
+\r
+// front-end wrapper for putting text in graph\r
+void DrawSeekText(char *buf, int x, int y)\r
+{\r
+ SIZE stSize;\r
+ SetBkMode( hdcSeek, TRANSPARENT );\r
+ GetTextExtentPoint32( hdcSeek, buf, strlen(buf), &stSize );\r
+ TextOut( hdcSeek, boardRect.left+x-3, boardRect.top+y-stSize.cy/2, buf, strlen(buf) );\r
+}\r
+\r
+void DrawSeekDot(int x, int y, int color)\r
+{\r
+ int square = color & 0x80;\r
+ color &= 0x7F;\r
+ HBRUSH oldBrush = SelectObject(hdcSeek, \r
+ color == 0 ? markerBrush : color == 1 ? darkSquareBrush : explodeBrush);\r
+ if(square)\r
+ Rectangle(hdcSeek, boardRect.left+x - squareSize/9, boardRect.top+y - squareSize/9,\r
+ boardRect.left+x + squareSize/9, boardRect.top+y + squareSize/9);\r
+ else\r
+ Ellipse(hdcSeek, boardRect.left+x - squareSize/8, boardRect.top+y - squareSize/8,\r
+ boardRect.left+x + squareSize/8, boardRect.top+y + squareSize/8);\r
+ SelectObject(hdcSeek, oldBrush);\r
+}\r
+\r
VOID\r
HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board)\r
{\r
*/\r
Boolean fullrepaint = repaint;\r
\r
+ if(DrawSeekGraph()) return; // [HG} seekgraph: suppress printing board if seek graph up\r
+\r
if( DrawPositionNeedsFullRepaint() ) {\r
fullrepaint = TRUE;\r
}\r
VOID\r
MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)\r
{\r
- int x, y;\r
+ int x, y, menuNr;\r
POINT pt;\r
static int recursive = 0;\r
HMENU hmenu;\r
break;\r
\r
case WM_MOUSEMOVE:\r
+ if(SeekGraphClick(Press, pt.x - boardRect.left, pt.y - boardRect.top, 1)) break;\r
MovePV(pt.x - boardRect.left, pt.y - boardRect.top, boardRect.bottom - boardRect.top);\r
if ((appData.animateDragging || appData.highlightDragging)\r
&& (wParam & MK_LBUTTON)\r
case WM_MBUTTONUP:\r
case WM_RBUTTONUP:\r
ReleaseCapture();\r
- UnLoadPV();\r
+ RightClick(Release, pt.x - boardRect.left, pt.y - boardRect.top, &fromX, &fromY);\r
break;\r
\r
case WM_MBUTTONDOWN:\r
}\r
DrawPosition(TRUE, NULL);\r
\r
- switch (gameMode) {\r
- case IcsExamining:\r
- if(x < BOARD_LEFT || x >= BOARD_RGHT) break;\r
- case EditPosition:\r
- if (x == BOARD_LEFT-1 || x == BOARD_RGHT) break;\r
- if (x < 0 || y < 0) break;\r
- fromX = x;\r
- fromY = y;\r
+ menuNr = RightClick(Press, pt.x - boardRect.left, pt.y - boardRect.top, &fromX, &fromY);\r
+ switch (menuNr) {\r
+ case 0:\r
if (message == WM_MBUTTONDOWN) {\r
buttonCount = 3; /* even if system didn't think so */\r
if (wParam & MK_SHIFT) \r
MenuPopup(hwnd, pt, LoadMenu(hInst, "ShogiPieceMenu"), -1);\r
}\r
break;\r
- case IcsObserving:\r
- if(!appData.icsEngineAnalyze) break;\r
- case IcsPlayingWhite:\r
- case IcsPlayingBlack:\r
- if(!appData.zippyPlay) goto noZip;\r
- case MachinePlaysWhite:\r
- case MachinePlaysBlack:\r
- case TwoMachinesPlay:\r
- case AnalyzeMode:\r
- case AnalyzeFile:\r
- if (!appData.dropMenu) {\r
- SetCapture(hwndMain);\r
- LoadPV(pt.x - boardRect.left, pt.y - boardRect.top);\r
- break;\r
- }\r
- if(gameMode == TwoMachinesPlay || gameMode == AnalyzeMode ||\r
- gameMode == AnalyzeFile || gameMode == IcsObserving) break;\r
- case EditGame:\r
- noZip:\r
- if (x < 0 || y < 0) break;\r
- if (!appData.dropMenu || appData.testLegality &&\r
- gameInfo.variant != VariantBughouse &&\r
- gameInfo.variant != VariantCrazyhouse) break;\r
- fromX = x;\r
- fromY = y;\r
+ case 2:\r
+ SetCapture(hwndMain);
+ break;\r
+ case 1:\r
hmenu = LoadMenu(hInst, "DropPieceMenu");\r
SetupDropMenu(hmenu);\r
MenuPopup(hwnd, pt, hmenu, -1);\r
- break;\r
default:\r
break;\r
}\r