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
|
#if USE_XTHEME
|
||||||
#include "XTheme.h"
|
#include "XTheme.h"
|
||||||
extern XTheme ThemeX;
|
extern XTheme ThemeX;
|
||||||
|
extern CONST CHAR8* IconsNames[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -466,53 +467,66 @@ EFI_STATUS ParseSVGXTheme(CONST CHAR8* buffer, TagPtr * dict)
|
|||||||
DBG(" parsed banner->width=%lld\n", ThemeX.Banner.GetWidth());
|
DBG(" parsed banner->width=%lld\n", ThemeX.Banner.GetWidth());
|
||||||
|
|
||||||
// --- Make other icons
|
// --- Make other icons
|
||||||
INTN i = BUILTIN_ICON_FUNC_ABOUT;
|
|
||||||
CHAR8 *IconName;
|
for (INTN i = BUILTIN_ICON_FUNC_ABOUT; i < BUILTIN_ICON_COUNT; ++i) {
|
||||||
while (BuiltinIconTable[i].Path) {
|
|
||||||
if (i == BUILTIN_ICON_BANNER) {
|
if (i == BUILTIN_ICON_BANNER) {
|
||||||
i++;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CONST CHAR16 *IconPath = BuiltinIconTable[i].Path;
|
Icon NewIcon(i, true); //initialize with embedded but further replace by loaded
|
||||||
// DBG("next table icon=%ls\n", IconPath);
|
ParseSVGXIcon(mainParser, i, NewIcon.Name, Scale, NewIcon.Image);
|
||||||
CONST CHAR16 *ptr = StrStr(IconPath, L"\\");
|
ParseSVGXIcon(mainParser, i, NewIcon.Name + L"_night", Scale, NewIcon.ImageNight);
|
||||||
if (!ptr) {
|
ThemeX.Icons.AddCopy(NewIcon);
|
||||||
ptr = IconPath;
|
|
||||||
} else {
|
|
||||||
ptr++;
|
|
||||||
}
|
}
|
||||||
// DBG("next icon=%ls Len=%d\n", ptr, StrLen(ptr));
|
|
||||||
UINTN Size = StrLen(ptr)+1;
|
for (INTN i = BUILTIN_ICON_COUNT; i < BUILTIN_RADIO_BUTTON; ++i) {
|
||||||
IconName = (__typeof__(IconName))AllocateZeroPool(Size);
|
Icon NewIcon(i); //there is no embedded
|
||||||
UnicodeStrToAsciiStrS(ptr, IconName, Size);
|
ParseSVGXIcon(mainParser, i, NewIcon.Name, Scale, NewIcon.Image);
|
||||||
// DBG("search for icon name %s\n", IconName);
|
ParseSVGXIcon(mainParser, i, NewIcon.Name + L"_night", Scale, NewIcon.ImageNight); //it is for future os_moja_night
|
||||||
CHAR8 IconNight[64];
|
ThemeX.Icons.AddCopy(NewIcon);
|
||||||
AsciiStrCpyS(IconNight, 64, IconName);
|
}
|
||||||
AsciiStrCatS(IconNight, 64, "_night");
|
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;
|
Status = EFI_NOT_FOUND;
|
||||||
if (!DayLight) {
|
if (!DayLight) {
|
||||||
Status = ParseSVGIcon(mainParser, i, IconNight, Scale, &BuiltinIconTable[i].Image);
|
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_SELECTION, XStringWP(L"selection_indicator_night"), Scale, SelectionImages[4]);
|
||||||
}
|
}
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
Status = ParseSVGIcon(mainParser, i, IconName, Scale, &BuiltinIconTable[i].Image);
|
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_SELECTION, XStringWP(L"selection_indicator"), Scale, SelectionImages[4]);
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ CONST CHAR8* IconsNames[] = {
|
|||||||
"vol_internal_ntfs",
|
"vol_internal_ntfs",
|
||||||
"vol_internal_ext3" ,
|
"vol_internal_ext3" ,
|
||||||
"vol_recovery",//21
|
"vol_recovery",//21
|
||||||
// not used?
|
// not used? will be skipped while theme parsing
|
||||||
"logo",
|
"logo",
|
||||||
"selection_small",
|
"selection_small",
|
||||||
"selection_big", //BUILTIN_SELECTION_BIG=24 we keep this numeration
|
"selection_big", //BUILTIN_SELECTION_BIG=24 we keep this numeration
|
||||||
@ -82,7 +82,7 @@ CONST CHAR8* IconsNames[] = {
|
|||||||
"os_freedos",
|
"os_freedos",
|
||||||
"os_win",
|
"os_win",
|
||||||
"os_vista",
|
"os_vista",
|
||||||
"radio_button", //20
|
"radio_button", //20+25
|
||||||
"radio_button_selected",
|
"radio_button_selected",
|
||||||
"checkbox", //22
|
"checkbox", //22
|
||||||
"checkbox_checked",
|
"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) {
|
if (!TypeSVG) {
|
||||||
UpButton.Width = ScrollWidth; // 16
|
UpButton.Width = ScrollWidth; // 16
|
||||||
UpButton.Height = ScrollButtonsHeight; // 20
|
UpButton.Height = ScrollButtonsHeight; // 20
|
||||||
|
@ -589,6 +589,7 @@ EG_IMAGE * GetSmallHover(IN UINTN Id);
|
|||||||
#define BUILTIN_SELECTION_SMALL (23)
|
#define BUILTIN_SELECTION_SMALL (23)
|
||||||
#define BUILTIN_SELECTION_BIG (24)
|
#define BUILTIN_SELECTION_BIG (24)
|
||||||
#define BUILTIN_ICON_COUNT (25)
|
#define BUILTIN_ICON_COUNT (25)
|
||||||
|
#define BUILTIN_RADIO_BUTTON (45)
|
||||||
#define BUILTIN_ICON_BACKGROUND (100)
|
#define BUILTIN_ICON_BACKGROUND (100)
|
||||||
#define BUILTIN_ICON_SELECTION (101)
|
#define BUILTIN_ICON_SELECTION (101)
|
||||||
#define BUILTIN_ICON_ANIME (102)
|
#define BUILTIN_ICON_ANIME (102)
|
||||||
|
Loading…
Reference in New Issue
Block a user