Fixed horizontal alignment in timeline

This commit is contained in:
kamel5 2020-03-05 14:46:52 +01:00
parent 7ec89bf12b
commit eb3a4113be
3 changed files with 12 additions and 20 deletions

View File

@ -2430,7 +2430,7 @@ void cRecMenuItemTimelineHeader::DrawTimeline(void) {
pixmapTimeline->Fill(clrTransparent);
width5Mins = (float)width * 5.0 / 24.0 / 60.0;
int widthHour = 12 * width5Mins;
x0 = (width - 24*widthHour)/2;
x0 = (width - (24 * widthHour)) / 2;
int barHeight = fontSmall->Height();
int y = height - barHeight;
tColor col1 = theme.Color(clrTimeline1);
@ -2535,7 +2535,8 @@ void cRecMenuItemTimelineTimer::SetPixmaps(void) {
}
width5Mins = (float)width * 5.0 / 24.0 / 60.0;
x0 = (width - 24*12*width5Mins)/2;
int widthHour = 12 * width5Mins;
x0 = (width - (24 * widthHour)) / 2;
}
void cRecMenuItemTimelineTimer::Draw(void) {

View File

@ -573,7 +573,7 @@ private:
cPixmap *pixmapTimeline;
cPixmap *pixmapTimerInfo;
cPixmap *pixmapTimerConflicts;
int width5Mins;
float width5Mins;
int x0;
int numTimersToday;
bool timelineDrawn;
@ -603,7 +603,7 @@ private:
cPixmap *pixmapTimerConflicts;
cRecMenuItemTimelineHeader *header;
int x0;
int width5Mins;
float width5Mins;
time_t start;
time_t stop;
void DrawBackground(void);

View File

@ -1413,7 +1413,7 @@ cRecMenuTimeline::cRecMenuTimeline(cTVGuideTimerConflicts *timerConflicts) {
SetStartStop();
conflictsToday = timerConflicts->GetConflictsBetween(timeStart, timeStop);
GetTimersForDay();
SetWidthPercent(95);
SetWidthPercent(90);
header = new cRecMenuItemTimelineHeader(timeStart, numTimersToday, conflictsToday);
SetHeader(header);
cRecMenuItem *footer = new cRecMenuItemButton(tr("Close"), rmsClose, false, true);
@ -1457,10 +1457,14 @@ void cRecMenuTimeline::GetTimersForDay(void) {
void cRecMenuTimeline::SetTimers(void) {
ClearMenu();
GetTimersForDay();
conflictsToday = timerConflicts->GetConflictsBetween(timeStart, timeStop);
header->UnsetCurrentTimer();
header->SetDay(timeStart);
header->RefreshTimerDisplay();
header->SetNumTimersToday(numTimersToday);
if (numTimersToday == 0) {
AddMenuItem(new cRecMenuItemTimelineTimer(NULL, 0, 0, conflictsToday, header, false));
header->UnsetCurrentTimer();
header->SetNumTimersToday(0);
footer->setActive();
} else {
for (int i = 0; i<numTimersToday; i++) {
@ -1469,7 +1473,6 @@ void cRecMenuTimeline::SetTimers(void) {
item->setActive();
if (!AddMenuItemInitial(item))
break;
header->SetNumTimersToday(numTimersToday);
}
footer->setInactive();
}
@ -1483,12 +1486,6 @@ void cRecMenuTimeline::PrevDay(void) {
return;
timeStart -= 3600*24;
timeStop -= 3600*24;
conflictsToday = timerConflicts->GetConflictsBetween(timeStart, timeStop);
SetWidthPercent(95);
header->SetDay(timeStart);
header->UnsetCurrentTimer();
header->RefreshTimerDisplay();
GetTimersForDay();
SetTimers();
Display();
}
@ -1496,12 +1493,6 @@ void cRecMenuTimeline::PrevDay(void) {
void cRecMenuTimeline::NextDay(void) {
timeStart += 3600*24;
timeStop += 3600*24;
conflictsToday = timerConflicts->GetConflictsBetween(timeStart, timeStop);
SetWidthPercent(95);
header->SetDay(timeStart);
header->UnsetCurrentTimer();
header->RefreshTimerDisplay();
GetTimersForDay();
SetTimers();
Display();
}