[FREELDR]

Use NULL string pointers as separators instead of a special "SEPARATOR" string.

svn path=/trunk/; revision=58002
This commit is contained in:
Hermès Bélusca-Maïto 2012-12-25 00:53:23 +00:00
parent f8917522e4
commit 570a635124
3 changed files with 26 additions and 17 deletions

View file

@ -26,7 +26,7 @@ PCSTR OptionsMenuList[] =
"Safe Mode with Networking",
"Safe Mode with Command Prompt",
"SEPARATOR",
NULL,
"Enable Boot Logging",
"Enable VGA Mode",
@ -35,7 +35,7 @@ PCSTR OptionsMenuList[] =
"Debugging Mode",
"FreeLdr debugging",
"SEPARATOR",
NULL,
#ifdef HAS_OPTION_MENU_CUSTOM_BOOT
"Custom Boot",

View file

@ -297,7 +297,7 @@ UiDrawMenuBox(IN PUI_MENU_INFO MenuInfo)
for (i = 0; i < MenuInfo->MenuItemCount; i++)
{
/* Check if it's a separator */
if (!(_stricmp(MenuInfo->MenuItemList[i], "SEPARATOR")))
if (MenuInfo->MenuItemList[i] == NULL)
{
/* Draw the separator line */
UiDrawText(MenuInfo->Left,
@ -325,10 +325,11 @@ UiDrawMenuItem(IN PUI_MENU_INFO MenuInfo,
strcat(MenuLineText, " ");
/* Now append the text string */
strcat(MenuLineText, MenuInfo->MenuItemList[MenuItemNumber]);
if (MenuInfo->MenuItemList[MenuItemNumber])
strcat(MenuLineText, MenuInfo->MenuItemList[MenuItemNumber]);
/* If it is a separator */
if (!(_stricmp(MenuInfo->MenuItemList[MenuItemNumber], "SEPARATOR")))
if (MenuInfo->MenuItemList[MenuItemNumber] == NULL)
{
/* Make it a separator line and use menu colors */
memset(MenuLineText, 0, 80);
@ -436,7 +437,7 @@ UiProcessMenuKeyboardEvent(IN PUI_MENU_INFO MenuInfo,
/* Skip past any separators */
if ((Selected) &&
!(_stricmp(MenuInfo->MenuItemList[Selected], "SEPARATOR")))
(MenuInfo->MenuItemList[Selected] == NULL))
{
MenuInfo->SelectedMenuItem--;
}
@ -450,7 +451,7 @@ UiProcessMenuKeyboardEvent(IN PUI_MENU_INFO MenuInfo,
/* Skip past any separators */
if ((Selected < Count) &&
!(_stricmp(MenuInfo->MenuItemList[Selected], "SEPARATOR")))
(MenuInfo->MenuItemList[Selected] == NULL))
{
MenuInfo->SelectedMenuItem++;
}
@ -479,8 +480,11 @@ UiCalcMenuBoxSize(IN PUI_MENU_INFO MenuInfo)
for (i = 0; i < MenuInfo->MenuItemCount; i++)
{
/* Get the string length and make it become the new width if necessary */
Length = strlen(MenuInfo->MenuItemList[i]);
if (Length > Width) Width = Length;
if (MenuInfo->MenuItemList[i])
{
Length = (ULONG)strlen(MenuInfo->MenuItemList[i]);
if (Length > Width) Width = Length;
}
}
/* Allow room for left & right borders, plus 8 spaces on each side */

View file

@ -157,8 +157,11 @@ TuiCalcMenuBoxSize(PUI_MENU_INFO MenuInfo)
//
// Get the string length and make it become the new width if necessary
//
Length = (ULONG)strlen(MenuInfo->MenuItemList[i]);
if (Length > Width) Width = Length;
if (MenuInfo->MenuItemList[i])
{
Length = (ULONG)strlen(MenuInfo->MenuItemList[i]);
if (Length > Width) Width = Length;
}
}
//
@ -334,7 +337,7 @@ TuiDrawMenuBox(PUI_MENU_INFO MenuInfo)
//
// Check if it's a separator
//
if (!(_stricmp(MenuInfo->MenuItemList[i], "SEPARATOR")))
if (MenuInfo->MenuItemList[i] == NULL)
{
//
// Draw the separator line
@ -373,7 +376,8 @@ TuiDrawMenuItem(PUI_MENU_INFO MenuInfo,
// how many spaces will be to the left and right
//
SpaceTotal = (MenuInfo->Right - MenuInfo->Left - 2) -
(ULONG)strlen(MenuInfo->MenuItemList[MenuItemNumber]);
(ULONG)(MenuInfo->MenuItemList[MenuItemNumber] ?
strlen(MenuInfo->MenuItemList[MenuItemNumber]) : 0);
SpaceLeft = (SpaceTotal / 2) + 1;
SpaceRight = (SpaceTotal - SpaceLeft) + 1;
@ -395,7 +399,8 @@ TuiDrawMenuItem(PUI_MENU_INFO MenuInfo,
//
// Now append the text string
//
strcat(MenuLineText, MenuInfo->MenuItemList[MenuItemNumber]);
if (MenuInfo->MenuItemList[MenuItemNumber])
strcat(MenuLineText, MenuInfo->MenuItemList[MenuItemNumber]);
//
// Check if using centered menu, and add spaces on the right if so
@ -405,7 +410,7 @@ TuiDrawMenuItem(PUI_MENU_INFO MenuInfo,
//
// If it is a separator
//
if (!(_stricmp(MenuInfo->MenuItemList[MenuItemNumber], "SEPARATOR")))
if (MenuInfo->MenuItemList[MenuItemNumber] == NULL)
{
//
// Make it a separator line and use menu colors
@ -504,7 +509,7 @@ TuiProcessMenuKeyboardEvent(PUI_MENU_INFO MenuInfo,
// Skip past any separators
if ((Selected) &&
!(_stricmp(MenuInfo->MenuItemList[Selected], "SEPARATOR")))
(MenuInfo->MenuItemList[Selected] == NULL))
{
MenuInfo->SelectedMenuItem--;
}
@ -520,7 +525,7 @@ TuiProcessMenuKeyboardEvent(PUI_MENU_INFO MenuInfo,
// Skip past any separators
if ((Selected < Count) &&
!(_stricmp(MenuInfo->MenuItemList[Selected], "SEPARATOR")))
(MenuInfo->MenuItemList[Selected] == NULL))
{
MenuInfo->SelectedMenuItem++;
}