more text procedures

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-03-26 23:32:31 +03:00
parent 8e42d69706
commit b58bcf7270
8 changed files with 339 additions and 142 deletions

View File

@ -5,7 +5,7 @@
#include "../cpp_foundation/XObjArray.h"
#include "../cpp_foundation/XString.h"
#include "libeg.h"
#include "nanosvg.h"
//#include "nanosvg.h"
#include "XImage.h"
@ -111,7 +111,7 @@ public:
void FillByEmbedded();
void FillByDir();
EFI_STATUS GetThemeTagSettings (void* DictPointer);
void parseTheme(NSVGparser* p, const char** dict); //in nano project
void parseTheme(void* p, const char** dict); //in nano project
//screen operations
void ClearScreen();

View File

@ -37,7 +37,7 @@
#ifndef __LIBEG_LIBEG_H__
#define __LIBEG_LIBEG_H__
#define USE_XTHEME 0
#define USE_XTHEME 1
#ifdef __cplusplus
extern "C" {

View File

@ -517,7 +517,7 @@ VOID egSetGraphicsModeEnabled(IN BOOLEAN Enable)
VOID egClearScreen(IN EG_PIXEL *Color)
{
EFI_UGA_PIXEL FillColor;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL FillColor;
if (!egHasGraphics)
return;
@ -531,10 +531,10 @@ VOID egClearScreen(IN EG_PIXEL *Color)
// EFI_GRAPHICS_OUTPUT_BLT_PIXEL and EFI_UGA_PIXEL have the same
// layout, and the header from TianoCore actually defines them
// to be the same type.
GraphicsOutput->Blt(GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)&FillColor, EfiBltVideoFill,
GraphicsOutput->Blt(GraphicsOutput, &FillColor, EfiBltVideoFill,
0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
} else if (UgaDraw != NULL) {
UgaDraw->Blt(UgaDraw, &FillColor, EfiUgaVideoFill,
UgaDraw->Blt(UgaDraw, (EFI_UGA_PIXEL*)&FillColor, EfiUgaVideoFill,
0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
}
}

View File

@ -3476,24 +3476,24 @@ static void nsvg__parseGroup(NSVGparser* p, const char** dict)
//parse Clover settings for theme
#if USE_XTHEME
void XTheme::parseTheme(NSVGparser* p, const char** dict)
void XTheme::parseTheme(void* parser, const char** dict)
{
int i;
NSVGparser* p = (NSVGparser*)parser;
BOOLEAN found = FALSE;
UINT32 Color = 0x80808080; //default value
for (i = 0; dict[i]; i += 2) {
for (int i = 0; dict[i]; i += 2) {
if (strcmp(dict[i], "SelectionOnTop") == 0) {
SelectionOnTop = getIntegerDict(dict[i+1])>0;
SelectionOnTop = getIntegerDict(dict[i+1]) > 0;
} else if (strcmp(dict[i], "BadgeOffsetX") == 0) {
BadgeOffsetX = getIntegerDict(dict[i + 1]);
} else if (strcmp(dict[i], "BadgeOffsetY") == 0) {
BadgeOffsetY = getIntegerDict(dict[i + 1]);
} else if (strcmp(dict[i], "NonSelectedGrey") == 0) {
NonSelectedGrey = getIntegerDict(dict[i + 1])>0;
NonSelectedGrey = getIntegerDict(dict[i + 1]) > 0;
} else if (strcmp(dict[i], "CharWidth") == 0) {
CharWidth = getIntegerDict(dict[i + 1]);
} else if (strcmp(dict[i], "BackgroundDark") == 0) {
BackgroundDark = getIntegerDict(dict[i + 1])>0;
BackgroundDark = getIntegerDict(dict[i + 1]) > 0;
} else if (strcmp(dict[i], "BackgroundSharp") == 0) {
BackgroundSharp = getIntegerDict(dict[i + 1]);
} else if (strcmp(dict[i], "BackgroundScale") == 0) {
@ -3533,7 +3533,7 @@ void XTheme::parseTheme(NSVGparser* p, const char** dict)
} else if (strcmp(dict[i], "VerticalLayout") == 0) {
VerticalLayout = getIntegerDict(dict[i + 1]) > 0;
} else if (strcmp(dict[i], "BootCampStyle") == 0) {
BootCampStyle = getIntegerDict(dict[i + 1])>0;
BootCampStyle = getIntegerDict(dict[i + 1]) > 0;
} else if (strcmp(dict[i], "AnimeFrames") == 0) {
NumFrames = getIntegerDict(dict[i + 1]);
if (NumFrames == 0xFFFF) {
@ -3969,7 +3969,12 @@ static void nsvg__startElement(void* ud, const char* el, const char** dict)
p->patternFlag = 1;
} else if (strcmp(el, "clover:theme") == 0) {
#if USE_XTHEME
ThemeX.parseTheme((void*)p, dict);
#else
parseTheme(p, dict);
#endif
} else {
strncpy(p->unknown, el, 63);
}

View File

@ -2024,8 +2024,9 @@ RefitMain (IN EFI_HANDLE ImageHandle,
BOOLEAN UniteConfigs = FALSE;
EFI_TIME Now;
BOOLEAN HaveDefaultVolume;
#if !USE_XTHEME
CHAR16 *FirstMessage;
#endif
// CHAR16 *InputBuffer; //, *Y;
// EFI_INPUT_KEY Key;
@ -2321,12 +2322,19 @@ RefitMain (IN EFI_HANDLE ImageHandle,
// DBG("DBG: messages\n");
if (!GlobalConfig.NoEarlyProgress && !GlobalConfig.FastBoot && GlobalConfig.Timeout>0) {
#if USE_XTHEME
XStringW Message = XStringWP(" Welcome to Clover ") + gFirmwareRevision;
DrawTextXY(Message, (UGAWidth >> 1), UGAHeight >> 1, X_IS_CENTER);
Message = XStringWP("... testing hardware ...");
DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
#else
FirstMessage = PoolPrint(L" Welcome to Clover %s ", gFirmwareRevision);
DrawTextXY(FirstMessage, (UGAWidth >> 1), UGAHeight >> 1, X_IS_CENTER);
FreePool(FirstMessage);
FirstMessage = PoolPrint(L"... testing hardware ...");
DrawTextXY(FirstMessage, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
FreePool(FirstMessage);
#endif
}
// DumpBiosMemoryMap();
@ -2386,10 +2394,15 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
if (!GlobalConfig.NoEarlyProgress && !GlobalConfig.FastBoot && GlobalConfig.Timeout>0) {
#if USE_XTHEME
XStringW Message = XStringWP("... user settings ...");
DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
#else
FirstMessage = PoolPrint(L"... user settings ...");
// i = (UGAWidth - StrLen(FirstMessage) * GlobalConfig.CharWidth) >> 1;
DrawTextXY(FirstMessage, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
FreePool(FirstMessage);
#endif
}
//Second step. Load config.plist into gSettings
@ -2458,9 +2471,14 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
if (!GlobalConfig.NoEarlyProgress && !GlobalConfig.FastBoot && GlobalConfig.Timeout>0) {
#if USE_XTHEME
XStringW Message = XStringWP("... scan entries ...");
DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
#else
FirstMessage = PoolPrint(L"... scan entries ...");
DrawTextXY(FirstMessage, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
FreePool(FirstMessage);
#endif
}
@ -2599,7 +2617,14 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
// font already changed and this message very quirky, clear line here
if (!GlobalConfig.NoEarlyProgress && !GlobalConfig.FastBoot && GlobalConfig.Timeout>0) {
#if USE_XTHEME
XStringW Message = XStringWP(" ");
DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
#else
DrawTextXY(L" ", (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
#endif
}
}
// wait for user ACK when there were errors

View File

@ -1820,7 +1820,7 @@ VOID HelpRefit(VOID)
[2] checkbox
[3] checkbox_checked
*/
#if !USE_XTHEME
VOID InitSelection(VOID)
{
@ -1971,7 +1971,7 @@ VOID InitSelection(VOID)
}
// DBG("selections inited\n");
}
#endif
//
// Scrolling functions
//
@ -3274,12 +3274,25 @@ VOID DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAl
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
}
}
@ -3400,7 +3413,7 @@ VOID FreeScrollBar(VOID)
}
}
#if !USE_XTHEME
VOID InitBar(VOID)
{
if (ThemeDir) {
@ -3486,6 +3499,7 @@ VOID InitBar(VOID)
}
}
#endif
VOID SetBar(INTN PosX, INTN UpPosY, INTN DownPosY, IN SCROLL_STATE *State)
{
@ -3641,7 +3655,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
InitAnime();
SwitchToGraphicsAndClear();
EntriesPosY = ((UGAHeight - (int)(LAYOUT_TOTAL_HEIGHT * ThemeX.Scale)) >> 1) + (int)(LayoutBannerOffset * ThemeX.Scale) + (TextHeight << 1);
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);
@ -3663,7 +3677,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
// determine width of the menu - not working
//MenuWidth = 80; // minimum
MenuWidth = (int)(LAYOUT_TEXT_WIDTH * ThemeX.Scale); //500
DrawMenuText(NULL, 0, 0, 0, 0);
// DrawMenuText(NULL, 0, 0, 0, 0);
if (!TitleImage.isEmpty()) {
if (MenuWidth > (INTN)(UGAWidth - (int)(TITLEICON_SPACING * ThemeX.Scale) - TitleImage.GetWidth())) {
@ -3681,7 +3695,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
// initial painting
egMeasureText(Title.data(), &ItemWidth, NULL);
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE)) {
DrawTextXY(Title.data(), (UGAWidth >> 1), EntriesPosY - TextHeight * 2, X_IS_CENTER);
DrawTextXY(Title, (UGAWidth >> 1), EntriesPosY - TextHeight * 2, X_IS_CENTER);
}
if (!TitleImage.isEmpty()) {
@ -3700,14 +3714,14 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
}
if (InfoLines.size() > 0) {
DrawMenuText(NULL, 0, 0, 0, 0);
for (i = 0; i < (INTN)InfoLines.size(); i++) {
// DrawMenuText(NULL, 0, 0, 0, 0);
for (UINTN i = 0; i < InfoLines.size(); i++) {
DrawMenuText(InfoLines[i], 0, EntriesPosX, EntriesPosY, 0xFFFF);
EntriesPosY += TextHeight;
}
EntriesPosY += TextHeight; // also add a blank line
}
InitBar();
ThemeX.InitBar();
break;
@ -3716,7 +3730,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
break;
case MENU_FUNCTION_PAINT_ALL:
DrawMenuText(NULL, 0, 0, 0, 0); //should clean every line to avoid artefacts
// 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;
@ -3752,8 +3766,8 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
REFIT_INPUT_DIALOG* inputDialogEntry = Entry->getREFIT_INPUT_DIALOG();
if (inputDialogEntry->Item && 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,
DrawMenuText(XStringWP(L" "), 0, EntriesPosX, Entry->Place.YPos, 0xFFFF);
DrawMenuText(XStringW().takeValueFrom(ResultString), (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0,
ctrlTextX,
Entry->Place.YPos, 0xFFFF);
ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->BValue)?3:2].Draw(ctrlX, ctrlY);
@ -3767,13 +3781,13 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
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,
DrawMenuText(XStringW().takeValueFrom(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); //clean the place
DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0,
DrawMenuText(XStringW().takeValueFrom(" "), 0, EntriesPosX, Entry->Place.YPos, 0xFFFF); //clean the place
DrawMenuText(XStringW().takeValueFrom(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);
@ -3789,7 +3803,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
OldChosenItem = OldChosenAudio;
}
DrawMenuText(ResultString,
DrawMenuText(XStringW().takeValueFrom(ResultString),
(i == ScrollState.CurrentSelection) ? MenuWidth : 0,
// clovy EntriesPosX + (TextHeight + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale)),
ctrlTextX,
@ -3797,7 +3811,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
ThemeX.Buttons[(Entry->Row == OldChosenItem)?1:0].Draw(ctrlX, ctrlY);
} else {
//DBG("paint entry %d title=%ls\n", i, Entries[i]->Title);
DrawMenuText(ResultString,
DrawMenuText(XStringW().takeValueFrom(ResultString),
(i == ScrollState.CurrentSelection) ? MenuWidth : 0,
EntriesPosX, Entry->Place.YPos, 0xFFFF);
}
@ -3833,7 +3847,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
REFIT_INPUT_DIALOG* inputDialogEntry = (REFIT_INPUT_DIALOG*)EntryL;
if (inputDialogEntry->Item->ItemType == BoolValue) {
//clovy
DrawMenuText(ResultString, 0,
DrawMenuText(XStringW().takeValueFrom(ResultString), 0,
ctrlTextX,
EntryL->Place.YPos, 0xFFFF);
ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].Draw(ctrlX, EntryL->Place.YPos + PlaceCentre);
@ -3843,7 +3857,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
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,
DrawMenuText(XStringW().takeValueFrom(ResultString), 0, EntriesPosX,
EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight,
TitleLen + EntryL->Row);
}
@ -3860,19 +3874,19 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
}
// clovy
DrawMenuText(ResultString, 0, ctrlTextX,
DrawMenuText(XStringW().takeValueFrom(ResultString), 0, ctrlTextX,
EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight, 0xFFFF);
ThemeX.Buttons[(EntryL->Row == OldChosenItem)?3:2].Draw(ctrlX, EntryL->Place.YPos + PlaceCentre1);
} else if (EntryL->getREFIT_MENU_CHECKBIT()) {
// clovy
DrawMenuText(ResultString, 0, ctrlTextX,
DrawMenuText(XStringW().takeValueFrom(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);
} else {
DrawMenuText(EntryL->Title, 0, EntriesPosX,
DrawMenuText(XStringW().takeValueFrom(EntryL->Title), 0, EntriesPosX,
EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight, 0xFFFF);
}
@ -3894,7 +3908,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
if ( EntryC->getREFIT_INPUT_DIALOG() ) {
REFIT_INPUT_DIALOG* inputDialogEntry = (REFIT_INPUT_DIALOG*)EntryC;
if (inputDialogEntry->Item->ItemType == BoolValue) {
DrawMenuText(ResultString, MenuWidth,
DrawMenuText(XStringW().takeValueFrom(ResultString), MenuWidth,
ctrlTextX,
inputDialogEntry->Place.YPos, 0xFFFF);
ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].Draw(ctrlX, inputDialogEntry->Place.YPos + PlaceCentre);
@ -3902,24 +3916,24 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
StrCatS(ResultString, TITLE_MAX_LEN, inputDialogEntry->Item->SValue +
inputDialogEntry->Item->LineShift);
StrCatS(ResultString, TITLE_MAX_LEN, L" ");
DrawMenuText(ResultString, MenuWidth, EntriesPosX,
DrawMenuText(XStringW().takeValueFrom(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,
DrawMenuText(XStringW().takeValueFrom(ResultString), MenuWidth,
ctrlTextX,
EntriesPosY + (ScrollState.CurrentSelection - ScrollState.FirstVisible) * TextHeight,
0xFFFF);
ThemeX.Buttons[(EntryC->Row == OldChosenItem)?1:0].Draw(ctrlX, EntryC->Place.YPos + PlaceCentre1);
} else if (EntryC->getREFIT_MENU_CHECKBIT()) {
DrawMenuText(ResultString, MenuWidth,
DrawMenuText(XStringW().takeValueFrom(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);
}else{
DrawMenuText(EntryC->Title, MenuWidth, EntriesPosX,
DrawMenuText(XStringW().takeValueFrom(EntryC->Title), MenuWidth, EntriesPosX,
EntriesPosY + (ScrollState.CurrentSelection - ScrollState.FirstVisible) * TextHeight,
0xFFFF);
}
@ -3934,7 +3948,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
case MENU_FUNCTION_PAINT_TIMEOUT: //ever be here?
X = (UGAWidth - StrLen(ParamText) * ScaledWidth) >> 1;
DrawMenuText(ParamText, 0, X, TimeoutPosY, 0xFFFF);
DrawMenuText(XStringW().takeValueFrom(ParamText), 0, X, TimeoutPosY, 0xFFFF);
break;
}
@ -4508,7 +4522,9 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST CHAR16 *Text, IN INTN XPos, I
ThemeX.FillRectAreaOfScreen((OldX - (OldTextWidth >> 1) - (BadgeDim + 16)),
(OldY - ((BadgeDim - TextHeight) >> 1)), 128, 128);
}
DrawTextXY(XStringW().takeValueFrom(Text), XPos, YPos, X_IS_CENTER);
XStringW TextX;
TextX.takeValueFrom(Text);
DrawTextXY(TextX, XPos, YPos, X_IS_CENTER);
//show inline badge
if (!(ThemeX.BootCampStyle) &&
@ -4580,7 +4596,67 @@ VOID REFIT_MENU_SCREEN::CountItems()
}
}
}
#if USE_XTHEME
VOID DrawTextCorner(UINTN TextC, UINT8 Align)
{
INTN Xpos;
// CHAR16 *Text = NULL;
XStringW 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) && (ThemeX.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 = XStringW() + gFirmwareRevision + ", booted from " + SelfVolume->VolLabel;
}
if (Text.isEmpty() ) {
Text = XStringW() + gFirmwareRevision + " " + SelfVolume->VolName);
}
break;
case TEXT_CORNER_HELP:
Text = XStringW() + "F1:Help";
break;
case TEXT_CORNER_OPTIMUS:
if (gGraphics[0].Vendor != Intel) {
Text = XStringW() + "Discrete";
} else {
Text = XStringW() + "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:
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)
{
INTN Xpos;
@ -4602,7 +4678,7 @@ VOID DrawTextCorner(UINTN TextC, UINT8 Align)
Text = PoolPrint(L"%s, booted from %s", gFirmwareRevision, SelfVolume->VolLabel);
}
if ( !Text ) {
Text = PoolPrint(L"%s", gFirmwareRevision, SelfVolume->VolName);
Text = PoolPrint(L"%s", gFirmwareRevision, SelfVolume->VolName);
}
break;
case TEXT_CORNER_HELP:
@ -4614,7 +4690,7 @@ VOID DrawTextCorner(UINTN TextC, UINT8 Align)
} else {
Text = PoolPrint(L"Intel");
}
// Text = (NGFX == 2)?L"Intel":L"Discrete";
// Text = (NGFX == 2)?L"Intel":L"Discrete";
break;
default:
return;
@ -4631,34 +4707,31 @@ VOID DrawTextCorner(UINTN TextC, UINT8 Align)
Xpos = UGAWidth >> 1;
break;
default:
if ( Text ) FreePool(Text);
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);
// clovy DrawTextXY(Text, Xpos, UGAHeight - 5 - TextHeight, Align);
DrawTextXY(Text, Xpos, UGAHeight - (INTN)(TextHeight * 1.5f), Align);
if ( Text ) FreePool(Text);
}
#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 USE_XTHEME
if (ThemeX.TypeSVG && textFace[1].valid) {
MessageHeight = (INTN)(textFace[1].size * RowHeightFromTextHeight * ThemeX.Scale);
} else {
MessageHeight = (INTN)(TextHeight * RowHeightFromTextHeight * ThemeX.Scale);
}
#else
if (GlobalConfig.TypeSVG && textFace[1].valid) {
MessageHeight = (INTN)(textFace[1].size * RowHeightFromTextHeight * GlobalConfig.Scale);
} else {
MessageHeight = (INTN)(TextHeight * RowHeightFromTextHeight * GlobalConfig.Scale);
}
#endif
switch (Function) {
@ -4668,6 +4741,156 @@ VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16
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 (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 = 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 (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:
int hi = (ThemeX.HideBadges & HDBADGES_INLINE)?3:1;
HidePointer();
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)) {
ThemeX.FillRectAreaOfScreen((UGAWidth >> 1), textPosY + MessageHeight * hi,
OldTimeoutTextWidth, TextHeight);
OldTimeoutTextWidth = DrawTextXY(XStringW().takeValueFrom(ParamText), (UGAWidth >> 1), textPosY + MessageHeight * 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);
@ -4709,7 +4932,8 @@ VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16
// Update FilmPlace only if not set by InitAnime
if (FilmPlace.Width == 0 || FilmPlace.Height == 0) {
CopyMem(&FilmPlace, &BannerPlace, sizeof(BannerPlace));
// CopyMem(&FilmPlace, &BannerPlace, sizeof(BannerPlace));
FilmPlace = BannerPlace;
}
InitBar();
@ -4779,19 +5003,7 @@ VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16
DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER);
MouseBirth();
break;
#if USE_XTHEME
case MENU_FUNCTION_PAINT_TIMEOUT:
i = (ThemeX.HideBadges & HDBADGES_INLINE)?3:1;
HidePointer();
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)){
ThemeX.FillRectAreaOfScreen((UGAWidth >> 1), textPosY + MessageHeight * i,
OldTimeoutTextWidth, TextHeight);
OldTimeoutTextWidth = DrawTextXY(XStringW().takeValueFrom(ParamText), (UGAWidth >> 1), textPosY + MessageHeight * i, X_IS_CENTER);
}
DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT);
break;
#else
case MENU_FUNCTION_PAINT_TIMEOUT:
i = (GlobalConfig.HideBadges & HDBADGES_INLINE)?3:1;
HidePointer();
@ -4803,9 +5015,10 @@ VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16
DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT);
break;
#endif
}
}
#endif
/**
* Main screen text.
@ -5115,61 +5328,27 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?1:0,
itemPosX[i - ScrollState.FirstVisible], row0PosY);
// draw static text for the boot options, BootCampStyle
#if USE_XTHEME
if (ThemeX.BootCampStyle && !(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)) {
INTN textPosX = itemPosX[i - ScrollState.FirstVisible] + (row0TileSize / 2);
// clear the screen
ThemeX.FillRectAreaOfScreen(textPosX, textPosY, EntriesWidth + GlobalConfig.TileXSpace,
MessageHeight);
DrawBCSText(Entries[i].Title, textPosX, textPosY, X_IS_CENTER);
}
#else
if (GlobalConfig.BootCampStyle && !(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) {
INTN textPosX = itemPosX[i - ScrollState.FirstVisible] + (row0TileSize / 2);
FillRectAreaOfScreen(textPosX, textPosY, EntriesWidth + GlobalConfig.TileXSpace,
MessageHeight, &MenuBackgroundPixel, X_IS_CENTER);
// draw the text
DrawBCSText(Entries[i].Title, textPosX, textPosY, X_IS_CENTER);
}
#endif
}
} else {
DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?1:0,
itemPosX[i], row1PosY);
}
}
#if USE_XTHEME
// 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);
}
#else
// clear the text from the second row, required by the BootCampStyle
if ((GlobalConfig.BootCampStyle) && (Entries[ScrollState.LastSelection].Row == 1)
&& (Entries[ScrollState.CurrentSelection].Row == 0) && !(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) {
FillRectAreaOfScreen((UGAWidth >> 1), FunctextPosY,
// clovy OldTextWidth, TextHeight, &MenuBackgroundPixel, X_IS_CENTER);
// clovy
OldTextWidth, MessageHeight, &MenuBackgroundPixel, X_IS_CENTER);
}
#endif
#if USE_XTHEME
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);
}
#else
if ((Entries[ScrollState.LastSelection].Row == 0) && (Entries[ScrollState.CurrentSelection].Row == 1)
&& GlobalConfig.BootCampStyle && !(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) {
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
@ -5183,7 +5362,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
(UGAWidth >> 1), textPosY);
}
#endif
DrawTextCorner(TEXT_CORNER_HELP, X_IS_LEFT);
DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER);
DrawTextCorner(TEXT_CORNER_REVISION, X_IS_RIGHT);
@ -5210,17 +5389,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], TRUE,
itemPosX[ScrollState.CurrentSelection], row1PosY);
}
#if USE_XTHEME
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);
}
#else
// create dynamic text for the second row if BootCampStyle is used
if ((GlobalConfig.BootCampStyle) && (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL))
&& Entries[ScrollState.CurrentSelection].Row == 1) {
@ -5233,7 +5402,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
DrawMainMenuLabel(Entries[ScrollState.CurrentSelection].Title,
(UGAWidth >> 1), textPosY);
}
#endif
DrawTextCorner(TEXT_CORNER_HELP, X_IS_LEFT);
DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER);
DrawTextCorner(TEXT_CORNER_REVISION, X_IS_RIGHT);
@ -5242,25 +5411,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
DBG("can't bear mouse at sel! Status=%s\n", strerror(Status));
}
break;
#if USE_XTHEME
case MENU_FUNCTION_PAINT_TIMEOUT:
i = (ThemeX.HideBadges & HDBADGES_INLINE)?3:1;
HidePointer();
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)){
ThemeX.FillRectAreaOfScreen((UGAWidth >> 1), FunctextPosY + MessageHeight * i,
OldTimeoutTextWidth, MessageHeight);
OldTimeoutTextWidth = DrawTextXY(XStringW().takeValueFrom(ParamText), (UGAWidth >> 1), FunctextPosY + MessageHeight * i, X_IS_CENTER);
}
DrawTextCorner(TEXT_CORNER_HELP, X_IS_LEFT);
DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER);
DrawTextCorner(TEXT_CORNER_REVISION, X_IS_RIGHT);
Status = MouseBirth();
if(EFI_ERROR(Status)) {
DBG("can't bear mouse at timeout! Status=%s\n", strerror(Status));
}
break;
#else
case MENU_FUNCTION_PAINT_TIMEOUT:
i = (GlobalConfig.HideBadges & HDBADGES_INLINE)?3:1;
HidePointer();
@ -5278,7 +5429,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
DBG("can't bear mouse at timeout! Status=%s\n", strerror(Status));
}
break;
#endif
}
}
#endif

View File

@ -9,7 +9,11 @@
VOID DrawMenuText(IN CONST CHAR16 *Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN INTN Cursor);
VOID OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry);
VOID FreeScrollBar(VOID);
#if USE_XTHEME
INTN DrawTextXY(IN XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
#else
INTN DrawTextXY(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
#endif
VOID DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
UINT64 TimeDiff(UINT64 t0, UINT64 t1); //double in Platform.h

View File

@ -416,7 +416,7 @@ typedef struct {
//same as EgRect but INTN <-> UINTN
*/
#if !USE_XTHEME
VOID BltClearScreen() //ShowBanner always TRUE. Called from line 400
{
EG_PIXEL *p1;
@ -590,7 +590,7 @@ VOID BltClearScreen() //ShowBanner always TRUE. Called from line 400
InputBackgroundPixel.a = (MenuBackgroundPixel.a + 0) & 0xFF;
GraphicsScreenDirty = FALSE;
}
#endif
VOID BltImage(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos)
{
if (!Image) {
@ -972,6 +972,16 @@ VOID REFIT_MENU_SCREEN::UpdateAnime()
// Check if the theme.plist setting for allowing an anim to be moved horizontally in the quest
// to avoid overlapping the menu text on menu pages at lower resolutions is set.
#if USE_XTHEME
if ((ID > 1) && (ThemeX.LayoutAnimMoveForMenuX != 0)) { // these screens have text menus which the anim may interfere with.
MenuWidth = (INTN)(TEXT_XMARGIN * 2 + (50 * ThemeX.CharWidth * ThemeX.Scale)); // taken from menu.c
if ((x + Film[0]->Width) > (UGAWidth - MenuWidth) >> 1) {
if ((x + ThemeX.LayoutAnimMoveForMenuX >= 0) || (UGAWidth-(x + ThemeX.LayoutAnimMoveForMenuX + Film[0]->Width)) <= 100) {
x += ThemeX.LayoutAnimMoveForMenuX;
}
}
}
#else
if ((ID > 1) && (LayoutAnimMoveForMenuX != 0)) { // these screens have text menus which the anim may interfere with.
MenuWidth = (INTN)(TEXT_XMARGIN * 2 + (50 * GlobalConfig.CharWidth * GlobalConfig.Scale)); // taken from menu.c
if ((x + Film[0]->Width) > (UGAWidth - MenuWidth) >> 1) {
@ -980,6 +990,8 @@ VOID REFIT_MENU_SCREEN::UpdateAnime()
}
}
}
#endif
Now = AsmReadTsc();
if (LastDraw == 0) {
@ -1018,7 +1030,7 @@ VOID REFIT_MENU_SCREEN::InitAnime()
EG_IMAGE *Last = NULL;
GUI_ANIME *Anime;
if (GlobalConfig.TextOnly) return;
if (ThemeX.TextOnly) return;
//
for (Anime = GuiAnime; Anime != NULL && Anime->ID != ID; Anime = Anime->Next);
@ -1044,7 +1056,7 @@ VOID REFIT_MENU_SCREEN::InitAnime()
if (Anime && Film == NULL) {
Path = Anime->Path;
Film = (EG_IMAGE**)AllocateZeroPool((Anime->Frames + 1) * sizeof(VOID*));
if ((GlobalConfig.TypeSVG || Path) && Film) {
if ((ThemeX.TypeSVG || Path) && Film) {
// Look through contents of the directory
UINTN i;
for (i = 0; i < Anime->Frames; i++) {
@ -1066,7 +1078,7 @@ VOID REFIT_MENU_SCREEN::InitAnime()
}
if (Film[0] != NULL) {
Frames = i;
DBG(" found %d frames of the anime\n", i);
DBG(" found %llu frames of the anime\n", i);
// Create background frame
Film[i] = egCreateImage(Film[0]->Width, Film[0]->Height, FALSE);
// Copy some settings from Anime into Screen