mirror of
https://github.com/reactos/reactos.git
synced 2024-07-04 19:54:58 +00:00
[WELCOME]: Addendum to r73656: The application title is also customizable!
Change also the name of some helper functions. svn path=/trunk/; revision=73658
This commit is contained in:
parent
9ffcd6f25a
commit
ccf03e4ba8
|
@ -197,7 +197,7 @@ VOID TranslateEscapes(IN OUT LPTSTR lpString)
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
LoadTopicsFromINI(LCID Locale, LPTSTR lpResPath)
|
LoadLocalizedResourcesFromINI(LCID Locale, LPTSTR lpResPath)
|
||||||
{
|
{
|
||||||
DWORD dwRet;
|
DWORD dwRet;
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
|
@ -236,6 +236,8 @@ LoadTopicsFromINI(LCID Locale, LPTSTR lpResPath)
|
||||||
return FALSE; // TODO: For localized resource, see the general function.
|
return FALSE; // TODO: For localized resource, see the general function.
|
||||||
|
|
||||||
/* Try to load the default localized strings */
|
/* Try to load the default localized strings */
|
||||||
|
GetPrivateProfileString(TEXT("Defaults"), TEXT("AppTitle"), TEXT("ReactOS Welcome") /* default */,
|
||||||
|
szAppTitle, ARRAYSIZE(szAppTitle), szIniPath);
|
||||||
if (!GetPrivateProfileString(TEXT("Defaults"), TEXT("DefaultTopicTitle"), NULL /* default */,
|
if (!GetPrivateProfileString(TEXT("Defaults"), TEXT("DefaultTopicTitle"), NULL /* default */,
|
||||||
szDefaultTitle, ARRAYSIZE(szDefaultTitle), szIniPath))
|
szDefaultTitle, ARRAYSIZE(szDefaultTitle), szIniPath))
|
||||||
{
|
{
|
||||||
|
@ -325,7 +327,7 @@ LoadTopicsFromINI(LCID Locale, LPTSTR lpResPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
LoadTopics(LPTSTR lpResPath)
|
LoadLocalizedResources(LPTSTR lpResPath)
|
||||||
{
|
{
|
||||||
#define MAX_NUMBER_INTERNAL_TOPICS 3
|
#define MAX_NUMBER_INTERNAL_TOPICS 3
|
||||||
|
|
||||||
|
@ -339,13 +341,15 @@ LoadTopics(LPTSTR lpResPath)
|
||||||
* First, try to load the default internal (localized) strings.
|
* First, try to load the default internal (localized) strings.
|
||||||
* They can be redefined by the localized INI files.
|
* They can be redefined by the localized INI files.
|
||||||
*/
|
*/
|
||||||
|
if (!LoadString(hInstance, IDS_APPTITLE, szAppTitle, ARRAYSIZE(szAppTitle)))
|
||||||
|
StringCchCopy(szAppTitle, ARRAYSIZE(szAppTitle), TEXT("ReactOS Welcome"));
|
||||||
if (!LoadString(hInstance, IDS_DEFAULTTOPICTITLE, szDefaultTitle, ARRAYSIZE(szDefaultTitle)))
|
if (!LoadString(hInstance, IDS_DEFAULTTOPICTITLE, szDefaultTitle, ARRAYSIZE(szDefaultTitle)))
|
||||||
*szDefaultTitle = 0;
|
*szDefaultTitle = 0;
|
||||||
if (!LoadString(hInstance, IDS_DEFAULTTOPICDESC, szDefaultDesc, ARRAYSIZE(szDefaultDesc)))
|
if (!LoadString(hInstance, IDS_DEFAULTTOPICDESC, szDefaultDesc, ARRAYSIZE(szDefaultDesc)))
|
||||||
*szDefaultDesc = 0;
|
*szDefaultDesc = 0;
|
||||||
|
|
||||||
/* Try to load the topics from INI file */
|
/* Try to load the resources from INI file */
|
||||||
if (*lpResPath && LoadTopicsFromINI(LOCALE_USER_DEFAULT, lpResPath))
|
if (*lpResPath && LoadLocalizedResourcesFromINI(LOCALE_USER_DEFAULT, lpResPath))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* We failed, fall back to internal (localized) resource */
|
/* We failed, fall back to internal (localized) resource */
|
||||||
|
@ -381,7 +385,7 @@ LoadTopics(LPTSTR lpResPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
FreeTopics(VOID)
|
FreeResources(VOID)
|
||||||
{
|
{
|
||||||
if (!pTopics)
|
if (!pTopics)
|
||||||
return;
|
return;
|
||||||
|
@ -421,8 +425,8 @@ LoadConfiguration(VOID)
|
||||||
/* Verify that the file exists, otherwise use the default configuration */
|
/* Verify that the file exists, otherwise use the default configuration */
|
||||||
if (GetFileAttributes(szIniPath) == INVALID_FILE_ATTRIBUTES)
|
if (GetFileAttributes(szIniPath) == INVALID_FILE_ATTRIBUTES)
|
||||||
{
|
{
|
||||||
/* Use the default configuration and retrieve the default topics */
|
/* Use the default configuration and retrieve the default resources */
|
||||||
return LoadTopics(TEXT(""));
|
return LoadLocalizedResources(TEXT(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load the settings from the INI configuration file */
|
/* Load the settings from the INI configuration file */
|
||||||
|
@ -435,9 +439,9 @@ LoadConfiguration(VOID)
|
||||||
*szResPath = 0;
|
*szResPath = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the current directory to the one of this application, and retrieve the topics */
|
/* Set the current directory to the one of this application, and retrieve the resources */
|
||||||
SetCurrentDirectory(szAppPath);
|
SetCurrentDirectory(szAppPath);
|
||||||
return LoadTopics(szResPath);
|
return LoadLocalizedResources(szResPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -556,10 +560,7 @@ _tWinMain(HINSTANCE hInst,
|
||||||
rcRightPanel.left = rcLeftPanel.right;
|
rcRightPanel.left = rcLeftPanel.right;
|
||||||
rcRightPanel.right = ulInnerWidth - 1;
|
rcRightPanel.right = ulInnerWidth - 1;
|
||||||
|
|
||||||
if (!LoadString(hInstance, IDS_APPTITLE, szAppTitle, ARRAYSIZE(szAppTitle)))
|
/* Load the configuration and the resources */
|
||||||
StringCchCopy(szAppTitle, ARRAYSIZE(szAppTitle), TEXT("ReactOS Welcome"));
|
|
||||||
|
|
||||||
/* Load the configuration and the topics */
|
|
||||||
LoadConfiguration();
|
LoadConfiguration();
|
||||||
|
|
||||||
/* Create main window */
|
/* Create main window */
|
||||||
|
@ -592,7 +593,7 @@ _tWinMain(HINSTANCE hInst,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
FreeTopics();
|
FreeResources();
|
||||||
|
|
||||||
return msg.wParam;
|
return msg.wParam;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue