From 08476b334d91596a4eb96504f0d5304354196ba7 Mon Sep 17 00:00:00 2001 From: ydong10 Date: Mon, 5 Dec 2011 13:20:03 +0000 Subject: 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 --- MdeModulePkg/Universal/SetupBrowserDxe/Ui.c | 50 +++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 10 deletions(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c index ca2ec3b169..01909e4649 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; -- cgit v1.2.3