mirror of
https://github.com/reactos/reactos.git
synced 2025-05-06 18:31:26 +00:00
[USETUP] Implement resource ID text based strings for MUI (#2193)
CORE-12683 Supersedes PR #612. * [USETUP] Implement the internal MUI routines for text manipulation based on its ID and implement text resource based IDs USETUP (the 1st stage text mode setup module) bases upon MUI (Multilingual User Interface) sub-component of USETUP which is responsible for the ability into translating the MUI pages (each page having corresponding properties like X, Y coordinates, text flags and text string buffer) in various languages. The only problem, as of now, is that whenever you want to modify a certain property of a page, such as removing a text from the said page in the screen, you've got to rely on using CONSOLE_* specific functions and calling with hardcoded parameters, namely the coordinates. This can become a problem as not every localized (translated) MUI page has the same properties for each language and this could lead to various issues. Therefore, assigning each entry with an ID you can remove a text by only giving its ID (and the entry page number) without having the need to specify the coordinates as the internal MUI routine, MUIGetEntry(), automatically retrieves the entry with respective data fields. The following commit implements: - MUIGetEntry() - MUIClearText() - MUIClearStyledText() - MUISetText() - MUISetStyledText() - Now the X and Y coordinate members of MUI_ENTRY are of SHORT integer type, for the sake of the general code as most of the coordination values, even the COORD structure itself, has the coordination points as SHORTs and not BYTEs. The following MUI functions will be used to manipulate text based resources depending on their ID from the corresponding MUI entry. * [USETUP] Make CONSOLE_ClearTextXY function public so that we can use across other files. * [USETUP] Implement the IDs for each text MUI entry in locale files. This mechanism follows the same principle of resource IDs in Win32 applications. Static text is merely a resource that doesn't get changed programmatically for whole of its lifetime whereas dynamic resources can change during the lifetime of the program depending on the algorithm (for example, hide that piece of text and set another one, etc.). * [USETUP] Remove the "Press ENTER to continue" message prompt when the partition formatting begins.
This commit is contained in:
parent
8dfd2338f1
commit
2bf4180c80
32 changed files with 11579 additions and 5668 deletions
|
@ -321,7 +321,6 @@ CONSOLE_SetTextXY(
|
|||
&Written);
|
||||
}
|
||||
|
||||
static
|
||||
VOID
|
||||
CONSOLE_ClearTextXY(IN SHORT x,
|
||||
IN SHORT y,
|
||||
|
|
|
@ -200,6 +200,12 @@ CONSOLE_SetTextXY(
|
|||
IN SHORT y,
|
||||
IN LPCSTR Text);
|
||||
|
||||
VOID
|
||||
CONSOLE_ClearTextXY(
|
||||
IN SHORT x,
|
||||
IN SHORT y,
|
||||
IN SHORT Length);
|
||||
|
||||
VOID
|
||||
CONSOLE_SetUnderlinedTextXY(
|
||||
IN SHORT x,
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -256,6 +256,202 @@ MUIGetString(
|
|||
return "<nostring>";
|
||||
}
|
||||
|
||||
/**
|
||||
* @MUIGetEntry
|
||||
*
|
||||
* Retrieves a MUI entry of a page, given the page number and the text ID.
|
||||
*
|
||||
* @param[in] Page
|
||||
* The MUI (Multilingual User Interface) entry page number, as a unsigned long integer.
|
||||
*
|
||||
* @param[in] TextID
|
||||
* The text identification number (ID), as a unsigned integer. The parameter is used to identify
|
||||
* its MUI properties like the coordinates, text style flag and its buffer content.
|
||||
*
|
||||
* @return
|
||||
* Returns a constant MUI entry.
|
||||
*
|
||||
*/
|
||||
const MUI_ENTRY *
|
||||
MUIGetEntry(
|
||||
IN ULONG Page,
|
||||
IN INT TextID)
|
||||
{
|
||||
const MUI_ENTRY * entry;
|
||||
ULONG index;
|
||||
|
||||
/* Retrieve the entries of a MUI page */
|
||||
entry = FindMUIEntriesOfPage(Page);
|
||||
if (!entry)
|
||||
{
|
||||
DPRINT("MUIGetEntryData(): Failed to get the translated entry page!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Loop over the ID entries and check if it matches with one of them */
|
||||
for (index = 0; entry[index].Buffer != NULL; index++)
|
||||
{
|
||||
if (entry[index].TextID == TextID)
|
||||
{
|
||||
/* They match so return the MUI entry */
|
||||
return &entry[index];
|
||||
}
|
||||
}
|
||||
|
||||
/* Page number or ID are incorrect so in this case bail out */
|
||||
DPRINT("Couldn't get the MUI entry field from the page!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @MUIClearText
|
||||
*
|
||||
* Clears a portion of text from the console output.
|
||||
*
|
||||
* @param[in] Page
|
||||
* The MUI (Multilingual User Interface) entry page number, as a unsigned long integer.
|
||||
*
|
||||
* @param[in] TextID
|
||||
* The text identification number (ID), as an integer. The parameter is used to identify
|
||||
* its MUI properties like the coordinates, text style flag and its buffer content.
|
||||
*
|
||||
* @return
|
||||
* Nothing.
|
||||
*
|
||||
*/
|
||||
VOID
|
||||
MUIClearText(
|
||||
IN ULONG Page,
|
||||
IN INT TextID)
|
||||
{
|
||||
const MUI_ENTRY * entry;
|
||||
|
||||
/* Get the MUI entry */
|
||||
entry = MUIGetEntry(Page, TextID);
|
||||
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
/* Remove the text by using CONSOLE_ClearTextXY() */
|
||||
CONSOLE_ClearTextXY(
|
||||
entry->X,
|
||||
entry->Y,
|
||||
(ULONG)strlen(entry->Buffer));
|
||||
}
|
||||
|
||||
/**
|
||||
* @MUIClearStyledText
|
||||
*
|
||||
* Clears a portion of text from the console output, given the actual state style flag of the text.
|
||||
*
|
||||
* @param[in] Page
|
||||
* The MUI (Multilingual User Interface) entry page number, as a unsigned long integer.
|
||||
*
|
||||
* @param[in] TextID
|
||||
* The text identification number (ID), as an integer. The parameter is used to identify
|
||||
* its MUI properties like the coordinates, text style flag and its buffer content.
|
||||
*
|
||||
* @param[in] Flags
|
||||
* The text style flag, as an integer. The flag determines the style of the text, such
|
||||
* as being highlighted, underlined, high padding and so on.
|
||||
*
|
||||
* @return
|
||||
* Nothing.
|
||||
*
|
||||
*/
|
||||
VOID
|
||||
MUIClearStyledText(
|
||||
IN ULONG Page,
|
||||
IN INT TextID,
|
||||
IN INT Flags)
|
||||
{
|
||||
const MUI_ENTRY * entry;
|
||||
|
||||
/* Get the MUI entry */
|
||||
entry = MUIGetEntry(Page, TextID);
|
||||
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
/* Now, begin removing the text by calling CONSOLE_ClearStyledText() */
|
||||
CONSOLE_ClearStyledText(
|
||||
entry->X,
|
||||
entry->Y,
|
||||
Flags,
|
||||
(ULONG)strlen(entry->Buffer));
|
||||
}
|
||||
|
||||
/**
|
||||
* @MUISetText
|
||||
*
|
||||
* Prints a text to the console output.
|
||||
*
|
||||
* @param[in] Page
|
||||
* The MUI (Multilingual User Interface) entry page number, as a unsigned long integer.
|
||||
*
|
||||
* @param[in] TextID
|
||||
* The text identification number (ID), as an integer. The parameter is used to identify
|
||||
* its MUI properties like the coordinates, text style flag and its buffer content.
|
||||
*
|
||||
* @return
|
||||
* Nothing.
|
||||
*
|
||||
*/
|
||||
VOID
|
||||
MUISetText(
|
||||
IN ULONG Page,
|
||||
IN INT TextID)
|
||||
{
|
||||
const MUI_ENTRY * entry;
|
||||
|
||||
/* Get the MUI entry */
|
||||
entry = MUIGetEntry(Page, TextID);
|
||||
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
/* Print the text to the console output by calling CONSOLE_SetTextXY() */
|
||||
CONSOLE_SetTextXY(entry->X, entry->Y, entry->Buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @MUISetStyledText
|
||||
*
|
||||
* Prints a text to the console output, with a style for it.
|
||||
*
|
||||
* @param[in] Page
|
||||
* The MUI (Multilingual User Interface) entry page number, as a unsigned long integer.
|
||||
*
|
||||
* @param[in] TextID
|
||||
* The text identification number (ID), as an integer. The parameter is used to identify
|
||||
* its MUI properties like the coordinates, text style flag and its buffer content.
|
||||
*
|
||||
* @param[in] Flags
|
||||
* The text style flag, as an integer. The flag determines the style of the text, such
|
||||
* as being highlighted, underlined, high padding and so on.
|
||||
*
|
||||
* @return
|
||||
* Nothing.
|
||||
*
|
||||
*/
|
||||
VOID
|
||||
MUISetStyledText(
|
||||
IN ULONG Page,
|
||||
IN INT TextID,
|
||||
IN INT Flags)
|
||||
{
|
||||
const MUI_ENTRY * entry;
|
||||
|
||||
/* Get the MUI entry */
|
||||
entry = MUIGetEntry(Page, TextID);
|
||||
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
/* Print the text to the console output by calling CONSOLE_SetStyledText() */
|
||||
CONSOLE_SetStyledText(entry->X, entry->Y, Flags, entry->Buffer);
|
||||
}
|
||||
|
||||
VOID
|
||||
SetConsoleCodePage(VOID)
|
||||
{
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
BYTE X;
|
||||
BYTE Y;
|
||||
SHORT X;
|
||||
SHORT Y;
|
||||
LPCSTR Buffer;
|
||||
DWORD Flags;
|
||||
INT TextID;
|
||||
} MUI_ENTRY, *PMUI_ENTRY;
|
||||
|
||||
typedef struct
|
||||
|
@ -71,6 +72,42 @@ LPSTR
|
|||
MUIGetString(
|
||||
ULONG Number);
|
||||
|
||||
const MUI_ENTRY *
|
||||
MUIGetEntry(
|
||||
IN ULONG Page,
|
||||
IN INT TextID);
|
||||
|
||||
VOID
|
||||
MUIClearText(
|
||||
IN ULONG Page,
|
||||
IN INT TextID);
|
||||
|
||||
VOID
|
||||
MUIClearStyledText(
|
||||
IN ULONG Page,
|
||||
IN INT TextID,
|
||||
IN INT Flags);
|
||||
|
||||
VOID
|
||||
MUISetText(
|
||||
IN ULONG Page,
|
||||
IN INT TextID);
|
||||
|
||||
VOID
|
||||
MUISetStyledText(
|
||||
IN ULONG Page,
|
||||
IN INT TextID,
|
||||
IN INT Flags);
|
||||
|
||||
/* MUI Text IDs */
|
||||
|
||||
/* Static MUI Text */
|
||||
#define TEXT_ID_STATIC (-1)
|
||||
|
||||
/* Dynamic MUI Text IDs */
|
||||
#define TEXT_ID_FORMAT_PROMPT 1
|
||||
|
||||
/* MUI Strings */
|
||||
#define STRING_PLEASEWAIT 1
|
||||
#define STRING_INSTALLCREATEPARTITION 2
|
||||
#define STRING_INSTALLCREATELOGICAL 60
|
||||
|
|
|
@ -3388,6 +3388,11 @@ FormatPartitionPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN || IsUnattendedSetup) /* ENTER */
|
||||
{
|
||||
/*
|
||||
* Remove the "Press ENTER to continue" message prompt when the ENTER
|
||||
* key is pressed as the user wants to begin the partition formatting.
|
||||
*/
|
||||
MUIClearStyledText(FORMAT_PARTITION_PAGE, TEXT_ID_FORMAT_PROMPT, TEXT_TYPE_REGULAR);
|
||||
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
||||
|
||||
if (!PreparePartitionForFormatting(PartEntry, SelectedFileSystem->FileSystem))
|
||||
|
|
Loading…
Reference in a new issue