diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp index ef47ee4bf..e2fb3d581 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp @@ -1540,8 +1540,9 @@ INTN REFIT_MENU_SCREEN::DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INT // DBG("draw text %ls\n", Text); // DBG("pos=%d width=%d xtext=%d Height=%d Y=%d\n", XPos, TextWidth, XText, Height, YPos); - TextBufferXY.Draw(XText, YPos, 0, false); + // TextBufferXY.Draw(XText, YPos, 0, false); // TextBufferXY.DrawWithoutCompose(XText, YPos); + TextBufferXY.DrawOnBack(XText, YPos, ThemeX.Background); return TextWidth2; } @@ -1557,6 +1558,7 @@ void REFIT_MENU_SCREEN::EraseTextXY() * Helper function to draw text for Boot Camp Style. * @author: Needy */ +#if USE_XTHEME VOID REFIT_MENU_SCREEN::DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign) { // check if text was provided @@ -1573,7 +1575,6 @@ VOID REFIT_MENU_SCREEN::DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN CHAR16 *BCSText = NULL; // more space, more characters -#if USE_XTHEME if (ThemeX.TileXSpace >= 25 && ThemeX.TileXSpace < 30) { MaxTextLen = 14; } else if (ThemeX.TileXSpace >= 30 && ThemeX.TileXSpace < 35) { @@ -1587,21 +1588,6 @@ VOID REFIT_MENU_SCREEN::DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN } else if (ThemeX.TileXSpace >= 50) { MaxTextLen = 19; } -#else - if (GlobalConfig.TileXSpace >= 25 && GlobalConfig.TileXSpace < 30) { - MaxTextLen = 14; - } else if (GlobalConfig.TileXSpace >= 30 && GlobalConfig.TileXSpace < 35) { - MaxTextLen = 15; - } else if (GlobalConfig.TileXSpace >= 35 && GlobalConfig.TileXSpace < 40) { - MaxTextLen = 16; - } else if (GlobalConfig.TileXSpace >= 40 && GlobalConfig.TileXSpace < 45) { - MaxTextLen = 17; - } else if (GlobalConfig.TileXSpace >= 45 && GlobalConfig.TileXSpace < 50) { - MaxTextLen = 18; - } else if (GlobalConfig.TileXSpace >= 50) { - MaxTextLen = 19; - } -#endif MaxTextLen += EllipsisLen; @@ -1622,27 +1608,21 @@ VOID REFIT_MENU_SCREEN::DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN StrnCatS(BCSText, MaxTextLen + 1, L"..", EllipsisLen); // redundant, used for safety measures BCSText[MaxTextLen] = '\0'; -#if USE_XTHEME XStringW BCSTextX; BCSTextX.takeValueFrom(BCSText); DrawTextXY(BCSTextX, XPos, YPos, XAlign); -#else - DrawTextXY(BCSText, XPos, YPos, XAlign); -#endif FreePool(BCSText); } else { // draw full text -#if USE_XTHEME XStringW TextX; TextX.takeValueFrom(Text); DrawTextXY(TextX, XPos, YPos, XAlign); -#else - DrawTextXY(Text, XPos, YPos, XAlign); -#endif - } } +#else +//remains in menu.cpp +#endif #if USE_XTHEME VOID REFIT_MENU_SCREEN::DrawMenuText(IN XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN INTN Cursor) @@ -1818,12 +1798,10 @@ VOID REFIT_MENU_SCREEN::ScrollingBar() #if USE_XTHEME VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText) { -// INTN iLast; INTN Chosen = 0; INTN ItemWidth = 0; INTN t1, t2; INTN VisibleHeight = 0; //assume vertical layout -// CHAR16 ResultString[TITLE_MAX_LEN]; // assume a title max length of around 128 XStringW ResultString; INTN PlaceCentre = 0; //(TextHeight / 2) - 7; INTN PlaceCentre1 = 0; @@ -1872,8 +1850,8 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa MenuWidth = UGAWidth - (int)(TITLEICON_SPACING * ThemeX.Scale) - TitleImage.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); + // DBG("UGAWIdth=%lld TitleImage=%lld MenuWidth=%lld\n", UGAWidth, + // TitleImage.GetWidth(), MenuWidth); MenuWidth += TitleImage.GetWidth(); } else { EntriesPosX = (UGAWidth - MenuWidth) >> 1; @@ -1889,7 +1867,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa if (!TitleImage.isEmpty()) { INTN FilmXPos = (INTN)(EntriesPosX - (TitleImage.GetWidth() + (int)(TITLEICON_SPACING * ThemeX.Scale))); INTN FilmYPos = (INTN)EntriesPosY; - // BltImageAlpha(TitleImage, FilmXPos, FilmYPos, &MenuBackgroundPixel, 16); + // BltImageAlpha(TitleImage, FilmXPos, FilmYPos, &MenuBackgroundPixel, 16); TitleImage.Draw(FilmXPos, FilmYPos); // update FilmPlace only if not set by InitAnime @@ -1902,7 +1880,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa } if (InfoLines.size() > 0) { - // DrawMenuText(NULL, 0, 0, 0, 0); + // DrawMenuText(NULL, 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); @@ -1920,17 +1898,17 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa case MENU_FUNCTION_PAINT_ALL: { -// DBG("PAINT_ALL: EntriesPosY=%lld MaxVisible=%lld\n", EntriesPosY, ScrollState.MaxVisible); -// DBG("DownButton.Height=%lld TextHeight=%lld MenuWidth=%lld\n", DownButton.Height, TextHeight, MenuWidth); + // DBG("PAINT_ALL: EntriesPosY=%lld MaxVisible=%lld\n", EntriesPosY, ScrollState.MaxVisible); + // DBG("DownButton.Height=%lld TextHeight=%lld MenuWidth=%lld\n", DownButton.Height, TextHeight, MenuWidth); t2 = EntriesPosY + (ScrollState.MaxVisible + 1) * TextHeight - DownButton.Height; t1 = EntriesPosX + TextHeight + MenuWidth + (INTN)((TEXT_XMARGIN + 16) * ThemeX.Scale); -// DBG("PAINT_ALL: X=%lld Y=%lld\n", t1, t2); + // DBG("PAINT_ALL: X=%lld Y=%lld\n", t1, t2); SetBar(t1, EntriesPosY, t2, &ScrollState); //823 302 554 /* - 48:307 39:206 UGAWIdth=800 TitleImage=48 MenuWidth=333 - 48:635 0:328 PAINT_ALL: EntriesPosY=259 MaxVisible=13 - 48:640 0:004 DownButton.Height=0 TextHeight=21 MenuWidth=381 - 48:646 0:006 PAINT_ALL: X=622 Y=553 + 48:307 39:206 UGAWIdth=800 TitleImage=48 MenuWidth=333 + 48:635 0:328 PAINT_ALL: EntriesPosY=259 MaxVisible=13 + 48:640 0:004 DownButton.Height=0 TextHeight=21 MenuWidth=381 + 48:646 0:006 PAINT_ALL: X=622 Y=553 */ // blackosx swapped this around so drawing of selection comes before drawing scrollbar. @@ -1943,11 +1921,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa Entry->Place.YPos = EntriesPosY + j * TextHeight; Entry->Place.Width = TitleLen * ScaledWidth; Entry->Place.Height = (UINTN)TextHeight; - //StrCpyS(ResultString, TITLE_MAX_LEN, Entry->Title.data()); ResultString = Entry->Title; //create a copy to modify later - //clovy//PlaceCentre1 = (TextHeight - (INTN)(Buttons[2]->Height * GlobalConfig.Scale)) / 2; - //clovy//PlaceCentre = (PlaceCentre>0)?PlaceCentre:0; - //clovy//PlaceCentre1 = (TextHeight - (INTN)(Buttons[0]->Height * GlobalConfig.Scale)) / 2; PlaceCentre = (INTN)((TextHeight - (INTN)(ThemeX.Buttons[2].GetHeight())) * ThemeX.Scale / 2); PlaceCentre1 = (INTN)((TextHeight - (INTN)(ThemeX.Buttons[0].GetHeight())) * ThemeX.Scale / 2); // clovy @@ -1963,21 +1937,14 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa if (inputDialogEntry->Item && inputDialogEntry->Item->ItemType == BoolValue) { Entry->Place.Width = ResultString.length() * ScaledWidth; //possible artefacts - // DrawMenuText(XStringWP(L" "), 0, EntriesPosX, Entry->Place.YPos, 0xFFFF); DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0, ctrlTextX, Entry->Place.YPos, 0xFFFF); - ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->BValue)?3:2].Draw(ctrlX, ctrlY); - - // DBG("X=%d, Y=%d, ImageY=%d\n", EntriesPosX + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale), - // Entry->Place.YPos, Entry->Place.YPos + PlaceCentre); - + ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->BValue)?3:2].DrawOnBack(ctrlX, ctrlY, ThemeX.Background); } else { // text input ResultString += ((REFIT_INPUT_DIALOG*)(Entry))->Item->SValue; ResultString += L" "; - // StrCatS(ResultString, TITLE_MAX_LEN, ((REFIT_INPUT_DIALOG*)(Entry))->Item->SValue); - // StrCatS(ResultString, TITLE_MAX_LEN, L" "); Entry->Place.Width = ResultString.length() * ScaledWidth; // Slice - suppose to use Row as Cursor in text DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? MenuWidth : 0, @@ -1985,12 +1952,11 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa Entry->Place.YPos, TitleLen + Entry->Row); } } else if (Entry->getREFIT_MENU_CHECKBIT()) { - // DrawMenuText(XStringW().takeValueFrom(" "), 0, EntriesPosX, Entry->Place.YPos, 0xFFFF); //clean the place ThemeX.FillRectAreaOfScreen(ctrlTextX, Entry->Place.YPos, MenuWidth, TextHeight); DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0, - ctrlTextX, - Entry->Place.YPos, 0xFFFF); - ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->IValue & Entry->Row)?3:2].Draw(ctrlX, ctrlY); + ctrlTextX, + Entry->Place.YPos, 0xFFFF); + ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->IValue & Entry->Row)?3:2].DrawOnBack(ctrlX, ctrlY, ThemeX.Background); } else if (Entry->getREFIT_MENU_SWITCH()) { if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 3) { //OldChosenItem = OldChosenTheme; @@ -2008,7 +1974,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa // clovy EntriesPosX + (TextHeight + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale)), ctrlTextX, Entry->Place.YPos, 0xFFFF); - ThemeX.Buttons[(Entry->Row == OldChosenItem)?1:0].Draw(ctrlX, ctrlY); + ThemeX.Buttons[(Entry->Row == OldChosenItem)?1:0].DrawOnBack(ctrlX, ctrlY, ThemeX.Background); } else { //DBG("paint entry %d title=%ls\n", i, Entries[i]->Title); DrawMenuText(ResultString, @@ -2028,7 +1994,6 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa REFIT_ABSTRACT_MENU_ENTRY *EntryC = &Entries[ScrollState.CurrentSelection]; TitleLen = EntryL->Title.length(); ResultString = EntryL->Title; - // StrCpyS(ResultString, TITLE_MAX_LEN, EntryL->Title); //clovy//PlaceCentre = (TextHeight - (INTN)(Buttons[2]->Height * GlobalConfig.Scale)) / 2; //clovy//PlaceCentre = (PlaceCentre>0)?PlaceCentre:0; //clovy//PlaceCentre1 = (TextHeight - (INTN)(Buttons[0]->Height * GlobalConfig.Scale)) / 2; @@ -2051,16 +2016,10 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa DrawMenuText(ResultString, 0, ctrlTextX, EntryL->Place.YPos, 0xFFFF); - ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].Draw(ctrlX, EntryL->Place.YPos + PlaceCentre); - // DBG("se:X=%d, Y=%d, ImageY=%d\n", EntriesPosX + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale), - // EntryL->Place.YPos, EntryL->Place.YPos + PlaceCentre); + ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].DrawOnBack(ctrlX, EntryL->Place.YPos + PlaceCentre, ThemeX.Background); } else { ResultString += (((REFIT_INPUT_DIALOG*)(EntryL))->Item->SValue + ((REFIT_INPUT_DIALOG*)(EntryL))->Item->LineShift); ResultString += L" "; - - // StrCatS(ResultString, TITLE_MAX_LEN, ((REFIT_INPUT_DIALOG*)(EntryL))->Item->SValue + - // ((REFIT_INPUT_DIALOG*)(EntryL))->Item->LineShift); - // StrCatS(ResultString, TITLE_MAX_LEN, L" "); DrawMenuText(ResultString, 0, EntriesPosX, EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight, TitleLen + EntryL->Row); @@ -2080,15 +2039,12 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa // clovy DrawMenuText(ResultString, 0, ctrlTextX, EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight, 0xFFFF); - ThemeX.Buttons[(EntryL->Row == OldChosenItem)?1:0].Draw(ctrlX, EntryL->Place.YPos + PlaceCentre1); + ThemeX.Buttons[(EntryL->Row == OldChosenItem)?1:0].DrawOnBack(ctrlX, EntryL->Place.YPos + PlaceCentre1, ThemeX.Background); } else if (EntryL->getREFIT_MENU_CHECKBIT()) { - // clovy - DrawMenuText(ResultString, 0, ctrlTextX, - EntryL->Place.YPos, 0xFFFF); - ThemeX.Buttons[(EntryL->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryL->Row) ?3:2].Draw(ctrlX, EntryL->Place.YPos + PlaceCentre); - - // DBG("ce:X=%d, Y=%d, ImageY=%d\n", EntriesPosX + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale), - // EntryL->Place.YPos, EntryL->Place.YPos + PlaceCentre); + // clovy + DrawMenuText(ResultString, 0, ctrlTextX, + EntryL->Place.YPos, 0xFFFF); + ThemeX.Buttons[(EntryL->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryL->Row) ?3:2].DrawOnBack(ctrlX, EntryL->Place.YPos + PlaceCentre, ThemeX.Background); } else { DrawMenuText(EntryL->Title, 0, EntriesPosX, EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight, 0xFFFF); @@ -2096,7 +2052,6 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa // current selection ResultString = EntryC->Title; - // StrCpyS(ResultString, TITLE_MAX_LEN, EntryC->Title); TitleLen = EntryC->Title.length(); if ( EntryC->getREFIT_MENU_SWITCH() ) { if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 3) { @@ -2116,14 +2071,11 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa DrawMenuText(ResultString, MenuWidth, ctrlTextX, inputDialogEntry->Place.YPos, 0xFFFF); - ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].Draw(ctrlX, inputDialogEntry->Place.YPos + PlaceCentre); + ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].DrawOnBack(ctrlX, inputDialogEntry->Place.YPos + PlaceCentre, ThemeX.Background); } else { ResultString += (inputDialogEntry->Item->SValue + inputDialogEntry->Item->LineShift); ResultString += L" "; - // StrCatS(ResultString, TITLE_MAX_LEN, inputDialogEntry->Item->SValue + - // inputDialogEntry->Item->LineShift); - // StrCatS(ResultString, TITLE_MAX_LEN, L" "); DrawMenuText(ResultString, MenuWidth, EntriesPosX, EntriesPosY + (ScrollState.CurrentSelection - ScrollState.FirstVisible) * TextHeight, TitleLen + inputDialogEntry->Row); @@ -2133,12 +2085,12 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa ctrlTextX, EntriesPosY + (ScrollState.CurrentSelection - ScrollState.FirstVisible) * TextHeight, 0xFFFF); - ThemeX.Buttons[(EntryC->Row == OldChosenItem)?1:0].Draw(ctrlX, EntryC->Place.YPos + PlaceCentre1); + ThemeX.Buttons[(EntryC->Row == OldChosenItem)?1:0].DrawOnBack(ctrlX, EntryC->Place.YPos + PlaceCentre1, ThemeX.Background); } else if (EntryC->getREFIT_MENU_CHECKBIT()) { DrawMenuText(ResultString, MenuWidth, ctrlTextX, EntryC->Place.YPos, 0xFFFF); - ThemeX.Buttons[(EntryC->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryC->Row)?3:2].Draw(ctrlX, EntryC->Place.YPos + PlaceCentre); + ThemeX.Buttons[(EntryC->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryC->Row)?3:2].DrawOnBack(ctrlX, EntryC->Place.YPos + PlaceCentre, ThemeX.Background); }else{ DrawMenuText(EntryC->Title, MenuWidth, EntriesPosX, EntriesPosY + (ScrollState.CurrentSelection - ScrollState.FirstVisible) * TextHeight, @@ -2528,21 +2480,6 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa #else -#endif -//the purpose of the procedure is restore Background in rect -//XAlign is always centre, Color is the Backgrounf fill -#if USE_XTHEME -VOID XTheme::FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Height) -{ - XImage TmpBuffer(Width, Height); -// TmpBuffer.CopyScaled(Background, 1.f); - INTN X = XPos - (Width >> 1); //X_IS_CENTRE - TmpBuffer.CopyRect(Background, X, YPos); //a part of BackGround image - TmpBuffer.DrawWithoutCompose(X, YPos); -// TmpBuffer.Draw(X, YPos, 0, true); -} -#else - #endif #if USE_XTHEME @@ -2622,15 +2559,16 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST CHAR16 *Text, IN INTN XPos, I OldRow = Entries[ScrollState.CurrentSelection].Row; } #endif + + VOID REFIT_MENU_SCREEN::CountItems() { - INTN i; row0PosX = 0; row1PosX = Entries.size(); // layout row0Count = 0; //Nr items in row0 row1Count = 0; - for (i = 0; i < (INTN)Entries.size(); i++) { + for (INTN i = 0; i < (INTN)Entries.size(); i++) { if (Entries[i].Row == 0) { row0Count++; CONSTRAIN_MIN(row0PosX, i); @@ -2640,6 +2578,7 @@ VOID REFIT_MENU_SCREEN::CountItems() } } } + #if USE_XTHEME VOID REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align) { diff --git a/rEFIt_UEFI/libeg/XTheme.cpp b/rEFIt_UEFI/libeg/XTheme.cpp index c96f70d47..a9fe8b60b 100644 --- a/rEFIt_UEFI/libeg/XTheme.cpp +++ b/rEFIt_UEFI/libeg/XTheme.cpp @@ -707,6 +707,19 @@ void XTheme::InitBar() } } +//the purpose of the procedure is restore Background in rect +//XAlign is always centre, Color is the Backgrounf fill +//TODO replace by some existing procedure +VOID XTheme::FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Height) +{ + XImage TmpBuffer(Width, Height); + // TmpBuffer.CopyScaled(Background, 1.f); + INTN X = XPos - (Width >> 1); //X_IS_CENTRE + TmpBuffer.CopyRect(Background, X, YPos); //a part of BackGround image + TmpBuffer.DrawWithoutCompose(X, YPos); + // TmpBuffer.Draw(X, YPos, 0, true); +} + #endif // USE_XTHEME diff --git a/rEFIt_UEFI/libeg/libeg.h b/rEFIt_UEFI/libeg/libeg.h index 65db1325a..d51c603b5 100755 --- a/rEFIt_UEFI/libeg/libeg.h +++ b/rEFIt_UEFI/libeg/libeg.h @@ -38,7 +38,7 @@ #define __LIBEG_LIBEG_H__ #ifndef USE_XTHEME -#define USE_XTHEME 0 +#define USE_XTHEME 1 #endif #ifdef __cplusplus diff --git a/rEFIt_UEFI/refit/menu.cpp b/rEFIt_UEFI/refit/menu.cpp index 9293ef230..c69625896 100644 --- a/rEFIt_UEFI/refit/menu.cpp +++ b/rEFIt_UEFI/refit/menu.cpp @@ -193,7 +193,7 @@ static INTN row0PosY /*, row1PosY, textPosY, FunctextPosY*/; //static INTN MenuWidth, TimeoutPosY; //static INTN EntriesPosX, EntriesPosY; //static INTN EntriesWidth, EntriesHeight, EntriesGap; -//#if !USE_XTHEME +#if !USE_XTHEME EG_IMAGE* ScrollbarImage = NULL; EG_IMAGE* ScrollbarBackgroundImage = NULL; EG_IMAGE* UpButtonImage = NULL; @@ -213,7 +213,7 @@ EG_RECT ScrollbarBackground; EG_RECT Scrollbar; EG_RECT ScrollbarOldPointerPlace; EG_RECT ScrollbarNewPointerPlace; -//#endif +#endif // //INPUT_ITEM *InputItems = NULL; //UINTN InputItemsCount = 0; @@ -1382,7 +1382,7 @@ VOID AboutRefit(VOID) #else AboutMenu.AddMenuInfo_f(" Build: unknown"); #endif - AboutMenu.AddMenuInfo_f(""); + AboutMenu.AddMenuInfo_f(" "); AboutMenu.AddMenuInfo_f("Based on rEFIt (c) 2006-2010 Christoph Pfisterer"); AboutMenu.AddMenuInfo_f("Portions Copyright (c) Intel Corporation"); AboutMenu.AddMenuInfo_f("Developers:"); @@ -1395,7 +1395,7 @@ VOID AboutRefit(VOID) AboutMenu.AddMenuInfo_f(" ath, savvas, syscl, goodwin_c, clovy, jief_machak"); AboutMenu.AddMenuInfo_f("Credits also:"); AboutMenu.AddMenuInfo_f(" projectosx.com, applelife.ru, insanelymac.com"); - AboutMenu.AddMenuInfo_f(""); + AboutMenu.AddMenuInfo_f(" "); AboutMenu.AddMenuInfo_f("Running on:"); AboutMenu.AddMenuInfo_f(" EFI Revision %d.%02d", gST->Hdr.Revision >> 16, gST->Hdr.Revision & ((1 << 16) - 1)); @@ -2419,7 +2419,8 @@ VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN break; } -} + +#endif /** * Draw text with specific coordinates. @@ -2427,88 +2428,7 @@ VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN #if USE_XTHEME -INTN REFIT_MENU_SCREEN::DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign) -{ - INTN TextWidth = 0; - INTN XText = 0; - INTN Height; - INTN TextXYStyle = 1; -// EG_IMAGE *TextBufferXY = NULL; - XImage TextBufferXY(0,0); - if (Text.isEmpty()) { - return 0; - } - //TODO assume using embedded font for BootScreen - //messages must be TextXYStyle = 1 if it is provided by theme - if (!textFace[1].valid) { - if (textFace[2].valid) { - TextXYStyle = 2; - } else { - TextXYStyle = 0; - } - } -/* - * here we want to know how many place is needed for the graphical text - * the procedure worked for fixed width font but the problem appears with proportional fonts - * as well we not know yet the font using but egRenderText calculate later real width - * so make a place to be large enoungh - */ - egMeasureText(Text.data(), &TextWidth, NULL); - - if (XAlign == X_IS_LEFT) { - TextWidth = UGAWidth - XPos - 1; - XText = XPos; - } - - if (!isBootScreen && ThemeX.TypeSVG) { - TextWidth += TextHeight * 2; //give more place for buffer - if (!textFace[TextXYStyle].valid) { - DBG("no vaid text face for message!\n"); - Height = TextHeight; - } else { - Height = (int)(textFace[TextXYStyle].size * RowHeightFromTextHeight * ThemeX.Scale); - } - } else { - Height = TextHeight; - } - -// TextBufferXY = egCreateFilledImage(TextWidth, Height, TRUE, &MenuBackgroundPixel); - TextBufferXY.setSizeInPixels(TextWidth, Height); -// TextBufferXY.Fill(MenuBackgroundPixel); - - // render the text - INTN TextWidth2 = egRenderText(Text, &TextBufferXY, 0, 0, 0xFFFF, TextXYStyle); - // there is real text width but we already have an array with Width = TextWidth - // -// TextBufferXY.EnsureImageSize(TextWidth2, Height); //assume color = MenuBackgroundPixel - - if (XAlign != X_IS_LEFT) { - // shift 64 is prohibited - XText = XPos - (TextWidth2 >> XAlign); //X_IS_CENTER = 1 - } - - OldTextBufferRect.XPos = XText; - OldTextBufferRect.YPos = YPos; - OldTextBufferRect.Width = TextWidth2; - OldTextBufferRect.Height = Height; - - OldTextBufferImage.GetArea(OldTextBufferRect); - //GetArea may change sizes - OldTextBufferRect.Width = OldTextBufferImage.GetWidth(); - OldTextBufferRect.Height = OldTextBufferImage.GetHeight(); - - // DBG("draw text %ls\n", Text); - // DBG("pos=%d width=%d xtext=%d Height=%d Y=%d\n", XPos, TextWidth, XText, Height, YPos); - TextBufferXY.DrawOnBack(XText, YPos, ThemeX.Background); -// TextBufferXY.DrawWithoutCompose(XText, YPos); - return TextWidth2; -} - -void REFIT_MENU_SCREEN::EraseTextXY() -{ - OldTextBufferImage.Draw(OldTextBufferRect.XPos, OldTextBufferRect.YPos); -} #else @@ -2571,6 +2491,7 @@ INTN DrawTextXY(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAli * Helper function to draw text for Boot Camp Style. * @author: Needy */ +#if !USE_XTHEME VOID REFIT_MENU_SCREEN::DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign) { // check if text was provided @@ -2587,21 +2508,6 @@ VOID REFIT_MENU_SCREEN::DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN CHAR16 *BCSText = NULL; // more space, more characters -#if USE_XTHEME - if (ThemeX.TileXSpace >= 25 && ThemeX.TileXSpace < 30) { - MaxTextLen = 14; - } else if (ThemeX.TileXSpace >= 30 && ThemeX.TileXSpace < 35) { - MaxTextLen = 15; - } else if (ThemeX.TileXSpace >= 35 && ThemeX.TileXSpace < 40) { - MaxTextLen = 16; - } else if (ThemeX.TileXSpace >= 40 && ThemeX.TileXSpace < 45) { - MaxTextLen = 17; - } else if (ThemeX.TileXSpace >= 45 && ThemeX.TileXSpace < 50) { - MaxTextLen = 18; - } else if (ThemeX.TileXSpace >= 50) { - MaxTextLen = 19; - } -#else if (GlobalConfig.TileXSpace >= 25 && GlobalConfig.TileXSpace < 30) { MaxTextLen = 14; } else if (GlobalConfig.TileXSpace >= 30 && GlobalConfig.TileXSpace < 35) { @@ -2615,7 +2521,6 @@ VOID REFIT_MENU_SCREEN::DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN } else if (GlobalConfig.TileXSpace >= 50) { MaxTextLen = 19; } -#endif MaxTextLen += EllipsisLen; @@ -2636,65 +2541,16 @@ VOID REFIT_MENU_SCREEN::DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN StrnCatS(BCSText, MaxTextLen + 1, L"..", EllipsisLen); // redundant, used for safety measures BCSText[MaxTextLen] = '\0'; -#if USE_XTHEME - XStringW BCSTextX; - BCSTextX.takeValueFrom(BCSText); - DrawTextXY(BCSTextX, XPos, YPos, XAlign); -#else DrawTextXY(BCSText, XPos, YPos, XAlign); -#endif - FreePool(BCSText); } else { // draw full text -#if USE_XTHEME - XStringW TextX; - TextX.takeValueFrom(Text); - DrawTextXY(TextX, XPos, YPos, XAlign); -#else DrawTextXY(Text, XPos, YPos, XAlign); + } +} #endif - } -} - #if USE_XTHEME -VOID REFIT_MENU_SCREEN::DrawMenuText(IN XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN INTN Cursor) -{ - XImage TextBufferX(UGAWidth-XPos, TextHeight); - XImage SelectionBar(UGAWidth-XPos, TextHeight); -/* - if (Cursor == 0xFFFF) { //InfoLine = 0xFFFF - TextBufferX.Fill(MenuBackgroundPixel); - } else { - TextBufferX.Fill(InputBackgroundPixel); - } -*/ - - if (SelectedWidth > 0) { - // fill selection bar background - EG_RECT TextRect; - TextRect.Width = SelectedWidth; - TextRect.Height = TextHeight; - TextBufferX.FillArea(SelectionBackgroundPixel, TextRect); -// SelectionBar.Fill(SelectionBackgroundPixel); - } - SelectionBar.CopyRect(ThemeX.Background, XPos, YPos); -// SelectionBar.DrawWithoutCompose(XPos, YPos); -// TextBufferX.Compose(0, 0, ThemeX.Background, true); - // render the text - if (ThemeX.TypeSVG) { - //clovy - text vertically centred on Height - egRenderText(Text, &TextBufferX, 0, - (INTN)((TextHeight - (textFace[TextStyle].size * ThemeX.Scale)) / 2), - Cursor, TextStyle); - } else { - egRenderText(Text, &TextBufferX, TEXT_XMARGIN, TEXT_YMARGIN, Cursor, TextStyle); - } - SelectionBar.Compose(0, 0, TextBufferX, true); -// TextBufferX.DrawWithoutCompose(XPos, YPos); - SelectionBar.DrawWithoutCompose(XPos, YPos); -} #else VOID DrawMenuText(IN CONST CHAR16 *Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN INTN Cursor) @@ -2869,935 +2725,11 @@ VOID InitBar(VOID) } #endif -VOID REFIT_MENU_SCREEN::SetBar(INTN PosX, INTN UpPosY, INTN DownPosY, IN SCROLL_STATE *State) -{ -// DBG("SetBar <= %d %d %d %d %d\n", UpPosY, DownPosY, State->MaxVisible, State->MaxIndex, State->FirstVisible); -//SetBar <= 302 722 19 31 0 - UpButton.XPos = PosX; - UpButton.YPos = UpPosY; - - DownButton.XPos = UpButton.XPos; - DownButton.YPos = DownPosY; - - ScrollbarBackground.XPos = UpButton.XPos; - ScrollbarBackground.YPos = UpButton.YPos + UpButton.Height; - ScrollbarBackground.Width = UpButton.Width; - ScrollbarBackground.Height = DownButton.YPos - (UpButton.YPos + UpButton.Height); - - BarStart.XPos = ScrollbarBackground.XPos; - BarStart.YPos = ScrollbarBackground.YPos; - BarStart.Width = ScrollbarBackground.Width; - - BarEnd.Width = ScrollbarBackground.Width; - BarEnd.XPos = ScrollbarBackground.XPos; - BarEnd.YPos = DownButton.YPos - BarEnd.Height; - - ScrollStart.XPos = ScrollbarBackground.XPos; - ScrollStart.YPos = ScrollbarBackground.YPos + ScrollbarBackground.Height * State->FirstVisible / (State->MaxIndex + 1); - ScrollStart.Width = ScrollbarBackground.Width; - - Scrollbar.XPos = ScrollbarBackground.XPos; - Scrollbar.YPos = ScrollStart.YPos + ScrollStart.Height; - Scrollbar.Width = ScrollbarBackground.Width; - Scrollbar.Height = ScrollbarBackground.Height * (State->MaxVisible + 1) / (State->MaxIndex + 1) - ScrollStart.Height; - - ScrollEnd.Width = ScrollbarBackground.Width; - ScrollEnd.XPos = ScrollbarBackground.XPos; - ScrollEnd.YPos = Scrollbar.YPos + Scrollbar.Height - ScrollEnd.Height; - - Scrollbar.Height -= ScrollEnd.Height; - - ScrollTotal.XPos = UpButton.XPos; - ScrollTotal.YPos = UpButton.YPos; - ScrollTotal.Width = UpButton.Width; - ScrollTotal.Height = DownButton.YPos + DownButton.Height - UpButton.YPos; -// DBG("ScrollTotal.Height = %d\n", ScrollTotal.Height); //ScrollTotal.Height = 420 -} -#if USE_XTHEME -VOID REFIT_MENU_SCREEN::ScrollingBar() -{ - ScrollEnabled = (ScrollState.MaxFirstVisible != 0); - if (!ScrollEnabled) { - return; - } -#if 1 //use compose instead of Draw - //this is a copy of old algorithm - // but we can not use Total and Draw all parts separately assumed they composed on background - // it is #else - - XImage Total(ScrollTotal.Width, ScrollTotal.Height); -// Total.Fill(&MenuBackgroundPixel); - Total.CopyRect(ThemeX.Background, ScrollTotal.XPos, ScrollTotal.YPos); - if (!ThemeX.ScrollbarBackgroundImage.isEmpty()) { - for (INTN i = 0; i < ScrollbarBackground.Height; i+=ThemeX.ScrollbarBackgroundImage.GetHeight()) { - Total.Compose(ScrollbarBackground.XPos - ScrollTotal.XPos, ScrollbarBackground.YPos + i - ScrollTotal.YPos, ThemeX.ScrollbarBackgroundImage, FALSE); - } - } - Total.Compose(BarStart.XPos - ScrollTotal.XPos, BarStart.YPos - ScrollTotal.YPos, ThemeX.BarStartImage, FALSE); - Total.Compose(BarEnd.XPos - ScrollTotal.XPos, BarEnd.YPos - ScrollTotal.YPos, ThemeX.BarEndImage, FALSE); - if (!ThemeX.ScrollbarImage.isEmpty()) { - for (INTN i = 0; i < Scrollbar.Height; i+=ThemeX.ScrollbarImage.GetHeight()) { - Total.Compose(Scrollbar.XPos - ScrollTotal.XPos, Scrollbar.YPos + i - ScrollTotal.YPos, ThemeX.ScrollbarImage, FALSE); - } - } - Total.Compose(UpButton.XPos - ScrollTotal.XPos, UpButton.YPos - ScrollTotal.YPos, ThemeX.UpButtonImage, FALSE); - Total.Compose(DownButton.XPos - ScrollTotal.XPos, DownButton.YPos - ScrollTotal.YPos, ThemeX.DownButtonImage, FALSE); - Total.Compose(ScrollStart.XPos - ScrollTotal.XPos, ScrollStart.YPos - ScrollTotal.YPos, ThemeX.ScrollStartImage, FALSE); - Total.Compose(ScrollEnd.XPos - ScrollTotal.XPos, ScrollEnd.YPos - ScrollTotal.YPos, ThemeX.ScrollEndImage, FALSE); - Total.Draw(ScrollTotal.XPos, ScrollTotal.YPos, ThemeX.ScrollWidth / 16.f); //ScrollWidth can be set in theme.plist but usually=16 -#else - for (INTN i = 0; i < ScrollbarBackground.Height; i += ThemeX.ScrollbarBackgroundImage.GetHeight()) { - ThemeX.ScrollbarBackgroundImage.Draw(ScrollbarBackground.XPos - ScrollTotal.XPos, ScrollbarBackground.YPos + i - ScrollTotal.YPos, 1.f); - } - ThemeX.BarStartImage.Draw(BarStart.XPos - ScrollTotal.XPos, BarStart.YPos - ScrollTotal.YPos, 1.f); - ThemeX.BarEndImage.Draw(BarEnd.XPos - ScrollTotal.XPos, BarEnd.YPos - ScrollTotal.YPos, 1.f); - for (INTN i = 0; i < Scrollbar.Height; i += ThemeX.ScrollbarImage.GetHeight()) { - ThemeX.ScrollbarImage.Draw(Scrollbar.XPos - ScrollTotal.XPos, Scrollbar.YPos + i - ScrollTotal.YPos, 1.f); - } - ThemeX.UpButtonImage.Draw(UpButton.XPos - ScrollTotal.XPos, UpButton.YPos - ScrollTotal.YPos, 1.f); - ThemeX.DownButtonImage.Draw(DownButton.XPos - ScrollTotal.XPos, DownButton.YPos - ScrollTotal.YPos, 1.f); - ThemeX.ScrollStartImage.Draw(ScrollStart.XPos - ScrollTotal.XPos, ScrollStart.YPos - ScrollTotal.YPos, 1.f); - ThemeX.ScrollEndImage.Draw(ScrollEnd.XPos - ScrollTotal.XPos, ScrollEnd.YPos - ScrollTotal.YPos, 1.f); -#endif -} -#else -VOID REFIT_MENU_SCREEN::ScrollingBar() -{ - EG_IMAGE* Total; -// INTN i; - - ScrollEnabled = (ScrollState.MaxFirstVisible != 0); - if (ScrollEnabled) { - Total = egCreateFilledImage(ScrollTotal.Width, ScrollTotal.Height, TRUE, &MenuBackgroundPixel); - - if (ScrollbarBackgroundImage && ScrollbarBackgroundImage->Height) { - for (INTN i = 0; i < ScrollbarBackground.Height; i+=ScrollbarBackgroundImage->Height) { - egComposeImage(Total, ScrollbarBackgroundImage, ScrollbarBackground.XPos - ScrollTotal.XPos, ScrollbarBackground.YPos + i - ScrollTotal.YPos); - } - } - - egComposeImage(Total, BarStartImage, BarStart.XPos - ScrollTotal.XPos, BarStart.YPos - ScrollTotal.YPos); - egComposeImage(Total, BarEndImage, BarEnd.XPos - ScrollTotal.XPos, BarEnd.YPos - ScrollTotal.YPos); - - if (ScrollbarImage && ScrollbarImage->Height) { - for (INTN i = 0; i < Scrollbar.Height; i+=ScrollbarImage->Height) { - egComposeImage(Total, ScrollbarImage, Scrollbar.XPos - ScrollTotal.XPos, Scrollbar.YPos + i - ScrollTotal.YPos); - } - } - - egComposeImage(Total, UpButtonImage, UpButton.XPos - ScrollTotal.XPos, UpButton.YPos - ScrollTotal.YPos); - egComposeImage(Total, DownButtonImage, DownButton.XPos - ScrollTotal.XPos, DownButton.YPos - ScrollTotal.YPos); - egComposeImage(Total, ScrollStartImage, ScrollStart.XPos - ScrollTotal.XPos, ScrollStart.YPos - ScrollTotal.YPos); - egComposeImage(Total, ScrollEndImage, ScrollEnd.XPos - ScrollTotal.XPos, ScrollEnd.YPos - ScrollTotal.YPos); - - BltImageAlpha(Total, ScrollTotal.XPos, ScrollTotal.YPos, &MenuBackgroundPixel, ScrollWidth); - egFreeImage(Total); - } -} -#endif -/** - * Graphical menu. - */ -#if USE_XTHEME -VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText) -{ -// INTN iLast; - INTN Chosen = 0; - INTN ItemWidth = 0; - INTN t1, t2; - INTN VisibleHeight = 0; //assume vertical layout -// CHAR16 ResultString[TITLE_MAX_LEN]; // assume a title max length of around 128 - XStringW ResultString; - INTN PlaceCentre = 0; //(TextHeight / 2) - 7; - INTN PlaceCentre1 = 0; - UINTN OldChosenItem = ~(UINTN)0; - INTN TitleLen = 0; - INTN ScaledWidth = (INTN)(ThemeX.CharWidth * ThemeX.Scale); - // clovy - INTN ctrlX, ctrlY, ctrlTextX; - - HidePointer(); - - switch (Function) { - - case MENU_FUNCTION_INIT: - { - egGetScreenSize(&UGAWidth, &UGAHeight); - InitAnime(); - SwitchToGraphicsAndClear(); - - EntriesPosY = ((UGAHeight - (int)(LAYOUT_TOTAL_HEIGHT * ThemeX.Scale)) >> 1) + (int)(ThemeX.LayoutBannerOffset * ThemeX.Scale) + (TextHeight << 1); - - VisibleHeight = ((UGAHeight - EntriesPosY) / TextHeight) - InfoLines.size() - 2;/* - GlobalConfig.PruneScrollRows; */ - //DBG("MENU_FUNCTION_INIT 1 EntriesPosY=%d VisibleHeight=%d\n", EntriesPosY, VisibleHeight); - if ( Entries[0].getREFIT_INPUT_DIALOG() ) { - REFIT_INPUT_DIALOG& entry = (REFIT_INPUT_DIALOG&)Entries[0]; - if (entry.getREFIT_MENU_SWITCH()) { - if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 3) { - Chosen = (OldChosenTheme == 0xFFFF) ? 0: (OldChosenTheme + 1); - } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 90) { - Chosen = OldChosenConfig; - } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 116) { - Chosen = (OldChosenDsdt == 0xFFFF) ? 0: (OldChosenDsdt + 1); - } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 119) { - Chosen = OldChosenAudio; - } - } - } - InitScroll(Entries.size(), Entries.size(), VisibleHeight, Chosen); - // determine width of the menu - not working - //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; - } - 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(); - } else { - EntriesPosX = (UGAWidth - MenuWidth) >> 1; - } - TimeoutPosY = EntriesPosY + (Entries.size() + 1) * TextHeight; - - // initial painting - egMeasureText(Title.data(), &ItemWidth, NULL); - if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE)) { - DrawTextXY(Title, (UGAWidth >> 1), EntriesPosY - TextHeight * 2, X_IS_CENTER); - } - - if (!TitleImage.isEmpty()) { - INTN FilmXPos = (INTN)(EntriesPosX - (TitleImage.GetWidth() + (int)(TITLEICON_SPACING * ThemeX.Scale))); - INTN FilmYPos = (INTN)EntriesPosY; - // BltImageAlpha(TitleImage, FilmXPos, FilmYPos, &MenuBackgroundPixel, 16); - TitleImage.Draw(FilmXPos, FilmYPos); - - // update FilmPlace only if not set by InitAnime - if (FilmPlace.Width == 0 || FilmPlace.Height == 0) { - FilmPlace.XPos = FilmXPos; - FilmPlace.YPos = FilmYPos; - FilmPlace.Width = TitleImage.GetWidth(); - FilmPlace.Height = TitleImage.GetHeight(); - } - } - - if (InfoLines.size() > 0) { - // DrawMenuText(NULL, 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); - EntriesPosY += TextHeight; - } - EntriesPosY += TextHeight; // also add a blank line - } - ThemeX.InitBar(); - - break; - } - case MENU_FUNCTION_CLEANUP: - HidePointer(); - break; - - case MENU_FUNCTION_PAINT_ALL: - { -// DBG("PAINT_ALL: EntriesPosY=%lld MaxVisible=%lld\n", EntriesPosY, ScrollState.MaxVisible); -// DBG("DownButton.Height=%lld TextHeight=%lld MenuWidth=%lld\n", DownButton.Height, TextHeight, MenuWidth); - t2 = EntriesPosY + (ScrollState.MaxVisible + 1) * TextHeight - DownButton.Height; - t1 = EntriesPosX + TextHeight + MenuWidth + (INTN)((TEXT_XMARGIN + 16) * ThemeX.Scale); -// DBG("PAINT_ALL: X=%lld Y=%lld\n", t1, t2); - SetBar(t1, EntriesPosY, t2, &ScrollState); //823 302 554 - /* - 48:307 39:206 UGAWIdth=800 TitleImage=48 MenuWidth=333 - 48:635 0:328 PAINT_ALL: EntriesPosY=259 MaxVisible=13 - 48:640 0:004 DownButton.Height=0 TextHeight=21 MenuWidth=381 - 48:646 0:006 PAINT_ALL: X=622 Y=553 - */ - - // blackosx swapped this around so drawing of selection comes before drawing scrollbar. - - for (INTN i = ScrollState.FirstVisible, j = 0; i <= ScrollState.LastVisible; i++, j++) { - REFIT_ABSTRACT_MENU_ENTRY *Entry = &Entries[i]; - TitleLen = StrLen(Entry->Title); - - Entry->Place.XPos = EntriesPosX; - Entry->Place.YPos = EntriesPosY + j * TextHeight; - Entry->Place.Width = TitleLen * ScaledWidth; - Entry->Place.Height = (UINTN)TextHeight; - ResultString = Entry->Title; //create a copy to modify later - PlaceCentre = (INTN)((TextHeight - (INTN)(ThemeX.Buttons[2].GetHeight())) * ThemeX.Scale / 2); - PlaceCentre1 = (INTN)((TextHeight - (INTN)(ThemeX.Buttons[0].GetHeight())) * ThemeX.Scale / 2); - // clovy - - if (ThemeX.TypeSVG) - ctrlX = EntriesPosX; - else ctrlX = EntriesPosX + (INTN)(TEXT_XMARGIN * ThemeX.Scale); - ctrlTextX = ctrlX + ThemeX.Buttons[0].GetWidth() + (INTN)(TEXT_XMARGIN * ThemeX.Scale / 2); - ctrlY = Entry->Place.YPos + PlaceCentre; - - if ( Entry->getREFIT_INPUT_DIALOG() ) { - REFIT_INPUT_DIALOG* inputDialogEntry = Entry->getREFIT_INPUT_DIALOG(); - if (inputDialogEntry->Item && inputDialogEntry->Item->ItemType == BoolValue) { - Entry->Place.Width = ResultString.length() * ScaledWidth; - //possible artefacts - DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0, - ctrlTextX, - Entry->Place.YPos, 0xFFFF); - ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->BValue)?3:2].DrawOnBack(ctrlX, ctrlY, ThemeX.Background); - } else { - // text input - ResultString += ((REFIT_INPUT_DIALOG*)(Entry))->Item->SValue; - ResultString += L" "; - Entry->Place.Width = ResultString.length() * ScaledWidth; - // Slice - suppose to use Row as Cursor in text - DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? MenuWidth : 0, - EntriesPosX, - Entry->Place.YPos, TitleLen + Entry->Row); - } - } else if (Entry->getREFIT_MENU_CHECKBIT()) { - ThemeX.FillRectAreaOfScreen(ctrlTextX, Entry->Place.YPos, MenuWidth, TextHeight); - DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0, - ctrlTextX, - Entry->Place.YPos, 0xFFFF); - ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->IValue & Entry->Row)?3:2].DrawOnBack(ctrlX, ctrlY, ThemeX.Background); - } else if (Entry->getREFIT_MENU_SWITCH()) { - if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 3) { - //OldChosenItem = OldChosenTheme; - OldChosenItem = (OldChosenTheme == 0xFFFF) ? 0: (OldChosenTheme + 1); - } else if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 90) { - OldChosenItem = OldChosenConfig; - } else if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 116) { - OldChosenItem = (OldChosenDsdt == 0xFFFF) ? 0: (OldChosenDsdt + 1); - } else if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 119) { - OldChosenItem = OldChosenAudio; - } - - DrawMenuText(ResultString, - (i == ScrollState.CurrentSelection) ? MenuWidth : 0, - // clovy EntriesPosX + (TextHeight + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale)), - ctrlTextX, - Entry->Place.YPos, 0xFFFF); - ThemeX.Buttons[(Entry->Row == OldChosenItem)?1:0].DrawOnBack(ctrlX, ctrlY, ThemeX.Background); - } else { - //DBG("paint entry %d title=%ls\n", i, Entries[i]->Title); - DrawMenuText(ResultString, - (i == ScrollState.CurrentSelection) ? MenuWidth : 0, - EntriesPosX, Entry->Place.YPos, 0xFFFF); - } - } - - ScrollingBar(); //&ScrollState - inside the class - //MouseBirth(); - break; - } - case MENU_FUNCTION_PAINT_SELECTION: - { - // last selection - REFIT_ABSTRACT_MENU_ENTRY *EntryL = &Entries[ScrollState.LastSelection]; - REFIT_ABSTRACT_MENU_ENTRY *EntryC = &Entries[ScrollState.CurrentSelection]; - TitleLen = EntryL->Title.length(); - ResultString = EntryL->Title; - //clovy//PlaceCentre = (TextHeight - (INTN)(Buttons[2]->Height * GlobalConfig.Scale)) / 2; - //clovy//PlaceCentre = (PlaceCentre>0)?PlaceCentre:0; - //clovy//PlaceCentre1 = (TextHeight - (INTN)(Buttons[0]->Height * GlobalConfig.Scale)) / 2; - PlaceCentre = (INTN)((TextHeight - (INTN)(ThemeX.Buttons[2].GetHeight())) * ThemeX.Scale / 2); - PlaceCentre1 = (INTN)((TextHeight - (INTN)(ThemeX.Buttons[0].GetHeight())) * ThemeX.Scale / 2); - - // clovy - if (ThemeX.TypeSVG) - ctrlX = EntriesPosX; - else ctrlX = EntriesPosX + (INTN)(TEXT_XMARGIN * ThemeX.Scale); - ctrlTextX = ctrlX + ThemeX.Buttons[0].GetWidth() + (INTN)(TEXT_XMARGIN * ThemeX.Scale / 2); - - // redraw selection cursor - // 1. blackosx swapped this around so drawing of selection comes before drawing scrollbar. - // 2. usr-sse2 - if ( EntryL->getREFIT_INPUT_DIALOG() ) { - REFIT_INPUT_DIALOG* inputDialogEntry = (REFIT_INPUT_DIALOG*)EntryL; - if (inputDialogEntry->Item->ItemType == BoolValue) { //this is checkbox - //clovy - DrawMenuText(ResultString, 0, - ctrlTextX, - EntryL->Place.YPos, 0xFFFF); - ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].DrawOnBack(ctrlX, EntryL->Place.YPos + PlaceCentre, ThemeX.Background); - } else { - ResultString += (((REFIT_INPUT_DIALOG*)(EntryL))->Item->SValue + ((REFIT_INPUT_DIALOG*)(EntryL))->Item->LineShift); - ResultString += L" "; - DrawMenuText(ResultString, 0, EntriesPosX, - EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight, - TitleLen + EntryL->Row); - } - } else if (EntryL->getREFIT_MENU_SWITCH()) { //radio buttons 0,1 - - if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 3) { - OldChosenItem = (OldChosenTheme == 0xFFFF) ? 0: OldChosenTheme + 1; - } else if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 90) { - OldChosenItem = OldChosenConfig; - } else if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 116) { - OldChosenItem = (OldChosenDsdt == 0xFFFF) ? 0: OldChosenDsdt + 1; - } else if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 119) { - OldChosenItem = OldChosenAudio; - } - - // clovy - DrawMenuText(ResultString, 0, ctrlTextX, - EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight, 0xFFFF); - ThemeX.Buttons[(EntryL->Row == OldChosenItem)?1:0].DrawOnBack(ctrlX, EntryL->Place.YPos + PlaceCentre1, ThemeX.Background); - } else if (EntryL->getREFIT_MENU_CHECKBIT()) { - // clovy - DrawMenuText(ResultString, 0, ctrlTextX, - EntryL->Place.YPos, 0xFFFF); - ThemeX.Buttons[(EntryL->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryL->Row) ?3:2].DrawOnBack(ctrlX, EntryL->Place.YPos + PlaceCentre, ThemeX.Background); - } else { - DrawMenuText(EntryL->Title, 0, EntriesPosX, - EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight, 0xFFFF); - } - - // current selection - ResultString = EntryC->Title; - TitleLen = EntryC->Title.length(); - if ( EntryC->getREFIT_MENU_SWITCH() ) { - if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 3) { - OldChosenItem = (OldChosenTheme == 0xFFFF) ? 0: OldChosenTheme + 1;; - } else if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 90) { - OldChosenItem = OldChosenConfig; - } else if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 116) { - OldChosenItem = (OldChosenDsdt == 0xFFFF) ? 0: OldChosenDsdt + 1; - } else if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 119) { - OldChosenItem = OldChosenAudio; - } - } - - if ( EntryC->getREFIT_INPUT_DIALOG() ) { - REFIT_INPUT_DIALOG* inputDialogEntry = (REFIT_INPUT_DIALOG*)EntryC; - if (inputDialogEntry->Item->ItemType == BoolValue) { //checkbox - DrawMenuText(ResultString, MenuWidth, - ctrlTextX, - inputDialogEntry->Place.YPos, 0xFFFF); - ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].DrawOnBack(ctrlX, inputDialogEntry->Place.YPos + PlaceCentre, ThemeX.Background); - } else { - ResultString += (inputDialogEntry->Item->SValue + - inputDialogEntry->Item->LineShift); - ResultString += L" "; - DrawMenuText(ResultString, MenuWidth, EntriesPosX, - EntriesPosY + (ScrollState.CurrentSelection - ScrollState.FirstVisible) * TextHeight, - TitleLen + inputDialogEntry->Row); - } - } else if (EntryC->getREFIT_MENU_SWITCH()) { //radio - DrawMenuText(EntryC->Title, MenuWidth, - ctrlTextX, - EntriesPosY + (ScrollState.CurrentSelection - ScrollState.FirstVisible) * TextHeight, - 0xFFFF); - ThemeX.Buttons[(EntryC->Row == OldChosenItem)?1:0].DrawOnBack(ctrlX, EntryC->Place.YPos + PlaceCentre1, ThemeX.Background); - } else if (EntryC->getREFIT_MENU_CHECKBIT()) { - DrawMenuText(ResultString, MenuWidth, - ctrlTextX, - EntryC->Place.YPos, 0xFFFF); - ThemeX.Buttons[(EntryC->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryC->Row)?3:2].DrawOnBack(ctrlX, EntryC->Place.YPos + PlaceCentre, ThemeX.Background); - }else{ - DrawMenuText(EntryC->Title, MenuWidth, EntriesPosX, - EntriesPosY + (ScrollState.CurrentSelection - ScrollState.FirstVisible) * TextHeight, - 0xFFFF); - } - - ScrollStart.YPos = ScrollbarBackground.YPos + ScrollbarBackground.Height * ScrollState.FirstVisible / (ScrollState.MaxIndex + 1); - Scrollbar.YPos = ScrollStart.YPos + ScrollStart.Height; - ScrollEnd.YPos = Scrollbar.YPos + Scrollbar.Height; // ScrollEnd.Height is already subtracted - ScrollingBar(); //&ScrollState); - - break; - } - - case MENU_FUNCTION_PAINT_TIMEOUT: //ParamText should be XStringW - ResultString.takeValueFrom(ParamText); - INTN X = (UGAWidth - StrLen(ParamText) * ScaledWidth) >> 1; - DrawMenuText(ResultString, 0, X, TimeoutPosY, 0xFFFF); - break; - } - - MouseBirth(); -} - -#else - - -VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText) -{ - INTN i; - INTN j = 0; - INTN ItemWidth = 0; - INTN X, t1, t2; - INTN VisibleHeight = 0; //assume vertical layout - CHAR16 ResultString[TITLE_MAX_LEN]; // assume a title max length of around 128 - INTN PlaceCentre = 0; //(TextHeight / 2) - 7; - INTN PlaceCentre1 = 0; - UINTN OldChosenItem = ~(UINTN)0; - INTN TitleLen = 0; - INTN ScaledWidth = (INTN)(GlobalConfig.CharWidth * GlobalConfig.Scale); -// clovy - INTN ctrlX, ctrlY, ctrlTextX; - - HidePointer(); - - switch (Function) { - - case MENU_FUNCTION_INIT: - egGetScreenSize(&UGAWidth, &UGAHeight); - InitAnime(); - SwitchToGraphicsAndClear(); - - EntriesPosY = ((UGAHeight - (int)(LAYOUT_TOTAL_HEIGHT * GlobalConfig.Scale)) >> 1) + (int)(LayoutBannerOffset * GlobalConfig.Scale) + (TextHeight << 1); - - VisibleHeight = ((UGAHeight - EntriesPosY) / TextHeight) - InfoLines.size() - 2;/* - GlobalConfig.PruneScrollRows; */ - //DBG("MENU_FUNCTION_INIT 1 EntriesPosY=%d VisibleHeight=%d\n", EntriesPosY, VisibleHeight); - if ( Entries[0].getREFIT_INPUT_DIALOG() ) { - REFIT_INPUT_DIALOG& entry = (REFIT_INPUT_DIALOG&)Entries[0]; - if (entry.getREFIT_MENU_SWITCH()) { - if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 3) { - j = (OldChosenTheme == 0xFFFF) ? 0: (OldChosenTheme + 1); - } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 90) { - j = OldChosenConfig; - } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 116) { - j = (OldChosenDsdt == 0xFFFF) ? 0: (OldChosenDsdt + 1); - } else if (entry.getREFIT_MENU_SWITCH()->Item->IValue == 119) { - j = OldChosenAudio; - } - } - } - InitScroll(Entries.size(), Entries.size(), VisibleHeight, j); - // determine width of the menu - not working - //MenuWidth = 80; // minimum - MenuWidth = (int)(LAYOUT_TEXT_WIDTH * GlobalConfig.Scale); //500 - DrawMenuText(NULL, 0, 0, 0, 0); - - if (TitleImage) { - if (MenuWidth > (INTN)(UGAWidth - (int)(TITLEICON_SPACING * GlobalConfig.Scale) - TitleImage->Width)) { - MenuWidth = UGAWidth - (int)(TITLEICON_SPACING * GlobalConfig.Scale) - TitleImage->Width - 2; - } - EntriesPosX = (UGAWidth - (TitleImage->Width + (int)(TITLEICON_SPACING * GlobalConfig.Scale) + MenuWidth)) >> 1; - //DBG("UGAWIdth=%d TitleImage=%d MenuWidth=%d\n", UGAWidth, - //TitleImage->Width, MenuWidth); - MenuWidth += TitleImage->Width; - } else { - EntriesPosX = (UGAWidth - MenuWidth) >> 1; - } - TimeoutPosY = EntriesPosY + (Entries.size() + 1) * TextHeight; - - // initial painting - egMeasureText(Title, &ItemWidth, NULL); - if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_MENU_TITLE)) { - DrawTextXY(Title, (UGAWidth >> 1), EntriesPosY - TextHeight * 2, X_IS_CENTER); - } - - if (TitleImage) { - INTN FilmXPos = (INTN)(EntriesPosX - (TitleImage->Width + (int)(TITLEICON_SPACING * GlobalConfig.Scale))); - INTN FilmYPos = (INTN)EntriesPosY; - BltImageAlpha(TitleImage, FilmXPos, FilmYPos, &MenuBackgroundPixel, 16); - - // update FilmPlace only if not set by InitAnime - if (FilmPlace.Width == 0 || FilmPlace.Height == 0) { - FilmPlace.XPos = FilmXPos; - FilmPlace.YPos = FilmYPos; - FilmPlace.Width = TitleImage->Width; - FilmPlace.Height = TitleImage->Height; - } - } - - if (InfoLines.size() > 0) { - DrawMenuText(NULL, 0, 0, 0, 0); - for (i = 0; i < (INTN)InfoLines.size(); i++) { - DrawMenuText(InfoLines[i], 0, EntriesPosX, EntriesPosY, 0xFFFF); - EntriesPosY += TextHeight; - } - EntriesPosY += TextHeight; // also add a blank line - } - InitBar(); - - break; - - case MENU_FUNCTION_CLEANUP: - HidePointer(); - break; - - case MENU_FUNCTION_PAINT_ALL: - DrawMenuText(NULL, 0, 0, 0, 0); //should clean every line to avoid artefacts - // DBG("PAINT_ALL: EntriesPosY=%d MaxVisible=%d\n", EntriesPosY, ScrollState.MaxVisible); - // DBG("DownButton.Height=%d TextHeight=%d\n", DownButton.Height, TextHeight); - t2 = EntriesPosY + (ScrollState.MaxVisible + 1) * TextHeight - DownButton.Height; - t1 = EntriesPosX + TextHeight + MenuWidth + (INTN)((TEXT_XMARGIN + 16) * GlobalConfig.Scale); - // DBG("PAINT_ALL: %d %d\n", t1, t2); - SetBar(t1, EntriesPosY, t2, &ScrollState); //823 302 554 - - // blackosx swapped this around so drawing of selection comes before drawing scrollbar. - - for (i = ScrollState.FirstVisible, j = 0; i <= ScrollState.LastVisible; i++, j++) { - REFIT_ABSTRACT_MENU_ENTRY *Entry = &Entries[i]; - TitleLen = StrLen(Entry->Title); - - Entry->Place.XPos = EntriesPosX; - Entry->Place.YPos = EntriesPosY + j * TextHeight; - Entry->Place.Width = TitleLen * ScaledWidth; - Entry->Place.Height = (UINTN)TextHeight; - StrCpyS(ResultString, TITLE_MAX_LEN, Entry->Title); - //clovy//PlaceCentre1 = (TextHeight - (INTN)(Buttons[2]->Height * GlobalConfig.Scale)) / 2; - //clovy//PlaceCentre = (PlaceCentre>0)?PlaceCentre:0; - //clovy//PlaceCentre1 = (TextHeight - (INTN)(Buttons[0]->Height * GlobalConfig.Scale)) / 2; - PlaceCentre = (INTN)((TextHeight - (INTN)(Buttons[2]->Height)) * GlobalConfig.Scale / 2); - PlaceCentre1 = (INTN)((TextHeight - (INTN)(Buttons[0]->Height)) * GlobalConfig.Scale / 2); -// clovy - ctrlX = EntriesPosX + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale); - if (GlobalConfig.TypeSVG) - ctrlX = EntriesPosX; - ctrlTextX = ctrlX + Buttons[0]->Width + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale / 2); - ctrlY = Entry->Place.YPos + PlaceCentre; - - if ( Entry->getREFIT_INPUT_DIALOG() ) { - REFIT_INPUT_DIALOG* inputDialogEntry = Entry->getREFIT_INPUT_DIALOG(); - if (inputDialogEntry->Item->ItemType == BoolValue) { - Entry->Place.Width = StrLen(ResultString) * ScaledWidth; - DrawMenuText(L" ", 0, EntriesPosX, Entry->Place.YPos, 0xFFFF); - DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0, -// clovy EntriesPosX + (TextHeight + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale)), - ctrlTextX, - Entry->Place.YPos, 0xFFFF); - BltImageAlpha( (((REFIT_INPUT_DIALOG*)(Entry))->Item->BValue) ? Buttons[3] :Buttons[2], - ctrlX, ctrlY, - &MenuBackgroundPixel, 16); -// DBG("X=%d, Y=%d, ImageY=%d\n", EntriesPosX + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale), -// Entry->Place.YPos, Entry->Place.YPos + PlaceCentre); - - } else { - // text input - StrCatS(ResultString, TITLE_MAX_LEN, ((REFIT_INPUT_DIALOG*)(Entry))->Item->SValue); - StrCatS(ResultString, TITLE_MAX_LEN, L" "); - Entry->Place.Width = StrLen(ResultString) * ScaledWidth; - // Slice - suppose to use Row as Cursor in text - DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? MenuWidth : 0, - EntriesPosX, - Entry->Place.YPos, TitleLen + Entry->Row); - } - } else if (Entry->getREFIT_MENU_CHECKBIT()) { - DrawMenuText(L" ", 0, EntriesPosX, Entry->Place.YPos, 0xFFFF); - DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0, -// clovy EntriesPosX + (TextHeight + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale)), - ctrlTextX, - Entry->Place.YPos, 0xFFFF); - BltImageAlpha((((REFIT_INPUT_DIALOG*)(Entry))->Item->IValue & Entry->Row) ? Buttons[3] :Buttons[2], - ctrlX, - ctrlY, - &MenuBackgroundPixel, 16); - - } else if (Entry->getREFIT_MENU_SWITCH()) { - if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 3) { - //OldChosenItem = OldChosenTheme; - OldChosenItem = (OldChosenTheme == 0xFFFF) ? 0: (OldChosenTheme + 1); - } else if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 90) { - OldChosenItem = OldChosenConfig; - } else if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 116) { - OldChosenItem = (OldChosenDsdt == 0xFFFF) ? 0: (OldChosenDsdt + 1); - } else if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 119) { - OldChosenItem = OldChosenAudio; - } - - DrawMenuText(ResultString, - (i == ScrollState.CurrentSelection) ? MenuWidth : 0, -// clovy EntriesPosX + (TextHeight + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale)), - ctrlTextX, - Entry->Place.YPos, 0xFFFF); - BltImageAlpha((Entry->Row == OldChosenItem) ? Buttons[1] : Buttons[0], - ctrlX, - ctrlY, - &MenuBackgroundPixel, 16); - } else { - //DBG("paint entry %d title=%ls\n", i, Entries[i]->Title); - DrawMenuText(ResultString, - (i == ScrollState.CurrentSelection) ? MenuWidth : 0, - EntriesPosX, Entry->Place.YPos, 0xFFFF); - } - } - - ScrollingBar(); //&ScrollState - inside the class - //MouseBirth(); - break; - - case MENU_FUNCTION_PAINT_SELECTION: - { - // last selection - REFIT_ABSTRACT_MENU_ENTRY *EntryL = &Entries[ScrollState.LastSelection]; - REFIT_ABSTRACT_MENU_ENTRY *EntryC = &Entries[ScrollState.CurrentSelection]; - TitleLen = StrLen(EntryL->Title); - StrCpyS(ResultString, TITLE_MAX_LEN, EntryL->Title); - //clovy//PlaceCentre = (TextHeight - (INTN)(Buttons[2]->Height * GlobalConfig.Scale)) / 2; - //clovy//PlaceCentre = (PlaceCentre>0)?PlaceCentre:0; - //clovy//PlaceCentre1 = (TextHeight - (INTN)(Buttons[0]->Height * GlobalConfig.Scale)) / 2; - PlaceCentre = (INTN)((TextHeight - (INTN)(Buttons[2]->Height)) * GlobalConfig.Scale / 2); - PlaceCentre1 = (INTN)((TextHeight - (INTN)(Buttons[0]->Height)) * GlobalConfig.Scale / 2); - -// clovy - ctrlX = EntriesPosX + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale); - if (GlobalConfig.TypeSVG) - ctrlX = EntriesPosX; - ctrlTextX = ctrlX + Buttons[0]->Width + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale / 2); - - // redraw selection cursor - // 1. blackosx swapped this around so drawing of selection comes before drawing scrollbar. - // 2. usr-sse2 - if ( EntryL->getREFIT_INPUT_DIALOG() ) { - REFIT_INPUT_DIALOG* inputDialogEntry = (REFIT_INPUT_DIALOG*)EntryL; - if (inputDialogEntry->Item->ItemType == BoolValue) { - //clovy//DrawMenuText(ResultString, 0, EntriesPosX + (TextHeight + TEXT_XMARGIN), - //clovy// EntryL->Place.YPos, 0xFFFF); - DrawMenuText(ResultString, 0, - ctrlTextX, - EntryL->Place.YPos, 0xFFFF); - BltImageAlpha((inputDialogEntry->Item->BValue)? Buttons[3] : Buttons[2], - ctrlX, - EntryL->Place.YPos + PlaceCentre, - &MenuBackgroundPixel, 16); -// DBG("se:X=%d, Y=%d, ImageY=%d\n", EntriesPosX + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale), -// EntryL->Place.YPos, EntryL->Place.YPos + PlaceCentre); - } else { - StrCatS(ResultString, TITLE_MAX_LEN, ((REFIT_INPUT_DIALOG*)(EntryL))->Item->SValue + - ((REFIT_INPUT_DIALOG*)(EntryL))->Item->LineShift); - StrCatS(ResultString, TITLE_MAX_LEN, L" "); - DrawMenuText(ResultString, 0, EntriesPosX, - EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight, - TitleLen + EntryL->Row); - } - } else if (EntryL->getREFIT_MENU_SWITCH()) { - - if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 3) { - OldChosenItem = (OldChosenTheme == 0xFFFF) ? 0: OldChosenTheme + 1; - } else if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 90) { - OldChosenItem = OldChosenConfig; - } else if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 116) { - OldChosenItem = (OldChosenDsdt == 0xFFFF) ? 0: OldChosenDsdt + 1; - } else if (EntryL->getREFIT_MENU_SWITCH()->Item->IValue == 119) { - OldChosenItem = OldChosenAudio; - } - -// clovy -// DrawMenuText(ResultString, 0, EntriesPosX + (TextHeight + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale)), -// EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight, 0xFFFF); - DrawMenuText(ResultString, 0, ctrlTextX, - EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight, 0xFFFF); - BltImageAlpha((EntryL->Row == OldChosenItem) ? Buttons[1] : Buttons[0], - ctrlX, - EntryL->Place.YPos + PlaceCentre1, - &MenuBackgroundPixel, 16); - } else if (EntryL->getREFIT_MENU_CHECKBIT()) { -// clovy -// DrawMenuText(ResultString, 0, EntriesPosX + (TextHeight + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale)), -// EntryL->Place.YPos, 0xFFFF); - DrawMenuText(ResultString, 0, ctrlTextX, - EntryL->Place.YPos, 0xFFFF); - BltImageAlpha((EntryL->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryL->Row) ? Buttons[3] : Buttons[2], - ctrlX, - EntryL->Place.YPos + PlaceCentre, - &MenuBackgroundPixel, 16); -// DBG("ce:X=%d, Y=%d, ImageY=%d\n", EntriesPosX + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale), -// EntryL->Place.YPos, EntryL->Place.YPos + PlaceCentre); - } else { - DrawMenuText(EntryL->Title, 0, EntriesPosX, - EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight, 0xFFFF); - } - - // current selection - StrCpyS(ResultString, TITLE_MAX_LEN, EntryC->Title); - TitleLen = StrLen(EntryC->Title); - if ( EntryC->getREFIT_MENU_SWITCH() ) { - if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 3) { - OldChosenItem = (OldChosenTheme == 0xFFFF) ? 0: OldChosenTheme + 1;; - } else if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 90) { - OldChosenItem = OldChosenConfig; - } else if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 116) { - OldChosenItem = (OldChosenDsdt == 0xFFFF) ? 0: OldChosenDsdt + 1; - } else if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 119) { - OldChosenItem = OldChosenAudio; - } - } - - if ( EntryC->getREFIT_INPUT_DIALOG() ) { - REFIT_INPUT_DIALOG* inputDialogEntry = (REFIT_INPUT_DIALOG*)EntryC; - if (inputDialogEntry->Item->ItemType == BoolValue) { - DrawMenuText(ResultString, MenuWidth, - ctrlTextX, - inputDialogEntry->Place.YPos, 0xFFFF); - BltImageAlpha((inputDialogEntry->Item->BValue)? Buttons[3] : Buttons[2], - ctrlX, - inputDialogEntry->Place.YPos + PlaceCentre, - &MenuBackgroundPixel, 16); - } else { - StrCatS(ResultString, TITLE_MAX_LEN, inputDialogEntry->Item->SValue + - inputDialogEntry->Item->LineShift); - StrCatS(ResultString, TITLE_MAX_LEN, L" "); - DrawMenuText(ResultString, MenuWidth, EntriesPosX, - EntriesPosY + (ScrollState.CurrentSelection - ScrollState.FirstVisible) * TextHeight, - TitleLen + inputDialogEntry->Row); - } - } else if (EntryC->getREFIT_MENU_SWITCH()) { - StrCpyS(ResultString, TITLE_MAX_LEN, EntryC->Title); - DrawMenuText(ResultString, MenuWidth, - ctrlTextX, - EntriesPosY + (ScrollState.CurrentSelection - ScrollState.FirstVisible) * TextHeight, - 0xFFFF); - BltImageAlpha((EntryC->Row == OldChosenItem) ? Buttons[1]:Buttons[0], - ctrlX, - EntryC->Place.YPos + PlaceCentre1, - &MenuBackgroundPixel, 16); - } else if (EntryC->getREFIT_MENU_CHECKBIT()) { - DrawMenuText(ResultString, MenuWidth, - ctrlTextX, - EntryC->Place.YPos, 0xFFFF); - BltImageAlpha((EntryC->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryC->Row) ? Buttons[3] :Buttons[2], - ctrlX, - EntryC->Place.YPos + PlaceCentre, - &MenuBackgroundPixel, 16); - }else{ - DrawMenuText(EntryC->Title, MenuWidth, EntriesPosX, - EntriesPosY + (ScrollState.CurrentSelection - ScrollState.FirstVisible) * TextHeight, - 0xFFFF); - } - - ScrollStart.YPos = ScrollbarBackground.YPos + ScrollbarBackground.Height * ScrollState.FirstVisible / (ScrollState.MaxIndex + 1); - Scrollbar.YPos = ScrollStart.YPos + ScrollStart.Height; - ScrollEnd.YPos = Scrollbar.YPos + Scrollbar.Height; // ScrollEnd.Height is already subtracted - ScrollingBar(); //&ScrollState); - - break; - } - - case MENU_FUNCTION_PAINT_TIMEOUT: //ever be here? - X = (UGAWidth - StrLen(ParamText) * ScaledWidth) >> 1; - DrawMenuText(ParamText, 0, X, TimeoutPosY, 0xFFFF); - break; - } - - MouseBirth(); -} -#endif /** * Draw entries for GUI. */ #if USE_XTHEME -VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN XPos, INTN YPos) -{ - INTN MainSize = ThemeX.MainEntriesSize; - XImage MainImage(MainSize, MainSize); - XImage* BadgeImage; - - if (Entry->Row == 0 && Entry->getDriveImage() && !(ThemeX.HideBadges & HDBADGES_SWAP)) { - MainImage = *Entry->getDriveImage(); - } else { - MainImage = Entry->Image; //XImage - } - //this should be inited by the Theme - if (MainImage.isEmpty()) { - if (!IsEmbeddedTheme()) { - MainImage = ThemeX.GetIcon("os_mac"); - } - if (MainImage.isEmpty()) { - MainImage.DummyImage(MainSize); - } - } - INTN CompWidth = (Entry->Row == 0) ? ThemeX.row0TileSize : ThemeX.row1TileSize; - INTN CompHeight = CompWidth; - // DBG("Entry title=%ls; Width=%d\n", Entry->Title, MainImage->Width); - float fScale; - if (ThemeX.TypeSVG) { - fScale = (selected ? 1.f : -1.f); - } else { - fScale = ((Entry->Row == 0) ? (ThemeX.MainEntriesSize/128.f * (selected ? 1.f : -1.f)): 1.f) ; - } - - if (Entry->Row == 0) { - BadgeImage = Entry->getBadgeImage(); - } //else null - - XImage TopImage = ThemeX.SelectionImages[((Entry->Row == 0) ? 0 : 2) + (selected ? 0 : 1)]; - XImage Back(CompWidth, CompHeight); -// Back.GetArea(XPos, YPos, 0, 0); // this is background at this place - Back.CopyRect(ThemeX.Background, XPos, YPos); - - INTN OffsetX = (CompWidth - MainImage.GetWidth()) / 2; - OffsetX = (OffsetX > 0) ? OffsetX: 0; - INTN OffsetY = (CompHeight - MainImage.GetHeight()) / 2; - OffsetY = (OffsetY > 0) ? OffsetY: 0; - - if(ThemeX.SelectionOnTop) { - //place main image in centre. It may be OS or Drive - Back.Compose(OffsetX, OffsetY, MainImage, false); - } else { - Back.Compose(0, 0, TopImage, false); //selection first - Back.Compose(OffsetX, OffsetY, MainImage, false); - } - - // place the badge image - if (BadgeImage && - ((INTN)BadgeImage->GetWidth() + 8) < CompWidth && - ((INTN)BadgeImage->GetHeight() + 8) < CompHeight) { - - // Check for user badge x offset from theme.plist - if (ThemeX.BadgeOffsetX != 0xFFFF) { - // Check if value is between 0 and ( width of the main icon - width of badge ) - if (ThemeX.BadgeOffsetX < 0 || ThemeX.BadgeOffsetX > (CompWidth - (INTN)BadgeImage->GetWidth())) { - DBG("User offset X %lld is out of range\n", ThemeX.BadgeOffsetX); - ThemeX.BadgeOffsetX = CompWidth - 8 - BadgeImage->GetWidth(); - DBG(" corrected to default %lld\n", ThemeX.BadgeOffsetX); - } - OffsetX += ThemeX.BadgeOffsetX; - } else { - // Set default position - OffsetX += CompWidth - 8 - BadgeImage->GetWidth(); - } - // Check for user badge y offset from theme.plist - if (ThemeX.BadgeOffsetY != 0xFFFF) { - // Check if value is between 0 and ( height of the main icon - height of badge ) - if (ThemeX.BadgeOffsetY < 0 || ThemeX.BadgeOffsetY > (CompHeight - (INTN)BadgeImage->GetHeight())) { - DBG("User offset Y %lld is out of range\n",ThemeX.BadgeOffsetY); - ThemeX.BadgeOffsetY = CompHeight - 8 - BadgeImage->GetHeight(); - DBG(" corrected to default %lld\n", ThemeX.BadgeOffsetY); - } - OffsetY += ThemeX.BadgeOffsetY; - } else { - // Set default position - OffsetY += CompHeight - 8 - BadgeImage->GetHeight(); - } - Back.Compose(OffsetX, OffsetY, *BadgeImage, false); - } - - if(ThemeX.SelectionOnTop) { - Back.Compose(0, 0, TopImage, false); //selection at the top - } - Back.DrawWithoutCompose(XPos, YPos); - - - // draw BCS indicator - // Needy: if Labels (Titles) are hidden there is no point to draw the indicator - if (ThemeX.BootCampStyle && !(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)) { -// ThemeX.SelectionImages[4]->HasAlpha = TRUE; - - // indicator is for row 0, main entries, only - if (Entry->Row == 0) { -// BltImageAlpha(SelectionImages[4 + (selected ? 0 : 1)], -// XPos + (row0TileSize / 2) - (INTN)(INDICATOR_SIZE * 0.5f * GlobalConfig.Scale), -// row0PosY + row0TileSize + TextHeight + (INTN)((BCSMargin * 2) * GlobalConfig.Scale), -// &MenuBackgroundPixel, Scale); - TopImage = ThemeX.SelectionImages[4 + (selected ? 0 : 1)]; - TopImage.Draw(XPos + (ThemeX.row0TileSize / 2) - (INTN)(INDICATOR_SIZE * 0.5f * ThemeX.Scale), - row0PosY + ThemeX.row0TileSize + TextHeight + (INTN)((BCSMargin * 2) * ThemeX.Scale), fScale, false); - } - } - - Entry->Place.XPos = XPos; - Entry->Place.YPos = YPos; - Entry->Place.Width = MainImage.GetWidth(); - Entry->Place.Height = MainImage.GetHeight(); - -} #else @@ -3880,15 +2812,7 @@ VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN //the purpose of the procedure is restore Background in rect //XAlign is always centre, Color is the Backgrounf fill #if USE_XTHEME -VOID XTheme::FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Height) -{ - XImage TmpBuffer(Width, Height); -// TmpBuffer.CopyScaled(Background, 1.f); - INTN X = XPos - (Width >> 1); //X_IS_CENTRE - TmpBuffer.CopyRect(Background, X, YPos); //a part of BackGround image - TmpBuffer.DrawWithoutCompose(X, YPos); -// TmpBuffer.Draw(X, YPos, 0, true); -} + #else VOID FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Height, IN EG_PIXEL *Color, IN UINT8 XAlign) { @@ -3912,161 +2836,9 @@ VOID FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Hei } #endif + #if USE_XTHEME -VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos, IN INTN YPos) -{ - INTN TextWidth = 0; - INTN BadgeDim = (INTN)(BADGE_DIMENSION * ThemeX.Scale); - egMeasureText(Text.wc_str(), &TextWidth, NULL); - - //Clear old text -// if (OldTextWidth > TextWidth) { - ThemeX.FillRectAreaOfScreen(OldX, OldY, OldTextWidth, TextHeight); -// } - - if (!(ThemeX.BootCampStyle) - && (ThemeX.HideBadges & HDBADGES_INLINE) && (!OldRow) -// && (OldTextWidth) && (OldTextWidth != TextWidth) - ) { - //Clear badge - ThemeX.FillRectAreaOfScreen((OldX - (OldTextWidth >> 1) - (BadgeDim + 16)), - (OldY - ((BadgeDim - TextHeight) >> 1)), 128, 128); - } -// XStringW TextX; -// TextX.takeValueFrom(Text); - DrawTextXY(Text, XPos, YPos, X_IS_CENTER); - - //show inline badge - if (!(ThemeX.BootCampStyle) && - (ThemeX.HideBadges & HDBADGES_INLINE) && - (Entries[ScrollState.CurrentSelection].Row == 0)) { - // Display Inline Badge: small icon before the text - Entries[ScrollState.CurrentSelection].Image.Draw((XPos - (TextWidth >> 1) - (BadgeDim + 16)), - (YPos - ((BadgeDim - TextHeight) >> 1))); - } - - OldX = XPos; - OldY = YPos; - OldTextWidth = TextWidth; - OldRow = Entries[ScrollState.CurrentSelection].Row; -} -#else -VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos) -{ - INTN TextWidth; - INTN BadgeDim = (INTN)(BADGE_DIMENSION * GlobalConfig.Scale); - - egMeasureText(Text, &TextWidth, NULL); - - //Clear old text - if (OldTextWidth > TextWidth) { - FillRectAreaOfScreen(OldX, OldY, OldTextWidth, TextHeight, &MenuBackgroundPixel, X_IS_CENTER); - } - - if (!(GlobalConfig.BootCampStyle) - && (GlobalConfig.HideBadges & HDBADGES_INLINE) && (!OldRow) - && (OldTextWidth) && (OldTextWidth != TextWidth)) { - //Clear badge - BltImageAlpha(NULL, (OldX - (OldTextWidth >> 1) - (BadgeDim + 16)), - (OldY - ((BadgeDim - TextHeight) >> 1)), &MenuBackgroundPixel, BadgeDim >> 3); - } - DrawTextXY(Text, XPos, YPos, X_IS_CENTER); - - //show inline badge - if (!(GlobalConfig.BootCampStyle) && - (GlobalConfig.HideBadges & HDBADGES_INLINE) && - (Entries[ScrollState.CurrentSelection].Row == 0)) { - // Display Inline Badge: small icon before the text - BltImageAlpha(Entries[ScrollState.CurrentSelection].Image, - (XPos - (TextWidth >> 1) - (BadgeDim + 16)), - (YPos - ((BadgeDim - TextHeight) >> 1)), &MenuBackgroundPixel, BadgeDim >> 3); - } - - OldX = XPos; - OldY = YPos; - OldTextWidth = TextWidth; - OldRow = Entries[ScrollState.CurrentSelection].Row; -} -#endif -VOID REFIT_MENU_SCREEN::CountItems() -{ - INTN i; - row0PosX = 0; - row1PosX = Entries.size(); - // layout - row0Count = 0; //Nr items in row0 - row1Count = 0; - for (i = 0; i < (INTN)Entries.size(); i++) { - if (Entries[i].Row == 0) { - row0Count++; - CONSTRAIN_MIN(row0PosX, i); - } else { - row1Count++; - CONSTRAIN_MAX(row1PosX, i); - } - } -} -#if USE_XTHEME -VOID REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align) -{ - INTN Xpos; -// CHAR16 *Text = NULL; - XString Text; - - if ( - // HIDEUI_ALL - included - ((TextC == TEXT_CORNER_REVISION) && ((ThemeX.HideUIFlags & HIDEUI_FLAG_REVISION) != 0)) || - ((TextC == TEXT_CORNER_HELP) && ((ThemeX.HideUIFlags & HIDEUI_FLAG_HELP) != 0)) || - ((TextC == TEXT_CORNER_OPTIMUS) && (GlobalConfig.ShowOptimus == FALSE)) - ) { - return; - } - - switch (TextC) { - case TEXT_CORNER_REVISION: - // Display Clover boot volume - if (SelfVolume->VolLabel && SelfVolume->VolLabel[0] != L'#') { - // Text = PoolPrint(L"%s, booted from %s", gFirmwareRevision, SelfVolume->VolLabel); - Text = XString() + gFirmwareRevision + ", booted from " + SelfVolume->VolLabel; - } - if (Text.isEmpty()) { - Text = XString() + gFirmwareRevision + " " + SelfVolume->VolName; - } - break; - case TEXT_CORNER_HELP: - Text = XString() + "F1:Help"; - break; - case TEXT_CORNER_OPTIMUS: - if (gGraphics[0].Vendor != Intel) { - Text = XString() + "Discrete"; - } else { - Text = XString() + "Intel"; - } - // Text = (NGFX == 2)?L"Intel":L"Discrete"; - break; - default: - return; - } - - switch (Align) { - case X_IS_LEFT: - Xpos = (INTN)(TextHeight * 0.75f); - break; - case X_IS_RIGHT: - Xpos = UGAWidth - (INTN)(TextHeight * 0.75f);//2 - break; - case X_IS_CENTER: - Xpos = UGAWidth >> 1; - break; - default: - Text.setEmpty(); - return; - } - // DBG("draw text %ls at (%d, %d)\n", Text, Xpos, UGAHeight - 5 - TextHeight), - // clovy DrawTextXY(Text, Xpos, UGAHeight - 5 - TextHeight, Align); - DrawTextXY(Text, Xpos, UGAHeight - (INTN)(TextHeight * 1.5f), Align); -} #else VOID DrawTextCorner(UINTN TextC, UINT8 Align) { @@ -4129,528 +2901,6 @@ VOID DrawTextCorner(UINTN TextC, UINT8 Align) #endif - -#if USE_XTHEME -VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16 *ParamText) -{ -// INTN i; - INTN row0PosYRunning; - INTN VisibleHeight = 0; //assume vertical layout - INTN MessageHeight = 20; - - if (ThemeX.TypeSVG && textFace[1].valid) { - MessageHeight = (INTN)(textFace[1].size * RowHeightFromTextHeight * ThemeX.Scale); - } else { - MessageHeight = (INTN)(TextHeight * RowHeightFromTextHeight * ThemeX.Scale); - } - - switch (Function) { - - case MENU_FUNCTION_INIT: - egGetScreenSize(&UGAWidth, &UGAHeight); - InitAnime(); - SwitchToGraphicsAndClear(); - //BltClearScreen(FALSE); - //adjustable by theme.plist? - EntriesPosY = (int)(LAYOUT_Y_EDGE * ThemeX.Scale); - EntriesGap = (int)(ThemeX.TileYSpace * ThemeX.Scale); - EntriesWidth = ThemeX.MainEntriesSize + (int)(16 * ThemeX.Scale); - EntriesHeight = ThemeX.MainEntriesSize + (int)(16 * ThemeX.Scale); - // - VisibleHeight = (UGAHeight - EntriesPosY - (int)(LAYOUT_Y_EDGE * ThemeX.Scale) + EntriesGap) / (EntriesHeight + EntriesGap); - EntriesPosX = UGAWidth - EntriesWidth - (int)((BAR_WIDTH + LAYOUT_X_EDGE) * ThemeX.Scale); - TimeoutPosY = UGAHeight - (int)(LAYOUT_Y_EDGE * ThemeX.Scale) - MessageHeight * 2; //optimus + timeout texts - - CountItems(); - InitScroll(row0Count, Entries.size(), VisibleHeight, 0); - row0PosX = EntriesPosX; - row0PosY = EntriesPosY; - row1PosX = (UGAWidth + EntriesGap - (ThemeX.row1TileSize + (int)(TILE1_XSPACING * ThemeX.Scale)) * row1Count) >> 1; - textPosY = TimeoutPosY - (int)(ThemeX.TileYSpace * ThemeX.Scale) - MessageHeight; //message text - row1PosY = textPosY - ThemeX.row1TileSize - (int)(ThemeX.TileYSpace * ThemeX.Scale) - ThemeX.LayoutTextOffset; - if (!itemPosX) { - itemPosX = (__typeof__(itemPosX))AllocatePool(sizeof(UINT64) * Entries.size()); - itemPosY = (__typeof__(itemPosY))AllocatePool(sizeof(UINT64) * Entries.size()); - } - row0PosYRunning = row0PosY; - row1PosXRunning = row1PosX; - - // DBG("EntryCount =%d\n", Entries.size()); - for (INTN i = 0; i < (INTN)Entries.size(); i++) { - if (Entries[i].Row == 0) { - itemPosX[i] = row0PosX; - itemPosY[i] = row0PosYRunning; - row0PosYRunning += EntriesHeight + EntriesGap; - } else { - itemPosX[i] = row1PosXRunning; - itemPosY[i] = row1PosY; - row1PosXRunning += ThemeX.row1TileSize + (int)(ThemeX.TileXSpace * 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)); - FilmPlace = ThemeX.BannerPlace; - } - - ThemeX.InitBar(); - break; - - case MENU_FUNCTION_CLEANUP: - FreePool(itemPosX); - itemPosX = NULL; - FreePool(itemPosY); - itemPosY = NULL; - HidePointer(); - break; - - case MENU_FUNCTION_PAINT_ALL: - SetBar(EntriesPosX + EntriesWidth + (int)(10 * ThemeX.Scale), - EntriesPosY, UGAHeight - (int)(LAYOUT_Y_EDGE * ThemeX.Scale), &ScrollState); - for (INTN 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], itemPosY[i - ScrollState.FirstVisible]); - } - } else { //row1 - DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?1:0, - itemPosX[i], itemPosY[i]); - } - } - if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)){ - DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title, - (UGAWidth >> 1), textPosY); - } - - ScrollingBar(); //&ScrollState); - DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT); - DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER); - MouseBirth(); - break; - - case MENU_FUNCTION_PAINT_SELECTION: - HidePointer(); - if (Entries[ScrollState.LastSelection].Row == 0) { - DrawMainMenuEntry(&Entries[ScrollState.LastSelection], FALSE, - itemPosX[ScrollState.LastSelection - ScrollState.FirstVisible], - itemPosY[ScrollState.LastSelection - ScrollState.FirstVisible]); - } else { - DrawMainMenuEntry(&Entries[ScrollState.LastSelection], FALSE, - itemPosX[ScrollState.LastSelection], - itemPosY[ScrollState.LastSelection]); - } - - if (Entries[ScrollState.CurrentSelection].Row == 0) { - DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], TRUE, - itemPosX[ScrollState.CurrentSelection - ScrollState.FirstVisible], - itemPosY[ScrollState.CurrentSelection - ScrollState.FirstVisible]); - } else { - DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], TRUE, - itemPosX[ScrollState.CurrentSelection], - itemPosY[ScrollState.CurrentSelection]); - } - if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)) { - DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title, - (UGAWidth >> 1), textPosY); - } - - ScrollingBar(); //&ScrollState); - DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT); - DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER); - MouseBirth(); - break; - - case MENU_FUNCTION_PAINT_TIMEOUT: - INTN hi = MessageHeight * ((ThemeX.HideBadges & HDBADGES_INLINE)?3:1); - HidePointer(); - if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)) { - ThemeX.FillRectAreaOfScreen((UGAWidth >> 1), textPosY + hi, - OldTimeoutTextWidth, TextHeight); - XStringW TextX; - TextX.takeValueFrom(ParamText); - OldTimeoutTextWidth = DrawTextXY(TextX, (UGAWidth >> 1), textPosY + hi, X_IS_CENTER); - } - - DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT); - break; - - } -} -#else -VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16 *ParamText) -{ - INTN i; - INTN row0PosYRunning; - INTN VisibleHeight = 0; //assume vertical layout - INTN MessageHeight = 20; - - 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); - //adjustable by theme.plist? - EntriesPosY = (int)(LAYOUT_Y_EDGE * GlobalConfig.Scale); - EntriesGap = (int)(GlobalConfig.TileYSpace * GlobalConfig.Scale); - EntriesWidth = GlobalConfig.MainEntriesSize + (int)(16 * GlobalConfig.Scale); - EntriesHeight = GlobalConfig.MainEntriesSize + (int)(16 * GlobalConfig.Scale); - // - VisibleHeight = (UGAHeight - EntriesPosY - (int)(LAYOUT_Y_EDGE * GlobalConfig.Scale) + EntriesGap) / (EntriesHeight + EntriesGap); - EntriesPosX = UGAWidth - EntriesWidth - (int)((BAR_WIDTH + LAYOUT_X_EDGE) * GlobalConfig.Scale); - TimeoutPosY = UGAHeight - (int)(LAYOUT_Y_EDGE * GlobalConfig.Scale) - MessageHeight * 2; //optimus + timeout texts - - CountItems(); - InitScroll(row0Count, Entries.size(), VisibleHeight, 0); - row0PosX = EntriesPosX; - row0PosY = EntriesPosY; - row1PosX = (UGAWidth + EntriesGap - (row1TileSize + (int)(TILE1_XSPACING * GlobalConfig.Scale)) * row1Count) >> 1; - textPosY = TimeoutPosY - (int)(GlobalConfig.TileYSpace * GlobalConfig.Scale) - MessageHeight; //message text - row1PosY = textPosY - row1TileSize - (int)(GlobalConfig.TileYSpace * GlobalConfig.Scale) - LayoutTextOffset; - if (!itemPosX) { - itemPosX = (__typeof__(itemPosX))AllocatePool(sizeof(UINT64) * Entries.size()); - itemPosY = (__typeof__(itemPosY))AllocatePool(sizeof(UINT64) * Entries.size()); - } - row0PosYRunning = row0PosY; - row1PosXRunning = row1PosX; - - // DBG("EntryCount =%d\n", Entries.size()); - for (i = 0; i < (INTN)Entries.size(); i++) { - if (Entries[i].Row == 0) { - itemPosX[i] = row0PosX; - itemPosY[i] = row0PosYRunning; - row0PosYRunning += EntriesHeight + EntriesGap; - } else { - itemPosX[i] = row1PosXRunning; - itemPosY[i] = row1PosY; - row1PosXRunning += row1TileSize + (int)(TILE1_XSPACING* GlobalConfig.Scale); - // DBG("next item in row1 at x=%d\n", row1PosXRunning); - } - } - // initial painting - InitSelection(); - - // Update FilmPlace only if not set by InitAnime - if (FilmPlace.Width == 0 || FilmPlace.Height == 0) { - // CopyMem(&FilmPlace, &BannerPlace, sizeof(BannerPlace)); - FilmPlace = BannerPlace; - } - - InitBar(); - break; - - case MENU_FUNCTION_CLEANUP: - FreePool(itemPosX); - itemPosX = NULL; - FreePool(itemPosY); - itemPosY = NULL; - HidePointer(); - break; - - case MENU_FUNCTION_PAINT_ALL: - SetBar(EntriesPosX + EntriesWidth + (int)(10 * GlobalConfig.Scale), - EntriesPosY, UGAHeight - (int)(LAYOUT_Y_EDGE * GlobalConfig.Scale), &ScrollState); - 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], itemPosY[i - ScrollState.FirstVisible]); - } - } else { //row1 - DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?1:0, - itemPosX[i], itemPosY[i]); - } - } - if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)){ - DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title, - (UGAWidth >> 1), textPosY); - } - - ScrollingBar(); //&ScrollState); - DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT); - DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER); - MouseBirth(); - break; - - case MENU_FUNCTION_PAINT_SELECTION: - HidePointer(); - if (Entries[ScrollState.LastSelection].Row == 0) { - DrawMainMenuEntry(&Entries[ScrollState.LastSelection], FALSE, - itemPosX[ScrollState.LastSelection - ScrollState.FirstVisible], - itemPosY[ScrollState.LastSelection - ScrollState.FirstVisible]); - } else { - DrawMainMenuEntry(&Entries[ScrollState.LastSelection], FALSE, - itemPosX[ScrollState.LastSelection], - itemPosY[ScrollState.LastSelection]); - } - - if (Entries[ScrollState.CurrentSelection].Row == 0) { - DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], TRUE, - itemPosX[ScrollState.CurrentSelection - ScrollState.FirstVisible], - itemPosY[ScrollState.CurrentSelection - ScrollState.FirstVisible]); - } else { - DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], TRUE, - itemPosX[ScrollState.CurrentSelection], - itemPosY[ScrollState.CurrentSelection]); - } - if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) { - DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title, - (UGAWidth >> 1), textPosY); - } - - ScrollingBar(); //&ScrollState); - DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT); - DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER); - MouseBirth(); - break; - - case MENU_FUNCTION_PAINT_TIMEOUT: - i = (GlobalConfig.HideBadges & HDBADGES_INLINE)?3:1; - HidePointer(); - if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)){ - FillRectAreaOfScreen((UGAWidth >> 1), textPosY + MessageHeight * i, - OldTimeoutTextWidth, TextHeight, &MenuBackgroundPixel, X_IS_CENTER); - OldTimeoutTextWidth = DrawTextXY(ParamText, (UGAWidth >> 1), textPosY + MessageHeight * i, X_IS_CENTER); - } - - DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT); - break; - - } -} -#endif - -/** - * 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 (ThemeX.TypeSVG && textFace[1].valid) { - MessageHeight = (INTN)(textFace[1].size * RowHeightFromTextHeight * ThemeX.Scale); - } else { - MessageHeight = (INTN)(TextHeight * RowHeightFromTextHeight * ThemeX.Scale); - } - - switch (Function) { - - case MENU_FUNCTION_INIT: - egGetScreenSize(&UGAWidth, &UGAHeight); - InitAnime(); - 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 += ThemeX.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)); - FilmPlace = ThemeX.BannerPlace; - } - - //DBG("main menu inited\n"); - break; - - case MENU_FUNCTION_CLEANUP: - FreePool(itemPosX); - itemPosX = NULL; - HidePointer(); - break; - - case MENU_FUNCTION_PAINT_ALL: - - for (INTN 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] + (ThemeX.row0TileSize / 2); - // clear the screen - - ThemeX.FillRectAreaOfScreen(textPosX, textPosY, EntriesWidth + ThemeX.TileXSpace, - MessageHeight); - DrawBCSText(Entries[i].Title.data(), 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: - INTN hi = MessageHeight * ((ThemeX.HideBadges & HDBADGES_INLINE)?3:1); - HidePointer(); - if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)){ - ThemeX.FillRectAreaOfScreen((UGAWidth >> 1), FunctextPosY + hi, - OldTimeoutTextWidth, MessageHeight); - XStringW TextX; - TextX.takeValueFrom(ParamText); - OldTimeoutTextWidth = DrawTextXY(TextX, (UGAWidth >> 1), FunctextPosY + hi, X_IS_CENTER); - } - - - // indicator is for row 0, main entries, only - if (Entry->Row == 0) { - BltImageAlpha(SelectionImages[4 + (selected ? 0 : 1)], - XPos + (row0TileSize / 2) - (INTN)(INDICATOR_SIZE * 0.5f * GlobalConfig.Scale), - row0PosY + row0TileSize + TextHeight + (INTN)((BCSMargin * 2) * GlobalConfig.Scale), - &MenuBackgroundPixel, Scale); - } - } - - Entry->Place.XPos = XPos; - Entry->Place.YPos = YPos; - Entry->Place.Width = MainImage->Width; - Entry->Place.Height = MainImage->Height; - //we can't free MainImage because it may be new image or it may be a link to entry image - // a workaround - if (NewImageCreated) { - egFreeImage(MainImage); - } -} -#endif //the purpose of the procedure is restore Background in rect //XAlign is always centre, Color is the Backgrounf fill #if USE_XTHEME @@ -4677,70 +2927,6 @@ VOID FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Hei } #endif -#if USE_XTHEME - -#else -VOID DrawTextCorner(UINTN TextC, UINT8 Align) -{ - INTN Xpos; - CHAR16 *Text = NULL; - - if ( - // HIDEUI_ALL - included - ((TextC == TEXT_CORNER_REVISION) && ((GlobalConfig.HideUIFlags & HIDEUI_FLAG_REVISION) != 0)) || - ((TextC == TEXT_CORNER_HELP) && ((GlobalConfig.HideUIFlags & HIDEUI_FLAG_HELP) != 0)) || - ((TextC == TEXT_CORNER_OPTIMUS) && (GlobalConfig.ShowOptimus == FALSE)) - ) { - return; - } - - switch (TextC) { - case TEXT_CORNER_REVISION: - // Display Clover boot volume - if (SelfVolume->VolLabel && SelfVolume->VolLabel[0] != L'#') { - Text = PoolPrint(L"%s, booted from %s", gFirmwareRevision, SelfVolume->VolLabel); - } - if ( !Text ) { - Text = PoolPrint(L"%s", gFirmwareRevision, SelfVolume->VolName); - } - break; - case TEXT_CORNER_HELP: - Text = PoolPrint(L"F1:Help"); - break; - case TEXT_CORNER_OPTIMUS: - if (gGraphics[0].Vendor != Intel) { - Text = PoolPrint(L"Discrete"); - } else { - Text = PoolPrint(L"Intel"); - } - // Text = (NGFX == 2)?L"Intel":L"Discrete"; - break; - default: - return; - } - - switch (Align) { - case X_IS_LEFT: - Xpos = (INTN)(TextHeight * 0.75f); - break; - case X_IS_RIGHT: - Xpos = UGAWidth - (INTN)(TextHeight * 0.7f);//2 - break; - case X_IS_CENTER: - Xpos = UGAWidth >> 1; - break; - default: - if ( Text ) FreePool(Text); - return; - } - // DBG("draw text %ls at (%d, %d)\n", Text, Xpos, UGAHeight - 5 - TextHeight), - // clovy DrawTextXY(Text, Xpos, UGAHeight - 5 - TextHeight, Align); - DrawTextXY(Text, Xpos, UGAHeight - (INTN)(TextHeight * 1.5f), Align); - if ( Text ) FreePool(Text); -} -#endif - - // // user-callable dispatcher functions