EngineOutputPopUp();\r
}\r
\r
- InitBackEnd2();\r
-\r
/* Make the window visible; update its client area; and return "success" */\r
EnsureOnScreen(&wpMain.x, &wpMain.y, minX, minY);\r
wp.length = sizeof(WINDOWPLACEMENT);\r
wp.rcNormalPosition.bottom = wpMain.y + wpMain.height;\r
SetWindowPlacement(hwndMain, &wp);\r
\r
+ InitBackEnd2(); // [HGM] moved until after all windows placed, to save correct position if fatal error on engine start\r
+\r
if(!appData.noGUI) SetWindowPos(hwndMain, alwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST,\r
0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);\r
\r
VOID\r
HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board)\r
{\r
- static Board lastReq, lastDrawn;\r
+ static Board lastReq[2], lastDrawn[2];\r
static HighlightInfo lastDrawnHighlight, lastDrawnPremove;\r
static int lastDrawnFlipView = 0;\r
- static int lastReqValid = 0, lastDrawnValid = 0;\r
+ static int lastReqValid[2] = {0, 0}, lastDrawnValid[2] = {0, 0};\r
int releaseDC, x, y, x2, y2, row, column, num_clips = 0, i;\r
HDC tmphdc;\r
HDC hdcmem;\r
RECT Rect;\r
HRGN clips[MAX_CLIPS];\r
ChessSquare dragged_piece = EmptySquare;\r
+ int nr = twoBoards*partnerUp;\r
\r
/* I'm undecided on this - this function figures out whether a full\r
* repaint is necessary on its own, so there's no real reason to have the\r
if( DrawPositionNeedsFullRepaint() ) {\r
fullrepaint = TRUE;\r
}\r
- if(twoBoards) fullrepaint = TRUE; // [HGM] dual: our memory of last-drawn will be all wrong\r
\r
if (board == NULL) {\r
- if (!lastReqValid) {\r
+ if (!lastReqValid[nr]) {\r
return;\r
}\r
- board = lastReq;\r
+ board = lastReq[nr];\r
} else {\r
- CopyBoard(lastReq, board);\r
- lastReqValid = 1;\r
+ CopyBoard(lastReq[nr], board);\r
+ lastReqValid[nr] = 1;\r
}\r
\r
if (doingSizing) {\r
* newest board with the last drawn board and checking if\r
* flipping has changed.\r
*/\r
- if (!fullrepaint && lastDrawnValid && lastDrawnFlipView == flipView) {\r
+ if (!fullrepaint && lastDrawnValid[nr] && (nr == 1 || lastDrawnFlipView == flipView)) {\r
for (row = 0; row < BOARD_HEIGHT; row++) { /* [HGM] true size, not 8 */\r
for (column = 0; column < BOARD_WIDTH; column++) {\r
- if (lastDrawn[row][column] != board[row][column]) {\r
+ if (lastDrawn[nr][row][column] != board[row][column]) {\r
SquareToPos(row, column, &x, &y);\r
clips[num_clips++] =\r
CreateRectRgn(x, y, x + squareSize, y + squareSize);\r
}\r
}\r
}\r
+ if(nr == 0) { // [HGM] dual: no highlights on second board\r
for (i=0; i<2; i++) {\r
if (lastDrawnHighlight.sq[i].x != highlightInfo.sq[i].x ||\r
lastDrawnHighlight.sq[i].y != highlightInfo.sq[i].y) {\r
}\r
}\r
}\r
+ }\r
} else {\r
fullrepaint = TRUE;\r
}\r
explodes. The old and new positions both had an empty square\r
at the destination, but animation has drawn a piece there and\r
we have to remember to erase it. [HGM] moved until after setting lastDrawn */\r
- lastDrawn[animInfo.to.y][animInfo.to.x] = animInfo.piece;\r
+ lastDrawn[0][animInfo.to.y][animInfo.to.x] = animInfo.piece;\r
}\r
}\r
\r
SelectObject(hdcmem, oldBrush);\r
} else {\r
DrawGridOnDC(hdcmem);\r
- DrawHighlightsOnDC(hdcmem);\r
+ if(nr == 0) DrawHighlightsOnDC(hdcmem); // [HGM] dual: no highlights on right board yet\r
DrawBoardOnDC(hdcmem, board, tmphdc);\r
}\r
+ if(nr == 0) // [HGM] dual: markers only on left board\r
for (row = 0; row < BOARD_HEIGHT; row++) {\r
for (column = 0; column < BOARD_WIDTH; column++) {\r
if (marker[row][column]) { // marker changes only occur with full repaint!\r
\r
DrawCoordsOnDC(hdcmem);\r
\r
- CopyBoard(lastDrawn, board); /* [HGM] Moved to here from end of routine, */\r
+ CopyBoard(lastDrawn[nr], board); /* [HGM] Moved to here from end of routine, */\r
/* to make sure lastDrawn contains what is actually drawn */\r
\r
/* Put the dragged piece back into place and draw it (out of place!) */\r
\r
/* Set clipping on the target DC */\r
if (!fullrepaint) {\r
+ if(nr == 1) for (x = 0; x < num_clips; x++) { // [HGM] dual: translate clips\r
+ RECT rect;\r
+ GetRgnBox(clips[x], &rect);\r
+ DeleteObject(clips[x]);\r
+ clips[x] = CreateRectRgn(rect.left + wpMain.width/2, rect.top, \r
+ rect.right + wpMain.width/2, rect.bottom);\r
+ }\r
SelectClipRgn(hdc, clips[0]);\r
for (x = 1; x < num_clips; x++) {\r
if (ExtSelectClipRgn(hdc, clips[x], RGN_OR) == ERROR)\r
if (releaseDC) \r
ReleaseDC(hwndMain, hdc);\r
\r
- if (lastDrawnFlipView != flipView) {\r
+ if (lastDrawnFlipView != flipView && nr == 0) {\r
if (flipView)\r
CheckMenuItem(GetMenu(hwndMain),IDM_FlipView, MF_BYCOMMAND|MF_CHECKED);\r
else\r
lastDrawnHighlight = highlightInfo;\r
lastDrawnPremove = premoveHighlightInfo;\r
lastDrawnFlipView = flipView;\r
- lastDrawnValid = 1;\r
+ lastDrawnValid[nr] = 1;\r
}\r
\r
/* [HGM] diag: Save the current board display to the given open file and close the file */\r
RealizePalette(hdc);\r
}\r
HDCDrawPosition(hdc, 1, NULL);\r
+ if(twoBoards) { // [HGM] dual: also redraw other board in other orientation\r
+ flipView = !flipView; partnerUp = !partnerUp;\r
+ HDCDrawPosition(hdc, 1, NULL);\r
+ flipView = !flipView; partnerUp = !partnerUp;\r
+ }\r
oldFont =\r
SelectObject(hdc, font[boardSize][MESSAGE_FONT]->hf);\r
ExtTextOut(hdc, messageRect.left, messageRect.top,\r
GetDlgItemText(hDlg, OPT_Name, move, sizeof(move));\r
appData.userName = strdup(move);\r
SetUserLogo();\r
+ SetGameInfo();\r
+ if(gameMode == MachinePlaysWhite || gameMode == MachinePlaysBlack) {\r
+ sprintf(move, "%s vs. %s", gameInfo.white, gameInfo.black);\r
+ DisplayTitle(move);\r
+ }\r
+\r
\r
EndDialog(hDlg, TRUE);\r
return TRUE;\r