mirror of
https://github.com/reactos/reactos.git
synced 2025-04-19 20:19:26 +00:00
[FREELDR:UI] Improve how menu line separators are drawn.
When the menu is not boxed, do not draw the specific "T"-shaped box corners for the separators.
This commit is contained in:
parent
c322610f6e
commit
5239a0ca4d
1 changed files with 64 additions and 56 deletions
|
@ -349,24 +349,6 @@ TuiDrawMenuBox(
|
||||||
ATTR(UiMenuFgColor, UiMenuBgColor));
|
ATTR(UiMenuFgColor, UiMenuBgColor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop each item */
|
|
||||||
for (i = 0; i < MenuInfo->MenuItemCount; i++)
|
|
||||||
{
|
|
||||||
/* Check if it's a separator */
|
|
||||||
if (MenuInfo->MenuItemList[i] == NULL)
|
|
||||||
{
|
|
||||||
/* Draw the separator line */
|
|
||||||
UiDrawText(MenuInfo->Left,
|
|
||||||
MenuInfo->Top + i + 1,
|
|
||||||
"\xC7",
|
|
||||||
ATTR(UiMenuFgColor, UiMenuBgColor));
|
|
||||||
UiDrawText(MenuInfo->Right,
|
|
||||||
MenuInfo->Top + i + 1,
|
|
||||||
"\xB6",
|
|
||||||
ATTR(UiMenuFgColor, UiMenuBgColor));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -374,15 +356,55 @@ TuiDrawMenuItem(
|
||||||
_In_ PUI_MENU_INFO MenuInfo,
|
_In_ PUI_MENU_INFO MenuInfo,
|
||||||
_In_ ULONG MenuItemNumber)
|
_In_ ULONG MenuItemNumber)
|
||||||
{
|
{
|
||||||
#ifndef _M_ARM
|
|
||||||
ULONG i;
|
|
||||||
ULONG SpaceTotal;
|
|
||||||
ULONG SpaceLeft;
|
ULONG SpaceLeft;
|
||||||
ULONG SpaceRight = 0;
|
ULONG SpaceRight;
|
||||||
#endif
|
UCHAR Attribute;
|
||||||
UCHAR Attribute = ATTR(UiTextColor, UiMenuBgColor);
|
|
||||||
CHAR MenuLineText[80];
|
CHAR MenuLineText[80];
|
||||||
|
|
||||||
|
/* If this is a separator */
|
||||||
|
if (MenuInfo->MenuItemList[MenuItemNumber] == NULL)
|
||||||
|
{
|
||||||
|
#ifndef _M_ARM // FIXME: Theme-specific
|
||||||
|
/* Draw its left box corner */
|
||||||
|
if (UiMenuBox)
|
||||||
|
{
|
||||||
|
UiDrawText(MenuInfo->Left,
|
||||||
|
MenuInfo->Top + 1 + MenuItemNumber,
|
||||||
|
"\xC7",
|
||||||
|
ATTR(UiMenuFgColor, UiMenuBgColor));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Make it a separator line and use menu colors */
|
||||||
|
RtlZeroMemory(MenuLineText, sizeof(MenuLineText));
|
||||||
|
RtlFillMemory(MenuLineText,
|
||||||
|
min(sizeof(MenuLineText), (MenuInfo->Right - MenuInfo->Left - 1)),
|
||||||
|
0xC4);
|
||||||
|
|
||||||
|
/* Draw the item */
|
||||||
|
UiDrawText(MenuInfo->Left + 1,
|
||||||
|
MenuInfo->Top + 1 + MenuItemNumber,
|
||||||
|
MenuLineText,
|
||||||
|
ATTR(UiMenuFgColor, UiMenuBgColor));
|
||||||
|
|
||||||
|
#ifndef _M_ARM // FIXME: Theme-specific
|
||||||
|
/* Draw its right box corner */
|
||||||
|
if (UiMenuBox)
|
||||||
|
{
|
||||||
|
UiDrawText(MenuInfo->Right,
|
||||||
|
MenuInfo->Top + 1 + MenuItemNumber,
|
||||||
|
"\xB6",
|
||||||
|
ATTR(UiMenuFgColor, UiMenuBgColor));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* We are done */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is not a separator */
|
||||||
|
ASSERT(MenuInfo->MenuItemList[MenuItemNumber]);
|
||||||
|
|
||||||
#ifndef _M_ARM
|
#ifndef _M_ARM
|
||||||
/* Check if using centered menu */
|
/* Check if using centered menu */
|
||||||
if (UiCenterMenu)
|
if (UiCenterMenu)
|
||||||
|
@ -391,51 +413,37 @@ TuiDrawMenuItem(
|
||||||
* We will want the string centered so calculate
|
* We will want the string centered so calculate
|
||||||
* how many spaces will be to the left and right.
|
* how many spaces will be to the left and right.
|
||||||
*/
|
*/
|
||||||
SpaceTotal = (MenuInfo->Right - MenuInfo->Left - 2) -
|
ULONG SpaceTotal =
|
||||||
(ULONG)(MenuInfo->MenuItemList[MenuItemNumber] ?
|
(MenuInfo->Right - MenuInfo->Left - 2) -
|
||||||
strlen(MenuInfo->MenuItemList[MenuItemNumber]) : 0);
|
(ULONG)strlen(MenuInfo->MenuItemList[MenuItemNumber]);
|
||||||
SpaceLeft = (SpaceTotal / 2) + 1;
|
SpaceLeft = (SpaceTotal / 2) + 1;
|
||||||
SpaceRight = (SpaceTotal - SpaceLeft) + 1;
|
SpaceRight = (SpaceTotal - SpaceLeft) + 1;
|
||||||
|
|
||||||
/* Insert the spaces on the left */
|
|
||||||
for (i = 0; i < SpaceLeft; i++)
|
|
||||||
MenuLineText[i] = ' ';
|
|
||||||
MenuLineText[i] = '\0';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* Simply left-align it */
|
/* Simply left-align it */
|
||||||
MenuLineText[0] = '\0';
|
SpaceLeft = 4;
|
||||||
strcat(MenuLineText, " ");
|
SpaceRight = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now append the text string */
|
/* Format the item text string */
|
||||||
if (MenuInfo->MenuItemList[MenuItemNumber])
|
RtlStringCbPrintfA(MenuLineText, sizeof(MenuLineText),
|
||||||
strcat(MenuLineText, MenuInfo->MenuItemList[MenuItemNumber]);
|
"%*s%s%*s",
|
||||||
|
SpaceLeft, "", // Left padding
|
||||||
|
MenuInfo->MenuItemList[MenuItemNumber],
|
||||||
|
SpaceRight, ""); // Right padding
|
||||||
|
|
||||||
#ifndef _M_ARM
|
if (MenuItemNumber == MenuInfo->SelectedMenuItem)
|
||||||
/* Check if using centered menu, and add spaces on the right if so */
|
|
||||||
if (UiCenterMenu)
|
|
||||||
{
|
|
||||||
for (i = 0; i < SpaceRight; i++)
|
|
||||||
strcat(MenuLineText, " ");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If it is a separator */
|
|
||||||
if (MenuInfo->MenuItemList[MenuItemNumber] == NULL)
|
|
||||||
{
|
|
||||||
/* Make it a separator line and use menu colors */
|
|
||||||
memset(MenuLineText, 0, sizeof(MenuLineText));
|
|
||||||
memset(MenuLineText, 0xC4, (MenuInfo->Right - MenuInfo->Left - 1));
|
|
||||||
Attribute = ATTR(UiMenuFgColor, UiMenuBgColor);
|
|
||||||
}
|
|
||||||
else if (MenuItemNumber == MenuInfo->SelectedMenuItem)
|
|
||||||
{
|
{
|
||||||
/* If this is the selected item, use the selected colors */
|
/* If this is the selected item, use the selected colors */
|
||||||
Attribute = ATTR(UiSelectedTextColor, UiSelectedTextBgColor);
|
Attribute = ATTR(UiSelectedTextColor, UiSelectedTextBgColor);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Normal item colors */
|
||||||
|
Attribute = ATTR(UiTextColor, UiMenuBgColor);
|
||||||
|
}
|
||||||
|
|
||||||
/* Draw the item */
|
/* Draw the item */
|
||||||
UiDrawText(MenuInfo->Left + 1,
|
UiDrawText(MenuInfo->Left + 1,
|
||||||
|
|
Loading…
Reference in a new issue