Change files to unix

This commit is contained in:
kamel5 2019-07-11 11:07:13 +02:00
parent ceadc0bbfe
commit 7a79059414
40 changed files with 6499 additions and 6499 deletions

View File

@ -1,98 +1,98 @@
#include <algorithm> #include <algorithm>
#include "channelgroup.h" #include "channelgroup.h"
#include "tools.h" #include "tools.h"
cChannelGroup::cChannelGroup(const char *name) { cChannelGroup::cChannelGroup(const char *name) {
channelStart = 0; channelStart = 0;
channelStop = 0; channelStop = 0;
this->name = name; this->name = name;
} }
cChannelGroup::~cChannelGroup(void) { cChannelGroup::~cChannelGroup(void) {
} }
void cChannelGroup::Dump(void) { void cChannelGroup::Dump(void) {
esyslog("tvguide: Group %s, startChannel %d, stopChannel %d", name, channelStart, channelStop); esyslog("tvguide: Group %s, startChannel %d, stopChannel %d", name, channelStart, channelStop);
} }
// --- cChannelGroupGrid ------------------------------------------------------------- // --- cChannelGroupGrid -------------------------------------------------------------
cChannelGroupGrid::cChannelGroupGrid(const char *name) { cChannelGroupGrid::cChannelGroupGrid(const char *name) {
this->name = name; this->name = name;
} }
cChannelGroupGrid::~cChannelGroupGrid(void) { cChannelGroupGrid::~cChannelGroupGrid(void) {
} }
void cChannelGroupGrid::SetBackground() { void cChannelGroupGrid::SetBackground() {
if (isColor1) { if (isColor1) {
color = theme.Color(clrGrid1); color = theme.Color(clrGrid1);
colorBlending = theme.Color(clrGrid1Blending); colorBlending = theme.Color(clrGrid1Blending);
} else { } else {
color = theme.Color(clrGrid2); color = theme.Color(clrGrid2);
colorBlending = theme.Color(clrGrid2Blending); colorBlending = theme.Color(clrGrid2Blending);
} }
} }
void cChannelGroupGrid::SetGeometry(int start, int end) { void cChannelGroupGrid::SetGeometry(int start, int end) {
int x, y, width, height; int x, y, width, height;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
x = geoManager.timeLineWidth + start*geoManager.colWidth; x = geoManager.timeLineWidth + start*geoManager.colWidth;
y = geoManager.statusHeaderHeight; y = geoManager.statusHeaderHeight;
width = (end - start + 1) * geoManager.colWidth; width = (end - start + 1) * geoManager.colWidth;
height = geoManager.channelGroupsHeight; height = geoManager.channelGroupsHeight;
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
x = 0; x = 0;
y = geoManager.statusHeaderHeight + geoManager.timeLineHeight + start*geoManager.rowHeight; y = geoManager.statusHeaderHeight + geoManager.timeLineHeight + start*geoManager.rowHeight;
width = geoManager.channelGroupsWidth; width = geoManager.channelGroupsWidth;
height = (end - start + 1) * geoManager.rowHeight; height = (end - start + 1) * geoManager.rowHeight;
} }
pixmap = osdManager.requestPixmap(1, cRect(x, y, width, height)); pixmap = osdManager.requestPixmap(1, cRect(x, y, width, height));
} }
void cChannelGroupGrid::Draw(void) { void cChannelGroupGrid::Draw(void) {
if (tvguideConfig.style == eStyleGraphical) { if (tvguideConfig.style == eStyleGraphical) {
drawBackgroundGraphical(bgChannelGroup); drawBackgroundGraphical(bgChannelGroup);
} else { } else {
drawBackground(); drawBackground();
drawBorder(); drawBorder();
} }
tColor colorText = theme.Color(clrFont); tColor colorText = theme.Color(clrFont);
tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
DrawVertical(colorText, colorTextBack); DrawVertical(colorText, colorTextBack);
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
DrawHorizontal(colorText, colorTextBack); DrawHorizontal(colorText, colorTextBack);
} }
} }
void cChannelGroupGrid::DrawVertical(tColor colorText, tColor colorTextBack) { void cChannelGroupGrid::DrawVertical(tColor colorText, tColor colorTextBack) {
int textY = (Height() - fontManager.FontChannelGroups->Height()) / 2; int textY = (Height() - fontManager.FontChannelGroups->Height()) / 2;
cString text = CutText(name, Width() - 4, fontManager.FontChannelGroups).c_str(); cString text = CutText(name, Width() - 4, fontManager.FontChannelGroups).c_str();
int textWidth = fontManager.FontChannelGroups->Width(*text); int textWidth = fontManager.FontChannelGroups->Width(*text);
int x = (Width() - textWidth) / 2; int x = (Width() - textWidth) / 2;
pixmap->DrawText(cPoint(x, textY), *text, colorText, colorTextBack, fontManager.FontChannelGroups); pixmap->DrawText(cPoint(x, textY), *text, colorText, colorTextBack, fontManager.FontChannelGroups);
} }
void cChannelGroupGrid::DrawHorizontal(tColor colorText, tColor colorTextBack) { void cChannelGroupGrid::DrawHorizontal(tColor colorText, tColor colorTextBack) {
std::string nameUpper = name; std::string nameUpper = name;
std::transform(nameUpper.begin(), nameUpper.end(),nameUpper.begin(), ::toupper); std::transform(nameUpper.begin(), nameUpper.end(),nameUpper.begin(), ::toupper);
int numChars = nameUpper.length(); int numChars = nameUpper.length();
int charHeight = fontManager.FontChannelGroupsHorizontal->Height(); int charHeight = fontManager.FontChannelGroupsHorizontal->Height();
int textHeight = numChars * charHeight; int textHeight = numChars * charHeight;
int y = 5; int y = 5;
if ((textHeight +5) < Height()) { if ((textHeight +5) < Height()) {
y = (Height() - textHeight) / 2; y = (Height() - textHeight) / 2;
} }
for (int i=0; i < numChars; i++) { for (int i=0; i < numChars; i++) {
if (((y + 2*charHeight) > Height()) && ((i+1)<numChars)) { if (((y + 2*charHeight) > Height()) && ((i+1)<numChars)) {
int x = (Width() - fontManager.FontChannelGroupsHorizontal->Width("...")) / 2; int x = (Width() - fontManager.FontChannelGroupsHorizontal->Width("...")) / 2;
pixmap->DrawText(cPoint(x, y), "...", colorText, colorTextBack, fontManager.FontChannelGroupsHorizontal); pixmap->DrawText(cPoint(x, y), "...", colorText, colorTextBack, fontManager.FontChannelGroupsHorizontal);
break; break;
} }
cString currentChar = cString::sprintf("%c", nameUpper.at(i)); cString currentChar = cString::sprintf("%c", nameUpper.at(i));
int x = (Width() - fontManager.FontChannelGroupsHorizontal->Width(*currentChar)) / 2; int x = (Width() - fontManager.FontChannelGroupsHorizontal->Width(*currentChar)) / 2;
pixmap->DrawText(cPoint(x, y), *currentChar, colorText, colorTextBack, fontManager.FontChannelGroupsHorizontal); pixmap->DrawText(cPoint(x, y), *currentChar, colorText, colorTextBack, fontManager.FontChannelGroupsHorizontal);
y += fontManager.FontChannelGroupsHorizontal->Height(); y += fontManager.FontChannelGroupsHorizontal->Height();
} }
} }

View File

@ -1,44 +1,44 @@
#ifndef __TVGUIDE_CHANNELGROUP_H #ifndef __TVGUIDE_CHANNELGROUP_H
#define __TVGUIDE_CHANNELGROUP_H #define __TVGUIDE_CHANNELGROUP_H
#include <vdr/tools.h> #include <vdr/tools.h>
#include "styledpixmap.h" #include "styledpixmap.h"
// --- cChannelGroup ------------------------------------------------------------- // --- cChannelGroup -------------------------------------------------------------
class cChannelGroup { class cChannelGroup {
private: private:
int channelStart; int channelStart;
int channelStop; int channelStop;
const char *name; const char *name;
public: public:
cChannelGroup(const char *name); cChannelGroup(const char *name);
virtual ~cChannelGroup(void); virtual ~cChannelGroup(void);
void SetChannelStart(int start) { channelStart = start; }; void SetChannelStart(int start) { channelStart = start; };
int StartChannel(void) { return channelStart; }; int StartChannel(void) { return channelStart; };
void SetChannelStop(int stop) { channelStop = stop; }; void SetChannelStop(int stop) { channelStop = stop; };
int StopChannel(void) { return channelStop; }; int StopChannel(void) { return channelStop; };
const char* GetName(void) { return name; }; const char* GetName(void) { return name; };
void Dump(void); void Dump(void);
}; };
// --- cChannelGroupGrid ------------------------------------------------------------- // --- cChannelGroupGrid -------------------------------------------------------------
class cChannelGroupGrid : public cListObject, public cStyledPixmap { class cChannelGroupGrid : public cListObject, public cStyledPixmap {
private: private:
const char *name; const char *name;
bool isColor1; bool isColor1;
void DrawHorizontal(tColor colorText, tColor colorTextBack); void DrawHorizontal(tColor colorText, tColor colorTextBack);
void DrawVertical(tColor colorText, tColor colorTextBack); void DrawVertical(tColor colorText, tColor colorTextBack);
public: public:
cChannelGroupGrid(const char *name); cChannelGroupGrid(const char *name);
virtual ~cChannelGroupGrid(void); virtual ~cChannelGroupGrid(void);
void SetColor(bool color) {isColor1 = color;}; void SetColor(bool color) {isColor1 = color;};
void SetBackground(void); void SetBackground(void);
void SetGeometry(int start, int end); void SetGeometry(int start, int end);
void Draw(void); void Draw(void);
}; };
#endif //__TVGUIDE_CHANNELGROUP_H #endif //__TVGUIDE_CHANNELGROUP_H

View File

@ -1,95 +1,95 @@
#include <vdr/channels.h> #include <vdr/channels.h>
#include "config.h" #include "config.h"
#include "geometrymanager.h" #include "geometrymanager.h"
#include "osdmanager.h" #include "osdmanager.h"
#include "fontmanager.h" #include "fontmanager.h"
#include "channelgroups.h" #include "channelgroups.h"
#include "channeljump.h" #include "channeljump.h"
cChannelJump::cChannelJump(cChannelGroups *channelGroups) { cChannelJump::cChannelJump(cChannelGroups *channelGroups) {
this->channelGroups = channelGroups; this->channelGroups = channelGroups;
pixmapText = NULL; pixmapText = NULL;
channel = 0; channel = 0;
if (!tvguideConfig.hideLastGroup) { if (!tvguideConfig.hideLastGroup) {
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
LOCK_CHANNELS_READ; LOCK_CHANNELS_READ;
maxChannels = Channels->MaxNumber(); maxChannels = Channels->MaxNumber();
#else #else
maxChannels = Channels.MaxNumber(); maxChannels = Channels.MaxNumber();
#endif #endif
} else { } else {
maxChannels = channelGroups->GetLastValidChannel(); maxChannels = channelGroups->GetLastValidChannel();
} }
timeout = Setup.ChannelEntryTimeout; timeout = Setup.ChannelEntryTimeout;
startTime = cTimeMs::Now(); startTime = cTimeMs::Now();
SetPixmaps(); SetPixmaps();
Draw(); Draw();
} }
cChannelJump::~cChannelJump(void) { cChannelJump::~cChannelJump(void) {
osdManager.releasePixmap(pixmapBack); osdManager.releasePixmap(pixmapBack);
osdManager.releasePixmap(pixmapText); osdManager.releasePixmap(pixmapText);
} }
void cChannelJump::SetPixmaps(void) { void cChannelJump::SetPixmaps(void) {
int x = (geoManager.osdWidth - geoManager.channelJumpWidth)/2; int x = (geoManager.osdWidth - geoManager.channelJumpWidth)/2;
int y = (geoManager.osdHeight - geoManager.channelJumpHeight)/2; int y = (geoManager.osdHeight - geoManager.channelJumpHeight)/2;
pixmapBack = osdManager.requestPixmap(4, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight)); pixmapBack = osdManager.requestPixmap(4, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight));
pixmap = osdManager.requestPixmap(5, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight)); pixmap = osdManager.requestPixmap(5, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight));
pixmapText = osdManager.requestPixmap(6, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight)); pixmapText = osdManager.requestPixmap(6, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight));
} }
void cChannelJump::Draw(void) { void cChannelJump::Draw(void) {
if (tvguideConfig.style == eStyleGraphical) { if (tvguideConfig.style == eStyleGraphical) {
drawBackgroundGraphical(bgChannelJump); drawBackgroundGraphical(bgChannelJump);
} else { } else {
pixmap->Fill(theme.Color(clrBackground)); pixmap->Fill(theme.Color(clrBackground));
drawBorder(); drawBorder();
} }
pixmapBack->Fill(clrTransparent); pixmapBack->Fill(clrTransparent);
pixmapBack->DrawRectangle(cRect(5, Height()/2, Width()-10, Height()-3), theme.Color(clrBackground)); pixmapBack->DrawRectangle(cRect(5, Height()/2, Width()-10, Height()-3), theme.Color(clrBackground));
} }
void cChannelJump::DrawText(void) { void cChannelJump::DrawText(void) {
pixmapText->Fill(clrTransparent); pixmapText->Fill(clrTransparent);
cString header = cString::sprintf("%s:", tr("Channel")); cString header = cString::sprintf("%s:", tr("Channel"));
const cFont *font = fontManager.FontMessageBox; const cFont *font = fontManager.FontMessageBox;
const cFont *fontHeader = fontManager.FontMessageBoxLarge; const cFont *fontHeader = fontManager.FontMessageBoxLarge;
int xHeader = (Width() - fontHeader->Width(*header)) / 2; int xHeader = (Width() - fontHeader->Width(*header)) / 2;
int yHeader = (Height()/2 - fontHeader->Height()) / 2; int yHeader = (Height()/2 - fontHeader->Height()) / 2;
pixmapText->DrawText(cPoint(xHeader, yHeader), *header, theme.Color(clrFont), clrTransparent, fontHeader); pixmapText->DrawText(cPoint(xHeader, yHeader), *header, theme.Color(clrFont), clrTransparent, fontHeader);
cString strChannel = BuildChannelString(); cString strChannel = BuildChannelString();
int xChannel = (Width() - font->Width(*strChannel)) / 2; int xChannel = (Width() - font->Width(*strChannel)) / 2;
int yChannel = Height()/2 + (Height()/2 - font->Height()) / 2; int yChannel = Height()/2 + (Height()/2 - font->Height()) / 2;
pixmapText->DrawText(cPoint(xChannel, yChannel), *strChannel, theme.Color(clrFont), clrTransparent, font); pixmapText->DrawText(cPoint(xChannel, yChannel), *strChannel, theme.Color(clrFont), clrTransparent, font);
} }
void cChannelJump::Set(int num) { void cChannelJump::Set(int num) {
startTime = cTimeMs::Now(); startTime = cTimeMs::Now();
if (channel == 0) { if (channel == 0) {
channel = num; channel = num;
return; return;
} }
int newChannel = channel * 10 + num; int newChannel = channel * 10 + num;
if (newChannel <= maxChannels) if (newChannel <= maxChannels)
channel = newChannel; channel = newChannel;
} }
cString cChannelJump::BuildChannelString(void) { cString cChannelJump::BuildChannelString(void) {
if (channel*10 <= maxChannels) if (channel*10 <= maxChannels)
return cString::sprintf("%d-", channel); return cString::sprintf("%d-", channel);
else else
return cString::sprintf("%d", channel); return cString::sprintf("%d", channel);
} }
bool cChannelJump::TimeOut(void) { bool cChannelJump::TimeOut(void) {
if ((cTimeMs::Now() - startTime) > timeout) if ((cTimeMs::Now() - startTime) > timeout)
return true; return true;
return false; return false;
} }

View File

@ -1,29 +1,29 @@
#ifndef __TVGUIDE_CHANNELJUMP_H #ifndef __TVGUIDE_CHANNELJUMP_H
#define __TVGUIDE_CHANNELJUMP_H #define __TVGUIDE_CHANNELJUMP_H
#include "styledpixmap.h" #include "styledpixmap.h"
// --- cChannelJump ------------------------------------------------------------- // --- cChannelJump -------------------------------------------------------------
class cChannelJump : public cStyledPixmap { class cChannelJump : public cStyledPixmap {
private: private:
int channel; int channel;
cChannelGroups *channelGroups; cChannelGroups *channelGroups;
int maxChannels; int maxChannels;
long unsigned int startTime; long unsigned int startTime;
long unsigned int timeout; long unsigned int timeout;
cPixmap *pixmapBack; cPixmap *pixmapBack;
cPixmap *pixmapText; cPixmap *pixmapText;
void SetPixmaps(void); void SetPixmaps(void);
void Draw(void); void Draw(void);
cString BuildChannelString(void); cString BuildChannelString(void);
public: public:
cChannelJump(cChannelGroups *channelGroups); cChannelJump(cChannelGroups *channelGroups);
virtual ~cChannelJump(void); virtual ~cChannelJump(void);
void Set(int num); void Set(int num);
void DrawText(void); void DrawText(void);
bool TimeOut(void); bool TimeOut(void);
int GetChannel(void) { return channel; }; int GetChannel(void) { return channel; };
}; };
#endif //__TVGUIDE_CHANNELJUMP_H #endif //__TVGUIDE_CHANNELJUMP_H

680
config.c
View File

