vdr-plugin-tvguide/geometrymanager.c

77 lines
3.4 KiB
C
Raw Normal View History

2019-07-11 11:07:13 +02:00
#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);
2019-07-11 11:28:11 +02:00
statusHeaderHeight = (config.displayStatusHeader) ? (config.headerHeightPercent * osdHeight / 100):0;
2019-07-11 11:07:13 +02:00
tvFrameWidth = statusHeaderHeight * 16 / 9;
2019-07-11 11:28:11 +02:00
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;
2019-07-11 11:07:13 +02:00
footerY = osdHeight - footerHeight;
2019-07-11 11:28:11 +02:00
if (config.displayMode == eVertical) {
colWidth = (osdWidth - timeLineWidth) / config.channelCols;
2019-07-11 11:07:13 +02:00
rowHeight = 0;
2020-01-06 14:09:56 +01:00
minutePixel = (double)(osdHeight - statusHeaderHeight - channelGroupsHeight - channelHeaderHeight - footerHeight) / (double)config.displayTime;
2019-07-11 11:07:13 +02:00
channelLogoWidth = colWidth;
channelLogoHeight = channelHeaderHeight;
2019-07-11 11:28:11 +02:00
logoWidth = channelLogoWidth / 2 - 15;
logoHeight = logoWidth * config.logoHeightRatio / config.logoWidthRatio;
2019-07-11 11:07:13 +02:00
timeLineGridWidth = timeLineWidth;
timeLineGridHeight = minutePixel * 30;
dateVieverWidth = timeLineWidth;
dateVieverHeight = (channelHeaderHeight + channelGroupsHeight) * 2 / 3;
clockWidth = dateVieverWidth;
clockHeight = (channelHeaderHeight + channelGroupsHeight) - dateVieverHeight;
2019-07-11 11:28:11 +02:00
} else if (config.displayMode == eHorizontal) {
2019-07-11 11:07:13 +02:00
colWidth = 0;
2019-07-11 11:28:11 +02:00
rowHeight = (osdHeight - statusHeaderHeight - timeLineHeight - footerHeight) / config.channelRows;
2020-01-06 14:09:56 +01:00
minutePixel = (double)(osdWidth - channelHeaderWidth - channelGroupsWidth) / (double)config.displayHorizontalTime;
2019-07-11 11:07:13 +02:00
channelLogoWidth = channelHeaderWidth;
channelLogoHeight = rowHeight;
2019-07-11 11:28:11 +02:00
logoWidth = channelLogoHeight * config.logoWidthRatio / config.logoHeightRatio;
2019-07-11 11:07:13 +02:00
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;
2019-07-11 11:28:11 +02:00
epgViewHeaderHeight = config.headerHeightPercent * osdHeight / 100;
2019-07-11 11:07:13 +02:00
borderRecMenus = 10;
channelJumpWidth = osdWidth * 30 / 100;
channelJumpHeight = osdHeight * 20 / 100;
return true;
}