mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-15 08:47:56 +01:00
App name and game name don't fit most titlebars, so use app name only
when game has none yet.
This commit is contained in:
parent
3ab61e4264
commit
6453f49e67
1 changed files with 12 additions and 26 deletions
|
@ -765,45 +765,31 @@ cePositionBoard( CEAppGlobals* globals )
|
||||||
return erase;
|
return erase;
|
||||||
} /* cePositionBoard */
|
} /* cePositionBoard */
|
||||||
|
|
||||||
/* Set the title to be app-name COLON file-name. If there's no colon there
|
/* Set the title. If there's a game name, replace the window title with that
|
||||||
* now append colon and game name. Else if there is a color replace what
|
* in case both won't fit. If there's no name yet, install the app name as
|
||||||
* follows it with the new name.
|
* title.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
ceSetTitleFromName( CEAppGlobals* globals )
|
ceSetTitleFromName( CEAppGlobals* globals )
|
||||||
{
|
{
|
||||||
wchar_t widebuf[256];
|
wchar_t widebuf[64];
|
||||||
wchar_t* colonPos;
|
|
||||||
XP_UCHAR* baseStart;
|
|
||||||
const XP_UCHAR* gameName = globals->curGameName;
|
const XP_UCHAR* gameName = globals->curGameName;
|
||||||
|
|
||||||
XP_U16 len = (XP_U16)SendMessage( globals->hWnd, WM_GETTEXT,
|
|
||||||
sizeof(widebuf), (long)widebuf );
|
|
||||||
colonPos = wcsstr( widebuf, L":" );
|
|
||||||
|
|
||||||
/* if default name, remove any current name */
|
/* if default name, remove any current name */
|
||||||
if ( !gameName || isDefaultName( globals, gameName ) ) {
|
if ( !gameName || isDefaultName( globals, gameName ) ) {
|
||||||
if ( NULL != colonPos ) {
|
LoadString( globals->hInst, IDS_APP_TITLE, widebuf, VSIZE(widebuf) );
|
||||||
*colonPos = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ( colonPos == NULL ) {
|
wchar_t* dotPos;
|
||||||
wcscat( widebuf, L":" );
|
XP_UCHAR* baseStart = 1 + strrchr( gameName, '\\' );
|
||||||
colonPos = widebuf + len; /* we'll write at the end */
|
XP_U16 len = (XP_U16)XP_STRLEN( baseStart );
|
||||||
}
|
|
||||||
++colonPos; /* skip the colon */
|
|
||||||
|
|
||||||
baseStart = strrchr( gameName, '\\' );
|
|
||||||
++baseStart;
|
|
||||||
len = (XP_U16)XP_STRLEN( baseStart );
|
|
||||||
|
|
||||||
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, baseStart, len + 1,
|
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, baseStart, len + 1,
|
||||||
colonPos, len + 1 );
|
widebuf, len + 1 );
|
||||||
|
|
||||||
/* now get rid of the ".xwg" */
|
/* now get rid of the ".xwg" */
|
||||||
colonPos = wcsrchr( widebuf, '.' );
|
dotPos = wcsrchr( widebuf, '.' );
|
||||||
if ( colonPos != NULL ) {
|
if ( dotPos != NULL ) {
|
||||||
*colonPos = 0;
|
*dotPos = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue