- 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.

svn path=/trunk/; revision=54502
This commit is contained in:
Eric Kohl 2011-11-26 18:27:42 +00:00
parent b687932799
commit 4b474cce59
6 changed files with 183 additions and 24 deletions

View file

@ -269,6 +269,25 @@ CONSOLE_SetTextXY(
&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,
@ -431,6 +450,25 @@ CONSOLE_SetStatusTextX(
&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(
IN SHORT x,
@ -670,4 +708,74 @@ CONSOLE_SetStyledText(
}
}
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 */

View file

@ -186,4 +186,10 @@ CONSOLE_SetStyledText(
IN INT Flags,
IN LPCSTR Text);
VOID
CONSOLE_ClearStyledText(IN SHORT x,
IN SHORT y,
IN INT Flags,
IN SHORT Length);
/* EOF */

View file

@ -608,6 +608,9 @@ UpdateKBLayout(VOID)
static PAGE_NUMBER
LanguagePage(PINPUT_RECORD Ir)
{
PWCHAR NewLanguageId;
BOOL RefreshPage = FALSE;
/* Initialize the computer settings list */
if (LanguageList == NULL)
{
@ -637,36 +640,26 @@ LanguagePage(PINPUT_RECORD Ir)
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 @@ LanguagePage(PINPUT_RECORD Ir)
UpdateKBLayout();
}
// Load the font
/* Load the font */
SetConsoleCodePage();
return INTRO_PAGE;
@ -694,6 +687,28 @@ LanguagePage(PINPUT_RECORD Ir)
{
/* 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;
}
}

View file

@ -24,13 +24,13 @@ static MUI_ENTRY deDELanguagePageEntries[] =
{
8,
10,
"\x07 Bitte w„hlen Sie die Sprache, die Sie w„hrend des Setups verwenden wollen.",
"\x07 Bitte w„hlen Sie die Sprache, die Sie w„hrend des Setups verwenden",
TEXT_STYLE_NORMAL
},
{
8,
11,
" Dann dr<64>cken Sie ENTER.",
"wollen. Dann dr<64>cken Sie ENTER.",
TEXT_STYLE_NORMAL
},
{

View file

@ -40,7 +40,7 @@ PopupError(IN PCCH Text,
static
ULONG
FindLanguageIndex()
FindLanguageIndex(VOID)
{
ULONG lngIndex = 0;
@ -123,6 +123,34 @@ MUIGetLayoutsList(VOID)
return LanguageList[lngIndex].MuiLayouts;
}
VOID
MUIClearPage(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_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)
{
@ -142,11 +170,10 @@ MUIDisplayPage(IN ULONG page)
index = 0;
do
{
CONSOLE_SetStyledText (
entry[index].X,
entry[index].Y,
entry[index].Flags,
entry[index].Buffer);
CONSOLE_SetStyledText(entry[index].X,
entry[index].Y,
entry[index].Flags,
entry[index].Buffer);
index++;
}

View file

@ -29,7 +29,7 @@ typedef struct
typedef struct
{
PWCHAR FontName;
PWCHAR SubFontName;
PWCHAR SubFontName;
} MUI_SUBFONT;
typedef struct
@ -56,6 +56,9 @@ typedef struct
VOID
MUIDisplayPage (ULONG PageNumber);
VOID
MUIClearPage (ULONG PageNumber);
VOID
MUIDisplayError (ULONG ErrorNum, PINPUT_RECORD Ir, ULONG WaitEvent);