diff --git a/HISTORY b/HISTORY index 9a8fa2c..9e1510e 100644 --- a/HISTORY +++ b/HISTORY @@ -69,3 +69,13 @@ VDR Plugin 'tvguide' Revision History Version 1.1.0 - 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 diff --git a/Makefile b/Makefile index c41f260..176ad7d 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ LIBS += $(shell pkg-config --libs Magick++) ### 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: diff --git a/channelcolumn.c b/channelcolumn.c index 69018a7..c23fbe6 100644 --- a/channelcolumn.c +++ b/channelcolumn.c @@ -109,11 +109,11 @@ void cChannelColumn::drawGrids() { } int cChannelColumn::getX() { - return tvguideConfig.timeLineWidth + num*tvguideConfig.colWidth; + return geoManager.timeLineWidth + num*geoManager.colWidth; } int cChannelColumn::getY() { - return tvguideConfig.statusHeaderHeight + tvguideConfig.timeLineHeight + num*tvguideConfig.rowHeight; + return geoManager.statusHeaderHeight + geoManager.timeLineHeight + num*geoManager.rowHeight; } cGrid * cChannelColumn::getActive() { diff --git a/channelgroup.c b/channelgroup.c index 4008a67..3278f8c 100644 --- a/channelgroup.c +++ b/channelgroup.c @@ -37,50 +37,62 @@ void cChannelGroupGrid::SetBackground() { void cChannelGroupGrid::SetGeometry(int start, int end) { int x, y, width, height; if (tvguideConfig.displayMode == eVertical) { - x = tvguideConfig.timeLineWidth + start*tvguideConfig.colWidth; - y = tvguideConfig.statusHeaderHeight; - width = (end - start + 1) * tvguideConfig.colWidth; - height = tvguideConfig.channelGroupsHeight; + x = geoManager.timeLineWidth + start*geoManager.colWidth; + y = geoManager.statusHeaderHeight; + width = (end - start + 1) * geoManager.colWidth; + height = geoManager.channelGroupsHeight; } else if (tvguideConfig.displayMode == eHorizontal) { x = 0; - y = tvguideConfig.statusHeaderHeight + tvguideConfig.timeLineHeight + start*tvguideConfig.rowHeight; - width = tvguideConfig.channelGroupsWidth; - height = (end - start + 1) * tvguideConfig.rowHeight; + y = geoManager.statusHeaderHeight + geoManager.timeLineHeight + start*geoManager.rowHeight; + width = geoManager.channelGroupsWidth; + height = (end - start + 1) * geoManager.rowHeight; } pixmap = osdManager.requestPixmap(1, cRect(x, y, width, height)); } void cChannelGroupGrid::Draw(void) { - drawBackground(); - drawBorder(); - tColor colorText = theme.Color(clrFont); - tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; - if (tvguideConfig.displayMode == eVertical) { - int textY = (Height() - tvguideConfig.FontChannelGroups->Height()) / 2; - 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) { - std::string nameUpper = name; - std::transform(nameUpper.begin(), nameUpper.end(),nameUpper.begin(), ::toupper); - int numChars = nameUpper.length(); - int charHeight = tvguideConfig.FontChannelGroupsHorizontal->Height(); - int textHeight = numChars * charHeight; - int y = 5; - if ((textHeight +5) < Height()) { - y = (Height() - textHeight) / 2; - } - for (int i=0; i < numChars; i++) { - if (((y + 2*charHeight) > Height()) && ((i+1)Width("...")) / 2; - pixmap->DrawText(cPoint(x, y), "...", colorText, colorTextBack, tvguideConfig.FontChannelGroupsHorizontal); - break; - } - cString currentChar = cString::sprintf("%c", nameUpper.at(i)); - int x = (Width() - tvguideConfig.FontChannelGroupsHorizontal->Width(*currentChar)) / 2; - pixmap->DrawText(cPoint(x, y), *currentChar, colorText, colorTextBack, tvguideConfig.FontChannelGroupsHorizontal); - y += tvguideConfig.FontChannelGroupsHorizontal->Height(); - } + if (tvguideConfig.style == eStyleGraphical) { + drawBackgroundGraphical(bgChannelGroup); + } else { + drawBackground(); + drawBorder(); } -} \ No newline at end of file + tColor colorText = theme.Color(clrFont); + tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent; + if (tvguideConfig.displayMode == eVertical) { + DrawVertical(colorText, colorTextBack); + } 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::transform(nameUpper.begin(), nameUpper.end(),nameUpper.begin(), ::toupper); + int numChars = nameUpper.length(); + int charHeight = fontManager.FontChannelGroupsHorizontal->Height(); + int textHeight = numChars * charHeight; + int y = 5; + if ((textHeight +5) < Height()) { + y = (Height() - textHeight) / 2; + } + for (int i=0; i < numChars; i++) { + if (((y + 2*charHeight) > Height()) && ((i+1)Width("...")) / 2; + pixmap->DrawText(cPoint(x, y), "...", colorText, colorTextBack, fontManager.FontChannelGroupsHorizontal); + break; + } + cString currentChar = cString::sprintf("%c", nameUpper.at(i)); + int x = (Width() - fontManager.FontChannelGroupsHorizontal->Width(*currentChar)) / 2; + pixmap->DrawText(cPoint(x, y), *currentChar, colorText, colorTextBack, fontManager.FontChannelGroupsHorizontal); + y += fontManager.FontChannelGroupsHorizontal->Height(); + } +} diff --git a/channelgroup.h b/channelgroup.h index a8984ce..e09f6de 100644 --- a/channelgroup.h +++ b/channelgroup.h @@ -29,6 +29,8 @@ class cChannelGroupGrid : public cListObject, public cStyledPixmap { private: const char *name; bool isColor1; + void DrawHorizontal(tColor colorText, tColor colorTextBack); + void DrawVertical(tColor colorText, tColor colorTextBack); public: cChannelGroupGrid(const char *name); virtual ~cChannelGroupGrid(void); diff --git a/config.c b/config.c index d593a40..d88c439 100644 --- a/config.c +++ b/config.c @@ -1,25 +1,21 @@ +#include #include "config.h" cTvguideConfig::cTvguideConfig() { + debugImageLoading = 0; showMainMenuEntry = 1; replaceOriginalSchedule = 0; - osdWidth = 0; - osdHeight = 0; displayMode = eHorizontal; showTimeInGrid = 1; - colWidth = 0; - rowHeight = 0; channelCols = 5; channelRows = 10; displayTime = 160; - minutePixel = 0; displayStatusHeader = 1; displayChannelGroups = 1; statusHeaderPercent = 20; - statusHeaderHeight = 0; channelGroupsPercent = 5; - channelGroupsWidth = 0; - channelGroupsHeight = 0; + epgViewHeaderPercent = 25; + epgViewBorder = 50; scaleVideo = 1; decorateVideo = 1; timeLineWidthPercent = 8; @@ -27,7 +23,7 @@ cTvguideConfig::cTvguideConfig() { displayChannelName = 1; channelHeaderWidthPercent = 20; channelHeaderHeightPercent = 15; - footerHeight = 80; + footerHeightPercent = 7; stepMinutes = 30; bigStepHours = 3; hugeStepHours = 24; @@ -73,178 +69,147 @@ cTvguideConfig::cTvguideConfig() { FontTimeLineTimeHorizontalDelta = 0; FontRecMenuItemDelta = 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; - themeIndex = 4; - useBlending = 2; + useNopacityTheme = 1; + themeIndex = -1; + themeIndexCurrent = -1; + themeName = ""; + nOpacityTheme = ""; + style = eStyleBlendingDefault; roundedCorners = 0; displayRerunsDetailEPGView = 1; numReruns = 5; useSubtitleRerun = 1; + numLogosInitial = 30; + numLogosMax = 50; + limitLogoCache = 1; + logoPathSet = false; + imagesPathSet = false; + iconsPathSet = false; } 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; jumpChannels = numGrids; } -void cTvguideConfig::SetFonts(void){ - cString fontname; - if (fontIndex == 0) { - fontname = fontNameDefault; - } else { - cStringList availableFonts; - cFont::GetAvailableFontNames(&availableFonts); - if (availableFonts[fontIndex-1]) { - fontname = availableFonts[fontIndex-1]; - } else - fontname = fontNameDefault; +bool cTvguideConfig::LoadTheme() { + //is correct theme already loaded? + if (nOpacityTheme.size() == 0) + nOpacityTheme = Setup.OSDTheme; + if ((themeIndex > -1) && (themeIndex == themeIndexCurrent)) { + if (!nOpacityTheme.compare(Setup.OSDTheme)) { + return false; + } else { + nOpacityTheme = Setup.OSDTheme; + } } - cFont *test = NULL; - test = cFont::CreateFont(*fontname, 30); - if (!test) { - fontname = DefaultFontSml; + //Load available Themes + cThemes themes; + themes.Load(*cString("tvguide")); + int numThemesAvailable = themes.NumThemes(); + + //Check for nOpacity Theme + if (useNopacityTheme) { + std::string nOpacity = "nOpacity"; + std::string currentSkin = Setup.OSDSkin; + std::string currentSkinTheme = Setup.OSDTheme; + if (!currentSkin.compare(nOpacity)) { + for (int curThemeIndex = 0; curThemeIndex < numThemesAvailable; curThemeIndex++) { + std::string curThemeName = themes.Name(curThemeIndex); + if (!curThemeName.compare(currentSkinTheme)) { + themeIndex = curThemeIndex; + break; + } + } + } } - delete test; - - //Common Fonts - FontButton = cFont::CreateFont(*fontname, footerHeight/3 + 4 + FontButtonDelta); - FontDetailView = cFont::CreateFont(*fontname, osdHeight/30 + FontDetailViewDelta); - FontDetailViewSmall = cFont::CreateFont(*fontname, osdHeight/40 + FontDetailViewSmallDelta); - FontDetailHeader = cFont::CreateFont(*fontname, osdHeight/25 + FontDetailHeaderDelta); - FontMessageBox = cFont::CreateFont(*fontname, osdHeight/33 + FontMessageBoxDelta); - FontMessageBoxLarge = cFont::CreateFont(*fontname, osdHeight/30 + FontMessageBoxLargeDelta); - FontStatusHeader = cFont::CreateFont(*fontname, statusHeaderHeight/6 - 4 + FontStatusHeaderDelta); - FontStatusHeaderLarge = cFont::CreateFont(*fontname, statusHeaderHeight/5 + FontStatusHeaderLargeDelta); - //Fonts for vertical Display - FontChannelHeader = cFont::CreateFont(*fontname, colWidth/10 + FontChannelHeaderDelta); - 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); + + if (themeIndex == -1) { + for (int curThemeIndex = 0; curThemeIndex < numThemesAvailable; curThemeIndex++) { + std::string curThemeName = themes.Name(curThemeIndex); + if (!curThemeName.compare("default")) { + themeIndex = curThemeIndex; + break; + } + } + + } + + 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::SetBlending(void) { - if (theme.Color(clrDoBlending) == CLR_BLENDING_OFF) { - useBlending = 0; - } else if (theme.Color(clrDoBlending) == CLR_BLENDING_DEFAULT) - useBlending = 1; - else { - useBlending = 2; + +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) { logoPath = path; + logoPathSet = true; + esyslog("tvguide: Logo Path set to %s", *logoPath); } void cTvguideConfig::SetImagesPath(cString path) { epgImagePath = path; + imagesPathSet = true; + esyslog("tvguide: EPG Image Path set to %s", *epgImagePath); } void cTvguideConfig::SetIconsPath(cString path) { iconPath = path; + iconsPathSet = true; + esyslog("tvguide: Icon Path set to %s", *iconPath); } -void cTvguideConfig::loadTheme() { - cThemes themes; - themes.Load(*cString("tvguide")); - const char *FileName = themes.FileName(themeIndex); - if (access(FileName, F_OK) == 0) { - ::theme.Load(FileName); +void cTvguideConfig::SetDefaultPathes(void) { + if (!logoPathSet) { + cString path = cString::sprintf("%s/channellogos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N)); + SetLogoPath(path); + } + 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) { 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, "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, "displayMode") == 0) displayMode = 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, "statusHeaderPercent") == 0) statusHeaderPercent = 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, "decorateVideo") == 0) decorateVideo = 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, "channelHeaderWidthPercent") == 0) channelHeaderWidthPercent = 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, "fontIndex") == 0) fontIndex = 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, "numReruns") == 0) numReruns = 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; return true; -} +} \ No newline at end of file diff --git a/config.h b/config.h index c69710c..1ac2810 100644 --- a/config.h +++ b/config.h @@ -4,6 +4,9 @@ #include #include #include "osdmanager.h" +#include "geometrymanager.h" +#include "fontmanager.h" +#include "imagecache.h" enum { e12Hours, @@ -20,49 +23,41 @@ enum { eGroupJump }; +enum { + eStyleGraphical, + eStyleBlendingMagick, + eStyleBlendingDefault, + eStyleFlat +}; + class cTvguideConfig { private: - void SetGeometry(int width, int height); - void SetFonts(void); public: cTvguideConfig(); ~cTvguideConfig(); - void SetLogoPath(cString path); - void SetImagesPath(cString path); - void SetIconsPath(cString path); - void SetBlending(void); + int debugImageLoading; int showMainMenuEntry; int replaceOriginalSchedule; - int osdWidth; - int osdHeight; int displayMode; int showTimeInGrid; - int colWidth; - int rowHeight; int channelCols; int channelRows; int numGrids; int displayTime; - int minutePixel; int displayStatusHeader; int displayChannelGroups; int statusHeaderPercent; - int statusHeaderHeight; int channelGroupsPercent; - int channelGroupsWidth; - int channelGroupsHeight; + int epgViewHeaderPercent; + int epgViewBorder; int scaleVideo; int decorateVideo; int timeLineWidthPercent; int timeLineHeightPercent; - int timeLineWidth; - int timeLineHeight; int displayChannelName; int channelHeaderWidthPercent; int channelHeaderHeightPercent; - int channelHeaderWidth; - int channelHeaderHeight; - int footerHeight; + int footerHeightPercent; int stepMinutes; int bigStepHours; int hugeStepHours; @@ -111,92 +106,91 @@ class cTvguideConfig { int FontTimeLineTimeHorizontalDelta; int FontRecMenuItemDelta; 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 useNopacityTheme; int themeIndex; - int useBlending; + int themeIndexCurrent; + cString themeName; + std::string nOpacityTheme; + int style; int roundedCorners; int displayRerunsDetailEPGView; int numReruns; 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); - void loadTheme(); }; #ifdef DEFINE_CONFIG cTvguideConfig tvguideConfig; cOsdManager osdManager; + cGeometryManager geoManager; + cFontManager fontManager; + cImageCache imgCache; cTheme theme; cPlugin* pRemoteTimers = NULL; #else extern cTvguideConfig tvguideConfig; extern cOsdManager osdManager; + extern cGeometryManager geoManager; + extern cFontManager fontManager; + extern cImageCache imgCache; extern cTheme theme; extern cPlugin* pRemoteTimers; #endif // --- Theme ------------------------------------------------------------- -//BLENDING SETUP -#define CLR_BLENDING_NOPACITY 0xFFFFFFFF -#define CLR_BLENDING_DEFAULT 0xAAAAAAAA -#define CLR_BLENDING_OFF 0x00000000 +//Style SETUP +#define CLR_STYLE_BLENDING_MAGICK 0xFFFFFFFF +#define CLR_STYLE_BLENDING_DEFAULT 0xAAAAAAAA +#define CLR_STYLE_GRAPHICAL 0x66666666 +#define CLR_STYLE_FLAT 0x00000000 -THEME_CLR(theme, clrDoBlending, CLR_BLENDING_DEFAULT); -THEME_CLR(theme, clrBackgroundOSD, clrBlack); -THEME_CLR(theme, clrBackground, clrBlack); -THEME_CLR(theme, clrGrid1, 0xFF404749); -THEME_CLR(theme, clrGrid1Blending, 0xFF000000); -THEME_CLR(theme, clrGrid2, 0xFF20293F); -THEME_CLR(theme, clrGrid2Blending, 0xFF000000); -THEME_CLR(theme, clrHighlight, 0xFFFF4D00); -THEME_CLR(theme, clrHighlightBlending, 0xFF000000); +THEME_CLR(theme, clrStyle, CLR_STYLE_BLENDING_DEFAULT); +THEME_CLR(theme, clrBackgroundOSD, 0xB012273f); +THEME_CLR(theme, clrBackground, 0xB012273f); +THEME_CLR(theme, clrGrid1, 0x00000000); +THEME_CLR(theme, clrGrid1Blending, 0x00000000); +THEME_CLR(theme, clrGrid2, 0x00000000); +THEME_CLR(theme, clrGrid2Blending, 0x00000000); +THEME_CLR(theme, clrHighlight, 0xAA3A3A55); +THEME_CLR(theme, clrHighlightBlending, 0xDD000000); THEME_CLR(theme, clrFont, clrWhite); -THEME_CLR(theme, clrFontActive, clrWhite); -THEME_CLR(theme, clrFontHeader, clrWhite); +THEME_CLR(theme, clrFontActive, 0xFF363636); +THEME_CLR(theme, clrFontHeader, 0xFF363636); THEME_CLR(theme, clrFontButtons, clrWhite); -THEME_CLR(theme, clrStatusHeader, clrBlack); -THEME_CLR(theme, clrStatusHeaderBlending, clrBlack); -THEME_CLR(theme, clrHeader, clrBlack); -THEME_CLR(theme, clrHeaderBlending, 0xFFE0E0E0); -THEME_CLR(theme, clrBorder, clrWhite); +THEME_CLR(theme, clrStatusHeader, 0x00000000); +THEME_CLR(theme, clrStatusHeaderBlending, 0x00000000); +THEME_CLR(theme, clrHeader, 0x00000000); +THEME_CLR(theme, clrHeaderBlending, 0x00000000); +THEME_CLR(theme, clrBorder, 0x00000000); THEME_CLR(theme, clrTimeline1, clrWhite); THEME_CLR(theme, clrTimeline1Blending, 0xFF828282); THEME_CLR(theme, clrTimeline2, clrBlack); THEME_CLR(theme, clrTimeline2Blending, 0xFF3F3F3F); -THEME_CLR(theme, clrButtonRed, 0x99BB0000); -THEME_CLR(theme, clrButtonRedBorder, 0xFFBB0000); -THEME_CLR(theme, clrButtonGreen, 0x9900BB00); -THEME_CLR(theme, clrButtonGreenBorder, 0xFF00BB00); -THEME_CLR(theme, clrButtonYellow, 0x99BBBB00); -THEME_CLR(theme, clrButtonYellowBorder, 0xFFBBBB00); -THEME_CLR(theme, clrButtonBlue, 0x990000BB); -THEME_CLR(theme, clrButtonBlueBorder, 0xFF0000BB); +THEME_CLR(theme, clrButtonRed, 0x00000000); +THEME_CLR(theme, clrButtonRedBorder, 0x00000000); +THEME_CLR(theme, clrButtonGreen, 0x00000000); +THEME_CLR(theme, clrButtonGreenBorder, 0x00000000); +THEME_CLR(theme, clrButtonYellow, 0x00000000); +THEME_CLR(theme, clrButtonYellowBorder, 0x00000000); +THEME_CLR(theme, clrButtonBlue, 0x00000000); +THEME_CLR(theme, clrButtonBlueBorder, 0x00000000); THEME_CLR(theme, clrButtonBlend, 0xDD000000); -THEME_CLR(theme, clrRecMenuBackground, 0xB0000000); +THEME_CLR(theme, clrRecMenuBackground, 0xAA000000); THEME_CLR(theme, clrRecMenuTimerConflictBackground, 0xFFCCCCCC); THEME_CLR(theme, clrRecMenuTimerConflictBar, 0xFF222222); THEME_CLR(theme, clrRecMenuTimerConflictOverlap, 0xAAFF0000); @@ -207,7 +201,7 @@ THEME_CLR(theme, clrRecMenuTextBack, 0xFF000000); THEME_CLR(theme, clrRecMenuTextActiveBack, 0xFF404749); THEME_CLR(theme, clrRecMenuKeyboardBack, 0xFF000000); THEME_CLR(theme, clrRecMenuKeyboardBorder, clrWhite); -THEME_CLR(theme, clrRecMenuKeyboardHigh, 0x55FFFFFF); +THEME_CLR(theme, clrRecMenuKeyboardHigh, 0x40BB0000); THEME_CLR(theme, clrButtonRedKeyboard, 0xFFBB0000); THEME_CLR(theme, clrButtonGreenKeyboard, 0xFF00BB00); THEME_CLR(theme, clrButtonYellowKeyboard, 0xFFBBBB00); diff --git a/detailview.c b/detailview.c index 9d25449..dc726f0 100644 --- a/detailview.c +++ b/detailview.c @@ -1,6 +1,7 @@ #include #include #include "imageloader.h" +#include "imagecache.h" #include "services/epgsearch.h" #include "services/remotetimers.h" #include "config.h" @@ -10,16 +11,14 @@ cDetailView::cDetailView(const cEvent *event) { this->event = event; imgScrollBar = NULL; - borderWidth = 20; //px, border around window - border = 10; //px, border in view window + border = tvguideConfig.epgViewBorder; //px, border in view window scrollBarWidth = 40; - headerHeight = max (40 + 3 * tvguideConfig.FontDetailHeader->Height(), // border + 3 Lines - 40 + tvguideConfig.epgImageHeight); + headerHeight = geoManager.epgViewHeaderHeight; pixmapPoster = NULL; - width = tvguideConfig.osdWidth-2*borderWidth; + width = geoManager.osdWidth; contentWidth = width - scrollBarWidth; - contentX = borderWidth; - contentHeight = tvguideConfig.osdHeight-2*borderWidth-headerHeight; + contentX = 0; + contentHeight = geoManager.osdHeight - headerHeight; widthPoster = 30 * contentWidth / 100; } @@ -27,6 +26,7 @@ cDetailView::~cDetailView(void){ Cancel(-1); while (Active()) cCondWait::SleepMs(10); + osdManager.releasePixmap(back); delete header; header = NULL; osdManager.releasePixmap(headerLogo); @@ -61,7 +61,7 @@ void cDetailView::setContent() { 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) { loadReruns(); } @@ -71,7 +71,7 @@ void cDetailView::setContent() { } bool cDetailView::setContentDrawportHeight() { - int lineHeight = tvguideConfig.FontDetailView->Height(); + int lineHeight = fontManager.FontDetailView->Height(); //Height of banner (only for series) int heightBanner = 0; if (hasAdditionalMedia && (mediaInfo.type == typeSeries)) { @@ -82,7 +82,7 @@ bool cDetailView::setContentDrawportHeight() { //Height of rerun information int heightReruns = 0; if (tvguideConfig.displayRerunsDetailEPGView) { - heightReruns = reruns.Lines() * lineHeight; + heightReruns = (reruns.Lines()+1) * lineHeight; } //Height of actor pictures int heightActors = 0; @@ -100,14 +100,14 @@ bool cDetailView::setContentDrawportHeight() { heightEpgPics = heightEPGPics(); } - yBanner = lineHeight; - yEPGText = heightBanner; - yActors = heightBanner + heightEPG; - yFanart = heightBanner + heightEPG + heightActors; - yAddInf = heightBanner + heightEPG + heightActors + heightFanart; - yEPGPics = heightBanner + heightEPG + heightActors + heightFanart + heightReruns; + yBanner = border; + yEPGText = yBanner + heightBanner; + yAddInf = yEPGText + heightEPG; + yActors = yAddInf + heightReruns; + yFanart = yActors + heightActors; + 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 if (totalHeight > contentHeight) { heightContent = totalHeight; @@ -120,58 +120,80 @@ bool cDetailView::setContentDrawportHeight() { } void cDetailView::createPixmaps() { - header = new cStyledPixmap(osdManager.requestPixmap(5, cRect(borderWidth, borderWidth, width, headerHeight), cRect::Null)); - headerLogo = osdManager.requestPixmap(6, cRect(borderWidth, borderWidth, width, headerHeight), cRect::Null); + back = osdManager.requestPixmap(3, cRect(0, 0, geoManager.osdWidth, geoManager.osdHeight), 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); - 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); 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))); 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->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)); } void cDetailView::drawHeader() { - header->drawBackground(); - header->drawBoldBorder(); - tColor colorTextBack = (tvguideConfig.useBlending==0)?theme.Color(clrHeader):clrTransparent; - int logoHeight = header->Height() / 2; + if (tvguideConfig.style == eStyleGraphical) { + header->drawBackgroundGraphical(bgEpgHeader); + } else { + header->drawBackground(); + header->drawBoldBorder(); + } + tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?theme.Color(clrHeader):clrTransparent; + int logoHeight = 2 * header->Height() / 3; int logoWidth = logoHeight * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio; - int lineHeight = tvguideConfig.FontDetailHeader->Height(); + int lineHeight = fontManager.FontDetailHeader->Height(); cImageLoader imgLoader; bool logoDrawn = false; if (!tvguideConfig.hideChannelLogos) { - cString channelName = Channels.GetByChannelID(event->ChannelID())->Name(); - if (imgLoader.LoadLogo(*channelName, logoWidth, logoHeight)) { + const cChannel *channel = Channels.GetByChannelID(event->ChannelID()); + if (imgLoader.LoadLogo(channel, logoWidth, logoHeight)) { cImage logo = imgLoader.GetImage(); headerLogo->DrawImage(cPoint(10, (header->Height() - logoHeight)/2), logo); logoDrawn = true; } } + bool epgImageDrawn = false; + int epgImageWidth = 0; 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(); - int epgImageX = header->Width() - 30 - tvguideConfig.epgImageWidth; - int epgImageY = (header->Height() - 10 - tvguideConfig.epgImageHeight) / 2; - header->DrawRectangle(cRect(epgImageX-2, epgImageY-2, tvguideConfig.epgImageWidth + 4, tvguideConfig.epgImageHeight + 4), theme.Color(clrBorder)); + int epgImageX = header->Width() - border - epgImageWidth; + int epgImageY = (header->Height() - epgImageHeight) / 2; + header->DrawRectangle(cRect(epgImageX-2, epgImageY-2, epgImageWidth + 4, epgImageHeight + 4), theme.Color(clrBorder)); header->DrawImage(cPoint(epgImageX, epgImageY), epgImage); + epgImageDrawn = true; } } - int textX = logoDrawn?(20 + logoWidth):20; - int textY = (header->Height() - 2*lineHeight)/2; - header->DrawText(cPoint(textX, textY), event->Title(), theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailHeader); - cString datetime = cString::sprintf("%s, %s - %s (%d min)", *event->GetDateString(), *event->GetTimeString(), *event->GetEndTimeString(), event->Duration()/60); - header->DrawText(cPoint(textX, textY + lineHeight), *datetime, theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailView); - header->DrawText(cPoint(textX, textY + 2 * lineHeight), event->ShortText(), theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailView); + int textX = logoDrawn?(border + logoWidth + 5):border; + int textY = (header->Height() - 7*lineHeight/2)/2; + int maxTextWidth = header->Width() - 2 * border; + if (logoDrawn) + maxTextWidth -= logoWidth; + 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; cTimer *ti; @@ -192,28 +214,28 @@ void cDetailView::drawHeader() { void cDetailView::drawRecIcon() { cString recIconText(" REC "); int headerWidth = width; - int widthIcon = tvguideConfig.FontDetailHeader->Width(*recIconText); - int height = tvguideConfig.FontDetailHeader->Height()+10; + int widthIcon = fontManager.FontDetailHeader->Width(*recIconText); + int height = fontManager.FontDetailHeader->Height()+10; int posX = headerWidth - widthIcon - 20; int posY = 20; 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() { content->Fill(theme.Color(clrBorder)); 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(); for (int i=0; iDrawText(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) { textLines = reruns.Lines(); for (int j=0; jDrawText(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() { 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))); drawScrollbar(); } @@ -277,7 +299,7 @@ void cDetailView::scrollUp() { void cDetailView::scrollDown() { 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); content->SetDrawPortPoint(cPoint(0, max(newDrawportHeight,(-1)*maxDrawportHeight))); drawScrollbar(); @@ -309,7 +331,7 @@ void cDetailView::pageDown() { cImage *cDetailView::createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend) { cImage *image = new cImage(cSize(width, height)); image->Fill(clrBgr); - if (tvguideConfig.useBlending) { + if (tvguideConfig.style != eStyleFlat) { int numSteps = 64; int alphaStep = 0x03; if (height < 30) @@ -379,9 +401,9 @@ void cDetailView::loadReruns(void) { 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 - reruns.Set("", tvguideConfig.FontDetailView, contentWidth - scrollBarWidth); + reruns.Set("", fontManager.FontDetailView, contentWidth - scrollBarWidth); } int cDetailView::heightEPGPics(void) { @@ -420,7 +442,7 @@ int cDetailView::heightActorPics(void) { int picLines = numActors / picsPerLine; if (numActors%picsPerLine != 0) 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; } @@ -533,17 +555,17 @@ void cDetailView::drawActors(int height) { int numActors = mediaInfo.actors.size(); if (numActors < 1) 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")); - 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 picLines = numActors / picsPerLine; if (numActors%picsPerLine != 0) picLines++; int x = 0; - int y = height + tvguideConfig.FontDetailHeader->Height(); + int y = height + fontManager.FontDetailHeader->Height(); if (!Running()) return; cImageLoader imgLoader; @@ -563,21 +585,21 @@ void cDetailView::drawActors(int height) { std::stringstream sstrRole; sstrRole << "\"" << mediaInfo.actors[actor].role << "\""; std::string role = sstrRole.str(); - if (tvguideConfig.FontDetailViewSmall->Width(name.c_str()) > actorThumbWidth + 2*border) - name = CutText(name, actorThumbWidth + 2*border, tvguideConfig.FontDetailViewSmall); - if (tvguideConfig.FontDetailViewSmall->Width(role.c_str()) > actorThumbWidth + 2*border) - role = CutText(role, actorThumbWidth + 2*border, tvguideConfig.FontDetailViewSmall); - int xName = x + ((actorThumbWidth+2*border) - tvguideConfig.FontDetailViewSmall->Width(name.c_str()))/2; - int xRole = x + ((actorThumbWidth+2*border) - tvguideConfig.FontDetailViewSmall->Width(role.c_str()))/2; + if (fontManager.FontDetailViewSmall->Width(name.c_str()) > actorThumbWidth + 2*border) + name = CutText(name, actorThumbWidth + 2*border, fontManager.FontDetailViewSmall); + if (fontManager.FontDetailViewSmall->Width(role.c_str()) > actorThumbWidth + 2*border) + role = CutText(role, actorThumbWidth + 2*border, fontManager.FontDetailViewSmall); + int xName = x + ((actorThumbWidth+2*border) - fontManager.FontDetailViewSmall->Width(name.c_str()))/2; + int xRole = x + ((actorThumbWidth+2*border) - fontManager.FontDetailViewSmall->Width(role.c_str()))/2; if (Running() && content) { - content->DrawText(cPoint(xName, y + actorThumbHeight), name.c_str(), theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailViewSmall); - content->DrawText(cPoint(xRole, y + actorThumbHeight + tvguideConfig.FontDetailViewSmall->Height()), role.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 + fontManager.FontDetailViewSmall->Height()), role.c_str(), theme.Color(clrFont), colorTextBack, fontManager.FontDetailViewSmall); x += actorThumbWidth + 2*border; } actor++; } x = 0; - y += actorThumbHeight + 2 * tvguideConfig.FontDetailViewSmall->Height(); + y += actorThumbHeight + 2 * fontManager.FontDetailViewSmall->Height(); } } diff --git a/detailview.h b/detailview.h index 9aba9c1..0693cca 100644 --- a/detailview.h +++ b/detailview.h @@ -13,6 +13,7 @@ class cEpgGrid; class cDetailView : public cThread { private: + cPixmap *back; cStyledPixmap *header; cPixmap *headerLogo; cPixmap *headerBack; @@ -26,7 +27,6 @@ private: cTextWrapper reruns; TVScraperGetFullInformation mediaInfo; bool hasAdditionalMedia; - int borderWidth; int border; int headerHeight; int width; diff --git a/dummygrid.c b/dummygrid.c index 6131e13..4ab0692 100644 --- a/dummygrid.c +++ b/dummygrid.c @@ -20,7 +20,7 @@ time_t cDummyGrid::Duration(void) { void cDummyGrid::SetViewportHeight() { int viewportHeightOld = viewportHeight; - viewportHeight = Duration() / 60 * tvguideConfig.minutePixel; + viewportHeight = Duration() / 60 * geoManager.minutePixel; if (viewportHeight != viewportHeightOld) dirty = true; } @@ -29,61 +29,61 @@ void cDummyGrid::PositionPixmap() { int x0, y0; if (tvguideConfig.displayMode == eVertical) { x0 = column->getX(); - y0 = tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight; + y0 = geoManager.statusHeaderHeight + geoManager.channelHeaderHeight + geoManager.channelGroupsHeight; if ( column->Start() < StartTime() ) { - y0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel; + y0 += (StartTime() - column->Start())/60*geoManager.minutePixel; } 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) { osdManager.releasePixmap(pixmap); - pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, tvguideConfig.colWidth, viewportHeight)); + pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, geoManager.colWidth, viewportHeight)); } else { - pixmap->SetViewPort(cRect(x0, y0, tvguideConfig.colWidth, viewportHeight)); + pixmap->SetViewPort(cRect(x0, y0, geoManager.colWidth, viewportHeight)); } } else if (tvguideConfig.displayMode == eHorizontal) { - x0 = tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth; + x0 = geoManager.channelHeaderWidth + geoManager.channelGroupsWidth; y0 = column->getY(); if ( column->Start() < StartTime() ) { - x0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel; + x0 += (StartTime() - column->Start())/60*geoManager.minutePixel; } 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) { osdManager.releasePixmap(pixmap); - pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, tvguideConfig.rowHeight)); + pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, geoManager.rowHeight)); } else { - pixmap->SetViewPort(cRect(x0, y0, viewportHeight, tvguideConfig.rowHeight)); + pixmap->SetViewPort(cRect(x0, y0, viewportHeight, geoManager.rowHeight)); } } } void cDummyGrid::setText() { 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() { 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 (Height()/tvguideConfig.minutePixel < 6) + if (Height()/geoManager.minutePixel < 6) return; - int textHeight = tvguideConfig.FontGrid->Height(); + int textHeight = fontManager.FontGrid->Height(); int textLines = text->Lines(); for (int i=0; iDrawText(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) { - if (Width()/tvguideConfig.minutePixel < 10) { - int titleY = (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontal->Height())/2; - pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, tvguideConfig.FontGridHorizontal); + if (Width()/geoManager.minutePixel < 10) { + int titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2; + pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, fontManager.FontGridHorizontal); return; } - int titleY = (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontal->Height())/2; - pixmap->DrawText(cPoint(borderWidth, titleY), *strText, colorText, colorTextBack, tvguideConfig.FontGridHorizontal); + int titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2; + pixmap->DrawText(cPoint(borderWidth, titleY), *strText, colorText, colorTextBack, fontManager.FontGridHorizontal); } } cString cDummyGrid::getText(void) { diff --git a/epggrid.c b/epggrid.c index 4f48d4d..2d8a703 100644 --- a/epggrid.c +++ b/epggrid.c @@ -27,7 +27,7 @@ void cEpgGrid::SetViewportHeight() { } else { viewportHeight = Duration() / 60; } - viewportHeight *= tvguideConfig.minutePixel; + viewportHeight *= geoManager.minutePixel; if (viewportHeight != viewportHeightOld) dirty = true; } @@ -36,27 +36,27 @@ void cEpgGrid::PositionPixmap() { int x0, y0; if (tvguideConfig.displayMode == eVertical) { int x0 = column->getX(); - int y0 = tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight; + int y0 = geoManager.statusHeaderHeight + geoManager.channelHeaderHeight + geoManager.channelGroupsHeight; if ( column->Start() < StartTime() ) { - y0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel; + y0 += (StartTime() - column->Start())/60*geoManager.minutePixel; } if (!pixmap) { - pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, tvguideConfig.colWidth, viewportHeight), - cRect(0, 0, tvguideConfig.colWidth, Duration()/60*tvguideConfig.minutePixel)); + pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, geoManager.colWidth, viewportHeight), + cRect(0, 0, geoManager.colWidth, Duration()/60*geoManager.minutePixel)); } else { - pixmap->SetViewPort(cRect(x0, y0, tvguideConfig.colWidth, viewportHeight)); + pixmap->SetViewPort(cRect(x0, y0, geoManager.colWidth, viewportHeight)); } } else if (tvguideConfig.displayMode == eHorizontal) { - int x0 = tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth; + int x0 = geoManager.channelHeaderWidth + geoManager.channelGroupsWidth; int y0 = column->getY(); if ( column->Start() < StartTime() ) { - x0 += (StartTime() - column->Start())/60*tvguideConfig.minutePixel; + x0 += (StartTime() - column->Start())/60*geoManager.minutePixel; } if (!pixmap) { - pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, tvguideConfig.rowHeight), - cRect(0, 0, Duration()/60*tvguideConfig.minutePixel, tvguideConfig.rowHeight)); + pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, geoManager.rowHeight), + cRect(0, 0, Duration()/60*geoManager.minutePixel, geoManager.rowHeight)); } 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) { cString strText; strText = cString::sprintf("%s - %s:\n%s", *(event->GetTimeString()), *(event->GetEndTimeString()), event->Title()); - text->Set(*(strText), tvguideConfig.FontGrid, tvguideConfig.colWidth-2*borderWidth); - extText->Set(event->ShortText(), tvguideConfig.FontGridSmall, tvguideConfig.colWidth-2*borderWidth); + text->Set(*(strText), fontManager.FontGrid, geoManager.colWidth-2*borderWidth); + extText->Set(event->ShortText(), fontManager.FontGridSmall, geoManager.colWidth-2*borderWidth); } else if (tvguideConfig.displayMode == eHorizontal) { timeString = cString::sprintf("%s - %s", *(event->GetTimeString()), *(event->GetEndTimeString())); } @@ -98,38 +98,38 @@ void cEpgGrid::setText() { void cEpgGrid::drawText() { 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 (Height()/tvguideConfig.minutePixel < 6) + if (Height()/geoManager.minutePixel < 6) return; - int textHeight = tvguideConfig.FontGrid->Height(); + int textHeight = fontManager.FontGrid->Height(); int textLines = text->Lines(); for (int i=0; iDrawText(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 offset = (textLines+1)*textHeight - 0.5*textHeight; - textHeight = tvguideConfig.FontGridSmall->Height(); + textHeight = fontManager.FontGridSmall->Height(); if ((Height()-textHeight-10) > offset) { for (int i=0; iDrawText(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) { - if (Width()/tvguideConfig.minutePixel < 10) { - int titleY = (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontal->Height())/2; - pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, tvguideConfig.FontGridHorizontal); + if (Width()/geoManager.minutePixel < 10) { + int titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2; + pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, fontManager.FontGridHorizontal); return; } - cString strTitle = CutText(event->Title(), viewportHeight, tvguideConfig.FontGridHorizontal).c_str(); + cString strTitle = CutText(event->Title(), viewportHeight, fontManager.FontGridHorizontal).c_str(); int titleY = 0; if (tvguideConfig.showTimeInGrid) { - pixmap->DrawText(cPoint(borderWidth, borderWidth), *timeString, colorText, colorTextBack, tvguideConfig.FontGridHorizontalSmall); - titleY = tvguideConfig.FontGridHorizontalSmall->Height() + (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontalSmall->Height() - tvguideConfig.FontGridHorizontal->Height())/2; + pixmap->DrawText(cPoint(borderWidth, borderWidth), *timeString, colorText, colorTextBack, fontManager.FontGridHorizontalSmall); + titleY = fontManager.FontGridHorizontalSmall->Height() + (geoManager.rowHeight - fontManager.FontGridHorizontalSmall->Height() - fontManager.FontGridHorizontal->Height())/2; } 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) drawIcon("Switch", theme.Color(clrButtonYellow)); @@ -140,8 +140,8 @@ void cEpgGrid::drawText() { void cEpgGrid::drawIcon(cString iconText, tColor color) { const cFont *font = (tvguideConfig.displayMode == eVertical) - ?tvguideConfig.FontGrid - :tvguideConfig.FontGridHorizontalSmall; + ?fontManager.FontGrid + :fontManager.FontGridHorizontalSmall; int textWidth = font->Width(*iconText)+2*borderWidth; int textHeight = font->Height()+10; pixmap->DrawRectangle( cRect(Width() - textWidth - borderWidth, Height() - textHeight - borderWidth, textWidth, textHeight), color); diff --git a/fontmanager.c b/fontmanager.c new file mode 100644 index 0000000..5123b7e --- /dev/null +++ b/fontmanager.c @@ -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); +} + diff --git a/fontmanager.h b/fontmanager.h new file mode 100644 index 0000000..e9e72dd --- /dev/null +++ b/fontmanager.h @@ -0,0 +1,39 @@ +#ifndef __TVGUIDE_FONTMANAGER_H +#define __TVGUIDE_FONTMANAGER_H + +#include + +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 \ No newline at end of file diff --git a/footer.c b/footer.c index 36bf652..8d1d03e 100644 --- a/footer.c +++ b/footer.c @@ -6,16 +6,13 @@ cFooter::cFooter(cChannelGroups *channelGroups) { this->channelGroups = channelGroups; currentGroup = -1; - buttonBorder = 20; - buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeLineWidth - 5*buttonBorder)/4; - buttonHeight= tvguideConfig.footerHeight - 2*buttonBorder; - buttonY = (tvguideConfig.footerHeight - buttonHeight)/2; + buttonY = (geoManager.footerHeight - geoManager.buttonHeight)/2; SetButtonPositions(); - footer = osdManager.requestPixmap(2, cRect( tvguideConfig.timeLineWidth, - tvguideConfig.osdHeight - tvguideConfig.footerHeight, - tvguideConfig.osdWidth - tvguideConfig.timeLineWidth, - tvguideConfig.footerHeight), + footer = osdManager.requestPixmap(2, cRect( 0, + geoManager.osdHeight - geoManager.footerHeight, + geoManager.osdWidth, + geoManager.footerHeight), cRect::Null); footer->Fill(clrTransparent); } @@ -24,6 +21,49 @@ cFooter::~cFooter(void) { 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) { for (int i=0; i < 4; i++) { positionButtons[i] = -1; @@ -54,62 +94,26 @@ void cFooter::SetButtonPositions(void) { } } -void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, int num) { - tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; - int left = num * buttonWidth + (num + 1) * buttonBorder; - footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor); - if (tvguideConfig.useBlending) { +void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, eOsdElementType buttonType, int num) { + tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent; + int left = num * geoManager.buttonWidth + (2 * num + 1) * geoManager.buttonBorder; + + if ((tvguideConfig.style == eStyleBlendingMagick) || (tvguideConfig.style == eStyleBlendingDefault)) { 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()); + } else if (tvguideConfig.style == eStyleGraphical) { + cImage *button = imgCache.GetOsdElement(buttonType); + if (button) { + footer->DrawImage(cPoint(left, buttonY), *button); + } } else { - footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor); - footer->DrawRectangle(cRect(left+2, buttonY+2, buttonWidth-4, buttonHeight-4), color); + footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor); + 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() { - cString text(tr("Search & Rec")); - DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), positionButtons[0]); -} - -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)); - } -} + + int textWidth = fontManager.FontButton->Width(text); + int textHeight = fontManager.FontButton->Height(); + footer->DrawText(cPoint(left + (geoManager.buttonWidth-textWidth)/2, buttonY + (geoManager.buttonHeight-textHeight)/2), text, theme.Color(clrFontButtons), colorTextBack, fontManager.FontButton); +} \ No newline at end of file diff --git a/footer.h b/footer.h index 9a640bd..51fc096 100644 --- a/footer.h +++ b/footer.h @@ -9,15 +9,12 @@ class cFooter { private: cPixmap *footer; - int buttonWidth; - int buttonHeight; int buttonY; - int buttonBorder; int positionButtons[4]; cChannelGroups *channelGroups; int currentGroup; 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: cFooter(cChannelGroups *channelGroups); virtual ~cFooter(void); diff --git a/geometrymanager.c b/geometrymanager.c new file mode 100644 index 0000000..6c9362d --- /dev/null +++ b/geometrymanager.c @@ -0,0 +1,70 @@ +#include + +#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; +} \ No newline at end of file diff --git a/geometrymanager.h b/geometrymanager.h new file mode 100644 index 0000000..43ab3e5 --- /dev/null +++ b/geometrymanager.h @@ -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 \ No newline at end of file diff --git a/grid.c b/grid.c index ff330d6..9a878d4 100644 --- a/grid.c +++ b/grid.c @@ -34,10 +34,15 @@ void cGrid::Draw() { return; } if (dirty) { - setBackground(); - drawBackground(); - drawText(); - drawBorder(); + if (tvguideConfig.style == eStyleGraphical) { + drawBackgroundGraphical(bgGrid, active); + drawText(); + } else { + setBackground(); + drawBackground(); + drawText(); + drawBorder(); + } pixmap->SetLayer(1); dirty = false; } diff --git a/headergrid.c b/headergrid.c index d4abe59..ec6a991 100644 --- a/headergrid.c +++ b/headergrid.c @@ -14,25 +14,26 @@ cHeaderGrid::~cHeaderGrid(void) { void cHeaderGrid::createBackground(int num) { color = theme.Color(clrHeader); colorBlending = theme.Color(clrHeaderBlending); - int x, y, width, height; + int x, y; if (tvguideConfig.displayMode == eVertical) { - x = tvguideConfig.timeLineWidth + num*tvguideConfig.colWidth; - y = tvguideConfig.statusHeaderHeight + tvguideConfig.channelGroupsHeight; - width = tvguideConfig.colWidth; - height = tvguideConfig.channelHeaderHeight; + x = geoManager.timeLineWidth + num*geoManager.colWidth; + y = geoManager.statusHeaderHeight + geoManager.channelGroupsHeight; } else if (tvguideConfig.displayMode == eHorizontal) { - x = tvguideConfig.channelGroupsWidth; - y = tvguideConfig.statusHeaderHeight + tvguideConfig.timeLineHeight + num*tvguideConfig.rowHeight; - width = tvguideConfig.channelHeaderWidth; - height = tvguideConfig.rowHeight; + x = geoManager.channelGroupsWidth; + y = geoManager.statusHeaderHeight + geoManager.timeLineHeight + num*geoManager.rowHeight; } - pixmap = osdManager.requestPixmap(1, cRect(x, y, width, height)); - pixmapLogo = osdManager.requestPixmap(2, cRect(x, y, width, height)); + pixmap = osdManager.requestPixmap(1, cRect(x, y, geoManager.channelLogoWidth, geoManager.channelLogoHeight)); + pixmapLogo = osdManager.requestPixmap(2, cRect(x, y, geoManager.channelLogoWidth, geoManager.channelLogoHeight)); if ((!pixmap) || (!pixmapLogo)){ return; } pixmapLogo->Fill(clrTransparent); - drawBackground(); + if (tvguideConfig.style == eStyleGraphical) { + drawBackgroundGraphical(bgChannelHeader); + } else { + drawBackground(); + drawBorder(); + } } void cHeaderGrid::drawChannel(const cChannel *channel) { @@ -41,20 +42,18 @@ void cHeaderGrid::drawChannel(const cChannel *channel) { } else if (tvguideConfig.displayMode == eHorizontal) { drawChannelHorizontal(channel); } - drawBorder(); } 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 textX = 5; - int textY = (Height() - tvguideConfig.FontChannelHeaderHorizontal->Height())/2; + int textY = (Height() - fontManager.FontChannelHeaderHorizontal->Height())/2; bool logoFound = false; if (!tvguideConfig.hideChannelLogos) { - cImageLoader imgLoader; - if (imgLoader.LoadLogo(channel->Name(), logoWidth, Height())) { - cImage logo = imgLoader.GetImage(); - pixmapLogo->DrawImage(cPoint(logoX, 0), logo); + cImage *logo = imgCache.GetLogo(channel); + if (logo) { + pixmapLogo->DrawImage(cPoint(logoX, 0), *logo); logoFound = true; } } @@ -68,28 +67,27 @@ void cHeaderGrid::drawChannelHorizontal(const cChannel *channel) { textWidthMax -= logoWidth; } 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()); - strChannel = CutText(*strChannel, textWidthMax, tvguideConfig.FontChannelHeaderHorizontal).c_str(); - pixmap->DrawText(cPoint(textX, textY), *strChannel, theme.Color(clrFontHeader), colorTextBack, tvguideConfig.FontChannelHeaderHorizontal); + strChannel = CutText(*strChannel, textWidthMax, fontManager.FontChannelHeaderHorizontal).c_str(); + pixmap->DrawText(cPoint(textX, textY), *strChannel, theme.Color(clrFontHeader), colorTextBack, fontManager.FontChannelHeaderHorizontal); } } void cHeaderGrid::drawChannelVertical(const cChannel *channel) { - int logoWidth = Width()/2 - 15; - int logoHeight = logoWidth * tvguideConfig.logoHeightRatio / tvguideConfig.logoWidthRatio; + int logoWidth = geoManager.logoWidth; + int logoHeight = geoManager.logoHeight; cTextWrapper tw; 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 lineHeight = tvguideConfig.FontChannelHeader->Height(); - int yStart = (tvguideConfig.channelHeaderHeight - lines*lineHeight)/2 + 8; + int lineHeight = fontManager.FontChannelHeader->Height(); + int yStart = (geoManager.channelHeaderHeight - lines*lineHeight)/2 + 8; bool logoFound = false; if (!tvguideConfig.hideChannelLogos) { - cImageLoader imgLoader; - if (imgLoader.LoadLogo(channel->Name(), logoWidth, logoHeight)) { - cImage logo = imgLoader.GetImage(); - pixmapLogo->DrawImage(cPoint((Width() - logoWidth)/2, 4), logo); + cImage *logo = imgCache.GetLogo(channel); + if (logo) { + pixmapLogo->DrawImage(cPoint((Width() - logoWidth)/2, 4), *logo); logoFound = true; } } @@ -102,28 +100,28 @@ void cHeaderGrid::drawChannelVertical(const cChannel *channel) { } if (!drawText) return; - tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; + tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent; for (int i=0; iWidth(tw.GetLine(i)); - int xText = (tvguideConfig.colWidth - textWidth) / 2; + int textWidth = fontManager.FontChannelHeader->Width(tw.GetLine(i)); + int xText = (geoManager.colWidth - textWidth) / 2; if (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) { int x, y, width, height; if (tvguideConfig.displayMode == eVertical) { - x = tvguideConfig.timeLineWidth + num*tvguideConfig.colWidth; - y = tvguideConfig.statusHeaderHeight + tvguideConfig.channelGroupsHeight; - width = tvguideConfig.colWidth; - height = tvguideConfig.channelHeaderHeight; + x = geoManager.timeLineWidth + num*geoManager.colWidth; + y = geoManager.statusHeaderHeight + geoManager.channelGroupsHeight; + width = geoManager.colWidth; + height = geoManager.channelHeaderHeight; } else if (tvguideConfig.displayMode == eHorizontal) { - x = tvguideConfig.channelGroupsWidth; - y = tvguideConfig.statusHeaderHeight + tvguideConfig.timeLineHeight + num*tvguideConfig.rowHeight; - width = tvguideConfig.channelHeaderWidth; - height = tvguideConfig.rowHeight; + x = geoManager.channelGroupsWidth; + y = geoManager.statusHeaderHeight + geoManager.timeLineHeight + num*geoManager.rowHeight; + width = geoManager.channelHeaderWidth; + height = geoManager.rowHeight; } pixmap->SetViewPort(cRect(x, y, width, height)); pixmapLogo->SetViewPort(cRect(x, y, width, height)); diff --git a/icons/darkredNG/osdElements/button_30percent.png b/icons/darkredNG/osdElements/button_30percent.png new file mode 100644 index 0000000..58f0281 Binary files /dev/null and b/icons/darkredNG/osdElements/button_30percent.png differ diff --git a/icons/darkredNG/osdElements/button_70percent.png b/icons/darkredNG/osdElements/button_70percent.png new file mode 100644 index 0000000..7234f08 Binary files /dev/null and b/icons/darkredNG/osdElements/button_70percent.png differ diff --git a/icons/darkredNG/osdElements/button_active_30percent.png b/icons/darkredNG/osdElements/button_active_30percent.png new file mode 100644 index 0000000..1b5aab0 Binary files /dev/null and b/icons/darkredNG/osdElements/button_active_30percent.png differ diff --git a/icons/darkredNG/osdElements/button_active_70percent.png b/icons/darkredNG/osdElements/button_active_70percent.png new file mode 100644 index 0000000..ba09ea0 Binary files /dev/null and b/icons/darkredNG/osdElements/button_active_70percent.png differ diff --git a/icons/darkredNG/osdElements/buttonblue.png b/icons/darkredNG/osdElements/buttonblue.png new file mode 100644 index 0000000..ac3536c Binary files /dev/null and b/icons/darkredNG/osdElements/buttonblue.png differ diff --git a/icons/darkredNG/osdElements/buttongreen.png b/icons/darkredNG/osdElements/buttongreen.png new file mode 100644 index 0000000..e598518 Binary files /dev/null and b/icons/darkredNG/osdElements/buttongreen.png differ diff --git a/icons/darkredNG/osdElements/buttonred.png b/icons/darkredNG/osdElements/buttonred.png new file mode 100644 index 0000000..152acad Binary files /dev/null and b/icons/darkredNG/osdElements/buttonred.png differ diff --git a/icons/darkredNG/osdElements/buttonyellow.png b/icons/darkredNG/osdElements/buttonyellow.png new file mode 100644 index 0000000..1b448c9 Binary files /dev/null and b/icons/darkredNG/osdElements/buttonyellow.png differ diff --git a/icons/darkredNG/osdElements/channelgroup_bottom.png b/icons/darkredNG/osdElements/channelgroup_bottom.png new file mode 100644 index 0000000..7127ea7 Binary files /dev/null and b/icons/darkredNG/osdElements/channelgroup_bottom.png differ diff --git a/icons/darkredNG/osdElements/channelgroup_head.png b/icons/darkredNG/osdElements/channelgroup_head.png new file mode 100644 index 0000000..bce9d22 Binary files /dev/null and b/icons/darkredNG/osdElements/channelgroup_head.png differ diff --git a/icons/darkredNG/osdElements/channelgroup_horizontal.png b/icons/darkredNG/osdElements/channelgroup_horizontal.png new file mode 100644 index 0000000..13d733c Binary files /dev/null and b/icons/darkredNG/osdElements/channelgroup_horizontal.png differ diff --git a/icons/darkredNG/osdElements/channelgroup_left.png b/icons/darkredNG/osdElements/channelgroup_left.png new file mode 100644 index 0000000..df495b1 Binary files /dev/null and b/icons/darkredNG/osdElements/channelgroup_left.png differ diff --git a/icons/darkredNG/osdElements/channelgroup_right.png b/icons/darkredNG/osdElements/channelgroup_right.png new file mode 100644 index 0000000..42dcf6d Binary files /dev/null and b/icons/darkredNG/osdElements/channelgroup_right.png differ diff --git a/icons/darkredNG/osdElements/channelgroup_vertical.png b/icons/darkredNG/osdElements/channelgroup_vertical.png new file mode 100644 index 0000000..43778d0 Binary files /dev/null and b/icons/darkredNG/osdElements/channelgroup_vertical.png differ diff --git a/icons/darkredNG/osdElements/channellogoback_horizontal.png b/icons/darkredNG/osdElements/channellogoback_horizontal.png new file mode 100644 index 0000000..d9bb54a Binary files /dev/null and b/icons/darkredNG/osdElements/channellogoback_horizontal.png differ diff --git a/icons/darkredNG/osdElements/channellogoback_vertical.png b/icons/darkredNG/osdElements/channellogoback_vertical.png new file mode 100644 index 0000000..06684cc Binary files /dev/null and b/icons/darkredNG/osdElements/channellogoback_vertical.png differ diff --git a/icons/darkredNG/osdElements/clock.png b/icons/darkredNG/osdElements/clock.png new file mode 100644 index 0000000..2e8686e Binary files /dev/null and b/icons/darkredNG/osdElements/clock.png differ diff --git a/icons/darkredNG/osdElements/date_vertical.png b/icons/darkredNG/osdElements/date_vertical.png new file mode 100644 index 0000000..58a72e4 Binary files /dev/null and b/icons/darkredNG/osdElements/date_vertical.png differ diff --git a/icons/darkredNG/osdElements/epgview_header.png b/icons/darkredNG/osdElements/epgview_header.png new file mode 100644 index 0000000..c42dad8 Binary files /dev/null and b/icons/darkredNG/osdElements/epgview_header.png differ diff --git a/icons/darkredNG/osdElements/grid_active_bottom.png b/icons/darkredNG/osdElements/grid_active_bottom.png new file mode 100644 index 0000000..08de467 Binary files /dev/null and b/icons/darkredNG/osdElements/grid_active_bottom.png differ diff --git a/icons/darkredNG/osdElements/grid_active_head.png b/icons/darkredNG/osdElements/grid_active_head.png new file mode 100644 index 0000000..060a908 Binary files /dev/null and b/icons/darkredNG/osdElements/grid_active_head.png differ diff --git a/icons/darkredNG/osdElements/grid_active_horizontal.png b/icons/darkredNG/osdElements/grid_active_horizontal.png new file mode 100644 index 0000000..9319d6b Binary files /dev/null and b/icons/darkredNG/osdElements/grid_active_horizontal.png differ diff --git a/icons/darkredNG/osdElements/grid_active_left.png b/icons/darkredNG/osdElements/grid_active_left.png new file mode 100644 index 0000000..7852d94 Binary files /dev/null and b/icons/darkredNG/osdElements/grid_active_left.png differ diff --git a/icons/darkredNG/osdElements/grid_active_right.png b/icons/darkredNG/osdElements/grid_active_right.png new file mode 100644 index 0000000..73dfbd0 Binary files /dev/null and b/icons/darkredNG/osdElements/grid_active_right.png differ diff --git a/icons/darkredNG/osdElements/grid_active_vertical.png b/icons/darkredNG/osdElements/grid_active_vertical.png new file mode 100644 index 0000000..6d96d34 Binary files /dev/null and b/icons/darkredNG/osdElements/grid_active_vertical.png differ diff --git a/icons/darkredNG/osdElements/grid_bottom.png b/icons/darkredNG/osdElements/grid_bottom.png new file mode 100644 index 0000000..82c20c4 Binary files /dev/null and b/icons/darkredNG/osdElements/grid_bottom.png differ diff --git a/icons/darkredNG/osdElements/grid_head.png b/icons/darkredNG/osdElements/grid_head.png new file mode 100644 index 0000000..f434c11 Binary files /dev/null and b/icons/darkredNG/osdElements/grid_head.png differ diff --git a/icons/darkredNG/osdElements/grid_horizontal.png b/icons/darkredNG/osdElements/grid_horizontal.png new file mode 100644 index 0000000..6f28550 Binary files /dev/null and b/icons/darkredNG/osdElements/grid_horizontal.png differ diff --git a/icons/darkredNG/osdElements/grid_left.png b/icons/darkredNG/osdElements/grid_left.png new file mode 100644 index 0000000..df80f91 Binary files /dev/null and b/icons/darkredNG/osdElements/grid_left.png differ diff --git a/icons/darkredNG/osdElements/grid_right.png b/icons/darkredNG/osdElements/grid_right.png new file mode 100644 index 0000000..d39470f Binary files /dev/null and b/icons/darkredNG/osdElements/grid_right.png differ diff --git a/icons/darkredNG/osdElements/grid_vertical.png b/icons/darkredNG/osdElements/grid_vertical.png new file mode 100644 index 0000000..6ad219d Binary files /dev/null and b/icons/darkredNG/osdElements/grid_vertical.png differ diff --git a/icons/darkredNG/osdElements/recmenu_background.png b/icons/darkredNG/osdElements/recmenu_background.png new file mode 100644 index 0000000..2ab2573 Binary files /dev/null and b/icons/darkredNG/osdElements/recmenu_background.png differ diff --git a/icons/darkredNG/osdElements/statusheader_content_full.png b/icons/darkredNG/osdElements/statusheader_content_full.png new file mode 100644 index 0000000..7fd6885 Binary files /dev/null and b/icons/darkredNG/osdElements/statusheader_content_full.png differ diff --git a/icons/darkredNG/osdElements/statusheader_content_windowed.png b/icons/darkredNG/osdElements/statusheader_content_windowed.png new file mode 100644 index 0000000..56a60a7 Binary files /dev/null and b/icons/darkredNG/osdElements/statusheader_content_windowed.png differ diff --git a/icons/darkredNG/osdElements/statusheader_tvframe.png b/icons/darkredNG/osdElements/statusheader_tvframe.png new file mode 100644 index 0000000..261fea3 Binary files /dev/null and b/icons/darkredNG/osdElements/statusheader_tvframe.png differ diff --git a/icons/darkredNG/osdElements/timeline1_horizontal.png b/icons/darkredNG/osdElements/timeline1_horizontal.png new file mode 100644 index 0000000..9240b37 Binary files /dev/null and b/icons/darkredNG/osdElements/timeline1_horizontal.png differ diff --git a/icons/darkredNG/osdElements/timeline1_vertical.png b/icons/darkredNG/osdElements/timeline1_vertical.png new file mode 100644 index 0000000..5466546 Binary files /dev/null and b/icons/darkredNG/osdElements/timeline1_vertical.png differ diff --git a/icons/darkredNG/osdElements/timeline2_horizontal.png b/icons/darkredNG/osdElements/timeline2_horizontal.png new file mode 100644 index 0000000..4364677 Binary files /dev/null and b/icons/darkredNG/osdElements/timeline2_horizontal.png differ diff --git a/icons/darkredNG/osdElements/timeline2_vertical.png b/icons/darkredNG/osdElements/timeline2_vertical.png new file mode 100644 index 0000000..dfa06c9 Binary files /dev/null and b/icons/darkredNG/osdElements/timeline2_vertical.png differ diff --git a/icons/default/icons/arrow_left.png b/icons/default/icons/arrow_left.png new file mode 100644 index 0000000..a65e47d Binary files /dev/null and b/icons/default/icons/arrow_left.png differ diff --git a/icons/default/icons/arrow_right.png b/icons/default/icons/arrow_right.png new file mode 100644 index 0000000..97fa123 Binary files /dev/null and b/icons/default/icons/arrow_right.png differ diff --git a/icons/default/icons/delete_active.png b/icons/default/icons/delete_active.png new file mode 100644 index 0000000..b01dc5c Binary files /dev/null and b/icons/default/icons/delete_active.png differ diff --git a/icons/default/icons/delete_inactive.png b/icons/default/icons/delete_inactive.png new file mode 100644 index 0000000..b327f07 Binary files /dev/null and b/icons/default/icons/delete_inactive.png differ diff --git a/icons/default/icons/edit_active.png b/icons/default/icons/edit_active.png new file mode 100644 index 0000000..5b3b667 Binary files /dev/null and b/icons/default/icons/edit_active.png differ diff --git a/icons/default/icons/edit_inactive.png b/icons/default/icons/edit_inactive.png new file mode 100644 index 0000000..d4f59a1 Binary files /dev/null and b/icons/default/icons/edit_inactive.png differ diff --git a/icons/default/icons/icon_backspace.png b/icons/default/icons/icon_backspace.png new file mode 100644 index 0000000..e20b7bd Binary files /dev/null and b/icons/default/icons/icon_backspace.png differ diff --git a/icons/default/icons/icon_del_ins.png b/icons/default/icons/icon_del_ins.png new file mode 100644 index 0000000..3d06162 Binary files /dev/null and b/icons/default/icons/icon_del_ins.png differ diff --git a/icons/default/icons/icon_shift.png b/icons/default/icons/icon_shift.png new file mode 100644 index 0000000..998d7fa Binary files /dev/null and b/icons/default/icons/icon_shift.png differ diff --git a/icons/default/icons/info_active.png b/icons/default/icons/info_active.png new file mode 100644 index 0000000..7f1ccf7 Binary files /dev/null and b/icons/default/icons/info_active.png differ diff --git a/icons/default/icons/info_inactive.png b/icons/default/icons/info_inactive.png new file mode 100644 index 0000000..9a79e95 Binary files /dev/null and b/icons/default/icons/info_inactive.png differ diff --git a/icons/default/icons/no.png b/icons/default/icons/no.png new file mode 100644 index 0000000..c4b1860 Binary files /dev/null and b/icons/default/icons/no.png differ diff --git a/icons/default/icons/record_active.png b/icons/default/icons/record_active.png new file mode 100644 index 0000000..8c42156 Binary files /dev/null and b/icons/default/icons/record_active.png differ diff --git a/icons/default/icons/record_inactive.png b/icons/default/icons/record_inactive.png new file mode 100644 index 0000000..6720a6f Binary files /dev/null and b/icons/default/icons/record_inactive.png differ diff --git a/icons/default/icons/yes.png b/icons/default/icons/yes.png new file mode 100644 index 0000000..28c2f81 Binary files /dev/null and b/icons/default/icons/yes.png differ diff --git a/icons/default/osdElements/buttonblue.png b/icons/default/osdElements/buttonblue.png new file mode 100644 index 0000000..ac3536c Binary files /dev/null and b/icons/default/osdElements/buttonblue.png differ diff --git a/icons/default/osdElements/buttongreen.png b/icons/default/osdElements/buttongreen.png new file mode 100644 index 0000000..e598518 Binary files /dev/null and b/icons/default/osdElements/buttongreen.png differ diff --git a/icons/default/osdElements/buttonred.png b/icons/default/osdElements/buttonred.png new file mode 100644 index 0000000..152acad Binary files /dev/null and b/icons/default/osdElements/buttonred.png differ diff --git a/icons/default/osdElements/buttonyellow.png b/icons/default/osdElements/buttonyellow.png new file mode 100644 index 0000000..1b448c9 Binary files /dev/null and b/icons/default/osdElements/buttonyellow.png differ diff --git a/icons/default/osdElements/channelgroup_bottom.png b/icons/default/osdElements/channelgroup_bottom.png new file mode 100644 index 0000000..c37ba42 Binary files /dev/null and b/icons/default/osdElements/channelgroup_bottom.png differ diff --git a/icons/default/osdElements/channelgroup_head.png b/icons/default/osdElements/channelgroup_head.png new file mode 100644 index 0000000..75ee8a8 Binary files /dev/null and b/icons/default/osdElements/channelgroup_head.png differ diff --git a/icons/default/osdElements/channelgroup_horizontal.png b/icons/default/osdElements/channelgroup_horizontal.png new file mode 100644 index 0000000..ead7606 Binary files /dev/null and b/icons/default/osdElements/channelgroup_horizontal.png differ diff --git a/icons/default/osdElements/channelgroup_left.png b/icons/default/osdElements/channelgroup_left.png new file mode 100644 index 0000000..30e1b45 Binary files /dev/null and b/icons/default/osdElements/channelgroup_left.png differ diff --git a/icons/default/osdElements/channelgroup_right.png b/icons/default/osdElements/channelgroup_right.png new file mode 100644 index 0000000..d89657c Binary files /dev/null and b/icons/default/osdElements/channelgroup_right.png differ diff --git a/icons/default/osdElements/channelgroup_vertical.png b/icons/default/osdElements/channelgroup_vertical.png new file mode 100644 index 0000000..64134c7 Binary files /dev/null and b/icons/default/osdElements/channelgroup_vertical.png differ diff --git a/icons/default/osdElements/channelgroups_vertical.png b/icons/default/osdElements/channelgroups_vertical.png new file mode 100644 index 0000000..474c558 Binary files /dev/null and b/icons/default/osdElements/channelgroups_vertical.png differ diff --git a/icons/default/osdElements/channellogoback_horizontal.png b/icons/default/osdElements/channellogoback_horizontal.png new file mode 100644 index 0000000..2df7f52 Binary files /dev/null and b/icons/default/osdElements/channellogoback_horizontal.png differ diff --git a/icons/default/osdElements/channellogoback_vertical.png b/icons/default/osdElements/channellogoback_vertical.png new file mode 100644 index 0000000..669beeb Binary files /dev/null and b/icons/default/osdElements/channellogoback_vertical.png differ diff --git a/icons/default/osdElements/clock.png b/icons/default/osdElements/clock.png new file mode 100644 index 0000000..3df1dae Binary files /dev/null and b/icons/default/osdElements/clock.png differ diff --git a/icons/default/osdElements/date_vertical.png b/icons/default/osdElements/date_vertical.png new file mode 100644 index 0000000..58a72e4 Binary files /dev/null and b/icons/default/osdElements/date_vertical.png differ diff --git a/icons/default/osdElements/epgview_header.png b/icons/default/osdElements/epgview_header.png new file mode 100644 index 0000000..b754eb0 Binary files /dev/null and b/icons/default/osdElements/epgview_header.png differ diff --git a/icons/default/osdElements/grid_active_bottom.png b/icons/default/osdElements/grid_active_bottom.png new file mode 100644 index 0000000..28fb443 Binary files /dev/null and b/icons/default/osdElements/grid_active_bottom.png differ diff --git a/icons/default/osdElements/grid_active_head.png b/icons/default/osdElements/grid_active_head.png new file mode 100644 index 0000000..a494d95 Binary files /dev/null and b/icons/default/osdElements/grid_active_head.png differ diff --git a/icons/default/osdElements/grid_active_horizontal.png b/icons/default/osdElements/grid_active_horizontal.png new file mode 100644 index 0000000..368309f Binary files /dev/null and b/icons/default/osdElements/grid_active_horizontal.png differ diff --git a/icons/default/osdElements/grid_active_left.png b/icons/default/osdElements/grid_active_left.png new file mode 100644 index 0000000..0548e21 Binary files /dev/null and b/icons/default/osdElements/grid_active_left.png differ diff --git a/icons/default/osdElements/grid_active_right.png b/icons/default/osdElements/grid_active_right.png new file mode 100644 index 0000000..2aee1d6 Binary files /dev/null and b/icons/default/osdElements/grid_active_right.png differ diff --git a/icons/default/osdElements/grid_active_vertical.png b/icons/default/osdElements/grid_active_vertical.png new file mode 100644 index 0000000..6aba9d1 Binary files /dev/null and b/icons/default/osdElements/grid_active_vertical.png differ diff --git a/icons/default/osdElements/grid_bottom.png b/icons/default/osdElements/grid_bottom.png new file mode 100644 index 0000000..e90e05e Binary files /dev/null and b/icons/default/osdElements/grid_bottom.png differ diff --git a/icons/default/osdElements/grid_head.png b/icons/default/osdElements/grid_head.png new file mode 100644 index 0000000..4196cd8 Binary files /dev/null and b/icons/default/osdElements/grid_head.png differ diff --git a/icons/default/osdElements/grid_horizontal.png b/icons/default/osdElements/grid_horizontal.png new file mode 100644 index 0000000..6bccb3f Binary files /dev/null and b/icons/default/osdElements/grid_horizontal.png differ diff --git a/icons/default/osdElements/grid_left.png b/icons/default/osdElements/grid_left.png new file mode 100644 index 0000000..7b17046 Binary files /dev/null and b/icons/default/osdElements/grid_left.png differ diff --git a/icons/default/osdElements/grid_right.png b/icons/default/osdElements/grid_right.png new file mode 100644 index 0000000..17fe003 Binary files /dev/null and b/icons/default/osdElements/grid_right.png differ diff --git a/icons/default/osdElements/grid_vertical.png b/icons/default/osdElements/grid_vertical.png new file mode 100644 index 0000000..e7192ac Binary files /dev/null and b/icons/default/osdElements/grid_vertical.png differ diff --git a/icons/default/osdElements/grids_vertical.png b/icons/default/osdElements/grids_vertical.png new file mode 100644 index 0000000..a481f27 Binary files /dev/null and b/icons/default/osdElements/grids_vertical.png differ diff --git a/icons/default/osdElements/statusheader_content_full.png b/icons/default/osdElements/statusheader_content_full.png new file mode 100644 index 0000000..18c6552 Binary files /dev/null and b/icons/default/osdElements/statusheader_content_full.png differ diff --git a/icons/default/osdElements/statusheader_content_windowed.png b/icons/default/osdElements/statusheader_content_windowed.png new file mode 100644 index 0000000..24fd20c Binary files /dev/null and b/icons/default/osdElements/statusheader_content_windowed.png differ diff --git a/icons/default/osdElements/statusheader_tvframe.png b/icons/default/osdElements/statusheader_tvframe.png new file mode 100644 index 0000000..cdb800c Binary files /dev/null and b/icons/default/osdElements/statusheader_tvframe.png differ diff --git a/icons/default/osdElements/timeline1_horizontal.png b/icons/default/osdElements/timeline1_horizontal.png new file mode 100644 index 0000000..9240b37 Binary files /dev/null and b/icons/default/osdElements/timeline1_horizontal.png differ diff --git a/icons/default/osdElements/timeline1_vertical.png b/icons/default/osdElements/timeline1_vertical.png new file mode 100644 index 0000000..5466546 Binary files /dev/null and b/icons/default/osdElements/timeline1_vertical.png differ diff --git a/icons/default/osdElements/timeline2_horizontal.png b/icons/default/osdElements/timeline2_horizontal.png new file mode 100644 index 0000000..4364677 Binary files /dev/null and b/icons/default/osdElements/timeline2_horizontal.png differ diff --git a/icons/default/osdElements/timeline2_vertical.png b/icons/default/osdElements/timeline2_vertical.png new file mode 100644 index 0000000..dfa06c9 Binary files /dev/null and b/icons/default/osdElements/timeline2_vertical.png differ diff --git a/imagecache.c b/imagecache.c new file mode 100644 index 0000000..6432627 --- /dev/null +++ b/imagecache.c @@ -0,0 +1,638 @@ +#include +#include +#include +#include +#include "imagecache.h" +#include "config.h" +#include "imagescaler.h" +#include "tools.h" + +cImageCache::cImageCache() : cImageMagickWrapper() { + tempStaticLogo = NULL; +} + +cImageCache::~cImageCache() { + Clear(); +} + +void cImageCache::CreateCache(void) { + if (tvguideConfig.style != eStyleGraphical) + return; + esyslog("tvguide: Creating Image Cache"); + int start = cTimeMs::Now(); + int startNext = cTimeMs::Now(); + CreateOsdIconCache(); + esyslog("tvguide: Osd Icon Cash created in %d ms", int(cTimeMs::Now()-startNext)); + startNext = cTimeMs::Now(); + PrepareGridIconCache(); + CreateGridIconCache(); + esyslog("tvguide: Grid Icon Cash created in %d ms", int(cTimeMs::Now()-startNext)); + startNext = cTimeMs::Now(); + CreateChannelGroupCache(); + esyslog("tvguide: Channelgroup Cash created in %d ms", int(cTimeMs::Now()-startNext)); + startNext = cTimeMs::Now(); + CreateLogoCache(); + esyslog("tvguide: Logo Cash created in %d ms", int(cTimeMs::Now()-startNext)); + startNext = cTimeMs::Now(); + esyslog("tvguide: Complete Image Cash created in %d ms", int(cTimeMs::Now()-start)); +} + +void cImageCache::CreateOsdIconCache(void) { + bool success = false; + //Status Header + std::string imgStatusHeaderContentFull = "osdElements/statusheader_content_full"; + std::string imgStatusHeaderContentWindowed = "osdElements/statusheader_content_windowed"; + std::string imgStatusHeaderTVFrame = "osdElements/statusheader_tvframe"; + success = LoadIcon(imgStatusHeaderContentFull); + if (success) + InsertIntoOsdElementCache(oeStatusHeaderContentFull, geoManager.statusHeaderContentWidth, geoManager.statusHeaderHeight); + success = LoadIcon(imgStatusHeaderContentWindowed); + if (success) + InsertIntoOsdElementCache(oeStatusHeaderContentWindowed, geoManager.statusHeaderContentWidth, geoManager.statusHeaderHeight); + success = LoadIcon(imgStatusHeaderTVFrame); + if (success) + InsertIntoOsdElementCache(oeStatusHeaderTVFrame, geoManager.tvFrameWidth, geoManager.statusHeaderHeight); + + + //Color Buttons + std::string imgButtonRed = "osdElements/buttonred"; + std::string imgButtonGreen = "osdElements/buttongreen"; + std::string imgButtonYellow = "osdElements/buttonyellow"; + std::string imgButtonBlue = "osdElements/buttonblue"; + success = LoadIcon(imgButtonRed); + if (success) + InsertIntoOsdElementCache(oeButtonRed, geoManager.buttonWidth, geoManager.buttonHeight); + success = LoadIcon(imgButtonGreen); + if (success) + InsertIntoOsdElementCache(oeButtonGreen, geoManager.buttonWidth, geoManager.buttonHeight); + success = LoadIcon(imgButtonYellow); + if (success) + InsertIntoOsdElementCache(oeButtonYellow, geoManager.buttonWidth, geoManager.buttonHeight); + success = LoadIcon(imgButtonBlue); + if (success) + InsertIntoOsdElementCache(oeButtonBlue, geoManager.buttonWidth, geoManager.buttonHeight); + + //Channel Logo Background + if (tvguideConfig.displayMode == eHorizontal) { + success = LoadIcon("osdElements/channellogoback_horizontal"); + } else { + success = LoadIcon("osdElements/channellogoback_vertical"); + } + if (success) + InsertIntoOsdElementCache(oeLogoBack, geoManager.channelLogoWidth, geoManager.channelLogoHeight); + + //Timeline Elements + std::string imgTimeline1, imgTimeline2, imgDateViewer; + if (tvguideConfig.displayMode == eHorizontal) { + imgTimeline1 = "osdElements/timeline1_horizontal"; + imgTimeline2 = "osdElements/timeline2_horizontal"; + imgDateViewer = "osdElements/timeline2_horizontal"; + } else { + imgTimeline1 = "osdElements/timeline1_vertical"; + imgTimeline2 = "osdElements/timeline2_vertical"; + imgDateViewer = "osdElements/date_vertical"; + } + std::string imgClock = "osdElements/clock"; + success = LoadIcon(imgTimeline1); + if (success) + InsertIntoOsdElementCache(oeTimeline1, geoManager.timeLineGridWidth, geoManager.timeLineGridHeight); + success = LoadIcon(imgTimeline2); + if (success) + InsertIntoOsdElementCache(oeTimeline2, geoManager.timeLineGridWidth, geoManager.timeLineGridHeight); + success = LoadIcon(imgDateViewer); + if (success) + InsertIntoOsdElementCache(oeDateViewer, geoManager.dateVieverWidth, geoManager.dateVieverHeight); + success = LoadIcon(imgClock); + if (success) + InsertIntoOsdElementCache(oeClock, geoManager.clockWidth, geoManager.clockHeight); + + //Detailed EPG View + success = LoadIcon("osdElements/epgview_header"); + if (success) + InsertIntoOsdElementCache(oeEpgHeader, geoManager.osdWidth, geoManager.epgViewHeaderHeight); +} + +void cImageCache::PrepareGridIconCache(void) { + bool success = false; + //Create Buffers for Background + gridsAvailable = true; + std::string grid, grid_active; + if (tvguideConfig.displayMode == eHorizontal) { + grid = "osdElements/grid_horizontal"; + grid_active = "osdElements/grid_active_horizontal"; + } else { + grid = "osdElements/grid_vertical"; + grid_active = "osdElements/grid_active_vertical"; + } + success = LoadIcon(grid); + if (success) { + bufferGrid = buffer; + } else { + gridsAvailable = false; + } + success = LoadIcon(grid_active); + if (success) { + bufferGridActive = buffer; + } else { + gridsAvailable = false; + } + //Create Grid Background Templates + imgLeft = NULL; + imgLeftActive = NULL; + imgRight = NULL; + imgRightActive = NULL; + imgHead = NULL; + imgHeadActive = NULL; + imgBottom = NULL; + imgBottomActive = NULL; + + if (tvguideConfig.displayMode == eHorizontal) { + std::string left = "osdElements/grid_left"; + std::string right = "osdElements/grid_right"; + std::string left_active = "osdElements/grid_active_left"; + std::string right_active = "osdElements/grid_active_right"; + cornerWidth = 0; + cornerHeight = geoManager.rowHeight; + //first image determinates width + success = LoadIcon(left); + if (!success) + return; + int widthOriginal = 0; + int heightOriginal = 0; + widthOriginal = buffer.columns(); + heightOriginal = buffer.rows(); + cornerWidth = widthOriginal * cornerHeight / heightOriginal; + imgLeft = CreateImage(cornerWidth, cornerHeight, false); + success = LoadIcon(right); + if (success) + imgRight = CreateImage(cornerWidth, cornerHeight, false); + success = LoadIcon(left_active); + if (success) + imgLeftActive = CreateImage(cornerWidth, cornerHeight, false); + success = LoadIcon(right_active); + if (success) + imgRightActive = CreateImage(cornerWidth, cornerHeight, false); + } else { + std::string head = "osdElements/grid_head"; + std::string bottom = "osdElements/grid_bottom"; + std::string head_active = "osdElements/grid_active_head"; + std::string bottom_active = "osdElements/grid_active_bottom"; + cornerWidth = geoManager.colWidth; + cornerHeight = 0; + //first image determinates height + success = LoadIcon(head); + if (!success) + return; + int widthOriginal = 0; + int heightOriginal = 0; + widthOriginal = buffer.columns(); + heightOriginal = buffer.rows(); + cornerHeight = heightOriginal * cornerWidth / widthOriginal; + imgHead = CreateImage(cornerWidth, cornerHeight, false); + success = LoadIcon(bottom); + if (success) + imgBottom = CreateImage(cornerWidth, cornerHeight, false); + success = LoadIcon(head_active); + if (success) + imgHeadActive = CreateImage(cornerWidth, cornerHeight, false); + success = LoadIcon(bottom_active); + if (success) + imgBottomActive = CreateImage(cornerWidth, cornerHeight, false); + } +} + +void cImageCache::CreateGridIconCache(void) { + if (tvguideConfig.displayMode == eHorizontal) { + int gridHeight = geoManager.rowHeight; + for (int minutes = 5; minutes <= 120; minutes += 5) { + GetGrid(minutes * geoManager.minutePixel, gridHeight, false); + } + } else { + int gridWidth = geoManager.colWidth; + for (int minutes = 5; minutes <= 120; minutes += 5) { + GetGrid(gridWidth, minutes * geoManager.minutePixel, false); + } + } +} + +void cImageCache::CreateChannelGroupCache(void) { + bool success = false; + groupsHead = NULL; + groupsBottom = NULL; + groupsLeft = NULL; + groupsRight = NULL; + if (tvguideConfig.displayMode == eHorizontal) { + std::string channelGroupHead = "osdElements/channelgroup_head"; + std::string channelGroupBottom = "osdElements/channelgroup_bottom"; + int width = geoManager.channelGroupsWidth; + int heightHeadBottom = 0; + success = LoadIcon(channelGroupHead); + if (success) { + int widthOriginal = buffer.columns(); + int heightOriginal = buffer.rows(); + heightHeadBottom = heightOriginal * width / widthOriginal; + groupsHead = CreateImage(width, heightHeadBottom, false); + } + success = LoadIcon(channelGroupBottom); + if (success && heightHeadBottom) { + groupsBottom = CreateImage(width, heightHeadBottom, false); + } + for (int size = 1; size <= tvguideConfig.numGrids; ++size) { + InsertIntoGroupsCacheHorizontal(size); + } + } else { + std::string channelGroupLeft = "osdElements/channelgroup_left"; + std::string channelGroupRight = "osdElements/channelgroup_right"; + int widthHeadBottom = 0; + int height = geoManager.channelGroupsHeight; + success = LoadIcon(channelGroupLeft); + if (success) { + int widthOriginal = buffer.columns(); + int heightOriginal = buffer.rows(); + widthHeadBottom = widthOriginal * height / heightOriginal; + groupsLeft = CreateImage(widthHeadBottom, height, false); + } + success = LoadIcon(channelGroupRight); + if (success && widthHeadBottom) { + groupsRight = CreateImage(widthHeadBottom, height, false); + } + for (int size = 1; size <= tvguideConfig.numGrids; ++size) { + InsertIntoGroupsCacheVertical(size); + } + } + +} + +void cImageCache::CreateLogoCache(void) { + if (tvguideConfig.hideChannelLogos) + return; + if (tvguideConfig.numLogosInitial > 0) { + int channelsCached = 0; + for (const cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel)) { + if (channelsCached >= tvguideConfig.numLogosInitial) + break; + if (!channel->GroupSep()) { + bool success = LoadLogo(channel); + if (success) { + channelsCached++; + InsertIntoLogoCache(*channel->GetChannelID().ToString()); + } + } + + } + } +} + + +cImage *cImageCache::GetOsdElement(eOsdElementType type) { + std::map::iterator hit = osdElementCache.find(type); + if (hit != osdElementCache.end()) { + return (cImage*)hit->second; + } + return NULL; +} + +cImage *cImageCache::GetGrid(int width, int height, bool active) { + if (!gridsAvailable) + return NULL; + std::stringstream gridImageName; + gridImageName << width << "x" << height; + if (active) + gridImageName << "active"; + std::string gridImg = gridImageName.str(); + std::map::iterator hit = gridCache.find(gridImg); + if (hit != gridCache.end()) { + return (cImage*)hit->second; + } else { + InsertIntoGridCache(gridImg, width, height, active); + hit = gridCache.find(gridImg); + if (hit != gridCache.end()) { + return (cImage*)hit->second; + } + } + return NULL; +} + +cImage *cImageCache::GetChannelGroup(int width, int height) { + std::stringstream groupName; + groupName << width << "x" << height; + std::map::iterator hit = groupsCache.find(groupName.str()); + if (hit != groupsCache.end()) { + return (cImage*)hit->second; + } + return NULL; +} + +cImage *cImageCache::GetLogo(const cChannel *channel) { + if (!channel) + return NULL; + + std::map::iterator hit = logoCache.find(*channel->GetChannelID().ToString()); + + if (hit != logoCache.end()) { + return (cImage*)hit->second; + } else { + bool success = LoadLogo(channel); + if (success) { + if ((tvguideConfig.limitLogoCache) && (logoCache.size() >= tvguideConfig.numLogosMax)) { + //logo cache is full, don't cache anymore + if (tempStaticLogo) { + delete tempStaticLogo; + tempStaticLogo = NULL; + } + tempStaticLogo = CreateImage(geoManager.logoWidth, geoManager.logoHeight); + return tempStaticLogo; + } else { + //add requested logo to cache + InsertIntoLogoCache(*channel->GetChannelID().ToString()); + hit = logoCache.find(*channel->GetChannelID().ToString()); + if (hit != logoCache.end()) { + return (cImage*)hit->second; + } + } + } + } + return NULL; +} + + +void cImageCache::InsertIntoOsdElementCache(eOsdElementType type, int width, int height) { + cImage *image = CreateImage(width, height, false); + if (image) + osdElementCache.insert(std::pair(type, image)); +} + +void cImageCache::InsertIntoGridCache(std::string name, int width, int height, bool active) { + cImage *image = CreateGrid(width, height, active); + if (image) { + if (tvguideConfig.displayMode == eHorizontal) { + AddCornersHorizontal(image, active); + } else { + AddCornersVertical(image, active); + } + gridCache.insert(std::pair(name, image)); + } +} + +cImage *cImageCache::CreateGrid(int width, int height, bool active) { + Image *currentGridBuffer = NULL; + if (active) + currentGridBuffer = &bufferGridActive; + else + currentGridBuffer = &bufferGrid; + int w, h; + w = currentGridBuffer->columns(); + h = currentGridBuffer->rows(); + const PixelPacket *pixels = currentGridBuffer->getConstPixels(0, 0, w, h); + cImage *image = NULL; + image = new cImage(cSize(width, height)); + if (!image) + return NULL; + tColor *imgData = (tColor *)image->Data(); + if (w != width || h != height) { + ImageScaler scaler; + scaler.SetImageParameters(imgData, width, width, height, w, h); + for (const void *pixels_end = &pixels[w*h]; pixels < pixels_end; ++pixels) + scaler.PutSourcePixel(pixels->blue / ((MaxRGB + 1) / 256), + pixels->green / ((MaxRGB + 1) / 256), + pixels->red / ((MaxRGB + 1) / 256), + ~((unsigned char)(pixels->opacity / ((MaxRGB + 1) / 256)))); + return image; + } + for (const void *pixels_end = &pixels[width*height]; pixels < pixels_end; ++pixels) + *imgData++ = ((~int(pixels->opacity / ((MaxRGB + 1) / 256)) << 24) | + (int(pixels->green / ((MaxRGB + 1) / 256)) << 8) | + (int(pixels->red / ((MaxRGB + 1) / 256)) << 16) | + (int(pixels->blue / ((MaxRGB + 1) / 256)) )); + return image; +} + +void cImageCache::AddCornersHorizontal(cImage *img, bool active) { + int imgWidth = img->Width(); + cImage *cornerLeft = NULL; + cImage *cornerRight = NULL; + if (active) { + cornerLeft = imgLeftActive; + cornerRight = imgRightActive; + } else { + cornerLeft = imgLeft; + cornerRight = imgRight; + } + if (!cornerLeft || !cornerRight) + return; + int maxX = min(cornerWidth, imgWidth); + for (int row = 0; row < cornerHeight; row++) { + for (int col = 0; col < maxX; ++col) { + img->SetPixel(cPoint(col, row), cornerLeft->GetPixel(cPoint(col, row))); + img->SetPixel(cPoint(imgWidth - maxX + col, row), cornerRight->GetPixel(cPoint(col, row))); + } + } +} + +void cImageCache::AddCornersVertical(cImage *img, bool active) { + int imgHeight = img->Height(); + cImage *cornerHead = NULL; + cImage *cornerBottom = NULL; + if (active) { + cornerHead = imgHeadActive; + cornerBottom = imgBottomActive; + } else { + cornerHead = imgHead; + cornerBottom = imgBottom; + } + if (!cornerHead || !cornerBottom) + return; + int maxY = min(cornerHeight, imgHeight); + for (int row = 0; row < maxY; row++) { + for (int col = 0; col < cornerWidth; ++col) { + img->SetPixel(cPoint(col, row), cornerHead->GetPixel(cPoint(col, row))); + img->SetPixel(cPoint(col, imgHeight - maxY + row), cornerBottom->GetPixel(cPoint(col, row))); + } + } +} + +void cImageCache::InsertIntoGroupsCacheHorizontal(int size) { + int width = geoManager.channelGroupsWidth; + bool success = LoadIcon("osdElements/channelgroup_horizontal"); + if (success) { + int height = size * geoManager.rowHeight; + std::stringstream name; + name << width << "x" << height; + cImage *image = CreateImage(width, height, false); + if (image) { + AddCornersGroupHorizontal(image); + groupsCache.insert(std::pair(name.str(), image)); + } + } +} + +void cImageCache::InsertIntoGroupsCacheVertical(int size) { + int height = geoManager.channelGroupsHeight; + bool success = LoadIcon("osdElements/channelgroup_vertical"); + if (success) { + int width = size * geoManager.colWidth; + std::stringstream name; + name << width << "x" << height; + cImage *image = CreateImage(width, height, false); + if (image) { + AddCornersGroupVertical(image); + groupsCache.insert(std::pair(name.str(), image)); + } + } +} + +void cImageCache::AddCornersGroupHorizontal(cImage *img) { + if (!groupsHead || !groupsBottom || !img) + return; + int imgWidth = img->Width(); + int imgHeight = img->Height(); + int heightHeadBottom = groupsHead->Height(); + int maxY = min(heightHeadBottom, imgHeight); + for (int row = 0; row < maxY; row++) { + for (int col = 0; col < imgWidth; ++col) { + img->SetPixel(cPoint(col, row), groupsHead->GetPixel(cPoint(col, row))); + img->SetPixel(cPoint(col, imgHeight - maxY + row), groupsBottom->GetPixel(cPoint(col, row))); + } + } +} + +void cImageCache::AddCornersGroupVertical(cImage *img) { + if (!groupsLeft || !groupsRight || !img) + return; + int imgWidth = img->Width(); + int imgHeight = img->Height(); + int widthLeftRight = groupsLeft->Width(); + int maxX = min(widthLeftRight, imgWidth); + for (int row = 0; row < imgHeight; row++) { + for (int col = 0; col < maxX; ++col) { + img->SetPixel(cPoint(col, row), groupsLeft->GetPixel(cPoint(col, row))); + img->SetPixel(cPoint(imgWidth - maxX + col, row), groupsRight->GetPixel(cPoint(col, row))); + } + } +} + +bool cImageCache::LoadIcon(std::string name) { + bool success = false; + cString iconPathTheme = cString::sprintf("%s%s/", *tvguideConfig.iconPath, *tvguideConfig.themeName); + success = LoadImage(name, *iconPathTheme, "png"); + if (success) { + return true; + } else { + success = LoadImage(name, *tvguideConfig.iconPath, "png"); + if (success) { + return true; + } + } + return false; +} + +bool cImageCache::LoadLogo(const cChannel *channel) { + if (!channel) + return false; + std::string channelID = StrToLowerCase(*(channel->GetChannelID().ToString())); + std::string logoLower = StrToLowerCase(channel->Name()); + bool success = false; + cString extension; + if (tvguideConfig.logoExtension == 0) { + extension = "png"; + } else if (tvguideConfig.logoExtension == 1) { + extension = "jpg"; + } + success = LoadImage(channelID.c_str(), *tvguideConfig.logoPath, *extension); + if (success) + return true; + success = LoadImage(logoLower.c_str(), *tvguideConfig.logoPath, *extension); +} + +void cImageCache::InsertIntoLogoCache(std::string channelID) { + cImage *image = CreateImage(geoManager.logoWidth, geoManager.logoHeight); + logoCache.insert(std::pair(channelID, image)); +} + +std::string cImageCache::GetCacheSize(eCacheType type) { + std::stringstream result; + int sizeByte = 0; + int numImages = 0; + if (type == ctOsdElement) { + for(std::map::const_iterator it = osdElementCache.begin(); it != osdElementCache.end(); it++) { + cImage *img = (cImage*)it->second; + if (img) + sizeByte += img->Width() * img->Height() * sizeof(tColor); + } + numImages = osdElementCache.size(); + } else if ((type == ctGrid) || (type == ctLogo) || (type == ctChannelGroup)) { + std::map *cache; + if (type == ctGrid) + cache = &gridCache; + else if (type == ctLogo) + cache = &logoCache; + else if (type == ctChannelGroup) + cache = &groupsCache; + + for(std::map::const_iterator it = cache->begin(); it != cache->end(); it++) { + cImage *img = (cImage*)it->second; + if (img) + sizeByte += img->Width() * img->Height() * sizeof(tColor); + } + numImages = cache->size(); + } + result << numImages << " " << tr("images") << " / " << sizeByte/1024 << " KByte"; + return result.str(); +} + +void cImageCache::Clear(void) { + for(std::map::const_iterator it = osdElementCache.begin(); it != osdElementCache.end(); it++) { + cImage *img = (cImage*)it->second; + delete img; + } + osdElementCache.clear(); + + for(std::map::const_iterator it = gridCache.begin(); it != gridCache.end(); it++) { + cImage *img = (cImage*)it->second; + delete img; + } + gridCache.clear(); + + for(std::map::const_iterator it = groupsCache.begin(); it != groupsCache.end(); it++) { + cImage *img = (cImage*)it->second; + delete img; + } + groupsCache.clear(); + + for(std::map::const_iterator it = logoCache.begin(); it != logoCache.end(); it++) { + cImage *img = (cImage*)it->second; + delete img; + } + logoCache.clear(); + + if (tempStaticLogo) { + delete tempStaticLogo; + tempStaticLogo = NULL; + } + + if (groupsHead) + delete groupsHead; + if (groupsBottom) + delete groupsBottom; + if (groupsLeft) + delete groupsLeft; + if (groupsRight) + delete groupsRight; + + if (imgLeft) + delete imgLeft; + if (imgLeftActive) + delete imgLeftActive; + if (imgRight) + delete imgRight; + if (imgRightActive) + delete imgRightActive; + if (imgHead) + delete imgHead; + if (imgHeadActive) + delete imgHeadActive; + if (imgBottom) + delete imgBottom; + if (imgBottomActive) + delete imgBottomActive; +} diff --git a/imagecache.h b/imagecache.h new file mode 100644 index 0000000..1fd86f2 --- /dev/null +++ b/imagecache.h @@ -0,0 +1,89 @@ +#ifndef __TVGUIDE_IMAGECACHE_H +#define __TVGUIDE_IMAGECACHE_H + +#define X_DISPLAY_MISSING + +#include +#include +#include "imagemagickwrapper.h" + +enum eCacheType { + ctOsdElement = 0, + ctGrid, + ctLogo, + ctChannelGroup, +}; + +enum eOsdElementType { + oeNone = -1, + oeStatusHeaderContentFull, + oeStatusHeaderContentWindowed, + oeStatusHeaderTVFrame, + oeButtonRed, + oeButtonGreen, + oeButtonYellow, + oeButtonBlue, + oeLogoBack, + oeTimeline1, + oeTimeline2, + oeDateViewer, + oeClock, + oeEpgHeader, +}; + +class cImageCache : public cImageMagickWrapper { +public: + cImageCache(); + ~cImageCache(); + void CreateCache(void); + cImage *GetOsdElement(eOsdElementType type); + cImage *GetGrid(int width, int height, bool active); + cImage *GetChannelGroup(int width, int height); + cImage *GetLogo(const cChannel *channel); + std::string GetCacheSize(eCacheType type); + void Clear(void); +private: + cImage *tempStaticLogo; + Image bufferGrid; + Image bufferGridActive; + bool gridsAvailable; + int cornerWidth; + int cornerHeight; + cImage *imgLeft; + cImage *imgLeftActive; + cImage *imgRight; + cImage *imgRightActive; + cImage *imgHead; + cImage *imgHeadActive; + cImage *imgBottom; + cImage *imgBottomActive; + cImage *imgChannelgroupHead; + cImage *imgChannelgroupBottom; + cImage *groupsHead; + cImage *groupsBottom; + cImage *groupsLeft; + cImage *groupsRight; + std::map osdElementCache; + std::map gridCache; + std::map groupsCache; + std::map logoCache; + void CreateOsdIconCache(void); + void PrepareGridIconCache(void); + void CreateGridIconCache(void); + void CreateChannelGroupCache(void); + void CreateLogoCache(void); + bool LoadIcon(std::string name); + void InsertIntoOsdElementCache(eOsdElementType type, int width=0, int height=0); + void InsertIntoGridCache(std::string name, int width, int height, bool active); + cImage *CreateGrid(int width, int height, bool active); + void AddCornersHorizontal(cImage *img, bool active); + void AddCornersVertical(cImage *img, bool active); + void InsertIntoGroupsCacheHorizontal(int size); + void InsertIntoGroupsCacheVertical(int size); + void AddCornersGroupHorizontal(cImage *img); + void AddCornersGroupVertical(cImage *img); + bool LoadLogo(const cChannel *channel); + void InsertIntoLogoCache(std::string channelID); +}; + +#endif //__TVGUIDE_IMAGECACHE_H \ No newline at end of file diff --git a/imageloader.c b/imageloader.c index 1a25ea1..ac3dbf8 100644 --- a/imageloader.c +++ b/imageloader.c @@ -2,9 +2,11 @@ #include #include #include +#include #include "config.h" #include "imageloader.h" +#include "tools.h" using namespace Magick; @@ -15,34 +17,33 @@ cImageLoader::cImageLoader() { cImageLoader::~cImageLoader() { } -bool cImageLoader::LoadLogo(const char *logo, int width, int height) { - - if ((width == 0)||(height==0)) +bool cImageLoader::LoadLogo(const cChannel *channel, int width, int height) { + if (!channel || (width == 0)||(height==0)) return false; - std::string logoLower = logo; - toLowerCase(logoLower); + std::string channelID = StrToLowerCase(*(channel->GetChannelID().ToString())); + std::string logoLower = StrToLowerCase(channel->Name()); cString extension; if (tvguideConfig.logoExtension == 0) { extension = "png"; } else if (tvguideConfig.logoExtension == 1) { extension = "jpg"; } - if (!LoadImage(logoLower.c_str(), tvguideConfig.logoPath, extension)) - return false; - buffer.sample( Geometry(width, height)); - return true; + bool success = false; + success = LoadImage(channelID.c_str(), *tvguideConfig.logoPath, *extension); + if (!success) { + success = LoadImage(logoLower.c_str(), *tvguideConfig.logoPath, *extension); + } + if (success) + buffer.sample(Geometry(width, height)); + return success; } -bool cImageLoader::LoadEPGImage(int eventID) { - int width = tvguideConfig.epgImageWidth; - int height = tvguideConfig.epgImageHeight; +bool cImageLoader::LoadEPGImage(int eventID, int width, int height) { if ((width == 0)||(height==0)) return false; - if (!LoadImage(cString::sprintf("%d", eventID), tvguideConfig.epgImagePath, "jpg")) + if (!LoadImage(*cString::sprintf("%d", eventID), *tvguideConfig.epgImagePath, "jpg")) return false; - if (height != 0 || width != 0) { - buffer.sample( Geometry(width, height)); - } + buffer.sample( Geometry(width, height)); return true; } @@ -52,7 +53,7 @@ bool cImageLoader::LoadAdditionalEPGImage(cString name) { if ((width == 0)||(height==0)) return false; bool success = false; - success = LoadImage(name, tvguideConfig.epgImagePath, "jpg"); + success = LoadImage(*name, *tvguideConfig.epgImagePath, "jpg"); if (!success) return false; if (height != 0 || width != 0) { @@ -73,13 +74,26 @@ bool cImageLoader::LoadIcon(const char *cIcon, int size) { if (size==0) return false; bool success = false; - success = LoadImage(cString(cIcon), tvguideConfig.iconPath, "png"); + success = LoadImage(cIcon, *tvguideConfig.iconPath, "png"); if (!success) return false; buffer.sample(Geometry(size, size)); return true; } +bool cImageLoader::LoadOsdElement(cString name, int width, int height) { + if ((width == 0)||(height==0)) + return false; + bool success = false; + cString path = cString::sprintf("%s%s%s", *tvguideConfig.iconPath, *tvguideConfig.themeName, "/osdElements/"); + success = LoadImage(*name, *path, "png"); + if (!success) + return false; + cString geometry = cString::sprintf("%dx%d!", width, height); + buffer.resize(Geometry(*geometry)); + return true; +} + bool cImageLoader::DrawBackground(tColor back, tColor blend, int width, int height) { if ((width < 1) || (height < 1) || (width > 1920) || (height > 1080)) return false; @@ -112,42 +126,3 @@ cImage cImageLoader::GetImage() { } return image; } - -Color cImageLoader::Argb2Color(tColor col) { - tIndex alpha = (col & 0xFF000000) >> 24; - tIndex red = (col & 0x00FF0000) >> 16; - tIndex green = (col & 0x0000FF00) >> 8; - tIndex blue = (col & 0x000000FF); - Color color(MaxRGB*red/255, MaxRGB*green/255, MaxRGB*blue/255, MaxRGB*(0xFF-alpha)/255); - return color; -} - -void cImageLoader::toLowerCase(std::string &str) { - const int length = str.length(); - for(int i=0; i < length; ++i) { - str[i] = std::tolower(str[i]); - } -} - -bool cImageLoader::LoadImage(cString FileName, cString Path, cString Extension) { - try { - cString File = cString::sprintf("%s%s.%s", *Path, *FileName, *Extension); - //dsyslog("tvguide: trying to load: %s", *File); - buffer.read(*File); - //dsyslog("tvguide: %s sucessfully loaded", *File); - } catch (...) { - return false; - } - return true; -} - -bool cImageLoader::LoadImage(const char *fullpath) { - try { - //dsyslog("tvguide: trying to load: %s", fullpath); - buffer.read(fullpath); - //dsyslog("tvguide: %s sucessfully loaded", fullpath); - } catch (...) { - return false; - } - return true; -} \ No newline at end of file diff --git a/imageloader.h b/imageloader.h index 8b88ba4..f06b542 100644 --- a/imageloader.h +++ b/imageloader.h @@ -6,26 +6,22 @@ #include #include #include +#include "imagemagickwrapper.h" using namespace Magick; -class cImageLoader { +class cImageLoader : public cImageMagickWrapper { public: cImageLoader(); ~cImageLoader(); cImage GetImage(); - bool LoadLogo(const char *logo, int width, int height); - bool LoadEPGImage(int eventID); + bool LoadLogo(const cChannel *channel, int width, int height); + bool LoadEPGImage(int eventID, int width, int height); bool LoadAdditionalEPGImage(cString name); bool LoadPoster(const char *poster, int width, int height); bool LoadIcon(const char *cIcon, int size); + bool LoadOsdElement(cString name, int width, int height); bool DrawBackground(tColor back, tColor blend, int width, int height); -private: - Image buffer; - Color Argb2Color(tColor col); - void toLowerCase(std::string &str); - bool LoadImage(cString FileName, cString Path, cString Extension); - bool LoadImage(const char *fullpath); }; #endif //_TVGUIDE_IMAGELOADER_H diff --git a/imagemagickwrapper.c b/imagemagickwrapper.c new file mode 100644 index 0000000..753b678 --- /dev/null +++ b/imagemagickwrapper.c @@ -0,0 +1,162 @@ +#include +#include +#include "imagemagickwrapper.h" +#include "config.h" +#include "imagescaler.h" + +cImageMagickWrapper::cImageMagickWrapper() { + InitializeMagick(NULL); +} + +cImageMagickWrapper::~cImageMagickWrapper() { +} + +cImage *cImageMagickWrapper::CreateImage(int width, int height, bool preserveAspect) { + int w, h; + w = buffer.columns(); + h = buffer.rows(); + if ((w == 0)||(h==0)) + return NULL; + if (width == 0) + width = w; + if (height == 0) + height = h; + if (preserveAspect) { + unsigned scale_w = 1000 * width / w; + unsigned scale_h = 1000 * height / h; + if (scale_w > scale_h) + width = w * height / h; + else + height = h * width / w; + } + const PixelPacket *pixels = buffer.getConstPixels(0, 0, w, h); + cImage *image = NULL; + image = new cImage(cSize(width, height)); + if (!image) + return NULL; + tColor *imgData = (tColor *)image->Data(); + if (w != width || h != height) { + ImageScaler scaler; + scaler.SetImageParameters(imgData, width, width, height, w, h); + for (const void *pixels_end = &pixels[w*h]; pixels < pixels_end; ++pixels) + scaler.PutSourcePixel(pixels->blue / ((MaxRGB + 1) / 256), + pixels->green / ((MaxRGB + 1) / 256), + pixels->red / ((MaxRGB + 1) / 256), + ~((unsigned char)(pixels->opacity / ((MaxRGB + 1) / 256)))); + return image; + } + for (const void *pixels_end = &pixels[width*height]; pixels < pixels_end; ++pixels) + *imgData++ = ((~int(pixels->opacity / ((MaxRGB + 1) / 256)) << 24) | + (int(pixels->green / ((MaxRGB + 1) / 256)) << 8) | + (int(pixels->red / ((MaxRGB + 1) / 256)) << 16) | + (int(pixels->blue / ((MaxRGB + 1) / 256)) )); + return image; +} + +cImage cImageMagickWrapper::CreateImageCopy() { + int w, h; + w = buffer.columns(); + h = buffer.rows(); + cImage image (cSize(w, h)); + const PixelPacket *pixels = buffer.getConstPixels(0, 0, w, h); + for (int iy = 0; iy < h; ++iy) { + for (int ix = 0; ix < w; ++ix) { + tColor col = (~int(pixels->opacity * 255 / MaxRGB) << 24) + | (int(pixels->green * 255 / MaxRGB) << 8) + | (int(pixels->red * 255 / MaxRGB) << 16) + | (int(pixels->blue * 255 / MaxRGB) ); + image.SetPixel(cPoint(ix, iy), col); + ++pixels; + } + } + return image; +} + +bool cImageMagickWrapper::LoadImage(std::string FileName, std::string Path, std::string Extension) { + try { + std::stringstream sstrImgFile; + sstrImgFile << Path << FileName << "." << Extension; + std::string imgFile = sstrImgFile.str(); + if (tvguideConfig.debugImageLoading) + esyslog("tvguide: trying to load: %s", imgFile.c_str()); + buffer.read(imgFile.c_str()); + if (tvguideConfig.debugImageLoading) + esyslog("tvguide: %s sucessfully loaded", imgFile.c_str()); + } catch( Magick::Warning &warning ) { + if (tvguideConfig.debugImageLoading) + esyslog("tvguide: Magick Warning: %s", warning.what()); + return true; + } catch( Magick::Error &error ) { + if (tvguideConfig.debugImageLoading) + esyslog("tvguide: Magick Error: %s", error.what()); + return false; + } catch(...) { + if (tvguideConfig.debugImageLoading) + esyslog("tvguide: an unknown Magick error occured during image loading"); + return false; + } + return true; +} + +bool cImageMagickWrapper::LoadImage(const char *fullpath) { + if ((fullpath == NULL) || (strlen(fullpath) < 5)) + return false; + try { + if (tvguideConfig.debugImageLoading) + esyslog("tvguide: trying to load: %s", fullpath); + buffer.read(fullpath); + if (tvguideConfig.debugImageLoading) + esyslog("tvguide: %s sucessfully loaded", fullpath); + } catch( Magick::Warning &warning ) { + if (tvguideConfig.debugImageLoading) + esyslog("tvguide: Magick Warning: %s", warning.what()); + return true; + } catch( Magick::Error &error ) { + if (tvguideConfig.debugImageLoading) + esyslog("tvguide: Magick Error: %s", error.what()); + return false; + } catch(...) { + if (tvguideConfig.debugImageLoading) + esyslog("tvguide: an unknown Magick error occured during image loading"); + return false; + } + return true; +} + +Color cImageMagickWrapper::Argb2Color(tColor col) { + tIndex alpha = (col & 0xFF000000) >> 24; + tIndex red = (col & 0x00FF0000) >> 16; + tIndex green = (col & 0x0000FF00) >> 8; + tIndex blue = (col & 0x000000FF); + Color color(MaxRGB*red/255, MaxRGB*green/255, MaxRGB*blue/255, MaxRGB*(0xFF-alpha)/255); + return color; +} + +void cImageMagickWrapper::CreateGradient(tColor back, tColor blend, int width, int height, double wfactor, double hfactor) { + Color Back = Argb2Color(back); + Color Blend = Argb2Color(blend); + int maxw = MaxRGB * wfactor; + int maxh = MaxRGB * hfactor; + + Image imgblend(Geometry(width, height), Blend); + imgblend.modifyImage(); + imgblend.type(TrueColorMatteType); + PixelPacket *pixels = imgblend.getPixels(0, 0, width, height); + for (int x = 0; x < width; x++) { + for (int y = 0; y < height; y++) { + PixelPacket *pixel = pixels + y * width + x; + int opacity = (maxw / width * x + maxh - maxh / height * y) / 2; + pixel->opacity = (opacity <= MaxRGB) ? opacity : MaxRGB; + } + } + imgblend.syncPixels(); + + Image imgback(Geometry(width, height), Back); + imgback.composite(imgblend, 0, 0, OverCompositeOp); + + buffer = imgback; +} + +void cImageMagickWrapper::CreateBackground(tColor back, tColor blend, int width, int height) { + CreateGradient(back, blend, width, height, 0.8, 0.8); +} \ No newline at end of file diff --git a/imagemagickwrapper.h b/imagemagickwrapper.h new file mode 100644 index 0000000..eafb69a --- /dev/null +++ b/imagemagickwrapper.h @@ -0,0 +1,27 @@ +#ifndef __TVGUIDE_IMAGEMAGICKWRAPPER_H +#define __TVGUIDE_IMAGEMAGICKWRAPPER_H + +#define X_DISPLAY_MISSING + +#include +#include + +using namespace Magick; + +class cImageMagickWrapper { +private: + void CreateGradient(tColor back, tColor blend, int width, int height, double wfactor, double hfactor); +public: + cImageMagickWrapper(); + ~cImageMagickWrapper(); +protected: + Image buffer; + Color Argb2Color(tColor col); + cImage *CreateImage(int width, int height, bool preserveAspect = true); + cImage CreateImageCopy(void); + bool LoadImage(std::string FileName, std::string Path, std::string Extension); + bool LoadImage(const char *fullpath); + void CreateBackground(tColor back, tColor blend, int width, int height); +}; + +#endif //__TVGUIDE_IMAGEMAGICKWRAPPER_H diff --git a/imagescaler.c b/imagescaler.c new file mode 100644 index 0000000..cebe912 --- /dev/null +++ b/imagescaler.c @@ -0,0 +1,149 @@ + +#include "imagescaler.h" + +#include +#include + +ImageScaler::ImageScaler() : + m_memory(NULL), + m_hor_filters(NULL), + m_ver_filters(NULL), + m_buffer(NULL), + m_dst_image(NULL), + m_dst_stride(0), + m_dst_width(0), + m_dst_height(0), + m_src_width(0), + m_src_height(0), + m_src_x(0), + m_src_y(0), + m_dst_x(0), + m_dst_y(0) { +} + +ImageScaler::~ImageScaler() { + if ( m_memory ) free( m_memory ); +} + +// sin(x)/(x) +static float sincf( float x ) { + if ( fabsf(x) < 0.05f ) return 1.0f - (1.0f/6.0f)*x*x; // taylor series approximation to avoid 0/0 + return sin(x)/x; +} + +static void CalculateFilters( ImageScaler::Filter *filters, int dst_size, int src_size ) { + const float fc = dst_size >= src_size ? 1.0f : ((float) dst_size)/((float) src_size); + + for (int i = 0; i < dst_size; i++) { + const int d = 2*dst_size; // sample position denominator + const int e = (2*i+1) * src_size - dst_size; // sample position enumerator + int offset = e / d; // truncated sample position + const float sub_offset = ((float) (e - offset*d)) / ((float) d); // exact sample position is (float) e/d = offset + sub_offset + + // calculate filter coefficients + float h[4]; + for (int j=0; j<4; j++) { + const float t = 3.14159265359f * (sub_offset+(1-j)); + h[j] = sincf( fc * t ) * cosf( 0.25f * t ); // sinc-lowpass and cos-window + } + + // ensure that filter does not reach out off image bounds: + while ( offset < 1 ) { + h[0] += h[1]; + h[1] = h[2]; + h[2] = h[3]; + h[3] = 0.0f; + offset++; + } + + while ( offset+3 > src_size ) { + h[3] += h[2]; + h[2] = h[1]; + h[1] = h[0]; + h[0] = 0.0f; + offset--; + } + + // coefficients are normalized to sum up to 2048 + const float norm = 2048.0f / ( h[0] + h[1] + h[2] + h[3] ); + + offset--; // offset of fist used pixel + + filters[i].m_offset = offset + 4; // store offset of first unused pixel + + for (int j=0; j<4; j++) { + const float t = norm * h[j]; + filters[i].m_coeff[(offset+j) & 3] = (int) ((t > 0.0f) ? (t+0.5f) : (t-0.5f)); // consider ring buffer index permutations + } + } + + // set end marker + filters[dst_size].m_offset = (unsigned) -1; + +} + +void ImageScaler::SetImageParameters( unsigned *dst_image, unsigned dst_stride, unsigned dst_width, unsigned dst_height, unsigned src_width, unsigned src_height ) { + m_src_x = 0; + m_src_y = 0; + m_dst_x = 0; + m_dst_y = 0; + + m_dst_image = dst_image; + m_dst_stride = dst_stride; + + // if image dimensions do not change we can keep the old filter coefficients + if ( (src_width == m_src_width) && (src_height == m_src_height) && (dst_width == m_dst_width) && (dst_height == m_dst_height) ) return; + + m_dst_width = dst_width; + m_dst_height = dst_height; + m_src_width = src_width; + m_src_height = src_height; + + if ( m_memory ) free( m_memory ); + + const unsigned hor_filters_size = (m_dst_width + 1) * sizeof(Filter); // reserve one extra position for end marker + const unsigned ver_filters_size = (m_dst_height + 1) * sizeof(Filter); + const unsigned buffer_size = 4 * m_dst_width * sizeof(TmpPixel); + + char *p = (char *) malloc( hor_filters_size + ver_filters_size + buffer_size ); + + m_memory = p; + + m_hor_filters = (Filter *) p; p += hor_filters_size; + m_ver_filters = (Filter *) p; p += ver_filters_size; + m_buffer = (TmpPixel *) p; + + CalculateFilters( m_hor_filters, m_dst_width , m_src_width ); + CalculateFilters( m_ver_filters, m_dst_height, m_src_height ); +} + +// shift range to 0..255 and clamp overflows +static unsigned shift_clamp( int x ) { + x = ( x + (1<<21) ) >> 22; + if ( x < 0 ) return 0; + if ( x > 255 ) return 255; + return x; +} + +void ImageScaler::NextSourceLine() { + m_dst_x = 0; + m_src_x = 0; + m_src_y++; + + while ( m_ver_filters[m_dst_y].m_offset == m_src_y ) { + const int h0 = m_ver_filters[m_dst_y].m_coeff[0]; + const int h1 = m_ver_filters[m_dst_y].m_coeff[1]; + const int h2 = m_ver_filters[m_dst_y].m_coeff[2]; + const int h3 = m_ver_filters[m_dst_y].m_coeff[3]; + const TmpPixel *src = m_buffer; + unsigned *dst = m_dst_image + m_dst_stride * m_dst_y; + + for (unsigned i=0; im_offset == m_src_x ) { + *bp = m_hbuf[0]*fh->m_coeff[0] + m_hbuf[1]*fh->m_coeff[1] + m_hbuf[2]*fh->m_coeff[2] + m_hbuf[3]*fh->m_coeff[3]; + m_dst_x++; + bp += 4; + } + + if ( m_src_x == m_src_width ) NextSourceLine(); + } + +private: + + //! temporary image pixel class - a 4-element integer vector + class TmpPixel { + public: + TmpPixel() { + } + + TmpPixel( int c0, int c1, int c2, int c3 ) { + Set(c0,c1,c2,c3); + } + + void Set( int c0, int c1, int c2, int c3 ) { + m_comp[0] = c0; + m_comp[1] = c1; + m_comp[2] = c2; + m_comp[3] = c3; + } + + TmpPixel operator*( int s ) const { + return TmpPixel( m_comp[0]*s, m_comp[1]*s, m_comp[2]*s, m_comp[3]*s ); + } + + TmpPixel operator+( const TmpPixel &x ) const { + return TmpPixel( m_comp[0] + x[0], m_comp[1] + x[1], m_comp[2] + x[2], m_comp[3] + x[3] ); + } + + // return component i=[0..3] - No range check! + int operator[](unsigned i) const { + return m_comp[i]; + } + + private: + int m_comp[4]; + }; + + //! this is called whenever one input line is processed completely + void NextSourceLine(); + + TmpPixel m_hbuf[4]; //! ring buffer for 4 input pixels + char *m_memory; //! buffer container + Filter *m_hor_filters; //! buffer for horizontal filters (one for each output image column) + Filter *m_ver_filters; //! buffer for vertical filters (one for each output image row) + TmpPixel *m_buffer; //! buffer contains 4 horizontally filtered input lines, multiplexed + unsigned *m_dst_image; //! pointer to destination image + unsigned m_dst_stride; //! destination image stride + unsigned m_dst_width; //! destination image width + unsigned m_dst_height; //! destination image height + unsigned m_src_width; //! source image width + unsigned m_src_height; //! source image height + unsigned m_src_x; //! x position of next source image pixel + unsigned m_src_y; //! y position of source image line currently beeing processed + unsigned m_dst_x; //! x position of next destination image pixel + unsigned m_dst_y; //! x position of next destination image line +}; + +#endif // _ImageScaler_h + diff --git a/osdmanager.c b/osdmanager.c index 1f2d54b..385acf9 100644 --- a/osdmanager.c +++ b/osdmanager.c @@ -17,9 +17,9 @@ bool cOsdManager::setOsd() { void cOsdManager::setBackground() { if (tvguideConfig.displayStatusHeader && tvguideConfig.scaleVideo) { - int widthStatus = cOsd::OsdWidth() - tvguideConfig.statusHeaderHeight * 16 / 9; - osd->DrawRectangle(0, 0, widthStatus, tvguideConfig.statusHeaderHeight, theme.Color(clrBackgroundOSD)); - osd->DrawRectangle(0, tvguideConfig.statusHeaderHeight, Width(), Height(), theme.Color(clrBackgroundOSD)); + int widthStatus = cOsd::OsdWidth() - geoManager.statusHeaderHeight * 16 / 9; + osd->DrawRectangle(0, 0, widthStatus, geoManager.statusHeaderHeight, theme.Color(clrBackgroundOSD)); + osd->DrawRectangle(0, geoManager.statusHeaderHeight, Width(), Height(), theme.Color(clrBackgroundOSD)); } else osd->DrawRectangle(0, 0, Width(), Height(), theme.Color(clrBackgroundOSD)); diff --git a/po/de_DE.po b/po/de_DE.po index e1f7e70..7d9b3c0 100755 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-08-25 13:08+0200\n" +"POT-Creation-Date: 2013-12-17 18:24+0100\n" "PO-Revision-Date: 2012-08-25 17:49+0200\n" "Last-Translator: Horst\n" "Language-Team: \n" @@ -19,7 +19,7 @@ msgid "RERUNS OF THIS SHOW" msgstr "Wiederholungen dieser Sendung" msgid "Actors" -msgstr "" +msgstr "Schauspieler" msgid "No EPG Information available" msgstr "Keine EPG Daten verfügbar" @@ -39,6 +39,9 @@ msgstr "Umschalten" msgid "Detailed EPG" msgstr "Detailiertes EPG" +msgid "images" +msgstr "Bilder" + msgid "Transp." msgstr "Transp." @@ -384,6 +387,9 @@ msgstr "Anzeigeoptionen" msgid "Fonts and Fontsizes" msgstr "Schriften und Schriftgrößen" +msgid "Image Loading and Caching" +msgstr "Image Loading und Caching" + msgid "x channels back / forward" msgstr "x Kanäle zurück / vor" @@ -411,6 +417,9 @@ msgstr "Hauptmenüeintrag anzeigen" msgid "Replace VDR Schedules Menu" msgstr "VDR Programm Menü ersetzen" +msgid "Use appropriate nOpacity Theme" +msgstr "Entsprechendes nOpacity Theme benutzen" + msgid "Theme" msgstr "Theme" @@ -477,8 +486,8 @@ msgstr "Höhe der Zeitleiste (% der OSD Höhe)" msgid "Display time in EPG Grids" msgstr "Zeit in EPG Grids anzeigen" -msgid "Height of Footer" -msgstr "Höhe des Footers" +msgid "Height of Footer (Perc. of osd height)" +msgstr "Höhe des Footers (% der OSD Höhe)" msgid "Display status header" msgstr "Status Header anzeigen" @@ -519,6 +528,12 @@ msgstr "Logo Breitenverhältnis" msgid "Logo height ratio" msgstr "Logo Höhenverhältnis" +msgid "Height of Header in Detailed View (Perc. of osd height)" +msgstr "Höhe des Headers im detailierten EPG View (% der OSD Höhe)" + +msgid "Text Border in Detailed View (pixel)" +msgstr "Rand im detailierten EPG View" + msgid "Show EPG Images" msgstr "EPG Bilder anzeigen" @@ -590,3 +605,30 @@ msgstr "Suchen & Aufnehmen Menu Schriftgröße" msgid "Search & Recording Menu Small Font Size" msgstr "Suchen & Aufnehmen Menu kleine Schriftgröße" + +msgid "Create Log Messages for image loading" +msgstr "Log Nachrichten für das Laden der Bilder erzeugen" + +msgid "Limit Logo Cache" +msgstr "Logo Cash beschränken" + +msgid "Maximal number of logos to cache" +msgstr "Maximale Anzahl Logos" + +msgid "Number of logos to cache at start" +msgstr "Anzahl der zu cachenden Logos beim Start" + +msgid "Cache Sizes" +msgstr "Cache Größe" + +msgid "OSD Element Cache" +msgstr "OSD Element Cache" + +msgid "Logo cache" +msgstr "Logo Cache" + +msgid "EPG Grid Cache" +msgstr "EPG Grid Cache" + +msgid "Channel Groups Cache" +msgstr "Kanalgruppen Cache" diff --git a/recmenu.c b/recmenu.c index 66a5a84..985406f 100644 --- a/recmenu.c +++ b/recmenu.c @@ -3,7 +3,7 @@ // --- cRecMenu ------------------------------------------------------------- cRecMenu::cRecMenu(void) { - border = 10; + border = geoManager.borderRecMenus; height = 2*border; headerHeight = 0; footerHeight = 0; @@ -33,13 +33,13 @@ cRecMenu::~cRecMenu(void) { } void cRecMenu::SetWidthPercent(int percentOSDWidth) { - width = tvguideConfig.osdWidth * percentOSDWidth / 100; - x = (tvguideConfig.osdWidth - width) / 2; + width = geoManager.osdWidth * percentOSDWidth / 100; + x = (geoManager.osdWidth - width) / 2; } void cRecMenu::SetWidthPixel(int pixel) { width = pixel; - x = (tvguideConfig.osdWidth - width) / 2; + x = (geoManager.osdWidth - width) / 2; } int cRecMenu::CalculateOptimalWidth(void) { @@ -71,7 +71,7 @@ void cRecMenu::AddMenuItemScroll(cRecMenuItem *item) { bool cRecMenu::CheckHeight(void) { int nextHeight = headerHeight + footerHeight + scrollHeight + 2*border + 150; - if (nextHeight > tvguideConfig.osdHeight) { + if (nextHeight > geoManager.osdHeight) { scrollable = true; return false; } @@ -87,7 +87,7 @@ void cRecMenu::CalculateHeight(void) { } if (footer) height += footerHeight; - y = (tvguideConfig.osdHeight - height) / 2; + y = (geoManager.osdHeight - height) / 2; if (scrollable) { width += scrollbarWidth + border; @@ -355,8 +355,12 @@ void cRecMenu::Arrange(bool scroll) { } void cRecMenu::Display(bool scroll) { - pixmap->Fill(theme.Color(clrBackground)); - drawBorder(); + if (tvguideConfig.style == eStyleGraphical) { + drawBackgroundGraphical(bgRecMenuBack); + } else { + pixmap->Fill(theme.Color(clrBackground)); + drawBorder(); + } if (header && !scroll) { header->setBackground(); header->Draw(); @@ -497,7 +501,7 @@ eRecMenuState cRecMenu::ProcessKey(eKeys Key) { cImage *cRecMenu::createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend) { cImage *image = new cImage(cSize(width, height)); image->Fill(clrBgr); - if (tvguideConfig.useBlending) { + if (tvguideConfig.style != eStyleFlat) { int numSteps = 64; int alphaStep = 0x03; if (height < 30) diff --git a/recmenuitem.c b/recmenuitem.c index 0854a7a..76d0a5f 100644 --- a/recmenuitem.c +++ b/recmenuitem.c @@ -10,8 +10,8 @@ cRecMenuItem::cRecMenuItem(void) { height = 0; action = rmsNotConsumed; drawn = false; - font = tvguideConfig.FontRecMenuItem; - fontSmall = tvguideConfig.FontRecMenuItemSmall; + font = fontManager.FontRecMenuItem; + fontSmall = fontManager.FontRecMenuItemSmall; } cRecMenuItem::~cRecMenuItem(void) { @@ -32,18 +32,24 @@ void cRecMenuItem::SetPixmaps(void) { } void cRecMenuItem::setBackground(void) { - if (active) { - color = theme.Color(clrHighlight); - colorBlending = theme.Color(clrHighlightBlending); - colorText = theme.Color(clrFontActive); + if (tvguideConfig.style == eStyleGraphical) { + drawBackgroundGraphical(bgButton, active); + colorTextBack = clrTransparent; + colorText = (active)?theme.Color(clrFontActive):theme.Color(clrFont); } else { - color = theme.Color(clrGrid1); - colorBlending = theme.Color(clrGrid1Blending); - colorText = theme.Color(clrFont); + if (active) { + color = theme.Color(clrHighlight); + colorBlending = theme.Color(clrHighlightBlending); + colorText = theme.Color(clrFontActive); + } else { + color = theme.Color(clrGrid1); + colorBlending = theme.Color(clrGrid1Blending); + colorText = theme.Color(clrFont); + } + colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent; + drawBackground(); + drawBorder(); } - colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; - drawBackground(); - drawBorder(); } // --- cRecMenuItemButton ------------------------------------------------------- @@ -124,12 +130,13 @@ void cRecMenuItemButtonYesNo::SetPixmaps(void) { int buttonWidth = 44 * width / 100; int yesX = x + width / 25; int noX = x + 52 * width / 100; + int yPixmaps = y + geoManager.borderRecMenus / 2; if (!pixmap) { - pixmap = osdManager.requestPixmap(4, cRect(yesX, y, buttonWidth, height)); - pixmapNo = new cStyledPixmap(osdManager.requestPixmap(4, cRect(noX, y, buttonWidth, height))); + pixmap = osdManager.requestPixmap(4, cRect(yesX, yPixmaps, buttonWidth, height)); + pixmapNo = new cStyledPixmap(osdManager.requestPixmap(4, cRect(noX, yPixmaps, buttonWidth, height))); } else { - pixmap->SetViewPort(cRect(x, y, width, height)); - pixmapNo->SetViewPort(cRect(x, y, width, height)); + pixmap->SetViewPort(cRect(x, yPixmaps, width, height)); + pixmapNo->SetViewPort(cRect(x, yPixmaps, width, height)); } } @@ -144,35 +151,43 @@ void cRecMenuItemButtonYesNo::Show(void) { } void cRecMenuItemButtonYesNo::setBackground() { - if (active) { - if (yesActive) { - color = theme.Color(clrHighlight); - colorBlending = theme.Color(clrHighlightBlending); - colorText = theme.Color(clrFontActive); - pixmapNo->setColor( theme.Color(clrGrid1), - theme.Color(clrGrid1Blending)); - colorTextNo = theme.Color(clrFont); + if (tvguideConfig.style == eStyleGraphical) { + drawBackgroundGraphical(bgButton, yesActive&&active); + colorTextBack = clrTransparent; + colorText = (active&&yesActive)?theme.Color(clrFontActive):theme.Color(clrFont); + colorTextNo = (active&&!yesActive)?theme.Color(clrFontActive):theme.Color(clrFont); + pixmapNo->drawBackgroundGraphical(bgButton, active&&!yesActive); + } else { + if (active) { + if (yesActive) { + color = theme.Color(clrHighlight); + colorBlending = theme.Color(clrHighlightBlending); + colorText = theme.Color(clrFontActive); + pixmapNo->setColor( theme.Color(clrGrid1), + theme.Color(clrGrid1Blending)); + colorTextNo = theme.Color(clrFont); + } else { + color = theme.Color(clrGrid1); + colorBlending = theme.Color(clrGrid1Blending); + colorText = theme.Color(clrFont); + pixmapNo->setColor( theme.Color(clrHighlight), + theme.Color(clrHighlightBlending)); + colorTextNo = theme.Color(clrFontActive); + } } else { color = theme.Color(clrGrid1); colorBlending = theme.Color(clrGrid1Blending); colorText = theme.Color(clrFont); - pixmapNo->setColor( theme.Color(clrHighlight), - theme.Color(clrHighlightBlending)); - colorTextNo = theme.Color(clrFontActive); + pixmapNo->setColor( theme.Color(clrGrid1), + theme.Color(clrGrid1Blending)); + colorTextNo = theme.Color(clrFont); } - } else { - color = theme.Color(clrGrid1); - colorBlending = theme.Color(clrGrid1Blending); - colorText = theme.Color(clrFont); - pixmapNo->setColor( theme.Color(clrGrid1), - theme.Color(clrGrid1Blending)); - colorTextNo = theme.Color(clrFont); + colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent; + drawBackground(); + drawBorder(); + pixmapNo->drawBackground(); + pixmapNo->drawBorder(); } - colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; - drawBackground(); - drawBorder(); - pixmapNo->drawBackground(); - pixmapNo->drawBorder(); } void cRecMenuItemButtonYesNo::Draw(void) { @@ -1340,17 +1355,17 @@ void cRecMenuItemTimer::Show(void) { void cRecMenuItemTimer::Draw(void) { const cChannel *channel = timer->Channel(); - cString channelName(""); int channelTransponder = 0; + cString channelName = ""; if (channel) { - channelName = channel->Name(); channelTransponder = channel->Transponder(); + channelName = channel->Name(); } int logoX = DrawIcons(); int logoWidth = height * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio; cImageLoader imgLoader; if (!tvguideConfig.hideChannelLogos) { - if (imgLoader.LoadLogo(*channelName, logoWidth, height)) { + if (imgLoader.LoadLogo(channel, logoWidth, height)) { cImage logo = imgLoader.GetImage(); pixmapIcons->DrawImage(cPoint(logoX, 0), logo); logoX += logoWidth + 5; @@ -1577,14 +1592,13 @@ void cRecMenuItemEvent::Draw(void) { return; int logoX = DrawIcons(); const cChannel *channel = Channels.GetByChannelID(event->ChannelID()); - cString channelName(""); - if (channel) { + cString channelName = ""; + if (channel) channelName = channel->Name(); - } int logoWidth = height * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio; cImageLoader imgLoader; if (!tvguideConfig.hideChannelLogos) { - if (imgLoader.LoadLogo(*channelName, logoWidth, height)) { + if (imgLoader.LoadLogo(channel, logoWidth, height)) { cImage logo = imgLoader.GetImage(); pixmapText->DrawImage(cPoint(logoX, 0), logo); logoX += logoWidth + 5; @@ -1749,7 +1763,7 @@ void cRecMenuItemChannelChooser::DrawValue(void) { int logoWidth = height * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio; int logoX = textX - logoWidth - 10; cImageLoader imgLoader; - if (imgLoader.LoadLogo(channel->Name(), logoWidth, height)) { + if (imgLoader.LoadLogo(channel, logoWidth, height)) { cImage logo = imgLoader.GetImage(); pixmapChannel->DrawImage(cPoint(logoX, 0), logo); } diff --git a/recmenumanager.c b/recmenumanager.c index 75d6555..270165e 100644 --- a/recmenumanager.c +++ b/recmenumanager.c @@ -57,14 +57,14 @@ void cRecMenuManager::Close(void) { } void cRecMenuManager::SetBackground(void) { - int backgroundWidth = tvguideConfig.osdWidth; - int backgroundHeight = tvguideConfig.osdHeight; + int backgroundWidth = geoManager.osdWidth; + int backgroundHeight = geoManager.osdHeight; pixmapBackground = osdManager.requestPixmap(3, cRect(0, 0, backgroundWidth, backgroundHeight)); pixmapBackground->Fill(theme.Color(clrRecMenuBackground)); if (tvguideConfig.scaleVideo) { - int tvHeight = tvguideConfig.statusHeaderHeight; + int tvHeight = geoManager.statusHeaderHeight; int tvWidth = tvHeight * 16 / 9; - int tvX = tvguideConfig.osdWidth - tvWidth; + int tvX = geoManager.osdWidth - tvWidth; pixmapBackground->DrawRectangle(cRect(tvX, 0, tvWidth, tvHeight), clrTransparent); } } diff --git a/setup.c b/setup.c index b38e838..c13af68 100644 --- a/setup.c +++ b/setup.c @@ -6,6 +6,13 @@ cTvguideSetup::cTvguideSetup() { } cTvguideSetup::~cTvguideSetup() { + geoManager.SetGeometry(cOsd::OsdWidth(), cOsd::OsdHeight(), true); + fontManager.DeleteFonts(); + fontManager.SetFonts(); + tvguideConfig.LoadTheme(); + tvguideConfig.setDynamicValues(); + imgCache.Clear(); + imgCache.CreateCache(); } @@ -16,7 +23,8 @@ void cTvguideSetup::Setup(void) { Add(new cOsdItem(tr("General Settings"))); Add(new cOsdItem(tr("Screen Presentation"))); Add(new cOsdItem(tr("Fonts and Fontsizes"))); - + Add(new cOsdItem(tr("Image Loading and Caching"))); + SetCurrent(Get(currentItem)); Display(); } @@ -35,7 +43,9 @@ eOSState cTvguideSetup::ProcessKey(eKeys Key) { if (strcmp(ItemText, tr("Screen Presentation")) == 0) state = AddSubMenu(new cMenuSetupScreenLayout(&tmpTvguideConfig)); if (strcmp(ItemText, tr("Fonts and Fontsizes")) == 0) - state = AddSubMenu(new cMenuSetupFont(&tmpTvguideConfig)); + state = AddSubMenu(new cMenuSetupFont(&tmpTvguideConfig)); + if (strcmp(ItemText, tr("Image Loading and Caching")) == 0) + state = AddSubMenu(new cMenuSetupImageCache(&tmpTvguideConfig)); } } return state; @@ -44,7 +54,8 @@ eOSState cTvguideSetup::ProcessKey(eKeys Key) { void cTvguideSetup::Store(void) { tvguideConfig = tmpTvguideConfig; - + SetupStore("debugImageLoading", tvguideConfig.debugImageLoading); + SetupStore("useNopacityTheme", tvguideConfig.useNopacityTheme); SetupStore("themeIndex", tvguideConfig.themeIndex); SetupStore("showMainMenuEntry", tvguideConfig.showMainMenuEntry); SetupStore("replaceOriginalSchedule", tvguideConfig.replaceOriginalSchedule); @@ -54,6 +65,8 @@ void cTvguideSetup::Store(void) { SetupStore("displayChannelGroups", tvguideConfig.displayChannelGroups); SetupStore("statusHeaderPercent", tvguideConfig.statusHeaderPercent); SetupStore("channelGroupsPercent", tvguideConfig.channelGroupsPercent); + SetupStore("epgViewHeaderPercent", tvguideConfig.epgViewHeaderPercent); + SetupStore("epgViewBorder", tvguideConfig.epgViewBorder); SetupStore("scaleVideo", tvguideConfig.scaleVideo); SetupStore("decorateVideo", tvguideConfig.decorateVideo); SetupStore("roundedCorners", tvguideConfig.roundedCorners); @@ -83,7 +96,7 @@ void cTvguideSetup::Store(void) { SetupStore("displayChannelName", tvguideConfig.displayChannelName); SetupStore("channelHeaderWidthPercent", tvguideConfig.channelHeaderWidthPercent); SetupStore("channelHeaderHeightPercent", tvguideConfig.channelHeaderHeightPercent); - SetupStore("footerHeight", tvguideConfig.footerHeight); + SetupStore("footerHeightPercent", tvguideConfig.footerHeightPercent); SetupStore("recMenuAskFolder", tvguideConfig.recMenuAskFolder); SetupStore("fontIndex", tvguideConfig.fontIndex); SetupStore("FontButtonDelta", tvguideConfig.FontButtonDelta); @@ -111,10 +124,14 @@ void cTvguideSetup::Store(void) { SetupStore("displayRerunsDetailEPGView", tvguideConfig.displayRerunsDetailEPGView); SetupStore("numReruns", tvguideConfig.numReruns); SetupStore("useSubtitleRerun", tvguideConfig.useSubtitleRerun); + SetupStore("numLogosInitial", tvguideConfig.numLogosInitial); + SetupStore("numLogosMax", tvguideConfig.numLogosMax); + SetupStore("limitLogoCache", tvguideConfig.limitLogoCache); } cMenuSetupSubMenu::cMenuSetupSubMenu(const char* Title, cTvguideConfig* data) : cOsdMenu(Title, 30) { tmpTvguideConfig = data; + indent = " "; } cOsdItem *cMenuSetupSubMenu::InfoItem(const char *label, const char *value) { @@ -154,13 +171,15 @@ cMenuSetupGeneral::cMenuSetupGeneral(cTvguideConfig* data) : cMenuSetupSubMenu( } void cMenuSetupGeneral::Set(void) { - const char *indent = " "; int currentItem = Current(); Clear(); Add(new cMenuEditBoolItem(tr("Show Main Menu Entry"), &tmpTvguideConfig->showMainMenuEntry)); Add(new cMenuEditBoolItem(tr("Replace VDR Schedules Menu"), &tmpTvguideConfig->replaceOriginalSchedule)); - if (themes.NumThemes()) - Add(new cMenuEditStraItem(tr("Theme"), &tmpTvguideConfig->themeIndex, themes.NumThemes(), themes.Descriptions())); + Add(new cMenuEditBoolItem(tr("Use appropriate nOpacity Theme"), &tmpTvguideConfig->useNopacityTheme)); + if (!tmpTvguideConfig->useNopacityTheme) { + if (themes.NumThemes()) + Add(new cMenuEditStraItem(cString::sprintf("%s%s", *indent, tr("Theme")), &tmpTvguideConfig->themeIndex, themes.NumThemes(), themes.Descriptions())); + } Add(new cMenuEditBoolItem(tr("Rounded Corners"), &tmpTvguideConfig->roundedCorners)); Add(new cMenuEditStraItem(tr("Channel Jump Mode (Keys Green / Yellow)"), &tmpTvguideConfig->channelJumpMode, 2, jumpMode)); @@ -176,8 +195,8 @@ void cMenuSetupGeneral::Set(void) { Add(new cMenuEditBoolItem(tr("Use Remotetimers"), &tmpTvguideConfig->useRemoteTimers)); Add(new cMenuEditBoolItem(tr("Display Reruns in detailed EPG View"), &tmpTvguideConfig->displayRerunsDetailEPGView)); if (tmpTvguideConfig->displayRerunsDetailEPGView) { - Add(new cMenuEditIntItem(cString::sprintf("%s%s", indent, tr("Number of reruns to display")), &tmpTvguideConfig->numReruns, 1, 10)); - Add(new cMenuEditStraItem(cString::sprintf("%s%s", indent, tr("Use Subtitle for reruns")), &tmpTvguideConfig->useSubtitleRerun, 3, useSubtitleRerunTexts)); + Add(new cMenuEditIntItem(cString::sprintf("%s%s", *indent, tr("Number of reruns to display")), &tmpTvguideConfig->numReruns, 1, 10)); + Add(new cMenuEditStraItem(cString::sprintf("%s%s", *indent, tr("Use Subtitle for reruns")), &tmpTvguideConfig->useSubtitleRerun, 3, useSubtitleRerunTexts)); } SetCurrent(Get(currentItem)); Display(); @@ -206,56 +225,58 @@ cMenuSetupScreenLayout::cMenuSetupScreenLayout(cTvguideConfig* data) : cMenuSet } void cMenuSetupScreenLayout::Set(void) { - const char *indent = " "; int currentItem = Current(); Clear(); Add(new cMenuEditStraItem(tr("Display Mode"), &tmpTvguideConfig->displayMode, 2, displayModeItems)); if (tmpTvguideConfig->displayMode == eVertical) { - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Height of Channel Header (Perc. of osd height)")), &tmpTvguideConfig->channelHeaderHeightPercent, 5, 30)); - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Width of Timeline (Perc. of osd width)")), &tmpTvguideConfig->timeLineWidthPercent, 5, 30)); - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Number of Channels to display")), &tmpTvguideConfig->channelCols, 3, 12)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Height of Channel Header (Perc. of osd height)")), &tmpTvguideConfig->channelHeaderHeightPercent, 5, 30)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Width of Timeline (Perc. of osd width)")), &tmpTvguideConfig->timeLineWidthPercent, 5, 30)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Number of Channels to display")), &tmpTvguideConfig->channelCols, 3, 12)); } else if (tmpTvguideConfig->displayMode == eHorizontal) { - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Width of Channel Header (Perc. of osd width)")), &tmpTvguideConfig->channelHeaderWidthPercent, 5, 30)); - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Height of Timeline (Perc. of osd height)")), &tmpTvguideConfig->timeLineHeightPercent, 5, 30)); - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Number of Channels to display")), &tmpTvguideConfig->channelRows, 3, 12)); - Add(new cMenuEditBoolItem(*cString::sprintf("%s%s", indent, tr("Display time in EPG Grids")), &tmpTvguideConfig->showTimeInGrid)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Width of Channel Header (Perc. of osd width)")), &tmpTvguideConfig->channelHeaderWidthPercent, 5, 30)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Height of Timeline (Perc. of osd height)")), &tmpTvguideConfig->timeLineHeightPercent, 5, 30)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Number of Channels to display")), &tmpTvguideConfig->channelRows, 3, 12)); + Add(new cMenuEditBoolItem(*cString::sprintf("%s%s", *indent, tr("Display time in EPG Grids")), &tmpTvguideConfig->showTimeInGrid)); } - Add(new cMenuEditIntItem(tr("Height of Footer"), &tmpTvguideConfig->footerHeight, 50, 300)); + Add(new cMenuEditIntItem(tr("Height of Footer (Perc. of osd height)"), &tmpTvguideConfig->footerHeightPercent, 3, 20)); Add(new cMenuEditBoolItem(tr("Display status header"), &tmpTvguideConfig->displayStatusHeader)); if (tmpTvguideConfig->displayStatusHeader) { - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Height of status header (Perc. of osd height)")), &tmpTvguideConfig->statusHeaderPercent, 5, 50)); - Add(new cMenuEditBoolItem(*cString::sprintf("%s%s", indent, tr("Scale video to upper right corner")), &tmpTvguideConfig->scaleVideo)); - Add(new cMenuEditBoolItem(*cString::sprintf("%s%s", indent, tr("Rounded corners around video frame")), &tmpTvguideConfig->decorateVideo)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Height of status header (Perc. of osd height)")), &tmpTvguideConfig->statusHeaderPercent, 5, 50)); + Add(new cMenuEditBoolItem(*cString::sprintf("%s%s", *indent, tr("Scale video to upper right corner")), &tmpTvguideConfig->scaleVideo)); + Add(new cMenuEditBoolItem(*cString::sprintf("%s%s", *indent, tr("Rounded corners around video frame")), &tmpTvguideConfig->decorateVideo)); } Add(new cMenuEditBoolItem(tr("Display Channel Names in Header"), &tmpTvguideConfig->displayChannelName)); Add(new cMenuEditBoolItem(tr("Display channel groups"), &tmpTvguideConfig->displayChannelGroups)); if (tmpTvguideConfig->displayChannelGroups) { if (tmpTvguideConfig->displayMode == eVertical) { - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Height of channel groups (Perc. of osd height)")), &tmpTvguideConfig->channelGroupsPercent, 3, 30)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Height of channel groups (Perc. of osd height)")), &tmpTvguideConfig->channelGroupsPercent, 3, 30)); } else if (tmpTvguideConfig->displayMode == eHorizontal) { - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Width of channel groups (Perc. of osd width)")), &tmpTvguideConfig->channelGroupsPercent, 3, 30)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Width of channel groups (Perc. of osd width)")), &tmpTvguideConfig->channelGroupsPercent, 3, 30)); } } Add(new cMenuEditStraItem(tr("Show Channel Logos"), &tmpTvguideConfig->hideChannelLogos, 2, hideChannelLogosItems)); if (!tmpTvguideConfig->hideChannelLogos) { Add(InfoItem(tr("Logo Path used"), *tvguideConfig.logoPath)); - Add(new cMenuEditStraItem(*cString::sprintf("%s%s", indent, tr("Logo Extension")), &tmpTvguideConfig->logoExtension, 2, logoExtensionItems)); - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Logo width ratio")), &tmpTvguideConfig->logoWidthRatio, 1, 1000)); - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Logo height ratio")), &tmpTvguideConfig->logoHeightRatio, 1, 1000)); + Add(new cMenuEditStraItem(*cString::sprintf("%s%s", *indent, tr("Logo Extension")), &tmpTvguideConfig->logoExtension, 2, logoExtensionItems)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Logo width ratio")), &tmpTvguideConfig->logoWidthRatio, 1, 1000)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Logo height ratio")), &tmpTvguideConfig->logoHeightRatio, 1, 1000)); } + Add(new cMenuEditIntItem(tr("Height of Header in Detailed View (Perc. of osd height)"), &tmpTvguideConfig->epgViewHeaderPercent, 10, 50)); + Add(new cMenuEditIntItem(tr("Text Border in Detailed View (pixel)"), &tmpTvguideConfig->epgViewBorder, 0, 300)); + Add(new cMenuEditStraItem(tr("Show EPG Images"), &tmpTvguideConfig->hideEpgImages, 2, hideChannelLogosItems)); if (!tmpTvguideConfig->hideEpgImages) { Add(InfoItem(tr("EPG Images Path used"), *tvguideConfig.epgImagePath)); - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("EPG Image width")), &tmpTvguideConfig->epgImageWidth, 0, 800)); - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("EPG Image height")), &tmpTvguideConfig->epgImageHeight, 0, 800)); - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Number of additional EPG Images")), &tmpTvguideConfig->numAdditionalEPGPictures, 0, 20)); - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Additional EPG Image width")), &tmpTvguideConfig->epgImageWidthLarge, 1, 800)); - Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Additional EPG Image height")), &tmpTvguideConfig->epgImageHeightLarge, 0, 800)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("EPG Image width")), &tmpTvguideConfig->epgImageWidth, 0, 800)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("EPG Image height")), &tmpTvguideConfig->epgImageHeight, 0, 800)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Number of additional EPG Images")), &tmpTvguideConfig->numAdditionalEPGPictures, 0, 20)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Additional EPG Image width")), &tmpTvguideConfig->epgImageWidthLarge, 1, 800)); + Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Additional EPG Image height")), &tmpTvguideConfig->epgImageHeightLarge, 0, 800)); } SetCurrent(Get(currentItem)); @@ -317,4 +338,29 @@ void cMenuSetupFont::Set(void) { SetCurrent(Get(currentItem)); Display(); -} \ No newline at end of file +} + +//-----Image Caching------------------------------------------------------------------------------------------------------------- +cMenuSetupImageCache::cMenuSetupImageCache(cTvguideConfig* data) : cMenuSetupSubMenu(tr("Image Loading and Caching"), data) { + Set(); +} + +void cMenuSetupImageCache::Set(void) { + int currentItem = Current(); + Clear(); + Add(new cMenuEditBoolItem(tr("Create Log Messages for image loading"), &tmpTvguideConfig->debugImageLoading)); + Add(new cMenuEditBoolItem(tr("Limit Logo Cache"), &tmpTvguideConfig->limitLogoCache)); + if (&tmpTvguideConfig->limitLogoCache) { + Add(new cMenuEditIntItem(cString::sprintf("%s%s", *indent, tr("Maximal number of logos to cache")), &tmpTvguideConfig->numLogosMax, 1, 9999)); + } + Add(new cMenuEditIntItem(tr("Number of logos to cache at start"), &tmpTvguideConfig->numLogosInitial, 0, 9999)); + + Add(InfoItem(tr("Cache Sizes"), "")); + Add(InfoItem(tr("OSD Element Cache"), (imgCache.GetCacheSize(ctOsdElement)).c_str())); + Add(InfoItem(tr("Logo cache"), (imgCache.GetCacheSize(ctLogo)).c_str())); + Add(InfoItem(tr("EPG Grid Cache"), (imgCache.GetCacheSize(ctGrid)).c_str())); + Add(InfoItem(tr("Channel Groups Cache"), (imgCache.GetCacheSize(ctChannelGroup)).c_str())); + + SetCurrent(Get(currentItem)); + Display(); +} diff --git a/setup.h b/setup.h index 936d2a1..07a9f71 100644 --- a/setup.h +++ b/setup.h @@ -23,6 +23,7 @@ class cMenuSetupSubMenu : public cOsdMenu { virtual eOSState ProcessKey(eKeys Key); virtual void Set(void) = 0; cOsdItem *InfoItem(const char *label, const char *value); + cString indent; public: cMenuSetupSubMenu(const char *Title, cTvguideConfig *data); }; @@ -59,4 +60,11 @@ class cMenuSetupFont : public cMenuSetupSubMenu { cMenuSetupFont(cTvguideConfig *data); }; +class cMenuSetupImageCache : public cMenuSetupSubMenu { + protected: + void Set(void); + public: + cMenuSetupImageCache(cTvguideConfig *data); +}; + #endif //__TVGUIDE_SETUP_H \ No newline at end of file diff --git a/statusheader.c b/statusheader.c index b964911..63442c1 100644 --- a/statusheader.c +++ b/statusheader.c @@ -6,34 +6,12 @@ cStatusHeader::cStatusHeader(void) { color = theme.Color(clrStatusHeader); colorBlending = theme.Color(clrStatusHeaderBlending); - height = tvguideConfig.statusHeaderHeight; - if (tvguideConfig.scaleVideo) { - width = tvguideConfig.osdWidth - height * 16 / 9; - } else { - width = tvguideConfig.osdWidth; - } - int tvFrameWidth = tvguideConfig.osdWidth - width; + height = geoManager.statusHeaderHeight; + width = geoManager.statusHeaderContentWidth; + tvFrameWidth = geoManager.tvFrameWidth; pixmap = osdManager.requestPixmap(1, cRect(0, 0, width, height)); pixmapText = osdManager.requestPixmap(2, cRect(0, 0, width, height)); - pixmapText->Fill(clrTransparent); - pixmapTVFrame = osdManager.requestPixmap(1, cRect(width, 0, tvFrameWidth, height)); - pixmapTVFrame->Fill(clrTransparent); - if (tvguideConfig.decorateVideo) { - int radius = 16; - int frame = 10; - pixmapTVFrame->DrawRectangle(cRect(0, 0, tvFrameWidth, frame), theme.Color(clrBackground)); - pixmapTVFrame->DrawEllipse(cRect(frame,frame,radius,radius), theme.Color(clrBackground), -2); - pixmapTVFrame->DrawRectangle(cRect(tvFrameWidth - frame, frame, frame, height - 2*frame), theme.Color(clrBackground)); - pixmapTVFrame->DrawEllipse(cRect(tvFrameWidth - radius - frame, frame, radius, radius), theme.Color(clrBackground), -1); - pixmapTVFrame->DrawRectangle(cRect(0, frame, frame, height - 2*frame), theme.Color(clrBackground)); - pixmapTVFrame->DrawEllipse(cRect(frame, height - radius - frame, radius, radius), theme.Color(clrBackground), -3); - pixmapTVFrame->DrawRectangle(cRect(0, height - frame, tvFrameWidth, frame), theme.Color(clrBackground)); - pixmapTVFrame->DrawEllipse(cRect(tvFrameWidth - radius - frame, height - radius - frame, radius, radius), theme.Color(clrBackground), -4); - - } - drawBackground(); - drawBorder(); } cStatusHeader::~cStatusHeader(void) { @@ -45,10 +23,32 @@ cStatusHeader::~cStatusHeader(void) { } } +void cStatusHeader::Draw(void) { + pixmapText->Fill(clrTransparent); + pixmapTVFrame->Fill(clrTransparent); + if (tvguideConfig.style == eStyleGraphical) { + if (tvguideConfig.scaleVideo) { + drawBackgroundGraphical(bgStatusHeaderWindowed); + cImage *tvFrameBack = imgCache.GetOsdElement(oeStatusHeaderTVFrame); + if (tvFrameBack) + pixmapTVFrame->DrawImage(cPoint(0,0), *tvFrameBack); + } else { + drawBackgroundGraphical(bgStatusHeaderFull); + } + + } else { + if (tvguideConfig.decorateVideo) { + DecorateVideoFrame(); + } + drawBackground(); + drawBorder(); + } +} + void cStatusHeader::ScaleVideo(void) { if (tvguideConfig.scaleVideo) { int width = height * 16 / 9; - int x = osdManager.Left() + tvguideConfig.osdWidth - width; + int x = osdManager.Left() + geoManager.osdWidth - width; int y = osdManager.Top(); cRect availableRect(x, y, width, height); cRect vidWin = cDevice::PrimaryDevice()->CanScaleVideo(availableRect); @@ -58,8 +58,8 @@ void cStatusHeader::ScaleVideo(void) { void cStatusHeader::DrawInfoText(cGrid *grid) { int border = 10; - int textWidth = width - 2 * border; - tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; + int textWidth = width - 2 * border - geoManager.clockWidth - 2; + tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent; pixmapText->Fill(clrTransparent); int x = border; int y = border; @@ -74,29 +74,29 @@ void cStatusHeader::DrawInfoText(cGrid *grid) { cString title(""); title = cString::sprintf(": %s", event->Title()); cString header = cString::sprintf("%s%s", *time, *title); - header = CutText(*header, textWidth, tvguideConfig.FontStatusHeaderLarge).c_str(); - pixmapText->DrawText(cPoint(x,y), *header, theme.Color(clrFont), colorTextBack, tvguideConfig.FontStatusHeaderLarge); - y += tvguideConfig.FontStatusHeaderLarge->Height() + border; + header = CutText(*header, textWidth, fontManager.FontStatusHeaderLarge).c_str(); + pixmapText->DrawText(cPoint(x,y), *header, theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeaderLarge); + y += fontManager.FontStatusHeaderLarge->Height() + border; int heightText = pixmapText->ViewPort().Height() - y; cTextWrapper description; - description.Set(event->Description(), tvguideConfig.FontStatusHeader, textWidth); - int lineHeight = tvguideConfig.FontStatusHeader->Height(); + description.Set(event->Description(), fontManager.FontStatusHeader, textWidth); + int lineHeight = fontManager.FontStatusHeader->Height(); int textLines = description.Lines(); int maxLines = heightText / lineHeight; int lines = min(textLines, maxLines); for (int i = 0; i < lines-1; i++) { - pixmapText->DrawText(cPoint(x,y), description.GetLine(i), theme.Color(clrFont), colorTextBack, tvguideConfig.FontStatusHeader); + pixmapText->DrawText(cPoint(x,y), description.GetLine(i), theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeader); y += lineHeight; } cString lastLine = description.GetLine(lines-1); if (textLines > maxLines) { lastLine = cString::sprintf("%s...", *lastLine); } - pixmapText->DrawText(cPoint(x,y), *lastLine, theme.Color(clrFont), colorTextBack, tvguideConfig.FontStatusHeader); + pixmapText->DrawText(cPoint(x,y), *lastLine, theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeader); } else { int heightText = pixmapText->ViewPort().Height() - y; - y += (heightText - tvguideConfig.FontStatusHeaderLarge->Height() - 2*border)/2; - pixmapText->DrawText(cPoint(x,y), *grid->getText(), theme.Color(clrFont), colorTextBack, tvguideConfig.FontStatusHeaderLarge); + y += (heightText - fontManager.FontStatusHeaderLarge->Height() - 2*border)/2; + pixmapText->DrawText(cPoint(x,y), *grid->getText(), theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeaderLarge); } } @@ -130,3 +130,16 @@ int cStatusHeader::DrawPoster(const cEvent *event, int x, int y, int height, int } return 0; } + +void cStatusHeader::DecorateVideoFrame(void) { + int radius = 16; + int frame = 10; + pixmapTVFrame->DrawRectangle(cRect(0, 0, tvFrameWidth, frame), theme.Color(clrBackground)); + pixmapTVFrame->DrawEllipse(cRect(frame,frame,radius,radius), theme.Color(clrBackground), -2); + pixmapTVFrame->DrawRectangle(cRect(tvFrameWidth - frame, frame, frame, height - 2*frame), theme.Color(clrBackground)); + pixmapTVFrame->DrawEllipse(cRect(tvFrameWidth - radius - frame, frame, radius, radius), theme.Color(clrBackground), -1); + pixmapTVFrame->DrawRectangle(cRect(0, frame, frame, height - 2*frame), theme.Color(clrBackground)); + pixmapTVFrame->DrawEllipse(cRect(frame, height - radius - frame, radius, radius), theme.Color(clrBackground), -3); + pixmapTVFrame->DrawRectangle(cRect(0, height - frame, tvFrameWidth, frame), theme.Color(clrBackground)); + pixmapTVFrame->DrawEllipse(cRect(tvFrameWidth - radius - frame, height - radius - frame, radius, radius), theme.Color(clrBackground), -4); +} \ No newline at end of file diff --git a/statusheader.h b/statusheader.h index de44315..3096803 100644 --- a/statusheader.h +++ b/statusheader.h @@ -9,12 +9,15 @@ class cStatusHeader : public cStyledPixmap { private: int width, height; + int tvFrameWidth; cPixmap *pixmapText; cPixmap *pixmapTVFrame; int DrawPoster(const cEvent *event, int x, int y, int height, int border); + void DecorateVideoFrame(void); public: cStatusHeader(void); virtual ~cStatusHeader(void); + void Draw(void); void ScaleVideo(void); void DrawInfoText(cGrid *grid); }; diff --git a/styledpixmap.c b/styledpixmap.c index 6acc1d0..41bdf28 100644 --- a/styledpixmap.c +++ b/styledpixmap.c @@ -1,4 +1,5 @@ #include "imageloader.h" +#include "geometrymanager.h" #include "styledpixmap.h" cStyledPixmap::cStyledPixmap(void) { @@ -21,15 +22,76 @@ void cStyledPixmap::setPixmap(cPixmap *pixmap) { } void cStyledPixmap::drawBackground() { - if (tvguideConfig.useBlending == 1){ + if (tvguideConfig.style == eStyleBlendingDefault){ drawBlendedBackground(); - } else if (tvguideConfig.useBlending == 2){ + } else if (tvguideConfig.style == eStyleBlendingMagick){ drawSparsedBackground(); } else { pixmap->Fill(color); } } +void cStyledPixmap::drawBackgroundGraphical(eBackgroundType type, bool active) { + cImage *back = NULL; + if (type == bgGrid) { + back = imgCache.GetGrid(pixmap->ViewPort().Width(), pixmap->ViewPort().Height(), active); + } else if (type == bgChannelHeader) { + back = imgCache.GetOsdElement(oeLogoBack); + } else if (type == bgChannelGroup) { + back = imgCache.GetChannelGroup(pixmap->ViewPort().Width(), pixmap->ViewPort().Height()); + } else if (type == bgStatusHeaderWindowed) { + back = imgCache.GetOsdElement(oeStatusHeaderContentWindowed); + } else if (type == bgStatusHeaderFull) { + back = imgCache.GetOsdElement(oeStatusHeaderContentFull); + } else if (type == bgClock) { + back = imgCache.GetOsdElement(oeClock); + } else if (type == bgEpgHeader) { + back = imgCache.GetOsdElement(oeEpgHeader); + } else if (type == bgButton) { + drawBackgroundButton(active); + return; + } else if (type == bgRecMenuBack) { + cImageLoader imgLoader; + if (imgLoader.LoadOsdElement("recmenu_background", pixmap->ViewPort().Width(), pixmap->ViewPort().Height())) { + cImage background = imgLoader.GetImage(); + pixmap->DrawImage(cPoint(0, 0), background); + } else { + pixmap->Fill(clrTransparent); + } + return; + } + if (back) { + pixmap->DrawImage(cPoint(0,0), *back); + } else { + pixmap->Fill(clrTransparent); + } +} + +void cStyledPixmap::drawBackgroundButton(bool active) { + std::string buttonName = ""; + int buttonWidth = pixmap->ViewPort().Width(); + int buttonHeight = pixmap->ViewPort().Height(); + if (buttonWidth > geoManager.osdWidth * 50 / 100) { + if (active) + buttonName = "button_active_70percent"; + else + buttonName = "button_70percent"; + } else { + if (active) + buttonName = "button_active_30percent"; + else + buttonName = "button_30percent"; + } + cImageLoader imgLoader; + if (imgLoader.LoadOsdElement(buttonName.c_str(), buttonWidth, buttonHeight)) { + cImage button = imgLoader.GetImage(); + pixmap->DrawImage(cPoint(0, 0), button); + } else { + pixmap->Fill(clrTransparent); + } +} + + void cStyledPixmap::drawBlendedBackground() { int width = pixmap->ViewPort().Width(); int height = pixmap->ViewPort().Height(); diff --git a/styledpixmap.h b/styledpixmap.h index ab488e6..8ce094f 100644 --- a/styledpixmap.h +++ b/styledpixmap.h @@ -6,12 +6,25 @@ #include "timer.h" #include "config.h" +enum eBackgroundType { + bgGrid, + bgStatusHeaderFull, + bgStatusHeaderWindowed, + bgChannelHeader, + bgChannelGroup, + bgClock, + bgEpgHeader, + bgButton, + bgRecMenuBack, +}; + // --- cStyledPixmap ------------------------------------------------------------- class cStyledPixmap { private: void drawVerticalLine(int x, int yStart, int yStop, tColor col); void drawHorizontalLine(int y, int xStart, int xStop, tColor col); + void drawBackgroundButton(bool active); protected: cPixmap *pixmap; tColor color; @@ -22,6 +35,7 @@ public: cStyledPixmap(cPixmap *pixmap); virtual ~cStyledPixmap(void); void drawBackground(); + void drawBackgroundGraphical(eBackgroundType type, bool active = false); void drawBlendedBackground(); void drawSparsedBackground(); void drawBorder(); @@ -31,6 +45,7 @@ public: void setColor(tColor color, tColor colorBlending) {this->color = color; this->colorBlending = colorBlending;}; void SetAlpha(int alpha) {pixmap->SetAlpha(alpha);}; void SetLayer(int layer) {pixmap->SetLayer(layer);}; + void Fill(tColor clr) {pixmap->Fill(clr);}; void DrawText(const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font); void DrawImage(const cPoint &Point, const cImage &Image); void DrawRectangle(const cRect &Rect, tColor Color); diff --git a/themes/tvguide-nOpacity.theme b/themes/tvguide-blue.theme similarity index 93% rename from themes/tvguide-nOpacity.theme rename to themes/tvguide-blue.theme index 345d13a..88827ba 100644 --- a/themes/tvguide-nOpacity.theme +++ b/themes/tvguide-blue.theme @@ -1,5 +1,5 @@ -Description = nOpacity -clrDoBlending = FFFFFFFF +Description = Blue +clrStyle = FFFFFFFF clrBackground = FF000000 clrBackgroundOSD = FF000000 clrGrid1 = EE555555 @@ -41,4 +41,4 @@ clrRecMenuTextBack = FF000000 clrRecMenuTextActiveBack = FF404749 clrRecMenuKeyboardBack = FF000000 clrRecMenuKeyboardBorder = FF003DF5 -clrRecMenuKeyboardHigh = 40BB0000 \ No newline at end of file +clrRecMenuKeyboardHigh = 40BB0000 diff --git a/themes/tvguide-darkblue.theme b/themes/tvguide-darkblue.theme index ec0a1b1..039323b 100644 --- a/themes/tvguide-darkblue.theme +++ b/themes/tvguide-darkblue.theme @@ -1,5 +1,5 @@ -Description = DarkBlue -clrDoBlending = AAAAAAAA +Description = Dark Blue +clrStyle = AAAAAAAA clrBackground = FF000000 clrBackgroundOSD = FF000000 clrGrid1 = FF0E53A7 @@ -41,4 +41,4 @@ clrRecMenuTextBack = FF000000 clrRecMenuTextActiveBack = FF404749 clrRecMenuKeyboardBack = FF000000 clrRecMenuKeyboardBorder = FFFFFFFF -clrRecMenuKeyboardHigh = 40BB0000 \ No newline at end of file +clrRecMenuKeyboardHigh = 40BB0000 diff --git a/themes/tvguide-nOpacitydarkred.theme b/themes/tvguide-darkred.theme similarity index 92% rename from themes/tvguide-nOpacitydarkred.theme rename to themes/tvguide-darkred.theme index b14f6ac..84d5af8 100644 --- a/themes/tvguide-nOpacitydarkred.theme +++ b/themes/tvguide-darkred.theme @@ -1,5 +1,5 @@ -Description = nOpacity Dark Red -clrDoBlending = FFFFFFFF +Description = Dark Red +clrStyle = FFFFFFFF clrBackground = FF000000 clrBackgroundOSD = FF000000 clrGrid1 = EE555555 @@ -41,4 +41,4 @@ clrRecMenuTextBack = FF000000 clrRecMenuTextActiveBack = FF404749 clrRecMenuKeyboardBack = FF000000 clrRecMenuKeyboardBorder = FF660000 -clrRecMenuKeyboardHigh = 40BB0000 \ No newline at end of file +clrRecMenuKeyboardHigh = 40BB0000 diff --git a/themes/tvguide-darkredNG.theme b/themes/tvguide-darkredNG.theme new file mode 100644 index 0000000..2b9729b --- /dev/null +++ b/themes/tvguide-darkredNG.theme @@ -0,0 +1,44 @@ +Description = Dark Red NG +clrStyle = 66666666 +clrBackground = FF000000 +clrBackgroundOSD = FF000000 +clrGrid1 = EE555555 +clrGrid1Blending = 90000000 +clrGrid2 = DD333333 +clrGrid2Blending = 90000000 +clrHighlight = DDBB0000 +clrHighlightBlending = DD000000 +clrFont = FFFFFFFF +clrFontActive = FFFFFFFF +clrFontHeader = FFFFFFFF +clrFontButtons = FFFFFFFF +clrHeader = EE888888 +clrHeaderBlending = 90000000 +clrBorder = 00000000 +clrStatusHeader = 00000000 +clrStatusHeaderBlending = 00000000 +clrTimeline1 = FFFFFFFF +clrTimeline1Blending = 90828282 +clrTimeline2 = FF000000 +clrTimeline2Blending = 903F3F3F +clrButtonRed = 99BB0000 +clrButtonRedBorder = FFBB0000 +clrButtonGreen = 9900BB00 +clrButtonGreenBorder = FF00BB00 +clrButtonYellow = 99BBBB00 +clrButtonYellowBorder = FFBBBB00 +clrButtonBlue = 990000BB +clrButtonBlueBorder = FF0000BB +clrButtonBlend = DD000000 +clrRecMenuBackground = AA000000 +clrRecMenuTimerConflictBackground = FFCCCCCC +clrRecMenuTimerConflictBar = FF222222 +clrRecMenuTimerConflictOverlap = AAFF0000 +clrRecMenuDayActive = FF00FF00 +clrRecMenuDayInactive = FFFF0000 +clrRecMenuDayHighlight = 44FFFFFF +clrRecMenuTextBack = FF000000 +clrRecMenuTextActiveBack = FF404749 +clrRecMenuKeyboardBack = FF000000 +clrRecMenuKeyboardBorder = FF660000 +clrRecMenuKeyboardHigh = 40BB0000 diff --git a/themes/tvguide-default.theme b/themes/tvguide-default.theme index 05b2e47..d241874 100644 --- a/themes/tvguide-default.theme +++ b/themes/tvguide-default.theme @@ -1,34 +1,34 @@ Description = Default -clrDoBlending = AAAAAAAA -clrBackground = FF000000 -clrBackgroundOSD = FF000000 -clrGrid1 = FF404749 -clrGrid1Blending = FF000000 -clrGrid2 = FF20293F -clrGrid2Blending = FF000000 -clrHighlight = FFFF4D00 -clrHighlightBlending = FF000000 +clrStyle = 66666666 +clrBackground = B012273f +clrBackgroundOSD = B012273f +clrGrid1 = 00000000 +clrGrid1Blending = 00000000 +clrGrid2 = 00000000 +clrGrid2Blending = 00000000 +clrHighlight = DD313548 +clrHighlightBlending = DD000000 clrFont = FFFFFFFF -clrFontActive = FFFFFFFF -clrFontHeader = FFFFFFFF +clrFontActive = FF363636 +clrFontHeader = FF363636 clrFontButtons = FFFFFFFF -clrHeader = FF000000 -clrHeaderBlending = FFE0E0E0 -clrBorder = FFFFFFFF +clrHeader = 00000000 +clrHeaderBlending = 00000000 +clrBorder = 00000000 clrStatusHeader = 00000000 clrStatusHeaderBlending = 00000000 clrTimeline1 = FFFFFFFF clrTimeline1Blending = FF828282 clrTimeline2 = FF000000 clrTimeline2Blending = FF3F3F3F -clrButtonRed = 99BB0000 -clrButtonRedBorder = FFBB0000 -clrButtonGreen = 9900BB00 -clrButtonGreenBorder = FF00BB00 -clrButtonYellow = 99BBBB00 -clrButtonYellowBorder = FFBBBB00 -clrButtonBlue = 990000BB -clrButtonBlueBorder = FF0000BB +clrButtonRed = 00000000 +clrButtonRedBorder = 00000000 +clrButtonGreen = 00000000 +clrButtonGreenBorder = 00000000 +clrButtonYellow = 00000000 +clrButtonYellowBorder = 00000000 +clrButtonBlue = 00000000 +clrButtonBlueBorder = 00000000 clrButtonBlend = DD000000 clrRecMenuBackground = AA000000 clrRecMenuTimerConflictBackground = FFCCCCCC diff --git a/themes/tvguide-nOpacitygreen.theme b/themes/tvguide-green.theme similarity index 93% rename from themes/tvguide-nOpacitygreen.theme rename to themes/tvguide-green.theme index 3042a84..7a94397 100644 --- a/themes/tvguide-nOpacitygreen.theme +++ b/themes/tvguide-green.theme @@ -1,5 +1,5 @@ -Description = nOpacity Green -clrDoBlending = FFFFFFFF +Description = Green +clrStyle = FFFFFFFF clrBackground = FF000000 clrBackgroundOSD = FF000000 clrGrid1 = EE555555 @@ -41,4 +41,4 @@ clrRecMenuTextBack = FF000000 clrRecMenuTextActiveBack = FF404749 clrRecMenuKeyboardBack = FF000000 clrRecMenuKeyboardBorder = EE006600 -clrRecMenuKeyboardHigh = 40BB0000 \ No newline at end of file +clrRecMenuKeyboardHigh = 40BB0000 diff --git a/themes/tvguide-nOpacityiceblue.theme b/themes/tvguide-iceblue.theme similarity index 95% rename from themes/tvguide-nOpacityiceblue.theme rename to themes/tvguide-iceblue.theme index ce5cb2c..9592a04 100644 --- a/themes/tvguide-nOpacityiceblue.theme +++ b/themes/tvguide-iceblue.theme @@ -1,5 +1,5 @@ -Description = nOpacity IceBlue -clrDoBlending = 00000000 +Description = IceBlue +clrStyle = 00000000 clrBackground = DDFFFFFF clrBackgroundOSD = DDFFFFFF clrGrid1 = BB555555 diff --git a/themes/tvguide-keepitsimple.theme b/themes/tvguide-keepitsimple.theme index 852d7c3..1a55167 100644 --- a/themes/tvguide-keepitsimple.theme +++ b/themes/tvguide-keepitsimple.theme @@ -1,5 +1,5 @@ Description = Keep it simple -clrDoBlending = 00000000 +clrStyle = 00000000 clrBackground = FF111111 clrBackgroundOSD = FF111111 clrGrid1 = BB555555 diff --git a/timeline.c b/timeline.c index 8dae868..a6d64cc 100644 --- a/timeline.c +++ b/timeline.c @@ -5,43 +5,51 @@ cTimeLine::cTimeLine(cMyTime *myTime) { this->myTime = myTime; if (tvguideConfig.displayMode == eVertical) { dateViewer = new cStyledPixmap(osdManager.requestPixmap(1, cRect(0, - tvguideConfig.statusHeaderHeight, - tvguideConfig.timeLineWidth, - tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight))); + geoManager.statusHeaderHeight, + geoManager.dateVieverWidth, + geoManager.dateVieverHeight))); timeline = osdManager.requestPixmap(2, cRect(0, - tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight, - tvguideConfig.timeLineWidth, - tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.channelGroupsHeight - tvguideConfig.footerHeight) + geoManager.statusHeaderHeight + geoManager.channelHeaderHeight + geoManager.channelGroupsHeight, + geoManager.timeLineWidth, + geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight) , cRect(0, 0, - tvguideConfig.timeLineWidth, - 1440*tvguideConfig.minutePixel)); + geoManager.timeLineWidth, + 1440*geoManager.minutePixel)); timelineBack = osdManager.requestPixmap(1, cRect(0, - tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight, - tvguideConfig.timeLineWidth, - tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.channelGroupsHeight - tvguideConfig.footerHeight)); + geoManager.statusHeaderHeight + geoManager.channelHeaderHeight + geoManager.channelGroupsHeight, + geoManager.timeLineWidth, + geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight)); } else if (tvguideConfig.displayMode == eHorizontal) { dateViewer = new cStyledPixmap(osdManager.requestPixmap(1, cRect(0, - tvguideConfig.statusHeaderHeight, - tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth, - tvguideConfig.timeLineHeight-2))); - timeline = osdManager.requestPixmap(2, cRect(tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth, - tvguideConfig.statusHeaderHeight, - tvguideConfig.osdWidth - tvguideConfig.channelHeaderWidth - tvguideConfig.channelGroupsWidth, - tvguideConfig.timeLineHeight) + geoManager.statusHeaderHeight, + geoManager.dateVieverWidth, + geoManager.dateVieverHeight))); + timeline = osdManager.requestPixmap(2, cRect(geoManager.channelHeaderWidth + geoManager.channelGroupsWidth, + geoManager.statusHeaderHeight, + geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth, + geoManager.timeLineHeight) , cRect(0, 0, - 1440*tvguideConfig.minutePixel, - tvguideConfig.timeLineWidth)); - timelineBack = osdManager.requestPixmap(1, cRect(tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth, - tvguideConfig.statusHeaderHeight, - tvguideConfig.osdWidth - tvguideConfig.channelHeaderWidth - tvguideConfig.channelGroupsWidth, - tvguideConfig.timeLineHeight)); + 1440*geoManager.minutePixel, + geoManager.timeLineHeight)); + timelineBack = osdManager.requestPixmap(1, cRect(geoManager.channelHeaderWidth + geoManager.channelGroupsWidth, + geoManager.statusHeaderHeight, + geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth, + geoManager.timeLineHeight)); } - clock = new cStyledPixmap(osdManager.requestPixmap(1, cRect(0, - tvguideConfig.osdHeight- tvguideConfig.footerHeight, - tvguideConfig.timeLineWidth, - tvguideConfig.footerHeight-9))); + + int clockY = 10; + int clockX; + if (tvguideConfig.scaleVideo) { + clockX = geoManager.osdWidth - geoManager.tvFrameWidth - geoManager.clockWidth - 4; + } else { + clockX = geoManager.osdWidth - geoManager.clockWidth - 10; + } + clock = new cStyledPixmap(osdManager.requestPixmap(3, cRect(clockX, + clockY, + geoManager.clockWidth, + geoManager.clockHeight))); } cTimeLine::~cTimeLine(void) { @@ -55,22 +63,32 @@ cTimeLine::~cTimeLine(void) { void cTimeLine::drawDateViewer() { cString weekDay = myTime->GetWeekday(); cString date = myTime->GetDate(); - dateViewer->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending)); - dateViewer->drawBackground(); - dateViewer->drawBorder(); - tColor colorFontBack = (tvguideConfig.useBlending==0)?theme.Color(clrHeader):clrTransparent; + if (tvguideConfig.style != eStyleGraphical) { + dateViewer->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending)); + dateViewer->drawBackground(); + dateViewer->drawBorder(); + + } else { + cImage *imgBack = imgCache.GetOsdElement(oeDateViewer); + if (imgBack) + dateViewer->DrawImage(cPoint(0,0), *imgBack); + else + dateViewer->Fill(clrTransparent); + } + tColor colorFont = theme.Color(clrTimeline1); + tColor colorFontBack = (tvguideConfig.style == eStyleFlat)?theme.Color(clrHeader):clrTransparent; if (tvguideConfig.displayMode == eVertical) { - int textHeight = tvguideConfig.FontTimeLineWeekday->Height(); - int weekdayWidth = tvguideConfig.FontTimeLineWeekday->Width(*weekDay); - int dateWidth = tvguideConfig.FontTimeLineDate->Width(*date); - dateViewer->DrawText(cPoint((tvguideConfig.timeLineWidth-weekdayWidth)/2, (tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight -2*textHeight)/2), *weekDay, theme.Color(clrFontHeader), colorFontBack, tvguideConfig.FontTimeLineWeekday); - dateViewer->DrawText(cPoint((tvguideConfig.timeLineWidth-dateWidth)/2, (tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight -2*textHeight)/2 + textHeight + 5), *date, theme.Color(clrFontHeader), colorFontBack, tvguideConfig.FontTimeLineDate); + int textHeight = fontManager.FontTimeLineWeekday->Height(); + int weekdayWidth = fontManager.FontTimeLineWeekday->Width(*weekDay); + int dateWidth = fontManager.FontTimeLineDate->Width(*date); + dateViewer->DrawText(cPoint((geoManager.timeLineWidth-weekdayWidth)/2, (geoManager.channelHeaderHeight + geoManager.channelGroupsHeight -2*textHeight)/2), *weekDay, colorFont, colorFontBack, fontManager.FontTimeLineWeekday); + dateViewer->DrawText(cPoint((geoManager.timeLineWidth-dateWidth)/2, (geoManager.channelHeaderHeight + geoManager.channelGroupsHeight -2*textHeight)/2 + textHeight + 5), *date, colorFont, colorFontBack, fontManager.FontTimeLineDate); } else if (tvguideConfig.displayMode == eHorizontal) { cString strDate = cString::sprintf("%s %s", *weekDay, *date); - int x = (dateViewer->Width() - tvguideConfig.FontTimeLineDateHorizontal->Width(*strDate))/2; - int y = (dateViewer->Height() - tvguideConfig.FontTimeLineDateHorizontal->Height())/2; - dateViewer->DrawText(cPoint(x, y), *strDate, theme.Color(clrFontHeader), colorFontBack, tvguideConfig.FontTimeLineDateHorizontal); + int x = (dateViewer->Width() - fontManager.FontTimeLineDateHorizontal->Width(*strDate))/2; + int y = (dateViewer->Height() - fontManager.FontTimeLineDateHorizontal->Height())/2; + dateViewer->DrawText(cPoint(x, y), *strDate, colorFont, colorFontBack, fontManager.FontTimeLineDateHorizontal); } } @@ -80,18 +98,20 @@ void cTimeLine::drawTimeline() { timeline->Fill(theme.Color(clrBackground)); tColor colorFont, colorBackground; - int imgWidth, imgHeight; - if (tvguideConfig.displayMode == eVertical) { - imgWidth = tvguideConfig.timeLineWidth-4; - imgHeight = tvguideConfig.minutePixel*30; - } else if (tvguideConfig.displayMode == eHorizontal) { - imgWidth = tvguideConfig.minutePixel*30; - imgHeight = tvguideConfig.timeLineHeight-4; + int imgWidth = geoManager.timeLineGridWidth; + int imgHeight = geoManager.timeLineGridHeight; + const cImage *img1 = NULL; + const cImage *img2 = NULL; + if (tvguideConfig.style == eStyleGraphical) { + img1 = imgCache.GetOsdElement(oeTimeline1); + img2 = imgCache.GetOsdElement(oeTimeline2); + } else { + img1 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline1), theme.Color(clrTimeline1Blending)); + img2 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline2), theme.Color(clrTimeline2Blending)); } - const cImage *img1 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline1), theme.Color(clrTimeline1Blending)); - const cImage *img2 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline2), theme.Color(clrTimeline2Blending)); const cImage *img = NULL; - + if (!img1 || !img2) + return; int textWidth, posX, posY; char timetext[10]; @@ -99,7 +119,7 @@ void cTimeLine::drawTimeline() { if (i%2==0) { img = img1; colorFont = theme.Color(clrTimeline2); - colorBackground = (tvguideConfig.useBlending==0)?theme.Color(clrTimeline1):clrTransparent; + colorBackground = (tvguideConfig.style == eStyleFlat)?theme.Color(clrTimeline1):clrTransparent; if (tvguideConfig.timeFormat == e12Hours) { if (i == 0) sprintf(timetext, "12:00 PM"); @@ -113,7 +133,7 @@ void cTimeLine::drawTimeline() { } else { img = img2; colorFont = theme.Color(clrTimeline1); - colorBackground = (tvguideConfig.useBlending==0)?theme.Color(clrTimeline2):clrTransparent; + colorBackground = (tvguideConfig.style == eStyleFlat)?theme.Color(clrTimeline2):clrTransparent; if (tvguideConfig.timeFormat == e12Hours) { if (i == 1) sprintf(timetext, "12:30 PM"); @@ -126,21 +146,27 @@ void cTimeLine::drawTimeline() { } } if (tvguideConfig.displayMode == eVertical) { - posY = i*tvguideConfig.minutePixel*30; - timeline->DrawImage(cPoint(2, posY), *img); - decorateTile(0, posY, imgWidth+2, imgHeight); - textWidth = tvguideConfig.FontTimeLineTime->Width(timetext); - timeline->DrawText(cPoint((tvguideConfig.timeLineWidth-textWidth)/2, posY + 5), timetext, colorFont, colorBackground, tvguideConfig.FontTimeLineTime); + posY = i*geoManager.minutePixel*30; + timeline->DrawImage(cPoint(0, posY), *img); + if (tvguideConfig.style != eStyleGraphical) { + decorateTile(0, posY, imgWidth+2, imgHeight); + } + textWidth = fontManager.FontTimeLineTime->Width(timetext); + timeline->DrawText(cPoint((geoManager.timeLineWidth-textWidth)/2, posY + 5), timetext, colorFont, colorBackground, fontManager.FontTimeLineTime); } else if (tvguideConfig.displayMode == eHorizontal) { - posX = i*tvguideConfig.minutePixel*30; - timeline->DrawImage(cPoint(posX, 2), *img); - decorateTile(posX, 0, imgWidth, imgHeight+2); - timeline->DrawText(cPoint(posX + 15, (dateViewer->Height() - tvguideConfig.FontTimeLineTimeHorizontal->Height())/2), timetext, colorFont, colorBackground, tvguideConfig.FontTimeLineTimeHorizontal); + posX = i*geoManager.minutePixel*30; + timeline->DrawImage(cPoint(posX, 0), *img); + if (tvguideConfig.style != eStyleGraphical) { + decorateTile(posX, 0, imgWidth, imgHeight+2); + } + timeline->DrawText(cPoint(posX + 15, (dateViewer->Height() - fontManager.FontTimeLineTimeHorizontal->Height())/2), timetext, colorFont, colorBackground, fontManager.FontTimeLineTimeHorizontal); } } setTimeline(); - delete img1; - delete img2; + if (tvguideConfig.style != eStyleGraphical) { + delete img1; + delete img2; + } } void cTimeLine::decorateTile(int posX, int posY, int tileWidth, int tileHeight) { @@ -178,7 +204,7 @@ void cTimeLine::drawRoundedCorners(int posX, int posY, int width, int height, in cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend) { cImage *image = NULL; - if (tvguideConfig.useBlending == 1) { + if (tvguideConfig.style == eStyleBlendingDefault) { image = new cImage(cSize(width, height)); image->Fill(clrBgr); int stepY = 0.5*height / 64; @@ -193,7 +219,7 @@ cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, t } alpha += 0x04; } - } else if (tvguideConfig.useBlending == 2) { + } else if (tvguideConfig.style == eStyleBlendingMagick) { cImageLoader imgLoader; if (imgLoader.DrawBackground(clrBgr, clrBlend, width, height)) { image = new cImage(imgLoader.GetImage()); @@ -210,21 +236,26 @@ void cTimeLine::setTimeline() { int xNew, yNew; if (tvguideConfig.displayMode == eVertical) { xNew = 0; - yNew = -offset*tvguideConfig.minutePixel; + yNew = -offset*geoManager.minutePixel; } else if (tvguideConfig.displayMode == eHorizontal) { - xNew = -offset*tvguideConfig.minutePixel; + xNew = -offset*geoManager.minutePixel; yNew = 0; } timeline->SetDrawPortPoint(cPoint(xNew, yNew)); } void cTimeLine::drawClock() { + clock->Fill(clrTransparent); cString currentTime = myTime->GetCurrentTime(); - int textHeight = tvguideConfig.FontTimeLineTime->Height(); - int clockWidth = tvguideConfig.FontTimeLineTime->Width(*currentTime); - tColor colorFontBack = (tvguideConfig.useBlending==0)?theme.Color(clrHeader):clrTransparent; - clock->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending)); - clock->drawBackground(); - clock->drawBorder(); - clock->DrawText(cPoint((tvguideConfig.timeLineWidth-clockWidth)/2, (tvguideConfig.footerHeight-textHeight)/2), *currentTime, theme.Color(clrFontHeader), colorFontBack, tvguideConfig.FontTimeLineTime); + int textHeight = fontManager.FontTimeLineTime->Height(); + int clockTextWidth = fontManager.FontTimeLineTime->Width(*currentTime); + tColor colorFontBack = (tvguideConfig.style == eStyleFlat)?theme.Color(clrHeader):clrTransparent; + if (tvguideConfig.style == eStyleGraphical) { + clock->drawBackgroundGraphical(bgClock); + } else { + clock->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending)); + clock->drawBackground(); + clock->drawBorder(); + } + clock->DrawText(cPoint((geoManager.clockWidth-clockTextWidth)/2, (geoManager.clockHeight-textHeight)/2), *currentTime, theme.Color(clrFont), colorFontBack, fontManager.FontTimeLineTime); } \ No newline at end of file diff --git a/timer.c b/timer.c index 11a6a43..0933a33 100644 --- a/timer.c +++ b/timer.c @@ -19,9 +19,9 @@ void cMyTime::Now() { tStart = t; tStart = GetRounded(); if (tvguideConfig.displayMode == eVertical) { - tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.channelGroupsHeight - tvguideConfig.footerHeight)/tvguideConfig.minutePixel*60; + tEnd = tStart + (geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight)/geoManager.minutePixel*60; } else if (tvguideConfig.displayMode == eHorizontal) { - tEnd = tStart + (tvguideConfig.osdWidth - tvguideConfig.channelHeaderWidth - tvguideConfig.channelGroupsWidth)/tvguideConfig.minutePixel*60; + tEnd = tStart + (geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth)/geoManager.minutePixel*60; } } @@ -42,9 +42,9 @@ bool cMyTime::DelStep(int step) { void cMyTime::SetTime(time_t newTime) { tStart = newTime; if (tvguideConfig.displayMode == eVertical) { - tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.channelGroupsHeight - tvguideConfig.footerHeight)/tvguideConfig.minutePixel*60; + tEnd = tStart + (geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight)/geoManager.minutePixel*60; } else if (tvguideConfig.displayMode == eHorizontal) { - tEnd = tStart + (tvguideConfig.osdWidth - tvguideConfig.channelHeaderWidth - tvguideConfig.channelGroupsWidth)/tvguideConfig.minutePixel*60; + tEnd = tStart + (geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth)/geoManager.minutePixel*60; } } diff --git a/tools.c b/tools.c index 5c0242a..92fb4a8 100644 --- a/tools.c +++ b/tools.c @@ -38,6 +38,19 @@ std::string CutText(std::string text, int width, const cFont *font) { } return cuttedText; } + +/**************************************************************************************** +* StrToLowerCase +****************************************************************************************/ +std::string StrToLowerCase(std::string str) { + std::string lowerCase = str; + const int length = lowerCase.length(); + for(int i=0; i < length; ++i) { + lowerCase[i] = std::tolower(lowerCase[i]); + } + return lowerCase; +} + /**************************************************************************************** * SPLTSTRING ****************************************************************************************/ diff --git a/tools.h b/tools.h index f9bdb4e..f17bb9c 100644 --- a/tools.h +++ b/tools.h @@ -6,6 +6,7 @@ #include std::string CutText(std::string text, int width, const cFont *font); +std::string StrToLowerCase(std::string str); class splitstring : public std::string { std::vector flds; diff --git a/tvguide.c b/tvguide.c index a22fb37..b23ca23 100644 --- a/tvguide.c +++ b/tvguide.c @@ -14,6 +14,9 @@ #include #define DEFINE_CONFIG 1 +#include "geometrymanager.h" +#include "fontmanager.h" +#include "imagecache.h" #include "config.h" #include "setup.h" #include "tvguideosd.h" @@ -23,15 +26,11 @@ #error "VDR-2.0.0 API version or greater is required!" #endif -static const char *VERSION = "1.1.0"; +static const char *VERSION = "1.2.0pre"; static const char *DESCRIPTION = "A fancy 2d EPG Viewer"; static const char *MAINMENUENTRY = "Tvguide"; class cPluginTvguide : public cPlugin { -private: - bool logoPathSet; - bool imagesPathSet; - bool iconsPathSet; public: cPluginTvguide(void); virtual ~cPluginTvguide(); @@ -55,146 +54,90 @@ public: virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode); }; -cPluginTvguide::cPluginTvguide(void) -{ - // Initialize any member variables here. - // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL - // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT! - logoPathSet = false; - imagesPathSet = false; - iconsPathSet = false; +cPluginTvguide::cPluginTvguide(void) { } -cPluginTvguide::~cPluginTvguide() -{ - // Clean up after yourself! +cPluginTvguide::~cPluginTvguide() { } -const char *cPluginTvguide::CommandLineHelp(void) -{ - // Return a string that describes all known command line options. +const char *cPluginTvguide::CommandLineHelp(void) { return - " -i , --epgimages= Set directory where epgimages are stored.\n" - " -c , --icons= Set directory where icons are stored.\n" + " -e , --epgimages= Set directory where epgimages are stored.\n" + " -i , --icons= Set directory where icons are stored.\n" " -l , --logodir= Set directory where logos are stored.\n"; } -bool cPluginTvguide::ProcessArgs(int argc, char *argv[]) -{ - // Implement command line argument processing here if applicable. +bool cPluginTvguide::ProcessArgs(int argc, char *argv[]) { static const struct option long_options[] = { - { "epgimages", required_argument, NULL, 'i' }, - { "icons", required_argument, NULL, 'c' }, + { "epgimages", required_argument, NULL, 'e' }, + { "iconpath", required_argument, NULL, 'i' }, { "logopath", required_argument, NULL, 'l' }, { 0, 0, 0, 0 } }; - int c; - cString *path = NULL; - while ((c = getopt_long(argc, argv, "i:c:l:", long_options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "e:i:l:", long_options, NULL)) != -1) { switch (c) { - case 'i': - path = new cString(optarg); - tvguideConfig.SetImagesPath(*path); - imagesPathSet = true; + case 'e': + tvguideConfig.SetImagesPath(cString(optarg)); break; - case 'c': - path = new cString(optarg); - tvguideConfig.SetIconsPath(*path); - iconsPathSet = true; - break; + case 'i': + tvguideConfig.SetIconsPath(cString(optarg)); + break; case 'l': - path = new cString(optarg); - tvguideConfig.SetLogoPath(*path); - logoPathSet = true; + tvguideConfig.SetLogoPath(cString(optarg)); break; default: return false; } - if (path) - delete path; } return true; } bool cPluginTvguide::Initialize(void) { - esyslog("tvguide: Initialize"); - esyslog("tvguide: OSD Wwidth %d, OSD Height %d", cOsd::OsdWidth(), cOsd::OsdHeight()); - esyslog("tvguide: numRows: %d, numCols: %d", tvguideConfig.channelRows, tvguideConfig.channelCols); + tvguideConfig.SetDefaultPathes(); + tvguideConfig.LoadTheme(); + tvguideConfig.SetStyle(); + tvguideConfig.setDynamicValues(); + geoManager.SetGeometry(cOsd::OsdWidth(), cOsd::OsdHeight()); + fontManager.SetFonts(); + imgCache.CreateCache(); return true; } -bool cPluginTvguide::Start(void) -{ - if (!logoPathSet) { - cString path = cString::sprintf("%s/channellogos/", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N)); - tvguideConfig.SetLogoPath(path); - logoPathSet = true; - } - - if (!imagesPathSet) { - cString path = cString::sprintf("%s/epgimages/", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N)); - tvguideConfig.SetImagesPath(path); - logoPathSet = true; - } - - if (!iconsPathSet) { - cString path = cString::sprintf("%s/icons/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N)); - tvguideConfig.SetIconsPath(path); - iconsPathSet = true; - } - +bool cPluginTvguide::Start(void) { return true; } -void cPluginTvguide::Stop(void) -{ - // Stop any background activities the plugin is performing. +void cPluginTvguide::Stop(void) { } -void cPluginTvguide::Housekeeping(void) -{ - // Perform any cleanup or other regular tasks. +void cPluginTvguide::Housekeeping(void) { } -void cPluginTvguide::MainThreadHook(void) -{ - // Perform actions in the context of the main program thread. - // WARNING: Use with great care - see PLUGINS.html! +void cPluginTvguide::MainThreadHook(void) { } -cString cPluginTvguide::Active(void) -{ - // Return a message string if shutdown should be postponed +cString cPluginTvguide::Active(void) { return NULL; } -time_t cPluginTvguide::WakeupTime(void) -{ - // Return custom wakeup time for shutdown script +time_t cPluginTvguide::WakeupTime(void) { return 0; } -cOsdObject *cPluginTvguide::MainMenuAction(void) -{ - // Perform the action when selected from the main VDR menu. - return new cTvGuideOsd; +cOsdObject *cPluginTvguide::MainMenuAction(void) { + return new cTvGuideOsd; } -cMenuSetupPage *cPluginTvguide::SetupMenu(void) -{ - // Return a setup menu in case the plugin supports one. +cMenuSetupPage *cPluginTvguide::SetupMenu(void) { return new cTvguideSetup(); } -bool cPluginTvguide::SetupParse(const char *Name, const char *Value) -{ - // Parse your own setup parameters and store their values. +bool cPluginTvguide::SetupParse(const char *Name, const char *Value) { return tvguideConfig.SetupParse(Name, Value); } -bool cPluginTvguide::Service(const char *Id, void *Data) -{ +bool cPluginTvguide::Service(const char *Id, void *Data) { if (strcmp(Id, "MainMenuHooksPatch-v1.0::osSchedule") == 0 && tvguideConfig.replaceOriginalSchedule != 0) { if (Data == NULL) return true; @@ -206,16 +149,12 @@ bool cPluginTvguide::Service(const char *Id, void *Data) return false; } -const char **cPluginTvguide::SVDRPHelpPages(void) -{ - // Return help text for SVDRP commands this plugin implements +const char **cPluginTvguide::SVDRPHelpPages(void) { return NULL; } -cString cPluginTvguide::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) -{ - // Process SVDRP commands this plugin implements +cString cPluginTvguide::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) { return NULL; } -VDRPLUGINCREATOR(cPluginTvguide); // Don't touch this! +VDRPLUGINCREATOR(cPluginTvguide); diff --git a/tvguideosd.c b/tvguideosd.c index 67b3c33..5cccc67 100644 --- a/tvguideosd.c +++ b/tvguideosd.c @@ -38,9 +38,16 @@ void cTvGuideOsd::Show(void) { bool ok = false; ok = osdManager.setOsd(); if (ok) { - tvguideConfig.setDynamicValues(osdManager.Width(), osdManager.Height()); - tvguideConfig.loadTheme(); - tvguideConfig.SetBlending(); + bool themeChanged = tvguideConfig.LoadTheme(); + tvguideConfig.SetStyle(); + tvguideConfig.setDynamicValues(); + bool geoChanged = geoManager.SetGeometry(cOsd::OsdWidth(), cOsd::OsdHeight()); + if (themeChanged || geoChanged) { + fontManager.DeleteFonts(); + fontManager.SetFonts(); + imgCache.Clear(); + imgCache.CreateCache(); + } osdManager.setBackground(); myTime = new cMyTime(); myTime->Now(); @@ -66,6 +73,7 @@ void cTvGuideOsd::drawOsd() { cChannel *startChannel = Channels.GetByNumber(cDevice::CurrentChannel()); if (tvguideConfig.displayStatusHeader) { statusHeader = new cStatusHeader(); + statusHeader->Draw(); statusHeader->ScaleVideo(); } timeLine = new cTimeLine(myTime);