static int boardX, boardY, consoleX, consoleY, consoleW, consoleH;\r
static int squareSize, lineGap, minorSize;\r
static int winWidth, winHeight;\r
-static RECT messageRect, whiteRect, blackRect;\r
+static RECT messageRect, whiteRect, blackRect, leftLogoRect, rightLogoRect; // [HGM] logo\r
+static int logoHeight = 0;\r
static char messageText[MESSAGE_TEXT_MAX];\r
static int clockTimerEvent = 0;\r
static int loadGameTimerEvent = 0;\r
return (FALSE);\r
}\r
\r
+ /* [HGM] logo: Load logos if specified (must be done before InitDrawingSizes) */\r
+ if( appData.firstLogo && appData.firstLogo[0] != NULLCHAR) {\r
+ first.programLogo = LoadImage( 0, appData.firstLogo, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );\r
+\r
+ if (first.programLogo == NULL && appData.debugMode) {\r
+ fprintf( debugFP, "Unable to load logo bitmap '%s'\n", appData.firstLogo );\r
+ }\r
+ } else if(appData.autoLogo) {\r
+ if(appData.firstDirectory && appData.firstDirectory[0]) {\r
+ char buf[MSG_SIZ];\r
+ sprintf(buf, "%s/logo.bmp", appData.firstDirectory);\r
+ first.programLogo = LoadImage( 0, buf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); \r
+ }\r
+ }\r
+\r
+ if( appData.secondLogo && appData.secondLogo[0] != NULLCHAR) {\r
+ second.programLogo = LoadImage( 0, appData.secondLogo, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );\r
+\r
+ if (second.programLogo == NULL && appData.debugMode) {\r
+ fprintf( debugFP, "Unable to load logo bitmap '%s'\n", appData.secondLogo );\r
+ }\r
+ } else if(appData.autoLogo) {\r
+ if(appData.secondDirectory && appData.secondDirectory[0]) {\r
+ char buf[MSG_SIZ];\r
+ sprintf(buf, "%s\\logo.bmp", appData.secondDirectory);\r
+ second.programLogo = LoadImage( 0, buf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); \r
+ }\r
+ }\r
+\r
iconWhite = LoadIcon(hInstance, "icon_white");\r
iconBlack = LoadIcon(hInstance, "icon_black");\r
iconCurrent = iconWhite;\r
boardSize = (BoardSize)ibs;\r
}\r
}\r
+\r
InitDrawingSizes(boardSize, 0);\r
InitMenuChecks();\r
buttonCount = GetSystemMetrics(SM_CMOUSEBUTTONS);\r
\r
mysrandom( (unsigned) time(NULL) );\r
\r
- /* Make a console window if needed */\r
- if (appData.icsActive) {\r
- ConsoleCreate();\r
- }\r
-\r
/* [AS] Restore layout */\r
if( wpMoveHistory.visible ) {\r
MoveHistoryPopUp();\r
{ "sameColorGames", ArgInt, (LPVOID) &appData.sameColorGames, FALSE },\r
{ "smpCores", ArgInt, (LPVOID) &appData.smpCores, TRUE },\r
{ "egtFormats", ArgString, (LPVOID) &appData.egtFormats, TRUE },\r
+ { "niceEngines", ArgInt, (LPVOID) &appData.niceEngines, TRUE },\r
+ { "firstLogo", ArgFilename, (LPVOID) &appData.firstLogo, FALSE },\r
+ { "secondLogo", ArgFilename, (LPVOID) &appData.secondLogo, FALSE },\r
+ { "autoLogo", ArgBoolean, (LPVOID) &appData.autoLogo, TRUE },\r
\r
#ifdef ZIPPY\r
{ "zippyTalk", ArgBoolean, (LPVOID) &appData.zippyTalk, FALSE },\r
{ "secondAccumulateTC", ArgInt, (LPVOID) &appData.secondAccumulateTC, FALSE },\r
{ "firstNPS", ArgInt, (LPVOID) &appData.firstNPS, FALSE },\r
{ "secondNPS", ArgInt, (LPVOID) &appData.secondNPS, FALSE },\r
+ { "noGUI", ArgTrue, (LPVOID) &appData.noGUI, FALSE },\r
{ NULL, ArgNone, NULL, FALSE }\r
};\r
\r
appData.reuseFirst = TRUE;\r
appData.reuseSecond = TRUE;\r
appData.blindfold = FALSE;\r
+ appData.icsEngineAnalyze = FALSE;\r
dcb.DCBlength = sizeof(DCB);\r
dcb.BaudRate = 9600;\r
dcb.fBinary = TRUE;\r
dcb.fNull = FALSE;\r
dcb.fRtsControl = RTS_CONTROL_ENABLE;\r
dcb.fAbortOnError = FALSE;\r
- dcb.wReserved = 0;\r
+ /* Microsoft SDK >= Feb. 2003 (MS VS >= 2002) */\r
+ #if (defined(_MSC_VER) && _MSC_VER <= 1200) \r
+ //dcb.wReserved = 0;\r
+ #else\r
+ dcb.wReserved = 0;\r
+ #endif\r
dcb.ByteSize = 7;\r
dcb.Parity = SPACEPARITY;\r
dcb.StopBits = ONESTOPBIT;\r
SetBkMode( hdc, TRANSPARENT );\r
SetTextColor( hdc, chroma );\r
/* Step 2: the piece has been drawn in purple, there are now black and purple in this bitmap */\r
- TextOut( hdc, pt.x, pt.y, &pieceToFontChar[index], 1 );\r
+ TextOut( hdc, pt.x, pt.y, &pieceToFontChar[appData.allWhite && index >= (int)BlackPawn ? index - (int)BlackPawn : index], 1 );\r
\r
SelectObject( hdc, GetStockObject(WHITE_BRUSH) );\r
/* Step 3: the area outside the piece is filled with white */\r
Step 5: some fonts have "disconnected" areas that are skipped by the fill:\r
draw the piece again in black for safety.\r
*/\r
- TextOut( hdc, pt.x, pt.y, &pieceToFontChar[index], 1 );\r
+ TextOut( hdc, pt.x, pt.y, &pieceToFontChar[appData.allWhite && index >= (int)BlackPawn ? index - (int)BlackPawn : index], 1 );\r
\r
SelectObject( hdc, hbm_old );\r
\r
}\r
\r
SetTextColor( hdc, foreColor );\r
- TextOut( hdc, pt.x, pt.y, &pieceToFontChar[index], 1 );\r
+ TextOut( hdc, pt.x, pt.y, &pieceToFontChar[appData.allWhite && index >= (int)BlackPawn ? index - (int)BlackPawn : index], 1 );\r
\r
SelectObject( hdc, hbm_old );\r
\r
ReleaseDC(hwndMain, hdc);\r
\r
/* Compute where everything goes */\r
- whiteRect.left = OUTER_MARGIN;\r
- whiteRect.right = whiteRect.left + boardWidth/2 - INNER_MARGIN/2;\r
- whiteRect.top = OUTER_MARGIN;\r
- whiteRect.bottom = whiteRect.top + clockSize.cy;\r
+ if(first.programLogo || second.programLogo) {\r
+ /* [HGM] logo: if either logo is on, reserve space for it */\r
+ logoHeight = 2*clockSize.cy;\r
+ leftLogoRect.left = OUTER_MARGIN;\r
+ leftLogoRect.right = leftLogoRect.left + 4*clockSize.cy;\r
+ leftLogoRect.top = OUTER_MARGIN;\r
+ leftLogoRect.bottom = OUTER_MARGIN + logoHeight;\r
+\r
+ rightLogoRect.right = OUTER_MARGIN + boardWidth;\r
+ rightLogoRect.left = rightLogoRect.right - 4*clockSize.cy;\r
+ rightLogoRect.top = OUTER_MARGIN;\r
+ rightLogoRect.bottom = OUTER_MARGIN + logoHeight;\r
+\r
+\r
+ blackRect.left = leftLogoRect.right;\r
+ blackRect.right = rightLogoRect.left;\r
+ blackRect.top = OUTER_MARGIN;\r
+ blackRect.bottom = blackRect.top + clockSize.cy;\r
+\r
+ whiteRect.left = blackRect.left ;\r
+ whiteRect.right = blackRect.right;\r
+ whiteRect.top = blackRect.bottom;\r
+ whiteRect.bottom = leftLogoRect.bottom;\r
+ } else {\r
+ whiteRect.left = OUTER_MARGIN;\r
+ whiteRect.right = whiteRect.left + boardWidth/2 - INNER_MARGIN/2;\r
+ whiteRect.top = OUTER_MARGIN + logoHeight;\r
+ whiteRect.bottom = whiteRect.top + clockSize.cy;\r
\r
- blackRect.left = whiteRect.right + INNER_MARGIN;\r
- blackRect.right = blackRect.left + boardWidth/2 - 1;\r
- blackRect.top = whiteRect.top;\r
- blackRect.bottom = whiteRect.bottom;\r
+ blackRect.left = whiteRect.right + INNER_MARGIN;\r
+ blackRect.right = blackRect.left + boardWidth/2 - 1;\r
+ blackRect.top = whiteRect.top;\r
+ blackRect.bottom = whiteRect.bottom;\r
+ }\r
\r
- messageRect.left = whiteRect.left + MESSAGE_LINE_LEFTMARGIN;\r
+ messageRect.left = OUTER_MARGIN + MESSAGE_LINE_LEFTMARGIN;\r
if (appData.showButtonBar) {\r
- messageRect.right = blackRect.right\r
+ messageRect.right = OUTER_MARGIN + boardWidth // [HGM] logo: expressed independent of clock placement\r
- N_BUTTONS*BUTTON_WIDTH - MESSAGE_LINE_LEFTMARGIN;\r
} else {\r
- messageRect.right = blackRect.right;\r
+ messageRect.right = OUTER_MARGIN + boardWidth;\r
}\r
messageRect.top = whiteRect.bottom + INNER_MARGIN;\r
messageRect.bottom = messageRect.top + messageSize.cy;\r
\r
- boardRect.left = whiteRect.left;\r
+ boardRect.left = OUTER_MARGIN;\r
boardRect.right = boardRect.left + boardWidth;\r
boardRect.top = messageRect.bottom + INNER_MARGIN;\r
boardRect.bottom = boardRect.top + boardHeight;\r
CreatePiecesFromFont();\r
\r
if( fontBitmapSquareSize == squareSize ) {\r
- int index = TranslatePieceToFontPiece( piece );\r
+ int index = TranslatePieceToFontPiece(piece);\r
\r
SelectObject( tmphdc, hPieceMask[ index ] );\r
\r
if( (col + row) & 1 ) {\r
/* Lite square */\r
if( lite_w >= squareSize && lite_h >= squareSize ) {\r
- backTextureSquareInfo[row][col].x = col * (lite_w - squareSize) / BOARD_WIDTH;\r
- backTextureSquareInfo[row][col].y = row * (lite_h - squareSize) / BOARD_HEIGHT;\r
+ backTextureSquareInfo[row][col].x = col * (lite_w - squareSize) / (BOARD_WIDTH-1); /* [HGM] divide by size-1 in stead of size! */\r
+ backTextureSquareInfo[row][col].y = (BOARD_HEIGHT-1-row) * (lite_h - squareSize) / (BOARD_HEIGHT-1);\r
backTextureSquareInfo[row][col].mode = GetBackTextureMode(liteBackTextureMode);\r
}\r
}\r
else {\r
/* Dark square */\r
if( dark_w >= squareSize && dark_h >= squareSize ) {\r
- backTextureSquareInfo[row][col].x = col * (dark_w - squareSize) / BOARD_WIDTH;\r
- backTextureSquareInfo[row][col].y = row * (dark_h - squareSize) / BOARD_HEIGHT;\r
+ backTextureSquareInfo[row][col].x = col * (dark_w - squareSize) / (BOARD_WIDTH-1);\r
+ backTextureSquareInfo[row][col].y = (BOARD_HEIGHT-1-row) * (dark_h - squareSize) / (BOARD_HEIGHT-1);\r
backTextureSquareInfo[row][col].mode = GetBackTextureMode(darkBackTextureMode);\r
}\r
}\r
piece = board[row][column];\r
\r
square_color = ((column + row) % 2) == 1;\r
- if(!strcmp(appData.variant, "xiangqi") ) {\r
+ if( gameInfo.variant == VariantXiangqi ) {\r
square_color = !InPalace(row, column);\r
if(BOARD_HEIGHT&1) { if(row==BOARD_HEIGHT/2) square_color ^= 1; }\r
else if(row < BOARD_HEIGHT/2) square_color ^= 1;\r
else if( backTextureSquareInfo[row][column].mode > 0 ) {\r
/* [AS] Draw the square using a texture bitmap */\r
HBITMAP hbm = SelectObject( texture_hdc, square_color ? liteBackTexture : darkBackTexture );\r
+ int r = row, c = column; // [HGM] do not flip board in flipView\r
+ if(flipView) { r = BOARD_HEIGHT-1 - r; c = BOARD_WIDTH-1 - c; }\r
\r
DrawTile( x, y, \r
squareSize, squareSize, \r
hdc, \r
texture_hdc,\r
- backTextureSquareInfo[row][column].mode,\r
- backTextureSquareInfo[row][column].x,\r
- backTextureSquareInfo[row][column].y );\r
+ backTextureSquareInfo[r][c].mode,\r
+ backTextureSquareInfo[r][c].x,\r
+ backTextureSquareInfo[r][c].y );\r
\r
SelectObject( texture_hdc, hbm );\r
\r
#define MAX_CLIPS 200 /* more than enough */\r
\r
VOID\r
+DrawLogoOnDC(HDC hdc, RECT logoRect, ChessProgramState *cps)\r
+{\r
+ HBITMAP bufferBitmap;\r
+ BITMAP bi;\r
+ RECT Rect;\r
+ HDC tmphdc;\r
+ HBITMAP hbm;\r
+ int w = 100, h = 50;\r
+\r
+ if(cps->programLogo == NULL) return;\r
+// GetClientRect(hwndMain, &Rect);\r
+// bufferBitmap = CreateCompatibleBitmap(hdc, Rect.right-Rect.left+1,\r
+// Rect.bottom-Rect.top+1);\r
+ tmphdc = CreateCompatibleDC(hdc);\r
+ hbm = SelectObject(tmphdc, (HBITMAP) cps->programLogo);\r
+ if( GetObject( cps->programLogo, sizeof(bi), &bi ) > 0 ) {\r
+ w = bi.bmWidth;\r
+ h = bi.bmHeight;\r
+ }\r
+ StretchBlt(hdc, logoRect.left, logoRect.top, logoRect.right - logoRect.left, \r
+ logoRect.bottom - logoRect.top, tmphdc, 0, 0, w, h, SRCCOPY);\r
+ SelectObject(tmphdc, hbm);\r
+ DeleteDC(tmphdc);\r
+}\r
+\r
+VOID\r
HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board)\r
{\r
static Board lastReq, lastDrawn;\r
DrawHighlightsOnDC(hdcmem);\r
DrawBoardOnDC(hdcmem, board, tmphdc);\r
\r
+ if(logoHeight) {\r
+ DrawLogoOnDC(hdc, leftLogoRect, flipClock ? &second : &first);\r
+ DrawLogoOnDC(hdc, rightLogoRect, flipClock ? &first : &second);\r
+ }\r
+\r
if( appData.highlightMoveWithArrow ) {\r
DrawArrowHighlight(hdcmem);\r
}\r
gameMode == MachinePlaysWhite) {\r
CallFlagEvent();\r
} else if (gameMode == EditGame) {\r
- AdjustClock(flipClock, -1);\r
+ AdjustClock((logoHeight > 0 ? flipView: flipClock), -1);\r
}\r
} else if (PtInRect((LPRECT) &blackRect, pt)) {\r
if (gameMode == EditPosition) {\r
gameMode == MachinePlaysBlack) {\r
CallFlagEvent();\r
} else if (gameMode == EditGame) {\r
- AdjustClock(!flipClock, -1);\r
+ AdjustClock(!(logoHeight > 0 ? flipView: flipClock), -1);\r
}\r
}\r
if (!appData.highlightLastMove) {\r
DrawPosition(forceFullRepaint || FALSE, NULL);\r
/* [HGM] <popupFix> Popup calls FinishMove now.\r
If promotion to Q is legal, all are legal! */\r
- if(gameInfo.variant == VariantSuper)\r
+ if(gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat)\r
{ ChessSquare p = boards[currentMove][fromY][fromX], q = boards[currentMove][toY][toX];\r
// kludge to temporarily execute move on display, wthout promotng yet\r
promotionChoice = TRUE;\r
else \r
if (moveType == WhitePromotionQueen || moveType == BlackPromotionQueen ) {\r
DrawPosition(forceFullRepaint || FALSE, NULL);\r
- if(gameInfo.variant == VariantSuper)\r
+ if(gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat)\r
{ ChessSquare p = boards[currentMove][fromY][fromX], q = boards[currentMove][toY][toX];\r
// kludge to temporarily execute move on display, wthout promotng yet\r
promotionChoice = TRUE;\r
}\r
break;\r
\r
+ case WM_MOUSEWHEEL: // [DM]\r
+ /* Mouse Wheel is being rolled forward\r
+ * Play moves forward\r
+ */\r
+ if((short)HIWORD(wParam) > 0 && currentMove < forwardMostMove) ForwardEvent();\r
+ /* Mouse Wheel is being rolled backward\r
+ * Play moves backward\r
+ */\r
+ if((short)HIWORD(wParam) < 0 && currentMove > backwardMostMove) BackwardEvent();\r
+ break;\r
+\r
case WM_MBUTTONDOWN:\r
case WM_RBUTTONDOWN:\r
ErrorPopDown();\r
if(y == -2) {\r
/* [HGM] right mouse button in clock area edit-game mode ups clock */\r
if (PtInRect((LPRECT) &whiteRect, pt)) {\r
- if (gameMode == EditGame) AdjustClock(flipClock, 1);\r
+ if (gameMode == EditGame) AdjustClock((logoHeight > 0 ? flipView: flipClock), 1);\r
} else if (PtInRect((LPRECT) &blackRect, pt)) {\r
- if (gameMode == EditGame) AdjustClock(!flipClock, 1);\r
+ if (gameMode == EditGame) AdjustClock(!(logoHeight > 0 ? flipView: flipClock), 1);\r
}\r
}\r
DrawPosition(TRUE, NULL);\r
ToggleShowThinking()\r
{\r
appData.showThinking = !appData.showThinking;\r
- ShowThinkingEvent();
+ ShowThinkingEvent();\r
}\r
\r
VOID\r
FILE *f;\r
UINT number;\r
char fileTitle[MSG_SIZ];\r
+ char buf[MSG_SIZ];\r
static SnapData sd;\r
\r
switch (message) {\r
case WM_MBUTTONUP:\r
case WM_RBUTTONUP:\r
case WM_MOUSEMOVE:\r
+ case WM_MOUSEWHEEL:\r
MouseEvent(hwnd, message, wParam, lParam);\r
break;\r
\r
}\r
else {\r
EngineOutputPopUp();\r
- }
+ }\r
break;\r
\r
/* [AS] User adjudication */\r
\r
case IDM_AnalysisMode:\r
if (!first.analysisSupport) {\r
- char buf[MSG_SIZ];\r
sprintf(buf, "%s does not support analysis", first.tidy);\r
DisplayError(buf, 0);\r
} else {\r
+ /* [DM] icsEngineAnlyze [HGM] Why is this front-end??? */\r
+ if (appData.icsActive) {\r
+ if (gameMode != IcsObserving) {\r
+ sprintf(buf, "You are not observing a game");\r
+ DisplayError(buf, 0);\r
+ /* secure check */\r
+ if (appData.icsEngineAnalyze) {\r
+ if (appData.debugMode) \r
+ fprintf(debugFP, "Found unexpected active ICS engine analyze \n");\r
+ ExitAnalyzeMode();\r
+ ModeHighlight();\r
+ break;\r
+ }\r
+ break;\r
+ } else {\r
+ /* if enable, user want disable icsEngineAnalyze */\r
+ if (appData.icsEngineAnalyze) {\r
+ ExitAnalyzeMode();\r
+ ModeHighlight();\r
+ break;\r
+ }\r
+ appData.icsEngineAnalyze = TRUE;\r
+ if (appData.debugMode) fprintf(debugFP, "ICS engine analyze starting...\n");\r
+ }\r
+ } \r
if (!appData.showThinking) ToggleShowThinking();\r
AnalyzeModeEvent();\r
}\r
AutoPlayGameLoop(); /* call into back end */\r
break;\r
case ANALYSIS_TIMER_ID:\r
- if ((gameMode == AnalyzeMode || gameMode == AnalyzeFile) && \r
- appData.periodicUpdates) {\r
+ if ((gameMode == AnalyzeMode || gameMode == AnalyzeFile\r
+ || appData.icsEngineAnalyze) && appData.periodicUpdates) {\r
AnalysisPeriodicEvent(0);\r
} else {\r
KillTimer(hwnd, analysisTimerEvent);\r
wp.rcNormalPosition.bottom = consoleY + consoleH;\r
SetWindowPlacement(hDlg, &wp);\r
}\r
+#if 0 \r
+ // [HGM] Chessknight's change 2004-07-13\r
+ else { /* Determine Defaults */\r
+ WINDOWPLACEMENT wp;\r
+ consoleX = winWidth + 1;\r
+ consoleY = boardY;\r
+ consoleW = screenWidth - winWidth;\r
+ consoleH = winHeight;\r
+ EnsureOnScreen(&consoleX, &consoleY);\r
+ wp.length = sizeof(WINDOWPLACEMENT);\r
+ wp.flags = 0;\r
+ wp.showCmd = SW_SHOW;\r
+ wp.ptMaxPosition.x = wp.ptMaxPosition.y = 0;\r
+ wp.rcNormalPosition.left = consoleX;\r
+ wp.rcNormalPosition.right = consoleX + consoleW;\r
+ wp.rcNormalPosition.top = consoleY;\r
+ wp.rcNormalPosition.bottom = consoleY + consoleH;\r
+ SetWindowPlacement(hDlg, &wp);\r
+ }\r
+#endif\r
return FALSE;\r
\r
case WM_SETFOCUS:\r
{ IDM_MachineWhite, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_MachineBlack, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_TwoMachines, MF_BYCOMMAND|MF_GRAYED },\r
- { IDM_AnalysisMode, MF_BYCOMMAND|MF_GRAYED },\r
+ { IDM_AnalysisMode, MF_BYCOMMAND|MF_ENABLED },\r
{ IDM_AnalyzeFile, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_TimeControl, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_MoveNow, MF_BYCOMMAND|MF_GRAYED },\r
}\r
\r
prevChecked = nowChecked;\r
+\r
+ /* [DM] icsEngineAnalyze - Do a sceure check too */\r
+ if (appData.icsActive) {\r
+ if (appData.icsEngineAnalyze) {\r
+ (void) CheckMenuItem(GetMenu(hwndMain), IDM_AnalysisMode,\r
+ MF_BYCOMMAND|MF_CHECKED);\r
+ } else {\r
+ (void) CheckMenuItem(GetMenu(hwndMain), IDM_AnalysisMode,\r
+ MF_BYCOMMAND|MF_UNCHECKED);\r
+ }\r
+ }\r
}\r
\r
VOID\r
#ifdef ZIPPY\r
if (appData.zippyPlay) {\r
SetMenuEnables(hmenu, zippyEnables);\r
+ if (!appData.noChessProgram) /* [DM] icsEngineAnalyze */\r
+ (void) EnableMenuItem(GetMenu(hwndMain), IDM_AnalysisMode,\r
+ MF_BYCOMMAND|MF_ENABLED);\r
}\r
#endif\r
}\r
DisplayWhiteClock(long timeRemaining, int highlight)\r
{\r
HDC hdc;\r
- hdc = GetDC(hwndMain);\r
char *flag = whiteFlag && gameMode == TwoMachinesPlay ? "(!)" : "";\r
\r
+ if(appData.noGUI) return;\r
+ hdc = GetDC(hwndMain);\r
if (!IsIconic(hwndMain)) {\r
- DisplayAClock(hdc, timeRemaining, highlight, flipClock ? &blackRect : &whiteRect, "White", flag);\r
+ DisplayAClock(hdc, timeRemaining, highlight, \r
+ (logoHeight > 0 ? flipView: flipClock) ? &blackRect : &whiteRect, "White", flag);\r
}\r
if (highlight && iconCurrent == iconBlack) {\r
iconCurrent = iconWhite;\r
HDC hdc;\r
char *flag = blackFlag && gameMode == TwoMachinesPlay ? "(!)" : "";\r
\r
+ if(appData.noGUI) return;\r
hdc = GetDC(hwndMain);\r
if (!IsIconic(hwndMain)) {\r
- DisplayAClock(hdc, timeRemaining, highlight, flipClock ? &whiteRect : &blackRect, "Black", flag);\r
+ DisplayAClock(hdc, timeRemaining, highlight, \r
+ (logoHeight > 0 ? flipView: flipClock) ? &whiteRect : &blackRect, "Black", flag);\r
}\r
if (highlight && iconCurrent == iconWhite) {\r
iconCurrent = iconBlack;\r
}\r
}\r
\r
+DWORD GetWin32Priority(int nice)\r
+{ // [HGM] nice: translate Unix nice() value to indows priority class. (Code stolen from Polyglot 1.4w11)\r
+/*\r
+REALTIME_PRIORITY_CLASS 0x00000100\r
+HIGH_PRIORITY_CLASS 0x00000080\r
+ABOVE_NORMAL_PRIORITY_CLASS 0x00008000\r
+NORMAL_PRIORITY_CLASS 0x00000020\r
+BELOW_NORMAL_PRIORITY_CLASS 0x00004000\r
+IDLE_PRIORITY_CLASS 0x00000040\r
+*/\r
+ if (nice < -15) return 0x00000080;\r
+ if (nice < 0) return 0x00008000;\r
+ if (nice == 0) return 0x00000020;\r
+ if (nice < 15) return 0x00004000;\r
+ return 0x00000040;\r
+}\r
+\r
/* Start a child process running the given program.\r
The process's standard output can be read from "from", and its\r
standard input can be written to "to".\r
return err;\r
}\r
\r
+ if (appData.niceEngines){ // [HGM] nice: adjust engine proc priority\r
+ if(appData.debugMode) fprintf(debugFP, "nice engine proc to %d\n", appData.niceEngines);\r
+ SetPriorityClass(piProcInfo.hProcess, GetWin32Priority(appData.niceEngines));\r
+ }\r
+\r
/* Close the handles we don't need in the parent */\r
CloseHandle(piProcInfo.hThread);\r
CloseHandle(hChildStdinRd);\r
case WM_COMMAND: /* message: received a command */\r
switch (LOWORD(wParam)) {\r
case IDCANCEL:\r
+ if (appData.icsActive && appData.icsEngineAnalyze) { /* [DM] icsEngineAnalyze */\r
+ ExitAnalyzeMode();\r
+ ModeHighlight();\r
+ return TRUE;\r
+ }\r
EditGameEvent();\r
return TRUE;\r
default:\r