diff --git a/boot/freeldr/freeldr/include/ui.h b/boot/freeldr/freeldr/include/ui.h index 8ee46293eed..4308b95c0f4 100644 --- a/boot/freeldr/freeldr/include/ui.h +++ b/boot/freeldr/freeldr/include/ui.h @@ -94,8 +94,24 @@ VOID UiUpdateDateTime(VOID); // Updates th VOID UiInfoBox(PCSTR MessageText); // Displays a info box on the screen VOID UiMessageBox(PCSTR Format, ...); // Displays a message box on the screen with an ok button VOID UiMessageBoxCritical(PCSTR MessageText); // Displays a message box on the screen with an ok button using no system resources -VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled -VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled + +/* Draws the progress bar showing nPos percent filled */ +VOID +UiDrawProgressBarCenter( + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText); + +/* Draws the progress bar showing nPos percent filled */ +VOID +UiDrawProgressBar( + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG Right, + _In_ ULONG Bottom, + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText); // Displays all the message boxes in a given section. VOID diff --git a/boot/freeldr/freeldr/include/ui/minitui.h b/boot/freeldr/freeldr/include/ui/minitui.h index 1a64c5569ba..eba12bc1ec6 100644 --- a/boot/freeldr/freeldr/include/ui/minitui.h +++ b/boot/freeldr/freeldr/include/ui/minitui.h @@ -16,8 +16,24 @@ VOID MiniTuiDrawBackdrop(VOID); VOID MiniTuiDrawStatusText(PCSTR StatusText); -VOID MiniTuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText); -VOID MiniTuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText); + +/* Draws the progress bar showing nPos percent filled */ +VOID +MiniTuiDrawProgressBarCenter( + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText); + +/* Draws the progress bar showing nPos percent filled */ +VOID +MiniTuiDrawProgressBar( + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG Right, + _In_ ULONG Bottom, + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText); /////////////////////////////////////////////////////////////////////////////////////// // diff --git a/boot/freeldr/freeldr/include/ui/noui.h b/boot/freeldr/freeldr/include/ui/noui.h index 99b8bfa4ec5..1bd560ad25d 100644 --- a/boot/freeldr/freeldr/include/ui/noui.h +++ b/boot/freeldr/freeldr/include/ui/noui.h @@ -53,8 +53,25 @@ VOID NoUiDrawStatusText(PCSTR StatusText); VOID NoUiUpdateDateTime(VOID); VOID NoUiMessageBox(PCSTR MessageText); VOID NoUiMessageBoxCritical(PCSTR MessageText); -VOID NoUiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText); -VOID NoUiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText); + +/* Draws the progress bar showing nPos percent filled */ +VOID +NoUiDrawProgressBarCenter( + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText); + +/* Draws the progress bar showing nPos percent filled */ +VOID +NoUiDrawProgressBar( + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG Right, + _In_ ULONG Bottom, + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText); + BOOLEAN NoUiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length); UCHAR NoUiTextToColor(PCSTR ColorText); UCHAR NoUiTextToFillStyle(PCSTR FillStyleText); diff --git a/boot/freeldr/freeldr/include/ui/tui.h b/boot/freeldr/freeldr/include/ui/tui.h index 729db425572..a486ef5cdec 100644 --- a/boot/freeldr/freeldr/include/ui/tui.h +++ b/boot/freeldr/freeldr/include/ui/tui.h @@ -75,8 +75,25 @@ VOID TuiSaveScreen(PUCHAR Buffer); // Saves the sc VOID TuiRestoreScreen(PUCHAR Buffer); // Restores the screen from a previous save VOID TuiMessageBox(PCSTR MessageText); // Displays a message box on the screen with an ok button VOID TuiMessageBoxCritical(PCSTR MessageText); // Displays a message box on the screen with an ok button using no system resources -VOID TuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled -VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText); // Draws the progress bar showing nPos percent filled + +/* Draws the progress bar showing nPos percent filled */ +VOID +TuiDrawProgressBarCenter( + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText); + +/* Draws the progress bar showing nPos percent filled */ +VOID +TuiDrawProgressBar( + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG Right, + _In_ ULONG Bottom, + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText); + BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length); UCHAR TuiTextToColor(PCSTR ColorText); // Converts the text color into it's equivalent color value UCHAR TuiTextToFillStyle(PCSTR FillStyleText); // Converts the text fill into it's equivalent fill value diff --git a/boot/freeldr/freeldr/ui/directui.c b/boot/freeldr/freeldr/ui/directui.c index 8a132842041..cd4b07dcf94 100644 --- a/boot/freeldr/freeldr/ui/directui.c +++ b/boot/freeldr/freeldr/ui/directui.c @@ -109,51 +109,25 @@ UiMessageBoxCritical(IN PCSTR MessageText) } VOID -UiDrawProgressBarCenter(IN ULONG Position, - IN ULONG Range, - IN PCHAR ProgressText) +UiDrawProgressBarCenter( + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText) { - ULONG Left, Top, Right, Bottom, Width, Height; - - /* Build the coordinates and sizes */ - Height = 2; - Width = UiScreenWidth; - Left = 0; - Right = (Left + Width) - 1; - Top = UiScreenHeight - Height - 4; - Bottom = Top + Height + 1; - - /* Draw the progress bar */ - UiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText); + MiniTuiDrawProgressBarCenter(Position, Range, ProgressText); } VOID -UiDrawProgressBar(IN ULONG Left, - IN ULONG Top, - IN ULONG Right, - IN ULONG Bottom, - IN ULONG Position, - IN ULONG Range, - IN PCHAR ProgressText) +UiDrawProgressBar( + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG Right, + _In_ ULONG Bottom, + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText) { - ULONG i, ProgressBarWidth; - - /* Calculate the width of the bar proper */ - ProgressBarWidth = (Right - Left) - 3; - - /* First make sure the progress bar text fits */ - UiTruncateStringEllipsis(ProgressText, ProgressBarWidth - 4); - if (Position > Range) Position = Range; - - /* Draw the "Loading..." text */ - UiDrawCenteredText(Left + 2, Top + 1, Right - 2, Top + 1, ProgressText, ATTR(7, 0)); - - /* Draw the percent complete */ - for (i = 0; i < (Position * ProgressBarWidth) / Range; i++) - { - /* Use the fill character */ - UiDrawText(Left + 2 + i, Top + 2, "\xDB", ATTR(UiTextColor, UiMenuBgColor)); - } + MiniTuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText); } VOID diff --git a/boot/freeldr/freeldr/ui/minitui.c b/boot/freeldr/freeldr/ui/minitui.c index 8a164602cba..cc967f9b753 100644 --- a/boot/freeldr/freeldr/ui/minitui.c +++ b/boot/freeldr/freeldr/ui/minitui.c @@ -7,9 +7,10 @@ * Hervé Poussineau */ -#ifndef _M_ARM #include +#ifndef _M_ARM + VOID MiniTuiDrawBackdrop(VOID) { /* Fill in a black background */ @@ -24,7 +25,13 @@ VOID MiniTuiDrawStatusText(PCSTR StatusText) /* Minimal UI doesn't have a status bar */ } -VOID MiniTuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText) +#endif // _M_ARM + +VOID +MiniTuiDrawProgressBarCenter( + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText) { ULONG Left, Top, Right, Bottom, Width, Height; @@ -40,18 +47,30 @@ VOID MiniTuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressTex MiniTuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText); } -VOID MiniTuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText) +VOID +MiniTuiDrawProgressBar( + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG Right, + _In_ ULONG Bottom, + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText) { - ULONG i; - ULONG ProgressBarWidth = (Right - Left) - 3; + ULONG ProgressBarWidth, i; + + /* Calculate the width of the bar proper */ + ProgressBarWidth = (Right - Left) - 3; /* First make sure the progress bar text fits */ UiTruncateStringEllipsis(ProgressText, ProgressBarWidth - 4); + + /* Clip the position */ if (Position > Range) Position = Range; /* Draw the "Loading..." text */ - TuiDrawCenteredText(Left + 2, Top + 1, Right - 2, Top + 1, ProgressText, ATTR(COLOR_GRAY, COLOR_BLACK)); + TuiDrawCenteredText(Left + 2, Top + 1, Right - 2, Top + 1, ProgressText, ATTR(UiTextColor, UiMenuBgColor)); /* Draw the percent complete */ for (i = 0; i < (Position * ProgressBarWidth) / Range; i++) @@ -60,10 +79,14 @@ VOID MiniTuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UL TuiDrawText(Left + 2 + i, Top + 2, "\xDB", ATTR(UiTextColor, UiMenuBgColor)); } +#ifndef _M_ARM TuiUpdateDateTime(); VideoCopyOffScreenBufferToVRAM(); +#endif } +#ifndef _M_ARM + VOID MiniTuiDrawMenu(PUI_MENU_INFO MenuInfo) { diff --git a/boot/freeldr/freeldr/ui/noui.c b/boot/freeldr/freeldr/ui/noui.c index 1cbb42d40e9..e0e1b4b97e4 100644 --- a/boot/freeldr/freeldr/ui/noui.c +++ b/boot/freeldr/freeldr/ui/noui.c @@ -100,11 +100,23 @@ VOID NoUiMessageBoxCritical(PCSTR MessageText) MachConsGetCh(); } -VOID NoUiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText) +VOID +NoUiDrawProgressBarCenter( + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText) { } -VOID NoUiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText) +VOID +NoUiDrawProgressBar( + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG Right, + _In_ ULONG Bottom, + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText) { } diff --git a/boot/freeldr/freeldr/ui/tui.c b/boot/freeldr/freeldr/ui/tui.c index 310c872172d..9da79931b94 100644 --- a/boot/freeldr/freeldr/ui/tui.c +++ b/boot/freeldr/freeldr/ui/tui.c @@ -683,29 +683,46 @@ VOID TuiMessageBoxCritical(PCSTR MessageText) } } -VOID TuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText) +VOID +TuiDrawProgressBarCenter( + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText) { ULONG Left, Top, Right, Bottom; ULONG Width = 50; // Allow for 50 "bars" ULONG Height = 2; + /* Build the coordinates and sizes */ Left = (UiScreenWidth - Width - 4) / 2; Right = Left + Width + 3; Top = (UiScreenHeight - Height - 2) / 2; Top += 2; Bottom = Top + Height + 1; + /* Draw the progress bar */ TuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText); } -VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText) +VOID +TuiDrawProgressBar( + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG Right, + _In_ ULONG Bottom, + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText) { - ULONG i; - ULONG ProgressBarWidth = (Right - Left) - 3; + ULONG ProgressBarWidth, i; + + /* Calculate the width of the bar proper */ + ProgressBarWidth = (Right - Left) - 3; /* First make sure the progress bar text fits */ UiTruncateStringEllipsis(ProgressText, ProgressBarWidth - 4); + /* Clip the position */ if (Position > Range) Position = Range; @@ -728,8 +745,10 @@ VOID TuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG TuiDrawText(Left + 2 + i, Top + 2, "\xB2", ATTR(UiTextColor, UiMenuBgColor)); } +#ifndef _M_ARM TuiUpdateDateTime(); VideoCopyOffScreenBufferToVRAM(); +#endif } UCHAR TuiTextToColor(PCSTR ColorText) diff --git a/boot/freeldr/freeldr/ui/ui.c b/boot/freeldr/freeldr/ui/ui.c index de1d959d05a..b2a08f27c9f 100644 --- a/boot/freeldr/freeldr/ui/ui.c +++ b/boot/freeldr/freeldr/ui/ui.c @@ -369,12 +369,24 @@ UCHAR UiTextToFillStyle(PCSTR FillStyleText) return UiVtbl.TextToFillStyle(FillStyleText); } -VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText) +VOID +UiDrawProgressBarCenter( + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText) { UiVtbl.DrawProgressBarCenter(Position, Range, ProgressText); } -VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText) +VOID +UiDrawProgressBar( + _In_ ULONG Left, + _In_ ULONG Top, + _In_ ULONG Right, + _In_ ULONG Bottom, + _In_ ULONG Position, + _In_ ULONG Range, + _Inout_z_ PSTR ProgressText) { UiVtbl.DrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText); }