diff options
author | lordjaxom <lordjaxom> | 2005-01-20 17:07:09 +0000 |
---|---|---|
committer | lordjaxom <lordjaxom> | 2005-01-20 17:07:09 +0000 |
commit | 45128661783dc02428f2a73df9a5e043e5f4f6dc (patch) | |
tree | ac295d6e1dac4d0bbec1e94d955f414aa7b468ba | |
parent | c62595a03f0558319c389a6bc5589d6fdc4ea47b (diff) | |
download | vdr-plugin-text2skin-45128661783dc02428f2a73df9a5e043e5f4f6dc.tar.gz vdr-plugin-text2skin-45128661783dc02428f2a73df9a5e043e5f4f6dc.tar.bz2 |
- implemented fallback to skinclassic with error message
-rw-r--r-- | display.c | 94 | ||||
-rw-r--r-- | display.h | 46 | ||||
-rw-r--r-- | render.c | 10 | ||||
-rw-r--r-- | render.h | 4 |
4 files changed, 134 insertions, 20 deletions
@@ -1,5 +1,5 @@ /* - * $Id: display.c,v 1.13 2005/01/20 15:12:16 lordjaxom Exp $ + * $Id: display.c,v 1.14 2005/01/20 17:07:09 lordjaxom Exp $ */ #include "render.h" @@ -15,6 +15,7 @@ cText2SkinDisplayChannel::cText2SkinDisplayChannel(cText2SkinLoader *Loader, bool WithInfo): cText2SkinRender(Loader, WithInfo ? cxDisplay::channelInfo : cxDisplay::channelSmall), + mFallbackDisplay(NULL), mChannel(NULL), mNumber(0), mPresent(NULL), @@ -26,14 +27,25 @@ cText2SkinDisplayChannel::cText2SkinDisplayChannel(cText2SkinLoader *Loader, boo mButtonYellow(""), mButtonBlue("") { + if (Fallback() != NULL) { + mFallbackDisplay = Fallback()->DisplayChannel(WithInfo); + Skins.Message(mtError, tr("Skin too large or incorrectly aligned"), 2); + } } cText2SkinDisplayChannel::~cText2SkinDisplayChannel() { + if (mFallbackDisplay != NULL) + delete mFallbackDisplay; } void cText2SkinDisplayChannel::SetChannel(const cChannel *Channel, int Number) { + if (mFallbackDisplay != NULL) { + mFallbackDisplay->SetChannel(Channel, Number); + return; + } + UpdateLock(); if (mChannel != Channel || mNumber != Number) { mChannel = Channel; @@ -45,6 +57,11 @@ void cText2SkinDisplayChannel::SetChannel(const cChannel *Channel, int Number) void cText2SkinDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Following) { + if (mFallbackDisplay != NULL) { + mFallbackDisplay->SetEvents(Present, Following); + return; + } + UpdateLock(); if (mPresent != Present || mFollowing != Following) { mPresent = Present; @@ -56,6 +73,11 @@ void cText2SkinDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Fo void cText2SkinDisplayChannel::SetMessage(eMessageType Type, const char *Text) { + if (mFallbackDisplay != NULL) { + mFallbackDisplay->SetMessage(Type, Text); + return; + } + UpdateLock(); if (Text == NULL) Text = ""; if (mType != Type || mText != Text) { @@ -68,6 +90,11 @@ void cText2SkinDisplayChannel::SetMessage(eMessageType Type, const char *Text) void cText2SkinDisplayChannel::SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue) { + if (mFallbackDisplay != NULL) { + mFallbackDisplay->SetButtons(Red, Green, Yellow, Blue); + return; + } + UpdateLock(); Dprintf("SetButtons(%s, %s, %s, %s)\n", Red, Green, Yellow, Blue); if (Red == NULL) Red = ""; @@ -653,6 +680,7 @@ cxType cText2SkinDisplayMessage::GetTokenData(const txToken &Token) cText2SkinDisplayMenu::cText2SkinDisplayMenu(cText2SkinLoader *Loader): cText2SkinRender(Loader, cxDisplay::menu), + mFallbackDisplay(NULL), mMaxItems(0), mTitle(""), mButtonRed(""), @@ -665,6 +693,13 @@ cText2SkinDisplayMenu::cText2SkinDisplayMenu(cText2SkinLoader *Loader): mItems(), mCurrentItem((uint)-1) { + if (Fallback() != NULL) { + mFallbackDisplay = Fallback()->DisplayMenu(); + mMaxItems = mFallbackDisplay->MaxItems(); + Skins.Message(mtError, tr("Skin too large or incorrectly aligned"), 2); + return; + } + cxDisplay *disp = Loader->Data()->Get(cxDisplay::menu); const cxObject *area = NULL; for (uint i = 0; i < disp->Objects(); ++i) { @@ -684,10 +719,18 @@ cText2SkinDisplayMenu::cText2SkinDisplayMenu(cText2SkinLoader *Loader): cText2SkinDisplayMenu::~cText2SkinDisplayMenu() { + if (mFallbackDisplay != NULL) + delete mFallbackDisplay; } void cText2SkinDisplayMenu::Clear(void) { + if (mFallbackDisplay != NULL) { + printf("fallback clear\n"); + mFallbackDisplay->Clear(); + return; + } + UpdateLock(); mItems.clear(); mCurrentItem = (uint)-1; @@ -701,6 +744,12 @@ void cText2SkinDisplayMenu::Clear(void) void cText2SkinDisplayMenu::SetTitle(const char *Title) { + if (mFallbackDisplay != NULL) { + printf("fallback title\n"); + mFallbackDisplay->SetTitle(Title); + return; + } + UpdateLock(); if (Title == NULL) Title = ""; if (mTitle != Title) { @@ -713,6 +762,11 @@ void cText2SkinDisplayMenu::SetTitle(const char *Title) void cText2SkinDisplayMenu::SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue) { + if (mFallbackDisplay != NULL) { + mFallbackDisplay->SetButtons(Red, Green, Yellow, Blue); + return; + } + UpdateLock(); if (Red == NULL) Red = ""; if (Green == NULL) Green = ""; @@ -731,6 +785,12 @@ void cText2SkinDisplayMenu::SetButtons(const char *Red, const char *Green, const void cText2SkinDisplayMenu::SetMessage(eMessageType Type, const char *Text) { + if (mFallbackDisplay != NULL) { + printf("fallback message\n"); + mFallbackDisplay->SetMessage(Type, Text); + return; + } + UpdateLock(); if (Text == NULL) Text = ""; if (mMessageType != Type || mMessageText != Text) { @@ -743,6 +803,11 @@ void cText2SkinDisplayMenu::SetMessage(eMessageType Type, const char *Text) void cText2SkinDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool Selectable) { + if (mFallbackDisplay != NULL) { + mFallbackDisplay->SetItem(Text, Index, Current, Selectable); + return; + } + UpdateLock(); if (Text == NULL) return; @@ -776,6 +841,11 @@ void cText2SkinDisplayMenu::SetItem(const char *Text, int Index, bool Current, b void cText2SkinDisplayMenu::SetEvent(const cEvent *Event) { + if (mFallbackDisplay != NULL) { + mFallbackDisplay->SetEvent(Event); + return; + } + UpdateLock(); if (mEvent != Event) { mEvent = Event; @@ -787,6 +857,11 @@ void cText2SkinDisplayMenu::SetEvent(const cEvent *Event) void cText2SkinDisplayMenu::SetRecording(const cRecording *Recording) { + if (mFallbackDisplay != NULL) { + mFallbackDisplay->SetRecording(Recording); + return; + } + UpdateLock(); // yet unused if (mRecording != Recording) { @@ -797,8 +872,13 @@ void cText2SkinDisplayMenu::SetRecording(const cRecording *Recording) UpdateUnlock(); } -void cText2SkinDisplayMenu::SetText(const char *Text, bool /*FixedFont*/) +void cText2SkinDisplayMenu::SetText(const char *Text, bool FixedFont) { + if (mFallbackDisplay != NULL) { + mFallbackDisplay->SetText(Text, FixedFont); + return; + } + UpdateLock(); if (Text == NULL) Text = ""; if (mText != Text) { @@ -810,6 +890,11 @@ void cText2SkinDisplayMenu::SetText(const char *Text, bool /*FixedFont*/) void cText2SkinDisplayMenu::SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, int Tab5) { + if (mFallbackDisplay != NULL) { + mFallbackDisplay->SetTabs(Tab1, Tab2, Tab3, Tab4, Tab5); + return; + } + UpdateLock(); cSkinDisplayMenu::SetTabs(Tab1, Tab2, Tab3, Tab4, Tab5); UpdateUnlock(); @@ -817,6 +902,11 @@ void cText2SkinDisplayMenu::SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, int void cText2SkinDisplayMenu::Scroll(bool Up, bool Page) { + if (mFallbackDisplay != NULL) { + mFallbackDisplay->Scroll(Up, Page); + return; + } + UpdateLock(); cText2SkinRender::Scroll(Up, Page); SetDirty(); @@ -1,5 +1,5 @@ /* - * $Id: display.h,v 1.8 2005/01/16 20:55:20 lordjaxom Exp $ + * $Id: display.h,v 1.9 2005/01/20 17:07:09 lordjaxom Exp $ */ #ifndef VDR_TEXT2SKIN_SKIN_H @@ -17,16 +17,18 @@ class cText2SkinLoader; class cText2SkinDisplayChannel: public cSkinDisplayChannel, public cText2SkinRender { private: - const cChannel *mChannel; - int mNumber; - const cEvent *mPresent; - const cEvent *mFollowing; - eMessageType mType; - std::string mText; - std::string mButtonRed; - std::string mButtonGreen; - std::string mButtonYellow; - std::string mButtonBlue; + cSkinDisplayChannel *mFallbackDisplay; + + const cChannel *mChannel; + int mNumber; + const cEvent *mPresent; + const cEvent *mFollowing; + eMessageType mType; + std::string mText; + std::string mButtonRed; + std::string mButtonGreen; + std::string mButtonYellow; + std::string mButtonBlue; protected: virtual cxType GetTokenData(const txToken &Token); @@ -40,9 +42,16 @@ public: virtual void SetMessage(eMessageType Type, const char *Text); virtual void SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue); - virtual void Flush(void) { cText2SkinRender::Flush(); } + virtual void Flush(void); }; +inline void cText2SkinDisplayChannel::Flush(void) { + if (mFallbackDisplay != NULL) + mFallbackDisplay->Flush(); + else + cText2SkinRender::Flush(); +} + class cText2SkinDisplayVolume: public cSkinDisplayVolume, public cText2SkinRender { private: int mCurrent; @@ -119,6 +128,7 @@ public: class cText2SkinDisplayMenu: public cSkinDisplayMenu, public cText2SkinRender { private: + cSkinDisplayMenu *mFallbackDisplay; int mMaxItems; // common for all menus @@ -157,7 +167,7 @@ protected: virtual int GetTab(int n) { return cSkinDisplayMenu::Tab(n); } virtual bool HasTabText(int Index, int n); virtual void SetEditableWidth(int Width) { cSkinDisplayMenu::SetEditableWidth(Width); } - virtual int MaxItems(void) { return mMaxItems;} + virtual int MaxItems(void) { return mMaxItems; } virtual void SetMaxItems(int MaxItems) { mMaxItems = MaxItems; } public: @@ -175,7 +185,7 @@ public: virtual void SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, int Tab5); virtual void Scroll(bool Up, bool Page); - virtual void Flush(void) { cText2SkinRender::Flush(); } + virtual void Flush(void); }; inline bool cText2SkinDisplayMenu::HasTabText(int Index, int n) @@ -187,6 +197,14 @@ inline bool cText2SkinDisplayMenu::HasTabText(int Index, int n) return false; } +inline void cText2SkinDisplayMenu::Flush(void) +{ + if (mFallbackDisplay != NULL) + mFallbackDisplay->Flush(); + else + cText2SkinRender::Flush(); +} + #if VDRVERSNUM >= 10318 class cText2SkinDisplayTracks: public cSkinDisplayTracks, public cText2SkinRender { private: @@ -1,5 +1,5 @@ /* - * $Id: render.c,v 1.23 2005/01/20 14:04:29 lordjaxom Exp $ + * $Id: render.c,v 1.24 2005/01/20 17:07:09 lordjaxom Exp $ */ #include "render.h" @@ -16,6 +16,7 @@ #include <vdr/epg.h> #include <vdr/menu.h> #include <vdr/videodir.h> +#include <vdr/skinclassic.h> cText2SkinRender *cText2SkinRender::mRender = NULL; @@ -29,6 +30,7 @@ cText2SkinRender::cText2SkinRender(cText2SkinLoader *Loader, cxDisplay::eType Di mScroller(NULL), mBasePath(BasePath), mDirty(true), + mFallback(NULL), mActive(false), mDoUpdate(), mDoUpdateMutex(), @@ -96,6 +98,8 @@ cText2SkinRender::cText2SkinRender(cText2SkinLoader *Loader, cxDisplay::eType Di break; } esyslog("ERROR: text2skin: OSD provider can't handle skin: %s\n", emsg); + DELETENULL(mScreen); + mFallback = new cSkinClassic(); return; } @@ -338,8 +342,8 @@ void cText2SkinRender::DrawMarquee(const txPoint &Pos, const txSize &Size, const if (mUpdateIn == 0 || updatein < mUpdateIn) mUpdateIn = updatein; } - Dprintf("drawMarquee text = %s, state.text = %s, offset = %d, index = %d, scrolling = %d, mUpdatteIn = %d, nexttime = %d, delay = %d\n", - Text.c_str(), state.text.c_str(), state.offset, Index, scrolling, mUpdateIn, state.nexttime, Delay); + //Dprintf("drawMarquee text = %s, state.text = %s, offset = %d, index = %d, scrolling = %d, mUpdatteIn = %d, nexttime = %d, delay = %d\n", + // Text.c_str(), state.text.c_str(), state.offset, Index, scrolling, mUpdateIn, state.nexttime, Delay); mScreen->DrawText(Pos.x, Pos.y, Text.c_str() + state.offset, Fg ? *Fg : 0, clrTransparent, Font, Size.w, Size.h, Align); @@ -1,5 +1,5 @@ /* - * $Id: render.h,v 1.9 2005/01/11 18:02:44 lordjaxom Exp $ + * $Id: render.h,v 1.10 2005/01/20 17:07:09 lordjaxom Exp $ */ #ifndef VDR_TEXT2SKIN_RENDER_H @@ -47,6 +47,7 @@ private: std::string mBasePath; bool mDirty; + cSkin *mFallback; // update thread bool mActive; @@ -120,6 +121,7 @@ protected: void SetDirty(void) { mDirty = true; } void Scroll(bool Up, bool Page) { if (mScroller != NULL) mScroller->Scroll(Up, Page); } void Clear(void) { DELETENULL(mScroller); } + cSkin *Fallback(void) const { return mFallback; } public: cText2SkinRender(cText2SkinLoader *Loader, cxDisplay::eType Section, |