VOID UiUnInitialize(PCSTR BootText) { UiDrawBackdrop(); UiDrawStatusText("Booting..."); UiInfoBox(BootText); UiVtbl.UnInitialize(); }
VOID UiMessageBox(PCSTR Format, ...) { CHAR Buffer[256]; va_list ap; va_start(ap, Format); vsnprintf(Buffer, sizeof(Buffer) - sizeof(CHAR), Format, ap); UiVtbl.MessageBox(Buffer); va_end(ap); }
BOOLEAN SetupUiInitialize(VOID) { CHAR DisplayModeText[260]; ULONG Depth, Length; DisplayModeText[0] = '\0'; MachVideoSetDisplayMode(DisplayModeText, TRUE); MachVideoGetDisplaySize(&UiScreenWidth, &UiScreenHeight, &Depth); UiVtbl = SetupUiVtbl; UiVtbl.Initialize(); // Draw the backdrop and fade it in if special effects are enabled UiVtbl.FillArea(0, 0, UiScreenWidth - 1, UiScreenHeight - 2, 0, ATTR(UiBackdropFgColor, UiBackdropBgColor)); UiDrawTime = FALSE; UiStatusBarBgColor = 7; Length = strlen("Odyssey " KERNEL_VERSION_STR " Setup"); memset(DisplayModeText, 0xcd, Length + 2); DisplayModeText[Length + 2] = '\0'; UiVtbl.DrawText(4, 1, "Odyssey " KERNEL_VERSION_STR " Setup", ATTR(COLOR_GRAY, UiBackdropBgColor)); UiVtbl.DrawText(3, 2, DisplayModeText, ATTR(COLOR_GRAY, UiBackdropBgColor)); TRACE("UiInitialize() returning TRUE.\n"); return TRUE; }
UCHAR UiTextToColor(PCSTR ColorText) { return UiVtbl.TextToColor(ColorText); }
VOID UiMessageBoxCritical(PCSTR MessageText) { UiVtbl.MessageBoxCritical(MessageText); }
VOID UiMessageBox(PCSTR MessageText) { UiVtbl.MessageBox(MessageText); }
BOOLEAN UiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length) { return UiVtbl.EditBox(MessageText, EditTextBuffer, Length); }
VOID UiFadeInBackdrop(VOID) { UiVtbl.FadeInBackdrop(); }
VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText) { UiVtbl.DrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText); }
VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr) { UiVtbl.DrawBox(Left, Top, Right, Bottom, VertStyle, HorzStyle, Fill, Shadow, Attr); }
VOID UiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom) { UiVtbl.DrawShadow(Left, Top, Right, Bottom); }
VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr /* Color Attributes */) { UiVtbl.FillArea(Left, Top, Right, Bottom, FillChar, Attr); }
VOID UiDrawBackdrop(VOID) { UiVtbl.DrawBackdrop(); }
UCHAR UiTextToFillStyle(PCSTR FillStyleText) { return UiVtbl.TextToFillStyle(FillStyleText); }
VOID UiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr) { UiVtbl.DrawText(X, Y, Text, Attr); }
VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText) { UiVtbl.DrawProgressBarCenter(Position, Range, ProgressText); }
VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr) { UiVtbl.DrawCenteredText(Left, Top, Right, Bottom, TextString, Attr); }
BOOLEAN UiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter) { return UiVtbl.DisplayMenu(MenuItemList, MenuItemCount, DefaultMenuItem, MenuTimeOut, SelectedMenuItem, CanEscape, KeyPressFilter); }
VOID UiDrawStatusText(PCSTR StatusText) { UiVtbl.DrawStatusText(StatusText); }
VOID UiFadeOut(VOID) { UiVtbl.FadeOut(); }
VOID UiUpdateDateTime(VOID) { UiVtbl.UpdateDateTime(); }
BOOLEAN UiInitialize(BOOLEAN ShowGui) { VIDEODISPLAYMODE UiDisplayMode; // Tells us if we are in text or graphics mode BOOLEAN UiMinimal = FALSE; // Tells us if we should use a minimal console-like UI ULONG_PTR SectionId; CHAR DisplayModeText[260]; CHAR SettingText[260]; ULONG Depth; if (!ShowGui) { if (!UiVtbl.Initialize()) { MachVideoSetDisplayMode(NULL, FALSE); return FALSE; } return TRUE; } TRACE("Initializing User Interface.\n"); TRACE("Reading in UI settings from [Display] section.\n"); DisplayModeText[0] = '\0'; if (IniOpenSection("Display", &SectionId)) { if (! IniReadSettingByName(SectionId, "DisplayMode", DisplayModeText, sizeof(DisplayModeText))) { DisplayModeText[0] = '\0'; } if (IniReadSettingByName(SectionId, "MinimalUI", SettingText, sizeof(SettingText))) { UiMinimal = (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3); } } UiDisplayMode = MachVideoSetDisplayMode(DisplayModeText, TRUE); MachVideoGetDisplaySize(&UiScreenWidth, &UiScreenHeight, &Depth); if (VideoTextMode == UiDisplayMode) UiVtbl = MiniTuiVtbl; if (!UiVtbl.Initialize()) { MachVideoSetDisplayMode(NULL, FALSE); return FALSE; } if (IniOpenSection("Display", &SectionId)) { if (IniReadSettingByName(SectionId, "TitleText", SettingText, sizeof(SettingText))) { strcpy(UiTitleBoxTitleText, SettingText); } if (IniReadSettingByName(SectionId, "TimeText", SettingText, sizeof(SettingText))) { strcpy(UiTimeText, SettingText); } if (IniReadSettingByName(SectionId, "StatusBarColor", SettingText, sizeof(SettingText))) { UiStatusBarBgColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "StatusBarTextColor", SettingText, sizeof(SettingText))) { UiStatusBarFgColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "BackdropTextColor", SettingText, sizeof(SettingText))) { UiBackdropFgColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "BackdropColor", SettingText, sizeof(SettingText))) { UiBackdropBgColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "BackdropFillStyle", SettingText, sizeof(SettingText))) { UiBackdropFillStyle = UiTextToFillStyle(SettingText); } if (IniReadSettingByName(SectionId, "TitleBoxTextColor", SettingText, sizeof(SettingText))) { UiTitleBoxFgColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "TitleBoxColor", SettingText, sizeof(SettingText))) { UiTitleBoxBgColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "MessageBoxTextColor", SettingText, sizeof(SettingText))) { UiMessageBoxFgColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "MessageBoxColor", SettingText, sizeof(SettingText))) { UiMessageBoxBgColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "MenuTextColor", SettingText, sizeof(SettingText))) { UiMenuFgColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "MenuColor", SettingText, sizeof(SettingText))) { UiMenuBgColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "TextColor", SettingText, sizeof(SettingText))) { UiTextColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "SelectedTextColor", SettingText, sizeof(SettingText))) { UiSelectedTextColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "SelectedColor", SettingText, sizeof(SettingText))) { UiSelectedTextBgColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "EditBoxTextColor", SettingText, sizeof(SettingText))) { UiEditBoxTextColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "EditBoxColor", SettingText, sizeof(SettingText))) { UiEditBoxBgColor = UiTextToColor(SettingText); } if (IniReadSettingByName(SectionId, "SpecialEffects", SettingText, sizeof(SettingText))) { UiUseSpecialEffects = (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3); } if (IniReadSettingByName(SectionId, "ShowTime", SettingText, sizeof(SettingText))) { UiDrawTime = (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3); } if (IniReadSettingByName(SectionId, "MenuBox", SettingText, sizeof(SettingText))) { UiMenuBox = (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3); } if (IniReadSettingByName(SectionId, "CenterMenu", SettingText, sizeof(SettingText))) { UiCenterMenu = (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3); } } // Draw the backdrop and fade it in if special effects are enabled UiFadeInBackdrop(); TRACE("UiInitialize() returning TRUE.\n"); return TRUE; }
VOID UiDrawText2(ULONG X, ULONG Y, ULONG MaxNumChars, PCSTR Text, UCHAR Attr) { UiVtbl.DrawText2(X, Y, MaxNumChars, Text, Attr); }