Refine the menu display logic, support menus with more than one page of options.

Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14072 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2013-01-22 06:08:24 +00:00
parent ffc6107d40
commit ed729be159
1 changed files with 185 additions and 80 deletions

View File

@ -1507,36 +1507,34 @@ UpdateOptionSkipLines (
Row = 0; Row = 0;
OptionString = NULL; OptionString = NULL;
Width = (UINT16) gOptionBlockWidth;
OriginalRow = 0;
GlyphWidth = 1;
ProcessOptions (Selection, MenuOption, FALSE, &OptionString); ProcessOptions (Selection, MenuOption, FALSE, &OptionString);
if (OptionString == NULL) {
return;
}
if (OptionString != NULL) { for (Index = 0; GetLineByWidth (OptionString, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
Width = (UINT16) gOptionBlockWidth; //
// If there is more string to process print on the next row and increment the Skip value
OriginalRow = Row; //
GlyphWidth = 1; if (StrLen (&OptionString[Index]) != 0) {
Row++;
for (Index = 0; GetLineByWidth (OptionString, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
// //
// If there is more string to process print on the next row and increment the Skip value // Since the Number of lines for this menu entry may or may not be reflected accurately
// since the prompt might be 1 lines and option might be many, and vice versa, we need to do
// some testing to ensure we are keeping this in-sync.
// //
if (StrLen (&OptionString[Index]) != 0) { // If the difference in rows is greater than or equal to the skip value, increase the skip value
Row++; //
// if ((Row - OriginalRow) >= MenuOption->Skip) {
// Since the Number of lines for this menu entry may or may not be reflected accurately MenuOption->Skip++;
// since the prompt might be 1 lines and option might be many, and vice versa, we need to do
// some testing to ensure we are keeping this in-sync.
//
// If the difference in rows is greater than or equal to the skip value, increase the skip value
//
if ((Row - OriginalRow) >= MenuOption->Skip) {
MenuOption->Skip++;
}
} }
FreePool (OutputString);
} }
Row = OriginalRow; FreePool (OutputString);
} }
if (OptionString != NULL) { if (OptionString != NULL) {
@ -1612,6 +1610,10 @@ ValueIsScroll (
@return The row distance from current MenuOption to next selectable MenuOption. @return The row distance from current MenuOption to next selectable MenuOption.
@retval -1 Reach the begin of the menu, still can't find the selectable menu.
@retval Value Find the selectable menu, maybe the truly selectable, maybe the l
last menu showing at current form.
**/ **/
INTN INTN
MoveToNextStatement ( MoveToNextStatement (
@ -1632,41 +1634,56 @@ MoveToNextStatement (
while (TRUE) { while (TRUE) {
NextMenuOption = MENU_OPTION_FROM_LINK (Pos); NextMenuOption = MENU_OPTION_FROM_LINK (Pos);
//
// NextMenuOption->Row == 0 means this menu has not calculate
// the NextMenuOption->Skip value yet, just calculate here.
//
if (NextMenuOption->Row == 0) { if (NextMenuOption->Row == 0) {
UpdateOptionSkipLines (Selection, NextMenuOption); UpdateOptionSkipLines (Selection, NextMenuOption);
} }
if (GoUp && (PreMenuOption != NextMenuOption)) { if (GoUp && (PreMenuOption != NextMenuOption)) {
// //
// Current Position doesn't need to be caculated when go up. // In this case, still can't find the selectable menu,
// Caculate distanct at first when go up // return the last one in the showing form.
// //
if ((UINTN) Distance + NextMenuOption->Skip > GapToTop) { if ((UINTN) Distance + NextMenuOption->Skip > GapToTop) {
NextMenuOption = PreMenuOption; NextMenuOption = PreMenuOption;
break; break;
} }
//
// Current Position doesn't need to be caculated when go up.
// Caculate distanct at first when go up
//
Distance += NextMenuOption->Skip; Distance += NextMenuOption->Skip;
} }
if (IsSelectable (NextMenuOption)) { if (IsSelectable (NextMenuOption)) {
break; break;
} }
//
// Arrive at begin of the menu list.
//
if ((GoUp ? Pos->BackLink : Pos->ForwardLink) == &gMenuOption) { if ((GoUp ? Pos->BackLink : Pos->ForwardLink) == &gMenuOption) {
//
// Arrive at top.
//
Distance = -1; Distance = -1;
break; break;
} }
if (!GoUp) { if (!GoUp) {
// //
// Caculate distanct at later when go down // In this case, still can't find the selectable menu,
// return the last one in the showing form.
// //
if ((UINTN) Distance + NextMenuOption->Skip > GapToTop) { if ((UINTN) Distance + NextMenuOption->Skip > GapToTop) {
NextMenuOption = PreMenuOption; NextMenuOption = PreMenuOption;
break; break;
} }
Distance += NextMenuOption->Skip; Distance += NextMenuOption->Skip;
} }
PreMenuOption = NextMenuOption; PreMenuOption = NextMenuOption;
Pos = (GoUp ? Pos->BackLink : Pos->ForwardLink); Pos = (GoUp ? Pos->BackLink : Pos->ForwardLink);
} }
@ -2173,7 +2190,6 @@ UiDisplayMenu (
{ {
INTN SkipValue; INTN SkipValue;
INTN Difference; INTN Difference;
INTN OldSkipValue;
UINTN DistanceValue; UINTN DistanceValue;
UINTN Row; UINTN Row;
UINTN Col; UINTN Col;
@ -2254,7 +2270,6 @@ UiDisplayMenu (
UpArrow = FALSE; UpArrow = FALSE;
DownArrow = FALSE; DownArrow = FALSE;
SkipValue = 0; SkipValue = 0;
OldSkipValue = 0;
MenuRefreshEntry = gMenuRefreshHead; MenuRefreshEntry = gMenuRefreshHead;
NextMenuOption = NULL; NextMenuOption = NULL;
@ -2355,6 +2370,9 @@ UiDisplayMenu (
Temp = (UINTN) SkipValue; Temp = (UINTN) SkipValue;
Temp2 = (UINTN) SkipValue; Temp2 = (UINTN) SkipValue;
//
// 1. Clear the screen.
//
if (Selection->Form->ModalForm) { if (Selection->Form->ModalForm) {
ClearLines ( ClearLines (
LocalScreen.LeftColumn + ModalSkipColumn, LocalScreen.LeftColumn + ModalSkipColumn,
@ -2375,6 +2393,9 @@ UiDisplayMenu (
UiFreeRefreshList (); UiFreeRefreshList ();
MinRefreshInterval = 0; MinRefreshInterval = 0;
//
// 2.Paint the menu.
//
for (Link = TopOfScreen; Link != &gMenuOption; Link = Link->ForwardLink) { for (Link = TopOfScreen; Link != &gMenuOption; Link = Link->ForwardLink) {
MenuOption = MENU_OPTION_FROM_LINK (Link); MenuOption = MENU_OPTION_FROM_LINK (Link);
MenuOption->Row = Row; MenuOption->Row = Row;
@ -2414,7 +2435,13 @@ UiDisplayMenu (
); );
} }
//
// 2.1. Paint the description.
//
for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) { for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
//
// Temp means need to skip how many lines from the start.
//
if ((Temp == 0) && (Row <= BottomRow)) { if ((Temp == 0) && (Row <= BottomRow)) {
PrintStringAt (MenuOption->Col, Row, OutputString); PrintStringAt (MenuOption->Col, Row, OutputString);
} }
@ -2436,6 +2463,9 @@ UiDisplayMenu (
Temp = 0; Temp = 0;
Row = OriginalRow; Row = OriginalRow;
//
// 2.2. Paint the option string.
//
Status = ProcessOptions (Selection, MenuOption, FALSE, &OptionString); Status = ProcessOptions (Selection, MenuOption, FALSE, &OptionString);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
// //
@ -2492,7 +2522,7 @@ UiDisplayMenu (
} }
// //
// If Question has refresh guid, register the op-code. // 2.4 Special process for Test opcode with test two.
// //
if (!CompareGuid (&Statement->RefreshGuid, &gZeroGuid)) { if (!CompareGuid (&Statement->RefreshGuid, &gZeroGuid)) {
if (gMenuEventGuidRefreshHead == NULL) { if (gMenuEventGuidRefreshHead == NULL) {
@ -2600,11 +2630,10 @@ UiDisplayMenu (
gST->ConOut->SetAttribute (gST->ConOut, PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND); gST->ConOut->SetAttribute (gST->ConOut, PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND);
// //
// Need to handle the bottom of the display // 3. Update the row info which will be used by next menu.
// //
if (MenuOption->Skip > 1) { if (Link == TopOfScreen) {
Row += MenuOption->Skip - SkipValue; Row += MenuOption->Skip - SkipValue;
SkipValue = 0;
} else { } else {
Row += MenuOption->Skip; Row += MenuOption->Skip;
} }
@ -2656,6 +2685,16 @@ UiDisplayMenu (
// NewPos: Current menu option that need to hilight // NewPos: Current menu option that need to hilight
// //
ControlFlag = CfUpdateHelpString; ControlFlag = CfUpdateHelpString;
if (TopOfScreen == &MenuOption->Link) {
Temp = SkipValue;
} else {
Temp = 0;
}
if (NewPos == TopOfScreen) {
Temp2 = SkipValue;
} else {
Temp2 = 0;
}
if (InitializedFlag) { if (InitializedFlag) {
InitializedFlag = FALSE; InitializedFlag = FALSE;
MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow); MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow);
@ -2688,7 +2727,7 @@ UiDisplayMenu (
SavedMenuOption = MENU_OPTION_FROM_LINK (Link); SavedMenuOption = MENU_OPTION_FROM_LINK (Link);
Index += SavedMenuOption->Skip; Index += SavedMenuOption->Skip;
if (Link == TopOfScreen) { if (Link == TopOfScreen) {
Index -= OldSkipValue; Index -= SkipValue;
} }
Link = Link->ForwardLink; Link = Link->ForwardLink;
} }
@ -2746,7 +2785,6 @@ UiDisplayMenu (
// //
SkipValue = 0; SkipValue = 0;
TopOfScreen = Link; TopOfScreen = Link;
OldSkipValue = SkipValue;
} else { } else {
// //
// Check whether need to skip some line for menu shows at the top of the page. // Check whether need to skip some line for menu shows at the top of the page.
@ -2754,7 +2792,6 @@ UiDisplayMenu (
SkipValue = Index - BottomRow - 1; SkipValue = Index - BottomRow - 1;
if (SkipValue > 0 && SkipValue < (INTN) SavedMenuOption->Skip) { if (SkipValue > 0 && SkipValue < (INTN) SavedMenuOption->Skip) {
TopOfScreen = Link; TopOfScreen = Link;
OldSkipValue = SkipValue;
} else { } else {
SkipValue = 0; SkipValue = 0;
TopOfScreen = Link->ForwardLink; TopOfScreen = Link->ForwardLink;
@ -2796,17 +2833,22 @@ UiDisplayMenu (
GlyphWidth = 1; GlyphWidth = 1;
for (Index = 0; GetLineByWidth (OptionString, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) { for (Index = 0; GetLineByWidth (OptionString, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
if (MenuOption->Row >= TopRow && MenuOption->Row <= BottomRow) { if ((Temp == 0) && (MenuOption->Row >= TopRow) && (MenuOption->Row <= BottomRow)) {
PrintStringAt (MenuOption->OptCol, MenuOption->Row, OutputString); PrintStringAt (MenuOption->OptCol, MenuOption->Row, OutputString);
} }
// //
// If there is more string to process print on the next row and increment the Skip value // If there is more string to process print on the next row and increment the Skip value
// //
if (StrLen (&OptionString[Index]) != 0) { if (StrLen (&OptionString[Index]) != 0) {
MenuOption->Row++; if (Temp == 0) {
MenuOption->Row++;
}
} }
FreePool (OutputString); FreePool (OutputString);
if (Temp != 0) {
Temp--;
}
} }
MenuOption->Row = OriginalRow; MenuOption->Row = OriginalRow;
@ -2825,17 +2867,22 @@ UiDisplayMenu (
GlyphWidth = 1; GlyphWidth = 1;
for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) { for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
if (MenuOption->Row >= TopRow && MenuOption->Row <= BottomRow) { if ((Temp == 0) && (MenuOption->Row >= TopRow) && (MenuOption->Row <= BottomRow)) {
PrintStringAt (MenuOption->Col, MenuOption->Row, OutputString); PrintStringAt (MenuOption->Col, MenuOption->Row, OutputString);
} }
// //
// If there is more string to process print on the next row and increment the Skip value // If there is more string to process print on the next row and increment the Skip value
// //
if (StrLen (&MenuOption->Description[Index]) != 0) { if (StrLen (&MenuOption->Description[Index]) != 0) {
MenuOption->Row++; if (Temp == 0) {
MenuOption->Row++;
}
} }
FreePool (OutputString); FreePool (OutputString);
if (Temp != 0) {
Temp--;
}
} }
MenuOption->Row = OriginalRow; MenuOption->Row = OriginalRow;
@ -2897,17 +2944,22 @@ UiDisplayMenu (
GlyphWidth = 1; GlyphWidth = 1;
for (Index = 0; GetLineByWidth (OptionString, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) { for (Index = 0; GetLineByWidth (OptionString, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
if (MenuOption->Row >= TopRow && MenuOption->Row <= BottomRow) { if ((Temp2 == 0) && (MenuOption->Row >= TopRow) && (MenuOption->Row <= BottomRow) ) {
PrintStringAt (MenuOption->OptCol, MenuOption->Row, OutputString); PrintStringAt (MenuOption->OptCol, MenuOption->Row, OutputString);
} }
// //
// If there is more string to process print on the next row and increment the Skip value // If there is more string to process print on the next row and increment the Skip value
// //
if (StrLen (&OptionString[Index]) != 0) { if (StrLen (&OptionString[Index]) != 0) {
if (Temp2 == 0) {
MenuOption->Row++; MenuOption->Row++;
}
} }
FreePool (OutputString); FreePool (OutputString);
if (Temp2 != 0) {
Temp2--;
}
} }
MenuOption->Row = OriginalRow; MenuOption->Row = OriginalRow;
@ -2921,17 +2973,22 @@ UiDisplayMenu (
GlyphWidth = 1; GlyphWidth = 1;
for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) { for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {
if (MenuOption->Row >= TopRow && MenuOption->Row <= BottomRow) { if ((Temp2 == 0) && (MenuOption->Row >= TopRow) && (MenuOption->Row <= BottomRow) ) {
PrintStringAt (MenuOption->Col, MenuOption->Row, OutputString); PrintStringAt (MenuOption->Col, MenuOption->Row, OutputString);
} }
// //
// If there is more string to process print on the next row and increment the Skip value // If there is more string to process print on the next row and increment the Skip value
// //
if (StrLen (&MenuOption->Description[Index]) != 0) { if (StrLen (&MenuOption->Description[Index]) != 0) {
MenuOption->Row++; if (Temp2 == 0) {
MenuOption->Row++;
}
} }
FreePool (OutputString); FreePool (OutputString);
if (Temp2 != 0) {
Temp2--;
}
} }
MenuOption->Row = OriginalRow; MenuOption->Row = OriginalRow;
@ -3446,7 +3503,6 @@ UiDisplayMenu (
TopOfScreen = NewPos; TopOfScreen = NewPos;
Repaint = TRUE; Repaint = TRUE;
SkipValue = 0; SkipValue = 0;
OldSkipValue = 0;
} else if (!IsSelectable (NextMenuOption)) { } else if (!IsSelectable (NextMenuOption)) {
// //
// Continue to go up until scroll to next page or the selectable option is found. // Continue to go up until scroll to next page or the selectable option is found.
@ -3475,9 +3531,15 @@ UiDisplayMenu (
break; break;
case CfUiPageUp: case CfUiPageUp:
//
// SkipValue means lines is skipped when show the top menu option.
//
ControlFlag = CfCheckSelection; ControlFlag = CfCheckSelection;
ASSERT(NewPos != NULL); ASSERT(NewPos != NULL);
//
// Already at the first menu option, so do nothing.
//
if (NewPos->BackLink == &gMenuOption) { if (NewPos->BackLink == &gMenuOption) {
NewLine = FALSE; NewLine = FALSE;
Repaint = FALSE; Repaint = FALSE;
@ -3486,8 +3548,22 @@ UiDisplayMenu (
NewLine = TRUE; NewLine = TRUE;
Repaint = TRUE; Repaint = TRUE;
//
// SkipValue > (BottomRow - TopRow + 1) means current menu has more than one
// form of options to be show, so just update the SkipValue to show the next
// parts of options.
//
if (SkipValue > (INTN) (BottomRow - TopRow + 1)) {
SkipValue -= BottomRow - TopRow + 1;
break;
}
Link = TopOfScreen; Link = TopOfScreen;
Index = BottomRow; //
// First minus the menu of the top screen, it's value is SkipValue.
//
Index = (BottomRow + 1) - SkipValue;
while ((Index >= TopRow) && (Link->BackLink != &gMenuOption)) { while ((Index >= TopRow) && (Link->BackLink != &gMenuOption)) {
Link = Link->BackLink; Link = Link->BackLink;
PreviousMenuOption = MENU_OPTION_FROM_LINK (Link); PreviousMenuOption = MENU_OPTION_FROM_LINK (Link);
@ -3495,13 +3571,13 @@ UiDisplayMenu (
UpdateOptionSkipLines (Selection, PreviousMenuOption); UpdateOptionSkipLines (Selection, PreviousMenuOption);
} }
if (Index < PreviousMenuOption->Skip) { if (Index < PreviousMenuOption->Skip) {
Index = 0;
break; break;
} }
Index = Index - PreviousMenuOption->Skip; Index = Index - PreviousMenuOption->Skip;
} }
if ((Link->BackLink == &gMenuOption) && (Index >= TopRow)) { if ((Link->BackLink == &gMenuOption) && (Index >= TopRow)) {
SkipValue = 0;
if (TopOfScreen == &gMenuOption) { if (TopOfScreen == &gMenuOption) {
TopOfScreen = gMenuOption.ForwardLink; TopOfScreen = gMenuOption.ForwardLink;
NewPos = gMenuOption.BackLink; NewPos = gMenuOption.BackLink;
@ -3520,10 +3596,13 @@ UiDisplayMenu (
MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow); MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow);
} }
} else { } else {
if (Index + 1 < TopRow) { if (Index >= TopRow) {
// //
// Back up the previous option. // At here, only case "Index < PreviousMenuOption->Skip" can reach here.
// //
SkipValue = PreviousMenuOption->Skip - (Index - TopRow);
} else {
SkipValue = PreviousMenuOption->Skip - (TopRow - Index);
Link = Link->ForwardLink; Link = Link->ForwardLink;
} }
@ -3554,6 +3633,9 @@ UiDisplayMenu (
break; break;
case CfUiPageDown: case CfUiPageDown:
//
// SkipValue means lines is skipped when show the top menu option.
//
ControlFlag = CfCheckSelection; ControlFlag = CfCheckSelection;
ASSERT (NewPos != NULL); ASSERT (NewPos != NULL);
@ -3567,47 +3649,62 @@ UiDisplayMenu (
Repaint = TRUE; Repaint = TRUE;
Link = TopOfScreen; Link = TopOfScreen;
NextMenuOption = MENU_OPTION_FROM_LINK (Link); NextMenuOption = MENU_OPTION_FROM_LINK (Link);
Index = TopRow; Index = TopRow + NextMenuOption->Skip - SkipValue;
while ((Index <= BottomRow) && (Link->ForwardLink != &gMenuOption)) { //
Index = Index + NextMenuOption->Skip; // Count to the menu option which will show at the top of the next form.
//
while ((Index <= BottomRow + 1) && (Link->ForwardLink != &gMenuOption)) {
Link = Link->ForwardLink; Link = Link->ForwardLink;
NextMenuOption = MENU_OPTION_FROM_LINK (Link); NextMenuOption = MENU_OPTION_FROM_LINK (Link);
Index = Index + NextMenuOption->Skip;
} }
if ((Link->ForwardLink == &gMenuOption) && (Index <= BottomRow)) { if ((Link->ForwardLink == &gMenuOption) && (Index <= BottomRow + 1)) {
// //
// Finally we know that NewPos is the last MenuOption can be focused. // Finally we know that NewPos is the last MenuOption can be focused.
// //
Repaint = FALSE; Repaint = FALSE;
MoveToNextStatement (Selection, TRUE, &Link, Index - TopRow); MoveToNextStatement (Selection, TRUE, &Link, Index - TopRow);
SkipValue = 0;
} else { } else {
if (Index - 1 > BottomRow) { //
// Calculate the skip line for top of screen menu.
//
if (Link == TopOfScreen) {
// //
// Back up the previous option. // The top of screen menu option occupies the entire form.
// //
Link = Link->BackLink; SkipValue += BottomRow - TopRow + 1;
} else {
SkipValue = NextMenuOption->Skip - (Index - (BottomRow + 1));
} }
//
// There are more MenuOption needing scrolling down.
//
TopOfScreen = Link; TopOfScreen = Link;
MenuOption = NULL; MenuOption = NULL;
// //
// Move to the option in Next page. // Move to the Next selectable menu.
// //
MoveToNextStatement (Selection, FALSE, &Link, BottomRow - TopRow); MoveToNextStatement (Selection, FALSE, &Link, BottomRow - TopRow);
} }
//
// Save the menu as the next highlight menu.
//
NewPos = Link;
// //
// If we encounter a Date/Time op-code set, rewind to the first op-code of the set. // If we encounter a Date/Time op-code set, rewind to the first op-code of the set.
// Don't do this when we are already in the last page. // Don't do this when we are already in the last page.
// //
NewPos = Link;
AdjustDateAndTimePosition (TRUE, &TopOfScreen); AdjustDateAndTimePosition (TRUE, &TopOfScreen);
AdjustDateAndTimePosition (TRUE, &NewPos); AdjustDateAndTimePosition (TRUE, &NewPos);
break; break;
case CfUiDown: case CfUiDown:
//
// SkipValue means lines is skipped when show the top menu option.
// NewPos points to the menu which is highlighted now.
//
ControlFlag = CfCheckSelection; ControlFlag = CfCheckSelection;
// //
// Since the behavior of hitting the down arrow on a Date/Time op-code is intended // Since the behavior of hitting the down arrow on a Date/Time op-code is intended
@ -3626,8 +3723,14 @@ UiDisplayMenu (
NewPos = NewPos->ForwardLink; NewPos = NewPos->ForwardLink;
Difference = 0; Difference = 0;
//
// Current menu not at the bottom of the form.
//
if (BottomRow >= MenuOption->Row + MenuOption->Skip) { if (BottomRow >= MenuOption->Row + MenuOption->Skip) {
Difference = MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - MenuOption->Row - MenuOption->Skip); //
// Find the next selectable menu.
//
Difference = MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - MenuOption->Row - MenuOption->Skip);
// //
// We hit the end of MenuOption that can be focused // We hit the end of MenuOption that can be focused
// so we simply scroll to the first page. // so we simply scroll to the first page.
@ -3645,7 +3748,8 @@ UiDisplayMenu (
} }
NewPos = gMenuOption.ForwardLink; NewPos = gMenuOption.ForwardLink;
MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow); MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow);
SkipValue = 0;
// //
// If we are at the end of the list and sitting on a Date/Time op, rewind to the head. // If we are at the end of the list and sitting on a Date/Time op, rewind to the head.
// //
@ -3655,11 +3759,9 @@ UiDisplayMenu (
} }
} }
NextMenuOption = MENU_OPTION_FROM_LINK (NewPos); NextMenuOption = MENU_OPTION_FROM_LINK (NewPos);
if (NextMenuOption->Row == 0) {
// UpdateOptionSkipLines (Selection, NextMenuOption);
// An option might be multi-line, so we need to reflect that data in the overall skip value }
//
UpdateOptionSkipLines (Selection, NextMenuOption);
DistanceValue = Difference + NextMenuOption->Skip; DistanceValue = Difference + NextMenuOption->Skip;
Temp = MenuOption->Row + MenuOption->Skip + DistanceValue - 1; Temp = MenuOption->Row + MenuOption->Skip + DistanceValue - 1;
@ -3684,18 +3786,16 @@ UiDisplayMenu (
// //
// If bottom op-code is more than one line or top op-code is more than one line // If bottom op-code is more than one line or top op-code is more than one line
// //
if ((DistanceValue > 1) || (MenuOption->Skip > 1)) { if ((DistanceValue > 1) || (SavedMenuOption->Skip > 1)) {
// //
// Is the bottom op-code greater than or equal in size to the top op-code? // Is the bottom op-code greater than or equal in size to the top op-code?
// //
if ((Temp - BottomRow) >= (SavedMenuOption->Skip - OldSkipValue)) { if ((Temp - BottomRow) >= (SavedMenuOption->Skip - SkipValue)) {
// //
// Skip the top op-code // Skip the top op-code
// //
TopOfScreen = TopOfScreen->ForwardLink; TopOfScreen = TopOfScreen->ForwardLink;
Difference = (Temp - BottomRow) - (SavedMenuOption->Skip - OldSkipValue); Difference = (Temp - BottomRow) - (SavedMenuOption->Skip - SkipValue);
OldSkipValue = Difference;
SavedMenuOption = MENU_OPTION_FROM_LINK (TopOfScreen); SavedMenuOption = MENU_OPTION_FROM_LINK (TopOfScreen);
@ -3715,20 +3815,17 @@ UiDisplayMenu (
// SkipValue, set the skips to one less than what is required. // SkipValue, set the skips to one less than what is required.
// //
SkipValue = Difference - 1; SkipValue = Difference - 1;
} else { } else {
// //
// Since we will act on this op-code in the next routine, and increment the // Since we will act on this op-code in the next routine, and increment the
// SkipValue, set the skips to one less than what is required. // SkipValue, set the skips to one less than what is required.
// //
SkipValue = OldSkipValue + (Temp - BottomRow) - 1; SkipValue += (Temp - BottomRow) - 1;
} }
} else { } else {
if ((OldSkipValue + 1) == (INTN) SavedMenuOption->Skip) { if ((SkipValue + 1) == (INTN) SavedMenuOption->Skip) {
TopOfScreen = TopOfScreen->ForwardLink; TopOfScreen = TopOfScreen->ForwardLink;
break; break;
} else {
SkipValue = OldSkipValue;
} }
} }
// //
@ -3750,7 +3847,6 @@ UiDisplayMenu (
} while (SavedMenuOption->Skip == 0); } while (SavedMenuOption->Skip == 0);
Repaint = TRUE; Repaint = TRUE;
OldSkipValue = SkipValue;
} else if (!IsSelectable (NextMenuOption)) { } else if (!IsSelectable (NextMenuOption)) {
// //
// Continue to go down until scroll to next page or the selectable option is found. // Continue to go down until scroll to next page or the selectable option is found.
@ -3772,9 +3868,18 @@ UiDisplayMenu (
Repaint = TRUE; Repaint = TRUE;
MenuOption = NULL; MenuOption = NULL;
} else { } else {
//
// Need to remove the current highlight menu.
// MenuOption saved the last highlight menu info.
//
MenuOption = MENU_OPTION_FROM_LINK (SavedListEntry); MenuOption = MENU_OPTION_FROM_LINK (SavedListEntry);
} }
SkipValue = 0;
NewLine = TRUE; NewLine = TRUE;
//
// Get the next highlight menu.
//
NewPos = gMenuOption.ForwardLink; NewPos = gMenuOption.ForwardLink;
MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow); MoveToNextStatement (Selection, FALSE, &NewPos, BottomRow - TopRow);
} }