mirror of
https://github.com/reactos/reactos.git
synced 2024-05-15 09:41:59 +00:00
[FREELDR] Minor formatting for MsgBox functions + add SAL annotations
This commit is contained in:
parent
dad056e06a
commit
64155019df
|
@ -49,11 +49,7 @@ extern CHAR UiTimeText[260];
|
|||
|
||||
extern const PCSTR UiMonthNames[12];
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// User Interface Functions
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
/* User Interface Functions **************************************************/
|
||||
|
||||
BOOLEAN UiInitialize(BOOLEAN ShowUi); // Initialize User-Interface
|
||||
VOID UiUnInitialize(PCSTR BootText); // Un-initialize User-Interface
|
||||
|
@ -91,10 +87,21 @@ UiDrawCenteredText(
|
|||
|
||||
VOID UiDrawStatusText(PCSTR StatusText); // Draws text at the very bottom line on the screen
|
||||
VOID UiUpdateDateTime(VOID); // Updates the date and time
|
||||
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
|
||||
|
||||
/* Displays an info box on the screen */
|
||||
VOID
|
||||
UiInfoBox(
|
||||
_In_ PCSTR MessageText);
|
||||
|
||||
/* Displays a message box on the screen with an ok button */
|
||||
VOID
|
||||
UiMessageBox(
|
||||
_In_ PCSTR Format, ...);
|
||||
|
||||
/* Displays a message box on the screen with an ok button using no system resources */
|
||||
VOID
|
||||
UiMessageBoxCritical(
|
||||
_In_ PCSTR MessageText);
|
||||
|
||||
/* Loading Progress-Bar Functions ********************************************/
|
||||
|
||||
|
@ -192,11 +199,7 @@ UCHAR UiTextToFillStyle(PCSTR FillStyleText); // Converts the
|
|||
VOID UiFadeInBackdrop(VOID); // Draws the backdrop and fades the screen in
|
||||
VOID UiFadeOut(VOID); // Fades the screen out
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu Functions
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
/* Menu Functions ************************************************************/
|
||||
|
||||
typedef struct tagUI_MENU_INFO
|
||||
{
|
||||
|
|
|
@ -21,11 +21,8 @@
|
|||
|
||||
#define TITLE_BOX_CHAR_HEIGHT 5
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Graphical User Interface Functions
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
/* Graphical User Interface Functions ****************************************/
|
||||
|
||||
VOID GuiDrawBackdrop(VOID); // Fills the entire screen with a backdrop
|
||||
VOID GuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr
|
||||
VOID GuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom); // Draws a shadow on the bottom and right sides of the area specified
|
||||
|
@ -36,18 +33,23 @@ VOID GuiDrawStatusText(PCSTR StatusText); // Draws text at
|
|||
VOID GuiUpdateDateTime(VOID); // Updates the date and time
|
||||
VOID GuiSaveScreen(PUCHAR Buffer); // Saves the screen so that it can be restored later
|
||||
VOID GuiRestoreScreen(PUCHAR Buffer); // Restores the screen from a previous save
|
||||
VOID GuiMessageBox(PCSTR MessageText); // Displays a message box on the screen with an ok button
|
||||
VOID GuiMessageBoxCritical(PCSTR MessageText); // Displays a message box on the screen with an ok button using no system resources
|
||||
|
||||
/* Displays a message box on the screen with an ok button */
|
||||
VOID
|
||||
GuiMessageBox(
|
||||
_In_ PCSTR MessageText);
|
||||
|
||||
/* Displays a message box on the screen with an ok button using no system resources */
|
||||
VOID
|
||||
GuiMessageBoxCritical(
|
||||
_In_ PCSTR MessageText);
|
||||
|
||||
VOID GuiDrawProgressBar(ULONG Position, ULONG Range); // Draws the progress bar showing nPos percent filled
|
||||
|
||||
UCHAR GuiTextToColor(PCSTR ColorText); // Converts the text color into it's equivalent color value
|
||||
UCHAR GuiTextToFillStyle(PCSTR FillStyleText); // Converts the text fill into it's equivalent fill value
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu Functions
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
/* Menu Functions ************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
GuiDisplayMenu(
|
||||
|
|
|
@ -47,8 +47,14 @@ NoUiDrawCenteredText(
|
|||
|
||||
VOID NoUiDrawStatusText(PCSTR StatusText);
|
||||
VOID NoUiUpdateDateTime(VOID);
|
||||
VOID NoUiMessageBox(PCSTR MessageText);
|
||||
VOID NoUiMessageBoxCritical(PCSTR MessageText);
|
||||
|
||||
VOID
|
||||
NoUiMessageBox(
|
||||
_In_ PCSTR MessageText);
|
||||
|
||||
VOID
|
||||
NoUiMessageBoxCritical(
|
||||
_In_ PCSTR MessageText);
|
||||
|
||||
/* Loading Progress-Bar Functions ********************************************/
|
||||
|
||||
|
|
|
@ -103,8 +103,16 @@ VOID TuiDrawStatusText(PCSTR StatusText); // Draws text at
|
|||
VOID TuiUpdateDateTime(VOID); // Updates the date and time
|
||||
VOID TuiSaveScreen(PUCHAR Buffer); // Saves the screen so that it can be restored later
|
||||
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
|
||||
|
||||
/* Displays a message box on the screen with an ok button */
|
||||
VOID
|
||||
TuiMessageBox(
|
||||
_In_ PCSTR MessageText);
|
||||
|
||||
/* Displays a message box on the screen with an ok button using no system resources */
|
||||
VOID
|
||||
TuiMessageBoxCritical(
|
||||
_In_ PCSTR MessageText);
|
||||
|
||||
BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length);
|
||||
UCHAR TuiTextToColor(PCSTR ColorText); // Converts the text color into it's equivalent color value
|
||||
|
|
|
@ -93,19 +93,22 @@ UiDrawStatusText(IN PCSTR StatusText)
|
|||
}
|
||||
|
||||
VOID
|
||||
UiInfoBox(IN PCSTR MessageText)
|
||||
UiInfoBox(
|
||||
_In_ PCSTR MessageText)
|
||||
{
|
||||
TuiPrintf(MessageText);
|
||||
}
|
||||
|
||||
VOID
|
||||
UiMessageBox(IN PCSTR MessageText)
|
||||
UiMessageBox(
|
||||
_In_ PCSTR MessageText)
|
||||
{
|
||||
TuiPrintf(MessageText);
|
||||
}
|
||||
|
||||
VOID
|
||||
UiMessageBoxCritical(IN PCSTR MessageText)
|
||||
UiMessageBoxCritical(
|
||||
_In_ PCSTR MessageText)
|
||||
{
|
||||
TuiPrintf(MessageText);
|
||||
}
|
||||
|
|
|
@ -59,11 +59,15 @@ VOID GuiRestoreScreen(PUCHAR Buffer)
|
|||
{
|
||||
}
|
||||
|
||||
VOID GuiMessageBox(PCSTR MessageText)
|
||||
VOID
|
||||
GuiMessageBox(
|
||||
_In_ PCSTR MessageText)
|
||||
{
|
||||
}
|
||||
|
||||
VOID GuiMessageBoxCritical(PCSTR MessageText)
|
||||
VOID
|
||||
GuiMessageBoxCritical(
|
||||
_In_ PCSTR MessageText)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -77,23 +77,23 @@ VOID NoUiUpdateDateTime(VOID)
|
|||
{
|
||||
}
|
||||
|
||||
VOID NoUiMessageBox(PCSTR MessageText)
|
||||
VOID
|
||||
NoUiMessageBox(
|
||||
_In_ PCSTR MessageText)
|
||||
{
|
||||
// We have not yet displayed the user interface
|
||||
// We are probably still reading the .ini file
|
||||
// and have encountered an error. Just use printf()
|
||||
// and return.
|
||||
printf("%s\n", MessageText);
|
||||
printf("Press any key\n");
|
||||
MachConsGetCh();
|
||||
NoUiMessageBoxCritical(MessageText);
|
||||
}
|
||||
|
||||
VOID NoUiMessageBoxCritical(PCSTR MessageText)
|
||||
VOID
|
||||
NoUiMessageBoxCritical(
|
||||
_In_ PCSTR MessageText)
|
||||
{
|
||||
// We have not yet displayed the user interface
|
||||
// We are probably still reading the .ini file
|
||||
// and have encountered an error. Just use printf()
|
||||
// and return.
|
||||
/*
|
||||
* We have not yet displayed the user interface
|
||||
* We are probably still reading the .ini file
|
||||
* and have encountered an error. Just use printf()
|
||||
* and return.
|
||||
*/
|
||||
printf("%s\n", MessageText);
|
||||
printf("Press any key\n");
|
||||
MachConsGetCh();
|
||||
|
|
|
@ -629,7 +629,9 @@ VOID TuiRestoreScreen(PUCHAR Buffer)
|
|||
VideoCopyOffScreenBufferToVRAM();
|
||||
}
|
||||
|
||||
VOID TuiMessageBox(PCSTR MessageText)
|
||||
VOID
|
||||
TuiMessageBox(
|
||||
_In_ PCSTR MessageText)
|
||||
{
|
||||
PVOID ScreenBuffer;
|
||||
|
||||
|
@ -646,7 +648,9 @@ VOID TuiMessageBox(PCSTR MessageText)
|
|||
FrLdrTempFree(ScreenBuffer, TAG_TUI_SCREENBUFFER);
|
||||
}
|
||||
|
||||
VOID TuiMessageBoxCritical(PCSTR MessageText)
|
||||
VOID
|
||||
TuiMessageBoxCritical(
|
||||
_In_ PCSTR MessageText)
|
||||
{
|
||||
int width = 8;
|
||||
unsigned int height = 1;
|
||||
|
|
|
@ -293,22 +293,24 @@ VOID UiUpdateDateTime(VOID)
|
|||
UiVtbl.UpdateDateTime();
|
||||
}
|
||||
|
||||
VOID UiInfoBox(PCSTR MessageText)
|
||||
VOID
|
||||
UiInfoBox(
|
||||
_In_ PCSTR MessageText)
|
||||
{
|
||||
SIZE_T TextLength;
|
||||
ULONG BoxWidth;
|
||||
ULONG BoxHeight;
|
||||
ULONG LineBreakCount;
|
||||
SIZE_T Index;
|
||||
SIZE_T LastIndex;
|
||||
ULONG Left;
|
||||
ULONG Top;
|
||||
ULONG Right;
|
||||
ULONG Bottom;
|
||||
SIZE_T TextLength;
|
||||
ULONG BoxWidth;
|
||||
ULONG BoxHeight;
|
||||
ULONG LineBreakCount;
|
||||
SIZE_T Index;
|
||||
SIZE_T LastIndex;
|
||||
ULONG Left;
|
||||
ULONG Top;
|
||||
ULONG Right;
|
||||
ULONG Bottom;
|
||||
|
||||
TextLength = strlen(MessageText);
|
||||
|
||||
// Count the new lines and the box width
|
||||
/* Count the new lines and the box width */
|
||||
LineBreakCount = 0;
|
||||
BoxWidth = 0;
|
||||
LastIndex = 0;
|
||||
|
@ -328,17 +330,17 @@ VOID UiInfoBox(PCSTR MessageText)
|
|||
}
|
||||
}
|
||||
|
||||
// Calc the box width & height
|
||||
/* Calc the box width & height */
|
||||
BoxWidth += 6;
|
||||
BoxHeight = LineBreakCount + 4;
|
||||
|
||||
// Calc the box coordinates
|
||||
/* Calc the box coordinates */
|
||||
Left = (UiScreenWidth / 2) - (BoxWidth / 2);
|
||||
Top =(UiScreenHeight / 2) - (BoxHeight / 2);
|
||||
Right = (UiScreenWidth / 2) + (BoxWidth / 2);
|
||||
Top = (UiScreenHeight / 2) - (BoxHeight / 2);
|
||||
Right = (UiScreenWidth / 2) + (BoxWidth / 2);
|
||||
Bottom = (UiScreenHeight / 2) + (BoxHeight / 2);
|
||||
|
||||
// Draw the box
|
||||
/* Draw the box */
|
||||
UiDrawBox(Left,
|
||||
Top,
|
||||
Right,
|
||||
|
@ -347,17 +349,18 @@ VOID UiInfoBox(PCSTR MessageText)
|
|||
HORZ,
|
||||
TRUE,
|
||||
TRUE,
|
||||
ATTR(UiMenuFgColor, UiMenuBgColor)
|
||||
);
|
||||
ATTR(UiMenuFgColor, UiMenuBgColor));
|
||||
|
||||
// Draw the text
|
||||
/* Draw the text */
|
||||
UiDrawCenteredText(Left, Top, Right, Bottom, MessageText, ATTR(UiTextColor, UiMenuBgColor));
|
||||
}
|
||||
|
||||
VOID UiMessageBox(PCSTR Format, ...)
|
||||
VOID
|
||||
UiMessageBox(
|
||||
_In_ PCSTR Format, ...)
|
||||
{
|
||||
CHAR Buffer[256];
|
||||
va_list ap;
|
||||
CHAR Buffer[256];
|
||||
|
||||
va_start(ap, Format);
|
||||
vsnprintf(Buffer, sizeof(Buffer) - sizeof(CHAR), Format, ap);
|
||||
|
@ -365,7 +368,9 @@ VOID UiMessageBox(PCSTR Format, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
VOID UiMessageBoxCritical(PCSTR MessageText)
|
||||
VOID
|
||||
UiMessageBoxCritical(
|
||||
_In_ PCSTR MessageText)
|
||||
{
|
||||
UiVtbl.MessageBoxCritical(MessageText);
|
||||
}
|
||||
|
@ -631,3 +636,4 @@ BOOLEAN UiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length)
|
|||
return UiVtbl.EditBox(MessageText, EditTextBuffer, Length);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue