PrintStringAtWithWidth (Col + Length, Row, L"", Width - Length);\r
}\r
\r
+/**\r
+ Check whether this menu can has option string.\r
+\r
+ @param MenuOption The menu opton which this attribut used to.\r
+\r
+ @retval TRUE This menu option can have option string.\r
+ @retval FALSE This menu option can't have option string.\r
+\r
+**/\r
+BOOLEAN \r
+HasOptionString (\r
+ IN UI_MENU_OPTION *MenuOption\r
+ )\r
+{\r
+ FORM_DISPLAY_ENGINE_STATEMENT *Statement;\r
+ CHAR16 *String;\r
+ UINTN Size;\r
+ EFI_IFR_TEXT *TestOp;\r
+\r
+ Size = 0;\r
+ Statement = MenuOption->ThisTag;\r
+\r
+ //\r
+ // See if the second text parameter is really NULL\r
+ //\r
+ if (Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) {\r
+ TestOp = (EFI_IFR_TEXT *) Statement->OpCode;\r
+ if (TestOp->TextTwo != 0) {\r
+ String = GetToken (TestOp->TextTwo, gFormData->HiiHandle);\r
+ Size = StrLen (String);\r
+ FreePool (String);\r
+ }\r
+ }\r
+\r
+ if ((Statement->OpCode->OpCode == EFI_IFR_SUBTITLE_OP) ||\r
+ (Statement->OpCode->OpCode == EFI_IFR_REF_OP) ||\r
+ (Statement->OpCode->OpCode == EFI_IFR_PASSWORD_OP) ||\r
+ (Statement->OpCode->OpCode == EFI_IFR_ACTION_OP) ||\r
+ (Statement->OpCode->OpCode == EFI_IFR_RESET_BUTTON_OP) ||\r
+ //\r
+ // Allow a wide display if text op-code and no secondary text op-code\r
+ //\r
+ ((Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) && (Size == 0))\r
+ ) {\r
+\r
+ return FALSE;\r
+ }\r
+\r
+ return TRUE;\r
+}\r
+\r
+\r
/**\r
Print string for this menu option.\r
\r
CHAR16 *StringPtr;\r
CHAR16 *OptionString;\r
CHAR16 *OutputString;\r
- UINTN OriginalRow;\r
UINT16 GlyphWidth;\r
UINTN Temp;\r
UINTN Temp2;\r
UINTN Row;\r
UINTN Col;\r
UINTN PromptLineNum;\r
+ UINTN OptionLineNum;\r
CHAR16 AdjustValue;\r
+ UINTN MaxRow;\r
\r
Statement = MenuOption->ThisTag;\r
- Col = MenuOption->Col;\r
- Row = MenuOption->Row;\r
Temp = SkipLine;\r
Temp2 = SkipLine;\r
Temp3 = SkipLine;\r
- AdjustValue = 0;\r
+ AdjustValue = 0;\r
+ PromptLineNum = 0;\r
+ OptionLineNum = 0;\r
+ MaxRow = 0;\r
\r
//\r
// Set default color.\r
}\r
\r
Width = (UINT16) gOptionBlockWidth - 1;\r
- OriginalRow = Row;\r
+ Row = MenuOption->Row;\r
GlyphWidth = 1;\r
+ OptionLineNum = 0;\r
\r
for (Index = 0; GetLineByWidth (OptionString, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) {\r
if (((Temp2 == 0)) && (Row <= BottomRow)) {\r
} else {\r
DisplayMenuString (MenuOption, MenuOption->OptCol, Row, OutputString, Width + 1, Highlight);\r
}\r
+ OptionLineNum++;\r
}\r
\r
//\r
//\r
// If the difference in rows is greater than or equal to the skip value, increase the skip value\r
//\r
- if ((Row - OriginalRow) >= MenuOption->Skip) {\r
+ if ((Row - MenuOption->Row) >= MenuOption->Skip) {\r
MenuOption->Skip++;\r
}\r
}\r
}\r
}\r
\r
- Row = OriginalRow;\r
Highlight = FALSE;\r
\r
FreePool (OptionString);\r
}\r
- Temp2 = 0;\r
-\r
\r
//\r
- // 2. Pre calculate the skip value.\r
- //\r
- if ((Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) && (((EFI_IFR_TEXT*)Statement->OpCode)->TextTwo != 0)) {\r
- StringPtr = GetToken (((EFI_IFR_TEXT*)Statement->OpCode)->TextTwo, gFormData->HiiHandle);\r
- \r
- Width = (UINT16) gOptionBlockWidth - 1;\r
- OriginalRow = Row;\r
- GlyphWidth = 1;\r
- for (Index = 0; GetLineByWidth (StringPtr, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) { \r
- if (StrLen (&StringPtr[Index]) != 0) {\r
- Row++;\r
- if ((Row - OriginalRow) >= MenuOption->Skip) {\r
- MenuOption->Skip++;\r
- }\r
- }\r
- FreePool (OutputString);\r
- }\r
- \r
- Row = OriginalRow;\r
- FreePool (StringPtr);\r
- }\r
-\r
-\r
- //\r
- // 3. Paint the description.\r
+ // 2. Paint the description.\r
//\r
PromptWidth = GetWidth (Statement, &AdjustValue);\r
- OriginalRow = Row;\r
+ Row = MenuOption->Row;\r
GlyphWidth = 1;\r
PromptLineNum = 0;\r
\r
if (MenuOption->Description == NULL || MenuOption->Description[0] == '\0') {\r
- while (Temp++ < MenuOption->Skip) {\r
- PrintStringAtWithWidth (BeginCol, Row++, L"", PromptWidth + AdjustValue + SkipWidth);\r
- } \r
+ PrintStringAtWithWidth (BeginCol, Row, L"", PromptWidth + AdjustValue + SkipWidth);\r
+ PromptLineNum++;\r
} else {\r
for (Index = 0; GetLineByWidth (MenuOption->Description, PromptWidth, &GlyphWidth, &Index, &OutputString) != 0x0000;) { \r
if ((Temp == 0) && (Row <= BottomRow)) { \r
}\r
\r
Highlight = FALSE;\r
-\r
- //\r
- // Clean the empty prompt line.\r
- // These line is used by option string but not prompt, so clean them here.\r
- //\r
- Row = OriginalRow + PromptLineNum;\r
- while (PromptLineNum + SkipLine < MenuOption->Skip && Row <= BottomRow) {\r
- PrintStringAtWithWidth (BeginCol, Row, L"", PromptWidth + AdjustValue + SkipWidth);\r
- PromptLineNum ++;\r
- Row ++;\r
- }\r
}\r
- Row = OriginalRow;\r
\r
\r
//\r
- // 4. If this is a text op with secondary text information\r
+ // 3. If this is a text op with secondary text information\r
//\r
if ((Statement->OpCode->OpCode == EFI_IFR_TEXT_OP) && (((EFI_IFR_TEXT*)Statement->OpCode)->TextTwo != 0)) {\r
StringPtr = GetToken (((EFI_IFR_TEXT*)Statement->OpCode)->TextTwo, gFormData->HiiHandle);\r
\r
Width = (UINT16) gOptionBlockWidth - 1;\r
- OriginalRow = Row;\r
+ Row = MenuOption->Row;\r
GlyphWidth = 1;\r
+ OptionLineNum = 0;\r
\r
for (Index = 0; GetLineByWidth (StringPtr, Width, &GlyphWidth, &Index, &OutputString) != 0x0000;) { \r
if ((Temp3 == 0) && (Row <= BottomRow)) {\r
DisplayMenuString (MenuOption, MenuOption->OptCol, Row, OutputString, Width + 1, Highlight);\r
+ OptionLineNum++;\r
}\r
//\r
// If there is more string to process print on the next row and increment the Skip value\r
Temp3--;\r
}\r
}\r
- \r
- Row = OriginalRow;\r
+\r
FreePool (StringPtr);\r
}\r
\r
+ //\r
+ // 4.Line number for Option string and prompt string are not equal.\r
+ // Clean the column whose line number is less.\r
+ //\r
+ if (HasOptionString(MenuOption) && (OptionLineNum != PromptLineNum)) {\r
+ Col = OptionLineNum < PromptLineNum ? MenuOption->OptCol : BeginCol;\r
+ Row = (OptionLineNum < PromptLineNum ? OptionLineNum : PromptLineNum) + MenuOption->Row;\r
+ Width = (UINT16) (OptionLineNum < PromptLineNum ? gOptionBlockWidth : PromptWidth + AdjustValue + SkipWidth);\r
+ MaxRow = (OptionLineNum < PromptLineNum ? PromptLineNum : OptionLineNum) + MenuOption->Row - 1;\r
+ \r
+ while (Row <= MaxRow) {\r
+ DisplayMenuString (MenuOption, Col, Row++, L"", Width, FALSE);\r
+ }\r
+ }\r
+\r
return EFI_SUCCESS;\r
}\r
\r