diff options
Diffstat (limited to 'channelgroup.c')
-rw-r--r-- | channelgroup.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/channelgroup.c b/channelgroup.c index 99420d6..de143a2 100644 --- a/channelgroup.c +++ b/channelgroup.c @@ -68,29 +68,28 @@ void cChannelGroupGrid::Draw(void) { void cChannelGroupGrid::DrawVertical(tColor colorText, tColor colorTextBack) { int textY = (Height() - fontManager.FontChannelGroups->Height()) / 2; - cString text = CutText(name, Width() - 4, fontManager.FontChannelGroups).c_str(); + cString text = cString::sprintf("%s", CutText(name, Width() - 4, fontManager.FontChannelGroups).c_str()); int textWidth = fontManager.FontChannelGroups->Width(*text); int x = (Width() - textWidth) / 2; pixmap->DrawText(cPoint(x, textY), *text, colorText, colorTextBack, fontManager.FontChannelGroups); } void cChannelGroupGrid::DrawHorizontal(tColor colorText, tColor colorTextBack) { - std::string nameUpper = name; - std::transform(nameUpper.begin(), nameUpper.end(),nameUpper.begin(), ::toupper); - int numChars = nameUpper.length(); + std::string groupName = name; + int numChars = groupName.length(); int charHeight = fontManager.FontChannelGroupsHorizontal->Height(); int textHeight = numChars * charHeight; int y = 5; - if ((textHeight +5) < Height()) { + if ((textHeight + 5) < Height()) { y = (Height() - textHeight) / 2; } - for (int i=0; i < numChars; i++) { - if (((y + 2*charHeight) > Height()) && ((i+1)<numChars)) { + for (int i = 0; i < numChars; i++) { + if (((y + 2 * charHeight) > Height()) && ((i + 1) < numChars)) { int x = (Width() - fontManager.FontChannelGroupsHorizontal->Width("...")) / 2; pixmap->DrawText(cPoint(x, y), "...", colorText, colorTextBack, fontManager.FontChannelGroupsHorizontal); break; } - cString currentChar = cString::sprintf("%c", nameUpper.at(i)); + cString currentChar = cString::sprintf("%s", utf8_substr(groupName.c_str(), i, 1).c_str()); int x = (Width() - fontManager.FontChannelGroupsHorizontal->Width(*currentChar)) / 2; pixmap->DrawText(cPoint(x, y), *currentChar, colorText, colorTextBack, fontManager.FontChannelGroupsHorizontal); y += fontManager.FontChannelGroupsHorizontal->Height(); |