mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 15:01:48 +02:00
Fixed display groupname in cChannelGroupGrid::DrawHorizontal
This commit is contained in:
parent
5870b1ae4c
commit
52c41ff5af
@ -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();
|
||||
|
3
tools.c
3
tools.c
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user