static int doingSizing = FALSE;\r
static int lastSizing = 0;\r
static int prevStderrPort;\r
+static HBITMAP userLogo;\r
\r
/* [AS] Support for background textures */\r
#define BACK_TEXTURE_MODE_DISABLED 0\r
*\r
\*---------------------------------------------------------------------------*/\r
\r
+void\r
+SetUserLogo()\r
+{ // update user logo if necessary\r
+ static char oldUserName[MSG_SIZ], *curName;\r
+\r
+ if(appData.autoLogo) {\r
+ curName = UserName();\r
+ if(strcmp(curName, oldUserName)) {\r
+ sprintf(oldUserName, "logos\\%s.bmp", curName);\r
+ userLogo = LoadImage( 0, oldUserName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); \r
+ strcpy(oldUserName, curName);\r
+ }\r
+ }\r
+}\r
+\r
BOOL\r
InitApplication(HINSTANCE hInstance)\r
{\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
+ sprintf(buf, "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
- 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
+ SetUserLogo();\r
+\r
iconWhite = LoadIcon(hInstance, "icon_white");\r
iconBlack = LoadIcon(hInstance, "icon_black");\r
iconCurrent = iconWhite;\r
#define MAX_CLIPS 200 /* more than enough */\r
\r
VOID\r
-DrawLogoOnDC(HDC hdc, RECT logoRect, ChessProgramState *cps)\r
+DrawLogoOnDC(HDC hdc, RECT logoRect, HBITMAP logo)\r
{\r
// HBITMAP bufferBitmap;\r
BITMAP bi;\r
HBITMAP hbm;\r
int w = 100, h = 50;\r
\r
- if(cps->programLogo == NULL) return;\r
+ if(logo == 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
+ hbm = SelectObject(tmphdc, logo);\r
+ if( GetObject( logo, sizeof(bi), &bi ) > 0 ) {\r
w = bi.bmWidth;\r
h = bi.bmHeight;\r
}\r
DrawBoardOnDC(hdcmem, board, tmphdc);\r
}\r
if(logoHeight) {\r
- DrawLogoOnDC(hdc, leftLogoRect, flipClock ? &second : &first);\r
- DrawLogoOnDC(hdc, rightLogoRect, flipClock ? &first : &second);\r
+ HBITMAP whiteLogo = (HBITMAP) first.programLogo, blackLogo = (HBITMAP) second.programLogo;\r
+ if(appData.autoLogo) {\r
+ \r
+ switch(gameMode) { // pick logos based on game mode\r
+ case IcsObserving:\r
+ whiteLogo = second.programLogo; // ICS logo\r
+ blackLogo = second.programLogo;\r
+ default:\r
+ break;\r
+ case IcsPlayingWhite:\r
+ if(!appData.zippyPlay) whiteLogo = userLogo;\r
+ blackLogo = second.programLogo; // ICS logo\r
+ break;\r
+ case IcsPlayingBlack:\r
+ whiteLogo = second.programLogo; // ICS logo\r
+ blackLogo = appData.zippyPlay ? first.programLogo : userLogo;\r
+ break;\r
+ case TwoMachinesPlay:\r
+ if(first.twoMachinesColor[0] == 'b') {\r
+ whiteLogo = second.programLogo;\r
+ blackLogo = first.programLogo;\r
+ }\r
+ break;\r
+ case MachinePlaysWhite:\r
+ blackLogo = userLogo;\r
+ break;\r
+ case MachinePlaysBlack:\r
+ whiteLogo = userLogo;\r
+ blackLogo = first.programLogo;\r
+ }\r
+ }\r
+ DrawLogoOnDC(hdc, leftLogoRect, flipClock ? blackLogo : whiteLogo);\r
+ DrawLogoOnDC(hdc, rightLogoRect, flipClock ? whiteLogo : blackLogo);\r
}\r
\r
if( appData.highlightMoveWithArrow ) {\r
case IDOK:\r
GetDlgItemText(hDlg, OPT_Name, move, sizeof(move));\r
appData.userName = strdup(move);\r
+ SetUserLogo();\r
\r
EndDialog(hDlg, TRUE);\r
return TRUE;\r