separate data in global config

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-03-27 19:50:17 +03:00
parent e5beea2f1b
commit 8f2c4b5efd
11 changed files with 211 additions and 51 deletions

View File

@ -1007,8 +1007,8 @@ typedef struct {
// GUI parameters // GUI parameters
BOOLEAN Debug; BOOLEAN Debug;
BOOLEAN Proportional; // BOOLEAN Proportional; //never used
// UINT8 Pad22[1]; UINT8 Pad22[1];
UINT32 DefaultBackgroundColor; UINT32 DefaultBackgroundColor;
//ACPI //ACPI

View File

@ -109,14 +109,87 @@ extern INTN ScrollBarDecorationsHeight;
extern INTN ScrollScrollDecorationsHeight; extern INTN ScrollScrollDecorationsHeight;
extern EFI_AUDIO_IO_PROTOCOL *AudioIo; extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
//extern INTN OldChosenAudio; //extern INTN OldChosenAudio;
/*
typedef struct {
INTN Timeout;
UINTN DisableFlags;
#if !USE_XTHEME
UINTN HideBadges;
UINTN HideUIFlags;
#endif
BOOLEAN TextOnly;
BOOLEAN Quiet;
BOOLEAN LegacyFirst;
BOOLEAN NoLegacy;
BOOLEAN DebugLog;
BOOLEAN FastBoot;
BOOLEAN NeverHibernate;
BOOLEAN StrictHibernate;
BOOLEAN RtcHibernateAware;
BOOLEAN HibernationFixup;
BOOLEAN SignatureFixup;
#if !USE_XTHEME
FONT_TYPE Font;
INTN CharWidth;
UINTN SelectionColor;
CHAR16 *FontFileName;
CHAR16 *Theme;
CHAR16 *BannerFileName;
CHAR16 *SelectionSmallFileName;
CHAR16 *SelectionBigFileName;
CHAR16 *SelectionIndicatorName;
CHAR16 *DefaultSelection;
#endif
CHAR16 *ScreenResolution;
INTN ConsoleMode;
BOOLEAN CustomIcons;
#if !USE_XTHEME
CHAR16 *BackgroundName;
SCALING BackgroundScale;
UINTN BackgroundSharp;
BOOLEAN BackgroundDark;
BOOLEAN SelectionOnTop;
BOOLEAN BootCampStyle;
INTN BadgeOffsetX;
INTN BadgeOffsetY;
INTN BadgeScale;
INTN ThemeDesignWidth;
INTN ThemeDesignHeight;
INTN BannerPosX;
INTN BannerPosY;
INTN BannerEdgeHorizontal;
INTN BannerEdgeVertical;
INTN BannerNudgeX;
INTN BannerNudgeY;
BOOLEAN VerticalLayout;
BOOLEAN NonSelectedGrey;
INTN MainEntriesSize;
INTN TileXSpace;
INTN TileYSpace;
#endif
INTN IconFormat;
BOOLEAN NoEarlyProgress;
INT32 Timezone;
BOOLEAN ShowOptimus;
#if !USE_XTHEME
BOOLEAN Proportional;
BOOLEAN DarkEmbedded;
BOOLEAN TypeSVG;
INTN Codepage;
INTN CodepageSize;
float Scale;
float CentreShift;
#endif
} REFIT_CONFIG;
*/
// global configuration with default values // global configuration with default values
REFIT_CONFIG GlobalConfig = { REFIT_CONFIG GlobalConfig = {
-1, // INTN Timeout; -1, // INTN Timeout;
0, // UINTN DisableFlags; 0, // UINTN DisableFlags;
#if !USE_XTHEME
0, // UINTN HideBadges; 0, // UINTN HideBadges;
0, // UINTN HideUIFlags; 0, // UINTN HideUIFlags;
#endif
FALSE, // BOOLEAN TextOnly; FALSE, // BOOLEAN TextOnly;
TRUE, // BOOLEAN Quiet; TRUE, // BOOLEAN Quiet;
FALSE, // BOOLEAN LegacyFirst; FALSE, // BOOLEAN LegacyFirst;
@ -126,6 +199,10 @@ REFIT_CONFIG GlobalConfig = {
FALSE, // BOOLEAN NeverHibernate; FALSE, // BOOLEAN NeverHibernate;
FALSE, // BOOLEAN StrictHibernate; FALSE, // BOOLEAN StrictHibernate;
FALSE, // BOOLEAN RtcHibernateAware; FALSE, // BOOLEAN RtcHibernateAware;
FALSE, // BOOLEAN HibernationFixup;
FALSE, // BOOLEAN SignatureFixup;
#if !USE_XTHEME
FONT_GRAY, // FONT_TYPE Font; //Welcome should be white FONT_GRAY, // FONT_TYPE Font; //Welcome should be white
9, // INTN CharWidth; 9, // INTN CharWidth;
0xFFFFFF80, // UINTN SelectionColor; 0xFFFFFF80, // UINTN SelectionColor;
@ -136,13 +213,15 @@ REFIT_CONFIG GlobalConfig = {
NULL, // CHAR16 *SelectionBigFileName; NULL, // CHAR16 *SelectionBigFileName;
NULL, // CHAR16 *SelectionIndicatorName; NULL, // CHAR16 *SelectionIndicatorName;
NULL, // CHAR16 *DefaultSelection; NULL, // CHAR16 *DefaultSelection;
#endif
NULL, // CHAR16 *ScreenResolution; NULL, // CHAR16 *ScreenResolution;
0, // INTN ConsoleMode; 0, // INTN ConsoleMode;
FALSE, // BOOLEAN CustomIcons;
#if !USE_XTHEME
NULL, // CHAR16 *BackgroundName; NULL, // CHAR16 *BackgroundName;
imNone, // SCALING BackgroundScale; imNone, // SCALING BackgroundScale;
0, // UINTN BackgroundSharp; 0, // UINTN BackgroundSharp;
FALSE, // BOOLEAN BackgroundDark; FALSE, // BOOLEAN BackgroundDark;
FALSE, // BOOLEAN CustomIcons;
FALSE, // BOOLEAN SelectionOnTop; FALSE, // BOOLEAN SelectionOnTop;
FALSE, // BOOLEAN BootCampStyle; FALSE, // BOOLEAN BootCampStyle;
0, // INTN BadgeOffsetX; 0, // INTN BadgeOffsetX;
@ -161,19 +240,20 @@ REFIT_CONFIG GlobalConfig = {
128, // INTN MainEntriesSize; 128, // INTN MainEntriesSize;
8, // INTN TileXSpace; 8, // INTN TileXSpace;
24, // INTN TileYSpace; 24, // INTN TileYSpace;
#endif
ICON_FORMAT_DEF, // INTN IconFormat; ICON_FORMAT_DEF, // INTN IconFormat;
FALSE, // BOOLEAN Proportional;
FALSE, // BOOLEAN NoEarlyProgress; FALSE, // BOOLEAN NoEarlyProgress;
0, // INT32 Timezone;
FALSE, // BOOLEAN ShowOptimus; FALSE, // BOOLEAN ShowOptimus;
FALSE, // BOOLEAN HibernationFixup; #if !USE_XTHEME
FALSE, // BOOLEAN SignatureFixup; FALSE, // BOOLEAN Proportional;
FALSE, // BOOLEAN DarkEmbedded; FALSE, // BOOLEAN DarkEmbedded;
FALSE, // BOOLEAN TypeSVG; FALSE, // BOOLEAN TypeSVG;
0, // INT32 Timezone;
0xC0, // INTN Codepage; 0xC0, // INTN Codepage;
0xC0, // INTN CodepageSize; //extended latin 0xC0, // INTN CodepageSize; //extended latin
1.0f, // float Scale; 1.0f, // float Scale;
0.0f, // float CentreShift; 0.0f, // float CentreShift;
#endif
}; };
static struct FIX_CONFIG { const CHAR8* oldName; const CHAR8* newName; UINT32 bitData; } FixesConfig[] = static struct FIX_CONFIG { const CHAR8* oldName; const CHAR8* newName; UINT32 bitData; } FixesConfig[] =
@ -2979,23 +3059,12 @@ GetEarlyUserSettings (
gSettings.PlayAsync = IsPropertyTrue (Prop); gSettings.PlayAsync = IsPropertyTrue (Prop);
// CustomIcons // CustomIcons
#if USE_XTHEME
Prop = GetProperty (DictPointer, "CustomIcons");
ThemeX.CustomIcons = IsPropertyTrue(Prop);
Prop = GetProperty (DictPointer, "ShowOptimus");
ThemeX.ShowOptimus = IsPropertyTrue (Prop);
Prop = GetProperty (DictPointer, "TextOnly");
ThemeX.TextOnly = IsPropertyTrue (Prop);
#else
Prop = GetProperty (DictPointer, "CustomIcons"); Prop = GetProperty (DictPointer, "CustomIcons");
GlobalConfig.CustomIcons = IsPropertyTrue(Prop); GlobalConfig.CustomIcons = IsPropertyTrue(Prop);
Prop = GetProperty (DictPointer, "ShowOptimus");
GlobalConfig.ShowOptimus = IsPropertyTrue (Prop);
Prop = GetProperty (DictPointer, "TextOnly"); Prop = GetProperty (DictPointer, "TextOnly");
GlobalConfig.TextOnly = IsPropertyTrue (Prop); GlobalConfig.TextOnly = IsPropertyTrue (Prop);
Prop = GetProperty (DictPointer, "ShowOptimus");
#endif GlobalConfig.ShowOptimus = IsPropertyTrue (Prop);
Prop = GetProperty (DictPointer, "ScreenResolution"); Prop = GetProperty (DictPointer, "ScreenResolution");
if (Prop != NULL) { if (Prop != NULL) {
@ -3923,7 +3992,7 @@ XTheme::GetThemeTagSettings (void* DictP)
Dict2 = GetProperty (Dict, "Tools"); Dict2 = GetProperty (Dict, "Tools");
if (Dict2 && Dict2->type == kTagTypeFalse) { if (Dict2 && Dict2->type == kTagTypeFalse) {
DisableFlags |= HIDEUI_FLAG_TOOLS; HideUIFlags |= HIDEUI_FLAG_TOOLS;
} }
Dict2 = GetProperty (Dict, "Label"); Dict2 = GetProperty (Dict, "Label");
@ -4012,7 +4081,17 @@ XTheme::GetThemeTagSettings (void* DictP)
FontFileName.takeValueFrom(Dict2->string); FontFileName.takeValueFrom(Dict2->string);
} }
} }
#if USE_XTHEME
Dict2 = GetProperty (Dict, "CharWidth");
ThemeX.CharWidth = (UINTN)GetPropertyInteger (Dict2, ThemeX.CharWidth);
if (ThemeX.CharWidth & 1) {
MsgLog("Warning! Character width %lld should be even!\n", ThemeX.CharWidth);
}
Dict2 = GetProperty (Dict, "Proportional");
ThemeX.Proportional = IsPropertyTrue (Dict2);
#else
Dict2 = GetProperty (Dict, "CharWidth"); Dict2 = GetProperty (Dict, "CharWidth");
CharWidth = (UINTN)GetPropertyInteger (Dict2, CharWidth); CharWidth = (UINTN)GetPropertyInteger (Dict2, CharWidth);
if (GlobalConfig.CharWidth & 1) { if (GlobalConfig.CharWidth & 1) {
@ -4020,7 +4099,10 @@ XTheme::GetThemeTagSettings (void* DictP)
} }
Dict2 = GetProperty (Dict, "Proportional"); Dict2 = GetProperty (Dict, "Proportional");
Proportional = IsPropertyTrue (Dict2); GlobalConfig.Proportional = IsPropertyTrue (Dict2);
#endif
} }
Dict = GetProperty (DictPointer, "Anime"); Dict = GetProperty (DictPointer, "Anime");
@ -4410,7 +4492,7 @@ GetThemeTagSettings (
Dict2 = GetProperty (Dict, "Tools"); Dict2 = GetProperty (Dict, "Tools");
if (Dict2 && Dict2->type == kTagTypeFalse) { if (Dict2 && Dict2->type == kTagTypeFalse) {
GlobalConfig.DisableFlags |= HIDEUI_FLAG_TOOLS; GlobalConfig.HideUIFlags |= HIDEUI_FLAG_TOOLS;
} }
Dict2 = GetProperty (Dict, "Label"); Dict2 = GetProperty (Dict, "Label");
@ -7228,7 +7310,18 @@ GetUserSettings(
} else { } else {
//DBG("\n ConfigName: %ls n", gSettings.ConfigName); //DBG("\n ConfigName: %ls n", gSettings.ConfigName);
} }
#if USE_XTHEME
if (gThemeChanged && ThemeX.Theme) {
DictPointer = GetProperty (Dict, "GUI");
if (DictPointer != NULL) {
Prop = GetProperty (DictPointer, "Theme");
if ((Prop != NULL) && (Prop->type == kTagTypeString) && Prop->string) {
ThemeX.Theme.takeValueFrom(Prop->string);
DBG ("Theme from new config: %ls\n", ThemeX.Theme.data());
}
}
}
#else
if (gThemeChanged && GlobalConfig.Theme) { if (gThemeChanged && GlobalConfig.Theme) {
DictPointer = GetProperty (Dict, "GUI"); DictPointer = GetProperty (Dict, "GUI");
if (DictPointer != NULL) { if (DictPointer != NULL) {
@ -7240,6 +7333,7 @@ GetUserSettings(
} }
} }
} }
#endif
SaveSettings(); SaveSettings();
} }

