diff options
Diffstat (limited to 'libtemplate/xmlparser.c')
-rw-r--r-- | libtemplate/xmlparser.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/libtemplate/xmlparser.c b/libtemplate/xmlparser.c index dd5a39b..e086ba4 100644 --- a/libtemplate/xmlparser.c +++ b/libtemplate/xmlparser.c @@ -9,6 +9,7 @@ void SkinDesignerXMLErrorHandler (void * userData, xmlErrorPtr error) { } cXmlParser::cXmlParser(void) { + view = NULL; doc = NULL; root = NULL; ctxt = NULL; @@ -194,6 +195,11 @@ bool cXmlParser::ParseView(void) { ParseViewElement(node->name, node->xmlChildrenNode, attribs); } else if (view->ValidViewList((const char*)node->name)) { ParseViewList(node); + } else if (view->ValidViewGrid((const char*)node->name)) { + xmlAttrPtr attr = node->properties; + vector<pair<string, string> > attribs; + ParseAttributes(attr, node, attribs); + ParseGrid(node->xmlChildrenNode, attribs); } else { return false; } @@ -843,6 +849,42 @@ void cXmlParser::ParseViewTab(xmlNodePtr parentNode, cTemplateView *subView) { subView->AddViewTab(viewTab); } +void cXmlParser::ParseGrid(xmlNodePtr node, vector<pair<string, string> > &attributes) { + if (!node) + return; + + if (!view) + return; + + while (node != NULL) { + + if (node->type != XML_ELEMENT_NODE) { + node = node->next; + continue; + } + + if (xmlStrcmp(node->name, (const xmlChar *) "area") && xmlStrcmp(node->name, (const xmlChar *) "areascroll")) { + esyslog("skindesigner: invalid tag \"%s\"", node->name); + node = node->next; + continue; + } + + xmlAttrPtr attr = node->properties; + vector<pair<string, string> > attribs; + ParseAttributes(attr, node, attribs); + + cTemplatePixmap *pix = new cTemplatePixmap(); + if (!xmlStrcmp(node->name, (const xmlChar *) "areascroll")) { + pix->SetScrolling(); + } + pix->SetParameters(attribs); + ParseFunctionCalls(node->xmlChildrenNode, pix); + view->AddPixmapGrid(pix, attributes); + + node = node->next; + } +} + void cXmlParser::ParseFunctionCalls(xmlNodePtr node, cTemplatePixmap *pix) { if (!node) return; |