diff options
author | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2020-07-25 13:35:03 +0200 |
---|---|---|
committer | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2020-07-25 13:35:03 +0200 |
commit | 52c41ff5afbc3476aed32da3e088e71b2ee3ca39 (patch) | |
tree | 4d9ace963863acbed30eab803d0cc20d44d87029 | |
parent | 5870b1ae4cbe4e4651c2662d8812ed4f22b69a67 (diff) | |
download | vdr-plugin-tvguide-52c41ff5afbc3476aed32da3e088e71b2ee3ca39.tar.gz vdr-plugin-tvguide-52c41ff5afbc3476aed32da3e088e71b2ee3ca39.tar.bz2 |
Fixed display groupname in cChannelGroupGrid::DrawHorizontal
-rw-r--r-- | channelgroup.c | 15 | ||||
-rw-r--r-- | tools.c | 3 |
2 files changed, 8 insertions, 10 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(); @@ -10,7 +10,6 @@ #include <vdr/plugin.h> #include <vdr/skins.h> #include "services/epgsearch.h" - #include "tools.h" cPlugin *GetScraperPlugin(void) { @@ -42,7 +41,7 @@ std::string utf8_substr(const std::string& str, unsigned int start, long unsigne } if (q<=start+leng || leng==std::string::npos){ max=i; } if (min==std::string::npos || max==std::string::npos) { return ""; } - return str.substr(min,max); + return str.substr(min,max-min); } std::string CutText(std::string text, int width, const cFont *font) { |