Author: janderwald
Date: Mon Jan 7 02:36:01 2008
New Revision: 31636
URL:
http://svn.reactos.org/svn/reactos?rev=31636&view=rev
Log:
- alter keyboard layout when a non default language is chosen
- fix typo
Modified:
trunk/reactos/base/setup/usetup/interface/usetup.c
trunk/reactos/base/setup/usetup/mui.c
trunk/reactos/base/setup/usetup/mui.h
trunk/reactos/base/setup/usetup/settings.c
trunk/reactos/base/setup/usetup/settings.h
Modified: trunk/reactos/base/setup/usetup/interface/usetup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
==============================================================================
--- trunk/reactos/base/setup/usetup/interface/usetup.c (original)
+++ trunk/reactos/base/setup/usetup/interface/usetup.c Mon Jan 7 02:36:01 2008
@@ -45,6 +45,8 @@
LONG AutoPartition = 0;
WCHAR UnattendInstallationDirectory[MAX_PATH];
PWCHAR SelectedLanguageId;
+WCHAR DefaultLanguage[20];
+WCHAR DefaultKBLayout[20];
BOOLEAN RepairUpdateFlag = FALSE;
HANDLE hPnpThread = INVALID_HANDLE_VALUE;
@@ -543,13 +545,39 @@
DPRINT("Running unattended setup\n");
}
+void
+UpdateKBLayout()
+{
+ PLIST_ENTRY Entry;
+ PGENERIC_LIST_ENTRY ListEntry;
+ WCHAR szNewLayout[20];
+
+ MUIDefaultKeyboardLayout(szNewLayout);
+
+ if (LayoutList == NULL)
+ {
+ LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout);
+ }
+ Entry = LayoutList->ListHead.Flink;
+ while (Entry != &LayoutList->ListHead)
+ {
+ ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
+ if (!wcscmp(szNewLayout, ListEntry->UserData))
+ {
+ LayoutList->CurrentEntry = ListEntry;
+ break;
+ }
+ Entry = Entry->Flink;
+ }
+}
+
static PAGE_NUMBER
LanguagePage(PINPUT_RECORD Ir)
{
/* Initialize the computer settings list */
if (LanguageList == NULL)
{
- LanguageList = CreateLanguageList(SetupInf);
+ LanguageList = CreateLanguageList(SetupInf, DefaultLanguage);
if (LanguageList == NULL)
{
PopupError("Setup failed to initialize available translations",
NULL, NULL, POPUP_WAIT_NONE);
@@ -572,7 +600,7 @@
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{
-#if 0 //Dinamically update user interface
+#if 0 //Dynamically update user interface
SelectedLanguageId = (PWCHAR)LanguageList->CurrentEntry->UserData;
MUIDisplayPage(LANGUAGE_PAGE);
#endif
@@ -596,6 +624,10 @@
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
SelectedLanguageId = (PWCHAR)LanguageList->CurrentEntry->UserData;
+ if (wcscmp(SelectedLanguageId, DefaultLanguage))
+ {
+ UpdateKBLayout();
+ }
return INTRO_PAGE;
}
}
@@ -713,8 +745,8 @@
ComputerList = CreateComputerTypeList(SetupInf);
DisplayList = CreateDisplayDriverList(SetupInf);
KeyboardList = CreateKeyboardDriverList(SetupInf);
- LayoutList = CreateKeyboardLayoutList(SetupInf);
- LanguageList = CreateLanguageList(SetupInf);
+ LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout);
+ LanguageList = CreateLanguageList(SetupInf, DefaultLanguage);
return INSTALL_INTRO_PAGE;
}
@@ -937,7 +969,7 @@
/* Initialize the keyboard layout list */
if (LayoutList == NULL)
{
- LayoutList = CreateKeyboardLayoutList(SetupInf);
+ LayoutList = CreateKeyboardLayoutList(SetupInf, DefaultKBLayout);
if (LayoutList == NULL)
{
/* FIXME: report error */
Modified: trunk/reactos/base/setup/usetup/mui.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/mui.c?re…
==============================================================================
--- trunk/reactos/base/setup/usetup/mui.c (original)
+++ trunk/reactos/base/setup/usetup/mui.c Mon Jan 7 02:36:01 2008
@@ -182,6 +182,27 @@
}
VOID
+MUIDefaultKeyboardLayout(WCHAR * KeyboardLayout)
+{
+ ULONG lngIndex = 0;
+ do
+ {
+ /* First we search the language list till we find current selected language
messages */
+ if (_wcsicmp(LanguageList[lngIndex].LanguageID , SelectedLanguageId) == 0)
+ {
+ /* Get all available error messages for this language */
+ wcscpy(KeyboardLayout, LanguageList[lngIndex].LanguageKeyboardLayoutID);
+ return;
+ }
+
+ lngIndex++;
+ }
+ while (LanguageList[lngIndex].MuiPages != NULL);
+
+ KeyboardLayout[0] = L'\0';
+}
+
+VOID
MUIDisplayPage(ULONG page)
{
MUI_ENTRY * entry;
Modified: trunk/reactos/base/setup/usetup/mui.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/mui.h?re…
==============================================================================
--- trunk/reactos/base/setup/usetup/mui.h (original)
+++ trunk/reactos/base/setup/usetup/mui.h Mon Jan 7 02:36:01 2008
@@ -47,4 +47,8 @@
VOID
MUIDisplayError (ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent);
+VOID
+MUIDefaultKeyboardLayout(WCHAR * KeyboardLayout);
+
+
#endif
Modified: trunk/reactos/base/setup/usetup/settings.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/settings…
==============================================================================
--- trunk/reactos/base/setup/usetup/settings.c (original)
+++ trunk/reactos/base/setup/usetup/settings.c Mon Jan 7 02:36:01 2008
@@ -656,7 +656,7 @@
}
PGENERIC_LIST
-CreateLanguageList(HINF InfFile)
+CreateLanguageList(HINF InfFile, WCHAR * DefaultLanguage)
{
CHAR Buffer[128];
PGENERIC_LIST List;
@@ -664,7 +664,6 @@
PWCHAR KeyName;
PWCHAR KeyValue;
PWCHAR UserData;
- WCHAR DefaultLanguage[20];
/* Get default language id */
if (!SetupFindFirstLineW (InfFile, L"NLS", L"DefaultLanguage",
&Context))
@@ -718,7 +717,7 @@
}
PGENERIC_LIST
-CreateKeyboardLayoutList(HINF InfFile)
+CreateKeyboardLayoutList(HINF InfFile, WCHAR * DefaultKBLayout)
{
CHAR Buffer[128];
PGENERIC_LIST List;
@@ -726,7 +725,6 @@
PWCHAR KeyName;
PWCHAR KeyValue;
PWCHAR UserData;
- WCHAR DefaultLayout[20];
/* Get default layout id */
if (!SetupFindFirstLineW (InfFile, L"NLS", L"DefaultLayout",
&Context))
@@ -735,7 +733,7 @@
if (!INF_GetData (&Context, NULL, &KeyValue))
return NULL;
- wcscpy(DefaultLayout, KeyValue);
+ wcscpy(DefaultKBLayout, KeyValue);
List = CreateGenericList();
if (List == NULL)
@@ -753,6 +751,7 @@
{
/* FIXME: Handle error! */
DPRINT("INF_GetData() failed\n");
+ DestroyGenericList(List, FALSE);
break;
}
@@ -770,7 +769,7 @@
AppendGenericListEntry(List,
Buffer,
UserData,
- _wcsicmp(KeyName, DefaultLayout) ? FALSE : TRUE);
+ _wcsicmp(KeyName, DefaultKBLayout) ? FALSE : TRUE);
}
while (SetupFindNextLine(&Context, &Context));
Modified: trunk/reactos/base/setup/usetup/settings.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/settings…
==============================================================================
--- trunk/reactos/base/setup/usetup/settings.h (original)
+++ trunk/reactos/base/setup/usetup/settings.h Mon Jan 7 02:36:01 2008
@@ -46,10 +46,10 @@
CreateKeyboardDriverList(HINF InfFile);
PGENERIC_LIST
-CreateKeyboardLayoutList(HINF InfFile);
+CreateKeyboardLayoutList(HINF InfFile, WCHAR *DefaultKBLayout);
PGENERIC_LIST
-CreateLanguageList(HINF InfFile);
+CreateLanguageList(HINF InfFile, WCHAR * DefaultLanguage);
BOOLEAN
ProcessKeyboardLayoutRegistry(PGENERIC_LIST List);