@ -1,340 +1,340 @@
#include <string> #include <string>
#include "config.h" #include "config.h"
cTvguideConfig::cTvguideConfig() { cTvguideConfig::cTvguideConfig() {
debugImageLoading = 0; debugImageLoading = 0;
showMainMenuEntry = 1; showMainMenuEntry = 1;
replaceOriginalSchedule = 0; replaceOriginalSchedule = 0;
displayMode = eHorizontal; displayMode = eHorizontal;
showTimeInGrid = 1; showTimeInGrid = 1;
channelCols = 5; channelCols = 5;
channelRows = 10; channelRows = 10;
displayTime = 160; displayTime = 160;
displayHorizontalTime = 160; displayHorizontalTime = 160;
displayStatusHeader = 1; displayStatusHeader = 1;
displayChannelGroups = 1; displayChannelGroups = 1;
displayTimeBase = 1; displayTimeBase = 1;
headerHeightPercent = 20; headerHeightPercent = 20;
channelGroupsPercent = 5; channelGroupsPercent = 5;
epgViewBorder = 50; epgViewBorder = 50;
scaleVideo = 1; scaleVideo = 1;
decorateVideo = 1; decorateVideo = 1;
timeLineWidthPercent = 8; timeLineWidthPercent = 8;
timeLineHeightPercent = 4; timeLineHeightPercent = 4;
displayChannelName = 1; displayChannelName = 1;
channelHeaderWidthPercent = 20; channelHeaderWidthPercent = 20;
channelHeaderHeightPercent = 15; channelHeaderHeightPercent = 15;
footerHeightPercent = 7; footerHeightPercent = 7;
stepMinutes = 30; stepMinutes = 30;
bigStepHours = 3; bigStepHours = 3;
hugeStepHours = 24; hugeStepHours = 24;
channelJumpMode = eNumJump; channelJumpMode = eNumJump;
jumpChannels = 0; jumpChannels = 0;
blueKeyMode = 2; blueKeyMode = 2;
closeOnSwitch = 1; closeOnSwitch = 1;
numkeyMode = 0; numkeyMode = 0;
useRemoteTimers = 0; useRemoteTimers = 0;
hideLastGroup = 0; hideLastGroup = 0;
hideChannelLogos = 0; hideChannelLogos = 0;
logoWidthRatio = 13; logoWidthRatio = 13;
logoHeightRatio = 10; logoHeightRatio = 10;
logoExtension = 0; logoExtension = 0;
hideEpgImages = 0; hideEpgImages = 0;
epgImageWidth = 315; epgImageWidth = 315;
epgImageHeight = 240; epgImageHeight = 240;
numAdditionalEPGPictures = 9; numAdditionalEPGPictures = 9;
epgImageWidthLarge = 525; epgImageWidthLarge = 525;
epgImageHeightLarge = 400; epgImageHeightLarge = 400;
detailedViewScrollStep = 5; detailedViewScrollStep = 5;
instRecFolderMode = eFolderRoot; instRecFolderMode = eFolderRoot;
instRecFixedFolder = ""; instRecFixedFolder = "";
favWhatsOnNow = 1; favWhatsOnNow = 1;
favWhatsOnNext = 1; favWhatsOnNext = 1;
favUseTime1 = 0; favUseTime1 = 0;
favUseTime2 = 0; favUseTime2 = 0;
favUseTime3 = 0; favUseTime3 = 0;
favUseTime4 = 0; favUseTime4 = 0;
favTime1 = 0; favTime1 = 0;
favTime2 = 0; favTime2 = 0;
favTime3 = 0; favTime3 = 0;
favTime4 = 0; favTime4 = 0;
descUser1 = ""; descUser1 = "";
descUser2 = ""; descUser2 = "";
descUser3 = ""; descUser3 = "";
descUser4 = ""; descUser4 = "";
favLimitChannels = 0; favLimitChannels = 0;
favStartChannel = 0; favStartChannel = 0;
favStopChannel = 0; favStopChannel = 0;
switchMode = 0; switchMode = 0;
switchMinsBefore = 2; switchMinsBefore = 2;
fontIndex = 0; fontIndex = 0;
fontNameDefault = "VDRSymbols Sans:Book"; fontNameDefault = "VDRSymbols Sans:Book";
FontButtonDelta = 0; FontButtonDelta = 0;
FontDetailViewDelta = 0; FontDetailViewDelta = 0;
FontDetailViewSmallDelta = 0; FontDetailViewSmallDelta = 0;
FontDetailHeaderDelta = 0; FontDetailHeaderDelta = 0;
FontMessageBoxDelta = 0; FontMessageBoxDelta = 0;
FontMessageBoxLargeDelta = 0; FontMessageBoxLargeDelta = 0;
FontStatusHeaderDelta = 0; FontStatusHeaderDelta = 0;
FontStatusHeaderLargeDelta = 0; FontStatusHeaderLargeDelta = 0;
FontChannelHeaderDelta = 0; FontChannelHeaderDelta = 0;
FontChannelGroupsDelta = 0; FontChannelGroupsDelta = 0;
FontGridDelta = 0; FontGridDelta = 0;
FontGridSmallDelta = 0; FontGridSmallDelta = 0;
FontTimeLineWeekdayDelta = 0; FontTimeLineWeekdayDelta = 0;
FontTimeLineDateDelta = 0; FontTimeLineDateDelta = 0;
FontTimeLineTimeDelta = 0; FontTimeLineTimeDelta = 0;
FontChannelHeaderHorizontalDelta = 0; FontChannelHeaderHorizontalDelta = 0;
FontChannelGroupsHorizontalDelta = 0; FontChannelGroupsHorizontalDelta = 0;
FontGridHorizontalDelta = 0; FontGridHorizontalDelta = 0;
FontGridHorizontalSmallDelta = 0; FontGridHorizontalSmallDelta = 0;
FontTimeLineDateHorizontalDelta = 0; FontTimeLineDateHorizontalDelta = 0;
FontTimeLineTimeHorizontalDelta = 0; FontTimeLineTimeHorizontalDelta = 0;
FontRecMenuItemDelta = 0; FontRecMenuItemDelta = 0;
FontRecMenuItemSmallDelta = 0; FontRecMenuItemSmallDelta = 0;
FontRecMenuItemLargeDelta = 0; FontRecMenuItemLargeDelta = 0;
timeFormat = 1; timeFormat = 1;
useNopacityTheme = 1; useNopacityTheme = 1;
themeIndex = -1; themeIndex = -1;
themeIndexCurrent = -1; themeIndexCurrent = -1;
themeName = ""; themeName = "";
nOpacityTheme = ""; nOpacityTheme = "";
style = eStyleBlendingDefault; style = eStyleBlendingDefault;
roundedCorners = 0; roundedCorners = 0;
displayRerunsDetailEPGView = 1; displayRerunsDetailEPGView = 1;
numReruns = 5; numReruns = 5;
useSubtitleRerun = 1; useSubtitleRerun = 1;
numLogosInitial = 30; numLogosInitial = 30;
numLogosMax = 50; numLogosMax = 50;
limitLogoCache = 1; limitLogoCache = 1;
logoPathSet = false; logoPathSet = false;
imagesPathSet = false; imagesPathSet = false;
iconsPathSet = false; iconsPathSet = false;
} }
cTvguideConfig::~cTvguideConfig() { cTvguideConfig::~cTvguideConfig() {
} }
void cTvguideConfig::setDynamicValues() { void cTvguideConfig::setDynamicValues() {
numGrids = (displayMode == eVertical)?channelCols:channelRows; numGrids = (displayMode == eVertical)?channelCols:channelRows;
jumpChannels = numGrids; jumpChannels = numGrids;
} }
bool cTvguideConfig::LoadTheme() { bool cTvguideConfig::LoadTheme() {
//is correct theme already loaded? //is correct theme already loaded?
if (nOpacityTheme.size() == 0) if (nOpacityTheme.size() == 0)
nOpacityTheme = Setup.OSDTheme; nOpacityTheme = Setup.OSDTheme;
if ((themeIndex > -1) && (themeIndex == themeIndexCurrent)) { if ((themeIndex > -1) && (themeIndex == themeIndexCurrent)) {
if (!nOpacityTheme.compare(Setup.OSDTheme)) { if (!nOpacityTheme.compare(Setup.OSDTheme)) {
return false; return false;
} else { } else {
nOpacityTheme = Setup.OSDTheme; nOpacityTheme = Setup.OSDTheme;
} }
} }
//Load available Themes //Load available Themes
cThemes themes; cThemes themes;
themes.Load(*cString("tvguide")); themes.Load(*cString("tvguide"));
int numThemesAvailable = themes.NumThemes(); int numThemesAvailable = themes.NumThemes();
//Check for nOpacity Theme //Check for nOpacity Theme
if (useNopacityTheme) { if (useNopacityTheme) {
std::string nOpacity = "nOpacity"; std::string nOpacity = "nOpacity";
std::string currentSkin = Setup.OSDSkin; std::string currentSkin = Setup.OSDSkin;
std::string currentSkinTheme = Setup.OSDTheme; std::string currentSkinTheme = Setup.OSDTheme;
if (!currentSkin.compare(nOpacity)) { if (!currentSkin.compare(nOpacity)) {
for (int curThemeIndex = 0; curThemeIndex < numThemesAvailable; curThemeIndex++) { for (int curThemeIndex = 0; curThemeIndex < numThemesAvailable; curThemeIndex++) {
std::string curThemeName = themes.Name(curThemeIndex); std::string curThemeName = themes.Name(curThemeIndex);
if (!curThemeName.compare(currentSkinTheme)) { if (!curThemeName.compare(currentSkinTheme)) {
themeIndex = curThemeIndex; themeIndex = curThemeIndex;
break; break;
} }
} }
} }
} }
if (themeIndex == -1) { if (themeIndex == -1) {
for (int curThemeIndex = 0; curThemeIndex < numThemesAvailable; curThemeIndex++) { for (int curThemeIndex = 0; curThemeIndex < numThemesAvailable; curThemeIndex++) {
std::string curThemeName = themes.Name(curThemeIndex); std::string curThemeName = themes.Name(curThemeIndex);
if (!curThemeName.compare("default")) { if (!curThemeName.compare("default")) {
themeIndex = curThemeIndex; themeIndex = curThemeIndex;
break; break;
} }
} }
} }
if (themeIndex == -1) if (themeIndex == -1)
themeIndex = 0; themeIndex = 0;
themeIndexCurrent = themeIndex; themeIndexCurrent = themeIndex;
const char *themePath = themes.FileName(themeIndex); const char *themePath = themes.FileName(themeIndex);
if (access(themePath, F_OK) == 0) { if (access(themePath, F_OK) == 0) {
::theme.Load(themePath); ::theme.Load(themePath);
themeName = themes.Name(themeIndex); themeName = themes.Name(themeIndex);
} }
esyslog("tvguide: set Theme to %s", *themeName); esyslog("tvguide: set Theme to %s", *themeName);
return true; return true;
} }
void cTvguideConfig::SetStyle(void) { void cTvguideConfig::SetStyle(void) {
if (theme.Color(clrStyle) == CLR_STYLE_FLAT) { if (theme.Color(clrStyle) == CLR_STYLE_FLAT) {
style = eStyleFlat; style = eStyleFlat;
esyslog("tvguide: set flat style"); esyslog("tvguide: set flat style");
} else if (theme.Color(clrStyle) == CLR_STYLE_BLENDING_DEFAULT) { } else if (theme.Color(clrStyle) == CLR_STYLE_BLENDING_DEFAULT) {
style = eStyleBlendingDefault; style = eStyleBlendingDefault;
esyslog("tvguide: set blending style"); esyslog("tvguide: set blending style");
} else if (theme.Color(clrStyle) == CLR_STYLE_GRAPHICAL) { } else if (theme.Color(clrStyle) == CLR_STYLE_GRAPHICAL) {
style = eStyleGraphical; style = eStyleGraphical;
esyslog("tvguide: set graphical style"); esyslog("tvguide: set graphical style");
} else { } else {
style = eStyleBlendingMagick; style = eStyleBlendingMagick;
esyslog("tvguide: set magick blending style"); esyslog("tvguide: set magick blending style");
} }
} }
void cTvguideConfig::SetLogoPath(cString path) { void cTvguideConfig::SetLogoPath(cString path) {
logoPath = checkSlashAtEnd(*path); logoPath = checkSlashAtEnd(*path);
logoPathSet = true; logoPathSet = true;
esyslog("tvguide: Logo Path set to %s", *logoPath); esyslog("tvguide: Logo Path set to %s", *logoPath);
} }
void cTvguideConfig::SetImagesPath(cString path) { void cTvguideConfig::SetImagesPath(cString path) {
epgImagePath = checkSlashAtEnd(*path); epgImagePath = checkSlashAtEnd(*path);
imagesPathSet = true; imagesPathSet = true;
esyslog("tvguide: EPG Image Path set to %s", *epgImagePath); esyslog("tvguide: EPG Image Path set to %s", *epgImagePath);
} }
void cTvguideConfig::SetIconsPath(cString path) { void cTvguideConfig::SetIconsPath(cString path) {
iconPath = checkSlashAtEnd(*path); iconPath = checkSlashAtEnd(*path);
iconsPathSet = true; iconsPathSet = true;
esyslog("tvguide: Icon Path set to %s", *iconPath); esyslog("tvguide: Icon Path set to %s", *iconPath);
} }
void cTvguideConfig::SetDefaultPathes(void) { void cTvguideConfig::SetDefaultPathes(void) {
logoPathDefault = cString::sprintf("%s/logos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N)); logoPathDefault = cString::sprintf("%s/logos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
iconPathDefault = cString::sprintf("%s/icons/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N)); iconPathDefault = cString::sprintf("%s/icons/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
epgImagePathDefault = cString::sprintf("%s/epgimages/", cPlugin::CacheDirectory(PLUGIN_NAME_I18N)); epgImagePathDefault = cString::sprintf("%s/epgimages/", cPlugin::CacheDirectory(PLUGIN_NAME_I18N));
if (!logoPathSet) { if (!logoPathSet) {
logoPath = logoPathDefault; logoPath = logoPathDefault;
} }
if (!imagesPathSet) { if (!imagesPathSet) {
epgImagePath = epgImagePathDefault; epgImagePath = epgImagePathDefault;
} }
if (!iconsPathSet) { if (!iconsPathSet) {
iconPath = iconPathDefault; iconPath = iconPathDefault;
} }
} }
cString cTvguideConfig::checkSlashAtEnd(std::string path) { cString cTvguideConfig::checkSlashAtEnd(std::string path) {
try { try {
if (!(path.at(path.size()-1) == '/')) if (!(path.at(path.size()-1) == '/'))
return cString::sprintf("%s/", path.c_str()); return cString::sprintf("%s/", path.c_str());
} catch (...) {return path.c_str();} } catch (...) {return path.c_str();}
return path.c_str(); return path.c_str();
} }
bool cTvguideConfig::SetupParse(const char *Name, const char *Value) { bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
if (strcmp(Name, "timeFormat") == 0) timeFormat = atoi(Value); if (strcmp(Name, "timeFormat") == 0) timeFormat = atoi(Value);
else if (strcmp(Name, "debugImageLoading") == 0) debugImageLoading = atoi(Value); else if (strcmp(Name, "debugImageLoading") == 0) debugImageLoading = atoi(Value);
else if (strcmp(Name, "showMainMenuEntry") == 0) showMainMenuEntry = atoi(Value); else if (strcmp(Name, "showMainMenuEntry") == 0) showMainMenuEntry = atoi(Value);
else if (strcmp(Name, "replaceOriginalSchedule") == 0) replaceOriginalSchedule = atoi(Value); else if (strcmp(Name, "replaceOriginalSchedule") == 0) replaceOriginalSchedule = atoi(Value);
else if (strcmp(Name, "useNopacityTheme") == 0) useNopacityTheme = atoi(Value); else if (strcmp(Name, "useNopacityTheme") == 0) useNopacityTheme = atoi(Value);
else if (strcmp(Name, "themeIndex") == 0) themeIndex = atoi(Value); else if (strcmp(Name, "themeIndex") == 0) themeIndex = atoi(Value);
else if (strcmp(Name, "displayMode") == 0) displayMode = atoi(Value); else if (strcmp(Name, "displayMode") == 0) displayMode = atoi(Value);
else if (strcmp(Name, "showTimeInGrid") == 0) showTimeInGrid = atoi(Value); else if (strcmp(Name, "showTimeInGrid") == 0) showTimeInGrid = atoi(Value);
else if (strcmp(Name, "displayStatusHeader") == 0) displayStatusHeader = atoi(Value); else if (strcmp(Name, "displayStatusHeader") == 0) displayStatusHeader = atoi(Value);
else if (strcmp(Name, "displayChannelGroups") == 0) displayChannelGroups = atoi(Value); else if (strcmp(Name, "displayChannelGroups") == 0) displayChannelGroups = atoi(Value);
else if (strcmp(Name, "displayTimeBase") == 0) displayTimeBase = atoi(Value); else if (strcmp(Name, "displayTimeBase") == 0) displayTimeBase = atoi(Value);
else if (strcmp(Name, "headerHeightPercent") == 0) headerHeightPercent = atoi(Value); else if (strcmp(Name, "headerHeightPercent") == 0) headerHeightPercent = atoi(Value);
else if (strcmp(Name, "channelGroupsPercent") == 0) channelGroupsPercent = atoi(Value); else if (strcmp(Name, "channelGroupsPercent") == 0) channelGroupsPercent = atoi(Value);
else if (strcmp(Name, "epgViewBorder") == 0) epgViewBorder = atoi(Value); else if (strcmp(Name, "epgViewBorder") == 0) epgViewBorder = atoi(Value);
else if (strcmp(Name, "scaleVideo") == 0) scaleVideo = atoi(Value); else if (strcmp(Name, "scaleVideo") == 0) scaleVideo = atoi(Value);
else if (strcmp(Name, "decorateVideo") == 0) decorateVideo = atoi(Value); else if (strcmp(Name, "decorateVideo") == 0) decorateVideo = atoi(Value);
else if (strcmp(Name, "roundedCorners") == 0) roundedCorners = atoi(Value); else if (strcmp(Name, "roundedCorners") == 0) roundedCorners = atoi(Value);
else if (strcmp(Name, "channelCols") == 0) channelCols = atoi(Value); else if (strcmp(Name, "channelCols") == 0) channelCols = atoi(Value);
else if (strcmp(Name, "channelRows") == 0) channelRows = atoi(Value); else if (strcmp(Name, "channelRows") == 0) channelRows = atoi(Value);
else if (strcmp(Name, "displayTime") == 0) displayTime = atoi(Value); else if (strcmp(Name, "displayTime") == 0) displayTime = atoi(Value);
else if (strcmp(Name, "displayHorizontalTime") == 0) displayHorizontalTime = atoi(Value); else if (strcmp(Name, "displayHorizontalTime") == 0) displayHorizontalTime = atoi(Value);
else if (strcmp(Name, "hideChannelLogos") == 0) hideChannelLogos = atoi(Value); else if (strcmp(Name, "hideChannelLogos") == 0) hideChannelLogos = atoi(Value);
else if (strcmp(Name, "logoExtension") == 0) logoExtension = atoi(Value); else if (strcmp(Name, "logoExtension") == 0) logoExtension = atoi(Value);
else if (strcmp(Name, "logoWidthRatio") == 0) logoWidthRatio = atoi(Value); else if (strcmp(Name, "logoWidthRatio") == 0) logoWidthRatio = atoi(Value);
else if (strcmp(Name, "logoHeightRatio") == 0) logoHeightRatio = atoi(Value); else if (strcmp(Name, "logoHeightRatio") == 0) logoHeightRatio = atoi(Value);
else if (strcmp(Name, "bigStepHours") == 0) bigStepHours = atoi(Value); else if (strcmp(Name, "bigStepHours") == 0) bigStepHours = atoi(Value);
else if (strcmp(Name, "hugeStepHours") == 0) hugeStepHours = atoi(Value); else if (strcmp(Name, "hugeStepHours") == 0) hugeStepHours = atoi(Value);
else if (strcmp(Name, "channelJumpMode") == 0) channelJumpMode = atoi(Value); else if (strcmp(Name, "channelJumpMode") == 0) channelJumpMode = atoi(Value);
else if (strcmp(Name, "blueKeyMode") == 0) blueKeyMode = atoi(Value); else if (strcmp(Name, "blueKeyMode") == 0) blueKeyMode = atoi(Value);
else if (strcmp(Name, "numkeyMode") == 0) numkeyMode = atoi(Value); else if (strcmp(Name, "numkeyMode") == 0) numkeyMode = atoi(Value);
else if (strcmp(Name, "closeOnSwitch") == 0) closeOnSwitch = atoi(Value); else if (strcmp(Name, "closeOnSwitch") == 0) closeOnSwitch = atoi(Value);
else if (strcmp(Name, "useRemoteTimers") == 0) useRemoteTimers = atoi(Value); else if (strcmp(Name, "useRemoteTimers") == 0) useRemoteTimers = atoi(Value);
else if (strcmp(Name, "hideLastGroup") == 0) hideLastGroup = atoi(Value); else if (strcmp(Name, "hideLastGroup") == 0) hideLastGroup = atoi(Value);
else if (strcmp(Name, "hideEpgImages") == 0) hideEpgImages = atoi(Value); else if (strcmp(Name, "hideEpgImages") == 0) hideEpgImages = atoi(Value);
else if (strcmp(Name, "epgImageWidth") == 0) epgImageWidth = atoi(Value); else if (strcmp(Name, "epgImageWidth") == 0) epgImageWidth = atoi(Value);
else if (strcmp(Name, "epgImageHeight") == 0) epgImageHeight = atoi(Value); else if (strcmp(Name, "epgImageHeight") == 0) epgImageHeight = atoi(Value);
else if (strcmp(Name, "numAdditionalEPGPictures") == 0) numAdditionalEPGPictures = atoi(Value); else if (strcmp(Name, "numAdditionalEPGPictures") == 0) numAdditionalEPGPictures = atoi(Value);
else if (strcmp(Name, "epgImageWidthLarge") == 0) epgImageWidthLarge = atoi(Value); else if (strcmp(Name, "epgImageWidthLarge") == 0) epgImageWidthLarge = atoi(Value);
else if (strcmp(Name, "epgImageHeightLarge") == 0) epgImageHeightLarge = atoi(Value); else if (strcmp(Name, "epgImageHeightLarge") == 0) epgImageHeightLarge = atoi(Value);
else if (strcmp(Name, "detailedViewScrollStep") == 0) detailedViewScrollStep = atoi(Value); else if (strcmp(Name, "detailedViewScrollStep") == 0) detailedViewScrollStep = atoi(Value);
else if (strcmp(Name, "timeLineWidthPercent") == 0) timeLineWidthPercent = atoi(Value); else if (strcmp(Name, "timeLineWidthPercent") == 0) timeLineWidthPercent = atoi(Value);
else if (strcmp(Name, "timeLineHeightPercent") == 0) timeLineHeightPercent = atoi(Value); else if (strcmp(Name, "timeLineHeightPercent") == 0) timeLineHeightPercent = atoi(Value);
else if (strcmp(Name, "displayChannelName") == 0) displayChannelName = atoi(Value); else if (strcmp(Name, "displayChannelName") == 0) displayChannelName = atoi(Value);
else if (strcmp(Name, "channelHeaderWidthPercent") == 0) channelHeaderWidthPercent = atoi(Value); else if (strcmp(Name, "channelHeaderWidthPercent") == 0) channelHeaderWidthPercent = atoi(Value);
else if (strcmp(Name, "channelHeaderHeightPercent") == 0) channelHeaderHeightPercent = atoi(Value); else if (strcmp(Name, "channelHeaderHeightPercent") == 0) channelHeaderHeightPercent = atoi(Value);
else if (strcmp(Name, "footerHeightPercent") == 0) footerHeightPercent = atoi(Value); else if (strcmp(Name, "footerHeightPercent") == 0) footerHeightPercent = atoi(Value);
else if (strcmp(Name, "instRecFolderMode") == 0) instRecFolderMode = atoi(Value); else if (strcmp(Name, "instRecFolderMode") == 0) instRecFolderMode = atoi(Value);
else if (strcmp(Name, "instRecFixedFolder") == 0) instRecFixedFolder = Value; else if (strcmp(Name, "instRecFixedFolder") == 0) instRecFixedFolder = Value;
else if (strcmp(Name, "favWhatsOnNow") == 0) favWhatsOnNow = atoi(Value); else if (strcmp(Name, "favWhatsOnNow") == 0) favWhatsOnNow = atoi(Value);
else if (strcmp(Name, "favWhatsOnNext") == 0) favWhatsOnNext = atoi(Value); else if (strcmp(Name, "favWhatsOnNext") == 0) favWhatsOnNext = atoi(Value);
else if (strcmp(Name, "favUseTime1") == 0) favUseTime1 = atoi(Value); else if (strcmp(Name, "favUseTime1") == 0) favUseTime1 = atoi(Value);
else if (strcmp(Name, "favUseTime2") == 0) favUseTime2 = atoi(Value); else if (strcmp(Name, "favUseTime2") == 0) favUseTime2 = atoi(Value);
else if (strcmp(Name, "favUseTime3") == 0) favUseTime3 = atoi(Value); else if (strcmp(Name, "favUseTime3") == 0) favUseTime3 = atoi(Value);
else if (strcmp(Name, "favUseTime4") == 0) favUseTime4 = atoi(Value); else if (strcmp(Name, "favUseTime4") == 0) favUseTime4 = atoi(Value);
else if (strcmp(Name, "favTime1") == 0) favTime1 = atoi(Value); else if (strcmp(Name, "favTime1") == 0) favTime1 = atoi(Value);
else if (strcmp(Name, "favTime2") == 0) favTime2 = atoi(Value); else if (strcmp(Name, "favTime2") == 0) favTime2 = atoi(Value);
else if (strcmp(Name, "favTime3") == 0) favTime3 = atoi(Value); else if (strcmp(Name, "favTime3") == 0) favTime3 = atoi(Value);
else if (strcmp(Name, "favTime4") == 0) favTime4 = atoi(Value); else if (strcmp(Name, "favTime4") == 0) favTime4 = atoi(Value);
else if (strcmp(Name, "descUser1") == 0) descUser1 = Value; else if (strcmp(Name, "descUser1") == 0) descUser1 = Value;
else if (strcmp(Name, "descUser2") == 0) descUser2 = Value; else if (strcmp(Name, "descUser2") == 0) descUser2 = Value;
else if (strcmp(Name, "descUser3") == 0) descUser3 = Value; else if (strcmp(Name, "descUser3") == 0) descUser3 = Value;
else if (strcmp(Name, "descUser4") == 0) descUser4 = Value; else if (strcmp(Name, "descUser4") == 0) descUser4 = Value;
else if (strcmp(Name, "favLimitChannels") == 0) favLimitChannels = atoi(Value); else if (strcmp(Name, "favLimitChannels") == 0) favLimitChannels = atoi(Value);
else if (strcmp(Name, "favStartChannel") == 0) favStartChannel = atoi(Value); else if (strcmp(Name, "favStartChannel") == 0) favStartChannel = atoi(Value);
else if (strcmp(Name, "favStopChannel") == 0) favStopChannel = atoi(Value); else if (strcmp(Name, "favStopChannel") == 0) favStopChannel = atoi(Value);
else if (strcmp(Name, "switchMode") == 0) switchMode = atoi(Value); else if (strcmp(Name, "switchMode") == 0) switchMode = atoi(Value);
else if (strcmp(Name, "switchMinsBefore") == 0) switchMinsBefore = atoi(Value); else if (strcmp(Name, "switchMinsBefore") == 0) switchMinsBefore = atoi(Value);
else if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value); else if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value);
else if (strcmp(Name, "FontButtonDelta") == 0) FontButtonDelta = atoi(Value); else if (strcmp(Name, "FontButtonDelta") == 0) FontButtonDelta = atoi(Value);
else if (strcmp(Name, "FontDetailViewDelta") == 0) FontDetailViewDelta = atoi(Value); else if (strcmp(Name, "FontDetailViewDelta") == 0) FontDetailViewDelta = atoi(Value);
else if (strcmp(Name, "FontDetailHeaderDelta") == 0) FontDetailHeaderDelta = atoi(Value); else if (strcmp(Name, "FontDetailHeaderDelta") == 0) FontDetailHeaderDelta = atoi(Value);
else if (strcmp(Name, "FontMessageBoxDelta") == 0) FontMessageBoxDelta = atoi(Value); else if (strcmp(Name, "FontMessageBoxDelta") == 0) FontMessageBoxDelta = atoi(Value);
else if (strcmp(Name, "FontMessageBoxLargeDelta") == 0) FontMessageBoxLargeDelta = atoi(Value); else if (strcmp(Name, "FontMessageBoxLargeDelta") == 0) FontMessageBoxLargeDelta = atoi(Value);
else if (strcmp(Name, "FontStatusHeaderDelta") == 0) FontStatusHeaderDelta = atoi(Value); else if (strcmp(Name, "FontStatusHeaderDelta") == 0) FontStatusHeaderDelta = atoi(Value);
else if (strcmp(Name, "FontStatusHeaderLargeDelta") == 0) FontStatusHeaderLargeDelta = atoi(Value); else if (strcmp(Name, "FontStatusHeaderLargeDelta") == 0) FontStatusHeaderLargeDelta = atoi(Value);
else if (strcmp(Name, "FontChannelHeaderDelta") == 0) FontChannelHeaderDelta = atoi(Value); else if (strcmp(Name, "FontChannelHeaderDelta") == 0) FontChannelHeaderDelta = atoi(Value);
else if (strcmp(Name, "FontChannelGroupsDelta") == 0) FontChannelGroupsDelta = atoi(Value); else if (strcmp(Name, "FontChannelGroupsDelta") == 0) FontChannelGroupsDelta = atoi(Value);
else if (strcmp(Name, "FontGridDelta") == 0) FontGridDelta = atoi(Value); else if (strcmp(Name, "FontGridDelta") == 0) FontGridDelta = atoi(Value);
else if (strcmp(Name, "FontGridSmallDelta") == 0) FontGridSmallDelta = atoi(Value); else if (strcmp(Name, "FontGridSmallDelta") == 0) FontGridSmallDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineWeekdayDelta") == 0) FontTimeLineWeekdayDelta = atoi(Value); else if (strcmp(Name, "FontTimeLineWeekdayDelta") == 0) FontTimeLineWeekdayDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineDateDelta") == 0) FontTimeLineDateDelta = atoi(Value); else if (strcmp(Name, "FontTimeLineDateDelta") == 0) FontTimeLineDateDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineTimeDelta") == 0) FontTimeLineTimeDelta = atoi(Value); else if (strcmp(Name, "FontTimeLineTimeDelta") == 0) FontTimeLineTimeDelta = atoi(Value);
else if (strcmp(Name, "FontChannelHeaderHorizontalDelta") == 0) FontChannelHeaderHorizontalDelta = atoi(Value); else if (strcmp(Name, "FontChannelHeaderHorizontalDelta") == 0) FontChannelHeaderHorizontalDelta = atoi(Value);
else if (strcmp(Name, "FontChannelGroupsHorizontalDelta") == 0) FontChannelGroupsHorizontalDelta = atoi(Value); else if (strcmp(Name, "FontChannelGroupsHorizontalDelta") == 0) FontChannelGroupsHorizontalDelta = atoi(Value);
else if (strcmp(Name, "FontGridHorizontalDelta") == 0) FontGridHorizontalDelta = atoi(Value); else if (strcmp(Name, "FontGridHorizontalDelta") == 0) FontGridHorizontalDelta = atoi(Value);
else if (strcmp(Name, "FontGridHorizontalSmallDelta") == 0) FontGridHorizontalSmallDelta = atoi(Value); else if (strcmp(Name, "FontGridHorizontalSmallDelta") == 0) FontGridHorizontalSmallDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineDateHorizontalDelta") == 0) FontTimeLineDateHorizontalDelta = atoi(Value); else if (strcmp(Name, "FontTimeLineDateHorizontalDelta") == 0) FontTimeLineDateHorizontalDelta = atoi(Value);
else if (strcmp(Name, "FontTimeLineTimeHorizontalDelta") == 0) FontTimeLineTimeHorizontalDelta = atoi(Value); else if (strcmp(Name, "FontTimeLineTimeHorizontalDelta") == 0) FontTimeLineTimeHorizontalDelta = atoi(Value);
else if (strcmp(Name, "FontRecMenuItemDelta") == 0) FontRecMenuItemDelta = atoi(Value); else if (strcmp(Name, "FontRecMenuItemDelta") == 0) FontRecMenuItemDelta = atoi(Value);
else if (strcmp(Name, "FontRecMenuItemSmallDelta") == 0) FontRecMenuItemSmallDelta = atoi(Value); else if (strcmp(Name, "FontRecMenuItemSmallDelta") == 0) FontRecMenuItemSmallDelta = atoi(Value);
else if (strcmp(Name, "FontRecMenuItemLargeDelta") == 0) FontRecMenuItemLargeDelta = atoi(Value); else if (strcmp(Name, "FontRecMenuItemLargeDelta") == 0) FontRecMenuItemLargeDelta = atoi(Value);
else if (strcmp(Name, "displayRerunsDetailEPGView") == 0) displayRerunsDetailEPGView = atoi(Value); else if (strcmp(Name, "displayRerunsDetailEPGView") == 0) displayRerunsDetailEPGView = atoi(Value);
else if (strcmp(Name, "numReruns") == 0) numReruns = atoi(Value); else if (strcmp(Name, "numReruns") == 0) numReruns = atoi(Value);
else if (strcmp(Name, "useSubtitleRerun") == 0) useSubtitleRerun = atoi(Value); else if (strcmp(Name, "useSubtitleRerun") == 0) useSubtitleRerun = atoi(Value);
else if (strcmp(Name, "numLogosInitial") == 0) numLogosInitial = atoi(Value); else if (strcmp(Name, "numLogosInitial") == 0) numLogosInitial = atoi(Value);
else if (strcmp(Name, "numLogosMax") == 0) numLogosMax = atoi(Value); else if (strcmp(Name, "numLogosMax") == 0) numLogosMax = atoi(Value);
else if (strcmp(Name, "limitLogoCache") == 0) limitLogoCache = atoi(Value); else if (strcmp(Name, "limitLogoCache") == 0) limitLogoCache = atoi(Value);
else return false; else return false;
return true; return true;
} }

516
config.h
View File

