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

View File

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

View File

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

View File

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

680
config.c
View File

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

516
config.h
View File

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

View File

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

View File

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

View File

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

View File

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

388
epggrid.c
View File

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

View File

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

View File

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

View File

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

334
footer.c
View File

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

View File

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

View File

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

View File

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

164
grid.c
View File

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

116
grid.h
View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

356
timer.c
View File

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

104
timer.h
View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1,65 +1,65 @@
#ifndef __TVGUIDE_TVGUIDEOSD_H
#define __TVGUIDE_TVGUIDEOSD_H
#include "timer.h"
#include "grid.h"
#include "channelcolumn.h"
#include "statusheader.h"
#include "detailview.h"
#include "timeline.h"
#include "channelgroups.h"
#include "footer.h"
#include "recmenuview.h"
#include "channeljump.h"
// --- cTvGuideOsd -------------------------------------------------------------
class cTvGuideOsd : public cOsdObject {
private:
cMyTime *myTime;
cList<cChannelColumn> columns;
cGrid *activeGrid;
cStatusHeader *statusHeader;
cDetailView *detailView;
cTimeLine *timeLine;
cChannelGroups *channelGroups;
cFooter *footer;
cRecMenuView *recMenuView;
cChannelJump *channelJumper;
bool detailViewActive;
void drawOsd();
void readChannels(const cChannel *channelStart);
void drawGridsChannelJump(int offset = 0);
void drawGridsTimeJump();
void processKeyUp();
void processKeyDown();
void processKeyLeft();
void processKeyRight();
void processKeyRed();
void processKeyGreen();
void processKeyYellow();
eOSState processKeyBlue(bool *alreadyUnlocked);
eOSState processKeyOk(bool *alreadyUnlocked);
void processNumKey(int numKey);
void TimeJump(int mode);
void ChannelJump(int num);
void CheckTimeout(void);
void setNextActiveGrid(cGrid *next);
void channelForward();
void channelBack();
void timeForward();
void timeBack();
void ScrollForward();
void ScrollBack();
eOSState ChannelSwitch(bool *alreadyUnlocked);
void DetailedEPG();
void SetTimers();
void dump();
public:
cTvGuideOsd(void);
virtual ~cTvGuideOsd(void);
virtual void Show(void);
virtual eOSState ProcessKey(eKeys Key);
};
#endif //__TVGUIDE_TVGUIDEOSD_H
#ifndef __TVGUIDE_TVGUIDEOSD_H
#define __TVGUIDE_TVGUIDEOSD_H
#include "timer.h"
#include "grid.h"
#include "channelcolumn.h"
#include "statusheader.h"
#include "detailview.h"
#include "timeline.h"
#include "channelgroups.h"
#include "footer.h"
#include "recmenuview.h"
#include "channeljump.h"
// --- cTvGuideOsd -------------------------------------------------------------
class cTvGuideOsd : public cOsdObject {
private:
cMyTime *myTime;
cList<cChannelColumn> columns;
cGrid *activeGrid;
cStatusHeader *statusHeader;
cDetailView *detailView;
cTimeLine *timeLine;
cChannelGroups *channelGroups;
cFooter *footer;
cRecMenuView *recMenuView;
cChannelJump *channelJumper;
bool detailViewActive;
void drawOsd();
void readChannels(const cChannel *channelStart);
void drawGridsChannelJump(int offset = 0);
void drawGridsTimeJump();
void processKeyUp();
void processKeyDown();
void processKeyLeft();
void processKeyRight();
void processKeyRed();
void processKeyGreen();
void processKeyYellow();
eOSState processKeyBlue(bool *alreadyUnlocked);
eOSState processKeyOk(bool *alreadyUnlocked);
void processNumKey(int numKey);
void TimeJump(int mode);
void ChannelJump(int num);
void CheckTimeout(void);
void setNextActiveGrid(cGrid *next);
void channelForward();
void channelBack();
void timeForward();
void timeBack();
void ScrollForward();
void ScrollBack();
eOSState ChannelSwitch(bool *alreadyUnlocked);
void DetailedEPG();
void SetTimers();
void dump();
public:
cTvGuideOsd(void);
virtual ~cTvGuideOsd(void);
virtual void Show(void);
virtual eOSState ProcessKey(eKeys Key);
};
#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
#define __TVGUIDE_VIEW_H
#include <vector>
#include <string>
#include <sstream>
#include <vdr/skins.h>
#include "services/scraper2vdr.h"
#include "services/epgsearch.h"
#include "services/remotetimers.h"
#include "config.h"
#include "imagecache.h"
#include "imageloader.h"
#include "tools.h"
enum eEPGViewTabs {
evtInfo = 0,
evtAddInfo,
evtImages,
evtCount
};
enum eMediaViewTabs {
mvtInfo = 0,
mvtAddInfo,
mvtCast,
mvtOnlineInfo,
mvtImages,
mvtCount
};
class cView : public cThread {
protected:
const cEvent *event;
cPixmap *pixmapBackground;
cStyledPixmap *pixmapHeader;
cPixmap *pixmapHeaderLogo;
cPixmap *pixmapContent;
cPixmap *pixmapScrollbar;
cPixmap *pixmapScrollbarBack;
cPixmap *pixmapTabs;
cFont *font, *fontSmall, *fontHeader, *fontHeaderLarge;
cImage *imgScrollBar;
int activeView;
bool scrollable;
bool tabbed;
int x, y;
int width, height;
int border;
int headerWidth, headerHeight;
int contentHeight;
int tabHeight;
int scrollbarWidth;
std::vector<std::string> tabs;
std::string title;
std::string subTitle;
std::string dateTime;
std::string infoText;
std::string addInfoText;
const cChannel *channel;
int eventID;
bool headerDrawn;
void DrawHeader(void);
void ClearContent(void);
void CreateContent(int fullHeight);
void DrawContent(std::string *text);
void DrawFloatingContent(std::string *infoText, cTvMedia *img, cTvMedia *img2 = NULL);
void CreateFloatingTextWrapper(cTextWrapper *twNarrow, cTextWrapper *twFull, std::string *text, int widthImg, int heightImg);
void DrawActors(std::vector<cActor> *actors);
void ClearScrollbar(void);
void ClearScrollbarImage(void);
cImage *CreateScrollbarImage(int width, int height, tColor clrBgr, tColor clrBlend);
virtual void SetTabs(void) {};
void DrawTabs(void);
public:
cView(void);
virtual ~cView(void);
void SetTitle(const char *t) { title = t ? t : ""; };
void SetSubTitle(const char *s) { subTitle = s ? s : ""; };
void SetDateTime(const char *dt) { dateTime = dt; };
void SetInfoText(const char *i) { infoText = i ? i : ""; };
void SetAdditionalInfoText(std::string addInfo) { addInfoText = addInfo; };
void SetChannel(const cChannel *c) { channel = c; };
void SetEventID(int id) { eventID = id; };
void SetEvent(const cEvent *event) { this->event = event; };
virtual void LoadMedia(void) {};
void SetGeometry(void);
void SetFonts(void);
virtual bool KeyUp(void);
virtual bool KeyDown(void);
virtual void KeyLeft(void) {};
virtual void KeyRight(void) {};
void DrawScrollbar(void);
virtual void Action(void) {};
};
class cEPGView : public cView {
protected:
std::vector<std::string> epgPics;
int numEPGPics;
int numTabs;
void SetTabs(void);
void CheckEPGImages(void);
void DrawImages(void);
public:
cEPGView(void);
virtual ~cEPGView(void);
void KeyLeft(void);
void KeyRight(void);
void Action(void);
};
class cSeriesView : public cView {
protected:
int seriesId;
int episodeId;
cSeries series;
std::string tvdbInfo;
void SetTabs(void);
void CreateTVDBInfo(void);
void DrawImages(void);
int GetRandomPoster(void);
public:
cSeriesView(int seriesId, int episodeId);
virtual ~cSeriesView(void);
void LoadMedia(void);
void KeyLeft(void);
void KeyRight(void);
void Action(void);
};
class cMovieView : public cView {
protected:
int movieId;
cMovie movie;
std::string movieDBInfo;
void SetTabs(void);
void CreateMovieDBInfo(void);
void DrawImages(void);
public:
cMovieView(int movieId);
virtual ~cMovieView(void);
void LoadMedia(void);
void KeyLeft(void);
void KeyRight(void);
void Action(void);
};
#endif //__TVGUIDE_VIEW_H
#ifndef __TVGUIDE_VIEW_H
#define __TVGUIDE_VIEW_H
#include <vector>
#include <string>
#include <sstream>
#include <vdr/skins.h>
#include "services/scraper2vdr.h"
#include "services/epgsearch.h"
#include "services/remotetimers.h"
#include "config.h"
#include "imagecache.h"
#include "imageloader.h"
#include "tools.h"
enum eEPGViewTabs {
evtInfo = 0,
evtAddInfo,
evtImages,
evtCount
};
enum eMediaViewTabs {
mvtInfo = 0,
mvtAddInfo,
mvtCast,
mvtOnlineInfo,
mvtImages,
mvtCount
};
class cView : public cThread {
protected:
const cEvent *event;
cPixmap *pixmapBackground;
cStyledPixmap *pixmapHeader;
cPixmap *pixmapHeaderLogo;
cPixmap *pixmapContent;
cPixmap *pixmapScrollbar;
cPixmap *pixmapScrollbarBack;
cPixmap *pixmapTabs;
cFont *font, *fontSmall, *fontHeader, *fontHeaderLarge;
cImage *imgScrollBar;
int activeView;
bool scrollable;
bool tabbed;
int x, y;
int width, height;
int border;
int headerWidth, headerHeight;
int contentHeight;
int tabHeight;
int scrollbarWidth;
std::vector<std::string> tabs;
std::string title;
std::string subTitle;
std::string dateTime;
std::string infoText;
std::string addInfoText;
const cChannel *channel;
int eventID;
bool headerDrawn;
void DrawHeader(void);
void ClearContent(void);
void CreateContent(int fullHeight);
void DrawContent(std::string *text);
void DrawFloatingContent(std::string *infoText, cTvMedia *img, cTvMedia *img2 = NULL);
void CreateFloatingTextWrapper(cTextWrapper *twNarrow, cTextWrapper *twFull, std::string *text, int widthImg, int heightImg);
void DrawActors(std::vector<cActor> *actors);
void ClearScrollbar(void);
void ClearScrollbarImage(void);
cImage *CreateScrollbarImage(int width, int height, tColor clrBgr, tColor clrBlend);
virtual void SetTabs(void) {};
void DrawTabs(void);
public:
cView(void);
virtual ~cView(void);
void SetTitle(const char *t) { title = t ? t : ""; };
void SetSubTitle(const char *s) { subTitle = s ? s : ""; };
void SetDateTime(const char *dt) { dateTime = dt; };
void SetInfoText(const char *i) { infoText = i ? i : ""; };
void SetAdditionalInfoText(std::string addInfo) { addInfoText = addInfo; };
void SetChannel(const cChannel *c) { channel = c; };
void SetEventID(int id) { eventID = id; };
void SetEvent(const cEvent *event) { this->event = event; };
virtual void LoadMedia(void) {};
void SetGeometry(void);
void SetFonts(void);
virtual bool KeyUp(void);
virtual bool KeyDown(void);
virtual void KeyLeft(void) {};
virtual void KeyRight(void) {};
void DrawScrollbar(void);
virtual void Action(void) {};
};
class cEPGView : public cView {
protected:
std::vector<std::string> epgPics;
int numEPGPics;
int numTabs;
void SetTabs(void);
void CheckEPGImages(void);
void DrawImages(void);
public:
cEPGView(void);
virtual ~cEPGView(void);
void KeyLeft(void);
void KeyRight(void);
void Action(void);
};
class cSeriesView : public cView {
protected:
int seriesId;
int episodeId;
cSeries series;
std::string tvdbInfo;
void SetTabs(void);
void CreateTVDBInfo(void);
void DrawImages(void);
int GetRandomPoster(void);
public:
cSeriesView(int seriesId, int episodeId);
virtual ~cSeriesView(void);
void LoadMedia(void);
void KeyLeft(void);
void KeyRight(void);
void Action(void);
};
class cMovieView : public cView {
protected:
int movieId;
cMovie movie;
std::string movieDBInfo;
void SetTabs(void);
void CreateMovieDBInfo(void);
void DrawImages(void);
public:
cMovieView(int movieId);
virtual ~cMovieView(void);
void LoadMedia(void);
void KeyLeft(void);
void KeyRight(void);
void Action(void);
};
#endif //__TVGUIDE_VIEW_H