mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-27 12:15:19 +01:00
apply theme settings to xtheme
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
a44952e7ef
commit
1abcd07489
@ -3740,6 +3740,407 @@ GetListOfThemes ()
|
||||
DirIterClose (&DirIter);
|
||||
}
|
||||
|
||||
#if USE_XTHEME
|
||||
|
||||
EFI_STATUS
|
||||
XTheme::GetThemeTagSettings (void* DictP)
|
||||
{
|
||||
TagPtr Dict, Dict2, Dict3;
|
||||
TagPtr DictPointer = (TagPtr)DictP;
|
||||
|
||||
//fill default to have an ability change theme
|
||||
//assume Xtheme is already inited by embedded values
|
||||
|
||||
ScrollWidth = 16;
|
||||
ScrollButtonsHeight = 20;
|
||||
ScrollBarDecorationsHeight = 5;
|
||||
ScrollScrollDecorationsHeight = 7;
|
||||
ThemeX.Font = FONT_LOAD; //not default
|
||||
GuiAnime = NULL;
|
||||
|
||||
|
||||
// if NULL parameter, quit after setting default values, this is embedded theme
|
||||
if (DictPointer == NULL) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Dict = GetProperty (DictPointer, "BootCampStyle");
|
||||
BootCampStyle = IsPropertyTrue(Dict);
|
||||
|
||||
Dict = GetProperty (DictPointer, "Background");
|
||||
if (Dict != NULL) {
|
||||
Dict2 = GetProperty (Dict, "Type");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
if ((Dict2->string[0] == 'S') || (Dict2->string[0] == 's')) {
|
||||
BackgroundScale = imScale;
|
||||
} else if ((Dict2->string[0] == 'T') || (Dict2->string[0] == 't')) {
|
||||
BackgroundScale = imTile;
|
||||
}
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "Path");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
BackgroundName.takeValueFrom(Dict2->string);
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "Sharp");
|
||||
BackgroundSharp = GetPropertyInteger (Dict2, BackgroundSharp);
|
||||
|
||||
Dict2 = GetProperty (Dict, "Dark");
|
||||
BackgroundDark = IsPropertyTrue(Dict2);
|
||||
}
|
||||
|
||||
Dict = GetProperty (DictPointer, "Banner");
|
||||
if (Dict != NULL) {
|
||||
// retain for legacy themes.
|
||||
if ((Dict->type == kTagTypeString) && Dict->string) {
|
||||
BannerFileName.takeValueFrom(Dict->string);
|
||||
} else {
|
||||
// for new placement settings
|
||||
Dict2 = GetProperty (Dict, "Path");
|
||||
if (Dict2 != NULL) {
|
||||
if ((Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
BannerFileName.takeValueFrom(Dict2->string);
|
||||
}
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "ScreenEdgeX");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
if (AsciiStrCmp (Dict2->string, "left") == 0) {
|
||||
BannerEdgeHorizontal = SCREEN_EDGE_LEFT;
|
||||
} else if (AsciiStrCmp (Dict2->string, "right") == 0) {
|
||||
BannerEdgeHorizontal = SCREEN_EDGE_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "ScreenEdgeY");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
if (AsciiStrCmp (Dict2->string, "top") == 0) {
|
||||
BannerEdgeVertical = SCREEN_EDGE_TOP;
|
||||
} else if (AsciiStrCmp (Dict2->string, "bottom") == 0) {
|
||||
BannerEdgeVertical = SCREEN_EDGE_BOTTOM;
|
||||
}
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "DistanceFromScreenEdgeX%");
|
||||
BannerPosX = GetPropertyInteger (Dict2, 0);
|
||||
|
||||
Dict2 = GetProperty (Dict, "DistanceFromScreenEdgeY%");
|
||||
BannerPosY = GetPropertyInteger (Dict2, 0);
|
||||
|
||||
Dict2 = GetProperty (Dict, "NudgeX");
|
||||
BannerNudgeX = GetPropertyInteger (Dict2, 0);
|
||||
|
||||
Dict2 = GetProperty (Dict, "NudgeY");
|
||||
BannerNudgeY = GetPropertyInteger (Dict2, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Dict = GetProperty (DictPointer, "Badges");
|
||||
if (Dict != NULL) {
|
||||
Dict2 = GetProperty (Dict, "Swap");
|
||||
if (Dict2 != NULL && Dict2->type == kTagTypeTrue) {
|
||||
HideBadges |= HDBADGES_SWAP;
|
||||
DBG ("OS main and drive as badge\n");
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "Show");
|
||||
if (Dict2 != NULL && Dict2->type == kTagTypeTrue) {
|
||||
HideBadges |= HDBADGES_SHOW;
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "Inline");
|
||||
if (Dict2 != NULL && Dict2->type == kTagTypeTrue) {
|
||||
HideBadges |= HDBADGES_INLINE;
|
||||
}
|
||||
|
||||
// blackosx added X and Y position for badge offset.
|
||||
Dict2 = GetProperty (Dict, "OffsetX");
|
||||
BadgeOffsetX = GetPropertyInteger (Dict2, BadgeOffsetX);
|
||||
|
||||
Dict2 = GetProperty (Dict, "OffsetY");
|
||||
BadgeOffsetY = GetPropertyInteger (Dict2, BadgeOffsetY);
|
||||
|
||||
Dict2 = GetProperty (Dict, "Scale");
|
||||
ThemeX.BadgeScale = GetPropertyInteger (Dict2, BadgeScale);
|
||||
}
|
||||
|
||||
Dict = GetProperty (DictPointer, "Origination");
|
||||
if (Dict != NULL) {
|
||||
Dict2 = GetProperty (Dict, "DesignWidth");
|
||||
ThemeDesignWidth = GetPropertyInteger (Dict2, ThemeDesignWidth);
|
||||
|
||||
Dict2 = GetProperty (Dict, "DesignHeight");
|
||||
ThemeDesignHeight = GetPropertyInteger (Dict2, ThemeDesignHeight);
|
||||
}
|
||||
|
||||
Dict = GetProperty (DictPointer, "Layout");
|
||||
if (Dict != NULL) {
|
||||
Dict2 = GetProperty (Dict, "BannerOffset");
|
||||
LayoutBannerOffset = GetPropertyInteger (Dict2, LayoutBannerOffset);
|
||||
|
||||
Dict2 = GetProperty (Dict, "ButtonOffset");
|
||||
LayoutButtonOffset = GetPropertyInteger (Dict2, LayoutButtonOffset);
|
||||
|
||||
Dict2 = GetProperty (Dict, "TextOffset");
|
||||
LayoutTextOffset = GetPropertyInteger (Dict2, LayoutTextOffset);
|
||||
|
||||
Dict2 = GetProperty (Dict, "AnimAdjustForMenuX");
|
||||
LayoutAnimMoveForMenuX = GetPropertyInteger (Dict2, LayoutAnimMoveForMenuX);
|
||||
|
||||
Dict2 = GetProperty (Dict, "Vertical");
|
||||
VerticalLayout = IsPropertyTrue(Dict2);
|
||||
|
||||
// GlobalConfig.MainEntriesSize
|
||||
Dict2 = GetProperty (Dict, "MainEntriesSize");
|
||||
MainEntriesSize = GetPropertyInteger (Dict2, MainEntriesSize);
|
||||
|
||||
Dict2 = GetProperty (Dict, "TileXSpace");
|
||||
TileXSpace = GetPropertyInteger (Dict2, TileXSpace);
|
||||
|
||||
Dict2 = GetProperty (Dict, "TileYSpace");
|
||||
TileYSpace = GetPropertyInteger (Dict2, TileYSpace);
|
||||
|
||||
Dict2 = GetProperty (Dict, "SelectionBigWidth");
|
||||
row0TileSize = GetPropertyInteger (Dict2, row0TileSize);
|
||||
|
||||
Dict2 = GetProperty (Dict, "SelectionSmallWidth");
|
||||
row1TileSize = (INTN)GetPropertyInteger (Dict2, row1TileSize);
|
||||
|
||||
}
|
||||
|
||||
Dict = GetProperty (DictPointer, "Components");
|
||||
if (Dict != NULL) {
|
||||
Dict2 = GetProperty (Dict, "Banner");
|
||||
if (Dict2 && Dict2->type == kTagTypeFalse) {
|
||||
HideUIFlags |= HIDEUI_FLAG_BANNER;
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "Functions");
|
||||
if (Dict2 && Dict2->type == kTagTypeFalse) {
|
||||
HideUIFlags |= HIDEUI_FLAG_FUNCS;
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "Tools");
|
||||
if (Dict2 && Dict2->type == kTagTypeFalse) {
|
||||
DisableFlags |= HIDEUI_FLAG_TOOLS;
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "Label");
|
||||
if (Dict2 && Dict2->type == kTagTypeFalse) {
|
||||
HideUIFlags |= HIDEUI_FLAG_LABEL;
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "Revision");
|
||||
if (Dict2 && Dict2->type == kTagTypeFalse) {
|
||||
HideUIFlags |= HIDEUI_FLAG_REVISION;
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "Help");
|
||||
if (Dict2 && Dict2->type == kTagTypeFalse) {
|
||||
HideUIFlags |= HIDEUI_FLAG_HELP;
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "MenuTitle");
|
||||
if (Dict2 && Dict2->type == kTagTypeFalse) {
|
||||
HideUIFlags |= HIDEUI_FLAG_MENU_TITLE;
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "MenuTitleImage");
|
||||
if (Dict2 && Dict2->type == kTagTypeFalse) {
|
||||
HideUIFlags |= HIDEUI_FLAG_MENU_TITLE_IMAGE;
|
||||
}
|
||||
}
|
||||
|
||||
Dict = GetProperty (DictPointer, "Selection");
|
||||
if (Dict != NULL) {
|
||||
Dict2 = GetProperty (Dict, "Color");
|
||||
SelectionColor = (UINTN)GetPropertyInteger (Dict2, SelectionColor);
|
||||
|
||||
Dict2 = GetProperty (Dict, "Small");
|
||||
if ( Dict2 && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
SelectionSmallFileName.takeValueFrom(Dict2->string);
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "Big");
|
||||
if ( Dict2 && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
SelectionBigFileName.takeValueFrom(Dict2->string);
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "Indicator");
|
||||
if ( Dict2 && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
SelectionIndicatorName.takeValueFrom(Dict2->string);
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "OnTop");
|
||||
SelectionOnTop = IsPropertyTrue (Dict2);
|
||||
|
||||
Dict2 = GetProperty (Dict, "ChangeNonSelectedGrey");
|
||||
NonSelectedGrey = IsPropertyTrue (Dict2);
|
||||
}
|
||||
|
||||
Dict = GetProperty (DictPointer, "Scroll");
|
||||
if (Dict != NULL) {
|
||||
Dict2 = GetProperty (Dict, "Width");
|
||||
ScrollWidth = (UINTN)GetPropertyInteger (Dict2, ScrollWidth);
|
||||
|
||||
Dict2 = GetProperty (Dict, "Height");
|
||||
ScrollButtonsHeight = (UINTN)GetPropertyInteger (Dict2, ScrollButtonsHeight);
|
||||
|
||||
Dict2 = GetProperty (Dict, "BarHeight");
|
||||
ScrollBarDecorationsHeight = (UINTN)GetPropertyInteger (Dict2, ScrollBarDecorationsHeight);
|
||||
|
||||
Dict2 = GetProperty (Dict, "ScrollHeight");
|
||||
ScrollScrollDecorationsHeight = (UINTN)GetPropertyInteger (Dict2,ScrollScrollDecorationsHeight);
|
||||
}
|
||||
|
||||
Dict = GetProperty (DictPointer, "Font");
|
||||
if (Dict != NULL) {
|
||||
Dict2 = GetProperty (Dict, "Type");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
if ((Dict2->string[0] == 'A') || (Dict2->string[0] == 'B')) {
|
||||
Font = FONT_ALFA;
|
||||
} else if ((Dict2->string[0] == 'G') || (Dict2->string[0] == 'W')) {
|
||||
Font = FONT_GRAY;
|
||||
} else if ((Dict2->string[0] == 'L') || (Dict2->string[0] == 'l')) {
|
||||
Font = FONT_LOAD;
|
||||
}
|
||||
}
|
||||
if (Font == FONT_LOAD) {
|
||||
Dict2 = GetProperty (Dict, "Path");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
FontFileName.takeValueFrom(Dict2->string);
|
||||
}
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "CharWidth");
|
||||
CharWidth = (UINTN)GetPropertyInteger (Dict2, CharWidth);
|
||||
if (GlobalConfig.CharWidth & 1) {
|
||||
MsgLog("Warning! Character width %lld should be even!\n", CharWidth);
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "Proportional");
|
||||
Proportional = IsPropertyTrue (Dict2);
|
||||
}
|
||||
|
||||
Dict = GetProperty (DictPointer, "Anime");
|
||||
if (Dict != NULL) {
|
||||
INTN i, Count = GetTagCount (Dict);
|
||||
for (i = 0; i < Count; i++) {
|
||||
GUI_ANIME *Anime;
|
||||
if (EFI_ERROR (GetElement (Dict, i, &Dict3))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Dict3 == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
Anime = (__typeof__(Anime))AllocateZeroPool (sizeof(GUI_ANIME));
|
||||
if (Anime == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict3, "ID");
|
||||
Anime->ID = (UINTN)GetPropertyInteger (Dict2, 1); //default=main screen
|
||||
|
||||
Dict2 = GetProperty (Dict3, "Path");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
Anime->Path = PoolPrint(L"%a", Dict2->string);
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict3, "Frames");
|
||||
Anime->Frames = (UINTN)GetPropertyInteger (Dict2, Anime->Frames);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "FrameTime");
|
||||
Anime->FrameTime = (UINTN)GetPropertyInteger (Dict2, Anime->FrameTime);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "ScreenEdgeX");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
if (AsciiStrCmp (Dict2->string, "left") == 0) {
|
||||
Anime->ScreenEdgeHorizontal = SCREEN_EDGE_LEFT;
|
||||
} else if (AsciiStrCmp (Dict2->string, "right") == 0) {
|
||||
Anime->ScreenEdgeHorizontal = SCREEN_EDGE_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict3, "ScreenEdgeY");
|
||||
if (Dict2 != NULL && (Dict2->type == kTagTypeString) && Dict2->string) {
|
||||
if (AsciiStrCmp (Dict2->string, "top") == 0) {
|
||||
Anime->ScreenEdgeVertical = SCREEN_EDGE_TOP;
|
||||
} else if (AsciiStrCmp (Dict2->string, "bottom") == 0) {
|
||||
Anime->ScreenEdgeVertical = SCREEN_EDGE_BOTTOM;
|
||||
}
|
||||
}
|
||||
|
||||
//default values are centre
|
||||
|
||||
Dict2 = GetProperty (Dict3, "DistanceFromScreenEdgeX%");
|
||||
Anime->FilmX = GetPropertyInteger (Dict2, INITVALUE);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "DistanceFromScreenEdgeY%");
|
||||
Anime->FilmY = GetPropertyInteger (Dict2, INITVALUE);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "NudgeX");
|
||||
Anime->NudgeX = GetPropertyInteger (Dict2, INITVALUE);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "NudgeY");
|
||||
Anime->NudgeY = GetPropertyInteger (Dict2, INITVALUE);
|
||||
|
||||
Dict2 = GetProperty (Dict3, "Once");
|
||||
Anime->Once = IsPropertyTrue (Dict2);
|
||||
|
||||
// Add the anime to the list
|
||||
if ((Anime->ID == 0) || (Anime->Path == NULL)) {
|
||||
FreePool (Anime);
|
||||
} else if (GuiAnime != NULL) { //second anime or further
|
||||
if (GuiAnime->ID == Anime->ID) { //why the same anime here?
|
||||
Anime->Next = GuiAnime->Next;
|
||||
FreeAnime (GuiAnime); //free double
|
||||
} else {
|
||||
GUI_ANIME *Ptr = GuiAnime;
|
||||
while (Ptr->Next) {
|
||||
if (Ptr->Next->ID == Anime->ID) { //delete double from list
|
||||
GUI_ANIME *Next = Ptr->Next;
|
||||
Ptr->Next = Next->Next;
|
||||
FreeAnime (Next);
|
||||
break;
|
||||
}
|
||||
Ptr = Ptr->Next;
|
||||
}
|
||||
Anime->Next = GuiAnime;
|
||||
}
|
||||
GuiAnime = Anime;
|
||||
} else {
|
||||
GuiAnime = Anime; //first anime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//not sure if it needed
|
||||
if (BackgroundName.isEmpty()) {
|
||||
BackgroundName.takeValueFrom("background");
|
||||
}
|
||||
if (BannerFileName.isEmpty()) {
|
||||
BannerFileName.takeValueFrom("logo");
|
||||
}
|
||||
if (SelectionSmallFileName.isEmpty()) {
|
||||
SelectionSmallFileName.takeValueFrom("selection_small");
|
||||
}
|
||||
if (SelectionBigFileName.isEmpty()) {
|
||||
SelectionBigFileName.takeValueFrom("selection_big");
|
||||
}
|
||||
if (SelectionIndicatorName.isEmpty()) {
|
||||
SelectionIndicatorName.takeValueFrom("selection_indicator");
|
||||
}
|
||||
if (FontFileName.isEmpty()) {
|
||||
FontFileName.takeValueFrom("font");
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
#else
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
GetThemeTagSettings (
|
||||
@ -4102,7 +4503,7 @@ GetThemeTagSettings (
|
||||
Dict2 = GetProperty (Dict, "CharWidth");
|
||||
GlobalConfig.CharWidth = (UINTN)GetPropertyInteger (Dict2, GlobalConfig.CharWidth);
|
||||
if (GlobalConfig.CharWidth & 1) {
|
||||
MsgLog("Warning! Character width %lld should be even!\n", GlobalConfig.CharWidth);
|
||||
MsgLog("Warning! Character width %lld should be even!\n", GlobalConfig.CharWidth);
|
||||
}
|
||||
|
||||
Dict2 = GetProperty (Dict, "Proportional");
|
||||
@ -4245,6 +4646,8 @@ GetThemeTagSettings (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
TagPtr
|
||||
LoadTheme (CHAR16 *TestTheme)
|
||||
{
|
||||
@ -4308,6 +4711,204 @@ LoadTheme (CHAR16 *TestTheme)
|
||||
return ThemeDict;
|
||||
}
|
||||
|
||||
#if USE_XTHEME
|
||||
EFI_STATUS
|
||||
InitTheme(BOOLEAN UseThemeDefinedInNVRam, EFI_TIME *Time)
|
||||
{
|
||||
EFI_STATUS Status = EFI_NOT_FOUND;
|
||||
UINTN Size = 0;
|
||||
UINTN i;
|
||||
TagPtr ThemeDict = NULL;
|
||||
CHAR8 *ChosenTheme = NULL;
|
||||
CHAR16 *TestTheme = NULL;
|
||||
UINTN Rnd;
|
||||
|
||||
DbgHeader("InitXTheme");
|
||||
ThemeX.Init();
|
||||
|
||||
if (DayLight) {
|
||||
DBG("use daylight theme\n");
|
||||
} else {
|
||||
DBG("use night theme\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
// DBG("validate %d face\n", i);
|
||||
textFace[i].valid = FALSE;
|
||||
}
|
||||
|
||||
NSVGfontChain *fontChain = fontsDB;
|
||||
while (fontChain) {
|
||||
NSVGfont *font = fontChain->font;
|
||||
// DBG("free font %s\n", font->fontFamily);
|
||||
NSVGfontChain *nextChain = fontChain->next;
|
||||
if (font) {
|
||||
nsvg__deleteFont(font);
|
||||
fontChain->font = NULL;
|
||||
}
|
||||
FreePool(fontChain);
|
||||
fontChain = nextChain;
|
||||
}
|
||||
//as all font freed then free the chain
|
||||
fontsDB = NULL;
|
||||
|
||||
/*
|
||||
if (mainParser) {
|
||||
nsvg__deleteParser(mainParser);
|
||||
DBG("parser deleted\n");
|
||||
mainParser = NULL;
|
||||
}
|
||||
*/
|
||||
//TODO switch to XImage
|
||||
if (FontImage != NULL) {
|
||||
// DBG("free font image\n"); //raster font
|
||||
egFreeImage (FontImage);
|
||||
FontImage = NULL;
|
||||
}
|
||||
|
||||
Rnd = ((Time != NULL) && (ThemesNum != 0)) ? Time->Second % ThemesNum : 0;
|
||||
|
||||
//TODO remake GuiAnime
|
||||
while (GuiAnime != NULL) {
|
||||
GUI_ANIME *NextAnime = GuiAnime->Next;
|
||||
// DBG("free anime %d\n", GuiAnime->ID);
|
||||
FreeAnime (GuiAnime);
|
||||
GuiAnime = NextAnime;
|
||||
}
|
||||
// DBG("...done\n");
|
||||
ThemeX.GetThemeTagSettings(NULL);
|
||||
|
||||
if (ThemesNum > 0) {
|
||||
// Try special theme first
|
||||
if (Time != NULL) {
|
||||
if ((Time->Month == 12) && ((Time->Day >= 25) && (Time->Day <= 31))) {
|
||||
TestTheme = PoolPrint (L"christmas");
|
||||
} else if ((Time->Month == 1) && ((Time->Day >= 1) && (Time->Day <= 3))) {
|
||||
TestTheme = PoolPrint (L"newyear");
|
||||
}
|
||||
|
||||
if (TestTheme != NULL) {
|
||||
ThemeDict = LoadTheme (TestTheme);
|
||||
if (ThemeDict != NULL) {
|
||||
DBG ("special theme %ls found and %ls parsed\n", TestTheme, CONFIG_THEME_FILENAME);
|
||||
ThemeX.Theme.takeValueFrom(TestTheme);
|
||||
} else { // special theme not loaded
|
||||
DBG ("special theme %ls not found, skipping\n", TestTheme/*, CONFIG_THEME_FILENAME*/);
|
||||
FreePool (TestTheme);
|
||||
}
|
||||
TestTheme = NULL;
|
||||
}
|
||||
}
|
||||
// Try theme from nvram
|
||||
if (ThemeDict == NULL && UseThemeDefinedInNVRam) {
|
||||
ChosenTheme = (__typeof__(ChosenTheme))GetNvramVariable(L"Clover.Theme", &gEfiAppleBootGuid, NULL, &Size);
|
||||
if (ChosenTheme != NULL) {
|
||||
if (AsciiStrCmp (ChosenTheme, "embedded") == 0) {
|
||||
goto finish;
|
||||
}
|
||||
if (AsciiStrCmp (ChosenTheme, "random") == 0) {
|
||||
ThemeDict = LoadTheme (ThemesList[Rnd]);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
TestTheme = PoolPrint (L"%a", ChosenTheme);
|
||||
if (TestTheme != NULL) {
|
||||
ThemeDict = LoadTheme (TestTheme);
|
||||
if (ThemeDict != NULL) {
|
||||
DBG ("theme %s defined in NVRAM found and %ls parsed\n", ChosenTheme, CONFIG_THEME_FILENAME);
|
||||
ThemeX.Theme.takeValueFrom(TestTheme);
|
||||
} else { // theme from nvram not loaded
|
||||
if (!ThemeX.Theme.isEmpty()) {
|
||||
DBG ("theme %s chosen from nvram is absent, using theme defined in config: %ls\n", ChosenTheme, ThemeX.Theme.data());
|
||||
} else {
|
||||
DBG ("theme %s chosen from nvram is absent, get first theme\n", ChosenTheme);
|
||||
}
|
||||
FreePool (TestTheme);
|
||||
}
|
||||
TestTheme = NULL;
|
||||
}
|
||||
FreePool (ChosenTheme);
|
||||
ChosenTheme = NULL;
|
||||
}
|
||||
}
|
||||
// Try to get theme from settings
|
||||
if (ThemeDict == NULL) {
|
||||
if (ThemeX.Theme.isEmpty()) {
|
||||
if (Time != NULL) {
|
||||
DBG ("no default theme, get random theme %ls\n", ThemesList[Rnd]);
|
||||
} else {
|
||||
DBG ("no default theme, get first theme %ls\n", ThemesList[0]);
|
||||
}
|
||||
} else {
|
||||
if (StriCmp(ThemeX.Theme.data(), L"random") == 0) {
|
||||
ThemeDict = LoadTheme (ThemesList[Rnd]);
|
||||
} else {
|
||||
ThemeDict = LoadTheme (ThemeX.Theme.data());
|
||||
if (ThemeDict == NULL) {
|
||||
DBG ("GlobalConfig: %ls not found, get embedded theme\n", ThemeX.Theme.data());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // ThemesNum>0
|
||||
|
||||
finish:
|
||||
if (!ThemeDict) { // No theme could be loaded, use embedded
|
||||
DBG (" using embedded theme\n");
|
||||
ThemeX.Init();
|
||||
OldChosenTheme = 0xFFFF;
|
||||
if (ThemePath != NULL) {
|
||||
FreePool (ThemePath);
|
||||
ThemePath = NULL;
|
||||
}
|
||||
|
||||
if (ThemeDir != NULL) {
|
||||
ThemeDir->Close (ThemeDir);
|
||||
ThemeDir = NULL;
|
||||
}
|
||||
|
||||
ThemeX.GetThemeTagSettings(NULL);
|
||||
//fill some fields
|
||||
ThemeX.Font = FONT_ALFA; //to be inverted later. At start we have FONT_GRAY
|
||||
|
||||
Status = StartupSoundPlay(ThemeDir, NULL);
|
||||
} else { // theme loaded successfully
|
||||
// read theme settings
|
||||
if (!ThemeX.TypeSVG) {
|
||||
TagPtr DictPointer = GetProperty(ThemeDict, "Theme");
|
||||
if (DictPointer != NULL) {
|
||||
Status = ThemeX.GetThemeTagSettings((void*)DictPointer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DBG ("Config theme error: %s\n", strerror(Status));
|
||||
}
|
||||
}
|
||||
}
|
||||
FreeTag(ThemeDict);
|
||||
|
||||
if (!DayLight) {
|
||||
Status = StartupSoundPlay(ThemeDir, L"sound_night.wav");
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = StartupSoundPlay(ThemeDir, L"sound.wav");
|
||||
}
|
||||
} else {
|
||||
Status = StartupSoundPlay(ThemeDir, L"sound.wav");
|
||||
}
|
||||
|
||||
}
|
||||
for (i = 0; i < ThemesNum; i++) {
|
||||
if (!ThemeX.Theme.isEmpty() && StriCmp(ThemeX.Theme.data(), ThemesList[i]) == 0) {
|
||||
OldChosenTheme = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ChosenTheme != NULL) {
|
||||
FreePool (ChosenTheme);
|
||||
}
|
||||
PrepareFont();
|
||||
return Status;
|
||||
}
|
||||
|
||||
#else
|
||||
EFI_STATUS
|
||||
InitTheme(
|
||||
BOOLEAN UseThemeDefinedInNVRam,
|
||||
@ -4336,14 +4937,14 @@ InitTheme(
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
// DBG("validate %d face\n", i);
|
||||
// DBG("validate %d face\n", i);
|
||||
textFace[i].valid = FALSE;
|
||||
}
|
||||
// DBG("...done\n");
|
||||
// DBG("...done\n");
|
||||
NSVGfontChain *fontChain = fontsDB;
|
||||
while (fontChain) {
|
||||
NSVGfont *font = fontChain->font;
|
||||
// DBG("free font %s\n", font->fontFamily);
|
||||
// DBG("free font %s\n", font->fontFamily);
|
||||
NSVGfontChain *nextChain = fontChain->next;
|
||||
if (font) {
|
||||
nsvg__deleteFont(font);
|
||||
@ -4356,16 +4957,16 @@ InitTheme(
|
||||
fontsDB = NULL;
|
||||
|
||||
/*
|
||||
if (mainParser) {
|
||||
nsvg__deleteParser(mainParser);
|
||||
DBG("parser deleted\n");
|
||||
mainParser = NULL;
|
||||
}
|
||||
*/
|
||||
if (mainParser) {
|
||||
nsvg__deleteParser(mainParser);
|
||||
DBG("parser deleted\n");
|
||||
mainParser = NULL;
|
||||
}
|
||||
*/
|
||||
row0TileSize = 144;
|
||||
row1TileSize = 64;
|
||||
if (FontImage != NULL) {
|
||||
// DBG("free font image\n"); //raster font
|
||||
// DBG("free font image\n"); //raster font
|
||||
egFreeImage (FontImage);
|
||||
FontImage = NULL;
|
||||
}
|
||||
@ -4374,7 +4975,7 @@ InitTheme(
|
||||
|
||||
// Free selection images which are not builtin icons
|
||||
for (i = 0; i < 6; i++) {
|
||||
// DBG("free selection %d\n", i);
|
||||
// DBG("free selection %d\n", i);
|
||||
if (SelectionImages[i] != NULL) {
|
||||
if ((SelectionImages[i] != BuiltinIconTable[BUILTIN_SELECTION_SMALL].Image) &&
|
||||
(SelectionImages[i] != BuiltinIconTable[BUILTIN_SELECTION_BIG].Image)) {
|
||||
@ -4383,46 +4984,46 @@ InitTheme(
|
||||
SelectionImages[i] = NULL;
|
||||
}
|
||||
}
|
||||
// DBG("...done\n");
|
||||
// DBG("...done\n");
|
||||
// Free banner which is not builtin icon
|
||||
if (Banner != NULL) {
|
||||
if (Banner != BuiltinIconTable[BUILTIN_ICON_BANNER].Image) {
|
||||
// DBG("free banner\n");
|
||||
// DBG("free banner\n");
|
||||
egFreeImage (Banner);
|
||||
}
|
||||
Banner = NULL;
|
||||
}
|
||||
// DBG("...done\n");
|
||||
// DBG("...done\n");
|
||||
//Free buttons images
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (Buttons[i] != NULL) {
|
||||
// DBG("free button %d\n", i);
|
||||
// DBG("free button %d\n", i);
|
||||
egFreeImage(Buttons[i]);
|
||||
Buttons[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Kill mouse before we invalidate builtin pointer image
|
||||
// KillMouse();
|
||||
// KillMouse();
|
||||
//here we have no access to Mouse
|
||||
|
||||
// Invalidate BuiltinIcons
|
||||
// DBG ("Invalidating BuiltinIcons...\n");
|
||||
// DBG ("Invalidating BuiltinIcons...\n");
|
||||
for (i = 0; i < BUILTIN_ICON_COUNT; i++) {
|
||||
if (BuiltinIconTable[i].Image != NULL) {
|
||||
// DBG("free builtin image %d\n", i);
|
||||
// DBG("free builtin image %d\n", i);
|
||||
egFreeImage (BuiltinIconTable[i].Image);
|
||||
BuiltinIconTable[i].Image = NULL;
|
||||
}
|
||||
}
|
||||
// DBG("...done\n");
|
||||
// DBG("...done\n");
|
||||
while (GuiAnime != NULL) {
|
||||
GUI_ANIME *NextAnime = GuiAnime->Next;
|
||||
// DBG("free anime %d\n", GuiAnime->ID);
|
||||
// DBG("free anime %d\n", GuiAnime->ID);
|
||||
FreeAnime (GuiAnime);
|
||||
GuiAnime = NextAnime;
|
||||
}
|
||||
// DBG("...done\n");
|
||||
// DBG("...done\n");
|
||||
GetThemeTagSettings(NULL);
|
||||
|
||||
if (ThemesNum > 0 &&
|
||||
@ -4438,13 +5039,13 @@ InitTheme(
|
||||
if (TestTheme != NULL) {
|
||||
ThemeDict = LoadTheme (TestTheme);
|
||||
if (ThemeDict != NULL) {
|
||||
DBG ("special theme %ls found and %ls parsed\n", TestTheme, CONFIG_THEME_FILENAME);
|
||||
DBG ("special theme %ls found and %ls parsed\n", TestTheme, CONFIG_THEME_FILENAME);
|
||||
if (GlobalConfig.Theme) {
|
||||
FreePool (GlobalConfig.Theme);
|
||||
}
|
||||
GlobalConfig.Theme = TestTheme;
|
||||
} else { // special theme not loaded
|
||||
DBG ("special theme %ls not found, skipping\n", TestTheme/*, CONFIG_THEME_FILENAME*/);
|
||||
DBG ("special theme %ls not found, skipping\n", TestTheme/*, CONFIG_THEME_FILENAME*/);
|
||||
FreePool (TestTheme);
|
||||
}
|
||||
TestTheme = NULL;
|
||||
@ -4531,7 +5132,7 @@ finish:
|
||||
GlobalConfig.CharWidth = 9;
|
||||
GlobalConfig.HideBadges = HDBADGES_SHOW;
|
||||
GlobalConfig.BadgeScale = 16;
|
||||
Status = StartupSoundPlay(ThemeDir, NULL);
|
||||
Status = StartupSoundPlay(ThemeDir, NULL);
|
||||
} else { // theme loaded successfully
|
||||
// read theme settings
|
||||
if (!GlobalConfig.TypeSVG) {
|
||||
@ -4568,6 +5169,8 @@ finish:
|
||||
return Status;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
VOID
|
||||
ParseSMBIOSSettings(
|
||||
TagPtr DictPointer
|
||||
|
@ -123,21 +123,40 @@ BOOLEAN AddLegacyEntry(IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle,
|
||||
if (FullTitle) {
|
||||
Entry->Title.takeValueFrom(FullTitle);
|
||||
} else {
|
||||
#if USE_XTHEME
|
||||
if (ThemeX.BootCampStyle) {
|
||||
Entry->Title.takeValueFrom(LoaderTitle);
|
||||
} else {
|
||||
Entry->Title.SPrintf("Boot %ls from %ls", LoaderTitle, VolDesc);
|
||||
}
|
||||
#else
|
||||
if (GlobalConfig.BootCampStyle) {
|
||||
Entry->Title.takeValueFrom(LoaderTitle);
|
||||
} else {
|
||||
Entry->Title.SPrintf("Boot %ls from %ls", LoaderTitle, VolDesc);
|
||||
Entry->Title.SPrintf("Boot %ls from %ls", LoaderTitle, VolDesc);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
// DBG("Title=%ls\n", Entry->Title);
|
||||
// Entry->Tag = TAG_LEGACY;
|
||||
Entry->Row = 0;
|
||||
Entry->ShortcutLetter = (Hotkey == 0) ? ShortcutLetter : Hotkey;
|
||||
|
||||
#if USE_XTHEME
|
||||
if (Image) {
|
||||
Entry->Image.FromEGImage(Image);
|
||||
} else {
|
||||
Entry->Image = ThemeX.GetIcon(Volume->LegacyOS->IconName);
|
||||
}
|
||||
#else
|
||||
if (Image) {
|
||||
Entry->Image = Image;
|
||||
} else {
|
||||
Entry->Image = LoadOSIcon(Volume->LegacyOS->IconName, L"legacy", 128, FALSE, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
// DBG("IconName=%ls\n", Volume->LegacyOS->IconName);
|
||||
Entry->DriveImage = (DriveImage != NULL) ? DriveImage : ScanVolumeDefaultIcon(Volume, Volume->LegacyOS->Type, Volume->DevicePath);
|
||||
// DBG("HideBadges=%d Volume=%ls\n", GlobalConfig.HideBadges, Volume->VolName);
|
||||
|
@ -134,7 +134,7 @@ void XTheme::Init()
|
||||
BadgeScale = 4; // TODO now we have float scale = BadgeScale/16
|
||||
ThemeDesignWidth = 0xFFFF;
|
||||
ThemeDesignHeight = 0xFFFF;
|
||||
BannerPosX = 0xFFFF;
|
||||
BannerPosX = 0xFFFF; // the value out of range [0,1000]
|
||||
BannerPosY = 0xFFFF;
|
||||
BannerEdgeHorizontal = 0;
|
||||
BannerEdgeVertical = 0;
|
||||
@ -156,6 +156,13 @@ void XTheme::Init()
|
||||
CentreShift = 0.0f;
|
||||
Daylight = true;
|
||||
LayoutHeight = 376;
|
||||
LayoutBannerOffset = 64; //default value if not set
|
||||
LayoutButtonOffset = 0; //default value if not set
|
||||
LayoutTextOffset = 0; //default value if not set
|
||||
LayoutAnimMoveForMenuX = 0; //default value if not set
|
||||
|
||||
row0TileSize = 144;
|
||||
row1TileSize = 64;
|
||||
}
|
||||
|
||||
XImage& XTheme::GetIcon(const char* Name)
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "libeg.h"
|
||||
#include "XImage.h"
|
||||
#include "nanosvg.h"
|
||||
|
||||
#define INDICATOR_SIZE (52)
|
||||
|
||||
@ -45,7 +46,7 @@ public:
|
||||
XStringW DefaultSelection;
|
||||
XStringW BackgroundName;
|
||||
SCALING BackgroundScale;
|
||||
UINTN BackgroundSharp;
|
||||
INTN BackgroundSharp;
|
||||
BOOLEAN BackgroundDark;
|
||||
BOOLEAN CustomIcons;
|
||||
BOOLEAN SelectionOnTop;
|
||||
@ -79,6 +80,11 @@ public:
|
||||
INTN row1TileSize;
|
||||
UINTN BanHeight;
|
||||
INTN LayoutHeight; //it was 376 before
|
||||
INTN LayoutBannerOffset;
|
||||
INTN LayoutButtonOffset;
|
||||
INTN LayoutTextOffset;
|
||||
INTN LayoutAnimMoveForMenuX;
|
||||
|
||||
BOOLEAN Daylight;
|
||||
|
||||
XImage Background; //Background and Banner will not be in array as they live own life
|
||||
@ -103,6 +109,8 @@ public:
|
||||
void AddIcon(Icon& NewIcon); //return EFI_STATUS?
|
||||
void FillByEmbedded();
|
||||
void FillByDir();
|
||||
EFI_STATUS GetThemeTagSettings (void* DictPointer);
|
||||
void parseTheme(NSVGparser* p, const char** dict); //in nano project
|
||||
|
||||
//screen operations
|
||||
void ClearScreen();
|
||||
|
@ -3475,6 +3475,80 @@ static void nsvg__parseGroup(NSVGparser* p, const char** dict)
|
||||
}
|
||||
|
||||
//parse Clover settings for theme
|
||||
#if USE_XTHEME
|
||||
void XTheme::parseTheme(NSVGparser* p, const char** dict)
|
||||
{
|
||||
int i;
|
||||
BOOLEAN found = FALSE;
|
||||
UINT32 Color = 0x80808080; //default value
|
||||
for (i = 0; dict[i]; i += 2) {
|
||||
if (strcmp(dict[i], "SelectionOnTop") == 0) {
|
||||
SelectionOnTop = getIntegerDict(dict[i+1])>0;
|
||||
} else if (strcmp(dict[i], "BadgeOffsetX") == 0) {
|
||||
BadgeOffsetX = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "BadgeOffsetY") == 0) {
|
||||
BadgeOffsetY = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "NonSelectedGrey") == 0) {
|
||||
NonSelectedGrey = getIntegerDict(dict[i + 1])>0;
|
||||
} else if (strcmp(dict[i], "CharWidth") == 0) {
|
||||
CharWidth = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "BackgroundDark") == 0) {
|
||||
BackgroundDark = getIntegerDict(dict[i + 1])>0;
|
||||
} else if (strcmp(dict[i], "BackgroundSharp") == 0) {
|
||||
BackgroundSharp = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "BackgroundScale") == 0) {
|
||||
BackgroundScale = imNone;
|
||||
if (strstr(dict[i+1], "scale") != NULL) {
|
||||
BackgroundScale = imScale;
|
||||
}
|
||||
if (strstr(dict[i+1], "crop") != NULL) {
|
||||
BackgroundScale = imCrop;
|
||||
}
|
||||
if (strstr(dict[i+1], "tile") != NULL) {
|
||||
BackgroundScale = imTile;
|
||||
}
|
||||
} else if (strcmp(dict[i], "Badges") == 0) {
|
||||
HideBadges = 0;
|
||||
if (strstr(dict[i+1], "show") != NULL) {
|
||||
HideBadges |= HDBADGES_SHOW;
|
||||
}
|
||||
if (strstr(dict[i+1], "swap") != NULL) {
|
||||
HideBadges |= HDBADGES_SWAP;
|
||||
}
|
||||
if (strstr(dict[i+1], "inline") != NULL) {
|
||||
HideBadges |= HDBADGES_INLINE;
|
||||
}
|
||||
} else if (strcmp(dict[i], "BadgeScale") == 0) {
|
||||
BadgeScale = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "SelectionColor") == 0) {
|
||||
Color = getIntegerDict(dict[i + 1]);
|
||||
if (DayLight) {
|
||||
SelectionColor = Color;
|
||||
}
|
||||
} else if (strcmp(dict[i], "SelectionColor_night") == 0) {
|
||||
found = TRUE;
|
||||
if (!DayLight) {
|
||||
SelectionColor = getIntegerDict(dict[i + 1]);
|
||||
}
|
||||
} else if (strcmp(dict[i], "VerticalLayout") == 0) {
|
||||
VerticalLayout = getIntegerDict(dict[i + 1]) > 0;
|
||||
} else if (strcmp(dict[i], "BootCampStyle") == 0) {
|
||||
BootCampStyle = getIntegerDict(dict[i + 1])>0;
|
||||
} else if (strcmp(dict[i], "AnimeFrames") == 0) {
|
||||
NumFrames = getIntegerDict(dict[i + 1]);
|
||||
if (NumFrames == 0xFFFF) {
|
||||
NumFrames = 0;
|
||||
}
|
||||
} else if (strcmp(dict[i], "FrameTime") == 0) {
|
||||
FrameTime = getIntegerDict(dict[i + 1]);
|
||||
} else nsvg__parseAttr(p, dict[i], dict[i + 1]);
|
||||
}
|
||||
if (!found) {
|
||||
SelectionColor = Color;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
static void parseTheme(NSVGparser* p, const char** dict)
|
||||
{
|
||||
int i;
|
||||
@ -3483,71 +3557,73 @@ static void parseTheme(NSVGparser* p, const char** dict)
|
||||
for (i = 0; dict[i]; i += 2) {
|
||||
if (strcmp(dict[i], "SelectionOnTop") == 0) {
|
||||
GlobalConfig.SelectionOnTop = getIntegerDict(dict[i+1])>0; } else if (strcmp(dict[i], "BadgeOffsetX") == 0) {
|
||||
GlobalConfig.BadgeOffsetX = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "BadgeOffsetY") == 0) {
|
||||
GlobalConfig.BadgeOffsetY = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "NonSelectedGrey") == 0) {
|
||||
GlobalConfig.NonSelectedGrey = getIntegerDict(dict[i + 1])>0; } else if (strcmp(dict[i], "CharWidth") == 0) {
|
||||
GlobalConfig.CharWidth = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "BackgroundDark") == 0) {
|
||||
GlobalConfig.BackgroundDark = getIntegerDict(dict[i + 1])>0; } else if (strcmp(dict[i], "BackgroundSharp") == 0) {
|
||||
GlobalConfig.BackgroundSharp = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "BackgroundScale") == 0) {
|
||||
GlobalConfig.BackgroundScale = imNone;
|
||||
if (strstr(dict[i+1], "scale") != NULL) {
|
||||
GlobalConfig.BackgroundScale = imScale;
|
||||
}
|
||||
if (strstr(dict[i+1], "crop") != NULL) {
|
||||
GlobalConfig.BackgroundScale = imCrop;
|
||||
}
|
||||
if (strstr(dict[i+1], "tile") != NULL) {
|
||||
GlobalConfig.BackgroundScale = imTile;
|
||||
}
|
||||
GlobalConfig.BadgeOffsetX = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "BadgeOffsetY") == 0) {
|
||||
GlobalConfig.BadgeOffsetY = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "NonSelectedGrey") == 0) {
|
||||
GlobalConfig.NonSelectedGrey = getIntegerDict(dict[i + 1])>0; } else if (strcmp(dict[i], "CharWidth") == 0) {
|
||||
GlobalConfig.CharWidth = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "BackgroundDark") == 0) {
|
||||
GlobalConfig.BackgroundDark = getIntegerDict(dict[i + 1])>0; } else if (strcmp(dict[i], "BackgroundSharp") == 0) {
|
||||
GlobalConfig.BackgroundSharp = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "BackgroundScale") == 0) {
|
||||
GlobalConfig.BackgroundScale = imNone;
|
||||
if (strstr(dict[i+1], "scale") != NULL) {
|
||||
GlobalConfig.BackgroundScale = imScale;
|
||||
}
|
||||
if (strstr(dict[i+1], "crop") != NULL) {
|
||||
GlobalConfig.BackgroundScale = imCrop;
|
||||
}
|
||||
if (strstr(dict[i+1], "tile") != NULL) {
|
||||
GlobalConfig.BackgroundScale = imTile;
|
||||
}
|
||||
|
||||
} else if (strcmp(dict[i], "Badges") == 0) {
|
||||
GlobalConfig.HideBadges = 0;
|
||||
if (strstr(dict[i+1], "show") != NULL) {
|
||||
GlobalConfig.HideBadges |= HDBADGES_SHOW;
|
||||
}
|
||||
if (strstr(dict[i+1], "swap") != NULL) {
|
||||
GlobalConfig.HideBadges |= HDBADGES_SWAP;
|
||||
}
|
||||
if (strstr(dict[i+1], "inline") != NULL) {
|
||||
GlobalConfig.HideBadges |= HDBADGES_INLINE;
|
||||
}
|
||||
} else if (strcmp(dict[i], "BadgeScale") == 0) {
|
||||
GlobalConfig.BadgeScale = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "SelectionColor") == 0) {
|
||||
Color = getIntegerDict(dict[i + 1]);
|
||||
if (DayLight) {
|
||||
GlobalConfig.SelectionColor = Color;
|
||||
}
|
||||
} else if (strcmp(dict[i], "SelectionColor_night") == 0) {
|
||||
found = TRUE;
|
||||
if (!DayLight) {
|
||||
GlobalConfig.SelectionColor = getIntegerDict(dict[i + 1]);
|
||||
}
|
||||
} else if (strcmp(dict[i], "VerticalLayout") == 0) {
|
||||
GlobalConfig.VerticalLayout = getIntegerDict(dict[i + 1])>0;
|
||||
} else if (strcmp(dict[i], "Badges") == 0) {
|
||||
GlobalConfig.HideBadges = 0;
|
||||
if (strstr(dict[i+1], "show") != NULL) {
|
||||
GlobalConfig.HideBadges |= HDBADGES_SHOW;
|
||||
}
|
||||
if (strstr(dict[i+1], "swap") != NULL) {
|
||||
GlobalConfig.HideBadges |= HDBADGES_SWAP;
|
||||
}
|
||||
if (strstr(dict[i+1], "inline") != NULL) {
|
||||
GlobalConfig.HideBadges |= HDBADGES_INLINE;
|
||||
}
|
||||
} else if (strcmp(dict[i], "BadgeScale") == 0) {
|
||||
GlobalConfig.BadgeScale = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "SelectionColor") == 0) {
|
||||
Color = getIntegerDict(dict[i + 1]);
|
||||
if (DayLight) {
|
||||
GlobalConfig.SelectionColor = Color;
|
||||
}
|
||||
} else if (strcmp(dict[i], "SelectionColor_night") == 0) {
|
||||
found = TRUE;
|
||||
if (!DayLight) {
|
||||
GlobalConfig.SelectionColor = getIntegerDict(dict[i + 1]);
|
||||
}
|
||||
} else if (strcmp(dict[i], "VerticalLayout") == 0) {
|
||||
GlobalConfig.VerticalLayout = getIntegerDict(dict[i + 1])>0;
|
||||
|
||||
} else if (strcmp(dict[i], "BootCampStyle") == 0) {
|
||||
GlobalConfig.BootCampStyle = getIntegerDict(dict[i + 1])>0;
|
||||
} else if (strcmp(dict[i], "BootCampStyle") == 0) {
|
||||
GlobalConfig.BootCampStyle = getIntegerDict(dict[i + 1])>0;
|
||||
|
||||
} else if (strcmp(dict[i], "AnimeFrames") == 0) {
|
||||
NumFrames = getIntegerDict(dict[i + 1]);
|
||||
if (NumFrames == 0xFFFF) {
|
||||
NumFrames = 0;
|
||||
}
|
||||
} else if (strcmp(dict[i], "FrameTime") == 0) {
|
||||
FrameTime = getIntegerDict(dict[i + 1]);
|
||||
} else if (strcmp(dict[i], "AnimeFrames") == 0) {
|
||||
NumFrames = getIntegerDict(dict[i + 1]);
|
||||
if (NumFrames == 0xFFFF) {
|
||||
NumFrames = 0;
|
||||
}
|
||||
} else if (strcmp(dict[i], "FrameTime") == 0) {
|
||||
FrameTime = getIntegerDict(dict[i + 1]);
|
||||
|
||||
} else nsvg__parseAttr(p, dict[i], dict[i + 1]);
|
||||
} else nsvg__parseAttr(p, dict[i], dict[i + 1]);
|
||||
}
|
||||
if (!found) {
|
||||
GlobalConfig.SelectionColor = Color;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// parse embedded font
|
||||
static void nsvg__parseFont(NSVGparser* p, const char** dict)
|
||||
{
|
||||
|
@ -46,6 +46,8 @@ extern "C" {
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
}
|
||||
#include "Platform.h"
|
||||
//TODO exclude intersection between libeg and platform
|
||||
#include "libeg.h"
|
||||
|
||||
#define NANOSVG_ALL_COLOR_KEYWORDS 1
|
||||
#define NSVG_RGBA(r, g, b, a) (((unsigned int)b) | ((unsigned int)g << 8) | ((unsigned int)r << 16) | ((unsigned int)a << 24))
|
||||
|
@ -693,12 +693,13 @@ extern INTN row0TileSize;
|
||||
extern INTN row1TileSize;
|
||||
extern INTN BCSMargin;
|
||||
|
||||
#if !USE_XTHEME
|
||||
extern INTN LayoutBannerOffset;
|
||||
extern INTN LayoutButtonOffset;
|
||||
extern INTN LayoutTextOffset;
|
||||
extern INTN LayoutAnimMoveForMenuX;
|
||||
extern INTN LayoutMainMenuHeight;
|
||||
|
||||
#endif
|
||||
extern UINTN ConWidth;
|
||||
extern UINTN ConHeight;
|
||||
extern CHAR16 *BlankLine;
|
||||
|
@ -88,11 +88,13 @@ extern UINT8 gLanMac[4][6]; // their MAC addresses
|
||||
extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
|
||||
|
||||
//layout must be in XTheme
|
||||
#if !USE_XTHEME
|
||||
INTN LayoutBannerOffset = 64;
|
||||
INTN LayoutButtonOffset = 0;
|
||||
INTN LayoutTextOffset = 0;
|
||||
INTN LayoutMainMenuHeight = 376;
|
||||
INTN LayoutAnimMoveForMenuX = 0;
|
||||
#endif
|
||||
|
||||
BOOLEAN SavePreBootLog = FALSE;
|
||||
|
||||
@ -4808,16 +4810,17 @@ VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16
|
||||
/**
|
||||
* Main screen text.
|
||||
*/
|
||||
#if USE_XTHEME
|
||||
VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
INTN i = 0;
|
||||
INTN MessageHeight = 0;
|
||||
// clovy
|
||||
if (GlobalConfig.TypeSVG && textFace[1].valid) {
|
||||
MessageHeight = (INTN)(textFace[1].size * RowHeightFromTextHeight * GlobalConfig.Scale);
|
||||
if (ThemeX.TypeSVG && textFace[1].valid) {
|
||||
MessageHeight = (INTN)(textFace[1].size * RowHeightFromTextHeight * ThemeX.Scale);
|
||||
} else {
|
||||
MessageHeight = (INTN)(TextHeight * RowHeightFromTextHeight * GlobalConfig.Scale);
|
||||
MessageHeight = (INTN)(TextHeight * RowHeightFromTextHeight * ThemeX.Scale);
|
||||
}
|
||||
|
||||
switch (Function) {
|
||||
@ -4828,6 +4831,208 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
SwitchToGraphicsAndClear();
|
||||
//BltClearScreen(FALSE);
|
||||
|
||||
EntriesGap = (int)(ThemeX.TileXSpace * ThemeX.Scale);
|
||||
EntriesWidth = ThemeX.row0TileSize;
|
||||
EntriesHeight = ThemeX.MainEntriesSize + (int)(16.f * ThemeX.Scale);
|
||||
|
||||
MaxItemOnScreen = (UGAWidth - (int)((ROW0_SCROLLSIZE * 2)* ThemeX.Scale)) / (EntriesWidth + EntriesGap); //8
|
||||
CountItems();
|
||||
InitScroll(row0Count, Entries.size(), MaxItemOnScreen, 0);
|
||||
|
||||
row0PosX = EntriesWidth + EntriesGap;
|
||||
row0PosX = row0PosX * ((MaxItemOnScreen < row0Count)?MaxItemOnScreen:row0Count);
|
||||
row0PosX = row0PosX - EntriesGap;
|
||||
row0PosX = UGAWidth - row0PosX;
|
||||
row0PosX = row0PosX >> 1;
|
||||
|
||||
row0PosY = (int)(((float)UGAHeight - ThemeX.LayoutHeight * ThemeX.Scale) * 0.5f +
|
||||
ThemeX.LayoutBannerOffset * ThemeX.Scale);
|
||||
|
||||
row1PosX = (UGAWidth + 8 - (ThemeX.row1TileSize + (INTN)(8.0f * ThemeX.Scale)) * row1Count) >> 1;
|
||||
|
||||
if (ThemeX.BootCampStyle && !(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)) {
|
||||
row1PosY = row0PosY + ThemeX.row0TileSize + (INTN)((BCSMargin * 2) * ThemeX.Scale) + TextHeight +
|
||||
(INTN)(INDICATOR_SIZE * ThemeX.Scale) +
|
||||
(INTN)((ThemeX.LayoutButtonOffset + ThemeX.TileYSpace) * ThemeX.Scale);
|
||||
} else {
|
||||
row1PosY = row0PosY + EntriesHeight +
|
||||
(INTN)((ThemeX.TileYSpace + ThemeX.LayoutButtonOffset) * ThemeX.Scale);
|
||||
}
|
||||
|
||||
if (row1Count > 0) {
|
||||
textPosY = row1PosY + MAX(ThemeX.row1TileSize, MessageHeight) + (INTN)((ThemeX.TileYSpace + ThemeX.LayoutTextOffset) * ThemeX.Scale);
|
||||
} else {
|
||||
textPosY = row1PosY;
|
||||
}
|
||||
|
||||
if (ThemeX.BootCampStyle) {
|
||||
textPosY = row0PosY + ThemeX.row0TileSize + (INTN)((TEXT_YMARGIN + BCSMargin) * ThemeX.Scale);
|
||||
}
|
||||
|
||||
FunctextPosY = row1PosY + ThemeX.row1TileSize + (INTN)((ThemeX.TileYSpace + ThemeX.LayoutTextOffset) * ThemeX.Scale);
|
||||
|
||||
if (!itemPosX) {
|
||||
itemPosX = (__typeof__(itemPosX))AllocatePool(sizeof(UINT64) * Entries.size());
|
||||
}
|
||||
|
||||
row0PosXRunning = row0PosX;
|
||||
row1PosXRunning = row1PosX;
|
||||
//DBG("EntryCount =%d\n", Entries.size());
|
||||
for (INTN i = 0; i < (INTN)Entries.size(); i++) {
|
||||
if (Entries[i].Row == 0) {
|
||||
itemPosX[i] = row0PosXRunning;
|
||||
row0PosXRunning += EntriesWidth + EntriesGap;
|
||||
} else {
|
||||
itemPosX[i] = row1PosXRunning;
|
||||
row1PosXRunning += row1TileSize + (INTN)(TILE1_XSPACING * ThemeX.Scale);
|
||||
//DBG("next item in row1 at x=%d\n", row1PosXRunning);
|
||||
}
|
||||
}
|
||||
// initial painting
|
||||
ThemeX.InitSelection();
|
||||
|
||||
// Update FilmPlace only if not set by InitAnime
|
||||
if (FilmPlace.Width == 0 || FilmPlace.Height == 0) {
|
||||
CopyMem(&FilmPlace, &BannerPlace, sizeof(BannerPlace));
|
||||
}
|
||||
|
||||
//DBG("main menu inited\n");
|
||||
break;
|
||||
|
||||
case MENU_FUNCTION_CLEANUP:
|
||||
FreePool(itemPosX);
|
||||
itemPosX = NULL;
|
||||
HidePointer();
|
||||
break;
|
||||
|
||||
case MENU_FUNCTION_PAINT_ALL:
|
||||
|
||||
for (i = 0; i <= ScrollState.MaxIndex; i++) {
|
||||
if (Entries[i].Row == 0) {
|
||||
if ((i >= ScrollState.FirstVisible) && (i <= ScrollState.LastVisible)) {
|
||||
DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?1:0,
|
||||
itemPosX[i - ScrollState.FirstVisible], row0PosY);
|
||||
// draw static text for the boot options, BootCampStyle
|
||||
|
||||
if (ThemeX.BootCampStyle && !(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)) {
|
||||
INTN textPosX = itemPosX[i - ScrollState.FirstVisible] + (row0TileSize / 2);
|
||||
// clear the screen
|
||||
|
||||
ThemeX.FillRectAreaOfScreen(textPosX, textPosY, EntriesWidth + GlobalConfig.TileXSpace,
|
||||
MessageHeight);
|
||||
DrawBCSText(Entries[i].Title, textPosX, textPosY, X_IS_CENTER);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?1:0,
|
||||
itemPosX[i], row1PosY);
|
||||
}
|
||||
}
|
||||
|
||||
// clear the text from the second row, required by the BootCampStyle
|
||||
if ((ThemeX.BootCampStyle) && (Entries[ScrollState.LastSelection].Row == 1)
|
||||
&& (Entries[ScrollState.CurrentSelection].Row == 0) && !(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)) {
|
||||
ThemeX.FillRectAreaOfScreen((UGAWidth >> 1), FunctextPosY,
|
||||
OldTextWidth, MessageHeight);
|
||||
}
|
||||
|
||||
if ((Entries[ScrollState.LastSelection].Row == 0) && (Entries[ScrollState.CurrentSelection].Row == 1)
|
||||
&& ThemeX.BootCampStyle && !(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)) {
|
||||
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
|
||||
(UGAWidth >> 1), FunctextPosY);
|
||||
}
|
||||
if (!(ThemeX.BootCampStyle) && !(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)) {
|
||||
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
|
||||
(UGAWidth >> 1), textPosY);
|
||||
}
|
||||
|
||||
DrawTextCorner(TEXT_CORNER_HELP, X_IS_LEFT);
|
||||
DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER);
|
||||
DrawTextCorner(TEXT_CORNER_REVISION, X_IS_RIGHT);
|
||||
Status = MouseBirth();
|
||||
if(EFI_ERROR(Status)) {
|
||||
DBG("can't bear mouse at all! Status=%s\n", strerror(Status));
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_FUNCTION_PAINT_SELECTION:
|
||||
HidePointer();
|
||||
if (Entries[ScrollState.LastSelection].Row == 0) {
|
||||
DrawMainMenuEntry(&Entries[ScrollState.LastSelection], FALSE,
|
||||
itemPosX[ScrollState.LastSelection - ScrollState.FirstVisible], row0PosY);
|
||||
} else {
|
||||
DrawMainMenuEntry(&Entries[ScrollState.LastSelection], FALSE,
|
||||
itemPosX[ScrollState.LastSelection], row1PosY);
|
||||
}
|
||||
|
||||
if (Entries[ScrollState.CurrentSelection].Row == 0) {
|
||||
DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], TRUE,
|
||||
itemPosX[ScrollState.CurrentSelection - ScrollState.FirstVisible], row0PosY);
|
||||
} else {
|
||||
DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], TRUE,
|
||||
itemPosX[ScrollState.CurrentSelection], row1PosY);
|
||||
}
|
||||
|
||||
if ((ThemeX.BootCampStyle) && (!(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL))
|
||||
&& Entries[ScrollState.CurrentSelection].Row == 1) {
|
||||
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
|
||||
(UGAWidth >> 1), FunctextPosY);
|
||||
}
|
||||
if ((!(ThemeX.BootCampStyle)) && (!(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL))) {
|
||||
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
|
||||
(UGAWidth >> 1), textPosY);
|
||||
}
|
||||
|
||||
DrawTextCorner(TEXT_CORNER_HELP, X_IS_LEFT);
|
||||
DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER);
|
||||
DrawTextCorner(TEXT_CORNER_REVISION, X_IS_RIGHT);
|
||||
Status = MouseBirth();
|
||||
if(EFI_ERROR(Status)) {
|
||||
DBG("can't bear mouse at sel! Status=%s\n", strerror(Status));
|
||||
}
|
||||
break;
|
||||
|
||||
case MENU_FUNCTION_PAINT_TIMEOUT:
|
||||
i = (ThemeX.HideBadges & HDBADGES_INLINE)?3:1;
|
||||
HidePointer();
|
||||
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)){
|
||||
ThemeX.FillRectAreaOfScreen((UGAWidth >> 1), FunctextPosY + MessageHeight * i,
|
||||
OldTimeoutTextWidth, MessageHeight);
|
||||
OldTimeoutTextWidth = DrawTextXY(XStringW().takeValueFrom(ParamText), (UGAWidth >> 1), FunctextPosY + MessageHeight * i, X_IS_CENTER);
|
||||
}
|
||||
|
||||
DrawTextCorner(TEXT_CORNER_HELP, X_IS_LEFT);
|
||||
DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER);
|
||||
DrawTextCorner(TEXT_CORNER_REVISION, X_IS_RIGHT);
|
||||
Status = MouseBirth();
|
||||
if(EFI_ERROR(Status)) {
|
||||
DBG("can't bear mouse at timeout! Status=%s\n", strerror(Status));
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
#else
|
||||
VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText)
|
||||
{
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
INTN i = 0;
|
||||
INTN MessageHeight = 0;
|
||||
// clovy
|
||||
if (GlobalConfig.TypeSVG && textFace[1].valid) {
|
||||
MessageHeight = (INTN)(textFace[1].size * RowHeightFromTextHeight * GlobalConfig.Scale);
|
||||
} else {
|
||||
MessageHeight = (INTN)(TextHeight * RowHeightFromTextHeight * GlobalConfig.Scale);
|
||||
}
|
||||
|
||||
switch (Function) {
|
||||
|
||||
case MENU_FUNCTION_INIT:
|
||||
egGetScreenSize(&UGAWidth, &UGAHeight);
|
||||
InitAnime();
|
||||
SwitchToGraphicsAndClear();
|
||||
//BltClearScreen(FALSE);
|
||||
|
||||
EntriesGap = (int)(GlobalConfig.TileXSpace * GlobalConfig.Scale);
|
||||
EntriesWidth = row0TileSize;
|
||||
EntriesHeight = GlobalConfig.MainEntriesSize + (int)(16.f * GlobalConfig.Scale);
|
||||
@ -4843,24 +5048,24 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
row0PosX = row0PosX >> 1;
|
||||
|
||||
row0PosY = (int)(((float)UGAHeight - LayoutMainMenuHeight * GlobalConfig.Scale) * 0.5f +
|
||||
LayoutBannerOffset * GlobalConfig.Scale);
|
||||
LayoutBannerOffset * GlobalConfig.Scale);
|
||||
|
||||
row1PosX = (UGAWidth + 8 - (row1TileSize + (INTN)(8.0f * GlobalConfig.Scale)) * row1Count) >> 1;
|
||||
|
||||
if (GlobalConfig.BootCampStyle && !(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) {
|
||||
row1PosY = row0PosY + row0TileSize + (INTN)((BCSMargin * 2) * GlobalConfig.Scale) + TextHeight +
|
||||
(INTN)(INDICATOR_SIZE * GlobalConfig.Scale) +
|
||||
(INTN)((LayoutButtonOffset + GlobalConfig.TileYSpace) * GlobalConfig.Scale);
|
||||
(INTN)(INDICATOR_SIZE * GlobalConfig.Scale) +
|
||||
(INTN)((LayoutButtonOffset + GlobalConfig.TileYSpace) * GlobalConfig.Scale);
|
||||
} else {
|
||||
row1PosY = row0PosY + EntriesHeight +
|
||||
(INTN)((GlobalConfig.TileYSpace + LayoutButtonOffset) * GlobalConfig.Scale);
|
||||
(INTN)((GlobalConfig.TileYSpace + LayoutButtonOffset) * GlobalConfig.Scale);
|
||||
}
|
||||
|
||||
if (row1Count > 0) {
|
||||
textPosY = row1PosY + MAX(row1TileSize, MessageHeight) + (INTN)((GlobalConfig.TileYSpace + LayoutTextOffset) * GlobalConfig.Scale);
|
||||
} else {
|
||||
textPosY = row1PosY;
|
||||
}
|
||||
textPosY = row1PosY + MAX(row1TileSize, MessageHeight) + (INTN)((GlobalConfig.TileYSpace + LayoutTextOffset) * GlobalConfig.Scale);
|
||||
} else {
|
||||
textPosY = row1PosY;
|
||||
}
|
||||
|
||||
if (GlobalConfig.BootCampStyle) {
|
||||
textPosY = row0PosY + row0TileSize + (INTN)((TEXT_YMARGIN + BCSMargin) * GlobalConfig.Scale);
|
||||
@ -4916,7 +5121,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
// clear the screen
|
||||
|
||||
ThemeX.FillRectAreaOfScreen(textPosX, textPosY, EntriesWidth + GlobalConfig.TileXSpace,
|
||||
MessageHeight);
|
||||
MessageHeight);
|
||||
DrawBCSText(Entries[i].Title, textPosX, textPosY, X_IS_CENTER);
|
||||
}
|
||||
|
||||
@ -4941,15 +5146,15 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
if ((ThemeX.BootCampStyle) && (Entries[ScrollState.LastSelection].Row == 1)
|
||||
&& (Entries[ScrollState.CurrentSelection].Row == 0) && !(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)) {
|
||||
ThemeX.FillRectAreaOfScreen((UGAWidth >> 1), FunctextPosY,
|
||||
OldTextWidth, MessageHeight);
|
||||
OldTextWidth, MessageHeight);
|
||||
}
|
||||
#else
|
||||
// clear the text from the second row, required by the BootCampStyle
|
||||
if ((GlobalConfig.BootCampStyle) && (Entries[ScrollState.LastSelection].Row == 1)
|
||||
&& (Entries[ScrollState.CurrentSelection].Row == 0) && !(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) {
|
||||
FillRectAreaOfScreen((UGAWidth >> 1), FunctextPosY,
|
||||
// clovy OldTextWidth, TextHeight, &MenuBackgroundPixel, X_IS_CENTER);
|
||||
OldTextWidth, MessageHeight, &MenuBackgroundPixel, X_IS_CENTER);
|
||||
FillRectAreaOfScreen((UGAWidth >> 1), FunctextPosY,
|
||||
// clovy OldTextWidth, TextHeight, &MenuBackgroundPixel, X_IS_CENTER);
|
||||
OldTextWidth, MessageHeight, &MenuBackgroundPixel, X_IS_CENTER);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -4967,8 +5172,8 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
#else
|
||||
if ((Entries[ScrollState.LastSelection].Row == 0) && (Entries[ScrollState.CurrentSelection].Row == 1)
|
||||
&& GlobalConfig.BootCampStyle && !(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) {
|
||||
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
|
||||
(UGAWidth >> 1), FunctextPosY);
|
||||
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
|
||||
(UGAWidth >> 1), FunctextPosY);
|
||||
}
|
||||
|
||||
// something is wrong with the DrawMainMenuLabel or Entries[ScrollState.CurrentSelection]
|
||||
@ -4976,7 +5181,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
// used for all the entries
|
||||
if (!(GlobalConfig.BootCampStyle) && !(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) {
|
||||
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
|
||||
(UGAWidth >> 1), textPosY);
|
||||
(UGAWidth >> 1), textPosY);
|
||||
}
|
||||
#endif
|
||||
DrawTextCorner(TEXT_CORNER_HELP, X_IS_LEFT);
|
||||
@ -4992,7 +5197,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
HidePointer();
|
||||
if (Entries[ScrollState.LastSelection].Row == 0) {
|
||||
DrawMainMenuEntry(&Entries[ScrollState.LastSelection], FALSE,
|
||||
itemPosX[ScrollState.LastSelection - ScrollState.FirstVisible], row0PosY);
|
||||
itemPosX[ScrollState.LastSelection - ScrollState.FirstVisible], row0PosY);
|
||||
} else {
|
||||
DrawMainMenuEntry(&Entries[ScrollState.LastSelection], FALSE,
|
||||
itemPosX[ScrollState.LastSelection], row1PosY);
|
||||
@ -5000,7 +5205,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
|
||||
if (Entries[ScrollState.CurrentSelection].Row == 0) {
|
||||
DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], TRUE,
|
||||
itemPosX[ScrollState.CurrentSelection - ScrollState.FirstVisible], row0PosY);
|
||||
itemPosX[ScrollState.CurrentSelection - ScrollState.FirstVisible], row0PosY);
|
||||
} else {
|
||||
DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], TRUE,
|
||||
itemPosX[ScrollState.CurrentSelection], row1PosY);
|
||||
@ -5019,14 +5224,14 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
// create dynamic text for the second row if BootCampStyle is used
|
||||
if ((GlobalConfig.BootCampStyle) && (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL))
|
||||
&& Entries[ScrollState.CurrentSelection].Row == 1) {
|
||||
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
|
||||
(UGAWidth >> 1), FunctextPosY);
|
||||
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
|
||||
(UGAWidth >> 1), FunctextPosY);
|
||||
}
|
||||
|
||||
// create dynamic text for all the entries
|
||||
if ((!(GlobalConfig.BootCampStyle)) && (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL))) {
|
||||
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
|
||||
(UGAWidth >> 1), textPosY);
|
||||
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
|
||||
(UGAWidth >> 1), textPosY);
|
||||
}
|
||||
#endif
|
||||
DrawTextCorner(TEXT_CORNER_HELP, X_IS_LEFT);
|
||||
@ -5043,7 +5248,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
HidePointer();
|
||||
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)){
|
||||
ThemeX.FillRectAreaOfScreen((UGAWidth >> 1), FunctextPosY + MessageHeight * i,
|
||||
OldTimeoutTextWidth, MessageHeight);
|
||||
OldTimeoutTextWidth, MessageHeight);
|
||||
OldTimeoutTextWidth = DrawTextXY(XStringW().takeValueFrom(ParamText), (UGAWidth >> 1), FunctextPosY + MessageHeight * i, X_IS_CENTER);
|
||||
}
|
||||
|
||||
@ -5061,7 +5266,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
HidePointer();
|
||||
if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)){
|
||||
FillRectAreaOfScreen((UGAWidth >> 1), FunctextPosY + MessageHeight * i,
|
||||
OldTimeoutTextWidth, MessageHeight, &MenuBackgroundPixel, X_IS_CENTER);
|
||||
OldTimeoutTextWidth, MessageHeight, &MenuBackgroundPixel, X_IS_CENTER);
|
||||
OldTimeoutTextWidth = DrawTextXY(ParamText, (UGAWidth >> 1), FunctextPosY + MessageHeight * i, X_IS_CENTER);
|
||||
}
|
||||
|
||||
@ -5076,6 +5281,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// user-callable dispatcher functions
|
||||
|
Loading…
Reference in New Issue
Block a user