diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | config.c | 438 | ||||
-rw-r--r-- | config.h | 224 | ||||
-rw-r--r-- | displaychannel.c | 884 | ||||
-rw-r--r-- | displaychannel.h | 132 | ||||
-rw-r--r-- | displaymenu.c | 882 | ||||
-rw-r--r-- | displaymenu.h | 90 | ||||
-rw-r--r-- | displaymenuview.c | 998 | ||||
-rw-r--r-- | displaymenuview.h | 190 | ||||
-rw-r--r-- | displaymessage.c | 116 | ||||
-rw-r--r-- | displaymessage.h | 16 | ||||
-rw-r--r-- | displayreplay.c | 528 | ||||
-rw-r--r-- | displayreplay.h | 98 | ||||
-rw-r--r-- | displaytracks.c | 296 | ||||
-rw-r--r-- | displaytracks.h | 58 | ||||
-rw-r--r-- | displayvolume.c | 232 | ||||
-rw-r--r-- | displayvolume.h | 32 | ||||
-rw-r--r-- | epgsearchconf.c | 560 | ||||
-rw-r--r-- | epgsearchconf.h | 40 | ||||
-rw-r--r-- | helpers.c | 66 | ||||
-rw-r--r-- | imageloader.c | 222 | ||||
-rw-r--r-- | imageloader.h | 26 | ||||
-rw-r--r-- | menudetailview.c | 428 | ||||
-rw-r--r-- | menudetailview.h | 94 | ||||
-rw-r--r-- | menuitem.c | 1090 | ||||
-rw-r--r-- | menuitem.h | 228 | ||||
-rw-r--r-- | nopacity.c | 176 | ||||
-rw-r--r-- | nopacity.h | 1 | ||||
-rw-r--r-- | setup.c | 458 | ||||
-rw-r--r-- | setup.h | 86 | ||||
-rw-r--r-- | skinnopacity.c | 22 |
31 files changed, 4356 insertions, 4357 deletions
@@ -110,7 +110,7 @@ dist: $(I18Npo) clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE) @cp -a * $(TMPDIR)/$(ARCHIVE) - @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) + @tar czf $(PACKAGE).tgz --exclude .git* --exclude *.o --exclude *.rej --exclude *.orig -C $(TMPDIR) $(ARCHIVE) @-rm -rf $(TMPDIR)/$(ARCHIVE) @echo Distribution package created as $(PACKAGE).tgz @@ -1,245 +1,245 @@ #include "config.h" cNopacityConfig::cNopacityConfig() { - epgSearchConf = NULL; - logoPathSet = false; - epgImagePathSet = false; - iconPathSet = false; - //Common - mainMenuEntry = false; - fontIndex = 0; - fontDefaultName = "VDRSymbols Sans:Book"; - //DisplayChannel - channelHeight = 25; - channelBorderVertical = 15; - channelBorderBottom = 15; - channelFadeTime = 300; // ms - logoWidth = 260; - logoHeight = 200; - logoExtension = "png"; - logoBorder = 15; - displaySignalStrength = 1; - fontChannelHeaderSize = 0; - fontChannelDateSize = 0; - fontEPGSize = 0; - fontEPGSmallSize = 0; - resolutionIconSize = 100; - //Display Replay - replayHeight = 25; - replayBorderVertical = 15; - replayBorderBottom = 15; - replayFadeTime = 300; // ms - fontReplayHeader = 0; - fontReplay = 0; - //DisplayMessage - messageWidth = 90; - messageHeight = 10; - messageBorderBottom = 10; - fontMessage = 0; - messageFadeTime = 300; - //DisplayTracks - tracksFadeTime = 300; - tracksWidth = 25; - tracksHeight = 25; - tracksPosition = 0; - tracksBorderHorizontal = 10; - tracksBorderVertical = 10; - fontTracksHeader = 0; - fontTracks = 0; - //DisplayVolume - volumeFadeTime = 300; - volumeWidth = 40; - volumeHeight = 10; - volumeBorderBottom = 10; - fontVolume = 0; - //DisplayMenu - scalePicture = 1; - displayRerunsDetailEPGView = 1; - numReruns = 5; - useSubtitleRerun = 1; - menuFadeTime = 300; - menuWidthNarrow = 30; - menuScrollDelay = 1000; - menuScrollSpeed = 2; - menuWidthRightItems = 12; - headerHeight = 7; - footerHeight = 7; - numDefaultMenuItems = 16; - iconHeight = 100; - headerIconHeight = 80; - menuHeaderLogoWidth = 104; - menuHeaderLogoHeight = 78; - menuItemLogoWidth = 130; - menuItemLogoHeight = 100; - detailViewLogoWidth = 260; - detailViewLogoHeight = 200; - epgImageWidth = 210; - epgImageHeight = 160; - fontHeader = 0; - fontDate = 0; - fontMenuitemLarge = 0; - fontMenuitemSchedule = 0; - fontMenuitemScheduleSmall = 0; - fontMenuitemDefault = 0; - fontDiskUsage = 0; - fontTimersHead = 0; - fontTimers = 0; - fontButtons = 0; - fontMessageMenu = 0; - fontDetailView = 0; - fontDetailViewHeader = 0; - fontDetailViewHeaderLarge = 0; + epgSearchConf = NULL; + logoPathSet = false; + epgImagePathSet = false; + iconPathSet = false; + //Common + mainMenuEntry = false; + fontIndex = 0; + fontDefaultName = "VDRSymbols Sans:Book"; + //DisplayChannel + channelHeight = 25; + channelBorderVertical = 15; + channelBorderBottom = 15; + channelFadeTime = 300; // ms + logoWidth = 260; + logoHeight = 200; + logoExtension = "png"; + logoBorder = 15; + displaySignalStrength = 1; + fontChannelHeaderSize = 0; + fontChannelDateSize = 0; + fontEPGSize = 0; + fontEPGSmallSize = 0; + resolutionIconSize = 100; + //Display Replay + replayHeight = 25; + replayBorderVertical = 15; + replayBorderBottom = 15; + replayFadeTime = 300; // ms + fontReplayHeader = 0; + fontReplay = 0; + //DisplayMessage + messageWidth = 90; + messageHeight = 10; + messageBorderBottom = 10; + fontMessage = 0; + messageFadeTime = 300; + //DisplayTracks + tracksFadeTime = 300; + tracksWidth = 25; + tracksHeight = 25; + tracksPosition = 0; + tracksBorderHorizontal = 10; + tracksBorderVertical = 10; + fontTracksHeader = 0; + fontTracks = 0; + //DisplayVolume + volumeFadeTime = 300; + volumeWidth = 40; + volumeHeight = 10; + volumeBorderBottom = 10; + fontVolume = 0; + //DisplayMenu + scalePicture = 1; + displayRerunsDetailEPGView = 1; + numReruns = 5; + useSubtitleRerun = 1; + menuFadeTime = 300; + menuWidthNarrow = 30; + menuScrollDelay = 1000; + menuScrollSpeed = 2; + menuWidthRightItems = 12; + headerHeight = 7; + footerHeight = 7; + numDefaultMenuItems = 16; + iconHeight = 100; + headerIconHeight = 80; + menuHeaderLogoWidth = 104; + menuHeaderLogoHeight = 78; + menuItemLogoWidth = 130; + menuItemLogoHeight = 100; + detailViewLogoWidth = 260; + detailViewLogoHeight = 200; + epgImageWidth = 210; + epgImageHeight = 160; + fontHeader = 0; + fontDate = 0; + fontMenuitemLarge = 0; + fontMenuitemSchedule = 0; + fontMenuitemScheduleSmall = 0; + fontMenuitemDefault = 0; + fontDiskUsage = 0; + fontTimersHead = 0; + fontTimers = 0; + fontButtons = 0; + fontMessageMenu = 0; + fontDetailView = 0; + fontDetailViewHeader = 0; + fontDetailViewHeaderLarge = 0; } cNopacityConfig::~cNopacityConfig() { } void cNopacityConfig::setDynamicValues() { - if (fontIndex == 0) { - fontName = strdup(fontDefaultName); - } else { - cStringList availableFonts; - cFont::GetAvailableFontNames(&availableFonts); - if (availableFonts[fontIndex-1]) { - fontName = strdup(availableFonts[fontIndex-1]); - } else - fontName = strdup(fontDefaultName); - } - channelFrameTime = channelFadeTime / 10; - replayFrameTime = replayFadeTime / 10; - messageFrameTime = messageFadeTime / 10; - tracksFrameTime = tracksFadeTime / 10; - volumeFrameTime = volumeFadeTime / 10; - menuFrameTime = menuFadeTime / 10; - - menuScrollFrameTime = 0; - if (menuScrollSpeed == 1) - menuScrollFrameTime = 50; - else if (menuScrollSpeed == 2) - menuScrollFrameTime = 30; - else if (menuScrollSpeed == 3) - menuScrollFrameTime = 15; + if (fontIndex == 0) { + fontName = strdup(fontDefaultName); + } else { + cStringList availableFonts; + cFont::GetAvailableFontNames(&availableFonts); + if (availableFonts[fontIndex-1]) { + fontName = strdup(availableFonts[fontIndex-1]); + } else + fontName = strdup(fontDefaultName); + } + channelFrameTime = channelFadeTime / 10; + replayFrameTime = replayFadeTime / 10; + messageFrameTime = messageFadeTime / 10; + tracksFrameTime = tracksFadeTime / 10; + volumeFrameTime = volumeFadeTime / 10; + menuFrameTime = menuFadeTime / 10; + + menuScrollFrameTime = 0; + if (menuScrollSpeed == 1) + menuScrollFrameTime = 50; + else if (menuScrollSpeed == 2) + menuScrollFrameTime = 30; + else if (menuScrollSpeed == 3) + menuScrollFrameTime = 15; - logoPathDefault = cString::sprintf("%s/logos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N)); - iconPathDefault = cString::sprintf("%s/icons/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N)); - epgImagePathDefault = cString::sprintf("%s/epgimages/", cPlugin::CacheDirectory(PLUGIN_NAME_I18N)); - - dsyslog("nopacity: using Logo Directory %s", (logoPathSet)?(*logoPath):(*logoPathDefault)); - dsyslog("nopacity: using Icon Directory %s", (iconPathSet)?(*iconPath):(*iconPathDefault)); - dsyslog("nopacity: using EPG Images Directory %s", (epgImagePathSet)?(*epgImagePath):(*epgImagePathDefault)); + logoPathDefault = cString::sprintf("%s/logos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N)); + iconPathDefault = cString::sprintf("%s/icons/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N)); + epgImagePathDefault = cString::sprintf("%s/epgimages/", cPlugin::CacheDirectory(PLUGIN_NAME_I18N)); + + dsyslog("nopacity: using Logo Directory %s", (logoPathSet)?(*logoPath):(*logoPathDefault)); + dsyslog("nopacity: using Icon Directory %s", (iconPathSet)?(*iconPath):(*iconPathDefault)); + dsyslog("nopacity: using EPG Images Directory %s", (epgImagePathSet)?(*epgImagePath):(*epgImagePathDefault)); } void cNopacityConfig::loadEPGSearchSettings(void) { - epgSearchConf = new cNopacityEPGSearchConfig(); - if (epgSearchConf->CheckEPGSearchAvailable()) { - dsyslog("nopacity: epgsearch plugin available"); - epgSearchConf->LoadEpgSearchConf(); - if (epgSearchConf->ReplaceScheduleActive()) { - if (!epgSearchConf->LoadEpgSearchMenuConf()) { - epgSearchConf->SetDefaultEPGSearchConf(); - } - } else { - dsyslog("nopacity: epgsearch plugin available, but not used for replacing schedules menu"); - dsyslog("nopacity: please enable \"replacing schedules menu\" in epgsearch settings"); - epgSearchConf->SetDefaultVDRConf(); - } - } else { - dsyslog("nopacity: no epgsearch plugin available"); - epgSearchConf->SetDefaultVDRConf(); - } - epgSearchConf->SetTimerConfilictCont(); + epgSearchConf = new cNopacityEPGSearchConfig(); + if (epgSearchConf->CheckEPGSearchAvailable()) { + dsyslog("nopacity: epgsearch plugin available"); + epgSearchConf->LoadEpgSearchConf(); + if (epgSearchConf->ReplaceScheduleActive()) { + if (!epgSearchConf->LoadEpgSearchMenuConf()) { + epgSearchConf->SetDefaultEPGSearchConf(); + } + } else { + dsyslog("nopacity: epgsearch plugin available, but not used for replacing schedules menu"); + dsyslog("nopacity: please enable \"replacing schedules menu\" in epgsearch settings"); + epgSearchConf->SetDefaultVDRConf(); + } + } else { + dsyslog("nopacity: no epgsearch plugin available"); + epgSearchConf->SetDefaultVDRConf(); + } + epgSearchConf->SetTimerConfilictCont(); } void cNopacityConfig::SetLogoPath(cString path) { - logoPath = path; - logoPathSet = true; + logoPath = path; + logoPathSet = true; } void cNopacityConfig::SetIconPath(cString path) { - iconPath = path; - iconPathSet = true; + iconPath = path; + iconPathSet = true; } void cNopacityConfig::SetEpgImagePath(cString path) { - epgImagePath = path; - epgImagePathSet = true; + epgImagePath = path; + epgImagePathSet = true; } bool cNopacityConfig::SetupParse(const char *Name, const char *Value) { - if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value); - else if (strcmp(Name, "channelFadeTime") == 0) channelFadeTime = atoi(Value); - else if (strcmp(Name, "channelHeight") == 0) channelHeight = atoi(Value); - else if (strcmp(Name, "channelBorderVertical") == 0) channelBorderVertical = atoi(Value); - else if (strcmp(Name, "channelBorderBottom") == 0) channelBorderBottom = atoi(Value); - else if (strcmp(Name, "logoWidth") == 0) logoWidth = atoi(Value); - else if (strcmp(Name, "logoHeight") == 0) logoHeight = atoi(Value); - else if (strcmp(Name, "logoBorder") == 0) logoBorder = atoi(Value); - else if (strcmp(Name, "displaySignalStrength") == 0) displaySignalStrength = atoi(Value); - else if (strcmp(Name, "fontChannelHeaderSize") == 0) fontChannelHeaderSize = atoi(Value); - else if (strcmp(Name, "fontChannelDateSize") == 0) fontChannelDateSize = atoi(Value); - else if (strcmp(Name, "fontEPGSize") == 0) fontEPGSize = atoi(Value); - else if (strcmp(Name, "fontEPGSmallSize") == 0) fontEPGSmallSize = atoi(Value); - else if (strcmp(Name, "resolutionIconSize") == 0) resolutionIconSize = atoi(Value); - else if (strcmp(Name, "replayHeight") == 0) replayHeight = atoi(Value); - else if (strcmp(Name, "replayBorderVertical") == 0) replayBorderVertical = atoi(Value); - else if (strcmp(Name, "replayBorderBottom") == 0) replayBorderBottom = atoi(Value); - else if (strcmp(Name, "replayFadeTime") == 0) replayFadeTime = atoi(Value); - else if (strcmp(Name, "fontReplayHeader") == 0) fontReplayHeader = atoi(Value); - else if (strcmp(Name, "fontReplay") == 0) fontReplay = atoi(Value); - else if (strcmp(Name, "messageWidth") == 0) messageWidth = atoi(Value); - else if (strcmp(Name, "messageHeight") == 0) messageHeight = atoi(Value); - else if (strcmp(Name, "messageBorderBottom") == 0) messageBorderBottom = atoi(Value); - else if (strcmp(Name, "fontMessage") == 0) fontMessage = atoi(Value); - else if (strcmp(Name, "messageFadeTime") == 0) messageFadeTime = atoi(Value); - else if (strcmp(Name, "tracksFadeTime") == 0) tracksFadeTime = atoi(Value); - else if (strcmp(Name, "tracksWidth") == 0) tracksWidth = atoi(Value); - else if (strcmp(Name, "tracksHeight") == 0) tracksHeight = atoi(Value); - else if (strcmp(Name, "tracksPosition") == 0) tracksPosition = atoi(Value); - else if (strcmp(Name, "tracksBorderHorizontal") == 0) tracksBorderHorizontal = atoi(Value); - else if (strcmp(Name, "tracksBorderVertical") == 0) tracksBorderVertical = atoi(Value); - else if (strcmp(Name, "fontTracksHeader") == 0) fontTracksHeader = atoi(Value); - else if (strcmp(Name, "fontTracks") == 0) fontTracks = atoi(Value); - else if (strcmp(Name, "volumeFadeTime") == 0) volumeFadeTime = atoi(Value); - else if (strcmp(Name, "volumeWidth") == 0) volumeWidth = atoi(Value); - else if (strcmp(Name, "volumeHeight") == 0) volumeHeight = atoi(Value); - else if (strcmp(Name, "volumeBorderBottom") == 0) volumeBorderBottom = atoi(Value); - else if (strcmp(Name, "fontVolume") == 0) fontVolume = atoi(Value); - else if (strcmp(Name, "menuFadeTime") == 0) menuFadeTime = atoi(Value); - else if (strcmp(Name, "menuScrollDelay") == 0) menuScrollDelay = atoi(Value); - else if (strcmp(Name, "menuScrollSpeed") == 0) menuScrollSpeed = atoi(Value); - else if (strcmp(Name, "scalePicture") == 0) scalePicture = atoi(Value); - else if (strcmp(Name, "displayRerunsDetailEPGView") == 0) displayRerunsDetailEPGView = atoi(Value); - else if (strcmp(Name, "numReruns") == 0) numReruns = atoi(Value); - else if (strcmp(Name, "useSubtitleRerun") == 0) useSubtitleRerun = atoi(Value); - else if (strcmp(Name, "menuWidthNarrow") == 0) menuWidthNarrow = atoi(Value); - else if (strcmp(Name, "menuWidthRightItems") == 0) menuWidthRightItems = atoi(Value); - else if (strcmp(Name, "headerHeight") == 0) headerHeight = atoi(Value); - else if (strcmp(Name, "footerHeight") == 0) footerHeight = atoi(Value); - else if (strcmp(Name, "numDefaultMenuItems") == 0) numDefaultMenuItems = atoi(Value); - else if (strcmp(Name, "iconHeight") == 0) iconHeight = atoi(Value); - else if (strcmp(Name, "headerIconHeight") == 0) headerIconHeight = atoi(Value); - else if (strcmp(Name, "menuItemLogoWidth") == 0) menuItemLogoWidth = atoi(Value); - else if (strcmp(Name, "menuItemLogoHeight") == 0) menuItemLogoHeight = atoi(Value); - else if (strcmp(Name, "menuHeaderLogoWidth") == 0) menuHeaderLogoWidth = atoi(Value); - else if (strcmp(Name, "menuHeaderLogoHeight") == 0) menuHeaderLogoHeight = atoi(Value); - else if (strcmp(Name, "detailViewLogoWidth") == 0) detailViewLogoWidth = atoi(Value); - else if (strcmp(Name, "detailViewLogoHeight") == 0) detailViewLogoHeight = atoi(Value); - else if (strcmp(Name, "epgImageWidth") == 0) epgImageWidth = atoi(Value); - else if (strcmp(Name, "epgImageHeight") == 0) epgImageHeight = atoi(Value); - else if (strcmp(Name, "fontHeader") == 0) fontHeader = atoi(Value); - else if (strcmp(Name, "fontDate") == 0) fontDate = atoi(Value); - else if (strcmp(Name, "fontMenuitemLarge") == 0) fontMenuitemLarge = atoi(Value); - else if (strcmp(Name, "fontMenuitemSchedule") == 0) fontMenuitemSchedule = atoi(Value); - else if (strcmp(Name, "fontMenuitemScheduleSmall") == 0) fontMenuitemScheduleSmall = atoi(Value); - else if (strcmp(Name, "fontMenuitemDefault") == 0) fontMenuitemDefault = atoi(Value); - else if (strcmp(Name, "fontDiskUsage") == 0) fontDiskUsage = atoi(Value); - else if (strcmp(Name, "fontTimersHead") == 0) fontTimersHead = atoi(Value); - else if (strcmp(Name, "fontTimers") == 0) fontTimers = atoi(Value); - else if (strcmp(Name, "fontButtons") == 0) fontButtons = atoi(Value); - else if (strcmp(Name, "fontMessageMenu") == 0) fontMessageMenu = atoi(Value); - else if (strcmp(Name, "fontDetailView") == 0) fontDetailView = atoi(Value); - else if (strcmp(Name, "fontDetailViewHeader") == 0) fontDetailViewHeader = atoi(Value); - else if (strcmp(Name, "fontDetailViewHeaderLarge") == 0) fontDetailViewHeaderLarge = atoi(Value); - else return false; - return true; + if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value); + else if (strcmp(Name, "channelFadeTime") == 0) channelFadeTime = atoi(Value); + else if (strcmp(Name, "channelHeight") == 0) channelHeight = atoi(Value); + else if (strcmp(Name, "channelBorderVertical") == 0) channelBorderVertical = atoi(Value); + else if (strcmp(Name, "channelBorderBottom") == 0) channelBorderBottom = atoi(Value); + else if (strcmp(Name, "logoWidth") == 0) logoWidth = atoi(Value); + else if (strcmp(Name, "logoHeight") == 0) logoHeight = atoi(Value); + else if (strcmp(Name, "logoBorder") == 0) logoBorder = atoi(Value); + else if (strcmp(Name, "displaySignalStrength") == 0) displaySignalStrength = atoi(Value); + else if (strcmp(Name, "fontChannelHeaderSize") == 0) fontChannelHeaderSize = atoi(Value); + else if (strcmp(Name, "fontChannelDateSize") == 0) fontChannelDateSize = atoi(Value); + else if (strcmp(Name, "fontEPGSize") == 0) fontEPGSize = atoi(Value); + else if (strcmp(Name, "fontEPGSmallSize") == 0) fontEPGSmallSize = atoi(Value); + else if (strcmp(Name, "resolutionIconSize") == 0) resolutionIconSize = atoi(Value); + else if (strcmp(Name, "replayHeight") == 0) replayHeight = atoi(Value); + else if (strcmp(Name, "replayBorderVertical") == 0) replayBorderVertical = atoi(Value); + else if (strcmp(Name, "replayBorderBottom") == 0) replayBorderBottom = atoi(Value); + else if (strcmp(Name, "replayFadeTime") == 0) replayFadeTime = atoi(Value); + else if (strcmp(Name, "fontReplayHeader") == 0) fontReplayHeader = atoi(Value); + else if (strcmp(Name, "fontReplay") == 0) fontReplay = atoi(Value); + else if (strcmp(Name, "messageWidth") == 0) messageWidth = atoi(Value); + else if (strcmp(Name, "messageHeight") == 0) messageHeight = atoi(Value); + else if (strcmp(Name, "messageBorderBottom") == 0) messageBorderBottom = atoi(Value); + else if (strcmp(Name, "fontMessage") == 0) fontMessage = atoi(Value); + else if (strcmp(Name, "messageFadeTime") == 0) messageFadeTime = atoi(Value); + else if (strcmp(Name, "tracksFadeTime") == 0) tracksFadeTime = atoi(Value); + else if (strcmp(Name, "tracksWidth") == 0) tracksWidth = atoi(Value); + else if (strcmp(Name, "tracksHeight") == 0) tracksHeight = atoi(Value); + else if (strcmp(Name, "tracksPosition") == 0) tracksPosition = atoi(Value); + else if (strcmp(Name, "tracksBorderHorizontal") == 0) tracksBorderHorizontal = atoi(Value); + else if (strcmp(Name, "tracksBorderVertical") == 0) tracksBorderVertical = atoi(Value); + else if (strcmp(Name, "fontTracksHeader") == 0) fontTracksHeader = atoi(Value); + else if (strcmp(Name, "fontTracks") == 0) fontTracks = atoi(Value); + else if (strcmp(Name, "volumeFadeTime") == 0) volumeFadeTime = atoi(Value); + else if (strcmp(Name, "volumeWidth") == 0) volumeWidth = atoi(Value); + else if (strcmp(Name, "volumeHeight") == 0) volumeHeight = atoi(Value); + else if (strcmp(Name, "volumeBorderBottom") == 0) volumeBorderBottom = atoi(Value); + else if (strcmp(Name, "fontVolume") == 0) fontVolume = atoi(Value); + else if (strcmp(Name, "menuFadeTime") == 0) menuFadeTime = atoi(Value); + else if (strcmp(Name, "menuScrollDelay") == 0) menuScrollDelay = atoi(Value); + else if (strcmp(Name, "menuScrollSpeed") == 0) menuScrollSpeed = atoi(Value); + else if (strcmp(Name, "scalePicture") == 0) scalePicture = atoi(Value); + else if (strcmp(Name, "displayRerunsDetailEPGView") == 0) displayRerunsDetailEPGView = atoi(Value); + else if (strcmp(Name, "numReruns") == 0) numReruns = atoi(Value); + else if (strcmp(Name, "useSubtitleRerun") == 0) useSubtitleRerun = atoi(Value); + else if (strcmp(Name, "menuWidthNarrow") == 0) menuWidthNarrow = atoi(Value); + else if (strcmp(Name, "menuWidthRightItems") == 0) menuWidthRightItems = atoi(Value); + else if (strcmp(Name, "headerHeight") == 0) headerHeight = atoi(Value); + else if (strcmp(Name, "footerHeight") == 0) footerHeight = atoi(Value); + else if (strcmp(Name, "numDefaultMenuItems") == 0) numDefaultMenuItems = atoi(Value); + else if (strcmp(Name, "iconHeight") == 0) iconHeight = atoi(Value); + else if (strcmp(Name, "headerIconHeight") == 0) headerIconHeight = atoi(Value); + else if (strcmp(Name, "menuItemLogoWidth") == 0) menuItemLogoWidth = atoi(Value); + else if (strcmp(Name, "menuItemLogoHeight") == 0) menuItemLogoHeight = atoi(Value); + else if (strcmp(Name, "menuHeaderLogoWidth") == 0) menuHeaderLogoWidth = atoi(Value); + else if (strcmp(Name, "menuHeaderLogoHeight") == 0) menuHeaderLogoHeight = atoi(Value); + else if (strcmp(Name, "detailViewLogoWidth") == 0) detailViewLogoWidth = atoi(Value); + else if (strcmp(Name, "detailViewLogoHeight") == 0) detailViewLogoHeight = atoi(Value); + else if (strcmp(Name, "epgImageWidth") == 0) epgImageWidth = atoi(Value); + else if (strcmp(Name, "epgImageHeight") == 0) epgImageHeight = atoi(Value); + else if (strcmp(Name, "fontHeader") == 0) fontHeader = atoi(Value); + else if (strcmp(Name, "fontDate") == 0) fontDate = atoi(Value); + else if (strcmp(Name, "fontMenuitemLarge") == 0) fontMenuitemLarge = atoi(Value); + else if (strcmp(Name, "fontMenuitemSchedule") == 0) fontMenuitemSchedule = atoi(Value); + else if (strcmp(Name, "fontMenuitemScheduleSmall") == 0) fontMenuitemScheduleSmall = atoi(Value); + else if (strcmp(Name, "fontMenuitemDefault") == 0) fontMenuitemDefault = atoi(Value); + else if (strcmp(Name, "fontDiskUsage") == 0) fontDiskUsage = atoi(Value); + else if (strcmp(Name, "fontTimersHead") == 0) fontTimersHead = atoi(Value); + else if (strcmp(Name, "fontTimers") == 0) fontTimers = atoi(Value); + else if (strcmp(Name, "fontButtons") == 0) fontButtons = atoi(Value); + else if (strcmp(Name, "fontMessageMenu") == 0) fontMessageMenu = atoi(Value); + else if (strcmp(Name, "fontDetailView") == 0) fontDetailView = atoi(Value); + else if (strcmp(Name, "fontDetailViewHeader") == 0) fontDetailViewHeader = atoi(Value); + else if (strcmp(Name, "fontDetailViewHeaderLarge") == 0) fontDetailViewHeaderLarge = atoi(Value); + else return false; + return true; }
\ No newline at end of file @@ -2,118 +2,118 @@ #define __NOPACITY_CONFIG_H
class cNopacityConfig {
- private:
- public:
- cNopacityConfig();
- ~cNopacityConfig();
- bool SetupParse(const char *Name, const char *Value);
- void SetLogoPath(cString path);
- void SetIconPath(cString path);
- void SetEpgImagePath(cString path);
- bool logoPathSet;
- bool epgImagePathSet;
- bool iconPathSet;
- cString logoPathDefault;
- cString iconPathDefault;
- cString epgImagePathDefault;
- void setDynamicValues();
- void loadEPGSearchSettings(void);
- //Common
- int fontIndex;
- const char *fontDefaultName;
- char *fontName;
- cString logoPath;
- cString logoExtension;
- cString iconPath;
- cString epgImagePath;
- bool mainMenuEntry;
- //DisplayChannel
- int channelHeight;
- int channelBorderVertical;
- int channelBorderBottom;
- int channelFadeTime;
- int channelFrameTime;
- int logoWidth;
- int logoHeight;
- int logoBorder;
- int displaySignalStrength;
- int fontChannelHeaderSize;
- int fontChannelDateSize;
- int fontEPGSize;
- int fontEPGSmallSize;
- int resolutionIconSize;
- //DisplayReplay
- int replayHeight;
- int replayBorderVertical;
- int replayBorderBottom;
- int replayFadeTime;
- int replayFrameTime;
- int fontReplayHeader;
- int fontReplay;
- //Display Message
- int messageWidth;
- int messageHeight;
- int messageBorderBottom;
- int fontMessage;
- int messageFadeTime;
- int messageFrameTime;
- //DisplayTracks
- int tracksFadeTime;
- int tracksFrameTime;
- int tracksWidth;
- int tracksHeight;
- int tracksPosition;
- int tracksBorderHorizontal;
- int tracksBorderVertical;
- int fontTracksHeader;
- int fontTracks;
- //DisplayVolume
- int volumeFadeTime;
- int volumeFrameTime;
- int volumeWidth;
- int volumeHeight;
- int volumeBorderBottom;
- int fontVolume;
- //DisplayMenu
- cNopacityEPGSearchConfig *epgSearchConf;
- int scalePicture;
- int displayRerunsDetailEPGView;
- int numReruns;
- int useSubtitleRerun;
- int menuFadeTime;
- int menuFrameTime;
- int menuScrollDelay;
- int menuScrollSpeed;
- int menuScrollFrameTime;
- int menuWidthNarrow;
- int menuWidthRightItems;
- int headerHeight;
- int footerHeight;
- int numDefaultMenuItems;
- int iconHeight;
- int headerIconHeight;
- int menuItemLogoWidth;
- int menuItemLogoHeight;
- int menuHeaderLogoWidth;
- int menuHeaderLogoHeight;
- int detailViewLogoWidth;
- int detailViewLogoHeight;
- int epgImageWidth;
- int epgImageHeight;
- int fontHeader;
- int fontDate;
- int fontMenuitemLarge;
- int fontMenuitemSchedule;
- int fontMenuitemScheduleSmall;
- int fontMenuitemDefault;
- int fontDiskUsage;
- int fontTimersHead;
- int fontTimers;
- int fontButtons;
- int fontMessageMenu;
- int fontDetailView;
- int fontDetailViewHeader;
- int fontDetailViewHeaderLarge;
+ private:
+ public:
+ cNopacityConfig();
+ ~cNopacityConfig();
+ bool SetupParse(const char *Name, const char *Value);
+ void SetLogoPath(cString path);
+ void SetIconPath(cString path);
+ void SetEpgImagePath(cString path);
+ bool logoPathSet;
+ bool epgImagePathSet;
+ bool iconPathSet;
+ cString logoPathDefault;
+ cString iconPathDefault;
+ cString epgImagePathDefault;
+ void setDynamicValues();
+ void loadEPGSearchSettings(void);
+ //Common
+ int fontIndex;
+ const char *fontDefaultName;
+ char *fontName;
+ cString logoPath;
+ cString logoExtension;
+ cString iconPath;
+ cString epgImagePath;
+ bool mainMenuEntry;
+ //DisplayChannel
+ int channelHeight;
+ int channelBorderVertical;
+ int channelBorderBottom;
+ int channelFadeTime;
+ int channelFrameTime;
+ int logoWidth;
+ int logoHeight;
+ int logoBorder;
+ int displaySignalStrength;
+ int fontChannelHeaderSize;
+ int fontChannelDateSize;
+ int fontEPGSize;
+ int fontEPGSmallSize;
+ int resolutionIconSize;
+ //DisplayReplay
+ int replayHeight;
+ int replayBorderVertical;
+ int replayBorderBottom;
+ int replayFadeTime;
+ int replayFrameTime;
+ int fontReplayHeader;
+ int fontReplay;
+ //Display Message
+ int messageWidth;
+ int messageHeight;
+ int messageBorderBottom;
+ int fontMessage;
+ int messageFadeTime;
+ int messageFrameTime;
+ //DisplayTracks
+ int tracksFadeTime;
+ int tracksFrameTime;
+ int tracksWidth;
+ int tracksHeight;
+ int tracksPosition;
+ int tracksBorderHorizontal;
+ int tracksBorderVertical;
+ int fontTracksHeader;
+ int fontTracks;
+ //DisplayVolume
+ int volumeFadeTime;
+ int volumeFrameTime;
+ int volumeWidth;
+ int volumeHeight;
+ int volumeBorderBottom;
+ int fontVolume;
+ //DisplayMenu
+ cNopacityEPGSearchConfig *epgSearchConf;
+ int scalePicture;
+ int displayRerunsDetailEPGView;
+ int numReruns;
+ int useSubtitleRerun;
+ int menuFadeTime;
+ int menuFrameTime;
+ int menuScrollDelay;
+ int menuScrollSpeed;
+ int menuScrollFrameTime;
+ int menuWidthNarrow;
+ int menuWidthRightItems;
+ int headerHeight;
+ int footerHeight;
+ int numDefaultMenuItems;
+ int iconHeight;
+ int headerIconHeight;
+ int menuItemLogoWidth;
+ int menuItemLogoHeight;
+ int menuHeaderLogoWidth;
+ int menuHeaderLogoHeight;
+ int detailViewLogoWidth;
+ int detailViewLogoHeight;
+ int epgImageWidth;
+ int epgImageHeight;
+ int fontHeader;
+ int fontDate;
+ int fontMenuitemLarge;
+ int fontMenuitemSchedule;
+ int fontMenuitemScheduleSmall;
+ int fontMenuitemDefault;
+ int fontDiskUsage;
+ int fontTimersHead;
+ int fontTimers;
+ int fontButtons;
+ int fontMessageMenu;
+ int fontDetailView;
+ int fontDetailViewHeader;
+ int fontDetailViewHeaderLarge;
};
#endif //__NOPACITY_CONFIG_H
\ No newline at end of file diff --git a/displaychannel.c b/displaychannel.c index 563e50b..08bbcea 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -8,59 +8,59 @@ #include "displaychannel.h" cNopacityDisplayChannel::cNopacityDisplayChannel(bool WithInfo) { - config.setDynamicValues(); - withInfo = WithInfo; - groupSep = false; - present = NULL; - lastSeen = -1; - lastSignalDisplay = 0; - lastSignalStrength = 0; - lastSignalQuality = 0; - lastScreenWidth = 0; - currentLast = 0; - channelChange = false; - initial = true; - FrameTime = config.channelFrameTime; - FadeTime = config.channelFadeTime; - lastDate = ""; - SetGeometry(); - CreatePixmaps(); - CreateFonts(); - DrawBackground(); - DrawSignalMeter(); + config.setDynamicValues(); + withInfo = WithInfo; + groupSep = false; + present = NULL; + lastSeen = -1; + lastSignalDisplay = 0; + lastSignalStrength = 0; + lastSignalQuality = 0; + lastScreenWidth = 0; + currentLast = 0; + channelChange = false; + initial = true; + FrameTime = config.channelFrameTime; + FadeTime = config.channelFadeTime; + lastDate = ""; + SetGeometry(); + CreatePixmaps(); + CreateFonts(); + DrawBackground(); + DrawSignalMeter(); } cNopacityDisplayChannel::~cNopacityDisplayChannel() { - Cancel(-1); - while (Active()) - cCondWait::SleepMs(10); - osd->DestroyPixmap(pixmapBackgroundTop); - osd->DestroyPixmap(pixmapBackgroundBottom); - osd->DestroyPixmap(pixmapLogo); - osd->DestroyPixmap(pixmapChannelInfo); - osd->DestroyPixmap(pixmapDate); - if (withInfo) { - osd->DestroyPixmap(pixmapBackgroundMiddle); - osd->DestroyPixmap(pixmapProgressBar); - osd->DestroyPixmap(pixmapEPGInfo); - } - if (pixmapScreenResolution) - osd->DestroyPixmap(pixmapScreenResolution); - osd->DestroyPixmap(pixmapStreamInfo); - if (config.displaySignalStrength && showSignal) { - osd->DestroyPixmap(pixmapSignalStrength); - osd->DestroyPixmap(pixmapSignalQuality); - osd->DestroyPixmap(pixmapSignalMeter); - osd->DestroyPixmap(pixmapSignalLabel); - } - if (config.displaySignalStrength && showSignal) { - delete fontInfoline; - } - delete fontHeader; - delete fontDate; - delete fontEPG; - delete fontEPGSmall; - delete osd; + Cancel(-1); + while (Active()) + cCondWait::SleepMs(10); + osd->DestroyPixmap(pixmapBackgroundTop); + osd->DestroyPixmap(pixmapBackgroundBottom); + osd->DestroyPixmap(pixmapLogo); + osd->DestroyPixmap(pixmapChannelInfo); + osd->DestroyPixmap(pixmapDate); + if (withInfo) { + osd->DestroyPixmap(pixmapBackgroundMiddle); + osd->DestroyPixmap(pixmapProgressBar); + osd->DestroyPixmap(pixmapEPGInfo); + } + if (pixmapScreenResolution) + osd->DestroyPixmap(pixmapScreenResolution); + osd->DestroyPixmap(pixmapStreamInfo); + if (config.displaySignalStrength && showSignal) { + osd->DestroyPixmap(pixmapSignalStrength); + osd->DestroyPixmap(pixmapSignalQuality); + osd->DestroyPixmap(pixmapSignalMeter); + osd->DestroyPixmap(pixmapSignalLabel); + } + if (config.displaySignalStrength && showSignal) { + delete fontInfoline; + } + delete fontHeader; + delete fontDate; + delete fontEPG; + delete fontEPGSmall; + delete osd; } cBitmap cNopacityDisplayChannel::bmTeletext(teletext_xpm); @@ -71,462 +71,462 @@ cBitmap cNopacityDisplayChannel::bmEncrypted(encrypted_xpm); cBitmap cNopacityDisplayChannel::bmRecording(recording_xpm); void cNopacityDisplayChannel::SetGeometry(void) { - height = cOsd::OsdHeight() * config.channelHeight / 100; - int top = cOsd::OsdTop() + cOsd::OsdHeight() - height - config.channelBorderBottom; - osd = CreateOsd(cOsd::OsdLeft(), top, cOsd::OsdWidth(), height); - infoWidth = osd->Width() - (config.logoWidth + 2 * config.channelBorderVertical + config.logoBorder); - infoX = config.logoWidth + config.channelBorderVertical + config.logoBorder; - channelInfoWidth = infoWidth * 0.7; - dateWidth = infoWidth - channelInfoWidth; - channelInfoHeight = height * 0.2; - if (channelInfoHeight%2 != 0) - channelInfoHeight++; - progressBarHeight = height * 0.1; - streamInfoHeight = height * 0.2; - if (streamInfoHeight%2 != 0) - streamInfoHeight++; - epgInfoHeight = height - channelInfoHeight - streamInfoHeight - progressBarHeight; - epgInfoLineHeight = epgInfoHeight / 4; - streamInfoY = channelInfoHeight + progressBarHeight + epgInfoHeight; + height = cOsd::OsdHeight() * config.channelHeight / 100; + int top = cOsd::OsdTop() + cOsd::OsdHeight() - height - config.channelBorderBottom; + osd = CreateOsd(cOsd::OsdLeft(), top, cOsd::OsdWidth(), height); + infoWidth = osd->Width() - (config.logoWidth + 2 * config.channelBorderVertical + config.logoBorder); + infoX = config.logoWidth + config.channelBorderVertical + config.logoBorder; + channelInfoWidth = infoWidth * 0.7; + dateWidth = infoWidth - channelInfoWidth; + channelInfoHeight = height * 0.2; + if (channelInfoHeight%2 != 0) + channelInfoHeight++; + progressBarHeight = height * 0.1; + streamInfoHeight = height * 0.2; + if (streamInfoHeight%2 != 0) + streamInfoHeight++; + epgInfoHeight = height - channelInfoHeight - streamInfoHeight - progressBarHeight; + epgInfoLineHeight = epgInfoHeight / 4; + streamInfoY = channelInfoHeight + progressBarHeight + epgInfoHeight; } void cNopacityDisplayChannel::CreatePixmaps(void) { - int channelInfoY = 0; - if (withInfo) { - pixmapProgressBar = osd->CreatePixmap(2, cRect(infoX, channelInfoHeight, infoWidth, progressBarHeight)); - pixmapEPGInfo = osd->CreatePixmap(2, cRect(infoX, channelInfoHeight + progressBarHeight, infoWidth, epgInfoHeight)); - pixmapBackgroundMiddle = osd->CreatePixmap(1, cRect(infoX, channelInfoHeight, infoWidth, progressBarHeight + epgInfoHeight)); - } else { - channelInfoY = (height - channelInfoHeight) / 3; - streamInfoY = (height - channelInfoHeight) / 3 + channelInfoHeight; - } - pixmapBackgroundTop = osd->CreatePixmap(1, cRect(infoX, channelInfoY, infoWidth, channelInfoHeight)); - pixmapBackgroundBottom = osd->CreatePixmap(1, cRect(infoX, streamInfoY, infoWidth, streamInfoHeight)); - - pixmapChannelInfo = osd->CreatePixmap(2, cRect(infoX, channelInfoY, channelInfoWidth, channelInfoHeight)); - pixmapDate = osd->CreatePixmap(2, cRect(infoX + channelInfoWidth, channelInfoY, dateWidth, channelInfoHeight)); - pixmapStreamInfo = osd->CreatePixmap(2, cRect(infoX, streamInfoY, infoWidth, streamInfoHeight)); - pixmapLogo = osd->CreatePixmap(1, cRect(0, 0, config.logoWidth + 2 * config.logoBorder, height)); - - if (config.channelFadeTime) { - pixmapBackgroundTop->SetAlpha(0); - pixmapBackgroundBottom->SetAlpha(0); - pixmapChannelInfo->SetAlpha(0); - pixmapDate->SetAlpha(0); - pixmapLogo->SetAlpha(0); - pixmapStreamInfo->SetAlpha(0); - if (withInfo) { - pixmapBackgroundMiddle->SetAlpha(0); - pixmapProgressBar->SetAlpha(0); - pixmapEPGInfo->SetAlpha(0); - } - } - if (withInfo) { - pixmapProgressBar->Fill(clrTransparent); - pixmapEPGInfo->Fill(clrTransparent); - } - pixmapScreenResolution = NULL; + int channelInfoY = 0; + if (withInfo) { + pixmapProgressBar = osd->CreatePixmap(2, cRect(infoX, channelInfoHeight, infoWidth, progressBarHeight)); + pixmapEPGInfo = osd->CreatePixmap(2, cRect(infoX, channelInfoHeight + progressBarHeight, infoWidth, epgInfoHeight)); + pixmapBackgroundMiddle = osd->CreatePixmap(1, cRect(infoX, channelInfoHeight, infoWidth, progressBarHeight + epgInfoHeight)); + } else { + channelInfoY = (height - channelInfoHeight) / 3; + streamInfoY = (height - channelInfoHeight) / 3 + channelInfoHeight; + } + pixmapBackgroundTop = osd->CreatePixmap(1, cRect(infoX, channelInfoY, infoWidth, channelInfoHeight)); + pixmapBackgroundBottom = osd->CreatePixmap(1, cRect(infoX, streamInfoY, infoWidth, streamInfoHeight)); + + pixmapChannelInfo = osd->CreatePixmap(2, cRect(infoX, channelInfoY, channelInfoWidth, channelInfoHeight)); + pixmapDate = osd->CreatePixmap(2, cRect(infoX + channelInfoWidth, channelInfoY, dateWidth, channelInfoHeight)); + pixmapStreamInfo = osd->CreatePixmap(2, cRect(infoX, streamInfoY, infoWidth, streamInfoHeight)); + pixmapLogo = osd->CreatePixmap(1, cRect(0, 0, config.logoWidth + 2 * config.logoBorder, height)); + + if (config.channelFadeTime) { + pixmapBackgroundTop->SetAlpha(0); + pixmapBackgroundBottom->SetAlpha(0); + pixmapChannelInfo->SetAlpha(0); + pixmapDate->SetAlpha(0); + pixmapLogo->SetAlpha(0); + pixmapStreamInfo->SetAlpha(0); + if (withInfo) { + pixmapBackgroundMiddle->SetAlpha(0); + pixmapProgressBar->SetAlpha(0); + pixmapEPGInfo->SetAlpha(0); + } + } + if (withInfo) { + pixmapProgressBar->Fill(clrTransparent); + pixmapEPGInfo->Fill(clrTransparent); + } + pixmapScreenResolution = NULL; } void cNopacityDisplayChannel::CreateFonts(void) { - fontHeader = cFont::CreateFont(config.fontName, channelInfoHeight - 8 + config.fontChannelHeaderSize); - fontDate = cFont::CreateFont(config.fontName, channelInfoHeight/2 + config.fontChannelDateSize); - fontEPG = cFont::CreateFont(config.fontName, epgInfoLineHeight + config.fontEPGSize); - fontEPGSmall = cFont::CreateFont(config.fontName, epgInfoLineHeight - 6 + config.fontEPGSmallSize); + fontHeader = cFont::CreateFont(config.fontName, channelInfoHeight - 8 + config.fontChannelHeaderSize); + fontDate = cFont::CreateFont(config.fontName, channelInfoHeight/2 + config.fontChannelDateSize); + fontEPG = cFont::CreateFont(config.fontName, epgInfoLineHeight + config.fontEPGSize); + fontEPGSmall = cFont::CreateFont(config.fontName, epgInfoLineHeight - 6 + config.fontEPGSmallSize); } void cNopacityDisplayChannel::DrawBackground(void){ - - DrawBlendedBackground(pixmapBackgroundTop, Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), true); - if (withInfo) - pixmapBackgroundMiddle->Fill(Theme.Color(clrChannelBackground)); - DrawBlendedBackground(pixmapBackgroundBottom, Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), false); + + DrawBlendedBackground(pixmapBackgroundTop, Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), true); + if (withInfo) + pixmapBackgroundMiddle->Fill(Theme.Color(clrChannelBackground)); + DrawBlendedBackground(pixmapBackgroundBottom, Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), false); - pixmapBackgroundTop->DrawEllipse(cRect(0, 0, channelInfoHeight/2, channelInfoHeight/2), clrTransparent, -2); - pixmapBackgroundTop->DrawEllipse(cRect(infoWidth - channelInfoHeight/2, 0, channelInfoHeight/2, channelInfoHeight/2), clrTransparent, -1); - pixmapBackgroundBottom->DrawEllipse(cRect(0, streamInfoHeight/2, streamInfoHeight/2, streamInfoHeight/2), clrTransparent, -3); - pixmapBackgroundBottom->DrawEllipse(cRect(infoWidth - streamInfoHeight/2, streamInfoHeight/2, streamInfoHeight/2, streamInfoHeight/2), clrTransparent, -4); + pixmapBackgroundTop->DrawEllipse(cRect(0, 0, channelInfoHeight/2, channelInfoHeight/2), clrTransparent, -2); + pixmapBackgroundTop->DrawEllipse(cRect(infoWidth - channelInfoHeight/2, 0, channelInfoHeight/2, channelInfoHeight/2), clrTransparent, -1); + pixmapBackgroundBottom->DrawEllipse(cRect(0, streamInfoHeight/2, streamInfoHeight/2, streamInfoHeight/2), clrTransparent, -3); + pixmapBackgroundBottom->DrawEllipse(cRect(infoWidth - streamInfoHeight/2, streamInfoHeight/2, streamInfoHeight/2, streamInfoHeight/2), clrTransparent, -4); - - pixmapChannelInfo->Fill(clrTransparent); - pixmapDate->Fill(clrTransparent); - pixmapLogo->Fill(clrTransparent); - pixmapStreamInfo->Fill(clrTransparent); + + pixmapChannelInfo->Fill(clrTransparent); + pixmapDate->Fill(clrTransparent); + pixmapLogo->Fill(clrTransparent); + pixmapStreamInfo->Fill(clrTransparent); } void cNopacityDisplayChannel::DrawDate(void) { - cString curDate = DayDateTime(); - if (initial || channelChange || strcmp(curDate, lastDate)) { - int strDateWidth = fontDate->Width(curDate); - int strDateHeight = fontDate->Height(); - int x = dateWidth - strDateWidth - channelInfoHeight/2; - int y = (channelInfoHeight - strDateHeight) / 2; - pixmapDate->Fill(clrTransparent); - pixmapDate->DrawText(cPoint(x, y), curDate, Theme.Color(clrChannelHead), clrTransparent, fontDate); - lastDate = curDate; + cString curDate = DayDateTime(); + if (initial || channelChange || strcmp(curDate, lastDate)) { + int strDateWidth = fontDate->Width(curDate); + int strDateHeight = fontDate->Height(); + int x = dateWidth - strDateWidth - channelInfoHeight/2; + int y = (channelInfoHeight - strDateHeight) / 2; + pixmapDate->Fill(clrTransparent); + pixmapDate->DrawText(cPoint(x, y), curDate, Theme.Color(clrChannelHead), clrTransparent, fontDate); + lastDate = curDate; } } void cNopacityDisplayChannel::DrawIcons(const cChannel *Channel) { - int spacing = 10; - int x = infoWidth - config.resolutionIconSize - 3*spacing; - int y = 0; - - bool rec = cRecordControls::Active(); - x -= bmRecording.Width() + spacing; - y = (streamInfoHeight - bmRecording.Height()) / 2; - pixmapStreamInfo->DrawBitmap(cPoint(x,y), bmRecording, Theme.Color(rec ? clrChannelRecActive : clrChannelSymbolOff), clrTransparent); + int spacing = 10; + int x = infoWidth - config.resolutionIconSize - 3*spacing; + int y = 0; + + bool rec = cRecordControls::Active(); + x -= bmRecording.Width() + spacing; + y = (streamInfoHeight - bmRecording.Height()) / 2; + pixmapStreamInfo->DrawBitmap(cPoint(x,y), bmRecording, Theme.Color(rec ? clrChannelRecActive : clrChannelSymbolOff), clrTransparent); - x -= bmEncrypted.Width() + spacing; - y = (streamInfoHeight - bmEncrypted.Height()) / 2; - pixmapStreamInfo->DrawBitmap(cPoint(x,y), bmEncrypted, Theme.Color(Channel->Ca() ? clrChannelSymbolOn : clrChannelSymbolOff), clrTransparent); + x -= bmEncrypted.Width() + spacing; + y = (streamInfoHeight - bmEncrypted.Height()) / 2; + pixmapStreamInfo->DrawBitmap(cPoint(x,y), bmEncrypted, Theme.Color(Channel->Ca() ? clrChannelSymbolOn : clrChannelSymbolOff), clrTransparent); - x -= bmDolbyDigital.Width() + spacing; - y = (streamInfoHeight - bmDolbyDigital.Height()) / 2; - pixmapStreamInfo->DrawBitmap(cPoint(x,y), bmDolbyDigital, Theme.Color(Channel->Dpid(0) ? clrChannelSymbolOn : clrChannelSymbolOff), clrTransparent); - - x -= bmAudio.Width() + spacing; + x -= bmDolbyDigital.Width() + spacing; + y = (streamInfoHeight - bmDolbyDigital.Height()) / 2; + pixmapStreamInfo->DrawBitmap(cPoint(x,y), bmDolbyDigital, Theme.Color(Channel->Dpid(0) ? clrChannelSymbolOn : clrChannelSymbolOff), clrTransparent); + + x -= bmAudio.Width() + spacing; y = (streamInfoHeight - bmAudio.Height()) / 2; - pixmapStreamInfo->DrawBitmap(cPoint(x,y), bmAudio, Theme.Color(Channel->Apid(1) ? clrChannelSymbolOn : clrChannelSymbolOff), clrTransparent); - - if (Channel->Vpid()) { - x -= bmTeletext.Width() + spacing; - y = (streamInfoHeight - bmTeletext.Height()) / 2; - pixmapStreamInfo->DrawBitmap(cPoint(x,y), bmTeletext, Theme.Color(Channel->Tpid() ? clrChannelSymbolOn : clrChannelSymbolOff), clrTransparent); + pixmapStreamInfo->DrawBitmap(cPoint(x,y), bmAudio, Theme.Color(Channel->Apid(1) ? clrChannelSymbolOn : clrChannelSymbolOff), clrTransparent); + + if (Channel->Vpid()) { + x -= bmTeletext.Width() + spacing; + y = (streamInfoHeight - bmTeletext.Height()) / 2; + pixmapStreamInfo->DrawBitmap(cPoint(x,y), bmTeletext, Theme.Color(Channel->Tpid() ? clrChannelSymbolOn : clrChannelSymbolOff), clrTransparent); } else if (Channel->Apid(0)) { x -= bmRadio.Width() + spacing; - y = (streamInfoHeight - bmTeletext.Height()) / 2; + y = (streamInfoHeight - bmTeletext.Height()) / 2; pixmapStreamInfo->DrawBitmap(cPoint(x,y), bmRadio, Theme.Color(clrChannelSymbolOn), clrTransparent); } - + } void cNopacityDisplayChannel::DrawScreenResolution(void) { - int spacing = 10; - int screenWidth = 0; - int screenHeight = 0; - double aspect = 0; + int spacing = 10; + int screenWidth = 0; + int screenHeight = 0; + double aspect = 0; - if (!pixmapScreenResolution) { - int x = infoX + infoWidth - config.resolutionIconSize - 2*spacing; - int y = streamInfoY + streamInfoHeight - config.resolutionIconSize - 3; - pixmapScreenResolution = osd->CreatePixmap(3, cRect(x, y, config.resolutionIconSize, config.resolutionIconSize)); - pixmapScreenResolution->Fill(clrTransparent); - if ((initial)&&(config.channelFadeTime)) - pixmapScreenResolution->SetAlpha(0); - } - - cDevice::PrimaryDevice()->GetVideoSize(screenWidth, screenHeight, aspect); - if (screenWidth != lastScreenWidth) { - cImageLoader imgLoader; - cString iconName(""); - switch (screenWidth) { - case 1920: - case 1440: - iconName = "hd1080i"; - break; - case 1280: - iconName = "hd720p"; - break; - case 720: - iconName = "sd576i"; - break; - default: - iconName = "sd576i"; - break; - } - if (imgLoader.LoadIcon(*iconName, config.resolutionIconSize)) { - pixmapScreenResolution->DrawImage(cPoint(0,0), imgLoader.GetImage()); - } - lastScreenWidth = screenWidth; - } + if (!pixmapScreenResolution) { + int x = infoX + infoWidth - config.resolutionIconSize - 2*spacing; + int y = streamInfoY + streamInfoHeight - config.resolutionIconSize - 3; + pixmapScreenResolution = osd->CreatePixmap(3, cRect(x, y, config.resolutionIconSize, config.resolutionIconSize)); + pixmapScreenResolution->Fill(clrTransparent); + if ((initial)&&(config.channelFadeTime)) + pixmapScreenResolution->SetAlpha(0); + } + + cDevice::PrimaryDevice()->GetVideoSize(screenWidth, screenHeight, aspect); + if (screenWidth != lastScreenWidth) { + cImageLoader imgLoader; + cString iconName(""); + switch (screenWidth) { + case 1920: + case 1440: + iconName = "hd1080i"; + break; + case 1280: + iconName = "hd720p"; + break; + case 720: + iconName = "sd576i"; + break; + default: + iconName = "sd576i"; + break; + } + if (imgLoader.LoadIcon(*iconName, config.resolutionIconSize)) { + pixmapScreenResolution->DrawImage(cPoint(0,0), imgLoader.GetImage()); + } + lastScreenWidth = screenWidth; + } } void cNopacityDisplayChannel::DrawSignalMeter(void) { - signalWidth = infoWidth * 0.15; - signalHeight = signalWidth *15 / 200; - showSignal = false; - if (config.displaySignalStrength) { - cImageLoader imgLoader; - cString signalStrength = "STR"; - cString signalQuality = "SNR"; - if (imgLoader.LoadIcon("signal", signalWidth, signalHeight)) { - cImage imgSignal = imgLoader.GetImage(); - signalWidth = imgSignal.Width(); - signalHeight = imgSignal.Height(); - int signalMeterY = streamInfoY + (streamInfoHeight - 2*signalHeight - 5)/2; - fontInfoline = cFont::CreateFont(config.fontName, signalHeight - 2); - int labelWidth = max(fontInfoline->Width(*signalStrength), fontInfoline->Width(*signalQuality)) + 2; - signalX = streamInfoHeight / 2 + labelWidth; - showSignal = true; - pixmapSignalStrength = osd->CreatePixmap(3, cRect(infoX + signalX, signalMeterY + 2, signalWidth + 2, signalHeight + 2)); - pixmapSignalQuality = osd->CreatePixmap(3, cRect(infoX + signalX, signalMeterY + signalHeight + 5, signalWidth + 2, signalHeight + 2)); - pixmapSignalMeter = osd->CreatePixmap(4, cRect(infoX + signalX + 1, signalMeterY + 3, signalWidth, 2*signalHeight + 3)); - pixmapSignalLabel = osd->CreatePixmap(3, cRect(infoX + streamInfoHeight / 2, signalMeterY + 2, labelWidth, 2*signalHeight + 3)); - pixmapSignalStrength->Fill(Theme.Color(clrProgressBarBack)); - pixmapSignalQuality->Fill(Theme.Color(clrProgressBarBack)); - pixmapSignalMeter->Fill(clrTransparent); - pixmapSignalLabel->Fill(clrTransparent); - if (config.channelFadeTime) { - pixmapSignalStrength->SetAlpha(0); - pixmapSignalQuality->SetAlpha(0); - pixmapSignalMeter->SetAlpha(0); - pixmapSignalLabel->SetAlpha(0); - } - pixmapSignalStrength->DrawImage(cPoint(1,1), imgSignal); - pixmapSignalQuality->DrawImage(cPoint(1,1), imgSignal); - pixmapSignalLabel->DrawText(cPoint(0, 2), *signalStrength, Theme.Color(clrChannelEPGInfo), clrTransparent, fontInfoline); - pixmapSignalLabel->DrawText(cPoint(0, signalHeight + 4), *signalQuality, Theme.Color(clrChannelEPGInfo), clrTransparent, fontInfoline); - } - } + signalWidth = infoWidth * 0.15; + signalHeight = signalWidth *15 / 200; + showSignal = false; + if (config.displaySignalStrength) { + cImageLoader imgLoader; + cString signalStrength = "STR"; + cString signalQuality = "SNR"; + if (imgLoader.LoadIcon("signal", signalWidth, signalHeight)) { + cImage imgSignal = imgLoader.GetImage(); + signalWidth = imgSignal.Width(); + signalHeight = imgSignal.Height(); + int signalMeterY = streamInfoY + (streamInfoHeight - 2*signalHeight - 5)/2; + fontInfoline = cFont::CreateFont(config.fontName, signalHeight - 2); + int labelWidth = max(fontInfoline->Width(*signalStrength), fontInfoline->Width(*signalQuality)) + 2; + signalX = streamInfoHeight / 2 + labelWidth; + showSignal = true; + pixmapSignalStrength = osd->CreatePixmap(3, cRect(infoX + signalX, signalMeterY + 2, signalWidth + 2, signalHeight + 2)); + pixmapSignalQuality = osd->CreatePixmap(3, cRect(infoX + signalX, signalMeterY + signalHeight + 5, signalWidth + 2, signalHeight + 2)); + pixmapSignalMeter = osd->CreatePixmap(4, cRect(infoX + signalX + 1, signalMeterY + 3, signalWidth, 2*signalHeight + 3)); + pixmapSignalLabel = osd->CreatePixmap(3, cRect(infoX + streamInfoHeight / 2, signalMeterY + 2, labelWidth, 2*signalHeight + 3)); + pixmapSignalStrength->Fill(Theme.Color(clrProgressBarBack)); + pixmapSignalQuality->Fill(Theme.Color(clrProgressBarBack)); + pixmapSignalMeter->Fill(clrTransparent); + pixmapSignalLabel->Fill(clrTransparent); + if (config.channelFadeTime) { + pixmapSignalStrength->SetAlpha(0); + pixmapSignalQuality->SetAlpha(0); + pixmapSignalMeter->SetAlpha(0); + pixmapSignalLabel->SetAlpha(0); + } + pixmapSignalStrength->DrawImage(cPoint(1,1), imgSignal); + pixmapSignalQuality->DrawImage(cPoint(1,1), imgSignal); + pixmapSignalLabel->DrawText(cPoint(0, 2), *signalStrength, Theme.Color(clrChannelEPGInfo), clrTransparent, fontInfoline); + pixmapSignalLabel->DrawText(cPoint(0, signalHeight + 4), *signalQuality, Theme.Color(clrChannelEPGInfo), clrTransparent, fontInfoline); + } + } } void cNopacityDisplayChannel::DrawSignal(void) { - time_t Now = time(NULL); - if (Now != lastSignalDisplay) { - int SignalStrength = cDevice::ActualDevice()->SignalStrength(); - int SignalQuality = cDevice::ActualDevice()->SignalQuality(); - if ((SignalStrength == 0)&&(SignalQuality==0)) - return; - if ((lastSignalStrength != SignalStrength) || (lastSignalQuality != SignalQuality)) { - pixmapSignalMeter->Fill(clrTransparent); - pixmapSignalMeter->DrawRectangle(cRect(double(SignalStrength) /100 * signalWidth, 0, signalWidth - (double)SignalStrength /100 * signalWidth + 1, signalHeight), Theme.Color(clrChannelBackground)); - pixmapSignalMeter->DrawRectangle(cRect(double(SignalQuality) /100 * signalWidth, signalHeight + 3, signalWidth - (double)SignalQuality / 100 * signalWidth + 1, signalHeight + 1), Theme.Color(clrChannelBackground)); - } - lastSignalStrength = SignalStrength; - lastSignalQuality = SignalQuality; - lastSignalDisplay = Now; - } + time_t Now = time(NULL); + if (Now != lastSignalDisplay) { + int SignalStrength = cDevice::ActualDevice()->SignalStrength(); + int SignalQuality = cDevice::ActualDevice()->SignalQuality(); + if ((SignalStrength == 0)&&(SignalQuality==0)) + return; + if ((lastSignalStrength != SignalStrength) || (lastSignalQuality != SignalQuality)) { + pixmapSignalMeter->Fill(clrTransparent); + pixmapSignalMeter->DrawRectangle(cRect(double(SignalStrength) /100 * signalWidth, 0, signalWidth - (double)SignalStrength /100 * signalWidth + 1, signalHeight), Theme.Color(clrChannelBackground)); + pixmapSignalMeter->DrawRectangle(cRect(double(SignalQuality) /100 * signalWidth, signalHeight + 3, signalWidth - (double)SignalQuality / 100 * signalWidth + 1, signalHeight + 1), Theme.Color(clrChannelBackground)); + } + lastSignalStrength = SignalStrength; + lastSignalQuality = SignalQuality; + lastSignalDisplay = Now; + } } void cNopacityDisplayChannel::SetChannel(const cChannel *Channel, int Number) { - pixmapLogo->Fill(clrTransparent); - pixmapChannelInfo->Fill(clrTransparent); - - if (withInfo) { - pixmapProgressBar->Fill(clrTransparent); - pixmapEPGInfo->Fill(clrTransparent); - } - - channelChange = true; - lastSignalStrength = 0; - lastSignalQuality = 0; - cString ChannelNumber(""); - cString ChannelName(""); - groupSep = false; - if (Channel) { - ChannelName = Channel->Name(); - if (!Channel->GroupSep()) { - DrawIcons(Channel); - ChannelNumber = cString::sprintf("%d%s", Channel->Number(), Number ? "-" : ""); - } else - groupSep = true; - } else if (Number) { - ChannelNumber = cString::sprintf("%d-", Number); - } else { - ChannelName = ChannelString(NULL, 0); - } + pixmapLogo->Fill(clrTransparent); + pixmapChannelInfo->Fill(clrTransparent); + + if (withInfo) { + pixmapProgressBar->Fill(clrTransparent); + pixmapEPGInfo->Fill(clrTransparent); + } + + channelChange = true; + lastSignalStrength = 0; + lastSignalQuality = 0; + cString ChannelNumber(""); + cString ChannelName(""); + groupSep = false; + if (Channel) { + ChannelName = Channel->Name(); + if (!Channel->GroupSep()) { + DrawIcons(Channel); + ChannelNumber = cString::sprintf("%d%s", Channel->Number(), Number ? "-" : ""); + } else + groupSep = true; + } else if (Number) { + ChannelNumber = cString::sprintf("%d-", Number); + } else { + ChannelName = ChannelString(NULL, 0); + } - cString channelString = cString::sprintf("%s %s", *ChannelNumber, *ChannelName); + cString channelString = cString::sprintf("%s %s", *ChannelNumber, *ChannelName); - if (!groupSep) { - pixmapChannelInfo->DrawText(cPoint(channelInfoHeight/2, (channelInfoHeight-fontHeader->Height())/2), channelString, Theme.Color(clrChannelHead), clrTransparent, fontHeader); - - cImageLoader imgLoader; - if (imgLoader.LoadLogo(*ChannelName)) { - pixmapLogo->DrawImage(cPoint(config.logoBorder, (height-config.logoHeight)/2), imgLoader.GetImage()); - } - } else { - if (withInfo) { - pixmapProgressBar->Fill(clrTransparent); - pixmapEPGInfo->Fill(clrTransparent); - pixmapEPGInfo->DrawText(cPoint(channelInfoHeight/2, (epgInfoHeight-fontHeader->Height())/2 - fontHeader->Height()/2), channelString, Theme.Color(clrChannelHead), clrTransparent, fontHeader); - } else { - pixmapChannelInfo->DrawText(cPoint(channelInfoHeight/2, (channelInfoHeight-fontHeader->Height())/2), channelString, Theme.Color(clrChannelHead), clrTransparent, fontHeader); - } - cImageLoader imgLoader; - if (imgLoader.LoadIcon("Channelseparator", config.logoHeight)) { - pixmapLogo->DrawImage(cPoint(config.logoBorder + (config.logoWidth - config.logoHeight)/2, (height-config.logoHeight)/2), imgLoader.GetImage()); - } - } + if (!groupSep) { + pixmapChannelInfo->DrawText(cPoint(channelInfoHeight/2, (channelInfoHeight-fontHeader->Height())/2), channelString, Theme.Color(clrChannelHead), clrTransparent, fontHeader); + + cImageLoader imgLoader; + if (imgLoader.LoadLogo(*ChannelName)) { + pixmapLogo->DrawImage(cPoint(config.logoBorder, (height-config.logoHeight)/2), imgLoader.GetImage()); + } + } else { + if (withInfo) { + pixmapProgressBar->Fill(clrTransparent); + pixmapEPGInfo->Fill(clrTransparent); + pixmapEPGInfo->DrawText(cPoint(channelInfoHeight/2, (epgInfoHeight-fontHeader->Height())/2 - fontHeader->Height()/2), channelString, Theme.Color(clrChannelHead), clrTransparent, fontHeader); + } else { + pixmapChannelInfo->DrawText(cPoint(channelInfoHeight/2, (channelInfoHeight-fontHeader->Height())/2), channelString, Theme.Color(clrChannelHead), clrTransparent, fontHeader); + } + cImageLoader imgLoader; + if (imgLoader.LoadIcon("Channelseparator", config.logoHeight)) { + pixmapLogo->DrawImage(cPoint(config.logoBorder + (config.logoWidth - config.logoHeight)/2, (height-config.logoHeight)/2), imgLoader.GetImage()); + } + } } void cNopacityDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Following) { - if (!withInfo) - return; - if (present != Present) - lastSeen = -1; - present = Present; - - if (Present || Following) { - pixmapProgressBar->Fill(clrTransparent); - pixmapEPGInfo->Fill(clrTransparent); - } - int indent = 20; - - for (int i = 0; i < 2; i++) { - const cEvent *e = !i ? Present : Following; - int y = !i ? 0 : 2; - if (e) { - cString startTime = e->GetTimeString(); - int startTimeWidth = fontEPG->Width(*startTime); - int epgWidth = fontEPG->Width(e->Title()); - int epgWidthShort = fontEPGSmall->Width(e->ShortText()); - cString strSeen(""); - if (i==0) { - int seen = (int)(time(NULL) - e->StartTime())/60; - strSeen = cString::sprintf("%d/%dmin", seen, e->Duration()/60); - } else { - strSeen = cString::sprintf("%dmin", e->Duration()/60); - } - int seenWidth = fontEPG->Width(*strSeen); - int space = infoWidth - 9*indent - seenWidth - startTimeWidth - config.resolutionIconSize; - cString strEPG; - if (space < epgWidth) { - cTextWrapper epgInfoWrapper(e->Title(), fontEPG, space); - strEPG = epgInfoWrapper.GetLine(0); - strEPG = cString::sprintf("%s...", *strEPG); - } else { - strEPG = e->Title(); - } - cString strEPGShort(""); - int spaceShort = infoWidth - 6*indent - startTimeWidth - config.resolutionIconSize; - if (spaceShort < epgWidthShort) { - cTextWrapper epgInfoWrapper(e->ShortText(), fontEPGSmall, spaceShort); - strEPGShort = epgInfoWrapper.GetLine(0); - strEPGShort = cString::sprintf("%s...", *strEPGShort); - } else { - strEPGShort = e->ShortText(); - } - tColor fontColor = (i==0)?Theme.Color(clrChannelEPG):Theme.Color(clrChannelEPGInfo); - pixmapEPGInfo->DrawText(cPoint(indent, y * epgInfoLineHeight), *startTime, fontColor, clrTransparent, fontEPG); - pixmapEPGInfo->DrawText(cPoint(2 * indent + startTimeWidth, y * epgInfoLineHeight), *strEPG, fontColor, clrTransparent, fontEPG); - pixmapEPGInfo->DrawText(cPoint(2 * indent + startTimeWidth, (y+1) * epgInfoLineHeight + 3), *strEPGShort, fontColor, clrTransparent, fontEPGSmall); - int x = infoWidth - indent - seenWidth - config.resolutionIconSize - indent; - pixmapEPGInfo->DrawText(cPoint(x, y * epgInfoLineHeight), *strSeen, fontColor, clrTransparent, fontEPG); - } - } + if (!withInfo) + return; + if (present != Present) + lastSeen = -1; + present = Present; + + if (Present || Following) { + pixmapProgressBar->Fill(clrTransparent); + pixmapEPGInfo->Fill(clrTransparent); + } + int indent = 20; + + for (int i = 0; i < 2; i++) { + const cEvent *e = !i ? Present : Following; + int y = !i ? 0 : 2; + if (e) { + cString startTime = e->GetTimeString(); + int startTimeWidth = fontEPG->Width(*startTime); + int epgWidth = fontEPG->Width(e->Title()); + int epgWidthShort = fontEPGSmall->Width(e->ShortText()); + cString strSeen(""); + if (i==0) { + int seen = (int)(time(NULL) - e->StartTime())/60; + strSeen = cString::sprintf("%d/%dmin", seen, e->Duration()/60); + } else { + strSeen = cString::sprintf("%dmin", e->Duration()/60); + } + int seenWidth = fontEPG->Width(*strSeen); + int space = infoWidth - 9*indent - seenWidth - startTimeWidth - config.resolutionIconSize; + cString strEPG; + if (space < epgWidth) { + cTextWrapper epgInfoWrapper(e->Title(), fontEPG, space); + strEPG = epgInfoWrapper.GetLine(0); + strEPG = cString::sprintf("%s...", *strEPG); + } else { + strEPG = e->Title(); + } + cString strEPGShort(""); + int spaceShort = infoWidth - 6*indent - startTimeWidth - config.resolutionIconSize; + if (spaceShort < epgWidthShort) { + cTextWrapper epgInfoWrapper(e->ShortText(), fontEPGSmall, spaceShort); + strEPGShort = epgInfoWrapper.GetLine(0); + strEPGShort = cString::sprintf("%s...", *strEPGShort); + } else { + strEPGShort = e->ShortText(); + } + tColor fontColor = (i==0)?Theme.Color(clrChannelEPG):Theme.Color(clrChannelEPGInfo); + pixmapEPGInfo->DrawText(cPoint(indent, y * epgInfoLineHeight), *startTime, fontColor, clrTransparent, fontEPG); + pixmapEPGInfo->DrawText(cPoint(2 * indent + startTimeWidth, y * epgInfoLineHeight), *strEPG, fontColor, clrTransparent, fontEPG); + pixmapEPGInfo->DrawText(cPoint(2 * indent + startTimeWidth, (y+1) * epgInfoLineHeight + 3), *strEPGShort, fontColor, clrTransparent, fontEPGSmall); + int x = infoWidth - indent - seenWidth - config.resolutionIconSize - indent; + pixmapEPGInfo->DrawText(cPoint(x, y * epgInfoLineHeight), *strSeen, fontColor, clrTransparent, fontEPG); + } + } } void cNopacityDisplayChannel::DrawProgressBar(int Current, int Total) { - if ((Current < currentLast + 3) && !channelChange) - return; - currentLast = Current; - if ((Current > 0) || (Total > 0)) { - int barHeight = pixmapProgressBar->ViewPort().Height()-8; - if (barHeight%2 != 0) - barHeight++; - int barFullWidth = pixmapProgressBar->ViewPort().Width() - 20 - barHeight; - double percentSeen = ((double)Current) / (double)Total; + if ((Current < currentLast + 3) && !channelChange) + return; + currentLast = Current; + if ((Current > 0) || (Total > 0)) { + int barHeight = pixmapProgressBar->ViewPort().Height()-8; + if (barHeight%2 != 0) + barHeight++; + int barFullWidth = pixmapProgressBar->ViewPort().Width() - 20 - barHeight; + double percentSeen = ((double)Current) / (double)Total; - pixmapProgressBar->DrawEllipse(cRect(9, 3, barHeight+2, barHeight+2), Theme.Color(clrProgressBarBack)); - pixmapProgressBar->DrawEllipse(cRect(9 + barFullWidth, 3, barHeight+2, barHeight+2), Theme.Color(clrProgressBarBack)); - pixmapProgressBar->DrawRectangle(cRect( 9 + barHeight/2, 3, barFullWidth, barHeight+1), Theme.Color(clrProgressBarBack)); + pixmapProgressBar->DrawEllipse(cRect(9, 3, barHeight+2, barHeight+2), Theme.Color(clrProgressBarBack)); + pixmapProgressBar->DrawEllipse(cRect(9 + barFullWidth, 3, barHeight+2, barHeight+2), Theme.Color(clrProgressBarBack)); + pixmapProgressBar->DrawRectangle(cRect( 9 + barHeight/2, 3, barFullWidth, barHeight+1), Theme.Color(clrProgressBarBack)); - pixmapProgressBar->DrawEllipse(cRect(10, 4, barHeight, barHeight), Theme.Color(clrProgressBarBlend)); - if (Current > 0) { - tColor colAct = DrawProgressbarBackground(10 + barHeight/2, 4, barFullWidth * percentSeen, barHeight-1); - pixmapProgressBar->DrawEllipse(cRect(10 + barFullWidth * percentSeen, 4, barHeight, barHeight), colAct); - //pixmapProgressBar->DrawRectangle(cRect( 10 + barHeight/2, 4, barFullWidth * percentSeen, barHeight-1), Theme.Color(clrProgressBar)); - } - } + pixmapProgressBar->DrawEllipse(cRect(10, 4, barHeight, barHeight), Theme.Color(clrProgressBarBlend)); + if (Current > 0) { + tColor colAct = DrawProgressbarBackground(10 + barHeight/2, 4, barFullWidth * percentSeen, barHeight-1); + pixmapProgressBar->DrawEllipse(cRect(10 + barFullWidth * percentSeen, 4, barHeight, barHeight), colAct); + //pixmapProgressBar->DrawRectangle(cRect( 10 + barHeight/2, 4, barFullWidth * percentSeen, barHeight-1), Theme.Color(clrProgressBar)); + } + } } tColor cNopacityDisplayChannel::DrawProgressbarBackground(int left, int top, int width, int height) { - tColor clr1 = Theme.Color(clrProgressBar); - tColor clr2 = Theme.Color(clrProgressBarBlend); - tColor clr = 0x00000000; - int step = width / 256; - int alpha = 0x0; - int alphaStep; - int maximum = 0; - if (step == 0) { //width < 256 - step = 1; + tColor clr1 = Theme.Color(clrProgressBar); + tColor clr2 = Theme.Color(clrProgressBarBlend); + tColor clr = 0x00000000; + int step = width / 256; + int alpha = 0x0; + int alphaStep; + int maximum = 0; + if (step == 0) { //width < 256 + step = 1; alphaStep = 256 / width; - maximum = width; - } else { //width > 256 + maximum = width; + } else { //width > 256 alphaStep = 0x1; - maximum = 256; + maximum = 256; } - int x = 0; - for (int i = 0; i < maximum; i++) { - x = left + i*step; - clr = AlphaBlend(clr1, clr2, alpha); - pixmapProgressBar->DrawRectangle(cRect(x,top,step,height), clr); + int x = 0; + for (int i = 0; i < maximum; i++) { + x = left + i*step; + clr = AlphaBlend(clr1, clr2, alpha); + pixmapProgressBar->DrawRectangle(cRect(x,top,step,height), clr); alpha += alphaStep; - } - if (step > 0) { - int rest = width - step*256; + } + if (step > 0) { + int rest = width - step*256; pixmapProgressBar->DrawRectangle(cRect(left+step*256, top, rest, height), clr); - } - return clr; + } + return clr; } void cNopacityDisplayChannel::SetMessage(eMessageType Type, const char *Text) { } void cNopacityDisplayChannel::Flush(void) { - DrawDate(); - if (!groupSep) - DrawScreenResolution(); - if (config.displaySignalStrength && showSignal) { - DrawSignal(); - } - if (withInfo) { - int Current = 0; - int Total = 0; - if (present) { - time_t t = time(NULL); - if (t > present->StartTime()) - Current = t - present->StartTime(); - Total = present->Duration(); - DrawProgressBar(Current, Total); - } - } - if (initial) { - if (config.channelFadeTime) - Start(); - } - initial = false; - channelChange = false; - osd->Flush(); + DrawDate(); + if (!groupSep) + DrawScreenResolution(); + if (config.displaySignalStrength && showSignal) { + DrawSignal(); + } + if (withInfo) { + int Current = 0; + int Total = 0; + if (present) { + time_t t = time(NULL); + if (t > present->StartTime()) + Current = t - present->StartTime(); + Total = present->Duration(); + DrawProgressBar(Current, Total); + } + } + if (initial) { + if (config.channelFadeTime) + Start(); + } + initial = false; + channelChange = false; + osd->Flush(); } void cNopacityDisplayChannel::Action(void) { - uint64_t Start = cTimeMs::Now(); - while (Running()) { - uint64_t Now = cTimeMs::Now(); - cPixmap::Lock(); - double t = min(double(Now - Start) / FadeTime, 1.0); - int Alpha = t * ALPHA_OPAQUE; - pixmapBackgroundTop->SetAlpha(Alpha); - pixmapBackgroundBottom->SetAlpha(Alpha); - pixmapLogo->SetAlpha(Alpha); - pixmapChannelInfo->SetAlpha(Alpha); - pixmapDate->SetAlpha(Alpha); - if (withInfo) { - pixmapBackgroundMiddle->SetAlpha(Alpha); - pixmapProgressBar->SetAlpha(Alpha); - pixmapEPGInfo->SetAlpha(Alpha); - } - pixmapStreamInfo->SetAlpha(Alpha); - if (pixmapScreenResolution) - pixmapScreenResolution->SetAlpha(Alpha); - if (config.displaySignalStrength && showSignal) { - pixmapSignalStrength->SetAlpha(Alpha); - pixmapSignalQuality->SetAlpha(Alpha); - pixmapSignalMeter->SetAlpha(Alpha); - pixmapSignalLabel->SetAlpha(Alpha); - } - if (Running()) - osd->Flush(); - cPixmap::Unlock(); - int Delta = cTimeMs::Now() - Now; - if (Running() && (Delta < FrameTime)) - cCondWait::SleepMs(FrameTime - Delta); - if ((int)(Now - Start) > FadeTime) { - break; - } - } + uint64_t Start = cTimeMs::Now(); + while (Running()) { + uint64_t Now = cTimeMs::Now(); + cPixmap::Lock(); + double t = min(double(Now - Start) / FadeTime, 1.0); + int Alpha = t * ALPHA_OPAQUE; + pixmapBackgroundTop->SetAlpha(Alpha); + pixmapBackgroundBottom->SetAlpha(Alpha); + pixmapLogo->SetAlpha(Alpha); + pixmapChannelInfo->SetAlpha(Alpha); + pixmapDate->SetAlpha(Alpha); + if (withInfo) { + pixmapBackgroundMiddle->SetAlpha(Alpha); + pixmapProgressBar->SetAlpha(Alpha); + pixmapEPGInfo->SetAlpha(Alpha); + } + pixmapStreamInfo->SetAlpha(Alpha); + if (pixmapScreenResolution) + pixmapScreenResolution->SetAlpha(Alpha); + if (config.displaySignalStrength && showSignal) { + pixmapSignalStrength->SetAlpha(Alpha); + pixmapSignalQuality->SetAlpha(Alpha); + pixmapSignalMeter->SetAlpha(Alpha); + pixmapSignalLabel->SetAlpha(Alpha); + } + if (Running()) + osd->Flush(); + cPixmap::Unlock(); + int Delta = cTimeMs::Now() - Now; + if (Running() && (Delta < FrameTime)) + cCondWait::SleepMs(FrameTime - Delta); + if ((int)(Now - Start) > FadeTime) { + break; + } + } }
\ No newline at end of file diff --git a/displaychannel.h b/displaychannel.h index 9052c0e..2854888 100644 --- a/displaychannel.h +++ b/displaychannel.h @@ -3,72 +3,72 @@ class cNopacityDisplayChannel : public cSkinDisplayChannel, cThread { private: - int FrameTime; - int FadeTime; - bool withInfo; - bool initial; - bool groupSep; - bool channelChange; - cString lastDate; - int lastSeen; - time_t lastSignalDisplay; - int lastSignalStrength; - int lastSignalQuality; - int lastScreenWidth; - int currentLast; - bool showSignal; - const cEvent *present; - cOsd *osd; - cPixmap *pixmapBackgroundTop; - cPixmap *pixmapBackgroundMiddle; - cPixmap *pixmapBackgroundBottom; - cPixmap *pixmapChannelInfo; - cPixmap *pixmapDate; - cPixmap *pixmapLogo; - cPixmap *pixmapProgressBar; - cPixmap *pixmapEPGInfo; - cPixmap *pixmapStreamInfo; - cPixmap *pixmapSignalStrength; - cPixmap *pixmapSignalQuality; - cPixmap *pixmapSignalMeter; - cPixmap *pixmapSignalLabel; - cPixmap *pixmapScreenResolution; - int height; - int infoWidth; - int infoX; - int channelInfoWidth; - int channelInfoHeight; - int dateWidth; - int progressBarHeight; - int epgInfoHeight; - int epgInfoLineHeight; - int streamInfoHeight; - int streamInfoY; - int signalWidth, signalHeight, signalX; - cFont *fontHeader; - cFont *fontDate; - cFont *fontEPG; - cFont *fontEPGSmall; - cFont *fontInfoline; - virtual void Action(void); - void SetGeometry(void); - void CreatePixmaps(void); - void CreateFonts(void); - void DrawBackground(void); - void DrawDate(void); - void DrawProgressBar(int Current, int Total); - tColor DrawProgressbarBackground(int left, int top, int width, int height); - void DrawIcons(const cChannel *channel); - void DrawScreenResolution(void); - void DrawSignalMeter(void); - void DrawSignal(void); - static cBitmap bmTeletext, bmRadio, bmAudio, bmDolbyDigital, bmEncrypted, bmRecording; + int FrameTime; + int FadeTime; + bool withInfo; + bool initial; + bool groupSep; + bool channelChange; + cString lastDate; + int lastSeen; + time_t lastSignalDisplay; + int lastSignalStrength; + int lastSignalQuality; + int lastScreenWidth; + int currentLast; + bool showSignal; + const cEvent *present; + cOsd *osd; + cPixmap *pixmapBackgroundTop; + cPixmap *pixmapBackgroundMiddle; + cPixmap *pixmapBackgroundBottom; + cPixmap *pixmapChannelInfo; + cPixmap *pixmapDate; + cPixmap *pixmapLogo; + cPixmap *pixmapProgressBar; + cPixmap *pixmapEPGInfo; + cPixmap *pixmapStreamInfo; + cPixmap *pixmapSignalStrength; + cPixmap *pixmapSignalQuality; + cPixmap *pixmapSignalMeter; + cPixmap *pixmapSignalLabel; + cPixmap *pixmapScreenResolution; + int height; + int infoWidth; + int infoX; + int channelInfoWidth; + int channelInfoHeight; + int dateWidth; + int progressBarHeight; + int epgInfoHeight; + int epgInfoLineHeight; + int streamInfoHeight; + int streamInfoY; + int signalWidth, signalHeight, signalX; + cFont *fontHeader; + cFont *fontDate; + cFont *fontEPG; + cFont *fontEPGSmall; + cFont *fontInfoline; + virtual void Action(void); + void SetGeometry(void); + void CreatePixmaps(void); + void CreateFonts(void); + void DrawBackground(void); + void DrawDate(void); + void DrawProgressBar(int Current, int Total); + tColor DrawProgressbarBackground(int left, int top, int width, int height); + void DrawIcons(const cChannel *channel); + void DrawScreenResolution(void); + void DrawSignalMeter(void); + void DrawSignal(void); + static cBitmap bmTeletext, bmRadio, bmAudio, bmDolbyDigital, bmEncrypted, bmRecording; public: - cNopacityDisplayChannel(bool WithInfo); - virtual ~cNopacityDisplayChannel(); - virtual void SetChannel(const cChannel *Channel, int Number); - virtual void SetEvents(const cEvent *Present, const cEvent *Following); - virtual void SetMessage(eMessageType Type, const char *Text); - virtual void Flush(void); + cNopacityDisplayChannel(bool WithInfo); + virtual ~cNopacityDisplayChannel(); + virtual void SetChannel(const cChannel *Channel, int Number); + virtual void SetEvents(const cEvent *Present, const cEvent *Following); + virtual void SetMessage(eMessageType Type, const char *Text); + virtual void Flush(void); }; #endif //__NOPACITY_DISPLAYCHANNEL_H
\ No newline at end of file diff --git a/displaymenu.c b/displaymenu.c index 34f8af3..8e3ea24 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -2,514 +2,514 @@ #include <string> cNopacityDisplayMenu::cNopacityDisplayMenu(void) { - int start = cTimeMs::Now(); - config.setDynamicValues(); - menuCategoryLast = mcUndefined; - menuSubCategory = mcSubUndefined; - menuSubCategoryLast = mcSubUndefined; - FrameTime = config.menuFrameTime; - FadeTime = config.menuFadeTime; - initial = true; - initMenu = true; - diskUsageDrawn = false; - timersDrawn = false; - lastDiskUsageState = -1; - lastTimersState = -1; - menuItemIndexLast = -1; - currentNumItems = 0; - menuHasIcons = true; - detailView = NULL; - contentNarrow = true; - contentNarrowLast = true; - menuView = new cNopacityDisplayMenuView(); - osd = menuView->createOsd(); - menuView->SetGeometry(); - menuView->CreatePixmaps(); - menuView->CreateFonts(); - menuView->SetAvrgFontWidth(); - menuView->CreateBackgroundImages(handleBackgrounds, handleButtons); - menuView->DrawHeaderLogo(); - menuView->DrawBorderDecoration(); - dsyslog("nopacity: Construktor needed %d ms", int(cTimeMs::Now()-start)); + int start = cTimeMs::Now(); + config.setDynamicValues(); + menuCategoryLast = mcUndefined; + menuSubCategory = mcSubUndefined; + menuSubCategoryLast = mcSubUndefined; + FrameTime = config.menuFrameTime; + FadeTime = config.menuFadeTime; + initial = true; + initMenu = true; + diskUsageDrawn = false; + timersDrawn = false; + lastDiskUsageState = -1; + lastTimersState = -1; + menuItemIndexLast = -1; + currentNumItems = 0; + menuHasIcons = true; + detailView = NULL; + contentNarrow = true; + contentNarrowLast = true; + menuView = new cNopacityDisplayMenuView(); + osd = menuView->createOsd(); + menuView->SetGeometry(); + menuView->CreatePixmaps(); + menuView->CreateFonts(); + menuView->SetAvrgFontWidth(); + menuView->CreateBackgroundImages(handleBackgrounds, handleButtons); + menuView->DrawHeaderLogo(); + menuView->DrawBorderDecoration(); + dsyslog("nopacity: Construktor needed %d ms", int(cTimeMs::Now()-start)); } cNopacityDisplayMenu::~cNopacityDisplayMenu() { - Cancel(-1); - while (Active()) - cCondWait::SleepMs(10); - delete menuView; - menuItems.Clear(); - if (detailView) { - delete detailView; - } - timers.Clear(); - for (int i=0; i<6; i++) - cOsdProvider::DropImage(handleBackgrounds[i]); - for (int i=0; i<4; i++) - cOsdProvider::DropImage(handleButtons[i]); + Cancel(-1); + while (Active()) + cCondWait::SleepMs(10); + delete menuView; + menuItems.Clear(); + if (detailView) { + delete detailView; + } + timers.Clear(); + for (int i=0; i<6; i++) + cOsdProvider::DropImage(handleBackgrounds[i]); + for (int i=0; i<4; i++) + cOsdProvider::DropImage(handleButtons[i]); - delete osd; + delete osd; } void cNopacityDisplayMenu::DrawDisk(void) { - if (initial || ((menuCategoryLast!=mcMain)&&(MenuCategory()==mcMain)&&!diskUsageDrawn)) { - if (cVideoDiskUsage::HasChanged(lastDiskUsageState)) { - menuView->DrawDiskUsage(); - } else { - menuView->ShowDiskUsage(true); - } - diskUsageDrawn = true; - } + if (initial || ((menuCategoryLast!=mcMain)&&(MenuCategory()==mcMain)&&!diskUsageDrawn)) { + if (cVideoDiskUsage::HasChanged(lastDiskUsageState)) { + menuView->DrawDiskUsage(); + } else { + menuView->ShowDiskUsage(true); + } + diskUsageDrawn = true; + } } void cNopacityDisplayMenu::DrawTimers(void) { - int maxTimersHeight = menuView->GetTimersMaxHeight(); - if (initial || ((menuCategoryLast!=mcMain)&&(MenuCategory()==mcMain)&&!timersDrawn)) { - if (Timers.Modified(lastTimersState)) { - timers.Clear(); - cSortedTimers SortedTimers; - int numTimers = SortedTimers.Size(); - int currentHeight = menuView->GetTimersInitHeight(); - for (int i = 0; i < numTimers; i++) { - if (const cTimer *Timer = SortedTimers[i]) { - cNopacityTimer *t = menuView->DrawTimer(Timer, currentHeight); - if (initial) - if (FadeTime) - t->SetAlpha(0); - currentHeight += t->pixmap->ViewPort().Height() + menuView->spaceMenu; - if (currentHeight < maxTimersHeight) { - timers.Add(t); - } else { - delete t; - break; - } - } - } - } else { - for (cNopacityTimer *t = timers.First(); t; t = timers.Next(t)) { - t->SetLayer(2); - } - } - timersDrawn = true; - } + int maxTimersHeight = menuView->GetTimersMaxHeight(); + if (initial || ((menuCategoryLast!=mcMain)&&(MenuCategory()==mcMain)&&!timersDrawn)) { + if (Timers.Modified(lastTimersState)) { + timers.Clear(); + cSortedTimers SortedTimers; + int numTimers = SortedTimers.Size(); + int currentHeight = menuView->GetTimersInitHeight(); + for (int i = 0; i < numTimers; i++) { + if (const cTimer *Timer = SortedTimers[i]) { + cNopacityTimer *t = menuView->DrawTimer(Timer, currentHeight); + if (initial) + if (FadeTime) + t->SetAlpha(0); + currentHeight += t->pixmap->ViewPort().Height() + menuView->spaceMenu; + if (currentHeight < maxTimersHeight) { + timers.Add(t); + } else { + delete t; + break; + } + } + } + } else { + for (cNopacityTimer *t = timers.First(); t; t = timers.Next(t)) { + t->SetLayer(2); + } + } + timersDrawn = true; + } } void cNopacityDisplayMenu::Scroll(bool Up, bool Page) { - bool scrolled; - scrolled = detailView->Scroll(Up, Page); - if (scrolled) { - double height = detailView->ScrollbarSize(); - double offset = detailView->Offset(); - menuView->DrawScrollbar(height, offset); - } + bool scrolled; + scrolled = detailView->Scroll(Up, Page); + if (scrolled) { + double height = detailView->ScrollbarSize(); + double offset = detailView->Offset(); + menuView->DrawScrollbar(height, offset); + } } int cNopacityDisplayMenu::MaxItems(void) { - int maxItems = 0; - if (((MenuCategory() == mcChannel) && (menuSubCategory == mcSubChannelEdit) && (menuSubCategoryLast != mcSubChannelEdit)) - || (menuSubCategory == mcSubScheduleTimer)){ - maxItems = config.numDefaultMenuItems; - } else { - maxItems = menuView->GetMaxItems(MenuCategory()); - } - currentNumItems = maxItems; - return maxItems; + int maxItems = 0; + if (((MenuCategory() == mcChannel) && (menuSubCategory == mcSubChannelEdit) && (menuSubCategoryLast != mcSubChannelEdit)) + || (menuSubCategory == mcSubScheduleTimer)){ + maxItems = config.numDefaultMenuItems; + } else { + maxItems = menuView->GetMaxItems(MenuCategory()); + } + currentNumItems = maxItems; + return maxItems; } void cNopacityDisplayMenu::Clear(void) { - if (detailView) { - delete detailView; - detailView = NULL; - } - menuItemIndexLast = -1; - initMenu = true; - menuItems.Clear(); + if (detailView) { + delete detailView; + detailView = NULL; + } + menuItemIndexLast = -1; + initMenu = true; + menuItems.Clear(); } void cNopacityDisplayMenu::SetMenuCategory(eMenuCategory MenuCategory) { - /* Categories: - mcUndefined = -1, - mcUnknown = 0, - mcMain = 1, - mcSchedule = 2, - mcChannel = 3, - mcTimer = 4, - mcRecording = 5, - mcPlugin = 6, - mcSetup = 7, - mcCommand = 8, - mcEvent = 9, - mcText = 10, - mcFolder = 11, - mcCam = 12 - */ - menuCategoryLast = this->MenuCategory(); - cSkinDisplayMenu::SetMenuCategory(MenuCategory); - if ((menuCategoryLast == mcMain) && (MenuCategory != mcMain)) { - menuView->ShowDiskUsage(false); - for (cNopacityTimer *t = timers.First(); t; t = timers.Next(t)) { - t->SetLayer(-1); - } - diskUsageDrawn = false; - timersDrawn = false; - } + /* Categories: + mcUndefined = -1, + mcUnknown = 0, + mcMain = 1, + mcSchedule = 2, + mcChannel = 3, + mcTimer = 4, + mcRecording = 5, + mcPlugin = 6, + mcSetup = 7, + mcCommand = 8, + mcEvent = 9, + mcText = 10, + mcFolder = 11, + mcCam = 12 + */ + menuCategoryLast = this->MenuCategory(); + cSkinDisplayMenu::SetMenuCategory(MenuCategory); + if ((menuCategoryLast == mcMain) && (MenuCategory != mcMain)) { + menuView->ShowDiskUsage(false); + for (cNopacityTimer *t = timers.First(); t; t = timers.Next(t)) { + t->SetLayer(-1); + } + diskUsageDrawn = false; + timersDrawn = false; + } } void cNopacityDisplayMenu::SetTitle(const char *Title) { - contentNarrowLast = contentNarrow; - menuSubCategoryLast = menuSubCategory; - int left = 5; - menuView->DestroyHeaderIcon(); - if (Title) { - cString title = Title; - if (MenuCategory() == mcMain) { - title = cString::sprintf("%s %s", Title, VDRVERSION); - left += menuView->ShowHeaderLogo(true); - contentNarrow = true; - menuHasIcons = true; - } else { - std::string strTitle = Title; - menuView->ShowHeaderLogo(false); - if (MenuCategory() == mcSchedule) { - //Main Schedule - if (startswith(Title, trVDR("Schedule"))) { - menuSubCategory = mcSubSchedule; - left += menuView->ShowHeaderIconChannelLogo(Title); - menuHasIcons = false; - contentNarrow = true; - //What's on now - } else if ( (strTitle.find(trVDR("Button$Now")) != std::string::npos) - || (strTitle.find(trVDR("What's on now?")) != std::string::npos) ) { - menuSubCategory = mcSubScheduleWhatsOnNow; - left += menuView->DrawHeaderIcon(mcSchedule); - menuHasIcons = true; - contentNarrow = true; - //What's on next - } else if ( (strTitle.find(trVDR("Button$Next")) != std::string::npos) - || (strTitle.find(trVDR("What's on next?")) != std::string::npos) ) { - menuSubCategory = mcSubScheduleWhatsOnNext; - left += menuView->DrawHeaderIcon(mcSchedule); - menuHasIcons = true; - contentNarrow = true; - //EPGSearch search results - } else if ((strTitle.length() > 0) && isdigit(strTitle.at(0))) { - menuSubCategory = mcSubScheduleSearchResults; - left += menuView->DrawHeaderIcon(mcSchedule); - menuHasIcons = true; - contentNarrow = true; - //What's on else - } else if ( ((config.epgSearchConf->UserSet[0]) && (strTitle.find(config.epgSearchConf->User[0]) != std::string::npos)) - ||((config.epgSearchConf->UserSet[1]) && (strTitle.find(config.epgSearchConf->User[1]) != std::string::npos)) - ||((config.epgSearchConf->UserSet[2]) && (strTitle.find(config.epgSearchConf->User[2]) != std::string::npos)) - ||((config.epgSearchConf->UserSet[3]) && (strTitle.find(config.epgSearchConf->User[3]) != std::string::npos))) - { - menuSubCategory = mcSubScheduleWhatsOnElse; - left += menuView->DrawHeaderIcon(mcSchedule); - menuHasIcons = true; - contentNarrow = true; - //hack for epgsearch timer conflict view - } else if (endswith(Title, "%")) { - menuSubCategory = mcSubScheduleTimer; - menuHasIcons = false; - contentNarrow = false; - currentNumItems = config.numDefaultMenuItems; - //EPGSearch Favorites - } else if (strTitle.find(":") != std::string::npos) { - menuSubCategory = mcSubScheduleFavorites; - left += menuView->DrawHeaderIcon(mcSchedule); - menuHasIcons = true; - contentNarrow = true; - - } else { - menuSubCategory = mcSubScheduleTimerconflict; - left += menuView->DrawHeaderIcon(mcSchedule); - menuHasIcons = true; - contentNarrow = true; - } - } else if (MenuCategory() == mcChannel) { - left += menuView->DrawHeaderIcon(mcChannel); - if (startswith(Title, trVDR("Channels"))) { - contentNarrow = true; - menuSubCategory = mcSubChannels; - menuHasIcons = true; - } else { - contentNarrow = false; - menuSubCategory = mcSubChannelEdit; - menuHasIcons = false; - } - } else { - left += menuView->DrawHeaderIcon(MenuCategory()); - contentNarrow = false; - menuHasIcons = false; - } - } - menuView->AdjustContentBackground(contentNarrow, contentNarrowLast); - menuView->DrawHeaderLabel(left, title); - } + contentNarrowLast = contentNarrow; + menuSubCategoryLast = menuSubCategory; + int left = 5; + menuView->DestroyHeaderIcon(); + if (Title) { + cString title = Title; + if (MenuCategory() == mcMain) { + title = cString::sprintf("%s %s", Title, VDRVERSION); + left += menuView->ShowHeaderLogo(true); + contentNarrow = true; + menuHasIcons = true; + } else { + std::string strTitle = Title; + menuView->ShowHeaderLogo(false); + if (MenuCategory() == mcSchedule) { + //Main Schedule + if (startswith(Title, trVDR("Schedule"))) { + menuSubCategory = mcSubSchedule; + left += menuView->ShowHeaderIconChannelLogo(Title); + menuHasIcons = false; + contentNarrow = true; + //What's on now + } else if ( (strTitle.find(trVDR("Button$Now")) != std::string::npos) + || (strTitle.find(trVDR("What's on now?")) != std::string::npos) ) { + menuSubCategory = mcSubScheduleWhatsOnNow; + left += menuView->DrawHeaderIcon(mcSchedule); + menuHasIcons = true; + contentNarrow = true; + //What's on next + } else if ( (strTitle.find(trVDR("Button$Next")) != std::string::npos) + || (strTitle.find(trVDR("What's on next?")) != std::string::npos) ) { + menuSubCategory = mcSubScheduleWhatsOnNext; + left += menuView->DrawHeaderIcon(mcSchedule); + menuHasIcons = true; + contentNarrow = true; + //EPGSearch search results + } else if ((strTitle.length() > 0) && isdigit(strTitle.at(0))) { + menuSubCategory = mcSubScheduleSearchResults; + left += menuView->DrawHeaderIcon(mcSchedule); + menuHasIcons = true; + contentNarrow = true; + //What's on else + } else if ( ((config.epgSearchConf->UserSet[0]) && (strTitle.find(config.epgSearchConf->User[0]) != std::string::npos)) + ||((config.epgSearchConf->UserSet[1]) && (strTitle.find(config.epgSearchConf->User[1]) != std::string::npos)) + ||((config.epgSearchConf->UserSet[2]) && (strTitle.find(config.epgSearchConf->User[2]) != std::string::npos)) + ||((config.epgSearchConf->UserSet[3]) && (strTitle.find(config.epgSearchConf->User[3]) != std::string::npos))) + { + menuSubCategory = mcSubScheduleWhatsOnElse; + left += menuView->DrawHeaderIcon(mcSchedule); + menuHasIcons = true; + contentNarrow = true; + //hack for epgsearch timer conflict view + } else if (endswith(Title, "%")) { + menuSubCategory = mcSubScheduleTimer; + menuHasIcons = false; + contentNarrow = false; + currentNumItems = config.numDefaultMenuItems; + //EPGSearch Favorites + } else if (strTitle.find(":") != std::string::npos) { + menuSubCategory = mcSubScheduleFavorites; + left += menuView->DrawHeaderIcon(mcSchedule); + menuHasIcons = true; + contentNarrow = true; + + } else { + menuSubCategory = mcSubScheduleTimerconflict; + left += menuView->DrawHeaderIcon(mcSchedule); + menuHasIcons = true; + contentNarrow = true; + } + } else if (MenuCategory() == mcChannel) { + left += menuView->DrawHeaderIcon(mcChannel); + if (startswith(Title, trVDR("Channels"))) { + contentNarrow = true; + menuSubCategory = mcSubChannels; + menuHasIcons = true; + } else { + contentNarrow = false; + menuSubCategory = mcSubChannelEdit; + menuHasIcons = false; + } + } else { + left += menuView->DrawHeaderIcon(MenuCategory()); + contentNarrow = false; + menuHasIcons = false; + } + } + menuView->AdjustContentBackground(contentNarrow, contentNarrowLast); + menuView->DrawHeaderLabel(left, title); + } } void cNopacityDisplayMenu::SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue) { - tColor lutBg[] = { Theme.Color(clrButtonRedBorder), Theme.Color(clrButtonGreenBorder), Theme.Color(clrButtonYellowBorder), Theme.Color(clrButtonBlueBorder) }; - if (Red) { - menuView->DrawButton(Red, handleButtons[0], lutBg[Setup.ColorKey0], 0); - } else - menuView->ClearButton(0); - - if (Green) { - menuView->DrawButton(Green, handleButtons[1], lutBg[Setup.ColorKey1], 1); - } else - menuView->ClearButton(1); - - if (Yellow) { - menuView->DrawButton(Yellow, handleButtons[2], lutBg[Setup.ColorKey2], 2); - } else - menuView->ClearButton(2); - - if (Blue) { - menuView->DrawButton(Blue, handleButtons[3], lutBg[Setup.ColorKey3], 3); - } else - menuView->ClearButton(3); + tColor lutBg[] = { Theme.Color(clrButtonRedBorder), Theme.Color(clrButtonGreenBorder), Theme.Color(clrButtonYellowBorder), Theme.Color(clrButtonBlueBorder) }; + if (Red) { + menuView->DrawButton(Red, handleButtons[0], lutBg[Setup.ColorKey0], 0); + } else + menuView->ClearButton(0); + + if (Green) { + menuView->DrawButton(Green, handleButtons[1], lutBg[Setup.ColorKey1], 1); + } else + menuView->ClearButton(1); + + if (Yellow) { + menuView->DrawButton(Yellow, handleButtons[2], lutBg[Setup.ColorKey2], 2); + } else + menuView->ClearButton(2); + + if (Blue) { + menuView->DrawButton(Blue, handleButtons[3], lutBg[Setup.ColorKey3], 3); + } else + menuView->ClearButton(3); } void cNopacityDisplayMenu::SetMessage(eMessageType Type, const char *Text) { - if (Text) { - menuView->DrawMessage(Type, Text); + if (Text) { + menuView->DrawMessage(Type, Text); } else { - menuView->ClearMessage(); - } + menuView->ClearMessage(); + } } void cNopacityDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool Selectable) { - int menuIconWidth = 0; - int menuIconHeight = 0; - cString *strItems = new cString[MaxTabs]; - int *tabItems = new int[2*MaxTabs]; - for (int i=0; i<MaxTabs; i++) { - strItems[i] = ""; - tabItems[i] = 0; - tabItems[i+MaxTabs] = 0; - } - SplitItem(Text, strItems, tabItems); - if (initMenu) { - if (Index > menuItemIndexLast) { - cNopacityMenuItem *item; - cPoint itemSize; - if (MenuCategory() == mcMain) { - item = new cNopacityMainMenuItem(osd, Text, Selectable); - menuView->GetMenuItemSize(mcMain, &itemSize); - item->SetFont(menuView->GetMenuItemFont(mcMain)); - menuIconWidth = menuIconHeight = config.iconHeight; - } else if (MenuCategory() == mcSchedule) { - if (menuSubCategory == mcSubScheduleTimer) { - item = new cNopacityDefaultMenuItem(osd, Text, Selectable); - menuView->GetMenuItemSize(mcUnknown, &itemSize); - item->SetFont(menuView->GetMenuItemFont(mcUnknown)); - } else { - item = new cNopacityScheduleMenuItem(osd, Text, Selectable, menuSubCategory); - menuView->GetMenuItemSize(mcSchedule, &itemSize); - item->SetFont(menuView->GetMenuItemFont(mcSchedule)); - item->SetFontSmall(menuView->GetMenuItemFontSmall()); - item->SetDisplayMode(); - menuIconWidth = config.menuItemLogoWidth; - menuIconHeight = config.menuItemLogoHeight; - } - } else if (MenuCategory() == mcChannel) { - if (menuSubCategory == mcSubChannels) { - item = new cNopacityChannelMenuItem(osd, Text, Selectable); - menuView->GetMenuItemSize(mcChannel, &itemSize); - item->SetFont(menuView->GetMenuItemFont(mcChannel)); - menuIconWidth = config.menuItemLogoWidth; - menuIconHeight = config.menuItemLogoHeight; - } else { - item = new cNopacityDefaultMenuItem(osd, Text, Selectable); - menuView->GetMenuItemSize(mcUnknown, &itemSize); - item->SetFont(menuView->GetMenuItemFont(mcUnknown)); - } - } else { - item = new cNopacityDefaultMenuItem(osd, Text, Selectable); - menuView->GetMenuItemSize(mcUnknown, &itemSize); - item->SetFont(menuView->GetMenuItemFont(mcUnknown)); - } - int spaceTop = menuView->GetMenuTop(currentNumItems, itemSize.Y()); - item->SetGeometry(Index, spaceTop, menuView->spaceMenu, itemSize.X(), itemSize.Y()); - item->SetCurrent(Current); - item->SetBackgrounds(handleBackgrounds); - item->SetTabs(strItems, tabItems, MaxTabs); - item->CreateText(); - int textWidth = item->CheckScrollable(menuHasIcons); - item->CreatePixmap(); - if (menuHasIcons) - item->CreatePixmapIcon(menuIconWidth, menuIconHeight); - if (textWidth > 0) - item->CreatePixmapTextScroller(textWidth); - menuItems.Add(item); - item->Render(); - menuItemIndexLast = Index; - if (initial) { - if (FadeTime) { - item->SetAlpha(0); - item->SetAlphaIcon(0); - item->SetAlphaText(0); - } - } - } else { - //adjust Current if item was added twice - cNopacityMenuItem *item = menuItems.Get(Index); - item->SetCurrent(Current); - item->Render(); - } - } else { - //redraw item when switching through menu - cNopacityMenuItem *item = menuItems.Get(Index); - item->SetTabs(strItems, tabItems, MaxTabs); - item->SetCurrent(Current); - item->Render(); - } - SetEditableWidth(menuView->GetEditableWidth()); + int menuIconWidth = 0; + int menuIconHeight = 0; + cString *strItems = new cString[MaxTabs]; + int *tabItems = new int[2*MaxTabs]; + for (int i=0; i<MaxTabs; i++) { + strItems[i] = ""; + tabItems[i] = 0; + tabItems[i+MaxTabs] = 0; + } + SplitItem(Text, strItems, tabItems); + if (initMenu) { + if (Index > menuItemIndexLast) { + cNopacityMenuItem *item; + cPoint itemSize; + if (MenuCategory() == mcMain) { + item = new cNopacityMainMenuItem(osd, Text, Selectable); + menuView->GetMenuItemSize(mcMain, &itemSize); + item->SetFont(menuView->GetMenuItemFont(mcMain)); + menuIconWidth = menuIconHeight = config.iconHeight; + } else if (MenuCategory() == mcSchedule) { + if (menuSubCategory == mcSubScheduleTimer) { + item = new cNopacityDefaultMenuItem(osd, Text, Selectable); + menuView->GetMenuItemSize(mcUnknown, &itemSize); + item->SetFont(menuView->GetMenuItemFont(mcUnknown)); + } else { + item = new cNopacityScheduleMenuItem(osd, Text, Selectable, menuSubCategory); + menuView->GetMenuItemSize(mcSchedule, &itemSize); + item->SetFont(menuView->GetMenuItemFont(mcSchedule)); + item->SetFontSmall(menuView->GetMenuItemFontSmall()); + item->SetDisplayMode(); + menuIconWidth = config.menuItemLogoWidth; + menuIconHeight = config.menuItemLogoHeight; + } + } else if (MenuCategory() == mcChannel) { + if (menuSubCategory == mcSubChannels) { + item = new cNopacityChannelMenuItem(osd, Text, Selectable); + menuView->GetMenuItemSize(mcChannel, &itemSize); + item->SetFont(menuView->GetMenuItemFont(mcChannel)); + menuIconWidth = config.menuItemLogoWidth; + menuIconHeight = config.menuItemLogoHeight; + } else { + item = new cNopacityDefaultMenuItem(osd, Text, Selectable); + menuView->GetMenuItemSize(mcUnknown, &itemSize); + item->SetFont(menuView->GetMenuItemFont(mcUnknown)); + } + } else { + item = new cNopacityDefaultMenuItem(osd, Text, Selectable); + menuView->GetMenuItemSize(mcUnknown, &itemSize); + item->SetFont(menuView->GetMenuItemFont(mcUnknown)); + } + int spaceTop = menuView->GetMenuTop(currentNumItems, itemSize.Y()); + item->SetGeometry(Index, spaceTop, menuView->spaceMenu, itemSize.X(), itemSize.Y()); + item->SetCurrent(Current); + item->SetBackgrounds(handleBackgrounds); + item->SetTabs(strItems, tabItems, MaxTabs); + item->CreateText(); + int textWidth = item->CheckScrollable(menuHasIcons); + item->CreatePixmap(); + if (menuHasIcons) + item->CreatePixmapIcon(menuIconWidth, menuIconHeight); + if (textWidth > 0) + item->CreatePixmapTextScroller(textWidth); + menuItems.Add(item); + item->Render(); + menuItemIndexLast = Index; + if (initial) { + if (FadeTime) { + item->SetAlpha(0); + item->SetAlphaIcon(0); + item->SetAlphaText(0); + } + } + } else { + //adjust Current if item was added twice + cNopacityMenuItem *item = menuItems.Get(Index); + item->SetCurrent(Current); + item->Render(); + } + } else { + //redraw item when switching through menu + cNopacityMenuItem *item = menuItems.Get(Index); + item->SetTabs(strItems, tabItems, MaxTabs); + item->SetCurrent(Current); + item->Render(); + } + SetEditableWidth(menuView->GetEditableWidth()); } void cNopacityDisplayMenu::SplitItem(const char *Text, cString *strItems, int *tabItems) { - int x = 0; - for (int i = 0; i < MaxTabs; i++) { - const char *s = GetTabbedText(Text, i); - if (s) { - strItems[i] = s; + int x = 0; + for (int i = 0; i < MaxTabs; i++) { + const char *s = GetTabbedText(Text, i); + if (s) { + strItems[i] = s; + } + tabItems[i] = Tab(i); + if (i>0) { + tabItems[(i-1) + MaxTabs] = Tab(i) - x; + x += Tab(i) - x; } - tabItems[i] = Tab(i); - if (i>0) { - tabItems[(i-1) + MaxTabs] = Tab(i) - x; - x += Tab(i) - x; - } - if (!Tab(i + 1)) { - if (s) - tabItems[i + MaxTabs] = menuView->GetWidthDefaultMenu() - x; - else if (i==1) { - tabItems[MaxTabs] = menuView->GetWidthDefaultMenu() - 1; - tabItems[1] = 0; - tabItems[MaxTabs+1] = 0; - } - break; - } - } + if (!Tab(i + 1)) { + if (s) + tabItems[i + MaxTabs] = menuView->GetWidthDefaultMenu() - x; + else if (i==1) { + tabItems[MaxTabs] = menuView->GetWidthDefaultMenu() - 1; + tabItems[1] = 0; + tabItems[MaxTabs+1] = 0; + } + break; + } + } } int cNopacityDisplayMenu::Tab(int n) { - return (n >= 0 && n < MaxTabs) ? menuView->mytabs[n] : 0; + return (n >= 0 && n < MaxTabs) ? menuView->mytabs[n] : 0; } void cNopacityDisplayMenu::SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, int Tab5) { - menuView->SetTabs(Tab1, Tab2, Tab3, Tab4, Tab5); + menuView->SetTabs(Tab1, Tab2, Tab3, Tab4, Tab5); } int cNopacityDisplayMenu::GetTextAreaWidth(void) const { - return menuView->GetTextAreaWidth(); + return menuView->GetTextAreaWidth(); } const cFont *cNopacityDisplayMenu::GetTextAreaFont(bool FixedFont) const { - return menuView->GetTextAreaFont(FixedFont); + return menuView->GetTextAreaFont(FixedFont); } void cNopacityDisplayMenu::SetScrollbar(int Total, int Offset) { - if (MaxItems() >= Total) { - menuView->ClearScrollbar(); - return; - } - double height = (double)MaxItems()/(double)Total; - double offset = (double)Offset/(double)Total; - - menuView->DrawScrollbar(height, offset); + if (MaxItems() >= Total) { + menuView->ClearScrollbar(); + return; + } + double height = (double)MaxItems()/(double)Total; + double offset = (double)Offset/(double)Total; + + menuView->DrawScrollbar(height, offset); } void cNopacityDisplayMenu::SetEvent(const cEvent *Event) { - if (!Event) - return; - menuView->AdjustContentBackground(false, contentNarrowLast); - detailView = new cNopacityMenuDetailEventView(osd, Event); - menuView->SetDetailViewSize(dvEvent, detailView); - detailView->SetFonts(); - if (config.displayRerunsDetailEPGView) - detailView->LoadReruns(Event); - detailView->SetContent(Event->Description()); - detailView->CreatePixmaps(); - detailView->Render(); - if (detailView->Scrollable()) { - double height = detailView->ScrollbarSize(); - double offset = 0.0; - menuView->DrawScrollbar(height, offset); - } + if (!Event) + return; + menuView->AdjustContentBackground(false, contentNarrowLast); + detailView = new cNopacityMenuDetailEventView(osd, Event); + menuView->SetDetailViewSize(dvEvent, detailView); + detailView->SetFonts(); + if (config.displayRerunsDetailEPGView) + detailView->LoadReruns(Event); + detailView->SetContent(Event->Description()); + detailView->CreatePixmaps(); + detailView->Render(); + if (detailView->Scrollable()) { + double height = detailView->ScrollbarSize(); + double offset = 0.0; + menuView->DrawScrollbar(height, offset); + } } void cNopacityDisplayMenu::SetRecording(const cRecording *Recording) { - if (!Recording) - return; - menuView->AdjustContentBackground(false, contentNarrowLast); - detailView = new cNopacityMenuDetailRecordingView(osd, Recording); - menuView->SetDetailViewSize(dvRecording, detailView); - detailView->SetFonts(); - detailView->SetContent(Recording->Info()->Description()); - detailView->CreatePixmaps(); - detailView->Render(); - if (detailView->Scrollable()) { - double height = detailView->ScrollbarSize(); - double offset = 0.0; - menuView->DrawScrollbar(height, offset); - } + if (!Recording) + return; + menuView->AdjustContentBackground(false, contentNarrowLast); + detailView = new cNopacityMenuDetailRecordingView(osd, Recording); + menuView->SetDetailViewSize(dvRecording, detailView); + detailView->SetFonts(); + detailView->SetContent(Recording->Info()->Description()); + detailView->CreatePixmaps(); + detailView->Render(); + if (detailView->Scrollable()) { + double height = detailView->ScrollbarSize(); + double offset = 0.0; + menuView->DrawScrollbar(height, offset); + } } void cNopacityDisplayMenu::SetText(const char *Text, bool FixedFont) { - if (!Text) - return; - menuView->AdjustContentBackground(false, contentNarrowLast); - detailView = new cNopacityMenuDetailTextView(osd); - menuView->SetDetailViewSize(dvText, detailView); - detailView->SetFonts(); - detailView->SetContent(Text); - detailView->CreatePixmaps(); - detailView->Render(); - if (detailView->Scrollable()) { - double height = detailView->ScrollbarSize(); - double offset = 0.0; - menuView->DrawScrollbar(height, offset); - } + if (!Text) + return; + menuView->AdjustContentBackground(false, contentNarrowLast); + detailView = new cNopacityMenuDetailTextView(osd); + menuView->SetDetailViewSize(dvText, detailView); + detailView->SetFonts(); + detailView->SetContent(Text); + detailView->CreatePixmaps(); + detailView->Render(); + if (detailView->Scrollable()) { + double height = detailView->ScrollbarSize(); + double offset = 0.0; + menuView->DrawScrollbar(height, offset); + } } void cNopacityDisplayMenu::Flush(void) { - menuView->DrawDate(initial); - if (MenuCategory() == mcMain) { - DrawDisk(); - DrawTimers(); - } - if (initial) { - if (config.menuFadeTime) - Start(); - } - initMenu = false; - initial = false; - osd->Flush(); + menuView->DrawDate(initial); + if (MenuCategory() == mcMain) { + DrawDisk(); + DrawTimers(); + } + if (initial) { + if (config.menuFadeTime) + Start(); + } + initMenu = false; + initial = false; + osd->Flush(); } void cNopacityDisplayMenu::Action(void) { - uint64_t Start = cTimeMs::Now(); - while (Running()) { - uint64_t Now = cTimeMs::Now(); - cPixmap::Lock(); - double t = min(double(Now - Start) / FadeTime, 1.0); - int Alpha = t * ALPHA_OPAQUE; - menuView->SetPixmapAlpha(Alpha); - for (cNopacityMenuItem *item = menuItems.First(); Running() && item; item = menuItems.Next(item)) { - item->SetAlpha(Alpha); - item->SetAlphaIcon(Alpha); - item->SetAlphaText(Alpha); - } - for (cNopacityTimer *t = timers.First(); Running() && t; t = timers.Next(t)) - t->SetAlpha(Alpha); - if (Running()) - osd->Flush(); - cPixmap::Unlock(); - int Delta = cTimeMs::Now() - Now; - if (Running() && (Delta < FrameTime)) - cCondWait::SleepMs(FrameTime - Delta); - if ((int)(Now - Start) > FadeTime) - break; - } + uint64_t Start = cTimeMs::Now(); + while (Running()) { + uint64_t Now = cTimeMs::Now(); + cPixmap::Lock(); + double t = min(double(Now - Start) / FadeTime, 1.0); + int Alpha = t * ALPHA_OPAQUE; + menuView->SetPixmapAlpha(Alpha); + for (cNopacityMenuItem *item = menuItems.First(); Running() && item; item = menuItems.Next(item)) { + item->SetAlpha(Alpha); + item->SetAlphaIcon(Alpha); + item->SetAlphaText(Alpha); + } + for (cNopacityTimer *t = timers.First(); Running() && t; t = timers.Next(t)) + t->SetAlpha(Alpha); + if (Running()) + osd->Flush(); + cPixmap::Unlock(); + int Delta = cTimeMs::Now() - Now; + if (Running() && (Delta < FrameTime)) + cCondWait::SleepMs(FrameTime - Delta); + if ((int)(Now - Start) > FadeTime) + break; + } } diff --git a/displaymenu.h b/displaymenu.h index 002f3a1..72ada46 100644 --- a/displaymenu.h +++ b/displaymenu.h @@ -3,53 +3,53 @@ class cNopacityDisplayMenu : public cSkinDisplayMenu , cThread { private: - cNopacityDisplayMenuView *menuView; - cNopacityMenuDetailView *detailView; - cOsd *osd; - eMenuCategory menuCategoryLast; - eMenuSubCategory menuSubCategory; - eMenuSubCategory menuSubCategoryLast; - int FrameTime; - int FadeTime; - bool initial; - bool initMenu; - bool diskUsageDrawn; - int lastDiskUsageState; - int lastTimersState; - bool timersDrawn; - int menuItemIndexLast; - int currentNumItems; - bool menuHasIcons; - bool contentNarrow, contentNarrowLast; - cList<cNopacityTimer> timers; - cList<cNopacityMenuItem> menuItems; - int handleBackgrounds[6]; - int handleButtons[4]; - void DrawDisk(void); - void DrawTimers(void); - void SplitItem(const char *Text, cString *strItems, int *tabItems); - virtual void Action(void); + cNopacityDisplayMenuView *menuView; + cNopacityMenuDetailView *detailView; + cOsd *osd; + eMenuCategory menuCategoryLast; + eMenuSubCategory menuSubCategory; + eMenuSubCategory menuSubCategoryLast; + int FrameTime; + int FadeTime; + bool initial; + bool initMenu; + bool diskUsageDrawn; + int lastDiskUsageState; + int lastTimersState; + bool timersDrawn; + int menuItemIndexLast; + int currentNumItems; + bool menuHasIcons; + bool contentNarrow, contentNarrowLast; + cList<cNopacityTimer> timers; + cList<cNopacityMenuItem> menuItems; + int handleBackgrounds[6]; + int handleButtons[4]; + void DrawDisk(void); + void DrawTimers(void); + void SplitItem(const char *Text, cString *strItems, int *tabItems); + virtual void Action(void); protected: - int Tab(int n); + int Tab(int n); public: - cNopacityDisplayMenu(void); - virtual ~cNopacityDisplayMenu(); - virtual void Scroll(bool Up, bool Page); - virtual int MaxItems(void); - virtual void Clear(void); - virtual void SetMenuCategory(eMenuCategory MenuCategory); - virtual void SetTitle(const char *Title); - virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL); - virtual void SetMessage(eMessageType Type, const char *Text); - virtual void SetItem(const char *Text, int Index, bool Current, bool Selectable); - virtual void SetScrollbar(int Total, int Offset); - virtual void SetEvent(const cEvent *Event); - virtual void SetRecording(const cRecording *Recording); - virtual void SetText(const char *Text, bool FixedFont); - virtual void Flush(void); - virtual void SetTabs(int Tab1, int Tab2 = 0, int Tab3 = 0, int Tab4 = 0, int Tab5 = 0); - virtual int GetTextAreaWidth(void) const; - virtual const cFont *GetTextAreaFont(bool FixedFont) const; + cNopacityDisplayMenu(void); + virtual ~cNopacityDisplayMenu(); + virtual void Scroll(bool Up, bool Page); + virtual int MaxItems(void); + virtual void Clear(void); + virtual void SetMenuCategory(eMenuCategory MenuCategory); + virtual void SetTitle(const char *Title); + virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL); + virtual void SetMessage(eMessageType Type, const char *Text); + virtual void SetItem(const char *Text, int Index, bool Current, bool Selectable); + virtual void SetScrollbar(int Total, int Offset); + virtual void SetEvent(const cEvent *Event); + virtual void SetRecording(const cRecording *Recording); + virtual void SetText(const char *Text, bool FixedFont); + virtual void Flush(void); + virtual void SetTabs(int Tab1, int Tab2 = 0, int Tab3 = 0, int Tab4 = 0, int Tab5 = 0); + virtual int GetTextAreaWidth(void) const; + virtual const cFont *GetTextAreaFont(bool FixedFont) const; }; #endif //__NOPACITY_DISPLAYMENU_H
\ No newline at end of file diff --git a/displaymenuview.c b/displaymenuview.c index 95965e8..fff3abf 100644 --- a/displaymenuview.c +++ b/displaymenuview.c @@ -1,635 +1,635 @@ #include "displaymenuview.h" cNopacityTimer::cNopacityTimer(cOsd *osd) { - this->osd = osd; + this->osd = osd; } cNopacityTimer::~cNopacityTimer(void) { - osd->DestroyPixmap(pixmap); + osd->DestroyPixmap(pixmap); } cNopacityDisplayMenuView::cNopacityDisplayMenuView() { - diskUsageAlert = 95; - pixmapStatus = NULL; - pixmapHeaderIcon = NULL; + diskUsageAlert = 95; + pixmapStatus = NULL; + pixmapHeaderIcon = NULL; } cNopacityDisplayMenuView::~cNopacityDisplayMenuView(void) { - osd->DestroyPixmap(pixmapHeader); - osd->DestroyPixmap(pixmapHeaderLogo); - osd->DestroyPixmap(pixmapHeaderLabel); - osd->DestroyPixmap(pixmapDate); - osd->DestroyPixmap(pixmapFooter); - osd->DestroyPixmap(pixmapContent); - osd->DestroyPixmap(pixmapScrollbar); - osd->DestroyPixmap(pixmapDiskUsage); - osd->DestroyPixmap(pixmapDiskUsageIcon); - osd->DestroyPixmap(pixmapDiskUsageLabel); - if (pixmapHeaderIcon) - osd->DestroyPixmap(pixmapHeaderIcon); - - delete fontHeader; - delete fontDate; - delete fontMenuitemLarge; - delete fontMenuitemSchedule; - delete fontMenuitemScheduleSmall; - delete fontMenuitemDefault; - delete fontDiskUsage; - delete fontTimers; - delete fontTimersHead; - delete fontButtons; - delete fontMessage; + osd->DestroyPixmap(pixmapHeader); + osd->DestroyPixmap(pixmapHeaderLogo); + osd->DestroyPixmap(pixmapHeaderLabel); + osd->DestroyPixmap(pixmapDate); + osd->DestroyPixmap(pixmapFooter); + osd->DestroyPixmap(pixmapContent); + osd->DestroyPixmap(pixmapScrollbar); + osd->DestroyPixmap(pixmapDiskUsage); + osd->DestroyPixmap(pixmapDiskUsageIcon); + osd->DestroyPixmap(pixmapDiskUsageLabel); + if (pixmapHeaderIcon) + osd->DestroyPixmap(pixmapHeaderIcon); + + delete fontHeader; + delete fontDate; + delete fontMenuitemLarge; + delete fontMenuitemSchedule; + delete fontMenuitemScheduleSmall; + delete fontMenuitemDefault; + delete fontDiskUsage; + delete fontTimers; + delete fontTimersHead; + delete fontButtons; + delete fontMessage; #ifdef USE_YAEPG - if (config.scalePicture) { - tArea availableArea; - availableArea.x1 = -osdLeft; - availableArea.y1 = -osdTop; - availableArea.x2 = osdWidth + osdLeft; - availableArea.y2 = osdHeight + osdTop; - ScalePreserveAspect(osd->vidWin, vidAspect, availableArea); - osd->vidWin.bpp = 12; - } + if (config.scalePicture) { + tArea availableArea; + availableArea.x1 = -osdLeft; + availableArea.y1 = -osdTop; + availableArea.x2 = osdWidth + osdLeft; + availableArea.y2 = osdHeight + osdTop; + ScalePreserveAspect(osd->vidWin, vidAspect, availableArea); + osd->vidWin.bpp = 12; + } #endif } cOsd *cNopacityDisplayMenuView::createOsd(void) { - osdLeft = cOsd::OsdLeft(); - osdTop = cOsd::OsdTop(); - osdWidth = cOsd::OsdWidth(); - osdHeight = cOsd::OsdHeight(); - osd = CreateOsd(osdLeft, osdTop, osdWidth, osdHeight); - cDevice::PrimaryDevice()->GetVideoSize(vidWidth, vidHeight, vidAspect); - return osd; + osdLeft = cOsd::OsdLeft(); + osdTop = cOsd::OsdTop(); + osdWidth = cOsd::OsdWidth(); + osdHeight = cOsd::OsdHeight(); + osd = CreateOsd(osdLeft, osdTop, osdWidth, osdHeight); + cDevice::PrimaryDevice()->GetVideoSize(vidWidth, vidHeight, vidAspect); + return osd; } void cNopacityDisplayMenuView::SetGeometry(void) { - spaceMenu = 5; - widthScrollbar = 20; - dateWidth = osdWidth * 0.3; - headerHeight = osdHeight * config.headerHeight / 100; - footerHeight = osdHeight * config.footerHeight / 100; - contentHeight = osdHeight - headerHeight - footerHeight; - contentWidthNarrow = osdWidth * config.menuWidthNarrow / 100; - contentWidthFull = osdWidth - widthScrollbar - spaceMenu; - menuItemWidthDefault = contentWidthFull - 4 * spaceMenu; - menuItemWidthMain = contentWidthNarrow - 4*spaceMenu; - menuItemHeightMain = config.iconHeight + 2; - menuItemHeightSchedule = config.menuItemLogoHeight + 2; - menuItemHeightDefault = contentHeight / config.numDefaultMenuItems - spaceMenu; - diskUsageWidth = diskUsageHeight = timersWidth = osdWidth * config.menuWidthRightItems / 100; - buttonsBorder = 10; - buttonWidth = (osdWidth / 4) - 2 * buttonsBorder; - buttonHeight = footerHeight - 3 * buttonsBorder; - messageWidth = 0.8 * osdWidth; - messageHeight = 0.1 * osdHeight; + spaceMenu = 5; + widthScrollbar = 20; + dateWidth = osdWidth * 0.3; + headerHeight = osdHeight * config.headerHeight / 100; + footerHeight = osdHeight * config.footerHeight / 100; + contentHeight = osdHeight - headerHeight - footerHeight; + contentWidthNarrow = osdWidth * config.menuWidthNarrow / 100; + contentWidthFull = osdWidth - widthScrollbar - spaceMenu; + menuItemWidthDefault = contentWidthFull - 4 * spaceMenu; + menuItemWidthMain = contentWidthNarrow - 4*spaceMenu; + menuItemHeightMain = config.iconHeight + 2; + menuItemHeightSchedule = config.menuItemLogoHeight + 2; + menuItemHeightDefault = contentHeight / config.numDefaultMenuItems - spaceMenu; + diskUsageWidth = diskUsageHeight = timersWidth = osdWidth * config.menuWidthRightItems / 100; + buttonsBorder = 10; + buttonWidth = (osdWidth / 4) - 2 * buttonsBorder; + buttonHeight = footerHeight - 3 * buttonsBorder; + messageWidth = 0.8 * osdWidth; + messageHeight = 0.1 * osdHeight; } void cNopacityDisplayMenuView::CreatePixmaps(void) { - pixmapHeader = osd->CreatePixmap(1, cRect(0, 0, osdWidth, headerHeight)); - pixmapHeaderLogo = osd->CreatePixmap(-1, cRect(0, 0, config.menuHeaderLogoWidth, config.menuHeaderLogoHeight)); - pixmapHeaderLabel = osd->CreatePixmap(2, cRect(0, 0, osdWidth - dateWidth, headerHeight)); - pixmapDate = osd->CreatePixmap(2, cRect(osdWidth - dateWidth, 0, dateWidth, headerHeight)); - pixmapFooter = osd->CreatePixmap(1, cRect(0, osdHeight-footerHeight, osdWidth, footerHeight)); - pixmapContent = osd->CreatePixmap(1, cRect(0, headerHeight, osdWidth, contentHeight), - cRect(0, 0, osdWidth + contentWidthFull - contentWidthNarrow, contentHeight)); - pixmapScrollbar = osd->CreatePixmap(2, cRect(contentWidthNarrow, headerHeight + spaceMenu, widthScrollbar, contentHeight - 2 * spaceMenu)); - pixmapDiskUsage = osd->CreatePixmap(2, cRect(osdWidth - diskUsageWidth - 10, headerHeight + spaceMenu, diskUsageWidth, diskUsageHeight)); - pixmapDiskUsageIcon = osd->CreatePixmap(3, cRect((osdWidth - diskUsageWidth - 10) + (diskUsageWidth)/8, headerHeight, diskUsageWidth*3/4, diskUsageWidth*3/4)); - pixmapDiskUsageLabel = osd->CreatePixmap(3, cRect(osdWidth - diskUsageWidth - 10, headerHeight + spaceMenu, diskUsageWidth, diskUsageHeight)); - pixmapHeaderLogo->Fill(clrTransparent); - pixmapHeaderLabel->Fill(clrTransparent); - pixmapDiskUsage->Fill(clrTransparent); - pixmapDiskUsageIcon->Fill(clrTransparent); - pixmapDiskUsageLabel->Fill(clrTransparent); - if (config.menuFadeTime) { - pixmapHeader->SetAlpha(0); - pixmapHeaderLogo->SetAlpha(0); - pixmapHeaderLabel->SetAlpha(0); - pixmapDate->SetAlpha(0); - pixmapFooter->SetAlpha(0); - pixmapContent->SetAlpha(0); - pixmapScrollbar->SetAlpha(0); - pixmapDiskUsage->SetAlpha(0); - pixmapDiskUsageIcon->SetAlpha(0); - pixmapDiskUsageLabel->SetAlpha(0); - } + pixmapHeader = osd->CreatePixmap(1, cRect(0, 0, osdWidth, headerHeight)); + pixmapHeaderLogo = osd->CreatePixmap(-1, cRect(0, 0, config.menuHeaderLogoWidth, config.menuHeaderLogoHeight)); + pixmapHeaderLabel = osd->CreatePixmap(2, cRect(0, 0, osdWidth - dateWidth, headerHeight)); + pixmapDate = osd->CreatePixmap(2, cRect(osdWidth - dateWidth, 0, dateWidth, headerHeight)); + pixmapFooter = osd->CreatePixmap(1, cRect(0, osdHeight-footerHeight, osdWidth, footerHeight)); + pixmapContent = osd->CreatePixmap(1, cRect(0, headerHeight, osdWidth, contentHeight), + cRect(0, 0, osdWidth + contentWidthFull - contentWidthNarrow, contentHeight)); + pixmapScrollbar = osd->CreatePixmap(2, cRect(contentWidthNarrow, headerHeight + spaceMenu, widthScrollbar, contentHeight - 2 * spaceMenu)); + pixmapDiskUsage = osd->CreatePixmap(2, cRect(osdWidth - diskUsageWidth - 10, headerHeight + spaceMenu, diskUsageWidth, diskUsageHeight)); + pixmapDiskUsageIcon = osd->CreatePixmap(3, cRect((osdWidth - diskUsageWidth - 10) + (diskUsageWidth)/8, headerHeight, diskUsageWidth*3/4, diskUsageWidth*3/4)); + pixmapDiskUsageLabel = osd->CreatePixmap(3, cRect(osdWidth - diskUsageWidth - 10, headerHeight + spaceMenu, diskUsageWidth, diskUsageHeight)); + pixmapHeaderLogo->Fill(clrTransparent); + pixmapHeaderLabel->Fill(clrTransparent); + pixmapDiskUsage->Fill(clrTransparent); + pixmapDiskUsageIcon->Fill(clrTransparent); + pixmapDiskUsageLabel->Fill(clrTransparent); + if (config.menuFadeTime) { + pixmapHeader->SetAlpha(0); + pixmapHeaderLogo->SetAlpha(0); + pixmapHeaderLabel->SetAlpha(0); + pixmapDate->SetAlpha(0); + pixmapFooter->SetAlpha(0); + pixmapContent->SetAlpha(0); + pixmapScrollbar->SetAlpha(0); + pixmapDiskUsage->SetAlpha(0); + pixmapDiskUsageIcon->SetAlpha(0); + pixmapDiskUsageLabel->SetAlpha(0); + } } void cNopacityDisplayMenuView::SetPixmapAlpha(int Alpha) { - pixmapHeader->SetAlpha(Alpha); - pixmapHeaderLogo->SetAlpha(Alpha); - pixmapHeaderLabel->SetAlpha(Alpha); - pixmapDate->SetAlpha(Alpha); - pixmapContent->SetAlpha(Alpha); - pixmapFooter->SetAlpha(Alpha); - pixmapScrollbar->SetAlpha(Alpha); - pixmapDiskUsage->SetAlpha(Alpha); - pixmapDiskUsageIcon->SetAlpha(Alpha); - pixmapDiskUsageLabel->SetAlpha(Alpha); + pixmapHeader->SetAlpha(Alpha); + pixmapHeaderLogo->SetAlpha(Alpha); + pixmapHeaderLabel->SetAlpha(Alpha); + pixmapDate->SetAlpha(Alpha); + pixmapContent->SetAlpha(Alpha); + pixmapFooter->SetAlpha(Alpha); + pixmapScrollbar->SetAlpha(Alpha); + pixmapDiskUsage->SetAlpha(Alpha); + pixmapDiskUsageIcon->SetAlpha(Alpha); + pixmapDiskUsageLabel->SetAlpha(Alpha); } void cNopacityDisplayMenuView::CreateFonts(void) { - fontHeader = cFont::CreateFont(config.fontName, headerHeight / 2 + config.fontHeader); - fontDate = cFont::CreateFont(config.fontName, headerHeight / 2 + config.fontDate); - fontMenuitemLarge = cFont::CreateFont(config.fontName, menuItemHeightMain/3 + 4 + config.fontMenuitemLarge); - fontMenuitemSchedule = cFont::CreateFont(config.fontName, menuItemHeightSchedule / 4 + 5 + config.fontMenuitemSchedule); - fontMenuitemScheduleSmall = cFont::CreateFont(config.fontName, menuItemHeightSchedule / 4 - 5 + config.fontMenuitemScheduleSmall); - fontMenuitemDefault = cFont::CreateFont(config.fontName, menuItemHeightDefault * 2 / 3 + config.fontMenuitemDefault); - fontDiskUsage = cFont::CreateFont(config.fontName, (diskUsageHeight/4)/2 - 2 + config.fontDiskUsage); - fontTimersHead = cFont::CreateFont(config.fontName, (contentHeight - 3*spaceMenu - diskUsageHeight) / 25 + config.fontTimersHead); - fontTimers = cFont::CreateFont(config.fontName, (contentHeight - 3*spaceMenu - diskUsageHeight) / 25 - 6 + config.fontTimers); - fontButtons = cFont::CreateFont(config.fontName, buttonHeight*0.8 + config.fontButtons); - fontMessage = cFont::CreateFont(config.fontName, messageHeight / 4 + config.fontMessageMenu); + fontHeader = cFont::CreateFont(config.fontName, headerHeight / 2 + config.fontHeader); + fontDate = cFont::CreateFont(config.fontName, headerHeight / 2 + config.fontDate); + fontMenuitemLarge = cFont::CreateFont(config.fontName, menuItemHeightMain/3 + 4 + config.fontMenuitemLarge); + fontMenuitemSchedule = cFont::CreateFont(config.fontName, menuItemHeightSchedule / 4 + 5 + config.fontMenuitemSchedule); + fontMenuitemScheduleSmall = cFont::CreateFont(config.fontName, menuItemHeightSchedule / 4 - 5 + config.fontMenuitemScheduleSmall); + fontMenuitemDefault = cFont::CreateFont(config.fontName, menuItemHeightDefault * 2 / 3 + config.fontMenuitemDefault); + fontDiskUsage = cFont::CreateFont(config.fontName, (diskUsageHeight/4)/2 - 2 + config.fontDiskUsage); + fontTimersHead = cFont::CreateFont(config.fontName, (contentHeight - 3*spaceMenu - diskUsageHeight) / 25 + config.fontTimersHead); + fontTimers = cFont::CreateFont(config.fontName, (contentHeight - 3*spaceMenu - diskUsageHeight) / 25 - 6 + config.fontTimers); + fontButtons = cFont::CreateFont(config.fontName, buttonHeight*0.8 + config.fontButtons); + fontMessage = cFont::CreateFont(config.fontName, messageHeight / 4 + config.fontMessageMenu); } cFont *cNopacityDisplayMenuView::GetMenuItemFont(eMenuCategory menuCat) { - switch (menuCat) { - case mcUnknown: - return fontMenuitemDefault; - case mcMain: - return fontMenuitemLarge; - case mcSchedule: - return fontMenuitemSchedule; - case mcChannel: - return fontMenuitemLarge; - default: - return fontMenuitemDefault; - } - return fontMenuitemDefault; + switch (menuCat) { + case mcUnknown: + return fontMenuitemDefault; + case mcMain: + return fontMenuitemLarge; + case mcSchedule: + return fontMenuitemSchedule; + case mcChannel: + return fontMenuitemLarge; + default: + return fontMenuitemDefault; + } + return fontMenuitemDefault; } cFont *cNopacityDisplayMenuView::GetMenuItemFontSmall() { - return fontMenuitemScheduleSmall; + return fontMenuitemScheduleSmall; } void cNopacityDisplayMenuView::GetMenuItemSize(eMenuCategory menuCat, cPoint *itemSize) { - int itemWidth = 0; - int itemHeight = 0; - switch (menuCat) { - case mcUnknown: - itemWidth = menuItemWidthDefault; - itemHeight = menuItemHeightDefault; - break; - case mcMain: - itemWidth = menuItemWidthMain; - itemHeight = menuItemHeightMain; - break; - case mcSchedule: - itemWidth = menuItemWidthMain; - itemHeight = menuItemHeightSchedule; - break; - case mcChannel: - itemWidth = menuItemWidthMain; - itemHeight = menuItemHeightSchedule; - break; - default: - itemWidth = menuItemWidthDefault; - itemHeight = menuItemHeightDefault; - break; - } - itemSize->Set(itemWidth, itemHeight); + int itemWidth = 0; + int itemHeight = 0; + switch (menuCat) { + case mcUnknown: + itemWidth = menuItemWidthDefault; + itemHeight = menuItemHeightDefault; + break; + case mcMain: + itemWidth = menuItemWidthMain; + itemHeight = menuItemHeightMain; + break; + case mcSchedule: + itemWidth = menuItemWidthMain; + itemHeight = menuItemHeightSchedule; + break; + case mcChannel: + itemWidth = menuItemWidthMain; + itemHeight = menuItemHeightSchedule; + break; + default: + itemWidth = menuItemWidthDefault; + itemHeight = menuItemHeightDefault; + break; + } + itemSize->Set(itemWidth, itemHeight); } int cNopacityDisplayMenuView::GetMaxItems(eMenuCategory menuCat) { - int maxItems = 0; - switch (menuCat) { - case mcUnknown: - maxItems = config.numDefaultMenuItems; - break; - case mcMain: - maxItems = contentHeight / (menuItemHeightMain + spaceMenu); - break; - case mcSchedule: - case mcChannel: - maxItems = contentHeight / (menuItemHeightSchedule + spaceMenu); - break; - default: - maxItems = config.numDefaultMenuItems; - } - return maxItems; + int maxItems = 0; + switch (menuCat) { + case mcUnknown: + maxItems = config.numDefaultMenuItems; + break; + case mcMain: + maxItems = contentHeight / (menuItemHeightMain + spaceMenu); + break; + case mcSchedule: + case mcChannel: + maxItems = contentHeight / (menuItemHeightSchedule + spaceMenu); + break; + default: + maxItems = config.numDefaultMenuItems; + } + return maxItems; } int cNopacityDisplayMenuView::GetMenuTop(int numItems, int itemHeight) { - return headerHeight + (contentHeight - numItems*(itemHeight + spaceMenu))/2; + return headerHeight + (contentHeight - numItems*(itemHeight + spaceMenu))/2; } void cNopacityDisplayMenuView::SetAvrgFontWidth(void) { - avrgFontWidth = fontMenuitemDefault->Width("x")+3; + avrgFontWidth = fontMenuitemDefault->Width("x")+3; } void cNopacityDisplayMenuView::SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, int Tab5) { - mytabs[0] = 1; - mytabs[1] = Tab1 ? mytabs[0] + Tab1 : 0; - mytabs[2] = Tab2 ? mytabs[1] + Tab2 : 0; - mytabs[3] = Tab3 ? mytabs[2] + Tab3 : 0; - mytabs[4] = Tab4 ? mytabs[3] + Tab4 : 0; - mytabs[5] = Tab5 ? mytabs[4] + Tab5 : 0; - if (Tab2) { - for (int i = 1; i < cSkinDisplayMenu::MaxTabs; i++) - mytabs[i] *= avrgFontWidth; - } else if (Tab1) { - mytabs[1] = GetEditableWidth(); - } + mytabs[0] = 1; + mytabs[1] = Tab1 ? mytabs[0] + Tab1 : 0; + mytabs[2] = Tab2 ? mytabs[1] + Tab2 : 0; + mytabs[3] = Tab3 ? mytabs[2] + Tab3 : 0; + mytabs[4] = Tab4 ? mytabs[3] + Tab4 : 0; + mytabs[5] = Tab5 ? mytabs[4] + Tab5 : 0; + if (Tab2) { + for (int i = 1; i < cSkinDisplayMenu::MaxTabs; i++) + mytabs[i] *= avrgFontWidth; + } else if (Tab1) { + mytabs[1] = GetEditableWidth(); + } } int cNopacityDisplayMenuView::GetEditableWidth(void) { - return contentWidthFull*0.5; + return contentWidthFull*0.5; } int cNopacityDisplayMenuView::GetTextAreaWidth(void) { - return contentWidthFull - 2*spaceMenu; + return contentWidthFull - 2*spaceMenu; } const cFont *cNopacityDisplayMenuView::GetTextAreaFont(bool FixedFont) { - return cFont::CreateFont(config.fontName, contentHeight / 25 + config.fontDetailView); + return cFont::CreateFont(config.fontName, contentHeight / 25 + config.fontDetailView); } void cNopacityDisplayMenuView::CreateBackgroundImages(int *handleBackgrounds, int *handleButtons) { - cImageLoader imgLoader; - imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), menuItemWidthDefault-2, menuItemHeightDefault-2); - handleBackgrounds[0] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), menuItemWidthDefault-2, menuItemHeightDefault-2); - handleBackgrounds[1] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), menuItemWidthMain-2, menuItemHeightMain-2); - handleBackgrounds[2] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), menuItemWidthMain-2, menuItemHeightMain-2); - handleBackgrounds[3] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), menuItemWidthMain-2, menuItemHeightSchedule-2); - handleBackgrounds[4] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), menuItemWidthMain-2, menuItemHeightSchedule-2); - handleBackgrounds[5] = cOsdProvider::StoreImage(imgLoader.GetImage()); - - tColor lutBg[] = { Theme.Color(clrButtonRed), Theme.Color(clrButtonGreen), Theme.Color(clrButtonYellow), Theme.Color(clrButtonBlue) }; - - imgLoader.DrawBackground(Theme.Color(clrMenuBack), lutBg[Setup.ColorKey0], buttonWidth-4, buttonHeight-4); - handleButtons[0] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuBack), lutBg[Setup.ColorKey1], buttonWidth-4, buttonHeight-4); - handleButtons[1] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuBack), lutBg[Setup.ColorKey2], buttonWidth-4, buttonHeight-4); - handleButtons[2] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuBack), lutBg[Setup.ColorKey3], buttonWidth-4, buttonHeight-4); - handleButtons[3] = cOsdProvider::StoreImage(imgLoader.GetImage()); + cImageLoader imgLoader; + imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), menuItemWidthDefault-2, menuItemHeightDefault-2); + handleBackgrounds[0] = cOsdProvider::StoreImage(imgLoader.GetImage()); + imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), menuItemWidthDefault-2, menuItemHeightDefault-2); + handleBackgrounds[1] = cOsdProvider::StoreImage(imgLoader.GetImage()); + imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), menuItemWidthMain-2, menuItemHeightMain-2); + handleBackgrounds[2] = cOsdProvider::StoreImage(imgLoader.GetImage()); + imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), menuItemWidthMain-2, menuItemHeightMain-2); + handleBackgrounds[3] = cOsdProvider::StoreImage(imgLoader.GetImage()); + imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), menuItemWidthMain-2, menuItemHeightSchedule-2); + handleBackgrounds[4] = cOsdProvider::StoreImage(imgLoader.GetImage()); + imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), menuItemWidthMain-2, menuItemHeightSchedule-2); + handleBackgrounds[5] = cOsdProvider::StoreImage(imgLoader.GetImage()); + + tColor lutBg[] = { Theme.Color(clrButtonRed), Theme.Color(clrButtonGreen), Theme.Color(clrButtonYellow), Theme.Color(clrButtonBlue) }; + + imgLoader.DrawBackground(Theme.Color(clrMenuBack), lutBg[Setup.ColorKey0], buttonWidth-4, buttonHeight-4); + handleButtons[0] = cOsdProvider::StoreImage(imgLoader.GetImage()); + imgLoader.DrawBackground(Theme.Color(clrMenuBack), lutBg[Setup.ColorKey1], buttonWidth-4, buttonHeight-4); + handleButtons[1] = cOsdProvider::StoreImage(imgLoader.GetImage()); + imgLoader.DrawBackground(Theme.Color(clrMenuBack), lutBg[Setup.ColorKey2], buttonWidth-4, buttonHeight-4); + handleButtons[2] = cOsdProvider::StoreImage(imgLoader.GetImage()); + imgLoader.DrawBackground(Theme.Color(clrMenuBack), lutBg[Setup.ColorKey3], buttonWidth-4, buttonHeight-4); + handleButtons[3] = cOsdProvider::StoreImage(imgLoader.GetImage()); } void cNopacityDisplayMenuView::DrawBorderDecoration() { - cImageLoader imgLoader; - imgLoader.DrawBackground(Theme.Color(clrMenuItemHighBlend), Theme.Color(clrMenuBack), osdWidth, headerHeight); - pixmapHeader->DrawImage(cPoint(0,0), imgLoader.GetImage()); - pixmapFooter->Fill(Theme.Color(clrMenuBack)); - - int borderWidth = 2; - int radius = 10; - - pixmapContent->Fill(clrTransparent); - pixmapContent->DrawRectangle(cRect(0, 0, contentWidthFull-radius, contentHeight), Theme.Color(clrMenuBack)); - pixmapContent->DrawRectangle(cRect(contentWidthFull, 0, osdWidth - contentWidthNarrow, borderWidth), Theme.Color(clrMenuBorder)); - pixmapContent->DrawRectangle(cRect(contentWidthFull, contentHeight - borderWidth, osdWidth - contentWidthNarrow, borderWidth), Theme.Color(clrMenuBorder)); - pixmapContent->DrawRectangle(cRect(contentWidthFull - radius, 0, radius, radius), Theme.Color(clrMenuBack)); - pixmapContent->DrawEllipse(cRect(contentWidthFull - radius, 0, radius, radius), Theme.Color(clrMenuBorder),2); - pixmapContent->DrawEllipse(cRect(contentWidthFull - radius + borderWidth, borderWidth, radius-borderWidth, radius-borderWidth), clrTransparent, 2); - pixmapContent->DrawRectangle(cRect(contentWidthFull-radius, radius, borderWidth, contentHeight - 2*radius), Theme.Color(clrMenuBorder)); - pixmapContent->DrawRectangle(cRect(contentWidthFull - radius, contentHeight - radius, radius, radius), Theme.Color(clrMenuBack)); - pixmapContent->DrawEllipse(cRect(contentWidthFull - radius, contentHeight - radius, radius, radius), Theme.Color(clrMenuBorder),3); - pixmapContent->DrawEllipse(cRect(contentWidthFull - radius + borderWidth, contentHeight - radius, radius-borderWidth, radius-borderWidth), clrTransparent, 3); + cImageLoader imgLoader; + imgLoader.DrawBackground(Theme.Color(clrMenuItemHighBlend), Theme.Color(clrMenuBack), osdWidth, headerHeight); + pixmapHeader->DrawImage(cPoint(0,0), imgLoader.GetImage()); + pixmapFooter->Fill(Theme.Color(clrMenuBack)); + + int borderWidth = 2; + int radius = 10; + + pixmapContent->Fill(clrTransparent); + pixmapContent->DrawRectangle(cRect(0, 0, contentWidthFull-radius, contentHeight), Theme.Color(clrMenuBack)); + pixmapContent->DrawRectangle(cRect(contentWidthFull, 0, osdWidth - contentWidthNarrow, borderWidth), Theme.Color(clrMenuBorder)); + pixmapContent->DrawRectangle(cRect(contentWidthFull, contentHeight - borderWidth, osdWidth - contentWidthNarrow, borderWidth), Theme.Color(clrMenuBorder)); + pixmapContent->DrawRectangle(cRect(contentWidthFull - radius, 0, radius, radius), Theme.Color(clrMenuBack)); + pixmapContent->DrawEllipse(cRect(contentWidthFull - radius, 0, radius, radius), Theme.Color(clrMenuBorder),2); + pixmapContent->DrawEllipse(cRect(contentWidthFull - radius + borderWidth, borderWidth, radius-borderWidth, radius-borderWidth), clrTransparent, 2); + pixmapContent->DrawRectangle(cRect(contentWidthFull-radius, radius, borderWidth, contentHeight - 2*radius), Theme.Color(clrMenuBorder)); + pixmapContent->DrawRectangle(cRect(contentWidthFull - radius, contentHeight - radius, radius, radius), Theme.Color(clrMenuBack)); + pixmapContent->DrawEllipse(cRect(contentWidthFull - radius, contentHeight - radius, radius, radius), Theme.Color(clrMenuBorder),3); + pixmapContent->DrawEllipse(cRect(contentWidthFull - radius + borderWidth, contentHeight - radius, radius-borderWidth, radius-borderWidth), clrTransparent, 3); } void cNopacityDisplayMenuView::AdjustContentBackground(bool contentNarrow, bool contentNarrowLast) { - if (contentNarrow) { - pixmapContent->SetDrawPortPoint(cPoint(contentWidthNarrow - contentWidthFull, 0)); + if (contentNarrow) { + pixmapContent->SetDrawPortPoint(cPoint(contentWidthNarrow - contentWidthFull, 0)); #ifdef USE_YAEPG - if (config.scalePicture) { - tArea availableArea; - availableArea.x1 = osdLeft + contentWidthNarrow; - availableArea.y1 = osdTop + headerHeight; - availableArea.x2 = contentWidthFull; - availableArea.y2 = availableArea.y1 + contentHeight; - ScalePreserveAspect(osd->vidWin, vidAspect, availableArea); - osd->vidWin.bpp = 12; - } + if (config.scalePicture) { + tArea availableArea; + availableArea.x1 = osdLeft + contentWidthNarrow; + availableArea.y1 = osdTop + headerHeight; + availableArea.x2 = contentWidthFull; + availableArea.y2 = availableArea.y1 + contentHeight; + ScalePreserveAspect(osd->vidWin, vidAspect, availableArea); + osd->vidWin.bpp = 12; + } #endif - } else { - pixmapContent->SetDrawPortPoint(cPoint(0, 0)); + } else { + pixmapContent->SetDrawPortPoint(cPoint(0, 0)); #ifdef USE_YAEPG - if (config.scalePicture) { - tArea availableArea; - availableArea.x1 = -osdLeft; - availableArea.y1 = -osdTop; - availableArea.x2 = osdWidth + osdLeft; - availableArea.y2 = osdHeight + osdTop; - ScalePreserveAspect(osd->vidWin, vidAspect, availableArea); - osd->vidWin.bpp = 12; - } + if (config.scalePicture) { + tArea availableArea; + availableArea.x1 = -osdLeft; + availableArea.y1 = -osdTop; + availableArea.x2 = osdWidth + osdLeft; + availableArea.y2 = osdHeight + osdTop; + ScalePreserveAspect(osd->vidWin, vidAspect, availableArea); + osd->vidWin.bpp = 12; + } #endif - } - if (contentNarrow != contentNarrowLast) { - osd->DestroyPixmap(pixmapScrollbar); - int contentWidth = (contentNarrow)?contentWidthNarrow:contentWidthFull; - pixmapScrollbar = osd->CreatePixmap(2, cRect(contentWidth , headerHeight + spaceMenu, widthScrollbar, osdHeight - headerHeight - footerHeight - 2*spaceMenu)); - } + } + if (contentNarrow != contentNarrowLast) { + osd->DestroyPixmap(pixmapScrollbar); + int contentWidth = (contentNarrow)?contentWidthNarrow:contentWidthFull; + pixmapScrollbar = osd->CreatePixmap(2, cRect(contentWidth , headerHeight + spaceMenu, widthScrollbar, osdHeight - headerHeight - footerHeight - 2*spaceMenu)); + } } void cNopacityDisplayMenuView::ScalePreserveAspect(tArea & videoWindowDest, const double & videoAspect, const tArea & availableArea) { - videoWindowDest.x1 = availableArea.x1; - videoWindowDest.x2 = availableArea.x2; - videoWindowDest.y1 = availableArea.y1; - videoWindowDest.y2 = availableArea.y2; - if (availableArea.Height() == 0) { - videoWindowDest.bpp = 0; // just for safety - return; - } - double availableAspect = double(availableArea.Width())/double(availableArea.Height()); - if (videoAspect < availableAspect) { - int offset = floor(double(availableArea.Width() - availableArea.Height() * videoAspect)/2); - videoWindowDest.x1 += offset; - videoWindowDest.x2 -= offset; - } else { - int offset = floor(double(availableArea.Height() - availableArea.Width() / videoAspect)/2); - videoWindowDest.y1 += offset; - videoWindowDest.y2 -= offset; - } + videoWindowDest.x1 = availableArea.x1; + videoWindowDest.x2 = availableArea.x2; + videoWindowDest.y1 = availableArea.y1; + videoWindowDest.y2 = availableArea.y2; + if (availableArea.Height() == 0) { + videoWindowDest.bpp = 0; // just for safety + return; + } + double availableAspect = double(availableArea.Width())/double(availableArea.Height()); + if (videoAspect < availableAspect) { + int offset = floor(double(availableArea.Width() - availableArea.Height() * videoAspect)/2); + videoWindowDest.x1 += offset; + videoWindowDest.x2 -= offset; + } else { + int offset = floor(double(availableArea.Height() - availableArea.Width() / videoAspect)/2); + videoWindowDest.y1 += offset; + videoWindowDest.y2 -= offset; + } } void cNopacityDisplayMenuView::DrawHeaderLogo(void) { - cImageLoader imgLoader; - if (imgLoader.LoadIcon("vdrlogo", config.menuHeaderLogoWidth, config.menuHeaderLogoHeight)) { - pixmapHeaderLogo->DrawImage(cPoint(0,0), imgLoader.GetImage()); - } + cImageLoader imgLoader; + if (imgLoader.LoadIcon("vdrlogo", config.menuHeaderLogoWidth, config.menuHeaderLogoHeight)) { + pixmapHeaderLogo->DrawImage(cPoint(0,0), imgLoader.GetImage()); + } } int cNopacityDisplayMenuView::ShowHeaderLogo(bool show) { - if (show) { - pixmapHeaderLogo->SetLayer(2); - } else { - pixmapHeaderLogo->SetLayer(-1); - } - return config.menuHeaderLogoWidth + spaceMenu; + if (show) { + pixmapHeaderLogo->SetLayer(2); + } else { + pixmapHeaderLogo->SetLayer(-1); + } + return config.menuHeaderLogoWidth + spaceMenu; } int cNopacityDisplayMenuView::DrawHeaderIcon(eMenuCategory menuCat) { - cString icon; - bool drawIcon = true; - switch (menuCat) { - case mcSchedule: - icon = "Schedule"; - break; - case mcChannel: - icon = "Channels"; - break; - case mcTimer: - icon = "Timers"; - break; - case mcRecording: - icon = "Recordings"; - break; - case mcSetup: - icon = "Setup"; - break; - case mcCommand: - icon = "Commands"; - break; - default: - drawIcon = false; - } - - int left = 0; - if (drawIcon) { - pixmapHeaderIcon = osd->CreatePixmap(2, cRect(0, 0, config.headerIconHeight, config.headerIconHeight)); - pixmapHeaderIcon->Fill(clrTransparent); - cImageLoader imgLoader; - if (imgLoader.LoadIcon(*icon, config.headerIconHeight)) { - pixmapHeaderIcon->DrawImage(cPoint(0,0), imgLoader.GetImage()); - left = config.headerIconHeight + spaceMenu; - } - } - return left; + cString icon; + bool drawIcon = true; + switch (menuCat) { + case mcSchedule: + icon = "Schedule"; + break; + case mcChannel: + icon = "Channels"; + break; + case mcTimer: + icon = "Timers"; + break; + case mcRecording: + icon = "Recordings"; + break; + case mcSetup: + icon = "Setup"; + break; + case mcCommand: + icon = "Commands"; + break; + default: + drawIcon = false; + } + + int left = 0; + if (drawIcon) { + pixmapHeaderIcon = osd->CreatePixmap(2, cRect(0, 0, config.headerIconHeight, config.headerIconHeight)); + pixmapHeaderIcon->Fill(clrTransparent); + cImageLoader imgLoader; + if (imgLoader.LoadIcon(*icon, config.headerIconHeight)) { + pixmapHeaderIcon->DrawImage(cPoint(0,0), imgLoader.GetImage()); + left = config.headerIconHeight + spaceMenu; + } + } + return left; } int cNopacityDisplayMenuView::ShowHeaderIconChannelLogo(const char *Title) { - pixmapHeaderIcon = osd->CreatePixmap(2, cRect(0, 0, config.menuItemLogoWidth, config.menuItemLogoHeight)); - pixmapHeaderIcon->Fill(clrTransparent); - std::string channel = Title; - std::string remove = trVDR("Schedule"); - remove.append(" - "); - channel.erase(0, remove.length()); - cImageLoader imgLoader; - int left = 0; - if (imgLoader.LoadLogo(channel.c_str(), config.menuItemLogoWidth, config.menuItemLogoHeight)) { - pixmapHeaderIcon->DrawImage(cPoint(0, 0), imgLoader.GetImage()); - left = config.menuItemLogoWidth + spaceMenu; - } - return left; + pixmapHeaderIcon = osd->CreatePixmap(2, cRect(0, 0, config.menuItemLogoWidth, config.menuItemLogoHeight)); + pixmapHeaderIcon->Fill(clrTransparent); + std::string channel = Title; + std::string remove = trVDR("Schedule"); + remove.append(" - "); + channel.erase(0, remove.length()); + cImageLoader imgLoader; + int left = 0; + if (imgLoader.LoadLogo(channel.c_str(), config.menuItemLogoWidth, config.menuItemLogoHeight)) { + pixmapHeaderIcon->DrawImage(cPoint(0, 0), imgLoader.GetImage()); + left = config.menuItemLogoWidth + spaceMenu; + } + return left; } void cNopacityDisplayMenuView::DestroyHeaderIcon(void) { - if (pixmapHeaderIcon) { - osd->DestroyPixmap(pixmapHeaderIcon); - pixmapHeaderIcon = NULL; - } + if (pixmapHeaderIcon) { + osd->DestroyPixmap(pixmapHeaderIcon); + pixmapHeaderIcon = NULL; + } } void cNopacityDisplayMenuView::DrawHeaderLabel(int left, cString label) { - pixmapHeaderLabel->Fill(clrTransparent); - pixmapHeaderLabel->DrawText(cPoint(left, ((headerHeight - 10) - fontHeader->Height()) / 2), *label, Theme.Color(clrMenuFontHeader), clrTransparent, fontHeader); + pixmapHeaderLabel->Fill(clrTransparent); + pixmapHeaderLabel->DrawText(cPoint(left, ((headerHeight - 10) - fontHeader->Height()) / 2), *label, Theme.Color(clrMenuFontHeader), clrTransparent, fontHeader); } void cNopacityDisplayMenuView::DrawDate(bool initial) { - cString date = DayDateTime(); - if (initial || strcmp(date, lastDate)) { - pixmapDate->Fill(clrTransparent); - int dateW = fontDate->Width(date); - pixmapDate->DrawText(cPoint(dateWidth - dateW - 2*spaceMenu, (headerHeight - fontDate->Height()) / 2), date, Theme.Color(clrMenuFontDate), clrTransparent, fontDate); - lastDate = date; - } + cString date = DayDateTime(); + if (initial || strcmp(date, lastDate)) { + pixmapDate->Fill(clrTransparent); + int dateW = fontDate->Width(date); + pixmapDate->DrawText(cPoint(dateWidth - dateW - 2*spaceMenu, (headerHeight - fontDate->Height()) / 2), date, Theme.Color(clrMenuFontDate), clrTransparent, fontDate); + lastDate = date; + } } void cNopacityDisplayMenuView::DrawDiskUsage(void) { - int iconWidth = diskUsageWidth * 3/4; - int DiskUsage = cVideoDiskUsage::UsedPercent(); - bool DiskAlert = DiskUsage > diskUsageAlert; - tColor bgColor = DiskAlert ? Theme.Color(clrDiskAlert) : Theme.Color(clrMenuBack); - pixmapDiskUsage->Fill(Theme.Color(clrMenuBorder)); - pixmapDiskUsage->DrawRectangle(cRect(2,2,diskUsageWidth-4, diskUsageHeight-4), bgColor); - cImageLoader imgLoader; - if (imgLoader.LoadIcon("DiskUsage", iconWidth)) { - cImage icon = imgLoader.GetImage(); - pixmapDiskUsageIcon->DrawImage(cPoint(0,0), icon); - } - pixmapDiskUsageLabel->Fill(clrTransparent); - cString usage = cString::sprintf("%s: %d%%", tr("Disc"), DiskUsage); - cString rest = cString::sprintf("%02d:%02dh %s", cVideoDiskUsage::FreeMinutes() / 60, cVideoDiskUsage::FreeMinutes() % 60, tr("free")); - pixmapDiskUsageLabel->DrawText(cPoint((diskUsageWidth - fontDiskUsage->Width(*usage))/2, diskUsageHeight - 2*fontDiskUsage->Height() - spaceMenu), *usage, Theme.Color(clrMenuFontDiscUsage), clrTransparent, fontDiskUsage); - pixmapDiskUsageLabel->DrawText(cPoint((diskUsageWidth - fontDiskUsage->Width(*rest))/2, diskUsageHeight - fontDiskUsage->Height() - spaceMenu), *rest, Theme.Color(clrMenuFontDiscUsage), clrTransparent, fontDiskUsage); - pixmapDiskUsage->SetLayer(2); - pixmapDiskUsageIcon->SetLayer(3); - pixmapDiskUsageLabel->SetLayer(4); + int iconWidth = diskUsageWidth * 3/4; + int DiskUsage = cVideoDiskUsage::UsedPercent(); + bool DiskAlert = DiskUsage > diskUsageAlert; + tColor bgColor = DiskAlert ? Theme.Color(clrDiskAlert) : Theme.Color(clrMenuBack); + pixmapDiskUsage->Fill(Theme.Color(clrMenuBorder)); + pixmapDiskUsage->DrawRectangle(cRect(2,2,diskUsageWidth-4, diskUsageHeight-4), bgColor); + cImageLoader imgLoader; + if (imgLoader.LoadIcon("DiskUsage", iconWidth)) { + cImage icon = imgLoader.GetImage(); + pixmapDiskUsageIcon->DrawImage(cPoint(0,0), icon); + } + pixmapDiskUsageLabel->Fill(clrTransparent); + cString usage = cString::sprintf("%s: %d%%", tr("Disc"), DiskUsage); + cString rest = cString::sprintf("%02d:%02dh %s", cVideoDiskUsage::FreeMinutes() / 60, cVideoDiskUsage::FreeMinutes() % 60, tr("free")); + pixmapDiskUsageLabel->DrawText(cPoint((diskUsageWidth - fontDiskUsage->Width(*usage))/2, diskUsageHeight - 2*fontDiskUsage->Height() - spaceMenu), *usage, Theme.Color(clrMenuFontDiscUsage), clrTransparent, fontDiskUsage); + pixmapDiskUsageLabel->DrawText(cPoint((diskUsageWidth - fontDiskUsage->Width(*rest))/2, diskUsageHeight - fontDiskUsage->Height() - spaceMenu), *rest, Theme.Color(clrMenuFontDiscUsage), clrTransparent, fontDiskUsage); + pixmapDiskUsage->SetLayer(2); + pixmapDiskUsageIcon->SetLayer(3); + pixmapDiskUsageLabel->SetLayer(4); } void cNopacityDisplayMenuView::ShowDiskUsage(bool show) { - if (show) { - pixmapDiskUsage->SetLayer(2); - pixmapDiskUsageIcon->SetLayer(3); - pixmapDiskUsageLabel->SetLayer(4); - } else { - pixmapDiskUsage->SetLayer(-1); - pixmapDiskUsageIcon->SetLayer(-1); - pixmapDiskUsageLabel->SetLayer(-1); - } + if (show) { + pixmapDiskUsage->SetLayer(2); + pixmapDiskUsageIcon->SetLayer(3); + pixmapDiskUsageLabel->SetLayer(4); + } else { + pixmapDiskUsage->SetLayer(-1); + pixmapDiskUsageIcon->SetLayer(-1); + pixmapDiskUsageLabel->SetLayer(-1); + } } void cNopacityDisplayMenuView::DrawButton(const char *text, int handleImage, tColor borderColor, int num) { - int top = 2*buttonsBorder; - int left = num * buttonWidth + (2*num + 1) * buttonsBorder; - pixmapFooter->DrawRectangle(cRect(left, top, buttonWidth, buttonHeight), borderColor); - pixmapFooter->DrawImage(cPoint(left+2, top+2), handleImage); - int textWidth = fontButtons->Width(text); - int textHeight = fontButtons->Height(); - pixmapFooter->DrawText(cPoint(left + (buttonWidth-textWidth)/2, top + (buttonHeight-textHeight)/2), text, Theme.Color(clrMenuFontButton), clrTransparent, fontButtons); + int top = 2*buttonsBorder; + int left = num * buttonWidth + (2*num + 1) * buttonsBorder; + pixmapFooter->DrawRectangle(cRect(left, top, buttonWidth, buttonHeight), borderColor); + pixmapFooter->DrawImage(cPoint(left+2, top+2), handleImage); + int textWidth = fontButtons->Width(text); + int textHeight = fontButtons->Height(); + pixmapFooter->DrawText(cPoint(left + (buttonWidth-textWidth)/2, top + (buttonHeight-textHeight)/2), text, Theme.Color(clrMenuFontButton), clrTransparent, fontButtons); } void cNopacityDisplayMenuView::ClearButton(int num) { - int top = 2*buttonsBorder; - int left = num * buttonWidth + (2*num + 1) * buttonsBorder; - pixmapFooter->DrawRectangle(cRect(left, top, buttonWidth, buttonHeight), Theme.Color(clrMenuBack)); + int top = 2*buttonsBorder; + int left = num * buttonWidth + (2*num + 1) * buttonsBorder; + pixmapFooter->DrawRectangle(cRect(left, top, buttonWidth, buttonHeight), Theme.Color(clrMenuBack)); } int cNopacityDisplayMenuView::GetTimersInitHeight(void) { - return headerHeight + diskUsageHeight + 2*spaceMenu; + return headerHeight + diskUsageHeight + 2*spaceMenu; } int cNopacityDisplayMenuView::GetTimersMaxHeight(void) { - return headerHeight + contentHeight; + return headerHeight + contentHeight; } cNopacityTimer *cNopacityDisplayMenuView::DrawTimer(const cTimer *Timer, int y) { - const cChannel *Channel = Timer->Channel(); - const cEvent *Event = Timer->Event(); - cString channelName(""), title(""); - if (Channel) { - channelName = Channel->Name(); - } - if (Event) { - title = Event->Title(); - } - cTextWrapper titleLines; - titleLines.Set(*title, fontTimers, timersWidth-10); - - cString Date; - if (Timer->Recording()) { - Date = cString::sprintf("-%s", *TimeString(Timer->StopTime())); - } else { - time_t Now = time(NULL); - cString Today = WeekDayName(Now); - cString Time = TimeString(Timer->StartTime()); - cString Day = WeekDayName(Timer->StartTime()); - if (Timer->StartTime() > Now + 6 * SECSINDAY) - Date = DayDateTime(Timer->StartTime()); - else if (strcmp(Day, Today) != 0) - Date = cString::sprintf("%s %s", *Day, *Time); - else - Date = Time; - if (Timer->Flags() & tfVps) - Date = cString::sprintf("VPS %s", *Date); - } - - int numLines = titleLines.Lines(); - int lineHeight = fontTimers->Height(); - int timerHeight = (numLines + 2)*lineHeight + spaceMenu; - - cNopacityTimer *t = new cNopacityTimer(osd); - t->pixmap = osd->CreatePixmap(2, cRect(osdWidth - timersWidth - 10, y, timersWidth, timerHeight)); - - cImageLoader imgLoader; - if(Timer->Recording()) { - t->pixmap->Fill(Theme.Color(clrDiskAlert)); - imgLoader.DrawBackground(Theme.Color(clrDiskAlert), Theme.Color(clrMenuItemHigh), timersWidth-2, timerHeight-2); - t->pixmap->DrawImage(cPoint(1,1), imgLoader.GetImage()); - } else { - t->pixmap->Fill(Theme.Color(clrMenuBorder)); - imgLoader.DrawBackground(Theme.Color(clrMenuItemHighBlend), Theme.Color(clrMenuItemHigh), timersWidth-2, timerHeight-2); - t->pixmap->DrawImage(cPoint(1,1), imgLoader.GetImage()); - } - t->pixmap->DrawText(cPoint(5, 0), *Date, Theme.Color(clrMenuFontTimersHeader), clrTransparent, fontTimersHead); - t->pixmap->DrawText(cPoint(5, lineHeight+2), *channelName, Theme.Color(clrMenuFontTimersHeader), clrTransparent, fontTimers); - int yStart = 2*lineHeight + 3; - for (int line=0; line<numLines; line++) - t->pixmap->DrawText(cPoint(5, yStart+line*(lineHeight-2)), titleLines.GetLine(line), Theme.Color(clrMenuFontTimers), clrTransparent, fontTimers); - - return t; + const cChannel *Channel = Timer->Channel(); + const cEvent *Event = Timer->Event(); + cString channelName(""), title(""); + if (Channel) { + channelName = Channel->Name(); + } + if (Event) { + title = Event->Title(); + } + cTextWrapper titleLines; + titleLines.Set(*title, fontTimers, timersWidth-10); + + cString Date; + if (Timer->Recording()) { + Date = cString::sprintf("-%s", *TimeString(Timer->StopTime())); + } else { + time_t Now = time(NULL); + cString Today = WeekDayName(Now); + cString Time = TimeString(Timer->StartTime()); + cString Day = WeekDayName(Timer->StartTime()); + if (Timer->StartTime() > Now + 6 * SECSINDAY) + Date = DayDateTime(Timer->StartTime()); + else if (strcmp(Day, Today) != 0) + Date = cString::sprintf("%s %s", *Day, *Time); + else + Date = Time; + if (Timer->Flags() & tfVps) + Date = cString::sprintf("VPS %s", *Date); + } + + int numLines = titleLines.Lines(); + int lineHeight = fontTimers->Height(); + int timerHeight = (numLines + 2)*lineHeight + spaceMenu; + + cNopacityTimer *t = new cNopacityTimer(osd); + t->pixmap = osd->CreatePixmap(2, cRect(osdWidth - timersWidth - 10, y, timersWidth, timerHeight)); + + cImageLoader imgLoader; + if(Timer->Recording()) { + t->pixmap->Fill(Theme.Color(clrDiskAlert)); + imgLoader.DrawBackground(Theme.Color(clrDiskAlert), Theme.Color(clrMenuItemHigh), timersWidth-2, timerHeight-2); + t->pixmap->DrawImage(cPoint(1,1), imgLoader.GetImage()); + } else { + t->pixmap->Fill(Theme.Color(clrMenuBorder)); + imgLoader.DrawBackground(Theme.Color(clrMenuItemHighBlend), Theme.Color(clrMenuItemHigh), timersWidth-2, timerHeight-2); + t->pixmap->DrawImage(cPoint(1,1), imgLoader.GetImage()); + } + t->pixmap->DrawText(cPoint(5, 0), *Date, Theme.Color(clrMenuFontTimersHeader), clrTransparent, fontTimersHead); + t->pixmap->DrawText(cPoint(5, lineHeight+2), *channelName, Theme.Color(clrMenuFontTimersHeader), clrTransparent, fontTimers); + int yStart = 2*lineHeight + 3; + for (int line=0; line<numLines; line++) + t->pixmap->DrawText(cPoint(5, yStart+line*(lineHeight-2)), titleLines.GetLine(line), Theme.Color(clrMenuFontTimers), clrTransparent, fontTimers); + + return t; } void cNopacityDisplayMenuView::DrawScrollbar(double Height, double Offset) { - int totalHeight = pixmapScrollbar->ViewPort().Height() - 6; - int height = Height * totalHeight; - int offset = Offset * totalHeight; - pixmapScrollbar->Fill(Theme.Color(clrMenuScrollBar)); - pixmapScrollbar->DrawRectangle(cRect(2,2,widthScrollbar-4,totalHeight+2), Theme.Color(clrMenuScrollBarBack)); - pixmapScrollbar->DrawRectangle(cRect(3,3 + offset,widthScrollbar-6,height), Theme.Color(clrMenuScrollBar)); + int totalHeight = pixmapScrollbar->ViewPort().Height() - 6; + int height = Height * totalHeight; + int offset = Offset * totalHeight; + pixmapScrollbar->Fill(Theme.Color(clrMenuScrollBar)); + pixmapScrollbar->DrawRectangle(cRect(2,2,widthScrollbar-4,totalHeight+2), Theme.Color(clrMenuScrollBarBack)); + pixmapScrollbar->DrawRectangle(cRect(3,3 + offset,widthScrollbar-6,height), Theme.Color(clrMenuScrollBar)); } void cNopacityDisplayMenuView::ClearScrollbar(void) { - pixmapScrollbar->Fill(clrTransparent); + pixmapScrollbar->Fill(clrTransparent); } void cNopacityDisplayMenuView::DrawMessage(eMessageType Type, const char *Text) { - tColor col = Theme.Color(clrMessageStatus); - switch (Type) { - case mtStatus: - col = Theme.Color(clrMessageStatus); - break; - case mtInfo: - col = Theme.Color(clrMessageInfo); - break; - case mtWarning: - col = Theme.Color(clrMessageWarning); - break; - case mtError: - col = Theme.Color(clrMessageError); - break; - } - if (pixmapStatus) { - ClearMessage(); - } - pixmapStatus = osd->CreatePixmap(5, cRect(0.1*osdWidth, 0.8*osdHeight, messageWidth, messageHeight)); - pixmapStatus->Fill(col); - cImageLoader imgLoader; - imgLoader.DrawBackground2(Theme.Color(clrMenuBack), col, messageWidth-2, messageHeight-2); - pixmapStatus->DrawImage(cPoint(1, 1), imgLoader.GetImage()); - int textWidth = fontMessage->Width(Text); - pixmapStatus->DrawText(cPoint((messageWidth - textWidth) / 2, (messageHeight - fontMessage->Height()) / 2), Text, Theme.Color(clrMenuFontMessages), clrTransparent, fontMessage); + tColor col = Theme.Color(clrMessageStatus); + switch (Type) { + case mtStatus: + col = Theme.Color(clrMessageStatus); + break; + case mtInfo: + col = Theme.Color(clrMessageInfo); + break; + case mtWarning: + col = Theme.Color(clrMessageWarning); + break; + case mtError: + col = Theme.Color(clrMessageError); + break; + } + if (pixmapStatus) { + ClearMessage(); + } + pixmapStatus = osd->CreatePixmap(5, cRect(0.1*osdWidth, 0.8*osdHeight, messageWidth, messageHeight)); + pixmapStatus->Fill(col); + cImageLoader imgLoader; + imgLoader.DrawBackground2(Theme.Color(clrMenuBack), col, messageWidth-2, messageHeight-2); + pixmapStatus->DrawImage(cPoint(1, 1), imgLoader.GetImage()); + int textWidth = fontMessage->Width(Text); + pixmapStatus->DrawText(cPoint((messageWidth - textWidth) / 2, (messageHeight - fontMessage->Height()) / 2), Text, Theme.Color(clrMenuFontMessages), clrTransparent, fontMessage); } void cNopacityDisplayMenuView::ClearMessage(void) { - if (pixmapStatus) { - osd->DestroyPixmap(pixmapStatus); - pixmapStatus = NULL; - } + if (pixmapStatus) { + osd->DestroyPixmap(pixmapStatus); + pixmapStatus = NULL; + } } void cNopacityDisplayMenuView::SetDetailViewSize(eDetailViewType detailViewType, cNopacityMenuDetailView *detailView) { - int width = 0; - int height = 0; - int top = 0; - int contentBorder = 20; - int detailHeaderHeight = 0; - - switch (detailViewType) { - case dvEvent: - detailHeaderHeight = max(config.detailViewLogoHeight, config.epgImageHeight)+4; - break; - case dvRecording: - detailHeaderHeight = contentHeight/5; - break; - case dvText: - detailHeaderHeight = 0; - break; - default: - break; - } - width = contentWidthFull - 2*spaceMenu; - height = contentHeight; - top = headerHeight; - detailView->SetGeometry(width, height, top, contentBorder, detailHeaderHeight); + int width = 0; + int height = 0; + int top = 0; + int contentBorder = 20; + int detailHeaderHeight = 0; + + switch (detailViewType) { + case dvEvent: + detailHeaderHeight = max(config.detailViewLogoHeight, config.epgImageHeight)+4; + break; + case dvRecording: + detailHeaderHeight = contentHeight/5; + break; + case dvText: + detailHeaderHeight = 0; + break; + default: + break; + } + width = contentWidthFull - 2*spaceMenu; + height = contentHeight; + top = headerHeight; + detailView->SetGeometry(width, height, top, contentBorder, detailHeaderHeight); }
\ No newline at end of file diff --git a/displaymenuview.h b/displaymenuview.h index 447dc2a..4c0db71 100644 --- a/displaymenuview.h +++ b/displaymenuview.h @@ -4,104 +4,104 @@ enum eDetailViewType {dvEvent = 0, dvRecording, dvText}; class cNopacityTimer : public cListObject { - private: - cOsd *osd; - public: - cNopacityTimer(cOsd *osd); - virtual ~cNopacityTimer(void); - void SetAlpha(int alpha) {pixmap->SetAlpha(alpha);} - void SetLayer(int layer) {pixmap->SetLayer(layer);} - cPixmap *pixmap; + private: + cOsd *osd; + public: + cNopacityTimer(cOsd *osd); + virtual ~cNopacityTimer(void); + void SetAlpha(int alpha) {pixmap->SetAlpha(alpha);} + void SetLayer(int layer) {pixmap->SetLayer(layer);} + cPixmap *pixmap; }; class cNopacityDisplayMenuView { - private: - cOsd *osd; - cString lastDate; - int diskUsageAlert; - cPixmap *pixmapHeader; - cPixmap *pixmapHeaderLogo; - cPixmap *pixmapHeaderIcon; - cPixmap *pixmapHeaderLabel; - cPixmap *pixmapDate; - cPixmap *pixmapFooter; - cPixmap *pixmapContent; - cPixmap *pixmapScrollbar; - cPixmap *pixmapDiskUsage; - cPixmap *pixmapDiskUsageIcon; - cPixmap *pixmapDiskUsageLabel; - cPixmap *pixmapStatus; - cFont *fontHeader; - cFont *fontDate; - cFont *fontMenuitemLarge; - cFont *fontMenuitemSchedule; - cFont *fontMenuitemScheduleSmall; - cFont *fontMenuitemDefault; - cFont *fontDiskUsage; - cFont *fontTimers; - cFont *fontTimersHead; - cFont *fontButtons; - cFont *fontMessage; - int osdWidth, osdHeight; - int osdLeft, osdTop; - int vidWidth, vidHeight; - double vidAspect; - int widthScrollbar; - int dateWidth; - int headerHeight, footerHeight, contentHeight; - int contentWidthNarrow, contentWidthFull; - int menuItemWidthDefault, menuItemHeightDefault; - int menuItemWidthMain, menuItemHeightMain; - int menuItemHeightSchedule; - int diskUsageWidth, diskUsageHeight; - int timersWidth; - int buttonsBorder, buttonWidth, buttonHeight; - int messageWidth, messageHeight; - int avrgFontWidth; - public: - cNopacityDisplayMenuView(); - virtual ~cNopacityDisplayMenuView(void); - cOsd *createOsd(void); - void SetGeometry(void); - void CreatePixmaps(void); - void SetPixmapAlpha(int Alpha); - void CreateFonts(void); - cFont *GetMenuItemFont(eMenuCategory menuCat); - cFont *GetMenuItemFontSmall(void); - void GetMenuItemSize(eMenuCategory menuCat, cPoint *itemSize); - int GetMaxItems(eMenuCategory menuCat); - int GetMenuTop(int numItems, int itemHeight); - void SetAvrgFontWidth(void); - int mytabs[cSkinDisplayMenu::MaxTabs]; - void SetTabs(int Tab1, int Tab2 = 0, int Tab3 = 0, int Tab4 = 0, int Tab5 = 0); - int GetEditableWidth(void); - int GetWidthDefaultMenu(void) {return menuItemWidthDefault;}; - int GetTextAreaWidth(void); - const cFont *GetTextAreaFont(bool FixedFont); - void CreateBackgroundImages(int *handleBackgrounds, int *handleButtons); - void AdjustContentBackground(bool contentNarrow, bool contentNarrowLast); - void DrawBorderDecoration(void); - int ShowHeaderLogo(bool show); - void DrawHeaderLogo(void); - int DrawHeaderIcon(eMenuCategory menuCat); - int ShowHeaderIconChannelLogo(const char *Title); - void DestroyHeaderIcon(void); - void DrawHeaderLabel(int left, cString label); - void DrawDate(bool initial); - void DrawDiskUsage(void); - void ShowDiskUsage(bool show); - void DrawButton(const char *text, int handleImage, tColor borderColor, int num); - void ClearButton(int num); - int GetTimersInitHeight(void); - int GetTimersMaxHeight(void); - cNopacityTimer *DrawTimer(const cTimer *Timer, int y); - void DrawScrollbar(double Height, double Offset); - void ClearScrollbar(void); - void DrawMessage(eMessageType Type, const char *Text); - void ClearMessage(void); - void SetDetailViewSize(eDetailViewType detailViewType, cNopacityMenuDetailView *detailView); - void ScalePreserveAspect(tArea & videoWindowDest, const double & videoAspect, const tArea & availableArea); - int spaceMenu; + private: + cOsd *osd; + cString lastDate; + int diskUsageAlert; + cPixmap *pixmapHeader; + cPixmap *pixmapHeaderLogo; + cPixmap *pixmapHeaderIcon; + cPixmap *pixmapHeaderLabel; + cPixmap *pixmapDate; + cPixmap *pixmapFooter; + cPixmap *pixmapContent; + cPixmap *pixmapScrollbar; + cPixmap *pixmapDiskUsage; + cPixmap *pixmapDiskUsageIcon; + cPixmap *pixmapDiskUsageLabel; + cPixmap *pixmapStatus; + cFont *fontHeader; + cFont *fontDate; + cFont *fontMenuitemLarge; + cFont *fontMenuitemSchedule; + cFont *fontMenuitemScheduleSmall; + cFont *fontMenuitemDefault; + cFont *fontDiskUsage; + cFont *fontTimers; + cFont *fontTimersHead; + cFont *fontButtons; + cFont *fontMessage; + int osdWidth, osdHeight; + int osdLeft, osdTop; + int vidWidth, vidHeight; + double vidAspect; + int widthScrollbar; + int dateWidth; + int headerHeight, footerHeight, contentHeight; + int contentWidthNarrow, contentWidthFull; + int menuItemWidthDefault, menuItemHeightDefault; + int menuItemWidthMain, menuItemHeightMain; + int menuItemHeightSchedule; + int diskUsageWidth, diskUsageHeight; + int timersWidth; + int buttonsBorder, buttonWidth, buttonHeight; + int messageWidth, messageHeight; + int avrgFontWidth; + public: + cNopacityDisplayMenuView(); + virtual ~cNopacityDisplayMenuView(void); + cOsd *createOsd(void); + void SetGeometry(void); + void CreatePixmaps(void); + void SetPixmapAlpha(int Alpha); + void CreateFonts(void); + cFont *GetMenuItemFont(eMenuCategory menuCat); + cFont *GetMenuItemFontSmall(void); + void GetMenuItemSize(eMenuCategory menuCat, cPoint *itemSize); + int GetMaxItems(eMenuCategory menuCat); + int GetMenuTop(int numItems, int itemHeight); + void SetAvrgFontWidth(void); + int mytabs[cSkinDisplayMenu::MaxTabs]; + void SetTabs(int Tab1, int Tab2 = 0, int Tab3 = 0, int Tab4 = 0, int Tab5 = 0); + int GetEditableWidth(void); + int GetWidthDefaultMenu(void) {return menuItemWidthDefault;}; + int GetTextAreaWidth(void); + const cFont *GetTextAreaFont(bool FixedFont); + void CreateBackgroundImages(int *handleBackgrounds, int *handleButtons); + void AdjustContentBackground(bool contentNarrow, bool contentNarrowLast); + void DrawBorderDecoration(void); + int ShowHeaderLogo(bool show); + void DrawHeaderLogo(void); + int DrawHeaderIcon(eMenuCategory menuCat); + int ShowHeaderIconChannelLogo(const char *Title); + void DestroyHeaderIcon(void); + void DrawHeaderLabel(int left, cString label); + void DrawDate(bool initial); + void DrawDiskUsage(void); + void ShowDiskUsage(bool show); + void DrawButton(const char *text, int handleImage, tColor borderColor, int num); + void ClearButton(int num); + int GetTimersInitHeight(void); + int GetTimersMaxHeight(void); + cNopacityTimer *DrawTimer(const cTimer *Timer, int y); + void DrawScrollbar(double Height, double Offset); + void ClearScrollbar(void); + void DrawMessage(eMessageType Type, const char *Text); + void ClearMessage(void); + void SetDetailViewSize(eDetailViewType detailViewType, cNopacityMenuDetailView *detailView); + void ScalePreserveAspect(tArea & videoWindowDest, const double & videoAspect, const tArea & availableArea); + int spaceMenu; }; diff --git a/displaymessage.c b/displaymessage.c index 999af3b..4b5fb47 100644 --- a/displaymessage.c +++ b/displaymessage.c @@ -1,74 +1,74 @@ #include "displaymessage.h" cNopacityDisplayMessage::cNopacityDisplayMessage(void) { - config.setDynamicValues(); - height = cOsd::OsdHeight() * config.messageHeight / 100; - int top = cOsd::OsdTop() + cOsd::OsdHeight() - height - config.messageBorderBottom; - width = cOsd::OsdWidth() * config.messageWidth / 100; - int left = (cOsd::OsdLeft() + cOsd::OsdWidth() - width) / 2; - osd = CreateOsd(left, top, width, height); - pixmap = osd->CreatePixmap(1, cRect(0, 0, width, height)); - if (config.messageFadeTime) - pixmap->SetAlpha(0); - font = cFont::CreateFont(config.fontName, height / 4 + 15 + config.fontMessage); - FrameTime = config.messageFrameTime; - FadeTime = config.messageFadeTime; + config.setDynamicValues(); + height = cOsd::OsdHeight() * config.messageHeight / 100; + int top = cOsd::OsdTop() + cOsd::OsdHeight() - height - config.messageBorderBottom; + width = cOsd::OsdWidth() * config.messageWidth / 100; + int left = (cOsd::OsdLeft() + cOsd::OsdWidth() - width) / 2; + osd = CreateOsd(left, top, width, height); + pixmap = osd->CreatePixmap(1, cRect(0, 0, width, height)); + if (config.messageFadeTime) + pixmap->SetAlpha(0); + font = cFont::CreateFont(config.fontName, height / 4 + 15 + config.fontMessage); + FrameTime = config.messageFrameTime; + FadeTime = config.messageFadeTime; } cNopacityDisplayMessage::~cNopacityDisplayMessage() { - Cancel(-1); - while (Active()) - cCondWait::SleepMs(10); - osd->DestroyPixmap(pixmap); - delete font; - delete osd; + Cancel(-1); + while (Active()) + cCondWait::SleepMs(10); + osd->DestroyPixmap(pixmap); + delete font; + delete osd; } void cNopacityDisplayMessage::SetMessage(eMessageType Type, const char *Text) { - tColor col = Theme.Color(clrMessageStatus); - switch (Type) { - case mtStatus: - col = Theme.Color(clrMessageStatus); - break; - case mtInfo: - col = Theme.Color(clrMessageInfo); - break; - case mtWarning: - col = Theme.Color(clrMessageWarning); - break; - case mtError: - col = Theme.Color(clrMessageError); - break; - } - pixmap->Fill(col); - cImageLoader imgLoader; - imgLoader.DrawBackground2(Theme.Color(clrMessageBlend), col, width-2, height-2); - pixmap->DrawImage(cPoint(1, 1), imgLoader.GetImage()); - int textWidth = font->Width(Text); - pixmap->DrawText(cPoint((width - textWidth) / 2, (height - font->Height()) / 2), Text, Theme.Color(clrMessageFont), clrTransparent, font); - if (config.messageFadeTime) - Start(); + tColor col = Theme.Color(clrMessageStatus); + switch (Type) { + case mtStatus: + col = Theme.Color(clrMessageStatus); + break; + case mtInfo: + col = Theme.Color(clrMessageInfo); + break; + case mtWarning: + col = Theme.Color(clrMessageWarning); + break; + case mtError: + col = Theme.Color(clrMessageError); + break; + } + pixmap->Fill(col); + cImageLoader imgLoader; + imgLoader.DrawBackground2(Theme.Color(clrMessageBlend), col, width-2, height-2); + pixmap->DrawImage(cPoint(1, 1), imgLoader.GetImage()); + int textWidth = font->Width(Text); + pixmap->DrawText(cPoint((width - textWidth) / 2, (height - font->Height()) / 2), Text, Theme.Color(clrMessageFont), clrTransparent, font); + if (config.messageFadeTime) + Start(); } void cNopacityDisplayMessage::Flush(void) { - osd->Flush(); + osd->Flush(); } void cNopacityDisplayMessage::Action(void) { - uint64_t Start = cTimeMs::Now(); - while (Running()) { - uint64_t Now = cTimeMs::Now(); - cPixmap::Lock(); - double t = min(double(Now - Start) / FadeTime, 1.0); - int Alpha = t * ALPHA_OPAQUE; - pixmap->SetAlpha(Alpha); - if (Running()) - osd->Flush(); - cPixmap::Unlock(); - int Delta = cTimeMs::Now() - Now; - if (Running() && (Delta < FrameTime)) - cCondWait::SleepMs(FrameTime - Delta); - if ((int)(Now - Start) > FadeTime) - break; - } + uint64_t Start = cTimeMs::Now(); + while (Running()) { + uint64_t Now = cTimeMs::Now(); + cPixmap::Lock(); + double t = min(double(Now - Start) / FadeTime, 1.0); + int Alpha = t * ALPHA_OPAQUE; + pixmap->SetAlpha(Alpha); + if (Running()) + osd->Flush(); + cPixmap::Unlock(); + int Delta = cTimeMs::Now() - Now; + if (Running() && (Delta < FrameTime)) + cCondWait::SleepMs(FrameTime - Delta); + if ((int)(Now - Start) > FadeTime) + break; + } } diff --git a/displaymessage.h b/displaymessage.h index bc7b6fb..b287e33 100644 --- a/displaymessage.h +++ b/displaymessage.h @@ -2,14 +2,14 @@ #define __NOPACITY_DISPLAYMESSAGE_H class cNopacityDisplayMessage : public cSkinDisplayMessage , cThread { private: - cOsd *osd; - int width; - int height; - cPixmap *pixmap; - cFont *font; - int FrameTime; - int FadeTime; - virtual void Action(void); + cOsd *osd; + int width; + int height; + cPixmap *pixmap; + cFont *font; + int FrameTime; + int FadeTime; + virtual void Action(void); public: cNopacityDisplayMessage(void); virtual ~cNopacityDisplayMessage(); diff --git a/displayreplay.c b/displayreplay.c index 873c1a1..a3cb933 100644 --- a/displayreplay.c +++ b/displayreplay.c @@ -1,326 +1,326 @@ #include "displayreplay.h" cNopacityDisplayReplay::cNopacityDisplayReplay(bool ModeOnly) { - config.setDynamicValues(); - initial = true; - modeOnly = ModeOnly; - lastDate = ""; - FrameTime = config.replayFrameTime; - FadeTime = config.replayFadeTime; + config.setDynamicValues(); + initial = true; + modeOnly = ModeOnly; + lastDate = ""; + FrameTime = config.replayFrameTime; + FadeTime = config.replayFadeTime; - SetGeometry(); - CreatePixmaps(); - DrawBackground(); - CreateFonts(); + SetGeometry(); + CreatePixmaps(); + DrawBackground(); + CreateFonts(); } cNopacityDisplayReplay::~cNopacityDisplayReplay() { - Cancel(-1); - while (Active()) - cCondWait::SleepMs(10); - if (!modeOnly) { - osd->DestroyPixmap(pixmapHeader); - osd->DestroyPixmap(pixmapBackground); - osd->DestroyPixmap(pixmapInfo); - osd->DestroyPixmap(pixmapDate); - osd->DestroyPixmap(pixmapInfo2); - osd->DestroyPixmap(pixmapProgressBar); - osd->DestroyPixmap(pixmapCurrent); - osd->DestroyPixmap(pixmapTotal); - osd->DestroyPixmap(pixmapJump); - osd->DestroyPixmap(pixmapFooter); - } - osd->DestroyPixmap(pixmapControls); - osd->DestroyPixmap(pixmapRew); - osd->DestroyPixmap(pixmapRewBackground); - osd->DestroyPixmap(pixmapRewSpeed); - osd->DestroyPixmap(pixmapPauseBackground); - osd->DestroyPixmap(pixmapPause); - osd->DestroyPixmap(pixmapPlayBackground); - osd->DestroyPixmap(pixmapPlay); - osd->DestroyPixmap(pixmapFwdBackground); - osd->DestroyPixmap(pixmapFwd); - osd->DestroyPixmap(pixmapFwdSpeed); - delete fontReplayHeader; - delete fontReplay; - delete osd; + Cancel(-1); + while (Active()) + cCondWait::SleepMs(10); + if (!modeOnly) { + osd->DestroyPixmap(pixmapHeader); + osd->DestroyPixmap(pixmapBackground); + osd->DestroyPixmap(pixmapInfo); + osd->DestroyPixmap(pixmapDate); + osd->DestroyPixmap(pixmapInfo2); + osd->DestroyPixmap(pixmapProgressBar); + osd->DestroyPixmap(pixmapCurrent); + osd->DestroyPixmap(pixmapTotal); + osd->DestroyPixmap(pixmapJump); + osd->DestroyPixmap(pixmapFooter); + } + osd->DestroyPixmap(pixmapControls); + osd->DestroyPixmap(pixmapRew); + osd->DestroyPixmap(pixmapRewBackground); + osd->DestroyPixmap(pixmapRewSpeed); + osd->DestroyPixmap(pixmapPauseBackground); + osd->DestroyPixmap(pixmapPause); + osd->DestroyPixmap(pixmapPlayBackground); + osd->DestroyPixmap(pixmapPlay); + osd->DestroyPixmap(pixmapFwdBackground); + osd->DestroyPixmap(pixmapFwd); + osd->DestroyPixmap(pixmapFwdSpeed); + delete fontReplayHeader; + delete fontReplay; + delete osd; } void cNopacityDisplayReplay::SetGeometry(void) { - height = cOsd::OsdHeight() * config.replayHeight / 100; - width = cOsd::OsdWidth() - 2 * config.replayBorderVertical; - int top = cOsd::OsdTop() + cOsd::OsdHeight() - height - config.replayBorderBottom; - osd = CreateOsd(cOsd::OsdLeft() + config.replayBorderVertical, top, width, height); - headerHeight = height * 0.2; - if (headerHeight%2 != 0) - headerHeight++; - footerHeight = headerHeight; - info2Height = 0.2 * height; - progressBarHeight = 0.1 * height; - if (progressBarHeight%2 != 0) - progressBarHeight++; - currentHeight = progressBarHeight + config.fontReplay; - controlsHeight = height - headerHeight - info2Height - footerHeight - progressBarHeight; + height = cOsd::OsdHeight() * config.replayHeight / 100; + width = cOsd::OsdWidth() - 2 * config.replayBorderVertical; + int top = cOsd::OsdTop() + cOsd::OsdHeight() - height - config.replayBorderBottom; + osd = CreateOsd(cOsd::OsdLeft() + config.replayBorderVertical, top, width, height); + headerHeight = height * 0.2; + if (headerHeight%2 != 0) + headerHeight++; + footerHeight = headerHeight; + info2Height = 0.2 * height; + progressBarHeight = 0.1 * height; + if (progressBarHeight%2 != 0) + progressBarHeight++; + currentHeight = progressBarHeight + config.fontReplay; + controlsHeight = height - headerHeight - info2Height - footerHeight - progressBarHeight; - infoWidth = 0.75 * width; - dateWidth = width - infoWidth; - - jumpX = (width - 4 * controlsHeight)/2 + 5*controlsHeight; - jumpY = headerHeight + info2Height + progressBarHeight; - jumpWidth = width - jumpX; - jumpHeight = controlsHeight; + infoWidth = 0.75 * width; + dateWidth = width - infoWidth; + + jumpX = (width - 4 * controlsHeight)/2 + 5*controlsHeight; + jumpY = headerHeight + info2Height + progressBarHeight; + jumpWidth = width - jumpX; + jumpHeight = controlsHeight; } void cNopacityDisplayReplay::CreatePixmaps(void) { - if (!modeOnly) { - pixmapHeader = osd->CreatePixmap(1, cRect(0, 0, width, headerHeight)); - pixmapBackground = osd->CreatePixmap(1, cRect(0, headerHeight, width, info2Height + progressBarHeight + controlsHeight)); - pixmapFooter = osd->CreatePixmap(1, cRect(0, headerHeight + info2Height + progressBarHeight + controlsHeight, width, footerHeight)); - pixmapInfo = osd->CreatePixmap(2, cRect(0, 0, infoWidth, headerHeight)); - pixmapDate = osd->CreatePixmap(2, cRect(infoWidth, 0, dateWidth, headerHeight)); - pixmapInfo2 = osd->CreatePixmap(2, cRect(0, headerHeight, width, info2Height)); - pixmapProgressBar = osd->CreatePixmap(2, cRect(0, headerHeight + info2Height, width, progressBarHeight)); - pixmapCurrent = osd->CreatePixmap(3, cRect(0, headerHeight + info2Height + progressBarHeight, width/5, currentHeight)); - pixmapTotal = osd->CreatePixmap(3, cRect(4*width/5, headerHeight + info2Height + progressBarHeight, width/5, currentHeight)); - pixmapJump = osd->CreatePixmap(4, cRect(jumpX, jumpY, jumpWidth, jumpHeight)); - } - - int controlY = headerHeight + info2Height + progressBarHeight; - iconBorder = 5; - iconSize = min(controlsHeight - 2*iconBorder, 128); - int backgroundWidth = 2 * iconBorder + iconSize; + if (!modeOnly) { + pixmapHeader = osd->CreatePixmap(1, cRect(0, 0, width, headerHeight)); + pixmapBackground = osd->CreatePixmap(1, cRect(0, headerHeight, width, info2Height + progressBarHeight + controlsHeight)); + pixmapFooter = osd->CreatePixmap(1, cRect(0, headerHeight + info2Height + progressBarHeight + controlsHeight, width, footerHeight)); + pixmapInfo = osd->CreatePixmap(2, cRect(0, 0, infoWidth, headerHeight)); + pixmapDate = osd->CreatePixmap(2, cRect(infoWidth, 0, dateWidth, headerHeight)); + pixmapInfo2 = osd->CreatePixmap(2, cRect(0, headerHeight, width, info2Height)); + pixmapProgressBar = osd->CreatePixmap(2, cRect(0, headerHeight + info2Height, width, progressBarHeight)); + pixmapCurrent = osd->CreatePixmap(3, cRect(0, headerHeight + info2Height + progressBarHeight, width/5, currentHeight)); + pixmapTotal = osd->CreatePixmap(3, cRect(4*width/5, headerHeight + info2Height + progressBarHeight, width/5, currentHeight)); + pixmapJump = osd->CreatePixmap(4, cRect(jumpX, jumpY, jumpWidth, jumpHeight)); + } + + int controlY = headerHeight + info2Height + progressBarHeight; + iconBorder = 5; + iconSize = min(controlsHeight - 2*iconBorder, 128); + int backgroundWidth = 2 * iconBorder + iconSize; - if (!modeOnly) { - pixmapControls = osd->CreatePixmap(2, cRect(0, controlY, width, controlsHeight)); - } else { - pixmapControls = osd->CreatePixmap(2, cRect( (width - (5 * backgroundWidth))/2, controlY - 10, 5 * backgroundWidth, controlsHeight + 20)); - } - pixmapRewBackground = osd->CreatePixmap(3, cRect((width - 4 * backgroundWidth)/2, controlY, iconSize + 2*iconBorder, iconSize + 2*iconBorder)); - pixmapRew = osd->CreatePixmap(4, cRect((width - 4 * backgroundWidth)/2 + iconBorder, controlY + iconBorder, iconSize, iconSize)); - pixmapRewSpeed = osd->CreatePixmap(5, cRect((width - 4 * backgroundWidth)/2 + iconBorder, controlY + iconBorder, iconSize, iconSize)); - pixmapPauseBackground = osd->CreatePixmap(3, cRect((width - 4 * backgroundWidth)/2 + iconSize + 2*iconBorder, controlY, iconSize + 2*iconBorder, iconSize + 2*iconBorder)); - pixmapPause = osd->CreatePixmap(4, cRect((width - 4 * backgroundWidth)/2 + (iconSize + 2*iconBorder) + iconBorder, controlY + iconBorder, iconSize, iconSize)); - pixmapPlayBackground = osd->CreatePixmap(3, cRect((width - 4 * backgroundWidth)/2 + 2*(iconSize + 2*iconBorder), controlY, iconSize + 2*iconBorder, iconSize + 2*iconBorder)); - pixmapPlay = osd->CreatePixmap(4, cRect((width - 4 * backgroundWidth)/2 + 2*(iconSize + 2*iconBorder) + iconBorder, controlY + iconBorder, iconSize, iconSize)); - pixmapFwdBackground = osd->CreatePixmap(3, cRect((width - 4 * backgroundWidth)/2 + 3*(iconSize + 2*iconBorder), controlY, iconSize + 2*iconBorder, iconSize + 2*iconBorder)); - pixmapFwd = osd->CreatePixmap(4, cRect((width - 4 * backgroundWidth)/2 + 3*(iconSize + 2*iconBorder) + iconBorder, controlY + iconBorder, iconSize, iconSize)); - pixmapFwdSpeed = osd->CreatePixmap(5, cRect((width - 4 * backgroundWidth)/2 + 3*(iconSize + 2*iconBorder) + iconBorder, controlY + iconBorder, iconSize, iconSize)); + if (!modeOnly) { + pixmapControls = osd->CreatePixmap(2, cRect(0, controlY, width, controlsHeight)); + } else { + pixmapControls = osd->CreatePixmap(2, cRect( (width - (5 * backgroundWidth))/2, controlY - 10, 5 * backgroundWidth, controlsHeight + 20)); + } + pixmapRewBackground = osd->CreatePixmap(3, cRect((width - 4 * backgroundWidth)/2, controlY, iconSize + 2*iconBorder, iconSize + 2*iconBorder)); + pixmapRew = osd->CreatePixmap(4, cRect((width - 4 * backgroundWidth)/2 + iconBorder, controlY + iconBorder, iconSize, iconSize)); + pixmapRewSpeed = osd->CreatePixmap(5, cRect((width - 4 * backgroundWidth)/2 + iconBorder, controlY + iconBorder, iconSize, iconSize)); + pixmapPauseBackground = osd->CreatePixmap(3, cRect((width - 4 * backgroundWidth)/2 + iconSize + 2*iconBorder, controlY, iconSize + 2*iconBorder, iconSize + 2*iconBorder)); + pixmapPause = osd->CreatePixmap(4, cRect((width - 4 * backgroundWidth)/2 + (iconSize + 2*iconBorder) + iconBorder, controlY + iconBorder, iconSize, iconSize)); + pixmapPlayBackground = osd->CreatePixmap(3, cRect((width - 4 * backgroundWidth)/2 + 2*(iconSize + 2*iconBorder), controlY, iconSize + 2*iconBorder, iconSize + 2*iconBorder)); + pixmapPlay = osd->CreatePixmap(4, cRect((width - 4 * backgroundWidth)/2 + 2*(iconSize + 2*iconBorder) + iconBorder, controlY + iconBorder, iconSize, iconSize)); + pixmapFwdBackground = osd->CreatePixmap(3, cRect((width - 4 * backgroundWidth)/2 + 3*(iconSize + 2*iconBorder), controlY, iconSize + 2*iconBorder, iconSize + 2*iconBorder)); + pixmapFwd = osd->CreatePixmap(4, cRect((width - 4 * backgroundWidth)/2 + 3*(iconSize + 2*iconBorder) + iconBorder, controlY + iconBorder, iconSize, iconSize)); + pixmapFwdSpeed = osd->CreatePixmap(5, cRect((width - 4 * backgroundWidth)/2 + 3*(iconSize + 2*iconBorder) + iconBorder, controlY + iconBorder, iconSize, iconSize)); - LoadControlIcons(); - - if (config.replayFadeTime) { - if (!modeOnly) { - pixmapHeader->SetAlpha(0); - pixmapBackground->SetAlpha(0); - pixmapInfo->SetAlpha(0); - pixmapDate->SetAlpha(0); - pixmapInfo2->SetAlpha(0); - pixmapProgressBar->SetAlpha(0); - pixmapCurrent->SetAlpha(0); - pixmapTotal->SetAlpha(0); - pixmapJump->SetAlpha(0); - pixmapFooter->SetAlpha(0); - } - pixmapControls->SetAlpha(0); - pixmapRewBackground->SetAlpha(0); - pixmapRew->SetAlpha(0); - pixmapRewSpeed->SetAlpha(0); - pixmapPauseBackground->SetAlpha(0); - pixmapPause->SetAlpha(0); - pixmapPlayBackground->SetAlpha(0); - pixmapPlay->SetAlpha(0); - pixmapFwdBackground->SetAlpha(0); - pixmapFwd->SetAlpha(0); - pixmapFwdSpeed->SetAlpha(0); - } + LoadControlIcons(); + + if (config.replayFadeTime) { + if (!modeOnly) { + pixmapHeader->SetAlpha(0); + pixmapBackground->SetAlpha(0); + pixmapInfo->SetAlpha(0); + pixmapDate->SetAlpha(0); + pixmapInfo2->SetAlpha(0); + pixmapProgressBar->SetAlpha(0); + pixmapCurrent->SetAlpha(0); + pixmapTotal->SetAlpha(0); + pixmapJump->SetAlpha(0); + pixmapFooter->SetAlpha(0); + } + pixmapControls->SetAlpha(0); + pixmapRewBackground->SetAlpha(0); + pixmapRew->SetAlpha(0); + pixmapRewSpeed->SetAlpha(0); + pixmapPauseBackground->SetAlpha(0); + pixmapPause->SetAlpha(0); + pixmapPlayBackground->SetAlpha(0); + pixmapPlay->SetAlpha(0); + pixmapFwdBackground->SetAlpha(0); + pixmapFwd->SetAlpha(0); + pixmapFwdSpeed->SetAlpha(0); + } } void cNopacityDisplayReplay::CreateFonts(void) { - fontReplayHeader = cFont::CreateFont(config.fontName, headerHeight - 8 + config.fontReplayHeader); - fontReplay = cFont::CreateFont(config.fontName, currentHeight); + fontReplayHeader = cFont::CreateFont(config.fontName, headerHeight - 8 + config.fontReplayHeader); + fontReplay = cFont::CreateFont(config.fontName, currentHeight); } void cNopacityDisplayReplay::DrawBackground(void) { - if (!modeOnly) { - DrawBlendedBackground(pixmapHeader, Theme.Color(clrReplayBackground), Theme.Color(clrReplayBackBlend), true); - pixmapHeader->DrawEllipse(cRect(0,0, headerHeight/2, headerHeight/2), clrTransparent, -2); - pixmapHeader->DrawEllipse(cRect(width - headerHeight/2 ,0 ,headerHeight/2,headerHeight/2), clrTransparent, -1); - pixmapBackground->Fill(Theme.Color(clrReplayBackground)); - pixmapControls->Fill(clrTransparent); - pixmapProgressBar->Fill(clrTransparent); - pixmapJump->Fill(clrTransparent); - DrawBlendedBackground(pixmapFooter, Theme.Color(clrReplayBackground), Theme.Color(clrReplayBackBlend), false); - pixmapFooter->DrawEllipse(cRect(0,footerHeight/2,footerHeight/2,footerHeight/2), clrTransparent, -3); - pixmapFooter->DrawEllipse(cRect(width - footerHeight/2, footerHeight/2 ,footerHeight/2,footerHeight/2), clrTransparent, -4); - } else { - pixmapControls->Fill(Theme.Color(clrMenuBorder)); - pixmapControls->DrawRectangle(cRect(2, 2, pixmapControls->ViewPort().Width() - 4, pixmapControls->ViewPort().Height() - 4),Theme.Color(clrReplayBackground)); - } + if (!modeOnly) { + DrawBlendedBackground(pixmapHeader, Theme.Color(clrReplayBackground), Theme.Color(clrReplayBackBlend), true); + pixmapHeader->DrawEllipse(cRect(0,0, headerHeight/2, headerHeight/2), clrTransparent, -2); + pixmapHeader->DrawEllipse(cRect(width - headerHeight/2 ,0 ,headerHeight/2,headerHeight/2), clrTransparent, -1); + pixmapBackground->Fill(Theme.Color(clrReplayBackground)); + pixmapControls->Fill(clrTransparent); + pixmapProgressBar->Fill(clrTransparent); + pixmapJump->Fill(clrTransparent); + DrawBlendedBackground(pixmapFooter, Theme.Color(clrReplayBackground), Theme.Color(clrReplayBackBlend), false); + pixmapFooter->DrawEllipse(cRect(0,footerHeight/2,footerHeight/2,footerHeight/2), clrTransparent, -3); + pixmapFooter->DrawEllipse(cRect(width - footerHeight/2, footerHeight/2 ,footerHeight/2,footerHeight/2), clrTransparent, -4); + } else { + pixmapControls->Fill(Theme.Color(clrMenuBorder)); + pixmapControls->DrawRectangle(cRect(2, 2, pixmapControls->ViewPort().Width() - 4, pixmapControls->ViewPort().Height() - 4),Theme.Color(clrReplayBackground)); + } } void cNopacityDisplayReplay::LoadControlIcons(void) { - - pixmapRew->Fill(clrTransparent); - pixmapPause->Fill(clrTransparent); - pixmapPlay->Fill(clrTransparent); - pixmapFwd->Fill(clrTransparent); - - cImageLoader imgLoader; - if (imgLoader.LoadIcon("rew", iconSize)) { - pixmapRew->DrawImage(cPoint(0,0), imgLoader.GetImage()); - } - if (imgLoader.LoadIcon("pause", iconSize)) { - pixmapPause->DrawImage(cPoint(0,0), imgLoader.GetImage()); - } - if (imgLoader.LoadIcon("play", iconSize)) { - pixmapPlay->DrawImage(cPoint(0,0), imgLoader.GetImage()); - } - if (imgLoader.LoadIcon("fwd", iconSize)) { - pixmapFwd->DrawImage(cPoint(0,0), imgLoader.GetImage()); - } + + pixmapRew->Fill(clrTransparent); + pixmapPause->Fill(clrTransparent); + pixmapPlay->Fill(clrTransparent); + pixmapFwd->Fill(clrTransparent); + + cImageLoader imgLoader; + if (imgLoader.LoadIcon("rew", iconSize)) { + pixmapRew->DrawImage(cPoint(0,0), imgLoader.GetImage()); + } + if (imgLoader.LoadIcon("pause", iconSize)) { + pixmapPause->DrawImage(cPoint(0,0), imgLoader.GetImage()); + } + if (imgLoader.LoadIcon("play", iconSize)) { + pixmapPlay->DrawImage(cPoint(0,0), imgLoader.GetImage()); + } + if (imgLoader.LoadIcon("fwd", iconSize)) { + pixmapFwd->DrawImage(cPoint(0,0), imgLoader.GetImage()); + } } void cNopacityDisplayReplay::DrawDate(void) { - cString curDate = DayDateTime(); - if (initial || strcmp(curDate, lastDate)) { - int strDateWidth = fontReplay->Width(curDate); - int strDateHeight = fontReplay->Height(); - int x = dateWidth - strDateWidth - headerHeight/2; - int y = (headerHeight - strDateHeight) / 2; - pixmapDate->Fill(clrTransparent); - pixmapDate->DrawText(cPoint(x, y), curDate, Theme.Color(clrReplayHead), clrTransparent, fontReplay); - lastDate = curDate; + cString curDate = DayDateTime(); + if (initial || strcmp(curDate, lastDate)) { + int strDateWidth = fontReplay->Width(curDate); + int strDateHeight = fontReplay->Height(); + int x = dateWidth - strDateWidth - headerHeight/2; + int y = (headerHeight - strDateHeight) / 2; + pixmapDate->Fill(clrTransparent); + pixmapDate->DrawText(cPoint(x, y), curDate, Theme.Color(clrReplayHead), clrTransparent, fontReplay); + lastDate = curDate; } } void cNopacityDisplayReplay::SetRecording(const cRecording *Recording) { - const cRecordingInfo *RecordingInfo = Recording->Info(); - SetTitle(RecordingInfo->Title()); - cString info2; - if (RecordingInfo->ShortText()) - info2 = cString::sprintf("%s - %s %s", RecordingInfo->ShortText(), *ShortDateString(Recording->Start()), *TimeString(Recording->Start())); - else - info2 = cString::sprintf("%s %s", *ShortDateString(Recording->Start()), *TimeString(Recording->Start())); - - pixmapInfo2->Fill(clrTransparent); - pixmapInfo2->DrawText(cPoint(headerHeight/2, max( (info2Height - fontReplay->Height())/2 - 10,0 )), *info2, Theme.Color(clrReplayDescription), clrTransparent, fontReplay); + const cRecordingInfo *RecordingInfo = Recording->Info(); + SetTitle(RecordingInfo->Title()); + cString info2; + if (RecordingInfo->ShortText()) + info2 = cString::sprintf("%s - %s %s", RecordingInfo->ShortText(), *ShortDateString(Recording->Start()), *TimeString(Recording->Start())); + else + info2 = cString::sprintf("%s %s", *ShortDateString(Recording->Start()), *TimeString(Recording->Start())); + + pixmapInfo2->Fill(clrTransparent); + pixmapInfo2->DrawText(cPoint(headerHeight/2, max( (info2Height - fontReplay->Height())/2 - 10,0 )), *info2, Theme.Color(clrReplayDescription), clrTransparent, fontReplay); } void cNopacityDisplayReplay::SetTitle(const char *Title) { - pixmapInfo->Fill(clrTransparent); - pixmapInfo->DrawText(cPoint(headerHeight/2, 0), Title, Theme.Color(clrReplayHead), clrTransparent, fontReplayHeader); + pixmapInfo->Fill(clrTransparent); + pixmapInfo->DrawText(cPoint(headerHeight/2, 0), Title, Theme.Color(clrReplayHead), clrTransparent, fontReplayHeader); } void cNopacityDisplayReplay::SetMode(bool Play, bool Forward, int Speed) { - pixmapRewBackground->Fill(clrTransparent); - pixmapRewSpeed->Fill(clrTransparent); - pixmapPauseBackground->Fill(clrTransparent); - pixmapPlayBackground->Fill(clrTransparent); - pixmapFwdBackground->Fill(clrTransparent); - pixmapFwdSpeed->Fill(clrTransparent); + pixmapRewBackground->Fill(clrTransparent); + pixmapRewSpeed->Fill(clrTransparent); + pixmapPauseBackground->Fill(clrTransparent); + pixmapPlayBackground->Fill(clrTransparent); + pixmapFwdBackground->Fill(clrTransparent); + pixmapFwdSpeed->Fill(clrTransparent); - if (!Play) { - pixmapPauseBackground->Fill(Theme.Color(clrReplayHighlightIcon)); - } else if (Play && (Speed < 0)) { - pixmapPlayBackground->Fill(Theme.Color(clrReplayHighlightIcon)); - } else if (Play && Forward) { - pixmapFwdBackground->Fill(Theme.Color(clrReplayHighlightIcon)); - if (Speed > 0) { - cString speed = cString::sprintf("x%d", Speed); - int sWidth = fontReplayHeader->Width(*speed); - pixmapFwdSpeed->DrawText(cPoint((iconSize - sWidth)/2, (iconSize - fontReplayHeader->Height())/2), *speed, Theme.Color(clrReplayHighlightIcon), clrTransparent, fontReplayHeader); - } - } else if (Play && !Forward) { - pixmapRewBackground->Fill(Theme.Color(clrReplayHighlightIcon)); - if (Speed > 0) { - cString speed = cString::sprintf("x%d", Speed); - int sWidth = fontReplayHeader->Width(*speed); - pixmapRewSpeed->DrawText(cPoint((iconSize - sWidth)/2, (iconSize - fontReplayHeader->Height())/2), *speed, Theme.Color(clrReplayHighlightIcon), clrTransparent, fontReplayHeader); - } - } - + if (!Play) { + pixmapPauseBackground->Fill(Theme.Color(clrReplayHighlightIcon)); + } else if (Play && (Speed < 0)) { + pixmapPlayBackground->Fill(Theme.Color(clrReplayHighlightIcon)); + } else if (Play && Forward) { + pixmapFwdBackground->Fill(Theme.Color(clrReplayHighlightIcon)); + if (Speed > 0) { + cString speed = cString::sprintf("x%d", Speed); + int sWidth = fontReplayHeader->Width(*speed); + pixmapFwdSpeed->DrawText(cPoint((iconSize - sWidth)/2, (iconSize - fontReplayHeader->Height())/2), *speed, Theme.Color(clrReplayHighlightIcon), clrTransparent, fontReplayHeader); + } + } else if (Play && !Forward) { + pixmapRewBackground->Fill(Theme.Color(clrReplayHighlightIcon)); + if (Speed > 0) { + cString speed = cString::sprintf("x%d", Speed); + int sWidth = fontReplayHeader->Width(*speed); + pixmapRewSpeed->DrawText(cPoint((iconSize - sWidth)/2, (iconSize - fontReplayHeader->Height())/2), *speed, Theme.Color(clrReplayHighlightIcon), clrTransparent, fontReplayHeader); + } + } + } void cNopacityDisplayReplay::SetProgress(int Current, int Total) { - int barWidth = width - 2*progressBarHeight; - cProgressBar pb(barWidth, progressBarHeight-2, Current, Total, marks, Theme.Color(clrReplayProgressSeen), Theme.Color(clrReplayProgressRest), Theme.Color(clrReplayProgressSelected), Theme.Color(clrReplayProgressMark), Theme.Color(clrReplayProgressCurrent)); - pixmapProgressBar->DrawEllipse(cRect(progressBarHeight/2, 0, progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack)); - pixmapProgressBar->DrawEllipse(cRect(barWidth + progressBarHeight/2, 0, progressBarHeight, progressBarHeight), Theme.Color(clrReplayProgressRest)); - pixmapProgressBar->DrawRectangle(cRect( progressBarHeight, 0, barWidth, progressBarHeight), Theme.Color(clrProgressBarBack)); - pixmapProgressBar->DrawEllipse(cRect(progressBarHeight/2+1, 1, progressBarHeight-1, progressBarHeight-2), Theme.Color(clrReplayProgressSeen)); - pixmapProgressBar->DrawBitmap(cPoint(progressBarHeight, 1), pb); + int barWidth = width - 2*progressBarHeight; + cProgressBar pb(barWidth, progressBarHeight-2, Current, Total, marks, Theme.Color(clrReplayProgressSeen), Theme.Color(clrReplayProgressRest), Theme.Color(clrReplayProgressSelected), Theme.Color(clrReplayProgressMark), Theme.Color(clrReplayProgressCurrent)); + pixmapProgressBar->DrawEllipse(cRect(progressBarHeight/2, 0, progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack)); + pixmapProgressBar->DrawEllipse(cRect(barWidth + progressBarHeight/2, 0, progressBarHeight, progressBarHeight), Theme.Color(clrReplayProgressRest)); + pixmapProgressBar->DrawRectangle(cRect( progressBarHeight, 0, barWidth, progressBarHeight), Theme.Color(clrProgressBarBack)); + pixmapProgressBar->DrawEllipse(cRect(progressBarHeight/2+1, 1, progressBarHeight-1, progressBarHeight-2), Theme.Color(clrReplayProgressSeen)); + pixmapProgressBar->DrawBitmap(cPoint(progressBarHeight, 1), pb); } void cNopacityDisplayReplay::SetCurrent(const char *Current) { - pixmapCurrent->Fill(clrTransparent); - pixmapCurrent->DrawText(cPoint(headerHeight/2, 0), Current, Theme.Color(clrReplayCurrentTotal), clrTransparent, fontReplay); + pixmapCurrent->Fill(clrTransparent); + pixmapCurrent->DrawText(cPoint(headerHeight/2, 0), Current, Theme.Color(clrReplayCurrentTotal), clrTransparent, fontReplay); } void cNopacityDisplayReplay::SetTotal(const char *Total) { - pixmapTotal->Fill(clrTransparent); - pixmapTotal->DrawText(cPoint(width/5 - (fontReplay->Width(Total) + headerHeight/2), 0), Total, Theme.Color(clrReplayCurrentTotal), clrTransparent, fontReplay); + pixmapTotal->Fill(clrTransparent); + pixmapTotal->DrawText(cPoint(width/5 - (fontReplay->Width(Total) + headerHeight/2), 0), Total, Theme.Color(clrReplayCurrentTotal), clrTransparent, fontReplay); } void cNopacityDisplayReplay::SetJump(const char *Jump) { - pixmapJump->Fill(clrTransparent); - if (Jump) { - pixmapJump->DrawText(cPoint(0, (jumpHeight - fontReplayHeader->Height())/2), Jump, Theme.Color(clrReplayCurrentTotal), clrTransparent, fontReplayHeader); - } + pixmapJump->Fill(clrTransparent); + if (Jump) { + pixmapJump->DrawText(cPoint(0, (jumpHeight - fontReplayHeader->Height())/2), Jump, Theme.Color(clrReplayCurrentTotal), clrTransparent, fontReplayHeader); + } } void cNopacityDisplayReplay::SetMessage(eMessageType Type, const char *Text) { } void cNopacityDisplayReplay::Flush(void) { - if (!modeOnly) { - DrawDate(); - } - if (initial) { - if (config.replayFadeTime) - Start(); - } - initial = false; - osd->Flush(); + if (!modeOnly) { + DrawDate(); + } + if (initial) { + if (config.replayFadeTime) + Start(); + } + initial = false; + osd->Flush(); } void cNopacityDisplayReplay::Action(void) { - uint64_t Start = cTimeMs::Now(); - while (Running()) { - uint64_t Now = cTimeMs::Now(); - cPixmap::Lock(); - double t = min(double(Now - Start) / FadeTime, 1.0); - int Alpha = t * ALPHA_OPAQUE; - if (!modeOnly) { - pixmapHeader->SetAlpha(Alpha); - pixmapBackground->SetAlpha(Alpha); - pixmapInfo->SetAlpha(Alpha); - pixmapDate->SetAlpha(Alpha); - pixmapInfo2->SetAlpha(Alpha); - pixmapProgressBar->SetAlpha(Alpha); - pixmapCurrent->SetAlpha(Alpha); - pixmapTotal->SetAlpha(Alpha); - pixmapJump->SetAlpha(Alpha); - pixmapFooter->SetAlpha(Alpha); - } - pixmapControls->SetAlpha(Alpha); - pixmapRewBackground->SetAlpha(Alpha); - pixmapRew->SetAlpha(Alpha); - pixmapRewSpeed->SetAlpha(Alpha); - pixmapPauseBackground->SetAlpha(Alpha); - pixmapPause->SetAlpha(Alpha); - pixmapPlayBackground->SetAlpha(Alpha); - pixmapPlay->SetAlpha(Alpha); - pixmapFwdBackground->SetAlpha(Alpha); - pixmapFwd->SetAlpha(Alpha); - pixmapFwdSpeed->SetAlpha(Alpha); - if (Running()) - osd->Flush(); - cPixmap::Unlock(); - int Delta = cTimeMs::Now() - Now; - if (Running() && (Delta < FrameTime)) - cCondWait::SleepMs(FrameTime - Delta); - if ((int)(Now - Start) > FadeTime) - break; - } + uint64_t Start = cTimeMs::Now(); + while (Running()) { + uint64_t Now = cTimeMs::Now(); + cPixmap::Lock(); + double t = min(double(Now - Start) / FadeTime, 1.0); + int Alpha = t * ALPHA_OPAQUE; + if (!modeOnly) { + pixmapHeader->SetAlpha(Alpha); + pixmapBackground->SetAlpha(Alpha); + pixmapInfo->SetAlpha(Alpha); + pixmapDate->SetAlpha(Alpha); + pixmapInfo2->SetAlpha(Alpha); + pixmapProgressBar->SetAlpha(Alpha); + pixmapCurrent->SetAlpha(Alpha); + pixmapTotal->SetAlpha(Alpha); + pixmapJump->SetAlpha(Alpha); + pixmapFooter->SetAlpha(Alpha); + } + pixmapControls->SetAlpha(Alpha); + pixmapRewBackground->SetAlpha(Alpha); + pixmapRew->SetAlpha(Alpha); + pixmapRewSpeed->SetAlpha(Alpha); + pixmapPauseBackground->SetAlpha(Alpha); + pixmapPause->SetAlpha(Alpha); + pixmapPlayBackground->SetAlpha(Alpha); + pixmapPlay->SetAlpha(Alpha); + pixmapFwdBackground->SetAlpha(Alpha); + pixmapFwd->SetAlpha(Alpha); + pixmapFwdSpeed->SetAlpha(Alpha); + if (Running()) + osd->Flush(); + cPixmap::Unlock(); + int Delta = cTimeMs::Now() - Now; + if (Running() && (Delta < FrameTime)) + cCondWait::SleepMs(FrameTime - Delta); + if ((int)(Now - Start) > FadeTime) + break; + } } diff --git a/displayreplay.h b/displayreplay.h index 015a9f0..d80ff5b 100644 --- a/displayreplay.h +++ b/displayreplay.h @@ -3,55 +3,55 @@ class cNopacityDisplayReplay : public cSkinDisplayReplay , cThread{ private: - cOsd *osd; - bool initial; - bool modeOnly; - cString lastDate; - int width; - int height; - int headerHeight; - int info2Height; - int progressBarHeight; - int currentHeight; - int controlsHeight; - int footerHeight; - int infoWidth; - int dateWidth; - int iconSize, iconBorder; - int jumpX, jumpY; - int jumpWidth, jumpHeight; - int FrameTime; - int FadeTime; - cPixmap *pixmapHeader; - cPixmap *pixmapBackground; - cPixmap *pixmapInfo; - cPixmap *pixmapDate; - cPixmap *pixmapInfo2; - cPixmap *pixmapProgressBar; - cPixmap *pixmapCurrent; - cPixmap *pixmapTotal; - cPixmap *pixmapControls; - cPixmap *pixmapRew; - cPixmap *pixmapRewBackground; - cPixmap *pixmapRewSpeed; - cPixmap *pixmapPause; - cPixmap *pixmapPauseBackground; - cPixmap *pixmapPlay; - cPixmap *pixmapPlayBackground; - cPixmap *pixmapFwd; - cPixmap *pixmapFwdBackground; - cPixmap *pixmapFwdSpeed; - cPixmap *pixmapJump; - cPixmap *pixmapFooter; - cFont *fontReplayHeader; - cFont *fontReplay; - virtual void Action(void); - void SetGeometry(void); - void CreatePixmaps(void); - void CreateFonts(void); - void DrawBackground(void); - void DrawDate(void); - void LoadControlIcons(void); + cOsd *osd; + bool initial; + bool modeOnly; + cString lastDate; + int width; + int height; + int headerHeight; + int info2Height; + int progressBarHeight; + int currentHeight; + int controlsHeight; + int footerHeight; + int infoWidth; + int dateWidth; + int iconSize, iconBorder; + int jumpX, jumpY; + int jumpWidth, jumpHeight; + int FrameTime; + int FadeTime; + cPixmap *pixmapHeader; + cPixmap *pixmapBackground; + cPixmap *pixmapInfo; + cPixmap *pixmapDate; + cPixmap *pixmapInfo2; + cPixmap *pixmapProgressBar; + cPixmap *pixmapCurrent; + cPixmap *pixmapTotal; + cPixmap *pixmapControls; + cPixmap *pixmapRew; + cPixmap *pixmapRewBackground; + cPixmap *pixmapRewSpeed; + cPixmap *pixmapPause; + cPixmap *pixmapPauseBackground; + cPixmap *pixmapPlay; + cPixmap *pixmapPlayBackground; + cPixmap *pixmapFwd; + cPixmap *pixmapFwdBackground; + cPixmap *pixmapFwdSpeed; + cPixmap *pixmapJump; + cPixmap *pixmapFooter; + cFont *fontReplayHeader; + cFont *fontReplay; + virtual void Action(void); + void SetGeometry(void); + void CreatePixmaps(void); + void CreateFonts(void); + void DrawBackground(void); + void DrawDate(void); + void LoadControlIcons(void); public: cNopacityDisplayReplay(bool ModeOnly); virtual ~cNopacityDisplayReplay(); diff --git a/displaytracks.c b/displaytracks.c index 5948aa7..37a55b5 100644 --- a/displaytracks.c +++ b/displaytracks.c @@ -2,189 +2,189 @@ #include "displaytracks.h" cNopacityDisplayTracks::cNopacityDisplayTracks(const char *Title, int NumTracks, const char * const *Tracks) { - config.setDynamicValues(); - initial = true; - currentIndex = -1; - numTracks = NumTracks; - FrameTime = config.tracksFrameTime; - FadeTime = config.tracksFadeTime; - SetGeometry(); - CreatePixmaps(); - CreateFonts(); - CreateBackgroundImages(); - DrawHeader(Title); - for (int i = 0; i < NumTracks; i++) - SetItem(Tracks[i], i, false); + config.setDynamicValues(); + initial = true; + currentIndex = -1; + numTracks = NumTracks; + FrameTime = config.tracksFrameTime; + FadeTime = config.tracksFadeTime; + SetGeometry(); + CreatePixmaps(); + CreateFonts(); + CreateBackgroundImages(); + DrawHeader(Title); + for (int i = 0; i < NumTracks; i++) + SetItem(Tracks[i], i, false); } cNopacityDisplayTracks::~cNopacityDisplayTracks() { - Cancel(-1); - while (Active()) - cCondWait::SleepMs(10); - osd->DestroyPixmap(pixmapContainer); - osd->DestroyPixmap(pixmapHeader); - menuItems.Clear(); - for (int i=0; i<2; i++) - cOsdProvider::DropImage(handleBackgrounds[i]); - delete font; - delete fontHeader; - delete osd; + Cancel(-1); + while (Active()) + cCondWait::SleepMs(10); + osd->DestroyPixmap(pixmapContainer); + osd->DestroyPixmap(pixmapHeader); + menuItems.Clear(); + for (int i=0; i<2; i++) + cOsdProvider::DropImage(handleBackgrounds[i]); + delete font; + delete fontHeader; + delete osd; } cBitmap cNopacityDisplayTracks::bmStereo(audio_xpm); cBitmap cNopacityDisplayTracks::bmDolbyDigital(dolbydigital_xpm); void cNopacityDisplayTracks::SetGeometry(void) { - width = cOsd::OsdWidth() * config.tracksWidth / 100; - height = cOsd::OsdHeight() * config.tracksHeight / 100; - if (!height%(numTracks + 1)) { - height += numTracks + 1 - height%(numTracks + 1); - } - menuItemWidth = width - 4; - menuItemHeight = (height - 2*(numTracks + 1)) / (numTracks + 1) - 1; - - int top, left; - switch(config.tracksPosition) { - case 0: //middle bottom - top = cOsd::OsdHeight() - cOsd::OsdTop() - height - config.tracksBorderHorizontal; - left = (cOsd::OsdWidth() - width) / 2; - break; - case 1: //left bottom - top = cOsd::OsdHeight() - cOsd::OsdTop() - height - config.tracksBorderHorizontal; - left = cOsd::OsdLeft(); - break; - case 2: //left middle - top = (cOsd::OsdHeight() - height) / 2; - left = cOsd::OsdLeft() + config.tracksBorderVertical; - break; - case 3: //left top - top = cOsd::OsdTop() + config.tracksBorderHorizontal; - left = cOsd::OsdLeft() + config.tracksBorderVertical; - break; - case 4: //top middle - top = cOsd::OsdTop() + config.tracksBorderHorizontal; - left = (cOsd::OsdWidth() - width) / 2; - break; - case 5: //top right - top = cOsd::OsdTop() + config.tracksBorderHorizontal; - left = cOsd::OsdWidth() - cOsd::OsdLeft() - width - config.tracksBorderVertical; - break; - case 6: //right middle - top = (cOsd::OsdHeight() - height) / 2; - left = cOsd::OsdWidth() - cOsd::OsdLeft() - width - config.tracksBorderVertical; - break; - case 7: //right bottom - top = cOsd::OsdHeight() - cOsd::OsdTop() - height - config.tracksBorderHorizontal; - left = cOsd::OsdWidth() - cOsd::OsdLeft() - width - config.tracksBorderVertical; - break; - default: //middle bottom - top = cOsd::OsdHeight() - cOsd::OsdTop() - height - config.tracksBorderHorizontal; - left = (cOsd::OsdWidth() - width) / 2; - break; - } - osd = CreateOsd(left, top, width, height); + width = cOsd::OsdWidth() * config.tracksWidth / 100; + height = cOsd::OsdHeight() * config.tracksHeight / 100; + if (!height%(numTracks + 1)) { + height += numTracks + 1 - height%(numTracks + 1); + } + menuItemWidth = width - 4; + menuItemHeight = (height - 2*(numTracks + 1)) / (numTracks + 1) - 1; + + int top, left; + switch(config.tracksPosition) { + case 0: //middle bottom + top = cOsd::OsdHeight() - cOsd::OsdTop() - height - config.tracksBorderHorizontal; + left = (cOsd::OsdWidth() - width) / 2; + break; + case 1: //left bottom + top = cOsd::OsdHeight() - cOsd::OsdTop() - height - config.tracksBorderHorizontal; + left = cOsd::OsdLeft(); + break; + case 2: //left middle + top = (cOsd::OsdHeight() - height) / 2; + left = cOsd::OsdLeft() + config.tracksBorderVertical; + break; + case 3: //left top + top = cOsd::OsdTop() + config.tracksBorderHorizontal; + left = cOsd::OsdLeft() + config.tracksBorderVertical; + break; + case 4: //top middle + top = cOsd::OsdTop() + config.tracksBorderHorizontal; + left = (cOsd::OsdWidth() - width) / 2; + break; + case 5: //top right + top = cOsd::OsdTop() + config.tracksBorderHorizontal; + left = cOsd::OsdWidth() - cOsd::OsdLeft() - width - config.tracksBorderVertical; + break; + case 6: //right middle + top = (cOsd::OsdHeight() - height) / 2; + left = cOsd::OsdWidth() - cOsd::OsdLeft() - width - config.tracksBorderVertical; + break; + case 7: //right bottom + top = cOsd::OsdHeight() - cOsd::OsdTop() - height - config.tracksBorderHorizontal; + left = cOsd::OsdWidth() - cOsd::OsdLeft() - width - config.tracksBorderVertical; + break; + default: //middle bottom + top = cOsd::OsdHeight() - cOsd::OsdTop() - height - config.tracksBorderHorizontal; + left = (cOsd::OsdWidth() - width) / 2; + break; + } + osd = CreateOsd(left, top, width, height); } void cNopacityDisplayTracks::CreatePixmaps(void) { - pixmapContainer = osd->CreatePixmap(1, cRect(0, 0, width, height)); - pixmapHeader = osd->CreatePixmap(2, cRect(2, 2, menuItemWidth, menuItemHeight)); - if (config.tracksFadeTime) { - pixmapContainer->SetAlpha(0); - pixmapHeader->SetAlpha(0); - } + pixmapContainer = osd->CreatePixmap(1, cRect(0, 0, width, height)); + pixmapHeader = osd->CreatePixmap(2, cRect(2, 2, menuItemWidth, menuItemHeight)); + if (config.tracksFadeTime) { + pixmapContainer->SetAlpha(0); + pixmapHeader->SetAlpha(0); + } } void cNopacityDisplayTracks::CreateFonts(void) { - font = cFont::CreateFont(config.fontName, menuItemHeight/3 + config.fontTracks); - fontHeader = cFont::CreateFont(config.fontName, menuItemHeight/2 + config.fontTracksHeader); + font = cFont::CreateFont(config.fontName, menuItemHeight/3 + config.fontTracks); + fontHeader = cFont::CreateFont(config.fontName, menuItemHeight/2 + config.fontTracksHeader); } void cNopacityDisplayTracks::CreateBackgroundImages(void) { - cImageLoader imgLoader; - imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), menuItemWidth-2, menuItemHeight-2); - handleBackgrounds[0] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), menuItemWidth-2, menuItemHeight-2); - handleBackgrounds[1] = cOsdProvider::StoreImage(imgLoader.GetImage()); + cImageLoader imgLoader; + imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), menuItemWidth-2, menuItemHeight-2); + handleBackgrounds[0] = cOsdProvider::StoreImage(imgLoader.GetImage()); + imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), menuItemWidth-2, menuItemHeight-2); + handleBackgrounds[1] = cOsdProvider::StoreImage(imgLoader.GetImage()); } void cNopacityDisplayTracks::DrawHeader(const char *Title) { - pixmapContainer->Fill(Theme.Color(clrMenuBorder)); - pixmapContainer->DrawRectangle(cRect(1, 1, width-2, height-2), Theme.Color(clrMenuBack)); - - pixmapHeader->Fill(Theme.Color(clrMenuItem)); - pixmapHeader->DrawImage(cPoint(1, 1), handleBackgrounds[0]); - pixmapIcon = osd->CreatePixmap(3, cRect(2, 2, menuItemHeight-2, menuItemHeight-2)); - pixmapIcon->Fill(clrTransparent); - cImageLoader imgLoader; - if (imgLoader.LoadIcon("tracks", menuItemHeight-6)) { - pixmapIcon->DrawImage(cPoint(3, 3), imgLoader.GetImage()); - } - pixmapHeader->DrawText(cPoint((width - fontHeader->Width(Title)) / 2, (menuItemHeight - fontHeader->Height()) / 2), Title, Theme.Color(clrTracksFontHead), clrTransparent, fontHeader); + pixmapContainer->Fill(Theme.Color(clrMenuBorder)); + pixmapContainer->DrawRectangle(cRect(1, 1, width-2, height-2), Theme.Color(clrMenuBack)); + + pixmapHeader->Fill(Theme.Color(clrMenuItem)); + pixmapHeader->DrawImage(cPoint(1, 1), handleBackgrounds[0]); + pixmapIcon = osd->CreatePixmap(3, cRect(2, 2, menuItemHeight-2, menuItemHeight-2)); + pixmapIcon->Fill(clrTransparent); + cImageLoader imgLoader; + if (imgLoader.LoadIcon("tracks", menuItemHeight-6)) { + pixmapIcon->DrawImage(cPoint(3, 3), imgLoader.GetImage()); + } + pixmapHeader->DrawText(cPoint((width - fontHeader->Width(Title)) / 2, (menuItemHeight - fontHeader->Height()) / 2), Title, Theme.Color(clrTracksFontHead), clrTransparent, fontHeader); } void cNopacityDisplayTracks::SetItem(const char *Text, int Index, bool Current) { - cNopacityMenuItem *item; - item = new cNopacityTrackMenuItem(osd, Text); - item->SetCurrent(Current); - item->SetFont(font); - item->SetGeometry(Index, menuItemHeight+5, 2, menuItemWidth, menuItemHeight); - item->CreatePixmap(); - item->SetBackgrounds(handleBackgrounds); - menuItems.Add(item); - item->Render(); + cNopacityMenuItem *item; + item = new cNopacityTrackMenuItem(osd, Text); + item->SetCurrent(Current); + item->SetFont(font); + item->SetGeometry(Index, menuItemHeight+5, 2, menuItemWidth, menuItemHeight); + item->CreatePixmap(); + item->SetBackgrounds(handleBackgrounds); + menuItems.Add(item); + item->Render(); } void cNopacityDisplayTracks::SetTrack(int Index, const char * const *Tracks) { - cNopacityMenuItem *item; - if (currentIndex >= 0) { - item = menuItems.Get(currentIndex); - item->SetCurrent(false); - item->Render(); - } - item = menuItems.Get(Index); - item->SetCurrent(true); - item->Render(); - currentIndex = Index; + cNopacityMenuItem *item; + if (currentIndex >= 0) { + item = menuItems.Get(currentIndex); + item->SetCurrent(false); + item->Render(); + } + item = menuItems.Get(Index); + item->SetCurrent(true); + item->Render(); + currentIndex = Index; } void cNopacityDisplayTracks::SetAudioChannel(int AudioChannel) { - cBitmap *bm = NULL; - switch (AudioChannel) { - case -1: bm = &bmDolbyDigital; break; - case 0: bm = &bmStereo; break; - default: ; + cBitmap *bm = NULL; + switch (AudioChannel) { + case -1: bm = &bmDolbyDigital; break; + case 0: bm = &bmStereo; break; + default: ; } - if (bm) - pixmapHeader->DrawBitmap(cPoint(width - bm->Width() - 10, (menuItemHeight - bm->Width()) / 2), *bm, Theme.Color(clrChannelSymbolOn), Theme.Color(clrMenuBack)); + if (bm) + pixmapHeader->DrawBitmap(cPoint(width - bm->Width() - 10, (menuItemHeight - bm->Width()) / 2), *bm, Theme.Color(clrChannelSymbolOn), Theme.Color(clrMenuBack)); } void cNopacityDisplayTracks::Flush(void) { - if (initial) - if (config.tracksFadeTime) - Start(); - initial = false; - osd->Flush(); + if (initial) + if (config.tracksFadeTime) + Start(); + initial = false; + osd->Flush(); } void cNopacityDisplayTracks::Action(void) { - uint64_t Start = cTimeMs::Now(); - while (Running()) { - uint64_t Now = cTimeMs::Now(); - cPixmap::Lock(); - double t = min(double(Now - Start) / FadeTime, 1.0); - int Alpha = t * ALPHA_OPAQUE; - pixmapContainer->SetAlpha(Alpha); - pixmapHeader->SetAlpha(Alpha); - for (cNopacityMenuItem *item = menuItems.First(); Running() && item; item = menuItems.Next(item)) { - item->SetAlpha(Alpha); - } - if (Running()) - osd->Flush(); - cPixmap::Unlock(); - int Delta = cTimeMs::Now() - Now; - if (Running() && (Delta < FrameTime)) - cCondWait::SleepMs(FrameTime - Delta); - if ((int)(Now - Start) > FadeTime) - break; - } + uint64_t Start = cTimeMs::Now(); + while (Running()) { + uint64_t Now = cTimeMs::Now(); + cPixmap::Lock(); + double t = min(double(Now - Start) / FadeTime, 1.0); + int Alpha = t * ALPHA_OPAQUE; + pixmapContainer->SetAlpha(Alpha); + pixmapHeader->SetAlpha(Alpha); + for (cNopacityMenuItem *item = menuItems.First(); Running() && item; item = menuItems.Next(item)) { + item->SetAlpha(Alpha); + } + if (Running()) + osd->Flush(); + cPixmap::Unlock(); + int Delta = cTimeMs::Now() - Now; + if (Running() && (Delta < FrameTime)) + cCondWait::SleepMs(FrameTime - Delta); + if ((int)(Now - Start) > FadeTime) + break; + } } diff --git a/displaytracks.h b/displaytracks.h index 83e388d..fddfe53 100644 --- a/displaytracks.h +++ b/displaytracks.h @@ -3,36 +3,36 @@ class cNopacityDisplayTracks : public cSkinDisplayTracks, cThread { private: - cOsd *osd; - int FrameTime; - int FadeTime; - int width, height; - int menuItemWidth; - int menuItemHeight; - bool initial; - int currentIndex; - int numTracks; - cPixmap *pixmapContainer; - cPixmap *pixmapHeader; - cPixmap *pixmapIcon; - cList<cNopacityMenuItem> menuItems; - int handleBackgrounds[2]; - cFont *font; - cFont *fontHeader; - virtual void Action(void); - void SetItem(const char *Text, int Index, bool Current); - static cBitmap bmStereo, bmDolbyDigital; - void SetGeometry(void); - void CreatePixmaps(void); - void CreateFonts(void); - void CreateBackgroundImages(void); - void DrawHeader(const char *Title); + cOsd *osd; + int FrameTime; + int FadeTime; + int width, height; + int menuItemWidth; + int menuItemHeight; + bool initial; + int currentIndex; + int numTracks; + cPixmap *pixmapContainer; + cPixmap *pixmapHeader; + cPixmap *pixmapIcon; + cList<cNopacityMenuItem> menuItems; + int handleBackgrounds[2]; + cFont *font; + cFont *fontHeader; + virtual void Action(void); + void SetItem(const char *Text, int Index, bool Current); + static cBitmap bmStereo, bmDolbyDigital; + void SetGeometry(void); + void CreatePixmaps(void); + void CreateFonts(void); + void CreateBackgroundImages(void); + void DrawHeader(const char *Title); public: - cNopacityDisplayTracks(const char *Title, int NumTracks, const char * const *Tracks); - virtual ~cNopacityDisplayTracks(); - virtual void SetTrack(int Index, const char * const *Tracks); - virtual void SetAudioChannel(int AudioChannel); - virtual void Flush(void); + cNopacityDisplayTracks(const char *Title, int NumTracks, const char * const *Tracks); + virtual ~cNopacityDisplayTracks(); + virtual void SetTrack(int Index, const char * const *Tracks); + virtual void SetAudioChannel(int AudioChannel); + virtual void Flush(void); }; diff --git a/displayvolume.c b/displayvolume.c index ae541bd..fcb8e25 100644 --- a/displayvolume.c +++ b/displayvolume.c @@ -2,145 +2,145 @@ #include "displayvolume.h" cNopacityDisplayVolume::cNopacityDisplayVolume(void) { - config.setDynamicValues(); - initial = true; - muted = false; - FrameTime = config.volumeFrameTime; - FadeTime = config.volumeFadeTime; - - width = cOsd::OsdWidth() * config.volumeWidth / 100; - height = cOsd::OsdHeight() * config.volumeHeight / 100; - - int top = (cOsd::OsdHeight() - height) - config.volumeBorderBottom; - int left = (cOsd::OsdWidth() - width) / 2; - - osd = CreateOsd(left, top, width, height); - - pixmapBackgroundTop = osd->CreatePixmap(1, cRect(0, 0, width, height/2)); - pixmapBackgroundBottom = osd->CreatePixmap(1, cRect(0, height/2, width, height/2)); - - DrawBlendedBackground(pixmapBackgroundTop, Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), true); - DrawBlendedBackground(pixmapBackgroundBottom, Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), false); - - pixmapBackgroundTop->DrawEllipse(cRect(0, 0, height/4, height/4), clrTransparent, -2); - pixmapBackgroundTop->DrawEllipse(cRect(width - height/4, 0, height/4, height/4), clrTransparent, -1); - pixmapBackgroundBottom->DrawEllipse(cRect(0, height/4, height/4, height/4), clrTransparent, -3); - pixmapBackgroundBottom->DrawEllipse(cRect(width - height/4, height/4, height/4, height/4), clrTransparent, -4); - - labelHeight = height/3; - pixmapLabel = osd->CreatePixmap(2, cRect(0, 5, width, labelHeight)); - progressBarWidth = 0.9 * width; - progressBarHeight = 0.3 * height; - if (progressBarHeight%2 != 0) - progressBarHeight++; - pixmapProgressBar = osd->CreatePixmap(2, cRect((width - progressBarWidth) / 2, (height - progressBarHeight)*2/3, progressBarWidth, progressBarHeight)); - - if (config.volumeFadeTime) { - pixmapBackgroundTop->SetAlpha(0); - pixmapBackgroundBottom->SetAlpha(0); - pixmapProgressBar->SetAlpha(0); - pixmapLabel->SetAlpha(0); - } - font = cFont::CreateFont(config.fontName, labelHeight - 6 + config.fontVolume); + config.setDynamicValues(); + initial = true; + muted = false; + FrameTime = config.volumeFrameTime; + FadeTime = config.volumeFadeTime; + + width = cOsd::OsdWidth() * config.volumeWidth / 100; + height = cOsd::OsdHeight() * config.volumeHeight / 100; + + int top = (cOsd::OsdHeight() - height) - config.volumeBorderBottom; + int left = (cOsd::OsdWidth() - width) / 2; + + osd = CreateOsd(left, top, width, height); + + pixmapBackgroundTop = osd->CreatePixmap(1, cRect(0, 0, width, height/2)); + pixmapBackgroundBottom = osd->CreatePixmap(1, cRect(0, height/2, width, height/2)); + + DrawBlendedBackground(pixmapBackgroundTop, Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), true); + DrawBlendedBackground(pixmapBackgroundBottom, Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), false); + + pixmapBackgroundTop->DrawEllipse(cRect(0, 0, height/4, height/4), clrTransparent, -2); + pixmapBackgroundTop->DrawEllipse(cRect(width - height/4, 0, height/4, height/4), clrTransparent, -1); + pixmapBackgroundBottom->DrawEllipse(cRect(0, height/4, height/4, height/4), clrTransparent, -3); + pixmapBackgroundBottom->DrawEllipse(cRect(width - height/4, height/4, height/4, height/4), clrTransparent, -4); + + labelHeight = height/3; + pixmapLabel = osd->CreatePixmap(2, cRect(0, 5, width, labelHeight)); + progressBarWidth = 0.9 * width; + progressBarHeight = 0.3 * height; + if (progressBarHeight%2 != 0) + progressBarHeight++; + pixmapProgressBar = osd->CreatePixmap(2, cRect((width - progressBarWidth) / 2, (height - progressBarHeight)*2/3, progressBarWidth, progressBarHeight)); + + if (config.volumeFadeTime) { + pixmapBackgroundTop->SetAlpha(0); + pixmapBackgroundBottom->SetAlpha(0); + pixmapProgressBar->SetAlpha(0); + pixmapLabel->SetAlpha(0); + } + font = cFont::CreateFont(config.fontName, labelHeight - 6 + config.fontVolume); } cNopacityDisplayVolume::~cNopacityDisplayVolume() { - Cancel(-1); - while (Active()) - cCondWait::SleepMs(10); - osd->DestroyPixmap(pixmapBackgroundTop); - osd->DestroyPixmap(pixmapBackgroundBottom); - osd->DestroyPixmap(pixmapLabel); - osd->DestroyPixmap(pixmapProgressBar); - delete font; - delete osd; + Cancel(-1); + while (Active()) + cCondWait::SleepMs(10); + osd->DestroyPixmap(pixmapBackgroundTop); + osd->DestroyPixmap(pixmapBackgroundBottom); + osd->DestroyPixmap(pixmapLabel); + osd->DestroyPixmap(pixmapProgressBar); + delete font; + delete osd; } void cNopacityDisplayVolume::SetVolume(int Current, int Total, bool Mute) { - pixmapLabel->Fill(clrTransparent); - cString label = cString::sprintf("%s: %d", tr("Volume"), Current); - pixmapLabel->DrawText(cPoint((width - font->Width(*label)) / 2, (labelHeight - font->Height()) / 2), *label, Theme.Color(clrVolumeFont), clrTransparent, font); - if (Mute) { - cBitmap bmMute(mute_xpm); - pixmapLabel->DrawBitmap(cPoint(width - 2*bmMute.Width(), (labelHeight - bmMute.Height()) / 2), bmMute, Theme.Color(clrDiskAlert), clrTransparent); - } + pixmapLabel->Fill(clrTransparent); + cString label = cString::sprintf("%s: %d", tr("Volume"), Current); + pixmapLabel->DrawText(cPoint((width - font->Width(*label)) / 2, (labelHeight - font->Height()) / 2), *label, Theme.Color(clrVolumeFont), clrTransparent, font); + if (Mute) { + cBitmap bmMute(mute_xpm); + pixmapLabel->DrawBitmap(cPoint(width - 2*bmMute.Width(), (labelHeight - bmMute.Height()) / 2), bmMute, Theme.Color(clrDiskAlert), clrTransparent); + } DrawProgressBar(Current, Total); } void cNopacityDisplayVolume::DrawProgressBar(int Current, int Total) { - pixmapProgressBar->Fill(clrTransparent); - double percent = ((double)Current) / (double)Total; - int barWidth = progressBarWidth - progressBarHeight; - if ((Current > 0) || (Total > 0)) { - pixmapProgressBar->DrawEllipse(cRect(0, 0, progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack)); - pixmapProgressBar->DrawEllipse(cRect(progressBarWidth - progressBarHeight, 0, progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack)); - pixmapProgressBar->DrawRectangle(cRect(progressBarHeight/2, 0, progressBarWidth - progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack)); - - pixmapProgressBar->DrawEllipse(cRect(1, 1, progressBarHeight-2, progressBarHeight-2), Theme.Color(clrProgressBarBlend)); - if (Current > 0) { - tColor colAct = DrawProgressbarBackground(progressBarHeight / 2 - 1, 1, barWidth * percent - 2, progressBarHeight - 2); - pixmapProgressBar->DrawEllipse(cRect(barWidth * percent, 1, progressBarHeight-2, progressBarHeight-2), colAct); - } - } + pixmapProgressBar->Fill(clrTransparent); + double percent = ((double)Current) / (double)Total; + int barWidth = progressBarWidth - progressBarHeight; + if ((Current > 0) || (Total > 0)) { + pixmapProgressBar->DrawEllipse(cRect(0, 0, progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack)); + pixmapProgressBar->DrawEllipse(cRect(progressBarWidth - progressBarHeight, 0, progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack)); + pixmapProgressBar->DrawRectangle(cRect(progressBarHeight/2, 0, progressBarWidth - progressBarHeight, progressBarHeight), Theme.Color(clrProgressBarBack)); + + pixmapProgressBar->DrawEllipse(cRect(1, 1, progressBarHeight-2, progressBarHeight-2), Theme.Color(clrProgressBarBlend)); + if (Current > 0) { + tColor colAct = DrawProgressbarBackground(progressBarHeight / 2 - 1, 1, barWidth * percent - 2, progressBarHeight - 2); + pixmapProgressBar->DrawEllipse(cRect(barWidth * percent, 1, progressBarHeight-2, progressBarHeight-2), colAct); + } + } } tColor cNopacityDisplayVolume::DrawProgressbarBackground(int left, int top, int width, int height) { - tColor clr1 = Theme.Color(clrProgressBar); - tColor clr2 = Theme.Color(clrProgressBarBlend); - tColor clr = 0x00000000; - int step = width / 256; - int alpha = 0x0; - int alphaStep; - int maximum = 0; - if (step == 0) { //width < 256 - step = 1; + tColor clr1 = Theme.Color(clrProgressBar); + tColor clr2 = Theme.Color(clrProgressBarBlend); + tColor clr = 0x00000000; + int step = width / 256; + int alpha = 0x0; + int alphaStep; + int maximum = 0; + if (step == 0) { //width < 256 + step = 1; alphaStep = 256 / width; - maximum = width; - } else { //width > 256 + maximum = width; + } else { //width > 256 alphaStep = 0x1; - maximum = 256; + maximum = 256; } - int x = 0; - for (int i = 0; i < maximum; i++) { - x = left + i*step; - clr = AlphaBlend(clr1, clr2, alpha); - pixmapProgressBar->DrawRectangle(cRect(x,top,step,height), clr); + int x = 0; + for (int i = 0; i < maximum; i++) { + x = left + i*step; + clr = AlphaBlend(clr1, clr2, alpha); + pixmapProgressBar->DrawRectangle(cRect(x,top,step,height), clr); alpha += alphaStep; - } - if (step > 0) { - int rest = width - step*256; + } + if (step > 0) { + int rest = width - step*256; pixmapProgressBar->DrawRectangle(cRect(left+step*256, top, rest, height), clr); - } - return clr; + } + return clr; } void cNopacityDisplayVolume::Flush(void) { - if (initial) - if (config.volumeFadeTime) - Start(); - initial = false; - osd->Flush(); + if (initial) + if (config.volumeFadeTime) + Start(); + initial = false; + osd->Flush(); } void cNopacityDisplayVolume::Action(void) { - uint64_t Start = cTimeMs::Now(); - while (Running()) { - uint64_t Now = cTimeMs::Now(); - cPixmap::Lock(); - double t = min(double(Now - Start) / FadeTime, 1.0); - int Alpha = t * ALPHA_OPAQUE; - pixmapBackgroundTop->SetAlpha(Alpha); - pixmapBackgroundBottom->SetAlpha(Alpha); - pixmapProgressBar->SetAlpha(Alpha); - pixmapLabel->SetAlpha(Alpha); - if (Running()) - osd->Flush(); - cPixmap::Unlock(); - int Delta = cTimeMs::Now() - Now; - if (Running() && (Delta < FrameTime)) - cCondWait::SleepMs(FrameTime - Delta); - if ((int)(Now - Start) > FadeTime) - break; - } + uint64_t Start = cTimeMs::Now(); + while (Running()) { + uint64_t Now = cTimeMs::Now(); + cPixmap::Lock(); + double t = min(double(Now - Start) / FadeTime, 1.0); + int Alpha = t * ALPHA_OPAQUE; + pixmapBackgroundTop->SetAlpha(Alpha); + pixmapBackgroundBottom->SetAlpha(Alpha); + pixmapProgressBar->SetAlpha(Alpha); + pixmapLabel->SetAlpha(Alpha); + if (Running()) + osd->Flush(); + cPixmap::Unlock(); + int Delta = cTimeMs::Now() - Now; + if (Running() && (Delta < FrameTime)) + cCondWait::SleepMs(FrameTime - Delta); + if ((int)(Now - Start) > FadeTime) + break; + } } diff --git a/displayvolume.h b/displayvolume.h index 6217a81..707bca3 100644 --- a/displayvolume.h +++ b/displayvolume.h @@ -3,22 +3,22 @@ class cNopacityDisplayVolume : public cSkinDisplayVolume, cThread { private: - int FrameTime; - int FadeTime; - bool initial; - bool muted; - int width, height; - int labelHeight; - int progressBarWidth, progressBarHeight; - cOsd *osd; - cPixmap *pixmapBackgroundTop; - cPixmap *pixmapBackgroundBottom; - cPixmap *pixmapProgressBar; - cPixmap *pixmapLabel; - cFont *font; - virtual void Action(void); - void DrawProgressBar(int Current, int Total); - tColor DrawProgressbarBackground(int left, int top, int width, int height); + int FrameTime; + int FadeTime; + bool initial; + bool muted; + int width, height; + int labelHeight; + int progressBarWidth, progressBarHeight; + cOsd *osd; + cPixmap *pixmapBackgroundTop; + cPixmap *pixmapBackgroundBottom; + cPixmap *pixmapProgressBar; + cPixmap *pixmapLabel; + cFont *font; + virtual void Action(void); + void DrawProgressBar(int Current, int Total); + tColor DrawProgressbarBackground(int left, int top, int width, int height); public: cNopacityDisplayVolume(void); virtual ~cNopacityDisplayVolume(); diff --git a/epgsearchconf.c b/epgsearchconf.c index 3073cbb..c0ffca5 100644 --- a/epgsearchconf.c +++ b/epgsearchconf.c @@ -1,317 +1,317 @@ enum eEpgSearchTokens { eEPGtime = 0, eEPGdate, eEPGdatesh, eEPGtime_w, eEPGtime_d, eEPGtimespan,
- eEPGtitle, eEPGsubtitle, eEPGt_status, eEPGv_status, eEPGr_status,
- eEPGstatus, eEPGchnr, eEPGchsh, eEPGchlng, eEPGprogr, eEPGprogrT2S};
+ eEPGtitle, eEPGsubtitle, eEPGt_status, eEPGv_status, eEPGr_status,
+ eEPGstatus, eEPGchnr, eEPGchsh, eEPGchlng, eEPGprogr, eEPGprogrT2S};
enum eEPGModes { eMenuSchedule = 0, eMenuWhatsOnNow, eMenuWhatsOnNext, eMenuWhatsOnElse,
- eMenuSearchResults, eMenuFavorites, eMenuTimerconflict};
+ eMenuSearchResults, eMenuFavorites, eMenuTimerconflict};
#include <string>
#include "epgsearchconf.h"
cNopacityEPGSearchConfig::cNopacityEPGSearchConfig(void) {
- ReplaceSchedule = false;
- ShowChannelNr = false;
- ShowProgress = false;
- for (int i=0; i<4; i++) {
- UserSet[i] = false;
- User[i] = "";
- }
- for (int i=0; i<EPGSEARCHCATS; i++)
- for (int j =0; j<EPGSEARCHTOKENS; j++)
- epgSearchConfig[i][j] = -1;
-
+ ReplaceSchedule = false;
+ ShowChannelNr = false;
+ ShowProgress = false;
+ for (int i=0; i<4; i++) {
+ UserSet[i] = false;
+ User[i] = "";
+ }
+ for (int i=0; i<EPGSEARCHCATS; i++)
+ for (int j =0; j<EPGSEARCHTOKENS; j++)
+ epgSearchConfig[i][j] = -1;
+
}
cNopacityEPGSearchConfig::~cNopacityEPGSearchConfig() {
}
bool cNopacityEPGSearchConfig::CheckEPGSearchAvailable(void) {
- cPlugin *epgSearchPlugin = NULL;
- epgSearchPlugin = cPluginManager::GetPlugin("epgsearch");
- if (epgSearchPlugin) {
- return true;
- }
- return false;
+ cPlugin *epgSearchPlugin = NULL;
+ epgSearchPlugin = cPluginManager::GetPlugin("epgsearch");
+ if (epgSearchPlugin) {
+ return true;
+ }
+ return false;
}
bool cNopacityEPGSearchConfig::LoadEpgSearchConf(void) {
- std::string ConfigDir = cPlugin::ConfigDirectory(NULL);
- ConfigDir = ConfigDir.substr(0, ConfigDir.find("/plugins"));
- cString vdrSetup = "setup.conf";
- cString fileName = AddDirectory(ConfigDir.c_str(), *vdrSetup);
- if (access(fileName, F_OK) == 0) {
- FILE *f = fopen(fileName, "r");
- if (f) {
- char *s;
- cReadLine ReadLine;
- while ((s = ReadLine.Read(f)) != NULL) {
- char *p = strchr(s, '#');
- if (p)
- *p = 0;
- stripspace(s);
- if (!isempty(s)) {
- std::string line = s;
- if (line.find("epgsearch.ReplaceOrgSchedule = 1") == 0) {
- ReplaceSchedule = true;
- } else if (line.find("epgsearch.ShowChannelNr = 1") == 0) {
- ShowChannelNr = true;
- } else if (line.find("epgsearch.ShowProgress = 1") == 0) {
- ShowProgress = true;
- } else {
- for (int i=0; i<4; i++) {
- cString strEPGUserMode = cString::sprintf("epgsearch.UserMode%dDescription =", i+1);
- if (line.find(*strEPGUserMode) == 0) {
- try {
- line = line.substr(line.find("=")+1);
- line = line.substr(line.find_first_not_of(" "));
- if (line.length() > 0) {
- User[i] = line.c_str();
- UserSet[i] = true;
- }
- } catch (...){}
- }
- }
- }
- }
- }
- }
- } else {
- return false;
- }
- return true;
+ std::string ConfigDir = cPlugin::ConfigDirectory(NULL);
+ ConfigDir = ConfigDir.substr(0, ConfigDir.find("/plugins"));
+ cString vdrSetup = "setup.conf";
+ cString fileName = AddDirectory(ConfigDir.c_str(), *vdrSetup);
+ if (access(fileName, F_OK) == 0) {
+ FILE *f = fopen(fileName, "r");
+ if (f) {
+ char *s;
+ cReadLine ReadLine;
+ while ((s = ReadLine.Read(f)) != NULL) {
+ char *p = strchr(s, '#');
+ if (p)
+ *p = 0;
+ stripspace(s);
+ if (!isempty(s)) {
+ std::string line = s;
+ if (line.find("epgsearch.ReplaceOrgSchedule = 1") == 0) {
+ ReplaceSchedule = true;
+ } else if (line.find("epgsearch.ShowChannelNr = 1") == 0) {
+ ShowChannelNr = true;
+ } else if (line.find("epgsearch.ShowProgress = 1") == 0) {
+ ShowProgress = true;
+ } else {
+ for (int i=0; i<4; i++) {
+ cString strEPGUserMode = cString::sprintf("epgsearch.UserMode%dDescription =", i+1);
+ if (line.find(*strEPGUserMode) == 0) {
+ try {
+ line = line.substr(line.find("=")+1);
+ line = line.substr(line.find_first_not_of(" "));
+ if (line.length() > 0) {
+ User[i] = line.c_str();
+ UserSet[i] = true;
+ }
+ } catch (...){}
+ }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ return false;
+ }
+ return true;
}
bool cNopacityEPGSearchConfig::LoadEpgSearchMenuConf(void) {
- cString ConfigDir = cPlugin::ConfigDirectory("epgsearch");
- cString epgsearchConf = "epgsearchmenu.conf";
- cString fileName = AddDirectory(*ConfigDir, *epgsearchConf);
- bool foundMenuWhatsOnNow = false;
- bool foundMenuWhatsOnNext = false;
- bool foundMenuWhatsOnElse = false;
- bool foundMenuSchedule = false;
- bool foundMenuSearchResults = false;
- bool foundMenuFavorites = false;
- if (access(fileName, F_OK) == 0) {
- dsyslog("nopacity: config file %s found", *fileName);
- FILE *f = fopen(fileName, "r");
- if (f) {
- char *s;
- cReadLine ReadLine;
- while ((s = ReadLine.Read(f)) != NULL) {
- char *p = strchr(s, '#');
- if (p)
- *p = 0;
- stripspace(s);
- try {
- if (!isempty(s)) {
- std::string line = s;
- std::string *values = new std::string[MAXITEMTABS];
- if (line.find("MenuWhatsOnNow") == 0) {
- values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
- SetTokens(values, eMenuWhatsOnNow);
- foundMenuWhatsOnNow = true;
- } else if (line.find("MenuWhatsOnNext") == 0) {
- values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
- SetTokens(values, eMenuWhatsOnNext);
- foundMenuWhatsOnNext = true;
- } else if (line.find("MenuWhatsOnElse") == 0) {
- values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
- SetTokens(values, eMenuWhatsOnElse);
- foundMenuWhatsOnElse = true;
- } else if (line.find("MenuSchedule") == 0) {
- values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
- SetTokens(values, eMenuSchedule);
- foundMenuSchedule = true;
- } else if (line.find("MenuSearchResults") == 0) {
- values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
- SetTokens(values, eMenuSearchResults);
- foundMenuSearchResults = true;
- } else if (line.find("MenuFavorites") == 0) {
- values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
- SetTokens(values, eMenuFavorites);
- foundMenuFavorites = true;
- }
- delete[] values;
- }
- } catch (...){}
- }
- }
- if (!foundMenuWhatsOnNow ||
- !foundMenuWhatsOnNext ||
- !foundMenuWhatsOnElse ||
- !foundMenuSchedule ||
- !foundMenuSearchResults ||
- !foundMenuFavorites)
- {
- dsyslog("nopacity: config file not complete, using default");
- return false;
- }
- } else {
- dsyslog("nopacity: %s not available, using epgsearch default settings", *fileName);
- return false;
- }
- dsyslog("nopacity: config file complete");
- return true;
+ cString ConfigDir = cPlugin::ConfigDirectory("epgsearch");
+ cString epgsearchConf = "epgsearchmenu.conf";
+ cString fileName = AddDirectory(*ConfigDir, *epgsearchConf);
+ bool foundMenuWhatsOnNow = false;
+ bool foundMenuWhatsOnNext = false;
+ bool foundMenuWhatsOnElse = false;
+ bool foundMenuSchedule = false;
+ bool foundMenuSearchResults = false;
+ bool foundMenuFavorites = false;
+ if (access(fileName, F_OK) == 0) {
+ dsyslog("nopacity: config file %s found", *fileName);
+ FILE *f = fopen(fileName, "r");
+ if (f) {
+ char *s;
+ cReadLine ReadLine;
+ while ((s = ReadLine.Read(f)) != NULL) {
+ char *p = strchr(s, '#');
+ if (p)
+ *p = 0;
+ stripspace(s);
+ try {
+ if (!isempty(s)) {
+ std::string line = s;
+ std::string *values = new std::string[MAXITEMTABS];
+ if (line.find("MenuWhatsOnNow") == 0) {
+ values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
+ SetTokens(values, eMenuWhatsOnNow);
+ foundMenuWhatsOnNow = true;
+ } else if (line.find("MenuWhatsOnNext") == 0) {
+ values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
+ SetTokens(values, eMenuWhatsOnNext);
+ foundMenuWhatsOnNext = true;
+ } else if (line.find("MenuWhatsOnElse") == 0) {
+ values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
+ SetTokens(values, eMenuWhatsOnElse);
+ foundMenuWhatsOnElse = true;
+ } else if (line.find("MenuSchedule") == 0) {
+ values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
+ SetTokens(values, eMenuSchedule);
+ foundMenuSchedule = true;
+ } else if (line.find("MenuSearchResults") == 0) {
+ values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
+ SetTokens(values, eMenuSearchResults);
+ foundMenuSearchResults = true;
+ } else if (line.find("MenuFavorites") == 0) {
+ values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1));
+ SetTokens(values, eMenuFavorites);
+ foundMenuFavorites = true;
+ }
+ delete[] values;
+ }
+ } catch (...){}
+ }
+ }
+ if (!foundMenuWhatsOnNow ||
+ !foundMenuWhatsOnNext ||
+ !foundMenuWhatsOnElse ||
+ !foundMenuSchedule ||
+ !foundMenuSearchResults ||
+ !foundMenuFavorites)
+ {
+ dsyslog("nopacity: config file not complete, using default");
+ return false;
+ }
+ } else {
+ dsyslog("nopacity: %s not available, using epgsearch default settings", *fileName);
+ return false;
+ }
+ dsyslog("nopacity: config file complete");
+ return true;
}
std::string *cNopacityEPGSearchConfig::SplitEpgSearchMenuLine(std::string line) {
- size_t posSeparator = -1;
- bool found = false;
- posSeparator = line.find_first_of("|") + 1;
- std::string *values = new std::string[MAXITEMTABS];
- for (int i=0; i < MAXITEMTABS; i++)
- values[i] = "";
- std::string value;
- int i=0;
- while (posSeparator > 0) {
- found = true;
- try {
- value = line.substr(0, posSeparator);
- value = value.substr(0, value.find_first_of(":"));
- value = value.substr(value.find_first_not_of(" "));
- value = value.substr(0, value.find_last_not_of(" ")+1);
- values[i] = value;
- line = line.substr(posSeparator);
- posSeparator = line.find_first_of("|") + 1;
- } catch (...) {}
- i++;
- }
- if (found) {
- try {
- value = line.substr(0, line.find_first_of(":"));
- value = value.substr(value.find_first_not_of(" "));
- value = value.substr(0, value.find_last_not_of(" ")+1);
- values[i] = value;
- } catch (...) {}
- }
- return values;
+ size_t posSeparator = -1;
+ bool found = false;
+ posSeparator = line.find_first_of("|") + 1;
+ std::string *values = new std::string[MAXITEMTABS];
+ for (int i=0; i < MAXITEMTABS; i++)
+ values[i] = "";
+ std::string value;
+ int i=0;
+ while (posSeparator > 0) {
+ found = true;
+ try {
+ value = line.substr(0, posSeparator);
+ value = value.substr(0, value.find_first_of(":"));
+ value = value.substr(value.find_first_not_of(" "));
+ value = value.substr(0, value.find_last_not_of(" ")+1);
+ values[i] = value;
+ line = line.substr(posSeparator);
+ posSeparator = line.find_first_of("|") + 1;
+ } catch (...) {}
+ i++;
+ }
+ if (found) {
+ try {
+ value = line.substr(0, line.find_first_of(":"));
+ value = value.substr(value.find_first_not_of(" "));
+ value = value.substr(0, value.find_last_not_of(" ")+1);
+ values[i] = value;
+ } catch (...) {}
+ }
+ return values;
}
-void cNopacityEPGSearchConfig::SetTokens(std::string *values, eEPGModes mode) {
- for (int i=0; i<MAXITEMTABS; i++) {
- toLowerCase(values[i]);
- if (values[i].find("%time%") == 0)
- epgSearchConfig[mode][eEPGtime] = i;
- else if (values[i].find("%date%") == 0)
- epgSearchConfig[mode][eEPGdate] = i;
- else if (values[i].find("%datesh%") == 0)
- epgSearchConfig[mode][eEPGdatesh] = i;
- else if (values[i].find("%time_w%") == 0)
- epgSearchConfig[mode][eEPGtime_w] = i;
- else if (values[i].find("%time_d%") == 0)
- epgSearchConfig[mode][eEPGtime_d] = i;
- else if (values[i].find("%timespan%") == 0)
- epgSearchConfig[mode][eEPGtimespan] = i;
- else if (values[i].find("%title%") == 0)
- epgSearchConfig[mode][eEPGtitle] = i;
- else if (values[i].find("%subtitle%") == 0)
- epgSearchConfig[mode][eEPGsubtitle] = i;
- else if (values[i].find("%t_status%") == 0)
- epgSearchConfig[mode][eEPGt_status] = i;
- else if (values[i].find("%v_status%") == 0)
- epgSearchConfig[mode][eEPGv_status] = i;
- else if (values[i].find("%r_status%") == 0)
- epgSearchConfig[mode][eEPGr_status] = i;
- else if (values[i].find("%status%") == 0)
- epgSearchConfig[mode][eEPGstatus] = i;
- else if (values[i].find("%chnr%") == 0)
- epgSearchConfig[mode][eEPGchnr] = i;
- else if (values[i].find("%chsh%") == 0)
- epgSearchConfig[mode][eEPGchsh] = i;
- else if (values[i].find("%chlng%") == 0)
- epgSearchConfig[mode][eEPGchlng] = i;
- else if (values[i].find("%progr%") == 0)
- epgSearchConfig[mode][eEPGprogr] = i;
- else if (values[i].find("%progrt2s%") == 0)
- epgSearchConfig[mode][eEPGprogrT2S] = i;
- }
-
+void cNopacityEPGSearchConfig::SetTokens(std::string *values, eEPGModes mode) {
+ for (int i=0; i<MAXITEMTABS; i++) {
+ toLowerCase(values[i]);
+ if (values[i].find("%time%") == 0)
+ epgSearchConfig[mode][eEPGtime] = i;
+ else if (values[i].find("%date%") == 0)
+ epgSearchConfig[mode][eEPGdate] = i;
+ else if (values[i].find("%datesh%") == 0)
+ epgSearchConfig[mode][eEPGdatesh] = i;
+ else if (values[i].find("%time_w%") == 0)
+ epgSearchConfig[mode][eEPGtime_w] = i;
+ else if (values[i].find("%time_d%") == 0)
+ epgSearchConfig[mode][eEPGtime_d] = i;
+ else if (values[i].find("%timespan%") == 0)
+ epgSearchConfig[mode][eEPGtimespan] = i;
+ else if (values[i].find("%title%") == 0)
+ epgSearchConfig[mode][eEPGtitle] = i;
+ else if (values[i].find("%subtitle%") == 0)
+ epgSearchConfig[mode][eEPGsubtitle] = i;
+ else if (values[i].find("%t_status%") == 0)
+ epgSearchConfig[mode][eEPGt_status] = i;
+ else if (values[i].find("%v_status%") == 0)
+ epgSearchConfig[mode][eEPGv_status] = i;
+ else if (values[i].find("%r_status%") == 0)
+ epgSearchConfig[mode][eEPGr_status] = i;
+ else if (values[i].find("%status%") == 0)
+ epgSearchConfig[mode][eEPGstatus] = i;
+ else if (values[i].find("%chnr%") == 0)
+ epgSearchConfig[mode][eEPGchnr] = i;
+ else if (values[i].find("%chsh%") == 0)
+ epgSearchConfig[mode][eEPGchsh] = i;
+ else if (values[i].find("%chlng%") == 0)
+ epgSearchConfig[mode][eEPGchlng] = i;
+ else if (values[i].find("%progr%") == 0)
+ epgSearchConfig[mode][eEPGprogr] = i;
+ else if (values[i].find("%progrt2s%") == 0)
+ epgSearchConfig[mode][eEPGprogrT2S] = i;
+ }
+
}
void cNopacityEPGSearchConfig::SetDefaultEPGSearchConf(void) {
- //MenuSchedule
- epgSearchConfig[eMenuSchedule][eEPGtime_w] = 0;
- epgSearchConfig[eMenuSchedule][eEPGtime] = 1;
- epgSearchConfig[eMenuSchedule][eEPGstatus] = 2;
- epgSearchConfig[eMenuSchedule][eEPGtitle] = 3;
- //MenuWhatsOnNow
- int i=0;
- if (ShowChannelNr)
- epgSearchConfig[eMenuWhatsOnNow][eEPGchnr] = i++;
- epgSearchConfig[eMenuWhatsOnNow][eEPGchsh] = i++;
- epgSearchConfig[eMenuWhatsOnNow][eEPGtime] = i++;
- if(ShowProgress)
- epgSearchConfig[eMenuWhatsOnNow][eEPGprogrT2S] = i++;
- else
- epgSearchConfig[eMenuWhatsOnNow][eEPGprogr] = i++;
- epgSearchConfig[eMenuWhatsOnNow][eEPGstatus] = i++;
- epgSearchConfig[eMenuWhatsOnNow][eEPGtitle] = i++;
- //MenuWhatsOnNext
- i=0;
- if (ShowChannelNr)
- epgSearchConfig[eMenuWhatsOnNext][eEPGchnr] = i++;
- epgSearchConfig[eMenuWhatsOnNext][eEPGchsh] = i++;
- epgSearchConfig[eMenuWhatsOnNext][eEPGtime] = i++;
- epgSearchConfig[eMenuWhatsOnNext][eEPGstatus] = i++;
- epgSearchConfig[eMenuWhatsOnNext][eEPGtitle] = i++;
- //MenuWhatsOnElse
- i=0;
- if (ShowChannelNr)
- epgSearchConfig[eMenuWhatsOnElse][eEPGchnr] = i++;
- epgSearchConfig[eMenuWhatsOnElse][eEPGchsh] = i++;
- epgSearchConfig[eMenuWhatsOnElse][eEPGtime] = i++;
- epgSearchConfig[eMenuWhatsOnElse][eEPGstatus] = i++;
- epgSearchConfig[eMenuWhatsOnElse][eEPGtitle] = i++;
- //MenuSearchResults
- i=0;
- if (ShowChannelNr)
- epgSearchConfig[eMenuSearchResults][eEPGchnr] = i++;
- epgSearchConfig[eMenuSearchResults][eEPGchsh] = i++;
- epgSearchConfig[eMenuSearchResults][eEPGdatesh] = i++;
- epgSearchConfig[eMenuSearchResults][eEPGtime] = i++;
- epgSearchConfig[eMenuSearchResults][eEPGstatus] = i++;
- epgSearchConfig[eMenuSearchResults][eEPGtitle] = i++;
- //MenuFavorites
- i=0;
- if (ShowChannelNr)
- epgSearchConfig[eMenuFavorites][eEPGchnr] = i++;
- epgSearchConfig[eMenuFavorites][eEPGchsh] = i++;
- epgSearchConfig[eMenuFavorites][eEPGtime] = i++;
- epgSearchConfig[eMenuFavorites][eEPGtimespan] = i++;
- epgSearchConfig[eMenuFavorites][eEPGstatus] = i++;
- epgSearchConfig[eMenuFavorites][eEPGtitle] = i++;
+ //MenuSchedule
+ epgSearchConfig[eMenuSchedule][eEPGtime_w] = 0;
+ epgSearchConfig[eMenuSchedule][eEPGtime] = 1;
+ epgSearchConfig[eMenuSchedule][eEPGstatus] = 2;
+ epgSearchConfig[eMenuSchedule][eEPGtitle] = 3;
+ //MenuWhatsOnNow
+ int i=0;
+ if (ShowChannelNr)
+ epgSearchConfig[eMenuWhatsOnNow][eEPGchnr] = i++;
+ epgSearchConfig[eMenuWhatsOnNow][eEPGchsh] = i++;
+ epgSearchConfig[eMenuWhatsOnNow][eEPGtime] = i++;
+ if(ShowProgress)
+ epgSearchConfig[eMenuWhatsOnNow][eEPGprogrT2S] = i++;
+ else
+ epgSearchConfig[eMenuWhatsOnNow][eEPGprogr] = i++;
+ epgSearchConfig[eMenuWhatsOnNow][eEPGstatus] = i++;
+ epgSearchConfig[eMenuWhatsOnNow][eEPGtitle] = i++;
+ //MenuWhatsOnNext
+ i=0;
+ if (ShowChannelNr)
+ epgSearchConfig[eMenuWhatsOnNext][eEPGchnr] = i++;
+ epgSearchConfig[eMenuWhatsOnNext][eEPGchsh] = i++;
+ epgSearchConfig[eMenuWhatsOnNext][eEPGtime] = i++;
+ epgSearchConfig[eMenuWhatsOnNext][eEPGstatus] = i++;
+ epgSearchConfig[eMenuWhatsOnNext][eEPGtitle] = i++;
+ //MenuWhatsOnElse
+ i=0;
+ if (ShowChannelNr)
+ epgSearchConfig[eMenuWhatsOnElse][eEPGchnr] = i++;
+ epgSearchConfig[eMenuWhatsOnElse][eEPGchsh] = i++;
+ epgSearchConfig[eMenuWhatsOnElse][eEPGtime] = i++;
+ epgSearchConfig[eMenuWhatsOnElse][eEPGstatus] = i++;
+ epgSearchConfig[eMenuWhatsOnElse][eEPGtitle] = i++;
+ //MenuSearchResults
+ i=0;
+ if (ShowChannelNr)
+ epgSearchConfig[eMenuSearchResults][eEPGchnr] = i++;
+ epgSearchConfig[eMenuSearchResults][eEPGchsh] = i++;
+ epgSearchConfig[eMenuSearchResults][eEPGdatesh] = i++;
+ epgSearchConfig[eMenuSearchResults][eEPGtime] = i++;
+ epgSearchConfig[eMenuSearchResults][eEPGstatus] = i++;
+ epgSearchConfig[eMenuSearchResults][eEPGtitle] = i++;
+ //MenuFavorites
+ i=0;
+ if (ShowChannelNr)
+ epgSearchConfig[eMenuFavorites][eEPGchnr] = i++;
+ epgSearchConfig[eMenuFavorites][eEPGchsh] = i++;
+ epgSearchConfig[eMenuFavorites][eEPGtime] = i++;
+ epgSearchConfig[eMenuFavorites][eEPGtimespan] = i++;
+ epgSearchConfig[eMenuFavorites][eEPGstatus] = i++;
+ epgSearchConfig[eMenuFavorites][eEPGtitle] = i++;
}
void cNopacityEPGSearchConfig::SetTimerConfilictCont(void) {
- epgSearchConfig[eMenuTimerconflict][eEPGtime_d] = 0;
- epgSearchConfig[eMenuTimerconflict][eEPGchsh] = 1;
- epgSearchConfig[eMenuTimerconflict][eEPGdate] = 2;
- epgSearchConfig[eMenuTimerconflict][eEPGtime] = 3;
- epgSearchConfig[eMenuTimerconflict][eEPGtitle] = 4;
+ epgSearchConfig[eMenuTimerconflict][eEPGtime_d] = 0;
+ epgSearchConfig[eMenuTimerconflict][eEPGchsh] = 1;
+ epgSearchConfig[eMenuTimerconflict][eEPGdate] = 2;
+ epgSearchConfig[eMenuTimerconflict][eEPGtime] = 3;
+ epgSearchConfig[eMenuTimerconflict][eEPGtitle] = 4;
}
void cNopacityEPGSearchConfig::SetDefaultVDRConf(void) {
- //MenuSchedule
- epgSearchConfig[eMenuSchedule][eEPGdate] = 0;
- epgSearchConfig[eMenuSchedule][eEPGtime] = 1;
- epgSearchConfig[eMenuSchedule][eEPGstatus] = 2;
- epgSearchConfig[eMenuSchedule][eEPGtitle] = 3;
- //MenuWhatsOnNow
- epgSearchConfig[eMenuWhatsOnNow][eEPGchnr] = 0;
- epgSearchConfig[eMenuWhatsOnNow][eEPGchlng] = 1;
- epgSearchConfig[eMenuWhatsOnNow][eEPGtime] = 2;
- epgSearchConfig[eMenuWhatsOnNow][eEPGstatus] = 3;
- epgSearchConfig[eMenuWhatsOnNow][eEPGtitle] = 4;
- //MenuWhatsOnNext
- epgSearchConfig[eMenuWhatsOnNext][eEPGchnr] = 0;
- epgSearchConfig[eMenuWhatsOnNext][eEPGchlng] = 1;
- epgSearchConfig[eMenuWhatsOnNext][eEPGtime] = 2;
- epgSearchConfig[eMenuWhatsOnNext][eEPGstatus] = 3;
- epgSearchConfig[eMenuWhatsOnNext][eEPGtitle] = 4;
+ //MenuSchedule
+ epgSearchConfig[eMenuSchedule][eEPGdate] = 0;
+ epgSearchConfig[eMenuSchedule][eEPGtime] = 1;
+ epgSearchConfig[eMenuSchedule][eEPGstatus] = 2;
+ epgSearchConfig[eMenuSchedule][eEPGtitle] = 3;
+ //MenuWhatsOnNow
+ epgSearchConfig[eMenuWhatsOnNow][eEPGchnr] = 0;
+ epgSearchConfig[eMenuWhatsOnNow][eEPGchlng] = 1;
+ epgSearchConfig[eMenuWhatsOnNow][eEPGtime] = 2;
+ epgSearchConfig[eMenuWhatsOnNow][eEPGstatus] = 3;
+ epgSearchConfig[eMenuWhatsOnNow][eEPGtitle] = 4;
+ //MenuWhatsOnNext
+ epgSearchConfig[eMenuWhatsOnNext][eEPGchnr] = 0;
+ epgSearchConfig[eMenuWhatsOnNext][eEPGchlng] = 1;
+ epgSearchConfig[eMenuWhatsOnNext][eEPGtime] = 2;
+ epgSearchConfig[eMenuWhatsOnNext][eEPGstatus] = 3;
+ epgSearchConfig[eMenuWhatsOnNext][eEPGtitle] = 4;
}
void cNopacityEPGSearchConfig::toLowerCase(std::string &str) {
- const int length = str.length();
- for(int i=0; i < length; ++i) {
- str[i] = std::tolower(str[i]);
- }
+ const int length = str.length();
+ for(int i=0; i < length; ++i) {
+ str[i] = std::tolower(str[i]);
+ }
}
\ No newline at end of file diff --git a/epgsearchconf.h b/epgsearchconf.h index d531978..724437b 100644 --- a/epgsearchconf.h +++ b/epgsearchconf.h @@ -6,26 +6,26 @@ #define MAXITEMTABS 6
class cNopacityEPGSearchConfig {
- private:
- bool ReplaceSchedule;
- bool ShowChannelNr;
- bool ShowProgress;
- std::string *SplitEpgSearchMenuLine(std::string line);
- void SetTokens(std::string *values, eEPGModes mode);
- void toLowerCase(std::string &str);
- public:
- cNopacityEPGSearchConfig(void);
- virtual ~cNopacityEPGSearchConfig();
- bool CheckEPGSearchAvailable(void);
- bool ReplaceScheduleActive(void) {return ReplaceSchedule;};
- bool LoadEpgSearchConf(void);
- bool LoadEpgSearchMenuConf(void);
- void SetDefaultEPGSearchConf(void);
- void SetDefaultVDRConf(void);
- void SetTimerConfilictCont(void);
- bool UserSet[4];
- cString User[4];
- int epgSearchConfig[EPGSEARCHCATS][EPGSEARCHTOKENS];
+ private:
+ bool ReplaceSchedule;
+ bool ShowChannelNr;
+ bool ShowProgress;
+ std::string *SplitEpgSearchMenuLine(std::string line);
+ void SetTokens(std::string *values, eEPGModes mode);
+ void toLowerCase(std::string &str);
+ public:
+ cNopacityEPGSearchConfig(void);
+ virtual ~cNopacityEPGSearchConfig();
+ bool CheckEPGSearchAvailable(void);
+ bool ReplaceScheduleActive(void) {return ReplaceSchedule;};
+ bool LoadEpgSearchConf(void);
+ bool LoadEpgSearchMenuConf(void);
+ void SetDefaultEPGSearchConf(void);
+ void SetDefaultVDRConf(void);
+ void SetTimerConfilictCont(void);
+ bool UserSet[4];
+ cString User[4];
+ int epgSearchConfig[EPGSEARCHCATS][EPGSEARCHTOKENS];
};
#endif //__NOPACITY_EPGSEARCHCONFIG_H
\ No newline at end of file @@ -1,38 +1,38 @@ static cOsd *CreateOsd(int Left, int Top, int Width, int Height) { - cOsd *osd = cOsdProvider::NewOsd(Left, Top); - if (osd) { - tArea Area = { 0, 0, Width, Height, 32 }; - if (osd->SetAreas(&Area, 1) == oeOk) { - return osd; - } - } - return NULL; + cOsd *osd = cOsdProvider::NewOsd(Left, Top); + if (osd) { + tArea Area = { 0, 0, Width, Height, 32 }; + if (osd->SetAreas(&Area, 1) == oeOk) { + return osd; + } + } + return NULL; } static void DrawBlendedBackground(cPixmap *pixmap, tColor color, tColor colorBlending, bool fromTop) { - int width = pixmap->ViewPort().Width(); - int height = pixmap->ViewPort().Height(); - pixmap->Fill(color); - int numSteps = 16; - int alphaStep = 0x0F; - int alpha = 0x00; - int step, begin, end; - bool cont = true; - if (fromTop) { - step = 1; - begin = 0; - end = numSteps; - } else { - step = -1; - begin = height; - end = height - numSteps; - } - tColor clr; - for (int i = begin; cont; i = i + step) { - clr = AlphaBlend(color, colorBlending, alpha); - pixmap->DrawRectangle(cRect(0,i,width,1), clr); - alpha += alphaStep; - if (i == end) - cont = false; - } + int width = pixmap->ViewPort().Width(); + int height = pixmap->ViewPort().Height(); + pixmap->Fill(color); + int numSteps = 16; + int alphaStep = 0x0F; + int alpha = 0x00; + int step, begin, end; + bool cont = true; + if (fromTop) { + step = 1; + begin = 0; + end = numSteps; + } else { + step = -1; + begin = height; + end = height - numSteps; + } + tColor clr; + for (int i = begin; cont; i = i + step) { + clr = AlphaBlend(color, colorBlending, alpha); + pixmap->DrawRectangle(cRect(0,i,width,1), clr); + alpha += alphaStep; + if (i == end) + cont = false; + } }
\ No newline at end of file diff --git a/imageloader.c b/imageloader.c index d4f1d21..3a9a0be 100644 --- a/imageloader.c +++ b/imageloader.c @@ -11,56 +11,56 @@ cImageLoader::~cImageLoader() { } bool cImageLoader::LoadLogo(const char *logo, int width = config.logoWidth, int height = config.logoHeight) { - if ((width == 0)||(height==0)) - return false; - std::string logoLower = logo; - toLowerCase(logoLower); - bool success = false; - if (config.logoPathSet) { - success = LoadImage(logoLower.c_str(), config.logoPath, config.logoExtension); - } - if (!success) { - success = LoadImage(logoLower.c_str(), config.logoPathDefault, config.logoExtension); - } - if (!success) - return false; - if (height != 0 || width != 0) { - buffer.sample( Geometry(width, height)); - } - return true; + if ((width == 0)||(height==0)) + return false; + std::string logoLower = logo; + toLowerCase(logoLower); + bool success = false; + if (config.logoPathSet) { + success = LoadImage(logoLower.c_str(), config.logoPath, config.logoExtension); + } + if (!success) { + success = LoadImage(logoLower.c_str(), config.logoPathDefault, config.logoExtension); + } + if (!success) + return false; + if (height != 0 || width != 0) { + buffer.sample( Geometry(width, height)); + } + return true; } bool cImageLoader::LoadIcon(const char *cIcon, int size) { - if (size==0) - return false; - bool success = false; - if (config.iconPathSet) { - success = LoadImage(cString(cIcon), config.iconPath, "png"); - } - if (!success) { - success = LoadImage(cString(cIcon), config.iconPathDefault, "png"); - } - if (!success) - return false; - buffer.sample(Geometry(size, size)); - return true; + if (size==0) + return false; + bool success = false; + if (config.iconPathSet) { + success = LoadImage(cString(cIcon), config.iconPath, "png"); + } + if (!success) { + success = LoadImage(cString(cIcon), config.iconPathDefault, "png"); + } + if (!success) + return false; + buffer.sample(Geometry(size, size)); + return true; } bool cImageLoader::LoadIcon(const char *cIcon, int width, int height) { try { - if ((width == 0)||(height==0)) - return false; - bool success = false; - if (config.iconPathSet) { - success = LoadImage(cString(cIcon), config.iconPath, "png"); - } - if (!success) { - success = LoadImage(cString(cIcon), config.iconPathDefault, "png"); - } - if (!success) - return false; - buffer.scale(Geometry(width, height)); - return true; + if ((width == 0)||(height==0)) + return false; + bool success = false; + if (config.iconPathSet) { + success = LoadImage(cString(cIcon), config.iconPath, "png"); + } + if (!success) { + success = LoadImage(cString(cIcon), config.iconPathDefault, "png"); + } + if (!success) + return false; + buffer.scale(Geometry(width, height)); + return true; } catch (...) { return false; @@ -68,90 +68,90 @@ bool cImageLoader::LoadIcon(const char *cIcon, int width, int height) { } bool cImageLoader::LoadEPGImage(int eventID) { - int width = config.epgImageWidth; - int height = config.epgImageHeight; - if ((width == 0)||(height==0)) - return false; - bool success = false; - if (config.epgImagePathSet) { - success = LoadImage(cString::sprintf("%d", eventID), config.epgImagePath, "jpg"); - } - if (!success) { - success = LoadImage(cString::sprintf("%d", eventID), config.epgImagePathDefault, "jpg"); - } - if (!success) - return false; - if (height != 0 || width != 0) { - buffer.sample( Geometry(width, height)); - } - return true; + int width = config.epgImageWidth; + int height = config.epgImageHeight; + if ((width == 0)||(height==0)) + return false; + bool success = false; + if (config.epgImagePathSet) { + success = LoadImage(cString::sprintf("%d", eventID), config.epgImagePath, "jpg"); + } + if (!success) { + success = LoadImage(cString::sprintf("%d", eventID), config.epgImagePathDefault, "jpg"); + } + if (!success) + return false; + if (height != 0 || width != 0) { + buffer.sample( Geometry(width, height)); + } + return true; } void cImageLoader::DrawBackground(tColor back, tColor blend, int width, int height) { - Color Back = Argb2Color(back); - Color Blend = Argb2Color(blend); - Image tmp(Geometry(width, height), Blend); - double arguments[9] = {0.0,(double)height,0.0,-1*(double)width,0.0,0.0,1.5*(double)width,0.0,1.0}; - tmp.sparseColor(MatteChannel, BarycentricColorInterpolate, 9, arguments); - Image tmp2(Geometry(width, height), Back); - tmp.composite(tmp2, 0, 0, OverlayCompositeOp); - buffer = tmp; + Color Back = Argb2Color(back); + Color Blend = Argb2Color(blend); + Image tmp(Geometry(width, height), Blend); + double arguments[9] = {0.0,(double)height,0.0,-1*(double)width,0.0,0.0,1.5*(double)width,0.0,1.0}; + tmp.sparseColor(MatteChannel, BarycentricColorInterpolate, 9, arguments); + Image tmp2(Geometry(width, height), Back); + tmp.composite(tmp2, 0, 0, OverlayCompositeOp); + buffer = tmp; } void cImageLoader::DrawBackground2(tColor back, tColor blend, int width, int height) { - Color Back = Argb2Color(back); - Color Blend = Argb2Color(blend); - Image tmp(Geometry(width, height), Blend); - double arguments[9] = {0.0,(double)height,0.0,-0.5*(double)width,0.0,0.0,0.75*(double)width,0.0,1.0}; - tmp.sparseColor(MatteChannel, BarycentricColorInterpolate, 9, arguments); - Image tmp2(Geometry(width, height), Back); - tmp.composite(tmp2, 0, 0, OverlayCompositeOp); - buffer = tmp; + Color Back = Argb2Color(back); + Color Blend = Argb2Color(blend); + Image tmp(Geometry(width, height), Blend); + double arguments[9] = {0.0,(double)height,0.0,-0.5*(double)width,0.0,0.0,0.75*(double)width,0.0,1.0}; + tmp.sparseColor(MatteChannel, BarycentricColorInterpolate, 9, arguments); + Image tmp2(Geometry(width, height), Back); + tmp.composite(tmp2, 0, 0, OverlayCompositeOp); + buffer = tmp; } cImage cImageLoader::GetImage() { - int w, h; - w = buffer.columns(); - h = buffer.rows(); - cImage image (cSize(w, h)); - const PixelPacket *pixels = buffer.getConstPixels(0, 0, w, h); - for (int iy = 0; iy < h; ++iy) { - for (int ix = 0; ix < w; ++ix) { - tColor col = (~int(pixels->opacity * 255 / MaxRGB) << 24) - | (int(pixels->green * 255 / MaxRGB) << 8) - | (int(pixels->red * 255 / MaxRGB) << 16) - | (int(pixels->blue * 255 / MaxRGB) ); - image.SetPixel(cPoint(ix, iy), col); - ++pixels; - } - } - return image; + int w, h; + w = buffer.columns(); + h = buffer.rows(); + cImage image (cSize(w, h)); + const PixelPacket *pixels = buffer.getConstPixels(0, 0, w, h); + for (int iy = 0; iy < h; ++iy) { + for (int ix = 0; ix < w; ++ix) { + tColor col = (~int(pixels->opacity * 255 / MaxRGB) << 24) + | (int(pixels->green * 255 / MaxRGB) << 8) + | (int(pixels->red * 255 / MaxRGB) << 16) + | (int(pixels->blue * 255 / MaxRGB) ); + image.SetPixel(cPoint(ix, iy), col); + ++pixels; + } + } + return image; } Color cImageLoader::Argb2Color(tColor col) { - tIndex alpha = (col & 0xFF000000) >> 24; - tIndex red = (col & 0x00FF0000) >> 16; - tIndex green = (col & 0x0000FF00) >> 8; - tIndex blue = (col & 0x000000FF); - Color color(MaxRGB*red/255, MaxRGB*green/255, MaxRGB*blue/255, MaxRGB*(0xFF-alpha)/255); - return color; + tIndex alpha = (col & 0xFF000000) >> 24; + tIndex red = (col & 0x00FF0000) >> 16; + tIndex green = (col & 0x0000FF00) >> 8; + tIndex blue = (col & 0x000000FF); + Color color(MaxRGB*red/255, MaxRGB*green/255, MaxRGB*blue/255, MaxRGB*(0xFF-alpha)/255); + return color; } void cImageLoader::toLowerCase(std::string &str) { - const int length = str.length(); - for(int i=0; i < length; ++i) { - str[i] = std::tolower(str[i]); - } + const int length = str.length(); + for(int i=0; i < length; ++i) { + str[i] = std::tolower(str[i]); + } } bool cImageLoader::LoadImage(cString FileName, cString Path, cString Extension) { - try { - cString File = cString::sprintf("%s%s.%s", *Path, *FileName, *Extension); - dsyslog("nopacity: trying to load: %s", *File); - buffer.read(*File); - dsyslog("nopacity: %s sucessfully loaded", *File); - } catch (...) { - return false; - } - return true; + try { + cString File = cString::sprintf("%s%s.%s", *Path, *FileName, *Extension); + dsyslog("nopacity: trying to load: %s", *File); + buffer.read(*File); + dsyslog("nopacity: %s sucessfully loaded", *File); + } catch (...) { + return false; + } + return true; } diff --git a/imageloader.h b/imageloader.h index cade4d0..96d1fdd 100644 --- a/imageloader.h +++ b/imageloader.h @@ -11,20 +11,20 @@ using namespace Magick; class cImageLoader { public: - cImageLoader(); - ~cImageLoader(); - cImage GetImage(); - bool LoadLogo(const char *logo, int width, int height); - bool LoadIcon(const char *cIcon, int size); - bool LoadIcon(const char *cIcon, int width, int height); - bool LoadEPGImage(int eventID); - void DrawBackground(tColor back, tColor blend, int width, int height); - void DrawBackground2(tColor back, tColor blend, int width, int height); + cImageLoader(); + ~cImageLoader(); + cImage GetImage(); + bool LoadLogo(const char *logo, int width, int height); + bool LoadIcon(const char *cIcon, int size); + bool LoadIcon(const char *cIcon, int width, int height); + bool LoadEPGImage(int eventID); + void DrawBackground(tColor back, tColor blend, int width, int height); + void DrawBackground2(tColor back, tColor blend, int width, int height); private: - Image buffer; - Color Argb2Color(tColor col); - void toLowerCase(std::string &str); - bool LoadImage(cString FileName, cString Path, cString Extension); + Image buffer; + Color Argb2Color(tColor col); + void toLowerCase(std::string &str); + bool LoadImage(cString FileName, cString Path, cString Extension); }; #endif //__NOPACITY_IMAGELOADER_H diff --git a/menudetailview.c b/menudetailview.c index c6d781c..091a542 100644 --- a/menudetailview.c +++ b/menudetailview.c @@ -3,280 +3,280 @@ #include <sstream> cNopacityMenuDetailView::cNopacityMenuDetailView(cOsd *osd) { - this->osd = osd; - hasScrollbar = false; - additionalContent = NULL; - additionalContentSet = false; + this->osd = osd; + hasScrollbar = false; + additionalContent = NULL; + additionalContentSet = false; } cNopacityMenuDetailView::~cNopacityMenuDetailView(void) { - delete font; - if (fontHeader) - delete fontHeader; - if (fontHeaderLarge) - delete fontHeaderLarge; + delete font; + if (fontHeader) + delete fontHeader; + if (fontHeaderLarge) + delete fontHeaderLarge; } void cNopacityMenuDetailView::SetGeometry(int width, int height, int top, int contentBorder, int headerHeight) { - this->width = width; - this->height = height; - this->top = top; - this->border = contentBorder; - this->headerHeight = headerHeight; - contentHeight = height - headerHeight; + this->width = width; + this->height = height; + this->top = top; + this->border = contentBorder; + this->headerHeight = headerHeight; + contentHeight = height - headerHeight; } void cNopacityMenuDetailView::SetContent(const char *textContent) { - if (textContent) { - cString sContent = textContent; - if (additionalContentSet) { - std::stringstream sstrContent; - sstrContent << textContent; - sstrContent << std::endl; - sstrContent << std::endl; - sstrContent << *additionalContent; - sContent = sstrContent.str().c_str(); - } - content.Set(*sContent, font, width - 4 * border); - } else - content.Set("", font, width - 4 * border); - - int textHeight = font->Height(); - int linesContent = content.Lines() + 2; - int heightContentText = linesContent * textHeight; - if (heightContentText > contentHeight) { - contentDrawPortHeight = heightContentText; - hasScrollbar = true; - } else { - contentDrawPortHeight = contentHeight; - } + if (textContent) { + cString sContent = textContent; + if (additionalContentSet) { + std::stringstream sstrContent; + sstrContent << textContent; + sstrContent << std::endl; + sstrContent << std::endl; + sstrContent << *additionalContent; + sContent = sstrContent.str().c_str(); + } + content.Set(*sContent, font, width - 4 * border); + } else + content.Set("", font, width - 4 * border); + + int textHeight = font->Height(); + int linesContent = content.Lines() + 2; + int heightContentText = linesContent * textHeight; + if (heightContentText > contentHeight) { + contentDrawPortHeight = heightContentText; + hasScrollbar = true; + } else { + contentDrawPortHeight = contentHeight; + } } void cNopacityMenuDetailView::DrawContent(void) { - int linesContent = content.Lines(); - int textHeight = font->Height(); - for (int i=0; i<linesContent; i++) { - pixmapContent->DrawText(cPoint(2*border, (i+1)*textHeight), content.GetLine(i), Theme.Color(clrMenuFontDetailViewText), clrTransparent, font); - } + int linesContent = content.Lines(); + int textHeight = font->Height(); + for (int i=0; i<linesContent; i++) { + pixmapContent->DrawText(cPoint(2*border, (i+1)*textHeight), content.GetLine(i), Theme.Color(clrMenuFontDetailViewText), clrTransparent, font); + } } void cNopacityMenuDetailView::LoadReruns(const cEvent *event) { - cPlugin *epgSearchPlugin = cPluginManager::GetPlugin("epgsearch"); - if (epgSearchPlugin && !isempty(event->Title())) { - std::stringstream sstrReruns; - Epgsearch_searchresults_v1_0 data; - std::string strQuery = event->Title(); - if (config.useSubtitleRerun > 0) { - if (config.useSubtitleRerun == 2 || !isempty(event->ShortText())) - strQuery += "~"; - if (!isempty(event->ShortText())) - strQuery += event->ShortText(); - data.useSubTitle = true; - } else { - data.useSubTitle = false; - } - data.query = (char *)strQuery.c_str(); - data.mode = 0; - data.channelNr = 0; - data.useTitle = true; - data.useDescription = false; - - if (epgSearchPlugin->Service("Epgsearch-searchresults-v1.0", &data)) { - cList<Epgsearch_searchresults_v1_0::cServiceSearchResult>* list = data.pResultList; - if (list && (list->Count() > 1)) { - //TODO: current event is shown as rerun - sstrReruns << tr("RERUNS OF THIS SHOW") << ':' << std::endl; - int i = 0; - for (Epgsearch_searchresults_v1_0::cServiceSearchResult *r = list->First(); r && i < config.numReruns; r = list->Next(r)) { - i++; - sstrReruns << "- " - << *DayDateTime(r->event->StartTime()); - cChannel *channel = Channels.GetByChannelID(r->event->ChannelID(), true, true); - if (channel) - sstrReruns << " " << channel->ShortName(true); - sstrReruns << ": " << r->event->Title(); - if (!isempty(r->event->ShortText())) - sstrReruns << "~" << r->event->ShortText(); - sstrReruns << std::endl; - } - delete list; - } - } - additionalContent = sstrReruns.str().c_str(); - additionalContentSet = true; - } + cPlugin *epgSearchPlugin = cPluginManager::GetPlugin("epgsearch"); + if (epgSearchPlugin && !isempty(event->Title())) { + std::stringstream sstrReruns; + Epgsearch_searchresults_v1_0 data; + std::string strQuery = event->Title(); + if (config.useSubtitleRerun > 0) { + if (config.useSubtitleRerun == 2 || !isempty(event->ShortText())) + strQuery += "~"; + if (!isempty(event->ShortText())) + strQuery += event->ShortText(); + data.useSubTitle = true; + } else { + data.useSubTitle = false; + } + data.query = (char *)strQuery.c_str(); + data.mode = 0; + data.channelNr = 0; + data.useTitle = true; + data.useDescription = false; + + if (epgSearchPlugin->Service("Epgsearch-searchresults-v1.0", &data)) { + cList<Epgsearch_searchresults_v1_0::cServiceSearchResult>* list = data.pResultList; + if (list && (list->Count() > 1)) { + //TODO: current event is shown as rerun + sstrReruns << tr("RERUNS OF THIS SHOW") << ':' << std::endl; + int i = 0; + for (Epgsearch_searchresults_v1_0::cServiceSearchResult *r = list->First(); r && i < config.numReruns; r = list->Next(r)) { + i++; + sstrReruns << "- " + << *DayDateTime(r->event->StartTime()); + cChannel *channel = Channels.GetByChannelID(r->event->ChannelID(), true, true); + if (channel) + sstrReruns << " " << channel->ShortName(true); + sstrReruns << ": " << r->event->Title(); + if (!isempty(r->event->ShortText())) + sstrReruns << "~" << r->event->ShortText(); + sstrReruns << std::endl; + } + delete list; + } + } + additionalContent = sstrReruns.str().c_str(); + additionalContentSet = true; + } } double cNopacityMenuDetailView::ScrollbarSize(void) { - double barSize = (double)contentHeight / (double)contentDrawPortHeight; - return barSize; + double barSize = (double)contentHeight / (double)contentDrawPortHeight; + return barSize; } double cNopacityMenuDetailView::Offset(void) { - double offset; - if (((-1)*pixmapContent->DrawPort().Point().Y() + contentHeight + font->Height()) > contentDrawPortHeight) - offset = (double)1 - ScrollbarSize(); - else - offset = (double)((-1)*pixmapContent->DrawPort().Point().Y())/(double)((-1)*pixmapContent->DrawPort().Point().Y() + contentHeight); - return offset; + double offset; + if (((-1)*pixmapContent->DrawPort().Point().Y() + contentHeight + font->Height()) > contentDrawPortHeight) + offset = (double)1 - ScrollbarSize(); + else + offset = (double)((-1)*pixmapContent->DrawPort().Point().Y())/(double)((-1)*pixmapContent->DrawPort().Point().Y() + contentHeight); + return offset; } bool cNopacityMenuDetailView::Scroll(bool Up, bool Page) { - int aktHeight = pixmapContent->DrawPort().Point().Y(); - int totalHeight = pixmapContent->DrawPort().Height(); - int screenHeight = pixmapContent->ViewPort().Height(); - int lineHeight = font->Height(); - bool scrolled = false; - if (Up) { - if (Page) { - int newY = aktHeight + screenHeight; - if (newY > 0) - newY = 0; - pixmapContent->SetDrawPortPoint(cPoint(0, newY)); - scrolled = true; - } else { - if (aktHeight < 0) { - pixmapContent->SetDrawPortPoint(cPoint(0, aktHeight + lineHeight)); - scrolled = true; - } - } - } else { - if (Page) { - int newY = aktHeight - screenHeight; - if ((-1)*newY > totalHeight - screenHeight) - newY = (-1)*(totalHeight - screenHeight); - pixmapContent->SetDrawPortPoint(cPoint(0, newY)); - scrolled = true; - } else { - if (totalHeight - ((-1)*aktHeight + lineHeight) > screenHeight) { - pixmapContent->SetDrawPortPoint(cPoint(0, aktHeight - lineHeight)); - scrolled = true; - } - } - } - return scrolled; + int aktHeight = pixmapContent->DrawPort().Point().Y(); + int totalHeight = pixmapContent->DrawPort().Height(); + int screenHeight = pixmapContent->ViewPort().Height(); + int lineHeight = font->Height(); + bool scrolled = false; + if (Up) { + if (Page) { + int newY = aktHeight + screenHeight; + if (newY > 0) + newY = 0; + pixmapContent->SetDrawPortPoint(cPoint(0, newY)); + scrolled = true; + } else { + if (aktHeight < 0) { + pixmapContent->SetDrawPortPoint(cPoint(0, aktHeight + lineHeight)); + scrolled = true; + } + } + } else { + if (Page) { + int newY = aktHeight - screenHeight; + if ((-1)*newY > totalHeight - screenHeight) + newY = (-1)*(totalHeight - screenHeight); + pixmapContent->SetDrawPortPoint(cPoint(0, newY)); + scrolled = true; + } else { + if (totalHeight - ((-1)*aktHeight + lineHeight) > screenHeight) { + pixmapContent->SetDrawPortPoint(cPoint(0, aktHeight - lineHeight)); + scrolled = true; + } + } + } + return scrolled; } //---------------cNopacityMenuDetailEventView--------------------- cNopacityMenuDetailEventView::cNopacityMenuDetailEventView(cOsd *osd, const cEvent *Event) : cNopacityMenuDetailView(osd) { - event = Event; + event = Event; } cNopacityMenuDetailEventView::~cNopacityMenuDetailEventView(void) { - osd->DestroyPixmap(pixmapHeader); - osd->DestroyPixmap(pixmapContent); - osd->DestroyPixmap(pixmapLogo); + osd->DestroyPixmap(pixmapHeader); + osd->DestroyPixmap(pixmapContent); + osd->DestroyPixmap(pixmapLogo); } void cNopacityMenuDetailEventView::CreatePixmaps(void) { - pixmapHeader = osd->CreatePixmap(3, cRect(0, top, width, headerHeight)); - pixmapContent = osd->CreatePixmap(3, cRect(0, top + headerHeight, width, contentHeight), - cRect(0, 0, width, contentDrawPortHeight)); - pixmapLogo = osd->CreatePixmap(4, cRect(0 + border, top + max((headerHeight-config.logoHeight)/2,1), config.detailViewLogoWidth, config.detailViewLogoHeight)); - - pixmapHeader->Fill(clrTransparent); - pixmapHeader->DrawRectangle(cRect(0, headerHeight - 2, width, 2), Theme.Color(clrMenuBorder)); - pixmapContent->Fill(clrTransparent); - pixmapLogo->Fill(clrTransparent); - + pixmapHeader = osd->CreatePixmap(3, cRect(0, top, width, headerHeight)); + pixmapContent = osd->CreatePixmap(3, cRect(0, top + headerHeight, width, contentHeight), + cRect(0, 0, width, contentDrawPortHeight)); + pixmapLogo = osd->CreatePixmap(4, cRect(0 + border, top + max((headerHeight-config.logoHeight)/2,1), config.detailViewLogoWidth, config.detailViewLogoHeight)); + + pixmapHeader->Fill(clrTransparent); + pixmapHeader->DrawRectangle(cRect(0, headerHeight - 2, width, 2), Theme.Color(clrMenuBorder)); + pixmapContent->Fill(clrTransparent); + pixmapLogo->Fill(clrTransparent); + } void cNopacityMenuDetailEventView::SetFonts(void) { - font = cFont::CreateFont(config.fontName, contentHeight / 25 + 3 + config.fontDetailView); - fontHeaderLarge = cFont::CreateFont(config.fontName, headerHeight / 4 + config.fontDetailViewHeaderLarge); - fontHeader = cFont::CreateFont(config.fontName, headerHeight / 6 + config.fontDetailViewHeader); + font = cFont::CreateFont(config.fontName, contentHeight / 25 + 3 + config.fontDetailView); + fontHeaderLarge = cFont::CreateFont(config.fontName, headerHeight / 4 + config.fontDetailViewHeaderLarge); + fontHeader = cFont::CreateFont(config.fontName, headerHeight / 6 + config.fontDetailViewHeader); } void cNopacityMenuDetailEventView::Render(void) { - DrawHeader(); - DrawContent(); + DrawHeader(); + DrawContent(); } void cNopacityMenuDetailEventView::DrawHeader(void) { - cImageLoader imgLoader; - int logoWidth = config.detailViewLogoWidth; - cChannel *channel = Channels.GetByChannelID(event->ChannelID(), true); - if (channel && channel->Name() && imgLoader.LoadLogo(channel->Name(), logoWidth, config.detailViewLogoHeight)) { - pixmapLogo->DrawImage(cPoint(0, max((headerHeight - config.detailViewLogoHeight - border)/2, 0)), imgLoader.GetImage()); - } - int widthTextHeader = width - 4 * border - logoWidth; - if (imgLoader.LoadEPGImage(event->EventID())) { - pixmapHeader->DrawImage(cPoint(width - config.epgImageWidth - border, (headerHeight-config.epgImageHeight)/2), imgLoader.GetImage()); - widthTextHeader -= config.epgImageWidth; - } - - int lineHeight = fontHeaderLarge->Height(); - - cString dateTime = cString::sprintf("%s %s - %s", *event->GetDateString(), *event->GetTimeString(), *event->GetEndTimeString()); - pixmapHeader->DrawText(cPoint(logoWidth + 2*border, (lineHeight - fontHeader->Height())/2), *dateTime, Theme.Color(clrMenuFontDetailViewHeader), clrTransparent, fontHeader); - - cTextWrapper title; - title.Set(event->Title(), fontHeaderLarge, widthTextHeader); - int currentLineHeight = lineHeight; - for (int i=0; i < title.Lines(); i++) { - pixmapHeader->DrawText(cPoint(logoWidth + 2*border, currentLineHeight), title.GetLine(i), Theme.Color(clrMenuFontDetailViewHeaderTitle), clrTransparent, fontHeaderLarge); - currentLineHeight += lineHeight; - } - - cTextWrapper shortText; - shortText.Set(event->ShortText(), fontHeader, widthTextHeader); - currentLineHeight += (lineHeight - fontHeader->Height())/2; - for (int i=0; i < shortText.Lines(); i++) { - if ((currentLineHeight + fontHeader->Height()) < headerHeight) { - pixmapHeader->DrawText(cPoint(logoWidth + 2*border, currentLineHeight), shortText.GetLine(i), Theme.Color(clrMenuFontDetailViewHeader), clrTransparent, fontHeader); - currentLineHeight += fontHeader->Height(); - } else - break; - } + cImageLoader imgLoader; + int logoWidth = config.detailViewLogoWidth; + cChannel *channel = Channels.GetByChannelID(event->ChannelID(), true); + if (channel && channel->Name() && imgLoader.LoadLogo(channel->Name(), logoWidth, config.detailViewLogoHeight)) { + pixmapLogo->DrawImage(cPoint(0, max((headerHeight - config.detailViewLogoHeight - border)/2, 0)), imgLoader.GetImage()); + } + int widthTextHeader = width - 4 * border - logoWidth; + if (imgLoader.LoadEPGImage(event->EventID())) { + pixmapHeader->DrawImage(cPoint(width - config.epgImageWidth - border, (headerHeight-config.epgImageHeight)/2), imgLoader.GetImage()); + widthTextHeader -= config.epgImageWidth; + } + + int lineHeight = fontHeaderLarge->Height(); + + cString dateTime = cString::sprintf("%s %s - %s", *event->GetDateString(), *event->GetTimeString(), *event->GetEndTimeString()); + pixmapHeader->DrawText(cPoint(logoWidth + 2*border, (lineHeight - fontHeader->Height())/2), *dateTime, Theme.Color(clrMenuFontDetailViewHeader), clrTransparent, fontHeader); + + cTextWrapper title; + title.Set(event->Title(), fontHeaderLarge, widthTextHeader); + int currentLineHeight = lineHeight; + for (int i=0; i < title.Lines(); i++) { + pixmapHeader->DrawText(cPoint(logoWidth + 2*border, currentLineHeight), title.GetLine(i), Theme.Color(clrMenuFontDetailViewHeaderTitle), clrTransparent, fontHeaderLarge); + currentLineHeight += lineHeight; + } + + cTextWrapper shortText; + shortText.Set(event->ShortText(), fontHeader, widthTextHeader); + currentLineHeight += (lineHeight - fontHeader->Height())/2; + for (int i=0; i < shortText.Lines(); i++) { + if ((currentLineHeight + fontHeader->Height()) < headerHeight) { + pixmapHeader->DrawText(cPoint(logoWidth + 2*border, currentLineHeight), shortText.GetLine(i), Theme.Color(clrMenuFontDetailViewHeader), clrTransparent, fontHeader); + currentLineHeight += fontHeader->Height(); + } else + break; + } } //------------------cNopacityMenuDetailRecordingView------------------ cNopacityMenuDetailRecordingView::cNopacityMenuDetailRecordingView(cOsd *osd, const cRecording *Recording) : cNopacityMenuDetailView(osd) { - recording = Recording; - info = Recording->Info(); + recording = Recording; + info = Recording->Info(); } cNopacityMenuDetailRecordingView::~cNopacityMenuDetailRecordingView(void) { - osd->DestroyPixmap(pixmapHeader); - osd->DestroyPixmap(pixmapContent); + osd->DestroyPixmap(pixmapHeader); + osd->DestroyPixmap(pixmapContent); } void cNopacityMenuDetailRecordingView::CreatePixmaps(void) { - pixmapHeader = osd->CreatePixmap(3, cRect(0, top, width, headerHeight)); - pixmapContent = osd->CreatePixmap(3, cRect(0, top + headerHeight, width, contentHeight), - cRect(0, 0, width, contentDrawPortHeight)); + pixmapHeader = osd->CreatePixmap(3, cRect(0, top, width, headerHeight)); + pixmapContent = osd->CreatePixmap(3, cRect(0, top + headerHeight, width, contentHeight), + cRect(0, 0, width, contentDrawPortHeight)); - pixmapHeader->Fill(clrTransparent); - pixmapHeader->DrawRectangle(cRect(0, headerHeight - 2, width, 2), Theme.Color(clrMenuBorder)); - pixmapContent->Fill(clrTransparent); + pixmapHeader->Fill(clrTransparent); + pixmapHeader->DrawRectangle(cRect(0, headerHeight - 2, width, 2), Theme.Color(clrMenuBorder)); + pixmapContent->Fill(clrTransparent); } void cNopacityMenuDetailRecordingView::SetFonts(void) { - font = cFont::CreateFont(config.fontName, contentHeight / 25 + config.fontDetailView); - fontHeaderLarge = cFont::CreateFont(config.fontName, headerHeight / 4 + config.fontDetailViewHeaderLarge); - fontHeader = cFont::CreateFont(config.fontName, headerHeight / 6 + config.fontDetailViewHeader); + font = cFont::CreateFont(config.fontName, contentHeight / 25 + config.fontDetailView); + fontHeaderLarge = cFont::CreateFont(config.fontName, headerHeight / 4 + config.fontDetailViewHeaderLarge); + fontHeader = cFont::CreateFont(config.fontName, headerHeight / 6 + config.fontDetailViewHeader); } void cNopacityMenuDetailRecordingView::Render(void) { - DrawHeader(); - DrawContent(); + DrawHeader(); + DrawContent(); } void cNopacityMenuDetailRecordingView::DrawHeader(void) { - int lineHeight = fontHeaderLarge->Height(); - cString dateTime = cString::sprintf("%s %s", *DateString(recording->Start()), *TimeString(recording->Start())); - const char *Title = info->Title(); - if (isempty(Title)) - Title = recording->Name(); - pixmapHeader->DrawText(cPoint(2*border, (lineHeight - fontHeader->Height())/2), *dateTime, Theme.Color(clrMenuFontDetailViewHeader), clrTransparent, fontHeader); - pixmapHeader->DrawText(cPoint(2*border, lineHeight), Title, Theme.Color(clrMenuFontDetailViewHeaderTitle), clrTransparent, fontHeaderLarge); - if (!isempty(info->ShortText())) { - pixmapHeader->DrawText(cPoint(2*border, 2*lineHeight + (lineHeight - fontHeader->Height())/2), info->ShortText(), Theme.Color(clrMenuFontDetailViewHeader), clrTransparent, fontHeader); + int lineHeight = fontHeaderLarge->Height(); + cString dateTime = cString::sprintf("%s %s", *DateString(recording->Start()), *TimeString(recording->Start())); + const char *Title = info->Title(); + if (isempty(Title)) + Title = recording->Name(); + pixmapHeader->DrawText(cPoint(2*border, (lineHeight - fontHeader->Height())/2), *dateTime, Theme.Color(clrMenuFontDetailViewHeader), clrTransparent, fontHeader); + pixmapHeader->DrawText(cPoint(2*border, lineHeight), Title, Theme.Color(clrMenuFontDetailViewHeaderTitle), clrTransparent, fontHeaderLarge); + if (!isempty(info->ShortText())) { + pixmapHeader->DrawText(cPoint(2*border, 2*lineHeight + (lineHeight - fontHeader->Height())/2), info->ShortText(), Theme.Color(clrMenuFontDetailViewHeader), clrTransparent, fontHeader); } } @@ -286,22 +286,22 @@ cNopacityMenuDetailTextView::cNopacityMenuDetailTextView(cOsd *osd) : cNopacityM } cNopacityMenuDetailTextView::~cNopacityMenuDetailTextView(void) { - osd->DestroyPixmap(pixmapContent); + osd->DestroyPixmap(pixmapContent); } void cNopacityMenuDetailTextView::SetFonts(void) { - font = cFont::CreateFont(config.fontName, contentHeight / 25 + config.fontDetailView); - fontHeaderLarge = NULL; - fontHeader = NULL; + font = cFont::CreateFont(config.fontName, contentHeight / 25 + config.fontDetailView); + fontHeaderLarge = NULL; + fontHeader = NULL; } void cNopacityMenuDetailTextView::CreatePixmaps(void) { - pixmapContent = osd->CreatePixmap(3, cRect(0, top + headerHeight, width, contentHeight), - cRect(0, 0, width, contentDrawPortHeight)); + pixmapContent = osd->CreatePixmap(3, cRect(0, top + headerHeight, width, contentHeight), + cRect(0, 0, width, contentDrawPortHeight)); - pixmapContent->Fill(clrTransparent); + pixmapContent->Fill(clrTransparent); } void cNopacityMenuDetailTextView::Render(void) { - DrawContent(); + DrawContent(); }
\ No newline at end of file diff --git a/menudetailview.h b/menudetailview.h index 16697f4..95cb789 100644 --- a/menudetailview.h +++ b/menudetailview.h @@ -3,68 +3,68 @@ class cNopacityMenuDetailView { protected: - cOsd *osd; - bool hasScrollbar; - int width, height, top; - int headerHeight; - int contentHeight; - int contentDrawPortHeight; - int border; - cTextWrapper content; - cString additionalContent; - bool additionalContentSet; - cFont *font, *fontHeader, *fontHeaderLarge; - cPixmap *pixmapHeader; - cPixmap *pixmapLogo; - cPixmap *pixmapContent; - void DrawContent(void); + cOsd *osd; + bool hasScrollbar; + int width, height, top; + int headerHeight; + int contentHeight; + int contentDrawPortHeight; + int border; + cTextWrapper content; + cString additionalContent; + bool additionalContentSet; + cFont *font, *fontHeader, *fontHeaderLarge; + cPixmap *pixmapHeader; + cPixmap *pixmapLogo; + cPixmap *pixmapContent; + void DrawContent(void); public: - cNopacityMenuDetailView(cOsd *osd); - virtual ~cNopacityMenuDetailView(void); - void SetGeometry(int width, int height, int top, int contentBorder, int headerHeight); - virtual void SetFonts(void) = 0; - void SetContent(const char *textContent); - void LoadReruns(const cEvent *event); - bool Scrollable(void) {return hasScrollbar;} - double ScrollbarSize(void); - double Offset(void); - bool Scroll(bool Up, bool Page); - virtual void CreatePixmaps(void) = 0; - virtual void Render(void) = 0; + cNopacityMenuDetailView(cOsd *osd); + virtual ~cNopacityMenuDetailView(void); + void SetGeometry(int width, int height, int top, int contentBorder, int headerHeight); + virtual void SetFonts(void) = 0; + void SetContent(const char *textContent); + void LoadReruns(const cEvent *event); + bool Scrollable(void) {return hasScrollbar;} + double ScrollbarSize(void); + double Offset(void); + bool Scroll(bool Up, bool Page); + virtual void CreatePixmaps(void) = 0; + virtual void Render(void) = 0; }; class cNopacityMenuDetailEventView : public cNopacityMenuDetailView { private: - void DrawHeader(void); - const cEvent *event; + void DrawHeader(void); + const cEvent *event; public: - cNopacityMenuDetailEventView(cOsd *osd, const cEvent *Event); - virtual ~cNopacityMenuDetailEventView(void); - void CreatePixmaps(void); - void SetFonts(void); - void Render(void); + cNopacityMenuDetailEventView(cOsd *osd, const cEvent *Event); + virtual ~cNopacityMenuDetailEventView(void); + void CreatePixmaps(void); + void SetFonts(void); + void Render(void); }; class cNopacityMenuDetailRecordingView : public cNopacityMenuDetailView { private: - void DrawHeader(void); - const cRecording *recording; - const cRecordingInfo *info; + void DrawHeader(void); + const cRecording *recording; + const cRecordingInfo *info; public: - cNopacityMenuDetailRecordingView(cOsd *osd, const cRecording *Recording); - virtual ~cNopacityMenuDetailRecordingView(void); - void CreatePixmaps(void); - void SetFonts(void); - void Render(void); + cNopacityMenuDetailRecordingView(cOsd *osd, const cRecording *Recording); + virtual ~cNopacityMenuDetailRecordingView(void); + void CreatePixmaps(void); + void SetFonts(void); + void Render(void); }; class cNopacityMenuDetailTextView : public cNopacityMenuDetailView { private: public: - cNopacityMenuDetailTextView(cOsd *osd); - virtual ~cNopacityMenuDetailTextView(void); - void CreatePixmaps(void); - void SetFonts(void); - void Render(void); + cNopacityMenuDetailTextView(cOsd *osd); + virtual ~cNopacityMenuDetailTextView(void); + void CreatePixmaps(void); + void SetFonts(void); + void Render(void); }; #endif //__NOPACITY_MENUDETAILVIEW_H
\ No newline at end of file @@ -7,128 +7,128 @@ // cNopacityMenuItem ------------- cNopacityMenuItem::cNopacityMenuItem(cOsd *osd, const char *text, bool sel) { - this->osd = osd; - hasIcon = false; - drawn = false; - Text = text; - selectable = sel; - current = false; - wasCurrent = false; - scrollable = false; - itemTabs = NULL; - tabWidth = NULL; - pixmapIcon = NULL; - pixmapTextScroller = NULL; + this->osd = osd; + hasIcon = false; + drawn = false; + Text = text; + selectable = sel; + current = false; + wasCurrent = false; + scrollable = false; + itemTabs = NULL; + tabWidth = NULL; + pixmapIcon = NULL; + pixmapTextScroller = NULL; } cNopacityMenuItem::~cNopacityMenuItem(void) { - Cancel(-1); - while (Active()) - cCondWait::SleepMs(10); - delete [] itemTabs; - delete [] tabWidth; - osd->DestroyPixmap(pixmap); - if (pixmapIcon) { - osd->DestroyPixmap(pixmapIcon); - } - if (pixmapTextScroller) { - osd->DestroyPixmap(pixmapTextScroller); - } + Cancel(-1); + while (Active()) + cCondWait::SleepMs(10); + delete [] itemTabs; + delete [] tabWidth; + osd->DestroyPixmap(pixmap); + if (pixmapIcon) { + osd->DestroyPixmap(pixmapIcon); + } + if (pixmapTextScroller) { + osd->DestroyPixmap(pixmapTextScroller); + } } void cNopacityMenuItem::SetCurrent(bool cur) { - wasCurrent = current; - current = cur; + wasCurrent = current; + current = cur; } void cNopacityMenuItem::SetGeometry(int index, int top, int left, int width, int height) { - this->index = index; - this->top = top; - this->left = left; - this->width = width; - this->height = height; + this->index = index; + this->top = top; + this->left = left; + this->width = width; + this->height = height; } void cNopacityMenuItem::CreatePixmap() { - pixmap = osd->CreatePixmap(3, cRect(left, top + index * (height + left), width, height)); + pixmap = osd->CreatePixmap(3, cRect(left, top + index * (height + left), width, height)); } void cNopacityMenuItem::CreatePixmapIcon(int iconWidth, int iconHeight) { - pixmapIcon = osd->CreatePixmap(5, cRect(left, top + index * (height + left), iconWidth, iconHeight)); - pixmapIcon->Fill(clrTransparent); - hasIcon = true; + pixmapIcon = osd->CreatePixmap(5, cRect(left, top + index * (height + left), iconWidth, iconHeight)); + pixmapIcon->Fill(clrTransparent); + hasIcon = true; } void cNopacityMenuItem::CreatePixmapTextScroller(int totalWidth) { - pixmapTextScroller = osd->CreatePixmap(4, cRect(left, top + index * (height + left), width, height), cRect(0, 0, totalWidth+10, height)); - pixmapTextScroller->Fill(clrTransparent); + pixmapTextScroller = osd->CreatePixmap(4, cRect(left, top + index * (height + left), width, height), cRect(0, 0, totalWidth+10, height)); + pixmapTextScroller->Fill(clrTransparent); } void cNopacityMenuItem::SetTabs(cString *tabs, int *tabWidths, int numtabs) { - if (itemTabs) - delete [] itemTabs; - if (tabWidth) - delete [] tabWidth; - itemTabs = tabs; - tabWidth = tabWidths; - numTabs = numtabs; + if (itemTabs) + delete [] itemTabs; + if (tabWidth) + delete [] tabWidth; + itemTabs = tabs; + tabWidth = tabWidths; + numTabs = numtabs; } void cNopacityMenuItem::SetBackgrounds(int *handleBackgrounds) { - this->handleBackgrounds = handleBackgrounds; + this->handleBackgrounds = handleBackgrounds; } void cNopacityMenuItem::DrawDelimiter(const char *del, const char *icon, int handleBgrd) { - pixmap->Fill(Theme.Color(clrMenuItem)); - pixmap->DrawImage(cPoint(1, 1), handleBgrd); - cImageLoader imgLoader; - if (!drawn) { - if (imgLoader.LoadIcon(icon, config.iconHeight)) { - if (pixmapIcon == NULL) { - pixmapIcon = osd->CreatePixmap(5, cRect(left, top + index * (height + left), config.menuItemLogoWidth, config.menuItemLogoWidth)); - pixmapIcon->Fill(clrTransparent); - } - pixmapIcon->DrawImage(cPoint(1, (height - config.iconHeight) / 2), imgLoader.GetImage()); - } - drawn = true; - } - std::string delimiter = del; - delimiter.erase(delimiter.find_last_not_of("-")+1); - int x = config.iconHeight + 3; - int y = (height - font->Height()) / 2; - pixmap->DrawText(cPoint(x, y), delimiter.c_str(), Theme.Color(clrMenuFontMenuItemSep), clrTransparent, font); + pixmap->Fill(Theme.Color(clrMenuItem)); + pixmap->DrawImage(cPoint(1, 1), handleBgrd); + cImageLoader imgLoader; + if (!drawn) { + if (imgLoader.LoadIcon(icon, config.iconHeight)) { + if (pixmapIcon == NULL) { + pixmapIcon = osd->CreatePixmap(5, cRect(left, top + index * (height + left), config.menuItemLogoWidth, config.menuItemLogoWidth)); + pixmapIcon->Fill(clrTransparent); + } + pixmapIcon->DrawImage(cPoint(1, (height - config.iconHeight) / 2), imgLoader.GetImage()); + } + drawn = true; + } + std::string delimiter = del; + delimiter.erase(delimiter.find_last_not_of("-")+1); + int x = config.iconHeight + 3; + int y = (height - font->Height()) / 2; + pixmap->DrawText(cPoint(x, y), delimiter.c_str(), Theme.Color(clrMenuFontMenuItemSep), clrTransparent, font); } void cNopacityMenuItem::Action(void) { - int sleepTime = 10; - for (int i = 0; Running() && (i*sleepTime < config.menuScrollDelay); i++) - cCondWait::SleepMs(sleepTime); - cPixmap::Lock(); - if (Running()) - SetTextFull(); - cPixmap::Unlock(); - int drawPortX; - int FrameTime = config.menuScrollFrameTime; - int maxX = pixmapTextScroller->DrawPort().Width() - pixmapTextScroller->ViewPort().Width(); - while (Running()) { - uint64_t Now = cTimeMs::Now(); - cPixmap::Lock(); - drawPortX = pixmapTextScroller->DrawPort().X(); - drawPortX -= 1; - if (abs(drawPortX) > maxX) { - for (int i = 0; Running() && (i*sleepTime < config.menuScrollDelay); i++) - cCondWait::SleepMs(sleepTime); - drawPortX = 0; - } - if (Running()) - pixmapTextScroller->SetDrawPortPoint(cPoint(drawPortX, 0)); - cPixmap::Unlock(); - int Delta = cTimeMs::Now() - Now; - if (Running()) - osd->Flush(); - if (Running() && (Delta < FrameTime)) - cCondWait::SleepMs(FrameTime - Delta); - } + int sleepTime = 10; + for (int i = 0; Running() && (i*sleepTime < config.menuScrollDelay); i++) + cCondWait::SleepMs(sleepTime); + cPixmap::Lock(); + if (Running()) + SetTextFull(); + cPixmap::Unlock(); + int drawPortX; + int FrameTime = config.menuScrollFrameTime; + int maxX = pixmapTextScroller->DrawPort().Width() - pixmapTextScroller->ViewPort().Width(); + while (Running()) { + uint64_t Now = cTimeMs::Now(); + cPixmap::Lock(); + drawPortX = pixmapTextScroller->DrawPort().X(); + drawPortX -= 1; + if (abs(drawPortX) > maxX) { + for (int i = 0; Running() && (i*sleepTime < config.menuScrollDelay); i++) + cCondWait::SleepMs(sleepTime); + drawPortX = 0; + } + if (Running()) + pixmapTextScroller->SetDrawPortPoint(cPoint(drawPortX, 0)); + cPixmap::Unlock(); + int Delta = cTimeMs::Now() - Now; + if (Running()) + osd->Flush(); + if (Running() && (Delta < FrameTime)) + cCondWait::SleepMs(FrameTime - Delta); + } } // cNopacityMainMenuItem ------------- @@ -141,377 +141,377 @@ cNopacityMainMenuItem::~cNopacityMainMenuItem(void) { std::string cNopacityMainMenuItem::items[6] = {"Schedule", "Channels", "Timers", "Recordings", "Setup", "Commands"}; cString cNopacityMainMenuItem::GetIconName() { - std::string element = *menuEntry; - for (int i=0; i<6; i++) { - std::string s = trVDR(items[i].c_str()); - if (s == element) - return items[i].c_str(); - } - return menuEntry; + std::string element = *menuEntry; + for (int i=0; i<6; i++) { + std::string s = trVDR(items[i].c_str()); + if (s == element) + return items[i].c_str(); + } + return menuEntry; } void cNopacityMainMenuItem::CreatePixmapTextScroller(int totalWidth) { - int drawPortWidth = totalWidth + 10; - if (hasIcon) - drawPortWidth += config.iconHeight + 10; - pixmapTextScroller = osd->CreatePixmap(4, cRect(left, top + index * (height + left), width, height), cRect(0, 0, drawPortWidth, height)); - pixmapTextScroller->Fill(clrTransparent); + int drawPortWidth = totalWidth + 10; + if (hasIcon) + drawPortWidth += config.iconHeight + 10; + pixmapTextScroller = osd->CreatePixmap(4, cRect(left, top + index * (height + left), width, height), cRect(0, 0, drawPortWidth, height)); + pixmapTextScroller->Fill(clrTransparent); } void cNopacityMainMenuItem::CreateText() { - std::string text = skipspace(Text); - bool found = false; - bool doBreak = false; - size_t i = 0; - for (; i < text.length(); i++) { - char s = text.at(i); - if (found) { - if (!(s >= '0' && s <= '9')) { - doBreak = true; - } - } - if (s >= '0' && s <= '9') { - found = true; - } - if (doBreak) - break; - if (i>4) - break; - } - if (found) { - menuNumber = skipspace(text.substr(0,i).c_str()); - menuEntry = skipspace(text.substr(i).c_str()); - } else { - menuNumber = ""; - menuEntry = text.c_str(); - } - strEntry = *menuEntry; + std::string text = skipspace(Text); + bool found = false; + bool doBreak = false; + size_t i = 0; + for (; i < text.length(); i++) { + char s = text.at(i); + if (found) { + if (!(s >= '0' && s <= '9')) { + doBreak = true; + } + } + if (s >= '0' && s <= '9') { + found = true; + } + if (doBreak) + break; + if (i>4) + break; + } + if (found) { + menuNumber = skipspace(text.substr(0,i).c_str()); + menuEntry = skipspace(text.substr(i).c_str()); + } else { + menuNumber = ""; + menuEntry = text.c_str(); + } + strEntry = *menuEntry; } int cNopacityMainMenuItem::CheckScrollable(bool hasIcon) { - int spaceLeft = left; - if (hasIcon) - spaceLeft += config.iconHeight; - int totalTextWidth = width - spaceLeft; - int numberWidth = font->Width("xxx"); - int textWidth = font->Width(*menuEntry); - if ((numberWidth + textWidth) > (width - spaceLeft)) { - scrollable = true; - totalTextWidth = max(numberWidth + textWidth, totalTextWidth); - strEntryFull = strEntry.c_str(); - cTextWrapper twEntry; - std::stringstream sstrEntry; - twEntry.Set(strEntry.c_str(), font, width - spaceLeft - numberWidth); - sstrEntry << twEntry.GetLine(0) << "..."; - strEntry = sstrEntry.str(); - } - return totalTextWidth; + int spaceLeft = left; + if (hasIcon) + spaceLeft += config.iconHeight; + int totalTextWidth = width - spaceLeft; + int numberWidth = font->Width("xxx"); + int textWidth = font->Width(*menuEntry); + if ((numberWidth + textWidth) > (width - spaceLeft)) { + scrollable = true; + totalTextWidth = max(numberWidth + textWidth, totalTextWidth); + strEntryFull = strEntry.c_str(); + cTextWrapper twEntry; + std::stringstream sstrEntry; + twEntry.Set(strEntry.c_str(), font, width - spaceLeft - numberWidth); + sstrEntry << twEntry.GetLine(0) << "..."; + strEntry = sstrEntry.str(); + } + return totalTextWidth; } void cNopacityMainMenuItem::SetTextFull(void) { - tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); - pixmapTextScroller->Fill(clrTransparent); - int x = config.iconHeight; - int numberTotalWidth = font->Width("xxx"); - int numberWidth = font->Width(*menuNumber); - pixmapTextScroller->DrawText(cPoint(x + (numberTotalWidth - numberWidth)/2, (height - font->Height())/2), *menuNumber, clrFont, clrTransparent, font); - x += numberTotalWidth; - pixmapTextScroller->DrawText(cPoint(x, (height - font->Height())/2), strEntryFull.c_str(), clrFont, clrTransparent, font); + tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); + pixmapTextScroller->Fill(clrTransparent); + int x = config.iconHeight; + int numberTotalWidth = font->Width("xxx"); + int numberWidth = font->Width(*menuNumber); + pixmapTextScroller->DrawText(cPoint(x + (numberTotalWidth - numberWidth)/2, (height - font->Height())/2), *menuNumber, clrFont, clrTransparent, font); + x += numberTotalWidth; + pixmapTextScroller->DrawText(cPoint(x, (height - font->Height())/2), strEntryFull.c_str(), clrFont, clrTransparent, font); } void cNopacityMainMenuItem::SetTextShort(void) { - tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); - pixmapTextScroller->Fill(clrTransparent); - int x = config.iconHeight; - int numberTotalWidth = font->Width("xxx"); - int numberWidth = font->Width(*menuNumber); - pixmapTextScroller->DrawText(cPoint(x + (numberTotalWidth - numberWidth)/2, (height - font->Height())/2), *menuNumber, clrFont, clrTransparent, font); - x += numberTotalWidth; - pixmapTextScroller->DrawText(cPoint(x, (height - font->Height())/2), strEntry.c_str(), clrFont, clrTransparent, font); + tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); + pixmapTextScroller->Fill(clrTransparent); + int x = config.iconHeight; + int numberTotalWidth = font->Width("xxx"); + int numberWidth = font->Width(*menuNumber); + pixmapTextScroller->DrawText(cPoint(x + (numberTotalWidth - numberWidth)/2, (height - font->Height())/2), *menuNumber, clrFont, clrTransparent, font); + x += numberTotalWidth; + pixmapTextScroller->DrawText(cPoint(x, (height - font->Height())/2), strEntry.c_str(), clrFont, clrTransparent, font); } void cNopacityMainMenuItem::Render() { - pixmap->Fill(Theme.Color(clrMenuBorder)); - int handleBgrd = (current)?handleBackgrounds[3]:handleBackgrounds[2]; - pixmap->DrawImage(cPoint(1, 1), handleBgrd); - if (selectable) { - cString cIcon = GetIconName(); - if (!drawn) { - cImageLoader imgLoader; - if (imgLoader.LoadIcon(*cIcon, config.iconHeight)) { - pixmapIcon->DrawImage(cPoint(1, 1), imgLoader.GetImage()); - } - drawn = true; - } - SetTextShort(); - if (current && scrollable && !Running() && config.menuScrollSpeed) { - Start(); - } - if (wasCurrent && !current && scrollable && Running()) { - pixmapTextScroller->SetDrawPortPoint(cPoint(0, 0)); - SetTextShort(); - Cancel(-1); - } - } else { - DrawDelimiter(*itemTabs[1], "Channelseparator", handleBgrd); - } + pixmap->Fill(Theme.Color(clrMenuBorder)); + int handleBgrd = (current)?handleBackgrounds[3]:handleBackgrounds[2]; + pixmap->DrawImage(cPoint(1, 1), handleBgrd); + if (selectable) { + cString cIcon = GetIconName(); + if (!drawn) { + cImageLoader imgLoader; + if (imgLoader.LoadIcon(*cIcon, config.iconHeight)) { + pixmapIcon->DrawImage(cPoint(1, 1), imgLoader.GetImage()); + } + drawn = true; + } + SetTextShort(); + if (current && scrollable && !Running() && config.menuScrollSpeed) { + Start(); + } + if (wasCurrent && !current && scrollable && Running()) { + pixmapTextScroller->SetDrawPortPoint(cPoint(0, 0)); + SetTextShort(); + Cancel(-1); + } + } else { + DrawDelimiter(*itemTabs[1], "Channelseparator", handleBgrd); + } } // cNopacityScheduleMenuItem ------------- cNopacityScheduleMenuItem::cNopacityScheduleMenuItem(cOsd *osd, const char *text, bool sel, eMenuSubCategory subCat) : cNopacityMenuItem (osd, text, sel) { - subCategory = subCat; - strDateTime = ""; - strTitle = ""; - strSubTitle = ""; - strTitleFull = ""; - strSubTitleFull = ""; - strProgressbar = ""; - hasProgressBar = false; - hasLogo = false; - delimiterType = "daydelimiter"; + subCategory = subCat; + strDateTime = ""; + strTitle = ""; + strSubTitle = ""; + strTitleFull = ""; + strSubTitleFull = ""; + strProgressbar = ""; + hasProgressBar = false; + hasLogo = false; + delimiterType = "daydelimiter"; } cNopacityScheduleMenuItem::~cNopacityScheduleMenuItem(void) { } void cNopacityScheduleMenuItem::CreatePixmapTextScroller(int totalWidth) { - int drawPortWidth = totalWidth + 10; - if (hasIcon) - drawPortWidth += config.menuItemLogoWidth + 10; - pixmapTextScroller = osd->CreatePixmap(4, cRect(left, top + index * (height + left), width, height), cRect(0, 0, drawPortWidth, height)); - pixmapTextScroller->Fill(clrTransparent); + int drawPortWidth = totalWidth + 10; + if (hasIcon) + drawPortWidth += config.menuItemLogoWidth + 10; + pixmapTextScroller = osd->CreatePixmap(4, cRect(left, top + index * (height + left), width, height), cRect(0, 0, drawPortWidth, height)); + pixmapTextScroller->Fill(clrTransparent); } void cNopacityScheduleMenuItem::SetDisplayMode(void) { - switch (subCategory) { - case mcSubSchedule: - mode = eMenuSchedule; - break; - case mcSubScheduleWhatsOnNow: - mode = eMenuWhatsOnNow; - hasLogo = true; - delimiterType = "Channelseparator"; - break; - case mcSubScheduleWhatsOnNext: - mode = eMenuWhatsOnNext; - hasLogo = true; - delimiterType = "Channelseparator"; - break; - case mcSubScheduleSearchResults: - mode = eMenuSearchResults; - hasLogo = true; - delimiterType = "Channelseparator"; - break; - case mcSubScheduleWhatsOnElse: - mode = eMenuWhatsOnElse; - hasLogo = true; - break; - case mcSubScheduleFavorites: - mode = eMenuFavorites; - hasLogo = true; - break; - case mcSubScheduleTimerconflict: - mode = eMenuTimerconflict; - hasLogo = true; - break; - default: - mode = eMenuSchedule; - break; - } + switch (subCategory) { + case mcSubSchedule: + mode = eMenuSchedule; + break; + case mcSubScheduleWhatsOnNow: + mode = eMenuWhatsOnNow; + hasLogo = true; + delimiterType = "Channelseparator"; + break; + case mcSubScheduleWhatsOnNext: + mode = eMenuWhatsOnNext; + hasLogo = true; + delimiterType = "Channelseparator"; + break; + case mcSubScheduleSearchResults: + mode = eMenuSearchResults; + hasLogo = true; + delimiterType = "Channelseparator"; + break; + case mcSubScheduleWhatsOnElse: + mode = eMenuWhatsOnElse; + hasLogo = true; + break; + case mcSubScheduleFavorites: + mode = eMenuFavorites; + hasLogo = true; + break; + case mcSubScheduleTimerconflict: + mode = eMenuTimerconflict; + hasLogo = true; + break; + default: + mode = eMenuSchedule; + break; + } } void cNopacityScheduleMenuItem::CreateText() { - std::stringstream sstrDateTime; - //Build Date & Time & Status - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtime_d] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtime_d] < MAXITEMTABS)) - sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtime_d]] << " "; - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtime_w] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtime_w] < MAXITEMTABS)) - sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtime_w]] << " "; - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGdate] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGdate] < MAXITEMTABS)) - sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGdate]] << " "; - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGdatesh] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGdatesh] < MAXITEMTABS)) - sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGdatesh]] << " "; - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtime] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtime] < MAXITEMTABS)) - sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtime]] << " "; - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtimespan] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtimespan] < MAXITEMTABS)) - sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtimespan]] << " "; - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGstatus] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGstatus] < MAXITEMTABS)) - sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGstatus]] << " "; - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGt_status] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGt_status] < MAXITEMTABS)) - sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGt_status]] << " "; - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGv_status] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGv_status] < MAXITEMTABS)) - sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGv_status]] << " "; - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGr_status] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGr_status] < MAXITEMTABS)) - sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGr_status]] << " "; - strDateTime = sstrDateTime.str(); - //Build title and subtitle - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtitle] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtitle] < MAXITEMTABS)) { - strTitle = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtitle]]; - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGsubtitle] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGsubtitle] < MAXITEMTABS)) { - strSubTitle = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGsubtitle]]; - } else { - size_t delimiter = strTitle.find("~"); - if (delimiter != std::string::npos) { - strSubTitle = strTitle.substr(delimiter+2); - strTitle = strTitle.substr(0, delimiter); - } else { - strSubTitle = ""; - } - } - } - //Build Channel Name - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGchlng] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGchlng] < MAXITEMTABS)) - strChannelName = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGchlng]]; - else if ((config.epgSearchConf->epgSearchConfig[mode][eEPGchsh] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGchsh] < MAXITEMTABS)) - strChannelName = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGchsh]]; - else - strChannelName = " "; - //Build Progressbar - if ((config.epgSearchConf->epgSearchConfig[mode][eEPGprogrT2S] > -1) - &&(config.epgSearchConf->epgSearchConfig[mode][eEPGprogrT2S] < MAXITEMTABS)) { - strProgressbar = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGprogrT2S]]; - hasProgressBar = true; - } + std::stringstream sstrDateTime; + //Build Date & Time & Status + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtime_d] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtime_d] < MAXITEMTABS)) + sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtime_d]] << " "; + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtime_w] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtime_w] < MAXITEMTABS)) + sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtime_w]] << " "; + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGdate] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGdate] < MAXITEMTABS)) + sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGdate]] << " "; + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGdatesh] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGdatesh] < MAXITEMTABS)) + sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGdatesh]] << " "; + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtime] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtime] < MAXITEMTABS)) + sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtime]] << " "; + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtimespan] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtimespan] < MAXITEMTABS)) + sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtimespan]] << " "; + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGstatus] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGstatus] < MAXITEMTABS)) + sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGstatus]] << " "; + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGt_status] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGt_status] < MAXITEMTABS)) + sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGt_status]] << " "; + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGv_status] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGv_status] < MAXITEMTABS)) + sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGv_status]] << " "; + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGr_status] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGr_status] < MAXITEMTABS)) + sstrDateTime << *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGr_status]] << " "; + strDateTime = sstrDateTime.str(); + //Build title and subtitle + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGtitle] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGtitle] < MAXITEMTABS)) { + strTitle = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGtitle]]; + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGsubtitle] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGsubtitle] < MAXITEMTABS)) { + strSubTitle = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGsubtitle]]; + } else { + size_t delimiter = strTitle.find("~"); + if (delimiter != std::string::npos) { + strSubTitle = strTitle.substr(delimiter+2); + strTitle = strTitle.substr(0, delimiter); + } else { + strSubTitle = ""; + } + } + } + //Build Channel Name + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGchlng] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGchlng] < MAXITEMTABS)) + strChannelName = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGchlng]]; + else if ((config.epgSearchConf->epgSearchConfig[mode][eEPGchsh] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGchsh] < MAXITEMTABS)) + strChannelName = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGchsh]]; + else + strChannelName = " "; + //Build Progressbar + if ((config.epgSearchConf->epgSearchConfig[mode][eEPGprogrT2S] > -1) + &&(config.epgSearchConf->epgSearchConfig[mode][eEPGprogrT2S] < MAXITEMTABS)) { + strProgressbar = *itemTabs[config.epgSearchConf->epgSearchConfig[mode][eEPGprogrT2S]]; + hasProgressBar = true; + } } int cNopacityScheduleMenuItem::CheckScrollable(bool hasIcon) { - int spaceLeft = left; - if (hasIcon) - spaceLeft += config.menuItemLogoWidth; - int totalTextWidth = width - spaceLeft; - if (font->Width(strTitle.c_str()) > (width - spaceLeft)) { - scrollable = true; - totalTextWidth = max(font->Width(strTitle.c_str()), totalTextWidth); - strTitleFull = strTitle.c_str(); - strSubTitleFull = strSubTitle.c_str(); - cTextWrapper twTitle; - std::stringstream sstrTitle; - twTitle.Set(strTitle.c_str(), font, width - spaceLeft); - sstrTitle << twTitle.GetLine(0) << "..."; - strTitle = sstrTitle.str(); - } - if (fontSmall->Width(strSubTitle.c_str()) > (width - spaceLeft)) { - if (!scrollable) { - scrollable = true; - strTitleFull = strTitle.c_str(); - strSubTitleFull = strSubTitle.c_str(); - } - totalTextWidth = max(fontSmall->Width(strSubTitle.c_str()), totalTextWidth); - cTextWrapper twSubtitle; - std::stringstream sstrSubtitle; - twSubtitle.Set(strSubTitle.c_str(), fontSmall, width - spaceLeft); - sstrSubtitle << twSubtitle.GetLine(0) << "..."; - strSubTitle = sstrSubtitle.str(); - } - return totalTextWidth; + int spaceLeft = left; + if (hasIcon) + spaceLeft += config.menuItemLogoWidth; + int totalTextWidth = width - spaceLeft; + if (font->Width(strTitle.c_str()) > (width - spaceLeft)) { + scrollable = true; + totalTextWidth = max(font->Width(strTitle.c_str()), totalTextWidth); + strTitleFull = strTitle.c_str(); + strSubTitleFull = strSubTitle.c_str(); + cTextWrapper twTitle; + std::stringstream sstrTitle; + twTitle.Set(strTitle.c_str(), font, width - spaceLeft); + sstrTitle << twTitle.GetLine(0) << "..."; + strTitle = sstrTitle.str(); + } + if (fontSmall->Width(strSubTitle.c_str()) > (width - spaceLeft)) { + if (!scrollable) { + scrollable = true; + strTitleFull = strTitle.c_str(); + strSubTitleFull = strSubTitle.c_str(); + } + totalTextWidth = max(fontSmall->Width(strSubTitle.c_str()), totalTextWidth); + cTextWrapper twSubtitle; + std::stringstream sstrSubtitle; + twSubtitle.Set(strSubTitle.c_str(), fontSmall, width - spaceLeft); + sstrSubtitle << twSubtitle.GetLine(0) << "..."; + strSubTitle = sstrSubtitle.str(); + } + return totalTextWidth; } void cNopacityScheduleMenuItem::SetTextFull(void) { - pixmapTextScroller->Fill(clrTransparent); - pixmapTextScroller->DrawText(cPoint(textLeft, 3), strDateTime.c_str(), Theme.Color(clrMenuFontMenuItem), clrTransparent, font); - pixmapTextScroller->DrawText(cPoint(textLeft, titleY), strTitleFull.c_str(), Theme.Color(clrMenuFontMenuItemTitle), clrTransparent, font); - pixmapTextScroller->DrawText(cPoint(textLeft, titleY + font->Height() - 2), strSubTitleFull.c_str(), Theme.Color(clrMenuFontMenuItem), clrTransparent, fontSmall); + pixmapTextScroller->Fill(clrTransparent); + pixmapTextScroller->DrawText(cPoint(textLeft, 3), strDateTime.c_str(), Theme.Color(clrMenuFontMenuItem), clrTransparent, font); + pixmapTextScroller->DrawText(cPoint(textLeft, titleY), strTitleFull.c_str(), Theme.Color(clrMenuFontMenuItemTitle), clrTransparent, font); + pixmapTextScroller->DrawText(cPoint(textLeft, titleY + font->Height() - 2), strSubTitleFull.c_str(), Theme.Color(clrMenuFontMenuItem), clrTransparent, fontSmall); } void cNopacityScheduleMenuItem::SetTextShort(void) { - pixmapTextScroller->Fill(clrTransparent); - pixmapTextScroller->DrawText(cPoint(textLeft, 3), strDateTime.c_str(), Theme.Color(clrMenuFontMenuItem), clrTransparent, font); - pixmapTextScroller->DrawText(cPoint(textLeft, titleY), strTitle.c_str(), Theme.Color(clrMenuFontMenuItemTitle), clrTransparent, font); - pixmapTextScroller->DrawText(cPoint(textLeft, titleY + font->Height() - 2), strSubTitle.c_str(), Theme.Color(clrMenuFontMenuItem), clrTransparent, fontSmall); + pixmapTextScroller->Fill(clrTransparent); + pixmapTextScroller->DrawText(cPoint(textLeft, 3), strDateTime.c_str(), Theme.Color(clrMenuFontMenuItem), clrTransparent, font); + pixmapTextScroller->DrawText(cPoint(textLeft, titleY), strTitle.c_str(), Theme.Color(clrMenuFontMenuItemTitle), clrTransparent, font); + pixmapTextScroller->DrawText(cPoint(textLeft, titleY + font->Height() - 2), strSubTitle.c_str(), Theme.Color(clrMenuFontMenuItem), clrTransparent, fontSmall); } void cNopacityScheduleMenuItem::Render() { - int logoWidth = config.menuItemLogoWidth; - int logoHeight = config.menuItemLogoHeight; - textLeft = 5; - int handleBgrd = (current)?handleBackgrounds[5]:handleBackgrounds[4]; - - pixmap->Fill(Theme.Color(clrMenuBorder)); - pixmap->DrawImage(cPoint(1, 1), handleBgrd); - - if (hasLogo) - textLeft = logoWidth + 10; - - if (selectable) { - titleY = (height - font->Height())/2 - 2; - //draw ProgressBar - if (hasProgressBar) { - DrawRemaining(strProgressbar.c_str(), textLeft, height*7/8, width - textLeft - 10); - } - //draw new? - if (!drawn) { - //draw Icon - if (hasIcon) { - cImageLoader imgLoader; - if (imgLoader.LoadLogo(strChannelName.c_str(), logoWidth, logoHeight)) { - pixmapIcon->DrawImage(cPoint(1, 1), imgLoader.GetImage()); - } else { - cTextWrapper channel; - channel.Set(strChannelName.c_str(), font, logoWidth); - int lines = channel.Lines(); - int lineHeight = height / 3; - int heightChannel = lines * lineHeight; - int y = (heightChannel>height)?0:(height-heightChannel)/2; - for (int line = 0; line < lines; line++) { - pixmapIcon->DrawText(cPoint((logoWidth - font->Width(channel.GetLine(line)))/2, y+lineHeight*line), channel.GetLine(line), Theme.Color(clrMenuFontMenuItemHigh), clrTransparent, font); - } - } - } - SetTextShort(); - drawn = true; - } - if (current && scrollable && !Running() && config.menuScrollSpeed) { - Start(); - } - if (wasCurrent && !current && scrollable && Running()) { - pixmapTextScroller->SetDrawPortPoint(cPoint(0, 0)); - SetTextShort(); - Cancel(-1); - } - } else { - DrawDelimiter(*itemTabs[1], delimiterType.c_str(), handleBgrd); - } - + int logoWidth = config.menuItemLogoWidth; + int logoHeight = config.menuItemLogoHeight; + textLeft = 5; + int handleBgrd = (current)?handleBackgrounds[5]:handleBackgrounds[4]; + + pixmap->Fill(Theme.Color(clrMenuBorder)); + pixmap->DrawImage(cPoint(1, 1), handleBgrd); + + if (hasLogo) + textLeft = logoWidth + 10; + + if (selectable) { + titleY = (height - font->Height())/2 - 2; + //draw ProgressBar + if (hasProgressBar) { + DrawRemaining(strProgressbar.c_str(), textLeft, height*7/8, width - textLeft - 10); + } + //draw new? + if (!drawn) { + //draw Icon + if (hasIcon) { + cImageLoader imgLoader; + if (imgLoader.LoadLogo(strChannelName.c_str(), logoWidth, logoHeight)) { + pixmapIcon->DrawImage(cPoint(1, 1), imgLoader.GetImage()); + } else { + cTextWrapper channel; + channel.Set(strChannelName.c_str(), font, logoWidth); + int lines = channel.Lines(); + int lineHeight = height / 3; + int heightChannel = lines * lineHeight; + int y = (heightChannel>height)?0:(height-heightChannel)/2; + for (int line = 0; line < lines; line++) { + pixmapIcon->DrawText(cPoint((logoWidth - font->Width(channel.GetLine(line)))/2, y+lineHeight*line), channel.GetLine(line), Theme.Color(clrMenuFontMenuItemHigh), clrTransparent, font); + } + } + } + SetTextShort(); + drawn = true; + } + if (current && scrollable && !Running() && config.menuScrollSpeed) { + Start(); + } + if (wasCurrent && !current && scrollable && Running()) { + pixmapTextScroller->SetDrawPortPoint(cPoint(0, 0)); + SetTextShort(); + Cancel(-1); + } + } else { + DrawDelimiter(*itemTabs[1], delimiterType.c_str(), handleBgrd); + } + } void cNopacityScheduleMenuItem::DrawRemaining(cString remaining, int x, int y, int width) { - int seen = 0; - int total = 8; - if (*remaining) { - const char *p = *remaining; - p++; - while (*p) { - if (*p == '|') { - seen++; - p++; - } else - break; + int seen = 0; + int total = 8; + if (*remaining) { + const char *p = *remaining; + p++; + while (*p) { + if (*p == '|') { + seen++; + p++; + } else + break; } - } - double percentSeen = (double)seen/total; - pixmap->DrawEllipse(cRect(x, y, 7, 7), Theme.Color(clrProgressBarBack)); - pixmap->DrawEllipse(cRect(x+width, y, 7, 7), Theme.Color(clrProgressBarBack)); - pixmap->DrawRectangle(cRect(x+4, y, width-1, 7), Theme.Color(clrProgressBarBack)); - pixmap->DrawEllipse(cRect(x+1, y+1, 5, 5), Theme.Color(clrProgressBar)); - if (percentSeen > 0.0) - pixmap->DrawEllipse(cRect(x+(width*percentSeen), y+1, 5, 5), Theme.Color(clrProgressBar)); - pixmap->DrawRectangle(cRect(x+4, y+1, (width-1)*percentSeen, 5), Theme.Color(clrProgressBar)); + } + double percentSeen = (double)seen/total; + pixmap->DrawEllipse(cRect(x, y, 7, 7), Theme.Color(clrProgressBarBack)); + pixmap->DrawEllipse(cRect(x+width, y, 7, 7), Theme.Color(clrProgressBarBack)); + pixmap->DrawRectangle(cRect(x+4, y, width-1, 7), Theme.Color(clrProgressBarBack)); + pixmap->DrawEllipse(cRect(x+1, y+1, 5, 5), Theme.Color(clrProgressBar)); + if (percentSeen > 0.0) + pixmap->DrawEllipse(cRect(x+(width*percentSeen), y+1, 5, 5), Theme.Color(clrProgressBar)); + pixmap->DrawRectangle(cRect(x+4, y+1, (width-1)*percentSeen, 5), Theme.Color(clrProgressBar)); } // cNopacityChannelMenuItem ------------- @@ -523,171 +523,171 @@ cNopacityChannelMenuItem::~cNopacityChannelMenuItem(void) { } void cNopacityChannelMenuItem::CreatePixmapTextScroller(int totalWidth) { - int drawPortWidth = totalWidth + 10; - if (hasIcon) - drawPortWidth += config.menuItemLogoWidth + 10; - pixmapTextScroller = osd->CreatePixmap(4, cRect(left, top + index * (height + left), width, height), cRect(0, 0, drawPortWidth, height)); - pixmapTextScroller->Fill(clrTransparent); + int drawPortWidth = totalWidth + 10; + if (hasIcon) + drawPortWidth += config.menuItemLogoWidth + 10; + pixmapTextScroller = osd->CreatePixmap(4, cRect(left, top + index * (height + left), width, height), cRect(0, 0, drawPortWidth, height)); + pixmapTextScroller->Fill(clrTransparent); } void cNopacityChannelMenuItem::CreateText() { - std::string strChannelNumber = *itemTabs[0]; - std::string strChannelName = *itemTabs[1]; - std::string name = strChannelName.c_str(); - if ((name.length() > 0) && !isalnum(name.at(0))) { - if (name.length() > 3) - name = name.substr(4); - } - name.erase(name.find_last_not_of(" ")+1); - std::stringstream sstrEntry; - sstrEntry << strChannelNumber << " " << name; - strEntry = sstrEntry.str(); - strLogo = name.c_str(); + std::string strChannelNumber = *itemTabs[0]; + std::string strChannelName = *itemTabs[1]; + std::string name = strChannelName.c_str(); + if ((name.length() > 0) && !isalnum(name.at(0))) { + if (name.length() > 3) + name = name.substr(4); + } + name.erase(name.find_last_not_of(" ")+1); + std::stringstream sstrEntry; + sstrEntry << strChannelNumber << " " << name; + strEntry = sstrEntry.str(); + strLogo = name.c_str(); } int cNopacityChannelMenuItem::CheckScrollable(bool hasIcon) { - int spaceLeft = left; - if (hasIcon) - spaceLeft += config.menuItemLogoWidth; - int totalTextWidth = width - spaceLeft; - if (font->Width(strEntry.c_str()) > (width - spaceLeft)) { - scrollable = true; - totalTextWidth = max(font->Width(strEntry.c_str()), totalTextWidth); - strEntryFull = strEntry.c_str(); - cTextWrapper twEntry; - std::stringstream sstrEntry; - twEntry.Set(strEntry.c_str(), font, width - spaceLeft); - sstrEntry << twEntry.GetLine(0) << "..."; - strEntry = sstrEntry.str(); - } - return totalTextWidth; + int spaceLeft = left; + if (hasIcon) + spaceLeft += config.menuItemLogoWidth; + int totalTextWidth = width - spaceLeft; + if (font->Width(strEntry.c_str()) > (width - spaceLeft)) { + scrollable = true; + totalTextWidth = max(font->Width(strEntry.c_str()), totalTextWidth); + strEntryFull = strEntry.c_str(); + cTextWrapper twEntry; + std::stringstream sstrEntry; + twEntry.Set(strEntry.c_str(), font, width - spaceLeft); + sstrEntry << twEntry.GetLine(0) << "..."; + strEntry = sstrEntry.str(); + } + return totalTextWidth; } void cNopacityChannelMenuItem::SetTextFull(void) { - tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); - pixmapTextScroller->Fill(clrTransparent); - pixmapTextScroller->DrawText(cPoint(config.menuItemLogoWidth + 10, (height - font->Height())/2), strEntryFull.c_str(), clrFont, clrTransparent, font); + tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); + pixmapTextScroller->Fill(clrTransparent); + pixmapTextScroller->DrawText(cPoint(config.menuItemLogoWidth + 10, (height - font->Height())/2), strEntryFull.c_str(), clrFont, clrTransparent, font); } void cNopacityChannelMenuItem::SetTextShort(void) { - tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); - pixmapTextScroller->Fill(clrTransparent); - pixmapTextScroller->DrawText(cPoint(config.menuItemLogoWidth + 10, (height - font->Height())/2), strEntry.c_str(), clrFont, clrTransparent, font); + tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); + pixmapTextScroller->Fill(clrTransparent); + pixmapTextScroller->DrawText(cPoint(config.menuItemLogoWidth + 10, (height - font->Height())/2), strEntry.c_str(), clrFont, clrTransparent, font); } void cNopacityChannelMenuItem::Render() { - - int handleBgrd = (current)?handleBackgrounds[5]:handleBackgrounds[4]; - - if (selectable) { //Channels - pixmap->Fill(Theme.Color(clrMenuBorder)); - int logoWidth = config.menuItemLogoWidth; - int logoHeight = config.menuItemLogoHeight; - pixmap->DrawImage(cPoint(1, 1), handleBgrd); - if (!drawn) { - cImageLoader imgLoader; - if (imgLoader.LoadLogo(strLogo.c_str(), logoWidth, logoHeight)) { - pixmapIcon->DrawImage(cPoint(1, 1), imgLoader.GetImage()); - } - drawn = true; - } - SetTextShort(); - if (current && scrollable && !Running() && config.menuScrollSpeed) { - Start(); - } - if (wasCurrent && !current && scrollable && Running()) { - pixmapTextScroller->SetDrawPortPoint(cPoint(0, 0)); - SetTextShort(); - Cancel(-1); - } - } else { //Channelseparators - DrawDelimiter(*itemTabs[1], "Channelseparator", handleBgrd); - } + + int handleBgrd = (current)?handleBackgrounds[5]:handleBackgrounds[4]; + + if (selectable) { //Channels + pixmap->Fill(Theme.Color(clrMenuBorder)); + int logoWidth = config.menuItemLogoWidth; + int logoHeight = config.menuItemLogoHeight; + pixmap->DrawImage(cPoint(1, 1), handleBgrd); + if (!drawn) { + cImageLoader imgLoader; + if (imgLoader.LoadLogo(strLogo.c_str(), logoWidth, logoHeight)) { + pixmapIcon->DrawImage(cPoint(1, 1), imgLoader.GetImage()); + } + drawn = true; + } + SetTextShort(); + if (current && scrollable && !Running() && config.menuScrollSpeed) { + Start(); + } + if (wasCurrent && !current && scrollable && Running()) { + pixmapTextScroller->SetDrawPortPoint(cPoint(0, 0)); + SetTextShort(); + Cancel(-1); + } + } else { //Channelseparators + DrawDelimiter(*itemTabs[1], "Channelseparator", handleBgrd); + } } // cNopacityDefaultMenuItem ------------- cNopacityDefaultMenuItem::cNopacityDefaultMenuItem(cOsd *osd, const char *text, bool sel) : cNopacityMenuItem (osd, text, sel) { - scrollCol = -1; + scrollCol = -1; } cNopacityDefaultMenuItem::~cNopacityDefaultMenuItem(void) { } void cNopacityDefaultMenuItem::SetTextFull(void) { - tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); - pixmapTextScroller->Fill(clrTransparent); - pixmapTextScroller->DrawText(cPoint(0, (height - font->Height()) / 2), strEntryFull.c_str(), clrFont, clrTransparent, font); + tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); + pixmapTextScroller->Fill(clrTransparent); + pixmapTextScroller->DrawText(cPoint(0, (height - font->Height()) / 2), strEntryFull.c_str(), clrFont, clrTransparent, font); } void cNopacityDefaultMenuItem::SetTextShort(void) { - tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); - pixmapTextScroller->Fill(clrTransparent); - pixmapTextScroller->DrawText(cPoint(0, (height - font->Height()) / 2), strEntry.c_str(), clrFont, clrTransparent, font); + tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); + pixmapTextScroller->Fill(clrTransparent); + pixmapTextScroller->DrawText(cPoint(0, (height - font->Height()) / 2), strEntry.c_str(), clrFont, clrTransparent, font); } int cNopacityDefaultMenuItem::CheckScrollable(bool hasIcon) { - int colWidth = 0; - int colTextWidth = 0; - for (int i=0; i<numTabs; i++) { - if (tabWidth[i] > 0) { - colWidth = tabWidth[i+cSkinDisplayMenu::MaxTabs]; - colTextWidth = font->Width(*itemTabs[i]); - if (colTextWidth > colWidth) { - scrollable = true; - scrollCol = i; - strEntryFull = *itemTabs[i]; - cTextWrapper itemTextWrapped; - itemTextWrapped.Set(*itemTabs[i], font, colWidth - font->Width("... ")); - strEntry = cString::sprintf("%s... ", itemTextWrapped.GetLine(0)); - break; - } - } else - break; - } - if (scrollable) { - pixmapTextScroller = osd->CreatePixmap(4, cRect(left + tabWidth[scrollCol], top + index * (height + left), tabWidth[scrollCol+numTabs], height), cRect(0, 0, colTextWidth+10, height)); - pixmapTextScroller->Fill(clrTransparent); - } - return 0; + int colWidth = 0; + int colTextWidth = 0; + for (int i=0; i<numTabs; i++) { + if (tabWidth[i] > 0) { + colWidth = tabWidth[i+cSkinDisplayMenu::MaxTabs]; + colTextWidth = font->Width(*itemTabs[i]); + if (colTextWidth > colWidth) { + scrollable = true; + scrollCol = i; + strEntryFull = *itemTabs[i]; + cTextWrapper itemTextWrapped; + itemTextWrapped.Set(*itemTabs[i], font, colWidth - font->Width("... ")); + strEntry = cString::sprintf("%s... ", itemTextWrapped.GetLine(0)); + break; + } + } else + break; + } + if (scrollable) { + pixmapTextScroller = osd->CreatePixmap(4, cRect(left + tabWidth[scrollCol], top + index * (height + left), tabWidth[scrollCol+numTabs], height), cRect(0, 0, colTextWidth+10, height)); + pixmapTextScroller->Fill(clrTransparent); + } + return 0; } void cNopacityDefaultMenuItem::Render() { - pixmap->Fill(Theme.Color(clrMenuBorder)); - int handleBgrd = (current)?handleBackgrounds[1]:handleBackgrounds[0]; - tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); - pixmap->DrawImage(cPoint(1, 1), handleBgrd); - int colWidth = 0; - int colTextWidth = 0; - cString itemText(""); - for (int i=0; i<numTabs; i++) { - if (tabWidth[i] > 0) { - if (i != scrollCol) { - colWidth = tabWidth[i+cSkinDisplayMenu::MaxTabs]; - colTextWidth = font->Width(*itemTabs[i]); - if (colTextWidth > colWidth) { - cTextWrapper itemTextWrapped; - itemTextWrapped.Set(*itemTabs[i], font, colWidth - font->Width("... ")); - itemText = cString::sprintf("%s... ", itemTextWrapped.GetLine(0)); - } else { - itemText = itemTabs[i]; - } - pixmap->DrawText(cPoint(tabWidth[i], (height - font->Height()) / 2), *itemText, clrFont, clrTransparent, font); - } else { - if (!Running()) - SetTextShort(); - } - } else - break; - } - if (current && scrollable && !Running() && config.menuScrollSpeed) { - Start(); - } - if (wasCurrent && !current && scrollable && Running()) { - pixmapTextScroller->SetDrawPortPoint(cPoint(0, 0)); - SetTextShort(); - Cancel(-1); - } + pixmap->Fill(Theme.Color(clrMenuBorder)); + int handleBgrd = (current)?handleBackgrounds[1]:handleBackgrounds[0]; + tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); + pixmap->DrawImage(cPoint(1, 1), handleBgrd); + int colWidth = 0; + int colTextWidth = 0; + cString itemText(""); + for (int i=0; i<numTabs; i++) { + if (tabWidth[i] > 0) { + if (i != scrollCol) { + colWidth = tabWidth[i+cSkinDisplayMenu::MaxTabs]; + colTextWidth = font->Width(*itemTabs[i]); + if (colTextWidth > colWidth) { + cTextWrapper itemTextWrapped; + itemTextWrapped.Set(*itemTabs[i], font, colWidth - font->Width("... ")); + itemText = cString::sprintf("%s... ", itemTextWrapped.GetLine(0)); + } else { + itemText = itemTabs[i]; + } + pixmap->DrawText(cPoint(tabWidth[i], (height - font->Height()) / 2), *itemText, clrFont, clrTransparent, font); + } else { + if (!Running()) + SetTextShort(); + } + } else + break; + } + if (current && scrollable && !Running() && config.menuScrollSpeed) { + Start(); + } + if (wasCurrent && !current && scrollable && Running()) { + pixmapTextScroller->SetDrawPortPoint(cPoint(0, 0)); + SetTextShort(); + Cancel(-1); + } } // cNopacityTrackMenuItem ------------- @@ -699,8 +699,8 @@ cNopacityTrackMenuItem::~cNopacityTrackMenuItem(void) { } void cNopacityTrackMenuItem::Render() { - pixmap->Fill(Theme.Color(clrMenuBorder)); - int handleBgrd = (current)?handleBackgrounds[1]:handleBackgrounds[0]; - pixmap->DrawImage(cPoint(1, 1), handleBgrd); - pixmap->DrawText(cPoint(5, (height - font->Height())/2), Text, Theme.Color(clrTracksFontButtons), clrTransparent, font); + pixmap->Fill(Theme.Color(clrMenuBorder)); + int handleBgrd = (current)?handleBackgrounds[1]:handleBackgrounds[0]; + pixmap->DrawImage(cPoint(1, 1), handleBgrd); + pixmap->DrawText(cPoint(5, (height - font->Height())/2), Text, Theme.Color(clrTracksFontButtons), clrTransparent, font); } @@ -3,147 +3,147 @@ class cNopacityMenuItem : public cListObject, public cThread { protected: - cOsd *osd; - cPixmap *pixmap; - cPixmap *pixmapIcon; - cPixmap *pixmapTextScroller; - bool hasIcon; - int *handleBackgrounds; - const char *Text; - bool selectable; - bool current; - bool wasCurrent; - bool scrollable; - bool drawn; - cFont *font; - cFont *fontSmall; - int width, height; - int top, left; - int textLeft; - int index; - cString *itemTabs; - int *tabWidth; - int numTabs; - void DrawDelimiter(const char *del, const char *icon, int handleBgrd); - virtual void Action(void); - virtual void SetTextFull(void) {}; - virtual void SetTextShort(void) {}; + cOsd *osd; + cPixmap *pixmap; + cPixmap *pixmapIcon; + cPixmap *pixmapTextScroller; + bool hasIcon; + int *handleBackgrounds; + const char *Text; + bool selectable; + bool current; + bool wasCurrent; + bool scrollable; + bool drawn; + cFont *font; + cFont *fontSmall; + int width, height; + int top, left; + int textLeft; + int index; + cString *itemTabs; + int *tabWidth; + int numTabs; + void DrawDelimiter(const char *del, const char *icon, int handleBgrd); + virtual void Action(void); + virtual void SetTextFull(void) {}; + virtual void SetTextShort(void) {}; public: - cNopacityMenuItem(cOsd *osd, const char *text, bool sel); - virtual ~cNopacityMenuItem(void); - void CreatePixmap(); - void CreatePixmapIcon(int iconWidth, int iconHeight); - virtual void CreatePixmapTextScroller(int totalWidth); - void SetGeometry(int index, int top, int left, int width, int height); - void SetFont(cFont *font) {this->font = font;} - void SetFontSmall(cFont *fontSmall) {this->fontSmall = fontSmall;} - void SetCurrent(bool cur); - void SetAlpha(int alpha) {this->pixmap->SetAlpha(alpha);} - void SetAlphaIcon(int alpha) {if (hasIcon) this->pixmapIcon->SetAlpha(alpha);} - void SetAlphaText(int alpha) {if (pixmapTextScroller) this->pixmapTextScroller->SetAlpha(alpha);} - void SetTabs(cString *tabs, int *tabWidths, int numtabs); - void SetBackgrounds(int *handleBackgrounds); - virtual void CreateText(void) {}; - virtual void SetDisplayMode(void) {}; - virtual int CheckScrollable(bool hasIcon) {return 0;}; - virtual void Render() = 0; + cNopacityMenuItem(cOsd *osd, const char *text, bool sel); + virtual ~cNopacityMenuItem(void); + void CreatePixmap(); + void CreatePixmapIcon(int iconWidth, int iconHeight); + virtual void CreatePixmapTextScroller(int totalWidth); + void SetGeometry(int index, int top, int left, int width, int height); + void SetFont(cFont *font) {this->font = font;} + void SetFontSmall(cFont *fontSmall) {this->fontSmall = fontSmall;} + void SetCurrent(bool cur); + void SetAlpha(int alpha) {this->pixmap->SetAlpha(alpha);} + void SetAlphaIcon(int alpha) {if (hasIcon) this->pixmapIcon->SetAlpha(alpha);} + void SetAlphaText(int alpha) {if (pixmapTextScroller) this->pixmapTextScroller->SetAlpha(alpha);} + void SetTabs(cString *tabs, int *tabWidths, int numtabs); + void SetBackgrounds(int *handleBackgrounds); + virtual void CreateText(void) {}; + virtual void SetDisplayMode(void) {}; + virtual int CheckScrollable(bool hasIcon) {return 0;}; + virtual void Render() = 0; }; class cNopacityMainMenuItem : public cNopacityMenuItem { private: - cString menuNumber; - cString menuEntry; - std::string strEntry; - std::string strEntryFull; - static std::string items[6]; - cString GetIconName(); - void SetTextFull(void); - void SetTextShort(void); + cString menuNumber; + cString menuEntry; + std::string strEntry; + std::string strEntryFull; + static std::string items[6]; + cString GetIconName(); + void SetTextFull(void); + void SetTextShort(void); public: - cNopacityMainMenuItem(cOsd *osd, const char *text, bool sel); - ~cNopacityMainMenuItem(void); - void CreatePixmapTextScroller(int totalWidth); - void CreateText(void); - int CheckScrollable(bool hasIcon); - void Render(); + cNopacityMainMenuItem(cOsd *osd, const char *text, bool sel); + ~cNopacityMainMenuItem(void); + void CreatePixmapTextScroller(int totalWidth); + void CreateText(void); + int CheckScrollable(bool hasIcon); + void Render(); }; enum eMenuSubCategory { mcSubUndefined = -1, - mcSubSchedule = 0, - mcSubScheduleWhatsOn, - mcSubScheduleWhatsOnNow, - mcSubScheduleWhatsOnNext, - mcSubScheduleWhatsOnElse, - mcSubScheduleSearchResults, - mcSubScheduleFavorites, - mcSubScheduleTimerconflict, - mcSubScheduleTimer, - mcSubChannels, - mcSubChannelEdit}; + mcSubSchedule = 0, + mcSubScheduleWhatsOn, + mcSubScheduleWhatsOnNow, + mcSubScheduleWhatsOnNext, + mcSubScheduleWhatsOnElse, + mcSubScheduleSearchResults, + mcSubScheduleFavorites, + mcSubScheduleTimerconflict, + mcSubScheduleTimer, + mcSubChannels, + mcSubChannelEdit}; class cNopacityScheduleMenuItem : public cNopacityMenuItem { private: - eMenuSubCategory subCategory; - std::string strDateTime; - std::string strTitle; - std::string strSubTitle; - std::string strTitleFull; - std::string strSubTitleFull; - std::string strChannelName; - std::string strProgressbar; - bool hasProgressBar; - eEPGModes mode; - bool hasLogo; - int titleY; - std::string delimiterType; - void DrawRemaining(cString remaining, int x, int y, int width); - void SetTextFull(void); - void SetTextShort(void); + eMenuSubCategory subCategory; + std::string strDateTime; + std::string strTitle; + std::string strSubTitle; + std::string strTitleFull; + std::string strSubTitleFull; + std::string strChannelName; + std::string strProgressbar; + bool hasProgressBar; + eEPGModes mode; + bool hasLogo; + int titleY; + std::string delimiterType; + void DrawRemaining(cString remaining, int x, int y, int width); + void SetTextFull(void); + void SetTextShort(void); public: - cNopacityScheduleMenuItem(cOsd *osd, const char *text, bool sel, eMenuSubCategory subCat); - ~cNopacityScheduleMenuItem(void); - void CreatePixmapTextScroller(int totalWidth); - void SetDisplayMode(void); - void CreateText(void); - int CheckScrollable(bool hasIcon); - void Render(); + cNopacityScheduleMenuItem(cOsd *osd, const char *text, bool sel, eMenuSubCategory subCat); + ~cNopacityScheduleMenuItem(void); + void CreatePixmapTextScroller(int totalWidth); + void SetDisplayMode(void); + void CreateText(void); + int CheckScrollable(bool hasIcon); + void Render(); }; class cNopacityChannelMenuItem : public cNopacityMenuItem { private: - std::string strLogo; - std::string strEntry; - std::string strEntryFull; - void SetTextFull(void); - void SetTextShort(void); + std::string strLogo; + std::string strEntry; + std::string strEntryFull; + void SetTextFull(void); + void SetTextShort(void); public: - cNopacityChannelMenuItem(cOsd *osd, const char *text, bool sel); - ~cNopacityChannelMenuItem(void); - void CreatePixmapTextScroller(int totalWidth); - void CreateText(void); - int CheckScrollable(bool hasIcon); - void Render(); + cNopacityChannelMenuItem(cOsd *osd, const char *text, bool sel); + ~cNopacityChannelMenuItem(void); + void CreatePixmapTextScroller(int totalWidth); + void CreateText(void); + int CheckScrollable(bool hasIcon); + void Render(); }; class cNopacityDefaultMenuItem : public cNopacityMenuItem { private: - std::string strEntry; - std::string strEntryFull; - int scrollCol; - void SetTextFull(void); - void SetTextShort(void); + std::string strEntry; + std::string strEntryFull; + int scrollCol; + void SetTextFull(void); + void SetTextShort(void); public: - cNopacityDefaultMenuItem(cOsd *osd, const char *text, bool sel); - ~cNopacityDefaultMenuItem(void); - int CheckScrollable(bool hasIcon); - void Render(); + cNopacityDefaultMenuItem(cOsd *osd, const char *text, bool sel); + ~cNopacityDefaultMenuItem(void); + int CheckScrollable(bool hasIcon); + void Render(); }; class cNopacityTrackMenuItem : public cNopacityMenuItem { private: public: - cNopacityTrackMenuItem(cOsd *osd, const char *text); - ~cNopacityTrackMenuItem(void); - void Render(); + cNopacityTrackMenuItem(cOsd *osd, const char *text); + ~cNopacityTrackMenuItem(void); + void Render(); }; #endif //__NOPACITY_MENUITEM_H @@ -4,66 +4,66 @@ static cTheme Theme; //COMMON -#define CLR_TRANSBLACK 0xDD000000 -#define CLR_TRANSBLACK2 0xB0000000 -#define CLR_DARKBLUE 0xDD003DF5 -#define CLR_DARKBLUE2 0xB0003DF5 -#define CLR_WHITE 0xFFFFFFFF -#define CLR_BRIGHTBLUE 0xFF0066FF -#define CLR_GRAY 0xFF858585 +#define CLR_TRANSBLACK 0xDD000000 +#define CLR_TRANSBLACK2 0xB0000000 +#define CLR_DARKBLUE 0xDD003DF5 +#define CLR_DARKBLUE2 0xB0003DF5 +#define CLR_WHITE 0xFFFFFFFF +#define CLR_BRIGHTBLUE 0xFF0066FF +#define CLR_GRAY 0xFF858585 //CHANNELS -#define CLR_PROGRESSBARBACK 0xDD858585 -#define CLR_PROGRESSBARBLEND 0xDD80B3FF -#define CLR_CHANNELSYMBOLOFF 0xDD858585 -#define CLR_CHANNELRECACTIVE 0xDDFF0000 +#define CLR_PROGRESSBARBACK 0xDD858585 +#define CLR_PROGRESSBARBLEND 0xDD80B3FF +#define CLR_CHANNELSYMBOLOFF 0xDD858585 +#define CLR_CHANNELRECACTIVE 0xDDFF0000 //REPLAY -#define CLR_REPLAYCURRENTTOTAL 0xFF003DF5 -#define CLR_REST 0xDD858585 -#define CLR_EXPOSED 0xFF000000 -#define CLR_CURRENT 0x90FFFFFF -#define CLR_MARKS 0xFF000000 +#define CLR_REPLAYCURRENTTOTAL 0xFF003DF5 +#define CLR_REST 0xDD858585 +#define CLR_EXPOSED 0xFF000000 +#define CLR_CURRENT 0x90FFFFFF +#define CLR_MARKS 0xFF000000 //MENU -#define CLR_MENUSCROLLBARBACK 0x40003DF5 -#define CLR_MENUITEM 0xEE444444 -#define CLR_MENUITEMBLEND 0x90000000 -#define CLR_MENUITEMHIGHBLEND 0xEE0033FF -#define CLR_DISKALERT 0xDDFF0000 +#define CLR_MENUSCROLLBARBACK 0x40003DF5 +#define CLR_MENUITEM 0xEE444444 +#define CLR_MENUITEMBLEND 0x90000000 +#define CLR_MENUITEMHIGHBLEND 0xEE0033FF +#define CLR_DISKALERT 0xDDFF0000 //BUTTONS -#define CLR_BUTTONRED 0x99BB0000 -#define CLR_BUTTONREDBORDER 0xFFBB0000 -#define CLR_BUTTONGREEN 0x9900BB00 -#define CLR_BUTTONGREENBORDER 0xFF00BB00 -#define CLR_BUTTONYELLOW 0x99BBBB00 -#define CLR_BUTTONYELLOWBORDER 0xFFBBBB00 -#define CLR_BUTTONBLUE 0x990000BB -#define CLR_BUTTONBLUEBORDER 0xFF0000BB +#define CLR_BUTTONRED 0x99BB0000 +#define CLR_BUTTONREDBORDER 0xFFBB0000 +#define CLR_BUTTONGREEN 0x9900BB00 +#define CLR_BUTTONGREENBORDER 0xFF00BB00 +#define CLR_BUTTONYELLOW 0x99BBBB00 +#define CLR_BUTTONYELLOWBORDER 0xFFBBBB00 +#define CLR_BUTTONBLUE 0x990000BB +#define CLR_BUTTONBLUEBORDER 0xFF0000BB //MESSAGES -#define CLR_MESSAGESTATUS 0x900000FF -#define CLR_MESSAGEINFO 0x90009900 -#define CLR_MESSAGEWARNING 0x90BBBB00 -#define CLR_MESSAGEERROR 0x90BB0000 +#define CLR_MESSAGESTATUS 0x900000FF +#define CLR_MESSAGEINFO 0x90009900 +#define CLR_MESSAGEWARNING 0x90BBBB00 +#define CLR_MESSAGEERROR 0x90BB0000 //CHANNELS -THEME_CLR(Theme, clrChannelBackground, CLR_TRANSBLACK2); -THEME_CLR(Theme, clrChannelBackBlend, CLR_DARKBLUE2); -THEME_CLR(Theme, clrChannelHead, CLR_BRIGHTBLUE); -THEME_CLR(Theme, clrChannelEPG, CLR_WHITE); -THEME_CLR(Theme, clrChannelEPGInfo, CLR_GRAY); -THEME_CLR(Theme, clrProgressBar, CLR_DARKBLUE); -THEME_CLR(Theme, clrProgressBarBack, CLR_PROGRESSBARBACK); -THEME_CLR(Theme, clrProgressBarBlend, CLR_PROGRESSBARBLEND); -THEME_CLR(Theme, clrChannelSymbolOn, CLR_DARKBLUE); -THEME_CLR(Theme, clrChannelSymbolOff, CLR_CHANNELSYMBOLOFF); -THEME_CLR(Theme, clrChannelRecActive, CLR_CHANNELRECACTIVE); +THEME_CLR(Theme, clrChannelBackground, CLR_TRANSBLACK2); +THEME_CLR(Theme, clrChannelBackBlend, CLR_DARKBLUE2); +THEME_CLR(Theme, clrChannelHead, CLR_BRIGHTBLUE); +THEME_CLR(Theme, clrChannelEPG, CLR_WHITE); +THEME_CLR(Theme, clrChannelEPGInfo, CLR_GRAY); +THEME_CLR(Theme, clrProgressBar, CLR_DARKBLUE); +THEME_CLR(Theme, clrProgressBarBack, CLR_PROGRESSBARBACK); +THEME_CLR(Theme, clrProgressBarBlend, CLR_PROGRESSBARBLEND); +THEME_CLR(Theme, clrChannelSymbolOn, CLR_DARKBLUE); +THEME_CLR(Theme, clrChannelSymbolOff, CLR_CHANNELSYMBOLOFF); +THEME_CLR(Theme, clrChannelRecActive, CLR_CHANNELRECACTIVE); //REPLAY -THEME_CLR(Theme, clrReplayBackground, CLR_TRANSBLACK2); -THEME_CLR(Theme, clrReplayBackBlend, CLR_DARKBLUE2); -THEME_CLR(Theme, clrReplayHead, CLR_WHITE); +THEME_CLR(Theme, clrReplayBackground, CLR_TRANSBLACK2); +THEME_CLR(Theme, clrReplayBackBlend, CLR_DARKBLUE2); +THEME_CLR(Theme, clrReplayHead, CLR_WHITE); THEME_CLR(Theme, clrReplayDescription, CLR_GRAY); THEME_CLR(Theme, clrReplayCurrentTotal, CLR_REPLAYCURRENTTOTAL); THEME_CLR(Theme, clrReplayProgressSeen, CLR_DARKBLUE); @@ -71,52 +71,52 @@ THEME_CLR(Theme, clrReplayProgressRest, CLR_REST); THEME_CLR(Theme, clrReplayProgressSelected, CLR_EXPOSED); THEME_CLR(Theme, clrReplayProgressMark, CLR_MARKS); THEME_CLR(Theme, clrReplayProgressCurrent, CLR_CURRENT); -THEME_CLR(Theme, clrReplayHighlightIcon, CLR_DARKBLUE); +THEME_CLR(Theme, clrReplayHighlightIcon, CLR_DARKBLUE); //TRACKS -THEME_CLR(Theme, clrTracksFontHead, CLR_GRAY); -THEME_CLR(Theme, clrTracksFontButtons, CLR_WHITE); +THEME_CLR(Theme, clrTracksFontHead, CLR_GRAY); +THEME_CLR(Theme, clrTracksFontButtons, CLR_WHITE); //Volume -THEME_CLR(Theme, clrVolumeFont, CLR_GRAY); +THEME_CLR(Theme, clrVolumeFont, CLR_GRAY); //MENU -THEME_CLR(Theme, clrMenuBack, CLR_TRANSBLACK); -THEME_CLR(Theme, clrMenuBorder, CLR_DARKBLUE); -THEME_CLR(Theme, clrMenuScrollBar, CLR_DARKBLUE); -THEME_CLR(Theme, clrMenuScrollBarBack, CLR_MENUSCROLLBARBACK); -THEME_CLR(Theme, clrMenuItem, CLR_MENUITEM); -THEME_CLR(Theme, clrMenuItemBlend, CLR_MENUITEMBLEND); -THEME_CLR(Theme, clrMenuItemHigh, CLR_TRANSBLACK); -THEME_CLR(Theme, clrMenuItemHighBlend, CLR_MENUITEMHIGHBLEND); -THEME_CLR(Theme, clrDiskAlert, CLR_DISKALERT); -THEME_CLR(Theme, clrMenuFontHeader, CLR_WHITE); -THEME_CLR(Theme, clrMenuFontDate, CLR_WHITE); -THEME_CLR(Theme, clrMenuFontDiscUsage, CLR_WHITE); -THEME_CLR(Theme, clrMenuFontButton, CLR_WHITE); -THEME_CLR(Theme, clrMenuFontTimers, CLR_WHITE); -THEME_CLR(Theme, clrMenuFontTimersHeader, CLR_WHITE); -THEME_CLR(Theme, clrMenuFontMessages, CLR_WHITE); -THEME_CLR(Theme, clrMenuFontDetailViewText, CLR_WHITE); +THEME_CLR(Theme, clrMenuBack, CLR_TRANSBLACK); +THEME_CLR(Theme, clrMenuBorder, CLR_DARKBLUE); +THEME_CLR(Theme, clrMenuScrollBar, CLR_DARKBLUE); +THEME_CLR(Theme, clrMenuScrollBarBack, CLR_MENUSCROLLBARBACK); +THEME_CLR(Theme, clrMenuItem, CLR_MENUITEM); +THEME_CLR(Theme, clrMenuItemBlend, CLR_MENUITEMBLEND); +THEME_CLR(Theme, clrMenuItemHigh, CLR_TRANSBLACK); +THEME_CLR(Theme, clrMenuItemHighBlend, CLR_MENUITEMHIGHBLEND); +THEME_CLR(Theme, clrDiskAlert, CLR_DISKALERT); +THEME_CLR(Theme, clrMenuFontHeader, CLR_WHITE); +THEME_CLR(Theme, clrMenuFontDate, CLR_WHITE); +THEME_CLR(Theme, clrMenuFontDiscUsage, CLR_WHITE); +THEME_CLR(Theme, clrMenuFontButton, CLR_WHITE); +THEME_CLR(Theme, clrMenuFontTimers, CLR_WHITE); +THEME_CLR(Theme, clrMenuFontTimersHeader, CLR_WHITE); +THEME_CLR(Theme, clrMenuFontMessages, CLR_WHITE); +THEME_CLR(Theme, clrMenuFontDetailViewText, CLR_WHITE); THEME_CLR(Theme, clrMenuFontDetailViewHeader, CLR_GRAY); THEME_CLR(Theme, clrMenuFontDetailViewHeaderTitle, CLR_BRIGHTBLUE); -THEME_CLR(Theme, clrMenuFontMenuItem, CLR_WHITE); -THEME_CLR(Theme, clrMenuFontMenuItemHigh, CLR_BRIGHTBLUE); -THEME_CLR(Theme, clrMenuFontMenuItemTitle, CLR_BRIGHTBLUE); -THEME_CLR(Theme, clrMenuFontMenuItemSep, CLR_GRAY); +THEME_CLR(Theme, clrMenuFontMenuItem, CLR_WHITE); +THEME_CLR(Theme, clrMenuFontMenuItemHigh, CLR_BRIGHTBLUE); +THEME_CLR(Theme, clrMenuFontMenuItemTitle, CLR_BRIGHTBLUE); +THEME_CLR(Theme, clrMenuFontMenuItemSep, CLR_GRAY); //BUTTONS -THEME_CLR(Theme, clrButtonRed, CLR_BUTTONRED); -THEME_CLR(Theme, clrButtonRedBorder, CLR_BUTTONREDBORDER); -THEME_CLR(Theme, clrButtonGreen, CLR_BUTTONGREEN); -THEME_CLR(Theme, clrButtonGreenBorder, CLR_BUTTONGREENBORDER); -THEME_CLR(Theme, clrButtonYellow, CLR_BUTTONYELLOW); -THEME_CLR(Theme, clrButtonYellowBorder, CLR_BUTTONYELLOWBORDER); -THEME_CLR(Theme, clrButtonBlue, CLR_BUTTONBLUE); -THEME_CLR(Theme, clrButtonBlueBorder, CLR_BUTTONBLUEBORDER); +THEME_CLR(Theme, clrButtonRed, CLR_BUTTONRED); +THEME_CLR(Theme, clrButtonRedBorder, CLR_BUTTONREDBORDER); +THEME_CLR(Theme, clrButtonGreen, CLR_BUTTONGREEN); +THEME_CLR(Theme, clrButtonGreenBorder, CLR_BUTTONGREENBORDER); +THEME_CLR(Theme, clrButtonYellow, CLR_BUTTONYELLOW); +THEME_CLR(Theme, clrButtonYellowBorder, CLR_BUTTONYELLOWBORDER); +THEME_CLR(Theme, clrButtonBlue, CLR_BUTTONBLUE); +THEME_CLR(Theme, clrButtonBlueBorder, CLR_BUTTONBLUEBORDER); //MESSAGES -THEME_CLR(Theme, clrMessageFont, CLR_WHITE); -THEME_CLR(Theme, clrMessageStatus, CLR_MESSAGESTATUS); -THEME_CLR(Theme, clrMessageInfo, CLR_MESSAGEINFO); -THEME_CLR(Theme, clrMessageWarning, CLR_MESSAGEWARNING); -THEME_CLR(Theme, clrMessageError, CLR_MESSAGEERROR); -THEME_CLR(Theme, clrMessageBlend, CLR_TRANSBLACK); +THEME_CLR(Theme, clrMessageFont, CLR_WHITE); +THEME_CLR(Theme, clrMessageStatus, CLR_MESSAGESTATUS); +THEME_CLR(Theme, clrMessageInfo, CLR_MESSAGEINFO); +THEME_CLR(Theme, clrMessageWarning, CLR_MESSAGEWARNING); +THEME_CLR(Theme, clrMessageError, CLR_MESSAGEERROR); +THEME_CLR(Theme, clrMessageBlend, CLR_TRANSBLACK); #include "epgsearchconf.c" #include "config.c" @@ -136,8 +136,8 @@ cNopacityConfig config; #include "displaymessage.c" cNopacity::cNopacity(void) : cSkin("nOpacity", &::Theme) { - config.setDynamicValues(); - config.loadEPGSearchSettings(); + config.setDynamicValues(); + config.loadEPGSearchSettings(); } const char *cNopacity::Description(void) { @@ -24,5 +24,4 @@ public: virtual cSkinDisplayTracks *DisplayTracks(const char *Title, int NumTracks, const char * const *Tracks); virtual cSkinDisplayMessage *DisplayMessage(void); }; - #endif //__NOPACITY_H @@ -1,10 +1,10 @@ #include "setup.h" cNopacitySetup::cNopacitySetup() { - tmpNopacityConfig = config; - cFont::GetAvailableFontNames(&fontNames); - fontNames.Insert(strdup(config.fontDefaultName)); - Setup(); + tmpNopacityConfig = config; + cFont::GetAvailableFontNames(&fontNames); + fontNames.Insert(strdup(config.fontDefaultName)); + Setup(); } cNopacitySetup::~cNopacitySetup() { @@ -12,127 +12,127 @@ cNopacitySetup::~cNopacitySetup() { void cNopacitySetup::Setup(void) { - int currentItem = Current(); - Clear(); - Add(new cMenuEditStraItem(tr("Font"), &tmpNopacityConfig.fontIndex, fontNames.Size(), &fontNames[0])); - Add(new cOsdItem(tr("VDR Menu"))); - Add(new cOsdItem(tr("Channel Switching"))); - Add(new cOsdItem(tr("Replay"))); - Add(new cOsdItem(tr("Audio Tracks"))); - Add(new cOsdItem(tr("Messages"))); - Add(new cOsdItem(tr("Volume"))); - - SetCurrent(Get(currentItem)); - Display(); + int currentItem = Current(); + Clear(); + Add(new cMenuEditStraItem(tr("Font"), &tmpNopacityConfig.fontIndex, fontNames.Size(), &fontNames[0])); + Add(new cOsdItem(tr("VDR Menu"))); + Add(new cOsdItem(tr("Channel Switching"))); + Add(new cOsdItem(tr("Replay"))); + Add(new cOsdItem(tr("Audio Tracks"))); + Add(new cOsdItem(tr("Messages"))); + Add(new cOsdItem(tr("Volume"))); + + SetCurrent(Get(currentItem)); + Display(); } eOSState cNopacitySetup::ProcessKey(eKeys Key) { - bool hadSubMenu = HasSubMenu(); - eOSState state = cMenuSetupPage::ProcessKey(Key); - if (hadSubMenu && Key == kOk) - Store(); - if (!hadSubMenu && (state == osUnknown || Key == kOk)) { - if ((Key == kOk && !hadSubMenu)) { - const char* ItemText = Get(Current())->Text(); - if (strcmp(ItemText, tr("VDR Menu")) == 0) - state = AddSubMenu(new cNopacitySetupMenuDisplay(&tmpNopacityConfig)); - if (strcmp(ItemText, tr("Channel Switching")) == 0) - state = AddSubMenu(new cNopacitySetupChannelDisplay(&tmpNopacityConfig)); - if (strcmp(ItemText, tr("Replay")) == 0) - state = AddSubMenu(new cNopacitySetupReplayDisplay(&tmpNopacityConfig)); - if (strcmp(ItemText, tr("Audio Tracks")) == 0) - state = AddSubMenu(new cNopacitySetupTrackDisplay(&tmpNopacityConfig)); - if (strcmp(ItemText, tr("Messages")) == 0) - state = AddSubMenu(new cNopacitySetupMessageDisplay(&tmpNopacityConfig)); - if (strcmp(ItemText, tr("Volume")) == 0) - state = AddSubMenu(new cNopacitySetupVolumeDisplay(&tmpNopacityConfig)); - } - } - return state; + bool hadSubMenu = HasSubMenu(); + eOSState state = cMenuSetupPage::ProcessKey(Key); + if (hadSubMenu && Key == kOk) + Store(); + if (!hadSubMenu && (state == osUnknown || Key == kOk)) { + if ((Key == kOk && !hadSubMenu)) { + const char* ItemText = Get(Current())->Text(); + if (strcmp(ItemText, tr("VDR Menu")) == 0) + state = AddSubMenu(new cNopacitySetupMenuDisplay(&tmpNopacityConfig)); + if (strcmp(ItemText, tr("Channel Switching")) == 0) + state = AddSubMenu(new cNopacitySetupChannelDisplay(&tmpNopacityConfig)); + if (strcmp(ItemText, tr("Replay")) == 0) + state = AddSubMenu(new cNopacitySetupReplayDisplay(&tmpNopacityConfig)); + if (strcmp(ItemText, tr("Audio Tracks")) == 0) + state = AddSubMenu(new cNopacitySetupTrackDisplay(&tmpNopacityConfig)); + if (strcmp(ItemText, tr("Messages")) == 0) + state = AddSubMenu(new cNopacitySetupMessageDisplay(&tmpNopacityConfig)); + if (strcmp(ItemText, tr("Volume")) == 0) + state = AddSubMenu(new cNopacitySetupVolumeDisplay(&tmpNopacityConfig)); + } + } + return state; } void cNopacitySetup::Store(void) { - config = tmpNopacityConfig; - SetupStore("fontIndex", config.fontIndex); - SetupStore("channelHeight", config.channelHeight); - SetupStore("channelBorderVertical", config.channelBorderVertical); - SetupStore("channelBorderBottom", config.channelBorderBottom); - SetupStore("logoWidth", config.logoWidth); - SetupStore("logoHeight", config.logoHeight); - SetupStore("logoBorder", config.logoBorder); - SetupStore("displaySignalStrength", config.displaySignalStrength); - SetupStore("channelFadeTime", config.channelFadeTime); - SetupStore("fontChannelHeaderSize", config.fontChannelHeaderSize); - SetupStore("fontChannelDateSize", config.fontChannelDateSize); - SetupStore("fontEPGSize", config.fontEPGSize); - SetupStore("fontEPGSmallSize", config.fontEPGSmallSize); - SetupStore("resolutionIconSize", config.resolutionIconSize); - SetupStore("replayHeight", config.replayHeight); - SetupStore("replayBorderVertical", config.replayBorderVertical); - SetupStore("replayBorderBottom", config.replayBorderBottom); - SetupStore("replayFadeTime", config.replayFadeTime); - SetupStore("fontReplayHeader", config.fontReplayHeader); - SetupStore("fontReplay", config.fontReplay); - SetupStore("messageWidth", config.messageWidth); - SetupStore("messageHeight", config.messageHeight); - SetupStore("messageBorderBottom", config.messageBorderBottom); - SetupStore("fontMessage", config.fontMessage); - SetupStore("messageFadeTime", config.messageFadeTime); - SetupStore("tracksFadeTime", config.tracksFadeTime); - SetupStore("tracksWidth", config.tracksWidth); - SetupStore("tracksHeight", config.tracksHeight); - SetupStore("tracksPosition", config.tracksPosition); - SetupStore("tracksBorderHorizontal", config.tracksBorderHorizontal); - SetupStore("tracksBorderVertical", config.tracksBorderVertical); - SetupStore("fontTracksHeader", config.fontTracksHeader); - SetupStore("fontTracks", config.fontTracks); - SetupStore("volumeFadeTime", config.volumeFadeTime); - SetupStore("volumeWidth", config.volumeWidth); - SetupStore("volumeHeight", config.volumeHeight); - SetupStore("volumeBorderBottom", config.volumeBorderBottom); - SetupStore("fontVolume", config.fontVolume); - SetupStore("scalePicture", config.scalePicture); - SetupStore("displayRerunsDetailEPGView", config.displayRerunsDetailEPGView); - SetupStore("numReruns", config.numReruns); - SetupStore("useSubtitleRerun", config.useSubtitleRerun); - SetupStore("menuFadeTime", config.menuFadeTime); - SetupStore("menuScrollDelay", config.menuScrollDelay); - SetupStore("menuScrollSpeed", config.menuScrollSpeed); - SetupStore("menuWidthNarrow", config.menuWidthNarrow); - SetupStore("menuWidthRightItems", config.menuWidthRightItems); - SetupStore("headerHeight", config.headerHeight); - SetupStore("footerHeight", config.footerHeight); - SetupStore("numDefaultMenuItems", config.numDefaultMenuItems); - SetupStore("iconHeight", config.iconHeight); - SetupStore("headerIconHeight", config.headerIconHeight); - SetupStore("menuItemLogoWidth", config.menuItemLogoWidth); - SetupStore("menuItemLogoHeight", config.menuItemLogoHeight); - SetupStore("menuHeaderLogoWidth", config.menuHeaderLogoWidth); - SetupStore("menuHeaderLogoHeight", config.menuHeaderLogoHeight); - SetupStore("detailViewLogoWidth", config.detailViewLogoWidth); - SetupStore("detailViewLogoHeight", config.detailViewLogoHeight); - SetupStore("epgImageWidth", config.epgImageWidth); - SetupStore("epgImageHeight", config.epgImageHeight); - SetupStore("fontHeader", config.fontHeader); - SetupStore("fontDate", config.fontDate); - SetupStore("fontMenuitemLarge", config.fontMenuitemLarge); - SetupStore("fontMenuitemSchedule", config.fontMenuitemSchedule); - SetupStore("fontMenuitemScheduleSmall", config.fontMenuitemScheduleSmall); - SetupStore("fontMenuitemDefault", config.fontMenuitemDefault); - SetupStore("fontDiskUsage", config.fontDiskUsage); - SetupStore("fontTimersHead", config.fontTimersHead); - SetupStore("fontTimers", config.fontTimers); - SetupStore("fontButtons", config.fontButtons); - SetupStore("fontMessageMenu", config.fontMessageMenu); - SetupStore("fontDetailView", config.fontDetailView); - SetupStore("fontDetailViewHeader", config.fontDetailViewHeader); - SetupStore("fontDetailViewHeaderLarge", config.fontDetailViewHeaderLarge); + config = tmpNopacityConfig; + SetupStore("fontIndex", config.fontIndex); + SetupStore("channelHeight", config.channelHeight); + SetupStore("channelBorderVertical", config.channelBorderVertical); + SetupStore("channelBorderBottom", config.channelBorderBottom); + SetupStore("logoWidth", config.logoWidth); + SetupStore("logoHeight", config.logoHeight); + SetupStore("logoBorder", config.logoBorder); + SetupStore("displaySignalStrength", config.displaySignalStrength); + SetupStore("channelFadeTime", config.channelFadeTime); + SetupStore("fontChannelHeaderSize", config.fontChannelHeaderSize); + SetupStore("fontChannelDateSize", config.fontChannelDateSize); + SetupStore("fontEPGSize", config.fontEPGSize); + SetupStore("fontEPGSmallSize", config.fontEPGSmallSize); + SetupStore("resolutionIconSize", config.resolutionIconSize); + SetupStore("replayHeight", config.replayHeight); + SetupStore("replayBorderVertical", config.replayBorderVertical); + SetupStore("replayBorderBottom", config.replayBorderBottom); + SetupStore("replayFadeTime", config.replayFadeTime); + SetupStore("fontReplayHeader", config.fontReplayHeader); + SetupStore("fontReplay", config.fontReplay); + SetupStore("messageWidth", config.messageWidth); + SetupStore("messageHeight", config.messageHeight); + SetupStore("messageBorderBottom", config.messageBorderBottom); + SetupStore("fontMessage", config.fontMessage); + SetupStore("messageFadeTime", config.messageFadeTime); + SetupStore("tracksFadeTime", config.tracksFadeTime); + SetupStore("tracksWidth", config.tracksWidth); + SetupStore("tracksHeight", config.tracksHeight); + SetupStore("tracksPosition", config.tracksPosition); + SetupStore("tracksBorderHorizontal", config.tracksBorderHorizontal); + SetupStore("tracksBorderVertical", config.tracksBorderVertical); + SetupStore("fontTracksHeader", config.fontTracksHeader); + SetupStore("fontTracks", config.fontTracks); + SetupStore("volumeFadeTime", config.volumeFadeTime); + SetupStore("volumeWidth", config.volumeWidth); + SetupStore("volumeHeight", config.volumeHeight); + SetupStore("volumeBorderBottom", config.volumeBorderBottom); + SetupStore("fontVolume", config.fontVolume); + SetupStore("scalePicture", config.scalePicture); + SetupStore("displayRerunsDetailEPGView", config.displayRerunsDetailEPGView); + SetupStore("numReruns", config.numReruns); + SetupStore("useSubtitleRerun", config.useSubtitleRerun); + SetupStore("menuFadeTime", config.menuFadeTime); + SetupStore("menuScrollDelay", config.menuScrollDelay); + SetupStore("menuScrollSpeed", config.menuScrollSpeed); + SetupStore("menuWidthNarrow", config.menuWidthNarrow); + SetupStore("menuWidthRightItems", config.menuWidthRightItems); + SetupStore("headerHeight", config.headerHeight); + SetupStore("footerHeight", config.footerHeight); + SetupStore("numDefaultMenuItems", config.numDefaultMenuItems); + SetupStore("iconHeight", config.iconHeight); + SetupStore("headerIconHeight", config.headerIconHeight); + SetupStore("menuItemLogoWidth", config.menuItemLogoWidth); + SetupStore("menuItemLogoHeight", config.menuItemLogoHeight); + SetupStore("menuHeaderLogoWidth", config.menuHeaderLogoWidth); + SetupStore("menuHeaderLogoHeight", config.menuHeaderLogoHeight); + SetupStore("detailViewLogoWidth", config.detailViewLogoWidth); + SetupStore("detailViewLogoHeight", config.detailViewLogoHeight); + SetupStore("epgImageWidth", config.epgImageWidth); + SetupStore("epgImageHeight", config.epgImageHeight); + SetupStore("fontHeader", config.fontHeader); + SetupStore("fontDate", config.fontDate); + SetupStore("fontMenuitemLarge", config.fontMenuitemLarge); + SetupStore("fontMenuitemSchedule", config.fontMenuitemSchedule); + SetupStore("fontMenuitemScheduleSmall", config.fontMenuitemScheduleSmall); + SetupStore("fontMenuitemDefault", config.fontMenuitemDefault); + SetupStore("fontDiskUsage", config.fontDiskUsage); + SetupStore("fontTimersHead", config.fontTimersHead); + SetupStore("fontTimers", config.fontTimers); + SetupStore("fontButtons", config.fontButtons); + SetupStore("fontMessageMenu", config.fontMessageMenu); + SetupStore("fontDetailView", config.fontDetailView); + SetupStore("fontDetailViewHeader", config.fontDetailViewHeader); + SetupStore("fontDetailViewHeaderLarge", config.fontDetailViewHeaderLarge); } //------------------------------------------------------------------------------------------------------------------ cMenuSetupSubMenu::cMenuSetupSubMenu(const char* Title, cNopacityConfig* data) : cOsdMenu(Title, 30) { - tmpNopacityConfig = data; + tmpNopacityConfig = data; } cOsdItem *cMenuSetupSubMenu::InfoItem(const char *label, const char *value) { @@ -158,166 +158,166 @@ eOSState cMenuSetupSubMenu::ProcessKey(eKeys Key) { //-----MenuDisplay------------------------------------------------------------------------------------------------------------- cNopacitySetupMenuDisplay::cNopacitySetupMenuDisplay(cNopacityConfig* data) : cMenuSetupSubMenu(tr("VDR Menu"), data) { - useSubtitleRerunTexts[0] = tr("never"); - useSubtitleRerunTexts[1] = tr("if exists"); - useSubtitleRerunTexts[2] = tr("always"); - scrollSpeed[0] = tr("off"); - scrollSpeed[1] = tr("slow"); - scrollSpeed[2] = tr("medium"); - scrollSpeed[3] = tr("fast"); - Set(); + useSubtitleRerunTexts[0] = tr("never"); + useSubtitleRerunTexts[1] = tr("if exists"); + useSubtitleRerunTexts[2] = tr("always"); + scrollSpeed[0] = tr("off"); + scrollSpeed[1] = tr("slow"); + scrollSpeed[2] = tr("medium"); + scrollSpeed[3] = tr("fast"); + Set(); } void cNopacitySetupMenuDisplay::Set(void) { - int currentItem = Current(); - Clear(); - Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->menuFadeTime, 0, 1000)); - Add(new cMenuEditStraItem(tr("Scrolling Speed"), &tmpNopacityConfig->menuScrollSpeed, 4, scrollSpeed)); - Add(new cMenuEditIntItem(tr("Scrolling Delay in ms"), &tmpNopacityConfig->menuScrollDelay, 0, 2000)); - Add(new cMenuEditBoolItem(tr("Scale Video size to fit into menu window"), &tmpNopacityConfig->scalePicture)); - Add(new cMenuEditBoolItem(tr("Display Reruns in detailed EPG View"), &tmpNopacityConfig->displayRerunsDetailEPGView)); - Add(new cMenuEditIntItem(tr("Number of reruns to display"), &tmpNopacityConfig->numReruns, 1, 10)); - Add(new cMenuEditStraItem(tr("Use Subtitle for reruns"), &tmpNopacityConfig->useSubtitleRerun, 3, useSubtitleRerunTexts)); - Add(new cMenuEditIntItem(tr("Width of narrow Menu Bar (Percent of OSD Width)"), &tmpNopacityConfig->menuWidthNarrow, 10, 100)); - Add(new cMenuEditIntItem(tr("Width of Disc Usage and Timers Display (Percent of OSD Width)"), &tmpNopacityConfig->menuWidthRightItems, 10, 100)); - Add(new cMenuEditIntItem(tr("Header Height (Percent of OSD Height)"), &tmpNopacityConfig->headerHeight, 0, 30)); - Add(new cMenuEditIntItem(tr("Footer Height (Percent of OSD Height)"), &tmpNopacityConfig->footerHeight, 0, 30)); - Add(new cMenuEditIntItem(tr("Number of Default Menu Entries per Page"), &tmpNopacityConfig->numDefaultMenuItems, 10, 40)); - Add(new cMenuEditIntItem(tr("Icon Size (Square Main Menu Icons)"), &tmpNopacityConfig->iconHeight, 30, 200)); - Add(new cMenuEditIntItem(tr("Header Icon Size (Square Header Menu Icons)"), &tmpNopacityConfig->headerIconHeight, 30, 200)); - Add(new cMenuEditIntItem(tr("Channel Logo Width (on the Menu Buttons)"), &tmpNopacityConfig->menuItemLogoWidth, 30, 200)); - Add(new cMenuEditIntItem(tr("Channel Logo Height (on the Menu Buttons)"), &tmpNopacityConfig->menuItemLogoHeight, 30, 200)); - Add(new cMenuEditIntItem(tr("Main Menu Header Logo Width"), &tmpNopacityConfig->menuHeaderLogoWidth, 30, 500)); - Add(new cMenuEditIntItem(tr("Main Menu Header Logo Height"), &tmpNopacityConfig->menuHeaderLogoHeight, 30, 500)); - Add(new cMenuEditIntItem(tr("Detail EPG View Logo Width"), &tmpNopacityConfig->detailViewLogoWidth, 30, 500)); - Add(new cMenuEditIntItem(tr("Detail EPG View Logo Height"), &tmpNopacityConfig->detailViewLogoHeight, 30, 500)); - Add(new cMenuEditIntItem(tr("Detail EPG View EPG Image Width"), &tmpNopacityConfig->epgImageWidth, 30, 500)); - Add(new cMenuEditIntItem(tr("Detail EPG View EPG Image Height"), &tmpNopacityConfig->epgImageHeight, 30, 500)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Header"), &tmpNopacityConfig->fontHeader, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Date"), &tmpNopacityConfig->fontDate, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Large Menu Item"), &tmpNopacityConfig->fontMenuitemLarge, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Schedule Menu Item"), &tmpNopacityConfig->fontMenuitemSchedule, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Schedule Menu Item Small"), &tmpNopacityConfig->fontMenuitemScheduleSmall, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Default Menu Item"), &tmpNopacityConfig->fontMenuitemDefault, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Disc Usage"), &tmpNopacityConfig->fontDiskUsage, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Timers Header"), &tmpNopacityConfig->fontTimersHead, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Timers Title"), &tmpNopacityConfig->fontTimers, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Color Buttons"), &tmpNopacityConfig->fontButtons, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Messages"), &tmpNopacityConfig->fontMessageMenu, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Detail View Text"), &tmpNopacityConfig->fontDetailView, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Detail View Header"), &tmpNopacityConfig->fontDetailViewHeader, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Detail View Header Large"), &tmpNopacityConfig->fontDetailViewHeaderLarge, -20, 20)); - - SetCurrent(Get(currentItem)); - Display(); + int currentItem = Current(); + Clear(); + Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->menuFadeTime, 0, 1000)); + Add(new cMenuEditStraItem(tr("Scrolling Speed"), &tmpNopacityConfig->menuScrollSpeed, 4, scrollSpeed)); + Add(new cMenuEditIntItem(tr("Scrolling Delay in ms"), &tmpNopacityConfig->menuScrollDelay, 0, 2000)); + Add(new cMenuEditBoolItem(tr("Scale Video size to fit into menu window"), &tmpNopacityConfig->scalePicture)); + Add(new cMenuEditBoolItem(tr("Display Reruns in detailed EPG View"), &tmpNopacityConfig->displayRerunsDetailEPGView)); + Add(new cMenuEditIntItem(tr("Number of reruns to display"), &tmpNopacityConfig->numReruns, 1, 10)); + Add(new cMenuEditStraItem(tr("Use Subtitle for reruns"), &tmpNopacityConfig->useSubtitleRerun, 3, useSubtitleRerunTexts)); + Add(new cMenuEditIntItem(tr("Width of narrow Menu Bar (Percent of OSD Width)"), &tmpNopacityConfig->menuWidthNarrow, 10, 100)); + Add(new cMenuEditIntItem(tr("Width of Disc Usage and Timers Display (Percent of OSD Width)"), &tmpNopacityConfig->menuWidthRightItems, 10, 100)); + Add(new cMenuEditIntItem(tr("Header Height (Percent of OSD Height)"), &tmpNopacityConfig->headerHeight, 0, 30)); + Add(new cMenuEditIntItem(tr("Footer Height (Percent of OSD Height)"), &tmpNopacityConfig->footerHeight, 0, 30)); + Add(new cMenuEditIntItem(tr("Number of Default Menu Entries per Page"), &tmpNopacityConfig->numDefaultMenuItems, 10, 40)); + Add(new cMenuEditIntItem(tr("Icon Size (Square Main Menu Icons)"), &tmpNopacityConfig->iconHeight, 30, 200)); + Add(new cMenuEditIntItem(tr("Header Icon Size (Square Header Menu Icons)"), &tmpNopacityConfig->headerIconHeight, 30, 200)); + Add(new cMenuEditIntItem(tr("Channel Logo Width (on the Menu Buttons)"), &tmpNopacityConfig->menuItemLogoWidth, 30, 200)); + Add(new cMenuEditIntItem(tr("Channel Logo Height (on the Menu Buttons)"), &tmpNopacityConfig->menuItemLogoHeight, 30, 200)); + Add(new cMenuEditIntItem(tr("Main Menu Header Logo Width"), &tmpNopacityConfig->menuHeaderLogoWidth, 30, 500)); + Add(new cMenuEditIntItem(tr("Main Menu Header Logo Height"), &tmpNopacityConfig->menuHeaderLogoHeight, 30, 500)); + Add(new cMenuEditIntItem(tr("Detail EPG View Logo Width"), &tmpNopacityConfig->detailViewLogoWidth, 30, 500)); + Add(new cMenuEditIntItem(tr("Detail EPG View Logo Height"), &tmpNopacityConfig->detailViewLogoHeight, 30, 500)); + Add(new cMenuEditIntItem(tr("Detail EPG View EPG Image Width"), &tmpNopacityConfig->epgImageWidth, 30, 500)); + Add(new cMenuEditIntItem(tr("Detail EPG View EPG Image Height"), &tmpNopacityConfig->epgImageHeight, 30, 500)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Header"), &tmpNopacityConfig->fontHeader, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Date"), &tmpNopacityConfig->fontDate, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Large Menu Item"), &tmpNopacityConfig->fontMenuitemLarge, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Schedule Menu Item"), &tmpNopacityConfig->fontMenuitemSchedule, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Schedule Menu Item Small"), &tmpNopacityConfig->fontMenuitemScheduleSmall, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Default Menu Item"), &tmpNopacityConfig->fontMenuitemDefault, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Disc Usage"), &tmpNopacityConfig->fontDiskUsage, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Timers Header"), &tmpNopacityConfig->fontTimersHead, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Timers Title"), &tmpNopacityConfig->fontTimers, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Color Buttons"), &tmpNopacityConfig->fontButtons, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Messages"), &tmpNopacityConfig->fontMessageMenu, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Detail View Text"), &tmpNopacityConfig->fontDetailView, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Detail View Header"), &tmpNopacityConfig->fontDetailViewHeader, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Detail View Header Large"), &tmpNopacityConfig->fontDetailViewHeaderLarge, -20, 20)); + + SetCurrent(Get(currentItem)); + Display(); } //----ChannelDisplay-------------------------------------------------------------------------------------------------------------- cNopacitySetupChannelDisplay::cNopacitySetupChannelDisplay(cNopacityConfig* data) : cMenuSetupSubMenu(tr("Channel Switching"), data) { - Set(); + Set(); } void cNopacitySetupChannelDisplay::Set(void) { - int currentItem = Current(); - Clear(); - - Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->channelFadeTime, 0, 1000)); - Add(new cMenuEditIntItem(tr("Hight of Channel Display (Percent of OSD Height)"), &tmpNopacityConfig->channelHeight, 15, 100)); - Add(new cMenuEditIntItem(tr("Left & Right Border Width"), &tmpNopacityConfig->channelBorderVertical, 0, 300)); - Add(new cMenuEditIntItem(tr("Bottom Border Height"), &tmpNopacityConfig->channelBorderBottom, 0, 300)); - Add(new cMenuEditIntItem(tr("Channel Logo Width"), &tmpNopacityConfig->logoWidth, 30, 500)); - Add(new cMenuEditIntItem(tr("Channel Logo Height"), &tmpNopacityConfig->logoHeight, 30, 500)); - Add(new cMenuEditIntItem(tr("Channel Logo Border"), &tmpNopacityConfig->logoBorder, 0, 200)); - Add(new cMenuEditBoolItem(tr("Display Signal Strength & Quality"), &tmpNopacityConfig->displaySignalStrength)); - Add(new cMenuEditIntItem(tr("Screen Resolution Icon Size"), &tmpNopacityConfig->resolutionIconSize, 30, 200)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Header"), &tmpNopacityConfig->fontChannelHeaderSize, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Date"), &tmpNopacityConfig->fontChannelDateSize, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - EPG Text"), &tmpNopacityConfig->fontEPGSize, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - EPG Infotext"), &tmpNopacityConfig->fontEPGSmallSize, -20, 20)); - SetCurrent(Get(currentItem)); - Display(); + int currentItem = Current(); + Clear(); + + Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->channelFadeTime, 0, 1000)); + Add(new cMenuEditIntItem(tr("Hight of Channel Display (Percent of OSD Height)"), &tmpNopacityConfig->channelHeight, 15, 100)); + Add(new cMenuEditIntItem(tr("Left & Right Border Width"), &tmpNopacityConfig->channelBorderVertical, 0, 300)); + Add(new cMenuEditIntItem(tr("Bottom Border Height"), &tmpNopacityConfig->channelBorderBottom, 0, 300)); + Add(new cMenuEditIntItem(tr("Channel Logo Width"), &tmpNopacityConfig->logoWidth, 30, 500)); + Add(new cMenuEditIntItem(tr("Channel Logo Height"), &tmpNopacityConfig->logoHeight, 30, 500)); + Add(new cMenuEditIntItem(tr("Channel Logo Border"), &tmpNopacityConfig->logoBorder, 0, 200)); + Add(new cMenuEditBoolItem(tr("Display Signal Strength & Quality"), &tmpNopacityConfig->displaySignalStrength)); + Add(new cMenuEditIntItem(tr("Screen Resolution Icon Size"), &tmpNopacityConfig->resolutionIconSize, 30, 200)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Header"), &tmpNopacityConfig->fontChannelHeaderSize, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Date"), &tmpNopacityConfig->fontChannelDateSize, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - EPG Text"), &tmpNopacityConfig->fontEPGSize, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - EPG Infotext"), &tmpNopacityConfig->fontEPGSmallSize, -20, 20)); + SetCurrent(Get(currentItem)); + Display(); } //-----ReplayDisplay------------------------------------------------------------------------------------------------------------- cNopacitySetupReplayDisplay::cNopacitySetupReplayDisplay(cNopacityConfig* data) : cMenuSetupSubMenu(tr("Replay"), data) { - Set(); + Set(); } void cNopacitySetupReplayDisplay::Set(void) { - int currentItem = Current(); - Clear(); - - Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->replayFadeTime, 0, 1000)); - Add(new cMenuEditIntItem(tr("Hight of Replay Display (Percent of OSD Height)"), &tmpNopacityConfig->replayHeight, 15, 100)); - Add(new cMenuEditIntItem(tr("Left & Right Border Width"), &tmpNopacityConfig->replayBorderVertical, 0, 300)); - Add(new cMenuEditIntItem(tr("Bottom Border Height"), &tmpNopacityConfig->replayBorderBottom, 0, 300)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Header"), &tmpNopacityConfig->fontReplayHeader, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Text"), &tmpNopacityConfig->fontReplay, -20, 20)); - - SetCurrent(Get(currentItem)); - Display(); + int currentItem = Current(); + Clear(); + + Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->replayFadeTime, 0, 1000)); + Add(new cMenuEditIntItem(tr("Hight of Replay Display (Percent of OSD Height)"), &tmpNopacityConfig->replayHeight, 15, 100)); + Add(new cMenuEditIntItem(tr("Left & Right Border Width"), &tmpNopacityConfig->replayBorderVertical, 0, 300)); + Add(new cMenuEditIntItem(tr("Bottom Border Height"), &tmpNopacityConfig->replayBorderBottom, 0, 300)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Header"), &tmpNopacityConfig->fontReplayHeader, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Text"), &tmpNopacityConfig->fontReplay, -20, 20)); + + SetCurrent(Get(currentItem)); + Display(); } //-----TrackDisplay------------------------------------------------------------------------------------------------------------- cNopacitySetupTrackDisplay::cNopacitySetupTrackDisplay(cNopacityConfig* data) : cMenuSetupSubMenu(tr("Audio Tracks"), data) { - Set(); + Set(); } void cNopacitySetupTrackDisplay::Set(void) { - int currentItem = Current(); - Clear(); - Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->tracksFadeTime, 0, 1000)); - Add(new cMenuEditIntItem(tr("Width of Tracks Display (Percent of OSD Width)"), &tmpNopacityConfig->tracksWidth, 10, 100)); - Add(new cMenuEditIntItem(tr("Hight of Tracks Display (Percent of OSD Height)"), &tmpNopacityConfig->tracksHeight, 10, 100)); - Add(new cMenuEditIntItem(tr("Position (0: bot. center, 1: bot. left, ... , 7: bot. right)"), &tmpNopacityConfig->tracksPosition, 0, 7)); - Add(new cMenuEditIntItem(tr("Border Top / Bottom"), &tmpNopacityConfig->tracksBorderHorizontal, 0, 100)); - Add(new cMenuEditIntItem(tr("Border Left / Right"), &tmpNopacityConfig->tracksBorderVertical, 0, 100)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Header"), &tmpNopacityConfig->fontTracksHeader, -20, 20)); - Add(new cMenuEditIntItem(tr("Adjust Font Size - Buttons"), &tmpNopacityConfig->fontTracks, -20, 20)); - - SetCurrent(Get(currentItem)); - Display(); + int currentItem = Current(); + Clear(); + Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->tracksFadeTime, 0, 1000)); + Add(new cMenuEditIntItem(tr("Width of Tracks Display (Percent of OSD Width)"), &tmpNopacityConfig->tracksWidth, 10, 100)); + Add(new cMenuEditIntItem(tr("Hight of Tracks Display (Percent of OSD Height)"), &tmpNopacityConfig->tracksHeight, 10, 100)); + Add(new cMenuEditIntItem(tr("Position (0: bot. center, 1: bot. left, ... , 7: bot. right)"), &tmpNopacityConfig->tracksPosition, 0, 7)); + Add(new cMenuEditIntItem(tr("Border Top / Bottom"), &tmpNopacityConfig->tracksBorderHorizontal, 0, 100)); + Add(new cMenuEditIntItem(tr("Border Left / Right"), &tmpNopacityConfig->tracksBorderVertical, 0, 100)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Header"), &tmpNopacityConfig->fontTracksHeader, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Buttons"), &tmpNopacityConfig->fontTracks, -20, 20)); + + SetCurrent(Get(currentItem)); + Display(); } //-----MessageDisplay------------------------------------------------------------------------------------------------------------- cNopacitySetupMessageDisplay::cNopacitySetupMessageDisplay(cNopacityConfig* data) : cMenuSetupSubMenu(tr("Messages"), data) { - Set(); + Set(); } void cNopacitySetupMessageDisplay::Set(void) { - int currentItem = Current(); - Clear(); + int currentItem = Current(); + Clear(); - Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->messageFadeTime, 0, 1000)); - Add(new cMenuEditIntItem(tr("Width of Message Display (Percent of OSD Height)"), &tmpNopacityConfig->messageWidth, 30, 100)); - Add(new cMenuEditIntItem(tr("Hight of Message Display (Percent of OSD Height)"), &tmpNopacityConfig->messageHeight, 5, 100)); - Add(new cMenuEditIntItem(tr("Bottom Border Height"), &tmpNopacityConfig->messageBorderBottom, 0, 1000)); - Add(new cMenuEditIntItem(tr("Adjust Font Size"), &tmpNopacityConfig->fontMessage, -30, 30)); + Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->messageFadeTime, 0, 1000)); + Add(new cMenuEditIntItem(tr("Width of Message Display (Percent of OSD Height)"), &tmpNopacityConfig->messageWidth, 30, 100)); + Add(new cMenuEditIntItem(tr("Hight of Message Display (Percent of OSD Height)"), &tmpNopacityConfig->messageHeight, 5, 100)); + Add(new cMenuEditIntItem(tr("Bottom Border Height"), &tmpNopacityConfig->messageBorderBottom, 0, 1000)); + Add(new cMenuEditIntItem(tr("Adjust Font Size"), &tmpNopacityConfig->fontMessage, -30, 30)); - SetCurrent(Get(currentItem)); - Display(); + SetCurrent(Get(currentItem)); + Display(); } //-----VolumeDisplay------------------------------------------------------------------------------------------------------------- cNopacitySetupVolumeDisplay::cNopacitySetupVolumeDisplay(cNopacityConfig* data) : cMenuSetupSubMenu(tr("Volume Display"), data) { - Set(); + Set(); } void cNopacitySetupVolumeDisplay::Set(void) { - int currentItem = Current(); - Clear(); + int currentItem = Current(); + Clear(); - Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->volumeFadeTime, 0, 1000)); - Add(new cMenuEditIntItem(tr("Width of Volume Display (Percent of OSD Height)"), &tmpNopacityConfig->volumeWidth, 10, 100)); - Add(new cMenuEditIntItem(tr("Hight of Volume Display (Percent of OSD Height)"), &tmpNopacityConfig->volumeHeight, 5, 100)); - Add(new cMenuEditIntItem(tr("Bottom Border Height"), &tmpNopacityConfig->volumeBorderBottom, 0, 1000)); - Add(new cMenuEditIntItem(tr("Adjust Font Size"), &tmpNopacityConfig->fontVolume, -30, 30)); + Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), &tmpNopacityConfig->volumeFadeTime, 0, 1000)); + Add(new cMenuEditIntItem(tr("Width of Volume Display (Percent of OSD Height)"), &tmpNopacityConfig->volumeWidth, 10, 100)); + Add(new cMenuEditIntItem(tr("Hight of Volume Display (Percent of OSD Height)"), &tmpNopacityConfig->volumeHeight, 5, 100)); + Add(new cMenuEditIntItem(tr("Bottom Border Height"), &tmpNopacityConfig->volumeBorderBottom, 0, 1000)); + Add(new cMenuEditIntItem(tr("Adjust Font Size"), &tmpNopacityConfig->fontVolume, -30, 30)); - SetCurrent(Get(currentItem)); - Display(); + SetCurrent(Get(currentItem)); + Display(); }
\ No newline at end of file @@ -2,71 +2,71 @@ #define __NOPACITY_SETUP_H class cNopacitySetup : public cMenuSetupPage { - public: - cNopacitySetup(void); - virtual ~cNopacitySetup(); - private: - cNopacityConfig tmpNopacityConfig; - cStringList fontNames; - void Setup(void); - protected: - virtual eOSState ProcessKey(eKeys Key); - virtual void Store(void); + public: + cNopacitySetup(void); + virtual ~cNopacitySetup(); + private: + cNopacityConfig tmpNopacityConfig; + cStringList fontNames; + void Setup(void); + protected: + virtual eOSState ProcessKey(eKeys Key); + virtual void Store(void); }; class cMenuSetupSubMenu : public cOsdMenu { - protected: - cNopacityConfig *tmpNopacityConfig; - virtual eOSState ProcessKey(eKeys Key); - virtual void Set(void) = 0; - cOsdItem *InfoItem(const char *label, const char *value); - public: - cMenuSetupSubMenu(const char *Title, cNopacityConfig *data); + protected: + cNopacityConfig *tmpNopacityConfig; + virtual eOSState ProcessKey(eKeys Key); + virtual void Set(void) = 0; + cOsdItem *InfoItem(const char *label, const char *value); + public: + cMenuSetupSubMenu(const char *Title, cNopacityConfig *data); }; class cNopacitySetupMenuDisplay : public cMenuSetupSubMenu { - protected: - const char *useSubtitleRerunTexts[3]; - const char *scrollSpeed[4]; - void Set(void); - public: - cNopacitySetupMenuDisplay(cNopacityConfig *data); + protected: + const char *useSubtitleRerunTexts[3]; + const char *scrollSpeed[4]; + void Set(void); + public: + cNopacitySetupMenuDisplay(cNopacityConfig *data); }; class cNopacitySetupChannelDisplay : public cMenuSetupSubMenu { - protected: - void Set(void); - public: - cNopacitySetupChannelDisplay(cNopacityConfig *data); + protected: + void Set(void); + public: + cNopacitySetupChannelDisplay(cNopacityConfig *data); }; class cNopacitySetupReplayDisplay : public cMenuSetupSubMenu { - protected: - void Set(void); - public: - cNopacitySetupReplayDisplay(cNopacityConfig *data); + protected: + void Set(void); + public: + cNopacitySetupReplayDisplay(cNopacityConfig *data); }; class cNopacitySetupTrackDisplay : public cMenuSetupSubMenu { - protected: - void Set(void); - public: - cNopacitySetupTrackDisplay(cNopacityConfig *data); + protected: + void Set(void); + public: + cNopacitySetupTrackDisplay(cNopacityConfig *data); }; class cNopacitySetupMessageDisplay : public cMenuSetupSubMenu { - protected: - void Set(void); - public: - cNopacitySetupMessageDisplay(cNopacityConfig *data); + protected: + void Set(void); + public: + cNopacitySetupMessageDisplay(cNopacityConfig *data); }; class cNopacitySetupVolumeDisplay : public cMenuSetupSubMenu { - protected: - void Set(void); - public: - cNopacitySetupVolumeDisplay(cNopacityConfig *data); + protected: + void Set(void); + public: + cNopacitySetupVolumeDisplay(cNopacityConfig *data); }; #endif //__NOPACITY_SETUP_H
\ No newline at end of file diff --git a/skinnopacity.c b/skinnopacity.c index b661dea..a1ab3fc 100644 --- a/skinnopacity.c +++ b/skinnopacity.c @@ -73,24 +73,24 @@ bool cPluginNopacity::ProcessArgs(int argc, char *argv[]) int c; cString *path = NULL; while ((c = getopt_long(argc, argv, "e:l:i:", long_options, NULL)) != -1) { - switch (c) { + switch (c) { case 'l': - path = new cString(optarg); + path = new cString(optarg); config.SetLogoPath(*path); break; case 'e': - path = new cString(optarg); + path = new cString(optarg); config.SetEpgImagePath(*path); break; case 'i': - path = new cString(optarg); + path = new cString(optarg); config.SetIconPath(*path); break; default: return false; } - if (path) - delete path; + if (path) + delete path; } return true; } @@ -102,11 +102,11 @@ bool cPluginNopacity::Initialize(void) bool cPluginNopacity::Start(void) { - if (!cOsdProvider::SupportsTrueColor()) { - esyslog("nopacity: No TrueColor OSD found! Aborting!"); - return false; - } else - dsyslog("nopacity: TrueColor OSD found"); + if (!cOsdProvider::SupportsTrueColor()) { + esyslog("nopacity: No TrueColor OSD found! Aborting!"); + return false; + } else + dsyslog("nopacity: TrueColor OSD found"); return new cNopacity; } |