Version 1.2.0pre

This commit is contained in:
louis 2013-12-21 11:25:03 +01:00
parent 8aa2c81d31
commit 4c61104675
142 changed files with 2555 additions and 914 deletions

10
HISTORY
View File

@ -69,3 +69,13 @@ VDR Plugin 'tvguide' Revision History
Version 1.1.0 Version 1.1.0
- changed build system - changed build system
- introduced image caching
- introduced new "graphical" style
- added new graphical default theme and theme darkred NG corresponding
to nOpacity themes
- using automatically configured nOpacity theme if available
- adapted startup options to nOpacity startup options:
-e epgimages directory
-i icons directory
-l logo directory
- changed detailed epg view using full screen, some further optimisations

View File

@ -54,7 +54,7 @@ LIBS += $(shell pkg-config --libs Magick++)
### The object files (add further files here): ### The object files (add further files here):
OBJS = $(PLUGIN).o channelcolumn.o channelgroup.o channelgroups.o config.o detailview.o dummygrid.o epggrid.o footer.o grid.o headergrid.o imageloader.o osdmanager.o recmanager.o recmenu.o recmenuitem.o recmenumanager.o recmenus.o setup.o statusheader.o styledpixmap.o switchtimer.o timeline.o timer.o tools.o tvguideosd.o OBJS = $(PLUGIN).o channelcolumn.o channelgroup.o channelgroups.o config.o detailview.o dummygrid.o epggrid.o fontmanager.o footer.o geometrymanager.o grid.o headergrid.o imagecache.o imageloader.o imagemagickwrapper.o imagescaler.o osdmanager.o recmanager.o recmenu.o recmenuitem.o recmenumanager.o recmenus.o setup.o statusheader.o styledpixmap.o switchtimer.o timeline.o timer.o tools.o tvguideosd.o
### The main target: ### The main target:

View File

@ -109,11 +109,11 @@ void cChannelColumn::drawGrids() {
} }
int cChannelColumn::getX() { int cChannelColumn::getX() {
return tvguideConfig.timeLineWidth + num*tvguideConfig.colWidth; return geoManager.timeLineWidth + num*geoManager.colWidth;
} }
int cChannelColumn::getY() { int cChannelColumn::getY() {
return tvguideConfig.statusHeaderHeight + tvguideConfig.timeLineHeight + num*tvguideConfig.rowHeight; return geoManager.statusHeaderHeight + geoManager.timeLineHeight + num*geoManager.rowHeight;
} }
cGrid * cChannelColumn::getActive() { cGrid * cChannelColumn::getActive() {

View File

@ -37,35 +37,48 @@ void cChannelGroupGrid::SetBackground() {
void cChannelGroupGrid::SetGeometry(int start, int end) { void cChannelGroupGrid::SetGeometry(int start, int end) {
int x, y, width, height; int x, y, width, height;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
x = tvguideConfig.timeLineWidth + start*tvguideConfig.colWidth; x = geoManager.timeLineWidth + start*geoManager.colWidth;
y = tvguideConfig.statusHeaderHeight; y = geoManager.statusHeaderHeight;
width = (end - start + 1) * tvguideConfig.colWidth; width = (end - start + 1) * geoManager.colWidth;
height = tvguideConfig.channelGroupsHeight; height = geoManager.channelGroupsHeight;
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
x = 0; x = 0;
y = tvguideConfig.statusHeaderHeight + tvguideConfig.timeLineHeight + start*tvguideConfig.rowHeight; y = geoManager.statusHeaderHeight + geoManager.timeLineHeight + start*geoManager.rowHeight;
width = tvguideConfig.channelGroupsWidth; width = geoManager.channelGroupsWidth;
height = (end - start + 1) * tvguideConfig.rowHeight; height = (end - start + 1) * geoManager.rowHeight;
} }
pixmap = osdManager.requestPixmap(1, cRect(x, y, width, height)); pixmap = osdManager.requestPixmap(1, cRect(x, y, width, height));
} }
void cChannelGroupGrid::Draw(void) { void cChannelGroupGrid::Draw(void) {
if (tvguideConfig.style == eStyleGraphical) {
drawBackgroundGraphical(bgChannelGroup);
} else {
drawBackground(); drawBackground();
drawBorder(); drawBorder();
}
tColor colorText = theme.Color(clrFont); tColor colorText = theme.Color(clrFont);
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
int textY = (Height() - tvguideConfig.FontChannelGroups->Height()) / 2; DrawVertical(colorText, colorTextBack);
cString text = CutText(name, Width() - 4, tvguideConfig.FontChannelGroups).c_str();
int textWidth = tvguideConfig.FontChannelGroups->Width(*text);
int x = (Width() - textWidth) / 2;
pixmap->DrawText(cPoint(x, textY), *text, colorText, colorTextBack, tvguideConfig.FontChannelGroups);
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
DrawHorizontal(colorText, colorTextBack);
}
}
void cChannelGroupGrid::DrawVertical(tColor colorText, tColor colorTextBack) {
int textY = (Height() - fontManager.FontChannelGroups->Height()) / 2;
cString text = 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::string nameUpper = name;
std::transform(nameUpper.begin(), nameUpper.end(),nameUpper.begin(), ::toupper); std::transform(nameUpper.begin(), nameUpper.end(),nameUpper.begin(), ::toupper);
int numChars = nameUpper.length(); int numChars = nameUpper.length();
int charHeight = tvguideConfig.FontChannelGroupsHorizontal->Height(); int charHeight = fontManager.FontChannelGroupsHorizontal->Height();
int textHeight = numChars * charHeight; int textHeight = numChars * charHeight;
int y = 5; int y = 5;
if ((textHeight +5) < Height()) { if ((textHeight +5) < Height()) {
@ -73,14 +86,13 @@ void cChannelGroupGrid::Draw(void) {
} }
for (int i=0; i < numChars; i++) { for (int i=0; i < numChars; i++) {
if (((y + 2*charHeight) > Height()) && ((i+1)<numChars)) { if (((y + 2*charHeight) > Height()) && ((i+1)<numChars)) {
int x = (Width() - tvguideConfig.FontChannelGroupsHorizontal->Width("...")) / 2; int x = (Width() - fontManager.FontChannelGroupsHorizontal->Width("...")) / 2;
pixmap->DrawText(cPoint(x, y), "...", colorText, colorTextBack, tvguideConfig.FontChannelGroupsHorizontal); pixmap->DrawText(cPoint(x, y), "...", colorText, colorTextBack, fontManager.FontChannelGroupsHorizontal);
break; break;
} }
cString currentChar = cString::sprintf("%c", nameUpper.at(i)); cString currentChar = cString::sprintf("%c", nameUpper.at(i));
int x = (Width() - tvguideConfig.FontChannelGroupsHorizontal->Width(*currentChar)) / 2; int x = (Width() - fontManager.FontChannelGroupsHorizontal->Width(*currentChar)) / 2;
pixmap->DrawText(cPoint(x, y), *currentChar, colorText, colorTextBack, tvguideConfig.FontChannelGroupsHorizontal); pixmap->DrawText(cPoint(x, y), *currentChar, colorText, colorTextBack, fontManager.FontChannelGroupsHorizontal);
y += tvguideConfig.FontChannelGroupsHorizontal->Height(); y += fontManager.FontChannelGroupsHorizontal->Height();
}
} }
} }

View File