@ -1,258 +1,258 @@
#ifndef __TVGUIDE_CONFIG_H #ifndef __TVGUIDE_CONFIG_H
#define __TVGUIDE_CONFIG_H #define __TVGUIDE_CONFIG_H
#include <vdr/themes.h> #include <vdr/themes.h>
#include <vdr/plugin.h> #include <vdr/plugin.h>
#include "osdmanager.h" #include "osdmanager.h"
#include "geometrymanager.h" #include "geometrymanager.h"
#include "fontmanager.h" #include "fontmanager.h"
#include "imagecache.h" #include "imagecache.h"
enum { enum {
e12Hours, e12Hours,
e24Hours e24Hours
}; };
enum { enum {
eVertical, eVertical,
eHorizontal eHorizontal
}; };
enum { enum {
eNumJump, eNumJump,
eGroupJump eGroupJump
}; };
enum { enum {
eStyleGraphical, eStyleGraphical,
eStyleBlendingMagick, eStyleBlendingMagick,
eStyleBlendingDefault, eStyleBlendingDefault,
eStyleFlat eStyleFlat
}; };
enum eBlueKeyMode { enum eBlueKeyMode {
eBlueKeySwitch = 0, eBlueKeySwitch = 0,
eBlueKeyEPG, eBlueKeyEPG,
eBlueKeyFavorites eBlueKeyFavorites
}; };
enum eInstRecFolderMode { enum eInstRecFolderMode {
eFolderRoot = 0, eFolderRoot = 0,
eFolderSelect, eFolderSelect,
eFolderFixed eFolderFixed
}; };
class cTvguideConfig { class cTvguideConfig {
private: private:
cString checkSlashAtEnd(std::string path); cString checkSlashAtEnd(std::string path);
public: public:
cTvguideConfig(); cTvguideConfig();
~cTvguideConfig(); ~cTvguideConfig();
int debugImageLoading; int debugImageLoading;
int showMainMenuEntry; int showMainMenuEntry;
int replaceOriginalSchedule; int replaceOriginalSchedule;
int displayMode; int displayMode;
int showTimeInGrid; int showTimeInGrid;
int channelCols; int channelCols;
int channelRows; int channelRows;
int numGrids; int numGrids;
int displayTime; int displayTime;
int displayHorizontalTime; int displayHorizontalTime;
int displayStatusHeader; int displayStatusHeader;
int displayChannelGroups; int displayChannelGroups;
int displayTimeBase; int displayTimeBase;
int headerHeightPercent; int headerHeightPercent;
int channelGroupsPercent; int channelGroupsPercent;
int epgViewBorder; int epgViewBorder;
int scaleVideo; int scaleVideo;
int decorateVideo; int decorateVideo;
int timeLineWidthPercent; int timeLineWidthPercent;
int timeLineHeightPercent; int timeLineHeightPercent;
int displayChannelName; int displayChannelName;
int channelHeaderWidthPercent; int channelHeaderWidthPercent;
int channelHeaderHeightPercent; int channelHeaderHeightPercent;
int footerHeightPercent; int footerHeightPercent;
int stepMinutes; int stepMinutes;
int bigStepHours; int bigStepHours;
int hugeStepHours; int hugeStepHours;
int channelJumpMode; int channelJumpMode;
int jumpChannels; int jumpChannels;
int blueKeyMode; int blueKeyMode;
int closeOnSwitch; int closeOnSwitch;
int numkeyMode; int numkeyMode;
int useRemoteTimers; int useRemoteTimers;
int hideLastGroup; int hideLastGroup;
int hideChannelLogos; int hideChannelLogos;
int logoWidthRatio; int logoWidthRatio;
int logoHeightRatio; int logoHeightRatio;
cString logoPath; cString logoPath;
int logoExtension; int logoExtension;
int hideEpgImages; int hideEpgImages;
int epgImageWidth; int epgImageWidth;
int epgImageHeight; int epgImageHeight;
int numAdditionalEPGPictures; int numAdditionalEPGPictures;
int epgImageWidthLarge; int epgImageWidthLarge;
int epgImageHeightLarge; int epgImageHeightLarge;
int detailedViewScrollStep; int detailedViewScrollStep;
cString epgImagePath; cString epgImagePath;
cString iconPath; cString iconPath;
cString logoPathDefault; cString logoPathDefault;
cString iconPathDefault; cString iconPathDefault;
cString epgImagePathDefault; cString epgImagePathDefault;
int instRecFolderMode; int instRecFolderMode;
std::string instRecFixedFolder; std::string instRecFixedFolder;
int favWhatsOnNow; int favWhatsOnNow;
int favWhatsOnNext; int favWhatsOnNext;
int favUseTime1; int favUseTime1;
int favUseTime2; int favUseTime2;
int favUseTime3; int favUseTime3;
int favUseTime4; int favUseTime4;
int favTime1; int favTime1;
int favTime2; int favTime2;
int favTime3; int favTime3;
int favTime4; int favTime4;
std::string descUser1; std::string descUser1;
std::string descUser2; std::string descUser2;
std::string descUser3; std::string descUser3;
std::string descUser4; std::string descUser4;
int favLimitChannels; int favLimitChannels;
int favStartChannel; int favStartChannel;
int favStopChannel; int favStopChannel;
int switchMode; int switchMode;
int switchMinsBefore; int switchMinsBefore;
int fontIndex; int fontIndex;
const char *fontNameDefault; const char *fontNameDefault;
int FontButtonDelta; int FontButtonDelta;
int FontDetailViewDelta; int FontDetailViewDelta;
int FontDetailViewSmallDelta; int FontDetailViewSmallDelta;
int FontDetailHeaderDelta; int FontDetailHeaderDelta;
int FontMessageBoxDelta; int FontMessageBoxDelta;
int FontMessageBoxLargeDelta; int FontMessageBoxLargeDelta;
int FontStatusHeaderDelta; int FontStatusHeaderDelta;
int FontStatusHeaderLargeDelta; int FontStatusHeaderLargeDelta;
int FontChannelHeaderDelta; int FontChannelHeaderDelta;
int FontChannelGroupsDelta; int FontChannelGroupsDelta;
int FontGridDelta; int FontGridDelta;
int FontGridSmallDelta; int FontGridSmallDelta;
int FontTimeLineWeekdayDelta; int FontTimeLineWeekdayDelta;
int FontTimeLineDateDelta; int FontTimeLineDateDelta;
int FontTimeLineTimeDelta; int FontTimeLineTimeDelta;
int FontChannelHeaderHorizontalDelta; int FontChannelHeaderHorizontalDelta;
int FontChannelGroupsHorizontalDelta; int FontChannelGroupsHorizontalDelta;
int FontGridHorizontalDelta; int FontGridHorizontalDelta;
int FontGridHorizontalSmallDelta; int FontGridHorizontalSmallDelta;
int FontTimeLineDateHorizontalDelta; int FontTimeLineDateHorizontalDelta;
int FontTimeLineTimeHorizontalDelta; int FontTimeLineTimeHorizontalDelta;
int FontRecMenuItemDelta; int FontRecMenuItemDelta;
int FontRecMenuItemSmallDelta; int FontRecMenuItemSmallDelta;
int FontRecMenuItemLargeDelta; int FontRecMenuItemLargeDelta;
int timeFormat; int timeFormat;
int useNopacityTheme; int useNopacityTheme;
int themeIndex; int themeIndex;
int themeIndexCurrent; int themeIndexCurrent;
cString themeName; cString themeName;
std::string nOpacityTheme; std::string nOpacityTheme;
int style; int style;
int roundedCorners; int roundedCorners;
int displayRerunsDetailEPGView; int displayRerunsDetailEPGView;
int numReruns; int numReruns;
int useSubtitleRerun; int useSubtitleRerun;
int numLogosInitial; int numLogosInitial;
int numLogosMax; int numLogosMax;
int limitLogoCache; int limitLogoCache;
bool logoPathSet; bool logoPathSet;
bool imagesPathSet; bool imagesPathSet;
bool iconsPathSet; bool iconsPathSet;
bool LoadTheme(); bool LoadTheme();
void SetStyle(void); void SetStyle(void);
void setDynamicValues(void); void setDynamicValues(void);
void SetLogoPath(cString path); void SetLogoPath(cString path);
void SetImagesPath(cString path); void SetImagesPath(cString path);
void SetIconsPath(cString path); void SetIconsPath(cString path);
void SetDefaultPathes(void); void SetDefaultPathes(void);
bool SetupParse(const char *Name, const char *Value); bool SetupParse(const char *Name, const char *Value);
}; };
#ifdef DEFINE_CONFIG #ifdef DEFINE_CONFIG
cTvguideConfig tvguideConfig; cTvguideConfig tvguideConfig;
cOsdManager osdManager; cOsdManager osdManager;
cGeometryManager geoManager; cGeometryManager geoManager;
cFontManager fontManager; cFontManager fontManager;
cImageCache imgCache; cImageCache imgCache;
cTheme theme; cTheme theme;
cPlugin* pRemoteTimers = NULL; cPlugin* pRemoteTimers = NULL;
#else #else
extern cTvguideConfig tvguideConfig; extern cTvguideConfig tvguideConfig;
extern cOsdManager osdManager; extern cOsdManager osdManager;
extern cGeometryManager geoManager; extern cGeometryManager geoManager;
extern cFontManager fontManager; extern cFontManager fontManager;
extern cImageCache imgCache; extern cImageCache imgCache;
extern cTheme theme; extern cTheme theme;
extern cPlugin* pRemoteTimers; extern cPlugin* pRemoteTimers;
#endif #endif
// --- Theme ------------------------------------------------------------- // --- Theme -------------------------------------------------------------
//Style SETUP //Style SETUP
#define CLR_STYLE_BLENDING_MAGICK 0xFFFFFFFF #define CLR_STYLE_BLENDING_MAGICK 0xFFFFFFFF
#define CLR_STYLE_BLENDING_DEFAULT 0xAAAAAAAA #define CLR_STYLE_BLENDING_DEFAULT 0xAAAAAAAA
#define CLR_STYLE_GRAPHICAL 0x66666666 #define CLR_STYLE_GRAPHICAL 0x66666666
#define CLR_STYLE_FLAT 0x00000000 #define CLR_STYLE_FLAT 0x00000000
THEME_CLR(theme, clrStyle, CLR_STYLE_BLENDING_DEFAULT); THEME_CLR(theme, clrStyle, CLR_STYLE_BLENDING_DEFAULT);
THEME_CLR(theme, clrBackgroundOSD, 0xB012273f); THEME_CLR(theme, clrBackgroundOSD, 0xB012273f);
THEME_CLR(theme, clrBackground, 0xFF12273f); THEME_CLR(theme, clrBackground, 0xFF12273f);
THEME_CLR(theme, clrGrid1, 0x00000000); THEME_CLR(theme, clrGrid1, 0x00000000);
THEME_CLR(theme, clrGrid1Blending, 0x00000000); THEME_CLR(theme, clrGrid1Blending, 0x00000000);
THEME_CLR(theme, clrGrid2, 0x00000000); THEME_CLR(theme, clrGrid2, 0x00000000);
THEME_CLR(theme, clrGrid2Blending, 0x00000000); THEME_CLR(theme, clrGrid2Blending, 0x00000000);
THEME_CLR(theme, clrHighlight, 0xAA3A3A55); THEME_CLR(theme, clrHighlight, 0xAA3A3A55);
THEME_CLR(theme, clrHighlightBlending, 0xDD000000); THEME_CLR(theme, clrHighlightBlending, 0xDD000000);
THEME_CLR(theme, clrGridFontBack, clrTransparent); THEME_CLR(theme, clrGridFontBack, clrTransparent);
THEME_CLR(theme, clrGridActiveFontBack, 0xFFAFD533); THEME_CLR(theme, clrGridActiveFontBack, 0xFFAFD533);
THEME_CLR(theme, clrFont, clrWhite); THEME_CLR(theme, clrFont, clrWhite);
THEME_CLR(theme, clrFontActive, 0xFF363636); THEME_CLR(theme, clrFontActive, 0xFF363636);
THEME_CLR(theme, clrFontHeader, 0xFF363636); THEME_CLR(theme, clrFontHeader, 0xFF363636);
THEME_CLR(theme, clrFontButtons, clrWhite); THEME_CLR(theme, clrFontButtons, clrWhite);
THEME_CLR(theme, clrStatusHeader, 0x00000000); THEME_CLR(theme, clrStatusHeader, 0x00000000);
THEME_CLR(theme, clrStatusHeaderBlending, 0x00000000); THEME_CLR(theme, clrStatusHeaderBlending, 0x00000000);
THEME_CLR(theme, clrHeader, 0x00000000); THEME_CLR(theme, clrHeader, 0x00000000);
THEME_CLR(theme, clrHeaderBlending, 0x00000000); THEME_CLR(theme, clrHeaderBlending, 0x00000000);
THEME_CLR(theme, clrBorder, 0x00000000); THEME_CLR(theme, clrBorder, 0x00000000);
THEME_CLR(theme, clrTimeline1, clrWhite); THEME_CLR(theme, clrTimeline1, clrWhite);
THEME_CLR(theme, clrTimeline1Blending, 0xFF828282); THEME_CLR(theme, clrTimeline1Blending, 0xFF828282);
THEME_CLR(theme, clrTimeline2, clrBlack); THEME_CLR(theme, clrTimeline2, clrBlack);
THEME_CLR(theme, clrTimeline2Blending, 0xFF3F3F3F); THEME_CLR(theme, clrTimeline2Blending, 0xFF3F3F3F);
THEME_CLR(theme, clrTimeBase, 0xA0FF0000); THEME_CLR(theme, clrTimeBase, 0xA0FF0000);
THEME_CLR(theme, clrTabInactive, 0xA01F3D7A); THEME_CLR(theme, clrTabInactive, 0xA01F3D7A);
THEME_CLR(theme, clrButtonRed, 0xFFFF0000); THEME_CLR(theme, clrButtonRed, 0xFFFF0000);
THEME_CLR(theme, clrButtonRedBorder, 0x00000000); THEME_CLR(theme, clrButtonRedBorder, 0x00000000);
THEME_CLR(theme, clrButtonGreen, 0x00000000); THEME_CLR(theme, clrButtonGreen, 0x00000000);
THEME_CLR(theme, clrButtonGreenBorder, 0x00000000); THEME_CLR(theme, clrButtonGreenBorder, 0x00000000);
THEME_CLR(theme, clrButtonYellow, 0x00000000); THEME_CLR(theme, clrButtonYellow, 0x00000000);
THEME_CLR(theme, clrButtonYellowBorder, 0x00000000); THEME_CLR(theme, clrButtonYellowBorder, 0x00000000);
THEME_CLR(theme, clrButtonBlue, 0x00000000); THEME_CLR(theme, clrButtonBlue, 0x00000000);
THEME_CLR(theme, clrButtonBlueBorder, 0x00000000); THEME_CLR(theme, clrButtonBlueBorder, 0x00000000);
THEME_CLR(theme, clrButtonBlend, 0xDD000000); THEME_CLR(theme, clrButtonBlend, 0xDD000000);
THEME_CLR(theme, clrRecMenuBackground, 0xAA000000); THEME_CLR(theme, clrRecMenuBackground, 0xAA000000);
THEME_CLR(theme, clrRecMenuTimerConflictBackground, 0xFFCCCCCC); THEME_CLR(theme, clrRecMenuTimerConflictBackground, 0xFFCCCCCC);
THEME_CLR(theme, clrRecMenuTimerConflictBar, 0xFF222222); THEME_CLR(theme, clrRecMenuTimerConflictBar, 0xFF222222);
THEME_CLR(theme, clrRecMenuTimerConflictOverlap, 0xAAFF0000); THEME_CLR(theme, clrRecMenuTimerConflictOverlap, 0xAAFF0000);
THEME_CLR(theme, clrRecMenuDayActive, 0xFF00FF00); THEME_CLR(theme, clrRecMenuDayActive, 0xFF00FF00);
THEME_CLR(theme, clrRecMenuDayInactive, 0xFFFF0000); THEME_CLR(theme, clrRecMenuDayInactive, 0xFFFF0000);
THEME_CLR(theme, clrRecMenuDayHighlight, 0x44FFFFFF); THEME_CLR(theme, clrRecMenuDayHighlight, 0x44FFFFFF);
THEME_CLR(theme, clrRecMenuTextBack, 0xFF000000); THEME_CLR(theme, clrRecMenuTextBack, 0xFF000000);
THEME_CLR(theme, clrRecMenuTextActiveBack, 0xFF939376); THEME_CLR(theme, clrRecMenuTextActiveBack, 0xFF939376);
THEME_CLR(theme, clrRecMenuKeyboardBack, 0xFF000000); THEME_CLR(theme, clrRecMenuKeyboardBack, 0xFF000000);
THEME_CLR(theme, clrRecMenuKeyboardBorder, clrWhite); THEME_CLR(theme, clrRecMenuKeyboardBorder, clrWhite);
THEME_CLR(theme, clrRecMenuKeyboardHigh, 0x40BB0000); THEME_CLR(theme, clrRecMenuKeyboardHigh, 0x40BB0000);
THEME_CLR(theme, clrButtonRedKeyboard, 0xFFBB0000); THEME_CLR(theme, clrButtonRedKeyboard, 0xFFBB0000);
THEME_CLR(theme, clrButtonGreenKeyboard, 0xFF00BB00); THEME_CLR(theme, clrButtonGreenKeyboard, 0xFF00BB00);
THEME_CLR(theme, clrButtonYellowKeyboard, 0xFFBBBB00); THEME_CLR(theme, clrButtonYellowKeyboard, 0xFFBBBB00);
THEME_CLR(theme, clrRecMenuTimelineTimer, 0xB012273f); THEME_CLR(theme, clrRecMenuTimelineTimer, 0xB012273f);
THEME_CLR(theme, clrRecMenuTimelineBack, 0xFF828282); THEME_CLR(theme, clrRecMenuTimelineBack, 0xFF828282);
THEME_CLR(theme, clrRecMenuTimelineActive, 0xFF3F3F3F); THEME_CLR(theme, clrRecMenuTimelineActive, 0xFF3F3F3F);
THEME_CLR(theme, clrRecMenuTimelineConflict, 0x30FF0000); THEME_CLR(theme, clrRecMenuTimelineConflict, 0x30FF0000);
THEME_CLR(theme, clrRecMenuTimelineConflictOverlap, 0x90FF0000); THEME_CLR(theme, clrRecMenuTimelineConflictOverlap, 0x90FF0000);
#endif //__TVGUIDE_CONFIG_H #endif //__TVGUIDE_CONFIG_H

View File

@ -171,4 +171,4 @@ eOSState cDetailView::ProcessKey(eKeys Key) {
break; break;
} }
return state; return state;
} }

View File

@ -25,4 +25,4 @@ public:
eOSState ProcessKey(eKeys Key); eOSState ProcessKey(eKeys Key);
}; };
#endif //__TVGUIDE_DETAILVIEW_H #endif //__TVGUIDE_DETAILVIEW_H

View File

@ -108,4 +108,4 @@ void cDummyGrid::debug() {
viewportHeight, viewportHeight,
Duration()/60, Duration()/60,
active); active);
} }

View File

@ -31,4 +31,4 @@ public:
void debug(); void debug();
}; };
#endif //__TVGUIDE_DUMMYGRID_H #endif //__TVGUIDE_DUMMYGRID_H

388
epggrid.c
View File

@ -1,194 +1,194 @@
#include "services/remotetimers.h" #include "services/remotetimers.h"
#include "channelcolumn.h" #include "channelcolumn.h"
#include "tools.h" #include "tools.h"
#include "epggrid.h" #include "epggrid.h"
cEpgGrid::cEpgGrid(cChannelColumn *c, const cEvent *event) : cGrid(c) { cEpgGrid::cEpgGrid(cChannelColumn *c, const cEvent *event) : cGrid(c) {
this->event = event; this->event = event;
extText = new cTextWrapper(); extText = new cTextWrapper();
hasTimer = false; hasTimer = false;
SetTimer(); SetTimer();
hasSwitchTimer = false; hasSwitchTimer = false;
SetSwitchTimer(); SetSwitchTimer();
dummy = false; dummy = false;
} }
cEpgGrid::~cEpgGrid(void) { cEpgGrid::~cEpgGrid(void) {
delete extText; delete extText;
} }
void cEpgGrid::SetViewportHeight() { void cEpgGrid::SetViewportHeight() {
int viewportHeightOld = viewportHeight; int viewportHeightOld = viewportHeight;
if ( column->Start() > StartTime() ) { if ( column->Start() > StartTime() ) {
viewportHeight = (min((int)EndTime(), column->Stop()) - column->Start()) /60; viewportHeight = (min((int)EndTime(), column->Stop()) - column->Start()) /60;
} else if ( column->Stop() < EndTime() ) { } else if ( column->Stop() < EndTime() ) {
viewportHeight = (column->Stop() - StartTime()) /60; viewportHeight = (column->Stop() - StartTime()) /60;
if (viewportHeight < 0) viewportHeight = 0; if (viewportHeight < 0) viewportHeight = 0;
} else { } else {
viewportHeight = Duration() / 60; viewportHeight = Duration() / 60;
} }
viewportHeight *= geoManager.minutePixel; viewportHeight *= geoManager.minutePixel;
if (viewportHeight != viewportHeightOld) if (viewportHeight != viewportHeightOld)
dirty = true; dirty = true;
} }
void cEpgGrid::PositionPixmap() { void cEpgGrid::PositionPixmap() {
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
int x0 = column->getX(); int x0 = column->getX();
int y0 = geoManager.statusHeaderHeight + geoManager.channelHeaderHeight + geoManager.channelGroupsHeight; int y0 = geoManager.statusHeaderHeight + geoManager.channelHeaderHeight + geoManager.channelGroupsHeight;
if ( column->Start() < StartTime() ) { if ( column->Start() < StartTime() ) {
y0 += (StartTime() - column->Start())/60*geoManager.minutePixel; y0 += (StartTime() - column->Start())/60*geoManager.minutePixel;
} }
if (!pixmap) { if (!pixmap) {
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, geoManager.colWidth, viewportHeight), pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, geoManager.colWidth, viewportHeight),
cRect(0, 0, geoManager.colWidth, Duration()/60*geoManager.minutePixel)); cRect(0, 0, geoManager.colWidth, Duration()/60*geoManager.minutePixel));
} else { } else {
pixmap->SetViewPort(cRect(x0, y0, geoManager.colWidth, viewportHeight)); pixmap->SetViewPort(cRect(x0, y0, geoManager.colWidth, viewportHeight));
} }
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
int x0 = geoManager.channelHeaderWidth + geoManager.channelGroupsWidth; int x0 = geoManager.channelHeaderWidth + geoManager.channelGroupsWidth;
int y0 = column->getY(); int y0 = column->getY();
if ( column->Start() < StartTime() ) { if ( column->Start() < StartTime() ) {
x0 += (StartTime() - column->Start())/60*geoManager.minutePixel; x0 += (StartTime() - column->Start())/60*geoManager.minutePixel;
} }
if (!pixmap) { if (!pixmap) {
pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, geoManager.rowHeight), pixmap = osdManager.requestPixmap(-1, cRect(x0, y0, viewportHeight, geoManager.rowHeight),
cRect(0, 0, Duration()/60*geoManager.minutePixel, geoManager.rowHeight)); cRect(0, 0, Duration()/60*geoManager.minutePixel, geoManager.rowHeight));
} else { } else {
pixmap->SetViewPort(cRect(x0, y0, viewportHeight, geoManager.rowHeight )); pixmap->SetViewPort(cRect(x0, y0, viewportHeight, geoManager.rowHeight ));
} }
} }
} }
void cEpgGrid::SetTimer() { void cEpgGrid::SetTimer() {
hasTimer = false; hasTimer = false;
if (tvguideConfig.useRemoteTimers && pRemoteTimers) { if (tvguideConfig.useRemoteTimers && pRemoteTimers) {
RemoteTimers_Event_v1_0 rt; RemoteTimers_Event_v1_0 rt;
rt.event = event; rt.event = event;
if (pRemoteTimers->Service("RemoteTimers::GetTimerByEvent-v1.0", &rt)) if (pRemoteTimers->Service("RemoteTimers::GetTimerByEvent-v1.0", &rt))
hasTimer = true; hasTimer = true;
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
} else { } else {
eTimerMatch TimerMatch = tmNone; eTimerMatch TimerMatch = tmNone;
LOCK_TIMERS_READ; LOCK_TIMERS_READ;
const cTimers *timers = Timers; const cTimers *timers = Timers;
if (timers->GetMatch(event, &TimerMatch) && (TimerMatch == tmFull)) if (timers->GetMatch(event, &TimerMatch) && (TimerMatch == tmFull))
hasTimer = true; hasTimer = true;
#else #else
} else if (column->HasTimer()) { } else if (column->HasTimer()) {
hasTimer = event->HasTimer(); hasTimer = event->HasTimer();
#endif #endif
} }
} }
void cEpgGrid::SetSwitchTimer() { void cEpgGrid::SetSwitchTimer() {
if (column->HasSwitchTimer()) { if (column->HasSwitchTimer()) {
hasSwitchTimer = SwitchTimers.EventInSwitchList(event); hasSwitchTimer = SwitchTimers.EventInSwitchList(event);
} else { } else {
hasSwitchTimer = false; hasSwitchTimer = false;
} }
} }
void cEpgGrid::setText() { void cEpgGrid::setText() {
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
cString strText; cString strText;
strText = cString::sprintf("%s - %s:\n%s", *(event->GetTimeString()), *(event->GetEndTimeString()), event->Title()); strText = cString::sprintf("%s - %s:\n%s", *(event->GetTimeString()), *(event->GetEndTimeString()), event->Title());
text->Set(*(strText), fontManager.FontGrid, geoManager.colWidth-2*borderWidth); text->Set(*(strText), fontManager.FontGrid, geoManager.colWidth-2*borderWidth);
extText->Set(event->ShortText(), fontManager.FontGridSmall, geoManager.colWidth-2*borderWidth); extText->Set(event->ShortText(), fontManager.FontGridSmall, geoManager.colWidth-2*borderWidth);
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
timeString = cString::sprintf("%s - %s", *(event->GetTimeString()), *(event->GetEndTimeString())); timeString = cString::sprintf("%s - %s", *(event->GetTimeString()), *(event->GetEndTimeString()));
} }
} }
void cEpgGrid::drawText() { void cEpgGrid::drawText() {
tColor colorText = (active)?theme.Color(clrFontActive):theme.Color(clrFont); tColor colorText = (active)?theme.Color(clrFontActive):theme.Color(clrFont);
tColor colorTextBack; tColor colorTextBack;
if (tvguideConfig.style == eStyleFlat) if (tvguideConfig.style == eStyleFlat)
colorTextBack = color; colorTextBack = color;
else if (tvguideConfig.style == eStyleGraphical) else if (tvguideConfig.style == eStyleGraphical)
colorTextBack = (active)?theme.Color(clrGridActiveFontBack):theme.Color(clrGridFontBack); colorTextBack = (active)?theme.Color(clrGridActiveFontBack):theme.Color(clrGridFontBack);
else else
colorTextBack = clrTransparent; colorTextBack = clrTransparent;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
if (Height()/geoManager.minutePixel < 6) if (Height()/geoManager.minutePixel < 6)
return; return;
int textHeight = fontManager.FontGrid->Height(); int textHeight = fontManager.FontGrid->Height();
int textLines = text->Lines(); int textLines = text->Lines();
for (int i=0; i<textLines; i++) { for (int i=0; i<textLines; i++) {
pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), colorText, colorTextBack, fontManager.FontGrid); pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), colorText, colorTextBack, fontManager.FontGrid);
} }
int extTextLines = extText->Lines(); int extTextLines = extText->Lines();
int offset = (textLines+1)*textHeight - 0.5*textHeight; int offset = (textLines+1)*textHeight - 0.5*textHeight;
textHeight = fontManager.FontGridSmall->Height(); textHeight = fontManager.FontGridSmall->Height();
if ((Height()-textHeight-10) > offset) { if ((Height()-textHeight-10) > offset) {
for (int i=0; i<extTextLines; i++) { for (int i=0; i<extTextLines; i++) {
pixmap->DrawText(cPoint(borderWidth, borderWidth + offset + i*textHeight), extText->GetLine(i), colorText, colorTextBack, fontManager.FontGridSmall); pixmap->DrawText(cPoint(borderWidth, borderWidth + offset + i*textHeight), extText->GetLine(i), colorText, colorTextBack, fontManager.FontGridSmall);
} }
} }
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
if (Width()/geoManager.minutePixel < 10) { if (Width()/geoManager.minutePixel < 10) {
int titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2; int titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2;
pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, fontManager.FontGridHorizontal); pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, fontManager.FontGridHorizontal);
return; return;
} }
cString strTitle = CutText(event->Title(), viewportHeight, fontManager.FontGridHorizontal).c_str(); cString strTitle = CutText(event->Title(), viewportHeight, fontManager.FontGridHorizontal).c_str();
int titleY = 0; int titleY = 0;
if (tvguideConfig.showTimeInGrid) { if (tvguideConfig.showTimeInGrid) {
pixmap->DrawText(cPoint(borderWidth, borderWidth), *timeString, colorText, colorTextBack, fontManager.FontGridHorizontalSmall); pixmap->DrawText(cPoint(borderWidth, borderWidth), *timeString, colorText, colorTextBack, fontManager.FontGridHorizontalSmall);
titleY = fontManager.FontGridHorizontalSmall->Height() + (geoManager.rowHeight - fontManager.FontGridHorizontalSmall->Height() - fontManager.FontGridHorizontal->Height())/2; titleY = fontManager.FontGridHorizontalSmall->Height() + (geoManager.rowHeight - fontManager.FontGridHorizontalSmall->Height() - fontManager.FontGridHorizontal->Height())/2;
} else { } else {
titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2; titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2;
} }
pixmap->DrawText(cPoint(borderWidth, titleY), *strTitle, colorText, colorTextBack, fontManager.FontGridHorizontal); pixmap->DrawText(cPoint(borderWidth, titleY), *strTitle, colorText, colorTextBack, fontManager.FontGridHorizontal);
} }
if (hasSwitchTimer) if (hasSwitchTimer)
drawIcon("Switch", theme.Color(clrButtonYellow)); drawIcon("Switch", theme.Color(clrButtonYellow));
if (hasTimer) { if (hasTimer) {
const cTimer *timer = NULL; const cTimer *timer = NULL;
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
{ {
LOCK_TIMERS_READ; LOCK_TIMERS_READ;
timer = Timers->GetMatch(event); timer = Timers->GetMatch(event);
} }
#else #else
timer = Timers.GetMatch(event); timer = Timers.GetMatch(event);
#endif #endif
if (timer) if (timer)
#ifdef SWITCHONLYPATCH #ifdef SWITCHONLYPATCH
if (timer->HasFlags(tfSwitchOnly)) if (timer->HasFlags(tfSwitchOnly))
drawIcon("Switch", theme.Color(clrButtonYellow)); drawIcon("Switch", theme.Color(clrButtonYellow));
else if (timer->HasFlags(tfActive)) else if (timer->HasFlags(tfActive))
#else /* SWITCHONLY */ #else /* SWITCHONLY */
if (timer->HasFlags(tfActive)) if (timer->HasFlags(tfActive))
#endif /* SWITCHONLY */ #endif /* SWITCHONLY */
drawIcon("REC", theme.Color(clrButtonRed)); drawIcon("REC", theme.Color(clrButtonRed));
else else
drawIcon("REC", theme.Color(clrButtonGreen)); drawIcon("REC", theme.Color(clrButtonGreen));
} }
} }
void cEpgGrid::drawIcon(cString iconText, tColor color) { void cEpgGrid::drawIcon(cString iconText, tColor color) {
const cFont *font = (tvguideConfig.displayMode == eVertical) const cFont *font = (tvguideConfig.displayMode == eVertical)
?fontManager.FontGrid ?fontManager.FontGrid
:fontManager.FontGridHorizontalSmall; :fontManager.FontGridHorizontalSmall;
int textWidth = font->Width(*iconText)+2*borderWidth; int textWidth = font->Width(*iconText)+2*borderWidth;
int textHeight = font->Height()+10; int textHeight = font->Height()+10;
pixmap->DrawRectangle( cRect(Width() - textWidth - borderWidth, Height() - textHeight - borderWidth, textWidth, textHeight), color); pixmap->DrawRectangle( cRect(Width() - textWidth - borderWidth, Height() - textHeight - borderWidth, textWidth, textHeight), color);
pixmap->DrawText(cPoint(Width() - textWidth, Height() - textHeight - borderWidth/2), *iconText, theme.Color(clrFont), color, font); pixmap->DrawText(cPoint(Width() - textWidth, Height() - textHeight - borderWidth/2), *iconText, theme.Color(clrFont), color, font);
} }
cString cEpgGrid::getTimeString(void) { cString cEpgGrid::getTimeString(void) {
return cString::sprintf("%s - %s", *(event->GetTimeString()), *(event->GetEndTimeString())); return cString::sprintf("%s - %s", *(event->GetTimeString()), *(event->GetEndTimeString()));
} }
void cEpgGrid::debug() { void cEpgGrid::debug() {
esyslog("tvguide epggrid: %s: %s, %s, viewportHeight: %d px, Duration: %d min, active: %d", esyslog("tvguide epggrid: %s: %s, %s, viewportHeight: %d px, Duration: %d min, active: %d",
column->Name(), column->Name(),
*(event->GetTimeString()), *(event->GetTimeString()),
event->Title(), event->Title(),
viewportHeight, viewportHeight,
event->Duration()/60, event->Duration()/60,
active); active);
} }

