void\r
SetUserLogo()\r
{ // update user logo if necessary\r
- static char oldUserName[MSG_SIZ], *curName;\r
+ static char oldUserName[MSG_SIZ], dir[MSG_SIZ], *curName;\r
\r
if(appData.autoLogo) {\r
curName = UserName();\r
if(strcmp(curName, oldUserName)) {\r
- snprintf(oldUserName, MSG_SIZ, "logos\\%s.bmp", curName);\r
+ GetCurrentDirectory(MSG_SIZ, dir);\r
+ SetCurrentDirectory(installDir);\r
+ snprintf(oldUserName, MSG_SIZ, "logos\\%s.bmp", curName);\r
userLogo = LoadImage( 0, oldUserName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); \r
safeStrCpy(oldUserName, curName, sizeof(oldUserName)/sizeof(oldUserName[0]) );\r
if(userLogo == NULL)\r
userLogo = LoadImage( 0, "logos\\dummy.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); \r
+ SetCurrentDirectory(dir); /* return to prev directory */\r
}\r
}\r
}\r
}\r
\r
VOID\r
-LoadLogo(ChessProgramState *cps, int n)\r
+LoadLogo(ChessProgramState *cps, int n, Boolean ics)\r
{\r
+ char buf[MSG_SIZ], dir[MSG_SIZ];\r
+ GetCurrentDirectory(MSG_SIZ, dir);\r
+ SetCurrentDirectory(installDir);\r
if( appData.logo[n] && appData.logo[n][0] != NULLCHAR) {\r
cps->programLogo = LoadImage( 0, appData.logo[n], IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );\r
\r
fprintf( debugFP, "Unable to load logo bitmap '%s'\n", appData.logo[n] );\r
}\r
} else if(appData.autoLogo) {\r
- if(appData.firstDirectory && appData.directory[n][0]) {\r
- char buf[MSG_SIZ];\r
- snprintf(buf, MSG_SIZ, "%s/logo.bmp", appData.directory[n]);\r
- cps->programLogo = LoadImage( 0, buf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); \r
+ if(ics) { // [HGM] logo: in ICS mode second can be used for ICS\r
+ sprintf(buf, "logos\\%s.bmp", appData.icsHost);\r
+ cps->programLogo = LoadImage( 0, buf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );\r
+ } else\r
+ if(appData.directory[n] && appData.directory[n][0]) {\r
+ SetCurrentDirectory(appData.directory[n]);\r
+ cps->programLogo = LoadImage( 0, "logo.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); \r
}\r
}\r
+ SetCurrentDirectory(dir); /* return to prev directory */\r
}\r
\r
BOOL\r
}\r
\r
/* [HGM] logo: Load logos if specified (must be done before InitDrawingSizes) */\r
- LoadLogo(&first, 0);\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
- char buf[MSG_SIZ];\r
- if(appData.icsActive) { // [HGM] logo: in ICS mode second can be used for ICS\r
- snprintf(buf, MSG_SIZ, "logos\\%s.bmp", appData.icsHost);\r
- second.programLogo = LoadImage( 0, buf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );\r
- } else\r
- if(appData.secondDirectory && appData.secondDirectory[0]) {\r
- snprintf(buf, MSG_SIZ, "%s\\logo.bmp", appData.secondDirectory);\r
- second.programLogo = LoadImage( 0, buf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); \r
- }\r
- }\r
+ LoadLogo(&first, 0, FALSE);\r
+ LoadLogo(&second, 1, appData.icsActive);\r
\r
SetUserLogo();\r
\r
q = strchr(p, ':');\r
if (q) {\r
if (q - p >= sizeof(mfp->faceName))\r
- ExitArgError(_("Font name too long:"), name);\r
+ ExitArgError(_("Font name too long:"), name, TRUE);\r
memcpy(mfp->faceName, p, q - p);\r
mfp->faceName[q - p] = NULLCHAR;\r
p = q + 1;\r
while (*p && !isdigit(*p)) {\r
*q++ = *p++;\r
if (q - mfp->faceName >= sizeof(mfp->faceName))\r
- ExitArgError(_("Font name too long:"), name);\r
+ ExitArgError(_("Font name too long:"), name, TRUE);\r
}\r
while (q > mfp->faceName && q[-1] == ' ') q--;\r
*q = NULLCHAR;\r
}\r
- if (!*p) ExitArgError(_("Font point size missing:"), name);\r
+ if (!*p) ExitArgError(_("Font point size missing:"), name, TRUE);\r
mfp->pointSize = (float) atof(p);\r
mfp->bold = (strchr(p, 'b') != NULL);\r
mfp->italic = (strchr(p, 'i') != NULL);\r
}\r
bs++;\r
}\r
- ExitArgError(_("Unrecognized board size value"), name);\r
+ ExitArgError(_("Unrecognized board size value"), name, TRUE);\r
}\r
\r
void\r
VOID\r
DrawCoordsOnDC(HDC hdc)\r
{\r
- static char files[24] = {'0', '1','2','3','4','5','6','7','8','9','0','1','1','0','9','8','7','6','5','4','3','2','1','0'};\r
- static char ranks[24] = {'l', 'k','j','i','h','g','f','e','d','c','b','a','a','b','c','d','e','f','g','h','i','j','k','l'};\r
+ static char files[] = "0123456789012345678901221098765432109876543210";\r
+ static char ranks[] = "wvutsrqponmlkjihgfedcbaabcdefghijklmnopqrstuvw";\r
char str[2] = { NULLCHAR, NULLCHAR };\r
int oldMode, oldAlign, x, y, start, i;\r
HFONT oldFont;\r
if (!appData.showCoords)\r
return;\r
\r
- start = flipView ? 1-(ONE!='1') : 23+(ONE!='1')-BOARD_HEIGHT;\r
+ start = flipView ? 1-(ONE!='1') : 45+(ONE!='1')-BOARD_HEIGHT;\r
\r
oldBrush = SelectObject(hdc, GetStockObject(BLACK_BRUSH));\r
oldMode = SetBkMode(hdc, (appData.monoMode ? OPAQUE : TRANSPARENT));\r
y += squareSize + lineGap;\r
}\r
\r
- start = flipView ? 12-(BOARD_RGHT-BOARD_LEFT) : 12;\r
+ start = flipView ? 23-(BOARD_RGHT-BOARD_LEFT) : 23;\r
\r
SetTextAlign(hdc, TA_RIGHT|TA_BOTTOM);\r
for (i = 0; i < BOARD_RGHT - BOARD_LEFT; i++) {\r
HBITMAP hbm;\r
int w = 100, h = 50;\r
\r
- if(logo == NULL) return;\r
+ if(logo == NULL) {\r
+ if(!logoHeight) return;\r
+ FillRect( hdc, &logoRect, whitePieceBrush );\r
+ }\r
// GetClientRect(hwndMain, &Rect);\r
// bufferBitmap = CreateCompatibleBitmap(hdc, Rect.right-Rect.left+1,\r
// Rect.bottom-Rect.top+1);\r
}\r
}\r
\r
+void\r
+UpdateLogos(int display)\r
+{ // called after loading new engine(s), in tourney or from menu\r
+ LoadLogo(&first, 0, FALSE);\r
+ LoadLogo(&second, 1, appData.icsActive);\r
+ InitDrawingSizes(-2, 0); // adapt layout of board window to presence/absence of logos\r
+ if(display) DisplayLogos();\r
+}\r
+\r
static HDC hdcSeek;\r
\r
// [HGM] seekgraph\r
}\r
}\r
\r
-void DragPieceBegin(int x, int y)\r
+void DragPieceBegin(int x, int y, Boolean instantly)\r
{\r
dragInfo.lastpos.x = boardRect.left + x;\r
dragInfo.lastpos.y = boardRect.top + y;\r
+ if(instantly) dragInfo.pos = dragInfo.lastpos;\r
dragInfo.from.x = fromX;\r
dragInfo.from.y = fromY;\r
dragInfo.piece = boards[currentMove][fromY][fromX];\r
break;\r
\r
case IDM_EditProgs2:\r
- EditTagsPopUp(secondChessProgramNames, &secondChessProgramNames);\r
+ LoadEnginePopUp(hwndMain);\r
+// EditTagsPopUp(secondChessProgramNames, &secondChessProgramNames);\r
break;\r
\r
case IDM_EditServers:\r
EditTagsProc();\r
break;\r
\r
+ case IDM_EditBook:\r
+ EditBookEvent();\r
+ break;\r
+\r
case IDM_EditComment:\r
case IDM_Comment:\r
if (commentUp && editComment) {\r
UciOptionsPopup(hwnd);\r
break;\r
\r
+ case IDM_Tourney:\r
+ TourneyPopup(hwnd);\r
+ break;\r
+\r
case IDM_IcsOptions:\r
IcsOptionsPopup(hwnd);\r
break;\r
struct stat st;\r
FILE *f;\r
\r
- if (ms->data) free(ms->data);\r
+ if (ms->data && ms->flag) free(ms->data);\r
ms->data = NULL;\r
\r
switch (ms->name[0]) {\r
HANDLE h = FindResource(hInst, ms->name + 1, "WAVE");\r
if (h == NULL) break;\r
ms->data = (void *)LoadResource(hInst, h);\r
+ ms->flag = 0; // not maloced, so cannot be freed!\r
if (h == NULL) break;\r
ok = TRUE;\r
}\r
if (f == NULL) break;\r
if (fstat(fileno(f), &st) < 0) break;\r
ms->data = malloc(st.st_size);\r
+ ms->flag = 1;\r
if (fread(ms->data, st.st_size, 1, f) < 1) break;\r
fclose(f);\r
ok = TRUE;\r
appData.firstChessProgram, "fd", appData.firstDirectory,\r
firstChessProgramNames);\r
InitEngineBox(hDlg, GetDlgItem(hDlg, OPT_SecondChessEngineName),\r
- appData.secondChessProgram, "sd", appData.secondDirectory,\r
- secondChessProgramNames);\r
+ appData.secondChessProgram, singleList ? "fd" : "sd", appData.secondDirectory,\r
+ singleList ? firstChessProgramNames : secondChessProgramNames); //[HGM] single: use first list in second combo\r
hwndCombo = GetDlgItem(hDlg, OPT_ChessServerName);\r
InitComboStringsFromOption(hwndCombo, icsNames); \r
snprintf(buf, MSG_SIZ, "%s /icsport=%s", appData.icsHost, appData.icsPort);\r
GetDlgItemText(hDlg, OPT_ChessEngineName, buf + strlen(buf), sizeof(buf) - strlen(buf));\r
p = buf;\r
ParseArgs(StringGet, &p);\r
- safeStrCpy(buf, "/scp=", sizeof(buf)/sizeof(buf[0]) );\r
+ safeStrCpy(buf, singleList ? "/fcp=" : "/scp=", sizeof(buf)/sizeof(buf[0]) );\r
GetDlgItemText(hDlg, OPT_SecondChessEngineName, buf + strlen(buf), sizeof(buf) - strlen(buf));\r
- p = buf;\r
+ p = buf;
+ SwapEngines(singleList); // temporarily swap first and second, to load a second 'first', ...\r
ParseArgs(StringGet, &p);\r
+ SwapEngines(singleList); // ... and then make it 'second'\r
appData.noChessProgram = FALSE;\r
appData.icsActive = FALSE;\r
} else if (IsDlgButtonChecked(hDlg, OPT_ChessServer)) {\r
{ IDM_Revert, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_Annotate, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_NewChat, MF_BYCOMMAND|MF_GRAYED },\r
+\r
+ // Needed to switch from ncp to GNU mode on Engine Load\r
+ { ACTION_POS, MF_BYPOSITION|MF_ENABLED },\r
+ { IDM_MachineWhite, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_MachineBlack, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_TwoMachines, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_Match, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_AnalysisMode, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_AnalyzeFile, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_Engine1Options, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_Engine2Options, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_TimeControl, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_RetractMove, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_MoveNow, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_Hint, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_Book, MF_BYCOMMAND|MF_ENABLED },\r
{ -1, -1 }\r
};\r
\r
{ IDM_MoveNow, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_Hint, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_Book, MF_BYCOMMAND|MF_GRAYED },\r
+ { IDM_EditProgs2, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_IcsOptions, MF_BYCOMMAND|MF_ENABLED },\r
{ IDM_Engine1Options, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_Engine2Options, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_Annotate, MF_BYCOMMAND|MF_GRAYED },\r
+ { IDM_Tourney, MF_BYCOMMAND|MF_GRAYED },\r
{ -1, -1 }\r
};\r
\r
MyPlaySound(&sounds[(int)SoundAlarm]);\r
}\r
\r
+VOID\r
+PlayTellSound()\r
+{\r
+ MyPlaySound(&textAttribs[ColorTell].sound);\r
+}\r
+\r
\r
VOID\r
EchoOn()\r
* dir relative to the directory WinBoard loaded from. */\r
GetCurrentDirectory(MSG_SIZ, buf);\r
SetCurrentDirectory(installDir);\r
- // kludgey way to update logos in tourney, as long as back-end can't do it\r
- if(!strcmp(cmdLine, first.program)) LoadLogo(&first, 0); else\r
- if(!strcmp(cmdLine, second.program)) LoadLogo(&second, 1);\r
SetCurrentDirectory(dir);\r
\r
/* Now create the child process. */\r
MoveHistorySet( movelist, first, last, current, pvInfoList );\r
\r
EvalGraphSet( first, last, current, pvInfoList );\r
+\r
+ MakeEngineOutputTitle();\r
}\r
\r
void\r