blob: afc568eec7bd26dd7d32196998ef0875d6a17b51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#include "channelepg.h"
#include "gridelement.h"
cGridElement::cGridElement(cChannelEpg *c) {
this->column = c;
text = new cTextWrapper();
dirty = true;
active = false;
viewportHeight = 0;
borderWidth = 10;
}
cGridElement::~cGridElement(void) {
delete text;
}
void cGridElement::setBackground() {
if (active) {
color = theme.Color(clrHighlight);
colorBlending = theme.Color(clrHighlightBlending);
} else {
if (isColor1) {
color = theme.Color(clrGrid1);
colorBlending = theme.Color(clrGrid1Blending);
} else {
color = theme.Color(clrGrid2);
colorBlending = theme.Color(clrGrid2Blending);
}
}
}
void cGridElement::Draw() {
if (!pixmap) {
return;
}
if (dirty) {
if (config.style == eStyleGraphical) {
drawBackgroundGraphical(bgGrid, active);
drawText();
} else {
setBackground();
drawBackground();
drawText();
drawBorder();
}
pixmap->SetLayer(1);
dirty = false;
}
}
bool cGridElement::isFirst(void) {
if (column->isFirst(this))
return true;
return false;
}
bool cGridElement::Match(time_t t) {
if ((StartTime() < t) && (EndTime() > t))
return true;
else
return false;
}
int cGridElement::calcOverlap(cGridElement *neighbor) {
int overlap = 0;
if (intersects(neighbor)) {
if ((StartTime() <= neighbor->StartTime()) && (EndTime() <= neighbor->EndTime())) {
overlap = EndTime() - neighbor->StartTime();
} else if ((StartTime() >= neighbor->StartTime()) && (EndTime() >= neighbor->EndTime())) {
overlap = neighbor->EndTime() - StartTime();
} else if ((StartTime() >= neighbor->StartTime()) && (EndTime() <= neighbor->EndTime())) {
overlap = Duration();
} else if ((StartTime() <= neighbor->StartTime()) && (EndTime() >= neighbor->EndTime())) {
overlap = neighbor->EndTime() - neighbor->StartTime();
}
}
return overlap;
}
bool cGridElement::intersects(cGridElement *neighbor) {
return ! ( (neighbor->EndTime() <= StartTime()) || (neighbor->StartTime() >= EndTime()) );
}
|