View File

@ -1,33 +1,33 @@
#ifndef __TVGUIDE_EPGGRID_H #ifndef __TVGUIDE_EPGGRID_H
#define __TVGUIDE_EPGGRID_H #define __TVGUIDE_EPGGRID_H
#include <vdr/epg.h> #include <vdr/epg.h>
#include "grid.h" #include "grid.h"
// --- cEpgGrid ------------------------------------------------------------- // --- cEpgGrid -------------------------------------------------------------
class cEpgGrid : public cGrid { class cEpgGrid : public cGrid {
private: private:
const cTimer *timer; const cTimer *timer;
const cEvent *event; const cEvent *event;
cTextWrapper *extText; cTextWrapper *extText;
cString timeString; cString timeString;
void drawText(); void drawText();
void drawIcon(cString iconText, tColor color); void drawIcon(cString iconText, tColor color);
time_t Duration(void) { return event->Duration(); }; time_t Duration(void) { return event->Duration(); };
public: public:
cEpgGrid(cChannelColumn *c, const cEvent *event); cEpgGrid(cChannelColumn *c, const cEvent *event);
virtual ~cEpgGrid(void); virtual ~cEpgGrid(void);
void SetViewportHeight(); void SetViewportHeight();
void PositionPixmap(); void PositionPixmap();
void setText(void); void setText(void);
const cEvent *GetEvent() {return event;}; const cEvent *GetEvent() {return event;};
time_t StartTime() { return event->StartTime(); }; time_t StartTime() { return event->StartTime(); };
time_t EndTime() { return event->EndTime(); }; time_t EndTime() { return event->EndTime(); };
void SetTimer(); void SetTimer();
void SetSwitchTimer(); void SetSwitchTimer();
cString getTimeString(void); cString getTimeString(void);
void debug(); void debug();
}; };
#endif //__TVGUIDE_EPGGRID_H #endif //__TVGUIDE_EPGGRID_H

View File

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

View File

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

334
footer.c
View File

@ -1,167 +1,167 @@
#include <string> #include <string>
#include "imageloader.h" #include "imageloader.h"
#include "tools.h" #include "tools.h"
#include "footer.h" #include "footer.h"
cFooter::cFooter(cChannelGroups *channelGroups) { cFooter::cFooter(cChannelGroups *channelGroups) {
this->channelGroups = channelGroups; this->channelGroups = channelGroups;
currentGroup = -1; currentGroup = -1;
buttonY = (geoManager.footerHeight - geoManager.buttonHeight)/2; buttonY = (geoManager.footerHeight - geoManager.buttonHeight)/2;
SetButtonPositions(); SetButtonPositions();
footer = osdManager.requestPixmap(2, cRect( 0, footer = osdManager.requestPixmap(2, cRect( 0,
geoManager.footerY, geoManager.footerY,
geoManager.osdWidth, geoManager.osdWidth,
geoManager.footerHeight), geoManager.footerHeight),
cRect::Null); cRect::Null);
footer->Fill(clrTransparent); footer->Fill(clrTransparent);
} }
cFooter::~cFooter(void) { cFooter::~cFooter(void) {
osdManager.releasePixmap(footer); osdManager.releasePixmap(footer);
} }
void cFooter::drawRedButton() { void cFooter::drawRedButton() {
cString text(tr("Search & Rec")); cString text(tr("Search & Rec"));
DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), oeButtonRed, positionButtons[0]); DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), oeButtonRed, positionButtons[0]);
} }
void cFooter::drawGreenButton() { void cFooter::drawGreenButton() {
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels back")); cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels back"));
DrawButton(*text, theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), oeButtonGreen, positionButtons[1]); DrawButton(*text, theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), oeButtonGreen, positionButtons[1]);
} }
void cFooter::drawGreenButton(const char *text) { void cFooter::drawGreenButton(const char *text) {
std::string cuttedText = CutText(text, geoManager.buttonWidth-6, fontManager.FontButton); std::string cuttedText = CutText(text, geoManager.buttonWidth-6, fontManager.FontButton);
DrawButton(cuttedText.c_str(), theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), oeButtonGreen, positionButtons[1]); DrawButton(cuttedText.c_str(), theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), oeButtonGreen, positionButtons[1]);
} }
void cFooter::drawYellowButton() { void cFooter::drawYellowButton() {
cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward")); cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward"));
DrawButton(*text, theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), oeButtonYellow, positionButtons[2]); DrawButton(*text, theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), oeButtonYellow, positionButtons[2]);
} }
void cFooter::drawYellowButton(const char *text) { void cFooter::drawYellowButton(const char *text) {
std::string cuttedText = CutText(text, geoManager.buttonWidth-6, fontManager.FontButton); std::string cuttedText = CutText(text, geoManager.buttonWidth-6, fontManager.FontButton);
DrawButton(cuttedText.c_str(), theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), oeButtonYellow, positionButtons[2]); DrawButton(cuttedText.c_str(), theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), oeButtonYellow, positionButtons[2]);
} }
void cFooter::drawBlueButton(bool detailedEPG) { void cFooter::drawBlueButton(bool detailedEPG) {
cString text; cString text;
if (tvguideConfig.blueKeyMode == eBlueKeySwitch) if (tvguideConfig.blueKeyMode == eBlueKeySwitch)
text = tr("Switch to Channel"); text = tr("Switch to Channel");
else if (tvguideConfig.blueKeyMode == eBlueKeyEPG) { else if (tvguideConfig.blueKeyMode == eBlueKeyEPG) {
if (!detailedEPG) if (!detailedEPG)
text = tr("Detailed EPG"); text = tr("Detailed EPG");
else else
text = tr("Close detailed EPG"); text = tr("Close detailed EPG");
} else if (tvguideConfig.blueKeyMode == eBlueKeyFavorites) { } else if (tvguideConfig.blueKeyMode == eBlueKeyFavorites) {
if (!detailedEPG) if (!detailedEPG)
text = tr("Favorites"); text = tr("Favorites");
else else
text = tr("Switch to Channel"); text = tr("Switch to Channel");
} }
DrawButton(*text, theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBorder), oeButtonBlue, positionButtons[3]); DrawButton(*text, theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBorder), oeButtonBlue, positionButtons[3]);
} }
void cFooter::UpdateGroupButtons(const cChannel *channel, bool force) { void cFooter::UpdateGroupButtons(const cChannel *channel, bool force) {
if (!channel) if (!channel)
return; return;
int group = channelGroups->GetGroup(channel); int group = channelGroups->GetGroup(channel);
if ((group != currentGroup) || force) { if ((group != currentGroup) || force) {
currentGroup = group; currentGroup = group;
drawGreenButton(channelGroups->GetPrev(group)); drawGreenButton(channelGroups->GetPrev(group));
drawYellowButton(channelGroups->GetNext(group)); drawYellowButton(channelGroups->GetNext(group));
} }
} }
void cFooter::SetDetailedViewMode(bool fromRecMenu) { void cFooter::SetDetailedViewMode(bool fromRecMenu) {
ClearButton(positionButtons[1]); ClearButton(positionButtons[1]);
ClearButton(positionButtons[2]); ClearButton(positionButtons[2]);
if (fromRecMenu) { if (fromRecMenu) {
ClearButton(positionButtons[0]); ClearButton(positionButtons[0]);
ClearButton(positionButtons[3]); ClearButton(positionButtons[3]);
} else if (tvguideConfig.blueKeyMode != eBlueKeySwitch) { } else if (tvguideConfig.blueKeyMode != eBlueKeySwitch) {
ClearButton(positionButtons[3]); ClearButton(positionButtons[3]);
drawBlueButton(true); drawBlueButton(true);
} }
} }
void cFooter::LeaveDetailedViewMode(const cChannel *channel) { void cFooter::LeaveDetailedViewMode(const cChannel *channel) {
drawRedButton(); drawRedButton();
drawBlueButton(); drawBlueButton();
if (tvguideConfig.channelJumpMode == eNumJump) { if (tvguideConfig.channelJumpMode == eNumJump) {
drawGreenButton(); drawGreenButton();
drawYellowButton(); drawYellowButton();
} else { } else {
UpdateGroupButtons(channel, true); UpdateGroupButtons(channel, true);
} }
} }
void cFooter::SetButtonPositions(void) { void cFooter::SetButtonPositions(void) {
for (int i=0; i < 4; i++) { for (int i=0; i < 4; i++) {
positionButtons[i] = -1; positionButtons[i] = -1;
} }
/* /*
red button = 0 red button = 0
green button = 1 green button = 1
yellow button = 2 yellow button = 2
blue button = 3 blue button = 3
*/ */
for (int button=0; button<4; button++) { for (int button=0; button<4; button++) {
if (Setup.ColorKey0 == button) { if (Setup.ColorKey0 == button) {
positionButtons[button] = 0; positionButtons[button] = 0;
continue; continue;
} }
if (Setup.ColorKey1 == button) { if (Setup.ColorKey1 == button) {
positionButtons[button] = 1; positionButtons[button] = 1;
continue; continue;
} }
if (Setup.ColorKey2 == button) { if (Setup.ColorKey2 == button) {
positionButtons[button] = 2; positionButtons[button] = 2;
continue; continue;
} }
if (Setup.ColorKey3 == button) { if (Setup.ColorKey3 == button) {
positionButtons[button] = 3; positionButtons[button] = 3;
continue; continue;
} }
} }
} }
void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, eOsdElementType buttonType, int num) { void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, eOsdElementType buttonType, int num) {
tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent;
int left = num * geoManager.buttonWidth + (2 * num + 1) * geoManager.buttonBorder; int left = num * geoManager.buttonWidth + (2 * num + 1) * geoManager.buttonBorder;
if ((tvguideConfig.style == eStyleBlendingMagick) || (tvguideConfig.style == eStyleBlendingDefault)) { if ((tvguideConfig.style == eStyleBlendingMagick) || (tvguideConfig.style == eStyleBlendingDefault)) {
cImageLoader imgLoader; cImageLoader imgLoader;
imgLoader.DrawBackground(theme.Color(clrButtonBlend), color, geoManager.buttonWidth-4, geoManager.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->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor);
footer->DrawImage(cPoint(left+2, buttonY+2), imgLoader.GetImage()); footer->DrawImage(cPoint(left+2, buttonY+2), imgLoader.GetImage());
if (tvguideConfig.roundedCorners) { if (tvguideConfig.roundedCorners) {
int borderRadius = 12; int borderRadius = 12;
int borderWidth = 2; int borderWidth = 2;
DrawRoundedCorners(footer, left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight, borderRadius, borderWidth, borderColor); DrawRoundedCorners(footer, left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight, borderRadius, borderWidth, borderColor);
} }
} else if (tvguideConfig.style == eStyleGraphical) { } else if (tvguideConfig.style == eStyleGraphical) {
cImage *button = imgCache.GetOsdElement(buttonType); cImage *button = imgCache.GetOsdElement(buttonType);
if (button) { if (button) {
footer->DrawImage(cPoint(left, buttonY), *button); footer->DrawImage(cPoint(left, buttonY), *button);
} }
} else { } else {
footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor); footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor);
footer->DrawRectangle(cRect(left+1, buttonY+1, geoManager.buttonWidth-2, geoManager.buttonHeight-2), color); footer->DrawRectangle(cRect(left+1, buttonY+1, geoManager.buttonWidth-2, geoManager.buttonHeight-2), color);
if (tvguideConfig.roundedCorners) { if (tvguideConfig.roundedCorners) {
int borderRadius = 12; int borderRadius = 12;
int borderWidth = 1; int borderWidth = 1;
DrawRoundedCorners(footer, left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight, borderRadius, borderWidth, borderColor); DrawRoundedCorners(footer, left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight, borderRadius, borderWidth, borderColor);
} }
} }
int textWidth = fontManager.FontButton->Width(text); int textWidth = fontManager.FontButton->Width(text);
int textHeight = fontManager.FontButton->Height(); 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); footer->DrawText(cPoint(left + (geoManager.buttonWidth-textWidth)/2, buttonY + (geoManager.buttonHeight-textHeight)/2), text, theme.Color(clrFontButtons), colorTextBack, fontManager.FontButton);
} }
void cFooter::ClearButton(int num) { void cFooter::ClearButton(int num) {
int left = num * geoManager.buttonWidth + (2 * num + 1) * geoManager.buttonBorder; int left = num * geoManager.buttonWidth + (2 * num + 1) * geoManager.buttonBorder;
footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), clrTransparent); footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), clrTransparent);
} }

View File

@ -30,4 +30,4 @@ public:
void LeaveDetailedViewMode(const cChannel *channel); void LeaveDetailedViewMode(const cChannel *channel);
}; };
#endif //__TVGUIDE_FOOTER_H #endif //__TVGUIDE_FOOTER_H

View File

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

View File

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

164
grid.c
View File

@ -1,82 +1,82 @@
#include "channelcolumn.h" #include "channelcolumn.h"
#include "grid.h" #include "grid.h"
cGrid::cGrid(cChannelColumn *c) { cGrid::cGrid(cChannelColumn *c) {
this->column = c; this->column = c;
text = new cTextWrapper(); text = new cTextWrapper();
dirty = true; dirty = true;
active = false; active = false;
viewportHeight = 0; viewportHeight = 0;
borderWidth = 10; borderWidth = 10;
} }
cGrid::~cGrid(void) { cGrid::~cGrid(void) {
delete text; delete text;
} }
void cGrid::setBackground() { void cGrid::setBackground() {
if (active) { if (active) {
color = theme.Color(clrHighlight); color = theme.Color(clrHighlight);
colorBlending = theme.Color(clrHighlightBlending); colorBlending = theme.Color(clrHighlightBlending);
} else { } else {
if (isColor1) { if (isColor1) {
color = theme.Color(clrGrid1); color = theme.Color(clrGrid1);
colorBlending = theme.Color(clrGrid1Blending); colorBlending = theme.Color(clrGrid1Blending);
} else { } else {
color = theme.Color(clrGrid2); color = theme.Color(clrGrid2);
colorBlending = theme.Color(clrGrid2Blending); colorBlending = theme.Color(clrGrid2Blending);
} }
} }
} }
void cGrid::Draw() { void cGrid::Draw() {
if (!pixmap) { if (!pixmap) {
return; return;
} }
if (dirty) { if (dirty) {
if (tvguideConfig.style == eStyleGraphical) { if (tvguideConfig.style == eStyleGraphical) {
drawBackgroundGraphical(bgGrid, active); drawBackgroundGraphical(bgGrid, active);
drawText(); drawText();
} else { } else {
setBackground(); setBackground();
drawBackground(); drawBackground();
drawText(); drawText();
drawBorder(); drawBorder();
} }
pixmap->SetLayer(1); pixmap->SetLayer(1);
dirty = false; dirty = false;
} }
} }
bool cGrid::isFirst(void) { bool cGrid::isFirst(void) {
if (column->isFirst(this)) if (column->isFirst(this))
return true; return true;
return false; return false;
} }
bool cGrid::Match(time_t t) { bool cGrid::Match(time_t t) {
if ((StartTime() < t) && (EndTime() > t)) if ((StartTime() < t) && (EndTime() > t))
return true; return true;
else else
return false; return false;
} }
int cGrid::calcOverlap(cGrid *neighbor) { int cGrid::calcOverlap(cGrid *neighbor) {
int overlap = 0; int overlap = 0;
if (intersects(neighbor)) { if (intersects(neighbor)) {
if ((StartTime() <= neighbor->StartTime()) && (EndTime() <= neighbor->EndTime())) { if ((StartTime() <= neighbor->StartTime()) && (EndTime() <= neighbor->EndTime())) {
overlap = EndTime() - neighbor->StartTime(); overlap = EndTime() - neighbor->StartTime();
} else if ((StartTime() >= neighbor->StartTime()) && (EndTime() >= neighbor->EndTime())) { } else if ((StartTime() >= neighbor->StartTime()) && (EndTime() >= neighbor->EndTime())) {
overlap = neighbor->EndTime() - StartTime(); overlap = neighbor->EndTime() - StartTime();
} else if ((StartTime() >= neighbor->StartTime()) && (EndTime() <= neighbor->EndTime())) { } else if ((StartTime() >= neighbor->StartTime()) && (EndTime() <= neighbor->EndTime())) {
overlap = Duration(); overlap = Duration();
} else if ((StartTime() <= neighbor->StartTime()) && (EndTime() >= neighbor->EndTime())) { } else if ((StartTime() <= neighbor->StartTime()) && (EndTime() >= neighbor->EndTime())) {
overlap = neighbor->EndTime() - neighbor->StartTime(); overlap = neighbor->EndTime() - neighbor->StartTime();
} }
} }
return overlap; return overlap;
} }
bool cGrid::intersects(cGrid *neighbor) { bool cGrid::intersects(cGrid *neighbor) {
return ! ( (neighbor->EndTime() <= StartTime()) || (neighbor->StartTime() >= EndTime()) ); return ! ( (neighbor->EndTime() <= StartTime()) || (neighbor->StartTime() >= EndTime()) );
} }

116
grid.h
View File

@ -1,58 +1,58 @@
#ifndef __TVGUIDE_GRID_H #ifndef __TVGUIDE_GRID_H
#define __TVGUIDE_GRID_H #define __TVGUIDE_GRID_H
#include <vdr/tools.h> #include <vdr/tools.h>
#include "styledpixmap.h" #include "styledpixmap.h"
class cChannelColumn; class cChannelColumn;
// --- cEpgGrid ------------------------------------------------------------- // --- cEpgGrid -------------------------------------------------------------
class cGrid : public cListObject, public cStyledPixmap { class cGrid : public cListObject, public cStyledPixmap {
protected: protected:
cTextWrapper *text; cTextWrapper *text;
int viewportHeight; int viewportHeight;
int borderWidth; int borderWidth;
void setBackground(); void setBackground();
bool isColor1; bool isColor1;
bool active; bool active;
bool dirty; bool dirty;
bool hasTimer; bool hasTimer;
bool hasSwitchTimer; bool hasSwitchTimer;
bool intersects(cGrid *neighbor); bool intersects(cGrid *neighbor);
virtual time_t Duration(void) { return 0; }; virtual time_t Duration(void) { return 0; };
virtual void drawText(void) {}; virtual void drawText(void) {};
bool dummy; bool dummy;
public: public:
cGrid(cChannelColumn *c); cGrid(cChannelColumn *c);
virtual ~cGrid(void); virtual ~cGrid(void);
cChannelColumn *column; cChannelColumn *column;
virtual void SetViewportHeight(void) {}; virtual void SetViewportHeight(void) {};
virtual void PositionPixmap(void) {}; virtual void PositionPixmap(void) {};
virtual void setText(void) {}; virtual void setText(void) {};
void Draw(void); void Draw(void);
void SetDirty(void) {dirty = true;}; void SetDirty(void) {dirty = true;};
void SetActive(void) {dirty = true; active = true;}; void SetActive(void) {dirty = true; active = true;};
void SetInActive(void) {dirty = true; active = false;}; void SetInActive(void) {dirty = true; active = false;};
void SetColor(bool color) {isColor1 = color;}; void SetColor(bool color) {isColor1 = color;};
bool IsColor1(void) {return isColor1;}; bool IsColor1(void) {return isColor1;};
bool isFirst(void); bool isFirst(void);
virtual const cEvent *GetEvent(void) { return NULL; }; virtual const cEvent *GetEvent(void) { return NULL; };
bool Match(time_t t); bool Match(time_t t);
virtual time_t StartTime(void) { return 0; }; virtual time_t StartTime(void) { return 0; };
virtual time_t EndTime(void) { return 0; }; virtual time_t EndTime(void) { return 0; };
virtual void SetStartTime(time_t start) {}; virtual void SetStartTime(time_t start) {};
virtual void SetEndTime(time_t end) {}; virtual void SetEndTime(time_t end) {};
int calcOverlap(cGrid *neighbor); int calcOverlap(cGrid *neighbor);
virtual void SetTimer(void) {}; virtual void SetTimer(void) {};
virtual void SetSwitchTimer(void) {}; virtual void SetSwitchTimer(void) {};
virtual cString getText(void) { return cString("");}; virtual cString getText(void) { return cString("");};
virtual cString getTimeString(void) { return cString("");}; virtual cString getTimeString(void) { return cString("");};
bool Active(void) { return active; }; bool Active(void) { return active; };
bool HasTimer(void) {return hasTimer;}; bool HasTimer(void) {return hasTimer;};
bool HasSwitchTimer(void) {return hasSwitchTimer;}; bool HasSwitchTimer(void) {return hasSwitchTimer;};
bool isDummy(void) { return dummy; }; bool isDummy(void) { return dummy; };
virtual void debug() {}; virtual void debug() {};
}; };
#endif //__TVGUIDE_GRID_H #endif //__TVGUIDE_GRID_H

View File

@ -1,134 +1,134 @@
#include "imageloader.h" #include "imageloader.h"
#include "tools.h" #include "tools.h"
#include "headergrid.h" #include "headergrid.h"
cHeaderGrid::cHeaderGrid(void) : cGrid(NULL) { cHeaderGrid::cHeaderGrid(void) : cGrid(NULL) {
pixmap = NULL; pixmap = NULL;
pixmapLogo = NULL; pixmapLogo = NULL;
} }
cHeaderGrid::~cHeaderGrid(void) { cHeaderGrid::~cHeaderGrid(void) {
osdManager.releasePixmap(pixmapLogo); osdManager.releasePixmap(pixmapLogo);
} }
void cHeaderGrid::createBackground(int num) { void cHeaderGrid::createBackground(int num) {
color = theme.Color(clrHeader); color = theme.Color(clrHeader);
colorBlending = theme.Color(clrHeaderBlending); colorBlending = theme.Color(clrHeaderBlending);
int x, y; int x, y;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
x = geoManager.timeLineWidth + num*geoManager.colWidth; x = geoManager.timeLineWidth + num*geoManager.colWidth;
y = geoManager.statusHeaderHeight + geoManager.channelGroupsHeight; y = geoManager.statusHeaderHeight + geoManager.channelGroupsHeight;
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
x = geoManager.channelGroupsWidth; x = geoManager.channelGroupsWidth;
y = geoManager.statusHeaderHeight + geoManager.timeLineHeight + num*geoManager.rowHeight; y = geoManager.statusHeaderHeight + geoManager.timeLineHeight + num*geoManager.rowHeight;
} }
pixmap = osdManager.requestPixmap(1, cRect(x, y, geoManager.channelLogoWidth, geoManager.channelLogoHeight)); pixmap = osdManager.requestPixmap(1, cRect(x, y, geoManager.channelLogoWidth, geoManager.channelLogoHeight));
pixmapLogo = osdManager.requestPixmap(2, cRect(x, y, geoManager.channelLogoWidth, geoManager.channelLogoHeight)); pixmapLogo = osdManager.requestPixmap(2, cRect(x, y, geoManager.channelLogoWidth, geoManager.channelLogoHeight));
if ((!pixmap) || (!pixmapLogo)){ if ((!pixmap) || (!pixmapLogo)){
return; return;
} }
pixmapLogo->Fill(clrTransparent); pixmapLogo->Fill(clrTransparent);
if (tvguideConfig.style == eStyleGraphical) { if (tvguideConfig.style == eStyleGraphical) {
drawBackgroundGraphical(bgChannelHeader); drawBackgroundGraphical(bgChannelHeader);
} else { } else {
drawBackground(); drawBackground();
drawBorder(); drawBorder();
} }
} }
void cHeaderGrid::drawChannel(const cChannel *channel) { void cHeaderGrid::drawChannel(const cChannel *channel) {
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
drawChannelVertical(channel); drawChannelVertical(channel);
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
drawChannelHorizontal(channel); drawChannelHorizontal(channel);
} }
} }
// Draw Channel horizontal view // Draw Channel horizontal view
void cHeaderGrid::drawChannelHorizontal(const cChannel *channel) { void cHeaderGrid::drawChannelHorizontal(const cChannel *channel) {
int logoWidth = geoManager.logoWidth; int logoWidth = geoManager.logoWidth;
int logoX = tvguideConfig.displayChannelName ? 5 : (Width() - logoWidth) / 2; int logoX = tvguideConfig.displayChannelName ? 5 : (Width() - logoWidth) / 2;
int textX = 5; int textX = 5;
int textY = (Height() - fontManager.FontChannelHeaderHorizontal->Height()) / 2; int textY = (Height() - fontManager.FontChannelHeaderHorizontal->Height()) / 2;
bool logoFound = false; bool logoFound = false;
if (!tvguideConfig.hideChannelLogos) { if (!tvguideConfig.hideChannelLogos) {
cImage *logo = imgCache.GetLogo(channel); cImage *logo = imgCache.GetLogo(channel);
if (logo) { if (logo) {
const int logoheight = logo->Height(); const int logoheight = logo->Height();
pixmapLogo->DrawImage(cPoint(logoX, (Height() - logoheight) / 2), *logo); pixmapLogo->DrawImage(cPoint(logoX, (Height() - logoheight) / 2), *logo);
logoFound = true; logoFound = true;
} }
} }
bool drawText = false; bool drawText = false;
int textWidthMax = Width() - 10; int textWidthMax = Width() - 10;
if (!logoFound) { if (!logoFound) {
drawText = true; drawText = true;
} }
if (tvguideConfig.displayChannelName) { if (tvguideConfig.displayChannelName) {
drawText = true; drawText = true;
textX += logoWidth + 5; textX += logoWidth + 5;
textWidthMax -= textX; textWidthMax -= textX;
} }
if (drawText) { if (drawText) {
tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent;
cString strChannel = cString::sprintf("%d %s", channel->Number(), channel->Name()); cString strChannel = cString::sprintf("%d %s", channel->Number(), channel->Name());
strChannel = CutText(*strChannel, textWidthMax, fontManager.FontChannelHeaderHorizontal).c_str(); strChannel = CutText(*strChannel, textWidthMax, fontManager.FontChannelHeaderHorizontal).c_str();
pixmap->DrawText(cPoint(textX, textY), *strChannel, theme.Color(clrFontHeader), colorTextBack, fontManager.FontChannelHeaderHorizontal); pixmap->DrawText(cPoint(textX, textY), *strChannel, theme.Color(clrFontHeader), colorTextBack, fontManager.FontChannelHeaderHorizontal);
} }
} }
// Draw Channel vertical view // Draw Channel vertical view
void cHeaderGrid::drawChannelVertical(const cChannel *channel) { void cHeaderGrid::drawChannelVertical(const cChannel *channel) {
int logoWidth = geoManager.logoWidth; int logoWidth = geoManager.logoWidth;
int logoHeight = geoManager.logoHeight; int logoHeight = geoManager.logoHeight;
cTextWrapper tw; cTextWrapper tw;
cString headerText = cString::sprintf("%d - %s", channel->Number(), channel->Name()); cString headerText = cString::sprintf("%d - %s", channel->Number(), channel->Name());
tw.Set(*headerText, fontManager.FontChannelHeader, geoManager.colWidth - 8); tw.Set(*headerText, fontManager.FontChannelHeader, geoManager.colWidth - 8);
int lines = tw.Lines(); int lines = tw.Lines();
int lineHeight = fontManager.FontChannelHeader->Height(); int lineHeight = fontManager.FontChannelHeader->Height();
int yStart = (geoManager.channelHeaderHeight - lines * lineHeight) / 2 + 8; int yStart = (geoManager.channelHeaderHeight - lines * lineHeight) / 2 + 8;
bool logoFound = false; bool logoFound = false;
if (!tvguideConfig.hideChannelLogos) { if (!tvguideConfig.hideChannelLogos) {
cImage *logo = imgCache.GetLogo(channel); cImage *logo = imgCache.GetLogo(channel);
if (logo) { if (logo) {
pixmapLogo->DrawImage(cPoint((Width() - logoWidth) / 2, 6), *logo); pixmapLogo->DrawImage(cPoint((Width() - logoWidth) / 2, 6), *logo);
logoFound = true; logoFound = true;
} }
} }
bool drawText = false; bool drawText = false;
if (!logoFound) { if (!logoFound) {
drawText = true; drawText = true;
} else if (tvguideConfig.displayChannelName) { } else if (tvguideConfig.displayChannelName) {
drawText = true; drawText = true;
yStart = logoHeight; yStart = logoHeight;
} }
if (!drawText) if (!drawText)
return; return;
tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent;
for (int i = 0; i < lines; i++) { for (int i = 0; i < lines; i++) {
int textWidth = fontManager.FontChannelHeader->Width(tw.GetLine(i)); int textWidth = fontManager.FontChannelHeader->Width(tw.GetLine(i));
int xText = (geoManager.colWidth - textWidth) / 2; int xText = (geoManager.colWidth - textWidth) / 2;
if (xText < 0) if (xText < 0)
xText = 0; xText = 0;
pixmap->DrawText(cPoint(xText, yStart + i * lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), colorTextBack, fontManager.FontChannelHeader); pixmap->DrawText(cPoint(xText, yStart + i * lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), colorTextBack, fontManager.FontChannelHeader);
} }
} }
void cHeaderGrid::setPosition(int num) { void cHeaderGrid::setPosition(int num) {
int x, y, width, height; int x, y, width, height;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
x = geoManager.timeLineWidth + num*geoManager.colWidth; x = geoManager.timeLineWidth + num*geoManager.colWidth;
y = geoManager.statusHeaderHeight + geoManager.channelGroupsHeight; y = geoManager.statusHeaderHeight + geoManager.channelGroupsHeight;
width = geoManager.colWidth; width = geoManager.colWidth;
height = geoManager.channelHeaderHeight; height = geoManager.channelHeaderHeight;
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
x = geoManager.channelGroupsWidth; x = geoManager.channelGroupsWidth;
y = geoManager.statusHeaderHeight + geoManager.timeLineHeight + num*geoManager.rowHeight; y = geoManager.statusHeaderHeight + geoManager.timeLineHeight + num*geoManager.rowHeight;
width = geoManager.channelHeaderWidth; width = geoManager.channelHeaderWidth;
height = geoManager.rowHeight; height = geoManager.rowHeight;
} }
pixmap->SetViewPort(cRect(x, y, width, height)); pixmap->SetViewPort(cRect(x, y, width, height));
pixmapLogo->SetViewPort(cRect(x, y, width, height)); pixmapLogo->SetViewPort(cRect(x, y, width, height));
} }

