demo other linux

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2020-04-23 14:36:35 +03:00
parent 574cc3261c
commit 16806d435f
8 changed files with 49 additions and 27 deletions

View File

@ -553,26 +553,26 @@ bool XString::DeleteIC(const XString &S)
}
#endif
#ifdef NOT_USED_ANYMORE_skqdjfhksqjhfksjqdf
void XString::ToLower(bool FirstCharIsCap)
{
if ( length() > 0 )
if ( size() > 0 )
{
unsigned int ui;
if ( FirstCharIsCap ) {
data()[0] = Majuscule(data()[0]);
// data()[0] = Majuscule(data()[0]);
ui = 1;
}else{
ui = 0;
}
for ( ; ui < length() ; ui+=1 ) {
data()[ui] = to_lower(data(ui));
for ( ; ui < size() ; ui+=1 ) {
m_data[ui] = to_lower(m_data[ui]);
}
}
}
#ifdef NOT_USED_ANYMORE_skqdjfhksqjhfksjqdf
bool XString::IsLetters() const
{
const char *p;

View File

@ -304,7 +304,7 @@ class XString
// friend bool operator >= (const XString& s1, const char* s2 ) { return s1.Compare(s2) >= 0; }
// friend bool operator >= (const char* s1, const XString& s2) { return s2.Compare(s1) <= 0; }
static char to_lower(char ch) { return (((ch >= L'A') && (ch <= L'Z')) ? ((ch - L'A') + L'a') : ch); }
static char to_lower(char ch) { return (((ch >= 'A') && (ch <= 'Z')) ? ((ch - 'A') + 'a') : ch); }
};
extern const XString NullXString;

View File

@ -639,6 +639,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
Entry->LoaderType = OSType;
OSIconName = L"linux";
if (Image == nullptr) {
DBG(" image not found\n");
OSIconName = LinuxIconNameFromPath(LoaderPath, Volume->RootDir); //something named "issue"
}
ShortcutLetter = 'L';
@ -1253,14 +1254,15 @@ VOID ScanLoader(VOID)
//DBG("Skip dot entries: %ls\n", DirEntry->FileName);
continue;
}
XStringW OSName = SWPrintf("%ls", DirEntry->FileName); //this is folder name "ubuntu"
XString OSName = SPrintf("%ls", DirEntry->FileName); //this is folder name "ubuntu"
XStringW File = SWPrintf("EFI\\%ls\\grubx64.efi", DirEntry->FileName);
if (FileExists(SelfRootDir, File.wc_str())) {
XStringW LoaderTitle = OSName + L" OS EFI boot menu"_XSW;
XStringW IconXSW = OSName + L",linux";
IconXSW.ToLower(); //to avoid misconception
XStringW LoaderTitle = SWPrintf("%s OS EFI boot menu", OSName.c_str());
XString IconXS = OSName + ",linux"_XS;
IconXS.ToLower(); //to avoid misconception
DBG(" found entry %s\n", IconXS.c_str());
XImage ImageX; //will the image be destroyed or rewritten by next image after the cycle end?
ImageX.LoadXImage(ThemeX.ThemeDir, IconXSW);
ImageX = ThemeX.LoadOSIcon(IconXS);
AddLoaderEntry(File.wc_str(), ""_XS, LoaderTitle, Volume,
(ImageX.isEmpty() ? NULL : &ImageX), OSTYPE_LINEFI, OSFLAG_NODEFAULTARGS);
} //anyway continue search other entries

View File