@ -29,6 +29,8 @@ class cChannelGroupGrid : public cListObject, public cStyledPixmap {
private: private:
const char *name; const char *name;
bool isColor1; bool isColor1;
void DrawHorizontal(tColor colorText, tColor colorTextBack);
void DrawVertical(tColor colorText, tColor colorTextBack);
public: public:
cChannelGroupGrid(const char *name); cChannelGroupGrid(const char *name);
virtual ~cChannelGroupGrid(void); virtual ~cChannelGroupGrid(void);

250
config.c
View File

@ -1,25 +1,21 @@
#include <string>
#include "config.h" #include "config.h"
cTvguideConfig::cTvguideConfig() { cTvguideConfig::cTvguideConfig() {
debugImageLoading = 0;
showMainMenuEntry = 1; showMainMenuEntry = 1;
replaceOriginalSchedule = 0; replaceOriginalSchedule = 0;
osdWidth = 0;
osdHeight = 0;
displayMode = eHorizontal; displayMode = eHorizontal;
showTimeInGrid = 1; showTimeInGrid = 1;
colWidth = 0;
rowHeight = 0;
channelCols = 5; channelCols = 5;
channelRows = 10; channelRows = 10;
displayTime = 160; displayTime = 160;
minutePixel = 0;
displayStatusHeader = 1; displayStatusHeader = 1;
displayChannelGroups = 1; displayChannelGroups = 1;
statusHeaderPercent = 20; statusHeaderPercent = 20;
statusHeaderHeight = 0;
channelGroupsPercent = 5; channelGroupsPercent = 5;
channelGroupsWidth = 0; epgViewHeaderPercent = 25;
channelGroupsHeight = 0; epgViewBorder = 50;
scaleVideo = 1; scaleVideo = 1;
decorateVideo = 1; decorateVideo = 1;
timeLineWidthPercent = 8; timeLineWidthPercent = 8;
@ -27,7 +23,7 @@ cTvguideConfig::cTvguideConfig() {
displayChannelName = 1; displayChannelName = 1;
channelHeaderWidthPercent = 20; channelHeaderWidthPercent = 20;
channelHeaderHeightPercent = 15; channelHeaderHeightPercent = 15;
footerHeight = 80; footerHeightPercent = 7;
stepMinutes = 30; stepMinutes = 30;
bigStepHours = 3; bigStepHours = 3;
hugeStepHours = 24; hugeStepHours = 24;
@ -73,178 +69,147 @@ cTvguideConfig::cTvguideConfig() {
FontTimeLineTimeHorizontalDelta = 0; FontTimeLineTimeHorizontalDelta = 0;
FontRecMenuItemDelta = 0; FontRecMenuItemDelta = 0;
FontRecMenuItemSmallDelta = 0; FontRecMenuItemSmallDelta = 0;
//Common Fonts
FontButton = NULL;
FontDetailView = NULL;
FontDetailHeader = NULL;
FontMessageBox = NULL;
FontMessageBoxLarge = NULL;
FontStatusHeader = NULL;
FontStatusHeaderLarge = NULL;
//Fonts for vertical Display
FontChannelHeader = NULL;
FontGrid = NULL;
FontGridSmall = NULL;
FontTimeLineWeekday = NULL;
FontTimeLineDate = NULL;
FontTimeLineTime = NULL;
//Fonts for horizontal Display
FontChannelHeaderHorizontal = NULL;
FontGridHorizontal = NULL;
FontGridHorizontalSmall = NULL;
FontTimeLineDateHorizontal = NULL;
FontTimeLineTimeHorizontal = NULL;
//Fonts for RecMenu
FontRecMenuItem = NULL;
FontRecMenuItemSmall = NULL;
timeFormat = 1; timeFormat = 1;
themeIndex = 4; useNopacityTheme = 1;
useBlending = 2; themeIndex = -1;
themeIndexCurrent = -1;
themeName = "";
nOpacityTheme = "";
style = eStyleBlendingDefault;
roundedCorners = 0; roundedCorners = 0;
displayRerunsDetailEPGView = 1; displayRerunsDetailEPGView = 1;
numReruns = 5; numReruns = 5;
useSubtitleRerun = 1; useSubtitleRerun = 1;
numLogosInitial = 30;
numLogosMax = 50;
limitLogoCache = 1;
logoPathSet = false;
imagesPathSet = false;
iconsPathSet = false;
} }
cTvguideConfig::~cTvguideConfig() { cTvguideConfig::~cTvguideConfig() {
delete FontButton;
delete FontDetailView;
delete FontDetailViewSmall;
delete FontDetailHeader;
delete FontMessageBox;
delete FontMessageBoxLarge;
delete FontStatusHeader;
delete FontStatusHeaderLarge;
delete FontChannelHeader;
delete FontChannelGroups;
delete FontGrid;
delete FontGridSmall;
delete FontTimeLineWeekday;
delete FontTimeLineDate;
delete FontTimeLineTime;
delete FontChannelHeaderHorizontal;
delete FontChannelGroupsHorizontal;
delete FontGridHorizontal;
delete FontGridHorizontalSmall;
delete FontTimeLineDateHorizontal;
delete FontTimeLineTimeHorizontal;
delete FontRecMenuItem;
delete FontRecMenuItemSmall;
}
void cTvguideConfig::setDynamicValues(int width, int height) {
SetGeometry(width, height);
SetFonts();
}
void cTvguideConfig::SetGeometry(int width, int height) {
osdWidth = width;
osdHeight = height;
statusHeaderHeight = (displayStatusHeader)?(statusHeaderPercent * osdHeight / 100):0;
channelGroupsWidth = (displayChannelGroups)?(channelGroupsPercent * osdWidth / 100):0;
channelGroupsHeight = (displayChannelGroups)?(channelGroupsPercent * osdHeight / 100):0;
channelHeaderWidth = channelHeaderWidthPercent * osdWidth / 100;
channelHeaderHeight = channelHeaderHeightPercent * osdHeight / 100;
timeLineWidth = timeLineWidthPercent * osdWidth / 100;
timeLineHeight = timeLineHeightPercent * osdHeight / 100;
if (displayMode == eVertical) {
colWidth = (osdWidth - timeLineWidth) / channelCols;
rowHeight = 0;
minutePixel = (osdHeight - statusHeaderHeight - channelGroupsHeight - channelHeaderHeight - footerHeight) / displayTime;
} else if (displayMode == eHorizontal) {
colWidth = 0;
rowHeight = (osdHeight - statusHeaderHeight - timeLineHeight - footerHeight) / channelRows;
minutePixel = (osdWidth - channelHeaderWidth - channelGroupsWidth) / displayTime;
} }
void cTvguideConfig::setDynamicValues() {
numGrids = (displayMode == eVertical)?channelCols:channelRows; numGrids = (displayMode == eVertical)?channelCols:channelRows;
jumpChannels = numGrids; jumpChannels = numGrids;
} }
void cTvguideConfig::SetFonts(void){ bool cTvguideConfig::LoadTheme() {
cString fontname; //is correct theme already loaded?
if (fontIndex == 0) { if (nOpacityTheme.size() == 0)
fontname = fontNameDefault; nOpacityTheme = Setup.OSDTheme;
if ((themeIndex > -1) && (themeIndex == themeIndexCurrent)) {
if (!nOpacityTheme.compare(Setup.OSDTheme)) {
return false;
} else { } else {
cStringList availableFonts; nOpacityTheme = Setup.OSDTheme;
cFont::GetAvailableFontNames(&availableFonts);
if (availableFonts[fontIndex-1]) {
fontname = availableFonts[fontIndex-1];
} else
fontname = fontNameDefault;
} }
cFont *test = NULL;
test = cFont::CreateFont(*fontname, 30);
if (!test) {
fontname = DefaultFontSml;
} }
delete test; //Load available Themes
cThemes themes;
themes.Load(*cString("tvguide"));
int numThemesAvailable = themes.NumThemes();
//Common Fonts //Check for nOpacity Theme
FontButton = cFont::CreateFont(*fontname, footerHeight/3 + 4 + FontButtonDelta); if (useNopacityTheme) {
FontDetailView = cFont::CreateFont(*fontname, osdHeight/30 + FontDetailViewDelta); std::string nOpacity = "nOpacity";
FontDetailViewSmall = cFont::CreateFont(*fontname, osdHeight/40 + FontDetailViewSmallDelta); std::string currentSkin = Setup.OSDSkin;
FontDetailHeader = cFont::CreateFont(*fontname, osdHeight/25 + FontDetailHeaderDelta); std::string currentSkinTheme = Setup.OSDTheme;
FontMessageBox = cFont::CreateFont(*fontname, osdHeight/33 + FontMessageBoxDelta); if (!currentSkin.compare(nOpacity)) {
FontMessageBoxLarge = cFont::CreateFont(*fontname, osdHeight/30 + FontMessageBoxLargeDelta); for (int curThemeIndex = 0; curThemeIndex < numThemesAvailable; curThemeIndex++) {
FontStatusHeader = cFont::CreateFont(*fontname, statusHeaderHeight/6 - 4 + FontStatusHeaderDelta); std::string curThemeName = themes.Name(curThemeIndex);
FontStatusHeaderLarge = cFont::CreateFont(*fontname, statusHeaderHeight/5 + FontStatusHeaderLargeDelta); if (!curThemeName.compare(currentSkinTheme)) {
//Fonts for vertical Display themeIndex = curThemeIndex;
FontChannelHeader = cFont::CreateFont(*fontname, colWidth/10 + FontChannelHeaderDelta); break;
FontChannelGroups = cFont::CreateFont(*fontname, colWidth/8 + FontChannelGroupsDelta); }
FontGrid = cFont::CreateFont(*fontname, colWidth/12 + FontGridDelta); }
FontGridSmall = cFont::CreateFont(*fontname, colWidth/12 + FontGridSmallDelta); }
FontTimeLineWeekday = cFont::CreateFont(*fontname, timeLineWidth/3 + FontTimeLineWeekdayDelta);
FontTimeLineDate = cFont::CreateFont(*fontname, timeLineWidth/4 + FontTimeLineDateDelta);
FontTimeLineTime = cFont::CreateFont(*fontname, timeLineWidth/4 + FontTimeLineTimeDelta);
//Fonts for horizontal Display
FontChannelHeaderHorizontal = cFont::CreateFont(*fontname, rowHeight/3 + FontChannelHeaderHorizontalDelta);
FontChannelGroupsHorizontal = cFont::CreateFont(*fontname, rowHeight/3 + 5 + FontChannelGroupsHorizontalDelta);
FontGridHorizontal = cFont::CreateFont(*fontname, rowHeight/3 + 5 + FontGridHorizontalDelta);
FontGridHorizontalSmall = cFont::CreateFont(*fontname, rowHeight/4 + FontGridHorizontalSmallDelta);
FontTimeLineDateHorizontal = cFont::CreateFont(*fontname, timeLineHeight/2 + 5 + FontTimeLineDateHorizontalDelta);
FontTimeLineTimeHorizontal = cFont::CreateFont(*fontname, timeLineHeight/2 + FontTimeLineTimeHorizontalDelta);
//Fonts for RecMenu
FontRecMenuItem = cFont::CreateFont(*fontname, osdHeight/30 + FontRecMenuItemDelta);
FontRecMenuItemSmall = cFont::CreateFont(*fontname, osdHeight/40 + FontRecMenuItemSmallDelta);
} }
void cTvguideConfig::SetBlending(void) { if (themeIndex == -1) {
if (theme.Color(clrDoBlending) == CLR_BLENDING_OFF) { for (int curThemeIndex = 0; curThemeIndex < numThemesAvailable; curThemeIndex++) {
useBlending = 0; std::string curThemeName = themes.Name(curThemeIndex);
} else if (theme.Color(clrDoBlending) == CLR_BLENDING_DEFAULT) if (!curThemeName.compare("default")) {
useBlending = 1; themeIndex = curThemeIndex;
else { break;
useBlending = 2;
} }
} }
}
if (themeIndex == -1)
themeIndex = 0;
themeIndexCurrent = themeIndex;
const char *themePath = themes.FileName(themeIndex);
if (access(themePath, F_OK) == 0) {
::theme.Load(themePath);
themeName = themes.Name(themeIndex);
}
esyslog("tvguide: set Theme to %s", *themeName);
return true;
}
void cTvguideConfig::SetStyle(void) {
if (theme.Color(clrStyle) == CLR_STYLE_FLAT) {
style = eStyleFlat;
esyslog("tvguide: set flat style");
} else if (theme.Color(clrStyle) == CLR_STYLE_BLENDING_DEFAULT) {
style = eStyleBlendingDefault;
esyslog("tvguide: set blending style");
} else if (theme.Color(clrStyle) == CLR_STYLE_GRAPHICAL) {
style = eStyleGraphical;
esyslog("tvguide: set graphical style");
} else {
style = eStyleBlendingMagick;
esyslog("tvguide: set magick blending style");
}
}
void cTvguideConfig::SetLogoPath(cString path) { void cTvguideConfig::SetLogoPath(cString path) {
logoPath = path; logoPath = path;
logoPathSet = true;
esyslog("tvguide: Logo Path set to %s", *logoPath);
} }
void cTvguideConfig::SetImagesPath(cString path) { void cTvguideConfig::SetImagesPath(cString path) {
epgImagePath = path; epgImagePath = path;
imagesPathSet = true;
esyslog("tvguide: EPG Image Path set to %s", *epgImagePath);
} }
void cTvguideConfig::SetIconsPath(cString path) { void cTvguideConfig::SetIconsPath(cString path) {
iconPath = path; iconPath = path;
iconsPathSet = true;
esyslog("tvguide: Icon Path set to %s", *iconPath);
} }
void cTvguideConfig::loadTheme() { void cTvguideConfig::SetDefaultPathes(void) {
cThemes themes; if (!logoPathSet) {
themes.Load(*cString("tvguide")); cString path = cString::sprintf("%s/channellogos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
const char *FileName = themes.FileName(themeIndex); SetLogoPath(path);
if (access(FileName, F_OK) == 0) { }
::theme.Load(FileName); if (!imagesPathSet) {
cString path = cString::sprintf("%s/epgimages/", cPlugin::CacheDirectory(PLUGIN_NAME_I18N));
SetImagesPath(path);
}
if (!iconsPathSet) {
cString path = cString::sprintf("%s/icons/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
SetIconsPath(path);
} }
} }
bool cTvguideConfig::SetupParse(const char *Name, const char *Value) { bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
if (strcmp(Name, "timeFormat") == 0) timeFormat = atoi(Value); if (strcmp(Name, "timeFormat") == 0) timeFormat = atoi(Value);
else if (strcmp(Name, "debugImageLoading") == 0) debugImageLoading = atoi(Value);
else if (strcmp(Name, "showMainMenuEntry") == 0) showMainMenuEntry = atoi(Value); else if (strcmp(Name, "showMainMenuEntry") == 0) showMainMenuEntry = atoi(Value);
else if (strcmp(Name, "replaceOriginalSchedule") == 0) replaceOriginalSchedule = atoi(Value); else if (strcmp(Name, "replaceOriginalSchedule") == 0) replaceOriginalSchedule = atoi(Value);
else if (strcmp(Name, "useNopacityTheme") == 0) useNopacityTheme = atoi(Value);
else if (strcmp(Name, "themeIndex") == 0) themeIndex = atoi(Value); else if (strcmp(Name, "themeIndex") == 0) themeIndex = atoi(Value);
else if (strcmp(Name, "displayMode") == 0) displayMode = atoi(Value); else if (strcmp(Name, "displayMode") == 0) displayMode = atoi(Value);
else if (strcmp(Name, "showTimeInGrid") == 0) showTimeInGrid = atoi(Value); else if (strcmp(Name, "showTimeInGrid") == 0) showTimeInGrid = atoi(Value);
@ -252,6 +217,8 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "displayChannelGroups") == 0) displayChannelGroups = atoi(Value); else if (strcmp(Name, "displayChannelGroups") == 0) displayChannelGroups = atoi(Value);
else if (strcmp(Name, "statusHeaderPercent") == 0) statusHeaderPercent = atoi(Value); else if (strcmp(Name, "statusHeaderPercent") == 0) statusHeaderPercent = atoi(Value);
else if (strcmp(Name, "channelGroupsPercent") == 0) channelGroupsPercent = atoi(Value); else if (strcmp(Name, "channelGroupsPercent") == 0) channelGroupsPercent = atoi(Value);
else if (strcmp(Name, "epgViewHeaderPercent") == 0) epgViewHeaderPercent = atoi(Value);
else if (strcmp(Name, "epgViewBorder") == 0) epgViewBorder = atoi(Value);
else if (strcmp(Name, "scaleVideo") == 0) scaleVideo = atoi(Value); else if (strcmp(Name, "scaleVideo") == 0) scaleVideo = atoi(Value);
else if (strcmp(Name, "decorateVideo") == 0) decorateVideo = atoi(Value); else if (strcmp(Name, "decorateVideo") == 0) decorateVideo = atoi(Value);
else if (strcmp(Name, "roundedCorners") == 0) roundedCorners = atoi(Value); else if (strcmp(Name, "roundedCorners") == 0) roundedCorners = atoi(Value);
@ -280,7 +247,7 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "displayChannelName") == 0) displayChannelName = atoi(Value); else if (strcmp(Name, "displayChannelName") == 0) displayChannelName = atoi(Value);
else if (strcmp(Name, "channelHeaderWidthPercent") == 0) channelHeaderWidthPercent = atoi(Value); else if (strcmp(Name, "channelHeaderWidthPercent") == 0) channelHeaderWidthPercent = atoi(Value);
else if (strcmp(Name, "channelHeaderHeightPercent") == 0) channelHeaderHeightPercent = atoi(Value); else if (strcmp(Name, "channelHeaderHeightPercent") == 0) channelHeaderHeightPercent = atoi(Value);
else if (strcmp(Name, "footerHeight") == 0) footerHeight = atoi(Value); else if (strcmp(Name, "footerHeightPercent") == 0) footerHeightPercent = atoi(Value);
else if (strcmp(Name, "recMenuAskFolder") == 0) recMenuAskFolder = atoi(Value); else if (strcmp(Name, "recMenuAskFolder") == 0) recMenuAskFolder = atoi(Value);
else if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value); else if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value);
else if (strcmp(Name, "FontButtonDelta") == 0) FontButtonDelta = atoi(Value); else if (strcmp(Name, "FontButtonDelta") == 0) FontButtonDelta = atoi(Value);
@ -308,6 +275,9 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "displayRerunsDetailEPGView") == 0) displayRerunsDetailEPGView = atoi(Value); else if (strcmp(Name, "displayRerunsDetailEPGView") == 0) displayRerunsDetailEPGView = atoi(Value);
else if (strcmp(Name, "numReruns") == 0) numReruns = atoi(Value); else if (strcmp(Name, "numReruns") == 0) numReruns = atoi(Value);
else if (strcmp(Name, "useSubtitleRerun") == 0) useSubtitleRerun = atoi(Value); else if (strcmp(Name, "useSubtitleRerun") == 0) useSubtitleRerun = atoi(Value);
else if (strcmp(Name, "numLogosInitial") == 0) numLogosInitial = atoi(Value);
else if (strcmp(Name, "numLogosMax") == 0) numLogosMax = atoi(Value);
else if (strcmp(Name, "limitLogoCache") == 0) limitLogoCache = atoi(Value);
else return false; else return false;
return true; return true;
} }

