From 87f3d895f7026b8b39944042cafcd50fdd14028a Mon Sep 17 00:00:00 2001 From: louis Date: Sun, 29 May 2016 10:07:28 +0200 Subject: [PATCH] left / right keys in zappilot configurable in skin --- coreengine/attribute.c | 8 +++++ coreengine/attribute.h | 1 + coreengine/attributes.c | 4 +++ coreengine/attributes.h | 1 + coreengine/definitions.h | 6 ++++ coreengine/viewdisplaychannel.c | 22 ++++++++++-- coreengine/viewdisplaychannel.h | 1 + coreengine/viewlist.h | 1 + displaychannel.c | 6 ++++ displaychannel.h | 1 + dtd/displaychannel.dtd | 2 ++ skins/estuary4vdr/setup.xml | 25 +++++++------ skins/estuary4vdr/xmlfiles/displaychannel.xml | 36 ++++++++++--------- skinskeleton/xmlfiles/displaychannel.xml | 4 +-- 14 files changed, 84 insertions(+), 34 deletions(-) diff --git a/coreengine/attribute.c b/coreengine/attribute.c index d92cb9b..a1c3ec6 100644 --- a/coreengine/attribute.c +++ b/coreengine/attribute.c @@ -339,6 +339,14 @@ void cAttributes::SetDirection(int id, const char *val) { attribs[id] = (int)direction; } +void cAttributes::SetButton(int id, const char *val) { + eButtonType button = eButtonType::none; + if (!strcmp(val, "left")) + button = eButtonType::left; + else if (!strcmp(val, "right")) + button = eButtonType::right; + attribs[id] = (int)button; +} /*************************************************************************** * Private Functions ***************************************************************************/ diff --git a/coreengine/attribute.h b/coreengine/attribute.h index f0ec6f8..ecbcf62 100644 --- a/coreengine/attribute.h +++ b/coreengine/attribute.h @@ -46,6 +46,7 @@ protected: void SetOrientation(int id, const char *val); void SetDirection(int id, const char *val); void SetAlign(int id, const char *val); + void SetButton(int id, const char *val); public: cAttributes(int numAttributes); cAttributes(const cAttributes &other); diff --git a/coreengine/attributes.c b/coreengine/attributes.c index 4840dbc..b0d0dba 100644 --- a/coreengine/attributes.c +++ b/coreengine/attributes.c @@ -244,6 +244,8 @@ void cViewListAttribs::Set(vector &attributes) { SetShiftType(id, attVal); } else if (IdEqual(id, (int)eViewListAttribs::shiftmode)) { SetShiftMode(id, attVal); + } else if (IdEqual(id, (int)eViewListAttribs::button)) { + SetButton(id, attVal); } else { attribCtors[id] = new cNumericExpr(attVal); } @@ -289,6 +291,7 @@ void cViewListAttribs::SetAttributesDefs(void) { attribIDs.insert(pair("startx", (int)eViewListAttribs::startx)); attribIDs.insert(pair("starty", (int)eViewListAttribs::starty)); attribIDs.insert(pair("condition", (int)eViewListAttribs::condition)); + attribIDs.insert(pair("button", (int)eViewListAttribs::button)); attribNames.insert(pair((int)eViewListAttribs::align, "align")); attribNames.insert(pair((int)eViewListAttribs::menuitemwidth, "menuitemwidth")); attribNames.insert(pair((int)eViewListAttribs::determinatefont, "determinatefont")); @@ -301,6 +304,7 @@ void cViewListAttribs::SetAttributesDefs(void) { attribNames.insert(pair((int)eViewListAttribs::startx, "startx")); attribNames.insert(pair((int)eViewListAttribs::starty, "starty")); attribNames.insert(pair((int)eViewListAttribs::condition, "condition")); + attribNames.insert(pair((int)eViewListAttribs::button, "button")); } void cViewListAttribs::Debug(void) { diff --git a/coreengine/attributes.h b/coreengine/attributes.h index 228964d..c0a7402 100644 --- a/coreengine/attributes.h +++ b/coreengine/attributes.h @@ -70,6 +70,7 @@ public: cPoint ShiftStartpoint(void) { return cPoint(GetValue((int)eViewListAttribs::startx), GetValue((int)eViewListAttribs::starty)); }; int ShiftType(void) { return GetValue((int)eViewListAttribs::shifttype); }; int ShiftMode(void) { return GetValue((int)eViewListAttribs::shiftmode); }; + eButtonType Button(void) { return (eButtonType)GetValue((int)eViewListAttribs::button); } void Debug(void); }; /****************************************************************** diff --git a/coreengine/definitions.h b/coreengine/definitions.h index 51f298d..5d8ecc0 100644 --- a/coreengine/definitions.h +++ b/coreengine/definitions.h @@ -1664,6 +1664,7 @@ enum class eViewListAttribs { startx, starty, condition, + button, count }; @@ -1871,5 +1872,10 @@ enum class eDirection { topdown }; +enum class eButtonType { + none = -1, + left, + right +}; #endif //__DEFINITIONS_H diff --git a/coreengine/viewdisplaychannel.c b/coreengine/viewdisplaychannel.c index 7ab36ce..831a1b9 100644 --- a/coreengine/viewdisplaychannel.c +++ b/coreengine/viewdisplaychannel.c @@ -292,6 +292,22 @@ int cViewChannel::MaxItems(void) { return 0; } +bool cViewChannel::KeyRightOpensChannellist(void) { + if (channelList) { + if (channelList->Button() == eButtonType::left) + return false; + else if (channelList->Button() == eButtonType::right) + return true; + } + if (groupList) { + if (groupList->Button() == eButtonType::left) + return true; + else if (groupList->Button() == eButtonType::right) + return false; + } + return true; +} + void cViewChannel::SetChannelInfo(const cChannel *channel) { if (!channel) return; @@ -329,6 +345,8 @@ void cViewChannel::ClearList(void) { channelList->Clear(); if (viewType == dcGroupsList && groupList) groupList->Clear(); + if (viewType == dcGroupsChannelList && groupChannelList) + groupChannelList->Clear(); } void cViewChannel::SetNumChannelHints(int num) { @@ -349,7 +367,7 @@ void cViewChannel::Close(void) { fader = NULL; delete shifter; shifter = NULL; - if (initFinished && ShiftTime() > 0) { + if (initFinished && viewType == dcDefault && ShiftTime() > 0) { cRect shiftbox = CoveredArea(); cPoint ref = cPoint(shiftbox.X(), shiftbox.Y()); cPoint end = ShiftStart(shiftbox); @@ -357,7 +375,7 @@ void cViewChannel::Close(void) { shifter->Shift(); delete shifter; shifter = NULL; - } else if (initFinished && FadeTime() > 0) { + } else if (initFinished && viewType == dcDefault && FadeTime() > 0) { fader = new cAnimation((cFadable*)this, false); fader->Fade(); delete fader; diff --git a/coreengine/viewdisplaychannel.h b/coreengine/viewdisplaychannel.h index aa7c278..497d327 100644 --- a/coreengine/viewdisplaychannel.h +++ b/coreengine/viewdisplaychannel.h @@ -62,6 +62,7 @@ public: #ifdef USE_ZAPCOCKPIT void SetViewType(eDisplaychannelView viewType); int MaxItems(void); + bool KeyRightOpensChannellist(void); void SetChannelInfo(const cChannel *channel); void SetChannelList(const cChannel *channel, int index, bool current); void SetGroupList(const char *group, int numChannels, int index, bool current); diff --git a/coreengine/viewlist.h b/coreengine/viewlist.h index b72123e..8e968c8 100644 --- a/coreengine/viewlist.h +++ b/coreengine/viewlist.h @@ -43,6 +43,7 @@ public: void Draw(eMenuCategory menuCat); void Clear(void); virtual void Close(void); + eButtonType Button(void) { return attribs->Button(); }; //Fadable bool Detached(void) { return false; }; int Delay(void) { return 0; }; diff --git a/displaychannel.c b/displaychannel.c index c9cc832..96e4419 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -43,6 +43,12 @@ int cSDDisplayChannel::MaxItems(void) { return view->MaxItems(); } +bool cSDDisplayChannel::KeyRightOpensChannellist(void) { + if (!ok) + return true; + return view->KeyRightOpensChannellist(); +} + void cSDDisplayChannel::SetChannelInfo(const cChannel *Channel) { if (!ok) return; diff --git a/displaychannel.h b/displaychannel.h index e0f2895..d0c7dbb 100644 --- a/displaychannel.h +++ b/displaychannel.h @@ -23,6 +23,7 @@ public: #ifdef USE_ZAPCOCKPIT virtual void SetViewType(eDisplaychannelView ViewType); virtual int MaxItems(void); + virtual bool KeyRightOpensChannellist(void); virtual void SetChannelInfo(const cChannel *Channel); virtual void SetChannelList(const cChannel *Channel, int Index, bool Current); virtual void SetGroupList(const char *Group, int NumChannels, int Index, bool Current); diff --git a/dtd/displaychannel.dtd b/dtd/displaychannel.dtd index 9ed515c..cf1aed6 100644 --- a/dtd/displaychannel.dtd +++ b/dtd/displaychannel.dtd @@ -307,6 +307,7 @@ numlistelements CDATA #REQUIRED orientation CDATA #REQUIRED condition CDATA #IMPLIED + button CDATA #IMPLIED > @@ -325,6 +326,7 @@ numlistelements CDATA #REQUIRED orientation CDATA #REQUIRED condition CDATA #IMPLIED + button CDATA #IMPLIED > diff --git a/skins/estuary4vdr/setup.xml b/skins/estuary4vdr/setup.xml index bd57312..673b25d 100644 --- a/skins/estuary4vdr/setup.xml +++ b/skins/estuary4vdr/setup.xml @@ -23,11 +23,11 @@ 80 6 - 38 - 3 - 38 - 35 - 28 + 30 + 3 + 45 + 26 + 30 70 80 80 @@ -361,15 +361,14 @@ Einfahrzeit für Zapcockpit Elemente [ms] Liukuman kesto elementeille [ms] - - Font size channel - Schriftgröße Kanal - Kirjasintyypin koko kanavalle + + Font size remaining time present event + Schriftgröße verbleibende Zeit aktuelle Sendung - - Vertical position channel - Vertikale Position Kanal - Pystysijainti kanavalle + + Vertical position remaining time present event + Vertikale Position verbleibende Zeit aktuelle Sendung + Pystysijainti nykyiselle ohjelmalle Font size present event diff --git a/skins/estuary4vdr/xmlfiles/displaychannel.xml b/skins/estuary4vdr/xmlfiles/displaychannel.xml index 0c3ddc1..d3be8bf 100644 --- a/skins/estuary4vdr/xmlfiles/displaychannel.xml +++ b/skins/estuary4vdr/xmlfiles/displaychannel.xml @@ -198,17 +198,18 @@ - + + - - - + + + - - - + + + @@ -274,18 +275,19 @@ - - + + + - - - - + + + + - - - - + + + + diff --git a/skinskeleton/xmlfiles/displaychannel.xml b/skinskeleton/xmlfiles/displaychannel.xml index bf2ddaa..5bfed29 100644 --- a/skinskeleton/xmlfiles/displaychannel.xml +++ b/skinskeleton/xmlfiles/displaychannel.xml @@ -330,7 +330,7 @@ {nexteventstart} start time of next event in hh:mm {nexteventstop} end time of next event in hh:mm --> - + - +