From c50775492c0b1d3da71283572a755d9aec3b202a Mon Sep 17 00:00:00 2001 From: Martin Schirrmacher Date: Fri, 30 May 2014 19:35:42 +0200 Subject: fix cut text on tab size --- displaymenu.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'displaymenu.c') diff --git a/displaymenu.c b/displaymenu.c index b199b37a..eeecd522 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -316,6 +316,9 @@ void cFlatDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool S bool isRunning = false; int xt = Tab(i); + int xt2 = Tab(i+1); + if( xt2 == 0 || i == MaxTabs ) + xt2 = menuItemWidth; if( xt >= menuItemWidth ) continue; @@ -437,19 +440,19 @@ void cFlatDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool S menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize, y), first.c_str(), ColorFg, ColorBg, font); int l = font->Width( first.c_str() ); - menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize + l, y), second.c_str(), ColorExtraTextFg, ColorBg, font); + menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize + l, y), second.c_str(), ColorExtraTextFg, ColorBg, font, xt2 - xt); } else if ( found2 != string::npos ) { std::string first = tilde.substr(0, found2); std::string second = tilde.substr(found2 +1, tilde.length() ); - menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize, y), first.c_str(), ColorFg, ColorBg, font); + menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize, y), first.c_str(), ColorFg, ColorBg, font, xt2 - xt); int l = font->Width( first.c_str() ); l += font->Width("X"); - menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize + l, y), second.c_str(), ColorExtraTextFg, ColorBg, font); + menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize + l, y), second.c_str(), ColorExtraTextFg, ColorBg, font, xt2 - xt); } else - menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize, y), s, ColorFg, ColorBg, font); + menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize, y), s, ColorFg, ColorBg, font, xt2 - xt); } else - menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize, y), s, ColorFg, ColorBg, font); + menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize, y), s, ColorFg, ColorBg, font, xt2 - xt); } } } -- cgit v1.2.3