mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
checking setup conditions for viewelements
This commit is contained in:
@@ -194,6 +194,14 @@ int cTemplateView::GetNumPixmapsViewElement(eViewElement ve) {
|
||||
return viewElement->GetNumPixmaps();
|
||||
}
|
||||
|
||||
bool cTemplateView::ExecuteView(eViewElement ve) {
|
||||
map < eViewElement, cTemplateViewElement* >::iterator hit = viewElements.find(ve);
|
||||
if (hit == viewElements.end())
|
||||
return false;
|
||||
cTemplateViewElement *viewElement = hit->second;
|
||||
return viewElement->Execute();
|
||||
}
|
||||
|
||||
int cTemplateView::GetNumListViewMenuItems(void) {
|
||||
int numElements = 0;
|
||||
cTemplateViewList *menuList = GetViewList(vlMenuItem);
|
||||
@@ -552,6 +560,7 @@ void cTemplateView::SetFunctionDefinitions(void) {
|
||||
attributes.insert("delay");
|
||||
attributes.insert("fadetime");
|
||||
attributes.insert("name");
|
||||
attributes.insert("condition");
|
||||
funcsAllowed.insert(pair< string, set<string> >(name, attributes));
|
||||
|
||||
name = "area";
|
||||
|
@@ -109,6 +109,7 @@ public:
|
||||
cRect GetOsdSize(void);
|
||||
int GetNumPixmaps(void);
|
||||
int GetNumPixmapsViewElement(eViewElement ve);
|
||||
bool ExecuteView(eViewElement ve);
|
||||
int GetNumListViewMenuItems(void);
|
||||
bool GetScalingWindow(cRect &scalingWindow);
|
||||
map<string,string> GetCustomStringTokens(void) { return globals->GetCustomStringTokens(); };
|
||||
|
@@ -46,7 +46,7 @@ bool cTemplateViewElement::CalculateParameters(void) {
|
||||
parameters->SetContainer(containerX, containerY, containerWidth, containerHeight);
|
||||
parameters->SetGlobals(globals);
|
||||
paramsValid = parameters->CalculateParameters();
|
||||
|
||||
parameters->ParseParameters();
|
||||
return paramsValid;
|
||||
}
|
||||
|
||||
@@ -118,6 +118,13 @@ cTemplateFunction *cTemplateViewElement::GetFunction(string name) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool cTemplateViewElement::Execute(void) {
|
||||
if (!parameters)
|
||||
return true;
|
||||
return parameters->DoExecute();
|
||||
}
|
||||
|
||||
|
||||
bool cTemplateViewElement::DebugTokens(void) {
|
||||
if (!parameters)
|
||||
return false;
|
||||
|
@@ -105,6 +105,7 @@ public:
|
||||
void InitIterator(void);
|
||||
cTemplatePixmap *GetNextPixmap(void);
|
||||
cTemplateFunction *GetFunction(string name);
|
||||
bool Execute(void);
|
||||
bool DebugTokens(void);
|
||||
virtual void Debug(void);
|
||||
};
|
||||
|
@@ -191,7 +191,7 @@ bool cXmlParser::ParseView(void) {
|
||||
} else if (view->ValidViewElement((const char*)node->name)) {
|
||||
xmlAttrPtr attr = node->properties;
|
||||
vector<pair<string, string> > attribs;
|
||||
ParseAttributes(attr, node, attribs);
|
||||
ParseAttributes(attr, node, attribs, true);
|
||||
ParseViewElement(node->name, node->xmlChildrenNode, attribs);
|
||||
} else if (view->ValidViewList((const char*)node->name)) {
|
||||
ParseViewList(node);
|
||||
@@ -682,7 +682,7 @@ bool cXmlParser::ParseSubView(xmlNodePtr node) {
|
||||
if (subView->ValidViewElement((const char*)childNode->name)) {
|
||||
xmlAttrPtr attr = childNode->properties;
|
||||
vector<pair<string, string> > attribs;
|
||||
ParseAttributes(attr, childNode, attribs);
|
||||
ParseAttributes(attr, childNode, attribs, true);
|
||||
ParseViewElement(childNode->name, childNode->xmlChildrenNode, attribs, subView);
|
||||
} else if (subView->ValidViewList((const char*)childNode->name)) {
|
||||
ParseViewList(childNode, subView);
|
||||
@@ -954,7 +954,7 @@ void cXmlParser::ParseLoopFunctionCalls(xmlNodePtr node, cTemplateLoopFunction *
|
||||
}
|
||||
}
|
||||
|
||||
bool cXmlParser::ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector<pair<string, string> > &attribs) {
|
||||
bool cXmlParser::ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector<pair<string, string> > &attribs, bool isViewElement) {
|
||||
if (attr == NULL) {
|
||||
return false;
|
||||
}
|
||||
@@ -965,15 +965,16 @@ bool cXmlParser::ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector<pair<s
|
||||
while (NULL != attr) {
|
||||
|
||||
string name = (const char*)attr->name;
|
||||
/*
|
||||
if (!name.compare("debug")) {
|
||||
attribs.push_back(pair<string, string>((const char*)attr->name, "true"));
|
||||
attr = attr->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
*/
|
||||
xmlChar *value = NULL;
|
||||
value = xmlGetProp(node, attr->name);
|
||||
if (!view->ValidAttribute((const char*)node->name, (const char*)attr->name)) {
|
||||
if (!view->ValidAttribute(isViewElement ? "viewelement" : (const char*)node->name, (const char*)attr->name)) {
|
||||
esyslog("skindesigner: unknown attribute %s in %s", (const char*)attr->name, (const char*)node->name);
|
||||
attr = attr->next;
|
||||
if (value)
|
||||
|
@@ -47,7 +47,7 @@ private:
|
||||
void ParseGrid(xmlNodePtr node, vector<pair<string, string> > &attributes);
|
||||
void ParseFunctionCalls(xmlNodePtr node, cTemplatePixmap *pix);
|
||||
void ParseLoopFunctionCalls(xmlNodePtr node, cTemplateLoopFunction *loopFunc);
|
||||
bool ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector<pair<string, string> > &attribs);
|
||||
bool ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector<pair<string, string> > &attribs, bool isViewElement = false);
|
||||
public:
|
||||
cXmlParser(void);
|
||||
virtual ~cXmlParser(void);
|
||||
|
Reference in New Issue
Block a user