summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schirrmacher <vdr.skinflatplus@schirrmacher.eu>2014-02-16 14:07:19 +0100
committerMartin Schirrmacher <vdr.skinflatplus@schirrmacher.eu>2014-02-16 14:07:19 +0100
commitf59cce493e621f3e0d7d2a6c3416c755c91e766f (patch)
tree1427728bce33c368bab2317546eff87635ed949c
parentce3f1e6df06b3c25398fd5d958427ecc9edcaa2e (diff)
downloadskin-flatplus-f59cce493e621f3e0d7d2a6c3416c755c91e766f.tar.gz
skin-flatplus-f59cce493e621f3e0d7d2a6c3416c755c91e766f.tar.bz2
fixes in SetItemEvent
-rw-r--r--HISTORY3
-rw-r--r--baserender.c6
-rw-r--r--displaymenu.c85
-rw-r--r--flat.h3
4 files changed, 80 insertions, 17 deletions
diff --git a/HISTORY b/HISTORY
index 7749a8e3..81075ad9 100644
--- a/HISTORY
+++ b/HISTORY
@@ -11,9 +11,10 @@ VDR Plugin 'skinflatplus' Revision History
- [fix] fixes in TopBar while icon set
- [update] add Patch from MegaV0lt, support for simple aspect & format, new icons
- [update] only log not loaded images
-- [add] theme colors clrMenuTextFixedFont, clrMenuTimerItemDisabledFont, clrMenuTimerItemRecordingFont
+- [add] theme colors clrMenuTextFixedFont, clrMenuTimerItemDisabledFont, clrMenuTimerItemRecordingFont, clrMenuItemProgramShortTextFont
- [add] add support for menu SetItemChannel
- [add] add support for menu SetItemTimer
+- [add] add support for menu SetItemEvent (program menu)
- [add] imagescaler from skin nopacity (thank you!)
- [add] imagecache for faster image loading
diff --git a/baserender.c b/baserender.c
index 891c8754..36935904 100644
--- a/baserender.c
+++ b/baserender.c
@@ -84,7 +84,7 @@ void cFlatBaseRender::CreateOsd(int left, int top, int width, int height) {
if (osd) {
tArea Area = { 0, 0, width, height, 32 };
if (osd->SetAreas(&Area, 1) == oeOk) {
- dsyslog("skinflatplus: create osd SUCCESS left: %d top: %d width: %d height: %d", left, top, width, height);
+ //dsyslog("skinflatplus: create osd SUCCESS left: %d top: %d width: %d height: %d", left, top, width, height);
return;
}
}
@@ -508,8 +508,12 @@ int cFlatBaseRender::ContentScrollOffset(void) {
if ( ((-1)*contentPixmap->DrawPort().Point().Y() + contentHeight + h) > contentDrawPortHeight) {
offset = (double)1 - ScrollbarSize();
+ //dsyslog("1 offset %f h %d return %d", offset, h, (int)(ContentScrollTotal() * offset));
} else {
offset = (double)((-1)*contentPixmap->DrawPort().Point().Y()) / (double)((-1)*contentPixmap->DrawPort().Point().Y() + contentHeight);
+ //dsyslog("2 offset %f h %d return %d", offset, h, (int)(ContentScrollTotal() * offset));
+ //dsyslog("contentHeight %d Y %d", contentHeight, contentPixmap->DrawPort().Point().Y());
+ //dsyslog("contentDrawPortHeight %d Y %d", contentDrawPortHeight, contentPixmap->DrawPort().Point().Y());
}
return ContentScrollTotal() * offset;
diff --git a/displaymenu.c b/displaymenu.c
index a6bf95c3..565eec3c 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -93,7 +93,9 @@ cFlatDisplayMenu::~cFlatDisplayMenu() {
void cFlatDisplayMenu::SetMenuCategory(eMenuCategory MenuCategory) {
ItemBorderClear();
-
+ isScrolling = false;
+ ShowRecording = ShowEvent = ShowText = false;
+
menuCategory = MenuCategory;
if( menuCategory == mcChannel ) {
@@ -110,7 +112,7 @@ void cFlatDisplayMenu::SetMenuCategory(eMenuCategory MenuCategory) {
if( Config.MenuEventView == 0 || Config.MenuEventView == 1 )
itemEventHeight = fontHeight + Config.MenuItemPadding + Config.decorBorderMenuItemSize*2;
else if( Config.MenuEventView == 2 || Config.MenuEventView == 3 )
- itemEventHeight = fontHeight + fontSmlHeight + marginItem + Config.MenuItemPadding + Config.decorBorderMenuItemSize*2;
+ itemEventHeight = fontHeight + fontSmlHeight + marginItem*2 + Config.MenuItemPadding + Config.decorBorderMenuItemSize*2 + Config.decorProgressMenuItemSize/2;
}
}
@@ -186,6 +188,8 @@ void cFlatDisplayMenu::Clear(void) {
DecorBorderClearByFrom(BorderMenuItem);
DecorBorderClearAll();
isScrolling = false;
+
+ ShowRecording = ShowEvent = ShowText = false;
}
void cFlatDisplayMenu::SetTitle(const char *Title) {
@@ -1034,7 +1038,6 @@ bool cFlatDisplayMenu::SetItemTimer(const cTimer *Timer, int Index, bool Current
menuPixmap->DrawText(cPoint(Left, Top + fontHeight), File, ColorFg, ColorBg, fontSml, menuItemWidth - Left - marginItem);
}
-
sDecorBorder ib;
ib.Left = Config.decorBorderMenuItemSize;
ib.Top = topBarHeight + marginItem + Config.decorBorderTopBarSize*2 + Config.decorBorderMenuItemSize + y;
@@ -1082,22 +1085,25 @@ bool cFlatDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Current
if( Config.MenuEventView == 0 )
return false;
+ dsyslog("menuItemWidth %d, isScrolling: %d", menuItemWidth, isScrolling);
+
cImage *img = NULL;
cString buffer;
int y = Index * itemEventHeight;
int Height = fontHeight;
if( Config.MenuEventView == 2 || Config.MenuEventView == 3 )
- Height = fontHeight + fontSmlHeight + marginItem;
+ Height = fontHeight + fontSmlHeight + marginItem*2 + Config.decorProgressMenuItemSize/2;
menuItemWidth = menuWidth - Config.decorBorderMenuItemSize*2;
if( Config.MenuEventView == 2 || Config.MenuEventView == 3 )
- menuItemWidth *= 0.5;
+ menuItemWidth *= 0.6;
if( isScrolling )
menuItemWidth -= scrollBarWidth;
- tColor ColorFg, ColorBg;
+ tColor ColorFg, ColorBg, ColorShortTextFg;
+ ColorShortTextFg = Theme.Color(clrMenuItemProgramShortTextFont);
if (Current) {
ColorFg = Theme.Color(clrItemCurrentFont);
ColorBg = Theme.Color(clrItemCurrentBg);
@@ -1193,9 +1199,49 @@ bool cFlatDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Current
Left += fontHeight + marginItem * 2;
LeftSecond = Left;
- w = menuWidth / 10 * 3;
+ w = menuWidth / 10 * 2;
menuPixmap->DrawText(cPoint(Left, Top), Channel->ShortName(true), ColorFg, ColorBg, font, w);
Left += w + marginItem * 2;
+
+ if( Event ) {
+ int PBWidth = menuItemWidth/20;
+ time_t now = time(NULL);
+ if( (now >= Event->StartTime()) && (now <= Event->EndTime()) ) {
+ int total = Event->EndTime() - Event->StartTime();
+ if( total > 0 ) {
+ // calculate progress bar
+ double progress = (int)roundf( (float)(time(NULL) - Event->StartTime()) / (float) (Event->Duration()) * 100.0);
+ if(progress < 0)
+ progress = 0.;
+ else if(progress > 100)
+ progress = 100;
+ int PBTop = y + (itemEventHeight - Config.MenuItemPadding)/2 - Config.decorProgressMenuItemSize/2 - Config.decorBorderMenuItemSize;
+ int PBLeft = Left;
+ int PBHeight = Config.decorProgressMenuItemSize;
+
+
+ if( (Config.MenuEventView == 2 || Config.MenuEventView == 3) ) {
+ PBTop = y + fontHeight + fontSmlHeight + marginItem;
+ PBWidth = menuItemWidth - LeftSecond - scrollBarWidth - marginItem * 2;
+ if( isScrolling )
+ PBWidth += scrollBarWidth;
+
+ PBLeft = LeftSecond;
+ PBHeight = Config.decorProgressMenuItemSize / 2;
+ }
+
+ if( Current )
+ ProgressBarDrawRaw(menuPixmap, menuPixmap, cRect( PBLeft, PBTop, PBWidth, PBHeight),
+ cRect( PBLeft, PBTop, PBWidth, PBHeight), progress, 100,
+ Config.decorProgressMenuItemCurFg, Config.decorProgressMenuItemCurBarFg, Config.decorProgressMenuItemCurBg, Config.decorProgressMenuItemType, false);
+ else
+ ProgressBarDrawRaw(menuPixmap, menuPixmap, cRect( PBLeft, PBTop, PBWidth, PBHeight),
+ cRect( PBLeft, PBTop, PBWidth, PBHeight), progress, 100,
+ Config.decorProgressMenuItemFg, Config.decorProgressMenuItemBarFg, Config.decorProgressMenuItemBg, Config.decorProgressMenuItemType, false);
+ }
+ }
+ Left += PBWidth + marginItem*2;
+ }
}
if( WithDate && Event ) {
@@ -1260,17 +1306,26 @@ bool cFlatDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Current
}
Left += imageHeight + marginItem;
- if( (Config.MenuEventView == 2 || Config.MenuEventView == 3) && Channel )
+ if( (Config.MenuEventView == 2 || Config.MenuEventView == 3) && Channel ) {
menuPixmap->DrawText(cPoint(Left, Top), Event->Title(), ColorFg, ColorBg, fontSml, menuItemWidth - Left - marginItem);
- else if( (Config.MenuEventView == 2 || Config.MenuEventView == 3) ) {
+ if( Event->ShortText() ) {
+ Left += fontSml->Width( Event->Title() );
+ cString ShortText = cString::sprintf(" %s", Event->ShortText());
+ menuPixmap->DrawText(cPoint(Left, Top), ShortText, ColorShortTextFg, ColorBg, fontSml, menuItemWidth - Left - marginItem);
+ }
+ } else if( (Config.MenuEventView == 2 || Config.MenuEventView == 3) ) {
menuPixmap->DrawText(cPoint(Left, Top), Event->Title(), ColorFg, ColorBg, font, menuItemWidth - Left - marginItem);
-
- } else
+ if( Event->ShortText() ) {
+ Top += fontHeight;
+ menuPixmap->DrawText(cPoint(Left, Top), Event->ShortText(), ColorShortTextFg, ColorBg, fontSml, menuItemWidth - Left - marginItem);
+ }
+ } else {
menuPixmap->DrawText(cPoint(Left, Top), Event->Title(), ColorFg, ColorBg, font, menuItemWidth - Left - marginItem);
-
- if( (Config.MenuEventView == 2 || Config.MenuEventView == 3) && !Channel ) {
- Top += fontHeight;
- menuPixmap->DrawText(cPoint(Left, Top), Event->ShortText(), ColorFg, ColorBg, fontSml, menuItemWidth - Left - marginItem);
+ if( Event->ShortText() ) {
+ Left += font->Width(Event->Title());
+ cString ShortText = cString::sprintf(" %s", Event->ShortText());
+ menuPixmap->DrawText(cPoint(Left, Top), ShortText, ColorShortTextFg, ColorBg, font, menuItemWidth - Left - marginItem);
+ }
}
}
diff --git a/flat.h b/flat.h
index 1ef62f5f..a1bf2bb7 100644
--- a/flat.h
+++ b/flat.h
@@ -129,6 +129,9 @@ THEME_CLR(Theme, clrMenuItemCurrentBorderBg, 0xC03090B0);
THEME_CLR(Theme, clrMenuTimerItemDisabledFont, 0xFFA0A0A0);
THEME_CLR(Theme, clrMenuTimerItemRecordingFont, 0xFFEEEEEE);
+// Program Menu
+THEME_CLR(Theme, clrMenuItemProgramShortTextFont, 0xFFA0A0A0);
+
// Replay
THEME_CLR(Theme, clrReplayBg, 0xC0101010);
THEME_CLR(Theme, clrReplayFont, 0xFFEEEEEE);