144
config.h
View File

@ -4,6 +4,9 @@
#include <vdr/themes.h> #include <vdr/themes.h>
#include <vdr/plugin.h> #include <vdr/plugin.h>
#include "osdmanager.h" #include "osdmanager.h"
#include "geometrymanager.h"
#include "fontmanager.h"
#include "imagecache.h"
enum { enum {
e12Hours, e12Hours,
@ -20,49 +23,41 @@ enum {
eGroupJump eGroupJump
}; };
enum {
eStyleGraphical,
eStyleBlendingMagick,
eStyleBlendingDefault,
eStyleFlat
};
class cTvguideConfig { class cTvguideConfig {
private: private:
void SetGeometry(int width, int height);
void SetFonts(void);
public: public:
cTvguideConfig(); cTvguideConfig();
~cTvguideConfig(); ~cTvguideConfig();
void SetLogoPath(cString path); int debugImageLoading;
void SetImagesPath(cString path);
void SetIconsPath(cString path);
void SetBlending(void);
int showMainMenuEntry; int showMainMenuEntry;
int replaceOriginalSchedule; int replaceOriginalSchedule;
int osdWidth;
int osdHeight;
int displayMode; int displayMode;
int showTimeInGrid; int showTimeInGrid;
int colWidth;
int rowHeight;
int channelCols; int channelCols;
int channelRows; int channelRows;
int numGrids; int numGrids;
int displayTime; int displayTime;
int minutePixel;
int displayStatusHeader; int displayStatusHeader;
int displayChannelGroups; int displayChannelGroups;
int statusHeaderPercent; int statusHeaderPercent;
int statusHeaderHeight;
int channelGroupsPercent; int channelGroupsPercent;
int channelGroupsWidth; int epgViewHeaderPercent;
int channelGroupsHeight; int epgViewBorder;
int scaleVideo; int scaleVideo;
int decorateVideo; int decorateVideo;
int timeLineWidthPercent; int timeLineWidthPercent;
int timeLineHeightPercent; int timeLineHeightPercent;
int timeLineWidth;
int timeLineHeight;
int displayChannelName; int displayChannelName;
int channelHeaderWidthPercent; int channelHeaderWidthPercent;
int channelHeaderHeightPercent; int channelHeaderHeightPercent;
int channelHeaderWidth; int footerHeightPercent;
int channelHeaderHeight;
int footerHeight;
int stepMinutes; int stepMinutes;
int bigStepHours; int bigStepHours;
int hugeStepHours; int hugeStepHours;
@ -111,92 +106,91 @@ class cTvguideConfig {
int FontTimeLineTimeHorizontalDelta; int FontTimeLineTimeHorizontalDelta;
int FontRecMenuItemDelta; int FontRecMenuItemDelta;
int FontRecMenuItemSmallDelta; int FontRecMenuItemSmallDelta;
const cFont *FontChannelHeader;
const cFont *FontChannelHeaderHorizontal;
const cFont *FontChannelGroups;
const cFont *FontChannelGroupsHorizontal;
const cFont *FontStatusHeader;
const cFont *FontStatusHeaderLarge;
const cFont *FontGrid;
const cFont *FontGridSmall;
const cFont *FontGridHorizontal;
const cFont *FontGridHorizontalSmall;
const cFont *FontTimeLineWeekday;
const cFont *FontTimeLineDate;
const cFont *FontTimeLineDateHorizontal;
const cFont *FontTimeLineTime;
const cFont *FontTimeLineTimeHorizontal;
const cFont *FontButton;
const cFont *FontDetailView;
const cFont *FontDetailViewSmall;
const cFont *FontDetailHeader;
const cFont *FontMessageBox;
const cFont *FontMessageBoxLarge;
const cFont *FontRecMenuItem;
const cFont *FontRecMenuItemSmall;
int timeFormat; int timeFormat;
int useNopacityTheme;
int themeIndex; int themeIndex;
int useBlending; int themeIndexCurrent;
cString themeName;
std::string nOpacityTheme;
int style;
int roundedCorners; int roundedCorners;
int displayRerunsDetailEPGView; int displayRerunsDetailEPGView;
int numReruns; int numReruns;
int useSubtitleRerun; int useSubtitleRerun;
void setDynamicValues(int width, int height); int numLogosInitial;
int numLogosMax;
int limitLogoCache;
bool logoPathSet;
bool imagesPathSet;
bool iconsPathSet;
bool LoadTheme();
void SetStyle(void);
void setDynamicValues(void);
void SetLogoPath(cString path);
void SetImagesPath(cString path);
void SetIconsPath(cString path);
void SetDefaultPathes(void);
bool SetupParse(const char *Name, const char *Value); bool SetupParse(const char *Name, const char *Value);
void loadTheme();
}; };
#ifdef DEFINE_CONFIG #ifdef DEFINE_CONFIG
cTvguideConfig tvguideConfig; cTvguideConfig tvguideConfig;
cOsdManager osdManager; cOsdManager osdManager;
cGeometryManager geoManager;
cFontManager fontManager;
cImageCache imgCache;
cTheme theme; cTheme theme;
cPlugin* pRemoteTimers = NULL; cPlugin* pRemoteTimers = NULL;
#else #else
extern cTvguideConfig tvguideConfig; extern cTvguideConfig tvguideConfig;
extern cOsdManager osdManager; extern cOsdManager osdManager;
extern cGeometryManager geoManager;
extern cFontManager fontManager;
extern cImageCache imgCache;
extern cTheme theme; extern cTheme theme;
extern cPlugin* pRemoteTimers; extern cPlugin* pRemoteTimers;
#endif #endif
// --- Theme ------------------------------------------------------------- // --- Theme -------------------------------------------------------------
//BLENDING SETUP //Style SETUP
#define CLR_BLENDING_NOPACITY 0xFFFFFFFF #define CLR_STYLE_BLENDING_MAGICK 0xFFFFFFFF
#define CLR_BLENDING_DEFAULT 0xAAAAAAAA #define CLR_STYLE_BLENDING_DEFAULT 0xAAAAAAAA
#define CLR_BLENDING_OFF 0x00000000 #define CLR_STYLE_GRAPHICAL 0x66666666
#define CLR_STYLE_FLAT 0x00000000
THEME_CLR(theme, clrDoBlending, CLR_BLENDING_DEFAULT); THEME_CLR(theme, clrStyle, CLR_STYLE_BLENDING_DEFAULT);
THEME_CLR(theme, clrBackgroundOSD, clrBlack); THEME_CLR(theme, clrBackgroundOSD, 0xB012273f);
THEME_CLR(theme, clrBackground, clrBlack); THEME_CLR(theme, clrBackground, 0xB012273f);
THEME_CLR(theme, clrGrid1, 0xFF404749); THEME_CLR(theme, clrGrid1, 0x00000000);
THEME_CLR(theme, clrGrid1Blending, 0xFF000000); THEME_CLR(theme, clrGrid1Blending, 0x00000000);
THEME_CLR(theme, clrGrid2, 0xFF20293F); THEME_CLR(theme, clrGrid2, 0x00000000);
THEME_CLR(theme, clrGrid2Blending, 0xFF000000); THEME_CLR(theme, clrGrid2Blending, 0x00000000);
THEME_CLR(theme, clrHighlight, 0xFFFF4D00); THEME_CLR(theme, clrHighlight, 0xAA3A3A55);
THEME_CLR(theme, clrHighlightBlending, 0xFF000000); THEME_CLR(theme, clrHighlightBlending, 0xDD000000);
THEME_CLR(theme, clrFont, clrWhite); THEME_CLR(theme, clrFont, clrWhite);
THEME_CLR(theme, clrFontActive, clrWhite); THEME_CLR(theme, clrFontActive, 0xFF363636);
THEME_CLR(theme, clrFontHeader, clrWhite); THEME_CLR(theme, clrFontHeader, 0xFF363636);
THEME_CLR(theme, clrFontButtons, clrWhite); THEME_CLR(theme, clrFontButtons, clrWhite);
THEME_CLR(theme, clrStatusHeader, clrBlack); THEME_CLR(theme, clrStatusHeader, 0x00000000);
THEME_CLR(theme, clrStatusHeaderBlending, clrBlack); THEME_CLR(theme, clrStatusHeaderBlending, 0x00000000);
THEME_CLR(theme, clrHeader, clrBlack); THEME_CLR(theme, clrHeader, 0x00000000);
THEME_CLR(theme, clrHeaderBlending, 0xFFE0E0E0); THEME_CLR(theme, clrHeaderBlending, 0x00000000);
THEME_CLR(theme, clrBorder, clrWhite); THEME_CLR(theme, clrBorder, 0x00000000);
THEME_CLR(theme, clrTimeline1, clrWhite); THEME_CLR(theme, clrTimeline1, clrWhite);
THEME_CLR(theme, clrTimeline1Blending, 0xFF828282); THEME_CLR(theme, clrTimeline1Blending, 0xFF828282);
THEME_CLR(theme, clrTimeline2, clrBlack); THEME_CLR(theme, clrTimeline2, clrBlack);
THEME_CLR(theme, clrTimeline2Blending, 0xFF3F3F3F); THEME_CLR(theme, clrTimeline2Blending, 0xFF3F3F3F);
THEME_CLR(theme, clrButtonRed, 0x99BB0000); THEME_CLR(theme, clrButtonRed, 0x00000000);
THEME_CLR(theme, clrButtonRedBorder, 0xFFBB0000); THEME_CLR(theme, clrButtonRedBorder, 0x00000000);
THEME_CLR(theme, clrButtonGreen, 0x9900BB00); THEME_CLR(theme, clrButtonGreen, 0x00000000);
THEME_CLR(theme, clrButtonGreenBorder, 0xFF00BB00); THEME_CLR(theme, clrButtonGreenBorder, 0x00000000);
THEME_CLR(theme, clrButtonYellow, 0x99BBBB00); THEME_CLR(theme, clrButtonYellow, 0x00000000);
THEME_CLR(theme, clrButtonYellowBorder, 0xFFBBBB00); THEME_CLR(theme, clrButtonYellowBorder, 0x00000000);
THEME_CLR(theme, clrButtonBlue, 0x990000BB); THEME_CLR(theme, clrButtonBlue, 0x00000000);
THEME_CLR(theme, clrButtonBlueBorder, 0xFF0000BB); THEME_CLR(theme, clrButtonBlueBorder, 0x00000000);
THEME_CLR(theme, clrButtonBlend, 0xDD000000); THEME_CLR(theme, clrButtonBlend, 0xDD000000);
THEME_CLR(theme, clrRecMenuBackground, 0xB0000000); THEME_CLR(theme, clrRecMenuBackground, 0xAA000000);
THEME_CLR(theme, clrRecMenuTimerConflictBackground, 0xFFCCCCCC); THEME_CLR(theme, clrRecMenuTimerConflictBackground, 0xFFCCCCCC);
THEME_CLR(theme, clrRecMenuTimerConflictBar, 0xFF222222); THEME_CLR(theme, clrRecMenuTimerConflictBar, 0xFF222222);
THEME_CLR(theme, clrRecMenuTimerConflictOverlap, 0xAAFF0000); THEME_CLR(theme, clrRecMenuTimerConflictOverlap, 0xAAFF0000);
@ -207,7 +201,7 @@ THEME_CLR(theme, clrRecMenuTextBack, 0xFF000000);
THEME_CLR(theme, clrRecMenuTextActiveBack, 0xFF404749); THEME_CLR(theme, clrRecMenuTextActiveBack, 0xFF404749);
THEME_CLR(theme, clrRecMenuKeyboardBack, 0xFF000000); THEME_CLR(theme, clrRecMenuKeyboardBack, 0xFF000000);
THEME_CLR(theme, clrRecMenuKeyboardBorder, clrWhite); THEME_CLR(theme, clrRecMenuKeyboardBorder, clrWhite);
THEME_CLR(theme, clrRecMenuKeyboardHigh, 0x55FFFFFF); THEME_CLR(theme, clrRecMenuKeyboardHigh, 0x40BB0000);
THEME_CLR(theme, clrButtonRedKeyboard, 0xFFBB0000); THEME_CLR(theme, clrButtonRedKeyboard, 0xFFBB0000);
THEME_CLR(theme, clrButtonGreenKeyboard, 0xFF00BB00); THEME_CLR(theme, clrButtonGreenKeyboard, 0xFF00BB00);
THEME_CLR(theme, clrButtonYellowKeyboard, 0xFFBBBB00); THEME_CLR(theme, clrButtonYellowKeyboard, 0xFFBBBB00);

View File

@ -1,6 +1,7 @@
#include <sstream> #include <sstream>
#include <vdr/plugin.h> #include <vdr/plugin.h>
#include "imageloader.h" #include "imageloader.h"
#include "imagecache.h"
#include "services/epgsearch.h" #include "services/epgsearch.h"
#include "services/remotetimers.h" #include "services/remotetimers.h"
#include "config.h" #include "config.h"
@ -10,16 +11,14 @@
cDetailView::cDetailView(const cEvent *event) { cDetailView::cDetailView(const cEvent *event) {
this->event = event; this->event = event;
imgScrollBar = NULL; imgScrollBar = NULL;
borderWidth = 20; //px, border around window border = tvguideConfig.epgViewBorder; //px, border in view window
border = 10; //px, border in view window
scrollBarWidth = 40; scrollBarWidth = 40;
headerHeight = max (40 + 3 * tvguideConfig.FontDetailHeader->Height(), // border + 3 Lines headerHeight = geoManager.epgViewHeaderHeight;
40 + tvguideConfig.epgImageHeight);
pixmapPoster = NULL; pixmapPoster = NULL;
width = tvguideConfig.osdWidth-2*borderWidth; width = geoManager.osdWidth;
contentWidth = width - scrollBarWidth; contentWidth = width - scrollBarWidth;
contentX = borderWidth; contentX = 0;
contentHeight = tvguideConfig.osdHeight-2*borderWidth-headerHeight; contentHeight = geoManager.osdHeight - headerHeight;
widthPoster = 30 * contentWidth / 100; widthPoster = 30 * contentWidth / 100;
} }
@ -27,6 +26,7 @@ cDetailView::~cDetailView(void){
Cancel(-1); Cancel(-1);
while (Active()) while (Active())
cCondWait::SleepMs(10); cCondWait::SleepMs(10);
osdManager.releasePixmap(back);
delete header; delete header;
header = NULL; header = NULL;
osdManager.releasePixmap(headerLogo); osdManager.releasePixmap(headerLogo);
@ -61,7 +61,7 @@ void cDetailView::setContent() {
contentX += widthPoster; contentX += widthPoster;
} }
} }
description.Set(event->Description(), tvguideConfig.FontDetailView, contentWidth - scrollBarWidth - 2*border); description.Set(event->Description(), fontManager.FontDetailView, contentWidth - scrollBarWidth - 2*border);
if (tvguideConfig.displayRerunsDetailEPGView) { if (tvguideConfig.displayRerunsDetailEPGView) {
loadReruns(); loadReruns();
} }
@ -71,7 +71,7 @@ void cDetailView::setContent() {
} }
bool cDetailView::setContentDrawportHeight() { bool cDetailView::setContentDrawportHeight() {
int lineHeight = tvguideConfig.FontDetailView->Height(); int lineHeight = fontManager.FontDetailView->Height();
//Height of banner (only for series) //Height of banner (only for series)
int heightBanner = 0; int heightBanner = 0;
if (hasAdditionalMedia && (mediaInfo.type == typeSeries)) { if (hasAdditionalMedia && (mediaInfo.type == typeSeries)) {
@ -82,7 +82,7 @@ bool cDetailView::setContentDrawportHeight() {
//Height of rerun information //Height of rerun information
int heightReruns = 0; int heightReruns = 0;
if (tvguideConfig.displayRerunsDetailEPGView) { if (tvguideConfig.displayRerunsDetailEPGView) {
heightReruns = reruns.Lines() * lineHeight; heightReruns = (reruns.Lines()+1) * lineHeight;
} }
//Height of actor pictures //Height of actor pictures
int heightActors = 0; int heightActors = 0;
@ -100,14 +100,14 @@ bool cDetailView::setContentDrawportHeight() {
heightEpgPics = heightEPGPics(); heightEpgPics = heightEPGPics();
} }
yBanner = lineHeight; yBanner = border;
yEPGText = heightBanner; yEPGText = yBanner + heightBanner;
yActors = heightBanner + heightEPG; yAddInf = yEPGText + heightEPG;
yFanart = heightBanner + heightEPG + heightActors; yActors = yAddInf + heightReruns;
yAddInf = heightBanner + heightEPG + heightActors + heightFanart; yFanart = yActors + heightActors;
yEPGPics = heightBanner + heightEPG + heightActors + heightFanart + heightReruns; yEPGPics = yAddInf + heightFanart;
int totalHeight = heightBanner + heightEPG + heightActors + heightFanart + heightReruns + heightEpgPics; int totalHeight = heightBanner + heightEPG + heightReruns + heightActors + heightFanart + heightEpgPics + lineHeight;
//check if pixmap content has to be scrollable //check if pixmap content has to be scrollable
if (totalHeight > contentHeight) { if (totalHeight > contentHeight) {
heightContent = totalHeight; heightContent = totalHeight;
@ -120,58 +120,80 @@ bool cDetailView::setContentDrawportHeight() {
} }
void cDetailView::createPixmaps() { void cDetailView::createPixmaps() {
header = new cStyledPixmap(osdManager.requestPixmap(5, cRect(borderWidth, borderWidth, width, headerHeight), cRect::Null)); back = osdManager.requestPixmap(3, cRect(0, 0, geoManager.osdWidth, geoManager.osdHeight), cRect::Null);
headerLogo = osdManager.requestPixmap(6, cRect(borderWidth, borderWidth, width, headerHeight), cRect::Null); back->Fill(clrBlack);
header = new cStyledPixmap(osdManager.requestPixmap(5, cRect(0, 0, width, headerHeight), cRect::Null));
headerLogo = osdManager.requestPixmap(6, cRect(0, 0, width, headerHeight), cRect::Null);
headerLogo->Fill(clrTransparent); headerLogo->Fill(clrTransparent);
headerBack = osdManager.requestPixmap(4, cRect(borderWidth, borderWidth, width, headerHeight), cRect::Null); headerBack = osdManager.requestPixmap(4, cRect(0, 0, width, headerHeight), cRect::Null);
headerBack->Fill(clrBlack); headerBack->Fill(clrBlack);
header->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending)); header->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
content = osdManager.requestPixmap(5, cRect(contentX, borderWidth + headerHeight, contentWidth, contentHeight), content = osdManager.requestPixmap(5, cRect(contentX, headerHeight, contentWidth, contentHeight),
cRect(0,0, contentWidth, max(heightContent, contentHeight))); cRect(0,0, contentWidth, max(heightContent, contentHeight)));
if (hasAdditionalMedia) { if (hasAdditionalMedia) {
pixmapPoster = osdManager.requestPixmap(4, cRect(borderWidth, borderWidth + headerHeight, widthPoster, contentHeight)); pixmapPoster = osdManager.requestPixmap(4, cRect(0, 0 + headerHeight, widthPoster, contentHeight));
pixmapPoster->Fill(theme.Color(clrBorder)); pixmapPoster->Fill(theme.Color(clrBorder));
pixmapPoster->DrawRectangle(cRect(2, 0, widthPoster - 2, content->DrawPort().Height()), theme.Color(clrBackground)); pixmapPoster->DrawRectangle(cRect(2, 0, widthPoster - 2, content->DrawPort().Height()), theme.Color(clrBackground));
} }
scrollBar = osdManager.requestPixmap(5, cRect(tvguideConfig.osdWidth-borderWidth-scrollBarWidth, borderWidth + headerHeight, scrollBarWidth, contentHeight)); scrollBar = osdManager.requestPixmap(5, cRect(geoManager.osdWidth - scrollBarWidth, headerHeight, scrollBarWidth, contentHeight));
footer = osdManager.requestPixmap(5, cRect(borderWidth, borderWidth + headerHeight + content->ViewPort().Height(), width, 3)); footer = osdManager.requestPixmap(5, cRect(0, headerHeight + content->ViewPort().Height(), width, 3));
footer->Fill(theme.Color(clrBorder)); footer->Fill(theme.Color(clrBorder));
} }
void cDetailView::drawHeader() { void cDetailView::drawHeader() {
if (tvguideConfig.style == eStyleGraphical) {
header->drawBackgroundGraphical(bgEpgHeader);
} else {
header->drawBackground(); header->drawBackground();
header->drawBoldBorder(); header->drawBoldBorder();
tColor colorTextBack = (tvguideConfig.useBlending==0)?theme.Color(clrHeader):clrTransparent; }
int logoHeight = header->Height() / 2; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?theme.Color(clrHeader):clrTransparent;
int logoHeight = 2 * header->Height() / 3;
int logoWidth = logoHeight * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio; int logoWidth = logoHeight * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio;
int lineHeight = tvguideConfig.FontDetailHeader->Height(); int lineHeight = fontManager.FontDetailHeader->Height();
cImageLoader imgLoader; cImageLoader imgLoader;
bool logoDrawn = false; bool logoDrawn = false;
if (!tvguideConfig.hideChannelLogos) { if (!tvguideConfig.hideChannelLogos) {
cString channelName = Channels.GetByChannelID(event->ChannelID())->Name(); const cChannel *channel = Channels.GetByChannelID(event->ChannelID());
if (imgLoader.LoadLogo(*channelName, logoWidth, logoHeight)) { if (imgLoader.LoadLogo(channel, logoWidth, logoHeight)) {
cImage logo = imgLoader.GetImage(); cImage logo = imgLoader.GetImage();
headerLogo->DrawImage(cPoint(10, (header->Height() - logoHeight)/2), logo); headerLogo->DrawImage(cPoint(10, (header->Height() - logoHeight)/2), logo);
logoDrawn = true; logoDrawn = true;
} }
} }
bool epgImageDrawn = false;
int epgImageWidth = 0;
if (!tvguideConfig.hideEpgImages) { if (!tvguideConfig.hideEpgImages) {
if (imgLoader.LoadEPGImage(event->EventID())) { int epgImageHeight = 3 * headerHeight / 4;
if (tvguideConfig.epgImageHeight > 0)
epgImageWidth = epgImageHeight * tvguideConfig.epgImageWidth / tvguideConfig.epgImageHeight;
if (imgLoader.LoadEPGImage(event->EventID(), epgImageWidth, epgImageHeight)) {
cImage epgImage = imgLoader.GetImage(); cImage epgImage = imgLoader.GetImage();
int epgImageX = header->Width() - 30 - tvguideConfig.epgImageWidth; int epgImageX = header->Width() - border - epgImageWidth;
int epgImageY = (header->Height() - 10 - tvguideConfig.epgImageHeight) / 2; int epgImageY = (header->Height() - epgImageHeight) / 2;
header->DrawRectangle(cRect(epgImageX-2, epgImageY-2, tvguideConfig.epgImageWidth + 4, tvguideConfig.epgImageHeight + 4), theme.Color(clrBorder)); header->DrawRectangle(cRect(epgImageX-2, epgImageY-2, epgImageWidth + 4, epgImageHeight + 4), theme.Color(clrBorder));
header->DrawImage(cPoint(epgImageX, epgImageY), epgImage); header->DrawImage(cPoint(epgImageX, epgImageY), epgImage);
epgImageDrawn = true;
} }
} }
int textX = logoDrawn?(20 + logoWidth):20; int textX = logoDrawn?(border + logoWidth + 5):border;
int textY = (header->Height() - 2*lineHeight)/2; int textY = (header->Height() - 7*lineHeight/2)/2;
header->DrawText(cPoint(textX, textY), event->Title(), theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailHeader); int maxTextWidth = header->Width() - 2 * border;
cString datetime = cString::sprintf("%s, %s - %s (%d min)", *event->GetDateString(), *event->GetTimeString(), *event->GetEndTimeString(), event->Duration()/60); if (logoDrawn)
header->DrawText(cPoint(textX, textY + lineHeight), *datetime, theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailView); maxTextWidth -= logoWidth;
header->DrawText(cPoint(textX, textY + 2 * lineHeight), event->ShortText(), theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailView); if (epgImageDrawn)
maxTextWidth -= epgImageWidth;
std::string title = CutText((event->Title())?event->Title():"", maxTextWidth, fontManager.FontDetailHeader);
header->DrawText(cPoint(textX, textY), title.c_str(), theme.Color(clrFont), colorTextBack, fontManager.FontDetailHeader);
std::string datetime = *cString::sprintf("%s, %s - %s (%d min)", *event->GetDateString(), *event->GetTimeString(), *event->GetEndTimeString(), event->Duration()/60);
datetime = CutText(datetime, maxTextWidth, fontManager.FontDetailView);
textY += 5*lineHeight/4;
header->DrawText(cPoint(textX, textY), datetime.c_str(), theme.Color(clrFont), colorTextBack, fontManager.FontDetailView);
std::string shortText = CutText((event->ShortText())?event->ShortText():"", maxTextWidth, fontManager.FontDetailView);
textY += 5*lineHeight/4;
header->DrawText(cPoint(textX, textY), shortText.c_str(), theme.Color(clrFont), colorTextBack, fontManager.FontDetailView);
eTimerMatch timerMatch=tmNone; eTimerMatch timerMatch=tmNone;
cTimer *ti; cTimer *ti;
@ -192,28 +214,28 @@ void cDetailView::drawHeader() {
void cDetailView::drawRecIcon() { void cDetailView::drawRecIcon() {
cString recIconText(" REC "); cString recIconText(" REC ");
int headerWidth = width; int headerWidth = width;
int widthIcon = tvguideConfig.FontDetailHeader->Width(*recIconText); int widthIcon = fontManager.FontDetailHeader->Width(*recIconText);
int height = tvguideConfig.FontDetailHeader->Height()+10; int height = fontManager.FontDetailHeader->Height()+10;
int posX = headerWidth - widthIcon - 20; int posX = headerWidth - widthIcon - 20;
int posY = 20; int posY = 20;
header->DrawRectangle( cRect(posX, posY, widthIcon, height), theme.Color(clrButtonRed)); header->DrawRectangle( cRect(posX, posY, widthIcon, height), theme.Color(clrButtonRed));
header->DrawText(cPoint(posX, posY+5), *recIconText, theme.Color(clrFont), theme.Color(clrButtonRed), tvguideConfig.FontDetailHeader); header->DrawText(cPoint(posX, posY+5), *recIconText, theme.Color(clrFont), theme.Color(clrButtonRed), fontManager.FontDetailHeader);
} }
void cDetailView::drawContent() { void cDetailView::drawContent() {
content->Fill(theme.Color(clrBorder)); content->Fill(theme.Color(clrBorder));
content->DrawRectangle(cRect(2, 0, content->ViewPort().Width() - 2, content->DrawPort().Height()), theme.Color(clrBackground)); content->DrawRectangle(cRect(2, 0, content->ViewPort().Width() - 2, content->DrawPort().Height()), theme.Color(clrBackground));
tColor colorTextBack = (tvguideConfig.useBlending==0)?theme.Color(clrBackground):clrTransparent; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?theme.Color(clrBackground):clrTransparent;
int textHeight = tvguideConfig.FontDetailView->Height(); int textHeight = fontManager.FontDetailView->Height();
int textLines = description.Lines(); int textLines = description.Lines();
for (int i=0; i<textLines; i++) { for (int i=0; i<textLines; i++) {
content->DrawText(cPoint(border, yEPGText + i*textHeight), description.GetLine(i), theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailView); content->DrawText(cPoint(border, yEPGText + i*textHeight), description.GetLine(i), theme.Color(clrFont), colorTextBack, fontManager.FontDetailView);
} }
if (tvguideConfig.displayRerunsDetailEPGView) { if (tvguideConfig.displayRerunsDetailEPGView) {
textLines = reruns.Lines(); textLines = reruns.Lines();
for (int j=0; j<textLines; j++) { for (int j=0; j<textLines; j++) {
content->DrawText(cPoint(border, yAddInf+ j*textHeight), reruns.GetLine(j), theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailView); content->DrawText(cPoint(border, yAddInf + j*textHeight), reruns.GetLine(j), theme.Color(clrFont), colorTextBack, fontManager.FontDetailView);
} }
} }
} }
@ -269,7 +291,7 @@ void cDetailView::drawScrollbar() {
void cDetailView::scrollUp() { void cDetailView::scrollUp() {
if (contentScrollable) { if (contentScrollable) {
int newDrawportHeight = content->DrawPort().Point().Y() + tvguideConfig.FontDetailView->Height(); int newDrawportHeight = content->DrawPort().Point().Y() + fontManager.FontDetailView->Height();
content->SetDrawPortPoint(cPoint(0, min(newDrawportHeight,0))); content->SetDrawPortPoint(cPoint(0, min(newDrawportHeight,0)));
drawScrollbar(); drawScrollbar();
} }
@ -277,7 +299,7 @@ void cDetailView::scrollUp() {
void cDetailView::scrollDown() { void cDetailView::scrollDown() {
if (contentScrollable) { if (contentScrollable) {
int newDrawportHeight = content->DrawPort().Point().Y() - tvguideConfig.FontDetailView->Height(); int newDrawportHeight = content->DrawPort().Point().Y() - fontManager.FontDetailView->Height();
int maxDrawportHeight = (content->DrawPort().Height() - contentHeight); int maxDrawportHeight = (content->DrawPort().Height() - contentHeight);
content->SetDrawPortPoint(cPoint(0, max(newDrawportHeight,(-1)*maxDrawportHeight))); content->SetDrawPortPoint(cPoint(0, max(newDrawportHeight,(-1)*maxDrawportHeight)));
drawScrollbar(); drawScrollbar();
@ -309,7 +331,7 @@ void cDetailView::pageDown() {
cImage *cDetailView::createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend) { cImage *cDetailView::createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend) {
cImage *image = new cImage(cSize(width, height)); cImage *image = new cImage(cSize(width, height));
image->Fill(clrBgr); image->Fill(clrBgr);
if (tvguideConfig.useBlending) { if (tvguideConfig.style != eStyleFlat) {
int numSteps = 64; int numSteps = 64;
int alphaStep = 0x03; int alphaStep = 0x03;
if (height < 30) if (height < 30)
@ -379,9 +401,9 @@ void cDetailView::loadReruns(void) {
delete list; delete list;
} }
} }
reruns.Set(sstrReruns.str().c_str(), tvguideConfig.FontDetailView, contentWidth - scrollBarWidth - 2*border); reruns.Set(sstrReruns.str().c_str(), fontManager.FontDetailView, contentWidth - scrollBarWidth - 2*border);
} else } else
reruns.Set("", tvguideConfig.FontDetailView, contentWidth - scrollBarWidth); reruns.Set("", fontManager.FontDetailView, contentWidth - scrollBarWidth);
} }
int cDetailView::heightEPGPics(void) { int cDetailView::heightEPGPics(void) {
@ -420,7 +442,7 @@ int cDetailView::heightActorPics(void) {
int picLines = numActors / picsPerLine; int picLines = numActors / picsPerLine;
if (numActors%picsPerLine != 0) if (numActors%picsPerLine != 0)
picLines++; picLines++;
int actorsHeight = picLines * (actorThumbHeight + 2*tvguideConfig.FontDetailViewSmall->Height()) + tvguideConfig.FontDetailView->Height() + tvguideConfig.FontDetailHeader->Height(); int actorsHeight = picLines * (actorThumbHeight + 2*fontManager.FontDetailViewSmall->Height()) + fontManager.FontDetailView->Height() + fontManager.FontDetailHeader->Height();
return actorsHeight; return actorsHeight;
} }
@ -533,17 +555,17 @@ void cDetailView::drawActors(int height) {
int numActors = mediaInfo.actors.size(); int numActors = mediaInfo.actors.size();
if (numActors < 1) if (numActors < 1)
return; return;
tColor colorTextBack = (tvguideConfig.useBlending==0)?theme.Color(clrBackground):clrTransparent; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?theme.Color(clrBackground):clrTransparent;
cString header = cString::sprintf("%s:", tr("Actors")); cString header = cString::sprintf("%s:", tr("Actors"));
content->DrawText(cPoint(border, height), *header, theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailHeader); content->DrawText(cPoint(border, height), *header, theme.Color(clrFont), colorTextBack, fontManager.FontDetailHeader);
int picsPerLine = contentWidth / (actorThumbWidth + 2*border); int picsPerLine = contentWidth / (actorThumbWidth + 2*border);
int picLines = numActors / picsPerLine; int picLines = numActors / picsPerLine;
if (numActors%picsPerLine != 0) if (numActors%picsPerLine != 0)
picLines++; picLines++;
int x = 0; int x = 0;
int y = height + tvguideConfig.FontDetailHeader->Height(); int y = height + fontManager.FontDetailHeader->Height();
if (!Running()) if (!Running())
return; return;
cImageLoader imgLoader; cImageLoader imgLoader;
@ -563,21 +585,21 @@ void cDetailView::drawActors(int height) {
std::stringstream sstrRole; std::stringstream sstrRole;
sstrRole << "\"" << mediaInfo.actors[actor].role << "\""; sstrRole << "\"" << mediaInfo.actors[actor].role << "\"";
std::string role = sstrRole.str(); std::string role = sstrRole.str();
if (tvguideConfig.FontDetailViewSmall->Width(name.c_str()) > actorThumbWidth + 2*border) if (fontManager.FontDetailViewSmall->Width(name.c_str()) > actorThumbWidth + 2*border)
name = CutText(name, actorThumbWidth + 2*border, tvguideConfig.FontDetailViewSmall); name = CutText(name, actorThumbWidth + 2*border, fontManager.FontDetailViewSmall);
if (tvguideConfig.FontDetailViewSmall->Width(role.c_str()) > actorThumbWidth + 2*border) if (fontManager.FontDetailViewSmall->Width(role.c_str()) > actorThumbWidth + 2*border)
role = CutText(role, actorThumbWidth + 2*border, tvguideConfig.FontDetailViewSmall); role = CutText(role, actorThumbWidth + 2*border, fontManager.FontDetailViewSmall);
int xName = x + ((actorThumbWidth+2*border) - tvguideConfig.FontDetailViewSmall->Width(name.c_str()))/2; int xName = x + ((actorThumbWidth+2*border) - fontManager.FontDetailViewSmall->Width(name.c_str()))/2;
int xRole = x + ((actorThumbWidth+2*border) - tvguideConfig.FontDetailViewSmall->Width(role.c_str()))/2; int xRole = x + ((actorThumbWidth+2*border) - fontManager.FontDetailViewSmall->Width(role.c_str()))/2;
if (Running() && content) { if (Running() && content) {
content->DrawText(cPoint(xName, y + actorThumbHeight), name.c_str(), theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailViewSmall); content->DrawText(cPoint(xName, y + actorThumbHeight), name.c_str(), theme.Color(clrFont), colorTextBack, fontManager.FontDetailViewSmall);
content->DrawText(cPoint(xRole, y + actorThumbHeight + tvguideConfig.FontDetailViewSmall->Height()), role.c_str(), theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailViewSmall); content->DrawText(cPoint(xRole, y + actorThumbHeight + fontManager.FontDetailViewSmall->Height()), role.c_str(), theme.Color(clrFont), colorTextBack, fontManager.FontDetailViewSmall);
x += actorThumbWidth + 2*border; x += actorThumbWidth + 2*border;
} }
actor++; actor++;
} }
x = 0; x = 0;
y += actorThumbHeight + 2 * tvguideConfig.FontDetailViewSmall->Height(); y += actorThumbHeight + 2 * fontManager.FontDetailViewSmall->Height();
} }
} }

View File

@ -13,6 +13,7 @@ class cEpgGrid;
class cDetailView : public cThread { class cDetailView : public cThread {
private: private:
cPixmap *back;
cStyledPixmap *header; cStyledPixmap *header;
cPixmap *headerLogo; cPixmap *headerLogo;
cPixmap *headerBack; cPixmap *headerBack;
@ -26,7 +27,6 @@ private:
cTextWrapper reruns; cTextWrapper reruns;
TVScraperGetFullInformation mediaInfo; TVScraperGetFullInformation mediaInfo;
bool hasAdditionalMedia; bool hasAdditionalMedia;
int borderWidth;
int border; int border;
int headerHeight; int headerHeight;
int width; int width;

View File

@ -20,7 +20,7 @@ time_t cDummyGrid::Duration(void) {
void cDummyGrid::SetViewportHeight() { void cDummyGrid::SetViewportHeight() {
int viewportHeightOld = viewportHeight; int viewportHeightOld = viewportHeight;
viewportHeight = Duration() / 60 * tvguideConfig.minutePixel; viewportHeight = Duration() / 60 * geoManager.minutePixel;
if (viewportHeight != viewportHeightOld) if (viewportHeight != viewportHeightOld)
dirty = true; dirty = true;
} }
@ -29,61 +29,61 @@ void cDummyGrid::PositionPixmap() {
int x0, y0; int x0, y0;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
x0 = column->getX(); x0 = column->getX();
y0 = tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight; y0 = geoManager.statusHeaderHeight + geoManager.channelHeaderHeight + geoManager.channelGroupsHeight;
if ( column->Start() < StartTime() ) { if ( column->Start() < StartTime() ) {
y0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel; y0 += (StartTime() - column->Start())/60*geoManager.minutePixel;
} }
if (!pixmap) { if (!pixmap) {
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, tvguideConfig.colWidth, viewportHeight)); pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, geoManager.colWidth, viewportHeight));
} else if (dirty) { } else if (dirty) {
osdManager.releasePixmap(pixmap); osdManager.releasePixmap(pixmap);
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, tvguideConfig.colWidth, viewportHeight)); pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, geoManager.colWidth, viewportHeight));
} else { } else {
pixmap->SetViewPort(cRect(x0, y0, tvguideConfig.colWidth, viewportHeight)); pixmap->SetViewPort(cRect(x0, y0, geoManager.colWidth, viewportHeight));
} }
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
x0 = tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth; x0 = geoManager.channelHeaderWidth + geoManager.channelGroupsWidth;
y0 = column->getY(); y0 = column->getY();
if ( column->Start() < StartTime() ) { if ( column->Start() < StartTime() ) {
x0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel; x0 += (StartTime() - column->Start())/60*geoManager.minutePixel;
} }
if (!pixmap) { if (!pixmap) {
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, tvguideConfig.rowHeight)); pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, geoManager.rowHeight));
} else if (dirty) { } else if (dirty) {
osdManager.releasePixmap(pixmap); osdManager.releasePixmap(pixmap);
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, tvguideConfig.rowHeight)); pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, geoManager.rowHeight));
} else { } else {
pixmap->SetViewPort(cRect(x0, y0, viewportHeight, tvguideConfig.rowHeight)); pixmap->SetViewPort(cRect(x0, y0, viewportHeight, geoManager.rowHeight));
} }
} }
} }
void cDummyGrid::setText() { void cDummyGrid::setText() {
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
text->Set(*strText, tvguideConfig.FontGrid, tvguideConfig.colWidth-2*borderWidth); text->Set(*strText, fontManager.FontGrid, geoManager.colWidth-2*borderWidth);
} }
} }
void cDummyGrid::drawText() { void cDummyGrid::drawText() {
tColor colorText = (active)?theme.Color(clrFontActive):theme.Color(clrFont); tColor colorText = (active)?theme.Color(clrFontActive):theme.Color(clrFont);
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
if (Height()/tvguideConfig.minutePixel < 6) if (Height()/geoManager.minutePixel < 6)
return; return;
int textHeight = tvguideConfig.FontGrid->Height(); int textHeight = fontManager.FontGrid->Height();
int textLines = text->Lines(); int textLines = text->Lines();
for (int i=0; i<textLines; i++) { for (int i=0; i<textLines; i++) {
pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), colorText, colorTextBack, tvguideConfig.FontGrid); pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), colorText, colorTextBack, fontManager.FontGrid);
} }
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
if (Width()/tvguideConfig.minutePixel < 10) { if (Width()/geoManager.minutePixel < 10) {
int titleY = (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontal->Height())/2; int titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2;
pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, tvguideConfig.FontGridHorizontal); pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, fontManager.FontGridHorizontal);
return; return;
} }
int titleY = (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontal->Height())/2; int titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2;
pixmap->DrawText(cPoint(borderWidth, titleY), *strText, colorText, colorTextBack, tvguideConfig.FontGridHorizontal); pixmap->DrawText(cPoint(borderWidth, titleY), *strText, colorText, colorTextBack, fontManager.FontGridHorizontal);
} }
} }
cString cDummyGrid::getText(void) { cString cDummyGrid::getText(void) {

View File

@ -27,7 +27,7 @@ void cEpgGrid::SetViewportHeight() {
} else { } else {
viewportHeight = Duration() / 60; viewportHeight = Duration() / 60;
} }
viewportHeight *= tvguideConfig.minutePixel; viewportHeight *= geoManager.minutePixel;
if (viewportHeight != viewportHeightOld) if (viewportHeight != viewportHeightOld)
dirty = true; dirty = true;
} }
@ -36,27 +36,27 @@ void cEpgGrid::PositionPixmap() {
int x0, y0; int x0, y0;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
int x0 = column->getX(); int x0 = column->getX();
int y0 = tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight; int y0 = geoManager.statusHeaderHeight + geoManager.channelHeaderHeight + geoManager.channelGroupsHeight;
if ( column->Start() < StartTime() ) { if ( column->Start() < StartTime() ) {
y0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel; y0 += (StartTime() - column->Start())/60*geoManager.minutePixel;
} }
if (!pixmap) { if (!pixmap) {
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, tvguideConfig.colWidth, viewportHeight), pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, geoManager.colWidth, viewportHeight),
cRect(0, 0, tvguideConfig.colWidth, Duration()/60*tvguideConfig.minutePixel)); cRect(0, 0, geoManager.colWidth, Duration()/60*geoManager.minutePixel));
} else { } else {
pixmap->SetViewPort(cRect(x0, y0, tvguideConfig.colWidth, viewportHeight)); pixmap->SetViewPort(cRect(x0, y0, geoManager.colWidth, viewportHeight));
} }
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
int x0 = tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth; int x0 = geoManager.channelHeaderWidth + geoManager.channelGroupsWidth;
int y0 = column->getY(); int y0 = column->getY();
if ( column->Start() < StartTime() ) { if ( column->Start() < StartTime() ) {
x0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel; x0 += (StartTime() - column->Start())/60*geoManager.minutePixel;
} }
if (!pixmap) { if (!pixmap) {
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, tvguideConfig.rowHeight), pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, geoManager.rowHeight),
cRect(0, 0, Duration()/60*tvguideConfig.minutePixel, tvguideConfig.rowHeight)); cRect(0, 0, Duration()/60*geoManager.minutePixel, geoManager.rowHeight));
} else { } else {
pixmap->SetViewPort(cRect(x0, y0, viewportHeight, tvguideConfig.rowHeight )); pixmap->SetViewPort(cRect(x0, y0, viewportHeight, geoManager.rowHeight ));
} }
} }
@ -89,8 +89,8 @@ void cEpgGrid::setText() {
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
cString strText; cString strText;
strText = cString::sprintf("%s - %s:\n%s", *(event->GetTimeString()), *(event->GetEndTimeString()), event->Title()); strText = cString::sprintf("%s - %s:\n%s", *(event->GetTimeString()), *(event->GetEndTimeString()), event->Title());
text->Set(*(strText), tvguideConfig.FontGrid, tvguideConfig.colWidth-2*borderWidth); text->Set(*(strText), fontManager.FontGrid, geoManager.colWidth-2*borderWidth);
extText->Set(event->ShortText(), tvguideConfig.FontGridSmall, tvguideConfig.colWidth-2*borderWidth); extText->Set(event->ShortText(), fontManager.FontGridSmall, geoManager.colWidth-2*borderWidth);
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
timeString = cString::sprintf("%s - %s", *(event->GetTimeString()), *(event->GetEndTimeString())); timeString = cString::sprintf("%s - %s", *(event->GetTimeString()), *(event->GetEndTimeString()));
} }
@ -98,38 +98,38 @@ void cEpgGrid::setText() {
void cEpgGrid::drawText() { void cEpgGrid::drawText() {
tColor colorText = (active)?theme.Color(clrFontActive):theme.Color(clrFont); tColor colorText = (active)?theme.Color(clrFontActive):theme.Color(clrFont);
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
if (Height()/tvguideConfig.minutePixel < 6) if (Height()/geoManager.minutePixel < 6)
return; return;
int textHeight = tvguideConfig.FontGrid->Height(); int textHeight = fontManager.FontGrid->Height();
int textLines = text->Lines(); int textLines = text->Lines();
for (int i=0; i<textLines; i++) { for (int i=0; i<textLines; i++) {
pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), colorText, colorTextBack, tvguideConfig.FontGrid); pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), colorText, colorTextBack, fontManager.FontGrid);
} }
int extTextLines = extText->Lines(); int extTextLines = extText->Lines();
int offset = (textLines+1)*textHeight - 0.5*textHeight; int offset = (textLines+1)*textHeight - 0.5*textHeight;
textHeight = tvguideConfig.FontGridSmall->Height(); textHeight = fontManager.FontGridSmall->Height();
if ((Height()-textHeight-10) > offset) { if ((Height()-textHeight-10) > offset) {
for (int i=0; i<extTextLines; i++) { for (int i=0; i<extTextLines; i++) {
pixmap->DrawText(cPoint(borderWidth, borderWidth + offset + i*textHeight), extText->GetLine(i), colorText, colorTextBack, tvguideConfig.FontGridSmall); pixmap->DrawText(cPoint(borderWidth, borderWidth + offset + i*textHeight), extText->GetLine(i), colorText, colorTextBack, fontManager.FontGridSmall);
} }
} }
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
if (Width()/tvguideConfig.minutePixel < 10) { if (Width()/geoManager.minutePixel < 10) {
int titleY = (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontal->Height())/2; int titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2;
pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, tvguideConfig.FontGridHorizontal); pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, fontManager.FontGridHorizontal);
return; return;
} }
cString strTitle = CutText(event->Title(), viewportHeight, tvguideConfig.FontGridHorizontal).c_str(); cString strTitle = CutText(event->Title(), viewportHeight, fontManager.FontGridHorizontal).c_str();
int titleY = 0; int titleY = 0;
if (tvguideConfig.showTimeInGrid) { if (tvguideConfig.showTimeInGrid) {
pixmap->DrawText(cPoint(borderWidth, borderWidth), *timeString, colorText, colorTextBack, tvguideConfig.FontGridHorizontalSmall); pixmap->DrawText(cPoint(borderWidth, borderWidth), *timeString, colorText, colorTextBack, fontManager.FontGridHorizontalSmall);
titleY = tvguideConfig.FontGridHorizontalSmall->Height() + (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontalSmall->Height() - tvguideConfig.FontGridHorizontal->Height())/2; titleY = fontManager.FontGridHorizontalSmall->Height() + (geoManager.rowHeight - fontManager.FontGridHorizontalSmall->Height() - fontManager.FontGridHorizontal->Height())/2;
} else { } else {
titleY = (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontal->Height())/2; titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2;
} }
pixmap->DrawText(cPoint(borderWidth, titleY), *strTitle, colorText, colorTextBack, tvguideConfig.FontGridHorizontal); pixmap->DrawText(cPoint(borderWidth, titleY), *strTitle, colorText, colorTextBack, fontManager.FontGridHorizontal);
} }
if (hasSwitchTimer) if (hasSwitchTimer)
drawIcon("Switch", theme.Color(clrButtonYellow)); drawIcon("Switch", theme.Color(clrButtonYellow));
@ -140,8 +140,8 @@ void cEpgGrid::drawText() {
void cEpgGrid::drawIcon(cString iconText, tColor color) { void cEpgGrid::drawIcon(cString iconText, tColor color) {
const cFont *font = (tvguideConfig.displayMode == eVertical) const cFont *font = (tvguideConfig.displayMode == eVertical)
?tvguideConfig.FontGrid ?fontManager.FontGrid
:tvguideConfig.FontGridHorizontalSmall; :fontManager.FontGridHorizontalSmall;
int textWidth = font->Width(*iconText)+2*borderWidth; int textWidth = font->Width(*iconText)+2*borderWidth;
int textHeight = font->Height()+10; int textHeight = font->Height()+10;
pixmap->DrawRectangle( cRect(Width() - textWidth - borderWidth, Height() - textHeight - borderWidth, textWidth, textHeight), color); pixmap->DrawRectangle( cRect(Width() - textWidth - borderWidth, Height() - textHeight - borderWidth, textWidth, textHeight), color);

92
fontmanager.c Normal file
View File

@ -0,0 +1,92 @@
#include "geometrymanager.h"
#include "config.h"
#include "fontmanager.h"
cFontManager::cFontManager() {
}
cFontManager::~cFontManager() {
DeleteFonts();
}
void cFontManager::SetFonts() {
InitialiseFontType();
//Common Fonts
FontButton = CreateFont(geoManager.footerHeight/3 + 4 + tvguideConfig.FontButtonDelta);
FontDetailView = CreateFont(geoManager.osdHeight/30 + tvguideConfig.FontDetailViewDelta);
FontDetailViewSmall = CreateFont(geoManager.osdHeight/40 + tvguideConfig.FontDetailViewSmallDelta);
FontDetailHeader = CreateFont(geoManager.osdHeight/25 + tvguideConfig.FontDetailHeaderDelta);
FontMessageBox = CreateFont(geoManager.osdHeight/33 + tvguideConfig.FontMessageBoxDelta);
FontMessageBoxLarge = CreateFont(geoManager.osdHeight/30 + tvguideConfig.FontMessageBoxLargeDelta);
FontStatusHeader = CreateFont(geoManager.statusHeaderHeight/6 - 4 + tvguideConfig.FontStatusHeaderDelta);
FontStatusHeaderLarge = CreateFont(geoManager.statusHeaderHeight/5 + tvguideConfig.FontStatusHeaderLargeDelta);
//Fonts for vertical Display
FontChannelHeader = CreateFont(geoManager.colWidth/10 + tvguideConfig.FontChannelHeaderDelta);
FontChannelGroups = CreateFont(geoManager.colWidth/8 + tvguideConfig.FontChannelGroupsDelta);
FontGrid = CreateFont(geoManager.colWidth/12 + tvguideConfig.FontGridDelta);
FontGridSmall = CreateFont(geoManager.colWidth/12 + tvguideConfig.FontGridSmallDelta);
FontTimeLineWeekday = CreateFont(geoManager.timeLineWidth/3 + tvguideConfig.FontTimeLineWeekdayDelta);
FontTimeLineDate = CreateFont(geoManager.timeLineWidth/4 + tvguideConfig.FontTimeLineDateDelta);
FontTimeLineTime = CreateFont(geoManager.timeLineWidth/4 + tvguideConfig.FontTimeLineTimeDelta);
//Fonts for horizontal Display
FontChannelHeaderHorizontal = CreateFont(geoManager.rowHeight/3 + tvguideConfig.FontChannelHeaderHorizontalDelta);
FontChannelGroupsHorizontal = CreateFont(geoManager.rowHeight/3 + 5 + tvguideConfig.FontChannelGroupsHorizontalDelta);
FontGridHorizontal = CreateFont(geoManager.rowHeight/3 + 5 + tvguideConfig.FontGridHorizontalDelta);
FontGridHorizontalSmall = CreateFont(geoManager.rowHeight/4 + tvguideConfig.FontGridHorizontalSmallDelta);
FontTimeLineDateHorizontal = CreateFont(geoManager.timeLineHeight/2 + 5 + tvguideConfig.FontTimeLineDateHorizontalDelta);
FontTimeLineTimeHorizontal = CreateFont(geoManager.timeLineHeight/2 + tvguideConfig.FontTimeLineTimeHorizontalDelta);
//Fonts for RecMenu
FontRecMenuItem = CreateFont(geoManager.osdHeight/30 + tvguideConfig.FontRecMenuItemDelta);
FontRecMenuItemSmall = CreateFont(geoManager.osdHeight/40 + tvguideConfig.FontRecMenuItemSmallDelta);
}
void cFontManager::DeleteFonts() {
delete FontButton;
delete FontDetailView;
delete FontDetailViewSmall;
delete FontDetailHeader;
delete FontMessageBox;
delete FontMessageBoxLarge;
delete FontStatusHeader;
delete FontStatusHeaderLarge;
delete FontChannelHeader;
delete FontChannelGroups;
delete FontGrid;
delete FontGridSmall;
delete FontTimeLineWeekday;
delete FontTimeLineDate;
delete FontTimeLineTime;
delete FontChannelHeaderHorizontal;
delete FontChannelGroupsHorizontal;
delete FontGridHorizontal;
delete FontGridHorizontalSmall;
delete FontTimeLineDateHorizontal;
delete FontTimeLineTimeHorizontal;
delete FontRecMenuItem;
delete FontRecMenuItemSmall;
}
void cFontManager::InitialiseFontType(void) {
if (tvguideConfig.fontIndex == 0) {
fontName = tvguideConfig.fontNameDefault;
} else {
cStringList availableFonts;
cFont::GetAvailableFontNames(&availableFonts);
if (availableFonts[tvguideConfig.fontIndex-1]) {
fontName = availableFonts[tvguideConfig.fontIndex-1];
} else
fontName = tvguideConfig.fontNameDefault;
}
cFont *test = NULL;
test = cFont::CreateFont(*fontName, 30);
if (!test) {
fontName = DefaultFontSml;
}
delete test;
esyslog("tvguide: Set Font to %s", *fontName);
}
cFont *cFontManager::CreateFont(int size) {
return cFont::CreateFont(*fontName, size);
}

39
fontmanager.h Normal file
View File

@ -0,0 +1,39 @@
#ifndef __TVGUIDE_FONTMANAGER_H
#define __TVGUIDE_FONTMANAGER_H
#include <vdr/skins.h>
class cFontManager {
cString fontName;
void InitialiseFontType(void);
cFont *CreateFont(int size);
public:
cFontManager();
~cFontManager();
void SetFonts(void);
void DeleteFonts(void);
cFont *FontChannelHeader;
cFont *FontChannelHeaderHorizontal;
cFont *FontChannelGroups;
cFont *FontChannelGroupsHorizontal;
cFont *FontStatusHeader;
cFont *FontStatusHeaderLarge;
cFont *FontGrid;
cFont *FontGridSmall;
cFont *FontGridHorizontal;
cFont *FontGridHorizontalSmall;
cFont *FontTimeLineWeekday;
cFont *FontTimeLineDate;
cFont *FontTimeLineDateHorizontal;
cFont *FontTimeLineTime;
cFont *FontTimeLineTimeHorizontal;
cFont *FontButton;
cFont *FontDetailView;
cFont *FontDetailViewSmall;
cFont *FontDetailHeader;
cFont *FontMessageBox;
cFont *FontMessageBoxLarge;
cFont *FontRecMenuItem;
cFont *FontRecMenuItemSmall;
};
#endif //__TVGUIDE_FONTMANAGER_H

126
footer.c
View File

@ -6,16 +6,13 @@
cFooter::cFooter(cChannelGroups *channelGroups) { cFooter::cFooter(cChannelGroups *channelGroups) {
this->channelGroups = channelGroups; this->channelGroups = channelGroups;
currentGroup = -1; currentGroup = -1;
buttonBorder = 20; buttonY = (geoManager.footerHeight - geoManager.buttonHeight)/2;
buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeLineWidth - 5*buttonBorder)/4;
buttonHeight= tvguideConfig.footerHeight - 2*buttonBorder;
buttonY = (tvguideConfig.footerHeight - buttonHeight)/2;
SetButtonPositions(); SetButtonPositions();
footer = osdManager.requestPixmap(2, cRect( tvguideConfig.timeLineWidth, footer = osdManager.requestPixmap(2, cRect( 0,
tvguideConfig.osdHeight - tvguideConfig.footerHeight, geoManager.osdHeight - geoManager.footerHeight,
tvguideConfig.osdWidth - tvguideConfig.timeLineWidth, geoManager.osdWidth,
tvguideConfig.footerHeight), geoManager.footerHeight),
cRect::Null); cRect::Null);
footer->Fill(clrTransparent); footer->Fill(clrTransparent);
} }
@ -24,6 +21,49 @@ cFooter::~cFooter(void) {
osdManager.releasePixmap(footer); osdManager.releasePixmap(footer);
} }
void cFooter::drawRedButton() {
cString text(tr("Search & Rec"));
DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), oeButtonRed, positionButtons[0]);
}
void cFooter::drawGreenButton() {
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels back"));
DrawButton(*text, theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), oeButtonGreen, positionButtons[1]);
}
void cFooter::drawGreenButton(const char *text) {
std::string cuttedText = CutText(text, geoManager.buttonWidth-6, fontManager.FontButton);
DrawButton(cuttedText.c_str(), theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), oeButtonGreen, positionButtons[1]);
}
void cFooter::drawYellowButton() {
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward"));
DrawButton(*text, theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), oeButtonYellow, positionButtons[2]);
}
void cFooter::drawYellowButton(const char *text) {
std::string cuttedText = CutText(text, geoManager.buttonWidth-6, fontManager.FontButton);
DrawButton(cuttedText.c_str(), theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), oeButtonYellow, positionButtons[2]);
}
void cFooter::drawBlueButton() {
cString text;
if (tvguideConfig.blueKeyMode == 0)
text = tr("Switch to Channel");
else if (tvguideConfig.blueKeyMode == 1)
text = tr("Detailed EPG");
DrawButton(*text, theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBorder), oeButtonBlue, positionButtons[3]);
}
void cFooter::UpdateGroupButtons(const cChannel *channel) {
int group = channelGroups->GetGroup(channel);
if (group != currentGroup) {
currentGroup = group;
drawGreenButton(channelGroups->GetPrev(group));
drawYellowButton(channelGroups->GetNext(group));
}
}
void cFooter::SetButtonPositions(void) { void cFooter::SetButtonPositions(void) {
for (int i=0; i < 4; i++) { for (int i=0; i < 4; i++) {
positionButtons[i] = -1; positionButtons[i] = -1;
@ -54,62 +94,26 @@ void cFooter::SetButtonPositions(void) {
} }
} }
void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, int num) { void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, eOsdElementType buttonType, int num) {
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent;
int left = num * buttonWidth + (num + 1) * buttonBorder; int left = num * geoManager.buttonWidth + (2 * num + 1) * geoManager.buttonBorder;
footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor);
if (tvguideConfig.useBlending) { if ((tvguideConfig.style == eStyleBlendingMagick) || (tvguideConfig.style == eStyleBlendingDefault)) {
cImageLoader imgLoader; cImageLoader imgLoader;
imgLoader.DrawBackground(theme.Color(clrButtonBlend), color, buttonWidth-4, buttonHeight-4); imgLoader.DrawBackground(theme.Color(clrButtonBlend), color, geoManager.buttonWidth-4, geoManager.buttonHeight-4);
footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor);
footer->DrawImage(cPoint(left+2, buttonY+2), imgLoader.GetImage()); footer->DrawImage(cPoint(left+2, buttonY+2), imgLoader.GetImage());
} else if (tvguideConfig.style == eStyleGraphical) {
cImage *button = imgCache.GetOsdElement(buttonType);
if (button) {
footer->DrawImage(cPoint(left, buttonY), *button);
}
} else { } else {
footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor); footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor);
footer->DrawRectangle(cRect(left+2, buttonY+2, buttonWidth-4, buttonHeight-4), color); footer->DrawRectangle(cRect(left+2, buttonY+2, geoManager.buttonWidth-4, geoManager.buttonHeight-4), color);
}
int textWidth = tvguideConfig.FontButton->Width(text);
int textHeight = tvguideConfig.FontButton->Height();
footer->DrawText(cPoint(left + (buttonWidth-textWidth)/2, buttonY + (buttonHeight-textHeight)/2), text, theme.Color(clrFontButtons), colorTextBack, tvguideConfig.FontButton);
} }
void cFooter::drawRedButton() { int textWidth = fontManager.FontButton->Width(text);
cString text(tr("Search & Rec")); int textHeight = fontManager.FontButton->Height();
DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), positionButtons[0]); footer->DrawText(cPoint(left + (geoManager.buttonWidth-textWidth)/2, buttonY + (geoManager.buttonHeight-textHeight)/2), text, theme.Color(clrFontButtons), colorTextBack, fontManager.FontButton);
}
void cFooter::drawGreenButton() {
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels back"));
DrawButton(*text, theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), positionButtons[1]);
}
void cFooter::drawGreenButton(const char *text) {
std::string cuttedText = CutText(text, buttonWidth-6, tvguideConfig.FontButton);
DrawButton(cuttedText.c_str(), theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), positionButtons[1]);
}
void cFooter::drawYellowButton() {
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward"));
DrawButton(*text, theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), positionButtons[2]);
}
void cFooter::drawYellowButton(const char *text) {
std::string cuttedText = CutText(text, buttonWidth-6, tvguideConfig.FontButton);
DrawButton(cuttedText.c_str(), theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), positionButtons[2]);
}
void cFooter::drawBlueButton() {
cString text;
if (tvguideConfig.blueKeyMode == 0)
text = tr("Switch to Channel");
else if (tvguideConfig.blueKeyMode == 1)
text = tr("Detailed EPG");
DrawButton(*text, theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBorder), positionButtons[3]);
}
void cFooter::UpdateGroupButtons(const cChannel *channel) {
int group = channelGroups->GetGroup(channel);
if (group != currentGroup) {
currentGroup = group;
drawGreenButton(channelGroups->GetPrev(group));
drawYellowButton(channelGroups->GetNext(group));
}
} }

