left / right keys in zappilot configurable in skin

This commit is contained in:
louis
2016-05-29 10:07:28 +02:00
parent 75668612be
commit 87f3d895f7
14 changed files with 84 additions and 34 deletions

View File

@@ -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
***************************************************************************/

View File

@@ -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);

View File

@@ -244,6 +244,8 @@ void cViewListAttribs::Set(vector<stringpair> &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<string, int>("startx", (int)eViewListAttribs::startx));
attribIDs.insert(pair<string, int>("starty", (int)eViewListAttribs::starty));
attribIDs.insert(pair<string, int>("condition", (int)eViewListAttribs::condition));
attribIDs.insert(pair<string, int>("button", (int)eViewListAttribs::button));
attribNames.insert(pair<int, string>((int)eViewListAttribs::align, "align"));
attribNames.insert(pair<int, string>((int)eViewListAttribs::menuitemwidth, "menuitemwidth"));
attribNames.insert(pair<int, string>((int)eViewListAttribs::determinatefont, "determinatefont"));
@@ -301,6 +304,7 @@ void cViewListAttribs::SetAttributesDefs(void) {
attribNames.insert(pair<int, string>((int)eViewListAttribs::startx, "startx"));
attribNames.insert(pair<int, string>((int)eViewListAttribs::starty, "starty"));
attribNames.insert(pair<int, string>((int)eViewListAttribs::condition, "condition"));
attribNames.insert(pair<int, string>((int)eViewListAttribs::button, "button"));
}
void cViewListAttribs::Debug(void) {

View File

@@ -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);
};
/******************************************************************

View File

@@ -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

View File

@@ -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;

View File

@@ -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);

View File

@@ -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; };