mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-23 16:17:40 +01:00
make scrolls for xtheme
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
4beb089a18
commit
f1d136e013
@ -57,7 +57,6 @@
|
||||
A5456D5623FC5B08000BF18C /* platformdata.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D1A23FC5AF5000BF18C /* platformdata.cpp */; };
|
||||
A5456D5723FC5B08000BF18C /* usbfix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D1B23FC5AF5000BF18C /* usbfix.cpp */; };
|
||||
A5456D5823FC5B08000BF18C /* kext_inject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D1C23FC5AF6000BF18C /* kext_inject.cpp */; };
|
||||
A5456D5923FC5B08000BF18C /* picopng.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D1D23FC5AF6000BF18C /* picopng.cpp */; };
|
||||
A5456D5A23FC5B08000BF18C /* LegacyBoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D1E23FC5AF7000BF18C /* LegacyBoot.cpp */; };
|
||||
A5456D5B23FC5B08000BF18C /* Edid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D1F23FC5AF7000BF18C /* Edid.cpp */; };
|
||||
A5456D5C23FC5B08000BF18C /* AmlGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D2123FC5AF8000BF18C /* AmlGenerator.cpp */; };
|
||||
@ -80,7 +79,6 @@
|
||||
A5456D6D23FC5B08000BF18C /* guid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D3E23FC5B04000BF18C /* guid.cpp */; };
|
||||
A5456D6E23FC5B08000BF18C /* b64cdecode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D3F23FC5B04000BF18C /* b64cdecode.cpp */; };
|
||||
A5456D6F23FC5B08000BF18C /* DevicePath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D4223FC5B05000BF18C /* DevicePath.cpp */; };
|
||||
A5456D7023FC5B08000BF18C /* Pointer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D4323FC5B06000BF18C /* Pointer.cpp */; };
|
||||
A5456D7123FC5B08000BF18C /* device_inject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D4523FC5B07000BF18C /* device_inject.cpp */; };
|
||||
A5456D7223FC5B08000BF18C /* DataHubCpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D4623FC5B07000BF18C /* DataHubCpu.cpp */; };
|
||||
A5456D7D23FC5B40000BF18C /* IO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D7623FC5B3D000BF18C /* IO.cpp */; };
|
||||
@ -2347,14 +2345,12 @@
|
||||
A5456D1A23FC5AF5000BF18C /* platformdata.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = platformdata.cpp; sourceTree = "<group>"; };
|
||||
A5456D1B23FC5AF5000BF18C /* usbfix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = usbfix.cpp; sourceTree = "<group>"; };
|
||||
A5456D1C23FC5AF6000BF18C /* kext_inject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = kext_inject.cpp; sourceTree = "<group>"; };
|
||||
A5456D1D23FC5AF6000BF18C /* picopng.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = picopng.cpp; sourceTree = "<group>"; };
|
||||
A5456D1E23FC5AF7000BF18C /* LegacyBoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LegacyBoot.cpp; sourceTree = "<group>"; };
|
||||
A5456D1F23FC5AF7000BF18C /* Edid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Edid.cpp; sourceTree = "<group>"; };
|
||||
A5456D2023FC5AF7000BF18C /* device_inject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = device_inject.h; sourceTree = "<group>"; };
|
||||
A5456D2123FC5AF8000BF18C /* AmlGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AmlGenerator.cpp; sourceTree = "<group>"; };
|
||||
A5456D2223FC5AF8000BF18C /* gma.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gma.cpp; sourceTree = "<group>"; };
|
||||
A5456D2323FC5AF9000BF18C /* smbios.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = smbios.cpp; sourceTree = "<group>"; };
|
||||
A5456D2423FC5AF9000BF18C /* picopng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = picopng.h; sourceTree = "<group>"; };
|
||||
A5456D2523FC5AF9000BF18C /* BootLog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BootLog.cpp; sourceTree = "<group>"; };
|
||||
A5456D2623FC5AFA000BF18C /* ati_reg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ati_reg.h; sourceTree = "<group>"; };
|
||||
A5456D2723FC5AFA000BF18C /* Console.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Console.cpp; sourceTree = "<group>"; };
|
||||
@ -2385,7 +2381,6 @@
|
||||
A5456D4023FC5B05000BF18C /* kernel_patcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kernel_patcher.h; sourceTree = "<group>"; };
|
||||
A5456D4123FC5B05000BF18C /* memvendors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memvendors.h; sourceTree = "<group>"; };
|
||||
A5456D4223FC5B05000BF18C /* DevicePath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DevicePath.cpp; sourceTree = "<group>"; };
|
||||
A5456D4323FC5B06000BF18C /* Pointer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Pointer.cpp; sourceTree = "<group>"; };
|
||||
A5456D4423FC5B06000BF18C /* HdaCodecDump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HdaCodecDump.h; sourceTree = "<group>"; };
|
||||
A5456D4523FC5B07000BF18C /* device_inject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = device_inject.cpp; sourceTree = "<group>"; };
|
||||
A5456D4623FC5B07000BF18C /* DataHubCpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataHubCpu.cpp; sourceTree = "<group>"; };
|
||||
@ -6231,13 +6226,10 @@
|
||||
A5456D2B23FC5AFC000BF18C /* nvidia.cpp */,
|
||||
A5456D1023FC5AF1000BF18C /* nvidia.h */,
|
||||
A5456D1823FC5AF4000BF18C /* Nvram.cpp */,
|
||||
A5456D1D23FC5AF6000BF18C /* picopng.cpp */,
|
||||
A5456D2423FC5AF9000BF18C /* picopng.h */,
|
||||
A5456D3223FC5AFF000BF18C /* Platform.h */,
|
||||
A5456D1A23FC5AF5000BF18C /* platformdata.cpp */,
|
||||
A5456D0B23FC5AEE000BF18C /* PlatformDriverOverride.cpp */,
|
||||
A5456D0723FC5AEC000BF18C /* plist.cpp */,
|
||||
A5456D4323FC5B06000BF18C /* Pointer.cpp */,
|
||||
A5456D2823FC5AFB000BF18C /* Settings.cpp */,
|
||||
A5456D2323FC5AF9000BF18C /* smbios.cpp */,
|
||||
A5456D3723FC5B01000BF18C /* sound.cpp */,
|
||||
@ -16551,7 +16543,6 @@
|
||||
A5AAFC37237F13B3009CD413 /* Vtutf8.c in Sources */,
|
||||
A5AAFD2D237F13B4009CD413 /* DebugAgentLibNull.c in Sources */,
|
||||
A5816DED24180F4D003BA66C /* panic.cpp in Sources */,
|
||||
A5456D7023FC5B08000BF18C /* Pointer.cpp in Sources */,
|
||||
A5AA0597237F13C1009CD413 /* ReadPmc.nasm in Sources */,
|
||||
A5AA0497237F13C1009CD413 /* ReadGs.nasm in Sources */,
|
||||
A5AA0618237F13C2009CD413 /* Synchronization.asm in Sources */,
|
||||
@ -17330,7 +17321,6 @@
|
||||
A5AAFC96237F13B4009CD413 /* NonDiscoverablePciDeviceIo.c in Sources */,
|
||||
A5AAFB77237F13B3009CD413 /* FirmwarePerformanceDxe.c in Sources */,
|
||||
A5AAFCC1237F13B4009CD413 /* ComponentName.c in Sources */,
|
||||
A5456D5923FC5B08000BF18C /* picopng.cpp in Sources */,
|
||||
A5AAFD65237F13B4009CD413 /* String.c in Sources */,
|
||||
A5AA0754237F13C3009CD413 /* ScanMem8Wrapper.c in Sources */,
|
||||
A5AAFD03237F13B4009CD413 /* BmBoot.c in Sources */,
|
||||
|
@ -89,8 +89,25 @@ public:
|
||||
ACTION mAction;
|
||||
UINTN mItemID;
|
||||
SCROLL_STATE ScrollState;
|
||||
BOOLEAN ScrollEnabled;
|
||||
// MENU_STYLE_FUNC StyleFunc;
|
||||
|
||||
//scroll positions should depends on REFIT_SCREEN?
|
||||
// Or it just currently calculated to be global variables?
|
||||
/*
|
||||
EG_RECT BarStart;
|
||||
EG_RECT BarEnd;
|
||||
EG_RECT ScrollStart;
|
||||
EG_RECT ScrollEnd;
|
||||
EG_RECT ScrollTotal;
|
||||
EG_RECT UpButton;
|
||||
EG_RECT DownButton;
|
||||
EG_RECT ScrollbarBackground;
|
||||
EG_RECT Scrollbar;
|
||||
EG_RECT ScrollbarOldPointerPlace;
|
||||
EG_RECT ScrollbarNewPointerPlace;
|
||||
*/
|
||||
|
||||
|
||||
REFIT_MENU_SCREEN()
|
||||
: ID(0), Title(0), TitleImage(0),
|
||||
@ -122,6 +139,7 @@ public:
|
||||
VOID InitScroll(IN INTN ItemCount, IN UINTN MaxCount,
|
||||
IN UINTN VisibleSpace, IN INTN Selected);
|
||||
VOID UpdateScroll(IN UINTN Movement);
|
||||
VOID ScrollingBar();
|
||||
VOID HidePointer();
|
||||
EFI_STATUS MouseBirth();
|
||||
VOID KillMouse();
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#if USE_XTHEME
|
||||
#include "XTheme.h"
|
||||
XTheme Theme; //later this definition will be global
|
||||
//XTheme ThemeX; //later this definition will be global
|
||||
#endif
|
||||
|
||||
|
||||
@ -640,6 +640,8 @@ EG_IMAGE * LoadSvgFrame(INTN i)
|
||||
EG_IMAGE *Frame = NULL;
|
||||
EFI_STATUS Status;
|
||||
CHAR8 FrameName[64];
|
||||
//TODO if extend SVG syntax then we can use dynamic SVG with parameter Frame
|
||||
// for example use variable instead of constant like javascript
|
||||
AsciiSPrint(FrameName, 63, "frame_%d", i+1);
|
||||
Status = ParseSVGIcon(mainParser, BUILTIN_ICON_ANIME, FrameName, GlobalConfig.Scale, &Frame);
|
||||
if (EFI_ERROR(Status)) {
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "lodepng.h"
|
||||
#include "nanosvg.h"
|
||||
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
#define DEBUG_XIMAGE 1
|
||||
#else
|
||||
@ -189,12 +190,11 @@ void XImage::Fill(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color)
|
||||
PixelData[y * Width + x] = Color;
|
||||
}
|
||||
|
||||
void XImage::FillArea(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color, const EgRect& Rect)
|
||||
|
||||
void XImage::FillArea(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color, EG_RECT& Rect)
|
||||
{
|
||||
for (UINTN y = Rect.Ypos; y < Height && (y - Rect.Ypos) < Rect.Height; ++y) {
|
||||
// EFI_GRAPHICS_OUTPUT_BLT_PIXEL* Ptr = PixelData + y * Width + Rect.Xpos;
|
||||
for (UINTN x = Rect.Xpos; x < Width && (x - Rect.Xpos) < Rect.Width; ++x)
|
||||
// *Ptr++ = Color;
|
||||
for (INTN y = Rect.YPos; y < (INTN)Height && (y - Rect.YPos) < Rect.Height; ++y) {
|
||||
for (INTN x = Rect.XPos; x < (INTN)Width && (x - Rect.XPos) < Rect.Width; ++x)
|
||||
PixelData[y * Width + x] = Color;
|
||||
}
|
||||
}
|
||||
@ -419,16 +419,10 @@ void XImage::GetArea(INTN x, INTN y, UINTN W, UINTN H)
|
||||
|
||||
void XImage::DrawWithoutCompose(INTN x, INTN y, UINTN width, UINTN height)
|
||||
{
|
||||
// //prepare images
|
||||
//// DBG("1\n");
|
||||
// XImage Top(*this, scale);
|
||||
//// DBG("2\n");
|
||||
// XImage Background(Width, Height);
|
||||
//// DBG("3\n");
|
||||
// Background.GetArea(x, y, Width, Height);
|
||||
//// DBG("4\n");
|
||||
// Background.Compose(0, 0, Top, true);
|
||||
//// DBG("5\n");
|
||||
if (isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( width == 0 ) width = Width;
|
||||
if ( height == 0 ) height = Height;
|
||||
UINTN AreaWidth = (x + width > (UINTN)UGAWidth) ? (UGAWidth - x) : width;
|
||||
@ -463,6 +457,10 @@ void XImage::DrawWithoutCompose(INTN x, INTN y, UINTN width, UINTN height)
|
||||
void XImage::Draw(INTN x, INTN y, float scale)
|
||||
{
|
||||
//prepare images
|
||||
if (isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
XImage Top(*this, scale);
|
||||
XImage Background(Width, Height);
|
||||
Background.GetArea(x, y, Width, Height);
|
||||
|
@ -35,14 +35,14 @@ typedef union {
|
||||
UINT32 Raw;
|
||||
} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
|
||||
#endif
|
||||
|
||||
/*
|
||||
typedef struct {
|
||||
UINTN Xpos;
|
||||
UINTN Ypos;
|
||||
UINTN Width;
|
||||
UINTN Height;
|
||||
} EgRect;
|
||||
|
||||
*/
|
||||
class XImage
|
||||
{
|
||||
protected:
|
||||
@ -80,7 +80,7 @@ public:
|
||||
|
||||
|
||||
void Fill(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color = { 0, 0, 0, 0 });
|
||||
void FillArea(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color, const EgRect& Rect);
|
||||
void FillArea(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color, EG_RECT& Rect);
|
||||
void CopyScaled(const XImage& Image, float scale);
|
||||
void Compose(INTN PosX, INTN PosY, const XImage& TopImage, bool Lowest); //instead of compose we often can Back.Draw(...) + Top.Draw(...)
|
||||
void FlipRB(bool WantAlpha);
|
||||
|
@ -201,54 +201,52 @@ bool XPointer::MouseInRect(EG_RECT *Place)
|
||||
|
||||
EFI_STATUS XPointer::CheckMouseEvent(REFIT_MENU_SCREEN *Screen)
|
||||
{
|
||||
EFI_STATUS Status = EFI_TIMEOUT;
|
||||
// INTN EntryId;
|
||||
|
||||
Screen->mAction = ActionNone;
|
||||
|
||||
if (!Screen) {
|
||||
return EFI_TIMEOUT;
|
||||
}
|
||||
EFI_STATUS Status = EFI_TIMEOUT;
|
||||
Screen->mAction = ActionNone;
|
||||
|
||||
if (!IsDragging && MouseEvent == MouseMove)
|
||||
MouseEvent = NoEvents;
|
||||
|
||||
// if (MouseEvent != NoEvents){
|
||||
if (ScrollEnabled && MouseInRect(&UpButton) && MouseEvent == LeftClick)
|
||||
Screen->mAction = ActionScrollUp;
|
||||
else if (ScrollEnabled && MouseInRect(&DownButton) && MouseEvent == LeftClick)
|
||||
Screen->mAction = ActionScrollDown;
|
||||
else if (ScrollEnabled && MouseInRect(&Scrollbar) && MouseEvent == LeftMouseDown) {
|
||||
IsDragging = TRUE;
|
||||
ScrollbarYMovement = 0;
|
||||
ScrollbarOldPointerPlace.XPos = ScrollbarNewPointerPlace.XPos = newPlace.XPos;
|
||||
ScrollbarOldPointerPlace.YPos = ScrollbarNewPointerPlace.YPos = newPlace.YPos;
|
||||
}
|
||||
else if (ScrollEnabled && IsDragging && MouseEvent == LeftClick) {
|
||||
IsDragging = FALSE;
|
||||
}
|
||||
else if (ScrollEnabled && IsDragging && MouseEvent == MouseMove) {
|
||||
Screen->mAction = ActionMoveScrollbar;
|
||||
ScrollbarNewPointerPlace.XPos = newPlace.XPos;
|
||||
ScrollbarNewPointerPlace.YPos = newPlace.YPos;
|
||||
}
|
||||
else if (ScrollEnabled && MouseInRect(&ScrollbarBackground) &&
|
||||
MouseEvent == LeftClick) {
|
||||
if (newPlace.YPos < Scrollbar.YPos) // up
|
||||
Screen->mAction = ActionPageUp;
|
||||
else // down
|
||||
Screen->mAction = ActionPageDown;
|
||||
if (Screen->ScrollEnabled){
|
||||
if (MouseInRect(&UpButton) && MouseEvent == LeftClick)
|
||||
Screen->mAction = ActionScrollUp;
|
||||
else if (MouseInRect(&DownButton) && MouseEvent == LeftClick)
|
||||
Screen->mAction = ActionScrollDown;
|
||||
else if (MouseInRect(&Scrollbar) && MouseEvent == LeftMouseDown) {
|
||||
IsDragging = TRUE;
|
||||
Screen->mAction = ActionMoveScrollbar;
|
||||
ScrollbarYMovement = 0;
|
||||
ScrollbarOldPointerPlace.XPos = ScrollbarNewPointerPlace.XPos = newPlace.XPos;
|
||||
ScrollbarOldPointerPlace.YPos = ScrollbarNewPointerPlace.YPos = newPlace.YPos;
|
||||
}
|
||||
else if (IsDragging && MouseEvent == LeftClick) {
|
||||
IsDragging = FALSE;
|
||||
Screen->mAction = ActionMoveScrollbar;
|
||||
}
|
||||
else if (IsDragging && MouseEvent == MouseMove) {
|
||||
Screen->mAction = ActionMoveScrollbar;
|
||||
ScrollbarNewPointerPlace.XPos = newPlace.XPos;
|
||||
ScrollbarNewPointerPlace.YPos = newPlace.YPos;
|
||||
}
|
||||
else if (MouseInRect(&ScrollbarBackground) &&
|
||||
MouseEvent == LeftClick) {
|
||||
if (newPlace.YPos < Scrollbar.YPos) // up
|
||||
Screen->mAction = ActionPageUp;
|
||||
else // down
|
||||
Screen->mAction = ActionPageDown;
|
||||
// page up/down, like in OS X
|
||||
}
|
||||
else if (ScrollEnabled &&
|
||||
MouseEvent == ScrollDown) {
|
||||
Screen->mAction = ActionScrollDown;
|
||||
}
|
||||
else if (ScrollEnabled &&
|
||||
MouseEvent == ScrollUp) {
|
||||
Screen->mAction = ActionScrollUp;
|
||||
}
|
||||
else {
|
||||
}
|
||||
else if (MouseEvent == ScrollDown) {
|
||||
Screen->mAction = ActionScrollDown;
|
||||
}
|
||||
else if (MouseEvent == ScrollUp) {
|
||||
Screen->mAction = ActionScrollUp;
|
||||
}
|
||||
} //if scroll enabled
|
||||
if (Screen->mAction != ActionNone) {
|
||||
for (UINTN EntryId = 0; EntryId < Screen->Entries.size(); EntryId++) {
|
||||
if (MouseInRect(&(Screen->Entries[EntryId].Place))) {
|
||||
switch (MouseEvent) {
|
||||
@ -301,7 +299,7 @@ EFI_STATUS XPointer::CheckMouseEvent(REFIT_MENU_SCREEN *Screen)
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
if (Screen->mAction != ActionNone) {
|
||||
Status = EFI_SUCCESS;
|
||||
MouseEvent = NoEvents; //clear event as set action
|
||||
|
@ -132,6 +132,7 @@ void XTheme::Init()
|
||||
Scale = 1.0f;
|
||||
CentreShift = 0.0f;
|
||||
Daylight = true;
|
||||
LayoutHeight = 376;
|
||||
}
|
||||
|
||||
XImage& XTheme::GetIcon(const char* Name)
|
||||
@ -494,8 +495,7 @@ void XTheme::InitSelection()
|
||||
//DECLARE_EMB_EXTERN_WITH_SIZE(emb_radio_button)
|
||||
//DECLARE_EMB_EXTERN_WITH_SIZE(emb_checkbox)
|
||||
//DECLARE_EMB_EXTERN_WITH_SIZE(emb_checkbox_checked)
|
||||
|
||||
DECLARE_EMB_EXTERN_WITH_SIZE(emb_dark_font_data)
|
||||
//DECLARE_EMB_EXTERN_WITH_SIZE(emb_dark_font_data)
|
||||
|
||||
|
||||
Status = Button[0].LoadXImage(ThemeDir, "radio_button");
|
||||
@ -504,15 +504,15 @@ void XTheme::InitSelection()
|
||||
}
|
||||
Status = Button[1].LoadXImage(ThemeDir, "radio_button_selected"));
|
||||
if (EFI_ERROR(Status)) {
|
||||
Button[0].FromPNG(ACCESS_EMB_DATA(emb_radio_button_selected), ACCESS_EMB_SIZE(emb_radio_button_selected));
|
||||
Button[1].FromPNG(ACCESS_EMB_DATA(emb_radio_button_selected), ACCESS_EMB_SIZE(emb_radio_button_selected));
|
||||
}
|
||||
Status = Button[2].LoadXImage(ThemeDir, "checkbox");
|
||||
if (EFI_ERROR(Status)) {
|
||||
Button[0].FromPNG(ACCESS_EMB_DATA(emb_checkbox), ACCESS_EMB_SIZE(emb_checkbox));
|
||||
Button[2].FromPNG(ACCESS_EMB_DATA(emb_checkbox), ACCESS_EMB_SIZE(emb_checkbox));
|
||||
}
|
||||
Status = Button[3].LoadXImage(ThemeDir, "checkbox_checked");
|
||||
if (EFI_ERROR(Status)) {
|
||||
Button[0].FromPNG(ACCESS_EMB_DATA(emb_checkbox_checked), ACCESS_EMB_SIZE(emb_checkbox_checked));
|
||||
Button[3].FromPNG(ACCESS_EMB_DATA(emb_checkbox_checked), ACCESS_EMB_SIZE(emb_checkbox_checked));
|
||||
}
|
||||
|
||||
// non-selected background images
|
||||
@ -550,7 +550,100 @@ void XTheme::FillByDir() //assume ThemeDir is defined by InitTheme() procedure
|
||||
|
||||
InitSelection(); //initialize selections, buttons
|
||||
|
||||
//load banner
|
||||
//load banner and background
|
||||
Banner.LoadXImage(ThemeDir, BannerFileName);
|
||||
|
||||
BigBack.LoadXImage(ThemeDir, BackgroundFileName);
|
||||
}
|
||||
|
||||
|
||||
void XTheme::InitBar()
|
||||
{
|
||||
if (!TypeSVG) {
|
||||
ScrollbarBackgroundImage.LoadXImage(ThemeDir, "scrollbar\\bar_fill");
|
||||
BarStartImage.LoadXImage(ThemeDir, "scrollbar\\bar_start");
|
||||
BarEndImage.LoadXImage(ThemeDir, "scrollbar\\bar_end");
|
||||
ScrollbarImage.LoadXImage(ThemeDir, "scrollbar\\scroll_fill");
|
||||
ScrollStartImage.LoadXImage(ThemeDir, "scrollbar\\scroll_start");
|
||||
ScrollEndImage.LoadXImage(ThemeDir, "scrollbar\\scroll_end");
|
||||
UpButtonImage.LoadXImage(ThemeDir, "scrollbar\\up_button");
|
||||
DownButtonImage.LoadXImage(ThemeDir, "scrollbar\\down_button");
|
||||
}
|
||||
|
||||
//some help with embedded scroll
|
||||
if (BarStartImage.isEmpty() && !TypeSVG) {
|
||||
BarStartImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_bar_start), ACCESS_EMB_SIZE(emb_scroll_bar_start));
|
||||
}
|
||||
if (BarEndImage.isEmpty() && !TypeSVG) {
|
||||
BarEndImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_bar_end), ACCESS_EMB_SIZE(emb_scroll_bar_end));
|
||||
}
|
||||
if (ScrollbarBackgroundImage.isEmpty()) {
|
||||
if (TypeSVG) {
|
||||
//return OSIconsTable[i].image;
|
||||
ScrollbarBackgroundImage.GetIcon("scrollbar_background");
|
||||
}
|
||||
if (ScrollbarBackgroundImage.isEmpty()) {
|
||||
ScrollbarBackgroundImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_bar_fill), ACCESS_EMB_SIZE(emb_scroll_bar_fill));
|
||||
}
|
||||
}
|
||||
if (ScrollbarImage.isEmpty()) {
|
||||
if (TypeSVG) {
|
||||
ScrollbarImage.GetIcon(ThemeDir, "scrollbar_holder"); //"_night" is already accounting
|
||||
}
|
||||
if (ScrollbarImage.isEmpty()) {
|
||||
ScrollbarImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_scroll_fill), ACCESS_EMB_SIZE(emb_scroll_scroll_fill));
|
||||
}
|
||||
}
|
||||
if (ScrollStartImage.isEmpty()) {
|
||||
if (TypeSVG) {
|
||||
ScrollStartImage.GetIcon(ThemeDir, "scrollbar_start");
|
||||
}
|
||||
if (ScrollStartImage.isEmpty()) {
|
||||
ScrollStartImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_scroll_start), ACCESS_EMB_SIZE(emb_scroll_scroll_start));
|
||||
}
|
||||
}
|
||||
if (ScrollEndImage.isEmpty()) {
|
||||
if (TypeSVG) {
|
||||
ScrollEndImage.GetIcon(ThemeDir, "scrollbar_end");
|
||||
}
|
||||
if (ScrollEndImage.isEmpty()) {
|
||||
ScrollEndImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_scroll_end), ACCESS_EMB_SIZE(emb_scroll_scroll_end));
|
||||
}
|
||||
}
|
||||
if (UpButtonImage.isEmpty()) {
|
||||
if (TypeSVG) {
|
||||
UpButtonImage.GetIcon(ThemeDir, "scrollbar_up_button");
|
||||
}
|
||||
UpButtonImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_up_button), ACCESS_EMB_SIZE(emb_scroll_up_button));
|
||||
}
|
||||
if (DownButtonImage.isEmpty()) {
|
||||
if (TypeSVG) {
|
||||
DownButtonImage.GetIcon(ThemeDir, "scrollbar_down_button");
|
||||
}
|
||||
if (DownButtonImage.isEmpty()) {
|
||||
DownButtonImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_down_button), ACCESS_EMB_SIZE(emb_scroll_down_button));
|
||||
}
|
||||
}
|
||||
if (!TypeSVG) {
|
||||
UpButton.Width = ScrollWidth; // 16
|
||||
UpButton.Height = ScrollButtonsHeight; // 20
|
||||
DownButton.Width = UpButton.Width;
|
||||
DownButton.Height = ScrollButtonsHeight;
|
||||
BarStart.Height = ScrollBarDecorationsHeight; // 5
|
||||
BarEnd.Height = ScrollBarDecorationsHeight;
|
||||
ScrollStart.Height = ScrollScrollDecorationsHeight; // 7
|
||||
ScrollEnd.Height = ScrollScrollDecorationsHeight;
|
||||
|
||||
} else {
|
||||
UpButton.Width = ScrollWidth; // 16
|
||||
UpButton.Height = 0; // 20
|
||||
DownButton.Width = UpButton.Width;
|
||||
DownButton.Height = 0;
|
||||
BarStart.Height = ScrollBarDecorationsHeight; // 5
|
||||
BarEnd.Height = ScrollBarDecorationsHeight;
|
||||
ScrollStart.Height = 0; // 7
|
||||
ScrollEnd.Height = 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,18 +74,25 @@ public:
|
||||
INTN CodepageSize;
|
||||
float Scale;
|
||||
float CentreShift;
|
||||
INTN row0TileSize;
|
||||
INTN row1TileSize;
|
||||
UINTN BanHeight;
|
||||
INTN LayoutHeight; //it was 376 before
|
||||
BOOLEAN Daylight;
|
||||
INTN row0TileSize;
|
||||
INTN row1TileSize;
|
||||
UINTN BanHeight;
|
||||
INTN LayoutHeight; //it was 376 before
|
||||
BOOLEAN Daylight;
|
||||
|
||||
void Init();
|
||||
XImage Background; //Background and Banner will not be in array as they live own life
|
||||
XImage BigBack; //it size is not equal to screen size will be scaled or cropped
|
||||
XImage Banner; //same as logo in the array, make a link?
|
||||
XImage SelectionImages[6];
|
||||
XImage Button[4];
|
||||
XImage SelectionImages[6];
|
||||
XImage Button[4];
|
||||
XImage ScrollbarBackgroundImage;
|
||||
XImage BarStartImage;
|
||||
XImage BarEndImage;
|
||||
XImage ScrollbarImage;
|
||||
XImage ScrollStartImage;
|
||||
XImage ScrollEndImage;
|
||||
XImage UpButtonImage;
|
||||
XImage DownButtonImage;
|
||||
|
||||
//fill the theme
|
||||
XImage& GetIcon(XStringW& Name); //get by name
|
||||
@ -99,8 +106,10 @@ public:
|
||||
void ClearScreen();
|
||||
void FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Height);
|
||||
void InitSelection();
|
||||
void InitBar();
|
||||
|
||||
XTheme(); //default constructor
|
||||
void Init();
|
||||
XTheme(); //default constructor
|
||||
~XTheme();
|
||||
|
||||
protected:
|
||||
|
@ -141,6 +141,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define USE_XTHEME 0
|
||||
#if USE_XTHEME
|
||||
extern XTheme ThemeX; //global variable defined in lib.cpp
|
||||
#endif
|
||||
|
||||
/* types */
|
||||
|
||||
|
@ -58,6 +58,11 @@ EFI_FILE *SelfDir;
|
||||
CHAR16 *SelfDirPath;
|
||||
EFI_DEVICE_PATH *SelfDevicePath;
|
||||
EFI_DEVICE_PATH *SelfFullDevicePath;
|
||||
|
||||
#if USE_XTHEME
|
||||
XTheme ThemeX;
|
||||
#endif
|
||||
|
||||
EFI_FILE *ThemeDir = NULL;
|
||||
CHAR16 *ThemePath;
|
||||
BOOLEAN gThemeChanged = FALSE;
|
||||
|
@ -324,7 +324,7 @@ typedef struct {
|
||||
BOOLEAN IsScrolling, PaintAll, PaintSelection;
|
||||
} SCROLL_STATE;
|
||||
|
||||
extern BOOLEAN ScrollEnabled;
|
||||
//extern BOOLEAN ScrollEnabled;
|
||||
extern EG_RECT UpButton;
|
||||
extern EG_RECT DownButton;
|
||||
extern EG_RECT ScrollbarBackground;
|
||||
|
@ -61,6 +61,7 @@
|
||||
#define DBG(...) DebugLog(DEBUG_MENU, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
|
||||
//#define PREBOOT_LOG L"EFI\\CLOVER\\misc\\preboot.log"
|
||||
//#define VBIOS_BIN L"EFI\\CLOVER\\misc\\c0000.bin"
|
||||
CONST CHAR16 *VBIOS_BIN = L"EFI\\CLOVER\\misc\\c0000.bin";
|
||||
@ -126,7 +127,7 @@ static CHAR16 ArrowDown[2] = { ARROW_DOWN, 0 };
|
||||
|
||||
BOOLEAN MainAnime = FALSE;
|
||||
|
||||
BOOLEAN ScrollEnabled = FALSE;
|
||||
//BOOLEAN ScrollEnabled = FALSE;
|
||||
BOOLEAN IsDragging = FALSE;
|
||||
|
||||
INTN ScrollWidth = 16;
|
||||
@ -1904,12 +1905,6 @@ VOID InitSelection(VOID)
|
||||
//it was a nonsense egLoadImage is just inluded into egLoadIcon.
|
||||
// will be corrected with XTheme support
|
||||
//the procedure loadIcon should also check embedded icons
|
||||
#if USE_XTHEME
|
||||
Button[0] = Theme.loadIcon("radio_button.png");
|
||||
Button[1] = Theme.loadIcon("radio_button_selected.png");
|
||||
Button[2] = Theme.loadIcon("checkbox.png");
|
||||
Button[3] = Theme.loadIcon("checkbox_checked.png");
|
||||
#else
|
||||
Buttons[0] = egLoadImage(ThemeDir, GetIconsExt(L"radio_button", L"png"), TRUE); //memory leak
|
||||
Buttons[1] = egLoadImage(ThemeDir, GetIconsExt(L"radio_button_selected", L"png"), TRUE);
|
||||
if (!Buttons[0]) {
|
||||
@ -1947,20 +1942,7 @@ VOID InitSelection(VOID)
|
||||
// DBG("embedded checkbox_checked\n");
|
||||
Buttons[3] = egDecodePNG(ACCESS_EMB_DATA(emb_checkbox_checked), ACCESS_EMB_SIZE(emb_checkbox_checked), TRUE);
|
||||
}
|
||||
#endif
|
||||
// non-selected background images
|
||||
#if USE_XTHEME
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL& BackgroundPixel = StdBackgroundPixel;
|
||||
if (Theme.SelectionBigFileName != NULL) {
|
||||
BackgroundPixel = &MenuBackgroundPixel;
|
||||
} else if (GlobalConfig.DarkEmbedded || GlobalConfig.TypeSVG) {
|
||||
BackgroundPixel = &DarkEmbeddedBackgroundPixel;
|
||||
} else {
|
||||
BackgroundPixel = &StdBackgroundPixel;
|
||||
}
|
||||
SelectionImages[1] = XImage(row0TileSize, row0TileSize, BackgroundPixel);
|
||||
SelectionImages[3] = XImage(row1TileSize, row1TileSize, BackgroundPixel);
|
||||
#else
|
||||
//totally wrong
|
||||
if (GlobalConfig.SelectionBigFileName != NULL) {
|
||||
SelectionImages[1] = egCreateFilledImage(row0TileSize, row0TileSize,
|
||||
@ -1990,7 +1972,6 @@ VOID InitSelection(VOID)
|
||||
}
|
||||
}
|
||||
// DBG("selections inited\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
@ -3422,13 +3403,59 @@ VOID SetBar(INTN PosX, INTN UpPosY, INTN DownPosY, IN SCROLL_STATE *State)
|
||||
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 0
|
||||
//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
|
||||
|
||||
VOID ScrollingBar(IN SCROLL_STATE *State)
|
||||
XImage Total(ScrollTotal.Width, ScrollTotal.Height);
|
||||
Total.Fill(&MenuBackgroundPixel);
|
||||
if (!ThemeX.ScrollbarBackgroundImage.isEmpty()) {
|
||||
for (INTN i; i < ScrollbarBackground.Height; i+=ThemeX.ScrollbarBackgroundImage->Height) {
|
||||
Total.Compose(ScrollbarBackground.XPos - ScrollTotal.XPos, ScrollbarBackground.YPos + i - ScrollTotal.YPos, ThemeX.ScrollbarBackgroundImage, TRUE);
|
||||
}
|
||||
}
|
||||
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->Height) {
|
||||
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, ScrollWidth / 16.f); //ScrollWidth can be set in theme.plist but usually=16
|
||||
#else
|
||||
for (INTN i; i < ScrollbarBackground.Height; i += ThemeX.ScrollbarBackgroundImage->Height) {
|
||||
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->Height) {
|
||||
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 = (State->MaxFirstVisible != 0);
|
||||
ScrollEnabled = (ScrollState.MaxFirstVisible != 0);
|
||||
if (ScrollEnabled) {
|
||||
Total = egCreateFilledImage(ScrollTotal.Width, ScrollTotal.Height, TRUE, &MenuBackgroundPixel);
|
||||
|
||||
@ -3456,7 +3483,7 @@ VOID ScrollingBar(IN SCROLL_STATE *State)
|
||||
egFreeImage(Total);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Graphical menu.
|
||||
*/
|
||||
@ -3655,7 +3682,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
}
|
||||
}
|
||||
|
||||
ScrollingBar(&ScrollState);
|
||||
ScrollingBar(); //&ScrollState - inside the class
|
||||
//MouseBirth();
|
||||
break;
|
||||
|
||||
@ -3801,7 +3828,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
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);
|
||||
ScrollingBar(); //&ScrollState);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -4158,7 +4185,7 @@ VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16
|
||||
(UGAWidth >> 1), textPosY);
|
||||
}
|
||||
|
||||
ScrollingBar(&ScrollState);
|
||||
ScrollingBar(); //&ScrollState);
|
||||
DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT);
|
||||
DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER);
|
||||
MouseBirth();
|
||||
@ -4190,7 +4217,7 @@ VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16
|
||||
(UGAWidth >> 1), textPosY);
|
||||
}
|
||||
|
||||
ScrollingBar(&ScrollState);
|
||||
ScrollingBar(); //&ScrollState);
|
||||
DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT);
|
||||
DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER);
|
||||
MouseBirth();
|
||||
|
@ -397,7 +397,7 @@ VOID SwitchToGraphicsAndClear(VOID) //called from MENU_FUNCTION_INIT
|
||||
{
|
||||
SwitchToGraphics();
|
||||
#if USE_XTHEME
|
||||
Theme.ClearScreen();
|
||||
ThemeX.ClearScreen();
|
||||
#else
|
||||
if (GraphicsScreenDirty) { //Invented in rEFIt 15 years ago
|
||||
BltClearScreen();
|
||||
@ -412,6 +412,7 @@ typedef struct {
|
||||
INTN Width;
|
||||
INTN Height;
|
||||
} EG_RECT;
|
||||
// moreover it is class EG_RECT;
|
||||
//same as EgRect but INTN <-> UINTN
|
||||
*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user