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
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
* 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