View File

@ -1,21 +1,21 @@
#ifndef __TVGUIDE_HEADERGRID_H #ifndef __TVGUIDE_HEADERGRID_H
#define __TVGUIDE_HEADERGRID_H #define __TVGUIDE_HEADERGRID_H
#include "grid.h" #include "grid.h"
// --- cHeaderGrid ------------------------------------------------------------- // --- cHeaderGrid -------------------------------------------------------------
class cHeaderGrid : public cGrid { class cHeaderGrid : public cGrid {
private: private:
cPixmap *pixmapLogo; cPixmap *pixmapLogo;
void drawChannelHorizontal(const cChannel *channel); void drawChannelHorizontal(const cChannel *channel);
void drawChannelVertical(const cChannel *channel); void drawChannelVertical(const cChannel *channel);
public: public:
cHeaderGrid(void); cHeaderGrid(void);
virtual ~cHeaderGrid(void); virtual ~cHeaderGrid(void);
void createBackground(int num); void createBackground(int num);
void drawChannel(const cChannel *channel); void drawChannel(const cChannel *channel);
void setPosition(int num); void setPosition(int num);
}; };
#endif //__TVGUIDE_HEADERGRID_H #endif //__TVGUIDE_HEADERGRID_H

File diff suppressed because it is too large Load Diff

View File

@ -1,92 +1,92 @@
#ifndef __TVGUIDE_IMAGECACHE_H #ifndef __TVGUIDE_IMAGECACHE_H
#define __TVGUIDE_IMAGECACHE_H #define __TVGUIDE_IMAGECACHE_H
#define X_DISPLAY_MISSING #define X_DISPLAY_MISSING
#include <map> #include <map>
#include <vector> #include <vector>
#include "imagemagickwrapper.h" #include "imagemagickwrapper.h"
enum eCacheType { enum eCacheType {
ctOsdElement = 0, ctOsdElement = 0,
ctGrid, ctGrid,
ctLogo, ctLogo,
ctChannelGroup, ctChannelGroup,
ctIcon, ctIcon,
}; };
enum eOsdElementType { enum eOsdElementType {
oeNone = -1, oeNone = -1,
oeStatusHeaderContentFull, oeStatusHeaderContentFull,
oeStatusHeaderContentWindowed, oeStatusHeaderContentWindowed,
oeStatusHeaderTVFrame, oeStatusHeaderTVFrame,
oeButtonRed, oeButtonRed,
oeButtonGreen, oeButtonGreen,
oeButtonYellow, oeButtonYellow,
oeButtonBlue, oeButtonBlue,
oeLogoBack, oeLogoBack,
oeTimeline1, oeTimeline1,
oeTimeline2, oeTimeline2,
oeDateViewer, oeDateViewer,
oeClock, oeClock,
oeChannelJump, oeChannelJump,
}; };
class cImageCache : public cImageMagickWrapper { class cImageCache : public cImageMagickWrapper {
public: public:
cImageCache(); cImageCache();
~cImageCache(); ~cImageCache();
void CreateCache(void); void CreateCache(void);
cImage *GetOsdElement(eOsdElementType type); cImage *GetOsdElement(eOsdElementType type);
cImage *GetGrid(int width, int height, bool active); cImage *GetGrid(int width, int height, bool active);
cImage *GetChannelGroup(int width, int height); cImage *GetChannelGroup(int width, int height);
cImage *GetLogo(const cChannel *channel); cImage *GetLogo(const cChannel *channel);
cImage *GetIcon(std::string name, int width, int height); cImage *GetIcon(std::string name, int width, int height);
std::string GetCacheSize(eCacheType type); std::string GetCacheSize(eCacheType type);
void Clear(void); void Clear(void);
private: private:
cImage *tempStaticLogo; cImage *tempStaticLogo;
Image bufferGrid; Image bufferGrid;
Image bufferGridActive; Image bufferGridActive;
bool gridsAvailable; bool gridsAvailable;
int cornerWidth; int cornerWidth;
int cornerHeight; int cornerHeight;
cImage *imgLeft; cImage *imgLeft;
cImage *imgLeftActive; cImage *imgLeftActive;
cImage *imgRight; cImage *imgRight;
cImage *imgRightActive; cImage *imgRightActive;
cImage *imgHead; cImage *imgHead;
cImage *imgHeadActive; cImage *imgHeadActive;
cImage *imgBottom; cImage *imgBottom;
cImage *imgBottomActive; cImage *imgBottomActive;
cImage *imgChannelgroupHead; cImage *imgChannelgroupHead;
cImage *imgChannelgroupBottom; cImage *imgChannelgroupBottom;
cImage *groupsHead; cImage *groupsHead;
cImage *groupsBottom; cImage *groupsBottom;
cImage *groupsLeft; cImage *groupsLeft;
cImage *groupsRight; cImage *groupsRight;
std::map<eOsdElementType, cImage*> osdElementCache; std::map<eOsdElementType, cImage*> osdElementCache;
std::map<std::string, cImage*> gridCache; std::map<std::string, cImage*> gridCache;
std::map<std::string, cImage*> groupsCache; std::map<std::string, cImage*> groupsCache;
std::map<std::string, cImage*> logoCache; std::map<std::string, cImage*> logoCache;
std::map<std::string, cImage*> iconCache; std::map<std::string, cImage*> iconCache;
void CreateOsdIconCache(void); void CreateOsdIconCache(void);
void PrepareGridIconCache(void); void PrepareGridIconCache(void);
void CreateGridIconCache(void); void CreateGridIconCache(void);
void CreateChannelGroupCache(void); void CreateChannelGroupCache(void);
void CreateLogoCache(void); void CreateLogoCache(void);
bool LoadIcon(std::string name); bool LoadIcon(std::string name);
void InsertIntoOsdElementCache(eOsdElementType type, int width=0, int height=0); void InsertIntoOsdElementCache(eOsdElementType type, int width=0, int height=0);
void InsertIntoGridCache(std::string name, int width, int height, bool active); void InsertIntoGridCache(std::string name, int width, int height, bool active);
cImage *CreateGrid(int width, int height, bool active); cImage *CreateGrid(int width, int height, bool active);
void AddCornersHorizontal(cImage *img, bool active); void AddCornersHorizontal(cImage *img, bool active);
void AddCornersVertical(cImage *img, bool active); void AddCornersVertical(cImage *img, bool active);
void InsertIntoGroupsCacheHorizontal(int size); void InsertIntoGroupsCacheHorizontal(int size);
void InsertIntoGroupsCacheVertical(int size); void InsertIntoGroupsCacheVertical(int size);
void AddCornersGroupHorizontal(cImage *img); void AddCornersGroupHorizontal(cImage *img);
void AddCornersGroupVertical(cImage *img); void AddCornersGroupVertical(cImage *img);
bool LoadLogo(const cChannel *channel); bool LoadLogo(const cChannel *channel);
void InsertIntoLogoCache(std::string channelID); void InsertIntoLogoCache(std::string channelID);
}; };
#endif //__TVGUIDE_IMAGECACHE_H #endif //__TVGUIDE_IMAGECACHE_H

View File

@ -1,38 +1,38 @@
#include "config.h" #include "config.h"
#include "osdmanager.h" #include "osdmanager.h"
cOsdManager::cOsdManager(void) { cOsdManager::cOsdManager(void) {
} }
bool cOsdManager::setOsd() { bool cOsdManager::setOsd() {
osd = cOsdProvider::NewOsd(cOsd::OsdLeft(), cOsd::OsdTop()); osd = cOsdProvider::NewOsd(cOsd::OsdLeft(), cOsd::OsdTop());
if (osd) { if (osd) {
tArea Area = { 0, 0, cOsd::OsdWidth(), cOsd::OsdHeight(), 32 }; tArea Area = { 0, 0, cOsd::OsdWidth(), cOsd::OsdHeight(), 32 };
if (osd->SetAreas(&Area, 1) == oeOk) { if (osd->SetAreas(&Area, 1) == oeOk) {
return true; return true;
} }
} }
return false; return false;
} }
void cOsdManager::setBackground() { void cOsdManager::setBackground() {
if (tvguideConfig.displayStatusHeader && tvguideConfig.scaleVideo) { if (tvguideConfig.displayStatusHeader && tvguideConfig.scaleVideo) {
int widthStatus = cOsd::OsdWidth() - geoManager.statusHeaderHeight * 16 / 9; int widthStatus = cOsd::OsdWidth() - geoManager.statusHeaderHeight * 16 / 9;
osd->DrawRectangle(0, 0, widthStatus, geoManager.statusHeaderHeight, theme.Color(clrBackgroundOSD)); osd->DrawRectangle(0, 0, widthStatus, geoManager.statusHeaderHeight, theme.Color(clrBackgroundOSD));
osd->DrawRectangle(0, geoManager.statusHeaderHeight, Width(), Height(), theme.Color(clrBackgroundOSD)); osd->DrawRectangle(0, geoManager.statusHeaderHeight, Width(), Height(), theme.Color(clrBackgroundOSD));
} }
else else
osd->DrawRectangle(0, 0, Width(), Height(), theme.Color(clrBackgroundOSD)); osd->DrawRectangle(0, 0, Width(), Height(), theme.Color(clrBackgroundOSD));
} }
cPixmap *cOsdManager::requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort) { cPixmap *cOsdManager::requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort) {
return osd->CreatePixmap(Layer, ViewPort, DrawPort); return osd->CreatePixmap(Layer, ViewPort, DrawPort);
} }
void cOsdManager::releasePixmap(cPixmap *pixmap) { void cOsdManager::releasePixmap(cPixmap *pixmap) {
if (!pixmap) if (!pixmap)
return; return;
osd->DestroyPixmap(pixmap); osd->DestroyPixmap(pixmap);
} }

View File

@ -1,23 +1,23 @@
#ifndef __TVGUIDE_OSDMANAGER_H #ifndef __TVGUIDE_OSDMANAGER_H
#define __TVGUIDE_OSDMANAGER_H #define __TVGUIDE_OSDMANAGER_H
#include <vdr/osd.h> #include <vdr/osd.h>
class cOsdManager { class cOsdManager {
private: private:
cOsd *osd; cOsd *osd;
public: public:
cOsdManager(void); cOsdManager(void);
bool setOsd(); bool setOsd();
void setBackground(); void setBackground();
void flush() {osd->Flush();}; void flush() {osd->Flush();};
cPixmap *requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null); cPixmap *requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
void releasePixmap(cPixmap *pixmap); void releasePixmap(cPixmap *pixmap);
void deleteOsd() {delete osd;}; void deleteOsd() {delete osd;};
int Width() { return osd->Width(); }; int Width() { return osd->Width(); };
int Height() { return osd->Height(); }; int Height() { return osd->Height(); };
int Top() { return osd->Top(); }; int Top() { return osd->Top(); };
int Left() { return osd->Left(); }; int Left() { return osd->Left(); };
}; };
#endif //__TVGUIDE_OSDMANAGER_H #endif //__TVGUIDE_OSDMANAGER_H

File diff suppressed because it is too large Load Diff

View File

@ -1,136 +1,136 @@
#ifndef __TVGUIDE_SEARCHTIMER_H #ifndef __TVGUIDE_SEARCHTIMER_H
#define __TVGUIDE_SEARCHTIMER_H #define __TVGUIDE_SEARCHTIMER_H
class cTVGuideSearchTimer { class cTVGuideSearchTimer {
friend class cRecMenuSearchTimerEdit; friend class cRecMenuSearchTimerEdit;
protected: protected:
std::string strTimer; std::string strTimer;
int ID; int ID;
std::string searchString; std::string searchString;
int useTime; int useTime;
int startTime; int startTime;
int stopTime; int stopTime;
int useChannel; int useChannel;
const cChannel *channelMin; const cChannel *channelMin;
const cChannel *channelMax; const cChannel *channelMax;
std::string channelGroup; std::string channelGroup;
int useCase; int useCase;
int mode; int mode;
int useTitle; int useTitle;
int useSubtitle; int useSubtitle;
int useDescription; int useDescription;
int useDuration; int useDuration;
int minDuration; int minDuration;
int maxDuration; int maxDuration;
int useAsSearchTimer; int useAsSearchTimer;
int useDayOfWeek; int useDayOfWeek;
int dayOfWeek; int dayOfWeek;
int useEpisode; int useEpisode;
std::string directory; std::string directory;
int priority; int priority;
int lifetime; int lifetime;
int marginStart; int marginStart;
int marginStop; int marginStop;
int useVPS; int useVPS;
int action; int action;
int useExtEPGInfo; int useExtEPGInfo;
std::string extEPGInfoValues; std::string extEPGInfoValues;
int avoidRepeats; int avoidRepeats;
int allowedRepeats; int allowedRepeats;
int compareTitle; int compareTitle;
int compareSubtitle; int compareSubtitle;
int compareSummary; int compareSummary;
unsigned long catvaluesAvoidRepeat; unsigned long catvaluesAvoidRepeat;
int repeatsWithinDays; int repeatsWithinDays;
int delAfterDays; int delAfterDays;
int recordingsKeep; int recordingsKeep;
int switchMinsBefore; int switchMinsBefore;
int pauseOnNrRecordings; int pauseOnNrRecordings;
int blacklistMode; int blacklistMode;
std::string blacklists; std::string blacklists;
int fuzzyTolerance; int fuzzyTolerance;
int useInFavorites; int useInFavorites;
int menuTemplate; int menuTemplate;
int delMode; int delMode;
int delAfterCountRecs; int delAfterCountRecs;
int delAfterDaysOfFirstRec; int delAfterDaysOfFirstRec;
int useAsSearchTimerFrom; int useAsSearchTimerFrom;
int useAsSearchTimerTil; int useAsSearchTimerTil;
int ignoreMissingEPGCats; int ignoreMissingEPGCats;
int unmuteSoundOnSwitch; int unmuteSoundOnSwitch;
int compareSummaryMatchInPercent; int compareSummaryMatchInPercent;
std::string contentsFilter; std::string contentsFilter;
int compareDate; int compareDate;
public: public:
cTVGuideSearchTimer(void); cTVGuideSearchTimer(void);
virtual ~cTVGuideSearchTimer(void); virtual ~cTVGuideSearchTimer(void);
bool operator < (const cTVGuideSearchTimer& other) const; bool operator < (const cTVGuideSearchTimer& other) const;
void SetEPGSearchString(std::string strTimer) { this->strTimer = strTimer; }; void SetEPGSearchString(std::string strTimer) { this->strTimer = strTimer; };
void SetTemplate(std::string tmpl); void SetTemplate(std::string tmpl);
bool Parse(bool readTemplate = false); bool Parse(bool readTemplate = false);
std::string BuildSearchString(void); std::string BuildSearchString(void);
int GetID(void) { return ID; }; int GetID(void) { return ID; };
//GETTER //GETTER
std::string GetSearchString(void) const { return searchString; }; std::string GetSearchString(void) const { return searchString; };
bool IsActive(void); bool IsActive(void);
int DayOfWeek(void); int DayOfWeek(void);
bool UseInFavorites(void) { return useInFavorites; }; bool UseInFavorites(void) { return useInFavorites; };
//SETTER //SETTER
void SetSearchString(std::string searchString) { this->searchString = searchString; }; void SetSearchString(std::string searchString) { this->searchString = searchString; };
void SetSearchMode(int mode) { this->mode = mode; }; void SetSearchMode(int mode) { this->mode = mode; };
void SetFuzzyTolerance(int fuzzyTolerance) { this->fuzzyTolerance = fuzzyTolerance; }; void SetFuzzyTolerance(int fuzzyTolerance) { this->fuzzyTolerance = fuzzyTolerance; };
void SetUseCase(bool useCase) { this->useCase = useCase; }; void SetUseCase(bool useCase) { this->useCase = useCase; };
void SetUseTitle(bool useTitle) { this->useTitle = useTitle; }; void SetUseTitle(bool useTitle) { this->useTitle = useTitle; };
void SetUseSubtitle(bool useSubtitle) { this->useSubtitle = useSubtitle; }; void SetUseSubtitle(bool useSubtitle) { this->useSubtitle = useSubtitle; };
void SetUseDesription(bool useDescription) { this->useDescription = useDescription; }; void SetUseDesription(bool useDescription) { this->useDescription = useDescription; };
void SetUseChannel(int useChannel) { this->useChannel = useChannel; }; void SetUseChannel(int useChannel) { this->useChannel = useChannel; };
void SetStartChannel(const cChannel *channelMin) { this->channelMin = channelMin; }; void SetStartChannel(const cChannel *channelMin) { this->channelMin = channelMin; };
void SetStopChannel(const cChannel *channelMax) { this->channelMax = channelMax; }; void SetStopChannel(const cChannel *channelMax) { this->channelMax = channelMax; };
void SetChannelGroup(std::string channelGroup) { this->channelGroup = channelGroup; }; void SetChannelGroup(std::string channelGroup) { this->channelGroup = channelGroup; };
void SetUseTime(bool useTime) { this->useTime = useTime; }; void SetUseTime(bool useTime) { this->useTime = useTime; };
void SetStartTime(int startTime) { this->startTime = startTime; }; void SetStartTime(int startTime) { this->startTime = startTime; };
void SetStopTime(int stopTime) { this->stopTime = stopTime; }; void SetStopTime(int stopTime) { this->stopTime = stopTime; };
void SetUseDayOfWeek(bool useDayOfWeek) { this->useDayOfWeek = useDayOfWeek; }; void SetUseDayOfWeek(bool useDayOfWeek) { this->useDayOfWeek = useDayOfWeek; };
void SetDayOfWeek(int VDRDayOfWeek); void SetDayOfWeek(int VDRDayOfWeek);
void SetUseDuration(bool useDuration) { this->useDuration = useDuration; }; void SetUseDuration(bool useDuration) { this->useDuration = useDuration; };
void SetMinDuration(int minDuration) { this->minDuration = minDuration; }; void SetMinDuration(int minDuration) { this->minDuration = minDuration; };
void SetMaxDuration(int maxDuration) { this->maxDuration = maxDuration; }; void SetMaxDuration(int maxDuration) { this->maxDuration = maxDuration; };
void SetUseEpisode(int useEpisode) { this->useEpisode = useEpisode; }; void SetUseEpisode(int useEpisode) { this->useEpisode = useEpisode; };
void SetDirectory(std::string directory) { this-> directory = directory; }; void SetDirectory(std::string directory) { this-> directory = directory; };
void SetDelAfterDays(int delAfterDays) { this->delAfterDays = delAfterDays; }; void SetDelAfterDays(int delAfterDays) { this->delAfterDays = delAfterDays; };
void SetRecordingsKeep(int recordingsKeep) { this->recordingsKeep = recordingsKeep; }; void SetRecordingsKeep(int recordingsKeep) { this->recordingsKeep = recordingsKeep; };
void SetPauseOnNrRecordings(int pauseOnNrRecordings) { this-> pauseOnNrRecordings = pauseOnNrRecordings; }; void SetPauseOnNrRecordings(int pauseOnNrRecordings) { this-> pauseOnNrRecordings = pauseOnNrRecordings; };
void SetPriority(int priority) { this->priority = priority; }; void SetPriority(int priority) { this->priority = priority; };
void SetLifetime(int lifetime) { this->lifetime = lifetime; }; void SetLifetime(int lifetime) { this->lifetime = lifetime; };
void SetMarginStart(int marginStart) { this->marginStart = marginStart; }; void SetMarginStart(int marginStart) { this->marginStart = marginStart; };
void SetMarginStop(int marginStop) { this->marginStop = marginStop; }; void SetMarginStop(int marginStop) { this->marginStop = marginStop; };
void SetUseVPS(bool useVPS) { this->useVPS = useVPS; }; void SetUseVPS(bool useVPS) { this->useVPS = useVPS; };
void SetAvoidRepeats(bool avoidRepeats) { this->avoidRepeats = avoidRepeats; }; void SetAvoidRepeats(bool avoidRepeats) { this->avoidRepeats = avoidRepeats; };
void SetAllowedRepeats(int allowedRepeats) { this->allowedRepeats = allowedRepeats; }; void SetAllowedRepeats(int allowedRepeats) { this->allowedRepeats = allowedRepeats; };
void SetRepeatsWithinDays(int repeatsWithinDays) { this-> repeatsWithinDays = repeatsWithinDays; }; void SetRepeatsWithinDays(int repeatsWithinDays) { this-> repeatsWithinDays = repeatsWithinDays; };
void SetCompareTitle(bool compareTitle) { this->compareTitle = compareTitle; }; void SetCompareTitle(bool compareTitle) { this->compareTitle = compareTitle; };
void SetCompareSubtitle(bool compareSubtitle) { this->compareSubtitle = compareSubtitle; }; void SetCompareSubtitle(bool compareSubtitle) { this->compareSubtitle = compareSubtitle; };
void SetCompareSummary(bool compareSummary) { this->compareSummary = compareSummary; }; void SetCompareSummary(bool compareSummary) { this->compareSummary = compareSummary; };
void SetCompareSummaryMatchInPercent(int compareSummaryMatchInPercent) { this->compareSummaryMatchInPercent = compareSummaryMatchInPercent; }; void SetCompareSummaryMatchInPercent(int compareSummaryMatchInPercent) { this->compareSummaryMatchInPercent = compareSummaryMatchInPercent; };
void SetCompareDate(int compareDate) { this->compareDate = compareDate; }; void SetCompareDate(int compareDate) { this->compareDate = compareDate; };
void SetUseInFavorites(bool useInFavorites) { this->useInFavorites = useInFavorites; }; void SetUseInFavorites(bool useInFavorites) { this->useInFavorites = useInFavorites; };
void SetUseAsSearchTimer(bool useAsSearchTimer) { this->useAsSearchTimer = useAsSearchTimer; }; void SetUseAsSearchTimer(bool useAsSearchTimer) { this->useAsSearchTimer = useAsSearchTimer; };
void SetAction(int action) { this->action = action; }; void SetAction(int action) { this->action = action; };
void SetSwitchMinsBefore(int switchMinsBefore) { this->switchMinsBefore = switchMinsBefore; }; void SetSwitchMinsBefore(int switchMinsBefore) { this->switchMinsBefore = switchMinsBefore; };
void SetUnmuteSoundOnSwitch(bool unmuteSoundOnSwitch) { this->unmuteSoundOnSwitch = unmuteSoundOnSwitch; }; void SetUnmuteSoundOnSwitch(bool unmuteSoundOnSwitch) { this->unmuteSoundOnSwitch = unmuteSoundOnSwitch; };
void SetDelMode(bool delMode) { this->delMode = delMode; }; void SetDelMode(bool delMode) { this->delMode = delMode; };
void SetDelAfterCountRecs(bool delAfterCountRecs) { this->delAfterCountRecs = delAfterCountRecs; }; void SetDelAfterCountRecs(bool delAfterCountRecs) { this->delAfterCountRecs = delAfterCountRecs; };
void SetDelAfterDaysOfFirstRec(bool delAfterDaysOfFirstRec) { this->delAfterDaysOfFirstRec = delAfterDaysOfFirstRec; }; void SetDelAfterDaysOfFirstRec(bool delAfterDaysOfFirstRec) { this->delAfterDaysOfFirstRec = delAfterDaysOfFirstRec; };
//COMMON //COMMON
int GetNumTimers(void); int GetNumTimers(void);
int GetNumRecordings(void); int GetNumRecordings(void);
void GetSearchModes(std::vector<std::string> *searchModes); void GetSearchModes(std::vector<std::string> *searchModes);
void GetUseChannelModes(std::vector<std::string> *useChannelModes); void GetUseChannelModes(std::vector<std::string> *useChannelModes);
void GetSearchTimerModes(std::vector<std::string> *searchTimerModes); void GetSearchTimerModes(std::vector<std::string> *searchTimerModes);
void GetCompareDateModes(std::vector<std::string> *compareDateModes); void GetCompareDateModes(std::vector<std::string> *compareDateModes);
void GetDelModes(std::vector<std::string> *delModes); void GetDelModes(std::vector<std::string> *delModes);
void Dump(void); void Dump(void);
}; };
#endif //__TVGUIDE_SEARCHTIMER_H #endif //__TVGUIDE_SEARCHTIMER_H

