mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 13:01:48 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fc784f34e5 | ||
|
b707292485 | ||
|
587fbe1f44 | ||
|
9173d14b10 |
6
HISTORY
6
HISTORY
@@ -216,3 +216,9 @@ Version 1.2.11
|
||||
- Fixed a segfault with graphicsmagick > 1.3.31
|
||||
- Fixed a possible deadlock in detailview
|
||||
- Optical changes in cMenuSetupImageCache
|
||||
|
||||
Version 1.2.12
|
||||
|
||||
- Fixed updating current time
|
||||
- Fixed updating current TimeBase
|
||||
- Diplay the current TimeBase throughout the whole timeline
|
||||
|
65
timeline.c
65
timeline.c
@@ -3,6 +3,7 @@
|
||||
|
||||
cTimeLine::cTimeLine(cTimeManager *timeManager) {
|
||||
this->timeManager = timeManager;
|
||||
lastClock = "";
|
||||
if (config.displayMode == eVertical) {
|
||||
dateViewer = new cStyledPixmap(osdManager.requestPixmap(1, cRect(0,
|
||||
geoManager.statusHeaderHeight + geoManager.clockHeight,
|
||||
@@ -15,11 +16,7 @@ cTimeLine::cTimeLine(cTimeManager *timeManager) {
|
||||
, cRect(0,
|
||||
0,
|
||||
geoManager.timeLineWidth,
|
||||
1440*geoManager.minutePixel));
|
||||
timeBase = osdManager.requestPixmap(3, cRect(0,
|
||||
geoManager.statusHeaderHeight + geoManager.channelGroupsHeight + geoManager.channelHeaderHeight,
|
||||
geoManager.osdWidth,
|
||||
geoManager.timeLineGridHeight));
|
||||
1440 * geoManager.minutePixel));
|
||||
} else if (config.displayMode == eHorizontal) {
|
||||
dateViewer = new cStyledPixmap(osdManager.requestPixmap(1, cRect(geoManager.clockWidth,
|
||||
geoManager.statusHeaderHeight,
|
||||
@@ -31,14 +28,9 @@ cTimeLine::cTimeLine(cTimeManager *timeManager) {
|
||||
geoManager.timeLineHeight)
|
||||
, cRect(0,
|
||||
0,
|
||||
1440*geoManager.minutePixel,
|
||||
1440 * geoManager.minutePixel,
|
||||
geoManager.timeLineHeight));
|
||||
timeBase = osdManager.requestPixmap(3, cRect(geoManager.channelGroupsWidth + geoManager.channelHeaderWidth,
|
||||
geoManager.statusHeaderHeight,
|
||||
geoManager.timeLineGridWidth,
|
||||
geoManager.timeLineHeight + config.channelRows * geoManager.rowHeight));
|
||||
}
|
||||
timeBase->Fill(clrTransparent);
|
||||
int clockY;
|
||||
int clockX;
|
||||
if (config.displayMode == eVertical) {
|
||||
@@ -206,19 +198,29 @@ void cTimeLine::drawRoundedCorners(int posX, int posY, int width, int height, in
|
||||
}
|
||||
|
||||
void cTimeLine::drawCurrentTimeBase(void) {
|
||||
timeBase->Fill(clrTransparent);
|
||||
bool nowVisible = timeManager->NowVisible();
|
||||
if (timeBase)
|
||||
osdManager.releasePixmap(timeBase);
|
||||
if (!nowVisible)
|
||||
return;
|
||||
int deltaTime = (timeManager->GetNow() - timeManager->GetStart()) / 60 * geoManager.minutePixel;
|
||||
int x1, x2, y1, y2;
|
||||
if (config.displayMode == eVertical) {
|
||||
timeBase->DrawRectangle(cRect(0, deltaTime - 2, timeBase->ViewPort().Width(), 4), theme.Color(clrTimeBase));
|
||||
x1 = 0;
|
||||
y1 = geoManager.statusHeaderHeight + geoManager.channelGroupsHeight + geoManager.channelHeaderHeight + deltaTime - 2;
|
||||
x2 = geoManager.osdWidth;
|
||||
y2 = 4;
|
||||
} else {
|
||||
timeBase->DrawRectangle(cRect(deltaTime-2, 0, 4, timeBase->ViewPort().Height()), theme.Color(clrTimeBase));
|
||||
x1 = geoManager.channelGroupsWidth + geoManager.channelHeaderWidth + deltaTime - 2;
|
||||
y1 = geoManager.statusHeaderHeight;
|
||||
x2 = 4;
|
||||
y2 = geoManager.timeLineHeight + config.channelRows * geoManager.rowHeight;
|
||||
}
|
||||
timeBase = osdManager.requestPixmap(3, cRect(x1, y1, x2, y2));
|
||||
timeBase->Fill(clrTransparent);
|
||||
timeBase->DrawRectangle(cRect(0, 0, timeBase->ViewPort().Width(), timeBase->ViewPort().Height()), theme.Color(clrTimeBase));
|
||||
}
|
||||
|
||||
|
||||
cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend) {
|
||||
cImage *image = NULL;
|
||||
if (config.style == eStyleBlendingDefault) {
|
||||
@@ -263,20 +265,25 @@ void cTimeLine::setTimeline() {
|
||||
drawCurrentTimeBase();
|
||||
}
|
||||
|
||||
void cTimeLine::drawClock() {
|
||||
if (config.displayMode == eVertical)
|
||||
clock->Fill(clrTransparent);
|
||||
bool cTimeLine::drawClock() {
|
||||
cString currentTime = timeManager->GetCurrentTime();
|
||||
const cFont *font = (config.displayMode == eVertical)?fontManager.FontTimeLineTime:fontManager.FontTimeLineTimeHorizontal;
|
||||
int textHeight = font->Height();
|
||||
int clockTextWidth = font->Width(*currentTime);
|
||||
tColor colorFontBack = (config.style == eStyleFlat)?theme.Color(clrHeader):clrTransparent;
|
||||
if (config.style == eStyleGraphical) {
|
||||
clock->drawBackgroundGraphical(bgClock);
|
||||
} else {
|
||||
clock->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
|
||||
clock->drawBackground();
|
||||
clock->drawBorder();
|
||||
if (strcmp(currentTime, lastClock)) {
|
||||
if (config.displayMode == eVertical)
|
||||
clock->Fill(clrTransparent);
|
||||
const cFont *font = (config.displayMode == eVertical) ? fontManager.FontTimeLineTime : fontManager.FontTimeLineTimeHorizontal;
|
||||
int textHeight = font->Height();
|
||||
int clockTextWidth = font->Width(*currentTime);
|
||||
tColor colorFontBack = (config.style == eStyleFlat) ? theme.Color(clrHeader) : clrTransparent;
|
||||
if (config.style == eStyleGraphical) {
|
||||
clock->drawBackgroundGraphical(bgClock);
|
||||
} else {
|
||||
clock->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
|
||||
clock->drawBackground();
|
||||
clock->drawBorder();
|
||||
}
|
||||
clock->DrawText(cPoint((geoManager.clockWidth - clockTextWidth) / 2, (geoManager.clockHeight - textHeight) / 2), *currentTime, theme.Color(clrFont), colorFontBack, font);
|
||||
lastClock = currentTime;
|
||||
return true;
|
||||
}
|
||||
clock->DrawText(cPoint((geoManager.clockWidth-clockTextWidth)/2, (geoManager.clockHeight-textHeight)/2), *currentTime, theme.Color(clrFont), colorFontBack, font);
|
||||
return false;
|
||||
}
|
||||
|
11
timeline.h
11
timeline.h
@@ -13,17 +13,18 @@ private:
|
||||
cPixmap *timeline;
|
||||
cStyledPixmap *clock;
|
||||
cPixmap *timeBase;
|
||||
cString lastClock;
|
||||
void decorateTile(int posX, int posY, int tileWidth, int tileHeight);
|
||||
void drawRoundedCorners(int posX, int posY, int width, int height, int radius);
|
||||
cImage *createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend);
|
||||
void drawCurrentTimeBase(void);
|
||||
public:
|
||||
cTimeLine(cTimeManager *timeManager);
|
||||
virtual ~cTimeLine(void);
|
||||
void setTimeline();
|
||||
void drawDateViewer();
|
||||
void drawTimeline();
|
||||
void drawClock();
|
||||
void setTimeline(void);
|
||||
void drawDateViewer(void);
|
||||
void drawTimeline(void);
|
||||
void drawCurrentTimeBase(void);
|
||||
bool drawClock();
|
||||
};
|
||||
|
||||
#endif //__TVGUIDE_TIMELINE_H
|
||||
|
@@ -9,7 +9,7 @@ cTimeManager::~cTimeManager(void) {
|
||||
cString cTimeManager::printTime(time_t displayTime) {
|
||||
struct tm *ts;
|
||||
ts = localtime(&displayTime);
|
||||
cString strTime = cString::sprintf("%d.%d-%d:%d.%d", ts->tm_mday, ts->tm_mon+1, ts->tm_hour, ts->tm_min, ts->tm_sec);
|
||||
cString strTime = cString::sprintf("%d.%d-%d:%d.%d", ts->tm_mday, ts->tm_mon + 1, ts->tm_hour, ts->tm_min, ts->tm_sec);
|
||||
return strTime;
|
||||
}
|
||||
|
||||
@@ -19,43 +19,43 @@ void cTimeManager::Now() {
|
||||
tStart = t;
|
||||
tStart = GetRounded();
|
||||
if (config.displayMode == eVertical) {
|
||||
tEnd = tStart + (geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight)/geoManager.minutePixel*60;
|
||||
tEnd = tStart + (geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight) / geoManager.minutePixel * 60;
|
||||
} else if (config.displayMode == eHorizontal) {
|
||||
tEnd = tStart + (geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth)/geoManager.minutePixel*60;
|
||||
tEnd = tStart + (geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth) / geoManager.minutePixel * 60;
|
||||
}
|
||||
}
|
||||
|
||||
void cTimeManager::AddStep(int step) {
|
||||
tStart += step*60;
|
||||
tEnd += step*60;
|
||||
tStart += step * 60;
|
||||
tEnd += step * 60;
|
||||
}
|
||||
|
||||
bool cTimeManager::DelStep(int step) {
|
||||
if ((tStart - step*60)+30*60 < t) {
|
||||
if ((tStart - step * 60) + 30 * 60 < t) {
|
||||
return true;
|
||||
}
|
||||
tStart -= step*60;
|
||||
tEnd -= step*60;
|
||||
tStart -= step * 60;
|
||||
tEnd -= step * 60;
|
||||
return false;
|
||||
}
|
||||
|
||||
void cTimeManager::SetTime(time_t newTime) {
|
||||
tStart = newTime;
|
||||
if (config.displayMode == eVertical) {
|
||||
tEnd = tStart + (geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight)/geoManager.minutePixel*60;
|
||||
tEnd = tStart + (geoManager.osdHeight - geoManager.statusHeaderHeight - geoManager.channelHeaderHeight - geoManager.channelGroupsHeight - geoManager.footerHeight) / geoManager.minutePixel * 60;
|
||||
} else if (config.displayMode == eHorizontal) {
|
||||
tEnd = tStart + (geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth)/geoManager.minutePixel*60;
|
||||
tEnd = tStart + (geoManager.osdWidth - geoManager.channelHeaderWidth - geoManager.channelGroupsWidth) / geoManager.minutePixel * 60;
|
||||
}
|
||||
}
|
||||
|
||||
time_t cTimeManager::getPrevPrimetime(time_t current) {
|
||||
tm *st = localtime(¤t);
|
||||
if (st->tm_hour < 21) {
|
||||
current -= 24 * 60* 60;
|
||||
current -= 24 * 60 * 60;
|
||||
st = localtime(¤t);
|
||||
}
|
||||
st->tm_hour = 20;
|
||||
st->tm_min = 0;
|
||||
st->tm_min = 0;
|
||||
time_t primeTime = mktime(st);
|
||||
return primeTime;
|
||||
}
|
||||
@@ -63,11 +63,11 @@ time_t cTimeManager::getPrevPrimetime(time_t current) {
|
||||
time_t cTimeManager::getNextPrimetime(time_t current){
|
||||
tm *st = localtime(¤t);
|
||||
if (st->tm_hour > 19) {
|
||||
current += 24 * 60* 60;
|
||||
current += 24 * 60 * 60;
|
||||
st = localtime(¤t);
|
||||
}
|
||||
st->tm_hour = 20;
|
||||
st->tm_min = 0;
|
||||
st->tm_min = 0;
|
||||
time_t primeTime = mktime(st);
|
||||
return primeTime;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ cString cTimeManager::GetWeekday() {
|
||||
|
||||
int cTimeManager::GetTimelineOffset() {
|
||||
tm *st = localtime(&tStart);
|
||||
int offset = st->tm_hour*60;
|
||||
int offset = st->tm_hour * 60;
|
||||
offset += st->tm_min;
|
||||
return offset;
|
||||
}
|
||||
@@ -126,7 +126,6 @@ bool cTimeManager::NowVisible(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void cTimeManager::debug() {
|
||||
esyslog("t: %s, tStart: %s, tEnd: %s", *TimeString(t), *TimeString(tStart), *TimeString(tEnd));
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#error "VDR-2.0.0 API version or greater is required!"
|
||||
#endif
|
||||
|
||||
static const char *VERSION = "1.2.11";
|
||||
static const char *VERSION = "1.2.12";
|
||||
static const char *DESCRIPTION = tr("A fancy 2d EPG Viewer");
|
||||
static const char *MAINMENUENTRY = "Tvguide";
|
||||
|
||||
|
10
tvguideosd.c
10
tvguideosd.c
@@ -352,7 +352,7 @@ void cTvGuideOsd::channelBack() {
|
||||
|
||||
void cTvGuideOsd::timeForward() {
|
||||
bool actionDone = false;
|
||||
if ( (timeManager->GetEnd() - activeGrid->EndTime())/60 < 30 ) {
|
||||
if ((timeManager->GetEnd() - activeGrid->EndTime())/60 < 30 ) {
|
||||
ScrollForward();
|
||||
actionDone = true;
|
||||
}
|
||||
@@ -373,7 +373,6 @@ void cTvGuideOsd::timeForward() {
|
||||
void cTvGuideOsd::ScrollForward() {
|
||||
timeManager->AddStep(config.stepMinutes);
|
||||
timeLine->drawDateViewer();
|
||||
timeLine->drawClock();
|
||||
timeLine->setTimeline();
|
||||
for (cChannelEpg *column = columns.First(); column; column = columns.Next(column)) {
|
||||
column->AddNewGridsAtEnd();
|
||||
@@ -384,7 +383,7 @@ void cTvGuideOsd::ScrollForward() {
|
||||
|
||||
void cTvGuideOsd::timeBack() {
|
||||
bool actionDone = false;
|
||||
if ( (activeGrid->StartTime() - timeManager->GetStart())/60 < 30 ) {
|
||||
if ((activeGrid->StartTime() - timeManager->GetStart())/60 < 30 ) {
|
||||
ScrollBack();
|
||||
actionDone = true;
|
||||
}
|
||||
@@ -408,7 +407,6 @@ void cTvGuideOsd::ScrollBack() {
|
||||
if (tooFarInPast)
|
||||
return;
|
||||
timeLine->drawDateViewer();
|
||||
timeLine->drawClock();
|
||||
timeLine->setTimeline();
|
||||
for (cChannelEpg *column = columns.First(); column; column = columns.Next(column)) {
|
||||
column->AddNewGridsAtStart();
|
||||
@@ -776,6 +774,10 @@ eOSState cTvGuideOsd::ProcessKey(eKeys Key) {
|
||||
case kNone: if (channelJumper) CheckTimeout(); break;
|
||||
default: break;
|
||||
}
|
||||
if (timeLine->drawClock()) {
|
||||
timeLine->drawCurrentTimeBase();
|
||||
osdManager.flush();
|
||||
}
|
||||
}
|
||||
if (!alreadyUnlocked) {
|
||||
cPixmap::Unlock();
|
||||
|
Reference in New Issue
Block a user