From 0449bb7335623283afe7b2a97a5f758b97b2985f Mon Sep 17 00:00:00 2001 From: Jief L Date: Sat, 4 Apr 2020 13:13:34 +0300 Subject: [PATCH] Fixes after rename. --- rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp | 119 ++++++++++++++++++++++++++- rEFIt_UEFI/libeg/XPointer.cpp | 112 ------------------------- rEFIt_UEFI/refit.inf | 1 - rEFIt_UEFI/refit/screen.cpp | 2 +- 4 files changed, 117 insertions(+), 117 deletions(-) diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp index f2b8acfe9..f4e696153 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp @@ -44,8 +44,8 @@ #include "../libeg/nanosvg.h" #include "../libeg/FloatLib.h" #include "HdaCodecDump.h" -#include "menu.h" -#include "screen.h" +#include "REFIT_MENU_SCREEN.h" +//#include "screen.h" #include "../cpp_foundation/XString.h" #include "../libeg/XTheme.h" #include "../libeg/VectorGraphics.h" // for testSVG @@ -62,6 +62,8 @@ #define DBG(...) DebugLog(DEBUG_MENU, __VA_ARGS__) #endif +XPointer REFIT_MENU_SCREEN::mPointer; + //#define PREBOOT_LOG L"EFI\\CLOVER\\misc\\preboot.log" //#define VBIOS_BIN L"EFI\\CLOVER\\misc\\c0000.bin" @@ -4459,7 +4461,7 @@ VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN { INTN MainSize = ThemeX.MainEntriesSize; XImage MainImage(MainSize, MainSize); - XImage* BadgeImage; + XImage* BadgeImage = NULL; if (Entry->Row == 0 && Entry->getDriveImage() && !(ThemeX.HideBadges & HDBADGES_SWAP)) { MainImage = *Entry->getDriveImage(); @@ -7086,3 +7088,114 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC return MenuExit; } + +EFI_STATUS REFIT_MENU_SCREEN::CheckMouseEvent() +{ + EFI_STATUS Status = EFI_TIMEOUT; + mAction = ActionNone; + MOUSE_EVENT Event = mPointer.GetEvent(); + bool Move = false; + + if (!IsDragging && Event == MouseMove) + Event = NoEvents; + + if (ScrollEnabled){ + if (mPointer.MouseInRect(&UpButton) && Event == LeftClick) + mAction = ActionScrollUp; + else if (mPointer.MouseInRect(&DownButton) && Event == LeftClick) + mAction = ActionScrollDown; + else if (mPointer.MouseInRect(&Scrollbar) && Event == LeftMouseDown) { + IsDragging = TRUE; + Move = true; +// mAction = ActionMoveScrollbar; + ScrollbarYMovement = 0; + ScrollbarOldPointerPlace.XPos = ScrollbarNewPointerPlace.XPos = mPointer.GetPlace().XPos; + ScrollbarOldPointerPlace.YPos = ScrollbarNewPointerPlace.YPos = mPointer.GetPlace().YPos; + } + else if (IsDragging && Event == LeftClick) { + IsDragging = FALSE; + Move = true; +// mAction = ActionMoveScrollbar; + } + else if (IsDragging && Event == MouseMove) { + mAction = ActionMoveScrollbar; + ScrollbarNewPointerPlace.XPos = mPointer.GetPlace().XPos; + ScrollbarNewPointerPlace.YPos = mPointer.GetPlace().YPos; + } + else if (mPointer.MouseInRect(&ScrollbarBackground) && + Event == LeftClick) { + if (mPointer.GetPlace().YPos < Scrollbar.YPos) // up + mAction = ActionPageUp; + else // down + mAction = ActionPageDown; + // page up/down, like in OS X + } + else if (Event == ScrollDown) { + mAction = ActionScrollDown; + } + else if (Event == ScrollUp) { + mAction = ActionScrollUp; + } + } + if (!ScrollEnabled || (mAction == ActionNone && !Move) ) { + for (UINTN EntryId = 0; EntryId < Entries.size(); EntryId++) { + if (mPointer.MouseInRect(&(Entries[EntryId].Place))) { + switch (Event) { + case LeftClick: + mAction = Entries[EntryId].AtClick; + // DBG("Click\n"); + break; + case RightClick: + mAction = Entries[EntryId].AtRightClick; + break; + case DoubleClick: + mAction = Entries[EntryId].AtDoubleClick; + break; + case ScrollDown: + mAction = ActionScrollDown; + break; + case ScrollUp: + mAction = ActionScrollUp; + break; + case MouseMove: + mAction = Entries[EntryId].AtMouseOver; + //how to do the action once? + break; + default: + mAction = ActionNone; + break; + } + mItemID = EntryId; + break; + } + else { //click in milk + switch (Event) { + case LeftClick: + mAction = ActionDeselect; + break; + case RightClick: + mAction = ActionFinish; + break; + case ScrollDown: + mAction = ActionScrollDown; + break; + case ScrollUp: + mAction = ActionScrollUp; + break; + default: + mAction = ActionNone; + break; + } + mItemID = 0xFFFF; + } + } + + } + + if (mAction != ActionNone) { + Status = EFI_SUCCESS; + // Event = NoEvents; //clear event as set action + mPointer.ClearEvent(); + } + return Status; +} diff --git a/rEFIt_UEFI/libeg/XPointer.cpp b/rEFIt_UEFI/libeg/XPointer.cpp index e672b0eda..21fc5b80f 100644 --- a/rEFIt_UEFI/libeg/XPointer.cpp +++ b/rEFIt_UEFI/libeg/XPointer.cpp @@ -216,115 +216,3 @@ bool XPointer::MouseInRect(EG_RECT *Place) (newPlace.YPos >= Place->YPos) && (newPlace.YPos < (Place->YPos + (INTN)Place->Height))); } - -EFI_STATUS REFIT_MENU_SCREEN::CheckMouseEvent() -{ - EFI_STATUS Status = EFI_TIMEOUT; - mAction = ActionNone; - MOUSE_EVENT Event = mPointer.GetEvent(); - bool Move = false; - - if (!IsDragging && Event == MouseMove) - Event = NoEvents; - - if (ScrollEnabled){ - if (mPointer.MouseInRect(&UpButton) && Event == LeftClick) - mAction = ActionScrollUp; - else if (mPointer.MouseInRect(&DownButton) && Event == LeftClick) - mAction = ActionScrollDown; - else if (mPointer.MouseInRect(&Scrollbar) && Event == LeftMouseDown) { - IsDragging = TRUE; - Move = true; -// mAction = ActionMoveScrollbar; - ScrollbarYMovement = 0; - ScrollbarOldPointerPlace.XPos = ScrollbarNewPointerPlace.XPos = mPointer.GetPlace().XPos; - ScrollbarOldPointerPlace.YPos = ScrollbarNewPointerPlace.YPos = mPointer.GetPlace().YPos; - } - else if (IsDragging && Event == LeftClick) { - IsDragging = FALSE; - Move = true; -// mAction = ActionMoveScrollbar; - } - else if (IsDragging && Event == MouseMove) { - mAction = ActionMoveScrollbar; - ScrollbarNewPointerPlace.XPos = mPointer.GetPlace().XPos; - ScrollbarNewPointerPlace.YPos = mPointer.GetPlace().YPos; - } - else if (mPointer.MouseInRect(&ScrollbarBackground) && - Event == LeftClick) { - if (mPointer.GetPlace().YPos < Scrollbar.YPos) // up - mAction = ActionPageUp; - else // down - mAction = ActionPageDown; - // page up/down, like in OS X - } - else if (Event == ScrollDown) { - mAction = ActionScrollDown; - } - else if (Event == ScrollUp) { - mAction = ActionScrollUp; - } - } - if (!ScrollEnabled || (mAction == ActionNone && !Move) ) { - for (UINTN EntryId = 0; EntryId < Entries.size(); EntryId++) { - if (mPointer.MouseInRect(&(Entries[EntryId].Place))) { - switch (Event) { - case LeftClick: - mAction = Entries[EntryId].AtClick; - // DBG("Click\n"); - break; - case RightClick: - mAction = Entries[EntryId].AtRightClick; - break; - case DoubleClick: - mAction = Entries[EntryId].AtDoubleClick; - break; - case ScrollDown: - mAction = ActionScrollDown; - break; - case ScrollUp: - mAction = ActionScrollUp; - break; - case MouseMove: - mAction = Entries[EntryId].AtMouseOver; - //how to do the action once? - break; - default: - mAction = ActionNone; - break; - } - mItemID = EntryId; - break; - } - else { //click in milk - switch (Event) { - case LeftClick: - mAction = ActionDeselect; - break; - case RightClick: - mAction = ActionFinish; - break; - case ScrollDown: - mAction = ActionScrollDown; - break; - case ScrollUp: - mAction = ActionScrollUp; - break; - default: - mAction = ActionNone; - break; - } - mItemID = 0xFFFF; - } - } - - } - - if (mAction != ActionNone) { - Status = EFI_SUCCESS; - // Event = NoEvents; //clear event as set action - mPointer.ClearEvent(); - } - return Status; -} - diff --git a/rEFIt_UEFI/refit.inf b/rEFIt_UEFI/refit.inf index a3efbafcd..ca2c60ef0 100644 --- a/rEFIt_UEFI/refit.inf +++ b/rEFIt_UEFI/refit.inf @@ -41,7 +41,6 @@ refit/icns.cpp refit/lib.cpp refit/lib.h - refit/menu.cpp refit/menu.h refit/screen.cpp refit/screen.h diff --git a/rEFIt_UEFI/refit/screen.cpp b/rEFIt_UEFI/refit/screen.cpp index 946af0d8f..01e9567ec 100644 --- a/rEFIt_UEFI/refit/screen.cpp +++ b/rEFIt_UEFI/refit/screen.cpp @@ -85,7 +85,7 @@ const EFI_GRAPHICS_OUTPUT_BLT_PIXEL StdBackgroundPixel = { 0xbf, 0xbf, 0xbf, 0 const EFI_GRAPHICS_OUTPUT_BLT_PIXEL MenuBackgroundPixel = { 0x00, 0x00, 0x00, 0x00}; const EFI_GRAPHICS_OUTPUT_BLT_PIXEL InputBackgroundPixel = { 0xcf, 0xcf, 0xcf, 0x80}; EFI_GRAPHICS_OUTPUT_BLT_PIXEL BlueBackgroundPixel = { 0x7f, 0x0f, 0x0f, 0xff}; -const EFI_GRAPHICS_OUTPUT_BLT_PIXEL EmbeddedBackgroundPixel = { 0xaa, 0xaa, 0xaa, 0xff}; +//const EFI_GRAPHICS_OUTPUT_BLT_PIXEL EmbeddedBackgroundPixel = { 0xaa, 0xaa, 0xaa, 0xff}; const EFI_GRAPHICS_OUTPUT_BLT_PIXEL DarkSelectionPixel = { 66, 66, 66, 0xff}; const EFI_GRAPHICS_OUTPUT_BLT_PIXEL DarkEmbeddedBackgroundPixel = { 0x33, 0x33, 0x33, 0xff}; const EFI_GRAPHICS_OUTPUT_BLT_PIXEL WhitePixel = { 0xff, 0xff, 0xff, 0xff};