diff options
-rw-r--r-- | HISTORY | 5 | ||||
-rw-r--r-- | baserender.c | 53 | ||||
-rw-r--r-- | baserender.h | 5 | ||||
-rw-r--r-- | displaychannel.c | 5 | ||||
-rw-r--r-- | displaychannel.h | 3 | ||||
-rw-r--r-- | textscroller.c | 5 | ||||
-rw-r--r-- | textscroller.h | 32 |
7 files changed, 71 insertions, 37 deletions
@@ -3,7 +3,10 @@ VDR Plugin 'skinflatplus' Revision History 2014-MM-DD: Version 0.4.0 - [add] Textscroller support - new options in general settings + - text in displaychannel for epg-text and epgshort-text + - topbar + - messages +- [add] new options in general settings for textscroller 2014-06-19: Version 0.3.1 - [fix] epg image position on channel info diff --git a/baserender.c b/baserender.c index bbe48975..2afa89f2 100644 --- a/baserender.c +++ b/baserender.c @@ -43,10 +43,6 @@ cFlatBaseRender::cFlatBaseRender(void) { Config.ThemeCheckAndInit(); Config.DecorCheckAndInit(); - - scrollers.SetScrollStep( Config.ScrollerStep ); - scrollers.SetScrollDelay( Config.ScrollerDelay ); - scrollers.SetScrollType( Config.ScrollerType ); } cFlatBaseRender::~cFlatBaseRender(void) { @@ -55,8 +51,8 @@ cFlatBaseRender::~cFlatBaseRender(void) { delete fontFixed; if( osd ) { - scrollers.Clear(); - + messageScroller.Clear(); + topBarScroller.Clear(); if( topBarPixmap ) osd->DestroyPixmap(topBarPixmap); if( buttonsPixmap ) @@ -125,6 +121,11 @@ void cFlatBaseRender::TopBarCreate(void) { topBarIconBGPixmap->Fill(clrTransparent); topBarIconPixmap->Fill(clrTransparent); + topBarScroller.SetOsd(osd); + topBarScroller.SetScrollStep( Config.ScrollerStep ); + topBarScroller.SetScrollDelay( Config.ScrollerDelay ); + topBarScroller.SetScrollType( Config.ScrollerType ); + if( Config.DiskUsageShow == 3) TopBarEnableDiskUsage(); } @@ -206,6 +207,7 @@ void cFlatBaseRender::TopBarUpdate(void) { int MenuIconWidth = 0; if ( strcmp(curDate, topBarLastDate) || topBarUpdateTitle ) { + topBarScroller.Clear(); topBarUpdateTitle = false; topBarLastDate = curDate; @@ -282,8 +284,11 @@ void cFlatBaseRender::TopBarUpdate(void) { int extra2Width = topBarFontSml->Width(tobBarTitleExtra2); int extraMaxWidth = max(extra1Width, extra2Width); + TitleWidthLeft -= extraMaxWidth + marginItem * 2; + int extraLeft = TopBarWidth/2 - extraMaxWidth/2; - extraLeft = max(MenuIconWidth + marginItem*4 + TitleWidth, extraLeft); +// if( !Config.ScrollerEnable ) +// extraLeft = max(MenuIconWidth + marginItem*4 + TitleWidth, extraLeft); topBarPixmap->DrawText(cPoint(extraLeft, fontSmlTop), tobBarTitleExtra1, Theme.Color(clrTopBarDateFont), Theme.Color(clrTopBarBg), topBarFontSml, extraMaxWidth, 0, taRight); topBarPixmap->DrawText(cPoint(extraLeft, fontSmlTop + topBarFontSmlHeight), tobBarTitleExtra2, Theme.Color(clrTopBarDateFont), Theme.Color(clrTopBarBg), topBarFontSml, extraMaxWidth, 0, taRight); @@ -358,16 +363,19 @@ void cFlatBaseRender::TopBarUpdate(void) { TitleWidthLeft -= ConW + marginItem*2; } - if( TitleWidth > TitleWidthLeft ) { - int dotsWidth = topBarFont->Width("... "); + int maxWidth = extraLeft - (MenuIconWidth + marginItem*2) - marginItem; + if( (TitleWidth > maxWidth) && Config.ScrollerEnable ) { + topBarScroller.AddScroller(*topBarTitle, cRect(MenuIconWidth + marginItem*2, fontTop, maxWidth, topBarFontHeight), Theme.Color(clrTopBarFont), clrTransparent, topBarFont); + TitleWidth = TitleWidthLeft; + } else { +/* int dotsWidth = topBarFont->Width("... "); cTextWrapper TitleWrapper(topBarTitle, topBarFont, TitleWidthLeft - dotsWidth); topBarTitle = TitleWrapper.GetLine(0); topBarTitle = cString::sprintf("%s...", *topBarTitle); TitleWidth = topBarFont->Width(topBarTitle); +*/ topBarPixmap->DrawText(cPoint(MenuIconWidth + marginItem*2, fontTop), topBarTitle, Theme.Color(clrTopBarFont), Theme.Color(clrTopBarBg), topBarFont, maxWidth); } - topBarPixmap->DrawText(cPoint(MenuIconWidth + marginItem*2, fontTop), topBarTitle, Theme.Color(clrTopBarFont), Theme.Color(clrTopBarBg), topBarFont); - if( TitleWidth > RecLeft ) RecLeft = TitleWidth + marginItem*2; if( numRec > 0 && Config.TopBarRecordingShow && (RecLeft + RecW) < DateRight ) { @@ -472,6 +480,12 @@ void cFlatBaseRender::MessageCreate(void) { messagePixmap->Fill(clrTransparent); messageIconPixmap = osd->CreatePixmap(5, cRect(Config.decorBorderMessageSize, top, osdWidth - Config.decorBorderMessageSize*2, messageHeight)); messageIconPixmap->Fill(clrTransparent); + + messageScroller.SetOsd(osd); + messageScroller.SetScrollStep( Config.ScrollerStep ); + messageScroller.SetScrollDelay( Config.ScrollerDelay ); + messageScroller.SetScrollType( Config.ScrollerType ); + messageScroller.SetPixmapLayer( 5 ); } void cFlatBaseRender::MessageSet(eMessageType Type, const char *Text) { @@ -496,6 +510,7 @@ void cFlatBaseRender::MessageSet(eMessageType Type, const char *Text) { break; } messagePixmap->Fill(Theme.Color(clrMessageBg)); + messageScroller.Clear(); cImage *img = imgLoader.LoadIcon(icon, fontHeight, fontHeight); if( img ) { @@ -510,6 +525,7 @@ void cFlatBaseRender::MessageSet(eMessageType Type, const char *Text) { } int textWidth = font->Width(Text); + int maxWidth = osdWidth - Config.decorBorderMessageSize*2 - fontHeight - marginItem*3 - 10; if( Config.MenuItemParseTilde ) { std::string tilde = Text; @@ -530,10 +546,18 @@ void cFlatBaseRender::MessageSet(eMessageType Type, const char *Text) { int l = font->Width( first.c_str() ); l += font->Width("X"); messagePixmap->DrawText(cPoint((osdWidth - textWidth) / 2 + l, marginItem), second.c_str(), Theme.Color(clrMenuItemExtraTextFont), Theme.Color(clrMessageBg), font); - } else + } else { + if( (textWidth > maxWidth) && Config.ScrollerEnable) + messageScroller.AddScroller(Text, cRect(Config.decorBorderMessageSize + fontHeight + marginItem*3+10, osdHeight - Config.MessageOffset - messageHeight - Config.decorBorderMessageSize, maxWidth, fontHeight), Theme.Color(clrMessageFont), clrTransparent, font); + else + messagePixmap->DrawText(cPoint((osdWidth - textWidth) / 2, marginItem), Text, Theme.Color(clrMessageFont), Theme.Color(clrMessageBg), font); + } + } else { + if( (textWidth > maxWidth) && Config.ScrollerEnable ) + messageScroller.AddScroller(Text, cRect(Config.decorBorderMessageSize + fontHeight + marginItem*3 + 10, osdHeight - Config.MessageOffset - messageHeight - Config.decorBorderMessageSize, maxWidth, fontHeight), Theme.Color(clrMessageFont), clrTransparent, font); + else messagePixmap->DrawText(cPoint((osdWidth - textWidth) / 2, marginItem), Text, Theme.Color(clrMessageFont), Theme.Color(clrMessageBg), font); - } else - messagePixmap->DrawText(cPoint((osdWidth - textWidth) / 2, marginItem), Text, Theme.Color(clrMessageFont), Theme.Color(clrMessageBg), font); + } int top = osdHeight - Config.MessageOffset - messageHeight - Config.decorBorderMessageSize; @@ -545,6 +569,7 @@ void cFlatBaseRender::MessageClear(void) { messageIconPixmap->Fill(clrTransparent); DecorBorderClearByFrom(BorderMessage); DecorBorderRedrawAll(); + messageScroller.Clear(); } void cFlatBaseRender::ProgressBarCreate(int Left, int Top, int Width, int Height, int MarginHor, int MarginVer, tColor ColorFg, tColor ColorBarFg, tColor ColorBg, int Type, bool SetBackground, bool isSignal) { diff --git a/baserender.h b/baserender.h index 3117f64e..f092023a 100644 --- a/baserender.h +++ b/baserender.h @@ -44,6 +44,7 @@ class cFlatBaseRender cPixmap *topBarIconBGPixmap; cFont *topBarFont, *topBarFontSml; int topBarFontHeight, topBarFontSmlHeight; + cTextScrollers topBarScroller; cString topBarTitle; cString tobBarTitleExtra1, tobBarTitleExtra2; @@ -81,6 +82,7 @@ class cFlatBaseRender // Nachricht cPixmap *messagePixmap, *messageIconPixmap; int messageWidth, messageHeight; + cTextScrollers messageScroller; // Mehrzeiliger Content mit Scrollbalken cPixmap *contentPixmap; @@ -103,9 +105,6 @@ class cFlatBaseRender cPixmap *decorPixmap; std::list<sDecorBorder> Borders; // for clear specific Borders (clear only MenuItems and not TopBar) - // TextScroller - cTextScrollers scrollers; - void contentDraw(void); void contentEventDraw(void); double ScrollbarSize(void); diff --git a/displaychannel.c b/displaychannel.c index af8c34b7..3060b9f8 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -83,6 +83,9 @@ cFlatDisplayChannel::cFlatDisplayChannel(bool WithInfo) { chanInfoTopPixmap->Fill( clrTransparent ); scrollers.SetOsd(osd); + scrollers.SetScrollStep( Config.ScrollerStep ); + scrollers.SetScrollDelay( Config.ScrollerDelay ); + scrollers.SetScrollType( Config.ScrollerType ); DecorBorderDraw(Config.decorBorderChannelSize, Config.decorBorderChannelSize+channelHeight - height, channelWidth, heightTop + heightBottom + Config.decorProgressChannelSize+marginItem*2, @@ -93,6 +96,8 @@ cFlatDisplayChannel::~cFlatDisplayChannel() { if( !doOutput ) return; if (osd) { + scrollers.Clear(); + if( chanInfoTopPixmap ) osd->DestroyPixmap(chanInfoTopPixmap); if( chanInfoBottomPixmap ) diff --git a/displaychannel.h b/displaychannel.h index 660fc60b..20d83584 100644 --- a/displaychannel.h +++ b/displaychannel.h @@ -31,6 +31,9 @@ class cFlatDisplayChannel : public cFlatBaseRender, public cSkinDisplayChannel { // TVScraper int TVSLeft, TVSTop, TVSWidth, TVSHeight; + // TextScroller + cTextScrollers scrollers; + bool isRecording; bool isRadioChannel; bool isGroup; diff --git a/textscroller.c b/textscroller.c index b1763834..487f1663 100644 --- a/textscroller.c +++ b/textscroller.c @@ -15,7 +15,7 @@ void cTextScroll::SetText(const char *text, cRect position, tColor colorFg, tCol if( Osd && Pixmap ) Osd->DestroyPixmap(Pixmap); - Pixmap = Osd->CreatePixmap(2, Position, drawPort); + Pixmap = Osd->CreatePixmap(Layer, Position, drawPort); Pixmap->Fill( colorBg ); Draw(); } @@ -82,6 +82,7 @@ void cTextScroll::DoStep(int Step) { } cTextScrollers::cTextScrollers() { + Layer = 2; } cTextScrollers::~cTextScrollers() { @@ -105,7 +106,7 @@ void cTextScrollers::AddScroller(const char *text, cRect position, tColor colorF while (Active()) cCondWait::SleepMs(10); - Scrollers.push_back( new cTextScroll(Osd, scrollType) ); + Scrollers.push_back( new cTextScroll(Osd, scrollType, Layer) ); Scrollers.back()->SetText(text, position, colorFg, colorBg, font); if( !Running() ) { diff --git a/textscroller.h b/textscroller.h index 5303cf87..624a557c 100644 --- a/textscroller.h +++ b/textscroller.h @@ -17,17 +17,29 @@ private: cFont *Font; cPixmap *Pixmap; cOsd *Osd; + int Layer; int waitSteps; bool isReserveStep; bool ResetX; int ScrollType; - public: + cTextScroll(cOsd *osd, int type, int layer) { + Font = NULL; + Pixmap = NULL; + Osd = osd; + Layer = layer; + + ScrollType = type; + isReserveStep = false; + waitSteps = WAITSTEPS; + ResetX = false; + } cTextScroll(cOsd *osd, int type) { Font = NULL; Pixmap = NULL; Osd = osd; + Layer = 2; ScrollType = type; isReserveStep = false; @@ -42,21 +54,6 @@ public: } } -/* - cTextScroll& operator=(const cTextScroll& other) { - if( this != &other ) { - this->Position = other.Position; - this->Text = other.Text; - this->ColorFg = other.ColorFg; - this->ColorBg = other.ColorBg; - this->Font = other.Font; - this->Pixmap = other.Pixmap; - this->Osd = other.Osd; - dsyslog("operator= pointer: %x", this->Pixmap); - } - return *this; - } -*/ void Reset(void); void SetText(const char *text, cRect position, tColor colorFg, tColor colorBg, cFont *font); void DoStep(int Step); @@ -72,7 +69,7 @@ private: cOsd *Osd; int scrollStep, scrollDelay; int scrollType; - + int Layer; virtual void Action(void); public: cTextScrollers(); @@ -80,6 +77,7 @@ public: void Clear(void); void SetOsd(cOsd *osd) { Osd = osd;} + void SetPixmapLayer(int layer) { Layer = layer; } void SetScrollStep(int step) { scrollStep = step; } void SetScrollDelay(int delay) { scrollDelay = delay; } void SetScrollType(int type) { scrollType = type; } |