mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-24 16:27:42 +01:00
repair scroll position
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
0dacc1df4c
commit
ddccb001e6
@ -3833,12 +3833,12 @@ XTheme::GetThemeTagSettings (void* DictP)
|
||||
|
||||
//fill default to have an ability change theme
|
||||
//assume Xtheme is already inited by embedded values
|
||||
|
||||
//theme variables
|
||||
ScrollWidth = 16;
|
||||
ScrollButtonsHeight = 20;
|
||||
ScrollBarDecorationsHeight = 5;
|
||||
ScrollScrollDecorationsHeight = 7;
|
||||
ThemeX.Font = FONT_LOAD; //not default
|
||||
Font = FONT_LOAD; //not default
|
||||
GuiAnime = NULL;
|
||||
|
||||
|
||||
|
@ -106,7 +106,7 @@ public:
|
||||
|
||||
//TODO scroll positions should depends on REFIT_SCREEN?
|
||||
// Or it just currently calculated to be global variables?
|
||||
/*
|
||||
#if USE_XTHEME
|
||||
EG_RECT BarStart;
|
||||
EG_RECT BarEnd;
|
||||
EG_RECT ScrollStart;
|
||||
@ -118,9 +118,9 @@ public:
|
||||
EG_RECT Scrollbar;
|
||||
EG_RECT ScrollbarOldPointerPlace;
|
||||
EG_RECT ScrollbarNewPointerPlace;
|
||||
*/
|
||||
|
||||
#if USE_XTHEME
|
||||
|
||||
|
||||
REFIT_MENU_SCREEN()
|
||||
: ID(0), Title(), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(), ThemeName(),
|
||||
@ -198,10 +198,17 @@ public:
|
||||
VOID InitScroll(IN INTN ItemCount, IN UINTN MaxCount,
|
||||
IN UINTN VisibleSpace, IN INTN Selected);
|
||||
VOID UpdateScroll(IN UINTN Movement);
|
||||
// void InitBar();
|
||||
VOID ScrollingBar();
|
||||
VOID SetBar(INTN PosX, INTN UpPosY, INTN DownPosY, IN SCROLL_STATE *State);
|
||||
|
||||
//mouse functions
|
||||
VOID HidePointer();
|
||||
EFI_STATUS MouseBirth();
|
||||
VOID KillMouse();
|
||||
EFI_STATUS CheckMouseEvent();
|
||||
|
||||
//menu functions
|
||||
VOID AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor);
|
||||
VOID AddMenuInfo(CONST char *Line);
|
||||
VOID AddMenuInfo_f(CONST char *format, ...);
|
||||
|
@ -482,6 +482,9 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
Icons.AddCopy(NewIcon);
|
||||
}
|
||||
|
||||
//selections
|
||||
SelectionImages[0] = GetIcon(BUILTIN_SELECTION_BIG);
|
||||
SelectionImages[2] = GetIcon(BUILTIN_SELECTION_SMALL);
|
||||
|
||||
//selection for bootcamp style
|
||||
Status = EFI_NOT_FOUND;
|
||||
|
@ -417,7 +417,6 @@ void XImage::GetArea(const EG_RECT& Rect)
|
||||
GetArea(Rect.XPos, Rect.YPos, Rect.Width, Rect.Height);
|
||||
}
|
||||
|
||||
|
||||
void XImage::GetArea(INTN x, INTN y, UINTN W, UINTN H)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
@ -204,6 +204,11 @@ VOID XPointer::UpdatePointer()
|
||||
}
|
||||
}
|
||||
|
||||
MOUSE_EVENT XPointer::GetEvent()
|
||||
{
|
||||
return MouseEvent;
|
||||
}
|
||||
|
||||
bool XPointer::MouseInRect(EG_RECT *Place)
|
||||
{
|
||||
return ((newPlace.XPos >= Place->XPos) &&
|
||||
@ -212,114 +217,113 @@ bool XPointer::MouseInRect(EG_RECT *Place)
|
||||
(newPlace.YPos < (Place->YPos + (INTN)Place->Height)));
|
||||
}
|
||||
|
||||
EFI_STATUS XPointer::CheckMouseEvent(REFIT_MENU_SCREEN *Screen)
|
||||
EFI_STATUS REFIT_MENU_SCREEN::CheckMouseEvent()
|
||||
{
|
||||
if (!Screen) {
|
||||
return EFI_TIMEOUT;
|
||||
}
|
||||
EFI_STATUS Status = EFI_TIMEOUT;
|
||||
Screen->mAction = ActionNone;
|
||||
mAction = ActionNone;
|
||||
MOUSE_EVENT Event = mPointer.GetEvent();
|
||||
bool Move = false;
|
||||
|
||||
if (!IsDragging && MouseEvent == MouseMove)
|
||||
MouseEvent = NoEvents;
|
||||
if (!IsDragging && Event == MouseMove)
|
||||
Event = NoEvents;
|
||||
|
||||
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) {
|
||||
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;
|
||||
// Screen->mAction = ActionMoveScrollbar;
|
||||
// mAction = ActionMoveScrollbar;
|
||||
ScrollbarYMovement = 0;
|
||||
ScrollbarOldPointerPlace.XPos = ScrollbarNewPointerPlace.XPos = newPlace.XPos;
|
||||
ScrollbarOldPointerPlace.YPos = ScrollbarNewPointerPlace.YPos = newPlace.YPos;
|
||||
ScrollbarOldPointerPlace.XPos = ScrollbarNewPointerPlace.XPos = mPointer.GetPlace().XPos;
|
||||
ScrollbarOldPointerPlace.YPos = ScrollbarNewPointerPlace.YPos = mPointer.GetPlace().YPos;
|
||||
}
|
||||
else if (IsDragging && MouseEvent == LeftClick) {
|
||||
else if (IsDragging && Event == LeftClick) {
|
||||
IsDragging = FALSE;
|
||||
Move = true;
|
||||
// Screen->mAction = ActionMoveScrollbar;
|
||||
// mAction = ActionMoveScrollbar;
|
||||
}
|
||||
else if (IsDragging && MouseEvent == MouseMove) {
|
||||
Screen->mAction = ActionMoveScrollbar;
|
||||
ScrollbarNewPointerPlace.XPos = newPlace.XPos;
|
||||
ScrollbarNewPointerPlace.YPos = newPlace.YPos;
|
||||
else if (IsDragging && Event == MouseMove) {
|
||||
mAction = ActionMoveScrollbar;
|
||||
ScrollbarNewPointerPlace.XPos = mPointer.GetPlace().XPos;
|
||||
ScrollbarNewPointerPlace.YPos = mPointer.GetPlace().YPos;
|
||||
}
|
||||
else if (MouseInRect(&ScrollbarBackground) &&
|
||||
MouseEvent == LeftClick) {
|
||||
if (newPlace.YPos < Scrollbar.YPos) // up
|
||||
Screen->mAction = ActionPageUp;
|
||||
else if (mPointer.MouseInRect(&ScrollbarBackground) &&
|
||||
Event == LeftClick) {
|
||||
if (mPointer.GetPlace().YPos < Scrollbar.YPos) // up
|
||||
mAction = ActionPageUp;
|
||||
else // down
|
||||
Screen->mAction = ActionPageDown;
|
||||
mAction = ActionPageDown;
|
||||
// page up/down, like in OS X
|
||||
}
|
||||
else if (MouseEvent == ScrollDown) {
|
||||
Screen->mAction = ActionScrollDown;
|
||||
else if (Event == ScrollDown) {
|
||||
mAction = ActionScrollDown;
|
||||
}
|
||||
else if (MouseEvent == ScrollUp) {
|
||||
Screen->mAction = ActionScrollUp;
|
||||
else if (Event == ScrollUp) {
|
||||
mAction = ActionScrollUp;
|
||||
}
|
||||
}
|
||||
if (!Screen->ScrollEnabled || (Screen->mAction == ActionNone && !Move) ) {
|
||||
for (UINTN EntryId = 0; EntryId < Screen->Entries.size(); EntryId++) {
|
||||
if (MouseInRect(&(Screen->Entries[EntryId].Place))) {
|
||||
switch (MouseEvent) {
|
||||
if (!ScrollEnabled || (mAction == ActionNone && !Move) ) {
|
||||
for (UINTN EntryId = 0; EntryId < Entries.size(); EntryId++) {
|
||||
if (mPointer.MouseInRect(&(Entries[EntryId].Place))) {
|
||||
switch (Event) {
|
||||
case LeftClick:
|
||||
Screen->mAction = Screen->Entries[EntryId].AtClick;
|
||||
mAction = Entries[EntryId].AtClick;
|
||||
// DBG("Click\n");
|
||||
break;
|
||||
case RightClick:
|
||||
Screen->mAction = Screen->Entries[EntryId].AtRightClick;
|
||||
mAction = Entries[EntryId].AtRightClick;
|
||||
break;
|
||||
case DoubleClick:
|
||||
Screen->mAction = Screen->Entries[EntryId].AtDoubleClick;
|
||||
mAction = Entries[EntryId].AtDoubleClick;
|
||||
break;
|
||||
case ScrollDown:
|
||||
Screen->mAction = ActionScrollDown;
|
||||
mAction = ActionScrollDown;
|
||||
break;
|
||||
case ScrollUp:
|
||||
Screen->mAction = ActionScrollUp;
|
||||
mAction = ActionScrollUp;
|
||||
break;
|
||||
case MouseMove:
|
||||
Screen->mAction = Screen->Entries[EntryId].AtMouseOver;
|
||||
mAction = Entries[EntryId].AtMouseOver;
|
||||
//how to do the action once?
|
||||
break;
|
||||
default:
|
||||
Screen->mAction = ActionNone;
|
||||
mAction = ActionNone;
|
||||
break;
|
||||
}
|
||||
Screen->mItemID = EntryId;
|
||||
mItemID = EntryId;
|
||||
break;
|
||||
}
|
||||
else { //click in milk
|
||||
switch (MouseEvent) {
|
||||
switch (Event) {
|
||||
case LeftClick:
|
||||
Screen->mAction = ActionDeselect;
|
||||
mAction = ActionDeselect;
|
||||
break;
|
||||
case RightClick:
|
||||
Screen->mAction = ActionFinish;
|
||||
mAction = ActionFinish;
|
||||
break;
|
||||
case ScrollDown:
|
||||
Screen->mAction = ActionScrollDown;
|
||||
mAction = ActionScrollDown;
|
||||
break;
|
||||
case ScrollUp:
|
||||
Screen->mAction = ActionScrollUp;
|
||||
mAction = ActionScrollUp;
|
||||
break;
|
||||
default:
|
||||
Screen->mAction = ActionNone;
|
||||
mAction = ActionNone;
|
||||
break;
|
||||
}
|
||||
Screen->mItemID = 0xFFFF;
|
||||
mItemID = 0xFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Screen->mAction != ActionNone) {
|
||||
if (mAction != ActionNone) {
|
||||
Status = EFI_SUCCESS;
|
||||
MouseEvent = NoEvents; //clear event as set action
|
||||
// Event = NoEvents; //clear event as set action
|
||||
mPointer.ClearEvent();
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
@ -34,9 +34,12 @@ public:
|
||||
VOID KillMouse();
|
||||
VOID UpdatePointer();
|
||||
bool MouseInRect(EG_RECT *Place);
|
||||
EFI_STATUS CheckMouseEvent(REFIT_MENU_SCREEN *Screen);
|
||||
// EFI_STATUS CheckMouseEvent(REFIT_MENU_SCREEN *Screen);
|
||||
|
||||
bool isEmpty() const { return PointerImage->isEmpty(); }
|
||||
void ClearEvent() { MouseEvent = NoEvents; }
|
||||
MOUSE_EVENT GetEvent();
|
||||
EG_RECT& GetPlace() { return newPlace; }
|
||||
|
||||
protected:
|
||||
VOID Draw();
|
||||
|
@ -26,13 +26,13 @@ extern "C" {
|
||||
#define DBG(...) DebugLog(DEBUG_XTHEME, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
|
||||
//temporary
|
||||
#if !USE_XTHEME
|
||||
//these are XTHEME members
|
||||
extern INTN ScrollWidth;
|
||||
extern INTN ScrollButtonsHeight;
|
||||
extern INTN ScrollBarDecorationsHeight;
|
||||
extern INTN ScrollScrollDecorationsHeight;
|
||||
|
||||
//These are SCREEN members
|
||||
extern EG_RECT UpButton;
|
||||
extern EG_RECT DownButton;
|
||||
extern EG_RECT BarStart;
|
||||
@ -42,14 +42,12 @@ extern EG_RECT Scrollbar;
|
||||
extern EG_RECT ScrollStart;
|
||||
extern EG_RECT ScrollEnd;
|
||||
extern EG_RECT ScrollTotal;
|
||||
|
||||
extern BOOLEAN IsDragging;
|
||||
extern EG_RECT ScrollbarOldPointerPlace;
|
||||
extern EG_RECT ScrollbarNewPointerPlace;
|
||||
#endif
|
||||
//dynamic variables
|
||||
extern INTN ScrollbarYMovement;
|
||||
|
||||
//extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL SelectionBackgroundPixel;
|
||||
|
||||
extern BOOLEAN IsDragging;
|
||||
|
||||
CONST CHAR8* IconsNames[] = {
|
||||
"func_about",
|
||||
@ -601,7 +599,7 @@ void XTheme::InitSelection() //for PNG theme
|
||||
if (!TypeSVG && !SelectionBigFileName.isEmpty()) {
|
||||
BackgroundPixel = { 0x00, 0x00, 0x00, 0x00 };
|
||||
} else if (DarkEmbedded || TypeSVG) {
|
||||
BackgroundPixel = { 0x33, 0x33, 0x33, 0x00 };
|
||||
BackgroundPixel = { 0x33, 0x33, 0x33, 0x00 }; //nonsense
|
||||
} else { //for example embedded daylight
|
||||
BackgroundPixel = { 0xbf, 0xbf, 0xbf, 0xff };
|
||||
}
|
||||
@ -698,29 +696,6 @@ void XTheme::InitBar()
|
||||
DownButtonImage.FromPNG(ACCESS_EMB_DATA(emb_scroll_down_button), ACCESS_EMB_SIZE(emb_scroll_down_button));
|
||||
}
|
||||
}
|
||||
|
||||
//TODO it must be somewhere in InitScroll - Screen function
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // USE_XTHEME
|
||||
|
@ -85,6 +85,11 @@ public:
|
||||
INTN LayoutButtonOffset;
|
||||
INTN LayoutTextOffset;
|
||||
INTN LayoutAnimMoveForMenuX;
|
||||
INTN ScrollWidth;
|
||||
INTN ScrollButtonsHeight;
|
||||
INTN ScrollBarDecorationsHeight;
|
||||
INTN ScrollScrollDecorationsHeight;
|
||||
|
||||
|
||||
BOOLEAN Daylight;
|
||||
|
||||
|
@ -1083,7 +1083,7 @@ EFI_STATUS WaitForInputEventPoll(REFIT_MENU_SCREEN* ScreenPtr, UINTN TimeoutDefa
|
||||
// if ( Screen.mPointer ) {
|
||||
if (Screen.mPointer.isAlive()) {
|
||||
Screen.mPointer.UpdatePointer();
|
||||
Status = Screen.mPointer.CheckMouseEvent(&Screen); //out: gItemID, gAction
|
||||
Status = Screen.CheckMouseEvent(); //out: gItemID, gAction
|
||||
if (Status != EFI_TIMEOUT) { //this check should return timeout if no mouse events occured
|
||||
break;
|
||||
|
||||
|
@ -221,6 +221,7 @@ typedef struct _pointers {
|
||||
#define SVALUE_MAX_SIZE 512
|
||||
|
||||
//extern BOOLEAN ScrollEnabled;
|
||||
#if !USE_XTHEME
|
||||
extern EG_RECT UpButton;
|
||||
extern EG_RECT DownButton;
|
||||
extern EG_RECT BarStart;
|
||||
@ -230,11 +231,11 @@ extern EG_RECT Scrollbar;
|
||||
extern EG_RECT ScrollStart;
|
||||
extern EG_RECT ScrollEnd;
|
||||
extern EG_RECT ScrollTotal;
|
||||
|
||||
extern BOOLEAN IsDragging;
|
||||
extern EG_RECT ScrollbarOldPointerPlace;
|
||||
extern EG_RECT ScrollbarNewPointerPlace;
|
||||
#endif
|
||||
extern INTN ScrollbarYMovement;
|
||||
extern BOOLEAN IsDragging;
|
||||
|
||||
#define SCREEN_UNKNOWN 0
|
||||
#define SCREEN_MAIN 1
|
||||
|
@ -135,10 +135,12 @@ BOOLEAN MainAnime = FALSE;
|
||||
//TODO Scroll variables must be a part of REFIT_SCREEN
|
||||
//BOOLEAN ScrollEnabled = FALSE;
|
||||
BOOLEAN IsDragging = FALSE;
|
||||
#if !USE_XTHEME
|
||||
INTN ScrollWidth = 16;
|
||||
INTN ScrollButtonsHeight = 20;
|
||||
INTN ScrollBarDecorationsHeight = 5;
|
||||
INTN ScrollScrollDecorationsHeight = 7;
|
||||
#endif
|
||||
INTN ScrollbarYMovement;
|
||||
|
||||
|
||||
@ -179,6 +181,7 @@ static INTN OldTimeoutTextWidth = 0;
|
||||
static INTN MenuWidth, TimeoutPosY;
|
||||
static INTN EntriesPosX, EntriesPosY;
|
||||
static INTN EntriesWidth, EntriesHeight, EntriesGap;
|
||||
#if !USE_XTHEME
|
||||
static EG_IMAGE* ScrollbarImage = NULL;
|
||||
static EG_IMAGE* ScrollbarBackgroundImage = NULL;
|
||||
static EG_IMAGE* UpButtonImage = NULL;
|
||||
@ -198,7 +201,7 @@ EG_RECT ScrollbarBackground;
|
||||
EG_RECT Scrollbar;
|
||||
EG_RECT ScrollbarOldPointerPlace;
|
||||
EG_RECT ScrollbarNewPointerPlace;
|
||||
|
||||
#endif
|
||||
|
||||
INPUT_ITEM *InputItems = NULL;
|
||||
UINTN InputItemsCount = 0;
|
||||
@ -2038,13 +2041,35 @@ VOID REFIT_MENU_SCREEN::InitScroll(IN INTN ItemCount, IN UINTN MaxCount,
|
||||
ScrollState.PaintSelection = FALSE;
|
||||
|
||||
ScrollState.LastVisible = ScrollState.FirstVisible + ScrollState.MaxVisible;
|
||||
|
||||
//scroll bar geometry
|
||||
if (!ThemeX.TypeSVG) {
|
||||
UpButton.Width = ThemeX.ScrollWidth; // 16
|
||||
UpButton.Height = ThemeX.ScrollButtonsHeight; // 20
|
||||
DownButton.Width = UpButton.Width;
|
||||
DownButton.Height = ThemeX.ScrollButtonsHeight;
|
||||
BarStart.Height = ThemeX.ScrollBarDecorationsHeight; // 5
|
||||
BarEnd.Height = ThemeX.ScrollBarDecorationsHeight;
|
||||
ScrollStart.Height = ThemeX.ScrollScrollDecorationsHeight; // 7
|
||||
ScrollEnd.Height = ThemeX.ScrollScrollDecorationsHeight;
|
||||
|
||||
} else {
|
||||
UpButton.Width = ThemeX.ScrollWidth; // 16
|
||||
UpButton.Height = 0; // 20
|
||||
DownButton.Width = UpButton.Width;
|
||||
DownButton.Height = 0;
|
||||
BarStart.Height = ThemeX.ScrollBarDecorationsHeight; // 5
|
||||
BarEnd.Height = ThemeX.ScrollBarDecorationsHeight;
|
||||
ScrollStart.Height = 0; // 7
|
||||
ScrollEnd.Height = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VOID REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement)
|
||||
{
|
||||
INTN Lines;
|
||||
UINTN ScrollMovement = SCROLL_SCROLL_DOWN;
|
||||
INTN i;
|
||||
ScrollState.LastSelection = ScrollState.CurrentSelection;
|
||||
|
||||
switch (Movement) {
|
||||
@ -2058,7 +2083,7 @@ VOID REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement)
|
||||
Lines = -Lines;
|
||||
ScrollMovement = SCROLL_SCROLL_UP;
|
||||
}
|
||||
for (i = 0; i < Lines; i++)
|
||||
for (INTN i = 0; i < Lines; i++)
|
||||
UpdateScroll(ScrollMovement);
|
||||
break;
|
||||
|
||||
@ -3451,7 +3476,7 @@ VOID DrawMenuText(IN CONST CHAR16 *Text, IN INTN SelectedWidth, IN INTN XPos, IN
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if !USE_XTHEME
|
||||
VOID FreeScrollBar(VOID)
|
||||
{
|
||||
if (ScrollbarBackgroundImage) {
|
||||
@ -3488,7 +3513,7 @@ VOID FreeScrollBar(VOID)
|
||||
}
|
||||
}
|
||||
|
||||
#if !USE_XTHEME
|
||||
|
||||
VOID InitBar(VOID)
|
||||
{
|
||||
if (ThemeDir) {
|
||||
@ -3576,7 +3601,7 @@ VOID InitBar(VOID)
|
||||
}
|
||||
#endif
|
||||
|
||||
VOID SetBar(INTN PosX, INTN UpPosY, INTN DownPosY, IN SCROLL_STATE *State)
|
||||
VOID REFIT_MENU_SCREEN::SetBar(INTN PosX, INTN UpPosY, INTN DownPosY, IN SCROLL_STATE *State)
|
||||
{
|
||||
// DBG("SetBar <= %d %d %d %d %d\n", UpPosY, DownPosY, State->MaxVisible, State->MaxIndex, State->FirstVisible);
|
||||
//SetBar <= 302 722 19 31 0
|
||||
@ -3627,22 +3652,23 @@ VOID REFIT_MENU_SCREEN::ScrollingBar()
|
||||
if (!ScrollEnabled) {
|
||||
return;
|
||||
}
|
||||
#if 0 //use compose instead of Draw
|
||||
#if 1 //use compose instead of Draw
|
||||
//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
|
||||
|
||||
XImage Total(ScrollTotal.Width, ScrollTotal.Height);
|
||||
Total.Fill(&MenuBackgroundPixel);
|
||||
// Total.Fill(&MenuBackgroundPixel);
|
||||
Total.CopyRect(ThemeX.Background, ScrollTotal.XPos, ScrollTotal.YPos);
|
||||
if (!ThemeX.ScrollbarBackgroundImage.isEmpty()) {
|
||||
for (INTN i = 0; i < ScrollbarBackground.Height; i+=ThemeX.ScrollbarBackgroundImage->Height) {
|
||||
Total.Compose(ScrollbarBackground.XPos - ScrollTotal.XPos, ScrollbarBackground.YPos + i - ScrollTotal.YPos, ThemeX.ScrollbarBackgroundImage, TRUE);
|
||||
for (INTN i = 0; i < ScrollbarBackground.Height; i+=ThemeX.ScrollbarBackgroundImage.GetHeight()) {
|
||||
Total.Compose(ScrollbarBackground.XPos - ScrollTotal.XPos, ScrollbarBackground.YPos + i - ScrollTotal.YPos, ThemeX.ScrollbarBackgroundImage, FALSE);
|
||||
}
|
||||
}
|
||||
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) {
|
||||
for (INTN i = 0; i < Scrollbar.Height; i+=ThemeX.ScrollbarImage.GetHeight()) {
|
||||
Total.Compose(Scrollbar.XPos - ScrollTotal.XPos, Scrollbar.YPos + i - ScrollTotal.YPos, ThemeX.ScrollbarImage, FALSE);
|
||||
}
|
||||
}
|
||||
@ -3650,7 +3676,7 @@ VOID REFIT_MENU_SCREEN::ScrollingBar()
|
||||
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
|
||||
Total.Draw(ScrollTotal.XPos, ScrollTotal.YPos, ThemeX.ScrollWidth / 16.f); //ScrollWidth can be set in theme.plist but usually=16
|
||||
#else
|
||||
for (INTN i = 0; i < ScrollbarBackground.Height; i += ThemeX.ScrollbarBackgroundImage.GetHeight()) {
|
||||
ThemeX.ScrollbarBackgroundImage.Draw(ScrollbarBackground.XPos - ScrollTotal.XPos, ScrollbarBackground.YPos + i - ScrollTotal.YPos, 1.f);
|
||||
@ -3761,8 +3787,8 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
MenuWidth = UGAWidth - (int)(TITLEICON_SPACING * ThemeX.Scale) - TitleImage.GetWidth() - 2;
|
||||
}
|
||||
EntriesPosX = (UGAWidth - (TitleImage.GetWidth() + (int)(TITLEICON_SPACING * ThemeX.Scale) + MenuWidth)) >> 1;
|
||||
//DBG("UGAWIdth=%d TitleImage=%d MenuWidth=%d\n", UGAWidth,
|
||||
//TitleImage->Width, MenuWidth);
|
||||
// DBG("UGAWIdth=%lld TitleImage=%lld MenuWidth=%lld\n", UGAWidth,
|
||||
// TitleImage.GetWidth(), MenuWidth);
|
||||
MenuWidth += TitleImage.GetWidth();
|
||||
} else {
|
||||
EntriesPosX = (UGAWidth - MenuWidth) >> 1;
|
||||
@ -3809,12 +3835,18 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
|
||||
case MENU_FUNCTION_PAINT_ALL:
|
||||
{
|
||||
// DBG("PAINT_ALL: EntriesPosY=%lld MaxVisible=%lld\n", EntriesPosY, ScrollState.MaxVisible);
|
||||
// DBG("DownButton.Height=%lld TextHeight=%lld\n", DownButton.Height, TextHeight);
|
||||
// DBG("PAINT_ALL: EntriesPosY=%lld MaxVisible=%lld\n", EntriesPosY, ScrollState.MaxVisible);
|
||||
// DBG("DownButton.Height=%lld TextHeight=%lld MenuWidth=%lld\n", DownButton.Height, TextHeight, MenuWidth);
|
||||
t2 = EntriesPosY + (ScrollState.MaxVisible + 1) * TextHeight - DownButton.Height;
|
||||
t1 = EntriesPosX + TextHeight + MenuWidth + (INTN)((TEXT_XMARGIN + 16) * ThemeX.Scale);
|
||||
// DBG("PAINT_ALL: %lld %lld\n", t1, t2);
|
||||
// DBG("PAINT_ALL: X=%lld Y=%lld\n", t1, t2);
|
||||
SetBar(t1, EntriesPosY, t2, &ScrollState); //823 302 554
|
||||
/*
|
||||
48:307 39:206 UGAWIdth=800 TitleImage=48 MenuWidth=333
|
||||
48:635 0:328 PAINT_ALL: EntriesPosY=259 MaxVisible=13
|
||||
48:640 0:004 DownButton.Height=0 TextHeight=21 MenuWidth=381
|
||||
48:646 0:006 PAINT_ALL: X=622 Y=553
|
||||
*/
|
||||
|
||||
// blackosx swapped this around so drawing of selection comes before drawing scrollbar.
|
||||
|
||||
@ -4408,7 +4440,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
* Draw entries for GUI.
|
||||
*/
|
||||
#if USE_XTHEME
|
||||
// move it to class XTheme?
|
||||
|
||||
VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN XPos, INTN YPos)
|
||||
{
|
||||
XImage MainImage(0,0);
|
||||
@ -4416,10 +4448,10 @@ VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN
|
||||
bool NewImageCreated = false;
|
||||
|
||||
if (Entry->Row == 0 && Entry->getDriveImage() && !(ThemeX.HideBadges & HDBADGES_SWAP)) {
|
||||
MainImage.FromEGImage(Entry->getDriveImage());
|
||||
MainImage.FromEGImage(Entry->getDriveImage()); //EG_IMAGE
|
||||
} else {
|
||||
// MainImage.FromEGImage(Entry->Image);
|
||||
MainImage = Entry->Image;
|
||||
MainImage = Entry->Image; //XImage
|
||||
}
|
||||
//this should be inited by the Theme
|
||||
if (MainImage.isEmpty()) {
|
||||
@ -4434,6 +4466,8 @@ VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN
|
||||
NewImageCreated = true;
|
||||
}
|
||||
}
|
||||
INTN CompWidth = (Entry->Row == 0) ? ThemeX.row0TileSize : ThemeX.row1TileSize;
|
||||
INTN CompHeight = CompWidth;
|
||||
// DBG("Entry title=%ls; Width=%d\n", Entry->Title, MainImage->Width);
|
||||
float fScale;
|
||||
if (ThemeX.TypeSVG) {
|
||||
@ -4446,18 +4480,64 @@ VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN
|
||||
BadgeImage.FromEGImage(Entry->getBadgeImage());
|
||||
} //else null
|
||||
|
||||
XImage& TopImage = ThemeX.SelectionImages[((Entry->Row == 0) ? 0 : 2) + (selected ? 0 : 1)];
|
||||
XImage TopImage = ThemeX.SelectionImages[((Entry->Row == 0) ? 0 : 2) + (selected ? 0 : 1)];
|
||||
XImage Back(CompWidth, CompHeight);
|
||||
// Back.GetArea(XPos, YPos, 0, 0); // this is background at this place
|
||||
Back.CopyRect(ThemeX.Background, XPos, YPos);
|
||||
|
||||
INTN OffsetX = (CompWidth - MainImage.GetWidth()) / 2;
|
||||
OffsetX = (OffsetX > 0) ? OffsetX: 0;
|
||||
INTN OffsetY = (CompHeight - MainImage.GetHeight()) / 2;
|
||||
OffsetY = (OffsetY > 0) ? OffsetY: 0;
|
||||
|
||||
if(ThemeX.SelectionOnTop) {
|
||||
MainImage.Draw(XPos, YPos, fScale, false);
|
||||
BadgeImage.Draw(XPos, YPos, fScale, false);
|
||||
TopImage.Draw(XPos, YPos, fScale, false);
|
||||
//place main image in centre. It may be OS or Drive
|
||||
Back.Compose(OffsetX, OffsetY, MainImage, false);
|
||||
} else {
|
||||
TopImage.Draw(XPos, YPos, fScale, false);
|
||||
MainImage.Draw(XPos, YPos, fScale, false);
|
||||
BadgeImage.Draw(XPos, YPos, fScale, false);
|
||||
Back.Compose(0, 0, TopImage, false); //selection first
|
||||
Back.Compose(OffsetX, OffsetY, MainImage, false);
|
||||
}
|
||||
|
||||
// place the badge image
|
||||
if (!BadgeImage.isEmpty() &&
|
||||
((INTN)BadgeImage.GetWidth() + 8) < CompWidth &&
|
||||
((INTN)BadgeImage.GetHeight() + 8) < CompHeight) {
|
||||
|
||||
// Check for user badge x offset from theme.plist
|
||||
if (ThemeX.BadgeOffsetX != 0xFFFF) {
|
||||
// Check if value is between 0 and ( width of the main icon - width of badge )
|
||||
if (ThemeX.BadgeOffsetX < 0 || ThemeX.BadgeOffsetX > (CompWidth - (INTN)BadgeImage.GetWidth())) {
|
||||
DBG("User offset X %lld is out of range\n", ThemeX.BadgeOffsetX);
|
||||
ThemeX.BadgeOffsetX = CompWidth - 8 - BadgeImage.GetWidth();
|
||||
DBG(" corrected to default %lld\n", ThemeX.BadgeOffsetX);
|
||||
}
|
||||
OffsetX += ThemeX.BadgeOffsetX;
|
||||
} else {
|
||||
// Set default position
|
||||
OffsetX += CompWidth - 8 - BadgeImage.GetWidth();
|
||||
}
|
||||
// Check for user badge y offset from theme.plist
|
||||
if (ThemeX.BadgeOffsetY != 0xFFFF) {
|
||||
// Check if value is between 0 and ( height of the main icon - height of badge )
|
||||
if (ThemeX.BadgeOffsetY < 0 || ThemeX.BadgeOffsetY > (CompHeight - (INTN)BadgeImage.GetHeight())) {
|
||||
DBG("User offset Y %lld is out of range\n",ThemeX.BadgeOffsetY);
|
||||
ThemeX.BadgeOffsetY = CompHeight - 8 - BadgeImage.GetHeight();
|
||||
DBG(" corrected to default %lld\n", ThemeX.BadgeOffsetY);
|
||||
}
|
||||
OffsetY += ThemeX.BadgeOffsetY;
|
||||
} else {
|
||||
// Set default position
|
||||
OffsetY += CompHeight - 8 - BadgeImage.GetHeight();
|
||||
}
|
||||
Back.Compose(OffsetX, OffsetY, BadgeImage, false);
|
||||
}
|
||||
|
||||
if(ThemeX.SelectionOnTop) {
|
||||
Back.Compose(0, 0, TopImage, false); //selection at the top
|
||||
}
|
||||
Back.DrawWithoutCompose(XPos, YPos);
|
||||
|
||||
|
||||
// draw BCS indicator
|
||||
// Needy: if Labels (Titles) are hidden there is no point to draw the indicator
|
||||
if (ThemeX.BootCampStyle && !(ThemeX.HideUIFlags & HIDEUI_FLAG_LABEL)) {
|
||||
|
Loading…
Reference in New Issue
Block a user