Example #1
0
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;
}
Example #2
0
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;
}