mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-27 12:15:19 +01:00
parse svg xtheme, not verified
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
parent
1cb19148e5
commit
cf61a01b03
@ -37,6 +37,7 @@
|
||||
#if USE_XTHEME
|
||||
#include "XTheme.h"
|
||||
extern XTheme ThemeX;
|
||||
extern CONST CHAR8* IconsNames[];
|
||||
#endif
|
||||
|
||||
|
||||
@ -466,54 +467,67 @@ EFI_STATUS ParseSVGXTheme(CONST CHAR8* buffer, TagPtr * dict)
|
||||
DBG(" parsed banner->width=%lld\n", ThemeX.Banner.GetWidth());
|
||||
|
||||
// --- Make other icons
|
||||
INTN i = BUILTIN_ICON_FUNC_ABOUT;
|
||||
CHAR8 *IconName;
|
||||
while (BuiltinIconTable[i].Path) {
|
||||
|
||||
for (INTN i = BUILTIN_ICON_FUNC_ABOUT; i < BUILTIN_ICON_COUNT; ++i) {
|
||||
if (i == BUILTIN_ICON_BANNER) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
CONST CHAR16 *IconPath = BuiltinIconTable[i].Path;
|
||||
// DBG("next table icon=%ls\n", IconPath);
|
||||
CONST CHAR16 *ptr = StrStr(IconPath, L"\\");
|
||||
if (!ptr) {
|
||||
ptr = IconPath;
|
||||
} else {
|
||||
ptr++;
|
||||
}
|
||||
// DBG("next icon=%ls Len=%d\n", ptr, StrLen(ptr));
|
||||
UINTN Size = StrLen(ptr)+1;
|
||||
IconName = (__typeof__(IconName))AllocateZeroPool(Size);
|
||||
UnicodeStrToAsciiStrS(ptr, IconName, Size);
|
||||
// DBG("search for icon name %s\n", IconName);
|
||||
CHAR8 IconNight[64];
|
||||
AsciiStrCpyS(IconNight, 64, IconName);
|
||||
AsciiStrCatS(IconNight, 64, "_night");
|
||||
Status = EFI_NOT_FOUND;
|
||||
if (!DayLight) {
|
||||
Status = ParseSVGIcon(mainParser, i, IconNight, Scale, &BuiltinIconTable[i].Image);
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = ParseSVGIcon(mainParser, i, IconName, Scale, &BuiltinIconTable[i].Image);
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
DBG(" icon %lld not parsed take common %ls\n", i, BuiltinIconTable[i].Path);
|
||||
if ((i >= BUILTIN_ICON_VOL_EXTERNAL) && (i <= BUILTIN_ICON_VOL_INTERNAL_REC)) {
|
||||
if (BuiltinIconTable[BUILTIN_ICON_VOL_INTERNAL].Image) {
|
||||
BuiltinIconTable[i].Image = egCopyImage(BuiltinIconTable[BUILTIN_ICON_VOL_INTERNAL].Image);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i == BUILTIN_SELECTION_BIG) {
|
||||
DBG("icon main size=[%lld,%lld]\n", BuiltinIconTable[i].Image->Width,
|
||||
BuiltinIconTable[i].Image->Height);
|
||||
}
|
||||
i++;
|
||||
FreePool(IconName);
|
||||
Icon NewIcon(i, true); //initialize with embedded but further replace by loaded
|
||||
ParseSVGXIcon(mainParser, i, NewIcon.Name, Scale, NewIcon.Image);
|
||||
ParseSVGXIcon(mainParser, i, NewIcon.Name + L"_night", Scale, NewIcon.ImageNight);
|
||||
ThemeX.Icons.AddCopy(NewIcon);
|
||||
}
|
||||
|
||||
for (INTN i = BUILTIN_ICON_COUNT; i < BUILTIN_RADIO_BUTTON; ++i) {
|
||||
Icon NewIcon(i); //there is no embedded
|
||||
ParseSVGXIcon(mainParser, i, NewIcon.Name, Scale, NewIcon.Image);
|
||||
ParseSVGXIcon(mainParser, i, NewIcon.Name + L"_night", Scale, NewIcon.ImageNight); //it is for future os_moja_night
|
||||
ThemeX.Icons.AddCopy(NewIcon);
|
||||
}
|
||||
for (INTN i = BUILTIN_RADIO_BUTTON; i < sizeof(IconsNames) / sizeof(IconsNames[0]); ++i) {
|
||||
Icon NewIcon(i, true); //initialize with embedded but further replace by loaded
|
||||
ParseSVGXIcon(mainParser, i, NewIcon.Name, Scale, NewIcon.Image);
|
||||
// ParseSVGXIcon(mainParser, i, NewIcon.Name + L"_night", Scale, NewIcon.ImageNight); //radio_button_selected_night???
|
||||
ThemeX.Icons.AddCopy(NewIcon);
|
||||
}
|
||||
|
||||
|
||||
//selection for bootcamp style
|
||||
Status = EFI_NOT_FOUND;
|
||||
if (!DayLight) {
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_SELECTION, XStringWP(L"selection_indicator_night"), Scale, SelectionImages[4]);
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_SELECTION, XStringWP(L"selection_indicator"), Scale, SelectionImages[4]);
|
||||
}
|
||||
|
||||
//banner animation
|
||||
GUI_ANIME *Anime = (__typeof__(Anime))AllocateZeroPool (sizeof(GUI_ANIME));
|
||||
Anime->ID = 1; //main screen
|
||||
//there is no Anime->Path in vectors
|
||||
Anime->Frames = NumFrames;
|
||||
Anime->FrameTime = FrameTime;
|
||||
Anime->Next = GuiAnime;
|
||||
Anime->FilmX = INITVALUE;
|
||||
Anime->FilmY = INITVALUE;
|
||||
Anime->NudgeX = INITVALUE;
|
||||
Anime->NudgeY = INITVALUE;
|
||||
GuiAnime = Anime;
|
||||
|
||||
nsvgDeleteRasterizer(rast);
|
||||
|
||||
*dict = (__typeof_am__(*dict))AllocateZeroPool(sizeof(TagStruct));
|
||||
(*dict)->type = kTagTypeNone;
|
||||
ThemeX.TypeSVG = TRUE;
|
||||
ThemeX.ThemeDesignHeight = (int)SVGimage->height;
|
||||
ThemeX.ThemeDesignWidth = (int)SVGimage->width;
|
||||
if (ThemeX.SelectionOnTop) {
|
||||
ThemeX.row0TileSize = (INTN)(144.f * Scale);
|
||||
ThemeX.row1TileSize = (INTN)(64.f * Scale);
|
||||
ThemeX.MainEntriesSize = (INTN)(128.f * Scale);
|
||||
}
|
||||
DBG("parsing svg theme finished\n");
|
||||
|
||||
return Status;
|
||||
}
|
||||
#else
|
||||
|
@ -57,7 +57,7 @@ CONST CHAR8* IconsNames[] = {
|
||||
"vol_internal_ntfs",
|
||||
"vol_internal_ext3" ,
|
||||
"vol_recovery",//21
|
||||
// not used?
|
||||
// not used? will be skipped while theme parsing
|
||||
"logo",
|
||||
"selection_small",
|
||||
"selection_big", //BUILTIN_SELECTION_BIG=24 we keep this numeration
|
||||
@ -82,7 +82,7 @@ CONST CHAR8* IconsNames[] = {
|
||||
"os_freedos",
|
||||
"os_win",
|
||||
"os_vista",
|
||||
"radio_button", //20
|
||||
"radio_button", //20+25
|
||||
"radio_button_selected",
|
||||
"checkbox", //22
|
||||
"checkbox_checked",
|
||||
@ -654,7 +654,7 @@ void XTheme::InitBar()
|
||||
}
|
||||
}
|
||||
|
||||
//TODO it must be somewhere in InitScroll - Scrfeen function
|
||||
//TODO it must be somewhere in InitScroll - Screen function
|
||||
if (!TypeSVG) {
|
||||
UpButton.Width = ScrollWidth; // 16
|
||||
UpButton.Height = ScrollButtonsHeight; // 20
|
||||
|
@ -589,6 +589,7 @@ EG_IMAGE * GetSmallHover(IN UINTN Id);
|
||||
#define BUILTIN_SELECTION_SMALL (23)
|
||||
#define BUILTIN_SELECTION_BIG (24)
|
||||
#define BUILTIN_ICON_COUNT (25)
|
||||
#define BUILTIN_RADIO_BUTTON (45)
|
||||
#define BUILTIN_ICON_BACKGROUND (100)
|
||||
#define BUILTIN_ICON_SELECTION (101)
|
||||
#define BUILTIN_ICON_ANIME (102)
|
||||
|
Loading…
Reference in New Issue
Block a user