make scrolls for xtheme

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-03-20 20:48:19 +03:00
parent 4beb089a18
commit f1d136e013
13 changed files with 260 additions and 116 deletions

View File

@ -57,7 +57,6 @@
A5456D5623FC5B08000BF18C /* platformdata.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D1A23FC5AF5000BF18C /* platformdata.cpp */; }; A5456D5623FC5B08000BF18C /* platformdata.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D1A23FC5AF5000BF18C /* platformdata.cpp */; };
A5456D5723FC5B08000BF18C /* usbfix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D1B23FC5AF5000BF18C /* usbfix.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 */; }; 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 */; }; A5456D5A23FC5B08000BF18C /* LegacyBoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D1E23FC5AF7000BF18C /* LegacyBoot.cpp */; };
A5456D5B23FC5B08000BF18C /* Edid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D1F23FC5AF7000BF18C /* Edid.cpp */; }; A5456D5B23FC5B08000BF18C /* Edid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D1F23FC5AF7000BF18C /* Edid.cpp */; };
A5456D5C23FC5B08000BF18C /* AmlGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D2123FC5AF8000BF18C /* AmlGenerator.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 */; }; A5456D6D23FC5B08000BF18C /* guid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D3E23FC5B04000BF18C /* guid.cpp */; };
A5456D6E23FC5B08000BF18C /* b64cdecode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D3F23FC5B04000BF18C /* b64cdecode.cpp */; }; A5456D6E23FC5B08000BF18C /* b64cdecode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D3F23FC5B04000BF18C /* b64cdecode.cpp */; };
A5456D6F23FC5B08000BF18C /* DevicePath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D4223FC5B05000BF18C /* DevicePath.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 */; }; A5456D7123FC5B08000BF18C /* device_inject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D4523FC5B07000BF18C /* device_inject.cpp */; };
A5456D7223FC5B08000BF18C /* DataHubCpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D4623FC5B07000BF18C /* DataHubCpu.cpp */; }; A5456D7223FC5B08000BF18C /* DataHubCpu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D4623FC5B07000BF18C /* DataHubCpu.cpp */; };
A5456D7D23FC5B40000BF18C /* IO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5456D7623FC5B3D000BF18C /* IO.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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; A5456D4623FC5B07000BF18C /* DataHubCpu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataHubCpu.cpp; sourceTree = "<group>"; };
@ -6231,13 +6226,10 @@
A5456D2B23FC5AFC000BF18C /* nvidia.cpp */, A5456D2B23FC5AFC000BF18C /* nvidia.cpp */,
A5456D1023FC5AF1000BF18C /* nvidia.h */, A5456D1023FC5AF1000BF18C /* nvidia.h */,
A5456D1823FC5AF4000BF18C /* Nvram.cpp */, A5456D1823FC5AF4000BF18C /* Nvram.cpp */,
A5456D1D23FC5AF6000BF18C /* picopng.cpp */,
A5456D2423FC5AF9000BF18C /* picopng.h */,
A5456D3223FC5AFF000BF18C /* Platform.h */, A5456D3223FC5AFF000BF18C /* Platform.h */,
A5456D1A23FC5AF5000BF18C /* platformdata.cpp */, A5456D1A23FC5AF5000BF18C /* platformdata.cpp */,
A5456D0B23FC5AEE000BF18C /* PlatformDriverOverride.cpp */, A5456D0B23FC5AEE000BF18C /* PlatformDriverOverride.cpp */,
A5456D0723FC5AEC000BF18C /* plist.cpp */, A5456D0723FC5AEC000BF18C /* plist.cpp */,
A5456D4323FC5B06000BF18C /* Pointer.cpp */,
A5456D2823FC5AFB000BF18C /* Settings.cpp */, A5456D2823FC5AFB000BF18C /* Settings.cpp */,
A5456D2323FC5AF9000BF18C /* smbios.cpp */, A5456D2323FC5AF9000BF18C /* smbios.cpp */,
A5456D3723FC5B01000BF18C /* sound.cpp */, A5456D3723FC5B01000BF18C /* sound.cpp */,
@ -16551,7 +16543,6 @@
A5AAFC37237F13B3009CD413 /* Vtutf8.c in Sources */, A5AAFC37237F13B3009CD413 /* Vtutf8.c in Sources */,
A5AAFD2D237F13B4009CD413 /* DebugAgentLibNull.c in Sources */, A5AAFD2D237F13B4009CD413 /* DebugAgentLibNull.c in Sources */,
A5816DED24180F4D003BA66C /* panic.cpp in Sources */, A5816DED24180F4D003BA66C /* panic.cpp in Sources */,
A5456D7023FC5B08000BF18C /* Pointer.cpp in Sources */,
A5AA0597237F13C1009CD413 /* ReadPmc.nasm in Sources */, A5AA0597237F13C1009CD413 /* ReadPmc.nasm in Sources */,
A5AA0497237F13C1009CD413 /* ReadGs.nasm in Sources */, A5AA0497237F13C1009CD413 /* ReadGs.nasm in Sources */,
A5AA0618237F13C2009CD413 /* Synchronization.asm in Sources */, A5AA0618237F13C2009CD413 /* Synchronization.asm in Sources */,
@ -17330,7 +17321,6 @@
A5AAFC96237F13B4009CD413 /* NonDiscoverablePciDeviceIo.c in Sources */, A5AAFC96237F13B4009CD413 /* NonDiscoverablePciDeviceIo.c in Sources */,
A5AAFB77237F13B3009CD413 /* FirmwarePerformanceDxe.c in Sources */, A5AAFB77237F13B3009CD413 /* FirmwarePerformanceDxe.c in Sources */,
A5AAFCC1237F13B4009CD413 /* ComponentName.c in Sources */, A5AAFCC1237F13B4009CD413 /* ComponentName.c in Sources */,
A5456D5923FC5B08000BF18C /* picopng.cpp in Sources */,
A5AAFD65237F13B4009CD413 /* String.c in Sources */, A5AAFD65237F13B4009CD413 /* String.c in Sources */,
A5AA0754237F13C3009CD413 /* ScanMem8Wrapper.c in Sources */, A5AA0754237F13C3009CD413 /* ScanMem8Wrapper.c in Sources */,
A5AAFD03237F13B4009CD413 /* BmBoot.c in Sources */, A5AAFD03237F13B4009CD413 /* BmBoot.c in Sources */,

