whitespace cleanup

This commit is contained in:
louis 2013-05-26 11:38:05 +02:00
parent 9f47ab764e
commit 812fd1b7a5
31 changed files with 1577 additions and 1577 deletions

View File

@ -1,21 +1,21 @@
#include "channelcolumn.h"
cChannelColumn::cChannelColumn(int num, const cChannel *channel, cMyTime *myTime) {
this->channel = channel;
this->num = num;
this->myTime = myTime;
hasTimer = channel->HasTimer();
this->channel = channel;
this->num = num;
this->myTime = myTime;
hasTimer = channel->HasTimer();
schedulesLock = new cSchedulesLock(true, 100);
}
cChannelColumn::~cChannelColumn(void) {
delete header;
grids.Clear();
grids.Clear();
delete schedulesLock;
}
void cChannelColumn::clearGrids() {
grids.Clear();
grids.Clear();
}
void cChannelColumn::createHeader() {
@ -30,29 +30,29 @@ void cChannelColumn::drawHeader() {
bool cChannelColumn::readGrids() {
schedules = cSchedules::Schedules(*schedulesLock);
const cSchedule *Schedule = NULL;
Schedule = schedules->GetSchedule(channel);
if (!Schedule) {
const cSchedule *Schedule = NULL;
Schedule = schedules->GetSchedule(channel);
if (!Schedule) {
addDummyGrid(myTime->GetStart(), myTime->GetEnd(), NULL, false);
return true;
}
bool eventFound = false;
}
bool eventFound = false;
bool dummyAtStart = false;
const cEvent *startEvent = Schedule->GetEventAround(myTime->GetStart());
if (startEvent != NULL) {
eventFound = true;
} else {
for (int i=1; i<6; i++) {
startEvent = Schedule->GetEventAround(myTime->GetStart()+i*5*60);
if (startEvent) {
eventFound = true;
const cEvent *startEvent = Schedule->GetEventAround(myTime->GetStart());
if (startEvent != NULL) {
eventFound = true;
} else {
for (int i=1; i<6; i++) {
startEvent = Schedule->GetEventAround(myTime->GetStart()+i*5*60);
if (startEvent) {
eventFound = true;
dummyAtStart = true;
break;
}
}
}
if (eventFound) {
bool col = true;
break;
}
}
}
if (eventFound) {
bool col = true;
if (dummyAtStart) {
addDummyGrid(myTime->GetStart(), startEvent->StartTime(), NULL, col);
col = !col;
@ -62,8 +62,8 @@ bool cChannelColumn::readGrids() {
time_t endLast = myTime->GetStart();
const cEvent *event = startEvent;
const cEvent *eventLast = NULL;
for (; event; event = Schedule->Events()->Next(event)) {
if (endLast < event->StartTime()) {
for (; event; event = Schedule->Events()->Next(event)) {
if (endLast < event->StartTime()) {
//gap, dummy needed
time_t endTime = event->StartTime();
if (endTime > myTime->GetEnd()) {
@ -77,19 +77,19 @@ bool cChannelColumn::readGrids() {
break;
}
addEpgGrid(event, NULL, col);
col = !col;
col = !col;
endLast = event->EndTime();
if (event->EndTime() > myTime->GetEnd()) {
if (event->EndTime() > myTime->GetEnd()) {
dummyNeeded = false;
break;
}
break;
}
eventLast = event;
}
}
if (dummyNeeded) {
addDummyGrid(eventLast->EndTime(), myTime->GetEnd(), NULL, col);
}
return true;
} else {
return true;
} else {
addDummyGrid(myTime->GetStart(), myTime->GetEnd(), NULL, false);
return true;
}
@ -97,11 +97,11 @@ bool cChannelColumn::readGrids() {
}
void cChannelColumn::drawGrids() {
for (cGrid *grid = grids.First(); grid; grid = grids.Next(grid)) {
grid->SetViewportHeight();
grid->PositionPixmap();
grid->Draw();
}
for (cGrid *grid = grids.First(); grid; grid = grids.Next(grid)) {
grid->SetViewportHeight();
grid->PositionPixmap();
grid->Draw();
}
}
int cChannelColumn::getX() {
@ -113,57 +113,57 @@ int cChannelColumn::getY() {
}
cGrid * cChannelColumn::getActive() {
cMyTime t;
t.Now();
for (cGrid *grid = grids.First(); grid; grid = grids.Next(grid)) {
if (grid->Match(t.Get()))
return grid;
}
return grids.First();
cMyTime t;
t.Now();
for (cGrid *grid = grids.First(); grid; grid = grids.Next(grid)) {
if (grid->Match(t.Get()))
return grid;
}
return grids.First();
}
cGrid * cChannelColumn::getNext(cGrid *activeGrid) {
if (activeGrid == NULL)
return NULL;
cGrid *next = grids.Next(activeGrid);
if (next)
return next;
return NULL;
if (activeGrid == NULL)
return NULL;
cGrid *next = grids.Next(activeGrid);
if (next)
return next;
return NULL;
}
cGrid * cChannelColumn::getPrev(cGrid *activeGrid) {
if (activeGrid == NULL)
return NULL;
cGrid *prev = grids.Prev(activeGrid);
if (prev)
return prev;
return NULL;
if (activeGrid == NULL)
return NULL;
cGrid *prev = grids.Prev(activeGrid);
if (prev)
return prev;
return NULL;
}
cGrid * cChannelColumn::getNeighbor(cGrid *activeGrid) {
if (!activeGrid)
return NULL;
cGrid *neighbor = NULL;
int overlap = 0;
int overlapNew = 0;
cGrid *grid = NULL;
grid = grids.First();
if (grid) {
for (; grid; grid = grids.Next(grid)) {
if ( (grid->StartTime() == activeGrid->StartTime()) ) {
neighbor = grid;
break;
}
overlapNew = activeGrid->calcOverlap(grid);
if (overlapNew > overlap) {
neighbor = grid;
overlap = overlapNew;
}
}
}
if (!neighbor)
neighbor = grids.First();
return neighbor;
if (!activeGrid)
return NULL;
cGrid *neighbor = NULL;
int overlap = 0;
int overlapNew = 0;
cGrid *grid = NULL;
grid = grids.First();
if (grid) {
for (; grid; grid = grids.Next(grid)) {
if ( (grid->StartTime() == activeGrid->StartTime()) ) {
neighbor = grid;
break;
}
overlapNew = activeGrid->calcOverlap(grid);
if (overlapNew > overlap) {
neighbor = grid;
overlap = overlapNew;
}
}
}
if (!neighbor)
neighbor = grids.First();
return neighbor;
}
bool cChannelColumn::isFirst(cGrid *grid) {
@ -173,10 +173,10 @@ bool cChannelColumn::isFirst(cGrid *grid) {
}
void cChannelColumn::AddNewGridsAtStart() {
cGrid *firstGrid = NULL;
firstGrid = grids.First();
cGrid *firstGrid = NULL;
firstGrid = grids.First();
if (firstGrid == NULL)
return;
return;
//if first event is long enough, nothing to do.
if (firstGrid->StartTime() <= myTime->GetStart()) {
return;
@ -194,20 +194,20 @@ void cChannelColumn::AddNewGridsAtStart() {
}
bool col = !(firstGrid->IsColor1());
bool dummyNeeded = true;
for (const cEvent *event = Schedule->GetEventAround(firstGrid->StartTime()-60); event; event = Schedule->Events()->Prev(event)) {
if (!event)
break;
for (const cEvent *event = Schedule->GetEventAround(firstGrid->StartTime()-60); event; event = Schedule->Events()->Prev(event)) {
if (!event)
break;
if (event->EndTime() < myTime->GetStart()) {
break;
}
cGrid *grid = addEpgGrid(event, firstGrid, col);
col = !col;
firstGrid = grid;
if (event->StartTime() <= myTime->GetStart()) {
if (event->StartTime() <= myTime->GetStart()) {
dummyNeeded = false;
break;
}
}
break;
}
}
if (dummyNeeded) {
firstGrid = grids.First();
if (firstGrid->isDummy()) {
@ -221,40 +221,40 @@ void cChannelColumn::AddNewGridsAtStart() {
}
void cChannelColumn::AddNewGridsAtEnd() {
cGrid *lastGrid = NULL;
lastGrid = grids.Last();
if (lastGrid == NULL)
return;
//if last event is long enough, nothing to do.
if (lastGrid->EndTime() >= myTime->GetEnd()) {
cGrid *lastGrid = NULL;
lastGrid = grids.Last();
if (lastGrid == NULL)
return;
}
//if not, i have to add new ones to the list
schedules = cSchedules::Schedules(*schedulesLock);
const cSchedule *Schedule = NULL;
Schedule = schedules->GetSchedule(channel);
if (!Schedule) {
//if last event is long enough, nothing to do.
if (lastGrid->EndTime() >= myTime->GetEnd()) {
return;
}
//if not, i have to add new ones to the list
schedules = cSchedules::Schedules(*schedulesLock);
const cSchedule *Schedule = NULL;
Schedule = schedules->GetSchedule(channel);
if (!Schedule) {
if (lastGrid->isDummy()) {
lastGrid->SetStartTime(myTime->GetStart());
lastGrid->SetEndTime(myTime->GetEnd());
}
return;
}
bool col = !(lastGrid->IsColor1());
bool col = !(lastGrid->IsColor1());
bool dummyNeeded = true;
for (const cEvent *event = Schedule->GetEventAround(lastGrid->EndTime()+60); event; event = Schedule->Events()->Next(event)) {
if (!event)
break;
for (const cEvent *event = Schedule->GetEventAround(lastGrid->EndTime()+60); event; event = Schedule->Events()->Next(event)) {
if (!event)
break;
if (event->StartTime() > myTime->GetEnd()) {
break;
}
addEpgGrid(event, NULL, col);
col = !col;
if (event->EndTime() > myTime->GetEnd()) {
if (event->EndTime() > myTime->GetEnd()) {
dummyNeeded = false;
break;
}
}
break;
}
}
if (dummyNeeded) {
lastGrid = grids.Last();
if (lastGrid->isDummy()) {
@ -268,15 +268,15 @@ void cChannelColumn::AddNewGridsAtEnd() {
}
void cChannelColumn::ClearOutdatedStart() {
cGrid *firstGrid = NULL;
while (true) {
firstGrid = grids.First();
cGrid *firstGrid = NULL;
while (true) {
firstGrid = grids.First();
if (!firstGrid)
break;
if (firstGrid->EndTime() <= myTime->GetStart()) {
if (firstGrid->EndTime() <= myTime->GetStart()) {
grids.Del(firstGrid);
firstGrid = NULL;
} else {
} else {
if (firstGrid->isDummy()) {
firstGrid->SetStartTime(myTime->GetStart());
cGrid *next = getNext(firstGrid);
@ -287,20 +287,20 @@ void cChannelColumn::ClearOutdatedStart() {
}
}
break;
}
}
}
}
}
void cChannelColumn::ClearOutdatedEnd() {
cGrid *lastGrid = NULL;
while (true) {
lastGrid = grids.Last();
cGrid *lastGrid = NULL;
while (true) {
lastGrid = grids.Last();
if (!lastGrid)
break;
if (lastGrid->StartTime() >= myTime->GetEnd()) {
grids.Del(lastGrid);
lastGrid = NULL;
} else {
} else {
if (lastGrid->isDummy()) {
lastGrid->SetEndTime(myTime->GetEnd());
cGrid *prev = getPrev(lastGrid);
@ -311,8 +311,8 @@ void cChannelColumn::ClearOutdatedEnd() {
}
}
break;
}
}
}
}
}
cGrid *cChannelColumn::addEpgGrid(const cEvent *event, cGrid *firstGrid, bool color) {
@ -338,10 +338,10 @@ cGrid *cChannelColumn::addDummyGrid(time_t start, time_t end, cGrid *firstGrid,
}
void cChannelColumn::dumpGrids() {
esyslog("tvguide: ------Channel %s: %d entires ---------", channel->Name(), grids.Count());
esyslog("tvguide: ------Channel %s: %d entires ---------", channel->Name(), grids.Count());
int i=1;
for (cGrid *grid = grids.First(); grid; grid = grids.Next(grid)) {
esyslog("tvguide: grid %d: start: %s, stop: %s", i, *cMyTime::printTime(grid->StartTime()), *cMyTime::printTime(grid->EndTime()));
for (cGrid *grid = grids.First(); grid; grid = grids.Next(grid)) {
esyslog("tvguide: grid %d: start: %s, stop: %s", i, *cMyTime::printTime(grid->StartTime()), *cMyTime::printTime(grid->EndTime()));
i++;
}
}

View File

@ -9,43 +9,43 @@ class cHeaderGrid;
class cChannelColumn : public cListObject, public cStyledPixmap {
private:
cMyTime *myTime;
int num;
const cChannel *channel;
cHeaderGrid *header;
int num;
const cChannel *channel;
cHeaderGrid *header;
cList<cGrid> grids;
cSchedulesLock *schedulesLock;
const cSchedules *schedules;
bool hasTimer;
cSchedulesLock *schedulesLock;
const cSchedules *schedules;
bool hasTimer;
cGrid *addEpgGrid(const cEvent *event, cGrid *firstGrid, bool color);
cGrid *addDummyGrid(time_t start, time_t end, cGrid *firstGrid, bool color);
public:
cChannelColumn(int num, const cChannel *channel, cMyTime *myTime);
virtual ~cChannelColumn(void);
void createHeader();
void drawHeader();
bool readGrids();
void drawGrids();
int getX();
int getY();
cChannelColumn(int num, const cChannel *channel, cMyTime *myTime);
virtual ~cChannelColumn(void);
void createHeader();
void drawHeader();
bool readGrids();
void drawGrids();
int getX();
int getY();
int Start() { return myTime->GetStart(); };
int Stop() { return myTime->GetEnd(); };
const char* Name() { return channel->Name(); };
const cChannel * getChannel() {return channel;}
cGrid * getActive();
cGrid * getNext(cGrid *activeGrid);
cGrid * getPrev(cGrid *activeGrid);
cGrid * getNeighbor(cGrid *activeGrid);
const cChannel * getChannel() {return channel;}
cGrid * getActive();
cGrid * getNext(cGrid *activeGrid);
cGrid * getPrev(cGrid *activeGrid);
cGrid * getNeighbor(cGrid *activeGrid);
bool isFirst(cGrid *grid);
void AddNewGridsAtStart();
void AddNewGridsAtEnd();
void ClearOutdatedStart();
void ClearOutdatedEnd();
int GetNum() {return num;};
void SetNum(int num) {this->num = num;};
void setTimer() {hasTimer = true;};
void AddNewGridsAtStart();
void AddNewGridsAtEnd();
void ClearOutdatedStart();
void ClearOutdatedEnd();
int GetNum() {return num;};
void SetNum(int num) {this->num = num;};
void setTimer() {hasTimer = true;};
bool HasTimer() { return hasTimer; };
void clearGrids();
void dumpGrids();
void clearGrids();
void dumpGrids();
};
#endif //__TVGUIDE_CHANNELCOLUMN_H

278
config.c
View File

@ -1,50 +1,50 @@
#include "config.h"
enum {
e12Hours,
e24Hours
e12Hours,
e24Hours
};
enum {
eVertical,
eHorizontal
eVertical,
eHorizontal
};
cTvguideConfig::cTvguideConfig() {
osdWidth = 0;
osdHeight = 0;
osdWidth = 0;
osdHeight = 0;
displayMode = eHorizontal;
colWidth = 0;
rowHeight = 0;
channelCols = 5;
colWidth = 0;
rowHeight = 0;
channelCols = 5;
channelRows = 10;
displayTime = 160;
minutePixel = 0;
displayTime = 160;
minutePixel = 0;
displayStatusHeader = 1;
statusHeaderPercent = 20;
statusHeaderHeight = 0;
scaleVideo = 1;
decorateVideo = 1;
timeLineWidthPercent = 8;
timeLineHeightPercent = 4;
timeLineWidthPercent = 8;
timeLineHeightPercent = 4;
displayChannelName = 1;
channelHeaderWidthPercent = 20;
channelHeaderHeightPercent = 15;
channelHeaderHeightPercent = 15;
footerHeight = 80;
stepMinutes = 30;
stepMinutes = 30;
bigStepHours = 3;
hugeStepHours = 24;
jumpChannels = 10;
hideChannelLogos = 0;
logoWidthRatio = 13;
logoHeightRatio = 10;
logoExtension = 0;
hideEpgImages = 0;
epgImageWidth = 315;
epgImageHeight = 240;
fontIndex = 0;
fontNameDefault = "VDRSymbols Sans:Book";
hugeStepHours = 24;
jumpChannels = 10;
hideChannelLogos = 0;
logoWidthRatio = 13;
logoHeightRatio = 10;
logoExtension = 0;
hideEpgImages = 0;
epgImageWidth = 315;
epgImageHeight = 240;
fontIndex = 0;
fontNameDefault = "VDRSymbols Sans:Book";
FontButtonDelta = 0;
FontDetailViewDelta = 0;
FontDetailHeaderDelta = 0;
@ -64,51 +64,51 @@ cTvguideConfig::cTvguideConfig() {
FontTimeLineDateHorizontalDelta = 0;
FontTimeLineTimeHorizontalDelta = 0;
//Common Fonts
FontButton = NULL;
FontDetailView = NULL;
FontDetailHeader = NULL;
FontMessageBox = NULL;
FontMessageBoxLarge = NULL;
FontButton = NULL;
FontDetailView = NULL;
FontDetailHeader = NULL;
FontMessageBox = NULL;
FontMessageBoxLarge = NULL;
FontStatusHeader = NULL;
FontStatusHeaderLarge = NULL;
//Fonts for vertical Display
FontChannelHeader = NULL;
FontGrid = NULL;
FontGridSmall = NULL;
FontTimeLineWeekday = NULL;
FontTimeLineDate = NULL;
FontChannelHeader = NULL;
FontGrid = NULL;
FontGridSmall = NULL;
FontTimeLineWeekday = NULL;
FontTimeLineDate = NULL;
FontTimeLineTime = NULL;
//Fonts for horizontal Display
FontChannelHeaderHorizontal = NULL;
FontChannelHeaderHorizontal = NULL;
FontGridHorizontal = NULL;
FontGridHorizontalSmall = NULL;
FontGridHorizontalSmall = NULL;
FontTimeLineDateHorizontal = NULL;
FontTimeLineTimeHorizontal = NULL;
FontTimeLineTimeHorizontal = NULL;
timeFormat = 1;
themeIndex = 4;
useBlending = 2;
roundedCorners = 0;
timeFormat = 1;
themeIndex = 4;
useBlending = 2;
roundedCorners = 0;
}
cTvguideConfig::~cTvguideConfig() {
delete FontButton;
delete FontButton;
delete FontDetailView;
delete FontDetailHeader;
delete FontMessageBox;
delete FontMessageBoxLarge;
delete FontDetailHeader;
delete FontMessageBox;
delete FontMessageBoxLarge;
delete FontStatusHeader;
delete FontStatusHeaderLarge;
delete FontChannelHeader;
delete FontGrid;
delete FontGridSmall;
delete FontGridSmall;
delete FontTimeLineWeekday;
delete FontTimeLineDate;
delete FontTimeLineTime;
delete FontChannelHeaderHorizontal;
delete FontGridHorizontal;
delete FontGridHorizontalSmall;
delete FontTimeLineDateHorizontal;
delete FontTimeLineDate;
delete FontTimeLineTime;
delete FontChannelHeaderHorizontal;
delete FontGridHorizontal;
delete FontGridHorizontalSmall;
delete FontTimeLineDateHorizontal;
delete FontTimeLineTimeHorizontal;
}
@ -118,13 +118,13 @@ void cTvguideConfig::setDynamicValues(int width, int height) {
}
void cTvguideConfig::SetGeometry(int width, int height) {
osdWidth = width;
osdHeight = height;
osdWidth = width;
osdHeight = height;
statusHeaderHeight = (displayStatusHeader)?(statusHeaderPercent * osdHeight / 100):0;
channelHeaderWidth = channelHeaderWidthPercent * osdWidth / 100;
channelHeaderHeight = channelHeaderHeightPercent * osdHeight / 100;
channelHeaderWidth = channelHeaderWidthPercent * osdWidth / 100;
channelHeaderHeight = channelHeaderHeightPercent * osdHeight / 100;
timeLineWidth = timeLineWidthPercent * osdWidth / 100;
timeLineHeight = timeLineHeightPercent * osdHeight / 100;
timeLineHeight = timeLineHeightPercent * osdHeight / 100;
if (displayMode == eVertical) {
colWidth = (osdWidth - timeLineWidth) / channelCols;
@ -140,113 +140,113 @@ void cTvguideConfig::SetGeometry(int width, int height) {
}
void cTvguideConfig::SetFonts(void){
cString fontname;
if (fontIndex == 0) {
fontname = fontNameDefault;
} else {
cStringList availableFonts;
cFont::GetAvailableFontNames(&availableFonts);
if (availableFonts[fontIndex-1]) {
fontname = availableFonts[fontIndex-1];
} else
fontname = fontNameDefault;
}
cFont *test = NULL;
test = cFont::CreateFont(*fontname, 30);
if (!test) {
fontname = DefaultFontSml;
}
delete test;
cString fontname;
if (fontIndex == 0) {
fontname = fontNameDefault;
} else {
cStringList availableFonts;
cFont::GetAvailableFontNames(&availableFonts);
if (availableFonts[fontIndex-1]) {
fontname = availableFonts[fontIndex-1];
} else
fontname = fontNameDefault;
}
cFont *test = NULL;
test = cFont::CreateFont(*fontname, 30);
if (!test) {
fontname = DefaultFontSml;
}
delete test;
//Common Fonts
FontButton = cFont::CreateFont(*fontname, footerHeight/3 + 4 + FontButtonDelta);
FontDetailView = cFont::CreateFont(*fontname, osdHeight/30 + FontDetailViewDelta);
FontDetailHeader = cFont::CreateFont(*fontname, osdHeight/25 + FontDetailHeaderDelta);
FontMessageBox = cFont::CreateFont(*fontname, osdHeight/33 + FontMessageBoxDelta);
FontMessageBoxLarge = cFont::CreateFont(*fontname, osdHeight/30 + FontMessageBoxLargeDelta);
FontStatusHeader = cFont::CreateFont(*fontname, statusHeaderHeight/6 - 4 + FontStatusHeaderDelta);
FontButton = cFont::CreateFont(*fontname, footerHeight/3 + 4 + FontButtonDelta);
FontDetailView = cFont::CreateFont(*fontname, osdHeight/30 + FontDetailViewDelta);
FontDetailHeader = cFont::CreateFont(*fontname, osdHeight/25 + FontDetailHeaderDelta);
FontMessageBox = cFont::CreateFont(*fontname, osdHeight/33 + FontMessageBoxDelta);
FontMessageBoxLarge = cFont::CreateFont(*fontname, osdHeight/30 + FontMessageBoxLargeDelta);
FontStatusHeader = cFont::CreateFont(*fontname, statusHeaderHeight/6 - 4 + FontStatusHeaderDelta);
FontStatusHeaderLarge = cFont::CreateFont(*fontname, statusHeaderHeight/5 + FontStatusHeaderLargeDelta);
//Fonts for vertical Display
FontChannelHeader = cFont::CreateFont(*fontname, colWidth/10 + FontChannelHeaderDelta);
FontChannelHeader = cFont::CreateFont(*fontname, colWidth/10 + FontChannelHeaderDelta);
FontGrid = cFont::CreateFont(*fontname, colWidth/12 + FontGridDelta);
FontGridSmall = cFont::CreateFont(*fontname, colWidth/12 + FontGridSmallDelta);
FontTimeLineWeekday = cFont::CreateFont(*fontname, timeLineWidth/3 + FontTimeLineWeekdayDelta);
FontGridSmall = cFont::CreateFont(*fontname, colWidth/12 + FontGridSmallDelta);
FontTimeLineWeekday = cFont::CreateFont(*fontname, timeLineWidth/3 + FontTimeLineWeekdayDelta);
FontTimeLineDate = cFont::CreateFont(*fontname, timeLineWidth/4 + FontTimeLineDateDelta);
FontTimeLineTime = cFont::CreateFont(*fontname, timeLineWidth/4 + FontTimeLineTimeDelta);
FontTimeLineTime = cFont::CreateFont(*fontname, timeLineWidth/4 + FontTimeLineTimeDelta);
//Fonts for horizontal Display
FontChannelHeaderHorizontal = cFont::CreateFont(*fontname, rowHeight/3 + FontChannelHeaderHorizontalDelta);
FontChannelHeaderHorizontal = cFont::CreateFont(*fontname, rowHeight/3 + FontChannelHeaderHorizontalDelta);
FontGridHorizontal = cFont::CreateFont(*fontname, rowHeight/3 + 5 + FontGridHorizontalDelta);
FontGridHorizontalSmall = cFont::CreateFont(*fontname, rowHeight/4 + FontGridHorizontalSmallDelta);
FontTimeLineDateHorizontal = cFont::CreateFont(*fontname, timeLineHeight/2 + 5 + FontTimeLineDateHorizontalDelta);
FontGridHorizontalSmall = cFont::CreateFont(*fontname, rowHeight/4 + FontGridHorizontalSmallDelta);
FontTimeLineDateHorizontal = cFont::CreateFont(*fontname, timeLineHeight/2 + 5 + FontTimeLineDateHorizontalDelta);
FontTimeLineTimeHorizontal = cFont::CreateFont(*fontname, timeLineHeight/2 + FontTimeLineTimeHorizontalDelta);
}
void cTvguideConfig::SetLogoPath(cString path) {
logoPath = path;
logoPath = path;
}
void cTvguideConfig::SetImagesPath(cString path) {
epgImagePath = path;
epgImagePath = path;
}
void cTvguideConfig::loadTheme() {
cThemes themes;
themes.Load(*cString("tvguide"));
const char *FileName = themes.FileName(themeIndex);
if (access(FileName, F_OK) == 0) {
::theme.Load(FileName);
}
cThemes themes;
themes.Load(*cString("tvguide"));
const char *FileName = themes.FileName(themeIndex);
if (access(FileName, F_OK) == 0) {
::theme.Load(FileName);
}
}
bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
if (strcmp(Name, "timeFormat") == 0) timeFormat = atoi(Value);
else if (strcmp(Name, "themeIndex") == 0) themeIndex = atoi(Value);
else if (strcmp(Name, "displayMode") == 0) displayMode = atoi(Value);
if (strcmp(Name, "timeFormat") == 0) timeFormat = atoi(Value);
else if (strcmp(Name, "themeIndex") == 0) themeIndex = atoi(Value);
else if (strcmp(Name, "displayMode") == 0) displayMode = atoi(Value);
else if (strcmp(Name, "displayStatusHeader") == 0) displayStatusHeader = atoi(Value);
else if (strcmp(Name, "statusHeaderPercent") == 0) statusHeaderPercent = atoi(Value);
else if (strcmp(Name, "scaleVideo") == 0) scaleVideo = atoi(Value);
else if (strcmp(Name, "decorateVideo") == 0) decorateVideo = atoi(Value);
else if (strcmp(Name, "useBlending") == 0) useBlending = 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, "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, "jumpChannels") == 0) jumpChannels = 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, "timeLineWidthPercent") == 0) timeLineWidthPercent = atoi(Value);
else if (strcmp(Name, "scaleVideo") == 0) scaleVideo = atoi(Value);
else if (strcmp(Name, "decorateVideo") == 0) decorateVideo = atoi(Value);
else if (strcmp(Name, "useBlending") == 0) useBlending = 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, "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, "jumpChannels") == 0) jumpChannels = 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, "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, "footerHeight") == 0) footerHeight = 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, "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, "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, "footerHeight") == 0) footerHeight = 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, "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, "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 return false;
return true;
return true;
}

114
config.h
View File

@ -2,53 +2,53 @@
#define __TVGUIDE_CONFIG_H
class cTvguideConfig {
public:
cTvguideConfig();
~cTvguideConfig();
void SetLogoPath(cString path);
void SetImagesPath(cString path);
public:
cTvguideConfig();
~cTvguideConfig();
void SetLogoPath(cString path);
void SetImagesPath(cString path);
void SetGeometry(int width, int height);
void SetFonts(void);
int osdWidth;
int osdHeight;
int osdHeight;
int displayMode;
int colWidth;
int colWidth;
int rowHeight;
int channelCols;
int channelRows;
int channelCols;
int channelRows;
int numGrids;
int displayTime;
int minutePixel;
int displayTime;
int minutePixel;
int displayStatusHeader;
int statusHeaderPercent;
int statusHeaderHeight;
int scaleVideo;
int decorateVideo;
int timeLineWidthPercent;
int timeLineHeightPercent;
int timeLineWidth;
int timeLineHeight;
int timeLineWidthPercent;
int timeLineHeightPercent;
int timeLineWidth;
int timeLineHeight;
int displayChannelName;
int channelHeaderWidthPercent;
int channelHeaderHeightPercent;
int channelHeaderWidth;
int channelHeaderHeight;
int footerHeight;
int stepMinutes;
int bigStepHours;
int hugeStepHours;
int jumpChannels;
int hideChannelLogos;
int logoWidthRatio;
int logoHeightRatio;
cString logoPath;
int logoExtension;
int hideEpgImages;
int epgImageWidth;
int epgImageHeight;
cString epgImagePath;
int fontIndex;
const char *fontNameDefault;
int channelHeaderWidthPercent;
int channelHeaderHeightPercent;
int channelHeaderWidth;
int channelHeaderHeight;
int footerHeight;
int stepMinutes;
int bigStepHours;
int hugeStepHours;
int jumpChannels;
int hideChannelLogos;
int logoWidthRatio;
int logoHeightRatio;
cString logoPath;
int logoExtension;
int hideEpgImages;
int epgImageWidth;
int epgImageHeight;
cString epgImagePath;
int fontIndex;
const char *fontNameDefault;
int FontButtonDelta;
int FontDetailViewDelta;
int FontDetailHeaderDelta;
@ -67,31 +67,31 @@ class cTvguideConfig {
int FontGridHorizontalSmallDelta;
int FontTimeLineDateHorizontalDelta;
int FontTimeLineTimeHorizontalDelta;
const cFont *FontChannelHeader;
const cFont *FontChannelHeader;
const cFont *FontChannelHeaderHorizontal;
const cFont *FontStatusHeader;
const cFont *FontStatusHeaderLarge;
const cFont *FontGrid;
const cFont *FontGridSmall;
const cFont *FontStatusHeader;
const cFont *FontStatusHeaderLarge;
const cFont *FontGrid;
const cFont *FontGridSmall;
const cFont *FontGridHorizontal;
const cFont *FontGridHorizontalSmall;
const cFont *FontTimeLineWeekday;
const cFont *FontTimeLineDate;
const cFont *FontTimeLineDateHorizontal;
const cFont *FontTimeLineTime;
const cFont *FontGridHorizontalSmall;
const cFont *FontTimeLineWeekday;
const cFont *FontTimeLineDate;
const cFont *FontTimeLineDateHorizontal;
const cFont *FontTimeLineTime;
const cFont *FontTimeLineTimeHorizontal;
const cFont *FontButton;
const cFont *FontDetailView;
const cFont *FontDetailHeader;
const cFont *FontMessageBox;
const cFont *FontMessageBoxLarge;
int timeFormat;
int themeIndex;
int useBlending;
int roundedCorners;
void setDynamicValues(int width, int height);
bool SetupParse(const char *Name, const char *Value);
void loadTheme();
const cFont *FontButton;
const cFont *FontDetailView;
const cFont *FontDetailHeader;
const cFont *FontMessageBox;
const cFont *FontMessageBoxLarge;
int timeFormat;
int themeIndex;
int useBlending;
int roundedCorners;
void setDynamicValues(int width, int height);
bool SetupParse(const char *Name, const char *Value);
void loadTheme();
};
#endif //__TVGUIDE_CONFIG_H

View File

@ -1,195 +1,195 @@
#include "detailview.h"
cDetailView::cDetailView(cGrid *grid) {
this->grid = grid;
this->event = grid->GetEvent();
imgScrollBar = NULL;
FrameTime = 40; // ms
FadeTime = 500; // ms
borderWidth = 100; //px
headerHeight = max (40 + 3 * tvguideConfig.FontDetailHeader->Height(), // border + 3 Lines
40 + tvguideConfig.epgImageHeight);
description.Set(event->Description(), tvguideConfig.FontDetailView, tvguideConfig.osdWidth-2*borderWidth - 50 - 40);
contentScrollable = setContentDrawportHeight();
createPixmaps();
this->grid = grid;
this->event = grid->GetEvent();
imgScrollBar = NULL;
FrameTime = 40; // ms
FadeTime = 500; // ms
borderWidth = 100; //px
headerHeight = max (40 + 3 * tvguideConfig.FontDetailHeader->Height(), // border + 3 Lines
40 + tvguideConfig.epgImageHeight);
description.Set(event->Description(), tvguideConfig.FontDetailView, tvguideConfig.osdWidth-2*borderWidth - 50 - 40);
contentScrollable = setContentDrawportHeight();
createPixmaps();
}
cDetailView::~cDetailView(void){
delete header;
osdManager.releasePixmap(headerLogo);
delete header;
osdManager.releasePixmap(headerLogo);
osdManager.releasePixmap(headerBack);
osdManager.releasePixmap(content);
osdManager.releasePixmap(scrollBar);
osdManager.releasePixmap(footer);
delete imgScrollBar;
osdManager.releasePixmap(content);
osdManager.releasePixmap(scrollBar);
osdManager.releasePixmap(footer);
delete imgScrollBar;
}
bool cDetailView::setContentDrawportHeight() {
int linesContent = description.Lines() + 1;
heightContent = linesContent * tvguideConfig.FontDetailView->Height();
if (heightContent > (tvguideConfig.osdHeight - 2 * borderWidth - headerHeight))
return true;
else
return false;
int linesContent = description.Lines() + 1;
heightContent = linesContent * tvguideConfig.FontDetailView->Height();
if (heightContent > (tvguideConfig.osdHeight - 2 * borderWidth - headerHeight))
return true;
else
return false;
}
void cDetailView::createPixmaps() {
int scrollBarWidth = 50;
header = new cStyledPixmap(osdManager.requestPixmap(5, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null));
header->SetAlpha(0);
headerLogo = osdManager.requestPixmap(6, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null);
int scrollBarWidth = 50;
header = new cStyledPixmap(osdManager.requestPixmap(5, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null));
header->SetAlpha(0);
headerLogo = osdManager.requestPixmap(6, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null);
headerLogo->Fill(clrTransparent);
headerLogo->SetAlpha(0);
headerBack = osdManager.requestPixmap(4, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null);
headerBack->SetAlpha(0);
headerLogo->SetAlpha(0);
headerBack = osdManager.requestPixmap(4, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null);
headerBack->SetAlpha(0);
headerBack->Fill(clrBlack);
header->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
content = osdManager.requestPixmap(5, cRect(borderWidth, borderWidth + headerHeight, tvguideConfig.osdWidth - 2*borderWidth - scrollBarWidth, tvguideConfig.osdHeight-2*borderWidth-headerHeight),
cRect(0,0, tvguideConfig.osdWidth - 2*borderWidth - scrollBarWidth, max(heightContent, tvguideConfig.osdHeight-2*borderWidth-headerHeight)));
content->SetAlpha(0);
header->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
scrollBar = osdManager.requestPixmap(5, cRect(tvguideConfig.osdWidth-borderWidth-scrollBarWidth, borderWidth + headerHeight, scrollBarWidth, tvguideConfig.osdHeight-2*borderWidth-headerHeight));
scrollBar->SetAlpha(0);
footer = osdManager.requestPixmap(5, cRect(borderWidth, borderWidth + headerHeight + content->ViewPort().Height(), tvguideConfig.osdWidth - 2*borderWidth, 3));
footer->SetAlpha(0);
footer->Fill(theme.Color(clrBorder));
content = osdManager.requestPixmap(5, cRect(borderWidth, borderWidth + headerHeight, tvguideConfig.osdWidth - 2*borderWidth - scrollBarWidth, tvguideConfig.osdHeight-2*borderWidth-headerHeight),
cRect(0,0, tvguideConfig.osdWidth - 2*borderWidth - scrollBarWidth, max(heightContent, tvguideConfig.osdHeight-2*borderWidth-headerHeight)));
content->SetAlpha(0);
header->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
scrollBar = osdManager.requestPixmap(5, cRect(tvguideConfig.osdWidth-borderWidth-scrollBarWidth, borderWidth + headerHeight, scrollBarWidth, tvguideConfig.osdHeight-2*borderWidth-headerHeight));
scrollBar->SetAlpha(0);
footer = osdManager.requestPixmap(5, cRect(borderWidth, borderWidth + headerHeight + content->ViewPort().Height(), tvguideConfig.osdWidth - 2*borderWidth, 3));
footer->SetAlpha(0);
footer->Fill(theme.Color(clrBorder));
}
void cDetailView::drawHeader() {
header->drawBackground();
header->drawBoldBorder();
header->drawBoldBorder();
int logoHeight = header->Height() / 2;
int logoWidth = logoHeight * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio;
int lineHeight = tvguideConfig.FontDetailHeader->Height();
cImageLoader imgLoader;
int lineHeight = tvguideConfig.FontDetailHeader->Height();
cImageLoader imgLoader;
bool logoDrawn = false;
if (!tvguideConfig.hideChannelLogos) {
if (imgLoader.LoadLogo(grid->column->getChannel()->Name(), logoWidth, logoHeight)) {
cImage logo = imgLoader.GetImage();
headerLogo->DrawImage(cPoint(10, (header->Height() - logoHeight)/2), logo);
if (!tvguideConfig.hideChannelLogos) {
if (imgLoader.LoadLogo(grid->column->getChannel()->Name(), logoWidth, logoHeight)) {
cImage logo = imgLoader.GetImage();
headerLogo->DrawImage(cPoint(10, (header->Height() - logoHeight)/2), logo);
logoDrawn = true;
}
}
if (!tvguideConfig.hideEpgImages) {
if (imgLoader.LoadEPGImage(event->EventID())) {
cImage epgImage = imgLoader.GetImage();
int epgImageX = header->Width() - 30 - tvguideConfig.epgImageWidth;
int epgImageY = (header->Height() - 10 - tvguideConfig.epgImageHeight) / 2;
header->DrawRectangle(cRect(epgImageX-2, epgImageY-2, tvguideConfig.epgImageWidth + 4, tvguideConfig.epgImageHeight + 4), theme.Color(clrBorder));
header->DrawImage(cPoint(epgImageX, epgImageY), epgImage);
}
}
int textX = logoDrawn?(20 + logoWidth):20;
}
}
if (!tvguideConfig.hideEpgImages) {
if (imgLoader.LoadEPGImage(event->EventID())) {
cImage epgImage = imgLoader.GetImage();
int epgImageX = header->Width() - 30 - tvguideConfig.epgImageWidth;
int epgImageY = (header->Height() - 10 - tvguideConfig.epgImageHeight) / 2;
header->DrawRectangle(cRect(epgImageX-2, epgImageY-2, tvguideConfig.epgImageWidth + 4, tvguideConfig.epgImageHeight + 4), theme.Color(clrBorder));
header->DrawImage(cPoint(epgImageX, epgImageY), epgImage);
}
}
int textX = logoDrawn?(20 + logoWidth):20;
int textY = (header->Height() - 2*lineHeight)/2;
header->DrawText(cPoint(textX, textY), event->Title(), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailHeader);
cString datetime = cString::sprintf("%s, %s - %s (%d min)", *event->GetDateString(), *event->GetTimeString(), *event->GetEndTimeString(), event->Duration()/60);
header->DrawText(cPoint(textX, textY + lineHeight), *datetime, theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
header->DrawText(cPoint(textX, textY + 2 * lineHeight), event->ShortText(), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
header->DrawText(cPoint(textX, textY), event->Title(), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailHeader);
cString datetime = cString::sprintf("%s, %s - %s (%d min)", *event->GetDateString(), *event->GetTimeString(), *event->GetEndTimeString(), event->Duration()/60);
header->DrawText(cPoint(textX, textY + lineHeight), *datetime, theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
header->DrawText(cPoint(textX, textY + 2 * lineHeight), event->ShortText(), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
}
void cDetailView::drawContent() {
content->Fill(theme.Color(clrBorder));
content->DrawRectangle(cRect(2, 0, content->ViewPort().Width() - 2, content->DrawPort().Height()), theme.Color(clrBackground));
int textHeight = tvguideConfig.FontDetailView->Height();
int textLines = description.Lines();
for (int i=0; i<textLines; i++) {
content->DrawText(cPoint(20, 20 + i*textHeight), description.GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
}
content->Fill(theme.Color(clrBorder));
content->DrawRectangle(cRect(2, 0, content->ViewPort().Width() - 2, content->DrawPort().Height()), theme.Color(clrBackground));
int textHeight = tvguideConfig.FontDetailView->Height();
int textLines = description.Lines();
for (int i=0; i<textLines; i++) {
content->DrawText(cPoint(20, 20 + i*textHeight), description.GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
}
}
void cDetailView::drawScrollbar() {
scrollBar->Fill(theme.Color(clrBorder));
double scrollBarOffset = 0.0;
if (contentScrollable) {
heightScrollbar = ( (double)scrollBar->ViewPort().Height() ) / (double)heightContent * ( (double)scrollBar->ViewPort().Height() );
scrollBarOffset = (-1.0)*(double)content->DrawPort().Point().Y() / (double)(content->DrawPort().Height() - (tvguideConfig.osdHeight-2*borderWidth-headerHeight));
scrollBarOffset *= ( (double)scrollBar->ViewPort().Height()-7.0 - heightScrollbar);
scrollBarOffset++;
} else {
heightScrollbar = scrollBar->ViewPort().Height();
}
scrollBar->DrawRectangle(cRect(3,0,scrollBar->ViewPort().Width()-6, scrollBar->ViewPort().Height()), theme.Color(clrBackground));
if (imgScrollBar == NULL) {
imgScrollBar = createScrollbar(scrollBar->ViewPort().Width()-10, heightScrollbar, theme.Color(clrHighlight), theme.Color(clrHighlightBlending));
}
scrollBar->DrawImage(cPoint(5, 2 + scrollBarOffset), *imgScrollBar);
scrollBar->Fill(theme.Color(clrBorder));
double scrollBarOffset = 0.0;
if (contentScrollable) {
heightScrollbar = ( (double)scrollBar->ViewPort().Height() ) / (double)heightContent * ( (double)scrollBar->ViewPort().Height() );
scrollBarOffset = (-1.0)*(double)content->DrawPort().Point().Y() / (double)(content->DrawPort().Height() - (tvguideConfig.osdHeight-2*borderWidth-headerHeight));
scrollBarOffset *= ( (double)scrollBar->ViewPort().Height()-7.0 - heightScrollbar);
scrollBarOffset++;
} else {
heightScrollbar = scrollBar->ViewPort().Height();
}
scrollBar->DrawRectangle(cRect(3,0,scrollBar->ViewPort().Width()-6, scrollBar->ViewPort().Height()), theme.Color(clrBackground));
if (imgScrollBar == NULL) {
imgScrollBar = createScrollbar(scrollBar->ViewPort().Width()-10, heightScrollbar, theme.Color(clrHighlight), theme.Color(clrHighlightBlending));
}
scrollBar->DrawImage(cPoint(5, 2 + scrollBarOffset), *imgScrollBar);
}
void cDetailView::scrollUp() {
if (contentScrollable) {
int newDrawportHeight = content->DrawPort().Point().Y() + tvguideConfig.FontDetailView->Height();
content->SetDrawPortPoint(cPoint(0, min(newDrawportHeight,0)));
drawScrollbar();
}
if (contentScrollable) {
int newDrawportHeight = content->DrawPort().Point().Y() + tvguideConfig.FontDetailView->Height();
content->SetDrawPortPoint(cPoint(0, min(newDrawportHeight,0)));
drawScrollbar();
}
}
void cDetailView::scrollDown() {
if (contentScrollable) {
int newDrawportHeight = content->DrawPort().Point().Y() - tvguideConfig.FontDetailView->Height();
int maxDrawportHeight = (content->DrawPort().Height() - (tvguideConfig.osdHeight-2*borderWidth-headerHeight));
content->SetDrawPortPoint(cPoint(0, max(newDrawportHeight,(-1)*maxDrawportHeight)));
drawScrollbar();
}
if (contentScrollable) {
int newDrawportHeight = content->DrawPort().Point().Y() - tvguideConfig.FontDetailView->Height();
int maxDrawportHeight = (content->DrawPort().Height() - (tvguideConfig.osdHeight-2*borderWidth-headerHeight));
content->SetDrawPortPoint(cPoint(0, max(newDrawportHeight,(-1)*maxDrawportHeight)));
drawScrollbar();
}
}
cImage *cDetailView::createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend) {
cImage *image = new cImage(cSize(width, height));
image->Fill(clrBgr);
if (tvguideConfig.useBlending) {
int numSteps = 64;
int alphaStep = 0x03;
if (height < 30)
return image;
else if (height < 100) {
numSteps = 32;
alphaStep = 0x06;
}
int stepY = 0.5*height / numSteps;
if (stepY == 0)
stepY = 1;
int alpha = 0x40;
tColor clr;
for (int i = 0; i<numSteps; 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 += alphaStep;
}
}
return image;
cImage *image = new cImage(cSize(width, height));
image->Fill(clrBgr);
if (tvguideConfig.useBlending) {
int numSteps = 64;
int alphaStep = 0x03;
if (height < 30)
return image;
else if (height < 100) {
numSteps = 32;
alphaStep = 0x06;
}
int stepY = 0.5*height / numSteps;
if (stepY == 0)
stepY = 1;
int alpha = 0x40;
tColor clr;
for (int i = 0; i<numSteps; 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 += alphaStep;
}
}
return image;
}
void cDetailView::Action(void) {
drawHeader();
drawContent();
drawScrollbar();
uint64_t Start = cTimeMs::Now();
while (true) {
uint64_t Now = cTimeMs::Now();
cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0);
int Alpha = t * ALPHA_OPAQUE;
header->SetAlpha(Alpha);
drawHeader();
drawContent();
drawScrollbar();
uint64_t Start = cTimeMs::Now();
while (true) {
uint64_t Now = cTimeMs::Now();
cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0);
int Alpha = t * ALPHA_OPAQUE;
header->SetAlpha(Alpha);
headerBack->SetAlpha(Alpha);
headerLogo->SetAlpha(Alpha);
content->SetAlpha(Alpha);
scrollBar->SetAlpha(Alpha);
footer->SetAlpha(Alpha);
osdManager.flush();
cPixmap::Unlock();
content->SetAlpha(Alpha);
scrollBar->SetAlpha(Alpha);
footer->SetAlpha(Alpha);
osdManager.flush();
cPixmap::Unlock();
int Delta = cTimeMs::Now() - Now;
if (Delta < FrameTime)
cCondWait::SleepMs(FrameTime - Delta);
if ((Now - Start) > FadeTime)
break;
if ((Now - Start) > FadeTime)
break;
}
}

View File

@ -7,35 +7,35 @@ class cEpgGrid;
class cDetailView : public cThread {
private:
cGrid *grid;
cStyledPixmap *header;
cPixmap *headerLogo;
cPixmap *headerBack;
cPixmap *content;
cPixmap *scrollBar;
cPixmap *footer;
const cEvent *event;
cImage *imgScrollBar;
int FrameTime;
int FadeTime;
cTextWrapper description;
int borderWidth;
int headerHeight;
bool setContentDrawportHeight();
int heightContent;
int heightScrollbar;
bool contentScrollable;
virtual void Action(void);
void drawHeader();
void drawContent();
void drawScrollbar();
cImage *createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend);
cGrid *grid;
cStyledPixmap *header;
cPixmap *headerLogo;
cPixmap *headerBack;
cPixmap *content;
cPixmap *scrollBar;
cPixmap *footer;
const cEvent *event;
cImage *imgScrollBar;
int FrameTime;
int FadeTime;
cTextWrapper description;
int borderWidth;
int headerHeight;
bool setContentDrawportHeight();
int heightContent;
int heightScrollbar;
bool contentScrollable;
virtual void Action(void);
void drawHeader();
void drawContent();
void drawScrollbar();
cImage *createScrollbar(int width, int height, tColor clrBgr, tColor clrBlend);
public:
cDetailView(cGrid *grid);
virtual ~cDetailView(void);
void createPixmaps();
void scrollUp();
void scrollDown();
cDetailView(cGrid *grid);
virtual ~cDetailView(void);
void createPixmaps();
void scrollUp();
void scrollDown();
};
#endif //__TVGUIDE_DETAILVIEW_H

View File

@ -11,10 +11,10 @@ cDummyGrid::~cDummyGrid(void) {
}
void cDummyGrid::SetViewportHeight() {
int viewportHeightOld = viewportHeight;
int viewportHeightOld = viewportHeight;
viewportHeight = Duration() / 60 * tvguideConfig.minutePixel;
if (viewportHeight != viewportHeightOld)
dirty = true;
dirty = true;
}
void cDummyGrid::PositionPixmap() {
@ -57,7 +57,7 @@ void cDummyGrid::setText() {
}
void cDummyGrid::drawText() {
if (tvguideConfig.displayMode == eVertical) {
if (tvguideConfig.displayMode == eVertical) {
if (Height()/tvguideConfig.minutePixel < 6)
return;
int textHeight = tvguideConfig.FontGrid->Height();
@ -80,7 +80,7 @@ cString cDummyGrid::getTimeString(void) {
}
void cDummyGrid::debug() {
esyslog("tvguide dummygrid: %s: %s, %s, viewportHeight: %d px, Duration: %ld min, active: %d",
esyslog("tvguide dummygrid: %s: %s, %s, viewportHeight: %d px, Duration: %ld min, active: %d",
column->Name(),
*cMyTime::printTime(start),
*cMyTime::printTime(end),

View File

@ -8,24 +8,24 @@ private:
time_t start;
time_t end;
cString strText;
void drawText();
void drawText();
time_t Duration(void) { return (end - start); };
public:
cDummyGrid(cChannelColumn *c, time_t start, time_t end);
virtual ~cDummyGrid(void);
void SetViewportHeight();
cDummyGrid(cChannelColumn *c, time_t start, time_t end);
virtual ~cDummyGrid(void);
void SetViewportHeight();
void PositionPixmap();
void setText(void);
const cEvent *GetEvent() {return NULL;};
time_t StartTime() { return start; };
time_t EndTime() { return end; };
const cEvent *GetEvent() {return NULL;};
time_t StartTime() { return start; };
time_t EndTime() { return end; };
void SetStartTime(time_t start) { this->start = start; };
void SetEndTime(time_t end) { this->end = end; };
int calcOverlap(cGrid *neighbor);
void setTimer() {};
void SetEndTime(time_t end) { this->end = end; };
int calcOverlap(cGrid *neighbor);
void setTimer() {};
cString getText(void);
cString getTimeString(void);
void debug();
void debug();
};
#endif //__TVGUIDE_DUMMYGRID_H

View File

@ -2,31 +2,31 @@
#include "epggrid.h"
cEpgGrid::cEpgGrid(cChannelColumn *c, const cEvent *event) : cGrid(c) {
this->event = event;
extText = new cTextWrapper();
hasTimer = false;
if (column->HasTimer())
hasTimer = event->HasTimer();
this->event = event;
extText = new cTextWrapper();
hasTimer = false;
if (column->HasTimer())
hasTimer = event->HasTimer();
dummy = false;
}
cEpgGrid::~cEpgGrid(void) {
delete extText;
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;
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;
}
} else {
viewportHeight = Duration() / 60;
}
viewportHeight *= tvguideConfig.minutePixel;
if (viewportHeight != viewportHeightOld)
dirty = true;
if (viewportHeight != viewportHeightOld)
dirty = true;
}
void cEpgGrid::PositionPixmap() {
@ -103,11 +103,11 @@ void cEpgGrid::drawText() {
}
void cEpgGrid::drawRecIcon() {
cString recIconText("REC");
int width = tvguideConfig.FontGrid->Width(*recIconText)+2*borderWidth;
int height = tvguideConfig.FontGrid->Height()+10;
pixmap->DrawRectangle( cRect(Width() - width - borderWidth, Height() - height - borderWidth, width, height), theme.Color(clrButtonRed));
pixmap->DrawText(cPoint(Width() - width, Height() - height - borderWidth/2), *recIconText, theme.Color(clrFont), clrTransparent, tvguideConfig.FontGrid);
cString recIconText("REC");
int width = tvguideConfig.FontGrid->Width(*recIconText)+2*borderWidth;
int height = tvguideConfig.FontGrid->Height()+10;
pixmap->DrawRectangle( cRect(Width() - width - borderWidth, Height() - height - borderWidth, width, height), theme.Color(clrButtonRed));
pixmap->DrawText(cPoint(Width() - width, Height() - height - borderWidth/2), *recIconText, theme.Color(clrFont), clrTransparent, tvguideConfig.FontGrid);
}
cString cEpgGrid::getTimeString(void) {
@ -115,7 +115,7 @@ cString cEpgGrid::getTimeString(void) {
}
void cEpgGrid::debug() {
esyslog("tvguide epggrid: %s: %s, %s, viewportHeight: %d px, Duration: %d min, active: %d",
esyslog("tvguide epggrid: %s: %s, %s, viewportHeight: %d px, Duration: %d min, active: %d",
column->Name(),
*(event->GetTimeString()),
event->Title(),

View File

@ -5,25 +5,25 @@
class cEpgGrid : public cGrid {
private:
const cEvent *event;
cTextWrapper *extText;
const cEvent *event;
cTextWrapper *extText;
cString timeString;
bool hasTimer;
void drawText();
void drawRecIcon();
void drawText();
void drawRecIcon();
time_t Duration(void) { return event->Duration(); };
public:
cEpgGrid(cChannelColumn *c, const cEvent *event);
virtual ~cEpgGrid(void);
void SetViewportHeight();
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() {hasTimer = true;};
const cEvent *GetEvent() {return event;};
time_t StartTime() { return event->StartTime(); };
time_t EndTime() { return event->EndTime(); };
void setTimer() {hasTimer = true;};
cString getTimeString(void);
void debug();
void debug();
};
#endif //__TVGUIDE_EPGGRID_H

View File

@ -2,10 +2,10 @@
cFooter::cFooter() {
buttonBorder = 20;
buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeLineWidth - 5*buttonBorder)/4;
buttonHeight= tvguideConfig.footerHeight - 2*buttonBorder;
buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeLineWidth - 5*buttonBorder)/4;
buttonHeight= tvguideConfig.footerHeight - 2*buttonBorder;
buttonY = (tvguideConfig.footerHeight - buttonHeight)/2;
footer = osdManager.requestPixmap(2, cRect( tvguideConfig.timeLineWidth,
tvguideConfig.osdHeight - tvguideConfig.footerHeight,
tvguideConfig.osdWidth - tvguideConfig.timeLineWidth,

View File

@ -5,19 +5,19 @@
class cFooter {
private:
cPixmap *footer;
int buttonWidth;
cPixmap *footer;
int buttonWidth;
int buttonHeight;
int buttonY;
int buttonBorder;
void DrawButton(const char *text, tColor color, tColor borderColor, int num);
public:
cFooter();
virtual ~cFooter(void);
void drawRedButton();
void drawGreenButton();
void drawYellowButton();
void drawBlueButton();
cFooter();
virtual ~cFooter(void);
void drawRedButton();
void drawGreenButton();
void drawYellowButton();
void drawBlueButton();
};
#endif //__TVGUIDE_FOOTER_H

94
grid.c
View File

@ -3,44 +3,44 @@
cGrid::cGrid(cChannelColumn *c) {
this->column = c;
text = new cTextWrapper();
dirty = true;
active = false;
viewportHeight = 0;
borderWidth = 10;
text = new cTextWrapper();
dirty = true;
active = false;
viewportHeight = 0;
borderWidth = 10;
}
cGrid::~cGrid(void) {
delete text;
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);
}
}
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) {
setBackground();
drawBackground();
drawText();
drawBorder();
pixmap->SetLayer(1);
dirty = false;
}
if (!pixmap) {
return;
}
if (dirty) {
setBackground();
drawBackground();
drawText();
drawBorder();
pixmap->SetLayer(1);
dirty = false;
}
}
bool cGrid::isFirst(void) {
@ -50,28 +50,28 @@ bool cGrid::isFirst(void) {
}
bool cGrid::Match(time_t t) {
if ((StartTime() < t) && (EndTime() > t))
return true;
else
return false;
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;
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()) );
return ! ( (neighbor->EndTime() <= StartTime()) || (neighbor->StartTime() >= EndTime()) );
}

54
grid.h
View File

@ -5,39 +5,39 @@
class cGrid : public cListObject, public cStyledPixmap {
protected:
cTextWrapper *text;
int viewportHeight;
int borderWidth;
void setBackground();
bool isColor1;
bool active;
bool dirty;
bool intersects(cGrid *neighbor);
cTextWrapper *text;
int viewportHeight;
int borderWidth;
void setBackground();
bool isColor1;
bool active;
bool dirty;
bool intersects(cGrid *neighbor);
virtual time_t Duration(void) {};
virtual void drawText(void) {};
bool dummy;
public:
cGrid(cChannelColumn *c);
virtual ~cGrid(void);
cChannelColumn *column;
virtual void SetViewportHeight() {};
virtual void PositionPixmap() {};
virtual void setText(void) {};
void Draw();
void SetDirty() {dirty = true;};
void SetActive() {dirty = true; active = true;};
void SetInActive() {dirty = true; active = false;};
void SetColor(bool color) {isColor1 = color;};
bool IsColor1() {return isColor1;};
cGrid(cChannelColumn *c);
virtual ~cGrid(void);
cChannelColumn *column;
virtual void SetViewportHeight() {};
virtual void PositionPixmap() {};
virtual void setText(void) {};
void Draw();
void SetDirty() {dirty = true;};
void SetActive() {dirty = true; active = true;};
void SetInActive() {dirty = true; active = false;};
void SetColor(bool color) {isColor1 = color;};
bool IsColor1() {return isColor1;};
bool isFirst(void);
virtual const cEvent *GetEvent() {};
bool Match(time_t t);
virtual time_t StartTime() {};
virtual time_t EndTime() {};
virtual void SetStartTime(time_t start) {};
virtual void SetEndTime(time_t end) {};
int calcOverlap(cGrid *neighbor);
virtual void setTimer() {};
bool Match(time_t t);
virtual time_t StartTime() {};
virtual time_t EndTime() {};
virtual void SetStartTime(time_t start) {};
virtual void SetEndTime(time_t end) {};
int calcOverlap(cGrid *neighbor);
virtual void setTimer() {};
virtual cString getText(void) { return cString("");};
virtual cString getTimeString(void) { return cString("");};
bool Active(void) { return active; };

View File

@ -26,11 +26,11 @@ void cHeaderGrid::createBackground(int num) {
}
pixmap = osdManager.requestPixmap(2, cRect(x, y, width, height));
pixmapLogo = osdManager.requestPixmap(3, cRect(x, y, width, height));
if ((!pixmap) || (!pixmapLogo)){
return;
}
if ((!pixmap) || (!pixmapLogo)){
return;
}
pixmapLogo->Fill(clrTransparent);
drawBackground();
drawBackground();
}
void cHeaderGrid::drawChannel(const cChannel *channel) {
@ -39,23 +39,23 @@ void cHeaderGrid::drawChannel(const cChannel *channel) {
} else if (tvguideConfig.displayMode == eHorizontal) {
drawChannelHorizontal(channel);
}
drawBorder();
drawBorder();
}
void cHeaderGrid::drawChannelHorizontal(const cChannel *channel) {
int logoWidth = Height() * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio;
int logoWidth = Height() * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio;
int logoX = tvguideConfig.displayChannelName?2:(Width()-logoWidth)/2;
int textX = 5;
int textY = (Height() - tvguideConfig.FontChannelHeaderHorizontal->Height())/2;
bool logoFound = false;
if (!tvguideConfig.hideChannelLogos) {
cImageLoader imgLoader;
cImageLoader imgLoader;
if (imgLoader.LoadLogo(channel->Name(), logoWidth, Height())) {
cImage logo = imgLoader.GetImage();
pixmapLogo->DrawImage(cPoint(logoX, 0), logo);
logoFound = true;
}
}
}
bool drawText = false;
int textWidthMax = Width() - 10;
if (!logoFound) {
@ -76,36 +76,36 @@ void cHeaderGrid::drawChannelVertical(const cChannel *channel) {
int logoWidth = Width()/2 - 15;
int logoHeight = logoWidth * tvguideConfig.logoHeightRatio / tvguideConfig.logoWidthRatio;
cTextWrapper tw;
cString headerText = cString::sprintf("%d - %s", channel->Number(), channel->Name());
tw.Set(*headerText, tvguideConfig.FontChannelHeader, tvguideConfig.colWidth - 8);
int lines = tw.Lines();
int lineHeight = tvguideConfig.FontChannelHeader->Height();
int yStart = (tvguideConfig.channelHeaderHeight - lines*lineHeight)/2 + 8;
bool logoFound = false;
cString headerText = cString::sprintf("%d - %s", channel->Number(), channel->Name());
tw.Set(*headerText, tvguideConfig.FontChannelHeader, tvguideConfig.colWidth - 8);
int lines = tw.Lines();
int lineHeight = tvguideConfig.FontChannelHeader->Height();
int yStart = (tvguideConfig.channelHeaderHeight - lines*lineHeight)/2 + 8;
bool logoFound = false;
if (!tvguideConfig.hideChannelLogos) {
cImageLoader imgLoader;
if (imgLoader.LoadLogo(channel->Name(), logoWidth, logoHeight)) {
cImage logo = imgLoader.GetImage();
cImageLoader imgLoader;
if (imgLoader.LoadLogo(channel->Name(), logoWidth, logoHeight)) {
cImage logo = imgLoader.GetImage();
pixmapLogo->DrawImage(cPoint((Width() - logoWidth)/2, 4), logo);
logoFound = true;
}
}
}
}
bool drawText = false;
if (!logoFound) {
drawText = true;
} else if (tvguideConfig.displayChannelName) {
drawText = true;
yStart = logoHeight;
yStart = logoHeight;
}
if (!drawText)
return;
for (int i=0; i<lines; i++) {
int textWidth = tvguideConfig.FontChannelHeader->Width(tw.GetLine(i));
int xText = (tvguideConfig.colWidth - textWidth) / 2;
if (xText < 0)
xText = 0;
pixmap->DrawText(cPoint(xText, yStart + i*lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontChannelHeader);
}
for (int i=0; i<lines; i++) {
int textWidth = tvguideConfig.FontChannelHeader->Width(tw.GetLine(i));
int xText = (tvguideConfig.colWidth - textWidth) / 2;
if (xText < 0)
xText = 0;
pixmap->DrawText(cPoint(xText, yStart + i*lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontChannelHeader);
}
}
void cHeaderGrid::setPosition(int num) {
@ -122,5 +122,5 @@ void cHeaderGrid::setPosition(int num) {
height = tvguideConfig.rowHeight;
}
pixmap->SetViewPort(cRect(x, y, width, height));
pixmapLogo->SetViewPort(cRect(x, y, width, height));
pixmapLogo->SetViewPort(cRect(x, y, width, height));
}

View File

@ -9,8 +9,8 @@ private:
void drawChannelHorizontal(const cChannel *channel);
void drawChannelVertical(const cChannel *channel);
public:
cHeaderGrid(void);
virtual ~cHeaderGrid(void);
cHeaderGrid(void);
virtual ~cHeaderGrid(void);
void createBackground(int num);
void drawChannel(const cChannel *channel);
void setPosition(int num);

View File

@ -21,10 +21,10 @@ bool cImageLoader::LoadLogo(const char *logo, int width, int height) {
toLowerCase(logoLower);
cString extension;
if (tvguideConfig.logoExtension == 0) {
extension = "png";
} else if (tvguideConfig.logoExtension == 1) {
extension = "jpg";
}
extension = "png";
} else if (tvguideConfig.logoExtension == 1) {
extension = "jpg";
}
if (!LoadImage(logoLower.c_str(), tvguideConfig.logoPath, extension))
return false;
buffer.sample( Geometry(width, height));

View File

@ -1,55 +1,55 @@
#include "messagebox.h"
cMessageBoxThread::cMessageBoxThread(cPixmap *content, int displayTime) {
this->content = content;
FrameTime = 30; // ms
FadeTime = 200; // ms
this->displayTime = displayTime;
this->content = content;
FrameTime = 30; // ms
FadeTime = 200; // ms
this->displayTime = displayTime;
}
cMessageBoxThread::~cMessageBoxThread(void) {
Cancel(-1);
while (Active())
while (Active())
cCondWait::SleepMs(10);
}
void cMessageBoxThread::Action(void) {
uint64_t Start = cTimeMs::Now();
while (Running()) {
uint64_t Now = cTimeMs::Now();
cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0);
int Alpha = t * ALPHA_OPAQUE;
if (Running() && content) {
content->SetAlpha(Alpha);
osdManager.flush();
}
cPixmap::Unlock();
uint64_t Start = cTimeMs::Now();
while (Running()) {
uint64_t Now = cTimeMs::Now();
cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0);
int Alpha = t * ALPHA_OPAQUE;
if (Running() && content) {
content->SetAlpha(Alpha);
osdManager.flush();
}
cPixmap::Unlock();
int Delta = cTimeMs::Now() - Now;
if (Delta < FrameTime)
cCondWait::SleepMs(FrameTime - Delta);
if ((Now - Start) > FadeTime)
break;
if ((Now - Start) > FadeTime)
break;
}
cCondWait::SleepMs(displayTime - 2*FadeTime);
Start = cTimeMs::Now();
while (Running()) {
uint64_t Now = cTimeMs::Now();
cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0);
int Alpha = (1-t) * ALPHA_OPAQUE;
if (Running() && content) {
content->SetAlpha(Alpha);
osdManager.flush();
}
cPixmap::Unlock();
cCondWait::SleepMs(displayTime - 2*FadeTime);
Start = cTimeMs::Now();
while (Running()) {
uint64_t Now = cTimeMs::Now();
cPixmap::Lock();
double t = min(double(Now - Start) / FadeTime, 1.0);
int Alpha = (1-t) * ALPHA_OPAQUE;
if (Running() && content) {
content->SetAlpha(Alpha);
osdManager.flush();
}
cPixmap::Unlock();
int Delta = cTimeMs::Now() - Now;
if (Delta < FrameTime)
cCondWait::SleepMs(FrameTime - Delta);
if ((Now - Start) > FadeTime)
break;
if ((Now - Start) > FadeTime)
break;
}
osdManager.flush();
osdManager.flush();
}
//--cMessageBox-------------------------------------------------------------
@ -57,55 +57,55 @@ cMessageBoxThread *cMessageBox::msgboxThread = NULL;
cPixmap *cMessageBox::content = NULL;
bool cMessageBox::Start(int displayTime, cString msg) {
int width = (tvguideConfig.osdWidth - 600)/2;
if (!content) {
int height = 400;
content = osdManager.requestPixmap(5, cRect((tvguideConfig.osdWidth - width)/2,
(tvguideConfig.osdHeight- height)/2,
width, height));
}
if (msgboxThread) {
delete msgboxThread;
msgboxThread = NULL;
}
if (!msgboxThread) {
msgboxThread = new cMessageBoxThread(content, displayTime);
cTextWrapper message;
message.Set(msg, tvguideConfig.FontMessageBox, width - 40);
int textHeight = tvguideConfig.FontMessageBox->Height();
int textLines = message.Lines();
int height = textLines * (textHeight+20);
cPixmap::Lock();
content->SetViewPort(cRect((tvguideConfig.osdWidth - width)/2,(tvguideConfig.osdHeight- height)/2, width, height));
content->SetAlpha(0);
content->Fill(theme.Color(clrBorder));
content->DrawRectangle(cRect(2,2,width-4, height-4), theme.Color(clrBackground));
int textWidth = 0;
for (int i=0; i<textLines; i++) {
textWidth = tvguideConfig.FontMessageBox->Width(message.GetLine(i));
content->DrawText(cPoint((width - textWidth)/2, 20 + i*textHeight), message.GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontMessageBox);
}
cPixmap::Unlock();
msgboxThread->Start();
int width = (tvguideConfig.osdWidth - 600)/2;
if (!content) {
int height = 400;
content = osdManager.requestPixmap(5, cRect((tvguideConfig.osdWidth - width)/2,
(tvguideConfig.osdHeight- height)/2,
width, height));
}
if (msgboxThread) {
delete msgboxThread;
msgboxThread = NULL;
}
if (!msgboxThread) {
msgboxThread = new cMessageBoxThread(content, displayTime);
cTextWrapper message;
message.Set(msg, tvguideConfig.FontMessageBox, width - 40);
int textHeight = tvguideConfig.FontMessageBox->Height();
int textLines = message.Lines();
int height = textLines * (textHeight+20);
cPixmap::Lock();
content->SetViewPort(cRect((tvguideConfig.osdWidth - width)/2,(tvguideConfig.osdHeight- height)/2, width, height));
content->SetAlpha(0);
content->Fill(theme.Color(clrBorder));
content->DrawRectangle(cRect(2,2,width-4, height-4), theme.Color(clrBackground));
int textWidth = 0;
for (int i=0; i<textLines; i++) {
textWidth = tvguideConfig.FontMessageBox->Width(message.GetLine(i));
content->DrawText(cPoint((width - textWidth)/2, 20 + i*textHeight), message.GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontMessageBox);
}
cPixmap::Unlock();
msgboxThread->Start();
return true;
}
return false;
}
return false;
}
void cMessageBox::Stop(void) {
if (msgboxThread) {
delete msgboxThread;
msgboxThread = NULL;
}
if (msgboxThread) {
delete msgboxThread;
msgboxThread = NULL;
}
}
void cMessageBox::Destroy(void) {
if (msgboxThread) {
delete msgboxThread;
msgboxThread = NULL;
}
if (content) {
osdManager.releasePixmap(content);
content = NULL;
}
if (msgboxThread) {
delete msgboxThread;
msgboxThread = NULL;
}
if (content) {
osdManager.releasePixmap(content);
content = NULL;
}
}

View File

@ -5,25 +5,25 @@
class cMessageBoxThread : public cThread {
private:
cPixmap *content;
int FadeTime;
int FrameTime;
int displayTime;
virtual void Action(void);
cPixmap *content;
int FadeTime;
int FrameTime;
int displayTime;
virtual void Action(void);
public:
cMessageBoxThread(cPixmap *content, int displayTime);
virtual ~cMessageBoxThread(void);
cMessageBoxThread(cPixmap *content, int displayTime);
virtual ~cMessageBoxThread(void);
};
class cMessageBox {
private:
static cMutex mutex;
static cMessageBoxThread *msgboxThread;
static cPixmap *content;
static cMutex mutex;
static cMessageBoxThread *msgboxThread;
static cPixmap *content;
public:
static bool Start(int displayTime, cString msg);
static void Stop(void);
static void Destroy(void);
static bool Start(int displayTime, cString msg);
static void Stop(void);
static void Destroy(void);
};
#endif //__TVGUIDE_MESSAGEBOX_H

View File

@ -5,18 +5,18 @@
#define __TVGUIDE_OSDMANAGER_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(); };
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(); };
};
#endif //__TVGUIDE_OSDMANAGER_H
@ -25,14 +25,14 @@ 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;
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() {
@ -46,13 +46,13 @@ void cOsdManager::setBackground() {
}
cPixmap *cOsdManager::requestPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort) {
return osd->CreatePixmap(Layer, ViewPort, DrawPort);
return osd->CreatePixmap(Layer, ViewPort, DrawPort);
}
void cOsdManager::releasePixmap(cPixmap *pixmap) {
if (!pixmap)
return;
osd->DestroyPixmap(pixmap);
osd->DestroyPixmap(pixmap);
}
static std::string CutText(std::string text, int width, const cFont *font) {

268
setup.c
View File

@ -1,8 +1,8 @@
#include "setup.h"
cTvguideSetup::cTvguideSetup() {
tmpTvguideConfig = tvguideConfig;
Setup();
tmpTvguideConfig = tvguideConfig;
Setup();
}
cTvguideSetup::~cTvguideSetup() {
@ -10,93 +10,93 @@ cTvguideSetup::~cTvguideSetup() {
void cTvguideSetup::Setup(void) {
int currentItem = Current();
Clear();
Add(new cOsdItem(tr("General Settings")));
Add(new cOsdItem(tr("Screen Presentation")));
Add(new cOsdItem(tr("Fonts and Fontsizes")));
SetCurrent(Get(currentItem));
Display();
int currentItem = Current();
Clear();
Add(new cOsdItem(tr("General Settings")));
Add(new cOsdItem(tr("Screen Presentation")));
Add(new cOsdItem(tr("Fonts and Fontsizes")));
SetCurrent(Get(currentItem));
Display();
}
eOSState cTvguideSetup::ProcessKey(eKeys Key) {
bool hadSubMenu = HasSubMenu();
eOSState state = cMenuSetupPage::ProcessKey(Key);
if (hadSubMenu && Key == kOk)
Store();
if (!hadSubMenu && (state == osUnknown || Key == kOk)) {
if ((Key == kOk && !hadSubMenu)) {
const char* ItemText = Get(Current())->Text();
if (strcmp(ItemText, tr("General Settings")) == 0)
state = AddSubMenu(new cMenuSetupGeneral(&tmpTvguideConfig));
if (strcmp(ItemText, tr("Screen Presentation")) == 0)
state = AddSubMenu(new cMenuSetupScreenLayout(&tmpTvguideConfig));
if (strcmp(ItemText, tr("Fonts and Fontsizes")) == 0)
state = AddSubMenu(new cMenuSetupFont(&tmpTvguideConfig));
}
}
return state;
bool hadSubMenu = HasSubMenu();
eOSState state = cMenuSetupPage::ProcessKey(Key);
if (hadSubMenu && Key == kOk)
Store();
if (!hadSubMenu && (state == osUnknown || Key == kOk)) {
if ((Key == kOk && !hadSubMenu)) {
const char* ItemText = Get(Current())->Text();
if (strcmp(ItemText, tr("General Settings")) == 0)
state = AddSubMenu(new cMenuSetupGeneral(&tmpTvguideConfig));
if (strcmp(ItemText, tr("Screen Presentation")) == 0)
state = AddSubMenu(new cMenuSetupScreenLayout(&tmpTvguideConfig));
if (strcmp(ItemText, tr("Fonts and Fontsizes")) == 0)
state = AddSubMenu(new cMenuSetupFont(&tmpTvguideConfig));
}
}
return state;
}
void cTvguideSetup::Store(void) {
tvguideConfig = tmpTvguideConfig;
tvguideConfig = tmpTvguideConfig;
SetupStore("themeIndex", tvguideConfig.themeIndex);
SetupStore("displayMode", tvguideConfig.displayMode);
SetupStore("themeIndex", tvguideConfig.themeIndex);
SetupStore("displayMode", tvguideConfig.displayMode);
SetupStore("displayStatusHeader", tvguideConfig.displayStatusHeader);
SetupStore("statusHeaderPercent", tvguideConfig.statusHeaderPercent);
SetupStore("scaleVideo", tvguideConfig.scaleVideo);
SetupStore("decorateVideo", tvguideConfig.decorateVideo);
SetupStore("statusHeaderPercent", tvguideConfig.statusHeaderPercent);
SetupStore("scaleVideo", tvguideConfig.scaleVideo);
SetupStore("decorateVideo", tvguideConfig.decorateVideo);
SetupStore("useBlending", tvguideConfig.useBlending);
SetupStore("roundedCorners", tvguideConfig.roundedCorners);
SetupStore("timeFormat", tvguideConfig.timeFormat);
SetupStore("channelCols", tvguideConfig.channelCols);
SetupStore("channelRows", tvguideConfig.channelRows);
SetupStore("displayTime", tvguideConfig.displayTime);
SetupStore("bigStepHours", tvguideConfig.bigStepHours);
SetupStore("hugeStepHours", tvguideConfig.hugeStepHours);
SetupStore("jumpChannels", tvguideConfig.jumpChannels);
SetupStore("hideChannelLogos", tvguideConfig.hideChannelLogos);
SetupStore("logoExtension", tvguideConfig.logoExtension);
SetupStore("logoWidthRatio", tvguideConfig.logoWidthRatio);
SetupStore("logoHeightRatio", tvguideConfig.logoHeightRatio);
SetupStore("hideEpgImages", tvguideConfig.hideEpgImages);
SetupStore("epgImageWidth", tvguideConfig.epgImageWidth);
SetupStore("epgImageHeight", tvguideConfig.epgImageHeight);
SetupStore("epgImageHeight", tvguideConfig.epgImageHeight);
SetupStore("timeLineWidthPercent", tvguideConfig.timeLineWidthPercent);
SetupStore("timeLineHeightPercent", tvguideConfig.timeLineHeightPercent);
SetupStore("roundedCorners", tvguideConfig.roundedCorners);
SetupStore("timeFormat", tvguideConfig.timeFormat);
SetupStore("channelCols", tvguideConfig.channelCols);
SetupStore("channelRows", tvguideConfig.channelRows);
SetupStore("displayTime", tvguideConfig.displayTime);
SetupStore("bigStepHours", tvguideConfig.bigStepHours);
SetupStore("hugeStepHours", tvguideConfig.hugeStepHours);
SetupStore("jumpChannels", tvguideConfig.jumpChannels);
SetupStore("hideChannelLogos", tvguideConfig.hideChannelLogos);
SetupStore("logoExtension", tvguideConfig.logoExtension);
SetupStore("logoWidthRatio", tvguideConfig.logoWidthRatio);
SetupStore("logoHeightRatio", tvguideConfig.logoHeightRatio);
SetupStore("hideEpgImages", tvguideConfig.hideEpgImages);
SetupStore("epgImageWidth", tvguideConfig.epgImageWidth);
SetupStore("epgImageHeight", tvguideConfig.epgImageHeight);
SetupStore("epgImageHeight", tvguideConfig.epgImageHeight);
SetupStore("timeLineWidthPercent", tvguideConfig.timeLineWidthPercent);
SetupStore("timeLineHeightPercent", tvguideConfig.timeLineHeightPercent);
SetupStore("displayChannelName", tvguideConfig.displayChannelName);
SetupStore("channelHeaderWidthPercent", tvguideConfig.channelHeaderWidthPercent);
SetupStore("channelHeaderHeightPercent", tvguideConfig.channelHeaderHeightPercent);
SetupStore("footerHeight", tvguideConfig.footerHeight);
SetupStore("fontIndex", tvguideConfig.fontIndex);
SetupStore("footerHeight", tvguideConfig.footerHeight);
SetupStore("fontIndex", tvguideConfig.fontIndex);
SetupStore("FontButtonDelta", tvguideConfig.FontButtonDelta);
SetupStore("FontDetailViewDelta", tvguideConfig.FontDetailViewDelta);
SetupStore("FontDetailHeaderDelta", tvguideConfig.FontDetailHeaderDelta);
SetupStore("FontMessageBoxDelta", tvguideConfig.FontMessageBoxDelta);
SetupStore("FontMessageBoxLargeDelta", tvguideConfig.FontMessageBoxLargeDelta);
SetupStore("FontStatusHeaderDelta", tvguideConfig.FontStatusHeaderDelta);
SetupStore("FontStatusHeaderLargeDelta", tvguideConfig.FontStatusHeaderLargeDelta);
SetupStore("FontChannelHeaderDelta", tvguideConfig.FontChannelHeaderDelta);
SetupStore("FontGridDelta", tvguideConfig.FontGridDelta);
SetupStore("FontGridSmallDelta", tvguideConfig.FontGridSmallDelta);
SetupStore("FontTimeLineWeekdayDelta", tvguideConfig.FontTimeLineWeekdayDelta);
SetupStore("FontTimeLineDateDelta", tvguideConfig.FontTimeLineDateDelta);
SetupStore("FontTimeLineTimeDelta", tvguideConfig.FontTimeLineTimeDelta);
SetupStore("FontChannelHeaderHorizontalDelta", tvguideConfig.FontChannelHeaderHorizontalDelta);
SetupStore("FontGridHorizontalDelta", tvguideConfig.FontGridHorizontalDelta);
SetupStore("FontGridHorizontalSmallDelta", tvguideConfig.FontGridHorizontalSmallDelta);
SetupStore("FontTimeLineDateHorizontalDelta", tvguideConfig.FontTimeLineDateHorizontalDelta);
SetupStore("FontTimeLineTimeHorizontalDelta", tvguideConfig.FontTimeLineTimeHorizontalDelta);
SetupStore("FontMessageBoxDelta", tvguideConfig.FontMessageBoxDelta);
SetupStore("FontMessageBoxLargeDelta", tvguideConfig.FontMessageBoxLargeDelta);
SetupStore("FontStatusHeaderDelta", tvguideConfig.FontStatusHeaderDelta);
SetupStore("FontStatusHeaderLargeDelta", tvguideConfig.FontStatusHeaderLargeDelta);
SetupStore("FontChannelHeaderDelta", tvguideConfig.FontChannelHeaderDelta);
SetupStore("FontGridDelta", tvguideConfig.FontGridDelta);
SetupStore("FontGridSmallDelta", tvguideConfig.FontGridSmallDelta);
SetupStore("FontTimeLineWeekdayDelta", tvguideConfig.FontTimeLineWeekdayDelta);
SetupStore("FontTimeLineDateDelta", tvguideConfig.FontTimeLineDateDelta);
SetupStore("FontTimeLineTimeDelta", tvguideConfig.FontTimeLineTimeDelta);
SetupStore("FontChannelHeaderHorizontalDelta", tvguideConfig.FontChannelHeaderHorizontalDelta);
SetupStore("FontGridHorizontalDelta", tvguideConfig.FontGridHorizontalDelta);
SetupStore("FontGridHorizontalSmallDelta", tvguideConfig.FontGridHorizontalSmallDelta);
SetupStore("FontTimeLineDateHorizontalDelta", tvguideConfig.FontTimeLineDateHorizontalDelta);
SetupStore("FontTimeLineTimeHorizontalDelta", tvguideConfig.FontTimeLineTimeHorizontalDelta);
}
cMenuSetupSubMenu::cMenuSetupSubMenu(const char* Title, cTvguideConfig* data) : cOsdMenu(Title, 30) {
tmpTvguideConfig = data;
tmpTvguideConfig = data;
}
cOsdItem *cMenuSetupSubMenu::InfoItem(const char *label, const char *value) {
@ -122,50 +122,50 @@ eOSState cMenuSetupSubMenu::ProcessKey(eKeys Key) {
//------------------------------------------------------------------------------------------------------------------
cMenuSetupGeneral::cMenuSetupGeneral(cTvguideConfig* data) : cMenuSetupSubMenu(tr("General Settings"), data) {
themes.Load(*cString("tvguide"));
themes.Load(*cString("tvguide"));
timeFormatItems[0] = "12h";
timeFormatItems[1] = "24h";
timeFormatItems[1] = "24h";
blendingMethods[0] = "none";
blendingMethods[1] = "classic";
blendingMethods[2] = "nOpacity style";
Set();
Set();
}
void cMenuSetupGeneral::Set(void) {
int currentItem = Current();
Clear();
int currentItem = Current();
Clear();
if (themes.NumThemes())
Add(new cMenuEditStraItem(tr("Theme"), &tmpTvguideConfig->themeIndex, themes.NumThemes(), themes.Descriptions()));
Add(new cMenuEditStraItem(tr("Use color gradients"), &tmpTvguideConfig->useBlending, 3, blendingMethods));
Add(new cMenuEditBoolItem(tr("Rounded Corners"), &tmpTvguideConfig->roundedCorners));
Add(new cMenuEditStraItem(tr("Theme"), &tmpTvguideConfig->themeIndex, themes.NumThemes(), themes.Descriptions()));
Add(new cMenuEditStraItem(tr("Use color gradients"), &tmpTvguideConfig->useBlending, 3, blendingMethods));
Add(new cMenuEditBoolItem(tr("Rounded Corners"), &tmpTvguideConfig->roundedCorners));
Add(new cMenuEditIntItem(tr("Channels to Jump (Keys Green / Yellow)"), &tmpTvguideConfig->jumpChannels, 2, 30));
Add(new cMenuEditIntItem(tr("Time to display in minutes"), &tmpTvguideConfig->displayTime, 120, 320));
Add(new cMenuEditIntItem(tr("Big Step (Keys 1 / 3) in hours"), &tmpTvguideConfig->bigStepHours, 1, 12));
Add(new cMenuEditIntItem(tr("Huge Step (Keys 4 / 6) in hours"), &tmpTvguideConfig->hugeStepHours, 13, 48));
Add(new cMenuEditStraItem(tr("Time Format (12h/24h)"), &tmpTvguideConfig->timeFormat, 2, timeFormatItems));
Add(new cMenuEditIntItem(tr("Channels to Jump (Keys Green / Yellow)"), &tmpTvguideConfig->jumpChannels, 2, 30));
Add(new cMenuEditIntItem(tr("Time to display in minutes"), &tmpTvguideConfig->displayTime, 120, 320));
Add(new cMenuEditIntItem(tr("Big Step (Keys 1 / 3) in hours"), &tmpTvguideConfig->bigStepHours, 1, 12));
Add(new cMenuEditIntItem(tr("Huge Step (Keys 4 / 6) in hours"), &tmpTvguideConfig->hugeStepHours, 13, 48));
Add(new cMenuEditStraItem(tr("Time Format (12h/24h)"), &tmpTvguideConfig->timeFormat, 2, timeFormatItems));
SetCurrent(Get(currentItem));
Display();
SetCurrent(Get(currentItem));
Display();
}
//------------------------------------------------------------------------------------------------------------------
cMenuSetupScreenLayout::cMenuSetupScreenLayout(cTvguideConfig* data) : cMenuSetupSubMenu(tr("Screen Presentation"), data) {
displayModeItems[0] = "vertical";
displayModeItems[0] = "vertical";
displayModeItems[1] = "horizontal";
hideChannelLogosItems[0] = trVDR("yes");
hideChannelLogosItems[1] = trVDR("no");
logoExtensionItems[0] = "png";
logoExtensionItems[1] = "jpg";
Set();
hideChannelLogosItems[0] = trVDR("yes");
hideChannelLogosItems[1] = trVDR("no");
logoExtensionItems[0] = "png";
logoExtensionItems[1] = "jpg";
Set();
}
void cMenuSetupScreenLayout::Set(void) {
const char *indent = " ";
int currentItem = Current();
Clear();
const char *indent = " ";
int currentItem = Current();
Clear();
Add(new cMenuEditStraItem(tr("Display Mode"), &tmpTvguideConfig->displayMode, 2, displayModeItems));
if (tmpTvguideConfig->displayMode == eVertical) {
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Height of Channel Header (Perc. of osd height)")), &tmpTvguideConfig->channelHeaderHeightPercent, 5, 30));
@ -176,7 +176,7 @@ void cMenuSetupScreenLayout::Set(void) {
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Height of Timeline (Perc. of osd height)")), &tmpTvguideConfig->timeLineHeightPercent, 5, 30));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Number of Channels to display")), &tmpTvguideConfig->channelRows, 3, 12));
}
Add(new cMenuEditIntItem(tr("Height of Footer"), &tmpTvguideConfig->footerHeight, 50, 300));
Add(new cMenuEditIntItem(tr("Height of Footer"), &tmpTvguideConfig->footerHeight, 50, 300));
Add(new cMenuEditBoolItem(tr("Display status header"), &tmpTvguideConfig->displayStatusHeader));
if (tmpTvguideConfig->displayStatusHeader) {
@ -184,58 +184,58 @@ void cMenuSetupScreenLayout::Set(void) {
Add(new cMenuEditBoolItem(*cString::sprintf("%s%s", indent, tr("Scale video to upper right corner")), &tmpTvguideConfig->scaleVideo));
Add(new cMenuEditBoolItem(*cString::sprintf("%s%s", indent, tr("Rounded corners around video frame")), &tmpTvguideConfig->decorateVideo));
}
Add(new cMenuEditBoolItem(tr("Display Channel Names in Header"), &tmpTvguideConfig->displayChannelName));
Add(new cMenuEditStraItem(tr("Show Channel Logos"), &tmpTvguideConfig->hideChannelLogos, 2, hideChannelLogosItems));
if (!tmpTvguideConfig->hideChannelLogos) {
Add(InfoItem(tr("Logo Path used"), *tvguideConfig.logoPath));
Add(new cMenuEditStraItem(*cString::sprintf("%s%s", indent, tr("Logo Extension")), &tmpTvguideConfig->logoExtension, 2, logoExtensionItems));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Logo width ratio")), &tmpTvguideConfig->logoWidthRatio, 1, 1000));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Logo height ratio")), &tmpTvguideConfig->logoHeightRatio, 1, 1000));
}
Add(new cMenuEditStraItem(tr("Show EPG Images"), &tmpTvguideConfig->hideEpgImages, 2, hideChannelLogosItems));
if (!tmpTvguideConfig->hideEpgImages) {
Add(InfoItem(tr("EPG Images Path used"), *tvguideConfig.epgImagePath));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("EPG Image width")), &tmpTvguideConfig->epgImageWidth, 0, 800));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("EPG Image height")), &tmpTvguideConfig->epgImageHeight, 0, 800));
}
SetCurrent(Get(currentItem));
Display();
Add(new cMenuEditBoolItem(tr("Display Channel Names in Header"), &tmpTvguideConfig->displayChannelName));
Add(new cMenuEditStraItem(tr("Show Channel Logos"), &tmpTvguideConfig->hideChannelLogos, 2, hideChannelLogosItems));
if (!tmpTvguideConfig->hideChannelLogos) {
Add(InfoItem(tr("Logo Path used"), *tvguideConfig.logoPath));
Add(new cMenuEditStraItem(*cString::sprintf("%s%s", indent, tr("Logo Extension")), &tmpTvguideConfig->logoExtension, 2, logoExtensionItems));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Logo width ratio")), &tmpTvguideConfig->logoWidthRatio, 1, 1000));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("Logo height ratio")), &tmpTvguideConfig->logoHeightRatio, 1, 1000));
}
Add(new cMenuEditStraItem(tr("Show EPG Images"), &tmpTvguideConfig->hideEpgImages, 2, hideChannelLogosItems));
if (!tmpTvguideConfig->hideEpgImages) {
Add(InfoItem(tr("EPG Images Path used"), *tvguideConfig.epgImagePath));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("EPG Image width")), &tmpTvguideConfig->epgImageWidth, 0, 800));
Add(new cMenuEditIntItem(*cString::sprintf("%s%s", indent, tr("EPG Image height")), &tmpTvguideConfig->epgImageHeight, 0, 800));
}
SetCurrent(Get(currentItem));
Display();
}
eOSState cMenuSetupScreenLayout::ProcessKey(eKeys Key) {
eOSState state = cOsdMenu::ProcessKey(Key);
if (Key == kOk) {
state = osBack;
} else if (Key != kNone) {
Set();
}
return state;
eOSState state = cOsdMenu::ProcessKey(Key);
if (Key == kOk) {
state = osBack;
} else if (Key != kNone) {
Set();
}
return state;
}
//------------------------------------------------------------------------------------------------------------------
cMenuSetupFont::cMenuSetupFont(cTvguideConfig* data) : cMenuSetupSubMenu(tr("Fonts and Fontsizes"), data) {
cFont::GetAvailableFontNames(&fontNames);
fontNames.Insert(strdup(tvguideConfig.fontNameDefault));
Set();
cFont::GetAvailableFontNames(&fontNames);
fontNames.Insert(strdup(tvguideConfig.fontNameDefault));
Set();
}
void cMenuSetupFont::Set(void) {
int currentItem = Current();
Clear();
int currentItem = Current();
Clear();
Add(new cMenuEditStraItem(tr("Font"), &tmpTvguideConfig->fontIndex, fontNames.Size(), &fontNames[0]));
Add(new cMenuEditIntItem(tr("Status Header Font Size"), &tmpTvguideConfig->FontStatusHeaderDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Status Header Large Font Size"), &tmpTvguideConfig->FontStatusHeaderLargeDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Detail EPG View Font Size"), &tmpTvguideConfig->FontDetailViewDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Detail EPG View Header Font Size"), &tmpTvguideConfig->FontDetailHeaderDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Message Font Size"), &tmpTvguideConfig->FontMessageBoxDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Message Large Font Size"), &tmpTvguideConfig->FontMessageBoxLargeDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Button Font Size"), &tmpTvguideConfig->FontButtonDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Detail EPG View Font Size"), &tmpTvguideConfig->FontDetailViewDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Detail EPG View Header Font Size"), &tmpTvguideConfig->FontDetailHeaderDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Message Font Size"), &tmpTvguideConfig->FontMessageBoxDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Message Large Font Size"), &tmpTvguideConfig->FontMessageBoxLargeDelta, -30, 30));
Add(new cMenuEditIntItem(tr("Button Font Size"), &tmpTvguideConfig->FontButtonDelta, -30, 30));
if (tmpTvguideConfig->displayMode == eVertical) {
@ -254,6 +254,6 @@ void cMenuSetupFont::Set(void) {
}
SetCurrent(Get(currentItem));
Display();
SetCurrent(Get(currentItem));
Display();
}

66
setup.h
View File

@ -2,55 +2,55 @@
#define __TVGUIDE_SETUP_H
class cTvguideSetup : public cMenuSetupPage {
public:
cTvguideSetup(void);
virtual ~cTvguideSetup();
private:
cTvguideConfig tmpTvguideConfig;
void Setup(void);
protected:
virtual eOSState ProcessKey(eKeys Key);
virtual void Store(void);
public:
cTvguideSetup(void);
virtual ~cTvguideSetup();
private:
cTvguideConfig tmpTvguideConfig;
void Setup(void);
protected:
virtual eOSState ProcessKey(eKeys Key);
virtual void Store(void);
};
class cMenuSetupSubMenu : public cOsdMenu {
protected:
cTvguideConfig *tmpTvguideConfig;
virtual eOSState ProcessKey(eKeys Key);
virtual void Set(void) = 0;
cOsdItem *InfoItem(const char *label, const char *value);
public:
cMenuSetupSubMenu(const char *Title, cTvguideConfig *data);
protected:
cTvguideConfig *tmpTvguideConfig;
virtual eOSState ProcessKey(eKeys Key);
virtual void Set(void) = 0;
cOsdItem *InfoItem(const char *label, const char *value);
public:
cMenuSetupSubMenu(const char *Title, cTvguideConfig *data);
};
class cMenuSetupGeneral : public cMenuSetupSubMenu {
protected:
protected:
cThemes themes;
const char * blendingMethods[3];
const char * timeFormatItems[2];
void Set(void);
public:
cMenuSetupGeneral(cTvguideConfig *data);
const char * timeFormatItems[2];
void Set(void);
public:
cMenuSetupGeneral(cTvguideConfig *data);
};
class cMenuSetupScreenLayout : public cMenuSetupSubMenu {
protected:
virtual eOSState ProcessKey(eKeys Key);
protected:
virtual eOSState ProcessKey(eKeys Key);
const char * displayModeItems[2];
const char * hideChannelLogosItems[2];
const char * logoExtensionItems[2];
void Set(void);
public:
cMenuSetupScreenLayout(cTvguideConfig *data);
const char * hideChannelLogosItems[2];
const char * logoExtensionItems[2];
void Set(void);
public:
cMenuSetupScreenLayout(cTvguideConfig *data);
};
class cMenuSetupFont : public cMenuSetupSubMenu {
protected:
cStringList fontNames;
void Set(void);
public:
cMenuSetupFont(cTvguideConfig *data);
protected:
cStringList fontNames;
void Set(void);
public:
cMenuSetupFont(cTvguideConfig *data);
};
#endif //__TVGUIDE_SETUP_H

View File

@ -8,8 +8,8 @@ private:
cPixmap *pixmapText;
cPixmap *pixmapTVFrame;
public:
cStatusHeader(void);
virtual ~cStatusHeader(void);
cStatusHeader(void);
virtual ~cStatusHeader(void);
void ScaleVideo(void);
void DrawInfoText(cGrid *grid);
};

View File

@ -1,60 +1,60 @@
#include "styledpixmap.h"
cStyledPixmap::cStyledPixmap(void) {
pixmap = NULL;
pixmap = NULL;
}
cStyledPixmap::cStyledPixmap(cPixmap *pixmap) {
this->pixmap = pixmap;
this->pixmap = pixmap;
}
cStyledPixmap::~cStyledPixmap(void) {
if (pixmap)
osdManager.releasePixmap(pixmap);
if (pixmap)
osdManager.releasePixmap(pixmap);
}
void cStyledPixmap::setPixmap(cPixmap *pixmap) {
if (pixmap) {
this->pixmap = pixmap;
}
if (pixmap) {
this->pixmap = pixmap;
}
}
void cStyledPixmap::drawBackground() {
if (tvguideConfig.useBlending == 1){
drawBlendedBackground();
} else if (tvguideConfig.useBlending == 2){
drawSparsedBackground();
} else {
drawBlendedBackground();
} else if (tvguideConfig.useBlending == 2){
drawSparsedBackground();
} else {
pixmap->Fill(color);
}
}
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;
}
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();
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());
@ -62,73 +62,73 @@ void cStyledPixmap::drawSparsedBackground() {
}
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);
}
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), theme.Color(clrBackground)); //top
pixmap->DrawRectangle(cRect(0,0,2,height), theme.Color(clrBackground)); //left
pixmap->DrawRectangle(cRect(0,height-2,width,2), theme.Color(clrBackground)); //bottom
pixmap->DrawRectangle(cRect(width-2,0,2,height), theme.Color(clrBackground)); //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
pixmap->DrawRectangle(cRect(0,0,width,2), theme.Color(clrBackground)); //top
pixmap->DrawRectangle(cRect(0,0,2,height), theme.Color(clrBackground)); //left
pixmap->DrawRectangle(cRect(0,height-2,width,2), theme.Color(clrBackground)); //bottom
pixmap->DrawRectangle(cRect(width-2,0,2,height), theme.Color(clrBackground)); //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
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), theme.Color(clrBackground), -2);
pixmap->DrawEllipse(cRect(2,2,radius,radius), theme.Color(clrBorder), -2);
pixmap->DrawEllipse(cRect(1,1,radius,radius), theme.Color(clrBackground), -2);
pixmap->DrawEllipse(cRect(width-radius - 2,2,radius,radius), theme.Color(clrBorder), -1);
pixmap->DrawEllipse(cRect(width-radius - 1,1,radius,radius), theme.Color(clrBackground), -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), theme.Color(clrBackground), -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), theme.Color(clrBackground), -4);
}
pixmap->DrawEllipse(cRect(width-radius - 2,2,radius,radius), theme.Color(clrBorder), -1);
pixmap->DrawEllipse(cRect(width-radius - 1,1,radius,radius), theme.Color(clrBackground), -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), theme.Color(clrBackground), -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), theme.Color(clrBackground), -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);
}
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);
}
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);
pixmap->DrawText(Point, s, ColorFg, ColorBg, Font);
}
void cStyledPixmap::DrawImage(const cPoint &Point, const cImage &Image) {
pixmap->DrawImage(Point, Image);
pixmap->DrawImage(Point, Image);
}
void cStyledPixmap::DrawRectangle(const cRect &Rect, tColor Color) {
pixmap->DrawRectangle(Rect,Color);
pixmap->DrawRectangle(Rect,Color);
}