View File

@ -100,8 +100,10 @@ wchar_t * XStringW::forgetDataWithoutFreeing()
const XStringW& XStringW::takeValueFrom(const wchar_t* S) const XStringW& XStringW::takeValueFrom(const wchar_t* S)
{ {
if ( !S ) { if ( !S ) {
DebugLog(2, "takeValueFrom(const wchar_t* S) called with NULL. Use setEmpty()\n"); // DebugLog(2, "takeValueFrom(const wchar_t* S) called with NULL. Use setEmpty()\n");
panic(); // panic();
Init(0);
return *this;
} }
Init(wcslen(S)); Init(wcslen(S));
StrCpy(S); StrCpy(S);

View File

@ -689,8 +689,8 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
// get custom volume icon if present // get custom volume icon if present
#if USE_XTHEME #if USE_XTHEME
if (ThemeX.CustomIcons && FileExists(Volume->RootDir, L"\\.VolumeIcon.icns")){ if (GlobalConfig.CustomIcons && FileExists(Volume->RootDir, L"\\.VolumeIcon.icns")){
Entry->Image = LoadIcns(Volume->RootDir, L"\\.VolumeIcon.icns", 128); Entry->Image.LoadIcns(Volume->RootDir, L"\\.VolumeIcon.icns", 128);
DBG("using VolumeIcon.icns image from Volume\n"); DBG("using VolumeIcon.icns image from Volume\n");
} else if (Image) { } else if (Image) {
Entry->Image.FromEGImage(Image); Entry->Image.FromEGImage(Image);

View File

@ -102,6 +102,7 @@ public:
// will be used instead of old egLoadImage // will be used instead of old egLoadImage
EFI_STATUS LoadXImage(EFI_FILE *Dir, const XStringW& FileName); //for example LoadImage(ThemeDir, L"icons\\" + Name); EFI_STATUS LoadXImage(EFI_FILE *Dir, const XStringW& FileName); //for example LoadImage(ThemeDir, L"icons\\" + Name);
EFI_STATUS LoadXImage(EFI_FILE *Dir, const char* IconName); EFI_STATUS LoadXImage(EFI_FILE *Dir, const char* IconName);
EFI_STATUS LoadIcns(IN EFI_FILE *Dir, IN CONST CHAR16 *FileName, IN UINTN PixelSize);
void EnsureImageSize(IN UINTN Width, IN UINTN Height, IN CONST EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color); void EnsureImageSize(IN UINTN Width, IN UINTN Height, IN CONST EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color);
void DummyImage(IN UINTN PixelSize); void DummyImage(IN UINTN PixelSize);

View File

@ -108,7 +108,7 @@ XTheme::~XTheme() {
void XTheme::Init() void XTheme::Init()
{ {
DisableFlags = 0; // DisableFlags = 0;
HideBadges = 0; HideBadges = 0;
HideUIFlags = 0; HideUIFlags = 0;
TextOnly = FALSE; TextOnly = FALSE;
@ -126,7 +126,7 @@ void XTheme::Init()
BackgroundScale = imNone; // SCALING BackgroundScale = imNone; // SCALING
BackgroundSharp = 0; BackgroundSharp = 0;
BackgroundDark = FALSE; //TODO should be set to true if Night theme BackgroundDark = FALSE; //TODO should be set to true if Night theme
CustomIcons = FALSE; //TODO don't know how to handle with SVG theme // CustomIcons = FALSE; //TODO don't know how to handle with SVG theme
SelectionOnTop = FALSE; SelectionOnTop = FALSE;
BootCampStyle = FALSE; BootCampStyle = FALSE;
BadgeOffsetX = 0; BadgeOffsetX = 0;
@ -147,7 +147,7 @@ void XTheme::Init()
TileYSpace = 24; TileYSpace = 24;
// IconFormat = ICON_FORMAT_DEF; // IconFormat = ICON_FORMAT_DEF;
Proportional = FALSE; Proportional = FALSE;
ShowOptimus = FALSE; // ShowOptimus = FALSE;
DarkEmbedded = FALSE; //looks like redundant, we always check Night or Daylight DarkEmbedded = FALSE; //looks like redundant, we always check Night or Daylight
TypeSVG = FALSE; TypeSVG = FALSE;
Codepage = 0xC0; //this is for PNG theme Codepage = 0xC0; //this is for PNG theme

View File

@ -31,7 +31,7 @@ public:
XObjArray<Icon> Icons; XObjArray<Icon> Icons;
EFI_FILE *ThemeDir; EFI_FILE *ThemeDir;
UINTN DisableFlags; // UINTN DisableFlags;
UINTN HideBadges; UINTN HideBadges;
UINTN HideUIFlags; UINTN HideUIFlags;
BOOLEAN TextOnly; BOOLEAN TextOnly;
@ -49,7 +49,7 @@ public:
SCALING BackgroundScale; SCALING BackgroundScale;
INTN BackgroundSharp; INTN BackgroundSharp;
BOOLEAN BackgroundDark; BOOLEAN BackgroundDark;
BOOLEAN CustomIcons; // BOOLEAN CustomIcons;
BOOLEAN SelectionOnTop; BOOLEAN SelectionOnTop;
BOOLEAN BootCampStyle; BOOLEAN BootCampStyle;
INTN BadgeOffsetX; INTN BadgeOffsetX;
@ -70,7 +70,7 @@ public:
INTN TileYSpace; INTN TileYSpace;
// INTN IconFormat; // INTN IconFormat;
BOOLEAN Proportional; BOOLEAN Proportional;
BOOLEAN ShowOptimus; // BOOLEAN ShowOptimus;
BOOLEAN DarkEmbedded; BOOLEAN DarkEmbedded;
BOOLEAN TypeSVG; BOOLEAN TypeSVG;
INTN Codepage; INTN Codepage;

View File

@ -52,7 +52,7 @@
// //
// well-known icons // well-known icons
// //
#if !USE_XTHEME
BUILTIN_ICON BuiltinIconTable[] = { BUILTIN_ICON BuiltinIconTable[] = {
{ NULL, L"icons\\func_about" , L"png", /*48*/32 }, { NULL, L"icons\\func_about" , L"png", /*48*/32 },
{ NULL, L"icons\\func_options" , L"png", /*48*/32 }, { NULL, L"icons\\func_options" , L"png", /*48*/32 },
@ -128,7 +128,9 @@ CHAR16 * GetIconsExt(IN CONST CHAR16 *Icon, IN CONST CHAR16 *Def)
{ {
return PoolPrint(L"%s.%s", Icon, ((GlobalConfig.IconFormat != ICON_FORMAT_DEF) && (IconFormat != NULL)) ? IconFormat : Def); return PoolPrint(L"%s.%s", Icon, ((GlobalConfig.IconFormat != ICON_FORMAT_DEF) && (IconFormat != NULL)) ? IconFormat : Def);
} }
#endif
#if !USE_XTHEME
EG_IMAGE * BuiltinIcon(IN UINTN Id) EG_IMAGE * BuiltinIcon(IN UINTN Id)
{ {
INTN Size; INTN Size;
@ -292,11 +294,11 @@ EG_IMAGE * BuiltinIcon(IN UINTN Id)
return BuiltinIconTable[Id].Image; return BuiltinIconTable[Id].Image;
} }
#endif
// //
// Load an icon for an operating system // Load an icon for an operating system
// //
#if !USE_XTHEME
EG_IMAGE * LoadOSIcon(IN CONST CHAR16 *OSIconName OPTIONAL, IN CONST CHAR16 *FallbackIconName, IN UINTN PixelSize, IN BOOLEAN BootLogo, IN BOOLEAN WantDummy) EG_IMAGE * LoadOSIcon(IN CONST CHAR16 *OSIconName OPTIONAL, IN CONST CHAR16 *FallbackIconName, IN UINTN PixelSize, IN BOOLEAN BootLogo, IN BOOLEAN WantDummy)
{ {
EG_IMAGE *Image; EG_IMAGE *Image;
@ -373,11 +375,38 @@ EG_IMAGE * LoadOSIcon(IN CONST CHAR16 *OSIconName OPTIONAL, IN CONST CHAR16 *Fal
return DummyImage(PixelSize); return DummyImage(PixelSize);
} }
#endif
// //
// Load an image from a .icns file // Load an image from a .icns file
// //
#if USE_XTHEME
EFI_STATUS XImage::LoadIcns(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileName, IN UINTN PixelSize)
{
if (GlobalConfig.TextOnly) // skip loading if it's not used anyway
return EFI_SUCCESS;
if (BaseDir) {
EFI_STATUS Status = EFI_NOT_FOUND;
UINT8 *FileData = NULL;
UINTN FileDataLength = 0;
EG_IMAGE *NewImage;
// load file
Status = egLoadFile(BaseDir, FileName, &FileData, &FileDataLength);
if (EFI_ERROR(Status)) {
return Status;
}
// decode it
NewImage = egDecodeICNS(FileData, FileDataLength, PixelSize, TRUE);
Status = FromEGImage(NewImage);
FreePool(FileData);
return Status;
}
return EFI_NOT_FOUND;
}
#else
EG_IMAGE * LoadIcns(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileName, IN UINTN PixelSize) EG_IMAGE * LoadIcns(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileName, IN UINTN PixelSize)
{ {
if (GlobalConfig.TextOnly) // skip loading if it's not used anyway if (GlobalConfig.TextOnly) // skip loading if it's not used anyway
@ -393,18 +422,21 @@ EG_IMAGE * LoadIcns(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileName, IN UI
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
return NULL; return NULL;
} }
// decode it // decode it
NewImage = egDecodeICNS(FileData, FileDataLength, PixelSize, TRUE); NewImage = egDecodeICNS(FileData, FileDataLength, PixelSize, TRUE);
FreePool(FileData); FreePool(FileData);
return NewImage; return NewImage;
} }
return DummyImage(PixelSize); return DummyImage(PixelSize);
} }
#endif
#if !USE_XTHEME
EG_IMAGE * DummyImage(IN UINTN PixelSize) EG_IMAGE * DummyImage(IN UINTN PixelSize)
{ {
EG_IMAGE *Image; EG_IMAGE *Image;
@ -448,3 +480,4 @@ EG_IMAGE * LoadIcnsFallback(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileNam
// Image = DummyImage(PixelSize); // Image = DummyImage(PixelSize);
return Image; return Image;
} }
#endif

View File

@ -70,8 +70,11 @@ extern XTheme ThemeX; //global variable defined in lib.cpp
#endif #endif
#define REFIT_DEBUG (2) #define REFIT_DEBUG (2)
#if USE_XTHEME
#define Print if ((!GlobalConfig.Quiet) || (ThemeX.TextOnly)) Print
#else
#define Print if ((!GlobalConfig.Quiet) || (GlobalConfig.TextOnly)) Print #define Print if ((!GlobalConfig.Quiet) || (GlobalConfig.TextOnly)) Print
//#include "GenericBdsLib.h" #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -313,8 +316,10 @@ extern INTN ScrollbarYMovement;
typedef struct { typedef struct {
INTN Timeout; INTN Timeout;
UINTN DisableFlags; UINTN DisableFlags;
#if !USE_XTHEME
UINTN HideBadges; UINTN HideBadges;
UINTN HideUIFlags; UINTN HideUIFlags;
#endif
BOOLEAN TextOnly; BOOLEAN TextOnly;
BOOLEAN Quiet; BOOLEAN Quiet;
BOOLEAN LegacyFirst; BOOLEAN LegacyFirst;
@ -324,6 +329,9 @@ typedef struct {
BOOLEAN NeverHibernate; BOOLEAN NeverHibernate;
BOOLEAN StrictHibernate; BOOLEAN StrictHibernate;
BOOLEAN RtcHibernateAware; BOOLEAN RtcHibernateAware;
BOOLEAN HibernationFixup;
BOOLEAN SignatureFixup;
#if !USE_XTHEME
FONT_TYPE Font; FONT_TYPE Font;
INTN CharWidth; INTN CharWidth;
UINTN SelectionColor; UINTN SelectionColor;
@ -334,13 +342,15 @@ typedef struct {
CHAR16 *SelectionBigFileName; CHAR16 *SelectionBigFileName;
CHAR16 *SelectionIndicatorName; CHAR16 *SelectionIndicatorName;
CHAR16 *DefaultSelection; CHAR16 *DefaultSelection;
#endif
CHAR16 *ScreenResolution; CHAR16 *ScreenResolution;
INTN ConsoleMode; INTN ConsoleMode;
BOOLEAN CustomIcons;
#if !USE_XTHEME
CHAR16 *BackgroundName; CHAR16 *BackgroundName;
SCALING BackgroundScale; SCALING BackgroundScale;
UINTN BackgroundSharp; UINTN BackgroundSharp;
BOOLEAN BackgroundDark; BOOLEAN BackgroundDark;
BOOLEAN CustomIcons;
BOOLEAN SelectionOnTop; BOOLEAN SelectionOnTop;
BOOLEAN BootCampStyle; BOOLEAN BootCampStyle;
INTN BadgeOffsetX; INTN BadgeOffsetX;
@ -359,19 +369,20 @@ typedef struct {
INTN MainEntriesSize; INTN MainEntriesSize;
INTN TileXSpace; INTN TileXSpace;
INTN TileYSpace; INTN TileYSpace;
#endif
INTN IconFormat; INTN IconFormat;
BOOLEAN Proportional;
BOOLEAN NoEarlyProgress; BOOLEAN NoEarlyProgress;
INT32 Timezone;
BOOLEAN ShowOptimus; BOOLEAN ShowOptimus;
BOOLEAN HibernationFixup; #if !USE_XTHEME
BOOLEAN SignatureFixup; BOOLEAN Proportional;
BOOLEAN DarkEmbedded; BOOLEAN DarkEmbedded;
BOOLEAN TypeSVG; BOOLEAN TypeSVG;
INT32 Timezone;
INTN Codepage; INTN Codepage;
INTN CodepageSize; INTN CodepageSize;
float Scale; float Scale;
float CentreShift; float CentreShift;
#endif
} REFIT_CONFIG; } REFIT_CONFIG;
// types // types

View File

@ -2584,7 +2584,8 @@ RefitMain (IN EFI_HANDLE ImageHandle,
} }
// fixed other menu entries // fixed other menu entries
if (!(GlobalConfig.DisableFlags & HIDEUI_FLAG_TOOLS)) { #if USE_XTHEME
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_TOOLS)) {
AddCustomTool(); AddCustomTool();
if (!gSettings.DisableToolScan) { if (!gSettings.DisableToolScan) {
ScanTool(); ScanTool();
@ -2594,8 +2595,26 @@ RefitMain (IN EFI_HANDLE ImageHandle,
#endif // ENABLE_SECURE_BOOT #endif // ENABLE_SECURE_BOOT
} }
} }
#else
if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_TOOLS)) {
AddCustomTool();
if (!gSettings.DisableToolScan) {
ScanTool();
#ifdef ENABLE_SECURE_BOOT
// Check for secure boot setup mode
AddSecureBootTool();
#endif // ENABLE_SECURE_BOOT
}
}
#endif
#if USE_XTHEME
MenuEntryOptions.Image = ThemeX.GetIcon(BUILTIN_ICON_FUNC_OPTIONS);
#else
MenuEntryOptions.Image = BuiltinIcon(BUILTIN_ICON_FUNC_OPTIONS); MenuEntryOptions.Image = BuiltinIcon(BUILTIN_ICON_FUNC_OPTIONS);
#endif
if (gSettings.DisableCloverHotkeys) if (gSettings.DisableCloverHotkeys)
MenuEntryOptions.ShortcutLetter = 0x00; MenuEntryOptions.ShortcutLetter = 0x00;
MainMenu.AddMenuEntry(&MenuEntryOptions, false); MainMenu.AddMenuEntry(&MenuEntryOptions, false);

View File

@ -4625,7 +4625,7 @@ VOID DrawTextCorner(UINTN TextC, UINT8 Align)
// HIDEUI_ALL - included // HIDEUI_ALL - included
((TextC == TEXT_CORNER_REVISION) && ((ThemeX.HideUIFlags & HIDEUI_FLAG_REVISION) != 0)) || ((TextC == TEXT_CORNER_REVISION) && ((ThemeX.HideUIFlags & HIDEUI_FLAG_REVISION) != 0)) ||
((TextC == TEXT_CORNER_HELP) && ((ThemeX.HideUIFlags & HIDEUI_FLAG_HELP) != 0)) || ((TextC == TEXT_CORNER_HELP) && ((ThemeX.HideUIFlags & HIDEUI_FLAG_HELP) != 0)) ||
((TextC == TEXT_CORNER_OPTIMUS) && (ThemeX.ShowOptimus == FALSE)) ((TextC == TEXT_CORNER_OPTIMUS) && (GlobalConfig.ShowOptimus == FALSE))
) { ) {
return; return;
} }