diff options
author | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-02-09 11:50:07 +0100 |
---|---|---|
committer | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-02-09 11:50:07 +0100 |
commit | 1f5c994a972ed78fa533539dfe1a99af16beb1a3 (patch) | |
tree | e5c75614b8e1ff325ac0a93183a6286b5ac2585f | |
parent | ba111a3223473e29352d1441115bb0e445cf217f (diff) | |
download | skin-flatplus-1f5c994a972ed78fa533539dfe1a99af16beb1a3.tar.gz skin-flatplus-1f5c994a972ed78fa533539dfe1a99af16beb1a3.tar.bz2 |
add SetItemChannel view, fix scrollbar not visible
-rw-r--r-- | HISTORY | 3 | ||||
-rw-r--r-- | baserender.c | 121 | ||||
-rw-r--r-- | baserender.h | 20 | ||||
-rw-r--r-- | config.c | 4 | ||||
-rw-r--r-- | config.h | 2 | ||||
-rw-r--r-- | displaymenu.c | 173 | ||||
-rw-r--r-- | displaymenu.h | 2 | ||||
-rw-r--r-- | po/de_DE.po | 7 | ||||
-rw-r--r-- | setup.c | 13 |
9 files changed, 260 insertions, 85 deletions
@@ -5,6 +5,9 @@ VDR Plugin 'skinflatplus' Revision History - [fix] load user decor settings - [fix] menu scrollbar size and margin +- [fix] no scrollbar in some situations +- [add] add support for menu SetItemChannel +- [update] add Patch from MegaV0lt, support for simple aspect & format, new icons 2013-11-24: Version 0.1.0 - MegaV0lt Version Special thanks to MegaV0lt@VDR-Portal for diff --git a/baserender.c b/baserender.c index 702ca67a..c0747106 100644 --- a/baserender.c +++ b/baserender.c @@ -23,6 +23,7 @@ cFlatBaseRender::cFlatBaseRender(void) { scrollBarWidth = 10; buttonsHeight = 0; + buttonsDrawn = false; osd = NULL; topBarPixmap = NULL; @@ -265,13 +266,16 @@ void cFlatBaseRender::ButtonsSet(const char *Red, const char *Green, const char int buttonWidth = (WidthMargin / 4) - Config.decorBorderButtonSize*2; buttonsPixmap->Fill(clrTransparent); - + + buttonsDrawn = false; + int x = 0; if( !(!Config.ButtonsShowEmpty && !Red) ) { buttonsPixmap->DrawText(cPoint(x, 0), Red, Theme.Color(clrButtonFont), Theme.Color(clrButtonBg), font, buttonWidth, fontHeight + marginButtonColor, taCenter); buttonsPixmap->DrawRectangle(cRect(x, fontHeight + marginButtonColor, buttonWidth, buttonColorHeight), Theme.Color(clrButtonRed)); DecorBorderDraw(x + Config.decorBorderButtonSize, buttonsTop, buttonWidth, buttonsHeight, Config.decorBorderButtonSize, Config.decorBorderButtonType, Config.decorBorderButtonFg, Config.decorBorderButtonBg); + buttonsDrawn = true; } x += buttonWidth + marginItem + Config.decorBorderButtonSize*2; @@ -280,6 +284,7 @@ void cFlatBaseRender::ButtonsSet(const char *Red, const char *Green, const char buttonsPixmap->DrawRectangle(cRect(x, fontHeight + marginButtonColor, buttonWidth, buttonColorHeight), Theme.Color(clrButtonGreen)); DecorBorderDraw(x + Config.decorBorderButtonSize, buttonsTop, buttonWidth, buttonsHeight, Config.decorBorderButtonSize, Config.decorBorderButtonType, Config.decorBorderButtonFg, Config.decorBorderButtonBg); + buttonsDrawn = true; } x += buttonWidth + marginItem + Config.decorBorderButtonSize*2; @@ -288,6 +293,7 @@ void cFlatBaseRender::ButtonsSet(const char *Red, const char *Green, const char buttonsPixmap->DrawRectangle(cRect(x, fontHeight + marginButtonColor, buttonWidth, buttonColorHeight), Theme.Color(clrButtonYellow)); DecorBorderDraw(x + Config.decorBorderButtonSize, buttonsTop, buttonWidth, buttonsHeight, Config.decorBorderButtonSize, Config.decorBorderButtonType, Config.decorBorderButtonFg, Config.decorBorderButtonBg); + buttonsDrawn = true; } x += buttonWidth + marginItem + Config.decorBorderButtonSize*2; @@ -298,9 +304,14 @@ void cFlatBaseRender::ButtonsSet(const char *Red, const char *Green, const char buttonsPixmap->DrawRectangle(cRect(x, fontHeight + marginButtonColor, buttonWidth, buttonColorHeight), Theme.Color(clrButtonBlue)); DecorBorderDraw(x + Config.decorBorderButtonSize, buttonsTop, buttonWidth, buttonsHeight, Config.decorBorderButtonSize, Config.decorBorderButtonType, Config.decorBorderButtonFg, Config.decorBorderButtonBg); + buttonsDrawn = true; } } +bool cFlatBaseRender::ButtonsDrawn(void) { + return buttonsDrawn; +} + void cFlatBaseRender::MessageCreate(void) { messageHeight = fontHeight + marginItem*2; int top = osdHeight - Config.MessageOffset - messageHeight - Config.decorBorderMessageSize; @@ -342,10 +353,10 @@ void cFlatBaseRender::MessageClear(void) { DecorBorderRedrawAll(); } -void cFlatBaseRender::ContentCreate(int Left, int Top, int Width, int Height, bool FixedFont) { +void cFlatBaseRender::ContentCreate(int Left, int Top, int Width, int Height, int FontType) { contentHasScrollbar = false; contentShown = false; - contentFixedFont = FixedFont; + contentFontType = FontType; contentLeft = Left; contentTop = Top; @@ -353,26 +364,37 @@ void cFlatBaseRender::ContentCreate(int Left, int Top, int Width, int Height, bo contentHeight = Height; int lines = ContentVisibleLines(); - contentHeight = lines * fontHeight; - if( contentFixedFont ) + if( contentFontType == 0 ) + contentHeight = lines * fontHeight; + else if( contentFontType == 1 ) contentHeight = lines * fontFixedHeight; + else if( contentFontType == 2 ) + contentHeight = lines * fontSmlHeight; } -void cFlatBaseRender::ContentSet(const char *Text, bool FixedFont, tColor ColorFg, tColor ColorBg) { - contentFixedFont = FixedFont; - if( contentFixedFont ) - contentWrapper.Set(Text, fontFixed, contentWidth - marginItem*2); - else +void cFlatBaseRender::ContentSet(const char *Text, tColor ColorFg, tColor ColorBg) { + if( contentFontType == 0 ) contentWrapper.Set(Text, font, contentWidth - marginItem*2); + else if( contentFontType == 1 ) + contentWrapper.Set(Text, fontFixed, contentWidth - marginItem*2); + else if( contentFontType == 2 ) + contentWrapper.Set(Text, fontSml, contentWidth - marginItem*2); contentColorFg = ColorFg; contentColorBg = ColorBg; - int contentWrapperHeight = (contentWrapper.Lines()+1) * fontHeight; - contentTextHeight = (contentWrapper.Lines()) * fontHeight + marginItem; - if( contentFixedFont ) + int contentWrapperHeight = 0; + if( contentFontType == 0 ) { + contentWrapperHeight = (contentWrapper.Lines()+1) * fontHeight; + contentTextHeight = (contentWrapper.Lines()) * fontHeight + marginItem; + } else if( contentFontType == 1 ) { contentWrapperHeight = (contentWrapper.Lines()+1) * fontFixedHeight; + contentTextHeight = (contentWrapper.Lines()) * fontFixedHeight + marginItem; + } else if( contentFontType == 2 ) { + contentWrapperHeight = (contentWrapper.Lines()+1) * fontSmlHeight; + contentTextHeight = (contentWrapper.Lines()) * fontSmlHeight + marginItem; + } if( contentWrapperHeight > contentHeight ) { contentDrawPortHeight = contentWrapperHeight; @@ -399,16 +421,22 @@ void cFlatBaseRender::ContentSet(const char *Text, bool FixedFont, tColor ColorF contentShown = true; } -bool cFlatBaseRender::ContentWillItBeScrollable(int Width, int Height, const char *Text, bool FixedFont) { +bool cFlatBaseRender::ContentWillItBeScrollable(int Width, int Height, const char *Text, int FontType) { cTextWrapper wrapper; - if( FixedFont ) - wrapper.Set(Text, fontFixed, Width - marginItem*2); - else + if( FontType == 0 ) wrapper.Set(Text, font, Width - marginItem*2); + else if( FontType == 1 ) + wrapper.Set(Text, fontFixed, Width - marginItem*2); + else if( FontType == 2 ) + wrapper.Set(Text, fontSml, Width - marginItem*2); - int VisibleLines = Height / fontHeight; - if( FixedFont ) + int VisibleLines = 0; + if( FontType == 0 ) + VisibleLines = Height / fontHeight; + else if( FontType == 1 ) VisibleLines = Height / fontFixedHeight; + else if( FontType == 2 ) + VisibleLines = Height / fontSmlHeight; if( wrapper.Lines() > 0 && wrapper.Lines() > VisibleLines ) return true; @@ -438,9 +466,13 @@ int cFlatBaseRender::ContentScrollTotal(void) { int cFlatBaseRender::ContentScrollOffset(void) { double offset; - int h = fontHeight; - if( contentFixedFont ) + int h = 0; + if( contentFontType == 0 ) + h = fontHeight; + else if( contentFontType == 1 ) h = fontFixedHeight; + else if( contentFontType == 2 ) + h = fontSmlHeight; if ( ((-1)*contentPixmap->DrawPort().Point().Y() + contentHeight + h) > contentDrawPortHeight) { offset = (double)1 - ScrollbarSize(); @@ -452,42 +484,51 @@ int cFlatBaseRender::ContentScrollOffset(void) { } int cFlatBaseRender::ContentVisibleLines(void) { - if( contentFixedFont ) - return contentHeight / fontFixedHeight; - else + if( contentFontType == 0 ) return contentHeight / fontHeight; + else if( contentFontType == 1 ) + return contentHeight / fontFixedHeight; + else if( contentFontType == 2 ) + return contentHeight / fontSmlHeight; + return 0; } bool cFlatBaseRender::ContentScroll(bool Up, bool Page) { int aktHeight = contentPixmap->DrawPort().Point().Y(); int totalHeight = contentPixmap->DrawPort().Height(); int screenHeight = contentPixmap->ViewPort().Height(); - int lineHeight = fontHeight; - if( contentFixedFont ) + int lineHeight = 0; + + if( contentFontType == 0 ) + lineHeight = fontHeight; + else if( contentFontType == 1 ) lineHeight = fontFixedHeight; + else if( contentFontType == 2 ) + lineHeight = fontSmlHeight; + bool scrolled = false; - if (Up) { - if (Page) { + if( Up ) { + if( Page ) { int newY = aktHeight + screenHeight; - if (newY > 0) + if( newY > 0 ) newY = 0; contentPixmap->SetDrawPortPoint(cPoint(0, newY)); scrolled = true; } else { - if (aktHeight < 0) { + if( aktHeight < 0 ) { contentPixmap->SetDrawPortPoint(cPoint(0, aktHeight + lineHeight)); scrolled = true; } } } else { - if (Page) { + if( Page ) { int newY = aktHeight - screenHeight; - if ((-1)*newY > totalHeight - screenHeight) + if( (-1)*newY > totalHeight - screenHeight ) newY = (-1)*(totalHeight - screenHeight); contentPixmap->SetDrawPortPoint(cPoint(0, newY)); scrolled = true; } else { - if (totalHeight - ((-1)*aktHeight + lineHeight) > screenHeight) { + if( totalHeight - ((-1)*aktHeight + lineHeight) > screenHeight ) { contentPixmap->SetDrawPortPoint(cPoint(0, aktHeight - lineHeight)); scrolled = true; } @@ -510,12 +551,15 @@ void cFlatBaseRender::contentDraw(void) { int linesText = contentWrapper.Lines(); int currentHeight = 0; for (int i=0; i < linesText; i++) { - if( contentFixedFont ) { - currentHeight = (i)*fontFixedHeight; - contentPixmap->DrawText(cPoint(marginItem, currentHeight), contentWrapper.GetLine(i), contentColorFg, contentColorBg, fontFixed, contentWidth - marginItem*2); - } else { + if( contentFontType == 0 ) { currentHeight = (i)*fontHeight; contentPixmap->DrawText(cPoint(marginItem, currentHeight), contentWrapper.GetLine(i), contentColorFg, contentColorBg, font, contentWidth - marginItem*2); + } else if( contentFontType == 1 ) { + currentHeight = (i)*fontFixedHeight; + contentPixmap->DrawText(cPoint(marginItem, currentHeight), contentWrapper.GetLine(i), contentColorFg, contentColorBg, fontFixed, contentWidth - marginItem*2); + } else if( contentFontType == 2 ) { + currentHeight = (i)*fontSmlHeight; + contentPixmap->DrawText(cPoint(marginItem, currentHeight), contentWrapper.GetLine(i), contentColorFg, contentColorBg, fontSml, contentWidth - marginItem*2); } } } @@ -843,6 +887,9 @@ void cFlatBaseRender::ProgressBarDrawMark(int posMark, int posMarkLast, int posC } void cFlatBaseRender::ScrollbarDraw(cPixmap *Pixmap, int Left, int Top, int Height, int Total, int Offset, int Shown, bool CanScrollUp, bool CanScrollDown) { + if( !Pixmap ) + return; + if (Total > 0 && Total > Shown) { int scrollHeight = max(int((Height) * double(Shown) / Total + 0.5), 5); int scrollTop = min(int(Top + (Height) * double(Offset) / Total + 0.5), Top + Height - scrollHeight); diff --git a/baserender.h b/baserender.h index db1fa3a2..8673be76 100644 --- a/baserender.h +++ b/baserender.h @@ -66,7 +66,8 @@ class cFlatBaseRender cPixmap *buttonsPixmap; int buttonsWidth, buttonsHeight, buttonsTop; int marginButtonColor, buttonColorHeight; - + bool buttonsDrawn; + // Nachricht cPixmap *messagePixmap; int messageWidth, messageHeight; @@ -78,7 +79,7 @@ class cFlatBaseRender int contentTextHeight; bool contentHasScrollbar; bool contentShown; - bool contentFixedFont; + int contentFontType; tColor contentColorFg, contentColorBg; cTextWrapper contentWrapper; @@ -125,7 +126,8 @@ class cFlatBaseRender void ButtonsCreate(void); void ButtonsSet(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL); - + bool ButtonsDrawn(void); + void MessageCreate(void); void MessageSet(eMessageType Type, const char *Text); void MessageClear(void); @@ -139,11 +141,17 @@ class cFlatBaseRender void ScrollbarDraw(cPixmap *Pixmap, int Left, int Top, int Height, int Total, int Offset, int Shown, bool CanScrollUp, bool CanScrollDown); int ScrollBarWidth(void); - void ContentCreate(int Left, int Top, int Width, int Height, bool FixedFont); - void ContentSet(const char *Text, bool FixedFont, tColor ColorFg, tColor ColorBg); + /* int FontType + * 0 = NormalFont + * 1 = FixedFont + * 2 = SmallFont + */ + + void ContentCreate(int Left, int Top, int Width, int Height, int FontType); + void ContentSet(const char *Text, tColor ColorFg, tColor ColorBg); bool ContentIsShown(void); bool ContentScrollable(void); - bool ContentWillItBeScrollable(int Width, int Height, const char *Text, bool FixedFont); + bool ContentWillItBeScrollable(int Width, int Height, const char *Text, int FontType); int ContentScrollTotal(void); int ContentScrollOffset(void); int ContentVisibleLines(void); @@ -42,7 +42,7 @@ cFlatConfig::cFlatConfig(void) { MainMenuItemScale = 1.0; - MenuChannelType = 1; + MenuChannelView = 1; decorBorderChannelByTheme = 1; decorBorderChannelTypeUser = 0; @@ -177,7 +177,7 @@ bool cFlatConfig::SetupParse(const char *Name, const char *Value) { else if (strcmp(Name, "TopBarMenuIconShow") == 0) TopBarMenuIconShow = atoi(Value); else if (strcmp(Name, "DecorIndex") == 0) DecorIndex = atoi(Value); else if (strcmp(Name, "MainMenuItemScale") == 0) MainMenuItemScale = atod(Value); - else if (strcmp(Name, "MenuChannelType") == 0) MenuChannelType = atoi(Value); + else if (strcmp(Name, "MenuChannelView") == 0) MenuChannelView = atoi(Value); else if (strcmp(Name, "ChannelSimpleAspectFormat") == 0) ChannelSimpleAspectFormat = atoi(Value); else if (strcmp(Name, "RecordingSimpleAspectFormat") == 0) RecordingSimpleAspectFormat = atoi(Value); @@ -177,7 +177,7 @@ class cFlatConfig double MainMenuItemScale; - int MenuChannelType; + int MenuChannelView; int DecorIndex; }; diff --git a/displaymenu.c b/displaymenu.c index f898058b..29ae35cb 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -44,8 +44,8 @@ cFlatDisplayMenu::cFlatDisplayMenu(void) { itemChannelHeight = fontHeight + Config.MenuItemPadding + Config.decorBorderMenuItemSize*2; scrollBarWidth = ScrollBarWidth() + marginItem; - scrollBarHeight = osdHeight - (topBarHeight + Config.decorBorderTopBarSize*2 + - buttonsHeight + Config.decorBorderButtonSize*2 + marginItem*3 ); + scrollBarHeight = osdHeight - (topBarHeight + Config.decorBorderTopBarSize*2 + marginItem*3 + buttonsHeight + Config.decorBorderButtonSize*2); + scrollBarTop = topBarHeight + marginItem + Config.decorBorderTopBarSize*2; isScrolling = false; ShowEvent = false; @@ -62,8 +62,8 @@ cFlatDisplayMenu::cFlatDisplayMenu(void) { chWidth = menuWidth - Config.decorBorderMenuContentHeadSize*2; chHeight = fontHeight + fontSmlHeight*2 + marginItem*2; contentHeadPixmap = osd->CreatePixmap(1, cRect(chLeft, chTop, chWidth, chHeight)); - - scrollbarPixmap = osd->CreatePixmap(2, cRect(0, scrollBarTop, menuWidth, scrollBarHeight)); + + scrollbarPixmap = osd->CreatePixmap(2, cRect(0, scrollBarTop, menuWidth, scrollBarHeight + buttonsHeight + Config.decorBorderButtonSize*2)); menuPixmap->Fill(clrTransparent); menuIconsPixmap->Fill(clrTransparent); @@ -90,11 +90,11 @@ void cFlatDisplayMenu::SetMenuCategory(eMenuCategory MenuCategory) { menuCategory = MenuCategory; if( menuCategory == mcChannel ) { - if( Config.MenuChannelType == 0 ) + if( Config.MenuChannelView == 0 ) itemChannelHeight = fontHeight + Config.MenuItemPadding + Config.decorBorderMenuItemSize*2; - else if( Config.MenuChannelType == 1 ) + else if( Config.MenuChannelView == 1 ) itemChannelHeight = fontHeight + Config.MenuItemPadding + Config.decorBorderMenuItemSize*2; - else if( Config.MenuChannelType == 2 ) + else if( Config.MenuChannelView == 2 || Config.MenuChannelView == 3 ) itemChannelHeight = fontHeight + fontSmlHeight + marginItem + Config.decorProgressMenuItemSize + Config.MenuItemPadding + Config.decorBorderMenuItemSize*2; } @@ -122,13 +122,10 @@ void cFlatDisplayMenu::SetScrollbar(int Total, int Offset) { void cFlatDisplayMenu::Scroll(bool Up, bool Page) { // Wird das Menü gescrollt oder Content? - if( ContentIsShown() ) - { + if( ContentIsShown() ) { bool scrolled = ContentScroll(Up, Page); if( scrolled ) - { DrawScrollbar(ContentScrollTotal(), ContentScrollOffset(), ContentVisibleLines(), contentTop - scrollBarTop, ContentGetHeight(), ContentScrollOffset() > 0, ContentScrollOffset() + ContentVisibleLines() < ContentScrollTotal()); - } } else { cSkinDisplayMenu::Scroll(Up, Page); } @@ -552,21 +549,22 @@ void cFlatDisplayMenu::DrawProgressBarFromText(int Top, int Left, int Width, con } bool cFlatDisplayMenu::SetItemChannel(const cChannel *Channel, int Index, bool Current, bool Selectable, bool WithProvider) { - if( Config.MenuChannelType == 0 || !Channel ) + if( Config.MenuChannelView == 0 || !Channel ) return false; cSchedulesLock schedulesLock; const cSchedules *schedules = cSchedules::Schedules(schedulesLock); - + const cEvent *Event = NULL; + cString buffer; int y = Index * itemChannelHeight; int Height = fontHeight; - if( Config.MenuChannelType == 2 ) + if( Config.MenuChannelView == 2 || Config.MenuChannelView == 3 ) Height = fontHeight + fontSmlHeight + marginItem + Config.decorProgressMenuItemSize; menuItemWidth = menuWidth - Config.decorBorderMenuItemSize*2; - if( Config.MenuChannelType == 2 ) + if( Config.MenuChannelView == 2 || Config.MenuChannelView == 3 ) menuItemWidth *= 0.5; if( isScrolling ) @@ -654,7 +652,7 @@ bool cFlatDisplayMenu::SetItemChannel(const cChannel *Channel, int Index, bool C // event from channel const cSchedule *Schedule = schedules->GetSchedule( Channel->GetChannelID() ); if( Schedule ) { - const cEvent *Event = Schedule->GetPresentEvent(); + Event = Schedule->GetPresentEvent(); if( Event ) { // calculate progress bar progress = (int)roundf( (float)(time(NULL) - Event->StartTime()) / (float) (Event->Duration()) * 100.0); @@ -676,7 +674,7 @@ bool cFlatDisplayMenu::SetItemChannel(const cChannel *Channel, int Index, bool C if( isScrolling ) Width = (menuItemWidth + scrollBarWidth) / 10*2; - if( Config.MenuChannelType == 2 ) + if( Config.MenuChannelView == 2 || Config.MenuChannelView == 3 ) Width = menuItemWidth - LeftName; menuPixmap->DrawText(cPoint(LeftName, Top), buffer, ColorFg, ColorBg, font, Width); @@ -687,7 +685,7 @@ bool cFlatDisplayMenu::SetItemChannel(const cChannel *Channel, int Index, bool C int PBTop = y + (itemChannelHeight-Config.MenuItemPadding)/2 - Config.decorProgressMenuItemSize/2 - Config.decorBorderMenuItemSize; int PBLeft = Left; int PBWidth = menuItemWidth/10; - if( Config.MenuChannelType == 2 ) { + if( Config.MenuChannelView == 2 || Config.MenuChannelView == 3 ) { PBTop = Top + fontHeight + fontSmlHeight; PBLeft = Left - Width - marginItem; PBWidth = menuItemWidth - LeftName - marginItem*2; @@ -710,7 +708,7 @@ bool cFlatDisplayMenu::SetItemChannel(const cChannel *Channel, int Index, bool C Left += Width + marginItem; } - if( Config.MenuChannelType == 2 ) { + if( Config.MenuChannelView == 2 || Config.MenuChannelView == 3 ) { Left = LeftName; Top += fontHeight; menuPixmap->DrawText(cPoint(Left, Top), EventTitle, ColorFg, ColorBg, fontSml, menuItemWidth - Left - marginItem ); @@ -753,9 +751,106 @@ bool cFlatDisplayMenu::SetItemChannel(const cChannel *Channel, int Index, bool C ItemBorderInsertUnique(ib); } + if( (Config.MenuChannelView == 2 || Config.MenuChannelView == 3) && Event && Current ) { + SetItemChannelDrawEvent(Event); + } + return true; } +void cFlatDisplayMenu::SetItemChannelDrawEvent(const cEvent *Event) { + + cLeft = menuItemWidth + Config.decorBorderMenuItemSize*2 + Config.decorBorderMenuContentSize + marginItem; + if( isScrolling ) + cLeft += scrollBarWidth; + cTop = topBarHeight + marginItem + Config.decorBorderTopBarSize*2 + Config.decorBorderMenuContentSize; + cWidth = menuWidth - cLeft - Config.decorBorderMenuContentSize; + cHeight = osdHeight - (topBarHeight + Config.decorBorderTopBarSize*2 + + buttonsHeight + Config.decorBorderButtonSize*2 + marginItem*3 + Config.decorBorderMenuContentSize*2); + + // Description + ostringstream text; + if( !isempty(Event->Description()) ) { + text << Event->Description(); + } + + if( Config.EpgAdditionalInfoShow ) { + text << endl; + const cComponents *Components = Event->Components(); + if (Components) { + ostringstream audio; + bool firstAudio = true; + const char *audio_type = NULL; + ostringstream subtitle; + bool firstSubtitle = true; + for (int i = 0; i < Components->NumComponents(); i++) { + const tComponent *p = Components->Component(i); + switch (p->stream) { + case sc_video_MPEG2: + if (p->description) + text << endl << tr("Video") << ": " << p->description << " (MPEG2)"; + else + text << endl << tr("Video") << ": MPEG2"; + break; + case sc_video_H264_AVC: + if (p->description) + text << endl << tr("Video") << ": " << p->description << " (H.264)"; + else + text << endl << tr("Video") << ": H.264"; + break; + + case sc_audio_MP2: + case sc_audio_AC3: + case sc_audio_HEAAC: + if (firstAudio) + firstAudio = false; + else + audio << ", "; + switch (p->stream) { + case sc_audio_MP2: + // workaround for wrongfully used stream type X 02 05 for AC3 + if (p->type == 5) + audio_type = "AC3"; + else + audio_type = "MP2"; + break; + case sc_audio_AC3: + audio_type = "AC3"; break; + case sc_audio_HEAAC: + audio_type = "HEAAC"; break; + } + if (p->description) + audio << p->description << " (" << audio_type << ", " << p->language << ")"; + else + audio << p->language << " (" << audio_type << ")"; + break; + case sc_subtitle: + if (firstSubtitle) + firstSubtitle = false; + else + subtitle << ", "; + if (p->description) + subtitle << p->description << " (" << p->language << ")"; + else + subtitle << p->language; + break; + } + } + if (audio.str().length() > 0) + text << endl << tr("Audio") << ": "<< audio.str(); + if (subtitle.str().length() > 0) + text << endl << tr("Subtitle") << ": "<< subtitle.str(); + } + } + + ContentCreate(cLeft, cTop, cWidth, cHeight, 2); + + ContentSet( text.str().c_str(), Theme.Color(clrMenuEventFontInfo), Theme.Color(clrMenuEventBg) ); + + DecorBorderDraw(cLeft, cTop, cWidth, ContentGetHeight(), Config.decorBorderMenuContentSize, Config.decorBorderMenuContentType, + Config.decorBorderMenuContentFg, Config.decorBorderMenuContentBg); +} + void cFlatDisplayMenu::SetEvent(const cEvent *Event) { if( !Event ) return; @@ -773,6 +868,11 @@ void cFlatDisplayMenu::SetEvent(const cEvent *Event) { buttonsHeight + Config.decorBorderButtonSize*2 + marginItem*3 + chHeight + Config.decorBorderMenuContentHeadSize*2 + Config.decorBorderMenuContentSize*2); + if( !ButtonsDrawn() ) + cHeight += buttonsHeight + Config.decorBorderButtonSize*2; + + menuItemWidth = cWidth; + contentHeadPixmap->Fill(clrTransparent); contentHeadPixmap->DrawRectangle(cRect(0, 0, menuWidth, fontHeight + fontSmlHeight*2 + marginItem*2), Theme.Color(clrScrollbarBg)); @@ -867,16 +967,17 @@ void cFlatDisplayMenu::SetEvent(const cEvent *Event) { } } - bool contentScrollable = ContentWillItBeScrollable(cWidth, cHeight, text.str().c_str(), false); + bool contentScrollable = ContentWillItBeScrollable(cWidth, cHeight, text.str().c_str(), 0); if( contentScrollable ) { cWidth -= scrollBarWidth; } - ContentCreate(cLeft, cTop, cWidth, cHeight, false); + ContentCreate(cLeft, cTop, cWidth, cHeight, 0); - ContentSet( text.str().c_str(), false, Theme.Color(clrMenuEventFontInfo), Theme.Color(clrMenuEventBg) ); - if( ContentScrollable() ) + ContentSet( text.str().c_str(), Theme.Color(clrMenuEventFontInfo), Theme.Color(clrMenuEventBg) ); + if( ContentScrollable() ) { DrawScrollbar(ContentScrollTotal(), ContentScrollOffset(), ContentVisibleLines(), contentTop - scrollBarTop, ContentGetHeight(), ContentScrollOffset() > 0, ContentScrollOffset() + ContentVisibleLines() < ContentScrollTotal()); + } if( Config.MenuContentFullSize || ContentScrollable() ) DecorBorderDraw(cLeft, cTop, cWidth, ContentGetHeight(), Config.decorBorderMenuContentSize, Config.decorBorderMenuContentType, @@ -914,7 +1015,7 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { chWidth = menuWidth - Config.decorBorderMenuContentHeadSize*2; chHeight = fontHeight + fontSmlHeight*2 + marginItem*2; contentHeadPixmap = osd->CreatePixmap(1, cRect(chLeft, chTop, chWidth, chHeight)); - + cLeft = Config.decorBorderMenuContentSize; cTop = chTop + marginItem*3 + fontHeight + fontSmlHeight*2 + Config.decorBorderMenuContentSize + Config.decorBorderMenuContentHeadSize; @@ -923,6 +1024,11 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { buttonsHeight + Config.decorBorderButtonSize*2 + marginItem*3 + chHeight + Config.decorBorderMenuContentHeadSize*2 + Config.decorBorderMenuContentSize*2); + if( !ButtonsDrawn() ) + cHeight += buttonsHeight + Config.decorBorderButtonSize*2; + + menuItemWidth = cWidth; + ostringstream text; text.imbue(std::locale("")); @@ -1112,12 +1218,12 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { } } - bool contentScrollable = ContentWillItBeScrollable(cWidth, cHeight, text.str().c_str(), false); + bool contentScrollable = ContentWillItBeScrollable(cWidth, cHeight, text.str().c_str(), 0); if( contentScrollable ) { cWidth -= scrollBarWidth; } - ContentCreate(cLeft, cTop, cWidth, cHeight, false); + ContentCreate(cLeft, cTop, cWidth, cHeight, 0); contentHeadPixmap->Fill(clrTransparent); contentHeadPixmap->DrawRectangle(cRect(0, 0, menuWidth, fontHeight + fontSmlHeight*2 + marginItem*2), Theme.Color(clrScrollbarBg)); @@ -1136,7 +1242,7 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { DecorBorderDraw(chLeft, chTop, chWidth, chHeight, Config.decorBorderMenuContentHeadSize, Config.decorBorderMenuContentHeadType, Config.decorBorderMenuContentHeadFg, Config.decorBorderMenuContentHeadBg); - ContentSet( text.str().c_str(), false, Theme.Color(clrMenuRecFontInfo), Theme.Color(clrMenuRecBg) ); + ContentSet( text.str().c_str(), Theme.Color(clrMenuRecFontInfo), Theme.Color(clrMenuRecBg) ); if( ContentScrollable() ) { DrawScrollbar(ContentScrollTotal(), ContentScrollOffset(), ContentVisibleLines(), contentTop - scrollBarTop, ContentGetHeight(), ContentScrollOffset() > 0, ContentScrollOffset() + ContentVisibleLines() < ContentScrollTotal()); } @@ -1176,16 +1282,23 @@ void cFlatDisplayMenu::SetText(const char *Text, bool FixedFont) { int Top = topBarHeight + marginItem + Config.decorBorderTopBarSize*2 + Config.decorBorderMenuContentSize; int Width = menuWidth - Config.decorBorderMenuContentSize*2; int Height = osdHeight - (topBarHeight + Config.decorBorderTopBarSize*2 + - buttonsHeight + Config.decorBorderButtonSize*2 + marginItem*3); + buttonsHeight + Config.decorBorderButtonSize*2 + Config.decorBorderMenuContentSize*2 + marginItem); + + if( !ButtonsDrawn() ) + Height += buttonsHeight + Config.decorBorderButtonSize*2; bool contentScrollable = ContentWillItBeScrollable(Width, Height, Text, FixedFont); if( contentScrollable ) { Width -= scrollBarWidth; } - ContentCreate(Left, Top, Width, Height, FixedFont); + if( FixedFont ) + ContentCreate(Left, Top, Width, Height, 2); + else + ContentCreate(Left, Top, Width, Height, 2); - ContentSet( Text, FixedFont, Theme.Color(clrMenuTextFont), Theme.Color(clrMenuTextBg) ); + ContentSet( Text, Theme.Color(clrMenuTextFont), Theme.Color(clrMenuTextBg) ); + if( ContentScrollable() ) DrawScrollbar(ContentScrollTotal(), ContentScrollOffset(), ContentVisibleLines(), contentTop - scrollBarTop, ContentGetHeight(), ContentScrollOffset() > 0, ContentScrollOffset() + ContentVisibleLines() < ContentScrollTotal()); diff --git a/displaymenu.h b/displaymenu.h index eb047089..3455ff12 100644 --- a/displaymenu.h +++ b/displaymenu.h @@ -45,7 +45,7 @@ class cFlatDisplayMenu : public cFlatBaseRender, public cSkinDisplayMenu { cBitmap *bmNew, *bmRec, *bmArrowTurn, *bmClock, *bmClocksml, *bmVPS; static cBitmap bmCNew, bmCRec, bmCArrowTurn, bmCClock, bmCClocksml, bmCHD, bmCVPS; - + void SetItemChannelDrawEvent(const cEvent *Event); public: cFlatDisplayMenu(void); virtual ~cFlatDisplayMenu(); diff --git a/po/de_DE.po b/po/de_DE.po index 167f8937..f68120ab 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skinflat 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2014-02-07 21:51+0100\n" +"POT-Creation-Date: 2014-02-08 13:52+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -120,6 +120,9 @@ msgstr "flatPlus lang" msgid "flatPlus short" msgstr "flatPlus kurz" +msgid "flatPlus short + EPG" +msgstr "" + msgid "General settings" msgstr "Allgemeine Einstellungen" @@ -274,7 +277,7 @@ msgid "Menucont. border size" msgstr "Menü Rand Größe" msgid "Menucont. head border by decor-file?" -msgstr "Menü Rand von Decordatei?" +msgstr "Menükopf Rand von Decordatei?" msgid "Menucont. head border type" msgstr "Menükopf Rand Typ" @@ -2,7 +2,7 @@ cStringList Bordertypes; cStringList Progresstypes; -cStringList MenuChannelTypes; +cStringList MenuChannelViews; cFlatSetup::cFlatSetup(void) { SetupConfig = Config; @@ -38,9 +38,10 @@ void cFlatSetup::Setup(void) { Progresstypes.Append( strdup(tr("small line + big line + alpha blend")) ); Progresstypes.Append( strdup(tr("big line + alpha blend")) ); - MenuChannelTypes.Append( strdup(tr("VDR default")) ); - MenuChannelTypes.Append( strdup(tr("flatPlus long")) ); - MenuChannelTypes.Append( strdup(tr("flatPlus short")) ); + MenuChannelViews.Append( strdup(tr("VDR default")) ); + MenuChannelViews.Append( strdup(tr("flatPlus long")) ); + MenuChannelViews.Append( strdup(tr("flatPlus short")) ); + MenuChannelViews.Append( strdup(tr("flatPlus short + EPG")) ); Add(new cOsdItem(tr("General settings"), osUnknown, true)); Add(new cOsdItem(tr("Channelinfo settings"), osUnknown, true)); @@ -150,7 +151,7 @@ void cFlatSetup::Store(void) { SetupStore("TopBarMenuIconShow", Config.TopBarMenuIconShow); SetupStore("DecorIndex", Config.DecorIndex); SetupStore("MainMenuItemScale", dtoa(Config.MainMenuItemScale)); - SetupStore("MenuChannelType", Config.MenuChannelType); + SetupStore("MenuChannelView", Config.MenuChannelView); SetupStore("ChannelSimpleAspectFormat", Config.ChannelSimpleAspectFormat); SetupStore("RecordingSimpleAspectFormat", Config.RecordingSimpleAspectFormat); @@ -352,7 +353,7 @@ void cFlatSetupMenu::Setup(void) { Add(new cMenuEditBoolItem(tr("Show additional EPG info"), &SetupConfig->EpgAdditionalInfoShow)); Add(new cMenuEditPrcItem(tr("Main menuitem scale"), &SetupConfig->MainMenuItemScale, 0.2, 1, 0)); - Add(new cMenuEditStraItem(tr("Menu channel view"), &SetupConfig->MenuChannelType, MenuChannelTypes.Size(), &MenuChannelTypes[0])); + Add(new cMenuEditStraItem(tr("Menu channel view"), &SetupConfig->MenuChannelView, MenuChannelViews.Size(), &MenuChannelViews[0])); Add(new cMenuEditBoolItem(tr("Menuitem border by decor-file?"), &SetupConfig->decorBorderMenuItemByTheme)); if( SetupConfig->decorBorderMenuItemByTheme ) { |