View File

@ -1,143 +1,143 @@
#include "tools.h" #include "tools.h"
#include "services/scraper2vdr.h" #include "services/scraper2vdr.h"
#include "imageloader.h" #include "imageloader.h"
#include "statusheader.h" #include "statusheader.h"
cStatusHeader::cStatusHeader(void) { cStatusHeader::cStatusHeader(void) {
color = theme.Color(clrStatusHeader); color = theme.Color(clrStatusHeader);
colorBlending = theme.Color(clrStatusHeaderBlending); colorBlending = theme.Color(clrStatusHeaderBlending);
height = geoManager.statusHeaderHeight; height = geoManager.statusHeaderHeight;
width = geoManager.headerContentWidth; width = geoManager.headerContentWidth;
tvFrameWidth = geoManager.tvFrameWidth; tvFrameWidth = geoManager.tvFrameWidth;
pixmap = osdManager.requestPixmap(1, cRect(0, 0, width, height)); pixmap = osdManager.requestPixmap(1, cRect(0, 0, width, height));
pixmapText = osdManager.requestPixmap(2, cRect(0, 0, width, height)); pixmapText = osdManager.requestPixmap(2, cRect(0, 0, width, height));
pixmapTVFrame = osdManager.requestPixmap(1, cRect(width, 0, tvFrameWidth, height)); pixmapTVFrame = osdManager.requestPixmap(1, cRect(width, 0, tvFrameWidth, height));
} }
cStatusHeader::~cStatusHeader(void) { cStatusHeader::~cStatusHeader(void) {
osdManager.releasePixmap(pixmapText); osdManager.releasePixmap(pixmapText);
osdManager.releasePixmap(pixmapTVFrame); osdManager.releasePixmap(pixmapTVFrame);
if (tvguideConfig.scaleVideo) { if (tvguideConfig.scaleVideo) {
cRect vidWin = cDevice::PrimaryDevice()->CanScaleVideo(cRect::Null); cRect vidWin = cDevice::PrimaryDevice()->CanScaleVideo(cRect::Null);
cDevice::PrimaryDevice()->ScaleVideo(vidWin); cDevice::PrimaryDevice()->ScaleVideo(vidWin);
} }
} }
void cStatusHeader::Draw(void) { void cStatusHeader::Draw(void) {
pixmapText->Fill(clrTransparent); pixmapText->Fill(clrTransparent);
pixmapTVFrame->Fill(clrTransparent); pixmapTVFrame->Fill(clrTransparent);
if (tvguideConfig.style == eStyleGraphical) { if (tvguideConfig.style == eStyleGraphical) {
if (tvguideConfig.scaleVideo) { if (tvguideConfig.scaleVideo) {
drawBackgroundGraphical(bgStatusHeaderWindowed); drawBackgroundGraphical(bgStatusHeaderWindowed);
cImage *tvFrameBack = imgCache.GetOsdElement(oeStatusHeaderTVFrame); cImage *tvFrameBack = imgCache.GetOsdElement(oeStatusHeaderTVFrame);
if (tvFrameBack) if (tvFrameBack)
pixmapTVFrame->DrawImage(cPoint(0,0), *tvFrameBack); pixmapTVFrame->DrawImage(cPoint(0,0), *tvFrameBack);
} else { } else {
drawBackgroundGraphical(bgStatusHeaderFull); drawBackgroundGraphical(bgStatusHeaderFull);
} }
} else { } else {
if (tvguideConfig.decorateVideo) { if (tvguideConfig.decorateVideo) {
DecorateVideoFrame(); DecorateVideoFrame();
} }
drawBackground(); drawBackground();
drawBorder(); drawBorder();
} }
} }
void cStatusHeader::ScaleVideo(void) { void cStatusHeader::ScaleVideo(void) {
if (tvguideConfig.scaleVideo) { if (tvguideConfig.scaleVideo) {
int width = height * 16 / 9; int width = height * 16 / 9;
int x = osdManager.Left() + geoManager.osdWidth - width; int x = osdManager.Left() + geoManager.osdWidth - width;
int y = osdManager.Top(); int y = osdManager.Top();
cRect availableRect(x, y, width, height); cRect availableRect(x, y, width, height);
cRect vidWin = cDevice::PrimaryDevice()->CanScaleVideo(availableRect); cRect vidWin = cDevice::PrimaryDevice()->CanScaleVideo(availableRect);
cDevice::PrimaryDevice()->ScaleVideo(vidWin); cDevice::PrimaryDevice()->ScaleVideo(vidWin);
} }
} }
void cStatusHeader::DrawInfoText(cGrid *grid) { void cStatusHeader::DrawInfoText(cGrid *grid) {
int border = 10; int border = 10;
int textWidth = 0; int textWidth = 0;
textWidth = width - 2 * border; textWidth = width - 2 * border;
tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent; tColor colorTextBack = (tvguideConfig.style == eStyleFlat)?color:clrTransparent;
pixmapText->Fill(clrTransparent); pixmapText->Fill(clrTransparent);
int x = border; int x = border;
int y = border; int y = border;
if (!grid->isDummy()) { if (!grid->isDummy()) {
const cEvent *event = grid->GetEvent(); const cEvent *event = grid->GetEvent();
int newX = DrawPoster(event, x, y, height-2*border, border); int newX = DrawPoster(event, x, y, height-2*border, border);
if (newX > 0) { if (newX > 0) {
textWidth -= (newX - x); textWidth -= (newX - x);
x += newX; x += newX;
} }
cString time = grid->getTimeString(); cString time = grid->getTimeString();
cString title(""); cString title("");
title = cString::sprintf(": %s", event->Title()); title = cString::sprintf(": %s", event->Title());
cString header = cString::sprintf("%s%s", *time, *title); cString header = cString::sprintf("%s%s", *time, *title);
header = CutText(*header, textWidth, fontManager.FontStatusHeaderLarge).c_str(); header = CutText(*header, textWidth, fontManager.FontStatusHeaderLarge).c_str();
pixmapText->DrawText(cPoint(x,y), *header, theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeaderLarge); pixmapText->DrawText(cPoint(x,y), *header, theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeaderLarge);
y += fontManager.FontStatusHeaderLarge->Height() + border; y += fontManager.FontStatusHeaderLarge->Height() + border;
int heightText = pixmapText->ViewPort().Height() - y; int heightText = pixmapText->ViewPort().Height() - y;
cTextWrapper description; cTextWrapper description;
description.Set(event->Description(), fontManager.FontStatusHeader, textWidth); description.Set(event->Description(), fontManager.FontStatusHeader, textWidth);
int lineHeight = fontManager.FontStatusHeader->Height(); int lineHeight = fontManager.FontStatusHeader->Height();
int textLines = description.Lines(); int textLines = description.Lines();
int maxLines = heightText / lineHeight; int maxLines = heightText / lineHeight;
int lines = std::min(textLines, maxLines); int lines = std::min(textLines, maxLines);
for (int i = 0; i < lines-1; i++) { for (int i = 0; i < lines-1; i++) {
pixmapText->DrawText(cPoint(x,y), description.GetLine(i), theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeader); pixmapText->DrawText(cPoint(x,y), description.GetLine(i), theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeader);
y += lineHeight; y += lineHeight;
} }
cString lastLine = description.GetLine(lines-1); cString lastLine = description.GetLine(lines-1);
if (textLines > maxLines) { if (textLines > maxLines) {
lastLine = cString::sprintf("%s...", *lastLine); lastLine = cString::sprintf("%s...", *lastLine);
} }
pixmapText->DrawText(cPoint(x,y), *lastLine, theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeader); pixmapText->DrawText(cPoint(x,y), *lastLine, theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeader);
} else { } else {
int heightText = pixmapText->ViewPort().Height() - y; int heightText = pixmapText->ViewPort().Height() - y;
y += (heightText - fontManager.FontStatusHeaderLarge->Height() - 2*border)/2; y += (heightText - fontManager.FontStatusHeaderLarge->Height() - 2*border)/2;
pixmapText->DrawText(cPoint(x,y), *grid->getText(), theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeaderLarge); pixmapText->DrawText(cPoint(x,y), *grid->getText(), theme.Color(clrFont), colorTextBack, fontManager.FontStatusHeaderLarge);
} }
} }
int cStatusHeader::DrawPoster(const cEvent *event, int x, int y, int height, int border) { int cStatusHeader::DrawPoster(const cEvent *event, int x, int y, int height, int border) {
bool hasPoster = false; bool hasPoster = false;
ScraperGetPoster posterScraper2Vdr; ScraperGetPoster posterScraper2Vdr;
int posterWidth = 0; int posterWidth = 0;
int posterHeight = 0; int posterHeight = 0;
static cPlugin *pScraper = GetScraperPlugin(); static cPlugin *pScraper = GetScraperPlugin();
if (pScraper) { if (pScraper) {
posterScraper2Vdr.event = event; posterScraper2Vdr.event = event;
posterScraper2Vdr.recording = NULL; posterScraper2Vdr.recording = NULL;
if (pScraper->Service("GetPoster", &posterScraper2Vdr)) { if (pScraper->Service("GetPoster", &posterScraper2Vdr)) {
hasPoster = true; hasPoster = true;
int posterWidthOrig = posterScraper2Vdr.poster.width; int posterWidthOrig = posterScraper2Vdr.poster.width;
int posterHeightOrig = posterScraper2Vdr.poster.height; int posterHeightOrig = posterScraper2Vdr.poster.height;
posterHeight = height; posterHeight = height;
posterWidth = posterWidthOrig * ((double)posterHeight / (double)posterHeightOrig); posterWidth = posterWidthOrig * ((double)posterHeight / (double)posterHeightOrig);
} else { } else {
hasPoster = false; hasPoster = false;
} }
} }
if (hasPoster) { if (hasPoster) {
cImageLoader imgLoader; cImageLoader imgLoader;
if (imgLoader.LoadPoster(posterScraper2Vdr.poster.path.c_str(), posterWidth, posterHeight)) { if (imgLoader.LoadPoster(posterScraper2Vdr.poster.path.c_str(), posterWidth, posterHeight)) {
pixmapText->DrawImage(cPoint(x, y), imgLoader.GetImage()); pixmapText->DrawImage(cPoint(x, y), imgLoader.GetImage());
return posterWidth + border; return posterWidth + border;
} }
} }
return 0; return 0;
} }
void cStatusHeader::DecorateVideoFrame(void) { void cStatusHeader::DecorateVideoFrame(void) {
int radius = 16; int radius = 16;
int frame = 2; int frame = 2;
pixmapTVFrame->DrawRectangle(cRect(0, 0, tvFrameWidth, frame), theme.Color(clrBackgroundOSD)); pixmapTVFrame->DrawRectangle(cRect(0, 0, tvFrameWidth, frame), theme.Color(clrBackgroundOSD));
pixmapTVFrame->DrawEllipse(cRect(frame,frame,radius,radius), theme.Color(clrBackgroundOSD), -2); pixmapTVFrame->DrawEllipse(cRect(frame,frame,radius,radius), theme.Color(clrBackgroundOSD), -2);
pixmapTVFrame->DrawRectangle(cRect(tvFrameWidth - frame, frame, frame, height - 2*frame), theme.Color(clrBackgroundOSD)); pixmapTVFrame->DrawRectangle(cRect(tvFrameWidth - frame, frame, frame, height - 2*frame), theme.Color(clrBackgroundOSD));
pixmapTVFrame->DrawEllipse(cRect(tvFrameWidth - radius - frame, frame, radius, radius), theme.Color(clrBackgroundOSD), -1); pixmapTVFrame->DrawEllipse(cRect(tvFrameWidth - radius - frame, frame, radius, radius), theme.Color(clrBackgroundOSD), -1);
pixmapTVFrame->DrawRectangle(cRect(0, frame, frame, height - 2*frame), theme.Color(clrBackgroundOSD)); pixmapTVFrame->DrawRectangle(cRect(0, frame, frame, height - 2*frame), theme.Color(clrBackgroundOSD));
pixmapTVFrame->DrawEllipse(cRect(frame, height - radius - frame, radius, radius), theme.Color(clrBackgroundOSD), -3); pixmapTVFrame->DrawEllipse(cRect(frame, height - radius - frame, radius, radius), theme.Color(clrBackgroundOSD), -3);
pixmapTVFrame->DrawRectangle(cRect(0, height - frame, tvFrameWidth, frame), theme.Color(clrBackgroundOSD)); pixmapTVFrame->DrawRectangle(cRect(0, height - frame, tvFrameWidth, frame), theme.Color(clrBackgroundOSD));
pixmapTVFrame->DrawEllipse(cRect(tvFrameWidth - radius - frame, height - radius - frame, radius, radius), theme.Color(clrBackgroundOSD), -4); pixmapTVFrame->DrawEllipse(cRect(tvFrameWidth - radius - frame, height - radius - frame, radius, radius), theme.Color(clrBackgroundOSD), -4);
} }

View File

@ -1,25 +1,25 @@
#ifndef __TVGUIDE_STATUSHEADER_H #ifndef __TVGUIDE_STATUSHEADER_H
#define __TVGUIDE_STATUSHEADER_H #define __TVGUIDE_STATUSHEADER_H
#include "styledpixmap.h" #include "styledpixmap.h"
#include "grid.h" #include "grid.h"
// --- cStatusHeader ------------------------------------------------------------- // --- cStatusHeader -------------------------------------------------------------
class cStatusHeader : public cStyledPixmap { class cStatusHeader : public cStyledPixmap {
private: private:
int width, height; int width, height;
int tvFrameWidth; int tvFrameWidth;
cPixmap *pixmapText; cPixmap *pixmapText;
cPixmap *pixmapTVFrame; cPixmap *pixmapTVFrame;
int DrawPoster(const cEvent *event, int x, int y, int height, int border); int DrawPoster(const cEvent *event, int x, int y, int height, int border);
void DecorateVideoFrame(void); void DecorateVideoFrame(void);
public: public:
cStatusHeader(void); cStatusHeader(void);
virtual ~cStatusHeader(void); virtual ~cStatusHeader(void);
void Draw(void); void Draw(void);
void ScaleVideo(void); void ScaleVideo(void);
void DrawInfoText(cGrid *grid); void DrawInfoText(cGrid *grid);
}; };
#endif //__TVGUIDE_STATUSHEADER_H #endif //__TVGUIDE_STATUSHEADER_H

View File

@ -1,205 +1,205 @@
#include "imageloader.h" #include "imageloader.h"
#include "geometrymanager.h" #include "geometrymanager.h"
#include "styledpixmap.h" #include "styledpixmap.h"
cStyledPixmap::cStyledPixmap(void) { cStyledPixmap::cStyledPixmap(void) {
pixmap = NULL; pixmap = NULL;
} }
cStyledPixmap::cStyledPixmap(cPixmap *pixmap) { cStyledPixmap::cStyledPixmap(cPixmap *pixmap) {
this->pixmap = pixmap; this->pixmap = pixmap;
} }
cStyledPixmap::~cStyledPixmap(void) { cStyledPixmap::~cStyledPixmap(void) {
if (pixmap) if (pixmap)
osdManager.releasePixmap(pixmap); osdManager.releasePixmap(pixmap);
} }
void cStyledPixmap::setPixmap(cPixmap *pixmap) { void cStyledPixmap::setPixmap(cPixmap *pixmap) {
if (pixmap) { if (pixmap) {
this->pixmap = pixmap; this->pixmap = pixmap;
} }
} }
void cStyledPixmap::drawBackground() { void cStyledPixmap::drawBackground() {
if (tvguideConfig.style == eStyleBlendingDefault){ if (tvguideConfig.style == eStyleBlendingDefault){
drawBlendedBackground(); drawBlendedBackground();
} else if (tvguideConfig.style == eStyleBlendingMagick){ } else if (tvguideConfig.style == eStyleBlendingMagick){
drawSparsedBackground(); drawSparsedBackground();
} else { } else {
pixmap->Fill(color); pixmap->Fill(color);
} }
} }
void cStyledPixmap::drawBackgroundGraphical(eBackgroundType type, bool active) { void cStyledPixmap::drawBackgroundGraphical(eBackgroundType type, bool active) {
cImage *back = NULL; cImage *back = NULL;
if (type == bgGrid) { if (type == bgGrid) {
back = imgCache.GetGrid(pixmap->ViewPort().Width(), pixmap->ViewPort().Height(), active); back = imgCache.GetGrid(pixmap->ViewPort().Width(), pixmap->ViewPort().Height(), active);
} else if (type == bgChannelHeader) { } else if (type == bgChannelHeader) {
back = imgCache.GetOsdElement(oeLogoBack); back = imgCache.GetOsdElement(oeLogoBack);
} else if (type == bgChannelGroup) { } else if (type == bgChannelGroup) {
back = imgCache.GetChannelGroup(pixmap->ViewPort().Width(), pixmap->ViewPort().Height()); back = imgCache.GetChannelGroup(pixmap->ViewPort().Width(), pixmap->ViewPort().Height());
} else if (type == bgStatusHeaderWindowed) { } else if (type == bgStatusHeaderWindowed) {
back = imgCache.GetOsdElement(oeStatusHeaderContentWindowed); back = imgCache.GetOsdElement(oeStatusHeaderContentWindowed);
} else if (type == bgStatusHeaderFull) { } else if (type == bgStatusHeaderFull) {
back = imgCache.GetOsdElement(oeStatusHeaderContentFull); back = imgCache.GetOsdElement(oeStatusHeaderContentFull);
} else if (type == bgClock) { } else if (type == bgClock) {
back = imgCache.GetOsdElement(oeClock); back = imgCache.GetOsdElement(oeClock);
} else if (type == bgButton) { } else if (type == bgButton) {
drawBackgroundButton(active); drawBackgroundButton(active);
return; return;
} else if (type == bgRecMenuBack) { } else if (type == bgRecMenuBack) {
cImageLoader imgLoader; cImageLoader imgLoader;
if (imgLoader.LoadOsdElement("recmenu_background", pixmap->ViewPort().Width(), pixmap->ViewPort().Height())) { if (imgLoader.LoadOsdElement("recmenu_background", pixmap->ViewPort().Width(), pixmap->ViewPort().Height())) {
cImage background = imgLoader.GetImage(); cImage background = imgLoader.GetImage();
pixmap->DrawImage(cPoint(0, 0), background); pixmap->DrawImage(cPoint(0, 0), background);
} else { } else {
pixmap->Fill(clrTransparent); pixmap->Fill(clrTransparent);
} }
return; return;
} else if (type == bgChannelJump) { } else if (type == bgChannelJump) {
back = imgCache.GetOsdElement(oeChannelJump); back = imgCache.GetOsdElement(oeChannelJump);
} }
if (back) { if (back) {
pixmap->DrawImage(cPoint(0,0), *back); pixmap->DrawImage(cPoint(0,0), *back);
} else { } else {
pixmap->Fill(clrTransparent); pixmap->Fill(clrTransparent);
} }
} }
void cStyledPixmap::drawBackgroundButton(bool active) { void cStyledPixmap::drawBackgroundButton(bool active) {
std::string buttonName = ""; std::string buttonName = "";
int buttonWidth = pixmap->ViewPort().Width(); int buttonWidth = pixmap->ViewPort().Width();
int buttonHeight = pixmap->ViewPort().Height(); int buttonHeight = pixmap->ViewPort().Height();
if (buttonWidth > geoManager.osdWidth * 50 / 100) { if (buttonWidth > geoManager.osdWidth * 50 / 100) {
if (active) if (active)
buttonName = "button_active_70percent"; buttonName = "button_active_70percent";
else else
buttonName = "button_70percent"; buttonName = "button_70percent";
} else { } else {
if (active) if (active)
buttonName = "button_active_30percent"; buttonName = "button_active_30percent";
else else
buttonName = "button_30percent"; buttonName = "button_30percent";
} }
cImageLoader imgLoader; cImageLoader imgLoader;
if (imgLoader.LoadOsdElement(buttonName.c_str(), buttonWidth, buttonHeight)) { if (imgLoader.LoadOsdElement(buttonName.c_str(), buttonWidth, buttonHeight)) {
cImage button = imgLoader.GetImage(); cImage button = imgLoader.GetImage();
pixmap->DrawImage(cPoint(0, 0), button); pixmap->DrawImage(cPoint(0, 0), button);
} else { } else {
pixmap->Fill(clrTransparent); pixmap->Fill(clrTransparent);
} }
} }
void cStyledPixmap::drawBlendedBackground() { void cStyledPixmap::drawBlendedBackground() {
int width = pixmap->ViewPort().Width(); int width = pixmap->ViewPort().Width();
int height = pixmap->ViewPort().Height(); int height = pixmap->ViewPort().Height();
pixmap->Fill(color); pixmap->Fill(color);
int numSteps = 64; int numSteps = 64;
int alphaStep = 0x04; int alphaStep = 0x04;
if (height < 30) if (height < 30)
return; return;
else if (height < 100) { else if (height < 100) {
numSteps = 32; numSteps = 32;
alphaStep = 0x08; alphaStep = 0x08;
} }
int stepY = 0.5*height / numSteps; int stepY = 0.5*height / numSteps;
if (stepY == 0) stepY = 1; if (stepY == 0) stepY = 1;
int alpha = 0x00; int alpha = 0x00;
tColor clr; tColor clr;
for (int i = 0; i<numSteps; i++) { for (int i = 0; i<numSteps; i++) {
clr = AlphaBlend(color, colorBlending, alpha); clr = AlphaBlend(color, colorBlending, alpha);
pixmap->DrawRectangle(cRect(0,i*stepY,width,stepY), clr); pixmap->DrawRectangle(cRect(0,i*stepY,width,stepY), clr);
alpha += alphaStep; alpha += alphaStep;
} }
} }
void cStyledPixmap::drawSparsedBackground() { void cStyledPixmap::drawSparsedBackground() {
int width = pixmap->ViewPort().Width(); int width = pixmap->ViewPort().Width();
int height = pixmap->ViewPort().Height(); int height = pixmap->ViewPort().Height();
cImageLoader imgLoader; cImageLoader imgLoader;
if (imgLoader.DrawBackground(colorBlending, color, width, height)) if (imgLoader.DrawBackground(colorBlending, color, width, height))
pixmap->DrawImage(cPoint(0,0), imgLoader.GetImage()); pixmap->DrawImage(cPoint(0,0), imgLoader.GetImage());
} }
void cStyledPixmap::drawBorder() { void cStyledPixmap::drawBorder() {
int width = pixmap->ViewPort().Width(); int width = pixmap->ViewPort().Width();
int height = pixmap->ViewPort().Height(); int height = pixmap->ViewPort().Height();
drawDefaultBorder(width, height); drawDefaultBorder(width, height);
if (tvguideConfig.roundedCorners) { if (tvguideConfig.roundedCorners) {
int borderRadius = 12; int borderRadius = 12;
drawRoundedCorners(width, height, borderRadius); drawRoundedCorners(width, height, borderRadius);
} }
} }
void cStyledPixmap::drawDefaultBorder(int width, int height) { void cStyledPixmap::drawDefaultBorder(int width, int height) {
pixmap->DrawRectangle(cRect(0,0,width,2), clrTransparent); //top pixmap->DrawRectangle(cRect(0,0,width,2), clrTransparent); //top
pixmap->DrawRectangle(cRect(0,0,2,height), clrTransparent); //left pixmap->DrawRectangle(cRect(0,0,2,height), clrTransparent); //left
pixmap->DrawRectangle(cRect(0,height-2,width,2), clrTransparent); //bottom pixmap->DrawRectangle(cRect(0,height-2,width,2), clrTransparent); //bottom
pixmap->DrawRectangle(cRect(width-2,0,2,height), clrTransparent); //right pixmap->DrawRectangle(cRect(width-2,0,2,height), clrTransparent); //right
pixmap->DrawRectangle(cRect(2,2,width-4,1), theme.Color(clrBorder)); //top pixmap->DrawRectangle(cRect(2,2,width-4,1), theme.Color(clrBorder)); //top
pixmap->DrawRectangle(cRect(2,2,1,height-4), theme.Color(clrBorder)); //left pixmap->DrawRectangle(cRect(2,2,1,height-4), theme.Color(clrBorder)); //left
pixmap->DrawRectangle(cRect(2,height-3,width-4,1), theme.Color(clrBorder)); //bottom pixmap->DrawRectangle(cRect(2,height-3,width-4,1), theme.Color(clrBorder)); //bottom
pixmap->DrawRectangle(cRect(width-3,2,1,height-4), theme.Color(clrBorder)); //right pixmap->DrawRectangle(cRect(width-3,2,1,height-4), theme.Color(clrBorder)); //right
} }
void cStyledPixmap::drawBoldBorder() { void cStyledPixmap::drawBoldBorder() {
int width = pixmap->ViewPort().Width(); int width = pixmap->ViewPort().Width();
int height = pixmap->ViewPort().Height(); int height = pixmap->ViewPort().Height();
pixmap->DrawRectangle(cRect(0,0,width,2), theme.Color(clrBorder)); //top pixmap->DrawRectangle(cRect(0,0,width,2), theme.Color(clrBorder)); //top
pixmap->DrawRectangle(cRect(0,0,2,height), theme.Color(clrBorder)); //left pixmap->DrawRectangle(cRect(0,0,2,height), theme.Color(clrBorder)); //left
pixmap->DrawRectangle(cRect(0,height-2,width,2), theme.Color(clrBorder)); //bottom pixmap->DrawRectangle(cRect(0,height-2,width,2), theme.Color(clrBorder)); //bottom
pixmap->DrawRectangle(cRect(width-2,0,2,height), theme.Color(clrBorder)); //right pixmap->DrawRectangle(cRect(width-2,0,2,height), theme.Color(clrBorder)); //right
} }
void cStyledPixmap::drawRoundedCorners(int width, int height, int radius) { void cStyledPixmap::drawRoundedCorners(int width, int height, int radius) {
pixmap->DrawEllipse(cRect(2,2,radius,radius), theme.Color(clrBorder), -2); pixmap->DrawEllipse(cRect(2,2,radius,radius), theme.Color(clrBorder), -2);
pixmap->DrawEllipse(cRect(1,1,radius,radius), clrTransparent, -2); pixmap->DrawEllipse(cRect(1,1,radius,radius), clrTransparent, -2);
pixmap->DrawEllipse(cRect(width-radius - 2,2,radius,radius), theme.Color(clrBorder), -1); pixmap->DrawEllipse(cRect(width-radius - 2,2,radius,radius), theme.Color(clrBorder), -1);
pixmap->DrawEllipse(cRect(width-radius - 1,1,radius,radius), clrTransparent, -1); pixmap->DrawEllipse(cRect(width-radius - 1,1,radius,radius), clrTransparent, -1);
if( height > 2*radius) { if( height > 2*radius) {
pixmap->DrawEllipse(cRect(2,height-radius - 2,radius,radius), theme.Color(clrBorder), -3); pixmap->DrawEllipse(cRect(2,height-radius - 2,radius,radius), theme.Color(clrBorder), -3);
pixmap->DrawEllipse(cRect(1,height-radius - 1,radius,radius), clrTransparent, -3); pixmap->DrawEllipse(cRect(1,height-radius - 1,radius,radius), clrTransparent, -3);
pixmap->DrawEllipse(cRect(width-radius - 2,height-radius - 2,radius,radius), theme.Color(clrBorder), -4); pixmap->DrawEllipse(cRect(width-radius - 2,height-radius - 2,radius,radius), theme.Color(clrBorder), -4);
pixmap->DrawEllipse(cRect(width-radius - 1,height-radius - 1,radius,radius), clrTransparent, -4); pixmap->DrawEllipse(cRect(width-radius - 1,height-radius - 1,radius,radius), clrTransparent, -4);
} }
} }
void cStyledPixmap::drawVerticalLine(int x, int yStart, int yStop, tColor col) { void cStyledPixmap::drawVerticalLine(int x, int yStart, int yStop, tColor col) {
for (int y = yStart; y <= yStop; y++) { for (int y = yStart; y <= yStop; y++) {
pixmap->DrawPixel(cPoint(x,y), col); pixmap->DrawPixel(cPoint(x,y), col);
} }
} }
void cStyledPixmap::drawHorizontalLine(int y, int xStart, int xStop, tColor col) { void cStyledPixmap::drawHorizontalLine(int y, int xStart, int xStop, tColor col) {
for (int x = xStart; x <= xStop; x++) { for (int x = xStart; x <= xStop; x++) {
pixmap->DrawPixel(cPoint(x,y), col); pixmap->DrawPixel(cPoint(x,y), col);
} }
} }
void cStyledPixmap::DrawText(const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font) { void cStyledPixmap::DrawText(const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font) {
pixmap->DrawText(Point, s, ColorFg, ColorBg, Font); pixmap->DrawText(Point, s, ColorFg, ColorBg, Font);
} }
void cStyledPixmap::DrawImage(const cPoint &Point, const cImage &Image) { void cStyledPixmap::DrawImage(const cPoint &Point, const cImage &Image) {
pixmap->DrawImage(Point, Image); pixmap->DrawImage(Point, Image);
} }
void cStyledPixmap::DrawRectangle(const cRect &Rect, tColor Color) { void cStyledPixmap::DrawRectangle(const cRect &Rect, tColor Color) {
pixmap->DrawRectangle(Rect,Color); pixmap->DrawRectangle(Rect,Color);
} }
void cStyledPixmap::DrawEllipse(const cRect &Rect, tColor Color, int Quadrant) { void cStyledPixmap::DrawEllipse(const cRect &Rect, tColor Color, int Quadrant) {
pixmap->DrawEllipse(Rect,Color,Quadrant); pixmap->DrawEllipse(Rect,Color,Quadrant);
} }
void cStyledPixmap::SetViewPort(const cRect &Rect) { void cStyledPixmap::SetViewPort(const cRect &Rect) {
pixmap->SetViewPort(Rect); pixmap->SetViewPort(Rect);
} }

