diff --git a/HISTORY b/HISTORY index 5d50939..0192557 100644 --- a/HISTORY +++ b/HISTORY @@ -228,3 +228,5 @@ Version 0.3.1 Version 0.3.2 +- fixed crash if number of dvb devices changes + diff --git a/Makefile b/Makefile index 2533983..66a89d4 100644 --- a/Makefile +++ b/Makefile @@ -92,6 +92,7 @@ OBJS = $(PLUGIN).o \ views/viewgrid.o \ views/viewhelpers.o \ views/displaychannelview.o \ + views/displaychannelviewelements.o \ views/displaymenurootview.o \ views/displaymenuview.o \ views/displaymenulistview.o \ diff --git a/skins/metrixhd/xmlfiles/displaychannel.xml b/skins/metrixhd/xmlfiles/displaychannel.xml index 7e39236..d6c201b 100644 --- a/skins/metrixhd/xmlfiles/displaychannel.xml +++ b/skins/metrixhd/xmlfiles/displaychannel.xml @@ -196,7 +196,7 @@ {devices[channelid]} ID of the currently tuned channel {devices[source]} source of the currently tuned channel --> - + diff --git a/views/displaychannelview.c b/views/displaychannelview.c index fe127e7..314cfba 100644 --- a/views/displaychannelview.c +++ b/views/displaychannelview.c @@ -2,6 +2,7 @@ #include #include "../services/scraper2vdr.h" #include "displaychannelview.h" +#include "displaychannelviewelements.h" #include "../libcore/timers.h" #include "../libcore/helpers.h" @@ -438,22 +439,30 @@ void cDisplayChannelView::DrawDevices(bool initial) { } if (DetachViewElement(veDevices)) { - esyslog("skindesigner: start new thread for devices"); + cViewElement *viewElement = GetViewElement(veDevices); + if (!viewElement) { + viewElement = new cViewElementDevices(tmplView->GetViewElement(veDevices)); + AddViewElement(veDevices, viewElement); + viewElement->Start(); + } else { + viewElement->Render(); + } + } else { + map < string, string > stringTokens; + map < string, int > intTokens; + map < string, vector< map< string, string > > > deviceLoopTokens; + vector< map< string, string > > devices; + + bool changed = SetDevices(initial, &intTokens, &devices); + if (!changed) + return; + + deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices)); + + ClearViewElement(veDevices); + DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens); } - map < string, string > stringTokens; - map < string, int > intTokens; - map < string, vector< map< string, string > > > deviceLoopTokens; - vector< map< string, string > > devices; - - bool changed = SetDevices(initial, &intTokens, &devices); - if (!changed) - return; - - deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices)); - - ClearViewElement(veDevices); - DrawViewElement(veDevices, &stringTokens, &intTokens, &deviceLoopTokens); } void cDisplayChannelView::ClearDevices(void) { diff --git a/views/displaychannelviewelements.c b/views/displaychannelviewelements.c new file mode 100644 index 0000000..7709b94 --- /dev/null +++ b/views/displaychannelviewelements.c @@ -0,0 +1,23 @@ +#include "displaychannelviewelements.h" + +cViewElementDevices::cViewElementDevices(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) { + init = true; +} + +void cViewElementDevices::Render(void) { + map < string, vector< map< string, string > > > deviceLoopTokens; + vector< map< string, string > > devices; + + if (init) + InitDevices(); + bool changed = SetDevices(init, &intTokens, &devices); + init = false; + + if (!changed) + return; + + deviceLoopTokens.insert(pair< string, vector< map< string, string > > >("devices", devices)); + + Clear(); + Draw(&deviceLoopTokens); +} \ No newline at end of file diff --git a/views/displaychannelviewelements.h b/views/displaychannelviewelements.h new file mode 100644 index 0000000..87d45c9 --- /dev/null +++ b/views/displaychannelviewelements.h @@ -0,0 +1,17 @@ +#ifndef __DISPLAYCHANNELVIEWELEMENTS_H +#define __DISPLAYCHANNELVIEWELEMENTS_H + +#include "../libtemplate/template.h" +#include "view.h" +#include "viewhelpers.h" + +class cViewElementDevices : public cViewElement, public cViewHelpers { +private: + bool init; +public: + cViewElementDevices(cTemplateViewElement *tmplViewElement); + virtual ~cViewElementDevices() {}; + void Render(void); +}; + +#endif //__DISPLAYCHANNELVIEWELEMENTS_H \ No newline at end of file diff --git a/views/displaymenuitemcurrentview.c b/views/displaymenuitemcurrentview.c index 4f1994b..48f1459 100644 --- a/views/displaymenuitemcurrentview.c +++ b/views/displaymenuitemcurrentview.c @@ -5,13 +5,10 @@ #include "displaymenuitemcurrentview.h" -cDisplayMenuItemCurrentView::cDisplayMenuItemCurrentView(cTemplateViewElement *tmplCurrent) : cView(tmplCurrent) { - delay = tmplItem->GetNumericParameter(ptDelay); - SetFadeTime(tmplItem->GetNumericParameter(ptFadeTime)); +cDisplayMenuItemCurrentView::cDisplayMenuItemCurrentView(cTemplateViewElement *tmplCurrent) : cViewElement(tmplCurrent) { } cDisplayMenuItemCurrentView::~cDisplayMenuItemCurrentView() { - CancelSave(); } void cDisplayMenuItemCurrentView::SetPosMenuItem(cRect &pos) { @@ -65,13 +62,6 @@ cDisplayMenuItemCurrentMainView::cDisplayMenuItemCurrentMainView(cTemplateViewEl this->icon = icon; } -cDisplayMenuItemCurrentMainView::~cDisplayMenuItemCurrentMainView() { -} - -void cDisplayMenuItemCurrentMainView::Prepare(void) { -} - - void cDisplayMenuItemCurrentMainView::Render(void) { stringTokens.insert(pair("number", number)); stringTokens.insert(pair("label", label)); @@ -80,26 +70,6 @@ void cDisplayMenuItemCurrentMainView::Render(void) { DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens); } -void cDisplayMenuItemCurrentMainView::Clear(void) { - -} - -void cDisplayMenuItemCurrentMainView::Action(void) { - SetInitFinished(); - DoSleep(delay); - Render(); - FadeIn(); - DoFlush(); - if (scrolling) { - DoSleep(scrollDelay); - if (scrollOrientation == orHorizontal) { - ScrollHorizontal(scrollingPix, scrollDelay, scrollSpeed, scrollMode); - } else { - ScrollVertical(scrollingPix, scrollDelay, scrollSpeed); - } - } -} - /************************************************************* * cDisplayMenuItemCurrentSchedulesView *************************************************************/ @@ -113,13 +83,6 @@ cDisplayMenuItemCurrentSchedulesView::cDisplayMenuItemCurrentSchedulesView(cTemp this->isEpgSearchFav = isEpgSearchFav; } -cDisplayMenuItemCurrentSchedulesView::~cDisplayMenuItemCurrentSchedulesView() { -} - -void cDisplayMenuItemCurrentSchedulesView::Prepare(void) { -} - - void cDisplayMenuItemCurrentSchedulesView::Render(void) { intTokens.insert(pair("whatson", (cat == mcSchedule)&&(!isEpgSearchFav) ? true: false)); intTokens.insert(pair("whatsonnow", (cat == mcScheduleNow) ? true: false)); @@ -184,26 +147,6 @@ void cDisplayMenuItemCurrentSchedulesView::Render(void) { DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens, &loopTokens); } -void cDisplayMenuItemCurrentSchedulesView::Clear(void) { - -} - -void cDisplayMenuItemCurrentSchedulesView::Action(void) { - SetInitFinished(); - DoSleep(delay); - Render(); - FadeIn(); - DoFlush(); - if (scrolling) { - DoSleep(scrollDelay); - if (scrollOrientation == orHorizontal) { - ScrollHorizontal(scrollingPix, scrollDelay, scrollSpeed, scrollMode); - } else { - ScrollVertical(scrollingPix, scrollDelay, scrollSpeed); - } - } -} - void cDisplayMenuItemCurrentSchedulesView::ReadSchedules(vector< map > *schedulesTokens) { if (!event) return; @@ -236,13 +179,6 @@ cDisplayMenuItemCurrentChannelView::cDisplayMenuItemCurrentChannelView(cTemplate this->channel = channel; } -cDisplayMenuItemCurrentChannelView::~cDisplayMenuItemCurrentChannelView() { -} - -void cDisplayMenuItemCurrentChannelView::Prepare(void) { -} - - void cDisplayMenuItemCurrentChannelView::Render(void) { if (!channel) return; @@ -342,26 +278,6 @@ void cDisplayMenuItemCurrentChannelView::Render(void) { DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens, &loopTokens); } -void cDisplayMenuItemCurrentChannelView::Clear(void) { - -} - -void cDisplayMenuItemCurrentChannelView::Action(void) { - SetInitFinished(); - DoSleep(delay); - Render(); - FadeIn(); - DoFlush(); - if (scrolling) { - DoSleep(scrollDelay); - if (scrollOrientation == orHorizontal) { - ScrollHorizontal(scrollingPix, scrollDelay, scrollSpeed, scrollMode); - } else { - ScrollVertical(scrollingPix, scrollDelay, scrollSpeed); - } - } -} - void cDisplayMenuItemCurrentChannelView::ReadSchedules(vector< map > *schedulesTokens) { cSchedulesLock schedulesLock; const cSchedules *schedules = cSchedules::Schedules(schedulesLock); @@ -398,13 +314,6 @@ cDisplayMenuItemCurrentTimerView::cDisplayMenuItemCurrentTimerView(cTemplateView this->timer = timer; } -cDisplayMenuItemCurrentTimerView::~cDisplayMenuItemCurrentTimerView() { -} - -void cDisplayMenuItemCurrentTimerView::Prepare(void) { -} - - void cDisplayMenuItemCurrentTimerView::Render(void) { if (!timer) return; @@ -491,26 +400,6 @@ void cDisplayMenuItemCurrentTimerView::Render(void) { DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens); } -void cDisplayMenuItemCurrentTimerView::Clear(void) { - -} - -void cDisplayMenuItemCurrentTimerView::Action(void) { - SetInitFinished(); - DoSleep(delay); - Render(); - FadeIn(); - DoFlush(); - if (scrolling) { - DoSleep(scrollDelay); - if (scrollOrientation == orHorizontal) { - ScrollHorizontal(scrollingPix, scrollDelay, scrollSpeed, scrollMode); - } else { - ScrollVertical(scrollingPix, scrollDelay, scrollSpeed); - } - } -} - /************************************************************* * cDisplayMenuItemCurrentRecordingView *************************************************************/ @@ -523,13 +412,6 @@ cDisplayMenuItemCurrentRecordingView::cDisplayMenuItemCurrentRecordingView(cTemp this->newRecs = newRecs; } -cDisplayMenuItemCurrentRecordingView::~cDisplayMenuItemCurrentRecordingView() { -} - -void cDisplayMenuItemCurrentRecordingView::Prepare(void) { -} - - void cDisplayMenuItemCurrentRecordingView::Render(void) { if (!recording) return; @@ -658,26 +540,6 @@ void cDisplayMenuItemCurrentRecordingView::Render(void) { DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens, &loopTokens); } -void cDisplayMenuItemCurrentRecordingView::Clear(void) { - -} - -void cDisplayMenuItemCurrentRecordingView::Action(void) { - SetInitFinished(); - DoSleep(delay); - Render(); - FadeIn(); - DoFlush(); - if (scrolling) { - DoSleep(scrollDelay); - if (scrollOrientation == orHorizontal) { - ScrollHorizontal(scrollingPix, scrollDelay, scrollSpeed, scrollMode); - } else { - ScrollVertical(scrollingPix, scrollDelay, scrollSpeed); - } - } -} - /************************************************************* * cDisplayMenuItemCurrentPluginView *************************************************************/ @@ -691,34 +553,7 @@ cDisplayMenuItemCurrentPluginView::cDisplayMenuItemCurrentPluginView(cTemplateVi loopTokens = pluginLoopTokens; } -cDisplayMenuItemCurrentPluginView::~cDisplayMenuItemCurrentPluginView() { -} - -void cDisplayMenuItemCurrentPluginView::Prepare(void) { -} - - void cDisplayMenuItemCurrentPluginView::Render(void) { SetTokensPosMenuItem(); DrawViewElement(veMenuCurrentItemDetail, &stringTokens, &intTokens, &loopTokens); } - -void cDisplayMenuItemCurrentPluginView::Clear(void) { - -} - -void cDisplayMenuItemCurrentPluginView::Action(void) { - SetInitFinished(); - DoSleep(delay); - Render(); - FadeIn(); - DoFlush(); - if (scrolling) { - DoSleep(scrollDelay); - if (scrollOrientation == orHorizontal) { - ScrollHorizontal(scrollingPix, scrollDelay, scrollSpeed, scrollMode); - } else { - ScrollVertical(scrollingPix, scrollDelay, scrollSpeed); - } - } -} diff --git a/views/displaymenuitemcurrentview.h b/views/displaymenuitemcurrentview.h index 680d9c8..c925ffa 100644 --- a/views/displaymenuitemcurrentview.h +++ b/views/displaymenuitemcurrentview.h @@ -4,12 +4,9 @@ #include "../libtemplate/template.h" #include "view.h" -class cDisplayMenuItemCurrentView : public cView { +class cDisplayMenuItemCurrentView : public cViewElement { private: protected: - int delay; - map < string, string > stringTokens; - map < string, int > intTokens; cRect posMenuItem; void SetTokensPosMenuItem(void); void SetScraperPoster(const cEvent *event, const cRecording *recording=NULL); @@ -17,9 +14,6 @@ public: cDisplayMenuItemCurrentView(cTemplateViewElement *tmplCurrent); virtual ~cDisplayMenuItemCurrentView(); void SetPosMenuItem(cRect &pos); - virtual void Prepare(void) {}; - virtual void Render(void) {}; - virtual void Clear(void) {}; }; class cDisplayMenuItemCurrentMainView: public cDisplayMenuItemCurrentView { @@ -27,13 +21,10 @@ private: string number; string label; string icon; - void Action(void); public: cDisplayMenuItemCurrentMainView(cTemplateViewElement *tmplCurrent, string number, string label, string icon); - virtual ~cDisplayMenuItemCurrentMainView(); - void Prepare(void); + virtual ~cDisplayMenuItemCurrentMainView() {}; void Render(void); - void Clear(void); }; class cDisplayMenuItemCurrentSchedulesView: public cDisplayMenuItemCurrentView { @@ -43,39 +34,30 @@ private: eTimerMatch timerMatch; eMenuCategory cat; bool isEpgSearchFav; - void Action(void); void ReadSchedules(vector< map > *schedulesTokens); public: cDisplayMenuItemCurrentSchedulesView(cTemplateViewElement *tmplCurrent, const cEvent *event, const cChannel *channel, eTimerMatch timerMatch, eMenuCategory cat, bool isEpgSearchFav); - virtual ~cDisplayMenuItemCurrentSchedulesView(); - void Prepare(void); + virtual ~cDisplayMenuItemCurrentSchedulesView() {}; void Render(void); - void Clear(void); }; class cDisplayMenuItemCurrentChannelView: public cDisplayMenuItemCurrentView { private: const cChannel *channel; - void Action(void); void ReadSchedules(vector< map > *schedulesTokens); public: cDisplayMenuItemCurrentChannelView(cTemplateViewElement *tmplCurrent, const cChannel *channel); - virtual ~cDisplayMenuItemCurrentChannelView(); - void Prepare(void); + virtual ~cDisplayMenuItemCurrentChannelView() {}; void Render(void); - void Clear(void); }; class cDisplayMenuItemCurrentTimerView: public cDisplayMenuItemCurrentView { private: const cTimer *timer; - void Action(void); public: cDisplayMenuItemCurrentTimerView(cTemplateViewElement *tmplCurrent, const cTimer *timer); - virtual ~cDisplayMenuItemCurrentTimerView(); - void Prepare(void); + virtual ~cDisplayMenuItemCurrentTimerView() {}; void Render(void); - void Clear(void); }; class cDisplayMenuItemCurrentRecordingView: public cDisplayMenuItemCurrentView { @@ -84,25 +66,19 @@ private: int level; int total; int newRecs; - void Action(void); public: cDisplayMenuItemCurrentRecordingView(cTemplateViewElement *tmplCurrent, const cRecording *recording, int level, int total, int newRecs); - virtual ~cDisplayMenuItemCurrentRecordingView(); - void Prepare(void); + virtual ~cDisplayMenuItemCurrentRecordingView() {}; void Render(void); - void Clear(void); }; class cDisplayMenuItemCurrentPluginView: public cDisplayMenuItemCurrentView { private: map > > loopTokens; - void Action(void); public: cDisplayMenuItemCurrentPluginView(cTemplateViewElement *tmplCurrent, map &plugStringTokens, map &plugIntTokens, map > > &pluginLoopTokens); - virtual ~cDisplayMenuItemCurrentPluginView(); - void Prepare(void); + virtual ~cDisplayMenuItemCurrentPluginView() {}; void Render(void); - void Clear(void); }; #endif //__DISPLAYMENUITEMCURRENTVIEW_H diff --git a/views/view.c b/views/view.c index 0c8c584..3bebde7 100644 --- a/views/view.c +++ b/views/view.c @@ -11,13 +11,13 @@ cView::cView(cTemplateView *tmplView) : cPixmapContainer(tmplView->GetNumPixmaps if (tvScaled) { cDevice::PrimaryDevice()->ScaleVideo(scalingWindow); } - tmplItem = NULL; + tmplViewElement = NULL; tmplTab = NULL; Init(); } -cView::cView(cTemplateViewElement *tmplItem) : cPixmapContainer(tmplItem ? tmplItem->GetNumPixmaps() : 0) { - this->tmplItem = tmplItem; +cView::cView(cTemplateViewElement *tmplViewElement) : cPixmapContainer(tmplViewElement ? tmplViewElement->GetNumPixmaps() : 0) { + this->tmplViewElement = tmplViewElement; tmplView = NULL; tmplTab = NULL; tvScaled = false; @@ -27,7 +27,7 @@ cView::cView(cTemplateViewElement *tmplItem) : cPixmapContainer(tmplItem ? tmplI cView::cView(cTemplateViewTab *tmplTab) : cPixmapContainer(1) { this->tmplTab = tmplTab; tmplView = NULL; - tmplItem = NULL; + tmplViewElement = NULL; tvScaled = false; Init(); } @@ -36,6 +36,9 @@ cView::~cView() { if (tvScaled) { cDevice::PrimaryDevice()->ScaleVideo(cRect::Null); } + for (map::iterator dVeIt = detachedViewElements.begin(); dVeIt != detachedViewElements.end(); dVeIt++) { + delete dVeIt->second; + } } void cView::Init(void) { @@ -72,9 +75,9 @@ void cView::Stop(void) { void cView::DrawViewElement(eViewElement ve, map *stringTokens, map *intTokens, map < string, vector< map< string, string > > > *loopTokens) { //setting correct ViewElement, depending which constructor was used - cTemplateViewElement *viewElement; - if (tmplItem && (ve == veMenuCurrentItemDetail || ve == veOnPause)) { - viewElement = tmplItem; + cTemplateViewElement *viewElement = NULL; + if (tmplViewElement) { + viewElement = tmplViewElement; } else if (tmplView) { viewElement = tmplView->GetViewElement(ve); } @@ -235,6 +238,17 @@ bool cView::ViewElementScrolls(eViewElement ve) { return false; } +cViewElement *cView::GetViewElement(eViewElement ve) { + map < eViewElement, cViewElement* >::iterator hit = detachedViewElements.find(ve); + if (hit == detachedViewElements.end()) + return NULL; + cViewElement *viewElement = hit->second; + return viewElement; +} + +void cView::AddViewElement(eViewElement ve, cViewElement *viewElement) { + detachedViewElements.insert(pair< eViewElement, cViewElement* >(ve, viewElement)); +} void cView::CreateViewPixmap(int num, cTemplatePixmap *pix, cRect *size) { cRect pixSize; @@ -815,6 +829,112 @@ void cView::DoDrawImage(int num, cTemplateFunction *func, int x0, int y0) { } } +/*********************************************************************** +* cViewElement +************************************************************************/ + +cViewElement::cViewElement(cTemplateViewElement *tmplViewElement) : cView(tmplViewElement) { + delay = tmplViewElement->GetNumericParameter(ptDelay); + SetFadeTime(tmplViewElement->GetNumericParameter(ptFadeTime)); +} + +cViewElement::~cViewElement() { + CancelSave(); +} + +void cViewElement::Action(void) { + SetInitFinished(); + DoSleep(delay); + Render(); + FadeIn(); + DoFlush(); + if (scrolling) { + DoSleep(scrollDelay); + if (scrollOrientation == orHorizontal) { + ScrollHorizontal(scrollingPix, scrollDelay, scrollSpeed, scrollMode); + } else { + ScrollVertical(scrollingPix, scrollDelay, scrollSpeed); + } + } +} + +void cViewElement::Draw(map < string, vector< map< string, string > > > *loopTokens) { + if (!tmplViewElement) + return; + + if (tmplViewElement->DebugTokens()) { + DebugTokens("viewelement", &stringTokens, &intTokens, loopTokens); + } + //iterate through pixmaps of viewelement + int pixCurrent = 0; + tmplViewElement->InitIterator(); + cTemplatePixmap *pix = NULL; + while(pix = tmplViewElement->GetNextPixmap()) { + //reset Template + pix->ClearDynamicParameters(); + //create Pixmap if already fully parsed + if (!PixmapExists(pixCurrent) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) { + CreateViewPixmap(pixCurrent, pix); + } + //check if pixmap needs dynamic parameters + if ((!pix->Ready() || !pix->DoExecute()) && !pix->Scrolling()) { + //parse dynamic parameters and initiate functions + pix->ParseDynamicParameters(&intTokens, true); + if (pix->Ready() && pix->DoExecute()) { + CreateViewPixmap(pixCurrent, pix); + } + } else { + //parse dynamic parameters but not initiate functions + pix->ParseDynamicParameters(&intTokens, false); + } + //if pixmap still not valid, skip + if (!pix->Ready() && !pix->Scrolling()) { + pixCurrent++; + continue; + } + //if condition for pixmap set, check if cond is true + if (!pix->DoExecute()) { + pixCurrent++; + continue; + } + //parse dynamic tokens of pixmap functions + pix->ClearDynamicFunctionParameters(); + pix->ParseDynamicFunctionParameters(&stringTokens, &intTokens); + + if (!PixmapExists(pixCurrent) && pix->Scrolling()) { + cSize drawportSize; + scrolling = pix->CalculateDrawPortSize(drawportSize, loopTokens); + if (scrolling) { + /* + CreateScrollingPixmap(pixCurrent, pix, drawportSize); + pix->SetScrollingTextWidth(); + veScroll = ve; + scrollingPix = pixCurrent; + scrollOrientation = pix->GetNumericParameter(ptOrientation); + scrollMode = pix->GetNumericParameter(ptScrollMode); + scrollDelay = pix->GetNumericParameter(ptDelay); + scrollSpeed = pix->GetNumericParameter(ptScrollSpeed); + */ + } else { + CreateViewPixmap(pixCurrent, pix); + } + } + if (pix->DoDebug()) { + pix->Debug(); + } + + DrawPixmap(pixCurrent, pix, loopTokens); + pixCurrent++; + } +} + +void cViewElement::Clear(void) { + int pixMax = NumPixmaps(); + for (int pixCurrent = 0; pixCurrent < pixMax; pixCurrent++) { + Fill(pixCurrent, clrTransparent); + } +} + /*********************************************************************** * cViewListItem ************************************************************************/ @@ -832,18 +952,18 @@ cViewListItem::~cViewListItem() { cRect cViewListItem::DrawListItem(map *stringTokens, map *intTokens) { cRect posItem; - if (!tmplItem) + if (!tmplViewElement) return posItem; - if (tmplItem->DebugTokens()) { + if (tmplViewElement->DebugTokens()) { DebugTokens("ListItem", stringTokens, intTokens); } - tmplItem->InitIterator(); + tmplViewElement->InitIterator(); cTemplatePixmap *pix = NULL; int pixCurrent = 0; - while(pix = tmplItem->GetNextPixmap()) { + while(pix = tmplViewElement->GetNextPixmap()) { SetListElementPosition(pix); if (pixCurrent == 0) { posItem = pix->GetPixmapSize(); @@ -988,13 +1108,13 @@ void cGrid::SetCurrent(bool current) { } void cGrid::Move(void) { - if (!tmplItem) + if (!tmplViewElement) return; - tmplItem->InitIterator(); + tmplViewElement->InitIterator(); cTemplatePixmap *pix = NULL; int pixCurrent = 0; - while(pix = tmplItem->GetNextPixmap()) { + while(pix = tmplViewElement->GetNextPixmap()) { PositionPixmap(pix); cRect pixViewPort = pix->GetPixmapSize(); SetViewPort(pixCurrent, pixViewPort); @@ -1006,17 +1126,17 @@ void cGrid::Move(void) { } void cGrid::Draw(void) { - if (!tmplItem) + if (!tmplViewElement) return; - if (tmplItem->DebugTokens()) { + if (tmplViewElement->DebugTokens()) { DebugTokens("Grid", &stringTokens, &intTokens); } - tmplItem->InitIterator(); + tmplViewElement->InitIterator(); cTemplatePixmap *pix = NULL; int pixCurrent = 0; - while(pix = tmplItem->GetNextPixmap()) { + while(pix = tmplViewElement->GetNextPixmap()) { PositionPixmap(pix); if (!PixmapExists(pixCurrent)) { pix->ParseDynamicParameters(&intTokens, true); diff --git a/views/view.h b/views/view.h index 3d9c501..ab11717 100644 --- a/views/view.h +++ b/views/view.h @@ -8,6 +8,8 @@ using namespace std; +class cViewElement; + class cView : public cPixmapContainer { private: void Init(void); @@ -23,8 +25,10 @@ private: void ActivateScrolling(void); protected: cTemplateView *tmplView; - cTemplateViewElement *tmplItem; + cTemplateViewElement *tmplViewElement; cTemplateViewTab *tmplTab; + //detached viewelements + map < eViewElement, cViewElement* > detachedViewElements; //scaling window cRect scalingWindow; bool tvScaled; @@ -45,6 +49,8 @@ protected: bool ExecuteViewElement(eViewElement ve); bool DetachViewElement(eViewElement ve); bool ViewElementScrolls(eViewElement ve); + cViewElement *GetViewElement(eViewElement ve); + void AddViewElement(eViewElement ve, cViewElement *viewElement); void CreateViewPixmap(int num, cTemplatePixmap *pix, cRect *size = NULL); void CreateScrollingPixmap(int num, cTemplatePixmap *pix, cSize &drawportSize); void DrawPixmap(int num, cTemplatePixmap *pix, map < string, vector< map< string, string > > > *loopTokens = NULL, bool flushPerLoop = false); @@ -53,12 +59,27 @@ protected: virtual void Action(void); public: cView(cTemplateView *tmplView); - cView(cTemplateViewElement *tmplItem); + cView(cTemplateViewElement *tmplViewElement); cView(cTemplateViewTab *tmplTab); virtual ~cView(); virtual void Stop(void); }; +class cViewElement : public cView { +private: +protected: + int delay; + map < string, string > stringTokens; + map < string, int > intTokens; + void Action(void); + void Draw(map < string, vector< map< string, string > > > *loopTokens = NULL); +public: + cViewElement(cTemplateViewElement *tmplViewElement); + virtual ~cViewElement(); + virtual void Render(void) {}; + void Clear(void); +}; + class cViewListItem : public cView { protected: int pos;