Increase the symbol size in the player menu items with labels

objectmenu
Günther Brammer 2016-01-30 02:08:48 +01:00
parent 435e5a8eeb
commit dd49c5a2fe
3 changed files with 9 additions and 15 deletions

View File

@ -144,7 +144,7 @@ namespace C4GUI
}
// calculations for automatic scrolling
int32_t iXOff = 0;
if (iAlign == ALeft) iXOff += 5;
if (iAlign == ALeft) iXOff += C4GUI_IconLabelSpacing;
if (iAutoScrollDelay)
{
C4TimeMilliseconds tNow = C4TimeMilliseconds::Now();

View File

@ -95,7 +95,10 @@ void C4MenuItem::DrawElement(C4TargetFacet &cgo)
// Draw item text
pDraw->StorePrimaryClipper(); pDraw->SubPrimaryClipper(cgoItemText.X, cgoItemText.Y, cgoItemText.X+cgoItemText.Wdt-1, cgoItemText.Y+cgoItemText.Hgt-1);
if (iStyle == C4MN_Style_Context)
pDraw->TextOut(Caption,::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y,C4Draw::DEFAULT_MESSAGE_COLOR,ALeft);
pDraw->TextOut(Caption, ::GraphicsResource.FontRegular, 1.0f, cgoItemText.Surface,
cgoItemText.X + C4GUI_IconLabelSpacing,
cgoItemText.Y + round((cgoItemText.Hgt - ::GraphicsResource.FontRegular.GetLineHeight())/2)-1,
C4GUI_ContextFontClr);
pDraw->RestorePrimaryClipper();
}
@ -437,16 +440,10 @@ void C4Menu::SetSize(int32_t iToWdt, int32_t iToHgt)
void C4Menu::InitLocation(C4Facet &cgoArea)
{
// Item size by style
switch (Style)
ItemWidth=ItemHeight=C4SymbolSize;
if (Style == C4MN_Style_Context)
{
case C4MN_Style_Normal:
ItemWidth=ItemHeight=C4SymbolSize;
break;
case C4MN_Style_Context:
{
ItemHeight = std::max<int32_t>(C4MN_SymbolSize, ::GraphicsResource.FontRegular.GetLineHeight());
ItemHeight = std::max<int32_t>(ItemHeight, ::GraphicsResource.FontRegular.GetLineHeight());
int32_t iWdt, iHgt;
::GraphicsResource.FontRegular.GetTextExtent(Caption, ItemWidth, iHgt, true);
// FIXME: Blah. This stuff should be calculated correctly by pTitle.
@ -455,11 +452,9 @@ void C4Menu::InitLocation(C4Facet &cgoArea)
for (int i = 0; (pItem = GetItem(i)); ++i)
{
::GraphicsResource.FontRegular.GetTextExtent(pItem->Caption, iWdt, iHgt, true);
ItemWidth = std::max(ItemWidth, iWdt + pItem->GetSymbolWidth(ItemHeight));
ItemWidth = std::max(ItemWidth, iWdt + pItem->GetSymbolWidth(ItemHeight) + C4GUI_IconLabelSpacing);
}
ItemWidth += 3; // Add some extra space so text doesn't touch right border frame...
break;
}
}
Lines = ItemCount/Columns+std::min<int32_t>(ItemCount%Columns,1);

View File

@ -27,7 +27,6 @@
enum
{
C4MN_SymbolSize = 16,
C4MN_FrameWidth = 2
};
enum