View File

@ -89,8 +89,25 @@ public:
ACTION mAction; ACTION mAction;
UINTN mItemID; UINTN mItemID;
SCROLL_STATE ScrollState; SCROLL_STATE ScrollState;
BOOLEAN ScrollEnabled;
// MENU_STYLE_FUNC StyleFunc; // 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() REFIT_MENU_SCREEN()
: ID(0), Title(0), TitleImage(0), : ID(0), Title(0), TitleImage(0),
@ -122,6 +139,7 @@ public:
VOID InitScroll(IN INTN ItemCount, IN UINTN MaxCount, VOID InitScroll(IN INTN ItemCount, IN UINTN MaxCount,
IN UINTN VisibleSpace, IN INTN Selected); IN UINTN VisibleSpace, IN INTN Selected);
VOID UpdateScroll(IN UINTN Movement); VOID UpdateScroll(IN UINTN Movement);
VOID ScrollingBar();
VOID HidePointer(); VOID HidePointer();
EFI_STATUS MouseBirth(); EFI_STATUS MouseBirth();
VOID KillMouse(); VOID KillMouse();

View File

@ -36,7 +36,7 @@
#if USE_XTHEME #if USE_XTHEME
#include "XTheme.h" #include "XTheme.h"
XTheme Theme; //later this definition will be global //XTheme ThemeX; //later this definition will be global
#endif #endif
@ -640,6 +640,8 @@ EG_IMAGE * LoadSvgFrame(INTN i)
EG_IMAGE *Frame = NULL; EG_IMAGE *Frame = NULL;
EFI_STATUS Status; EFI_STATUS Status;
CHAR8 FrameName[64]; 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); AsciiSPrint(FrameName, 63, "frame_%d", i+1);
Status = ParseSVGIcon(mainParser, BUILTIN_ICON_ANIME, FrameName, GlobalConfig.Scale, &Frame); Status = ParseSVGIcon(mainParser, BUILTIN_ICON_ANIME, FrameName, GlobalConfig.Scale, &Frame);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {

View File

@ -2,6 +2,7 @@
#include "lodepng.h" #include "lodepng.h"
#include "nanosvg.h" #include "nanosvg.h"
#ifndef DEBUG_ALL #ifndef DEBUG_ALL
#define DEBUG_XIMAGE 1 #define DEBUG_XIMAGE 1
#else #else
@ -189,12 +190,11 @@ void XImage::Fill(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color)
PixelData[y * Width + x] = 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) { for (INTN y = Rect.YPos; y < (INTN)Height && (y - Rect.YPos) < Rect.Height; ++y) {
// EFI_GRAPHICS_OUTPUT_BLT_PIXEL* Ptr = PixelData + y * Width + Rect.Xpos; for (INTN x = Rect.XPos; x < (INTN)Width && (x - Rect.XPos) < Rect.Width; ++x)
for (UINTN x = Rect.Xpos; x < Width && (x - Rect.Xpos) < Rect.Width; ++x)
// *Ptr++ = Color;
PixelData[y * Width + x] = Color; 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) void XImage::DrawWithoutCompose(INTN x, INTN y, UINTN width, UINTN height)
{ {
// //prepare images if (isEmpty()) {
//// DBG("1\n"); return;
// 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 ( width == 0 ) width = Width; if ( width == 0 ) width = Width;
if ( height == 0 ) height = Height; if ( height == 0 ) height = Height;
UINTN AreaWidth = (x + width > (UINTN)UGAWidth) ? (UGAWidth - x) : width; 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) void XImage::Draw(INTN x, INTN y, float scale)
{ {
//prepare images //prepare images
if (isEmpty()) {
return;
}
XImage Top(*this, scale); XImage Top(*this, scale);
XImage Background(Width, Height); XImage Background(Width, Height);
Background.GetArea(x, y, Width, Height); Background.GetArea(x, y, Width, Height);

View File

@ -35,14 +35,14 @@ typedef union {
UINT32 Raw; UINT32 Raw;
} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION; } EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
#endif #endif
/*
typedef struct { typedef struct {
UINTN Xpos; UINTN Xpos;
UINTN Ypos; UINTN Ypos;
UINTN Width; UINTN Width;
UINTN Height; UINTN Height;
} EgRect; } EgRect;
*/
class XImage class XImage
{ {
protected: protected:
@ -80,7 +80,7 @@ public:
void Fill(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color = { 0, 0, 0, 0 }); 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 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 Compose(INTN PosX, INTN PosY, const XImage& TopImage, bool Lowest); //instead of compose we often can Back.Draw(...) + Top.Draw(...)
void FlipRB(bool WantAlpha); void FlipRB(bool WantAlpha);

View File

@ -201,38 +201,37 @@ bool XPointer::MouseInRect(EG_RECT *Place)
EFI_STATUS XPointer::CheckMouseEvent(REFIT_MENU_SCREEN *Screen) EFI_STATUS XPointer::CheckMouseEvent(REFIT_MENU_SCREEN *Screen)
{ {
EFI_STATUS Status = EFI_TIMEOUT;
// INTN EntryId;
Screen->mAction = ActionNone;
if (!Screen) { if (!Screen) {
return EFI_TIMEOUT; return EFI_TIMEOUT;
} }
EFI_STATUS Status = EFI_TIMEOUT;
Screen->mAction = ActionNone;
if (!IsDragging && MouseEvent == MouseMove) if (!IsDragging && MouseEvent == MouseMove)
MouseEvent = NoEvents; MouseEvent = NoEvents;
// if (MouseEvent != NoEvents){ if (Screen->ScrollEnabled){
if (ScrollEnabled && MouseInRect(&UpButton) && MouseEvent == LeftClick) if (MouseInRect(&UpButton) && MouseEvent == LeftClick)
Screen->mAction = ActionScrollUp; Screen->mAction = ActionScrollUp;
else if (ScrollEnabled && MouseInRect(&DownButton) && MouseEvent == LeftClick) else if (MouseInRect(&DownButton) && MouseEvent == LeftClick)
Screen->mAction = ActionScrollDown; Screen->mAction = ActionScrollDown;
else if (ScrollEnabled && MouseInRect(&Scrollbar) && MouseEvent == LeftMouseDown) { else if (MouseInRect(&Scrollbar) && MouseEvent == LeftMouseDown) {
IsDragging = TRUE; IsDragging = TRUE;
Screen->mAction = ActionMoveScrollbar;
ScrollbarYMovement = 0; ScrollbarYMovement = 0;
ScrollbarOldPointerPlace.XPos = ScrollbarNewPointerPlace.XPos = newPlace.XPos; ScrollbarOldPointerPlace.XPos = ScrollbarNewPointerPlace.XPos = newPlace.XPos;
ScrollbarOldPointerPlace.YPos = ScrollbarNewPointerPlace.YPos = newPlace.YPos; ScrollbarOldPointerPlace.YPos = ScrollbarNewPointerPlace.YPos = newPlace.YPos;
} }
else if (ScrollEnabled && IsDragging && MouseEvent == LeftClick) { else if (IsDragging && MouseEvent == LeftClick) {
IsDragging = FALSE; IsDragging = FALSE;
Screen->mAction = ActionMoveScrollbar;
} }
else if (ScrollEnabled && IsDragging && MouseEvent == MouseMove) { else if (IsDragging && MouseEvent == MouseMove) {
Screen->mAction = ActionMoveScrollbar; Screen->mAction = ActionMoveScrollbar;
ScrollbarNewPointerPlace.XPos = newPlace.XPos; ScrollbarNewPointerPlace.XPos = newPlace.XPos;
ScrollbarNewPointerPlace.YPos = newPlace.YPos; ScrollbarNewPointerPlace.YPos = newPlace.YPos;
} }
else if (ScrollEnabled && MouseInRect(&ScrollbarBackground) && else if (MouseInRect(&ScrollbarBackground) &&
MouseEvent == LeftClick) { MouseEvent == LeftClick) {
if (newPlace.YPos < Scrollbar.YPos) // up if (newPlace.YPos < Scrollbar.YPos) // up
Screen->mAction = ActionPageUp; Screen->mAction = ActionPageUp;
@ -240,15 +239,14 @@ EFI_STATUS XPointer::CheckMouseEvent(REFIT_MENU_SCREEN *Screen)
Screen->mAction = ActionPageDown; Screen->mAction = ActionPageDown;
// page up/down, like in OS X // page up/down, like in OS X
} }
else if (ScrollEnabled && else if (MouseEvent == ScrollDown) {
MouseEvent == ScrollDown) {
Screen->mAction = ActionScrollDown; Screen->mAction = ActionScrollDown;
} }
else if (ScrollEnabled && else if (MouseEvent == ScrollUp) {
MouseEvent == ScrollUp) {
Screen->mAction = ActionScrollUp; Screen->mAction = ActionScrollUp;
} }
else { } //if scroll enabled
if (Screen->mAction != ActionNone) {
for (UINTN EntryId = 0; EntryId < Screen->Entries.size(); EntryId++) { for (UINTN EntryId = 0; EntryId < Screen->Entries.size(); EntryId++) {
if (MouseInRect(&(Screen->Entries[EntryId].Place))) { if (MouseInRect(&(Screen->Entries[EntryId].Place))) {
switch (MouseEvent) { switch (MouseEvent) {
@ -301,7 +299,7 @@ EFI_STATUS XPointer::CheckMouseEvent(REFIT_MENU_SCREEN *Screen)
} }
} }
} }
// }
if (Screen->mAction != ActionNone) { if (Screen->mAction != ActionNone) {
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
MouseEvent = NoEvents; //clear event as set action MouseEvent = NoEvents; //clear event as set action

View File

@ -132,6 +132,7 @@ void XTheme::Init()
Scale = 1.0f; Scale = 1.0f;
CentreShift = 0.0f; CentreShift = 0.0f;
Daylight = true; Daylight = true;
LayoutHeight = 376;
} }
XImage& XTheme::GetIcon(const char* Name) 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_radio_button)
//DECLARE_EMB_EXTERN_WITH_SIZE(emb_checkbox) //DECLARE_EMB_EXTERN_WITH_SIZE(emb_checkbox)
//DECLARE_EMB_EXTERN_WITH_SIZE(emb_checkbox_checked) //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"); Status = Button[0].LoadXImage(ThemeDir, "radio_button");
@ -504,15 +504,15 @@ void XTheme::InitSelection()
} }
Status = Button[1].LoadXImage(ThemeDir, "radio_button_selected")); Status = Button[1].LoadXImage(ThemeDir, "radio_button_selected"));
if (EFI_ERROR(Status)) { 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"); Status = Button[2].LoadXImage(ThemeDir, "checkbox");
if (EFI_ERROR(Status)) { 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"); Status = Button[3].LoadXImage(ThemeDir, "checkbox_checked");
if (EFI_ERROR(Status)) { 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 // non-selected background images
@ -550,7 +550,100 @@ void XTheme::FillByDir() //assume ThemeDir is defined by InitTheme() procedure
InitSelection(); //initialize selections, buttons InitSelection(); //initialize selections, buttons
//load banner //load banner and background
Banner.LoadXImage(ThemeDir, BannerFileName); 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;
} }
}

View File

@ -80,12 +80,19 @@ public:
INTN LayoutHeight; //it was 376 before INTN LayoutHeight; //it was 376 before
BOOLEAN Daylight; BOOLEAN Daylight;
void Init();
XImage Background; //Background and Banner will not be in array as they live own life 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 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 Banner; //same as logo in the array, make a link?
XImage SelectionImages[6]; XImage SelectionImages[6];
XImage Button[4]; XImage Button[4];
XImage ScrollbarBackgroundImage;
XImage BarStartImage;
XImage BarEndImage;
XImage ScrollbarImage;
XImage ScrollStartImage;
XImage ScrollEndImage;
XImage UpButtonImage;
XImage DownButtonImage;
//fill the theme //fill the theme
XImage& GetIcon(XStringW& Name); //get by name XImage& GetIcon(XStringW& Name); //get by name
@ -99,7 +106,9 @@ public:
void ClearScreen(); void ClearScreen();
void FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Height); void FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Height);
void InitSelection(); void InitSelection();
void InitBar();
void Init();
XTheme(); //default constructor XTheme(); //default constructor
~XTheme(); ~XTheme();

View File

@ -141,6 +141,9 @@ extern "C" {
#endif #endif
#define USE_XTHEME 0 #define USE_XTHEME 0
#if USE_XTHEME
extern XTheme ThemeX; //global variable defined in lib.cpp
#endif
/* types */ /* types */

View File

@ -58,6 +58,11 @@ EFI_FILE *SelfDir;
CHAR16 *SelfDirPath; CHAR16 *SelfDirPath;
EFI_DEVICE_PATH *SelfDevicePath; EFI_DEVICE_PATH *SelfDevicePath;
EFI_DEVICE_PATH *SelfFullDevicePath; EFI_DEVICE_PATH *SelfFullDevicePath;
#if USE_XTHEME
XTheme ThemeX;
#endif
EFI_FILE *ThemeDir = NULL; EFI_FILE *ThemeDir = NULL;
CHAR16 *ThemePath; CHAR16 *ThemePath;
BOOLEAN gThemeChanged = FALSE; BOOLEAN gThemeChanged = FALSE;

View File

@ -324,7 +324,7 @@ typedef struct {
BOOLEAN IsScrolling, PaintAll, PaintSelection; BOOLEAN IsScrolling, PaintAll, PaintSelection;
} SCROLL_STATE; } SCROLL_STATE;
extern BOOLEAN ScrollEnabled; //extern BOOLEAN ScrollEnabled;
extern EG_RECT UpButton; extern EG_RECT UpButton;
extern EG_RECT DownButton; extern EG_RECT DownButton;
extern EG_RECT ScrollbarBackground; extern EG_RECT ScrollbarBackground;

View File

@ -61,6 +61,7 @@
#define DBG(...) DebugLog(DEBUG_MENU, __VA_ARGS__) #define DBG(...) DebugLog(DEBUG_MENU, __VA_ARGS__)
#endif #endif
//#define PREBOOT_LOG L"EFI\\CLOVER\\misc\\preboot.log" //#define PREBOOT_LOG L"EFI\\CLOVER\\misc\\preboot.log"
//#define VBIOS_BIN L"EFI\\CLOVER\\misc\\c0000.bin" //#define VBIOS_BIN L"EFI\\CLOVER\\misc\\c0000.bin"
CONST CHAR16 *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 MainAnime = FALSE;
BOOLEAN ScrollEnabled = FALSE; //BOOLEAN ScrollEnabled = FALSE;
BOOLEAN IsDragging = FALSE; BOOLEAN IsDragging = FALSE;
INTN ScrollWidth = 16; INTN ScrollWidth = 16;
@ -1904,12 +1905,6 @@ VOID InitSelection(VOID)
//it was a nonsense egLoadImage is just inluded into egLoadIcon. //it was a nonsense egLoadImage is just inluded into egLoadIcon.
// will be corrected with XTheme support // will be corrected with XTheme support
//the procedure loadIcon should also check embedded icons //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[0] = egLoadImage(ThemeDir, GetIconsExt(L"radio_button", L"png"), TRUE); //memory leak
Buttons[1] = egLoadImage(ThemeDir, GetIconsExt(L"radio_button_selected", L"png"), TRUE); Buttons[1] = egLoadImage(ThemeDir, GetIconsExt(L"radio_button_selected", L"png"), TRUE);
if (!Buttons[0]) { if (!Buttons[0]) {
@ -1947,20 +1942,7 @@ VOID InitSelection(VOID)
// DBG("embedded checkbox_checked\n"); // DBG("embedded checkbox_checked\n");
Buttons[3] = egDecodePNG(ACCESS_EMB_DATA(emb_checkbox_checked), ACCESS_EMB_SIZE(emb_checkbox_checked), TRUE); Buttons[3] = egDecodePNG(ACCESS_EMB_DATA(emb_checkbox_checked), ACCESS_EMB_SIZE(emb_checkbox_checked), TRUE);
} }
#endif
// non-selected background images // 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 //totally wrong
if (GlobalConfig.SelectionBigFileName != NULL) { if (GlobalConfig.SelectionBigFileName != NULL) {
SelectionImages[1] = egCreateFilledImage(row0TileSize, row0TileSize, SelectionImages[1] = egCreateFilledImage(row0TileSize, row0TileSize,
@ -1990,7 +1972,6 @@ VOID InitSelection(VOID)
} }
} }
// DBG("selections inited\n"); // 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; ScrollTotal.Height = DownButton.YPos + DownButton.Height - UpButton.YPos;
// DBG("ScrollTotal.Height = %d\n", ScrollTotal.Height); //ScrollTotal.Height = 420 // 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; EG_IMAGE* Total;
INTN i; INTN i;
ScrollEnabled = (State->MaxFirstVisible != 0); ScrollEnabled = (ScrollState.MaxFirstVisible != 0);
if (ScrollEnabled) { if (ScrollEnabled) {
Total = egCreateFilledImage(ScrollTotal.Width, ScrollTotal.Height, TRUE, &MenuBackgroundPixel); Total = egCreateFilledImage(ScrollTotal.Width, ScrollTotal.Height, TRUE, &MenuBackgroundPixel);
@ -3456,7 +3483,7 @@ VOID ScrollingBar(IN SCROLL_STATE *State)
egFreeImage(Total); egFreeImage(Total);
} }
} }
#endif
/** /**
* Graphical menu. * 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(); //MouseBirth();
break; 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); ScrollStart.YPos = ScrollbarBackground.YPos + ScrollbarBackground.Height * ScrollState.FirstVisible / (ScrollState.MaxIndex + 1);
Scrollbar.YPos = ScrollStart.YPos + ScrollStart.Height; Scrollbar.YPos = ScrollStart.YPos + ScrollStart.Height;
ScrollEnd.YPos = Scrollbar.YPos + Scrollbar.Height; // ScrollEnd.Height is already subtracted ScrollEnd.YPos = Scrollbar.YPos + Scrollbar.Height; // ScrollEnd.Height is already subtracted
ScrollingBar(&ScrollState); ScrollingBar(); //&ScrollState);
break; break;
} }
@ -4158,7 +4185,7 @@ VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16
(UGAWidth >> 1), textPosY); (UGAWidth >> 1), textPosY);
} }
ScrollingBar(&ScrollState); ScrollingBar(); //&ScrollState);
DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT); DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT);
DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER); DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER);
MouseBirth(); MouseBirth();
@ -4190,7 +4217,7 @@ VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16
(UGAWidth >> 1), textPosY); (UGAWidth >> 1), textPosY);
} }
ScrollingBar(&ScrollState); ScrollingBar(); //&ScrollState);
DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT); DrawTextCorner(TEXT_CORNER_REVISION, X_IS_LEFT);
DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER); DrawTextCorner(TEXT_CORNER_OPTIMUS, X_IS_CENTER);
MouseBirth(); MouseBirth();

View File

@ -397,7 +397,7 @@ VOID SwitchToGraphicsAndClear(VOID) //called from MENU_FUNCTION_INIT
{ {
SwitchToGraphics(); SwitchToGraphics();
#if USE_XTHEME #if USE_XTHEME
Theme.ClearScreen(); ThemeX.ClearScreen();
#else #else
if (GraphicsScreenDirty) { //Invented in rEFIt 15 years ago if (GraphicsScreenDirty) { //Invented in rEFIt 15 years ago
BltClearScreen(); BltClearScreen();
@ -412,6 +412,7 @@ typedef struct {
INTN Width; INTN Width;
INTN Height; INTN Height;
} EG_RECT; } EG_RECT;
// moreover it is class EG_RECT;
//same as EgRect but INTN <-> UINTN //same as EgRect but INTN <-> UINTN
*/ */