/**\r
Get the supported width for a particular op-code\r
\r
- @param Statement The curent statement.\r
+ @param MenuOption The menu option.\r
@param AdjustWidth The width which is saved for the space.\r
\r
@return Returns the number of CHAR16 characters that is support.\r
**/\r
UINT16\r
GetWidth (\r
- IN FORM_DISPLAY_ENGINE_STATEMENT *Statement,\r
- OUT UINT16 *AdjustWidth\r
+ IN UI_MENU_OPTION *MenuOption,\r
+ OUT UINT16 *AdjustWidth\r
)\r
{\r
- CHAR16 *String;\r
- UINTN Size;\r
- EFI_IFR_TEXT *TestOp;\r
+ CHAR16 *String;\r
+ UINTN Size;\r
+ EFI_IFR_TEXT *TestOp;\r
+ UINT16 ReturnWidth;\r
+ FORM_DISPLAY_ENGINE_STATEMENT *Statement;\r
+\r
+ Statement = MenuOption->ThisTag;\r
\r
//\r
// For modal form, clean the entire row.\r
//\r
// Keep consistent with current behavior.\r
//\r
- return (UINT16) (gPromptBlockWidth + gOptionBlockWidth - 2);\r
+ ReturnWidth = (UINT16) (gPromptBlockWidth + gOptionBlockWidth - 2);\r
+ } else {\r
+ if (AdjustWidth != NULL) {\r
+ *AdjustWidth = 1;\r
+ }\r
+\r
+ ReturnWidth = (UINT16) (gPromptBlockWidth - 1);\r
}\r
\r
- if (AdjustWidth != NULL) {\r
- *AdjustWidth = 1;\r
+ //\r
+ // For nest in statement, should the subtitle indent.\r
+ //\r
+ if (MenuOption->NestInStatement) {\r
+ ReturnWidth -= SUBTITLE_INDENT;\r
}\r
- return (UINT16) (gPromptBlockWidth - 1);\r
+\r
+ return ReturnWidth;\r
}\r
\r
/**\r
String = GetToken (PromptId, gFormData->HiiHandle);\r
ASSERT (String != NULL);\r
\r
- Width = GetWidth (Statement, NULL);\r
- for (; GetLineByWidth (String, Width, &GlyphWidth,&ArrayEntry, &OutputString) != 0x0000;) {\r
- //\r
- // If there is more string to process print on the next row and increment the Skip value\r
- //\r
- if (StrLen (&String[ArrayEntry]) != 0) {\r
- NumberOfLines++;\r
- }\r
- FreePool (OutputString);\r
- }\r
-\r
if (Statement->OpCode->OpCode == EFI_IFR_DATE_OP || Statement->OpCode->OpCode == EFI_IFR_TIME_OP) {\r
- //\r
- // Add three MenuOptions for Date/Time\r
- // Data format : [01/02/2004] [11:22:33]\r
- // Line number : 0 0 1 0 0 1\r
- //\r
- NumberOfLines = 0;\r
Count = 3;\r
}\r
\r
MenuOption->NestInStatement = NestIn;\r
MenuOption->EntryNumber = *MenuItemCount;\r
\r
- if (Index == 2) {\r
- //\r
- // Override LineNumber for the MenuOption in Date/Time sequence\r
- //\r
- MenuOption->Skip = 1;\r
- } else {\r
- MenuOption->Skip = NumberOfLines;\r
- }\r
MenuOption->Sequence = Index;\r
\r
if ((Statement->Attribute & HII_DISPLAY_GRAYOUT) != 0) {\r
}\r
}\r
\r
+ if (Index == 0 && \r
+ (Statement->OpCode->OpCode != EFI_IFR_DATE_OP) && \r
+ (Statement->OpCode->OpCode != EFI_IFR_TIME_OP)) {\r
+ Width = GetWidth (MenuOption, NULL);\r
+ for (; GetLineByWidth (String, Width, &GlyphWidth,&ArrayEntry, &OutputString) != 0x0000;) {\r
+ //\r
+ // If there is more string to process print on the next row and increment the Skip value\r
+ //\r
+ if (StrLen (&String[ArrayEntry]) != 0) {\r
+ NumberOfLines++;\r
+ }\r
+ FreePool (OutputString);\r
+ }\r
+ } else {\r
+ //\r
+ // Add three MenuOptions for Date/Time\r
+ // Data format : [01/02/2004] [11:22:33]\r
+ // Line number : 0 0 1 0 0 1\r
+ // \r
+ NumberOfLines = 0;\r
+ }\r
+\r
+ if (Index == 2) {\r
+ //\r
+ // Override LineNumber for the MenuOption in Date/Time sequence\r
+ //\r
+ MenuOption->Skip = 1;\r
+ } else {\r
+ MenuOption->Skip = NumberOfLines;\r
+ }\r
+\r
InsertTailList (&gMenuOption, &MenuOption->Link);\r
}\r
\r
//\r
// 2. Paint the description.\r
//\r
- PromptWidth = GetWidth (Statement, &AdjustValue);\r
+ PromptWidth = GetWidth (MenuOption, &AdjustValue);\r
Row = MenuOption->Row;\r
GlyphWidth = 1;\r
PromptLineNum = 0;\r
\r
if ((FormData->Attribute & HII_DISPLAY_MODAL) != 0) {\r
Status = DisplayOneMenu (MenuOption, \r
- LEFT_SKIPPED_COLUMNS,\r
+ MenuOption->Col - gStatementDimensions.LeftColumn,\r
gStatementDimensions.LeftColumn + gModalSkipColumn, \r
Link == TopOfScreen ? SkipValue : 0, \r
BottomRow,\r
);\r
} else {\r
Status = DisplayOneMenu (MenuOption, \r
- LEFT_SKIPPED_COLUMNS,\r
+ MenuOption->Col - gStatementDimensions.LeftColumn,\r
gStatementDimensions.LeftColumn, \r
Link == TopOfScreen ? SkipValue : 0, \r
BottomRow,\r
ProcessStringForDateTime(MenuOption, OptionString, FALSE);\r
}\r
\r
- Width = (UINT16) gOptionBlockWidth;\r
+ Width = (UINT16) gOptionBlockWidth - 1;\r
OriginalRow = MenuOption->Row;\r
GlyphWidth = 1;\r
\r
}\r
\r
OriginalRow = MenuOption->Row;\r
- Width = GetWidth (MenuOption->ThisTag, NULL);\r
+ Width = GetWidth (MenuOption, NULL);\r
GlyphWidth = 1;\r
\r
for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {\r
if (Statement->OpCode->OpCode == EFI_IFR_DATE_OP || Statement->OpCode->OpCode == EFI_IFR_TIME_OP) {\r
ProcessStringForDateTime(MenuOption, OptionString, FALSE);\r
}\r
- Width = (UINT16) gOptionBlockWidth;\r
+ Width = (UINT16) gOptionBlockWidth - 1;\r
\r
OriginalRow = MenuOption->Row;\r
GlyphWidth = 1;\r
if (NewLine) {\r
OriginalRow = MenuOption->Row;\r
\r
- Width = GetWidth (Statement, NULL);\r
+ Width = GetWidth (MenuOption, NULL);\r
GlyphWidth = 1;\r
\r
for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {\r
MenuOption = MENU_OPTION_FROM_LINK (SavedListEntry);\r
UpdateStatusBar (INPUT_ERROR, FALSE);\r
} else {\r
+ if (NewPos->ForwardLink == &gMenuOption) {\r
+ NewLine = FALSE;\r
+ Repaint = FALSE;\r
+ break;\r
+ }\r
//\r
// Scroll up to the last page.\r
//\r
MenuOption = MENU_OPTION_FROM_LINK (SavedListEntry);\r
ScreenOperation = UiPageUp;\r
ControlFlag = CfScreenOperation;\r
+ SkipValue = 0;\r
}\r
break;\r
\r
}\r
\r
if ((Link->BackLink == &gMenuOption) && (Index >= TopRow)) {\r
- SkipValue = 0;\r
if (TopOfScreen == &gMenuOption) {\r
TopOfScreen = gMenuOption.ForwardLink;\r
NewPos = gMenuOption.BackLink;\r
MoveToNextStatement (TRUE, &NewPos, BottomRow - TopRow);\r
- Repaint = FALSE;\r
+ if (Index < PreviousMenuOption->Skip) {\r
+ Repaint = TRUE;\r
+ SkipValue = PreviousMenuOption->Skip - (Index - TopRow);\r
+ } else {\r
+ Repaint = FALSE;\r
+ SkipValue = 0;\r
+ }\r
} else if (TopOfScreen != Link) {\r
TopOfScreen = Link;\r
NewPos = Link;\r
MoveToNextStatement (FALSE, &NewPos, BottomRow - TopRow);\r
+ SkipValue = 0;\r
} else {\r
//\r
// Finally we know that NewPos is the last MenuOption can be focused.\r
//\r
- Repaint = FALSE;\r
+ if (SkipValue == 0) {\r
+ Repaint = FALSE;\r
+ }\r
NewPos = Link;\r
MoveToNextStatement (FALSE, &NewPos, BottomRow - TopRow);\r
+ SkipValue = 0;\r
}\r
} else {\r
if (Index > TopRow) {\r
\r
ASSERT (NewPos != NULL);\r
if (NewPos->ForwardLink == &gMenuOption) {\r
+ MenuOption = MENU_OPTION_FROM_LINK (NewPos);\r
+ if (SkipValue + BottomRow - TopRow + 1 < MenuOption->Skip) {\r
+ SkipValue += BottomRow - TopRow + 1;\r
+ NewLine = TRUE;\r
+ Repaint = TRUE;\r
+ break;\r
+ }\r
NewLine = FALSE;\r
Repaint = FALSE;\r
break;\r
AdjustDateAndTimePosition (FALSE, &NewPos);\r
\r
if (NewPos->ForwardLink != &gMenuOption) {\r
+ if (NewPos == TopOfScreen) {\r
+ Temp2 = SkipValue;\r
+ } else {\r
+ Temp2 = 0;\r
+ }\r
+\r
MenuOption = MENU_OPTION_FROM_LINK (NewPos);\r
NewLine = TRUE;\r
NewPos = NewPos->ForwardLink;\r
//\r
// Current menu not at the bottom of the form.\r
//\r
- if (BottomRow >= MenuOption->Row + MenuOption->Skip) {\r
+ if (BottomRow >= MenuOption->Row + MenuOption->Skip - Temp2) {\r
//\r
// Find the next selectable menu.\r
//\r
- Difference = MoveToNextStatement (FALSE, &NewPos, BottomRow - MenuOption->Row - MenuOption->Skip);\r
+ Difference = MoveToNextStatement (FALSE, &NewPos, BottomRow - MenuOption->Row - MenuOption->Skip + Temp2);\r
//\r
// We hit the end of MenuOption that can be focused\r
// so we simply scroll to the first page.\r
if (NextMenuOption->Row == 0) {\r
UpdateOptionSkipLines (NextMenuOption);\r
}\r
- DistanceValue = Difference + NextMenuOption->Skip;\r
+ DistanceValue = Difference + NextMenuOption->Skip - Temp2;\r
\r
Temp = MenuOption->Row + MenuOption->Skip + DistanceValue - 1;\r
- if ((MenuOption->Row + MenuOption->Skip == BottomRow + 1) &&\r
+ if ((MenuOption->Row + MenuOption->Skip - Temp2 == BottomRow + 1) &&\r
(NextMenuOption->ThisTag->OpCode->OpCode == EFI_IFR_DATE_OP ||\r
NextMenuOption->ThisTag->OpCode->OpCode == EFI_IFR_TIME_OP)\r
) {\r
//\r
// Scroll to the first page.\r
//\r
- if (TopOfScreen != gMenuOption.ForwardLink) {\r
+ if (TopOfScreen != gMenuOption.ForwardLink || SkipValue != 0) {\r
TopOfScreen = gMenuOption.ForwardLink;\r
Repaint = TRUE;\r
MenuOption = NULL;\r