diff options
author | louis <louis.braun@gmx.de> | 2013-11-07 16:58:07 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2013-11-07 16:58:07 +0100 |
commit | e09cf14b0cf0882b8b4db75ae64cf9d6846b8bc7 (patch) | |
tree | 7886779ba33b466b2fe9ca67362183dabe08597e | |
parent | 0bbbad6d8057953ae51e9465bd76e5a3256e5eee (diff) | |
download | skin-nopacity-e09cf14b0cf0882b8b4db75ae64cf9d6846b8bc7.tar.gz skin-nopacity-e09cf14b0cf0882b8b4db75ae64cf9d6846b8bc7.tar.bz2 |
changed build environment that every class is build seperately
46 files changed, 863 insertions, 728 deletions
@@ -348,3 +348,5 @@ Version 0.1.4 pictures (VDR Menu -> Common Settings) - Added complete date for events longer than one day in the future in schedules menu +- changed build environment that every class is build seperately + (thanks @Helmut Auer) @@ -56,7 +56,8 @@ LIBS += $(shell pkg-config --libs Magick++) ### The object files (add further files here): -OBJS = $(PLUGIN).o +OBJS = $(PLUGIN).o config.o displaychannel.o displaymenu.o displaymenuview.o displaymessage.o displayreplay.o displaytracks.o displayvolume.o displaychannelview.o fontmanager.o \ + geometrymanager.o imagecache.o imagemagickwrapper.o helpers.o imageloader.o menudetailview.o menuitem.o nopacity.o setup.o textwindow.o timers.o ### The main target: @@ -2,6 +2,8 @@ #include <vector> #include <map> #include "config.h" +#include "helpers.h" +#include <vdr/skins.h> cNopacityConfig::cNopacityConfig() { logoPathSet = false; @@ -163,7 +165,7 @@ void cNopacityConfig::LoadDefaults(void) { conf.insert(std::pair<std::string, int>("progressCurrentSchedule", 0)); conf.insert(std::pair<std::string, int>("displayPoster", 1)); conf.insert(std::pair<std::string, int>("channelPosterBorder", 10)); - //Display Replay + //Display Replay conf.insert(std::pair<std::string, int>("replayHeight", 25)); conf.insert(std::pair<std::string, int>("replayBorderVertical", 15)); conf.insert(std::pair<std::string, int>("replayBorderBottom", 15)); @@ -197,7 +199,7 @@ void cNopacityConfig::LoadDefaults(void) { conf.insert(std::pair<std::string, int>("numLogosMax", 50)); } -void cNopacityConfig::SetFontName() { +void cNopacityConfig::SetFontName() { if (fontName) free(fontName); if (GetValue("fontIndex") == 0) { @@ -207,7 +209,7 @@ void cNopacityConfig::SetFontName() { cFont::GetAvailableFontNames(&availableFonts); if (availableFonts[GetValue("fontIndex")-1]) { fontName = strdup(availableFonts[GetValue("fontIndex")-1]); - } else + } else fontName = strdup(fontDefaultName); } } @@ -216,10 +218,10 @@ void cNopacityConfig::SetPathes(void) { 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)); + + 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::SetLogoPath(cString path) { @@ -253,7 +255,7 @@ void cNopacityConfig::LoadThemeSpecificConfigs(void) { for (int theme = 0; theme < numThemes; theme++) { cString confFile = cString::sprintf("%s/themeconfigs/theme-%s.conf", cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), themes.Name(theme)); dsyslog("nopacity: trying to load theme config %s", *confFile); - LoadThemeConfig(confFile, themes.Name(theme)); + LoadThemeConfig(confFile, themes.Name(theme)); } } @@ -1,6 +1,15 @@ #ifndef __NOPACITY_CONFIG_H #define __NOPACITY_CONFIG_H +#include <string> +#include <vector> +#include <map> +#include <vdr/tools.h> +#include <vdr/skins.h> +#include <vdr/plugin.h> +#include "fontmanager.h" +#include "geometrymanager.h" + enum eDisplayType { dtFlat = 0, dtBlending, @@ -49,5 +58,174 @@ class cNopacityConfig { cString epgImagePath; bool mainMenuEntry; }; +#ifdef DEFINE_CONFIG + bool firstDisplay = true; + cNopacityConfig config; + cGeometryManager *geoManager; + cFontManager *fontManager; + cTheme Theme; +#else + extern bool firstDisplay; + extern cNopacityConfig config; + extern cGeometryManager *geoManager; + extern cFontManager *fontManager; + extern cTheme Theme; +#endif + +//COMMON +#define CLR_TRANSPARENT 0x00000000 +#define CLR_BACKGROUND_BLUE 0xFF242A38 +#define CLR_TRANSBLACK 0xDD000000 +#define CLR_TRANSBLACK2 0xB0000000 +#define CLR_BLACK 0xFF000000 +#define CLR_DARKBLUE 0xDD003DF5 +#define CLR_DARKBLUE2 0xB0003DF5 +#define CLR_WHITE 0xFFFFFFFF +#define CLR_BRIGHTBLUE 0xFF0066FF +#define CLR_GRAY 0xFF858585 + +//CHANNELS +#define CLR_CHANNELPROGRESSBAR 0xDD003DF5 +#define CLR_CHANNELPROGRESSBARBACK 0xDD858585 +#define CLR_CHANNELPROGRESSBARBLEND 0xDD80B3FF +#define CLR_CHANNELSYMBOLOFF 0xDD858585 +#define CLR_CHANNELRECACTIVE 0xDDFF0000 +#define CLR_RECNEXT 0xDDFFFF00 + +//REPLAY +#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_MENUSCROLLBARBASE 0x00000000 +#define CLR_MENUITEM 0xEE444444 +#define CLR_MENUITEMBLEND 0x90000000 +#define CLR_MENUITEMHIGHBLEND 0xEE0033FF +#define CLR_SEPARATORBORDER 0xEE444444 +#define CLR_DISKALERT 0xDDFF0000 +#define CLR_MENUHEADER 0xDD000000 +#define CLR_MENUHEADERBLEND 0xEE0033FF +#define CLR_AUDIOMENUHEADER 0xDD000000 +#define CLR_PROGRESSBAR 0xDD003DF5 +#define CLR_PROGRESSBARBACK 0xDD858585 +#define CLR_PROGRESSBARBLEND 0xDD80B3FF +#define CLR_PROGRESSBARHIGH 0xDD003DF5 +#define CLR_PROGRESSBARBACKHIGH 0xDD858585 +#define CLR_PROGRESSBARBLENDHIGH 0xDD80B3FF +#define CLR_CHANNELLOGOBACK 0xDD858585 + +//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 + +//MESSAGES +#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_WHITE); +THEME_CLR(Theme, clrChannelEPGNext, CLR_GRAY); +THEME_CLR(Theme, clrChannelEPGInfoNext, CLR_GRAY); +THEME_CLR(Theme, clrChannelProgressBar, CLR_CHANNELPROGRESSBAR); +THEME_CLR(Theme, clrChannelProgressBarBack, CLR_CHANNELPROGRESSBARBACK); +THEME_CLR(Theme, clrChannelProgressBarBlend,CLR_CHANNELPROGRESSBARBLEND); +THEME_CLR(Theme, clrStatusIconsBack, CLR_TRANSPARENT); +THEME_CLR(Theme, clrRecNow, CLR_CHANNELRECACTIVE); +THEME_CLR(Theme, clrRecNowFont, CLR_WHITE); +THEME_CLR(Theme, clrRecNext, CLR_RECNEXT); +THEME_CLR(Theme, clrRecNextFont, CLR_BLACK); +//REPLAY +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); +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); +//TRACKS +THEME_CLR(Theme, clrTracksFontHead, CLR_GRAY); +THEME_CLR(Theme, clrTracksFontButtons, CLR_WHITE); +//Volume +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, clrMenuScrollBarBase, CLR_MENUSCROLLBARBASE); +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, clrSeparatorBorder, CLR_SEPARATORBORDER); +THEME_CLR(Theme, clrDiskAlert, CLR_DISKALERT); +THEME_CLR(Theme, clrTimersBack, CLR_MENUITEMHIGHBLEND); +THEME_CLR(Theme, clrTimersBackBlend, CLR_TRANSBLACK); +THEME_CLR(Theme, clrMenuFontHeader, CLR_WHITE); +THEME_CLR(Theme, clrMenuFontDate, CLR_WHITE); +THEME_CLR(Theme, clrMenuFontDiscUsage, CLR_WHITE); +THEME_CLR(Theme, clrMenuFontTimers, CLR_WHITE); +THEME_CLR(Theme, clrMenuFontTimersHeader, 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, clrMenuHeader, CLR_MENUHEADER); +THEME_CLR(Theme, clrMenuHeaderBlend, CLR_MENUHEADERBLEND); +THEME_CLR(Theme, clrAudioMenuHeader, CLR_AUDIOMENUHEADER); +THEME_CLR(Theme, clrProgressBar, CLR_PROGRESSBAR); +THEME_CLR(Theme, clrProgressBarBack, CLR_PROGRESSBARBACK); +THEME_CLR(Theme, clrProgressBarBlend, CLR_PROGRESSBARBLEND); +THEME_CLR(Theme, clrProgressBarHigh, CLR_PROGRESSBARHIGH); +THEME_CLR(Theme, clrProgressBarBackHigh, CLR_PROGRESSBARBACKHIGH); +THEME_CLR(Theme, clrProgressBarBlendHigh, CLR_PROGRESSBARBLENDHIGH); +THEME_CLR(Theme, clrMenuTextWindow, CLR_TRANSBLACK); +THEME_CLR(Theme, clrMenuChannelLogoBack, CLR_CHANNELLOGOBACK); +//BUTTONS +THEME_CLR(Theme, clrButtonRed, CLR_BUTTONRED); +THEME_CLR(Theme, clrButtonRedBorder, CLR_BUTTONREDBORDER); +THEME_CLR(Theme, clrButtonRedFont, CLR_WHITE); +THEME_CLR(Theme, clrButtonGreen, CLR_BUTTONGREEN); +THEME_CLR(Theme, clrButtonGreenBorder, CLR_BUTTONGREENBORDER); +THEME_CLR(Theme, clrButtonGreenFont, CLR_WHITE); +THEME_CLR(Theme, clrButtonYellow, CLR_BUTTONYELLOW); +THEME_CLR(Theme, clrButtonYellowBorder, CLR_BUTTONYELLOWBORDER); +THEME_CLR(Theme, clrButtonYellowFont, CLR_WHITE); +THEME_CLR(Theme, clrButtonBlue, CLR_BUTTONBLUE); +THEME_CLR(Theme, clrButtonBlueBorder, CLR_BUTTONBLUEBORDER); +THEME_CLR(Theme, clrButtonBlueFont, CLR_WHITE); +//MESSAGES +THEME_CLR(Theme, clrMessageFontStatus, CLR_WHITE); +THEME_CLR(Theme, clrMessageFontInfo, CLR_WHITE); +THEME_CLR(Theme, clrMessageFontWarning, CLR_WHITE); +THEME_CLR(Theme, clrMessageFontError, 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); -#endif //__NOPACITY_CONFIG_H
\ No newline at end of file +#endif //__NOPACITY_CONFIG_H diff --git a/displaychannel.c b/displaychannel.c index 0f4b8a8..c53d5f4 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -1,4 +1,11 @@ +#include "config.h" +#include "nopacity.h" #include "displaychannel.h" +#include "imageloader.h" +#include "helpers.h" + +#include <vdr/osd.h> +#include <vdr/menu.h> cNopacityDisplayChannel::cNopacityDisplayChannel(cImageCache *imgCache, bool WithInfo) { if (firstDisplay) { @@ -15,7 +22,7 @@ cNopacityDisplayChannel::cNopacityDisplayChannel(cImageCache *imgCache, bool Wit initial = true; FadeTime = config.GetValue("channelFadeTime"); FrameTime = FadeTime / 10; - + channelView = new cNopacityDisplayChannelView(imgCache); channelView->createOsd(); channelView->CreatePixmaps(); @@ -37,13 +44,13 @@ cNopacityDisplayChannel::~cNopacityDisplayChannel() { void cNopacityDisplayChannel::SetChannel(const cChannel *Channel, int Number) { if (!doOutput) return; - + channelChange = true; groupSep = false; - + cString ChannelNumber(""); cString ChannelName(""); - + if (Channel) { ChannelName = Channel->Name(); if (!Channel->GroupSep()) { @@ -56,7 +63,7 @@ void cNopacityDisplayChannel::SetChannel(const cChannel *Channel, int Number) { } else { ChannelName = ChannelString(NULL, 0); } - + channelView->ClearChannelLogo(); channelView->ClearChannelName(); channelView->ClearEPGInfo(); @@ -144,18 +151,18 @@ void cNopacityDisplayChannel::Flush(void) { SetProgressBar(present); } else channelView->ClearProgressBar(); - + if (!groupSep) channelView->DrawScreenResolution(); - else + else channelView->ClearStatusIcons(); - + if (config.GetValue("displaySignalStrength") && !groupSep) { channelView->ShowSignalMeter(); channelView->DrawSignal(); } else channelView->HideSignalMeter(); - + if (initial) { if (config.GetValue("channelFadeTime")) Start(); diff --git a/displaychannel.h b/displaychannel.h index 752f522..65b6884 100644 --- a/displaychannel.h +++ b/displaychannel.h @@ -1,6 +1,9 @@ #ifndef __NOPACITY_DISPLAYCHANNEL_H #define __NOPACITY_DISPLAYCHANNEL_H +#include <vdr/thread.h> +#include "displaychannelview.h" + class cNopacityDisplayChannel : public cSkinDisplayChannel, cThread { private: cNopacityDisplayChannelView *channelView; diff --git a/displaychannelview.c b/displaychannelview.c index a343d06..c543c4a 100644 --- a/displaychannelview.c +++ b/displaychannelview.c @@ -1,5 +1,11 @@ #include "services/tvscraper.h" #include "displaychannelview.h" +#include "config.h" +#include "helpers.h" +#include "fontmanager.h" +#include "geometrymanager.h" +#include "imageloader.h" +#include <vdr/menu.h> cNopacityDisplayChannelView::cNopacityDisplayChannelView(cImageCache *imgCache) { this->imgCache = imgCache; @@ -47,83 +53,83 @@ cNopacityDisplayChannelView::~cNopacityDisplayChannelView() { } void cNopacityDisplayChannelView::createOsd(void) { - osd = CreateOsd(geoManager->osdLeft, - geoManager->osdTop, - geoManager->osdWidth, + osd = CreateOsd(geoManager->osdLeft, + geoManager->osdTop, + geoManager->osdWidth, geoManager->osdHeight); } void cNopacityDisplayChannelView::CreatePixmaps(void) { - pixmapBackground = osd->CreatePixmap(1, - cRect(geoManager->channelX, + pixmapBackground = osd->CreatePixmap(1, + cRect(geoManager->channelX, geoManager->channelTop, geoManager->channelWidth, geoManager->channelHeight) ); - pixmapTop = osd->CreatePixmap(7, - cRect(geoManager->channelX, + pixmapTop = osd->CreatePixmap(7, + cRect(geoManager->channelX, geoManager->channelTop, geoManager->channelWidth, geoManager->channelHeight) ); - pixmapLogo = osd->CreatePixmap(3, - cRect(geoManager->channelX + geoManager->channelLogoX, + pixmapLogo = osd->CreatePixmap(3, + cRect(geoManager->channelX + geoManager->channelLogoX, geoManager->channelLogoY, geoManager->channelLogoWidth, geoManager->channelLogoHeight) ); - pixmapLogoBackground = osd->CreatePixmap(2, - cRect(geoManager->channelX + geoManager->channelLogoX, + pixmapLogoBackground = osd->CreatePixmap(2, + cRect(geoManager->channelX + geoManager->channelLogoX, geoManager->channelLogoY, geoManager->channelLogoWidth, geoManager->channelLogoHeight) - ); + ); pixmapChannelName = osd->CreatePixmap(2, cRect(geoManager->channelX + geoManager->channelContentX, geoManager->channelTop, geoManager->channelChannelNameWidth, geoManager->channelHeaderHeight) ); - pixmapDate = osd->CreatePixmap(2, - cRect(geoManager->channelX + geoManager->channelContentX + - geoManager->channelChannelNameWidth, + pixmapDate = osd->CreatePixmap(2, + cRect(geoManager->channelX + geoManager->channelContentX + + geoManager->channelChannelNameWidth, geoManager->channelTop, geoManager->channelDateWidth, geoManager->channelHeaderHeight) - ); - pixmapProgressBar = osd->CreatePixmap(2, - cRect(geoManager->channelX + geoManager->channelContentX, + ); + pixmapProgressBar = osd->CreatePixmap(2, + cRect(geoManager->channelX + geoManager->channelContentX, geoManager->channelTop + geoManager->channelHeaderHeight, geoManager->channelContentWidth, geoManager->channelProgressBarHeight) ); - pixmapEPGInfo = osd->CreatePixmap(2, - cRect(geoManager->channelX + geoManager->channelContentX, + pixmapEPGInfo = osd->CreatePixmap(2, + cRect(geoManager->channelX + geoManager->channelContentX, geoManager->channelTop + geoManager->channelHeaderHeight + geoManager->channelProgressBarHeight, geoManager->channelContentWidth, geoManager->channelEpgInfoHeight) ); int statusIconsWidth = 8 * statusIconSize + 6 * statusIconBorder; - int statusIconX = geoManager->osdWidth - - config.GetValue("channelBorderVertical") - - statusIconsWidth + int statusIconX = geoManager->osdWidth + - config.GetValue("channelBorderVertical") + - statusIconsWidth - 3*statusIconBorder; if (config.GetValue("logoPosition") == lpRight) statusIconX -= geoManager->channelLogoWidthTotal; - - pixmapStatusIcons = osd->CreatePixmap(3, - cRect(statusIconX, + + pixmapStatusIcons = osd->CreatePixmap(3, + cRect(statusIconX, geoManager->channelTop + geoManager->channelHeaderHeight + - geoManager->channelProgressBarHeight + + geoManager->channelProgressBarHeight + geoManager->channelEpgInfoHeight, statusIconsWidth, geoManager->channelFooterHeight) ); - pixmapStatusIconsBackground = osd->CreatePixmap(2, - cRect(statusIconX - 2*statusIconBorder, + pixmapStatusIconsBackground = osd->CreatePixmap(2, + cRect(statusIconX - 2*statusIconBorder, geoManager->channelTop + geoManager->channelHeaderHeight + - geoManager->channelProgressBarHeight + + geoManager->channelProgressBarHeight + geoManager->channelEpgInfoHeight + 1, statusIconsWidth + 3*statusIconBorder, geoManager->channelFooterHeight - 2) @@ -131,15 +137,15 @@ void cNopacityDisplayChannelView::CreatePixmaps(void) { int sourceInfoX = geoManager->channelContentX + 2 * statusIconBorder; if (config.GetValue("displaySignalStrength")) sourceInfoX +=geoManager->channelWidth * 0.2; - pixmapSourceInfo = osd->CreatePixmap(2, - cRect(sourceInfoX, + pixmapSourceInfo = osd->CreatePixmap(2, + cRect(sourceInfoX, geoManager->channelTop + geoManager->channelHeaderHeight + - geoManager->channelProgressBarHeight + + geoManager->channelProgressBarHeight + geoManager->channelEpgInfoHeight, geoManager->channelContentWidth * 0.3, geoManager->channelFooterHeight) ); - + if (config.GetValue("channelFadeTime")) { pixmapBackground->SetAlpha(0); pixmapTop->SetAlpha(0); @@ -212,12 +218,12 @@ void cNopacityDisplayChannelView::DrawBackground(void) { DrawBlendedBackground(pixmapBackground, backgroundX, backgroundWidth, - Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), + Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), true); DrawBlendedBackground(pixmapBackground, backgroundX, backgroundWidth, - Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), + Theme.Color(clrChannelBackground), Theme.Color(clrChannelBackBlend), false); } if (config.GetValue("roundedCornersChannel")) { @@ -254,11 +260,11 @@ void cNopacityDisplayChannelView::ClearChannelLogo(void) { void cNopacityDisplayChannelView::DrawChannelName(cString number, cString name) { cString channelString = cString::sprintf("%s %s", *number, *name); - pixmapChannelName->DrawText(cPoint(geoManager->channelHeaderHeight/2, - (geoManager->channelHeaderHeight-fontManager->channelHeader->Height())/2), - channelString, - Theme.Color(clrChannelHead), - clrTransparent, + pixmapChannelName->DrawText(cPoint(geoManager->channelHeaderHeight/2, + (geoManager->channelHeaderHeight-fontManager->channelHeader->Height())/2), + channelString, + Theme.Color(clrChannelHead), + clrTransparent, fontManager->channelHeader); } @@ -284,24 +290,24 @@ void cNopacityDisplayChannelView::DrawProgressBar(int Current, int Total) { int barHeight = pixmapProgressBar->ViewPort().Height()-8; if (barHeight%2 != 0) barHeight++; - if (barHeight < 3) + if (barHeight < 3) return; int barFullWidth = pixmapProgressBar->ViewPort().Width() - 20 - barHeight; if (Current > Total) Current = Total; if ((Current > 0) || (Total > 0)) { double percentSeen = ((double)Current) / (double)Total; - pixmapProgressBar->DrawEllipse(cRect(10, - 4, - barHeight, + pixmapProgressBar->DrawEllipse(cRect(10, + 4, + barHeight, barHeight), Theme.Color(clrChannelProgressBarBlend)); if (Current > 0) { tColor colAct = DrawProgressbarProgress(10 + barHeight/2, 4, barFullWidth * percentSeen, barHeight-1); - pixmapProgressBar->DrawEllipse(cRect(10 + barFullWidth * percentSeen, - 4, - barHeight, - barHeight), + pixmapProgressBar->DrawEllipse(cRect(10 + barFullWidth * percentSeen, + 4, + barHeight, + barHeight), colAct); } } @@ -311,21 +317,21 @@ void cNopacityDisplayChannelView::DrawProgressbarBackground(void) { int barHeight = pixmapProgressBar->ViewPort().Height()-8; if (barHeight%2 != 0) barHeight++; - if (barHeight < 3) + if (barHeight < 3) return; int barFullWidth = pixmapProgressBar->ViewPort().Width() - 20 - barHeight; - pixmapProgressBar->DrawEllipse(cRect(9, - 3, - barHeight+2, - barHeight+2), + pixmapProgressBar->DrawEllipse(cRect(9, + 3, + barHeight+2, + barHeight+2), Theme.Color(clrChannelProgressBarBack)); - pixmapProgressBar->DrawEllipse(cRect(9 + barFullWidth, - 3, barHeight+2, - barHeight+2), + pixmapProgressBar->DrawEllipse(cRect(9 + barFullWidth, + 3, barHeight+2, + barHeight+2), Theme.Color(clrChannelProgressBarBack)); - pixmapProgressBar->DrawRectangle(cRect(9 + barHeight/2, - 3, - barFullWidth, + pixmapProgressBar->DrawRectangle(cRect(9 + barHeight/2, + 3, + barFullWidth, barHeight+1), Theme.Color(clrChannelProgressBarBack)); } @@ -383,17 +389,17 @@ void cNopacityDisplayChannelView::DrawEPGInfo(const cEvent *e, bool present, boo } else { strSeen = cString::sprintf("%dmin", e->Duration()/60); } - + int startTimeWidth = fontManager->channelEPG->Width(*startTime); int epgWidth = fontManager->channelEPG->Width(*strEPG); int epgWidthShort = fontManager->channelEPGSmall->Width(*strEPGShort); int seenWidth = fontManager->channelEPG->Width(*strSeen); - + int widthRecIcon = 0; if (recording) { widthRecIcon = fontManager->channelEPGSmall->Width(" REC ") + indent/2; } - int spaceEPGText = geoManager->channelContentWidth - seenWidth + int spaceEPGText = geoManager->channelContentWidth - seenWidth - startTimeWidth - 3 * indent - widthRecIcon - fontManager->channelEPG->Width("..."); int spaceEPGTextSmall = spaceEPGText + widthRecIcon; @@ -403,27 +409,27 @@ void cNopacityDisplayChannelView::DrawEPGInfo(const cEvent *e, bool present, boo if (spaceEPGTextSmall < epgWidthShort) { strEPGShort = CutText(*strEPGShort, spaceEPGText, fontManager->channelEPGSmall).c_str(); } - + int lineHeight = geoManager->channelEpgInfoLineHeight; int yEPG = (present) ? 0 : 2 * lineHeight; int yEPGSmall = (present) ? lineHeight : 3 * lineHeight; int xEPG = 2 * indent + startTimeWidth; - + tColor fontColor = (present) ? Theme.Color(clrChannelEPG) : Theme.Color(clrChannelEPGNext); tColor fontColorInfo = (present) ? Theme.Color(clrChannelEPGInfo) : Theme.Color(clrChannelEPGInfoNext); pixmapEPGInfo->DrawText(cPoint(indent, yEPG), *startTime, fontColor, clrTransparent, fontManager->channelEPG); - + pixmapEPGInfo->DrawText(cPoint(xEPG + widthRecIcon, yEPG), *strEPG, fontColor, clrTransparent, fontManager->channelEPG); - + pixmapEPGInfo->DrawText(cPoint(xEPG, yEPGSmall), *strEPGShort, fontColorInfo, clrTransparent, fontManager->channelEPGSmall); - + int x = geoManager->channelContentWidth - 2 * indent - seenWidth; - + pixmapEPGInfo->DrawText(cPoint(x, yEPG), *strSeen, fontColor, clrTransparent, fontManager->channelEPG); - + //Recording Icon if (recording) { tColor clrRecIcon = (present)?Theme.Color(clrRecNow):Theme.Color(clrRecNext); @@ -443,12 +449,12 @@ void cNopacityDisplayChannelView::DrawStatusIcons(const cChannel *Channel) { pixmapStatusIconsBackground->Fill(Theme.Color(clrStatusIconsBack)); DrawRoundedCorners(pixmapStatusIconsBackground, 5, - 0, - 0, + 0, + 0, pixmapStatusIconsBackground->ViewPort().Width(), pixmapStatusIconsBackground->ViewPort().Height() ); - + isRadioChannel = ((!Channel->Vpid())&&(Channel->Apid(0)))?true:false; int iconX = 0; @@ -463,7 +469,7 @@ void cNopacityDisplayChannelView::DrawStatusIcons(const cChannel *Channel) { } iconX += statusIconBorder + statusIconSize; - + if (Channel->Apid(0)) { cImage *imgIcon = imgCache->GetSkinIcon("skinIcons/stereoon", statusIconSize, statusIconSize); if (imgIcon) @@ -474,8 +480,8 @@ void cNopacityDisplayChannelView::DrawStatusIcons(const cChannel *Channel) { pixmapStatusIcons->DrawImage(cPoint(iconX,statusIconBorder), *imgIcon); } - iconX += statusIconBorder + statusIconSize; - + iconX += statusIconBorder + statusIconSize; + if (Channel->Dpid(0)) { cImage *imgIcon = imgCache->GetSkinIcon("skinIcons/dolbyon", statusIconSize, statusIconSize); if (imgIcon) @@ -487,7 +493,7 @@ void cNopacityDisplayChannelView::DrawStatusIcons(const cChannel *Channel) { } iconX += statusIconBorder + statusIconSize; - + if (Channel->Ca()) { cImage *imgIcon = imgCache->GetSkinIcon("skinIcons/crypted", statusIconSize, statusIconSize); if (imgIcon) @@ -499,7 +505,7 @@ void cNopacityDisplayChannelView::DrawStatusIcons(const cChannel *Channel) { } iconX += statusIconBorder + statusIconSize; - + if (cRecordControls::Active()) { cImage *imgIcon = imgCache->GetSkinIcon("skinIcons/recon", statusIconSize, statusIconSize); if (imgIcon) @@ -557,8 +563,8 @@ cString cNopacityDisplayChannelView::GetScreenResolutionIcon(void) { } void cNopacityDisplayChannelView::ClearStatusIcons(void) { - pixmapStatusIcons->Fill(clrTransparent); - pixmapStatusIconsBackground->Fill(clrTransparent); + pixmapStatusIcons->Fill(clrTransparent); + pixmapStatusIconsBackground->Fill(clrTransparent); } void cNopacityDisplayChannelView::DrawPoster(const cEvent *event, bool initial) { @@ -583,8 +589,8 @@ void cNopacityDisplayChannelView::DrawPoster(const cEvent *event, bool initial) } int border = config.GetValue("channelPosterBorder"); pixmapPoster = osd->CreatePixmap(1, cRect(config.GetValue("channelBorderVertical"), - config.GetValue("channelBorderBottom"), - mediaWidth + 2 * border, + config.GetValue("channelBorderBottom"), + mediaWidth + 2 * border, mediaHeight + 2 * border)); if (initial && config.GetValue("channelFadeTime")) pixmapPoster->SetAlpha(0); @@ -594,7 +600,7 @@ void cNopacityDisplayChannelView::DrawPoster(const cEvent *event, bool initial) pixmapPoster->DrawImage(cPoint(border, border), imgLoader.GetImage()); DrawRoundedCorners(pixmapPoster, border, 0, 0, pixmapPoster->ViewPort().Width(), pixmapPoster->ViewPort().Height()); } else { - pixmapPoster->Fill(clrTransparent); + pixmapPoster->Fill(clrTransparent); } } } @@ -610,30 +616,30 @@ void cNopacityDisplayChannelView::DrawSignalMeter(void) { if (imgSignal) { signalWidth = imgSignal->Width(); signalHeight = imgSignal->Height(); - int signalMeterY = geoManager->channelFooterY + + int signalMeterY = geoManager->channelFooterY + (geoManager->channelFooterHeight - 2*signalHeight - 5)/2; - int labelWidth = max(fontInfoline->Width(*signalStrength), + int labelWidth = max(fontInfoline->Width(*signalStrength), fontInfoline->Width(*signalQuality)) + 2; signalX = geoManager->channelFooterHeight / 2 + labelWidth; - pixmapSignalStrength = osd->CreatePixmap(3, + pixmapSignalStrength = osd->CreatePixmap(3, cRect(geoManager->channelContentX + signalX, signalMeterY + 2, - signalWidth + 2, + signalWidth + 2, signalHeight + 2)); - pixmapSignalQuality = osd->CreatePixmap(3, + pixmapSignalQuality = osd->CreatePixmap(3, cRect(geoManager->channelContentX + signalX, - signalMeterY + signalHeight + 5, - signalWidth + 2, + signalMeterY + signalHeight + 5, + signalWidth + 2, signalHeight + 2)); - pixmapSignalMeter = osd->CreatePixmap(4, + pixmapSignalMeter = osd->CreatePixmap(4, cRect(geoManager->channelContentX + signalX + 1, - signalMeterY + 3, signalWidth, + signalMeterY + 3, signalWidth, 2*signalHeight + 3)); - pixmapSignalLabel = osd->CreatePixmap(3, - cRect(geoManager->channelContentX + pixmapSignalLabel = osd->CreatePixmap(3, + cRect(geoManager->channelContentX + geoManager->channelFooterHeight / 2, signalMeterY + 2, - labelWidth, + labelWidth, 2*signalHeight + 3)); pixmapSignalStrength->Fill(Theme.Color(clrProgressBarBack)); pixmapSignalQuality->Fill(Theme.Color(clrProgressBarBack)); @@ -712,22 +718,22 @@ void cNopacityDisplayChannelView::DrawChannelGroups(const cChannel *Channel, cSt ySep = (geoManager->channelContentHeight-fontManager->channelChannelGroup->Height())/2 - fontManager->channelChannelGroup->Height()/2; int widthSep = fontManager->channelChannelGroup->Width(*ChannelName); - + if (!config.GetValue("displayPrevNextChannelGroup")) { xSep = (geoManager->channelContentWidth - widthSep)/2; pixmapEPGInfo->DrawText(cPoint(xSep, ySep), *ChannelName, Theme.Color(clrChannelHead), clrTransparent, fontManager->channelChannelGroup); return; } - + int spaceSep = 4 * geoManager->channelContentWidth / 10; int spaceNextPrev = (geoManager->channelContentWidth - spaceSep - 2*prevNextIconSize - 10) / 2; - + int xPrev = 0; int xPrevIcon = spaceNextPrev; xSep = xPrevIcon + prevNextIconSize; int xNextIcon = xSep + spaceSep; int xNext = xNextIcon + prevNextIconSize + 10; - + std::string strSep = *ChannelName; if (widthSep > spaceSep) strSep = CutText(strSep, spaceSep, fontManager->channelChannelGroup); @@ -762,7 +768,7 @@ void cNopacityDisplayChannelView::DrawChannelGroups(const cChannel *Channel, cSt std::string cNopacityDisplayChannelView::GetChannelSep(const cChannel *channel, bool prev) { std::string sepName = ""; - const cChannel *sep = prev ? Channels.Prev(channel) : + const cChannel *sep = prev ? Channels.Prev(channel) : Channels.Next(channel); for (; sep; (prev)?(sep = Channels.Prev(sep)):(sep = Channels.Next(sep))) { if (sep->GroupSep()) { @@ -779,7 +785,7 @@ void cNopacityDisplayChannelView::DrawSourceInfo(const cChannel *Channel) { if (source) channelInfo = cString::sprintf("%s - %s", *cSource::ToString(source->Code()), source->Description()); int textY = (geoManager->channelFooterHeight - fontManager->channelSourceInfo->Height()) / 2; - pixmapSourceInfo->DrawText(cPoint(0, textY), channelInfo, Theme.Color(clrChannelHead), clrTransparent, fontManager->channelSourceInfo); + pixmapSourceInfo->DrawText(cPoint(0, textY), channelInfo, Theme.Color(clrChannelHead), clrTransparent, fontManager->channelSourceInfo); } void cNopacityDisplayChannelView::ClearSourceInfo(void) { diff --git a/displaychannelview.h b/displaychannelview.h index c4ce1a6..0bd3eaf 100644 --- a/displaychannelview.h +++ b/displaychannelview.h @@ -1,6 +1,8 @@ #ifndef __NOPACITY_DISPLAYCHANNELVIEW_H #define __NOPACITY_DISPLAYCHANNELVIEW_H +#include "imagecache.h" +#include <vdr/osd.h> class cNopacityDisplayChannelView { private: diff --git a/displaymenu.c b/displaymenu.c index ba4b5c8..c0bbd0a 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -5,14 +5,17 @@ namespace PluginRemoteTimers { } } +#include "displaymenuview.h" #include "displaymenu.h" +#include "config.h" #include <string> +#include "services/epgsearch.h" cNopacityDisplayMenu::cNopacityDisplayMenu(cImageCache *imgCache) { this->imgCache = imgCache; menuCategoryLast = mcUndefined; FadeTime = config.GetValue("menuFadeTime"); - FrameTime = FadeTime / 10; + FrameTime = FadeTime / 10; initial = true; initMenu = true; diskUsageDrawn = false; @@ -45,7 +48,6 @@ cNopacityDisplayMenu::~cNopacityDisplayMenu() { timers.Clear(); delete osd; cDevice::PrimaryDevice()->ScaleVideo(cRect::Null); - menuActive = false; } void cNopacityDisplayMenu::DrawDisk(void) { @@ -98,7 +100,7 @@ void cNopacityDisplayMenu::DrawTimers(bool timersChanged, int numConflicts) { drawRemoteTimers = pRemoteTimers->Service("RemoteTimers::RefreshTimers-v1.0", &errorMsg); } timers.Clear(); - cSortedTimers SortedTimers; + cSortedTimers SortedTimers; //if remotetimers plugin is available, take timers also from him if (drawRemoteTimers) { cTimer* remoteTimer = NULL; @@ -143,7 +145,7 @@ void cNopacityDisplayMenu::DrawTimers(bool timersChanged, int numConflicts) { } else { for (cNopacityTimer *t = timers.First(); t; t = timers.Next(t)) { t->Show(); - } + } } timersDrawn = true; } @@ -201,7 +203,7 @@ int cNopacityDisplayMenu::MaxItems(void) { maxItems = config.GetValue("numDefaultMenuItems"); break; default: - maxItems = config.GetValue("numDefaultMenuItems"); + maxItems = config.GetValue("numDefaultMenuItems"); } currentNumItems = maxItems; return maxItems; @@ -259,7 +261,7 @@ void cNopacityDisplayMenu::SetMenuCategory(eMenuCategory MenuCategory) { if (config.GetValue("showTimers")) { for (cNopacityTimer *t = timers.First(); t; t = timers.Next(t)) { t->Hide(); - } + } timersDrawn = false; } } @@ -369,8 +371,8 @@ void cNopacityDisplayMenu::SetMessage(eMessageType Type, const char *Text) { } } -bool cNopacityDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Current, - bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch) { +bool cNopacityDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Current, + bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch) { if (!config.GetValue("narrowScheduleMenu")) return false; if ((initMenu)&&(Index > menuItemIndexLast)) { @@ -411,7 +413,7 @@ bool cNopacityDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Cur return true; } -bool cNopacityDisplayMenu::SetItemTimer(const cTimer *Timer, int Index, bool Current, bool Selectable) { +bool cNopacityDisplayMenu::SetItemTimer(const cTimer *Timer, int Index, bool Current, bool Selectable) { if (!config.GetValue("narrowTimerMenu")) return false; if ((initMenu)&&(Index > menuItemIndexLast)) { @@ -449,7 +451,7 @@ bool cNopacityDisplayMenu::SetItemTimer(const cTimer *Timer, int Index, bool Cur return true; } -bool cNopacityDisplayMenu::SetItemChannel(const cChannel *Channel, int Index, bool Current, bool Selectable, bool WithProvider) { +bool cNopacityDisplayMenu::SetItemChannel(const cChannel *Channel, int Index, bool Current, bool Selectable, bool WithProvider) { if (!config.GetValue("narrowChannelMenu")) return false; if ((initMenu)&&(Index > menuItemIndexLast)) { @@ -489,7 +491,7 @@ bool cNopacityDisplayMenu::SetItemChannel(const cChannel *Channel, int Index, bo return true; } -bool cNopacityDisplayMenu::SetItemRecording(const cRecording *Recording, int Index, bool Current, bool Selectable, +bool cNopacityDisplayMenu::SetItemRecording(const cRecording *Recording, int Index, bool Current, bool Selectable, int Level, int Total, int New) { if (!config.GetValue("narrowRecordingMenu")) return false; @@ -634,8 +636,8 @@ void cNopacityDisplayMenu::SplitItem(const char *Text, cString *strItems, int *t } } -int cNopacityDisplayMenu::Tab(int n) { - return (n >= 0 && n < MaxTabs) ? menuView->mytabs[n] : 0; +int cNopacityDisplayMenu::Tab(int n) { + return (n >= 0 && n < MaxTabs) ? menuView->mytabs[n] : 0; } void cNopacityDisplayMenu::SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, int Tab5) { @@ -657,7 +659,7 @@ void cNopacityDisplayMenu::SetScrollbar(int Total, int Offset) { } double height = (double)MaxItems()/(double)Total; double offset = (double)Offset/(double)Total; - + menuView->DrawScrollbar(height, offset); } diff --git a/displaymenu.h b/displaymenu.h index 420cbe5..f88543b 100644 --- a/displaymenu.h +++ b/displaymenu.h @@ -1,6 +1,10 @@ #ifndef __NOPACITY_DISPLAYMENU_H #define __NOPACITY_DISPLAYMENU_H +#include "nopacity.h" +#include "menuitem.h" +#include <vdr/thread.h> + class cNopacityDisplayMenu : public cSkinDisplayMenu , cThread { private: cImageCache *imgCache; diff --git a/displaymenuview.c b/displaymenuview.c index 429d35c..75309fd 100644 --- a/displaymenuview.c +++ b/displaymenuview.c @@ -35,14 +35,14 @@ void cNopacityDisplayMenuView::SetDescriptionTextWindowSize(void) { int xSchedules, xRecordings, xChannels; int widthSchedules, widthRecordings, widthChannels; if (config.GetValue("menuAdjustLeft")) { - xSchedules = 2 * geoManager->menuSpace - + geoManager->menuContentWidthSchedules + xSchedules = 2 * geoManager->menuSpace + + geoManager->menuContentWidthSchedules + geoManager->menuWidthScrollbar; - xRecordings = 2 * geoManager->menuSpace - + geoManager->menuContentWidthRecordings + xRecordings = 2 * geoManager->menuSpace + + geoManager->menuContentWidthRecordings + geoManager->menuWidthScrollbar; - xChannels = 2 * geoManager->menuSpace - + geoManager->menuContentWidthChannels + xChannels = 2 * geoManager->menuSpace + + geoManager->menuContentWidthChannels + geoManager->menuWidthScrollbar; widthSchedules = geoManager->osdWidth - xSchedules - geoManager->menuSpace; widthRecordings = geoManager->osdWidth - xRecordings - geoManager->menuSpace; @@ -51,17 +51,17 @@ void cNopacityDisplayMenuView::SetDescriptionTextWindowSize(void) { xSchedules = geoManager->menuSpace; xRecordings = geoManager->menuSpace; xChannels = geoManager->menuSpace; - widthSchedules = geoManager->osdWidth - - geoManager->menuContentWidthSchedules - - geoManager->menuWidthScrollbar + widthSchedules = geoManager->osdWidth + - geoManager->menuContentWidthSchedules + - geoManager->menuWidthScrollbar - 2 * geoManager->menuSpace; - widthRecordings = geoManager->osdWidth - - geoManager->menuContentWidthRecordings - - geoManager->menuWidthScrollbar + widthRecordings = geoManager->osdWidth + - geoManager->menuContentWidthRecordings + - geoManager->menuWidthScrollbar - 2 * geoManager->menuSpace; - widthChannels = geoManager->osdWidth - - geoManager->menuContentWidthChannels - - geoManager->menuWidthScrollbar + widthChannels = geoManager->osdWidth + - geoManager->menuContentWidthChannels + - geoManager->menuWidthScrollbar - 2 * geoManager->menuSpace; } int heightFull = geoManager->menuContentHeight - 2*geoManager->menuSpace; @@ -129,7 +129,7 @@ int cNopacityDisplayMenuView::GetContentWidth(eMenuCategory menuCat) { else return geoManager->menuContentWidthFull; default: - return geoManager->menuContentWidthFull; + return geoManager->menuContentWidthFull; } return geoManager->menuContentWidthFull; } @@ -304,7 +304,7 @@ void cNopacityDisplayMenuView::DrawBorderDecoration() { pixmapFooter->Fill(clrTransparent); pixmapFooterBack->Fill(Theme.Color(clrMenuBack)); pixmapButtonsText->Fill(clrTransparent); - + int borderWidth = 2; int radius = 10; @@ -433,7 +433,7 @@ int cNopacityDisplayMenuView::DrawHeaderIcon(eMenuCategory menuCat) { default: drawIcon = false; } - + int left = 0; if (drawIcon) { int iconSize = geoManager->menuHeaderHeight - 4; @@ -452,9 +452,9 @@ int cNopacityDisplayMenuView::DrawHeaderIcon(eMenuCategory menuCat) { int cNopacityDisplayMenuView::ShowHeaderIconChannelLogo(const char *Title) { int left = 0; int logoHeight = geoManager->menuHeaderHeight - 4; - cSize logoSize = ScaleToFit(1000, - logoHeight, - config.GetValue("logoWidth"), + cSize logoSize = ScaleToFit(1000, + logoHeight, + config.GetValue("logoWidth"), config.GetValue("logoHeight")); int logoWidth = logoSize.Width(); int iconX = (config.GetValue("menuAdjustLeft")) ? 0 : (geoManager->osdWidth - logoWidth); @@ -486,13 +486,13 @@ void cNopacityDisplayMenuView::DestroyHeaderIcon(void) { void cNopacityDisplayMenuView::DrawHeaderLabel(int left, cString label) { pixmapHeaderLabel->Fill(clrTransparent); int labelW = fontManager->menuHeader->Width(label); - int labelX = (config.GetValue("menuAdjustLeft")) ? (left) + int labelX = (config.GetValue("menuAdjustLeft")) ? (left) : (geoManager->osdWidth - geoManager->menuDateWidth - labelW - left - 2*geoManager->menuSpace); int labelY = (geoManager->menuHeaderHeight - fontManager->menuHeader->Height())/2; pixmapHeaderLabel->DrawText(cPoint(labelX, labelY), - *label, - Theme.Color(clrMenuFontHeader), - clrTransparent, + *label, + Theme.Color(clrMenuFontHeader), + clrTransparent, fontManager->menuHeader); } @@ -682,7 +682,7 @@ void cNopacityDisplayMenuView::DrawMessage(eMessageType Type, const char *Text) ClearMessage(); } pixmapStatus = osd->CreatePixmap(7, cRect(0.1*geoManager->osdWidth, 0.8*geoManager->osdHeight, geoManager->menuMessageWidth, geoManager->menuMessageHeight)); - + pixmapStatus->Fill(clrTransparent); if (config.GetValue("displayType") == dtGraphical) { cImage *imgBack = imgCache->GetSkinElement(seType); @@ -701,11 +701,11 @@ void cNopacityDisplayMenuView::DrawMessage(eMessageType Type, const char *Text) } int textWidth = fontManager->menuMessage->Width(Text); tColor clrFontBack = (config.GetValue("displayType") != dtFlat)?(clrTransparent):col; - pixmapStatus->DrawText(cPoint((geoManager->menuMessageWidth - textWidth) / 2, - (geoManager->menuMessageHeight - fontManager->menuMessage->Height()) / 2), - Text, - colFont, - clrFontBack, + pixmapStatus->DrawText(cPoint((geoManager->menuMessageWidth - textWidth) / 2, + (geoManager->menuMessageHeight - fontManager->menuMessage->Height()) / 2), + Text, + colFont, + clrFontBack, fontManager->menuMessage); } @@ -723,7 +723,7 @@ void cNopacityDisplayMenuView::SetDetailViewSize(eDetailViewType detailViewType, int top = 0; int contentBorder = 30; int detailHeaderHeight = 0; - + switch (detailViewType) { case dvEvent: detailHeaderHeight = max(config.GetValue("logoHeightOriginal"), config.GetValue("epgImageHeight"))+4; @@ -734,7 +734,7 @@ void cNopacityDisplayMenuView::SetDetailViewSize(eDetailViewType detailViewType, contentBorder = config.GetValue("borderDetailedRecordings"); break; case dvText: - detailHeaderHeight = 0; + detailHeaderHeight = 0; break; default: break; diff --git a/displaymenuview.h b/displaymenuview.h index e2f64fc..ca0e61f 100644 --- a/displaymenuview.h +++ b/displaymenuview.h @@ -1,6 +1,15 @@ #ifndef __NOPACITY_DISPLAYMENUVIEW_H #define __NOPACITY_DISPLAYMENUVIEW_H +#include "timers.h" +#include "menudetailview.h" +#include <vdr/skins.h> +#include <vdr/videodir.h> +#include "config.h" +#include "helpers.h" +#include "imageloader.h" + + enum eDetailViewType {dvEvent = 0, dvRecording, dvText}; class cNopacityDisplayMenuView { diff --git a/displaymessage.c b/displaymessage.c index 2dae835..8d85f8b 100644 --- a/displaymessage.c +++ b/displaymessage.c @@ -1,4 +1,7 @@ #include "displaymessage.h" +#include "config.h" +#include "imageloader.h" +#include "helpers.h" cNopacityDisplayMessage::cNopacityDisplayMessage(cImageCache *imgCache) { this->imgCache = imgCache; @@ -50,7 +53,7 @@ void cNopacityDisplayMessage::SetMessage(eMessageType Type, const char *Text) { seType = seMessageError; break; } - + pixmap->Fill(clrTransparent); if (config.GetValue("displayType") == dtGraphical) { pixmapBackground->Fill(clrTransparent); @@ -69,11 +72,11 @@ void cNopacityDisplayMessage::SetMessage(eMessageType Type, const char *Text) { } } int textWidth = fontManager->messageText->Width(Text); - pixmap->DrawText(cPoint((geoManager->messageWidth - textWidth) / 2, - (geoManager->messageHeight - fontManager->messageText->Height()) / 2), - Text, - colFont, - clrTransparent, + pixmap->DrawText(cPoint((geoManager->messageWidth - textWidth) / 2, + (geoManager->messageHeight - fontManager->messageText->Height()) / 2), + Text, + colFont, + clrTransparent, fontManager->messageText); if (FadeTime) Start(); diff --git a/displaymessage.h b/displaymessage.h index dc53d5f..fc1d5b0 100644 --- a/displaymessage.h +++ b/displaymessage.h @@ -1,5 +1,10 @@ #ifndef __NOPACITY_DISPLAYMESSAGE_H #define __NOPACITY_DISPLAYMESSAGE_H + +#include <vdr/thread.h> +#include <vdr/skins.h> +#include "imagecache.h" + class cNopacityDisplayMessage : public cSkinDisplayMessage , cThread { private: cOsd *osd; diff --git a/displayreplay.c b/displayreplay.c index cbd6a92..12fcd66 100644 --- a/displayreplay.c +++ b/displayreplay.c @@ -1,4 +1,7 @@ #include "displayreplay.h" +#include "config.h" +#include "helpers.h" +#include "imageloader.h" cNopacityDisplayReplay::cNopacityDisplayReplay(cImageCache *imgCache, bool ModeOnly) { this->imgCache = imgCache; @@ -37,102 +40,102 @@ cNopacityDisplayReplay::~cNopacityDisplayReplay() { } void cNopacityDisplayReplay::createOSD(void) { - int top = geoManager->osdTop - + geoManager->osdHeight - - geoManager->replayHeight + int top = geoManager->osdTop + + geoManager->osdHeight + - geoManager->replayHeight - config.GetValue("replayBorderBottom"); - osd = CreateOsd(geoManager->osdLeft + config.GetValue("replayBorderVertical"), - top, - geoManager->replayWidth, + osd = CreateOsd(geoManager->osdLeft + config.GetValue("replayBorderVertical"), + top, + geoManager->replayWidth, geoManager->replayHeight); } void cNopacityDisplayReplay::CreatePixmaps(void) { if (!modeOnly) { - pixmapBackground = osd->CreatePixmap(1, cRect(0, - 0, - geoManager->replayWidth, + pixmapBackground = osd->CreatePixmap(1, cRect(0, + 0, + geoManager->replayWidth, geoManager->replayHeight)); - pixmapTop = osd->CreatePixmap(7, cRect(0, - 0, - geoManager->replayWidth, + pixmapTop = osd->CreatePixmap(7, cRect(0, + 0, + geoManager->replayWidth, geoManager->replayHeight)); - pixmapInfo = osd->CreatePixmap(2, cRect(0, - 0, - geoManager->replayInfoWidth, + pixmapInfo = osd->CreatePixmap(2, cRect(0, + 0, + geoManager->replayInfoWidth, geoManager->replayHeaderHeight)); - pixmapDate = osd->CreatePixmap(2, cRect(geoManager->replayInfoWidth, - 0, - geoManager->replayDateWidth, + pixmapDate = osd->CreatePixmap(2, cRect(geoManager->replayInfoWidth, + 0, + geoManager->replayDateWidth, geoManager->replayHeaderHeight)); - pixmapInfo2 = osd->CreatePixmap(2, cRect(0, - geoManager->replayHeaderHeight, - geoManager->replayInfoWidth, + pixmapInfo2 = osd->CreatePixmap(2, cRect(0, + geoManager->replayHeaderHeight, + geoManager->replayInfoWidth, geoManager->replayInfo2Height)); - pixmapProgressBar = osd->CreatePixmap(2, cRect(0, - geoManager->replayHeaderHeight - + geoManager->replayInfo2Height, - geoManager->replayWidth, + pixmapProgressBar = osd->CreatePixmap(2, cRect(0, + geoManager->replayHeaderHeight + + geoManager->replayInfo2Height, + geoManager->replayWidth, geoManager->replayProgressBarHeight)); - pixmapCurrent = osd->CreatePixmap(3, cRect(0, - geoManager->replayHeaderHeight - + geoManager->replayInfo2Height + pixmapCurrent = osd->CreatePixmap(3, cRect(0, + geoManager->replayHeaderHeight + + geoManager->replayInfo2Height + geoManager->replayProgressBarHeight, - geoManager->replayWidth/5, + geoManager->replayWidth/5, geoManager->replayCurrentHeight)); - pixmapTotal = osd->CreatePixmap(3, cRect(4*geoManager->replayWidth/5, - geoManager->replayHeaderHeight - + geoManager->replayInfo2Height - + geoManager->replayProgressBarHeight, - geoManager->replayWidth/5, + pixmapTotal = osd->CreatePixmap(3, cRect(4*geoManager->replayWidth/5, + geoManager->replayHeaderHeight + + geoManager->replayInfo2Height + + geoManager->replayProgressBarHeight, + geoManager->replayWidth/5, geoManager->replayCurrentHeight)); pixmapScreenRes = osd->CreatePixmap(5, cRect(geoManager->replayResolutionX, geoManager->replayResolutionY, geoManager->replayResolutionSize * 3, geoManager->replayResolutionSize)); - pixmapJump = osd->CreatePixmap(4, cRect(geoManager->replayJumpX, - geoManager->replayJumpY, - geoManager->replayJumpWidth, + pixmapJump = osd->CreatePixmap(4, cRect(geoManager->replayJumpX, + geoManager->replayJumpY, + geoManager->replayJumpWidth, geoManager->replayJumpHeight)); } - - int controlY = geoManager->replayHeaderHeight - + geoManager->replayInfo2Height + + int controlY = geoManager->replayHeaderHeight + + geoManager->replayInfo2Height + geoManager->replayProgressBarHeight; int iconBorder = geoManager->replayIconBorder; int iconSize = geoManager->replayIconSize; int iconWidth = 2 * iconBorder + iconSize; if (!modeOnly) { - pixmapControls = osd->CreatePixmap(2, cRect(0, - controlY, - geoManager->replayWidth, + pixmapControls = osd->CreatePixmap(2, cRect(0, + controlY, + geoManager->replayWidth, geoManager->replayControlsHeight)); } else { - pixmapControls = osd->CreatePixmap(2, cRect((geoManager->replayWidth - - (5 * iconWidth))/2, - controlY - 10, - 5 * iconWidth, + pixmapControls = osd->CreatePixmap(2, cRect((geoManager->replayWidth + - (5 * iconWidth))/2, + controlY - 10, + 5 * iconWidth, geoManager->replayControlsHeight + 20)); } int iconX = (geoManager->replayWidth - 4 * iconWidth)/2; - pixmapRew = osd->CreatePixmap(4, cRect(iconX + iconBorder, - controlY + iconBorder, - iconSize, - iconSize)); - pixmapPause = osd->CreatePixmap(4, cRect(iconX + iconSize + 3*iconBorder, - controlY + iconBorder, - iconSize, - iconSize)); - pixmapPlay = osd->CreatePixmap(4, cRect(iconX + 2*iconSize + 3*iconBorder, - controlY + iconBorder, - iconSize, - iconSize)); - pixmapFwd = osd->CreatePixmap(4, cRect(iconX + 3*iconSize + 3*iconBorder, - controlY + iconBorder, - iconSize, - iconSize)); - + pixmapRew = osd->CreatePixmap(4, cRect(iconX + iconBorder, + controlY + iconBorder, + iconSize, + iconSize)); + pixmapPause = osd->CreatePixmap(4, cRect(iconX + iconSize + 3*iconBorder, + controlY + iconBorder, + iconSize, + iconSize)); + pixmapPlay = osd->CreatePixmap(4, cRect(iconX + 2*iconSize + 3*iconBorder, + controlY + iconBorder, + iconSize, + iconSize)); + pixmapFwd = osd->CreatePixmap(4, cRect(iconX + 3*iconSize + 3*iconBorder, + controlY + iconBorder, + iconSize, + iconSize)); + if (FadeTime) { if (!modeOnly) { pixmapBackground->SetAlpha(0); @@ -147,9 +150,9 @@ void cNopacityDisplayReplay::CreatePixmaps(void) { pixmapJump->SetAlpha(0); } pixmapControls->SetAlpha(0); - pixmapRew->SetAlpha(0); - pixmapPause->SetAlpha(0); - pixmapPlay->SetAlpha(0); + pixmapRew->SetAlpha(0); + pixmapPause->SetAlpha(0); + pixmapPlay->SetAlpha(0); pixmapFwd->SetAlpha(0); } else if (!modeOnly) { int alphaBack = (100 - config.GetValue("channelBackgroundTransparency"))*255/100; @@ -167,21 +170,21 @@ void cNopacityDisplayReplay::DrawBackground(void) { if (imgTop) pixmapTop->DrawImage(cPoint(0,0), *imgTop); } else { - pixmapBackground->Fill(Theme.Color(clrReplayBackground)); + pixmapBackground->Fill(Theme.Color(clrReplayBackground)); pixmapTop->Fill(clrTransparent); - if (config.GetValue("displayType") == dtBlending && + if (config.GetValue("displayType") == dtBlending && (Theme.Color(clrReplayBackground) != Theme.Color(clrReplayBackBlend))) { - DrawBlendedBackground(pixmapBackground, + DrawBlendedBackground(pixmapBackground, 0, geoManager->replayWidth, Theme.Color(clrReplayBackground), - Theme.Color(clrReplayBackBlend), + Theme.Color(clrReplayBackBlend), true); - DrawBlendedBackground(pixmapBackground, + DrawBlendedBackground(pixmapBackground, 0, geoManager->replayWidth, Theme.Color(clrReplayBackground), - Theme.Color(clrReplayBackBlend), + Theme.Color(clrReplayBackBlend), false); } if (config.GetValue("roundedCornersChannel")) { @@ -235,10 +238,10 @@ void cNopacityDisplayReplay::DrawDate(void) { int x = geoManager->replayDateWidth - strDateWidth - geoManager->replayHeaderHeight/2; int y = (geoManager->replayHeaderHeight - strDateHeight) / 2; pixmapDate->Fill(clrTransparent); - pixmapDate->DrawText(cPoint(x, y), - curDate, - Theme.Color(clrReplayHead), - clrTransparent, + pixmapDate->DrawText(cPoint(x, y), + curDate, + Theme.Color(clrReplayHead), + clrTransparent, fontManager->replayText); lastDate = curDate; } @@ -282,25 +285,25 @@ void cNopacityDisplayReplay::SetRecording(const cRecording *Recording) { 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(geoManager->replayHeaderHeight/2, - max((geoManager->replayInfo2Height - - fontManager->replayText->Height())/2 - 10, - 0)), - *info2, + pixmapInfo2->DrawText(cPoint(geoManager->replayHeaderHeight/2, + max((geoManager->replayInfo2Height + - fontManager->replayText->Height())/2 - 10, + 0)), + *info2, Theme.Color(clrReplayDescription), - clrTransparent, + clrTransparent, fontManager->replayText); DrawScreenResolution(); } void cNopacityDisplayReplay::SetTitle(const char *Title) { pixmapInfo->Fill(clrTransparent); - pixmapInfo->DrawText(cPoint(geoManager->replayHeaderHeight/2, 0), - Title, - Theme.Color(clrReplayHead), - clrTransparent, + pixmapInfo->DrawText(cPoint(geoManager->replayHeaderHeight/2, 0), + Title, + Theme.Color(clrReplayHead), + clrTransparent, fontManager->replayHeader); } @@ -362,34 +365,34 @@ void cNopacityDisplayReplay::SetProgress(int Current, int Total) { if (geoManager->replayProgressBarHeight < 5) return; int barWidth = geoManager->replayWidth - 2*geoManager->replayProgressBarHeight; - cProgressBar pb(barWidth, - geoManager->replayProgressBarHeight-2, - Current, - Total, - marks, - Theme.Color(clrReplayProgressSeen), - Theme.Color(clrReplayProgressRest), - Theme.Color(clrReplayProgressSelected), - Theme.Color(clrReplayProgressMark), + cProgressBar pb(barWidth, + geoManager->replayProgressBarHeight-2, + Current, + Total, + marks, + Theme.Color(clrReplayProgressSeen), + Theme.Color(clrReplayProgressRest), + Theme.Color(clrReplayProgressSelected), + Theme.Color(clrReplayProgressMark), Theme.Color(clrReplayProgressCurrent)); - pixmapProgressBar->DrawEllipse(cRect(geoManager->replayProgressBarHeight/2, - 0, - geoManager->replayProgressBarHeight, + pixmapProgressBar->DrawEllipse(cRect(geoManager->replayProgressBarHeight/2, + 0, + geoManager->replayProgressBarHeight, geoManager->replayProgressBarHeight), Theme.Color(clrProgressBarBack)); - pixmapProgressBar->DrawEllipse(cRect(barWidth + geoManager->replayProgressBarHeight/2, - 0, - geoManager->replayProgressBarHeight, + pixmapProgressBar->DrawEllipse(cRect(barWidth + geoManager->replayProgressBarHeight/2, + 0, + geoManager->replayProgressBarHeight, geoManager->replayProgressBarHeight), Theme.Color(clrReplayProgressRest)); - pixmapProgressBar->DrawRectangle(cRect(geoManager->replayProgressBarHeight, - 0, - barWidth, + pixmapProgressBar->DrawRectangle(cRect(geoManager->replayProgressBarHeight, + 0, + barWidth, geoManager->replayProgressBarHeight), Theme.Color(clrProgressBarBack)); - pixmapProgressBar->DrawEllipse(cRect(geoManager->replayProgressBarHeight/2+1, - 1, - geoManager->replayProgressBarHeight-1, + pixmapProgressBar->DrawEllipse(cRect(geoManager->replayProgressBarHeight/2+1, + 1, + geoManager->replayProgressBarHeight-1, geoManager->replayProgressBarHeight-2), Theme.Color(clrReplayProgressSeen)); pixmapProgressBar->DrawBitmap(cPoint(geoManager->replayProgressBarHeight, 1), pb); @@ -397,34 +400,34 @@ void cNopacityDisplayReplay::SetProgress(int Current, int Total) { void cNopacityDisplayReplay::SetCurrent(const char *Current) { pixmapCurrent->Fill(clrTransparent); - pixmapCurrent->DrawText(cPoint(geoManager->replayHeaderHeight/2, 0), - Current, - Theme.Color(clrReplayCurrentTotal), - clrTransparent, + pixmapCurrent->DrawText(cPoint(geoManager->replayHeaderHeight/2, 0), + Current, + Theme.Color(clrReplayCurrentTotal), + clrTransparent, fontManager->replayText); } void cNopacityDisplayReplay::SetTotal(const char *Total) { pixmapTotal->Fill(clrTransparent); - pixmapTotal->DrawText(cPoint(geoManager->replayWidth/5 - - (fontManager->replayText->Width(Total) + pixmapTotal->DrawText(cPoint(geoManager->replayWidth/5 + - (fontManager->replayText->Width(Total) + geoManager->replayHeaderHeight/2), - 0), - Total, - Theme.Color(clrReplayCurrentTotal), - clrTransparent, + 0), + Total, + Theme.Color(clrReplayCurrentTotal), + clrTransparent, fontManager->replayText); } void cNopacityDisplayReplay::SetJump(const char *Jump) { pixmapJump->Fill(clrTransparent); if (Jump) { - pixmapJump->DrawText(cPoint(0, - (geoManager->replayJumpHeight - - fontManager->replayHeader->Height())/2), - Jump, - Theme.Color(clrReplayCurrentTotal), - clrTransparent, + pixmapJump->DrawText(cPoint(0, + (geoManager->replayJumpHeight + - fontManager->replayHeader->Height())/2), + Jump, + Theme.Color(clrReplayCurrentTotal), + clrTransparent, fontManager->replayHeader); } } @@ -465,9 +468,9 @@ void cNopacityDisplayReplay::Action(void) { pixmapJump->SetAlpha(Alpha); } pixmapControls->SetAlpha(Alpha); - pixmapRew->SetAlpha(Alpha); - pixmapPause->SetAlpha(Alpha); - pixmapPlay->SetAlpha(Alpha); + pixmapRew->SetAlpha(Alpha); + pixmapPause->SetAlpha(Alpha); + pixmapPlay->SetAlpha(Alpha); pixmapFwd->SetAlpha(Alpha); cPixmap::Unlock(); if (Running()) diff --git a/displayreplay.h b/displayreplay.h index 3563506..99ee022 100644 --- a/displayreplay.h +++ b/displayreplay.h @@ -1,6 +1,10 @@ #ifndef __NOPACITY_DISPLAYREPLAY_H #define __NOPACITY_DISPLAYREPLAY_H +#include <vdr/skins.h> +#include <vdr/thread.h> +#include "imagecache.h" + class cNopacityDisplayReplay : public cSkinDisplayReplay , cThread{ private: cOsd *osd; @@ -47,5 +51,5 @@ public: virtual void SetMessage(eMessageType Type, const char *Text); virtual void Flush(void); }; - + #endif //__NOPACITY_DISPLAYREPLAY_H
\ No newline at end of file diff --git a/displaytracks.c b/displaytracks.c index 8b013be..5f2c6dd 100644 --- a/displaytracks.c +++ b/displaytracks.c @@ -1,4 +1,8 @@ #include "displaytracks.h" +#include "config.h" +#include "helpers.h" +#include "imageloader.h" + cNopacityDisplayTracks::cNopacityDisplayTracks(cImageCache *imgCache, const char *Title, int NumTracks, const char * const *Tracks) { this->imgCache = imgCache; @@ -7,7 +11,7 @@ cNopacityDisplayTracks::cNopacityDisplayTracks(cImageCache *imgCache, const char numTracks = NumTracks; audioChannelLast = -5; FadeTime = config.GetValue("tracksFadeTime"); - FrameTime = FadeTime / 10; + FrameTime = FadeTime / 10; SetGeometry(); CreatePixmaps(); DrawHeader(Title); @@ -104,7 +108,7 @@ void cNopacityDisplayTracks::DrawHeader(const char *Title) { } pixmapIcon = osd->CreatePixmap(3, cRect(2, 2, menuItemHeight-2, menuItemHeight-2)); pixmapIcon->Fill(clrTransparent); - + cImage *imgTracks = imgCache->GetSkinIcon("skinIcons/tracks", menuItemHeight-6, menuItemHeight-6); if (imgTracks) pixmapIcon->DrawImage(cPoint(3,3), *imgTracks); @@ -144,14 +148,14 @@ void cNopacityDisplayTracks::SetAudioChannel(int AudioChannel) { pixmapHeaderAudio->Fill(clrTransparent); cString icon(""); switch (AudioChannel) { - case -1: + case -1: icon = "skinIcons/ac3"; break; - case 0: - icon = "skinIcons/stereo"; + case 0: + icon = "skinIcons/stereo"; break; default: - icon = "skinIcons/stereo"; + icon = "skinIcons/stereo"; break; } cImage *imgIcon = imgCache->GetSkinIcon(*icon, menuItemHeight-2, menuItemHeight-2); diff --git a/displaytracks.h b/displaytracks.h index 1f9ad1e..05c5596 100644 --- a/displaytracks.h +++ b/displaytracks.h @@ -1,6 +1,10 @@ #ifndef __NOPACITY_DISPLAYTRACKS_H #define __NOPACITY_DISPLAYTRACKS_H +#include <vdr/skins.h> +#include <vdr/thread.h> +#include "menuitem.h" + class cNopacityDisplayTracks : public cSkinDisplayTracks, cThread { private: cOsd *osd; diff --git a/displayvolume.c b/displayvolume.c index 979f182..d6ba5d1 100644 --- a/displayvolume.c +++ b/displayvolume.c @@ -1,6 +1,9 @@ #include "symbols/mute.xpm" #include "displayvolume.h" +#include "config.h" +#include "helpers.h" + cNopacityDisplayVolume::cNopacityDisplayVolume(cImageCache *imgCache) { this->imgCache = imgCache; initial = true; @@ -13,7 +16,7 @@ cNopacityDisplayVolume::cNopacityDisplayVolume(cImageCache *imgCache) { osd = CreateOsd(left, top, geoManager->volumeWidth, geoManager->volumeHeight); pixmapBackground = osd->CreatePixmap(1, cRect(0, 0, geoManager->volumeWidth, geoManager->volumeHeight)); - + if (config.GetValue("displayType") == dtGraphical) { cImage *imgBack = imgCache->GetSkinElement(seVolumeBackground); if (imgBack) { @@ -25,14 +28,14 @@ cNopacityDisplayVolume::cNopacityDisplayVolume(cImageCache *imgCache) { DrawBlendedBackground(pixmapBackground, 0, geoManager->volumeWidth, - Theme.Color(clrChannelBackground), - Theme.Color(clrChannelBackBlend), + Theme.Color(clrChannelBackground), + Theme.Color(clrChannelBackBlend), true); - DrawBlendedBackground(pixmapBackground, + DrawBlendedBackground(pixmapBackground, 0, geoManager->volumeWidth, - Theme.Color(clrChannelBackground), - Theme.Color(clrChannelBackBlend), + Theme.Color(clrChannelBackground), + Theme.Color(clrChannelBackBlend), false); } int cornerRadius = geoManager->volumeHeight/4; diff --git a/displayvolume.h b/displayvolume.h index c1ef2ae..a3d66cc 100644 --- a/displayvolume.h +++ b/displayvolume.h @@ -1,6 +1,10 @@ #ifndef __NOPACITY_DISPLAYVOLUME_H #define __NOPACITY_DISPLAYVOLUME_H +#include <vdr/skins.h> +#include <vdr/thread.h> +#include "imagecache.h" + class cNopacityDisplayVolume : public cSkinDisplayVolume, cThread { private: int FrameTime; @@ -21,5 +25,5 @@ public: virtual void SetVolume(int Current, int Total, bool Mute); virtual void Flush(void); }; - + #endif //__NOPACITY_DISPLAYVOLUME_H
\ No newline at end of file diff --git a/fontmanager.c b/fontmanager.c index c7a08fd..0ef4bb1 100644 --- a/fontmanager.c +++ b/fontmanager.c @@ -1,4 +1,7 @@ #include "fontmanager.h" +#include "geometrymanager.h" +#include "config.h" + cFontManager::cFontManager() { } diff --git a/fontmanager.h b/fontmanager.h index 69938f0..28d2a45 100644 --- a/fontmanager.h +++ b/fontmanager.h @@ -1,6 +1,8 @@ #ifndef __NOPACITY_FONTMANAGER_H #define __NOPACITY_FONTMANAGER_H +#include <vdr/skins.h> + class cFontManager { private: void SetFontsMenu(void); diff --git a/geometrymanager.c b/geometrymanager.c index 220551e..976d328 100644 --- a/geometrymanager.c +++ b/geometrymanager.c @@ -1,4 +1,7 @@ #include "geometrymanager.h" +#include "config.h" +#include "helpers.h" +#include <vdr/osd.h> cGeometryManager::cGeometryManager() { SetOSDSize(); @@ -24,7 +27,7 @@ void cGeometryManager::SetGeometry(void) { } bool cGeometryManager::GeometryChanged(void) { - if ((osdWidth != cOsd::OsdWidth()) || + if ((osdWidth != cOsd::OsdWidth()) || (osdHeight != cOsd::OsdHeight()) || (osdLeft != cOsd::OsdLeft()) || (osdTop != cOsd::OsdTop())) { @@ -39,10 +42,10 @@ bool cGeometryManager::GeometryChanged(void) { void cGeometryManager::SetDisplayMenuSizes() { menuSpace = config.GetValue("spaceMenu"); - + menuWidthScrollbar = config.GetValue("widthScrollbar"); menuDateWidth = osdWidth * 0.3; - + menuHeaderHeight = osdHeight * config.GetValue("headerHeight") / 100; menuFooterHeight = osdHeight * config.GetValue("footerHeight") / 100; menuContentHeight = osdHeight - menuHeaderHeight - menuFooterHeight; @@ -54,8 +57,8 @@ void cGeometryManager::SetDisplayMenuSizes() { menuContentWidthRecordings = osdWidth * config.GetValue("menuWidthRecordings") / 100; menuContentWidthSetup = osdWidth * config.GetValue("menuWidthSetup") / 100; menuContentWidthFull = osdWidth - config.GetValue("widthScrollbar") - config.GetValue("spaceMenu"); - menuContentWidthMinimum = Minimum(menuContentWidthMain, - menuContentWidthSchedules, + menuContentWidthMinimum = Minimum(menuContentWidthMain, + menuContentWidthSchedules, menuContentWidthChannels, menuContentWidthTimers, menuContentWidthRecordings, @@ -76,23 +79,23 @@ void cGeometryManager::SetDisplayMenuSizes() { menuItemHeightTracks = config.GetValue("tracksItemHeight"); menuMainMenuIconSize = menuItemHeightMain - 2 * menuSpace; - cSize logoSize = ScaleToFit(1000, - menuItemHeightSchedule - 2, - config.GetValue("logoWidthOriginal"), + cSize logoSize = ScaleToFit(1000, + menuItemHeightSchedule - 2, + config.GetValue("logoWidthOriginal"), config.GetValue("logoHeightOriginal")); menuLogoWidth = logoSize.Width(); menuLogoHeight = logoSize.Height(); - - cSize logoSizeVDRHeader = ScaleToFit(1000, - menuHeaderHeight - 4, - config.GetValue("menuHeaderLogoWidth"), + + cSize logoSizeVDRHeader = ScaleToFit(1000, + menuHeaderHeight - 4, + config.GetValue("menuHeaderLogoWidth"), config.GetValue("menuHeaderLogoHeight")); menuHeaderVDRLogoWidth = logoSizeVDRHeader.Width(); - + menuButtonsBorder = menuFooterHeight / 6; menuButtonWidth = (osdWidth / 4) - 2 * menuButtonsBorder; menuButtonHeight = menuFooterHeight - 3 * menuButtonsBorder; - + menuDiskUsageWidth = menuDiskUsageHeight = osdWidth * config.GetValue("menuSizeDiskUsage") / 100; menuTimersWidth = osdWidth * config.GetValue("menuWidthRightItems") / 100; menuMessageWidth = 0.8 * osdWidth; @@ -104,14 +107,14 @@ void cGeometryManager::SetDisplayChannelSizes(void) { channelWidth = osdWidth - 2 * config.GetValue("channelBorderVertical"); channelHeight = osdHeight * config.GetValue("channelHeight") / 100; channelTop = osdTop + osdHeight - channelHeight - config.GetValue("channelBorderBottom"); - + channelHeaderHeight = 0.2 * channelHeight; channelFooterHeight = 0.2 * channelHeight; channelContentHeight = channelHeight - channelHeaderHeight - channelFooterHeight; - + int logoWidthTotalPercent = 16; channelLogoWidthTotal = logoWidthTotalPercent * channelWidth /100; - + int logoMaxWidth = logoMaxWidth = channelLogoWidthTotal - 10; int logoMaxHeight; if (config.GetValue("displayType") == dtGraphical) { @@ -119,21 +122,21 @@ void cGeometryManager::SetDisplayChannelSizes(void) { } else { logoMaxHeight = channelHeight - 2; } - cSize logoSize = ScaleToFit(logoMaxWidth, - logoMaxHeight, - config.GetValue("logoWidthOriginal"), + cSize logoSize = ScaleToFit(logoMaxWidth, + logoMaxHeight, + config.GetValue("logoWidthOriginal"), config.GetValue("logoHeightOriginal")); channelLogoWidth = logoSize.Width(); channelLogoHeight = logoSize.Height(); channelLogoX = (channelLogoWidthTotal - channelLogoWidth) / 2; - + if (config.GetValue("displayType") == dtGraphical) { - channelLogoY = (channelTop + channelHeaderHeight) + channelLogoY = (channelTop + channelHeaderHeight) + (channelHeight - channelHeaderHeight - channelLogoHeight)/2; } else { channelLogoY = channelTop + (channelHeight - channelLogoHeight)/2; } - + switch (config.GetValue("logoPosition")) { case lpLeft: channelContentX = channelLogoWidthTotal; @@ -153,7 +156,7 @@ void cGeometryManager::SetDisplayChannelSizes(void) { channelChannelNameWidth = channelContentWidth * 70 / 100; channelDateWidth = channelContentWidth - channelChannelNameWidth; channelProgressBarHeight = channelHeight * 0.1; - channelEpgInfoHeight = channelContentHeight - channelProgressBarHeight; + channelEpgInfoHeight = channelContentHeight - channelProgressBarHeight; channelEpgInfoLineHeight = channelEpgInfoHeight / 4; channelFooterY = channelTop + channelHeaderHeight + channelContentHeight; } @@ -185,7 +188,7 @@ void cGeometryManager::SetDisplayReplaySizes(void) { replayJumpHeight = replayControlsHeight; replayIconBorder = 5; - replayIconSize = min(replayControlsHeight - 2*replayIconBorder, 128); + replayIconSize = min(replayControlsHeight - 2*replayIconBorder, 128); } void cGeometryManager::SetDisplayMessageSizes(void) { diff --git a/geometrymanager.h b/geometrymanager.h index 91cd5cc..f9e2166 100644 --- a/geometrymanager.h +++ b/geometrymanager.h @@ -91,8 +91,8 @@ class cGeometryManager { int replayDateWidth; int replayIconSize, replayIconBorder; int replayResolutionSize; - int replayResolutionX, replayResolutionY; - int replayJumpX, replayJumpY; + int replayResolutionX, replayResolutionY; + int replayJumpX, replayJumpY; int replayJumpWidth, replayJumpHeight; //DisplayMessage Sizes int messageWidth; @@ -1,19 +1,21 @@ #include <string> #include <sstream> #include <vector> +#include "helpers.h" +#include <vdr/skins.h> -static cOsd *CreateOsd(int Left, int Top, int Width, int Height) { +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) { + if (osd->SetAreas(&Area, 1) == oeOk) { return osd; } } return NULL; } -static void DrawBlendedBackground(cPixmap *pixmap, int xStart, int width, tColor color, tColor colorBlending, bool fromTop) { +void DrawBlendedBackground(cPixmap *pixmap, int xStart, int width, tColor color, tColor colorBlending, bool fromTop) { int height = pixmap->ViewPort().Height(); int numSteps = 16; int alphaStep = 0x0F; @@ -34,12 +36,12 @@ static void DrawBlendedBackground(cPixmap *pixmap, int xStart, int width, tColor clr = AlphaBlend(color, colorBlending, alpha); pixmap->DrawRectangle(cRect(xStart,i,width,1), clr); alpha += alphaStep; - if (i == end) + if (i == end) cont = false; } } -static void DrawRoundedCorners(cPixmap *p, int radius, int x, int y, int width, int height) { +void DrawRoundedCorners(cPixmap *p, int radius, int x, int y, int width, int height) { if (radius > 2) { p->DrawEllipse(cRect(x, y, radius, radius), clrTransparent, -2); p->DrawEllipse(cRect(x + width - radius, y , radius, radius), clrTransparent, -1); @@ -48,7 +50,7 @@ static void DrawRoundedCorners(cPixmap *p, int radius, int x, int y, int width, } } -static void DrawRoundedCornersWithBorder(cPixmap *p, tColor borderColor, int radius, int width, int height) { +void DrawRoundedCornersWithBorder(cPixmap *p, tColor borderColor, int radius, int width, int height) { if (radius < 3) return; p->DrawEllipse(cRect(0,0,radius,radius), borderColor, -2); @@ -56,21 +58,21 @@ static void DrawRoundedCornersWithBorder(cPixmap *p, tColor borderColor, int rad p->DrawEllipse(cRect(width-radius,0,radius,radius), borderColor, -1); p->DrawEllipse(cRect(width-radius+1,-1,radius,radius), clrTransparent, -1); - + p->DrawEllipse(cRect(0,height-radius,radius,radius), borderColor, -3); p->DrawEllipse(cRect(-1,height-radius+1,radius,radius), clrTransparent, -3); - + p->DrawEllipse(cRect(width-radius,height-radius,radius,radius), borderColor, -4); p->DrawEllipse(cRect(width-radius+1,height-radius+1,radius,radius), clrTransparent, -4); } -static cSize ScaleToFit(int widthMax, int heightMax, int widthOriginal, int heightOriginal) { +cSize ScaleToFit(int widthMax, int heightMax, int widthOriginal, int heightOriginal) { int width = 1; int height = 1; if ((widthMax == 0)||(heightMax==0)||(widthOriginal==0)||(heightOriginal==0)) return cSize(width, height); - + if ((widthOriginal <= widthMax) && (heightOriginal <= heightMax)) { width = widthOriginal; height = heightOriginal; @@ -91,7 +93,7 @@ static cSize ScaleToFit(int widthMax, int heightMax, int widthOriginal, int heig return cSize(width, height); } -static int Minimum(int a, int b, int c, int d, int e, int f) { +int Minimum(int a, int b, int c, int d, int e, int f) { int min = a; if (b < min) min = b; if (c < min) min = c; @@ -101,7 +103,7 @@ static int Minimum(int a, int b, int c, int d, int e, int f) { return min; } -static std::string CutText(std::string text, int width, const cFont *font) { +std::string CutText(std::string text, int width, const cFont *font) { if (width <= font->Size()) return text.c_str(); cTextWrapper twText; @@ -136,13 +138,6 @@ std::string StrToLowerCase(std::string str) { return lowerCase; } -class splitstring : public std::string { - std::vector<std::string> flds; -public: - splitstring(const char *s) : std::string(s) { }; - std::vector<std::string>& split(char delim, int rep=0); -}; - // split: receives a char delimiter; returns a vector of strings // By default ignores repeated delimiters, unless argument rep == 1. std::vector<std::string>& splitstring::split(char delim, int rep) { @@ -165,4 +160,4 @@ std::vector<std::string>& splitstring::split(char delim, int rep) { if (!buf.empty()) flds.push_back(buf); return flds; -}
\ No newline at end of file +} diff --git a/imagecache.c b/imagecache.c index 2e6e0cb..ee59d49 100644 --- a/imagecache.c +++ b/imagecache.c @@ -2,6 +2,8 @@ #include <sstream> #include <map> #include "imagecache.h" +#include "config.h" +#include "helpers.h" using namespace Magick; @@ -15,7 +17,7 @@ cImageCache::~cImageCache() { if (tempStaticLogo) { delete tempStaticLogo; tempStaticLogo = NULL; - } + } } void cImageCache::CreateCache(void) { @@ -55,7 +57,7 @@ void cImageCache::CreateCache(void) { InsertIntoLogoCache(ctLogoMenuItem, *channel->GetChannelID().ToString()); } } - + } } } @@ -128,7 +130,7 @@ cImage *cImageCache::GetSkinElement(eSkinElementType type) { cImage *cImageCache::GetLogo(eCacheType type, const cChannel *channel) { if (!channel) return NULL; - + std::map<std::string, cImage*> *cache; if (type == ctLogo) cache = &logoCache; @@ -136,9 +138,9 @@ cImage *cImageCache::GetLogo(eCacheType type, const cChannel *channel) { cache = &logoMenuItemCache; else if (type == ctLogoTimer) cache = &logoTimerCache; - + std::map<std::string, cImage*>::iterator hit = cache->find(*channel->GetChannelID().ToString()); - + if (hit != cache->end()) { return (cImage*)hit->second; } else { @@ -187,7 +189,7 @@ std::string cImageCache::GetCacheSize(eCacheType type) { cache = &menuIconCache; else if (type == ctSkinIcon) cache = &skinIconCache; - + for(std::map<std::string, cImage*>::const_iterator it = cache->begin(); it != cache->end(); it++) { cImage *img = (cImage*)it->second; sizeByte += img->Width() * img->Height() * sizeof(tColor); @@ -218,7 +220,7 @@ std::string cImageCache::GetCacheSize(eCacheType type) { result << numImages << " " << tr("images") << " / " << sizeByte/1024 << " KByte"; return result.str(); } - + std::vector<std::pair<std::string, cPoint> > cImageCache::GetMenuIcons(void) { std::vector<std::pair<std::string, cPoint> > menuIcons; //MainMenuIcons @@ -243,7 +245,7 @@ std::vector<std::pair<std::string, cPoint> > cImageCache::GetMenuIcons(void) { for (int i=0; i<mainMenuIcons.size(); i++) { menuIcons.push_back(std::pair<std::string, cPoint>(mainMenuIcons[i], cPoint(mainMenuIconSize, mainMenuIconSize))); } - + //Plugin Icons for (int i = 0; ; i++) { cPlugin *p = cPluginManager::GetPlugin(i); @@ -305,7 +307,7 @@ bool cImageCache::LoadIcon(eCacheType type, std::string name) { return true; } } - } + } if (!success) { cString iconPathTheme = cString::sprintf("%s%s/", *config.iconPathDefault, Setup.OSDTheme); success = LoadImage(name, *iconPathTheme, "png"); @@ -369,7 +371,7 @@ bool cImageCache::LoadLogo(const cChannel *channel) { success = LoadImage(logoLower.c_str(), *config.logoPathDefault, *config.logoExtension); if (success) return true; - + return false; } @@ -415,49 +417,49 @@ void cImageCache::CreateSkinElementsBlended(void) { InsertIntoSkinElementCache(seDefault); CreateBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), geoManager->menuItemWidthDefault-2, geoManager->menuItemHeightDefault-2); InsertIntoSkinElementCache(seDefaultHigh); - + //Main Menu CreateBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), geoManager->menuItemWidthMain-2, geoManager->menuItemHeightMain-2); InsertIntoSkinElementCache(seMain); CreateBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), geoManager->menuItemWidthMain-2, geoManager->menuItemHeightMain-2); InsertIntoSkinElementCache(seMainHigh); - + //Schedules Menu CreateBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), geoManager->menuItemWidthSchedule-2, geoManager->menuItemHeightSchedule-2); InsertIntoSkinElementCache(seSchedules); CreateBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), geoManager->menuItemWidthSchedule-2, geoManager->menuItemHeightSchedule-2); InsertIntoSkinElementCache(seSchedulesHigh); - + //Channels Menu CreateBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), geoManager->menuItemWidthChannel-2, geoManager->menuItemHeightSchedule-2); InsertIntoSkinElementCache(seChannels); CreateBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), geoManager->menuItemWidthChannel-2, geoManager->menuItemHeightSchedule-2); InsertIntoSkinElementCache(seChannelsHigh); - + //Recordings Menu CreateBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), geoManager->menuItemWidthRecording-2, geoManager->menuItemHeightRecordings-2); InsertIntoSkinElementCache(seRecordings); CreateBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), geoManager->menuItemWidthRecording-2, geoManager->menuItemHeightRecordings-2); InsertIntoSkinElementCache(seRecordingsHigh); - + //Timers Menu CreateBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), geoManager->menuItemWidthTimer-2, geoManager->menuItemHeightSchedule-2); InsertIntoSkinElementCache(seTimers); CreateBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), geoManager->menuItemWidthTimer-2, geoManager->menuItemHeightSchedule-2); InsertIntoSkinElementCache(seTimersHigh); - + //Setup Menu CreateBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), geoManager->menuItemWidthSetup-2, geoManager->menuItemHeightMain-2); InsertIntoSkinElementCache(seSetup); CreateBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), geoManager->menuItemWidthSetup-2, geoManager->menuItemHeightMain-2); InsertIntoSkinElementCache(seSetupHigh); - + //DisplayTracks CreateBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), geoManager->menuItemWidthTracks-2, geoManager->menuItemHeightTracks-2); InsertIntoSkinElementCache(seTracks); CreateBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), geoManager->menuItemWidthTracks-2, geoManager->menuItemHeightTracks-2); InsertIntoSkinElementCache(seTracksHigh); - + //Color Buttons CreateBackground(Theme.Color(clrMenuBack), Theme.Color(clrButtonRed), geoManager->menuButtonWidth-4, geoManager->menuButtonHeight-4); InsertIntoSkinElementCache(seButtonRed); @@ -467,7 +469,7 @@ void cImageCache::CreateSkinElementsBlended(void) { InsertIntoSkinElementCache(seButtonYellow); CreateBackground(Theme.Color(clrMenuBack), Theme.Color(clrButtonBlue), geoManager->menuButtonWidth-4, geoManager->menuButtonHeight-4); InsertIntoSkinElementCache(seButtonBlue); - + //Menu Header bool mirrorHeader = (config.GetValue("menuAdjustLeft")) ? false : true; CreateBackground(Theme.Color(clrMenuHeaderBlend), Theme.Color(clrMenuHeader), geoManager->osdWidth, geoManager->menuHeaderHeight, mirrorHeader); @@ -476,7 +478,7 @@ void cImageCache::CreateSkinElementsBlended(void) { void cImageCache::CreateSkinElementsGraphics(void) { bool success = false; - + //Default Menus std::string imgDefaultMenuItem = "skinElements/menubuttondefault"; std::string imgDefaultMenuItemActive = "skinElements/menubuttondefaultactive"; @@ -511,7 +513,7 @@ void cImageCache::CreateSkinElementsGraphics(void) { success = LoadIcon(ctSkinElement, imgMenuItemTop); if (success) InsertIntoSkinElementCache(seSetupTop, geoManager->menuItemWidthSetup, geoManager->menuItemHeightMain); - + //Schedules Menu success = LoadIcon(ctSkinElement, imgMenuItem); if (success) @@ -533,7 +535,7 @@ void cImageCache::CreateSkinElementsGraphics(void) { success = LoadIcon(ctSkinElement, imgMenuItemTop); if (success) InsertIntoSkinElementCache(seChannelsTop, geoManager->menuItemWidthChannel, geoManager->menuItemHeightSchedule); - + //Recordings Menu success = LoadIcon(ctSkinElement, imgMenuItem); if (success) @@ -544,7 +546,7 @@ void cImageCache::CreateSkinElementsGraphics(void) { success = LoadIcon(ctSkinElement, imgMenuItemTop); if (success) InsertIntoSkinElementCache(seRecordingsTop, geoManager->menuItemWidthRecording, geoManager->menuItemHeightRecordings); - + //Timers Menu success = LoadIcon(ctSkinElement, imgMenuItem); if (success) @@ -555,7 +557,7 @@ void cImageCache::CreateSkinElementsGraphics(void) { success = LoadIcon(ctSkinElement, imgMenuItemTop); if (success) InsertIntoSkinElementCache(seTimersTop, geoManager->menuItemWidthTimer, geoManager->menuItemHeightSchedule); - + //Tracks Menu success = LoadIcon(ctSkinElement, imgMenuItem); if (success) @@ -566,7 +568,7 @@ void cImageCache::CreateSkinElementsGraphics(void) { success = LoadIcon(ctSkinElement, imgMenuItemTop); if (success) InsertIntoSkinElementCache(seTracksTop, geoManager->menuItemWidthTracks, geoManager->menuItemHeightTracks); - + //Color Buttons std::string imgButtonRed = "skinElements/buttonred"; std::string imgButtonGreen = "skinElements/buttongreen"; @@ -584,7 +586,7 @@ void cImageCache::CreateSkinElementsGraphics(void) { success = LoadIcon(ctSkinElement, imgButtonBlue); if (success) InsertIntoSkinElementCache(seButtonBlue, geoManager->menuButtonWidth, geoManager->menuButtonHeight); - + //Menu Header std::string imgHeader = "skinElements/header"; success = LoadIcon(ctSkinElement, imgHeader); @@ -643,7 +645,7 @@ void cImageCache::CreateSkinElementsGraphics(void) { success = LoadIcon(ctSkinElement, imgChannelBackground); if (success) InsertIntoSkinElementCache(seChannelBackground, geoManager->channelWidth, geoManager->channelHeight); - + success = LoadIcon(ctSkinElement, imgChannelTop); if (success) InsertIntoSkinElementCache(seChannelTop, geoManager->channelWidth, geoManager->channelHeight); @@ -663,13 +665,13 @@ void cImageCache::CreateSkinElementsGraphics(void) { success = LoadIcon(ctSkinElement, imgReplayTop); if (success) InsertIntoSkinElementCache(seReplayTop, geoManager->replayWidth, geoManager->replayHeight); - + //DisplayVolume Background std::string imgVolumeBackground = "skinElements/displayvolume"; success = LoadIcon(ctSkinElement, imgVolumeBackground); if (success) InsertIntoSkinElementCache(seVolumeBackground, geoManager->volumeWidth, geoManager->volumeHeight); - + //Scrolllbar std::string imgScrollbar = "skinElements/scrollbar"; success = LoadIcon(ctSkinElement, imgScrollbar); @@ -692,13 +694,13 @@ void cImageCache::Clear(void) { delete img; } menuIconCache.clear(); - + for(std::map<std::string, cImage*>::const_iterator it = skinIconCache.begin(); it != skinIconCache.end(); it++) { cImage *img = (cImage*)it->second; delete img; } skinIconCache.clear(); - + for(std::map<eSkinElementType, cImage*>::const_iterator it = skinElementCache.begin(); it != skinElementCache.end(); it++) { cImage *img = (cImage*)it->second; delete img; @@ -710,13 +712,13 @@ void cImageCache::Clear(void) { delete img; } logoCache.clear(); - + for(std::map<std::string, cImage*>::const_iterator it = logoMenuItemCache.begin(); it != logoMenuItemCache.end(); it++) { cImage *img = (cImage*)it->second; delete img; } logoMenuItemCache.clear(); - + for(std::map<std::string, cImage*>::const_iterator it = logoTimerCache.begin(); it != logoTimerCache.end(); it++) { cImage *img = (cImage*)it->second; delete img; diff --git a/imagecache.h b/imagecache.h index b634011..7ba7f09 100644 --- a/imagecache.h +++ b/imagecache.h @@ -6,11 +6,13 @@ #include <vdr/osd.h> #include <vdr/skins.h> #include <Magick++.h> +#include <vector> +#include "imagemagickwrapper.h" using namespace Magick; -enum eCacheType { - ctMenuIcon = 0, +enum eCacheType { + ctMenuIcon = 0, ctSkinIcon, ctLogo, ctLogoMenuItem, @@ -20,7 +22,7 @@ enum eCacheType { enum eSkinElementType { seNone = -1, - seDefault = 0, + seDefault = 0, seDefaultHigh, seMain, seMainHigh, diff --git a/imageloader.c b/imageloader.c index 437030e..c368370 100644 --- a/imageloader.c +++ b/imageloader.c @@ -1,3 +1,5 @@ +#include "config.h" +#include "helpers.h" #include "imageloader.h" #include <math.h> #include <string> @@ -16,7 +18,7 @@ cImage cImageLoader::GetImage() { return CreateImageCopy(); } -bool cImageLoader::LoadLogo(const char *logo, int width = config.GetValue("logoWidthOriginal"), int height = config.GetValue("logoHeightOriginal")) { +bool cImageLoader::LoadLogo(const char *logo, int width, int height ) { if ((width == 0)||(height==0)) return false; std::string logoLower = StrToLowerCase(logo); @@ -141,7 +143,7 @@ bool cImageLoader::SearchRecordingPoster(cString recPath, cString &found) { found = manualPoster; return true; } - return false; + return false; } bool cImageLoader::FirstImageInFolder(cString Path, cString Extension, cString *recImage) { diff --git a/imageloader.h b/imageloader.h index a0fa864..2c080ba 100644 --- a/imageloader.h +++ b/imageloader.h @@ -6,15 +6,16 @@ #include <vdr/osd.h> #include <vdr/skins.h> #include <Magick++.h> +#include "imagemagickwrapper.h" using namespace Magick; - + class cImageLoader : public cImageMagickWrapper { public: cImageLoader(); ~cImageLoader(); cImage GetImage(); - bool LoadLogo(const char *logo, int width, int height); + bool LoadLogo(const char *logo, int width = config.GetValue("logoWidthOriginal"), int height = config.GetValue("logoHeightOriginal")); bool LoadEPGImage(int eventID); bool LoadAdditionalEPGImage(cString name); bool LoadRecordingImage(cString Path); diff --git a/imagemagickwrapper.c b/imagemagickwrapper.c index e06e9f6..c22faf4 100644 --- a/imagemagickwrapper.c +++ b/imagemagickwrapper.c @@ -1,6 +1,7 @@ #include <string> #include <sstream> #include "imagemagickwrapper.h" +#include "config.h" cImageMagickWrapper::cImageMagickWrapper() { InitializeMagick(NULL); @@ -17,9 +18,9 @@ cImage *cImageMagickWrapper::CreateImage() { 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) + 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; @@ -36,9 +37,9 @@ cImage cImageMagickWrapper::CreateImageCopy() { 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) + 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; @@ -57,7 +58,7 @@ bool cImageMagickWrapper::LoadImage(std::string FileName, std::string Path, std: buffer.read(imgFile.c_str()); if (config.GetValue("debugImageLoading")) dsyslog("nopacity: %s sucessfully loaded", imgFile.c_str()); - } catch (...) { + } catch (...) { return false; } return true; @@ -72,7 +73,7 @@ bool cImageMagickWrapper::LoadImage(const char *fullpath) { buffer.read(fullpath); if (config.GetValue("debugImageLoading")) dsyslog("nopacity: %s sucessfully loaded", fullpath); - } catch (...) { + } catch (...) { return false; } return true; diff --git a/imagemagickwrapper.h b/imagemagickwrapper.h index 1ec7a56..1c38074 100644 --- a/imagemagickwrapper.h +++ b/imagemagickwrapper.h @@ -4,9 +4,10 @@ #define X_DISPLAY_MISSING #include <Magick++.h> +#include <vdr/osd.h> using namespace Magick; - + class cImageMagickWrapper { public: cImageMagickWrapper(); diff --git a/menudetailview.c b/menudetailview.c index 4c0bb4e..3debf75 100644 --- a/menudetailview.c +++ b/menudetailview.c @@ -4,6 +4,10 @@ #include <iostream> #include <dirent.h> #include <vector> +#include "config.h" +#include "helpers.h" +#include "imageloader.h" + cNopacityMenuDetailView::cNopacityMenuDetailView(cOsd *osd, cImageCache *imgCache) { this->osd = osd; @@ -96,7 +100,7 @@ void cNopacityMenuDetailView::DrawPoster(void) { } int posterWidth = posterWidthOrig; int posterHeight = posterHeightOrig; - + if ((posterWidthOrig > widthPoster) && (posterHeightOrig < contentHeight)) { posterWidth = widthPoster - 2*border; posterHeight = posterHeightOrig * ((double)posterWidth / (double)posterWidthOrig); @@ -135,7 +139,7 @@ void cNopacityMenuDetailView::DrawBanner(int height) { int bannerHeightOrig = mediaInfo.banner.height; int bannerWidth = bannerWidthOrig; int bannerHeight = bannerHeightOrig; - + if (bannerWidthOrig > contentWidth - 2*border) { bannerWidth = contentWidth - 2*border; bannerHeight = bannerHeightOrig * ((double)bannerWidth / (double)bannerWidthOrig); @@ -208,7 +212,7 @@ void cNopacityMenuDetailView::DrawFanart(int height) { int fanartHeightOrig = mediaInfo.fanart[0].height; int fanartWidth = fanartWidthOrig; int fanartHeight = fanartHeightOrig; - + if (fanartWidthOrig > contentWidth - 2*border) { fanartWidth = contentWidth - 2*border; fanartHeight = fanartHeightOrig * ((double)fanartWidth / (double)fanartWidthOrig); @@ -357,21 +361,21 @@ void cNopacityMenuDetailEventView::SetContentHeight(void) { if ((config.GetValue("displayAdditionalEPGPictures") == 1) || ((config.GetValue("displayAdditionalEPGPictures") == 2) && !hasAdditionalMedia)) { heightEPGPics = HeightEPGPics(); } - + yBanner = border; yEPGText = yBanner + heightBanner; yAddInf = yEPGText + heightEPG; yActors = yAddInf + heightReruns; yFanart = yActors + heightActors; yEPGPics = yFanart + heightFanart; - + int totalHeight = 2 * border + heightBanner + heightEPG + heightActors + heightFanart + heightReruns + heightEPGPics; //check if pixmap content has to be scrollable if (totalHeight > contentHeight) { contentDrawPortHeight = totalHeight; hasScrollbar = true; } else { - contentDrawPortHeight = contentHeight; + contentDrawPortHeight = contentHeight; } } @@ -385,7 +389,7 @@ void cNopacityMenuDetailEventView::CreatePixmaps(void) { pixmapHeader->DrawRectangle(cRect(0, headerHeight - 2, width, 2), Theme.Color(clrMenuBorder)); pixmapContent->Fill(clrTransparent); pixmapLogo->Fill(clrTransparent); - + if (hasAdditionalMedia) { pixmapPoster = osd->CreatePixmap(4, cRect(x, top + headerHeight, widthPoster, contentHeight)); pixmapPoster->Fill(clrTransparent); @@ -527,7 +531,7 @@ void cNopacityMenuDetailEventView::LoadReruns(void) { 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)) { @@ -675,23 +679,23 @@ void cNopacityMenuDetailRecordingView::SetContentHeight(void) { } //additional recording Info int heightAdditionalInfo = (additionalInfo.Lines() + 1) * lineHeight; - + yBanner = border; yEPGText = yBanner + heightBanner; yActors = yEPGText + heightEPG; yFanart = yActors + heightActors; yEPGPics = yFanart + heightFanart; yAddInf = yEPGPics + heightEPGPics; - + int totalHeight = 2*border + heightBanner + heightEPG + heightActors + heightFanart + heightAdditionalInfo + heightEPGPics; //check if pixmap content has to be scrollable if (totalHeight > contentHeight) { contentDrawPortHeight = totalHeight; hasScrollbar = true; } else { - contentDrawPortHeight = contentHeight; + contentDrawPortHeight = contentHeight; } - + } void cNopacityMenuDetailRecordingView::CreatePixmaps(void) { @@ -752,7 +756,7 @@ bool cNopacityMenuDetailRecordingView::LoadEPGPics(void) { int picsFound = 0; if (dirHandle != NULL) { while ( 0 != (dirEntry = readdir(dirHandle))) { - if (endswith(dirEntry->d_name, "jpg")) { + if (endswith(dirEntry->d_name, "jpg")) { std::string fileName = dirEntry->d_name; if (!fileName.compare("cover_vdr.jpg")) continue; @@ -828,7 +832,7 @@ void cNopacityMenuDetailRecordingView::DrawHeader(void) { recDuration = (recDuration>0)?(recDuration / 60):0; cString dateTime = cString::sprintf("%s %s (%d %s)", *DateString(recording->Start()), *TimeString(recording->Start()), recDuration, tr("min")); pixmapHeader->DrawText(cPoint(border, (lineHeight - fontHeader->Height())/2), *dateTime, Theme.Color(clrMenuFontDetailViewHeader), clrTransparent, fontHeader); - + const char *Title = info->Title(); if (isempty(Title)) Title = recording->Name(); @@ -942,7 +946,7 @@ void cNopacityMenuDetailRecordingView::LoadRecordingInformation(void) { } sstrInfo << (const char*)strRecSize << std::endl; } - + if (index) { int nLastIndex = index->Last(); if (nLastIndex) { @@ -958,7 +962,7 @@ void cNopacityMenuDetailRecordingView::LoadRecordingInformation(void) { } } delete index; - + if (Info) { const char *aux = NULL; aux = Info->Aux(); @@ -968,12 +972,12 @@ void cNopacityMenuDetailRecordingView::LoadRecordingInformation(void) { if (!auxEpgsearch.empty()) { std::string searchTimer = StripXmlTag(auxEpgsearch, "searchtimer"); if (!searchTimer.empty()) { - sstrInfo << tr("Search timer") << ": " << searchTimer << std::endl; + sstrInfo << tr("Search timer") << ": " << searchTimer << std::endl; } } } } - + additionalInfo.Set(sstrInfo.str().c_str(), font, width - 4 * border); } @@ -1044,7 +1048,7 @@ void cNopacityMenuDetailTextView::SetContentHeight(void) { contentDrawPortHeight = heightContentText; hasScrollbar = true; } else { - contentDrawPortHeight = contentHeight; + contentDrawPortHeight = contentHeight; } } diff --git a/menudetailview.h b/menudetailview.h index 90c8d2b..985ceb5 100644 --- a/menudetailview.h +++ b/menudetailview.h @@ -1,6 +1,14 @@ #ifndef __NOPACITY_MENUDETAILVIEW_H #define __NOPACITY_MENUDETAILVIEW_H +#include <vdr/recording.h> +#include <vdr/skins.h> + +#include <vector> +#include <string> +#include "services/tvscraper.h" +#include "imagecache.h" + class cNopacityMenuDetailView : public cThread { protected: cOsd *osd; @@ -4,6 +4,9 @@ #include <algorithm> #include <iostream> #include <vector> +#include "config.h" +#include "helpers.h" +#include "imageloader.h" // cNopacityMenuItem ------------- @@ -48,7 +51,7 @@ cNopacityMenuItem::~cNopacityMenuItem(void) { void cNopacityMenuItem::SetCurrent(bool cur) { wasCurrent = current; current = cur; -} +} void cNopacityMenuItem::SetGeometry(int index, int top, int left, int width, int height, int spaceMenu) { this->index = index; @@ -141,7 +144,7 @@ void cNopacityMenuItem::Action(void) { SetTextFull(); cPixmap::Unlock(); int drawPortX; - + int FrameTime = 0; if (config.GetValue("menuScrollSpeed") == 1) FrameTime = 50; @@ -161,7 +164,7 @@ void cNopacityMenuItem::Action(void) { drawPortX = pixmapTextScroller->DrawPort().X(); drawPortX -= scrollDelta; cPixmap::Unlock(); - + if (abs(drawPortX) > maxX) { DoSleep(scrollDelay); if (carriageReturn) @@ -214,7 +217,7 @@ void cNopacityMenuItem::DrawRoundedCorners(tColor borderColor) { void cNopacityMenuItem::DrawChannelLogoBackground(void) { int logoWidth = geoManager->menuLogoWidth; pixmapBackground->DrawRectangle(cRect(4,6,logoWidth-4, height-12), Theme.Color(clrMenuChannelLogoBack)); -} +} // cNopacityMainMenuItem ------------- cNopacityMainMenuItem::cNopacityMainMenuItem(cOsd *osd, cImageCache *imgCache, const char *text, bool sel, bool setup) : cNopacityMenuItem (osd, imgCache, text, sel) { @@ -304,7 +307,7 @@ cString cNopacityMainMenuItem::GetIconName() { return cString::sprintf("pluginIcons/%s", p->Name()); } } catch (...) {} - } + } } else break; } @@ -339,7 +342,7 @@ void cNopacityMainMenuItem::CreateText() { if (found) { if (!(s >= '0' && s <= '9')) { doBreak = true; - } + } } if (s >= '0' && s <= '9') { found = true; @@ -354,7 +357,7 @@ void cNopacityMainMenuItem::CreateText() { menuEntry = skipspace(text.substr(i).c_str()); } else { menuNumber = ""; - menuEntry = text.c_str(); + menuEntry = text.c_str(); } strEntry = *menuEntry; } @@ -425,7 +428,7 @@ void cNopacityMainMenuItem::Render() { // cNopacityScheduleMenuItem ------------- -cNopacityScheduleMenuItem::cNopacityScheduleMenuItem(cOsd *osd, cImageCache *imgCache, const cEvent *Event, const cChannel *Channel, eTimerMatch TimerMatch, bool sel, eMenuCategory category, cRect *vidWin) +cNopacityScheduleMenuItem::cNopacityScheduleMenuItem(cOsd *osd, cImageCache *imgCache, const cEvent *Event, const cChannel *Channel, eTimerMatch TimerMatch, bool sel, eMenuCategory category, cRect *vidWin) : cNopacityMenuItem (osd, imgCache, "", sel) { this->category = category; this->Event = Event; @@ -521,7 +524,7 @@ void cNopacityScheduleMenuItem::Render() { textLeft = 5; if (Channel && Channel->Name()) textLeft = logoWidth + 10; - + if (selectable) { titleY = (height - font->Height())/2 - 2; DrawBackground(textLeft); @@ -603,7 +606,7 @@ void cNopacityScheduleMenuItem::DrawBackground(int textLeft) { if (config.GetValue("roundedCorners")) DrawRoundedCorners(Theme.Color(clrMenuBorder)); } - + if (TimerMatch == tmFull) { cImage *imgIcon = imgCache->GetSkinIcon("skinIcons/activetimer", 64, 64); if (imgIcon) @@ -632,7 +635,7 @@ void cNopacityScheduleMenuItem::DrawLogo(int logoWidth, int logoHeight) { int y = (heightChannel>height)?0:(height-heightChannel)/2; for (int line = 0; line < lines; line++) { pixmapStatic->DrawText(cPoint((logoWidth - font->Width(channel.GetLine(line)))/2, y+lineHeight*line), channel.GetLine(line), Theme.Color(clrMenuFontMenuItemHigh), clrTransparent, font); - } + } } } } @@ -648,14 +651,14 @@ void cNopacityScheduleMenuItem::DrawRemaining(int x, int y, int width) { if (total == 0) return; double percentSeen = (double)seen/total; - + tColor clrBack = (current)?Theme.Color(clrProgressBarBackHigh):Theme.Color(clrProgressBarBack); tColor clrBar = (current)?Theme.Color(clrProgressBarHigh):Theme.Color(clrProgressBar); pixmapBackground->DrawEllipse(cRect(x, y, 7, 7), clrBack); pixmapBackground->DrawEllipse(cRect(x+width, y, 7, 7), clrBack); pixmapBackground->DrawRectangle(cRect(x+4, y, width-1, 7), clrBack); pixmapBackground->DrawEllipse(cRect(x+1, y+1, 5, 5), clrBar); - + if (percentSeen > 0.0) pixmapBackground->DrawEllipse(cRect(x+(width*percentSeen), y+1, 5, 5), clrBar); pixmapBackground->DrawRectangle(cRect(x+4, y+1, (width-1)*percentSeen, 5), clrBar); @@ -710,9 +713,9 @@ int cNopacityChannelMenuItem::CheckScrollable(bool hasIcon) { totalTextWidth = max(font->Width(strEntry.c_str()), totalTextWidth); strEntryFull = strEntry.c_str(); strEntry = CutText(strEntry, width - spaceLeft, font); - } else + } else strEntryFull = strEntry; - + if (fontSmall->Width(strEpgInfo.c_str()) > (width - spaceLeft)) { scrollable = true; totalTextWidth = max(fontSmall->Width(strEpgInfo.c_str()), totalTextWidth); @@ -720,7 +723,7 @@ int cNopacityChannelMenuItem::CheckScrollable(bool hasIcon) { strEpgInfo = CutText(strEpgInfo, width - spaceLeft, fontSmall); } else strEpgInfoFull = strEpgInfo; - + return totalTextWidth; } @@ -805,7 +808,7 @@ void cNopacityChannelMenuItem::DrawBackground(void) { if (config.GetValue("roundedCorners")) DrawRoundedCorners(Theme.Color(clrMenuBorder)); } - + if (config.GetValue("menuChannelDisplayMode") == 0) { int encryptedSize = height/4-2; int sourceX = geoManager->menuLogoWidth + 15; @@ -1026,9 +1029,9 @@ void cNopacityTimerMenuItem::DrawBackground(int textLeft) { firstDay = true; } else if (Timer->Recording()) iconName = "skinIcons/timerRecording"; - else + else iconName = "skinIcons/timerActive"; - + cImage *imgIcon = imgCache->GetSkinIcon(*iconName, iconSize, iconSize); if (imgIcon) pixmapStatic->DrawImage(cPoint(textLeft, 0), *imgIcon); @@ -1044,7 +1047,7 @@ void cNopacityTimerMenuItem::DrawBackground(int textLeft) { void cNopacityTimerMenuItem::Render() { textLeft = geoManager->menuLogoWidth + geoManager->menuSpace; - if (selectable) { + if (selectable) { DrawBackground(textLeft); DrawChannelLogoBackground(); int logoWidth = geoManager->menuLogoWidth; @@ -1080,7 +1083,7 @@ void cNopacityTimerMenuItem::DrawLogo(int logoWidth, int logoHeight) { int y = (heightChannel>height)?0:(height-heightChannel)/2; for (int line = 0; line < lines; line++) { pixmapStatic->DrawText(cPoint((logoWidth - font->Width(channel.GetLine(line)))/2, y+lineHeight*line), channel.GetLine(line), Theme.Color(clrMenuFontMenuItemHigh), clrTransparent, font); - } + } } } } @@ -1118,7 +1121,7 @@ void cNopacityRecordingMenuItem::CreateText() { try { std::vector<std::string> tokens; std::istringstream f(recName.c_str()); - std::string s; + std::string s; while (std::getline(f, s, FOLDERDELIMCHAR)) { tokens.push_back(s); } @@ -1280,7 +1283,7 @@ void cNopacityRecordingMenuItem::SetTextShortRecording(void) { void cNopacityRecordingMenuItem::DrawRecordingNewIcon(void) { int iconNewSize = height/3; - + cImage *imgIcon = imgCache->GetSkinIcon("skinIcons/newrecording", iconNewSize, iconNewSize); if (imgIcon) { int iconX = pixmapStatic->ViewPort().Width() - iconNewSize; @@ -1355,7 +1358,7 @@ void cNopacityRecordingMenuItem::DrawPoster(void) { pixmapStatic->DrawImage(cPoint(10, 5), imgLoader.GetImage()); } } else { - + cImage *imgIcon = imgCache->GetSkinIcon("skinIcons/defaultPoster", posterWidth, posterHeight); if (imgIcon) pixmapStatic->DrawImage(cPoint(10,5), *imgIcon); @@ -1363,7 +1366,7 @@ void cNopacityRecordingMenuItem::DrawPoster(void) { } void cNopacityRecordingMenuItem::Render() { - if (selectable) { + if (selectable) { DrawBackground(); if (isFolder) { DrawFolderNewSeen(); @@ -1426,10 +1429,10 @@ cNopacityDefaultMenuItem::~cNopacityDefaultMenuItem(void) { } bool cNopacityDefaultMenuItem::CheckProgressBar(const char *text) { - if (strlen(text) > 5 - && text[0] == '[' - && ((text[1] == '|')||(text[1] == ' ')) - && ((text[2] == '|')||(text[2] == ' ')) + if (strlen(text) > 5 + && text[0] == '[' + && ((text[1] == '|')||(text[1] == ' ')) + && ((text[2] == '|')||(text[2] == ' ')) && text[strlen(text) - 1] == ']') return true; return false; @@ -1480,7 +1483,7 @@ void cNopacityDefaultMenuItem::DrawProgressBar(int x, int width, const char *bar pixmapStatic->DrawRectangle(cRect(x+7, height/4+2, width-14, height/2-4), clrTransparent); double progress = (double)now/(double)total; pixmapStatic->DrawRectangle(cRect(x+8, height/4+3, (width-16)*progress, height/2-6), color); - + } } @@ -1502,7 +1505,7 @@ int cNopacityDefaultMenuItem::CheckScrollable(bool hasIcon) { if (!selectable) return 0; int colWidth = 0; - int colTextWidth = 0; + int colTextWidth = 0; for (int i=0; i<numTabs; i++) { if (tabWidth[i] > 0) { if (CheckProgressBar(*itemTabs[i])) @@ -1555,7 +1558,7 @@ bool cNopacityDefaultMenuItem::DrawHeaderElement(void) { void cNopacityDefaultMenuItem::Render() { DrawBackground(); pixmapStatic->Fill(clrTransparent); - + tColor clrFont; if (current) clrFont = Theme.Color(clrMenuFontMenuItemHigh); @@ -1569,7 +1572,7 @@ void cNopacityDefaultMenuItem::Render() { return; } int colWidth = 0; - int colTextWidth = 0; + int colTextWidth = 0; cString itemText(""); for (int i=0; i<numTabs; i++) { if (tabWidth[i] > 0) { @@ -1,6 +1,10 @@ #ifndef __NOPACITY_MENUITEM_H #define __NOPACITY_MENUITEM_H +#include "textwindow.h" +#include <string> +#include "imagecache.h" + class cNopacityMenuItem : public cListObject, public cThread { protected: cOsd *osd; @@ -48,7 +52,7 @@ public: void SetFontSmall(cFont *fontSmall) {this->fontSmall = fontSmall;} void SetFontEPGWindow(cFont *font) {this->fontEPGWindow = font;} void SetFontEPGWindowLarge(cFont *font) {this->fontEPGWindowLarge = font;} - void SetCurrent(bool cur); + void SetCurrent(bool cur); void SetAlpha(int alpha) {this->pixmapBackground->SetAlpha(alpha);} void SetAlphaIcon(int alpha) {if (pixmapStatic) this->pixmapStatic->SetAlpha(alpha);} void SetAlphaText(int alpha) {if (pixmapTextScroller) this->pixmapTextScroller->SetAlpha(alpha);} @@ -1,192 +1,15 @@ #include <vdr/osd.h> #include <vdr/menu.h> -static cTheme Theme; -static bool menuActive = false; -static bool firstDisplay = true; - -//COMMON -#define CLR_TRANSPARENT 0x00000000 -#define CLR_BACKGROUND_BLUE 0xFF242A38 -#define CLR_TRANSBLACK 0xDD000000 -#define CLR_TRANSBLACK2 0xB0000000 -#define CLR_BLACK 0xFF000000 -#define CLR_DARKBLUE 0xDD003DF5 -#define CLR_DARKBLUE2 0xB0003DF5 -#define CLR_WHITE 0xFFFFFFFF -#define CLR_BRIGHTBLUE 0xFF0066FF -#define CLR_GRAY 0xFF858585 - -//CHANNELS -#define CLR_CHANNELPROGRESSBAR 0xDD003DF5 -#define CLR_CHANNELPROGRESSBARBACK 0xDD858585 -#define CLR_CHANNELPROGRESSBARBLEND 0xDD80B3FF -#define CLR_CHANNELSYMBOLOFF 0xDD858585 -#define CLR_CHANNELRECACTIVE 0xDDFF0000 -#define CLR_RECNEXT 0xDDFFFF00 - -//REPLAY -#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_MENUSCROLLBARBASE 0x00000000 -#define CLR_MENUITEM 0xEE444444 -#define CLR_MENUITEMBLEND 0x90000000 -#define CLR_MENUITEMHIGHBLEND 0xEE0033FF -#define CLR_SEPARATORBORDER 0xEE444444 -#define CLR_DISKALERT 0xDDFF0000 -#define CLR_MENUHEADER 0xDD000000 -#define CLR_MENUHEADERBLEND 0xEE0033FF -#define CLR_AUDIOMENUHEADER 0xDD000000 -#define CLR_PROGRESSBAR 0xDD003DF5 -#define CLR_PROGRESSBARBACK 0xDD858585 -#define CLR_PROGRESSBARBLEND 0xDD80B3FF -#define CLR_PROGRESSBARHIGH 0xDD003DF5 -#define CLR_PROGRESSBARBACKHIGH 0xDD858585 -#define CLR_PROGRESSBARBLENDHIGH 0xDD80B3FF -#define CLR_CHANNELLOGOBACK 0xDD858585 - -//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 - -//MESSAGES -#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_WHITE); -THEME_CLR(Theme, clrChannelEPGNext, CLR_GRAY); -THEME_CLR(Theme, clrChannelEPGInfoNext, CLR_GRAY); -THEME_CLR(Theme, clrChannelProgressBar, CLR_CHANNELPROGRESSBAR); -THEME_CLR(Theme, clrChannelProgressBarBack, CLR_CHANNELPROGRESSBARBACK); -THEME_CLR(Theme, clrChannelProgressBarBlend,CLR_CHANNELPROGRESSBARBLEND); -THEME_CLR(Theme, clrStatusIconsBack, CLR_TRANSPARENT); -THEME_CLR(Theme, clrRecNow, CLR_CHANNELRECACTIVE); -THEME_CLR(Theme, clrRecNowFont, CLR_WHITE); -THEME_CLR(Theme, clrRecNext, CLR_RECNEXT); -THEME_CLR(Theme, clrRecNextFont, CLR_BLACK); -//REPLAY -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); -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); -//TRACKS -THEME_CLR(Theme, clrTracksFontHead, CLR_GRAY); -THEME_CLR(Theme, clrTracksFontButtons, CLR_WHITE); -//Volume -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, clrMenuScrollBarBase, CLR_MENUSCROLLBARBASE); -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, clrSeparatorBorder, CLR_SEPARATORBORDER); -THEME_CLR(Theme, clrDiskAlert, CLR_DISKALERT); -THEME_CLR(Theme, clrTimersBack, CLR_MENUITEMHIGHBLEND); -THEME_CLR(Theme, clrTimersBackBlend, CLR_TRANSBLACK); -THEME_CLR(Theme, clrMenuFontHeader, CLR_WHITE); -THEME_CLR(Theme, clrMenuFontDate, CLR_WHITE); -THEME_CLR(Theme, clrMenuFontDiscUsage, CLR_WHITE); -THEME_CLR(Theme, clrMenuFontTimers, CLR_WHITE); -THEME_CLR(Theme, clrMenuFontTimersHeader, 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, clrMenuHeader, CLR_MENUHEADER); -THEME_CLR(Theme, clrMenuHeaderBlend, CLR_MENUHEADERBLEND); -THEME_CLR(Theme, clrAudioMenuHeader, CLR_AUDIOMENUHEADER); -THEME_CLR(Theme, clrProgressBar, CLR_PROGRESSBAR); -THEME_CLR(Theme, clrProgressBarBack, CLR_PROGRESSBARBACK); -THEME_CLR(Theme, clrProgressBarBlend, CLR_PROGRESSBARBLEND); -THEME_CLR(Theme, clrProgressBarHigh, CLR_PROGRESSBARHIGH); -THEME_CLR(Theme, clrProgressBarBackHigh, CLR_PROGRESSBARBACKHIGH); -THEME_CLR(Theme, clrProgressBarBlendHigh, CLR_PROGRESSBARBLENDHIGH); -THEME_CLR(Theme, clrMenuTextWindow, CLR_TRANSBLACK); -THEME_CLR(Theme, clrMenuChannelLogoBack, CLR_CHANNELLOGOBACK); -//BUTTONS -THEME_CLR(Theme, clrButtonRed, CLR_BUTTONRED); -THEME_CLR(Theme, clrButtonRedBorder, CLR_BUTTONREDBORDER); -THEME_CLR(Theme, clrButtonRedFont, CLR_WHITE); -THEME_CLR(Theme, clrButtonGreen, CLR_BUTTONGREEN); -THEME_CLR(Theme, clrButtonGreenBorder, CLR_BUTTONGREENBORDER); -THEME_CLR(Theme, clrButtonGreenFont, CLR_WHITE); -THEME_CLR(Theme, clrButtonYellow, CLR_BUTTONYELLOW); -THEME_CLR(Theme, clrButtonYellowBorder, CLR_BUTTONYELLOWBORDER); -THEME_CLR(Theme, clrButtonYellowFont, CLR_WHITE); -THEME_CLR(Theme, clrButtonBlue, CLR_BUTTONBLUE); -THEME_CLR(Theme, clrButtonBlueBorder, CLR_BUTTONBLUEBORDER); -THEME_CLR(Theme, clrButtonBlueFont, CLR_WHITE); -//MESSAGES -THEME_CLR(Theme, clrMessageFontStatus, CLR_WHITE); -THEME_CLR(Theme, clrMessageFontInfo, CLR_WHITE); -THEME_CLR(Theme, clrMessageFontWarning, CLR_WHITE); -THEME_CLR(Theme, clrMessageFontError, 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 "helpers.c" -#include "config.c" -cNopacityConfig config; -#include "geometrymanager.c" -cGeometryManager *geoManager; -#include "fontmanager.c" -cFontManager *fontManager; -#include "imagemagickwrapper.c" -#include "imagecache.c" -#include "imageloader.c" -#include "setup.c" #include "nopacity.h" -#include "displaychannelview.c" -#include "displaychannel.c" -#include "textwindow.c" -#include "timers.c" -#include "menuitem.c" -#include "menudetailview.c" -#include "displaymenuview.c" -#include "displaymenu.c" -#include "displayreplay.c" -#include "displayvolume.c" -#include "displaytracks.c" -#include "displaymessage.c" - - +#include "config.h" +#include "displaychannel.h" +#include "displaymenuview.h" +#include "displaymenu.h" +#include "displayreplay.h" +#include "displayvolume.h" +#include "displaytracks.h" +#include "displaymessage.h" cNopacity::cNopacity(cImageCache *imgCache) : cSkin("nOpacity", &::Theme) { displayMenu = NULL; @@ -216,7 +39,6 @@ cSkinDisplayMenu *cNopacity::DisplayMenu(void) { ReloadCaches(); cNopacityDisplayMenu *menu = new cNopacityDisplayMenu(imgCache); displayMenu = menu; - menuActive = true; return menu; } @@ -3,6 +3,7 @@ #include <vdr/skins.h> #include <vdr/videodir.h> +#include "imagecache.h" class cNopacityDisplayMenu; @@ -21,4 +22,5 @@ public: virtual cSkinDisplayTracks *DisplayTracks(const char *Title, int NumTracks, const char * const *Tracks); virtual cSkinDisplayMessage *DisplayMessage(void); }; + #endif //__NOPACITY_H diff --git a/services/remotetimers.h b/services/remotetimers.h index a69a7a0..ea31124 100644 --- a/services/remotetimers.h +++ b/services/remotetimers.h @@ -25,7 +25,7 @@ #define _SERVICE__H #ifndef __TIMERS_H -#include <vdr/timer.h> +#include <vdr/timers.h> #include <vdr/epg.h> #endif diff --git a/services/tvscraper.h b/services/tvscraper.h index fc278ad..8c3cf35 100644 --- a/services/tvscraper.h +++ b/services/tvscraper.h @@ -1,3 +1,10 @@ +#ifndef __NOPACITY_TVSCRAPER_H +#define __NOPACITY_TVSCRAPER_H + +#include <string> +#include <vector> +#include <vdr/epg.h> + enum tvMediaType { typeSeries, typeMovie, @@ -53,4 +60,5 @@ struct TVScraperGetFullInformation std::vector<tvMedia> fanart; std::vector<tvActor> actors; std::string description; -};
\ No newline at end of file +}; +#endif // __NOPACITY_TVSCRAPER_H
\ No newline at end of file @@ -40,7 +40,7 @@ void cNopacitySetup::Setup(void) { } eOSState cNopacitySetup::ProcessKey(eKeys Key) { - bool hadSubMenu = HasSubMenu(); + bool hadSubMenu = HasSubMenu(); eOSState state = cMenuSetupPage::ProcessKey(Key); if (hadSubMenu && Key == kOk) Store(); @@ -72,7 +72,7 @@ eOSState cNopacitySetup::ProcessKey(eKeys Key) { if (strcmp(ItemText, tr("Image Caching")) == 0) state = AddSubMenu(new cNopacitySetupCaching(&tmpConf, imgCache)); } - } + } return state; } @@ -91,7 +91,7 @@ void cNopacitySetup::Store(void) { } config = tmpConf; } - + //------------------------------------------------------------------------------------------------------------------ cMenuSetupSubMenu::cMenuSetupSubMenu(const char* Title, cNopacityConfig* data) : cOsdMenu(Title, 30) { @@ -214,7 +214,7 @@ void cNopacitySetupMenuDisplayMain::Set(void) { Add(new cMenuEditIntItem(tr("Header Logo Width"), tmpConf->GetValueRef("menuHeaderLogoWidth"), 30, 500)); Add(new cMenuEditIntItem(tr("Header Logo Height"), tmpConf->GetValueRef("menuHeaderLogoHeight"), 30, 500)); Add(new cMenuEditIntItem(tr("Adjust Font Size - Menu Items"), tmpConf->GetValueRef("fontMenuitemLarge"), -20, 20)); - + SetCurrent(Get(currentItem)); Display(); } @@ -268,7 +268,7 @@ void cNopacitySetupMenuDisplaySchedules::Set(void) { Add(new cMenuEditIntItem(tr("Adjust Font Size - Menu Item Small"), tmpConf->GetValueRef("fontMenuitemScheduleSmall"), -20, 20)); Add(new cMenuEditIntItem(tr("Adjust Font Size - EPG Info Window"), tmpConf->GetValueRef("fontEPGInfoWindow"), -20, 20)); Add(new cMenuEditIntItem(tr("Adjust Font Size - EPG Info Window Header"), tmpConf->GetValueRef("fontEPGInfoWindowLarge"), -20, 20)); - + SetCurrent(Get(currentItem)); Display(); } @@ -285,7 +285,7 @@ cNopacitySetupMenuDisplayChannels::cNopacitySetupMenuDisplayChannels(cNopacityCo void cNopacitySetupMenuDisplayChannels::Set(void) { int currentItem = Current(); Clear(); - + Add(new cMenuEditBoolItem(tr("Use narrow menu"), tmpConf->GetValueRef("narrowChannelMenu"))); if (tmpConf->GetValue("narrowChannelMenu")) Add(new cMenuEditIntItem(cString::sprintf("%s%s", *spacer, tr("Width (Percent of OSD Width)")), tmpConf->GetValueRef("menuWidthChannels"), 10, 97)); @@ -296,7 +296,7 @@ void cNopacitySetupMenuDisplayChannels::Set(void) { Add(new cMenuEditIntItem(tr("Number of EPG Entries in Schedules Info Window"), tmpConf->GetValueRef("numEPGEntriesChannelsMenu"), 1, 100)); Add(new cMenuEditIntItem(tr("Adjust Font Size - Menu Item"), tmpConf->GetValueRef("fontMenuitemChannel"), -20, 20)); Add(new cMenuEditIntItem(tr("Adjust Font Size - Menu Item Small"), tmpConf->GetValueRef("fontMenuitemChannelSmall"), -20, 20)); - + SetCurrent(Get(currentItem)); Display(); } @@ -310,13 +310,13 @@ cNopacitySetupMenuDisplayTimers::cNopacitySetupMenuDisplayTimers(cNopacityConfig void cNopacitySetupMenuDisplayTimers::Set(void) { int currentItem = Current(); Clear(); - + Add(new cMenuEditBoolItem(tr("Use narrow menu"), tmpConf->GetValueRef("narrowTimerMenu"))); if (tmpConf->GetValue("narrowTimerMenu")) Add(new cMenuEditIntItem(cString::sprintf("%s%s", *spacer, tr("Width (Percent of OSD Width)")), tmpConf->GetValueRef("menuWidthTimers"), 10, 97)); Add(new cMenuEditIntItem(tr("Adjust Font Size - Menu Item"), tmpConf->GetValueRef("fontMenuitemTimers"), -20, 20)); Add(new cMenuEditIntItem(tr("Adjust Font Size - Menu Item Small"), tmpConf->GetValueRef("fontMenuitemTimersSmall"), -20, 20)); - + SetCurrent(Get(currentItem)); Display(); } @@ -335,7 +335,7 @@ cNopacitySetupMenuDisplayRecordings::cNopacitySetupMenuDisplayRecordings(cNopaci void cNopacitySetupMenuDisplayRecordings::Set(void) { int currentItem = Current(); Clear(); - + Add(new cMenuEditBoolItem(tr("Use narrow menu"), tmpConf->GetValueRef("narrowRecordingMenu"))); if (tmpConf->GetValue("narrowRecordingMenu")) Add(new cMenuEditIntItem(cString::sprintf("%s%s", *spacer, tr("Width (Percent of OSD Width)")), tmpConf->GetValueRef("menuWidthRecordings"), 10, 97)); @@ -496,7 +496,7 @@ cNopacitySetupCaching::cNopacitySetupCaching(cNopacityConfig* data, cImageCache void cNopacitySetupCaching::Set(void) { int currentItem = Current(); Clear(); - + Add(new cMenuEditBoolItem(tr("Limit Logo Cache"), tmpConf->GetValueRef("limitLogoCache"))); if (tmpConf->GetValue("limitLogoCache")) { Add(new cMenuEditIntItem(cString::sprintf("%s%s", *spacer, tr("Maximal number of logos to cache")), tmpConf->GetValueRef("numLogosMax"), 1, 9999)); @@ -510,7 +510,7 @@ void cNopacitySetupCaching::Set(void) { Add(InfoItem(tr("Menu Item Logo cache"), (imgCache->GetCacheSize(ctLogoMenuItem)).c_str())); Add(InfoItem(tr("Timer Logo cache"), (imgCache->GetCacheSize(ctLogoTimer)).c_str())); Add(InfoItem(tr("Background Images cache"), (imgCache->GetCacheSize(ctSkinElement)).c_str())); - + SetCurrent(Get(currentItem)); Display(); }
\ No newline at end of file @@ -1,10 +1,13 @@ #ifndef __NOPACITY_SETUP_H #define __NOPACITY_SETUP_H +#include "config.h" +#include "imagecache.h" + class cNopacitySetup : public cMenuSetupPage { public: cNopacitySetup(cImageCache *imgCache); - virtual ~cNopacitySetup(); + virtual ~cNopacitySetup(); private: cNopacityConfig tmpConf; cImageCache *imgCache; diff --git a/skinnopacity.c b/skinnopacity.c index f31a902..2c6bd3e 100644 --- a/skinnopacity.c +++ b/skinnopacity.c @@ -8,7 +8,11 @@ #include <getopt.h> #include <vdr/plugin.h> -#include "nopacity.c" +#define DEFINE_CONFIG 1 +#include "config.h" +#include "nopacity.h" +#include "setup.h" + #if defined(APIVERSNUM) && APIVERSNUM < 10734 #error "VDR-1.7.34 API version or greater is required!" @@ -57,7 +61,7 @@ cPluginNopacity::~cPluginNopacity() const char *cPluginNopacity::CommandLineHelp(void) { - return + return " -e <EPGIMAGESPATH>, --epgimages=<IMAGESPATH> Set directory where epgimages are stored\n" " -i <ICONSPATH>, --iconpath=<ICONSPATH> Set directory where Menu Icons are stored\n" " -l <LOGOPATH>, --logopath=<LOGOPATH> Set directory where Channel Logos are stored.\n"; @@ -101,7 +105,7 @@ bool cPluginNopacity::Start(void) { return false; } else dsyslog("nopacity: TrueColor OSD found"); - + imgCache = new cImageCache(); nopacity = new cNopacity(imgCache); return nopacity; diff --git a/textwindow.c b/textwindow.c index 095b808..1d313c6 100644 --- a/textwindow.c +++ b/textwindow.c @@ -1,4 +1,9 @@ #include "textwindow.h" +#include "config.h" +#include "imagecache.h" +#include "imageloader.h" +#include "helpers.h" +#include <sstream> cNopacityTextWindow::cNopacityTextWindow(cOsd *osd, cFont *font, cRect *vidWin) { this->osd = osd; @@ -196,7 +201,7 @@ void cNopacityTextWindow::DrawText(int border, int left) { currentLineHeight += lineHeight; } } - cPixmap::Unlock(); + cPixmap::Unlock(); } void cNopacityTextWindow::SetEvent(const cEvent *event) { @@ -231,7 +236,7 @@ void cNopacityTextWindow::SetEvent(const cEvent *event) { //Description if (hasPoster && (y < (border + posterHeight))) { int heightNarrow = border + posterHeight - y; - DrawTextWrapperFloat(event->Description(), + DrawTextWrapperFloat(event->Description(), widthTextHeader, widthText, y, heightNarrow, border, font, Theme.Color(clrMenuFontDetailViewText), height); } else if (epgImageFound && (y < (border + config.GetValue("epgImageHeight")))) { @@ -278,7 +283,7 @@ void cNopacityTextWindow::SetRecording(const cRecording *recording) { cString recTitle; if (info->Title()) recTitle = info->Title(); - else + else recTitle = recording->Name(); //Title y = DrawTextWrapper(*recTitle, widthTextHeader, y, border, fontHeader, Theme.Color(clrMenuFontDetailViewHeaderTitle), height); @@ -301,7 +306,7 @@ void cNopacityTextWindow::SetRecording(const cRecording *recording) { } } -int cNopacityTextWindow::DrawTextWrapper(const char *text, int width, int top, int x, +int cNopacityTextWindow::DrawTextWrapper(const char *text, int width, int top, int x, const cFont *font, tColor color, int maxHeight) { cTextWrapper wrapper; int lineHeight = font->Height(); @@ -319,10 +324,10 @@ int cNopacityTextWindow::DrawTextWrapper(const char *text, int width, int top, i return y; } -void cNopacityTextWindow::DrawTextWrapperFloat(const char *text, int widthSmall, int widthFull, - int top, int heightNarrow, int x, const cFont *font, +void cNopacityTextWindow::DrawTextWrapperFloat(const char *text, int widthSmall, int widthFull, + int top, int heightNarrow, int x, const cFont *font, tColor color, int maxHeight) { - + if (!text) return; int lineHeight = font->Height(); @@ -409,13 +414,13 @@ void cNopacityTextWindow::ScaleVideoWindow(void) { void cNopacityTextWindow::Action(void) { if (! *text) return; - + DoSleep(config.GetValue("menuInfoTextDelay")*1000); if (config.GetValue("scalePicture") == 2) { - ScaleVideoWindow(); + ScaleVideoWindow(); } - + int border = 5; int left = 0; if (hasPoster || hasManualPoster) @@ -453,7 +458,7 @@ void cNopacityTextWindow::Action(void) { break; } } - + if (scrolling && Running()) { int scrollDelay = config.GetValue("menuInfoScrollDelay") * 1000; DoSleep(scrollDelay); @@ -465,7 +470,7 @@ void cNopacityTextWindow::Action(void) { FrameTime = 30; else if (config.GetValue("menuInfoScrollSpeed") == 3) FrameTime = 15; - + int maxY = pixmap->DrawPort().Height() - pixmap->ViewPort().Height(); bool doSleep = false; while (Running()) { diff --git a/textwindow.h b/textwindow.h index 2be9142..b870a48 100644 --- a/textwindow.h +++ b/textwindow.h @@ -1,5 +1,10 @@ #ifndef __NOPACITY_TEXTWINDOW_H #define __NOPACITY_TEXTWINDOW_H + +#include <vdr/skins.h> +#include <vdr/thread.h> +#include "services/tvscraper.h" + class cNopacityTextWindow : public cThread { private: cOsd *osd; @@ -1,4 +1,8 @@ #include "timers.h" +#include "config.h" +#include "imageloader.h" +#include "helpers.h" +#include <vdr/recording.h> cNopacityTimer::cNopacityTimer(cOsd *osd, cImageCache *imgCache, const cTimer *timer, const cFont *font, const cFont *fontLarge) { this->osd = osd; @@ -104,10 +108,10 @@ void cNopacityTimer::CalculateHeight(int space) { int numLines = showName.Lines(); if (isTimerConflict) { int lineHeight = fontLarge->Height(); - height = numLines * lineHeight + 2*space; + height = numLines * lineHeight + 2*space; } else { int lineHeight = font->Height(); - height = config.GetValue("timersLogoHeight") + (numLines +1)* lineHeight + 2*space; + height = config.GetValue("timersLogoHeight") + (numLines +1)* lineHeight + 2*space; } } @@ -129,7 +133,7 @@ void cNopacityTimer::Render(void) { pixmap->DrawImage(cPoint(1,1), imgBack); } else { pixmap->DrawRectangle(cRect(1, 1, width-2, height-2), Theme.Color(clrDiskAlert)); - } + } int numLines = showName.Lines(); int textWidth = 0; int x = 0; @@ -149,7 +153,7 @@ void cNopacityTimer::Render(void) { pixmap->DrawImage(cPoint(1,1), imgBack); } else { pixmap->DrawRectangle(cRect(1, 1, width-2, height-2), Theme.Color(clrDiskAlert)); - } + } } else { pixmap->Fill(Theme.Color(clrMenuBorder)); if (config.GetValue("displayType") == dtBlending) { @@ -157,17 +161,17 @@ void cNopacityTimer::Render(void) { pixmap->DrawImage(cPoint(1,1), imgBack); } else { pixmap->DrawRectangle(cRect(1, 1, width-2, height-2), Theme.Color(clrTimersBack)); - } + } } pixmapText->DrawText(cPoint(5, config.GetValue("timersLogoHeight")), *Date, Theme.Color(clrMenuFontTimersHeader), clrTransparent, fontLarge); - + int lineHeight = font->Height(); int yStart = config.GetValue("timersLogoHeight") + lineHeight + 3; int numLines = showName.Lines(); for (int line=0; line<numLines; line++) pixmapText->DrawText(cPoint(5, yStart+line*(lineHeight-2)), showName.GetLine(line), Theme.Color(clrMenuFontTimers), clrTransparent, font); - } + } } void cNopacityTimer::DrawLogo(void) { @@ -193,7 +197,7 @@ void cNopacityTimer::DrawLogo(void) { int y = 1; for (int line = 0; line < lines; line++) { pixmapLogo->DrawText(cPoint((width - fontLarge->Width(channel.GetLine(line)))/2, y+lineHeight*line), channel.GetLine(line), Theme.Color(clrMenuFontMenuItemHigh), clrTransparent, fontLarge); - } + } } } } @@ -1,40 +1,45 @@ -#ifndef __NOPACITY_TIMERS_H
-#define __NOPACITY_TIMERS_H
-
-class cNopacityTimer : public cListObject {
- private:
- cOsd *osd;
- cImageCache *imgCache;
- cPixmap *pixmapBackground;
- cPixmap *pixmap;
- cPixmap *pixmapLogo;
- cPixmap *pixmapText;
- const cTimer *timer;
- int numConflicts;
- bool isTimerConflict;
- const cFont *font;
- const cFont *fontLarge;
- int width;
- int height;
- int y;
- cString Date;
- cTextWrapper showName;
- void DrawLogo(void);
- public:
- cNopacityTimer(cOsd *osd, cImageCache *imgCache, const cTimer *timer, const cFont *font, const cFont *fontLarge);
- cNopacityTimer(cOsd *osd, cImageCache *imgCache, int numConflicts, const cFont *font, const cFont *fontLarge);
- virtual ~cNopacityTimer(void);
- void SetGeometry(int width, int y);
- void CreateDate(void);
- void CreateShowName(void);
- void CreateConflictText(void);
- void CalculateHeight(int space);
- void CreatePixmaps(int x);
- void SetAlpha(int alpha);
- void Show(void);
- void Hide(void);
- int GetHeight(void) {return pixmap->ViewPort().Height();}
- void Render(void);
-};
-
-#endif //__NOPACITY_TIMERS_H
+#ifndef __NOPACITY_TIMERS_H +#define __NOPACITY_TIMERS_H + +#include <vdr/tools.h> +#include <vdr/osd.h> +#include <vdr/timers.h> +#include "imagecache.h" + +class cNopacityTimer : public cListObject { + private: + cOsd *osd; + cImageCache *imgCache; + cPixmap *pixmapBackground; + cPixmap *pixmap; + cPixmap *pixmapLogo; + cPixmap *pixmapText; + const cTimer *timer; + int numConflicts; + bool isTimerConflict; + const cFont *font; + const cFont *fontLarge; + int width; + int height; + int y; + cString Date; + cTextWrapper showName; + void DrawLogo(void); + public: + cNopacityTimer(cOsd *osd, cImageCache *imgCache, const cTimer *timer, const cFont *font, const cFont *fontLarge); + cNopacityTimer(cOsd *osd, cImageCache *imgCache, int numConflicts, const cFont *font, const cFont *fontLarge); + virtual ~cNopacityTimer(void); + void SetGeometry(int width, int y); + void CreateDate(void); + void CreateShowName(void); + void CreateConflictText(void); + void CalculateHeight(int space); + void CreatePixmaps(int x); + void SetAlpha(int alpha); + void Show(void); + void Hide(void); + int GetHeight(void) {return pixmap->ViewPort().Height();} + void Render(void); +}; + +#endif //__NOPACITY_TIMERS_H |