summaryrefslogtreecommitdiff
path: root/coreengine
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2016-04-30 06:49:30 +0200
committerlouis <louis.braun@gmx.de>2016-04-30 06:49:30 +0200
commitf4f64e96e5cd5856305498dd562247cdf6474fff (patch)
tree7d51c3ca4c731f383d891b83ed4de24d7ef21345 /coreengine
parent4076377e213c45f1f0e07c288ea48aa9faa37d90 (diff)
downloadvdr-plugin-skindesigner-f4f64e96e5cd5856305498dd562247cdf6474fff.tar.gz
vdr-plugin-skindesigner-f4f64e96e5cd5856305498dd562247cdf6474fff.tar.bz2
improved estuary4vdr
Diffstat (limited to 'coreengine')
-rw-r--r--coreengine/definitions.h6
-rw-r--r--coreengine/listelements.c37
-rw-r--r--coreengine/listelements.h3
-rw-r--r--coreengine/viewdisplaymenu.c58
-rw-r--r--coreengine/viewdisplaymenu.h4
-rw-r--r--coreengine/viewlist.c10
-rw-r--r--coreengine/viewlist.h2
7 files changed, 72 insertions, 48 deletions
diff --git a/coreengine/definitions.h b/coreengine/definitions.h
index b07943f..5787615 100644
--- a/coreengine/definitions.h
+++ b/coreengine/definitions.h
@@ -698,6 +698,7 @@ enum class eCeMenuMainIT {
menuitemy,
menuitemwidth,
menuitemheight,
+ numitem,
count
};
@@ -721,6 +722,7 @@ enum class eLeMenuSchedulesIT {
daynumeric,
month,
year,
+ istoday,
running,
elapsed,
startsin,
@@ -766,6 +768,7 @@ enum class eCeMenuSchedulesIT {
menuitemy,
menuitemwidth,
menuitemheight,
+ numitem,
daynumeric,
month,
year,
@@ -851,6 +854,7 @@ enum class eCeMenuChannelsIT {
menuitemy,
menuitemwidth,
menuitemheight,
+ numitem,
number,
transponder,
frequency,
@@ -937,6 +941,7 @@ enum class eCeMenuTimersIT {
menuitemy,
menuitemwidth,
menuitemheight,
+ numitem,
month,
year,
channellogoexists,
@@ -1015,6 +1020,7 @@ enum class eCeMenuRecordingsIT {
menuitemy,
menuitemwidth,
menuitemheight,
+ numitem,
isnew,
percentseen,
watched,
diff --git a/coreengine/listelements.c b/coreengine/listelements.c
index 1ebfa94..ccf84af 100644
--- a/coreengine/listelements.c
+++ b/coreengine/listelements.c
@@ -78,20 +78,23 @@ cCurrentElement::cCurrentElement(void) {
listY = 0;
listWidth = 0;
listHeight = 0;
+ listNum = 0;
}
-void cCurrentElement::SetListPosition(int x, int y, int width, int height) {
+void cCurrentElement::SetListPosition(int x, int y, int width, int height, int num) {
listX = x;
listY = y;
listWidth = width;
listHeight = height;
+ listNum = num;
}
void cCurrentElement::SetListTokens(skindesignerapi::cTokenContainer *tokenContainer) {
- tokenContainer->AddIntToken(0, listX);
- tokenContainer->AddIntToken(1, listY);
+ tokenContainer->AddIntToken(0, listX - container.X());
+ tokenContainer->AddIntToken(1, listY - container.Y());
tokenContainer->AddIntToken(2, listWidth);
tokenContainer->AddIntToken(3, listHeight);
+ tokenContainer->AddIntToken(4, listNum);
}
/******************************************************************
@@ -455,7 +458,7 @@ void cLeMenuMain::RenderCurrent(void) {
if (!currentMain)
return;
currentMain->SetText(text);
- currentMain->SetListPosition(container.X(), container.Y(), container.Width(), container.Height());
+ currentMain->SetListPosition(container.X(), container.Y(), container.Width(), container.Height(), num);
currentMain->Parse();
}
@@ -500,6 +503,7 @@ void cCeMenuMain::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{menuitemy}", (int)eCeMenuMainIT::menuitemy);
tokenContainer->DefineIntToken("{menuitemwidth}", (int)eCeMenuMainIT::menuitemwidth);
tokenContainer->DefineIntToken("{menuitemheight}", (int)eCeMenuMainIT::menuitemheight);
+ tokenContainer->DefineIntToken("{numitem}", (int)eCeMenuMainIT::numitem);
tokenContainer->DefineStringToken("{label}", (int)eCeMenuMainST::label);
tokenContainer->DefineStringToken("{number}", (int)eCeMenuMainST::number);
tokenContainer->DefineStringToken("{icon}", (int)eCeMenuMainST::icon);
@@ -563,6 +567,7 @@ void cLeMenuSchedules::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{daynumeric}", (int)eLeMenuSchedulesIT::daynumeric);
tokenContainer->DefineIntToken("{month}", (int)eLeMenuSchedulesIT::month);
tokenContainer->DefineIntToken("{year}", (int)eLeMenuSchedulesIT::year);
+ tokenContainer->DefineIntToken("{istoday}", (int)eLeMenuSchedulesIT::istoday);
tokenContainer->DefineIntToken("{running}", (int)eLeMenuSchedulesIT::running);
tokenContainer->DefineIntToken("{elapsed}", (int)eLeMenuSchedulesIT::elapsed);
tokenContainer->DefineIntToken("{startsin}", (int)eLeMenuSchedulesIT::startsin);
@@ -626,12 +631,14 @@ bool cLeMenuSchedules::Parse(bool forced) {
tokenContainer->AddStringToken((int)eLeMenuSchedulesST::start, *(event->GetTimeString()));
tokenContainer->AddStringToken((int)eLeMenuSchedulesST::stop, *(event->GetEndTimeString()));
time_t startTime = event->StartTime();
- struct tm * sStartTime = localtime(&startTime);
+ struct tm *sStartTime = localtime(&startTime);
+ int day = sStartTime->tm_mday;
+ int month = sStartTime->tm_mon;
tokenContainer->AddStringToken((int)eLeMenuSchedulesST::day, *WeekDayName(startTime));
tokenContainer->AddStringToken((int)eLeMenuSchedulesST::date, *ShortDateString(startTime));
tokenContainer->AddIntToken((int)eLeMenuSchedulesIT::year, sStartTime->tm_year + 1900);
- tokenContainer->AddIntToken((int)eLeMenuSchedulesIT::daynumeric, sStartTime->tm_mday);
- tokenContainer->AddIntToken((int)eLeMenuSchedulesIT::month, sStartTime->tm_mon+1);
+ tokenContainer->AddIntToken((int)eLeMenuSchedulesIT::daynumeric, day);
+ tokenContainer->AddIntToken((int)eLeMenuSchedulesIT::month, month + 1);
bool isRunning = false;
time_t now = time(NULL);
@@ -645,6 +652,8 @@ bool cLeMenuSchedules::Parse(bool forced) {
tokenContainer->AddIntToken((int)eLeMenuSchedulesIT::elapsed, 0);
tokenContainer->AddIntToken((int)eLeMenuSchedulesIT::startsin, (event->StartTime() - now)/60);
}
+ struct tm *sNow = localtime(&now);
+ tokenContainer->AddIntToken((int)eLeMenuSchedulesIT::istoday, (day == sNow->tm_mday && month == sNow->tm_mon) ? true : false);
tokenContainer->AddIntToken((int)eLeMenuSchedulesIT::duration, event->Duration() / 60);
tokenContainer->AddIntToken((int)eLeMenuSchedulesIT::durationhours, event->Duration() / 3600);
tokenContainer->AddStringToken((int)eLeMenuSchedulesST::durationminutes, *cString::sprintf("%.2d", (event->Duration() / 60)%60));
@@ -676,7 +685,7 @@ void cLeMenuSchedules::RenderCurrent(void) {
return;
currentSchedules->Set(event, channel, withDate, timerMatch, menuCat);
currentSchedules->SetEpgSearchFav(epgSearchFav);
- currentSchedules->SetListPosition(container.X(), container.Y(), container.Width(), container.Height());
+ currentSchedules->SetListPosition(container.X(), container.Y(), container.Width(), container.Height(), num);
currentSchedules->Parse();
}
@@ -707,6 +716,7 @@ void cCeMenuSchedules::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{menuitemy}", (int)eCeMenuSchedulesIT::menuitemy);
tokenContainer->DefineIntToken("{menuitemwidth}", (int)eCeMenuSchedulesIT::menuitemwidth);
tokenContainer->DefineIntToken("{menuitemheight}", (int)eCeMenuSchedulesIT::menuitemheight);
+ tokenContainer->DefineIntToken("{numitem}", (int)eCeMenuSchedulesIT::numitem);
tokenContainer->DefineIntToken("{daynumeric}", (int)eCeMenuSchedulesIT::daynumeric);
tokenContainer->DefineIntToken("{month}", (int)eCeMenuSchedulesIT::month);
tokenContainer->DefineIntToken("{year}", (int)eCeMenuSchedulesIT::year);
@@ -953,7 +963,7 @@ void cLeMenuChannels::RenderCurrent(void) {
if (!currentChannel)
return;
currentChannel->Set(channel, withProvider);
- currentChannel->SetListPosition(container.X(), container.Y(), container.Width(), container.Height());
+ currentChannel->SetListPosition(container.X(), container.Y(), container.Width(), container.Height(), num);
currentChannel->Parse();
}
@@ -998,6 +1008,7 @@ void cCeMenuChannels::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{menuitemy}", (int)eCeMenuChannelsIT::menuitemy);
tokenContainer->DefineIntToken("{menuitemwidth}", (int)eCeMenuChannelsIT::menuitemwidth);
tokenContainer->DefineIntToken("{menuitemheight}", (int)eCeMenuChannelsIT::menuitemheight);
+ tokenContainer->DefineIntToken("{numitem}", (int)eCeMenuChannelsIT::numitem);
tokenContainer->DefineIntToken("{number}", (int)eCeMenuChannelsIT::number);
tokenContainer->DefineIntToken("{transponder}", (int)eCeMenuChannelsIT::transponder);
tokenContainer->DefineIntToken("{frequency}", (int)eCeMenuChannelsIT::frequency);
@@ -1271,7 +1282,7 @@ void cLeMenuTimers::RenderCurrent(void) {
if (!currentTimer)
return;
currentTimer->Set(timer);
- currentTimer->SetListPosition(container.X(), container.Y(), container.Width(), container.Height());
+ currentTimer->SetListPosition(container.X(), container.Y(), container.Width(), container.Height(), num);
currentTimer->Parse();
}
@@ -1307,6 +1318,7 @@ void cCeMenuTimers::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{menuitemy}", (int)eCeMenuTimersIT::menuitemy);
tokenContainer->DefineIntToken("{menuitemwidth}", (int)eCeMenuTimersIT::menuitemwidth);
tokenContainer->DefineIntToken("{menuitemheight}", (int)eCeMenuTimersIT::menuitemheight);
+ tokenContainer->DefineIntToken("{numitem}", (int)eCeMenuTimersIT::numitem);
tokenContainer->DefineIntToken("{month}", (int)eCeMenuTimersIT::month);
tokenContainer->DefineIntToken("{year}", (int)eCeMenuTimersIT::year);
tokenContainer->DefineIntToken("{channellogoexists}", (int)eCeMenuTimersIT::channellogoexists);
@@ -1602,7 +1614,7 @@ void cLeMenuRecordings::RenderCurrent(void) {
if (!currentRecording)
return;
currentRecording->Set(recording, level, total, New);
- currentRecording->SetListPosition(container.X(), container.Y(), container.Width(), container.Height());
+ currentRecording->SetListPosition(container.X(), container.Y(), container.Width(), container.Height(), num);
currentRecording->Parse();
}
@@ -1679,6 +1691,7 @@ void cCeMenuRecordings::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{menuitemy}", (int)eCeMenuRecordingsIT::menuitemy);
tokenContainer->DefineIntToken("{menuitemwidth}", (int)eCeMenuRecordingsIT::menuitemwidth);
tokenContainer->DefineIntToken("{menuitemheight}", (int)eCeMenuRecordingsIT::menuitemheight);
+ tokenContainer->DefineIntToken("{numitem}", (int)eCeMenuRecordingsIT::numitem);
tokenContainer->DefineIntToken("{new}", (int)eCeMenuRecordingsIT::isnew);
tokenContainer->DefineIntToken("{percentseen}", (int)eCeMenuRecordingsIT::percentseen);
tokenContainer->DefineIntToken("{watched}", (int)eCeMenuRecordingsIT::watched);
@@ -1888,7 +1901,7 @@ void cLeMenuPlugin::RenderCurrent(void) {
if (!currentPlugin)
return;
currentPlugin->Set(tokenContainer);
- currentPlugin->SetListPosition(container.X(), container.Y(), container.Width(), container.Height());
+ currentPlugin->SetListPosition(container.X(), container.Y(), container.Width(), container.Height(), num);
currentPlugin->Parse();
}
diff --git a/coreengine/listelements.h b/coreengine/listelements.h
index 6c8a0fb..8f2b5b2 100644
--- a/coreengine/listelements.h
+++ b/coreengine/listelements.h
@@ -42,10 +42,11 @@ protected:
int listY;
int listWidth;
int listHeight;
+ int listNum;
public:
cCurrentElement(void);
virtual ~cCurrentElement(void) {};
- void SetListPosition(int x, int y, int width, int height);
+ void SetListPosition(int x, int y, int width, int height, int num);
void SetListTokens(skindesignerapi::cTokenContainer *tokenContainer);
};
diff --git a/coreengine/viewdisplaymenu.c b/coreengine/viewdisplaymenu.c
index 07de9fe..9376879 100644
--- a/coreengine/viewdisplaymenu.c
+++ b/coreengine/viewdisplaymenu.c
@@ -639,40 +639,33 @@ cSubView::cSubView(const char *name) {
colorbuttons = NULL;
scrollbar = NULL;
viewList = NULL;
- viewListVertical = NULL;
- viewListHorizontal = NULL;
SetViewElements();
}
cSubView::~cSubView(void) {
- delete viewListHorizontal;
- delete viewListVertical;
+ for(vector<cViewList*>::iterator it = viewLists.begin(); it != viewLists.end(); it++) {
+ delete (*it);
+ }
}
void cSubView::SetGlobals(cGlobals *globals) {
cView::SetGlobals(globals);
- if (viewListVertical)
- viewListVertical->SetGlobals(globals);
- if (viewListHorizontal)
- viewListHorizontal->SetGlobals(globals);
+ for(vector<cViewList*>::iterator it = viewLists.begin(); it != viewLists.end(); it++) {
+ (*it)->SetGlobals(globals);
+ }
}
void cSubView::PreCache(void) {
attribs->SetContainer(container.X(), container.Y(), container.Width(), container.Height());
attribs->Cache();
- cView::PreCache();
- if (viewListVertical) {
- viewListVertical->SetPlugId(plugId);
- viewListVertical->SetPlugMenuId(plugMenuId);
- viewListVertical->SetContainer(attribs->X(), attribs->Y(), attribs->Width(), attribs->Height());
- viewListVertical->PreCache();
- }
- if (viewListHorizontal) {
- viewListHorizontal->SetPlugId(plugId);
- viewListHorizontal->SetPlugMenuId(plugMenuId);
- viewListHorizontal->SetContainer(attribs->X(), attribs->Y(), attribs->Width(), attribs->Height());
- viewListHorizontal->PreCache();
+ for(vector<cViewList*>::iterator it = viewLists.begin(); it != viewLists.end(); it++) {
+ cViewList *vl = (*it);
+ vl->SetPlugId(plugId);
+ vl->SetPlugMenuId(plugMenuId);
+ vl->SetContainer(attribs->X(), attribs->Y(), attribs->Width(), attribs->Height());
+ vl->PreCache();
}
+ cView::PreCache();
}
bool cSubView::ViewElementSet(int ve) {
@@ -769,14 +762,7 @@ void cSubView::SetViewElementHorizontal(eVeDisplayMenu ve, cViewElement *viewEle
}
void cSubView::AddViewList(cViewList *viewList) {
- eOrientation orientation = viewList->Orientation();
- if (orientation == eOrientation::vertical) {
- viewListVertical = viewList;
- } else if (orientation == eOrientation::horizontal) {
- viewListHorizontal = viewList;
- } else {
- viewListVertical = viewList;
- }
+ viewLists.push_back(viewList);
}
int cSubView::NumListItems(void) {
@@ -987,11 +973,17 @@ void cSubView::SetViewElementObjects(void) {
else if (viewElements[(int)eVeDisplayMenu::scrollbar])
scrollbar = dynamic_cast<cVeDmScrollbar*>(viewElements[(int)eVeDisplayMenu::scrollbar]);
-
- if (attribs->Orientation() == eOrientation::horizontal)
- viewList = viewListHorizontal;
- else
- viewList = viewListVertical;
+ //set appropriate viewlist, orientation and condition have to be considered
+ for(vector<cViewList*>::iterator it = viewLists.begin(); it != viewLists.end(); it++) {
+ cViewList *vl = (*it);
+ if (vl->Orientation() == orientation && vl->Execute()) {
+ viewList = vl;
+ break;
+ }
+ }
+ if (!viewList && viewLists.size() > 0) {
+ viewList = viewLists.front();
+ }
}
void cSubView::SetViewElements(void) {
diff --git a/coreengine/viewdisplaymenu.h b/coreengine/viewdisplaymenu.h
index 1e3e624..b50bdb0 100644
--- a/coreengine/viewdisplaymenu.h
+++ b/coreengine/viewdisplaymenu.h
@@ -72,6 +72,7 @@ public:
void AddSubview(const char *sSubView, cSubView *subView);
void AddPluginview(cSubView *plugView);
void SetSubView(eMenuCategory MenuCat);
+ eMenuCategory MenuCat(void) { return menuCat; };
void SetSortMode(eMenuSortMode sortMode);
void SetPluginMenu(int plugId, int plugMenuId);
int NumListItems(void);
@@ -114,8 +115,7 @@ protected:
int plugId;
int plugMenuId;
cViewList *viewList;
- cViewList *viewListVertical;
- cViewList *viewListHorizontal;
+ vector<cViewList*> viewLists;
cViewElement *background;
cVeDmHeader *header;
cVeDateTime *datetime;
diff --git a/coreengine/viewlist.c b/coreengine/viewlist.c
index dbbe5e7..83e75f8 100644
--- a/coreengine/viewlist.c
+++ b/coreengine/viewlist.c
@@ -24,6 +24,7 @@ cViewList::~cViewList(void) {
}
}
delete[] listElements;
+ delete tokenContainer;
}
void cViewList::SetGlobals(cGlobals *globals) {
@@ -127,6 +128,9 @@ void cViewList::AddCurrentElement(cViewElement *currentElement) {
}
void cViewList::PreCache(void) {
+ tokenContainer = new skindesignerapi::cTokenContainer();
+ tokenContainer->CreateContainers();
+ attribs->SetTokenContainer(tokenContainer);
attribs->SetContainer(container.X(), container.Y(), container.Width(), container.Height());
attribs->SetGlobals(globals);
attribs->Cache();
@@ -164,6 +168,10 @@ int cViewList::NumItems(void) {
return numElements;
}
+bool cViewList::Execute(void) {
+ return attribs->DoExecute();
+}
+
eOrientation cViewList::Orientation(void) {
return attribs->Orientation();
}
@@ -219,6 +227,8 @@ void cViewList::SetTransparency(int transparency) {
}
void cViewList::Debug(void) {
+ esyslog("skindesigner: --- debug viewlist");
+ attribs->Debug();
}
/******************************************************************
diff --git a/coreengine/viewlist.h b/coreengine/viewlist.h
index a979723..6c14d03 100644
--- a/coreengine/viewlist.h
+++ b/coreengine/viewlist.h
@@ -13,6 +13,7 @@ protected:
cViewListAttribs *attribs;
cRect container;
cGlobals *globals;
+ skindesignerapi::cTokenContainer *tokenContainer;
int numElements;
eOrientation orientation;
cViewElement *listElement;
@@ -34,6 +35,7 @@ public:
void AddCurrentElement(cViewElement *currentElement);
virtual void PreCache(void);
int NumItems(void);
+ bool Execute(void);
eOrientation Orientation(void);
void Draw(eMenuCategory menuCat);
void Clear(void);