@ -36,7 +36,8 @@
#include "XTheme.h"
extern XTheme ThemeX;
extern CONST CHAR8* IconsNames[];
extern const CHAR8* IconsNames[];
extern const INTN IconsNamesSize;
#define NSVG_RGB(r, g, b) (((unsigned int)b) | ((unsigned int)g << 8) | ((unsigned int)r << 16))
@ -286,7 +287,6 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
DBG(" parsed banner->width=%lld height=%lld\n", Banner.GetWidth(), BanHeight); //parsed banner->width=467 height=89
// --- Make other icons
for (INTN i = BUILTIN_ICON_FUNC_ABOUT; i <= BUILTIN_CHECKBOX_CHECKED; ++i) {
if (i == BUILTIN_ICON_BANNER) { //exclude "logo" as it done as Banner
continue;
@ -298,12 +298,28 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
if (!EFI_ERROR(Status)) {
ParseSVGXIcon(i, NewIcon->Name + "_night"_XS, &NewIcon->ImageNight);
}
// DBG("parse %s status %s\n", NewIcon->Name.c_str(), strerror(Status));
Icons.AddReference(NewIcon, true);
if (EFI_ERROR(Status) && i >= BUILTIN_ICON_VOL_INTERNAL_HFS && i <= BUILTIN_ICON_VOL_INTERNAL_REC) {
// call to GetIconAlt will get alternate/embedded into Icon if missing
DBG(" get alt icon for %lld\n", i);
GetIconAlt(i, BUILTIN_ICON_VOL_INTERNAL);
}
}
// --- Make other OSes
for (INTN i = ICON_OTHER_OS; i < IconsNamesSize; ++i) {
if (AsciiStrLen(IconsNames[i]) == 0) break;
Icon* NewIcon = new Icon(i, false); //initialize without embedded
Status = ParseSVGXIcon(i, NewIcon->Name, &NewIcon->Image);
// DBG("parse %s i=%lld status %s\n", NewIcon->Name.c_str(), i, strerror(Status));
NewIcon->Native = !EFI_ERROR(Status);
if (!EFI_ERROR(Status)) {
ParseSVGXIcon(i, NewIcon->Name + "_night"_XS, &NewIcon->ImageNight);
}
Icons.AddReference(NewIcon, true);
}
//selection for bootcampstyle
Icon *NewIcon = new Icon(BUILTIN_ICON_SELECTION);
Status = ParseSVGXIcon(BUILTIN_ICON_SELECTION, "selection_indicator"_XS, &NewIcon->Image);

View File

@ -42,7 +42,7 @@ CONST CHAR8* IconsNames[] = {
"vol_optical",
"vol_firewire",
"vol_clover" ,
"vol_internal_hfs" , //18
"vol_internal_hfs" , //17
"vol_internal_apfs",
"vol_internal_ntfs",
"vol_internal_ext3" ,
@ -60,27 +60,30 @@ CONST CHAR8* IconsNames[] = {
"os_cougar",
"os_mav",
"os_yos",
"os_cap",
"os_cap", //33
"os_sierra",
"os_hsierra",
"os_moja", //11
"os_cata", //12 //there is no reserve for 10.16, next oses should be added to the end of the list
"os_linux",
"os_moja", //36
"os_cata", //37 //there is no reserve for 10.16, next oses should be added to the end of the list
"os_linux", //13 + 25 = 38
"os_ubuntu",
"os_suse",
"os_freebsd", //16
"os_freebsd", //16+25 = 41
"os_freedos",
"os_win",
"os_vista",
"radio_button", //20+25
"radio_button", //20+25 = 45
"radio_button_selected",
"checkbox", //22
"checkbox", //22+25 = 47
"checkbox_checked",
"scrollbar_background", //24 - present here for SVG theme but should be done more common way
"scrollbar_holder",
//other oses will be added below
//example
"os_uuu", //51 == ICON_OTHER_OS
""
};
const INTN IconsNamesSize = sizeof(IconsNames) / sizeof(IconsNames[0]);
//icons class
//if ImageNight is not set then Image should be used
@ -98,7 +101,7 @@ Icon::Icon(INTN Index, bool TakeEmbedded) : Image(), ImageNight()
Id = Index;
Name.setEmpty();
Native = false;
if (Index >= BUILTIN_ICON_FUNC_ABOUT && Index <= BUILTIN_CHECKBOX_CHECKED) {
if (Index >= BUILTIN_ICON_FUNC_ABOUT && Index < IconsNamesSize) { //full table
Name.takeValueFrom(IconsNames[Index]);
}
if (TakeEmbedded) {
@ -759,7 +762,7 @@ void XTheme::FillByDir() //assume ThemeDir is defined by InitTheme() procedure
{
EFI_STATUS Status;
Icons.Empty();
for (INTN i = 0; i <= BUILTIN_CHECKBOX_CHECKED; ++i) {
for (INTN i = 0; i < IconsNamesSize; ++i) { //scan full table
Status = EFI_NOT_FOUND;
Icon* NewIcon = new Icon(i); //initialize without embedded
switch (i) {

View File

@ -9,7 +9,7 @@
#include "XImage.h"
#include "XCinema.h"
extern const INTN IconsNamesSize;
#define INDICATOR_SIZE (52)
class Icon

View File

@ -459,6 +459,7 @@ VOID DebugPause(VOID);
#define BUILTIN_RADIO_BUTTON_SELECTED (46)
#define BUILTIN_CHECKBOX (47)
#define BUILTIN_CHECKBOX_CHECKED (48)
#define ICON_OTHER_OS (51)
#define BUILTIN_ICON_BACKGROUND (100)
#define BUILTIN_ICON_SELECTION (101)
#define BUILTIN_ICON_ANIME (102)

View File

@ -424,8 +424,8 @@ VOID REFIT_MENU_SCREEN::InitAnime()
FilmC = nullptr;
}
if (FilmC == nullptr) {
DBG("Screen %lld inited without anime\n", ID);
FilmC->AnimeRun = FALSE;
// DBG("Screen %lld inited without anime\n", ID);
// FilmC->AnimeRun = FALSE;
return;
}
// DBG("=== Debug Film ===\n");