diff options
author | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2019-07-11 11:07:13 +0200 |
---|---|---|
committer | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2019-07-11 11:07:13 +0200 |
commit | 7a79059414ea2f10cba1710de0e37dcbbdfbfa42 (patch) | |
tree | 3300a2389ae07acbe21561e6f1fe78ea28674054 /channeljump.c | |
parent | ceadc0bbfe5a82ebdb961a15e2bb3669197551ad (diff) | |
download | vdr-plugin-tvguide-7a79059414ea2f10cba1710de0e37dcbbdfbfa42.tar.gz vdr-plugin-tvguide-7a79059414ea2f10cba1710de0e37dcbbdfbfa42.tar.bz2 |
Change files to unix
Diffstat (limited to 'channeljump.c')
-rw-r--r-- | channeljump.c | 190 |
1 files changed, 95 insertions, 95 deletions
diff --git a/channeljump.c b/channeljump.c index 7e641f5..425b085 100644 --- a/channeljump.c +++ b/channeljump.c @@ -1,95 +1,95 @@ -#include <vdr/channels.h>
-#include "config.h"
-#include "geometrymanager.h"
-#include "osdmanager.h"
-#include "fontmanager.h"
-#include "channelgroups.h"
-#include "channeljump.h"
-
-cChannelJump::cChannelJump(cChannelGroups *channelGroups) {
- this->channelGroups = channelGroups;
- pixmapText = NULL;
- channel = 0;
- if (!tvguideConfig.hideLastGroup) {
-#if VDRVERSNUM >= 20301
- LOCK_CHANNELS_READ;
- maxChannels = Channels->MaxNumber();
-#else
- maxChannels = Channels.MaxNumber();
-#endif
- } else {
- maxChannels = channelGroups->GetLastValidChannel();
- }
- timeout = Setup.ChannelEntryTimeout;
- startTime = cTimeMs::Now();
- SetPixmaps();
- Draw();
-}
-
-cChannelJump::~cChannelJump(void) {
- osdManager.releasePixmap(pixmapBack);
- osdManager.releasePixmap(pixmapText);
-}
-
-void cChannelJump::SetPixmaps(void) {
- int x = (geoManager.osdWidth - geoManager.channelJumpWidth)/2;
- int y = (geoManager.osdHeight - geoManager.channelJumpHeight)/2;
-
- pixmapBack = osdManager.requestPixmap(4, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight));
- pixmap = osdManager.requestPixmap(5, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight));
- pixmapText = osdManager.requestPixmap(6, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight));
-}
-
-void cChannelJump::Draw(void) {
- if (tvguideConfig.style == eStyleGraphical) {
- drawBackgroundGraphical(bgChannelJump);
- } else {
- pixmap->Fill(theme.Color(clrBackground));
- drawBorder();
- }
- pixmapBack->Fill(clrTransparent);
- pixmapBack->DrawRectangle(cRect(5, Height()/2, Width()-10, Height()-3), theme.Color(clrBackground));
-}
-
-void cChannelJump::DrawText(void) {
- pixmapText->Fill(clrTransparent);
-
- cString header = cString::sprintf("%s:", tr("Channel"));
-
- const cFont *font = fontManager.FontMessageBox;
- const cFont *fontHeader = fontManager.FontMessageBoxLarge;
-
- int xHeader = (Width() - fontHeader->Width(*header)) / 2;
- int yHeader = (Height()/2 - fontHeader->Height()) / 2;
- pixmapText->DrawText(cPoint(xHeader, yHeader), *header, theme.Color(clrFont), clrTransparent, fontHeader);
-
- cString strChannel = BuildChannelString();
- int xChannel = (Width() - font->Width(*strChannel)) / 2;
- int yChannel = Height()/2 + (Height()/2 - font->Height()) / 2;
- pixmapText->DrawText(cPoint(xChannel, yChannel), *strChannel, theme.Color(clrFont), clrTransparent, font);
-
-}
-
-void cChannelJump::Set(int num) {
- startTime = cTimeMs::Now();
- if (channel == 0) {
- channel = num;
- return;
- }
- int newChannel = channel * 10 + num;
- if (newChannel <= maxChannels)
- channel = newChannel;
-}
-
-cString cChannelJump::BuildChannelString(void) {
- if (channel*10 <= maxChannels)
- return cString::sprintf("%d-", channel);
- else
- return cString::sprintf("%d", channel);
-}
-
- bool cChannelJump::TimeOut(void) {
- if ((cTimeMs::Now() - startTime) > timeout)
- return true;
- return false;
- }
\ No newline at end of file +#include <vdr/channels.h> +#include "config.h" +#include "geometrymanager.h" +#include "osdmanager.h" +#include "fontmanager.h" +#include "channelgroups.h" +#include "channeljump.h" + +cChannelJump::cChannelJump(cChannelGroups *channelGroups) { + this->channelGroups = channelGroups; + pixmapText = NULL; + channel = 0; + if (!tvguideConfig.hideLastGroup) { +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; + maxChannels = Channels->MaxNumber(); +#else + maxChannels = Channels.MaxNumber(); +#endif + } else { + maxChannels = channelGroups->GetLastValidChannel(); + } + timeout = Setup.ChannelEntryTimeout; + startTime = cTimeMs::Now(); + SetPixmaps(); + Draw(); +} + +cChannelJump::~cChannelJump(void) { + osdManager.releasePixmap(pixmapBack); + osdManager.releasePixmap(pixmapText); +} + +void cChannelJump::SetPixmaps(void) { + int x = (geoManager.osdWidth - geoManager.channelJumpWidth)/2; + int y = (geoManager.osdHeight - geoManager.channelJumpHeight)/2; + + pixmapBack = osdManager.requestPixmap(4, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight)); + pixmap = osdManager.requestPixmap(5, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight)); + pixmapText = osdManager.requestPixmap(6, cRect(x, y, geoManager.channelJumpWidth, geoManager.channelJumpHeight)); +} + +void cChannelJump::Draw(void) { + if (tvguideConfig.style == eStyleGraphical) { + drawBackgroundGraphical(bgChannelJump); + } else { + pixmap->Fill(theme.Color(clrBackground)); + drawBorder(); + } + pixmapBack->Fill(clrTransparent); + pixmapBack->DrawRectangle(cRect(5, Height()/2, Width()-10, Height()-3), theme.Color(clrBackground)); +} + +void cChannelJump::DrawText(void) { + pixmapText->Fill(clrTransparent); + + cString header = cString::sprintf("%s:", tr("Channel")); + + const cFont *font = fontManager.FontMessageBox; + const cFont *fontHeader = fontManager.FontMessageBoxLarge; + + int xHeader = (Width() - fontHeader->Width(*header)) / 2; + int yHeader = (Height()/2 - fontHeader->Height()) / 2; + pixmapText->DrawText(cPoint(xHeader, yHeader), *header, theme.Color(clrFont), clrTransparent, fontHeader); + + cString strChannel = BuildChannelString(); + int xChannel = (Width() - font->Width(*strChannel)) / 2; + int yChannel = Height()/2 + (Height()/2 - font->Height()) / 2; + pixmapText->DrawText(cPoint(xChannel, yChannel), *strChannel, theme.Color(clrFont), clrTransparent, font); + +} + +void cChannelJump::Set(int num) { + startTime = cTimeMs::Now(); + if (channel == 0) { + channel = num; + return; + } + int newChannel = channel * 10 + num; + if (newChannel <= maxChannels) + channel = newChannel; +} + +cString cChannelJump::BuildChannelString(void) { + if (channel*10 <= maxChannels) + return cString::sprintf("%d-", channel); + else + return cString::sprintf("%d", channel); +} + + bool cChannelJump::TimeOut(void) { + if ((cTimeMs::Now() - startTime) > timeout) + return true; + return false; + } |