View File

@ -5,13 +5,13 @@
class cStyledPixmap {
private:
void drawVerticalLine(int x, int yStart, int yStop, tColor col);
void drawHorizontalLine(int y, int xStart, int xStop, tColor col);
void drawVerticalLine(int x, int yStart, int yStop, tColor col);
void drawHorizontalLine(int y, int xStart, int xStop, tColor col);
protected:
cPixmap *pixmap;
tColor color;
tColor colorBlending;
void setPixmap(cPixmap *pixmap);
cPixmap *pixmap;
tColor color;
tColor colorBlending;
void setPixmap(cPixmap *pixmap);
public:
cStyledPixmap(void);
cStyledPixmap(cPixmap *pixmap);

View File

@ -1,7 +1,7 @@
#include "timeline.h"
cTimeLine::cTimeLine(cMyTime *myTime) {
this->myTime = myTime;
this->myTime = myTime;
if (tvguideConfig.displayMode == eVertical) {
dateViewer = new cStyledPixmap(osdManager.requestPixmap(3, cRect(0,
tvguideConfig.statusHeaderHeight,
@ -36,18 +36,18 @@ cTimeLine::cTimeLine(cMyTime *myTime) {
}
cTimeLine::~cTimeLine(void) {
delete dateViewer;
osdManager.releasePixmap(timeline);
delete dateViewer;
osdManager.releasePixmap(timeline);
if (clock)
delete clock;
}
void cTimeLine::drawDateViewer() {
cString weekDay = myTime->GetWeekday();
cString date = myTime->GetDate();
dateViewer->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
dateViewer->drawBackground();
dateViewer->drawBorder();
cString weekDay = myTime->GetWeekday();
cString date = myTime->GetDate();
dateViewer->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
dateViewer->drawBackground();
dateViewer->drawBorder();
if (tvguideConfig.displayMode == eVertical) {
int textHeight = tvguideConfig.FontTimeLineWeekday->Height();
@ -64,10 +64,10 @@ void cTimeLine::drawDateViewer() {
}
void cTimeLine::drawTimeline() {
timeline->SetTile(true);
timeline->Fill(theme.Color(clrBackground));
timeline->SetTile(true);
timeline->Fill(theme.Color(clrBackground));
tColor colorFont;
int imgWidth, imgHeight;
if (tvguideConfig.displayMode == eVertical) {
imgWidth = tvguideConfig.timeLineWidth-4;
@ -77,40 +77,40 @@ void cTimeLine::drawTimeline() {
imgHeight = tvguideConfig.timeLineHeight-4;
}
const cImage *img1 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline1), theme.Color(clrTimeline1Blending));
const cImage *img2 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline2), theme.Color(clrTimeline2Blending));
const cImage *img = NULL;
int textWidth, posX, posY;
char timetext[10];
for (int i=0; i<48; i++) {
if (i%2==0) {
img = img1;
colorFont = theme.Color(clrTimeline2);
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);
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);
}
}
const cImage *img2 = createBackgroundImage(imgWidth, imgHeight, theme.Color(clrTimeline2), theme.Color(clrTimeline2Blending));
const cImage *img = NULL;
int textWidth, posX, posY;
char timetext[10];
for (int i=0; i<48; i++) {
if (i%2==0) {
img = img1;
colorFont = theme.Color(clrTimeline2);
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);
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*tvguideConfig.minutePixel*30;
timeline->DrawImage(cPoint(2, posY), *img);
@ -121,30 +121,30 @@ void cTimeLine::drawTimeline() {
timeline->DrawImage(cPoint(posX, 2), *img);
timeline->DrawText(cPoint(posX + 2, (dateViewer->Height() - tvguideConfig.FontTimeLineTimeHorizontal->Height())/2), timetext, colorFont, clrTransparent, tvguideConfig.FontTimeLineTimeHorizontal);
}
}
setTimeline();
delete img1;
delete img2;
}
setTimeline();
delete img1;
delete img2;
}
cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend) {
cImage *image = NULL;
cImage *image = NULL;
if (tvguideConfig.useBlending == 1) {
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.useBlending == 2) {
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.useBlending == 2) {
cImageLoader imgLoader;
if (imgLoader.DrawBackground(clrBgr, clrBlend, width, height)) {
image = new cImage(imgLoader.GetImage());
@ -153,11 +153,11 @@ cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, t
image = new cImage(cSize(width, height));
image->Fill(clrBgr);
}
return image;
return image;
}
void cTimeLine::setTimeline() {
int offset = myTime->GetTimelineOffset();
int offset = myTime->GetTimelineOffset();
int xNew, yNew;
if (tvguideConfig.displayMode == eVertical) {
xNew = 0;
@ -170,11 +170,11 @@ void cTimeLine::setTimeline() {
}
void cTimeLine::drawClock() {
cString currentTime = myTime->GetCurrentTime();
int textHeight = tvguideConfig.FontTimeLineTime->Height();
int clockWidth = tvguideConfig.FontTimeLineTime->Width(*currentTime);
clock->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
clock->drawBackground();
clock->drawBorder();
clock->DrawText(cPoint((tvguideConfig.timeLineWidth-clockWidth)/2, (tvguideConfig.footerHeight-textHeight)/2), *currentTime, theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontTimeLineTime);
cString currentTime = myTime->GetCurrentTime();
int textHeight = tvguideConfig.FontTimeLineTime->Height();
int clockWidth = tvguideConfig.FontTimeLineTime->Width(*currentTime);
clock->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
clock->drawBackground();
clock->drawBorder();
clock->DrawText(cPoint((tvguideConfig.timeLineWidth-clockWidth)/2, (tvguideConfig.footerHeight-textHeight)/2), *currentTime, theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontTimeLineTime);
}

View File

@ -5,18 +5,18 @@
class cTimeLine {
private:
cMyTime *myTime;
cStyledPixmap *dateViewer;
cPixmap *timeline;
cStyledPixmap *clock;
cImage *createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend);
cMyTime *myTime;
cStyledPixmap *dateViewer;
cPixmap *timeline;
cStyledPixmap *clock;
cImage *createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend);
public:
cTimeLine(cMyTime *myTime);
virtual ~cTimeLine(void);
void drawDateViewer();
void drawTimeline();
void setTimeline();
void drawClock();
cTimeLine(cMyTime *myTime);
virtual ~cTimeLine(void);
void drawDateViewer();
void drawTimeline();
void setTimeline();
void drawClock();
};
#endif //__TVGUIDE_TIMELINE_H

124
timer.c
View File

@ -11,10 +11,10 @@ cString cMyTime::printTime(time_t displayTime) {
}
void cMyTime::Now() {
t = time(0);
tStart = t;
tStart = GetRounded();
void cMyTime::Now() {
t = time(0);
tStart = t;
tStart = GetRounded();
if (tvguideConfig.displayMode == eVertical) {
tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.footerHeight)/tvguideConfig.minutePixel*60;
} else if (tvguideConfig.displayMode == eHorizontal) {
@ -23,21 +23,21 @@ void cMyTime::Now() {
}
void cMyTime::AddStep(int step) {
tStart += step*60;
tEnd += step*60;
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;
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;
tStart = newTime;
if (tvguideConfig.displayMode == eVertical) {
tEnd = tStart + (tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.footerHeight)/tvguideConfig.minutePixel*60;
} else if (tvguideConfig.displayMode == eHorizontal) {
@ -46,77 +46,77 @@ void cMyTime::SetTime(time_t newTime) {
}
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;
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;
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;
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;
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;
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);
return WeekDayName(tStart);
}
int cMyTime::GetTimelineOffset() {
tm *st = localtime(&tStart);
int offset = st->tm_hour*60;
offset += st->tm_min;
return offset;
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);
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);
}
void cMyTime::debug() {
esyslog("t: %s, tStart: %s, tEnd: %s", *TimeString(t), *TimeString(tStart), *TimeString(tEnd));
esyslog("t: %s, tStart: %s, tEnd: %s", *TimeString(t), *TimeString(tStart), *TimeString(tEnd));
}

46
timer.h
View File

@ -4,30 +4,30 @@
// --- cMyTime -------------------------------------------------------------
class cMyTime {
private:
time_t t;
time_t tStart;
time_t tEnd;
public:
cMyTime(){};
virtual ~cMyTime(void);
private:
time_t t;
time_t tStart;
time_t tEnd;
public:
cMyTime(){};
virtual ~cMyTime(void);
static cString printTime(time_t displayTime);
void Now();
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();
void debug();
void Now();
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();
void debug();
};
#endif //__TVGUIDE_TIMER_H

View File

@ -85,22 +85,22 @@ bool cPluginTvguide::ProcessArgs(int argc, char *argv[])
int c;
cString *path = NULL;
while ((c = getopt_long(argc, argv, "i:f:l:", long_options, NULL)) != -1) {
switch (c) {
switch (c) {
case 'i':
path = new cString(optarg);
path = new cString(optarg);
tvguideConfig.SetImagesPath(*path);
imagesPathSet = true;
break;
case 'l':
path = new cString(optarg);
path = new cString(optarg);
tvguideConfig.SetLogoPath(*path);
logoPathSet = true;
break;
default:
return false;
}
if (path)
delete path;
if (path)
delete path;
}
return true;
}
@ -113,18 +113,18 @@ bool cPluginTvguide::Initialize(void)
bool cPluginTvguide::Start(void)
{
if (!logoPathSet) {
cString path = cString::sprintf("%s/channellogos/", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N));
tvguideConfig.SetLogoPath(path);
logoPathSet = true;
}
if (!imagesPathSet) {
cString path = cString::sprintf("%s/epgimages/", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N));
tvguideConfig.SetImagesPath(path);
logoPathSet = true;
}
return true;
if (!logoPathSet) {
cString path = cString::sprintf("%s/channellogos/", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N));
tvguideConfig.SetLogoPath(path);
logoPathSet = true;
}
if (!imagesPathSet) {
cString path = cString::sprintf("%s/epgimages/", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N));
tvguideConfig.SetImagesPath(path);
logoPathSet = true;
}
return true;
}
void cPluginTvguide::Stop(void)

