summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2011-12-05 13:20:03 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2011-12-05 13:20:03 +0000
commit08476b334d91596a4eb96504f0d5304354196ba7 (patch)
tree8124d17c75cc90d304fc7e3ef80db44f24e09f84
parentfebca2e36407e6c7acddb420606d901f28a4b4a9 (diff)
downloadedk2-08476b334d91596a4eb96504f0d5304354196ba7.zip
edk2-08476b334d91596a4eb96504f0d5304354196ba7.tar.gz
edk2-08476b334d91596a4eb96504f0d5304354196ba7.tar.bz2
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
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Ui.c50
1 files changed, 40 insertions, 10 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
index ca2ec3b..01909e4 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
@@ -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.
//
@@ -2590,7 +2601,11 @@ UiDisplayMenu (
if (SavedMenuOption->Row == 0) {
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;
@@ -2598,16 +2613,31 @@ UiDisplayMenu (
if (SavedMenuOption->Row == 0) {
UpdateOptionSkipLines (Selection, SavedMenuOption);
}
- Index += SavedMenuOption->Skip;
+ Index += SavedMenuOption->Skip;
}
-
- SkipValue = Index - BottomRow - 1;
- if (SkipValue > 0 && SkipValue < (INTN) SavedMenuOption->Skip) {
- TopOfScreen = Link;
- OldSkipValue = SkipValue;
+
+ //
+ // 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 {
- SkipValue = 0;
- TopOfScreen = Link->ForwardLink;
+ //
+ // 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;
+ OldSkipValue = SkipValue;
+ } else {
+ SkipValue = 0;
+ TopOfScreen = Link->ForwardLink;
+ }
}
Repaint = TRUE;