View File

@ -9,15 +9,12 @@
class cFooter { class cFooter {
private: private:
cPixmap *footer; cPixmap *footer;
int buttonWidth;
int buttonHeight;
int buttonY; int buttonY;
int buttonBorder;
int positionButtons[4]; int positionButtons[4];
cChannelGroups *channelGroups; cChannelGroups *channelGroups;
int currentGroup; int currentGroup;
void SetButtonPositions(void); void SetButtonPositions(void);
void DrawButton(const char *text, tColor color, tColor borderColor, int num); void DrawButton(const char *text, tColor color, tColor borderColor, eOsdElementType buttonType, int num);
public: public:
cFooter(cChannelGroups *channelGroups); cFooter(cChannelGroups *channelGroups);
virtual ~cFooter(void); virtual ~cFooter(void);

70
geometrymanager.c Normal file
View File

@ -0,0 +1,70 @@
#include <vdr/osd.h>
#include "config.h"
#include "geometrymanager.h"
cGeometryManager::cGeometryManager() {
osdWidth = 0;
osdHeight = 0;
}
cGeometryManager::~cGeometryManager() {
}
bool cGeometryManager::SetGeometry(int osdWidth, int osdHeight, bool force) {
if (!force && (this->osdWidth == osdWidth) && (this->osdHeight == osdHeight)) {
esyslog("tvgudie: GeoManager SetGeometry nothing to change");
return false;
}
this->osdWidth = osdWidth;
this->osdHeight = osdHeight;
esyslog("tvguide: Set OSD to %d x %d px", osdWidth, osdHeight);
statusHeaderHeight = (tvguideConfig.displayStatusHeader)?(tvguideConfig.statusHeaderPercent * osdHeight / 100):0;
tvFrameWidth = statusHeaderHeight * 16 / 9;
statusHeaderContentWidth = (tvguideConfig.scaleVideo)?(osdWidth - tvFrameWidth):osdWidth;
channelGroupsWidth = (tvguideConfig.displayChannelGroups)?(tvguideConfig.channelGroupsPercent * osdWidth / 100):0;
channelGroupsHeight = (tvguideConfig.displayChannelGroups)?(tvguideConfig.channelGroupsPercent * osdHeight / 100):0;
channelHeaderWidth = tvguideConfig.channelHeaderWidthPercent * osdWidth / 100;
channelHeaderHeight = tvguideConfig.channelHeaderHeightPercent * osdHeight / 100;
timeLineWidth = tvguideConfig.timeLineWidthPercent * osdWidth / 100;
timeLineHeight = tvguideConfig.timeLineHeightPercent * osdHeight / 100;
clockWidth = tvFrameWidth / 3;
clockHeight = timeLineHeight;
footerHeight = tvguideConfig.footerHeightPercent * osdHeight / 100;
if (tvguideConfig.displayMode == eVertical) {
colWidth = (osdWidth - timeLineWidth) / tvguideConfig.channelCols;
rowHeight = 0;
minutePixel = (osdHeight - statusHeaderHeight - channelGroupsHeight - channelHeaderHeight - footerHeight) / tvguideConfig.displayTime;
channelLogoWidth = colWidth;
channelLogoHeight = channelHeaderHeight;
logoWidth = channelLogoWidth/2 - 15;
logoHeight = logoWidth * tvguideConfig.logoHeightRatio / tvguideConfig.logoWidthRatio;
timeLineGridWidth = timeLineWidth;
timeLineGridHeight = minutePixel*30;
dateVieverWidth = timeLineWidth;
dateVieverHeight = channelHeaderHeight + channelGroupsHeight;
} else if (tvguideConfig.displayMode == eHorizontal) {
colWidth = 0;
rowHeight = (osdHeight - statusHeaderHeight - timeLineHeight - footerHeight) / tvguideConfig.channelRows;
minutePixel = (osdWidth - channelHeaderWidth - channelGroupsWidth) / tvguideConfig.displayTime;
channelLogoWidth = channelHeaderWidth;
channelLogoHeight = rowHeight;
logoWidth = channelLogoHeight * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio;
logoHeight = channelLogoHeight;
timeLineGridWidth = geoManager.minutePixel*30;
timeLineGridHeight = geoManager.timeLineHeight;
dateVieverWidth = channelHeaderWidth + channelGroupsWidth;
dateVieverHeight = timeLineHeight;
}
buttonBorder = footerHeight / 6;
buttonWidth = osdWidth / 4 - 2 * buttonBorder;
buttonHeight = footerHeight - 3 * buttonBorder;
epgViewHeaderHeight = tvguideConfig.epgViewHeaderPercent * osdHeight / 100;
borderRecMenus = 10;
return true;
}

50
geometrymanager.h Normal file
View File

@ -0,0 +1,50 @@
#ifndef __TVGUIDE_GEOMETRYMANAGER_H
#define __TVGUIDE_GEOMETRYMANAGER_H
class cGeometryManager {
private:
public:
cGeometryManager(void);
~cGeometryManager();
bool SetGeometry(int osdWidth, int osdHeight, bool force = false);
//Common
int osdWidth;
int osdHeight;
int statusHeaderHeight;
int tvFrameWidth;
int statusHeaderContentWidth;
//ChannelGroups
int channelGroupsWidth;
int channelGroupsHeight;
//ContentHeader
int channelHeaderWidth;
int channelHeaderHeight;
int logoWidth;
int logoHeight;
//Content
int colWidth;
int rowHeight;
int minutePixel;
int channelLogoWidth;
int channelLogoHeight;
//Timeline
int timeLineWidth;
int timeLineHeight;
int timeLineGridWidth;
int timeLineGridHeight;
int dateVieverWidth;
int dateVieverHeight;
int clockWidth;
int clockHeight;
//Footer
int footerHeight;
int buttonWidth;
int buttonHeight;
int buttonBorder;
//Detailed EPG View
int epgViewHeaderHeight;
//Recording Menus
int borderRecMenus;
};
#endif //__TVGUIDE_GEOMETRYMANAGER_H

5
grid.c
View File

@ -34,10 +34,15 @@ void cGrid::Draw() {
return; return;
} }
if (dirty) { if (dirty) {
if (tvguideConfig.style == eStyleGraphical) {
drawBackgroundGraphical(bgGrid, active);
drawText();
} else {
setBackground(); setBackground();
drawBackground(); drawBackground();
drawText(); drawText();
drawBorder(); drawBorder();
}
pixmap->SetLayer(1); pixmap->SetLayer(1);
dirty = false; dirty = false;
} }

View File

@ -14,25 +14,26 @@ cHeaderGrid::~cHeaderGrid(void) {
void cHeaderGrid::createBackground(int num) { void cHeaderGrid::createBackground(int num) {
color = theme.Color(clrHeader); color = theme.Color(clrHeader);
colorBlending = theme.Color(clrHeaderBlending); colorBlending = theme.Color(clrHeaderBlending);
int x, y, width, height; int x, y;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
x = tvguideConfig.timeLineWidth + num*tvguideConfig.colWidth; x = geoManager.timeLineWidth + num*geoManager.colWidth;
y = tvguideConfig.statusHeaderHeight + tvguideConfig.channelGroupsHeight; y = geoManager.statusHeaderHeight + geoManager.channelGroupsHeight;
width = tvguideConfig.colWidth;
height = tvguideConfig.channelHeaderHeight;
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
x = tvguideConfig.channelGroupsWidth; x = geoManager.channelGroupsWidth;
y = tvguideConfig.statusHeaderHeight + tvguideConfig.timeLineHeight + num*tvguideConfig.rowHeight; y = geoManager.statusHeaderHeight + geoManager.timeLineHeight + num*geoManager.rowHeight;
width = tvguideConfig.channelHeaderWidth;
height = tvguideConfig.rowHeight;
} }
pixmap = osdManager.requestPixmap(1, cRect(x, y, width, height)); pixmap = osdManager.requestPixmap(1, cRect(x, y, geoManager.channelLogoWidth, geoManager.channelLogoHeight));
pixmapLogo = osdManager.requestPixmap(2, cRect(x, y, width, height)); pixmapLogo = osdManager.requestPixmap(2, cRect(x, y, geoManager.channelLogoWidth, geoManager.channelLogoHeight));
if ((!pixmap) || (!pixmapLogo)){ if ((!pixmap) || (!pixmapLogo)){
return; return;
} }
pixmapLogo->Fill(clrTransparent); pixmapLogo->Fill(clrTransparent);
if (tvguideConfig.style == eStyleGraphical) {
drawBackgroundGraphical(bgChannelHeader);
} else {
drawBackground(); drawBackground();
drawBorder();
}
} }
void cHeaderGrid::drawChannel(const cChannel *channel) { void cHeaderGrid::drawChannel(const cChannel *channel) {
@ -41,20 +42,18 @@ void cHeaderGrid::drawChannel(const cChannel *channel) {
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
drawChannelHorizontal(channel); drawChannelHorizontal(channel);
} }
drawBorder();
} }
void cHeaderGrid::drawChannelHorizontal(const cChannel *channel) { void cHeaderGrid::drawChannelHorizontal(const cChannel *channel) {
int logoWidth = Height() * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio; int logoWidth = geoManager.logoWidth;
int logoX = tvguideConfig.displayChannelName?2:(Width()-logoWidth)/2; int logoX = tvguideConfig.displayChannelName?2:(Width()-logoWidth)/2;
int textX = 5; int textX = 5;
int textY = (Height() - tvguideConfig.FontChannelHeaderHorizontal->Height())/2; int textY = (Height() - fontManager.FontChannelHeaderHorizontal->Height())/2;
bool logoFound = false; bool logoFound = false;
if (!tvguideConfig.hideChannelLogos) { if (!tvguideConfig.hideChannelLogos) {
cImageLoader imgLoader; cImage *logo = imgCache.GetLogo(channel);
if (imgLoader.LoadLogo(channel->Name(), logoWidth, Height())) { if (logo) {
cImage logo = imgLoader.GetImage(); pixmapLogo->DrawImage(cPoint(logoX, 0), *logo);
pixmapLogo->DrawImage(cPoint(logoX, 0), logo);
logoFound = true; logoFound = true;
} }
} }
@ -68,28 +67,27 @@ void cHeaderGrid::drawChannelHorizontal(const cChannel *channel) {
textWidthMax -= logoWidth; textWidthMax -= logoWidth;
} }
if (drawText) { if (drawText) {
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent;
cString strChannel = cString::sprintf("%d %s", channel->Number(), channel->Name()); cString strChannel = cString::sprintf("%d %s", channel->Number(), channel->Name());
strChannel = CutText(*strChannel, textWidthMax, tvguideConfig.FontChannelHeaderHorizontal).c_str(); strChannel = CutText(*strChannel, textWidthMax, fontManager.FontChannelHeaderHorizontal).c_str();
pixmap->DrawText(cPoint(textX, textY), *strChannel, theme.Color(clrFontHeader), colorTextBack, tvguideConfig.FontChannelHeaderHorizontal); pixmap->DrawText(cPoint(textX, textY), *strChannel, theme.Color(clrFontHeader), colorTextBack, fontManager.FontChannelHeaderHorizontal);
} }
} }
void cHeaderGrid::drawChannelVertical(const cChannel *channel) { void cHeaderGrid::drawChannelVertical(const cChannel *channel) {
int logoWidth = Width()/2 - 15; int logoWidth = geoManager.logoWidth;
int logoHeight = logoWidth * tvguideConfig.logoHeightRatio / tvguideConfig.logoWidthRatio; int logoHeight = geoManager.logoHeight;
cTextWrapper tw; cTextWrapper tw;
cString headerText = cString::sprintf("%d - %s", channel->Number(), channel->Name()); cString headerText = cString::sprintf("%d - %s", channel->Number(), channel->Name());
tw.Set(*headerText, tvguideConfig.FontChannelHeader, tvguideConfig.colWidth - 8); tw.Set(*headerText, fontManager.FontChannelHeader, geoManager.colWidth - 8);
int lines = tw.Lines(); int lines = tw.Lines();
int lineHeight = tvguideConfig.FontChannelHeader->Height(); int lineHeight = fontManager.FontChannelHeader->Height();
int yStart = (tvguideConfig.channelHeaderHeight - lines*lineHeight)/2 + 8; int yStart = (geoManager.channelHeaderHeight - lines*lineHeight)/2 + 8;
bool logoFound = false; bool logoFound = false;
if (!tvguideConfig.hideChannelLogos) { if (!tvguideConfig.hideChannelLogos) {
cImageLoader imgLoader; cImage *logo = imgCache.GetLogo(channel);
if (imgLoader.LoadLogo(channel->Name(), logoWidth, logoHeight)) { if (logo) {
cImage logo = imgLoader.GetImage(); pixmapLogo->DrawImage(cPoint((Width() - logoWidth)/2, 4), *logo);
pixmapLogo->DrawImage(cPoint((Width() - logoWidth)/2, 4), logo);
logoFound = true; logoFound = true;
} }
} }
@ -102,28 +100,28 @@ void cHeaderGrid::drawChannelVertical(const cChannel *channel) {
} }
if (!drawText) if (!drawText)
return; return;
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent;
for (int i=0; i<lines; i++) { for (int i=0; i<lines; i++) {
int textWidth = tvguideConfig.FontChannelHeader->Width(tw.GetLine(i)); int textWidth = fontManager.FontChannelHeader->Width(tw.GetLine(i));
int xText = (tvguideConfig.colWidth - textWidth) / 2; int xText = (geoManager.colWidth - textWidth) / 2;
if (xText < 0) if (xText < 0)
xText = 0; xText = 0;
pixmap->DrawText(cPoint(xText, yStart + i*lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), colorTextBack, tvguideConfig.FontChannelHeader); pixmap->DrawText(cPoint(xText, yStart + i*lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), colorTextBack, fontManager.FontChannelHeader);
} }
} }
void cHeaderGrid::setPosition(int num) { void cHeaderGrid::setPosition(int num) {
int x, y, width, height; int x, y, width, height;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
x = tvguideConfig.timeLineWidth + num*tvguideConfig.colWidth; x = geoManager.timeLineWidth + num*geoManager.colWidth;
y = tvguideConfig.statusHeaderHeight + tvguideConfig.channelGroupsHeight; y = geoManager.statusHeaderHeight + geoManager.channelGroupsHeight;
width = tvguideConfig.colWidth; width = geoManager.colWidth;
height = tvguideConfig.channelHeaderHeight; height = geoManager.channelHeaderHeight;
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
x = tvguideConfig.channelGroupsWidth; x = geoManager.channelGroupsWidth;
y = tvguideConfig.statusHeaderHeight + tvguideConfig.timeLineHeight + num*tvguideConfig.rowHeight; y = geoManager.statusHeaderHeight + geoManager.timeLineHeight + num*geoManager.rowHeight;
width = tvguideConfig.channelHeaderWidth; width = geoManager.channelHeaderWidth;
height = tvguideConfig.rowHeight; height = geoManager.rowHeight;
} }
pixmap->SetViewPort(cRect(x, y, width, height)); pixmap->SetViewPort(cRect(x, y, width, height));
pixmapLogo->SetViewPort(cRect(x, y, width, height)); pixmapLogo->SetViewPort(cRect(x, y, width, height));

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

BIN
icons/default/icons/no.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

BIN
icons/default/icons/yes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Some files were not shown because too many files have changed in this diff Show More