View File

@ -56,132 +56,132 @@ cOsdManager osdManager;
#include <stdlib.h>
cTvGuideOsd::cTvGuideOsd(void) {
detailView = NULL;
detailViewActive = false;
detailView = NULL;
detailViewActive = false;
activeGrid = NULL;
timeLine = NULL;
timeLine = NULL;
}
cTvGuideOsd::~cTvGuideOsd() {
delete myTime;
columns.Clear();
delete myTime;
columns.Clear();
if (tvguideConfig.displayStatusHeader) {
delete statusHeader;
}
}
if (detailView)
delete detailView;
delete timeLine;
delete footer;
cMessageBox::Destroy();
osdManager.deleteOsd();
delete detailView;
delete timeLine;
delete footer;
cMessageBox::Destroy();
osdManager.deleteOsd();
}
void cTvGuideOsd::Show(void) {
int start = cTimeMs::Now();
bool ok = false;
ok = osdManager.setOsd();
if (ok) {
tvguideConfig.setDynamicValues(osdManager.Width(), osdManager.Height());
tvguideConfig.loadTheme();
osdManager.setBackground();
myTime = new cMyTime();
myTime->Now();
drawOsd();
}
esyslog("tvguide: Rendering took %d ms", int(cTimeMs::Now()-start));
int start = cTimeMs::Now();
bool ok = false;
ok = osdManager.setOsd();
if (ok) {
tvguideConfig.setDynamicValues(osdManager.Width(), osdManager.Height());
tvguideConfig.loadTheme();
osdManager.setBackground();
myTime = new cMyTime();
myTime->Now();
drawOsd();
}
esyslog("tvguide: Rendering took %d ms", int(cTimeMs::Now()-start));
}
void cTvGuideOsd::drawOsd() {
cPixmap::Lock();
cChannel *startChannel = Channels.GetByNumber(cDevice::CurrentChannel());
cPixmap::Lock();
cChannel *startChannel = Channels.GetByNumber(cDevice::CurrentChannel());
if (tvguideConfig.displayStatusHeader) {
statusHeader = new cStatusHeader();
statusHeader->ScaleVideo();
}
timeLine = new cTimeLine(myTime);
timeLine->drawDateViewer();
timeLine->drawTimeline();
timeLine->drawClock();
footer = new cFooter();
footer->drawRedButton();
footer->drawGreenButton();
footer->drawYellowButton();
footer->drawBlueButton();
osdManager.flush();
readChannels(startChannel);
drawGridsChannelJump();
osdManager.flush();
cPixmap::Unlock();
timeLine = new cTimeLine(myTime);
timeLine->drawDateViewer();
timeLine->drawTimeline();
timeLine->drawClock();
footer = new cFooter();
footer->drawRedButton();
footer->drawGreenButton();
footer->drawYellowButton();
footer->drawBlueButton();
osdManager.flush();
readChannels(startChannel);
drawGridsChannelJump();
osdManager.flush();
cPixmap::Unlock();
}
void cTvGuideOsd::readChannels(const cChannel *channelStart) {
int i=0;
columns.Clear();
if (!channelStart)
return;
for (const cChannel *channel = channelStart; channel; channel = Channels.Next(channel)) {
int i=0;
columns.Clear();
if (!channelStart)
return;
for (const cChannel *channel = channelStart; channel; channel = Channels.Next(channel)) {
if (!channel->GroupSep()) {
cChannelColumn *column = new cChannelColumn(i, channel, myTime);
if (column->readGrids()) {
columns.Add(column);
i++;
} else {
delete column;
}
}
if (i == tvguideConfig.numGrids)
break;
cChannelColumn *column = new cChannelColumn(i, channel, myTime);
if (column->readGrids()) {
columns.Add(column);
i++;
} else {
delete column;
}
}
if (i == tvguideConfig.numGrids)
break;
}
}
void cTvGuideOsd::drawGridsChannelJump() {
if (columns.Count() == 0)
return;
activeGrid = columns.First()->getActive();
if (activeGrid)
activeGrid->SetActive();
if (columns.Count() == 0)
return;
activeGrid = columns.First()->getActive();
if (activeGrid)
activeGrid->SetActive();
if (tvguideConfig.displayStatusHeader) {
statusHeader->DrawInfoText(activeGrid);
}
}
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->createHeader();
column->drawGrids();
}
column->createHeader();
column->drawGrids();
}
}
void cTvGuideOsd::drawGridsTimeJump() {
if (columns.Count() == 0)
return;
cChannelColumn *colActive = NULL;
if (activeGrid) {
colActive = activeGrid->column;
} else {
colActive = columns.First();
}
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->clearGrids();
column->readGrids();
column->drawGrids();
}
activeGrid = colActive->getActive();
if (activeGrid) {
activeGrid->SetActive();
activeGrid->Draw();
if (columns.Count() == 0)
return;
cChannelColumn *colActive = NULL;
if (activeGrid) {
colActive = activeGrid->column;
} else {
colActive = columns.First();
}
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->clearGrids();
column->readGrids();
column->drawGrids();
}
activeGrid = colActive->getActive();
if (activeGrid) {
activeGrid->SetActive();
activeGrid->Draw();
if (tvguideConfig.displayStatusHeader) {
statusHeader->DrawInfoText(activeGrid);
}
}
}
}
void cTvGuideOsd::setNextActiveGrid(cGrid *next) {
if (!next || !activeGrid) {
return;
}
activeGrid->SetInActive();
activeGrid->Draw();
activeGrid = next;
activeGrid->SetActive();
activeGrid->Draw();
if (!next || !activeGrid) {
return;
}
activeGrid->SetInActive();
activeGrid->Draw();
activeGrid = next;
activeGrid->SetActive();
activeGrid->Draw();
if (tvguideConfig.displayStatusHeader) {
statusHeader->DrawInfoText(activeGrid);
}
@ -189,81 +189,81 @@ void cTvGuideOsd::setNextActiveGrid(cGrid *next) {
void cTvGuideOsd::channelForward() {
cChannelColumn *colRight = columns.Next(activeGrid->column);
if (!colRight) {
const cChannel *channelRight = activeGrid->column->getChannel();
while (channelRight = Channels.Next(channelRight)) {
if (!channelRight->GroupSep()) {
colRight = new cChannelColumn(tvguideConfig.numGrids - 1, channelRight, myTime);
if (colRight->readGrids()) {
break;
} else {
delete colRight;
colRight = NULL;
}
}
}
if (colRight) {
if (columns.Count() == tvguideConfig.numGrids) {
cChannelColumn *cFirst = columns.First();
columns.Del(cFirst);
}
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->SetNum(column->GetNum() - 1);
column->drawHeader();
column->drawGrids();
}
columns.Add(colRight);
colRight->createHeader();
colRight->drawGrids();
}
}
if (colRight) {
cGrid *right = colRight->getNeighbor(activeGrid);
if (right) {
setNextActiveGrid(right);
}
}
osdManager.flush();
if (!colRight) {
const cChannel *channelRight = activeGrid->column->getChannel();
while (channelRight = Channels.Next(channelRight)) {
if (!channelRight->GroupSep()) {
colRight = new cChannelColumn(tvguideConfig.numGrids - 1, channelRight, myTime);
if (colRight->readGrids()) {
break;
} else {
delete colRight;
colRight = NULL;
}
}
}
if (colRight) {
if (columns.Count() == tvguideConfig.numGrids) {
cChannelColumn *cFirst = columns.First();
columns.Del(cFirst);
}
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->SetNum(column->GetNum() - 1);
column->drawHeader();
column->drawGrids();
}
columns.Add(colRight);
colRight->createHeader();
colRight->drawGrids();
}
}
if (colRight) {
cGrid *right = colRight->getNeighbor(activeGrid);
if (right) {
setNextActiveGrid(right);
}
}
osdManager.flush();
}
void cTvGuideOsd::channelBack() {
cChannelColumn *colLeft = columns.Prev(activeGrid->column);
if (!colLeft) {
const cChannel *channelLeft = activeGrid->column->getChannel();
while (channelLeft = Channels.Prev(channelLeft)) {
if (!channelLeft->GroupSep()) {
colLeft = new cChannelColumn(0, channelLeft, myTime);
if (colLeft->readGrids()) {
break;
} else {
delete colLeft;
colLeft = NULL;
}
}
}
if (colLeft) {
if (columns.Count() == tvguideConfig.numGrids) {
cChannelColumn *cLast = columns.Last();
columns.Del(cLast);
}
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->SetNum(column->GetNum() + 1);
column->drawHeader();
column->drawGrids();
}
columns.Ins(colLeft, columns.First());
colLeft->createHeader();
colLeft->drawGrids();
}
}
cChannelColumn *colLeft = columns.Prev(activeGrid->column);
if (!colLeft) {
const cChannel *channelLeft = activeGrid->column->getChannel();
while (channelLeft = Channels.Prev(channelLeft)) {
if (!channelLeft->GroupSep()) {
colLeft = new cChannelColumn(0, channelLeft, myTime);
if (colLeft->readGrids()) {
break;
} else {
delete colLeft;
colLeft = NULL;
}
}
}
if (colLeft) {
if (columns.Count() == tvguideConfig.numGrids) {
cChannelColumn *cLast = columns.Last();
columns.Del(cLast);
}
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->SetNum(column->GetNum() + 1);
column->drawHeader();
column->drawGrids();
}
columns.Ins(colLeft, columns.First());
colLeft->createHeader();
colLeft->drawGrids();
}
}
if (colLeft) {
cGrid *left = colLeft->getNeighbor(activeGrid);
if (left) {
setNextActiveGrid(left);
}
}
osdManager.flush();
if (colLeft) {
cGrid *left = colLeft->getNeighbor(activeGrid);
if (left) {
setNextActiveGrid(left);
}
}
osdManager.flush();
}
void cTvGuideOsd::timeForward() {
@ -283,19 +283,19 @@ void cTvGuideOsd::timeForward() {
if (!actionDone) {
ScrollForward();
}
osdManager.flush();
osdManager.flush();
}
void cTvGuideOsd::ScrollForward() {
myTime->AddStep(tvguideConfig.stepMinutes);
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->AddNewGridsAtEnd();
column->ClearOutdatedStart();
column->drawGrids();
}
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->AddNewGridsAtEnd();
column->ClearOutdatedStart();
column->drawGrids();
}
}
void cTvGuideOsd::timeBack() {
@ -316,31 +316,31 @@ void cTvGuideOsd::timeBack() {
if (!actionDone) {
ScrollBack();
}
osdManager.flush();
osdManager.flush();
}
void cTvGuideOsd::ScrollBack() {
bool tooFarInPast = myTime->DelStep(tvguideConfig.stepMinutes);
if (tooFarInPast)
return;
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->AddNewGridsAtStart();
column->ClearOutdatedEnd();
column->drawGrids();
}
bool tooFarInPast = myTime->DelStep(tvguideConfig.stepMinutes);
if (tooFarInPast)
return;
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
for (cChannelColumn *column = columns.First(); column; column = columns.Next(column)) {
column->AddNewGridsAtStart();
column->ClearOutdatedEnd();
column->drawGrids();
}
}
void cTvGuideOsd::processKeyUp() {
if (!activeGrid) {
return;
}
if (detailViewActive) {
detailView->scrollUp();
if (detailViewActive) {
detailView->scrollUp();
osdManager.flush();
} else {
} else {
if (tvguideConfig.displayMode == eVertical) {
timeBack();
} else if (tvguideConfig.displayMode == eHorizontal) {
@ -350,13 +350,13 @@ void cTvGuideOsd::processKeyUp() {
}
void cTvGuideOsd::processKeyDown() {
if (!activeGrid) {
return;
if (!activeGrid) {
return;
}
if (detailViewActive) {
detailView->scrollDown();
detailView->scrollDown();
osdManager.flush();
} else {
} else {
if (tvguideConfig.displayMode == eVertical) {
timeForward();
} else if (tvguideConfig.displayMode == eHorizontal) {
@ -366,10 +366,10 @@ void cTvGuideOsd::processKeyDown() {
}
void cTvGuideOsd::processKeyLeft() {
if (detailViewActive)
return;
if (activeGrid == NULL)
return;
if (detailViewActive)
return;
if (activeGrid == NULL)
return;
if (tvguideConfig.displayMode == eVertical) {
channelBack();
} else if (tvguideConfig.displayMode == eHorizontal) {
@ -378,10 +378,10 @@ void cTvGuideOsd::processKeyLeft() {
}
void cTvGuideOsd::processKeyRight() {
if (detailViewActive)
return;
if (activeGrid == NULL)
return;
if (detailViewActive)
return;
if (activeGrid == NULL)
return;
if (tvguideConfig.displayMode == eVertical) {
channelForward();
} else if (tvguideConfig.displayMode == eHorizontal) {
@ -390,201 +390,201 @@ void cTvGuideOsd::processKeyRight() {
}
void cTvGuideOsd::processKeyOk() {
if (detailViewActive) {
delete detailView;
detailView = NULL;
detailViewActive = false;
osdManager.flush();
} else {
if (detailViewActive) {
delete detailView;
detailView = NULL;
detailViewActive = false;
osdManager.flush();
} else {
if (!activeGrid->isDummy()) {
detailViewActive = true;
detailView = new cDetailView(activeGrid);
detailView->Start();
}
}
}
}
void cTvGuideOsd::processKeyRed() {
if ((activeGrid == NULL) || activeGrid->isDummy())
return;
if ((activeGrid == NULL) || activeGrid->isDummy())
return;
cTimer *timer = new cTimer(activeGrid->GetEvent());
cTimer *t = Timers.GetTimer(timer);
cString msg;
if (t) {
cString msg;
if (t) {
isyslog("timer %s already exists", *timer->ToDescr());
delete timer;
msg = cString::sprintf(tr("Timer not set! There is already a timer for this item."));
delete timer;
msg = cString::sprintf(tr("Timer not set! There is already a timer for this item."));
} else {
Timers.Add(timer);
Timers.SetModified();
msg = cString::sprintf("%s:\n%s (%s) %s - %s", tr("Timer set"), activeGrid->GetEvent()->Title(), timer->Channel()->Name(), *DayDateTime(timer->StartTime()), *TimeString(timer->StopTime()));
timer->SetEvent(activeGrid->GetEvent());
activeGrid->setTimer();
activeGrid->column->setTimer();
activeGrid->SetDirty();
activeGrid->Draw();
osdManager.flush();
msg = cString::sprintf("%s:\n%s (%s) %s - %s", tr("Timer set"), activeGrid->GetEvent()->Title(), timer->Channel()->Name(), *DayDateTime(timer->StartTime()), *TimeString(timer->StopTime()));
timer->SetEvent(activeGrid->GetEvent());
activeGrid->setTimer();
activeGrid->column->setTimer();
activeGrid->SetDirty();
activeGrid->Draw();
osdManager.flush();
isyslog("timer %s added (active)", *timer->ToDescr());
}
cMessageBox::Start(4000, msg);
cMessageBox::Start(4000, msg);
}
void cTvGuideOsd::processKeyGreen() {
if (activeGrid == NULL)
return;
const cChannel *currentChannel = activeGrid->column->getChannel();
if (activeGrid == NULL)
return;
const cChannel *currentChannel = activeGrid->column->getChannel();
const cChannel *prev = NULL;
int i = tvguideConfig.jumpChannels + 1;
for (const cChannel *channel = currentChannel; channel; channel = Channels.Prev(channel)) {
if (!channel->GroupSep()) {
prev = channel;
i--;
}
if (i == 0)
break;
int i = tvguideConfig.jumpChannels + 1;
for (const cChannel *channel = currentChannel; channel; channel = Channels.Prev(channel)) {
if (!channel->GroupSep()) {
prev = channel;
i--;
}
if (i == 0)
break;
}
if (prev) {
readChannels(prev);
if (columns.Count() > 0) {
drawGridsChannelJump();
}
osdManager.flush();
}
readChannels(prev);
if (columns.Count() > 0) {
drawGridsChannelJump();
}
osdManager.flush();
}
}
void cTvGuideOsd::processKeyYellow() {
if (activeGrid == NULL)
return;
const cChannel *currentChannel = activeGrid->column->getChannel();
const cChannel *next = NULL;
int i=0;
for (const cChannel *channel = currentChannel; channel; channel = Channels.Next(channel)) {
if (!channel->GroupSep()) {
next = channel;
i++;
}
if (i == (tvguideConfig.jumpChannels+1))
break;
if (activeGrid == NULL)
return;
const cChannel *currentChannel = activeGrid->column->getChannel();
const cChannel *next = NULL;
int i=0;
for (const cChannel *channel = currentChannel; channel; channel = Channels.Next(channel)) {
if (!channel->GroupSep()) {
next = channel;
i++;
}
if (i == (tvguideConfig.jumpChannels+1))
break;
}
if (next) {
readChannels(next);
if (columns.Count() > 0) {
drawGridsChannelJump();
}
osdManager.flush();
}
if (next) {
readChannels(next);
if (columns.Count() > 0) {
drawGridsChannelJump();
}
osdManager.flush();
}
}
eOSState cTvGuideOsd::processKeyBlue() {
if (activeGrid == NULL)
return osContinue;
const cChannel *currentChannel = activeGrid->column->getChannel();
if (currentChannel) {
cDevice::PrimaryDevice()->SwitchChannel(currentChannel, true);
return osEnd;
}
return osContinue;
if (activeGrid == NULL)
return osContinue;
const cChannel *currentChannel = activeGrid->column->getChannel();
if (currentChannel) {
cDevice::PrimaryDevice()->SwitchChannel(currentChannel, true);
return osEnd;
}
return osContinue;
}
void cTvGuideOsd::processKey1() {
bool tooFarInPast = myTime->DelStep(tvguideConfig.bigStepHours*60);
if (tooFarInPast)
return;
drawGridsTimeJump();
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
osdManager.flush();
bool tooFarInPast = myTime->DelStep(tvguideConfig.bigStepHours*60);
if (tooFarInPast)
return;
drawGridsTimeJump();
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
osdManager.flush();
}
void cTvGuideOsd::processKey3() {
myTime->AddStep(tvguideConfig.bigStepHours*60);
drawGridsTimeJump();
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
osdManager.flush();
myTime->AddStep(tvguideConfig.bigStepHours*60);
drawGridsTimeJump();
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
osdManager.flush();
}
void cTvGuideOsd::processKey4() {
bool tooFarInPast = myTime->DelStep(tvguideConfig.hugeStepHours*60);
if (tooFarInPast)
return;
drawGridsTimeJump();
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
osdManager.flush();
bool tooFarInPast = myTime->DelStep(tvguideConfig.hugeStepHours*60);
if (tooFarInPast)
return;
drawGridsTimeJump();
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
osdManager.flush();
}
void cTvGuideOsd::processKey6() {
myTime->AddStep(tvguideConfig.hugeStepHours*60);
drawGridsTimeJump();
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
osdManager.flush();
myTime->AddStep(tvguideConfig.hugeStepHours*60);
drawGridsTimeJump();
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
osdManager.flush();
}
void cTvGuideOsd::processKey7() {
cMyTime *primeChecker = new cMyTime();
primeChecker->Now();
time_t prevPrime = primeChecker->getPrevPrimetime(myTime->GetStart());
if (primeChecker->tooFarInPast(prevPrime))
return;
myTime->SetTime(prevPrime);
drawGridsTimeJump();
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
osdManager.flush();
cMyTime *primeChecker = new cMyTime();
primeChecker->Now();
time_t prevPrime = primeChecker->getPrevPrimetime(myTime->GetStart());
if (primeChecker->tooFarInPast(prevPrime))
return;
myTime->SetTime(prevPrime);
drawGridsTimeJump();
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
osdManager.flush();
}
void cTvGuideOsd::processKey9() {
cMyTime *primeChecker = new cMyTime();
time_t nextPrime = primeChecker->getNextPrimetime(myTime->GetStart());
myTime->SetTime(nextPrime);
drawGridsTimeJump();
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
osdManager.flush();
cMyTime *primeChecker = new cMyTime();
time_t nextPrime = primeChecker->getNextPrimetime(myTime->GetStart());
myTime->SetTime(nextPrime);
drawGridsTimeJump();
timeLine->drawDateViewer();
timeLine->drawClock();
timeLine->setTimeline();
osdManager.flush();
}
eOSState cTvGuideOsd::ProcessKey(eKeys Key) {
eOSState state = cOsdObject::ProcessKey(Key);
if (state == osUnknown) {
cPixmap::Lock();
state = osContinue;
switch (Key & ~k_Repeat) {
case kUp: processKeyUp(); break;
case kDown: processKeyDown(); break;
case kLeft: processKeyLeft(); break;
case kRight: processKeyRight(); break;
case kRed: processKeyRed(); break;
case kGreen: processKeyGreen(); break;
case kYellow: processKeyYellow(); break;
case kBlue: state = processKeyBlue(); break;
case kOk: processKeyOk(); break;
case kBack: state=osEnd; break;
case k1: processKey1(); break;
case k3: processKey3(); break;
case k4: processKey4(); break;
case k6: processKey6(); break;
case k7: processKey7(); break;
case k9: processKey9(); break;
default: break;
}
cPixmap::Unlock();
}
return state;
eOSState state = cOsdObject::ProcessKey(Key);
if (state == osUnknown) {
cPixmap::Lock();
state = osContinue;
switch (Key & ~k_Repeat) {
case kUp: processKeyUp(); break;
case kDown: processKeyDown(); break;
case kLeft: processKeyLeft(); break;
case kRight: processKeyRight(); break;
case kRed: processKeyRed(); break;
case kGreen: processKeyGreen(); break;
case kYellow: processKeyYellow(); break;
case kBlue: state = processKeyBlue(); break;
case kOk: processKeyOk(); break;
case kBack: state=osEnd; break;
case k1: processKey1(); break;
case k3: processKey3(); break;
case k4: processKey4(); break;
case k6: processKey6(); break;
case k7: processKey7(); break;
case k9: processKey9(); break;
default: break;
}
cPixmap::Unlock();
}
return state;
}
void cTvGuideOsd::dump() {
esyslog("tvguide: ------Dumping Content---------");
esyslog("tvguide: ------Dumping Content---------");
activeGrid->debug();
int i=1;
for (cChannelColumn *col = columns.First(); col; col = columns.Next(col)) {
for (cChannelColumn *col = columns.First(); col; col = columns.Next(col)) {
col->dumpGrids();
}
}