diff options
-rw-r--r-- | HISTORY | 5 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | config.c | 2 | ||||
-rw-r--r-- | config.h | 2 | ||||
-rw-r--r-- | displaymenu.c | 57 | ||||
-rw-r--r-- | flat.h | 7 | ||||
-rw-r--r-- | imageloader.c | 64 | ||||
-rw-r--r-- | setup.c | 1 |
8 files changed, 101 insertions, 41 deletions
@@ -1,7 +1,7 @@ VDR Plugin 'skinflatplus' Revision History --------------------------------------- -2013-12-XX: Version 0.1.1 +2013-12-XX: Version 0.2.0 - [fix] load user decor settings - [fix] menu scrollbar size and margin @@ -13,7 +13,7 @@ VDR Plugin 'skinflatplus' Revision History - [update] add Patch from MegaV0lt, support for simple aspect & format, new icons - [update] only log not loaded images - [add] theme colors clrMenuTextFixedFont, clrMenuTimerItemDisabledFont, clrMenuTimerItemRecordingFont, - clrMenuItemProgramShortTextFont, clrMenuItemReplayExtraTextFont + clrMenuItemExtraTextFont - [add] add support for menu SetItemChannel - [add] add support for menu SetItemTimer - [add] add support for menu SetItemEvent (program menu) @@ -22,6 +22,7 @@ VDR Plugin 'skinflatplus' Revision History - [add] imagecache for faster image loading - [add] option MenuItemRecordingClearPercent set to 1 to clear the '%' in recording names (you have an cut icon to detect cutted recordings) - [add] option MenuItemRecordingShowFolderDate to show the date in the folder item from the newest/oldest recording in that folder (0 = disable, 1 = newest recording date, 2 = oldest recording date) +- [add] option MenuItemParseTilde for parse the tilde (of epgsearch) and draw the text after the tilde in clrMenuItemExtraTextFont color - [add] define DEBUGIMAGELOADTIME for debug output of imageloader time (search in cache, load from disk, scale) 2013-11-24: Version 0.1.0 - MegaV0lt Version @@ -64,7 +64,9 @@ INCLUDES += $(shell pkg-config --cflags Magick++) # vdrlogo_yavdr VDRLOGO = vdrlogo_default -DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DVDRLOGO=\"$(VDRLOGO)\" -DDEBUGIMAGELOADTIME +# -DDEBUGIMAGELOADTIME + +DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DVDRLOGO=\"$(VDRLOGO)\" LIBS += $(shell pkg-config --libs Magick++) @@ -49,6 +49,7 @@ cFlatConfig::cFlatConfig(void) { MenuItemRecordingClearPercent = 1; MenuItemRecordingShowFolderDate = 1; + MenuItemParseTilde = 1; decorBorderChannelByTheme = 1; decorBorderChannelTypeUser = 0; @@ -191,6 +192,7 @@ bool cFlatConfig::SetupParse(const char *Name, const char *Value) { else if (strcmp(Name, "RecordingSimpleAspectFormat") == 0) RecordingSimpleAspectFormat = atoi(Value); else if (strcmp(Name, "MenuItemRecordingClearPercent") == 0) MenuItemRecordingClearPercent = atoi(Value); else if (strcmp(Name, "MenuItemRecordingShowFolderDate") == 0) MenuItemRecordingShowFolderDate = atoi(Value); + else if (strcmp(Name, "MenuItemParseTilde") == 0) MenuItemParseTilde = atoi(Value); else return false; @@ -185,5 +185,7 @@ class cFlatConfig int MenuItemRecordingClearPercent; int MenuItemRecordingShowFolderDate; // 0 = disable, 1 = newest recording date, 2 = oldest recording date + int MenuItemParseTilde; + int DecorIndex; }; diff --git a/displaymenu.c b/displaymenu.c index 2be298d8..e4ed81ec 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -434,7 +434,20 @@ void cFlatDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool S menuPixmap->DrawText(cPoint(fontHeight + marginItem*2 + xt + Config.decorBorderMenuItemSize, y), s, ColorFg, ColorBg, font, AvailableTextWidth - xt - marginItem*2 - fontHeight); } else { - menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize, y), s, ColorFg, ColorBg, font); + if( Config.MenuItemParseTilde ) { + std::string tilde = s; + size_t found = tilde.find("~"); + if( found != string::npos ) { + std::string first = tilde.substr(0, found); + std::string second = tilde.substr(found +2, tilde.length() ); + + menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize, y), first.c_str(), ColorFg, ColorBg, font); + int l = font->Width( first.c_str() ); + menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize + l, y), second.c_str(), Theme.Color(clrMenuItemExtraTextFont), ColorBg, font); + } else + menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize, y), s, ColorFg, ColorBg, font); + } else + menuPixmap->DrawText(cPoint(xt + Config.decorBorderMenuItemSize, y), s, ColorFg, ColorBg, font); } } } @@ -1104,7 +1117,7 @@ bool cFlatDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Current menuItemWidth -= scrollBarWidth; tColor ColorFg, ColorBg, ColorShortTextFg; - ColorShortTextFg = Theme.Color(clrMenuItemProgramShortTextFont); + ColorShortTextFg = Theme.Color(clrMenuItemExtraTextFont); if (Current) { ColorFg = Theme.Color(clrItemCurrentFont); ColorBg = Theme.Color(clrItemCurrentBg); @@ -1329,12 +1342,22 @@ bool cFlatDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Current } } } else { - // extract date from Separator - std::string sep = Event->Title(); - std::size_t found = sep.find(" -"); - std::string date = sep.substr(found - 10, 10); - - menuPixmap->DrawText(cPoint(Left, Top), date.c_str(), ColorFg, ColorBg, font, menuItemWidth - Left - marginItem); + try { + // extract date from Separator + std::string sep = Event->Title(); + if( sep.size() > 12 ) { + std::size_t found = sep.find(" -"); + if( found >= 10 ) { + std::string date = sep.substr(found - 10, 10); + menuPixmap->DrawText(cPoint(Left, Top), date.c_str(), ColorFg, ColorBg, font, menuItemWidth - Left - marginItem); + } else + menuPixmap->DrawText(cPoint(Left, Top), Event->Title(), ColorFg, ColorBg, font, menuItemWidth - Left - marginItem); + } else + menuPixmap->DrawText(cPoint(Left, Top), Event->Title(), ColorFg, ColorBg, font, menuItemWidth - Left - marginItem); + } + catch( ... ) { + menuPixmap->DrawText(cPoint(Left, Top), Event->Title(), ColorFg, ColorBg, font, menuItemWidth - Left - marginItem); + } } sDecorBorder ib; @@ -1400,7 +1423,7 @@ bool cFlatDisplayMenu::SetItemRecording(const cRecording *Recording, int Index, menuItemWidth -= scrollBarWidth; tColor ColorFg, ColorBg, ColorExtraTextFg; - ColorExtraTextFg = Theme.Color(clrMenuItemReplayExtraTextFont); + ColorExtraTextFg = Theme.Color(clrMenuItemExtraTextFont); if (Current) { ColorFg = Theme.Color(clrItemCurrentFont); ColorBg = Theme.Color(clrItemCurrentBg); @@ -1465,16 +1488,16 @@ bool cFlatDisplayMenu::SetItemRecording(const cRecording *Recording, int Index, Left += img->Width() + marginItem; } - buffer = cString::sprintf(" %d", Total); - menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorFg, ColorBg, font, font->Width(" 9999"), fontHeight, taRight); - Left += font->Width(" 9999 "); + buffer = cString::sprintf(" %d", Total); + menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorFg, ColorBg, font, font->Width(" 999"), fontHeight, taRight); + Left += font->Width(" 999 "); if( imgRecNew ) menuIconsPixmap->DrawImage( cPoint(Left, Top), *imgRecNew ); Left += imgRecNew->Width() + marginItem; buffer = cString::sprintf("%d", New); menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorFg, ColorBg, font, menuItemWidth - Left - marginItem); - Left += font->Width( buffer ); + Left += font->Width(" 999 "); if( Config.MenuItemRecordingShowFolderDate != 0 ) { buffer = cString::sprintf(" (%s)", *ShortDateString(GetLastRecTimeFromFolder(Recording, Level))); menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorExtraTextFg, ColorBg, font, menuItemWidth - Left - marginItem); @@ -1535,16 +1558,16 @@ bool cFlatDisplayMenu::SetItemRecording(const cRecording *Recording, int Index, menuPixmap->DrawText(cPoint(Left, Top), RecName, ColorFg, ColorBg, font, menuItemWidth - Left - marginItem); Top += fontHeight; - buffer = cString::sprintf(" %d", Total); - menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorFg, ColorBg, fontSml, fontSml->Width(" 9999"), fontSmlHeight, taRight); - Left += fontSml->Width(" 9999 "); + buffer = cString::sprintf(" %d", Total); + menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorFg, ColorBg, fontSml, fontSml->Width(" 999"), fontSmlHeight, taRight); + Left += fontSml->Width(" 999 "); if( imgRecNewSml ) menuIconsPixmap->DrawImage( cPoint(Left, Top), *imgRecNewSml ); Left += imgRecNewSml->Width() + marginItem; buffer = cString::sprintf("%d", New); menuPixmap->DrawText(cPoint(Left, Top), buffer, ColorFg, ColorBg, fontSml, menuItemWidth - Left - marginItem); - Left += fontSml->Width( buffer ); + Left += fontSml->Width(" 999 "); if( Config.MenuItemRecordingShowFolderDate != 0 ) { buffer = cString::sprintf(" (%s)", *ShortDateString(GetLastRecTimeFromFolder(Recording, Level))); @@ -135,11 +135,8 @@ THEME_CLR(Theme, clrMenuItemCurrentBorderBg, 0xC03090B0); THEME_CLR(Theme, clrMenuTimerItemDisabledFont, 0xFFA0A0A0); THEME_CLR(Theme, clrMenuTimerItemRecordingFont, 0xFFEEEEEE); -// Program Menu -THEME_CLR(Theme, clrMenuItemProgramShortTextFont, 0xFFA0A0A0); - -// Replay Menu -THEME_CLR(Theme, clrMenuItemReplayExtraTextFont, 0xFFA0A0A0); +// For Tilde, Timer Extra, Program Short Text +THEME_CLR(Theme, clrMenuItemExtraTextFont, 0xFFA0A0A0); // Replay THEME_CLR(Theme, clrReplayBg, 0xC0101010); diff --git a/imageloader.c b/imageloader.c index 24134531..5dafd953 100644 --- a/imageloader.c +++ b/imageloader.c @@ -26,33 +26,45 @@ cImage* cImageLoader::LoadLogo(const char *logo, int width, int height) { #endif cImage *img; - uint32_t tick1 = GetMsTicks(); + #ifdef DEBUGIMAGELOADTIME + uint32_t tick1 = GetMsTicks(); + #endif + img = imgCache.GetImage( *File, width, height ); - uint32_t tick2 = GetMsTicks(); + #ifdef DEBUGIMAGELOADTIME + uint32_t tick2 = GetMsTicks(); dsyslog(" search in cache: %d ms", tick2 - tick1); #endif if( img != NULL ) return img; - uint32_t tick3 = GetMsTicks(); + #ifdef DEBUGIMAGELOADTIME + uint32_t tick3 = GetMsTicks(); + #endif + bool success = LoadImage(File); - uint32_t tick4 = GetMsTicks(); + if( !success ) { dsyslog("imageloader LoadLogo: %s could not be loaded", *File); return NULL; } #ifdef DEBUGIMAGELOADTIME + uint32_t tick4 = GetMsTicks(); dsyslog(" load file from disk: %d ms", tick4 - tick3); #endif - uint32_t tick5 = GetMsTicks(); + #ifdef DEBUGIMAGELOADTIME + uint32_t tick5 = GetMsTicks(); + #endif + img = CreateImage(width, height); - uint32_t tick6 = GetMsTicks(); + if( img == NULL ) return NULL; #ifdef DEBUGIMAGELOADTIME + uint32_t tick6 = GetMsTicks(); dsyslog(" scale logo: %d ms", tick6 - tick5); #endif @@ -71,19 +83,28 @@ cImage* cImageLoader::LoadIcon(const char *cIcon, int width, int height, bool pr #endif cImage *img; - uint32_t tick1 = GetMsTicks(); + + #ifdef DEBUGIMAGELOADTIME + uint32_t tick1 = GetMsTicks(); + #endif + img = imgCache.GetImage( *File, width, height ); - uint32_t tick2 = GetMsTicks(); + #ifdef DEBUGIMAGELOADTIME + uint32_t tick2 = GetMsTicks(); dsyslog(" search in cache: %d ms", tick2 - tick1); #endif if( img != NULL ) return img; - uint32_t tick3 = GetMsTicks(); + #ifdef DEBUGIMAGELOADTIME + uint32_t tick3 = GetMsTicks(); + #endif + bool success = LoadImage(File); - uint32_t tick4 = GetMsTicks(); + #ifdef DEBUGIMAGELOADTIME + uint32_t tick4 = GetMsTicks(); dsyslog(" load file from disk: %d ms", tick4 - tick3); #endif @@ -91,31 +112,42 @@ cImage* cImageLoader::LoadIcon(const char *cIcon, int width, int height, bool pr File = cString::sprintf("%s%s/%s.%s", *Config.iconPath, "default", cIcon, *logoExtension); #ifdef DEBUGIMAGELOADTIME dsyslog("imageloader load icon %s", *File); + uint32_t tick5 = GetMsTicks(); #endif - uint32_t tick5 = GetMsTicks(); + img = imgCache.GetImage( *File, width, height ); - uint32_t tick6 = GetMsTicks(); + #ifdef DEBUGIMAGELOADTIME + uint32_t tick6 = GetMsTicks(); dsyslog(" search in cache: %d ms", tick6 - tick5); #endif if( img != NULL ) return img; - uint32_t tick7 = GetMsTicks(); + #ifdef DEBUGIMAGELOADTIME + uint32_t tick7 = GetMsTicks(); + #endif + success = LoadImage(File); - uint32_t tick8 = GetMsTicks(); + #ifdef DEBUGIMAGELOADTIME + uint32_t tick8 = GetMsTicks(); dsyslog(" load file from disk: %d ms", tick8 - tick7); #endif + if( !success ) { dsyslog("imageloader LoadIcon: %s could not be loaded", *File); return NULL; } } - uint32_t tick9 = GetMsTicks(); + #ifdef DEBUGIMAGELOADTIME + uint32_t tick9 = GetMsTicks(); + #endif + img = CreateImage(width, height); - uint32_t tick10 = GetMsTicks(); + #ifdef DEBUGIMAGELOADTIME + uint32_t tick10 = GetMsTicks(); dsyslog(" scale logo: %d ms", tick10 - tick9); #endif if( img == NULL ) @@ -179,6 +179,7 @@ void cFlatSetup::Store(void) { SetupStore("RecordingSimpleAspectFormat", Config.RecordingSimpleAspectFormat); SetupStore("MenuItemRecordingClearPercent", Config.MenuItemRecordingClearPercent); SetupStore("MenuItemRecordingShowFolderDate", Config.MenuItemRecordingShowFolderDate); + SetupStore("MenuItemParseTilde", Config.MenuItemParseTilde); Config.Init(); } |