View File

@ -1,58 +1,58 @@
#ifndef __TVGUIDE_STYLEDPIXMAP_H #ifndef __TVGUIDE_STYLEDPIXMAP_H
#define __TVGUIDE_STYLEDPIXMAP_H #define __TVGUIDE_STYLEDPIXMAP_H
#include <vdr/osd.h> #include <vdr/osd.h>
#include <vdr/epg.h> #include <vdr/epg.h>
#include "timer.h" #include "timer.h"
#include "config.h" #include "config.h"
enum eBackgroundType { enum eBackgroundType {
bgGrid, bgGrid,
bgStatusHeaderFull, bgStatusHeaderFull,
bgStatusHeaderWindowed, bgStatusHeaderWindowed,
bgChannelHeader, bgChannelHeader,
bgChannelGroup, bgChannelGroup,
bgClock, bgClock,
bgButton, bgButton,
bgRecMenuBack, bgRecMenuBack,
bgChannelJump, bgChannelJump,
}; };
// --- cStyledPixmap ------------------------------------------------------------- // --- cStyledPixmap -------------------------------------------------------------
class cStyledPixmap { class cStyledPixmap {
private: private:
void drawVerticalLine(int x, int yStart, int yStop, tColor col); void drawVerticalLine(int x, int yStart, int yStop, tColor col);
void drawHorizontalLine(int y, int xStart, int xStop, tColor col); void drawHorizontalLine(int y, int xStart, int xStop, tColor col);
void drawBackgroundButton(bool active); void drawBackgroundButton(bool active);
protected: protected:
cPixmap *pixmap; cPixmap *pixmap;
tColor color; tColor color;
tColor colorBlending; tColor colorBlending;
void setPixmap(cPixmap *pixmap); void setPixmap(cPixmap *pixmap);
public: public:
cStyledPixmap(void); cStyledPixmap(void);
cStyledPixmap(cPixmap *pixmap); cStyledPixmap(cPixmap *pixmap);
virtual ~cStyledPixmap(void); virtual ~cStyledPixmap(void);
void drawBackground(); void drawBackground();
void drawBackgroundGraphical(eBackgroundType type, bool active = false); void drawBackgroundGraphical(eBackgroundType type, bool active = false);
void drawBlendedBackground(); void drawBlendedBackground();
void drawSparsedBackground(); void drawSparsedBackground();
void drawBorder(); void drawBorder();
void drawBoldBorder(); void drawBoldBorder();
void drawDefaultBorder(int width, int height); void drawDefaultBorder(int width, int height);
void drawRoundedCorners(int width, int height, int radius); void drawRoundedCorners(int width, int height, int radius);
void setColor(tColor color, tColor colorBlending) {this->color = color; this->colorBlending = colorBlending;}; void setColor(tColor color, tColor colorBlending) {this->color = color; this->colorBlending = colorBlending;};
void SetAlpha(int alpha) {pixmap->SetAlpha(alpha);}; void SetAlpha(int alpha) {pixmap->SetAlpha(alpha);};
void SetLayer(int layer) {pixmap->SetLayer(layer);}; void SetLayer(int layer) {pixmap->SetLayer(layer);};
void Fill(tColor clr) {pixmap->Fill(clr);}; void Fill(tColor clr) {pixmap->Fill(clr);};
void DrawText(const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font); void DrawText(const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font);
void DrawImage(const cPoint &Point, const cImage &Image); void DrawImage(const cPoint &Point, const cImage &Image);
void DrawRectangle(const cRect &Rect, tColor Color); void DrawRectangle(const cRect &Rect, tColor Color);
void DrawEllipse(const cRect &Rect, tColor Color, int Quadrant); void DrawEllipse(const cRect &Rect, tColor Color, int Quadrant);
void SetViewPort(const cRect &Rect); void SetViewPort(const cRect &Rect);
int Width() {return pixmap->ViewPort().Width();}; int Width() {return pixmap->ViewPort().Width();};
int Height() {return pixmap->ViewPort().Height();}; int Height() {return pixmap->ViewPort().Height();};
}; };
#endif //__TVGUIDE_STYLEDPIXMAP_H #endif //__TVGUIDE_STYLEDPIXMAP_H

View File

@ -1,282 +1,282 @@
#include "imageloader.h" #include "imageloader.h"
#include "timeline.h" #include "timeline.h"
cTimeLine::cTimeLine(cMyTime *myTime) { cTimeLine::cTimeLine(cMyTime *myTime) {
this->myTime = myTime; this->myTime = myTime;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
dateViewer = new cStyledPixmap(osdManager.requestPixmap(1, cRect(0, dateViewer = new cStyledPixmap(osdManager.requestPixmap(1, cRect(0,
geoManager.statusHeaderHeight + geoManager.clockHeight, geoManager.statusHeaderHeight + geoManager.clockHeight,
geoManager.dateVieverWidth, geoManager.dateVieverWidth,
geoManager.dateVieverHeight))); geoManager.dateVieverHeight)));
timeline = osdManager.requestPixmap(2, cRect(0, timeline = osdManager.requestPixmap(2, cRect(0,
geoManager.statusHeaderHeight + geoManager.channelHeaderHeight + geoManager.channelGroupsHeight, geoManager.statusHeaderHeight + geoManager.channelHeaderHeight + geoManager.channelGroupsHeight,
geoManager.timeLineWidth, geoManager.timeLineWidth,
geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight) geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight)
, cRect(0, , cRect(0,
0, 0,
geoManager.timeLineWidth, geoManager.timeLineWidth,
1440*geoManager.minutePixel)); 1440*geoManager.minutePixel));
timeBase = osdManager.requestPixmap(3, cRect(0, timeBase = osdManager.requestPixmap(3, cRect(0,
geoManager.statusHeaderHeight + geoManager.channelGroupsHeight + geoManager.channelHeaderHeight, geoManager.statusHeaderHeight + geoManager.channelGroupsHeight + geoManager.channelHeaderHeight,
geoManager.osdWidth, geoManager.osdWidth,
geoManager.timeLineGridHeight)); geoManager.timeLineGridHeight));
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
dateViewer = new cStyledPixmap(osdManager.requestPixmap(1, cRect(geoManager.clockWidth, dateViewer = new cStyledPixmap(osdManager.requestPixmap(1, cRect(geoManager.clockWidth,
geoManager.statusHeaderHeight, geoManager.statusHeaderHeight,
geoManager.dateVieverWidth, geoManager.dateVieverWidth,
geoManager.dateVieverHeight))); geoManager.dateVieverHeight)));
timeline = osdManager.requestPixmap(2, cRect(geoManager.channelHeaderWidth + geoManager.channelGroupsWidth, timeline = osdManager.requestPixmap(2, cRect(geoManager.channelHeaderWidth + geoManager.channelGroupsWidth,
geoManager.statusHeaderHeight, geoManager.statusHeaderHeight,
geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth, geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth,
geoManager.timeLineHeight) geoManager.timeLineHeight)
, cRect(0, , cRect(0,
0, 0,
1440*geoManager.minutePixel, 1440*geoManager.minutePixel,
geoManager.timeLineHeight)); geoManager.timeLineHeight));
timeBase = osdManager.requestPixmap(3, cRect(geoManager.channelGroupsWidth + geoManager.channelHeaderWidth, timeBase = osdManager.requestPixmap(3, cRect(geoManager.channelGroupsWidth + geoManager.channelHeaderWidth,
geoManager.statusHeaderHeight, geoManager.statusHeaderHeight,
geoManager.timeLineGridWidth, geoManager.timeLineGridWidth,
geoManager.timeLineHeight + tvguideConfig.channelRows * geoManager.rowHeight)); geoManager.timeLineHeight + tvguideConfig.channelRows * geoManager.rowHeight));
} }
timeBase->Fill(clrTransparent); timeBase->Fill(clrTransparent);
int clockY; int clockY;
int clockX; int clockX;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
clockY = geoManager.statusHeaderHeight; clockY = geoManager.statusHeaderHeight;
clockX = 0; clockX = 0;
} }
else { else {
clockY = geoManager.statusHeaderHeight; clockY = geoManager.statusHeaderHeight;
clockX = 0; clockX = 0;
} }
clock = new cStyledPixmap(osdManager.requestPixmap(3, cRect(clockX, clock = new cStyledPixmap(osdManager.requestPixmap(3, cRect(clockX,
clockY, clockY,
geoManager.clockWidth, geoManager.clockWidth,
geoManager.clockHeight))); geoManager.clockHeight)));
} }
cTimeLine::~cTimeLine(void) { cTimeLine::~cTimeLine(void) {
delete dateViewer; delete dateViewer;
osdManager.releasePixmap(timeline); osdManager.releasePixmap(timeline);
if (clock) if (clock)
delete clock; delete clock;
} }
void cTimeLine::drawDateViewer() { void cTimeLine::drawDateViewer() {
cString weekDay = myTime->GetWeekday(); cString weekDay = myTime->GetWeekday();
cString date = myTime->GetDate(); cString date = myTime->GetDate();
if (tvguideConfig.style != eStyleGraphical) { if (tvguideConfig.style != eStyleGraphical) {
dateViewer->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending)); dateViewer->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
dateViewer->drawBackground(); dateViewer->drawBackground();
dateViewer->drawBorder(); dateViewer->drawBorder();
} else { } else {
cImage *imgBack = imgCache.GetOsdElement(oeDateViewer); cImage *imgBack = imgCache.GetOsdElement(oeDateViewer);
if (imgBack) if (imgBack)
dateViewer->DrawImage(cPoint(0,0), *imgBack); dateViewer->DrawImage(cPoint(0,0), *imgBack);
else else
dateViewer->Fill(clrTransparent); dateViewer->Fill(clrTransparent);
} }
tColor colorFont = theme.Color(clrButtonYellow); tColor colorFont = theme.Color(clrButtonYellow);
tColor colorFontBack = (tvguideConfig.style == eStyleFlat) ? theme.Color(clrHeader) : clrTransparent; tColor colorFontBack = (tvguideConfig.style == eStyleFlat) ? theme.Color(clrHeader) : clrTransparent;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
int textHeightWeekday = fontManager.FontTimeLineWeekday->Height(); int textHeightWeekday = fontManager.FontTimeLineWeekday->Height();
int textHeightDate = fontManager.FontTimeLineDate->Height(); int textHeightDate = fontManager.FontTimeLineDate->Height();
int weekdayWidth = fontManager.FontTimeLineWeekday->Width(*weekDay); int weekdayWidth = fontManager.FontTimeLineWeekday->Width(*weekDay);
int dateWidth = fontManager.FontTimeLineDate->Width(*date); int dateWidth = fontManager.FontTimeLineDate->Width(*date);
int y = ((geoManager.dateVieverHeight - textHeightWeekday - textHeightDate) / 2); int y = ((geoManager.dateVieverHeight - textHeightWeekday - textHeightDate) / 2);
dateViewer->DrawText(cPoint((geoManager.timeLineWidth - weekdayWidth) / 2, y), *weekDay, colorFont, colorFontBack, fontManager.FontTimeLineWeekday); dateViewer->DrawText(cPoint((geoManager.timeLineWidth - weekdayWidth) / 2, y), *weekDay, colorFont, colorFontBack, fontManager.FontTimeLineWeekday);
dateViewer->DrawText(cPoint((geoManager.timeLineWidth - dateWidth) / 2, y + textHeightWeekday), *date, colorFont, colorFontBack, fontManager.FontTimeLineDate); dateViewer->DrawText(cPoint((geoManager.timeLineWidth - dateWidth) / 2, y + textHeightWeekday), *date, colorFont, colorFontBack, fontManager.FontTimeLineDate);
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
cString strDate = cString::sprintf("%s %s", *weekDay, *date); cString strDate = cString::sprintf("%s %s", *weekDay, *date);
int x = ((dateViewer->Width() - fontManager.FontTimeLineDateHorizontal->Width(*strDate)) / 2); int x = ((dateViewer->Width() - fontManager.FontTimeLineDateHorizontal->Width(*strDate)) / 2);
int y = ((dateViewer->Height() - fontManager.FontTimeLineDateHorizontal->Height()) / 2); int y = ((dateViewer->Height() - fontManager.FontTimeLineDateHorizontal->Height()) / 2);
dateViewer->DrawText(cPoint(x, y), *strDate, colorFont, colorFontBack, fontManager.FontTimeLineDateHorizontal); dateViewer->DrawText(cPoint(x, y), *strDate, colorFont, colorFontBack, fontManager.FontTimeLineDateHorizontal);
} }
} }
void cTimeLine::drawTimeline() { void cTimeLine::drawTimeline() {
timeline->SetTile(true); timeline->SetTile(true);
timeline->Fill(clrTransparent); timeline->Fill(clrTransparent);
tColor colorFont, colorBackground; tColor colorFont, colorBackground;
int imgWidth = geoManager.timeLineGridWidth; int imgWidth = geoManager.timeLineGridWidth;
int imgHeight = geoManager.timeLineGridHeight; int imgHeight = geoManager.timeLineGridHeight;
const cImage *img1 = NULL; const cImage *img1 = NULL;
const cImage *img2 = NULL; const cImage *img2 = NULL;
if (tvguideConfig.style == eStyleGraphical) { if (tvguideConfig.style == eStyleGraphical) {
img1 = imgCache.GetOsdElement(oeTimeline1); img1 = imgCache.GetOsdElement(oeTimeline1);
img2 = imgCache.GetOsdElement(oeTimeline2); img2 = imgCache.GetOsdElement(oeTimeline2);
} else { } else {
img1 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline1), theme.Color(clrTimeline1Blending)); img1 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline1), theme.Color(clrTimeline1Blending));
img2 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline2), theme.Color(clrTimeline2Blending)); img2 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline2), theme.Color(clrTimeline2Blending));
} }
const cImage *img = NULL; const cImage *img = NULL;
if (!img1 || !img2) if (!img1 || !img2)
return; return;
int textWidth, posX, posY; int textWidth, posX, posY;
char timetext[10]; char timetext[10];
for (int i=0; i<48; i++) { for (int i=0; i<48; i++) {
if (i%2==0) { if (i%2==0) {
img = img1; img = img1;
colorFont = theme.Color(clrTimeline2); colorFont = theme.Color(clrTimeline2);
colorBackground = (tvguideConfig.style == eStyleFlat)?theme.Color(clrTimeline1):clrTransparent; colorBackground = (tvguideConfig.style == eStyleFlat)?theme.Color(clrTimeline1):clrTransparent;
if (tvguideConfig.timeFormat == e12Hours) { if (tvguideConfig.timeFormat == e12Hours) {
if (i == 0) if (i == 0)
sprintf(timetext, "12:00 PM"); sprintf(timetext, "12:00 PM");
else if (i/2 < 13) else if (i/2 < 13)
sprintf(timetext, "%d:00 AM", i/2); sprintf(timetext, "%d:00 AM", i/2);
else else
sprintf(timetext, "%d:00 PM", i/2-12); sprintf(timetext, "%d:00 PM", i/2-12);
} else { } else {
sprintf(timetext, "%d:00", i/2); sprintf(timetext, "%d:00", i/2);
} }
} else { } else {
img = img2; img = img2;
colorFont = theme.Color(clrTimeline1); colorFont = theme.Color(clrTimeline1);
colorBackground = (tvguideConfig.style == eStyleFlat)?theme.Color(clrTimeline2):clrTransparent; colorBackground = (tvguideConfig.style == eStyleFlat)?theme.Color(clrTimeline2):clrTransparent;
if (tvguideConfig.timeFormat == e12Hours) { if (tvguideConfig.timeFormat == e12Hours) {
if (i == 1) if (i == 1)
sprintf(timetext, "12:30 PM"); sprintf(timetext, "12:30 PM");
else if (i/2 < 13) else if (i/2 < 13)
sprintf(timetext, "%d:30 AM", i/2); sprintf(timetext, "%d:30 AM", i/2);
else else
sprintf(timetext, "%d:30 PM", i/2-12); sprintf(timetext, "%d:30 PM", i/2-12);
} else { } else {
sprintf(timetext, "%d:30", i/2); sprintf(timetext, "%d:30", i/2);
} }
} }
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
posY = i*geoManager.minutePixel*30; posY = i*geoManager.minutePixel*30;
timeline->DrawImage(cPoint(0, posY), *img); timeline->DrawImage(cPoint(0, posY), *img);
if (tvguideConfig.style != eStyleGraphical) { if (tvguideConfig.style != eStyleGraphical) {
decorateTile(0, posY, imgWidth+2, imgHeight); decorateTile(0, posY, imgWidth+2, imgHeight);
} }
textWidth = fontManager.FontTimeLineTime->Width(timetext); textWidth = fontManager.FontTimeLineTime->Width(timetext);
timeline->DrawText(cPoint((geoManager.timeLineWidth-textWidth)/2, posY + 5), timetext, colorFont, colorBackground, fontManager.FontTimeLineTime); timeline->DrawText(cPoint((geoManager.timeLineWidth-textWidth)/2, posY + 5), timetext, colorFont, colorBackground, fontManager.FontTimeLineTime);
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
posX = i*geoManager.minutePixel*30; posX = i*geoManager.minutePixel*30;
timeline->DrawImage(cPoint(posX, 0), *img); timeline->DrawImage(cPoint(posX, 0), *img);
if (tvguideConfig.style != eStyleGraphical) { if (tvguideConfig.style != eStyleGraphical) {
decorateTile(posX, 0, imgWidth, imgHeight+2); decorateTile(posX, 0, imgWidth, imgHeight+2);
} }
timeline->DrawText(cPoint(posX + 15, (dateViewer->Height() - fontManager.FontTimeLineTimeHorizontal->Height())/2), timetext, colorFont, colorBackground, fontManager.FontTimeLineTimeHorizontal); timeline->DrawText(cPoint(posX + 15, (dateViewer->Height() - fontManager.FontTimeLineTimeHorizontal->Height())/2), timetext, colorFont, colorBackground, fontManager.FontTimeLineTimeHorizontal);
} }
} }
setTimeline(); setTimeline();
if (tvguideConfig.style != eStyleGraphical) { if (tvguideConfig.style != eStyleGraphical) {
delete img1; delete img1;
delete img2; delete img2;
} }
} }
void cTimeLine::decorateTile(int posX, int posY, int tileWidth, int tileHeight) { void cTimeLine::decorateTile(int posX, int posY, int tileWidth, int tileHeight) {
timeline->DrawRectangle(cRect(posX,posY,tileWidth,2), clrTransparent); //top timeline->DrawRectangle(cRect(posX,posY,tileWidth,2), clrTransparent); //top
timeline->DrawRectangle(cRect(posX,posY,2,tileHeight), clrTransparent); //left timeline->DrawRectangle(cRect(posX,posY,2,tileHeight), clrTransparent); //left
timeline->DrawRectangle(cRect(posX,posY + tileHeight-2,tileWidth,2), clrTransparent); //bottom timeline->DrawRectangle(cRect(posX,posY + tileHeight-2,tileWidth,2), clrTransparent); //bottom
timeline->DrawRectangle(cRect(posX + tileWidth-2,posY,2,tileHeight), clrTransparent); //right timeline->DrawRectangle(cRect(posX + tileWidth-2,posY,2,tileHeight), clrTransparent); //right
timeline->DrawRectangle(cRect(2+posX,posY+2,tileWidth-4,1), theme.Color(clrBorder)); //top timeline->DrawRectangle(cRect(2+posX,posY+2,tileWidth-4,1), theme.Color(clrBorder)); //top
timeline->DrawRectangle(cRect(2+posX,posY+2,1,tileHeight-4), theme.Color(clrBorder)); //left timeline->DrawRectangle(cRect(2+posX,posY+2,1,tileHeight-4), theme.Color(clrBorder)); //left
timeline->DrawRectangle(cRect(2+posX,posY+tileHeight-3,tileWidth-4,1), theme.Color(clrBorder)); //bottom timeline->DrawRectangle(cRect(2+posX,posY+tileHeight-3,tileWidth-4,1), theme.Color(clrBorder)); //bottom
timeline->DrawRectangle(cRect(posX+tileWidth-3,posY+2,1,tileHeight-4), theme.Color(clrBorder)); //right timeline->DrawRectangle(cRect(posX+tileWidth-3,posY+2,1,tileHeight-4), theme.Color(clrBorder)); //right
if (tvguideConfig.roundedCorners) { if (tvguideConfig.roundedCorners) {
int borderRadius = 12; int borderRadius = 12;
drawRoundedCorners(posX, posY, tileWidth, tileHeight, borderRadius); drawRoundedCorners(posX, posY, tileWidth, tileHeight, borderRadius);
} }
} }
void cTimeLine::drawRoundedCorners(int posX, int posY, int width, int height, int radius) { void cTimeLine::drawRoundedCorners(int posX, int posY, int width, int height, int radius) {
timeline->DrawEllipse(cRect(posX+2,posY+2,radius,radius), theme.Color(clrBorder), -2); timeline->DrawEllipse(cRect(posX+2,posY+2,radius,radius), theme.Color(clrBorder), -2);
timeline->DrawEllipse(cRect(posX+1,posY+1,radius,radius), clrTransparent, -2); timeline->DrawEllipse(cRect(posX+1,posY+1,radius,radius), clrTransparent, -2);
timeline->DrawEllipse(cRect(posX+width-radius - 2,posY+2,radius,radius), theme.Color(clrBorder), -1); timeline->DrawEllipse(cRect(posX+width-radius - 2,posY+2,radius,radius), theme.Color(clrBorder), -1);
timeline->DrawEllipse(cRect(posX+width-radius - 1,posY+1,radius,radius), clrTransparent, -1); timeline->DrawEllipse(cRect(posX+width-radius - 1,posY+1,radius,radius), clrTransparent, -1);
if( height > 2*radius) { if( height > 2*radius) {
timeline->DrawEllipse(cRect(posX+2,posY+height-radius - 2,radius,radius), theme.Color(clrBorder), -3); timeline->DrawEllipse(cRect(posX+2,posY+height-radius - 2,radius,radius), theme.Color(clrBorder), -3);
timeline->DrawEllipse(cRect(posX+1,posY+height-radius - 1,radius,radius), clrTransparent, -3); timeline->DrawEllipse(cRect(posX+1,posY+height-radius - 1,radius,radius), clrTransparent, -3);
timeline->DrawEllipse(cRect(posX+width-radius - 2,posY+height-radius - 2,radius,radius), theme.Color(clrBorder), -4); timeline->DrawEllipse(cRect(posX+width-radius - 2,posY+height-radius - 2,radius,radius), theme.Color(clrBorder), -4);
timeline->DrawEllipse(cRect(posX+width-radius - 1,posY+height-radius - 1,radius,radius), clrTransparent, -4); timeline->DrawEllipse(cRect(posX+width-radius - 1,posY+height-radius - 1,radius,radius), clrTransparent, -4);
} }
} }
void cTimeLine::drawCurrentTimeBase(void) { void cTimeLine::drawCurrentTimeBase(void) {
timeBase->Fill(clrTransparent); timeBase->Fill(clrTransparent);
bool nowVisible = myTime->NowVisible(); bool nowVisible = myTime->NowVisible();
if (!nowVisible) if (!nowVisible)
return; return;
int deltaTime = (myTime->GetNow() - myTime->GetStart()) / 60 * geoManager.minutePixel; int deltaTime = (myTime->GetNow() - myTime->GetStart()) / 60 * geoManager.minutePixel;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
timeBase->DrawRectangle(cRect(0, deltaTime - 2, timeBase->ViewPort().Width(), 4), theme.Color(clrTimeBase)); timeBase->DrawRectangle(cRect(0, deltaTime - 2, timeBase->ViewPort().Width(), 4), theme.Color(clrTimeBase));
} else { } else {
timeBase->DrawRectangle(cRect(deltaTime-2, 0, 4, timeBase->ViewPort().Height()), theme.Color(clrTimeBase)); timeBase->DrawRectangle(cRect(deltaTime-2, 0, 4, timeBase->ViewPort().Height()), theme.Color(clrTimeBase));
} }
} }
cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend) { cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend) {
cImage *image = NULL; cImage *image = NULL;
if (tvguideConfig.style == eStyleBlendingDefault) { if (tvguideConfig.style == eStyleBlendingDefault) {
image = new cImage(cSize(width, height)); image = new cImage(cSize(width, height));
image->Fill(clrBgr); image->Fill(clrBgr);
int stepY = 0.5*height / 64; int stepY = 0.5*height / 64;
int alpha = 0x00; int alpha = 0x00;
tColor clr; tColor clr;
for (int i = 0; i<64; i++) { for (int i = 0; i<64; i++) {
clr = AlphaBlend(clrBgr, clrBlend, alpha); clr = AlphaBlend(clrBgr, clrBlend, alpha);
for (int y = i*stepY; y < (i+1)*stepY; y++) { for (int y = i*stepY; y < (i+1)*stepY; y++) {
for (int x=0; x<width; x++) { for (int x=0; x<width; x++) {
image->SetPixel(cPoint(x,y), clr); image->SetPixel(cPoint(x,y), clr);
} }
} }
alpha += 0x04; alpha += 0x04;
} }
} else if (tvguideConfig.style == eStyleBlendingMagick) { } else if (tvguideConfig.style == eStyleBlendingMagick) {
cImageLoader imgLoader; cImageLoader imgLoader;
if (imgLoader.DrawBackground(clrBgr, clrBlend, width, height)) { if (imgLoader.DrawBackground(clrBgr, clrBlend, width, height)) {
image = new cImage(imgLoader.GetImage()); image = new cImage(imgLoader.GetImage());
} }
} else { } else {
image = new cImage(cSize(width, height)); image = new cImage(cSize(width, height));
image->Fill(clrBgr); image->Fill(clrBgr);
} }
return image; return image;
} }
void cTimeLine::setTimeline() { void cTimeLine::setTimeline() {
int offset = myTime->GetTimelineOffset(); int offset = myTime->GetTimelineOffset();
int xNew, yNew; int xNew, yNew;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
xNew = 0; xNew = 0;
yNew = -offset*geoManager.minutePixel; yNew = -offset*geoManager.minutePixel;
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
xNew = -offset*geoManager.minutePixel; xNew = -offset*geoManager.minutePixel;
yNew = 0; yNew = 0;
} }
timeline->SetDrawPortPoint(cPoint(xNew, yNew)); timeline->SetDrawPortPoint(cPoint(xNew, yNew));
if (tvguideConfig.displayTimeBase) if (tvguideConfig.displayTimeBase)
drawCurrentTimeBase(); drawCurrentTimeBase();
} }
void cTimeLine::drawClock() { void cTimeLine::drawClock() {
if (tvguideConfig.displayMode == eVertical) if (tvguideConfig.displayMode == eVertical)
clock->Fill(clrTransparent); clock->Fill(clrTransparent);
cString currentTime = myTime->GetCurrentTime(); cString currentTime = myTime->GetCurrentTime();
const cFont *font = (tvguideConfig.displayMode == eVertical)?fontManager.FontTimeLineTime:fontManager.FontTimeLineTimeHorizontal; const cFont *font = (tvguideConfig.displayMode == eVertical)?fontManager.FontTimeLineTime:fontManager.FontTimeLineTimeHorizontal;
int textHeight = font->Height(); int textHeight = font->Height();
int clockTextWidth = font->Width(*currentTime); int clockTextWidth = font->Width(*currentTime);
tColor colorFontBack = (tvguideConfig.style == eStyleFlat)?theme.Color(clrHeader):clrTransparent; tColor colorFontBack = (tvguideConfig.style == eStyleFlat)?theme.Color(clrHeader):clrTransparent;
if (tvguideConfig.style == eStyleGraphical) { if (tvguideConfig.style == eStyleGraphical) {
clock->drawBackgroundGraphical(bgClock); clock->drawBackgroundGraphical(bgClock);
} else { } else {
clock->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending)); clock->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
clock->drawBackground(); clock->drawBackground();
clock->drawBorder(); clock->drawBorder();
} }
clock->DrawText(cPoint((geoManager.clockWidth-clockTextWidth)/2, (geoManager.clockHeight-textHeight)/2), *currentTime, theme.Color(clrFont), colorFontBack, font); clock->DrawText(cPoint((geoManager.clockWidth-clockTextWidth)/2, (geoManager.clockHeight-textHeight)/2), *currentTime, theme.Color(clrFont), colorFontBack, font);
} }

