mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-23 11:35:19 +01:00
repair scroll
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
0af69ed7a3
commit
4b1c81b7f9
@ -1083,7 +1083,7 @@ VOID testSVG()
|
||||
#if 1 //test XImage
|
||||
XImage NewX(NewImage);
|
||||
NewX.Draw((UGAWidth - Width) / 2,
|
||||
(UGAHeight - Height) / 2, 1.f);
|
||||
(UGAHeight - Height) / 2);
|
||||
#else
|
||||
BltImageAlpha(NewImage,
|
||||
(UGAWidth - Width) / 2,
|
||||
@ -1132,7 +1132,7 @@ VOID testSVG()
|
||||
// DBG("text ready to blit\n");
|
||||
#if USE_XTHEME
|
||||
TextBufferXY.Draw((UGAWidth - Width) / 2,
|
||||
(UGAHeight - Height) / 2, 1.f);
|
||||
(UGAHeight - Height) / 2);
|
||||
#else
|
||||
BltImageAlpha(TextBufferXY,
|
||||
(UGAWidth - Width) / 2,
|
||||
|
@ -479,10 +479,15 @@ void XImage::DrawWithoutCompose(INTN x, INTN y, UINTN width, UINTN height)
|
||||
|
||||
void XImage::Draw(INTN x, INTN y)
|
||||
{
|
||||
Draw(x, y, 0);
|
||||
Draw(x, y, 0, true);
|
||||
}
|
||||
|
||||
void XImage::Draw(INTN x, INTN y, float scale)
|
||||
{
|
||||
Draw(x, y, scale, true);
|
||||
}
|
||||
|
||||
void XImage::Draw(INTN x, INTN y, float scale, bool Opaque)
|
||||
{
|
||||
//prepare images
|
||||
if (isEmpty()) {
|
||||
@ -492,7 +497,7 @@ void XImage::Draw(INTN x, INTN y, float scale)
|
||||
XImage Top(*this, scale); //can accept 0 as scale
|
||||
XImage Background(Width, Height);
|
||||
Background.GetArea(x, y, Width, Height);
|
||||
Background.Compose(0, 0, Top, true);
|
||||
Background.Compose(0, 0, Top, Opaque);
|
||||
UINTN AreaWidth = (x + Width > (UINTN)UGAWidth) ? (UGAWidth - x) : Width;
|
||||
UINTN AreaHeight = (y + Height > (UINTN)UGAHeight) ? (UGAHeight - y) : Height;
|
||||
|
||||
|
@ -94,13 +94,14 @@ public:
|
||||
EG_IMAGE* ToEGImage();
|
||||
void GetArea(const EG_RECT& Rect);
|
||||
void GetArea(INTN x, INTN y, UINTN W, UINTN H);
|
||||
void Draw(INTN x, INTN y, float scale, bool Opaque);
|
||||
void Draw(INTN x, INTN y, float scale); //can accept 0 scale as 1.f
|
||||
void Draw(INTN x, INTN y);
|
||||
void DrawWithoutCompose(INTN x, INTN y, UINTN width = 0, UINTN height = 0);
|
||||
//I changed the name because LoadImage is too widely used
|
||||
// will be used instead of old egLoadImage
|
||||
EFI_STATUS LoadXImage(EFI_FILE *Dir, const XStringW& FileName); //for example LoadImage(ThemeDir, L"icons\\" + Name);
|
||||
EFI_STATUS LoadXImage(EFI_FILE *BaseDir, const char* IconName);
|
||||
EFI_STATUS LoadXImage(EFI_FILE *Dir, const char* IconName);
|
||||
void EnsureImageSize(IN UINTN Width, IN UINTN Height, IN CONST EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color);
|
||||
void DummyImage(IN UINTN PixelSize);
|
||||
|
||||
|
@ -95,7 +95,8 @@ EFI_STATUS XPointer::MouseBirth()
|
||||
oldPlace.YPos = (INTN)(UGAHeight >> 2);
|
||||
oldPlace.Width = PointerImage->GetWidth();
|
||||
oldPlace.Height = PointerImage->GetHeight();
|
||||
CopyMem(&newPlace, &oldPlace, sizeof(EG_RECT));
|
||||
// CopyMem(&newPlace, &oldPlace, sizeof(EG_RECT));
|
||||
newPlace = oldPlace;
|
||||
Draw();
|
||||
MouseEvent = NoEvents;
|
||||
Alive = true;
|
||||
@ -108,7 +109,7 @@ VOID XPointer::Draw()
|
||||
// CopyMem(&oldPlace, &newPlace, sizeof(EG_RECT)); //can we use oldPlace = newPlace; ?
|
||||
// take background image for later to restore background
|
||||
oldImage.GetArea(newPlace);
|
||||
PointerImage->Draw(newPlace.XPos, newPlace.YPos, 0.f); //zero means no scale
|
||||
PointerImage->Draw(newPlace.XPos, newPlace.YPos); //zero means no scale
|
||||
}
|
||||
|
||||
VOID XPointer::KillMouse()
|
||||
@ -217,14 +218,14 @@ EFI_STATUS XPointer::CheckMouseEvent(REFIT_MENU_SCREEN *Screen)
|
||||
Screen->mAction = ActionScrollDown;
|
||||
else if (MouseInRect(&Scrollbar) && MouseEvent == LeftMouseDown) {
|
||||
IsDragging = TRUE;
|
||||
Screen->mAction = ActionMoveScrollbar;
|
||||
// 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;
|
||||
// Screen->mAction = ActionMoveScrollbar;
|
||||
}
|
||||
else if (IsDragging && MouseEvent == MouseMove) {
|
||||
Screen->mAction = ActionMoveScrollbar;
|
||||
@ -245,57 +246,57 @@ EFI_STATUS XPointer::CheckMouseEvent(REFIT_MENU_SCREEN *Screen)
|
||||
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) {
|
||||
case LeftClick:
|
||||
Screen->mAction = Screen->Entries[EntryId].AtClick;
|
||||
// DBG("Click\n");
|
||||
break;
|
||||
case RightClick:
|
||||
Screen->mAction = Screen->Entries[EntryId].AtRightClick;
|
||||
break;
|
||||
case DoubleClick:
|
||||
Screen->mAction = Screen->Entries[EntryId].AtDoubleClick;
|
||||
break;
|
||||
case ScrollDown:
|
||||
Screen->mAction = ActionScrollDown;
|
||||
break;
|
||||
case ScrollUp:
|
||||
Screen->mAction = ActionScrollUp;
|
||||
break;
|
||||
case MouseMove:
|
||||
Screen->mAction = Screen->Entries[EntryId].AtMouseOver;
|
||||
//how to do the action once?
|
||||
break;
|
||||
default:
|
||||
Screen->mAction = ActionNone;
|
||||
else {
|
||||
for (UINTN EntryId = 0; EntryId < Screen->Entries.size(); EntryId++) {
|
||||
if (MouseInRect(&(Screen->Entries[EntryId].Place))) {
|
||||
switch (MouseEvent) {
|
||||
case LeftClick:
|
||||
Screen->mAction = Screen->Entries[EntryId].AtClick;
|
||||
// DBG("Click\n");
|
||||
break;
|
||||
case RightClick:
|
||||
Screen->mAction = Screen->Entries[EntryId].AtRightClick;
|
||||
break;
|
||||
case DoubleClick:
|
||||
Screen->mAction = Screen->Entries[EntryId].AtDoubleClick;
|
||||
break;
|
||||
case ScrollDown:
|
||||
Screen->mAction = ActionScrollDown;
|
||||
break;
|
||||
case ScrollUp:
|
||||
Screen->mAction = ActionScrollUp;
|
||||
break;
|
||||
case MouseMove:
|
||||
Screen->mAction = Screen->Entries[EntryId].AtMouseOver;
|
||||
//how to do the action once?
|
||||
break;
|
||||
default:
|
||||
Screen->mAction = ActionNone;
|
||||
break;
|
||||
}
|
||||
Screen->mItemID = EntryId;
|
||||
break;
|
||||
}
|
||||
Screen->mItemID = EntryId;
|
||||
break;
|
||||
}
|
||||
else { //click in milk
|
||||
switch (MouseEvent) {
|
||||
case LeftClick:
|
||||
Screen->mAction = ActionDeselect;
|
||||
break;
|
||||
case RightClick:
|
||||
Screen->mAction = ActionFinish;
|
||||
break;
|
||||
case ScrollDown:
|
||||
Screen->mAction = ActionScrollDown;
|
||||
break;
|
||||
case ScrollUp:
|
||||
Screen->mAction = ActionScrollUp;
|
||||
break;
|
||||
default:
|
||||
Screen->mAction = ActionNone;
|
||||
break;
|
||||
else { //click in milk
|
||||
switch (MouseEvent) {
|
||||
case LeftClick:
|
||||
Screen->mAction = ActionDeselect;
|
||||
break;
|
||||
case RightClick:
|
||||
Screen->mAction = ActionFinish;
|
||||
break;
|
||||
case ScrollDown:
|
||||
Screen->mAction = ActionScrollDown;
|
||||
break;
|
||||
case ScrollUp:
|
||||
Screen->mAction = ActionScrollUp;
|
||||
break;
|
||||
default:
|
||||
Screen->mAction = ActionNone;
|
||||
break;
|
||||
}
|
||||
Screen->mItemID = 0xFFFF;
|
||||
}
|
||||
Screen->mItemID = 0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ void XTheme::ClearScreen() //and restore background and banner
|
||||
break;
|
||||
}
|
||||
}
|
||||
Background.Draw(0, 0, 1.f);
|
||||
Background.Draw(0, 0);
|
||||
//then draw banner
|
||||
if (!Banner.isEmpty()) {
|
||||
Banner.Draw(BannerPlace.XPos, BannerPlace.YPos, Scale);
|
||||
|
@ -3158,7 +3158,7 @@ INTN DrawTextXY(IN XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign)
|
||||
// DBG("pos=%d width=%d xtext=%d Height=%d Y=%d\n", XPos, TextWidth, XText, Height, YPos);
|
||||
// BltImageAlpha(TextBufferXY, XText, YPos, &MenuBackgroundPixel, 16);
|
||||
// egFreeImage(TextBufferXY);
|
||||
TextBufferXY.Draw(XText, YPos, 1.f);
|
||||
TextBufferXY.Draw(XText, YPos);
|
||||
return TextWidth;
|
||||
}
|
||||
#else
|
||||
@ -3686,7 +3686,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
INTN FilmXPos = (INTN)(EntriesPosX - (TitleImage.GetWidth() + (int)(TITLEICON_SPACING * ThemeX.Scale)));
|
||||
INTN FilmYPos = (INTN)EntriesPosY;
|
||||
// BltImageAlpha(TitleImage, FilmXPos, FilmYPos, &MenuBackgroundPixel, 16);
|
||||
TitleImage.Draw(FilmXPos, FilmYPos, 1.f);
|
||||
TitleImage.Draw(FilmXPos, FilmYPos);
|
||||
|
||||
// update FilmPlace only if not set by InitAnime
|
||||
if (FilmPlace.Width == 0 || FilmPlace.Height == 0) {
|
||||
@ -3754,7 +3754,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0,
|
||||
ctrlTextX,
|
||||
Entry->Place.YPos, 0xFFFF);
|
||||
ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->BValue)?3:2].Draw(ctrlX, ctrlY, 1.f);
|
||||
ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->BValue)?3:2].Draw(ctrlX, ctrlY);
|
||||
|
||||
// DBG("X=%d, Y=%d, ImageY=%d\n", EntriesPosX + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale),
|
||||
// Entry->Place.YPos, Entry->Place.YPos + PlaceCentre);
|
||||
@ -3774,7 +3774,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0,
|
||||
ctrlTextX,
|
||||
Entry->Place.YPos, 0xFFFF);
|
||||
ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->IValue & Entry->Row)?3:2].Draw(ctrlX, ctrlY, 1.f);
|
||||
ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->IValue & Entry->Row)?3:2].Draw(ctrlX, ctrlY);
|
||||
} else if (Entry->getREFIT_MENU_SWITCH()) {
|
||||
if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 3) {
|
||||
//OldChosenItem = OldChosenTheme;
|
||||
@ -3792,7 +3792,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
// clovy EntriesPosX + (TextHeight + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale)),
|
||||
ctrlTextX,
|
||||
Entry->Place.YPos, 0xFFFF);
|
||||
ThemeX.Buttons[(Entry->Row == OldChosenItem)?1:0].Draw(ctrlX, ctrlY, 1.f);
|
||||
ThemeX.Buttons[(Entry->Row == OldChosenItem)?1:0].Draw(ctrlX, ctrlY);
|
||||
} else {
|
||||
//DBG("paint entry %d title=%s\n", i, Entries[i]->Title);
|
||||
DrawMenuText(ResultString,
|
||||
@ -3834,7 +3834,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
DrawMenuText(ResultString, 0,
|
||||
ctrlTextX,
|
||||
EntryL->Place.YPos, 0xFFFF);
|
||||
ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].Draw(ctrlX, EntryL->Place.YPos + PlaceCentre, 1.f);
|
||||
ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].Draw(ctrlX, EntryL->Place.YPos + PlaceCentre);
|
||||
// DBG("se:X=%d, Y=%d, ImageY=%d\n", EntriesPosX + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale),
|
||||
// EntryL->Place.YPos, EntryL->Place.YPos + PlaceCentre);
|
||||
} else {
|
||||
@ -3860,12 +3860,12 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
// clovy
|
||||
DrawMenuText(ResultString, 0, ctrlTextX,
|
||||
EntriesPosY + (ScrollState.LastSelection - ScrollState.FirstVisible) * TextHeight, 0xFFFF);
|
||||
ThemeX.Buttons[(EntryL->Row == OldChosenItem)?3:2].Draw(ctrlX, EntryL->Place.YPos + PlaceCentre1, 1.f);
|
||||
ThemeX.Buttons[(EntryL->Row == OldChosenItem)?3:2].Draw(ctrlX, EntryL->Place.YPos + PlaceCentre1);
|
||||
} else if (EntryL->getREFIT_MENU_CHECKBIT()) {
|
||||
// clovy
|
||||
DrawMenuText(ResultString, 0, ctrlTextX,
|
||||
EntryL->Place.YPos, 0xFFFF);
|
||||
ThemeX.Buttons[(EntryL->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryL->Row) ?3:2].Draw(ctrlX, EntryL->Place.YPos + PlaceCentre, 1.f);
|
||||
ThemeX.Buttons[(EntryL->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryL->Row) ?3:2].Draw(ctrlX, EntryL->Place.YPos + PlaceCentre);
|
||||
|
||||
// DBG("ce:X=%d, Y=%d, ImageY=%d\n", EntriesPosX + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale),
|
||||
// EntryL->Place.YPos, EntryL->Place.YPos + PlaceCentre);
|
||||
@ -3895,7 +3895,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
DrawMenuText(ResultString, MenuWidth,
|
||||
ctrlTextX,
|
||||
inputDialogEntry->Place.YPos, 0xFFFF);
|
||||
ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].Draw(ctrlX, inputDialogEntry->Place.YPos + PlaceCentre, 1.f);
|
||||
ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].Draw(ctrlX, inputDialogEntry->Place.YPos + PlaceCentre);
|
||||
} else {
|
||||
StrCatS(ResultString, TITLE_MAX_LEN, inputDialogEntry->Item->SValue +
|
||||
inputDialogEntry->Item->LineShift);
|
||||
@ -3910,12 +3910,12 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
ctrlTextX,
|
||||
EntriesPosY + (ScrollState.CurrentSelection - ScrollState.FirstVisible) * TextHeight,
|
||||
0xFFFF);
|
||||
ThemeX.Buttons[(EntryC->Row == OldChosenItem)?1:0].Draw(ctrlX, EntryC->Place.YPos + PlaceCentre1, 1.f);
|
||||
ThemeX.Buttons[(EntryC->Row == OldChosenItem)?1:0].Draw(ctrlX, EntryC->Place.YPos + PlaceCentre1);
|
||||
} else if (EntryC->getREFIT_MENU_CHECKBIT()) {
|
||||
DrawMenuText(ResultString, MenuWidth,
|
||||
ctrlTextX,
|
||||
EntryC->Place.YPos, 0xFFFF);
|
||||
ThemeX.Buttons[(EntryC->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryC->Row)?3:2].Draw(ctrlX, EntryC->Place.YPos + PlaceCentre, 1.f);
|
||||
ThemeX.Buttons[(EntryC->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryC->Row)?3:2].Draw(ctrlX, EntryC->Place.YPos + PlaceCentre);
|
||||
}else{
|
||||
DrawMenuText(EntryC->Title, MenuWidth, EntriesPosX,
|
||||
EntriesPosY + (ScrollState.CurrentSelection - ScrollState.FirstVisible) * TextHeight,
|
||||
|
Loading…
Reference in New Issue
Block a user