#include <freeldr.h>
PVOID TextVideoBuffer = NULL;
-extern BOOLEAN UiDrawTime;
-extern BOOLEAN UiMinimal;
/*
* printf() - prints formatted text to stdout
* originally from GRUB
*/
-int printf(const char *format, ... )
+int TuiPrintf(const char *format, ... )
{
va_list ap;
va_start(ap,format);
VOID TuiDrawBackdrop(VOID)
{
- if (UiMinimal)
- {
- //
- // Fill in a black background
- //
- TuiFillArea(0,
- 0,
- UiScreenWidth - 1,
- UiScreenHeight - 1,
- 0,
- 0);
-
- //
- // Update the screen buffer
- //
- VideoCopyOffScreenBufferToVRAM();
- return;
- }
-
//
// Fill in the background (excluding title box & status bar)
//
{
ULONG i;
- //
- // Minimal UI doesn't have a status bar
- //
- if (UiMinimal) return;
-
TuiDrawText(0, UiScreenHeight-1, " ", ATTR(UiStatusBarFgColor, UiStatusBarBgColor));
TuiDrawText(1, UiScreenHeight-1, StatusText, ATTR(UiStatusBarFgColor, UiStatusBarBgColor));
PVOID ScreenBuffer;
// Save the screen contents
- ScreenBuffer = MmAllocateMemory(UiScreenWidth * UiScreenHeight * 2);
+ ScreenBuffer = MmHeapAlloc(UiScreenWidth * UiScreenHeight * 2);
TuiSaveScreen(ScreenBuffer);
// Display the message box
// Restore the screen contents
TuiRestoreScreen(ScreenBuffer);
- MmFreeMemory(ScreenBuffer);
+ MmHeapFree(ScreenBuffer);
}
VOID TuiMessageBoxCritical(PCSTR MessageText)
ULONG Width = 50; // Allow for 50 "bars"
ULONG Height = 2;
- //
- // Is this the minimal UI?
- //
- if (UiMinimal)
- {
- //
- // Use alternate settings
- //
- Width = 80;
- Left = 0;
- Right = Left + Width;
- Top = UiScreenHeight - Height - 4;
- Bottom = Top + Height + 1;
- }
- else
- {
- Left = (UiScreenWidth - Width - 4) / 2;
- Right = Left + Width + 3;
- Top = (UiScreenHeight - Height - 2) / 2;
- Top += 2;
- }
-
+ Left = (UiScreenWidth - Width - 4) / 2;
+ Right = Left + Width + 3;
+ Top = (UiScreenHeight - Height - 2) / 2;
+ Top += 2;
Bottom = Top + Height + 1;
TuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText);
Position = Range;
}
- //
- // Minimal UI has no box, and only generic loading text
- //
- if (!UiMinimal)
- {
- // Draw the box
- TuiDrawBox(Left, Top, Right, Bottom, VERT, HORZ, TRUE, TRUE, ATTR(UiMenuFgColor, UiMenuBgColor));
-
- //
- // Draw the "Loading..." text
- //
- TuiDrawCenteredText(Left + 2, Top + 2, Right - 2, Top + 2, ProgressText, ATTR(UiTextColor, UiMenuBgColor));
- }
- else
- {
- //
- // Draw the "Loading..." text
- //
- TuiDrawCenteredText(Left + 2, Top + 1, Right - 2, Top + 1, "ReactOS is loading files...", ATTR(7, 0));
- }
+ // Draw the box
+ TuiDrawBox(Left, Top, Right, Bottom, VERT, HORZ, TRUE, TRUE, ATTR(UiMenuFgColor, UiMenuBgColor));
+
+ //
+ // Draw the "Loading..." text
+ //
+ TuiDrawCenteredText(Left + 2, Top + 2, Right - 2, Top + 2, ProgressText, ATTR(UiTextColor, UiMenuBgColor));
// Draw the percent complete
for (i=0; i<(Position*ProgressBarWidth)/Range; i++)
TuiDrawText(Left+2+i, Top+2, "\xDB", ATTR(UiTextColor, UiMenuBgColor));
}
- // Draw the shadow for non-minimal UI
- if (!UiMinimal)
- {
- for (; i<ProgressBarWidth; i++)
- {
- TuiDrawText(Left+2+i, Top+2, "\xB2", ATTR(UiTextColor, UiMenuBgColor));
- }
- }
+ // Draw the shadow
+ for (; i<ProgressBarWidth; i++)
+ {
+ TuiDrawText(Left+2+i, Top+2, "\xB2", ATTR(UiTextColor, UiMenuBgColor));
+ }
TuiUpdateDateTime();
VideoCopyOffScreenBufferToVRAM();
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed())
{
- TuiFadePalette = (PPALETTE_ENTRY)MmAllocateMemory(sizeof(PALETTE_ENTRY) * 64);
+ TuiFadePalette = (PPALETTE_ENTRY)MmHeapAlloc(sizeof(PALETTE_ENTRY) * 64);
if (TuiFadePalette != NULL)
{
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
{
VideoFadeIn(TuiFadePalette, 64);
- MmFreeMemory(TuiFadePalette);
+ MmHeapFree(TuiFadePalette);
}
}
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed())
{
- TuiFadePalette = (PPALETTE_ENTRY)MmAllocateMemory(sizeof(PALETTE_ENTRY) * 64);
+ TuiFadePalette = (PPALETTE_ENTRY)MmHeapAlloc(sizeof(PALETTE_ENTRY) * 64);
if (TuiFadePalette != NULL)
{
if (UiUseSpecialEffects && ! MachVideoIsPaletteFixed() && TuiFadePalette != NULL)
{
VideoRestorePaletteState(TuiFadePalette, 64);
- MmFreeMemory(TuiFadePalette);
+ MmHeapFree(TuiFadePalette);
}
}
PVOID ScreenBuffer;
// Save the screen contents
- ScreenBuffer = MmAllocateMemory(UiScreenWidth * UiScreenHeight * 2);
+ ScreenBuffer = MmHeapAlloc(UiScreenWidth * UiScreenHeight * 2);
TuiSaveScreen(ScreenBuffer);
// Find the height
}
else
{
- beep();
+ MachBeep();
}
}
else // Add this key to the buffer
}
else
{
- beep();
+ MachBeep();
}
}
}
// Restore the screen contents
TuiRestoreScreen(ScreenBuffer);
- MmFreeMemory(ScreenBuffer);
+ MmHeapFree(ScreenBuffer);
return ReturnCode;
}
+
+const UIVTBL TuiVtbl =
+{
+ TuiInitialize,
+ TuiUnInitialize,
+ TuiDrawBackdrop,
+ TuiFillArea,
+ TuiDrawShadow,
+ TuiDrawBox,
+ TuiDrawText,
+ TuiDrawCenteredText,
+ TuiDrawStatusText,
+ TuiUpdateDateTime,
+ TuiMessageBox,
+ TuiMessageBoxCritical,
+ TuiDrawProgressBarCenter,
+ TuiDrawProgressBar,
+ TuiEditBox,
+ TuiTextToColor,
+ TuiTextToFillStyle,
+ TuiFadeInBackdrop,
+ TuiFadeOut,
+ TuiDisplayMenu,
+ TuiDrawMenu,
+};