From 813b0d22cc6a209de9497475f65ef89076974849 Mon Sep 17 00:00:00 2001 From: SergeySlice Date: Fri, 15 May 2020 11:17:06 +0300 Subject: [PATCH] prepare to dynamic svg Signed-off-by: SergeySlice --- rEFIt_UEFI/entry_scan/legacy.cpp | 2 +- rEFIt_UEFI/entry_scan/loader.cpp | 4 +- rEFIt_UEFI/entry_scan/tool.cpp | 2 +- rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp | 27 ++-- rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h | 12 +- rEFIt_UEFI/libeg/XTheme.cpp | 194 ++++----------------------- rEFIt_UEFI/libeg/XTheme.h | 7 +- rEFIt_UEFI/refit/menu.cpp | 38 +++--- 8 files changed, 66 insertions(+), 220 deletions(-) diff --git a/rEFIt_UEFI/entry_scan/legacy.cpp b/rEFIt_UEFI/entry_scan/legacy.cpp index 4385ec493..75f6d2a4b 100644 --- a/rEFIt_UEFI/entry_scan/legacy.cpp +++ b/rEFIt_UEFI/entry_scan/legacy.cpp @@ -170,7 +170,7 @@ BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTi // SubScreen->Title = L"Boot Options for "_XSW + LoaderTitle + L" on "_XSW + VolDesc; SubScreen->Title.SWPrintf("Boot Options for %ls on %ls", LoaderTitle.wc_str(), VolDesc); - SubScreen->TitleImage = Entry->Image; + SubScreen->TitleImage.Image = Entry->Image; //TODO - ImageNight SubScreen->ID = SCREEN_BOOT; SubScreen->GetAnime(); // default entry diff --git a/rEFIt_UEFI/entry_scan/loader.cpp b/rEFIt_UEFI/entry_scan/loader.cpp index ea5416312..e3f339d64 100644 --- a/rEFIt_UEFI/entry_scan/loader.cpp +++ b/rEFIt_UEFI/entry_scan/loader.cpp @@ -815,7 +815,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry) SubScreen = new REFIT_MENU_SCREEN; SubScreen->Title.SWPrintf("Options for %ls on %ls", Entry->Title.wc_str(), Entry->VolName); - SubScreen->TitleImage = Entry->Image; + SubScreen->TitleImage.Image = Entry->Image; SubScreen->ID = Entry->LoaderType + 20; //wow // DBG("get anime for os=%lld\n", SubScreen->ID); SubScreen->GetAnime(); @@ -1911,7 +1911,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex, REFIT_MENU_SCREEN *SubScreen = new REFIT_MENU_SCREEN; if (SubScreen) { SubScreen->Title.SWPrintf("Boot Options for %ls on %ls", (Custom->Title.notEmpty()) ? Custom->Title.wc_str() : CustomPath.wc_str(), Entry->VolName); - SubScreen->TitleImage = Entry->Image; + SubScreen->TitleImage.Image = Entry->Image; SubScreen->ID = Custom->Type + 20; SubScreen->GetAnime(); VolumeSize = RShiftU64(MultU64x32(Volume->BlockIO->Media->LastBlock, Volume->BlockIO->Media->BlockSize), 20); diff --git a/rEFIt_UEFI/entry_scan/tool.cpp b/rEFIt_UEFI/entry_scan/tool.cpp index 191650008..0374e1656 100644 --- a/rEFIt_UEFI/entry_scan/tool.cpp +++ b/rEFIt_UEFI/entry_scan/tool.cpp @@ -149,7 +149,7 @@ STATIC VOID AddCloverEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Loade SubScreen->Title.takeValueFrom(LoaderTitle); - SubScreen->TitleImage = Entry->Image; + SubScreen->TitleImage.Image = Entry->Image; SubScreen->ID = SCREEN_BOOT; SubScreen->GetAnime(); SubScreen->AddMenuInfoLine_f("%ls", FileDevicePathToStr(Volume->DevicePath)); diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp index 1a4985f57..d12bd2ce9 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp @@ -1606,14 +1606,14 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa //MenuWidth = 80; // minimum MenuWidth = (int)(LAYOUT_TEXT_WIDTH * ThemeX.Scale); //500 - if (!TitleImage.isEmpty()) { - if (MenuWidth > (INTN)(UGAWidth - (int)(TITLEICON_SPACING * ThemeX.Scale) - TitleImage.GetWidth())) { - MenuWidth = UGAWidth - (int)(TITLEICON_SPACING * ThemeX.Scale) - TitleImage.GetWidth() - 2; + if (!TitleImage.Image.isEmpty()) { + if (MenuWidth > (INTN)(UGAWidth - (int)(TITLEICON_SPACING * ThemeX.Scale) - TitleImage.Image.GetWidth())) { + MenuWidth = UGAWidth - (int)(TITLEICON_SPACING * ThemeX.Scale) - TitleImage.Image.GetWidth() - 2; } - EntriesPosX = (UGAWidth - (TitleImage.GetWidth() + (int)(TITLEICON_SPACING * ThemeX.Scale) + MenuWidth)) >> 1; - // DBG("UGAWIdth=%lld TitleImage=%lld MenuWidth=%lld\n", UGAWidth, - // TitleImage.GetWidth(), MenuWidth); - MenuWidth += TitleImage.GetWidth(); + EntriesPosX = (UGAWidth - (TitleImage.Image.GetWidth() + (int)(TITLEICON_SPACING * ThemeX.Scale) + MenuWidth)) >> 1; + // DBG("UGAWIdth=%lld TitleImage.Image=%lld MenuWidth=%lld\n", UGAWidth, + // TitleImage.Image.GetWidth(), MenuWidth); + MenuWidth += TitleImage.Image.GetWidth(); } else { EntriesPosX = (UGAWidth - MenuWidth) >> 1; } @@ -1628,24 +1628,21 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa DrawTextXY(Title, (UGAWidth >> 1), EntriesPosY - ThemeX.TextHeight * 2, X_IS_CENTER); } - if (!TitleImage.isEmpty()) { - INTN FilmXPos = (INTN)(EntriesPosX - (TitleImage.GetWidth() + (int)(TITLEICON_SPACING * ThemeX.Scale))); + if (!TitleImage.Image.isEmpty()) { + INTN FilmXPos = (INTN)(EntriesPosX - (TitleImage.Image.GetWidth() + (int)(TITLEICON_SPACING * ThemeX.Scale))); INTN FilmYPos = (INTN)EntriesPosY; - // BltImageAlpha(TitleImage, FilmXPos, FilmYPos, &MenuBackgroundPixel, 16); - TitleImage.Draw(FilmXPos, FilmYPos); + TitleImage.Image.Draw(FilmXPos, FilmYPos); // update FilmPlace only if not set by InitAnime if (FilmC->FilmPlace.Width == 0 || FilmC->FilmPlace.Height == 0) { FilmC->FilmPlace.XPos = FilmXPos; FilmC->FilmPlace.YPos = FilmYPos; - FilmC->FilmPlace.Width = TitleImage.GetWidth(); - FilmC->FilmPlace.Height = TitleImage.GetHeight(); + FilmC->FilmPlace.Width = TitleImage.Image.GetWidth(); + FilmC->FilmPlace.Height = TitleImage.Image.GetHeight(); } } if (InfoLines.size() > 0) { - // DrawMenuText(NULL, 0, 0, 0, 0, 0); - //EraseTextXY(); //but we should make it complementare to DrawMenuText for (UINTN i = 0; i < InfoLines.size(); i++) { DrawMenuText(InfoLines[i], 0, EntriesPosX, EntriesPosY, 0xFFFF, 0); EntriesPosY += ThemeX.TextHeight; diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h index 4a71ef388..edc3e75b2 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h @@ -74,7 +74,7 @@ public: // XPointer mPointer; UINTN ID; XStringW Title; - XImage TitleImage; + Icon TitleImage; XStringWArray InfoLines; XObjArray Entries; @@ -85,23 +85,13 @@ public: EG_RECT OldTextBufferRect; XImage OldTextBufferImage; BOOLEAN isBootScreen; - //BOOLEAN Once; - //same for xcinema - // BOOLEAN AnimeRun; - // UINT64 LastDraw; - // INTN CurrentFrame; - // INTN Frames; //there are FilmC properties - // UINTN FrameTime; //ms - // EG_RECT FilmPlace; FILM *FilmC; - //XImage FilmPlaceImage; ACTION mAction; UINTN mItemID; SCROLL_STATE ScrollState; BOOLEAN ScrollEnabled; INTN TextStyle; -// MENU_STYLE_FUNC StyleFunc; //TODO scroll positions should depends on REFIT_SCREEN? // Or it just currently calculated to be global variables? diff --git a/rEFIt_UEFI/libeg/XTheme.cpp b/rEFIt_UEFI/libeg/XTheme.cpp index 18a4113ed..0a59073fd 100644 --- a/rEFIt_UEFI/libeg/XTheme.cpp +++ b/rEFIt_UEFI/libeg/XTheme.cpp @@ -111,6 +111,18 @@ Icon::Icon(INTN Index, bool TakeEmbedded) : Image(), ImageNight() } } +Icon& Icon::operator=(const Icon& src) +{ + Id = src.Id; + Name = src.Name; + Image = src.Image; + ImageNight = src.ImageNight; + //this mment we copy pointers. Later it will be class variables + ImageSVG = src.ImageSVG; + ImageSVGnight = src.ImageSVGnight; + return *this; +} + void Icon::GetEmbedded() { switch (Id) { @@ -298,8 +310,9 @@ void XTheme::Init() // return GetIcon(XString().takeValueFrom(Name)); //} -static XImage NullIcon; +static XImage NullImage; static XImage DummyIcon; +static Icon NullIcon; const XImage& XTheme::GetIcon(const XString8& Name) { @@ -310,7 +323,7 @@ const XImage& XTheme::GetIcon(const XString8& Name) return GetIcon(Icons[i].Id); } } - return NullIcon; //if name is not found + return NullImage; //if name is not found } bool XTheme::CheckNative(INTN Id) @@ -330,6 +343,18 @@ const XImage& XTheme::GetIcon(INTN Id) return GetIconAlt(Id, -1); } +const Icon& XTheme::TakeIcon(INTN Id) +{ + for (size_t i = 0; i < Icons.size(); i++) + { + if (Icons[i].Id == Id) + { + return Icons[i]; + } + } + return NullIcon; +} + /* * Get Icon with this ID=id, for example VOL_INTERNAL_HFS * if not found then search for ID=Alt with Native attribute set, for example VOL_INTERNAL @@ -382,7 +407,7 @@ const XImage& XTheme::GetIconAlt(INTN Id, INTN Alt) //if not found then take emb DBG("got day icon %lld name{%s}\n", Id, IconsNames[IdFound]); return Icons[IdFound].Image; } - return NullIcon; //such Id is not found in the database + return NullImage; //such Id is not found in the database } const XImage& XTheme::LoadOSIcon(const CHAR16* OSIconName) @@ -432,11 +457,6 @@ const XImage& XTheme::LoadOSIcon(const XString8& Full) DummyIcon.DummyImage(MainEntriesSize); return DummyIcon; } -// -//void XTheme::AddIcon(Icon& NewIcon) -//{ -// Icons.AddCopy(NewIcon); -//} void XTheme::FillByEmbedded() @@ -484,7 +504,6 @@ void XTheme::ClearScreen() //and restore background and banner if (BanHeight < 2) { BanHeight = ((UGAHeight - (int)(LayoutHeight * Scale)) >> 1); } -// egClearScreen(&MenuBackgroundPixel); //not needed if (!(HideUIFlags & HIDEUI_FLAG_BANNER)) { //Banner image prepared before if (!Banner.isEmpty()) { @@ -528,8 +547,6 @@ void XTheme::ClearScreen() //and restore background and banner if (!BigBack.isEmpty()) { switch (BackgroundScale) { case imScale: -// DBG("back copy scaled\n"); -// Background.setSizeInPixels(UGAWidth, UGAHeight); //anyway set BigScale = (float)UGAWidth/BigBack.GetWidth(); BigScaleY = (float)UGAHeight/BigBack.GetHeight(); Background.CopyScaled(BigBack, MAX(BigScale, BigScaleY)); @@ -559,13 +576,8 @@ void XTheme::ClearScreen() //and restore background and banner } const EG_RECT BackRect = EG_RECT(x1, y1, x, y); const EG_RECT BigRect = EG_RECT(x2, y2, x, y); - //the function can be in XImage class -// egRawCopy((EG_PIXEL*)Background.GetPixelPtr(x1, y1), -// (EG_PIXEL*)BigBack.GetPixelPtr(x2, y2), -// x, y, Background.GetWidth(), BigBack.GetWidth()); // DBG("crop to x,y: %lld, %lld\n", x, y); Background.CopyRect(BigBack, BackRect, BigRect); -// DBG("back copy cropped\n"); break; } case imTile: @@ -608,157 +620,7 @@ void XTheme::ClearScreen() //and restore background and banner Background.DrawWithoutCompose(0, 0, UGAWidth, UGAHeight); } -#if 0 -void XTheme::InitSelection() //for PNG theme -{ - EFI_STATUS Status; - if (!AllowGraphicsMode) - return; - //used to fill TextBuffer if selected - SelectionBackgroundPixel.Red = (SelectionColor >> 24) & 0xFF; - SelectionBackgroundPixel.Green = (SelectionColor >> 16) & 0xFF; - SelectionBackgroundPixel.Blue = (SelectionColor >> 8) & 0xFF; - SelectionBackgroundPixel.Reserved = (SelectionColor >> 0) & 0xFF; - - if (!SelectionImages[0].isEmpty()) { //already presents - return; - } - if (TypeSVG) { - SelectionImages[2] = GetIcon(BUILTIN_SELECTION_SMALL); - SelectionImages[0] = GetIcon(BUILTIN_SELECTION_BIG); - if (SelectionImages[0].isEmpty()) { - SelectionImages[0] = SelectionImages[2]; //use same selection if OnTop for example - } - } else { - // load small selection image - if (SelectionImages[2].isEmpty()){ - SelectionImages[2].LoadXImage(ThemeDir, SelectionSmallFileName); - } - if (SelectionImages[2].isEmpty()){ - // SelectionImages[2] = BuiltinIcon(BUILTIN_SELECTION_SMALL); - // SelectionImages[2]->HasAlpha = FALSE; // support transparensy for selection icons - if (Daylight) { - SelectionImages[2].FromPNG(ACCESS_EMB_DATA(emb_selection_small), ACCESS_EMB_SIZE(emb_selection_small)); - } else { - SelectionImages[2].FromPNG(ACCESS_EMB_DATA(emb_dark_selection_small), ACCESS_EMB_SIZE(emb_dark_selection_small)); - } - // CopyMem(&BlueBackgroundPixel, &StdBackgroundPixel, sizeof(EG_PIXEL)); //why??? - } - //cut or extend the image by Compose - /* SelectionImages[2] = egEnsureImageSize(SelectionImages[2], - row1TileSize, row1TileSize, &MenuBackgroundPixel); - if (SelectionImages[2] == NULL) { - return; - } */ - - // load big selection image - if (SelectionImages[0].isEmpty()) { - SelectionImages[0].LoadXImage(ThemeDir, SelectionBigFileName); - // SelectionImages[0].EnsureImageSize(row0TileSize, row0TileSize, &MenuBackgroundPixel); - } - if (SelectionImages[0].isEmpty()) { - // calculate big selection image from small one - // SelectionImages[0] = BuiltinIcon(BUILTIN_SELECTION_BIG); - if (Daylight) { - SelectionImages[0].FromPNG(ACCESS_EMB_DATA(emb_selection_big), ACCESS_EMB_SIZE(emb_selection_big)); - } else { - SelectionImages[0].FromPNG(ACCESS_EMB_DATA(emb_dark_selection_big), ACCESS_EMB_SIZE(emb_dark_selection_big)); - } - // SelectionImages[0]->HasAlpha = FALSE; // support transparensy for selection icons - //CopyMem(&BlueBackgroundPixel, &StdBackgroundPixel, sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); - BlueBackgroundPixel = StdBackgroundPixel; - if (SelectionImages[0].isEmpty()) { - SelectionImages[2].setEmpty(); - return; - } - // if (SelectionOnTop) { - // SelectionImages[0]->HasAlpha = TRUE; // TODO ? - // SelectionImages[2]->HasAlpha = TRUE; - // } - } - } - // BootCampStyle indicator image - if (BootCampStyle) { - // load indicator selection image - if (!TypeSVG && SelectionImages[4].isEmpty()) { - SelectionImages[4].LoadXImage(ThemeDir, SelectionIndicatorName); - } - if (SelectionImages[4].isEmpty()) { - SelectionImages[4].FromPNG(ACCESS_EMB_DATA(emb_selection_indicator), ACCESS_EMB_SIZE(emb_selection_indicator)); - } - INTN ScaledIndicatorSize = (INTN)(INDICATOR_SIZE * Scale); - SelectionImages[4].EnsureImageSize(ScaledIndicatorSize, ScaledIndicatorSize, MenuBackgroundPixel); - if (SelectionImages[4].isEmpty()) { -// SelectionImages[4] = egCreateFilledImage(ScaledIndicatorSize, ScaledIndicatorSize, -// TRUE, &StdBackgroundPixel); - SelectionImages[4] = XImage(ScaledIndicatorSize, ScaledIndicatorSize); - SelectionImages[4].Fill(StdBackgroundPixel); - } - SelectionImages[5] = XImage(ScaledIndicatorSize, ScaledIndicatorSize); - SelectionImages[5].Fill(MenuBackgroundPixel); - } - - /* - Button & radio, or any other next icons with builtin icon as fallback should synced to: - - BUILTIN_ICON_* in lib.h - - BuiltinIconTable in icns.c - - Data in egemb_icons.h / scroll_images.h - */ - - // Radio buttons - //it was a nonsense egLoadImage is just inluded into egLoadIcon. - // will be corrected with XTheme support - //the procedure loadIcon should also check embedded icons - //DECLARE_EMB_EXTERN_WITH_SIZE(emb_radio_button_selected) - //DECLARE_EMB_EXTERN_WITH_SIZE(emb_radio_button) - //DECLARE_EMB_EXTERN_WITH_SIZE(emb_checkbox) - //DECLARE_EMB_EXTERN_WITH_SIZE(emb_checkbox_checked) - //DECLARE_EMB_EXTERN_WITH_SIZE(emb_dark_font_data) - - if (!TypeSVG) { //SVG theme already parsed buttons - Status = Buttons[0].LoadXImage(ThemeDir, "radio_button"); - if (EFI_ERROR(Status)) { - Buttons[0].FromPNG(ACCESS_EMB_DATA(emb_radio_button), ACCESS_EMB_SIZE(emb_radio_button)); - } - Status = Buttons[1].LoadXImage(ThemeDir, "radio_button_selected"); - if (EFI_ERROR(Status)) { - Buttons[1].FromPNG(ACCESS_EMB_DATA(emb_radio_button_selected), ACCESS_EMB_SIZE(emb_radio_button_selected)); - } - Status = Buttons[2].LoadXImage(ThemeDir, "checkbox"); - if (EFI_ERROR(Status)) { - Buttons[2].FromPNG(ACCESS_EMB_DATA(emb_checkbox), ACCESS_EMB_SIZE(emb_checkbox)); - } - Status = Buttons[3].LoadXImage(ThemeDir, "checkbox_checked"); - if (EFI_ERROR(Status)) { - Buttons[3].FromPNG(ACCESS_EMB_DATA(emb_checkbox_checked), ACCESS_EMB_SIZE(emb_checkbox_checked)); - } - } else { - //SVG theme already parsed all icons - Buttons[0] = GetIcon("radio_button"_XS8); - Buttons[1] = GetIcon("radio_button_selected"_XS8); - Buttons[2] = GetIcon("checkbox"_XS8); - Buttons[3] = GetIcon("checkbox_checked"_XS8); - } - - // non-selected background images - - EFI_GRAPHICS_OUTPUT_BLT_PIXEL BackgroundPixel = { 0xbf, 0xbf, 0xbf, 0xff }; - if (TypeSVG || !SelectionBigFileName.isEmpty()) { - BackgroundPixel = { 0x00, 0x00, 0x00, 0x00 }; - } else if (DarkEmbedded) { - BackgroundPixel = { 0x33, 0x33, 0x33, 0x00 }; //nonsense. Will be a sense if semi-transparent - } else { //for example embedded daylight - BackgroundPixel = { 0xbf, 0xbf, 0xbf, 0xff }; - } - - SelectionImages[1] = XImage(row0TileSize, row0TileSize); - SelectionImages[1].Fill(BackgroundPixel); - SelectionImages[3] = XImage(row1TileSize, row1TileSize); - SelectionImages[3].Fill(BackgroundPixel); - -} -#endif //use this only for PNG theme void XTheme::FillByDir() //assume ThemeDir is defined by InitTheme() procedure { diff --git a/rEFIt_UEFI/libeg/XTheme.h b/rEFIt_UEFI/libeg/XTheme.h index 75d0a5e0f..2bf190657 100644 --- a/rEFIt_UEFI/libeg/XTheme.h +++ b/rEFIt_UEFI/libeg/XTheme.h @@ -22,12 +22,14 @@ public: void *ImageSVG; //NSVGimage* void *ImageSVGnight; + Icon(): Id(0), Name(), Image(), ImageNight(), Native(false), ImageSVG(nullptr), ImageSVGnight(nullptr) + {}; Icon(INTN Id, bool Embedded = false); ~Icon(); // Default are not valid, as usual. We delete them. If needed, proper ones can be created - Icon(const Icon&) = delete; - Icon& operator=(const Icon&) = delete; +// Icon(const Icon&) = delete; + Icon& operator=(const Icon&); // = delete; void GetEmbedded(); }; @@ -134,6 +136,7 @@ public: const XImage& LoadOSIcon(const CHAR16* OSIconName); //TODO make XString provider const XImage& LoadOSIcon(const XString8& Full); bool CheckNative(INTN Id); + const Icon& TakeIcon(INTN Id); //fonts void LoadFontImage(IN BOOLEAN UseEmbedded, IN INTN Rows, IN INTN Cols); diff --git a/rEFIt_UEFI/refit/menu.cpp b/rEFIt_UEFI/refit/menu.cpp index 2e3a6fbea..52e5e69e9 100644 --- a/rEFIt_UEFI/refit/menu.cpp +++ b/rEFIt_UEFI/refit/menu.cpp @@ -1209,10 +1209,11 @@ VOID AboutRefit(VOID) { if (AboutMenu.Entries.size() == 0) { if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) { - AboutMenu.TitleImage = ThemeX.GetIcon((INTN)BUILTIN_ICON_FUNC_ABOUT); - } else { - AboutMenu.TitleImage.setEmpty(); + AboutMenu.TitleImage = ThemeX.TakeIcon(BUILTIN_ICON_FUNC_ABOUT); } +// else { +// AboutMenu.TitleImage.setEmpty(); //done in the constructor +// } // AboutMenu.AddMenuInfo_f(("Clover Version 5.0")); AboutMenu.AddMenuInfo_f("%s", gRevisionStr); AboutMenu.AddMenuInfo_f(" Build: %s", gFirmwareBuildDate); @@ -1262,10 +1263,11 @@ VOID HelpRefit(VOID) { if (HelpMenu.Entries.size() == 0) { if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) { - HelpMenu.TitleImage = ThemeX.GetIcon(BUILTIN_ICON_FUNC_HELP); - } else { - HelpMenu.TitleImage.setEmpty(); + HelpMenu.TitleImage = ThemeX.TakeIcon(BUILTIN_ICON_FUNC_HELP); } + //else { + // HelpMenu.TitleImage.setEmpty(); + //} switch (gLanguage) { case russian: @@ -1657,17 +1659,17 @@ VOID HelpRefit(VOID) REFIT_ABSTRACT_MENU_ENTRY* NewEntry_(REFIT_ABSTRACT_MENU_ENTRY *Entry, REFIT_MENU_SCREEN **SubScreen, ACTION AtClick, UINTN ID, CONST CHAR8 *CTitle) { - if ( CTitle ) Entry->Title.takeValueFrom(CTitle); + if (CTitle) Entry->Title.takeValueFrom(CTitle); else Entry->Title.setEmpty(); - Entry->Image = OptionMenu.TitleImage; + Entry->Image = OptionMenu.TitleImage.Image; Entry->AtClick = AtClick; // create the submenu // *SubScreen = (__typeof_am__(*SubScreen))AllocateZeroPool(sizeof(**SubScreen)); *SubScreen = new REFIT_MENU_SCREEN(); // (*SubScreen)->Title = EfiStrDuplicate(Entry->Title); (*SubScreen)->Title = Entry->Title; - (*SubScreen)->TitleImage = Entry->Image; + (*SubScreen)->TitleImage.Image = Entry->Image; (*SubScreen)->ID = ID; (*SubScreen)->GetAnime(); Entry->SubScreen = *SubScreen; @@ -1678,7 +1680,6 @@ REFIT_MENU_ITEM_OPTIONS* newREFIT_MENU_ITEM_OPTIONS(REFIT_MENU_SCREEN **SubScree { REFIT_MENU_ITEM_OPTIONS* Entry = new REFIT_MENU_ITEM_OPTIONS(); return NewEntry_(Entry, SubScreen, AtClick, ID, Title)->getREFIT_MENU_ITEM_OPTIONS(); -// (*Entry)->Tag = TAG_OPTIONS; } VOID ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry) @@ -1694,13 +1695,9 @@ VOID ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry) if (gSettings.CsrActiveConfig != 0 && gSettings.BooterConfig == 0) { gSettings.BooterConfig = 0x28; } - } else if (ChosenEntry->SubScreen->ID == SCREEN_BLC) { ChosenEntry->Title.SWPrintf("boot_args->flags [0x%04hx]->", gSettings.BooterConfig); } - /*else if (ChosenEntry->SubScreen->ID == SCREEN_DSM) { - ChosenEntry->Title.SWPrintf("Drop OEM _DSM [0x%04hx]->", dropDSM); - } */ } REFIT_ABSTRACT_MENU_ENTRY *SubMenuGraphics() @@ -1711,7 +1708,6 @@ REFIT_ABSTRACT_MENU_ENTRY *SubMenuGraphics() Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_GRAPHICS, "Graphics Injector->"); SubScreen->AddMenuInfoLine_f("Number of VideoCard%s=%llu",((NGFX!=1)?"s":""), NGFX); - SubScreen->AddMenuItemInput(52, "InjectEDID", FALSE); SubScreen->AddMenuItemInput(53, "Fake Vendor EDID:", TRUE); SubScreen->AddMenuItemInput(54, "Fake Product EDID:", TRUE); @@ -2740,10 +2736,11 @@ VOID OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry) if (OptionMenu.Entries.size() == 0) { if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) { - OptionMenu.TitleImage = ThemeX.GetIcon(BUILTIN_ICON_FUNC_OPTIONS); - } else { - OptionMenu.TitleImage.setEmpty(); + OptionMenu.TitleImage = ThemeX.TakeIcon(BUILTIN_ICON_FUNC_OPTIONS); } + //else { + // OptionMenu.TitleImage.setEmpty(); + //} gThemeOptionsChanged = TRUE; OptionMenu.ID = SCREEN_OPTIONS; OptionMenu.GetAnime(); //FALSE; @@ -2772,15 +2769,13 @@ VOID OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry) while (!MenuExit) { MenuExit = OptionMenu.RunGenericMenu(Style, &EntryIndex, ChosenEntry); - // MenuExit = RunMenu(&OptionMenu, ChosenEntry); - if ( MenuExit == MENU_EXIT_ESCAPE || (*ChosenEntry)->getREFIT_MENU_ITEM_RETURN() ) + if (MenuExit == MENU_EXIT_ESCAPE || (*ChosenEntry)->getREFIT_MENU_ITEM_RETURN()) break; if (MenuExit == MENU_EXIT_ENTER || MenuExit == MENU_EXIT_DETAILS) { //enter input dialog or subscreen if ((*ChosenEntry)->SubScreen != NULL) { SubMenuExit = 0; while (!SubMenuExit) { - SubMenuExit = (*ChosenEntry)->SubScreen->RunGenericMenu(Style, &SubEntryIndex, &TmpChosenEntry); if (SubMenuExit == MENU_EXIT_ESCAPE || TmpChosenEntry->getREFIT_MENU_ITEM_RETURN() ){ ApplyInputs(); @@ -2791,7 +2786,6 @@ VOID OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry) if (TmpChosenEntry->SubScreen != NULL) { NextMenuExit = 0; while (!NextMenuExit) { - NextMenuExit = TmpChosenEntry->SubScreen->RunGenericMenu(Style, &NextEntryIndex, &NextChosenEntry); if (NextMenuExit == MENU_EXIT_ESCAPE || NextChosenEntry->getREFIT_MENU_ITEM_RETURN() ){ ApplyInputs();