View File

@ -1,29 +1,29 @@
#ifndef __TVGUIDE_TIMELINE_H #ifndef __TVGUIDE_TIMELINE_H
#define __TVGUIDE_TIMELINE_H #define __TVGUIDE_TIMELINE_H
#include "timer.h" #include "timer.h"
#include "styledpixmap.h" #include "styledpixmap.h"
// --- cTimeLine ------------------------------------------------------------- // --- cTimeLine -------------------------------------------------------------
class cTimeLine { class cTimeLine {
private: private:
cMyTime *myTime; cMyTime *myTime;
cStyledPixmap *dateViewer; cStyledPixmap *dateViewer;
cPixmap *timeline; cPixmap *timeline;
cStyledPixmap *clock; cStyledPixmap *clock;
cPixmap *timeBase; cPixmap *timeBase;
void decorateTile(int posX, int posY, int tileWidth, int tileHeight); void decorateTile(int posX, int posY, int tileWidth, int tileHeight);
void drawRoundedCorners(int posX, int posY, int width, int height, int radius); void drawRoundedCorners(int posX, int posY, int width, int height, int radius);
cImage *createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend); cImage *createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend);
void drawCurrentTimeBase(void); void drawCurrentTimeBase(void);
public: public:
cTimeLine(cMyTime *myTime); cTimeLine(cMyTime *myTime);
virtual ~cTimeLine(void); virtual ~cTimeLine(void);
void setTimeline(); void setTimeline();
void drawDateViewer(); void drawDateViewer();
void drawTimeline(); void drawTimeline();
void drawClock(); void drawClock();
}; };
#endif //__TVGUIDE_TIMELINE_H #endif //__TVGUIDE_TIMELINE_H

356
timer.c
View File

@ -1,178 +1,178 @@
#include <time.h> #include <time.h>
#include <vdr/tools.h> #include <vdr/tools.h>
#include "config.h" #include "config.h"
#include "timer.h" #include "timer.h"
cMyTime::~cMyTime(void) { cMyTime::~cMyTime(void) {
} }
cString cMyTime::printTime(time_t displayTime) { cString cMyTime::printTime(time_t displayTime) {
struct tm *ts; struct tm *ts;
ts = localtime(&displayTime); ts = localtime(&displayTime);
cString strTime = cString::sprintf("%d.%d-%d:%d.%d", ts->tm_mday, ts->tm_mon+1, ts->tm_hour, ts->tm_min, ts->tm_sec); cString strTime = cString::sprintf("%d.%d-%d:%d.%d", ts->tm_mday, ts->tm_mon+1, ts->tm_hour, ts->tm_min, ts->tm_sec);
return strTime; return strTime;
} }
void cMyTime::Now() { void cMyTime::Now() {
t = time(0); t = time(0);
tStart = t; tStart = t;
tStart = GetRounded(); tStart = GetRounded();
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
tEnd = tStart + (geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight)/geoManager.minutePixel*60; tEnd = tStart + (geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight)/geoManager.minutePixel*60;
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
tEnd = tStart + (geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth)/geoManager.minutePixel*60; tEnd = tStart + (geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth)/geoManager.minutePixel*60;
} }
} }
void cMyTime::AddStep(int step) { void cMyTime::AddStep(int step) {
tStart += step*60; tStart += step*60;
tEnd += step*60; tEnd += step*60;
} }
bool cMyTime::DelStep(int step) { bool cMyTime::DelStep(int step) {
if ((tStart - step*60)+30*60 < t) { if ((tStart - step*60)+30*60 < t) {
return true; return true;
} }
tStart -= step*60; tStart -= step*60;
tEnd -= step*60; tEnd -= step*60;
return false; return false;
} }
void cMyTime::SetTime(time_t newTime) { void cMyTime::SetTime(time_t newTime) {
tStart = newTime; tStart = newTime;
if (tvguideConfig.displayMode == eVertical) { if (tvguideConfig.displayMode == eVertical) {
tEnd = tStart + (geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight)/geoManager.minutePixel*60; tEnd = tStart + (geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight)/geoManager.minutePixel*60;
} else if (tvguideConfig.displayMode == eHorizontal) { } else if (tvguideConfig.displayMode == eHorizontal) {
tEnd = tStart + (geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth)/geoManager.minutePixel*60; tEnd = tStart + (geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth)/geoManager.minutePixel*60;
} }
} }
time_t cMyTime::getPrevPrimetime(time_t current) { time_t cMyTime::getPrevPrimetime(time_t current) {
tm *st = localtime(&current); tm *st = localtime(&current);
if (st->tm_hour < 21) { if (st->tm_hour < 21) {
current -= 24 * 60* 60; current -= 24 * 60* 60;
st = localtime(&current); st = localtime(&current);
} }
st->tm_hour = 20; st->tm_hour = 20;
st->tm_min = 0; st->tm_min = 0;
time_t primeTime = mktime(st); time_t primeTime = mktime(st);
return primeTime; return primeTime;
} }
time_t cMyTime::getNextPrimetime(time_t current){ time_t cMyTime::getNextPrimetime(time_t current){
tm *st = localtime(&current); tm *st = localtime(&current);
if (st->tm_hour > 19) { if (st->tm_hour > 19) {
current += 24 * 60* 60; current += 24 * 60* 60;
st = localtime(&current); st = localtime(&current);
} }
st->tm_hour = 20; st->tm_hour = 20;
st->tm_min = 0; st->tm_min = 0;
time_t primeTime = mktime(st); time_t primeTime = mktime(st);
return primeTime; return primeTime;
} }
bool cMyTime::tooFarInPast(time_t current) { bool cMyTime::tooFarInPast(time_t current) {
if (current < t) { if (current < t) {
return true; return true;
} }
return false; return false;
} }
cString cMyTime::GetCurrentTime() { cString cMyTime::GetCurrentTime() {
char buf[25]; char buf[25];
t = time(0); t = time(0);
tm *st = localtime(&t); tm *st = localtime(&t);
//snprintf(text, sizeof(text), "%d:%02d", st->tm_hour, st->tm_min); //snprintf(text, sizeof(text), "%d:%02d", st->tm_hour, st->tm_min);
if (tvguideConfig.timeFormat == e12Hours) { if (tvguideConfig.timeFormat == e12Hours) {
strftime(buf, sizeof(buf), "%I:%M %p", st); strftime(buf, sizeof(buf), "%I:%M %p", st);
} else if (tvguideConfig.timeFormat == e24Hours) } else if (tvguideConfig.timeFormat == e24Hours)
strftime(buf, sizeof(buf), "%H:%M", st); strftime(buf, sizeof(buf), "%H:%M", st);
return buf; return buf;
} }
cString cMyTime::GetDate() { cString cMyTime::GetDate() {
char text[6]; char text[6];
tm *st = localtime(&tStart); tm *st = localtime(&tStart);
snprintf(text, sizeof(text), "%d.%d", st->tm_mday, st->tm_mon+1); snprintf(text, sizeof(text), "%d.%d", st->tm_mday, st->tm_mon+1);
return text; return text;
} }
cString cMyTime::GetWeekday() { cString cMyTime::GetWeekday() {
return WeekDayName(tStart); return WeekDayName(tStart);
} }
int cMyTime::GetTimelineOffset() { int cMyTime::GetTimelineOffset() {
tm *st = localtime(&tStart); tm *st = localtime(&tStart);
int offset = st->tm_hour*60; int offset = st->tm_hour*60;
offset += st->tm_min; offset += st->tm_min;
return offset; return offset;
} }
time_t cMyTime::GetRounded() { time_t cMyTime::GetRounded() {
tm *rounded = localtime ( &tStart ); tm *rounded = localtime ( &tStart );
rounded->tm_sec = 0; rounded->tm_sec = 0;
if (rounded->tm_min > 29) if (rounded->tm_min > 29)
rounded->tm_min = 30; rounded->tm_min = 30;
else else
rounded->tm_min = 0; rounded->tm_min = 0;
return mktime(rounded); return mktime(rounded);
} }
bool cMyTime::NowVisible(void) { bool cMyTime::NowVisible(void) {
if (t > tStart) if (t > tStart)
return true; return true;
return false; return false;
} }
void cMyTime::debug() { void cMyTime::debug() {
esyslog("t: %s, tStart: %s, tEnd: %s", *TimeString(t), *TimeString(tStart), *TimeString(tEnd)); esyslog("t: %s, tStart: %s, tEnd: %s", *TimeString(t), *TimeString(tStart), *TimeString(tEnd));
} }
// --- cTimeInterval ------------------------------------------------------------- // --- cTimeInterval -------------------------------------------------------------
cTimeInterval::cTimeInterval(time_t start, time_t stop) { cTimeInterval::cTimeInterval(time_t start, time_t stop) {
this->start = start; this->start = start;
this->stop = stop; this->stop = stop;
} }
cTimeInterval::~cTimeInterval(void) { cTimeInterval::~cTimeInterval(void) {
} }
cTimeInterval *cTimeInterval::Intersect(cTimeInterval *interval) { cTimeInterval *cTimeInterval::Intersect(cTimeInterval *interval) {
time_t startIntersect, stopIntersect; time_t startIntersect, stopIntersect;
if ((stop <= interval->Start()) || (interval->Stop() <= start)) { if ((stop <= interval->Start()) || (interval->Stop() <= start)) {
return NULL; return NULL;
} }
if (start <= interval->Start()) { if (start <= interval->Start()) {
startIntersect = interval->Start(); startIntersect = interval->Start();
} else { } else {
startIntersect = start; startIntersect = start;
} }
if (stop <= interval->Stop()) { if (stop <= interval->Stop()) {
stopIntersect = stop; stopIntersect = stop;
} else { } else {
stopIntersect = interval->Stop(); stopIntersect = interval->Stop();
} }
return new cTimeInterval(startIntersect, stopIntersect); return new cTimeInterval(startIntersect, stopIntersect);
} }
cTimeInterval *cTimeInterval::Union(cTimeInterval *interval) { cTimeInterval *cTimeInterval::Union(cTimeInterval *interval) {
time_t startUnion, stopUnion; time_t startUnion, stopUnion;
if (start <= interval->Start()) { if (start <= interval->Start()) {
startUnion = start; startUnion = start;
} else { } else {
startUnion = interval->Start(); startUnion = interval->Start();
} }
if (stop <= interval->Stop()) { if (stop <= interval->Stop()) {
stopUnion = interval->Stop(); stopUnion = interval->Stop();
} else { } else {
stopUnion = stop; stopUnion = stop;
} }
return new cTimeInterval(startUnion, stopUnion); return new cTimeInterval(startUnion, stopUnion);
} }

104
timer.h
View File

@ -1,52 +1,52 @@
#ifndef __TVGUIDE_TIMER_H #ifndef __TVGUIDE_TIMER_H
#define __TVGUIDE_TIMER_H #define __TVGUIDE_TIMER_H
#include <vdr/tools.h> #include <vdr/tools.h>
// --- cMyTime ------------------------------------------------------------- // --- cMyTime -------------------------------------------------------------
class cMyTime { class cMyTime {
private: private:
time_t t; time_t t;
time_t tStart; time_t tStart;
time_t tEnd; time_t tEnd;
public: public:
cMyTime(){}; cMyTime(){};
virtual ~cMyTime(void); virtual ~cMyTime(void);
static cString printTime(time_t displayTime); static cString printTime(time_t displayTime);
void Now(); void Now();
time_t GetNow() { return t; }; time_t GetNow() { return t; };
void AddStep(int step); void AddStep(int step);
bool DelStep(int step); bool DelStep(int step);
void SetTime(time_t newTime); void SetTime(time_t newTime);
time_t Get() {return t;}; time_t Get() {return t;};
time_t GetStart() {return tStart;}; time_t GetStart() {return tStart;};
time_t GetEnd() {return tEnd;}; time_t GetEnd() {return tEnd;};
cString GetCurrentTime(); cString GetCurrentTime();
cString GetDate(); cString GetDate();
cString GetWeekday(); cString GetWeekday();
time_t getPrevPrimetime(time_t current); time_t getPrevPrimetime(time_t current);
time_t getNextPrimetime(time_t current); time_t getNextPrimetime(time_t current);
bool tooFarInPast(time_t current); bool tooFarInPast(time_t current);
int GetTimelineOffset(); int GetTimelineOffset();
time_t GetRounded(); time_t GetRounded();
bool NowVisible(void); bool NowVisible(void);
void debug(); void debug();
}; };
// --- cTimeInterval ------------------------------------------------------------- // --- cTimeInterval -------------------------------------------------------------
class cTimeInterval { class cTimeInterval {
private: private:
time_t start; time_t start;
time_t stop; time_t stop;
public: public:
cTimeInterval(time_t start, time_t stop); cTimeInterval(time_t start, time_t stop);
virtual ~cTimeInterval(void); virtual ~cTimeInterval(void);
time_t Start(void) { return start; }; time_t Start(void) { return start; };
time_t Stop(void) { return stop; }; time_t Stop(void) { return stop; };
cTimeInterval *Intersect(cTimeInterval *interval); cTimeInterval *Intersect(cTimeInterval *interval);
cTimeInterval *Union(cTimeInterval *interval); cTimeInterval *Union(cTimeInterval *interval);
}; };
#endif //__TVGUIDE_TIMER_H #endif //__TVGUIDE_TIMER_H

File diff suppressed because it is too large Load Diff

View File

@ -1,65 +1,65 @@
#ifndef __TVGUIDE_TVGUIDEOSD_H #ifndef __TVGUIDE_TVGUIDEOSD_H
#define __TVGUIDE_TVGUIDEOSD_H #define __TVGUIDE_TVGUIDEOSD_H
#include "timer.h" #include "timer.h"
#include "grid.h" #include "grid.h"
#include "channelcolumn.h" #include "channelcolumn.h"
#include "statusheader.h" #include "statusheader.h"
#include "detailview.h" #include "detailview.h"
#include "timeline.h" #include "timeline.h"
#include "channelgroups.h" #include "channelgroups.h"
#include "footer.h" #include "footer.h"
#include "recmenuview.h" #include "recmenuview.h"
#include "channeljump.h" #include "channeljump.h"
// --- cTvGuideOsd ------------------------------------------------------------- // --- cTvGuideOsd -------------------------------------------------------------
class cTvGuideOsd : public cOsdObject { class cTvGuideOsd : public cOsdObject {
private: private:
cMyTime *myTime; cMyTime *myTime;
cList<cChannelColumn> columns; cList<cChannelColumn> columns;
cGrid *activeGrid; cGrid *activeGrid;
cStatusHeader *statusHeader; cStatusHeader *statusHeader;
cDetailView *detailView; cDetailView *detailView;
cTimeLine *timeLine; cTimeLine *timeLine;
cChannelGroups *channelGroups; cChannelGroups *channelGroups;
cFooter *footer; cFooter *footer;
cRecMenuView *recMenuView; cRecMenuView *recMenuView;
cChannelJump *channelJumper; cChannelJump *channelJumper;
bool detailViewActive; bool detailViewActive;
void drawOsd(); void drawOsd();
void readChannels(const cChannel *channelStart); void readChannels(const cChannel *channelStart);
void drawGridsChannelJump(int offset = 0); void drawGridsChannelJump(int offset = 0);
void drawGridsTimeJump(); void drawGridsTimeJump();
void processKeyUp(); void processKeyUp();
void processKeyDown(); void processKeyDown();
void processKeyLeft(); void processKeyLeft();
void processKeyRight(); void processKeyRight();
void processKeyRed(); void processKeyRed();
void processKeyGreen(); void processKeyGreen();
void processKeyYellow(); void processKeyYellow();
eOSState processKeyBlue(bool *alreadyUnlocked); eOSState processKeyBlue(bool *alreadyUnlocked);
eOSState processKeyOk(bool *alreadyUnlocked); eOSState processKeyOk(bool *alreadyUnlocked);
void processNumKey(int numKey); void processNumKey(int numKey);
void TimeJump(int mode); void TimeJump(int mode);
void ChannelJump(int num); void ChannelJump(int num);
void CheckTimeout(void); void CheckTimeout(void);
void setNextActiveGrid(cGrid *next); void setNextActiveGrid(cGrid *next);
void channelForward(); void channelForward();
void channelBack(); void channelBack();
void timeForward(); void timeForward();
void timeBack(); void timeBack();
void ScrollForward(); void ScrollForward();
void ScrollBack(); void ScrollBack();
eOSState ChannelSwitch(bool *alreadyUnlocked); eOSState ChannelSwitch(bool *alreadyUnlocked);
void DetailedEPG(); void DetailedEPG();
void SetTimers(); void SetTimers();
void dump(); void dump();
public: public:
cTvGuideOsd(void); cTvGuideOsd(void);
virtual ~cTvGuideOsd(void); virtual ~cTvGuideOsd(void);
virtual void Show(void); virtual void Show(void);
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
}; };
#endif //__TVGUIDE_TVGUIDEOSD_H #endif //__TVGUIDE_TVGUIDEOSD_H

2124
view.c

File diff suppressed because it is too large Load Diff

298
view.h
View File

@ -1,149 +1,149 @@
#ifndef __TVGUIDE_VIEW_H #ifndef __TVGUIDE_VIEW_H
#define __TVGUIDE_VIEW_H #define __TVGUIDE_VIEW_H
#include <vector> #include <vector>
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <vdr/skins.h> #include <vdr/skins.h>
#include "services/scraper2vdr.h" #include "services/scraper2vdr.h"
#include "services/epgsearch.h" #include "services/epgsearch.h"
#include "services/remotetimers.h" #include "services/remotetimers.h"
#include "config.h" #include "config.h"
#include "imagecache.h" #include "imagecache.h"
#include "imageloader.h" #include "imageloader.h"
#include "tools.h" #include "tools.h"
enum eEPGViewTabs { enum eEPGViewTabs {
evtInfo = 0, evtInfo = 0,
evtAddInfo, evtAddInfo,
evtImages, evtImages,
evtCount evtCount
}; };
enum eMediaViewTabs { enum eMediaViewTabs {
mvtInfo = 0, mvtInfo = 0,
mvtAddInfo, mvtAddInfo,
mvtCast, mvtCast,
mvtOnlineInfo, mvtOnlineInfo,
mvtImages, mvtImages,
mvtCount mvtCount
}; };
class cView : public cThread { class cView : public cThread {
protected: protected:
const cEvent *event; const cEvent *event;
cPixmap *pixmapBackground; cPixmap *pixmapBackground;
cStyledPixmap *pixmapHeader; cStyledPixmap *pixmapHeader;
cPixmap *pixmapHeaderLogo; cPixmap *pixmapHeaderLogo;
cPixmap *pixmapContent; cPixmap *pixmapContent;
cPixmap *pixmapScrollbar; cPixmap *pixmapScrollbar;
cPixmap *pixmapScrollbarBack; cPixmap *pixmapScrollbarBack;
cPixmap *pixmapTabs; cPixmap *pixmapTabs;
cFont *font, *fontSmall, *fontHeader, *fontHeaderLarge; cFont *font, *fontSmall, *fontHeader, *fontHeaderLarge;
cImage *imgScrollBar; cImage *imgScrollBar;
int activeView; int activeView;
bool scrollable; bool scrollable;
bool tabbed; bool tabbed;
int x, y; int x, y;
int width, height; int width, height;
int border; int border;
int headerWidth, headerHeight; int headerWidth, headerHeight;
int contentHeight; int contentHeight;
int tabHeight; int tabHeight;
int scrollbarWidth; int scrollbarWidth;
std::vector<std::string> tabs; std::vector<std::string> tabs;
std::string title; std::string title;
std::string subTitle; std::string subTitle;
std::string dateTime; std::string dateTime;
std::string infoText; std::string infoText;
std::string addInfoText; std::string addInfoText;
const cChannel *channel; const cChannel *channel;
int eventID; int eventID;
bool headerDrawn; bool headerDrawn;
void DrawHeader(void); void DrawHeader(void);
void ClearContent(void); void ClearContent(void);
void CreateContent(int fullHeight); void CreateContent(int fullHeight);
void DrawContent(std::string *text); void DrawContent(std::string *text);
void DrawFloatingContent(std::string *infoText, cTvMedia *img, cTvMedia *img2 = NULL); void DrawFloatingContent(std::string *infoText, cTvMedia *img, cTvMedia *img2 = NULL);
void CreateFloatingTextWrapper(cTextWrapper *twNarrow, cTextWrapper *twFull, std::string *text, int widthImg, int heightImg); void CreateFloatingTextWrapper(cTextWrapper *twNarrow, cTextWrapper *twFull, std::string *text, int widthImg, int heightImg);
void DrawActors(std::vector<cActor> *actors); void DrawActors(std::vector<cActor> *actors);
void ClearScrollbar(void); void ClearScrollbar(void);
void ClearScrollbarImage(void); void ClearScrollbarImage(void);
cImage *CreateScrollbarImage(int width, int height, tColor clrBgr, tColor clrBlend); cImage *CreateScrollbarImage(int width, int height, tColor clrBgr, tColor clrBlend);
virtual void SetTabs(void) {}; virtual void SetTabs(void) {};
void DrawTabs(void); void DrawTabs(void);
public: public:
cView(void); cView(void);
virtual ~cView(void); virtual ~cView(void);
void SetTitle(const char *t) { title = t ? t : ""; }; void SetTitle(const char *t) { title = t ? t : ""; };
void SetSubTitle(const char *s) { subTitle = s ? s : ""; }; void SetSubTitle(const char *s) { subTitle = s ? s : ""; };
void SetDateTime(const char *dt) { dateTime = dt; }; void SetDateTime(const char *dt) { dateTime = dt; };
void SetInfoText(const char *i) { infoText = i ? i : ""; }; void SetInfoText(const char *i) { infoText = i ? i : ""; };
void SetAdditionalInfoText(std::string addInfo) { addInfoText = addInfo; }; void SetAdditionalInfoText(std::string addInfo) { addInfoText = addInfo; };
void SetChannel(const cChannel *c) { channel = c; }; void SetChannel(const cChannel *c) { channel = c; };
void SetEventID(int id) { eventID = id; }; void SetEventID(int id) { eventID = id; };
void SetEvent(const cEvent *event) { this->event = event; }; void SetEvent(const cEvent *event) { this->event = event; };
virtual void LoadMedia(void) {}; virtual void LoadMedia(void) {};
void SetGeometry(void); void SetGeometry(void);
void SetFonts(void); void SetFonts(void);
virtual bool KeyUp(void); virtual bool KeyUp(void);
virtual bool KeyDown(void); virtual bool KeyDown(void);
virtual void KeyLeft(void) {}; virtual void KeyLeft(void) {};
virtual void KeyRight(void) {}; virtual void KeyRight(void) {};
void DrawScrollbar(void); void DrawScrollbar(void);
virtual void Action(void) {}; virtual void Action(void) {};
}; };
class cEPGView : public cView { class cEPGView : public cView {
protected: protected:
std::vector<std::string> epgPics; std::vector<std::string> epgPics;
int numEPGPics; int numEPGPics;
int numTabs; int numTabs;
void SetTabs(void); void SetTabs(void);
void CheckEPGImages(void); void CheckEPGImages(void);
void DrawImages(void); void DrawImages(void);
public: public:
cEPGView(void); cEPGView(void);
virtual ~cEPGView(void); virtual ~cEPGView(void);
void KeyLeft(void); void KeyLeft(void);
void KeyRight(void); void KeyRight(void);
void Action(void); void Action(void);
}; };
class cSeriesView : public cView { class cSeriesView : public cView {
protected: protected:
int seriesId; int seriesId;
int episodeId; int episodeId;
cSeries series; cSeries series;
std::string tvdbInfo; std::string tvdbInfo;
void SetTabs(void); void SetTabs(void);
void CreateTVDBInfo(void); void CreateTVDBInfo(void);
void DrawImages(void); void DrawImages(void);
int GetRandomPoster(void); int GetRandomPoster(void);
public: public:
cSeriesView(int seriesId, int episodeId); cSeriesView(int seriesId, int episodeId);
virtual ~cSeriesView(void); virtual ~cSeriesView(void);
void LoadMedia(void); void LoadMedia(void);
void KeyLeft(void); void KeyLeft(void);
void KeyRight(void); void KeyRight(void);
void Action(void); void Action(void);
}; };
class cMovieView : public cView { class cMovieView : public cView {
protected: protected:
int movieId; int movieId;
cMovie movie; cMovie movie;
std::string movieDBInfo; std::string movieDBInfo;
void SetTabs(void); void SetTabs(void);
void CreateMovieDBInfo(void); void CreateMovieDBInfo(void);
void DrawImages(void); void DrawImages(void);
public: public:
cMovieView(int movieId); cMovieView(int movieId);
virtual ~cMovieView(void); virtual ~cMovieView(void);
void LoadMedia(void); void LoadMedia(void);
void KeyLeft(void); void KeyLeft(void);
void KeyRight(void); void KeyRight(void);
void Action(void); void Action(void);
}; };
#endif //__TVGUIDE_VIEW_H #endif //__TVGUIDE_VIEW_H