From 7f75d097405171389bc8054b41e0444189c48ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Brammer?= Date: Sat, 30 Jan 2016 15:06:25 +0100 Subject: [PATCH] Increase height of dialog/menu title bars to the standard icon height --- src/gui/C4GuiLabels.cpp | 11 +++++++---- src/gui/C4Menu.cpp | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/gui/C4GuiLabels.cpp b/src/gui/C4GuiLabels.cpp index c1fc8e678..cd0b5624d 100644 --- a/src/gui/C4GuiLabels.cpp +++ b/src/gui/C4GuiLabels.cpp @@ -139,11 +139,11 @@ namespace C4GUI // draw symbol if (fctIcon.Surface) { - C4Facet cgoSymbol(cgo.Surface, cgo.TargetX + rcBounds.x + 1, cgo.TargetY + rcBounds.y + 1, rcBounds.Hgt-2, rcBounds.Hgt-2); + C4Facet cgoSymbol(cgo.Surface, cgo.TargetX + rcBounds.x, cgo.TargetY + rcBounds.y, rcBounds.Hgt, rcBounds.Hgt); fctIcon.Draw(cgoSymbol); } // calculations for automatic scrolling - int32_t iXOff = 0; + int32_t iXOff = 0, iYOff; if (iAlign == ALeft) iXOff += C4GUI_IconLabelSpacing; if (iAutoScrollDelay) { @@ -168,14 +168,17 @@ namespace C4GUI // print out text; clipped pDraw->StorePrimaryClipper(); pDraw->SetPrimaryClipper(rcBounds.x + GetLeftIndent() + cgo.TargetX, rcBounds.y + cgo.TargetY, rcBounds.x+rcBounds.Wdt - GetRightIndent() + cgo.TargetX, rcBounds.y+rcBounds.Hgt + cgo.TargetY); - pDraw->TextOut(sText.getData(), *pFont, 1.0f, cgo.Surface, x0 + cgo.TargetX + iXOff, rcBounds.y + cgo.TargetY + (rcBounds.Hgt-pFont->GetLineHeight())/2-1, dwFgClr, iAlign); + iYOff = (rcBounds.Hgt-pFont->GetLineHeight())/2-1; + // even border all around the text + if (!fctIcon.Surface) iXOff += iYOff; + pDraw->TextOut(sText.getData(), *pFont, 1.0f, cgo.Surface, x0 + cgo.TargetX + iXOff, rcBounds.y + cgo.TargetY + iYOff, dwFgClr, iAlign); pDraw->RestorePrimaryClipper(); } int32_t WoodenLabel::GetDefaultHeight(CStdFont *pUseFont) { if (!pUseFont) pUseFont = &(::GraphicsResource.TextFont); - return std::max(pUseFont->GetLineHeight(), C4GUI_MinWoodBarHgt); + return std::max(pUseFont->GetLineHeight(), C4SymbolSize); } void WoodenLabel::SetIcon(const C4Facet &rfctIcon) diff --git a/src/gui/C4Menu.cpp b/src/gui/C4Menu.cpp index d490176b3..554e95df1 100644 --- a/src/gui/C4Menu.cpp +++ b/src/gui/C4Menu.cpp @@ -438,9 +438,9 @@ void C4Menu::InitLocation(C4Facet &cgoArea) { ItemHeight = std::max(ItemHeight, ::GraphicsResource.FontRegular.GetLineHeight()); int32_t iWdt, iHgt; - ::GraphicsResource.FontRegular.GetTextExtent(Caption, ItemWidth, iHgt, true); + ::GraphicsResource.FontRegular.GetTextExtent(Caption, iWdt, iHgt, true); // FIXME: Blah. This stuff should be calculated correctly by pTitle. - ItemWidth += ItemHeight + 16; + ItemWidth += iWdt + 20 + C4GUI_IconLabelSpacing; C4MenuItem *pItem; for (int i = 0; (pItem = GetItem(i)); ++i) {