Author: mpiulachs
Date: Sun Dec 23 23:29:52 2007
New Revision: 31418
URL:
http://svn.reactos.org/svn/reactos?rev=31418&view=rev
Log:
- Reorder the pages , the non graphical START_PAGE should be allways the first page to be
loaded because it initializes txtsetup.sif
- Apply the selected language to the installed OS
- Get the list of languages from txtsetup.sif, it will allow us to not include explicitly
excluded languages
- Various formatting fixes
- Add a default language setting to txtsetup.sif
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
trunk/reactos/base/setup/usetup/usetup.h
trunk/reactos/boot/bootdata/txtsetup.sif
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 Sun Dec 23 23:29:52 2007
@@ -545,13 +545,14 @@
static PAGE_NUMBER
LanguagePage(PINPUT_RECORD Ir)
{
+ /* Initialize the computer settings list */
if (LanguageList == NULL)
{
- LanguageList = MUICreateLanguageList();
+ LanguageList = CreateLanguageList(SetupInf);
if (LanguageList == NULL)
{
PopupError("Setup failed to initialize available translations",
NULL, NULL, POPUP_WAIT_NONE);
- return START_PAGE;
+ return INTRO_PAGE;
}
}
@@ -585,11 +586,12 @@
}
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
- MUISelectLanguage((ULONG)LanguageList->CurrentEntry->UserData);
- return START_PAGE;
- }
- }
- return START_PAGE;
+ MUISelectLanguage((PWCHAR)LanguageList->CurrentEntry->UserData);
+ return INTRO_PAGE;
+ }
+ }
+
+ return INTRO_PAGE;
}
@@ -695,7 +697,20 @@
CheckUnattendedSetup();
- return INTRO_PAGE;
+ if (IsUnattendedSetup)
+ {
+ //TODO
+ //read options from inf
+ ComputerList = CreateComputerTypeList(SetupInf);
+ DisplayList = CreateDisplayDriverList(SetupInf);
+ KeyboardList = CreateKeyboardDriverList(SetupInf);
+ LayoutList = CreateKeyboardLayoutList(SetupInf);
+ LanguageList = CreateLanguageList(SetupInf);
+
+ return INSTALL_INTRO_PAGE;
+ }
+
+ return LANGUAGE_PAGE;
}
@@ -708,17 +723,6 @@
IntroPage(PINPUT_RECORD Ir)
{
MUIDisplayPage(START_PAGE);
-
- if (IsUnattendedSetup)
- {
- //TODO
- //read options from inf
- ComputerList = CreateComputerTypeList(SetupInf);
- DisplayList = CreateDisplayDriverList(SetupInf);
- KeyboardList = CreateKeyboardDriverList(SetupInf);
- LayoutList = CreateKeyboardLayoutList(SetupInf);
- return INSTALL_INTRO_PAGE;
- }
while (TRUE)
{
@@ -3044,7 +3048,7 @@
/* Update keyboard layout settings */
CONSOLE_SetStatusText(" Updating keyboard layout settings...");
- if (!ProcessKeyboardLayoutRegistry(LayoutList))
+ if (!ProcessKeyboardLayoutRegistry(LanguageList))
{
MUIDisplayError(ERROR_UPDATE_KBSETTINGS, Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE;
@@ -3411,26 +3415,23 @@
/* Hide the cursor */
CONSOLE_SetCursorType(TRUE, FALSE);
- Page = LANGUAGE_PAGE;
+ Page = START_PAGE;
while (Page != REBOOT_PAGE)
{
CONSOLE_ClearScreen();
-
CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR "
Setup ");
-
CONSOLE_Flush();
switch (Page)
{
+ /* Start page */
+ case START_PAGE:
+ Page = SetupStartPage(&Ir);
+ break;
/* Language page */
case LANGUAGE_PAGE:
Page = LanguagePage(&Ir);
break;
- /* Start page */
- case START_PAGE:
- Page = SetupStartPage(&Ir);
- break;
-
/* License page */
case LICENSE_PAGE:
Page = LicensePage(&Ir);
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 Sun Dec 23 23:29:52 2007
@@ -1,3 +1,29 @@
+/*
+ * ReactOS kernel
+ * Copyright (C) 2008 ReactOS Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS text-mode setup
+ * FILE: subsys/system/usetup/mui.c
+ * PURPOSE: Text-mode setup
+ * PROGRAMMER:
+ */
+
#include "usetup.h"
#include "errorcode.h"
#include "mui.h"
@@ -12,51 +38,71 @@
#include "lang/sv-SE.h"
#include "lang/uk-UA.h"
+/* The current selected language , by default en-us for now */
+static PWCHAR SelectedLanguageId = L"00000409";
+
static MUI_LANGUAGE LanguageList[] =
{
{
- "English",
- enUSPages
- },
- {
- "French",
+ L"00000409", /* The Language ID */
+ L"00000409", /* Default Keyboard Layout for this language */
+ L"English", /* Language Name , not used just to make things easier
when updating this file */
+ enUSPages /* Translated strings */
+ },
+ {
+ L"0000040C",
+ L"0000040C",
+ L"French",
frFRPages
},
{
- "German",
+ L"00000407",
+ L"00000407",
+ L"German",
deDEPages
},
{
- "Greek",
+ L"00000408",
+ L"00000408",
+ L"Greek",
elGRPages
},
{
- "Italian",
+ L"00000410",
+ L"00000410",
+ L"Italian",
itITPages
},
{
- "Russian",
+ L"00000419",
+ L"00000419",
+ L"Russian",
ruRUPages
},
{
- "Spanish",
+ L"0000040A",
+ L"0000040A",
+ L"Spanish",
esESPages
},
{
- "Swedish",
+ L"0000041D",
+ L"0000041D",
+ L"Swedish",
svSEPages
},
{
- "Ukrainian",
+ L"00000422",
+ L"00000422",
+ L"Ukrainian",
ukUAPages
},
{
+ NULL,
NULL,
NULL
}
};
-
-static ULONG SelectedLanguage = 0;
extern
VOID
@@ -65,62 +111,58 @@
PINPUT_RECORD Ir,
ULONG WaitEvent);
-
-PGENERIC_LIST
-MUICreateLanguageList()
-{
- PGENERIC_LIST List;
- ULONG Index;
-
- List = CreateGenericList();
- if (List == NULL)
- {
- return NULL;
- }
-
- Index = 0;
-
- do
- {
- AppendGenericListEntry(List, LanguageList[Index].LanguageDescriptor,
(PVOID)Index, (Index == 0 ? TRUE : FALSE));
- Index++;
- }while(LanguageList[Index].MuiPages &&
LanguageList[Index].LanguageDescriptor);
-
- return List;
-}
-
BOOLEAN
-MUISelectLanguage(ULONG LanguageIndex)
-{
- SelectedLanguage = LanguageIndex;
+MUISelectLanguage(PWCHAR LanguageID)
+{
+ if (LanguageID == NULL)
+ return FALSE;
+
+ SelectedLanguageId = LanguageID;
return TRUE;
}
-
static
MUI_ENTRY *
-findMUIEntriesOfPage(ULONG PageNumber, MUI_PAGE * Pages)
-{
- ULONG Index = 0;
+FindMUIEntriesOfPage (ULONG PageNumber)
+{
+ ULONG muiIndex = 0;
+ ULONG lngIndex = 0;
+ MUI_PAGE * Pages = NULL;
+
do
{
- if (Pages[Index].Number == PageNumber)
+ /* First we search the language list till we find current selected language
messages */
+ if (_wcsicmp(LanguageList[lngIndex].LanguageID , SelectedLanguageId) == 0)
{
- return Pages[Index].MuiEntry;
+ /* Get all available pages for this language */
+ Pages = LanguageList[lngIndex].MuiPages;
+
+ do
+ {
+ /* Get page messages */
+ if (Pages[muiIndex].Number == PageNumber)
+ return Pages[muiIndex].MuiEntry;
+
+ muiIndex++;
+ }
+ while (Pages[muiIndex].MuiEntry != NULL);
}
- Index++;
- }while(Pages[Index].MuiEntry != NULL);
+
+ lngIndex++;
+ }
+ while (LanguageList[lngIndex].MuiPages != NULL);
+
return NULL;
}
VOID
-MUIDisplayPage(ULONG pg)
+MUIDisplayPage(ULONG page)
{
MUI_ENTRY * entry;
int index;
int flags;
- entry = findMUIEntriesOfPage(pg, LanguageList[SelectedLanguage].MuiPages);
+ entry = FindMUIEntriesOfPage (page);
if (!entry)
{
PopupError("Error: Failed to find translated page",
@@ -152,7 +194,8 @@
break;
}
index++;
- }while(entry[index].Buffer != NULL);
+ }
+ while (entry[index].Buffer != NULL);
}
VOID
@@ -173,3 +216,5 @@
Ir,
WaitEvent);
}
+
+/* EOF */
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 Sun Dec 23 23:29:52 2007
@@ -17,23 +17,28 @@
typedef struct
{
- CHAR * LanguageDescriptor;
+ PWCHAR LanguageID;
+ PWCHAR LanguageKeyboardLayoutID;
+ PWCHAR LanguageDescriptor;
MUI_PAGE * MuiPages;
}MUI_LANGUAGE;
-#define TEXT_NORMAL 0
-#define TEXT_HIGHLIGHT 1
-#define TEXT_UNDERLINE 2
-#define TEXT_STATUS 4
+#define TEXT_NORMAL 0
+#define TEXT_HIGHLIGHT 1
+#define TEXT_UNDERLINE 2
+#define TEXT_STATUS 4
+
+#define TEXT_ALIGN_DEFAULT 5
+#define TEXT_ALIGN_RIGHT 6
+#define TEXT_ALIGN_LEFT 7
+#define TEXT_ALIGN_CENTER 8
VOID
MUIDisplayPage(ULONG PageNumber);
-PGENERIC_LIST
-MUICreateLanguageList();
-
BOOLEAN
-MUISelectLanguage(ULONG LanguageIndex);
+//MUISelectLanguage(ULONG LanguageIndex);
+MUISelectLanguage(PWCHAR LanguageID);
#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 Sun Dec 23 23:29:52 2007
@@ -655,6 +655,65 @@
return List;
}
+PGENERIC_LIST
+CreateLanguageList(HINF InfFile)
+{
+ CHAR Buffer[128];
+ PGENERIC_LIST List;
+ INFCONTEXT Context;
+ PWCHAR KeyName;
+ PWCHAR KeyValue;
+ PWCHAR UserData;
+ WCHAR DefaultLanguage[20];
+
+ /* Get default language id */
+ if (!SetupFindFirstLineW (InfFile, L"NLS", L"DefaultLanguage",
&Context))
+ return NULL;
+
+ if (!INF_GetData (&Context, NULL, &KeyValue))
+ return NULL;
+
+ wcscpy(DefaultLanguage, KeyValue);
+
+ List = CreateGenericList();
+ if (List == NULL)
+ return NULL;
+
+ if (!SetupFindFirstLineW (InfFile, L"Language", NULL, &Context))
+ {
+ DestroyGenericList(List, FALSE);
+ return NULL;
+ }
+
+ do
+ {
+ if (!INF_GetData (&Context, &KeyName, &KeyValue))
+ {
+ /* FIXME: Handle error! */
+ DPRINT("INF_GetData() failed\n");
+ break;
+ }
+
+ UserData = (WCHAR*) RtlAllocateHeap(ProcessHeap,
+ 0,
+ (wcslen(KeyName) + 1) * sizeof(WCHAR));
+ if (UserData == NULL)
+ {
+ /* FIXME: Handle error! */
+ }
+
+ wcscpy(UserData, KeyName);
+
+ sprintf(Buffer, "%S", KeyValue);
+ AppendGenericListEntry(List,
+ Buffer,
+ UserData,
+ _wcsicmp(KeyName, DefaultLanguage) ? FALSE : TRUE);
+ }
+ while (SetupFindNextLine(&Context, &Context));
+
+ return List;
+}
PGENERIC_LIST
CreateKeyboardLayoutList(HINF InfFile)
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 Sun Dec 23 23:29:52 2007
@@ -48,6 +48,9 @@
PGENERIC_LIST
CreateKeyboardLayoutList(HINF InfFile);
+PGENERIC_LIST
+CreateLanguageList(HINF InfFile);
+
BOOLEAN
ProcessKeyboardLayoutRegistry(PGENERIC_LIST List);
Modified: trunk/reactos/base/setup/usetup/usetup.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/usetup.h…
==============================================================================
--- trunk/reactos/base/setup/usetup/usetup.h (original)
+++ trunk/reactos/base/setup/usetup/usetup.h Sun Dec 23 23:29:52 2007
@@ -82,8 +82,8 @@
typedef enum _PAGE_NUMBER
{
- LANGUAGE_PAGE = 0,
START_PAGE,
+ LANGUAGE_PAGE,
INTRO_PAGE,
LICENSE_PAGE,
INSTALL_INTRO_PAGE,
Modified: trunk/reactos/boot/bootdata/txtsetup.sif
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/txtsetup.sif…
==============================================================================
--- trunk/reactos/boot/bootdata/txtsetup.sif (original)
+++ trunk/reactos/boot/bootdata/txtsetup.sif Sun Dec 23 23:29:52 2007
@@ -58,6 +58,7 @@
OemCodepage = c_437.nls
UnicodeCasetable = l_intl.nls
DefaultLayout = 00000409
+DefaultLanguage = 00000409
[Computer]
pci_up = "Standard-PC"
@@ -89,10 +90,6 @@
vbe_1024x768x16 = "VESA Display (1024x768x16)",,VBE,1024,768,16
vbe_1024x768x32 = "VESA Display (1024x768x32)",,VBE,1024,768,32
-
-
-
-
[Map.Display]
;<id> = <pnp id string>
vga = "VGA Display"
@@ -100,6 +97,28 @@
[Keyboard]
Default = "XT-, AT- or extended keyboard (83-105 keys)"
+
+[Language]
+;00000403 = "Catalan"
+;00000406 = "Danish"
+;00000813 = "Dutch"
+00000409 = "English"
+;0000040B = "Finnish"
+0000040C = "French"
+00000407 = "German"
+;00000408 = "Greek"
+;0000040D = "Hebrew"
+;0000040E = "Hungarian"
+00000410 = "Italian"
+;00000411 = "Japanese"
+;00000414 = "Norwegian"
+;00000415 = "Polish"
+;00000816 = "Portuguese"
+;00000419 = "Russian"
+;0000041B = "Slovak"
+0000040A = "Spanish"
+00000422 = "Ukrainian"
+
[KeyboardLayout]
00040402 = "Bulgarian BDS 5237-1978"