Refine the select highlight menu logic.

Signed-off-by: ydong10
Reviewed-by: lgao4

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12818 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2011-12-05 13:20:03 +00:00
parent febca2e364
commit 08476b334d
1 changed files with 40 additions and 10 deletions

View File

@ -2575,7 +2575,18 @@ UiDisplayMenu (
SavedMenuOption = MENU_OPTION_FROM_LINK (Link);
}
if (Link != NewPos || Index > BottomRow || (Link == NewPos && SavedMenuOption->Row + SavedMenuOption->Skip - 1 > BottomRow)) {
//
// Not find the selected menu in current show page.
// Have two case to enter this if:
// 1. Not find the menu at current page.
// 2. Find the menu in current page, but the menu shows at the bottom and not all info shows.
// For case 2, has an exception: The menu can show more than one pages and now only this menu shows.
//
// Base on the selected menu will show at the bottom of the page,
// select the menu which will show at the top of the page.
//
if (Link != NewPos || Index > BottomRow ||
(Link == NewPos && (SavedMenuOption->Row + SavedMenuOption->Skip - 1 > BottomRow) && (Link != TopOfScreen))) {
//
// Find the MenuOption which has the skip value for Date/Time opcode.
//
@ -2591,6 +2602,10 @@ UiDisplayMenu (
UpdateOptionSkipLines (Selection, SavedMenuOption);
}
//
// Base on the selected menu will show at the bottome of next page,
// select the menu show at the top of the next page.
//
Link = NewPos;
for (Index = TopRow + SavedMenuOption->Skip; Index <= BottomRow + 1; ) {
Link = Link->BackLink;
@ -2601,6 +2616,20 @@ UiDisplayMenu (
Index += SavedMenuOption->Skip;
}
//
// Found the menu which will show at the top of the page.
//
if (Link == NewPos) {
//
// The menu can show more than one pages, just show the menu at the top of the page.
//
SkipValue = 0;
TopOfScreen = Link;
OldSkipValue = SkipValue;
} else {
//
// Check whether need to skip some line for menu shows at the top of the page.
//
SkipValue = Index - BottomRow - 1;
if (SkipValue > 0 && SkipValue < (INTN) SavedMenuOption->Skip) {
TopOfScreen = Link;
@ -2609,6 +2638,7 @@ UiDisplayMenu (
SkipValue = 0;
TopOfScreen = Link->ForwardLink;
}
}
Repaint = TRUE;
NewLine = TRUE;