summaryrefslogtreecommitdiff
path: root/geometrymanager.c
blob: a92f823ddc1af3993a5bd23bfb4cd86012ded996 (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
#include <vdr/osd.h>

#include "config.h"
#include "geometrymanager.h"

cGeometryManager::cGeometryManager() {
    osdWidth = 0;
    osdHeight = 0;
}

cGeometryManager::~cGeometryManager() {
}

bool cGeometryManager::SetGeometry(int osdWidth, int osdHeight, bool force) {
	if (!force && (this->osdWidth == osdWidth) && (this->osdHeight == osdHeight)) {
		esyslog("tvgudie: GeoManager SetGeometry nothing to change");
		return false;
	}
	this->osdWidth = osdWidth;
	this->osdHeight = osdHeight;
	esyslog("tvguide: Set OSD to %d x %d px", osdWidth, osdHeight);

	statusHeaderHeight = (config.displayStatusHeader) ? (config.headerHeightPercent * osdHeight / 100):0;
    tvFrameWidth = statusHeaderHeight * 16 / 9;
    headerContentWidth = (config.scaleVideo) ? (osdWidth -  tvFrameWidth):osdWidth;
    channelGroupsWidth = (config.displayChannelGroups) ? (config.channelGroupsPercent * osdWidth / 100):0;
    channelGroupsHeight = (config.displayChannelGroups) ? (config.channelGroupsPercent * osdHeight / 100):0;
    channelHeaderWidth = config.channelHeaderWidthPercent * osdWidth / 100;
    channelHeaderHeight = config.channelHeaderHeightPercent * osdHeight / 100;
    timeLineWidth = config.timeLineWidthPercent * osdWidth / 100;
    timeLineHeight = config.timeLineHeightPercent * osdHeight / 100;
    footerHeight = config.footerHeightPercent * osdHeight / 100;
    footerY = osdHeight - footerHeight;

    if (config.displayMode == eVertical) {
        colWidth = (osdWidth - timeLineWidth) / config.channelCols;
        rowHeight = 0;
        minutePixel = (double)(osdHeight - statusHeaderHeight - channelGroupsHeight - channelHeaderHeight - footerHeight) / (double)config.displayTime;
        channelLogoWidth = colWidth;
        channelLogoHeight = channelHeaderHeight;
        logoWidth = channelLogoWidth / 2 - 15;
        logoHeight = logoWidth * config.logoHeightRatio / config.logoWidthRatio;
        timeLineGridWidth = timeLineWidth;
        timeLineGridHeight = minutePixel * 30;
        dateVieverWidth = timeLineWidth;
        dateVieverHeight = (channelHeaderHeight + channelGroupsHeight) * 2 / 3;
        clockWidth = dateVieverWidth;
        clockHeight = (channelHeaderHeight + channelGroupsHeight) - dateVieverHeight;
    } else if (config.displayMode == eHorizontal) {
        colWidth = 0;
        rowHeight = (osdHeight - statusHeaderHeight - timeLineHeight - footerHeight) / config.channelRows;
        minutePixel = (double)(osdWidth - channelHeaderWidth - channelGroupsWidth) / (double)config.displayHorizontalTime;
        channelLogoWidth = channelHeaderWidth;
        channelLogoHeight = rowHeight;
        logoWidth = channelLogoHeight * config.logoWidthRatio / config.logoHeightRatio;
        logoHeight = channelLogoHeight;
        timeLineGridWidth = geoManager.minutePixel * 30;
        timeLineGridHeight = geoManager.timeLineHeight;
        dateVieverWidth = (channelHeaderWidth + channelGroupsWidth) * 3 / 5;
        dateVieverHeight = timeLineHeight;
        clockWidth = (channelHeaderWidth + channelGroupsWidth) - dateVieverWidth;
        clockHeight = timeLineHeight;
    }
    buttonBorder = footerHeight / 6;
    buttonWidth = osdWidth / 4 - 2 * buttonBorder;
    buttonHeight = footerHeight - 3 * buttonBorder;

    epgViewHeaderHeight = config.headerHeightPercent * osdHeight / 100;

    borderRecMenus = 10;

    channelJumpWidth = osdWidth * 30 / 100;
    channelJumpHeight = osdHeight * 20 / 100;

    return true;
}