Author: ekohl
Date: Sat Nov 26 18:27:42 2011
New Revision: 54502
URL:
http://svn.reactos.org/svn/reactos?rev=54502&view=rev
Log:
[USETUP]
- Enable translations of the language page. Patch by Stefan Fulea.
- Simplified the clear text code.
- Fixed the german language page.
See issue #6637 for more details.
Modified:
trunk/reactos/base/setup/usetup/interface/consup.c
trunk/reactos/base/setup/usetup/interface/consup.h
trunk/reactos/base/setup/usetup/interface/usetup.c
trunk/reactos/base/setup/usetup/lang/de-DE.h
trunk/reactos/base/setup/usetup/mui.c
trunk/reactos/base/setup/usetup/mui.h
Modified: trunk/reactos/base/setup/usetup/interface/consup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
==============================================================================
--- trunk/reactos/base/setup/usetup/interface/consup.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/interface/consup.c [iso-8859-1] Sat Nov 26 18:27:42
2011
@@ -269,6 +269,25 @@
&Written);
}
+static
+VOID
+CONSOLE_ClearTextXY(IN SHORT x,
+ IN SHORT y,
+ IN SHORT Length)
+{
+ COORD coPos;
+ DWORD Written;
+
+ coPos.X = x;
+ coPos.Y = y;
+
+ FillConsoleOutputCharacterA(StdOutput,
+ ' ',
+ Length,
+ coPos,
+ &Written);
+}
+
VOID
CONSOLE_SetInputTextXY(
IN SHORT x,
@@ -430,6 +449,25 @@
coPos,
&Written);
}
+
+static
+VOID
+CONSOLE_ClearStatusTextX(IN SHORT x,
+ IN SHORT Length)
+{
+ COORD coPos;
+ DWORD Written;
+
+ coPos.X = x;
+ coPos.Y = yScreen - 1;
+
+ FillConsoleOutputCharacterA(StdOutput,
+ ' ',
+ Length,
+ coPos,
+ &Written);
+}
+
VOID
CONSOLE_SetStatusTextAutoFitX(
@@ -670,4 +708,74 @@
}
}
+
+VOID
+CONSOLE_ClearStyledText(IN SHORT x,
+ IN SHORT y,
+ IN INT Flags,
+ IN SHORT Length)
+{
+ COORD coPos;
+
+ coPos.X = x;
+ coPos.Y = y;
+
+ if (Flags & TEXT_TYPE_STATUS)
+ {
+ coPos.X = x;
+ coPos.Y = yScreen - 1;
+ }
+ else /* TEXT_TYPE_REGULAR (Default) */
+ {
+ coPos.X = x;
+ coPos.Y = y;
+ }
+
+ if (Flags & TEXT_ALIGN_CENTER)
+ {
+ coPos.X = (xScreen - Length) /2;
+ }
+ else if(Flags & TEXT_ALIGN_RIGHT)
+ {
+ coPos.X = coPos.X - Length;
+
+ if (Flags & TEXT_PADDING_SMALL)
+ {
+ coPos.X -= 1;
+ }
+ else if (Flags & TEXT_PADDING_MEDIUM)
+ {
+ coPos.X -= 2;
+ }
+ else if (Flags & TEXT_PADDING_BIG)
+ {
+ coPos.X -= 3;
+ }
+ }
+ else /* TEXT_ALIGN_LEFT (Default) */
+ {
+ if (Flags & TEXT_PADDING_SMALL)
+ {
+ coPos.X += 1;
+ }
+ else if (Flags & TEXT_PADDING_MEDIUM)
+ {
+ coPos.X += 2;
+ }
+ else if (Flags & TEXT_PADDING_BIG)
+ {
+ coPos.X += 3;
+ }
+ }
+
+ if (Flags & TEXT_TYPE_STATUS)
+ {
+ CONSOLE_ClearStatusTextX(coPos.X, Length);
+ }
+ else /* TEXT_TYPE_REGULAR (Default) */
+ {
+ CONSOLE_ClearTextXY(coPos.X, coPos.Y, Length);
+ }
+}
+
/* EOF */
Modified: trunk/reactos/base/setup/usetup/interface/consup.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
==============================================================================
--- trunk/reactos/base/setup/usetup/interface/consup.h [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/interface/consup.h [iso-8859-1] Sat Nov 26 18:27:42
2011
@@ -186,4 +186,10 @@
IN INT Flags,
IN LPCSTR Text);
+VOID
+CONSOLE_ClearStyledText(IN SHORT x,
+ IN SHORT y,
+ IN INT Flags,
+ IN SHORT Length);
+
/* EOF */
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 [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/interface/usetup.c [iso-8859-1] Sat Nov 26 18:27:42
2011
@@ -608,6 +608,9 @@
static PAGE_NUMBER
LanguagePage(PINPUT_RECORD Ir)
{
+ PWCHAR NewLanguageId;
+ BOOL RefreshPage = FALSE;
+
/* Initialize the computer settings list */
if (LanguageList == NULL)
{
@@ -637,36 +640,26 @@
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{
-#if 0
- SelectedLanguageId =
(PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
-
- /* Redraw language selection page in native language */
- MUIDisplayPage(LANGUAGE_PAGE);
-#endif
-
ScrollDownGenericList (LanguageList);
+ RefreshPage = TRUE;
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
{
-#if 0
- SelectedLanguageId =
(PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
-
- /* Redraw language selection page in native language */
- MUIDisplayPage(LANGUAGE_PAGE);
-#endif
-
ScrollUpGenericList(LanguageList);
+ RefreshPage = TRUE;
}
if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
{
ScrollPageDownGenericList(LanguageList);
+ RefreshPage = TRUE;
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
{
ScrollPageUpGenericList(LanguageList);
+ RefreshPage = TRUE;
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
@@ -685,7 +678,7 @@
UpdateKBLayout();
}
- // Load the font
+ /* Load the font */
SetConsoleCodePage();
return INTRO_PAGE;
@@ -694,6 +687,28 @@
{
/* a-z */
GenericListKeyPress (LanguageList, Ir->Event.KeyEvent.uChar.AsciiChar);
+ RefreshPage = TRUE;
+ }
+
+ if (RefreshPage)
+ {
+ NewLanguageId =
(PWCHAR)GetListEntryUserData(GetCurrentListEntry(LanguageList));
+
+ if (SelectedLanguageId != NewLanguageId)
+ {
+ /* Clear the language page */
+ MUIClearPage(LANGUAGE_PAGE);
+
+ SelectedLanguageId = NewLanguageId;
+
+ /* Load the font */
+ SetConsoleCodePage();
+
+ /* Redraw language selection page in native language */
+ MUIDisplayPage(LANGUAGE_PAGE);
+ }
+
+ RefreshPage = FALSE;
}
}
Modified: trunk/reactos/base/setup/usetup/lang/de-DE.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/lang/de-…
==============================================================================
--- trunk/reactos/base/setup/usetup/lang/de-DE.h [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/lang/de-DE.h [iso-8859-1] Sat Nov 26 18:27:42 2011
@@ -24,13 +24,13 @@
{
8,
10,
- "\x07 Bitte whlen Sie die Sprache, die Sie whrend des Setups verwenden
wollen.",
+ "\x07 Bitte whlen Sie die Sprache, die Sie whrend des Setups
verwenden",
TEXT_STYLE_NORMAL
},
{
8,
11,
- " Dann drcken Sie ENTER.",
+ "wollen. Dann drcken Sie ENTER.",
TEXT_STYLE_NORMAL
},
{
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 [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/mui.c [iso-8859-1] Sat Nov 26 18:27:42 2011
@@ -40,7 +40,7 @@
static
ULONG
-FindLanguageIndex()
+FindLanguageIndex(VOID)
{
ULONG lngIndex = 0;
@@ -124,7 +124,7 @@
}
VOID
-MUIDisplayPage(IN ULONG page)
+MUIClearPage(IN ULONG page)
{
const MUI_ENTRY * entry;
int index;
@@ -142,11 +142,38 @@
index = 0;
do
{
- CONSOLE_SetStyledText (
- entry[index].X,
- entry[index].Y,
- entry[index].Flags,
- entry[index].Buffer);
+ CONSOLE_ClearStyledText(entry[index].X,
+ entry[index].Y,
+ entry[index].Flags,
+ strlen(entry[index].Buffer));
+ index++;
+ }
+ while (entry[index].Buffer != NULL);
+}
+
+VOID
+MUIDisplayPage(IN ULONG page)
+{
+ const MUI_ENTRY * entry;
+ int index;
+
+ entry = FindMUIEntriesOfPage(page);
+ if (!entry)
+ {
+ PopupError("Error: Failed to find translated page",
+ NULL,
+ NULL,
+ POPUP_WAIT_NONE);
+ return;
+ }
+
+ index = 0;
+ do
+ {
+ CONSOLE_SetStyledText(entry[index].X,
+ entry[index].Y,
+ entry[index].Flags,
+ entry[index].Buffer);
index++;
}
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 [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/mui.h [iso-8859-1] Sat Nov 26 18:27:42 2011
@@ -29,7 +29,7 @@
typedef struct
{
PWCHAR FontName;
- PWCHAR SubFontName;
+ PWCHAR SubFontName;
} MUI_SUBFONT;
typedef struct
@@ -55,6 +55,9 @@
VOID
MUIDisplayPage (ULONG PageNumber);
+
+VOID
+MUIClearPage (ULONG PageNumber);
VOID
MUIDisplayError (ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent);