mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
plugin interface
This commit is contained in:
@@ -4,11 +4,11 @@
|
||||
|
||||
// --- cTemplate -------------------------------------------------------------
|
||||
|
||||
cTemplate::cTemplate(eViewType viewType) {
|
||||
cTemplate::cTemplate(eViewType viewType, string pluginName, int viewID) {
|
||||
globals = NULL;
|
||||
rootView = NULL;
|
||||
this->viewType = viewType;
|
||||
CreateView();
|
||||
CreateView(pluginName, viewID);
|
||||
}
|
||||
|
||||
cTemplate::~cTemplate() {
|
||||
@@ -21,8 +21,8 @@ cTemplate::~cTemplate() {
|
||||
/*******************************************************************
|
||||
* Public Functions
|
||||
*******************************************************************/
|
||||
bool cTemplate::ReadFromXML(void) {
|
||||
std::string xmlFile;
|
||||
bool cTemplate::ReadFromXML(string xmlfile) {
|
||||
string xmlFile;
|
||||
switch (viewType) {
|
||||
case vtDisplayChannel:
|
||||
xmlFile = "displaychannel.xml";
|
||||
@@ -42,6 +42,9 @@ bool cTemplate::ReadFromXML(void) {
|
||||
case vtDisplayAudioTracks:
|
||||
xmlFile = "displayaudiotracks.xml";
|
||||
break;
|
||||
case vtDisplayPlugin:
|
||||
xmlFile = xmlfile;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -56,7 +59,7 @@ bool cTemplate::ReadFromXML(void) {
|
||||
//read additional plugin templates
|
||||
bool ok = true;
|
||||
if (viewType == vtDisplayMenu) {
|
||||
config.InitPluginIterator();
|
||||
config.InitPluginMenuIterator();
|
||||
map <int,string> *plugTemplates = NULL;
|
||||
string plugName;
|
||||
while ( plugTemplates = config.GetPluginTemplates(plugName) ) {
|
||||
@@ -119,7 +122,7 @@ void cTemplate::Debug(void) {
|
||||
* Private Functions
|
||||
*******************************************************************/
|
||||
|
||||
void cTemplate::CreateView(void) {
|
||||
void cTemplate::CreateView(string pluginName, int viewID) {
|
||||
switch (viewType) {
|
||||
case vtDisplayChannel:
|
||||
rootView = new cTemplateViewChannel();
|
||||
@@ -138,7 +141,10 @@ void cTemplate::CreateView(void) {
|
||||
break;
|
||||
case vtDisplayMessage:
|
||||
rootView = new cTemplateViewMessage();
|
||||
break;
|
||||
break;
|
||||
case vtDisplayPlugin:
|
||||
rootView = new cTemplateViewPlugin(pluginName, viewID);
|
||||
break;
|
||||
default:
|
||||
esyslog("skindesigner: unknown view %d", viewType);
|
||||
}
|
||||
|
@@ -26,7 +26,8 @@ enum eViewType {
|
||||
vtDisplayReplay,
|
||||
vtDisplayVolume,
|
||||
vtDisplayAudioTracks,
|
||||
vtDisplayMessage
|
||||
vtDisplayMessage,
|
||||
vtDisplayPlugin
|
||||
};
|
||||
|
||||
class cTemplate {
|
||||
@@ -37,13 +38,13 @@ private:
|
||||
protected:
|
||||
cGlobals *globals;
|
||||
cTemplateView *rootView;
|
||||
void CreateView(void);
|
||||
void CreateView(string pluginName, int viewID);
|
||||
void GetUsedFonts(cTemplateView *view, vector< pair<string, int> > &usedFonts);
|
||||
void CacheImages(cTemplateView *view);
|
||||
public:
|
||||
cTemplate(eViewType viewType);
|
||||
cTemplate(eViewType viewType, string pluginName = "", int viewID = -1);
|
||||
virtual ~cTemplate(void);
|
||||
bool ReadFromXML(void);
|
||||
bool ReadFromXML(string xmlfile = "");
|
||||
void SetGlobals(cGlobals *globals);
|
||||
cTemplateView *GetRootView(void) { return rootView; };
|
||||
void Translate(void);
|
||||
|
@@ -53,6 +53,28 @@ void cTemplatePixmap::SetY(int y) {
|
||||
parameters->SetYManually(y);
|
||||
}
|
||||
|
||||
void cTemplatePixmap::SetWidthPercent(double width) {
|
||||
int absWidth = containerWidth * width;
|
||||
cString pWidth = cString::sprintf("%d", absWidth);
|
||||
parameters->SetWidthManually(*pWidth);
|
||||
}
|
||||
|
||||
void cTemplatePixmap::SetHeightPercent(double height) {
|
||||
int absHeight = containerHeight * height;
|
||||
cString pHeight = cString::sprintf("%d", absHeight);
|
||||
parameters->SetHeightManually(*pHeight);
|
||||
}
|
||||
|
||||
void cTemplatePixmap::SetXPercent(double x) {
|
||||
int absX = containerX + containerWidth * x;
|
||||
parameters->SetXManually(absX);
|
||||
}
|
||||
|
||||
void cTemplatePixmap::SetYPercent(double y) {
|
||||
int absY = containerY + containerHeight * y;
|
||||
parameters->SetYManually(absY);
|
||||
}
|
||||
|
||||
void cTemplatePixmap::ClearDynamicParameters(void) {
|
||||
parameters->ClearDynamicParameters();
|
||||
}
|
||||
|
@@ -47,6 +47,10 @@ public:
|
||||
void SetHeight(int height);
|
||||
void SetX(int x);
|
||||
void SetY(int y);
|
||||
void SetWidthPercent(double width);
|
||||
void SetHeightPercent(double height);
|
||||
void SetXPercent(double x);
|
||||
void SetYPercent(double y);
|
||||
void SetContainer(int x, int y, int w, int h);
|
||||
void SetGlobals(cGlobals *globals) { this->globals = globals; };
|
||||
void AddFunction(string name, vector<pair<string, string> > ¶ms);
|
||||
|
@@ -1,3 +1,4 @@
|
||||
#include "../config.h"
|
||||
#include "templateview.h"
|
||||
|
||||
// --- cTemplateView -------------------------------------------------------------
|
||||
@@ -22,6 +23,10 @@ cTemplateView::~cTemplateView() {
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
for (map < int, cTemplateViewGrid* >::iterator it = viewGrids.begin(); it != viewGrids.end(); it++) {
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
for (vector < cTemplateViewTab* >::iterator it = viewTabs.begin(); it != viewTabs.end(); it++) {
|
||||
delete *it;
|
||||
}
|
||||
@@ -61,8 +66,9 @@ void cTemplateView::SetContainer(int x, int y, int width, int height) {
|
||||
|
||||
cTemplateViewElement *cTemplateView::GetViewElement(eViewElement ve) {
|
||||
map < eViewElement, cTemplateViewElement* >::iterator hit = viewElements.find(ve);
|
||||
if (hit == viewElements.end())
|
||||
if (hit == viewElements.end()) {
|
||||
return NULL;
|
||||
}
|
||||
return hit->second;
|
||||
}
|
||||
|
||||
@@ -78,6 +84,14 @@ cTemplateViewElement *cTemplateView::GetNextViewElement(void) {
|
||||
return viewElement;
|
||||
}
|
||||
|
||||
cTemplateViewGrid *cTemplateView::GetViewGrid(int gridID) {
|
||||
map < int, cTemplateViewGrid* >::iterator hit = viewGrids.find(gridID);
|
||||
if (hit == viewGrids.end()) {
|
||||
return NULL;
|
||||
}
|
||||
return hit->second;
|
||||
}
|
||||
|
||||
cTemplateViewList *cTemplateView::GetViewList(eViewList vl) {
|
||||
map < eViewList, cTemplateViewList* >::iterator hit = viewLists.find(vl);
|
||||
if (hit == viewLists.end())
|
||||
@@ -224,7 +238,14 @@ bool cTemplateView::ValidViewList(const char *viewList) {
|
||||
set<string>::iterator hit = viewListsAllowed.find(viewList);
|
||||
if (hit == viewListsAllowed.end())
|
||||
return false;
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cTemplateView::ValidViewGrid(const char *viewGrid) {
|
||||
set<string>::iterator hit = viewGridsAllowed.find(viewGrid);
|
||||
if (hit == viewGridsAllowed.end())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cTemplateView::ValidFunction(const char *func) {
|
||||
@@ -428,6 +449,14 @@ void cTemplateView::PreCache(bool isSubview) {
|
||||
pixOffset += viewElement->GetNumPixmaps();
|
||||
}
|
||||
|
||||
//Cache ViewGrids
|
||||
for (map < int, cTemplateViewGrid* >::iterator it = viewGrids.begin(); it != viewGrids.end(); it++) {
|
||||
cTemplateViewGrid *viewGrid = it->second;
|
||||
viewGrid->SetGlobals(globals);
|
||||
viewGrid->SetContainer(0, 0, osdWidth, osdHeight);
|
||||
viewGrid->CalculateParameters();
|
||||
viewGrid->CalculatePixmapParameters();
|
||||
}
|
||||
|
||||
//Cache ViewLists
|
||||
for (map < eViewList, cTemplateViewList* >::iterator it = viewLists.begin(); it != viewLists.end(); it++) {
|
||||
@@ -486,6 +515,12 @@ void cTemplateView::Debug(void) {
|
||||
viewList->Debug();
|
||||
}
|
||||
|
||||
for (map < int, cTemplateViewGrid* >::iterator it = viewGrids.begin(); it != viewGrids.end(); it++) {
|
||||
esyslog("skindesigner: ++++++++ ViewGrid %d:", it->first);
|
||||
cTemplateViewGrid *viewGrid = it->second;
|
||||
viewGrid->Debug();
|
||||
}
|
||||
|
||||
for (vector<cTemplateViewTab*>::iterator tab = viewTabs.begin(); tab != viewTabs.end(); tab++) {
|
||||
esyslog("skindesigner: ++++++++ ViewTab");
|
||||
(*tab)->Debug();
|
||||
@@ -516,6 +551,7 @@ void cTemplateView::SetFunctionDefinitions(void) {
|
||||
attributes.insert("debug");
|
||||
attributes.insert("delay");
|
||||
attributes.insert("fadetime");
|
||||
attributes.insert("name");
|
||||
funcsAllowed.insert(pair< string, set<string> >(name, attributes));
|
||||
|
||||
name = "area";
|
||||
@@ -1095,7 +1131,6 @@ void cTemplateViewMenu::SetViewElements(void) {
|
||||
}
|
||||
|
||||
void cTemplateViewMenu::SetViewLists(void) {
|
||||
viewListsAllowed.insert("timerlist");
|
||||
viewListsAllowed.insert("menuitems");
|
||||
}
|
||||
|
||||
@@ -1210,9 +1245,6 @@ string cTemplateViewMenu::GetViewElementName(eViewElement ve) {
|
||||
string cTemplateViewMenu::GetViewListName(eViewList vl) {
|
||||
string name;
|
||||
switch (vl) {
|
||||
case vlTimerList:
|
||||
name = "Timer List";
|
||||
break;
|
||||
case vlMenuItem:
|
||||
name = "Menu Item";
|
||||
break;
|
||||
@@ -1335,9 +1367,7 @@ void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, vec
|
||||
void cTemplateViewMenu::AddViewList(string sViewList, cTemplateViewList *viewList) {
|
||||
|
||||
eViewList vl = vlUndefined;
|
||||
if (!sViewList.compare("timerlist")) {
|
||||
vl = vlTimerList;
|
||||
} else if (!sViewList.compare("menuitems")) {
|
||||
if (!sViewList.compare("menuitems")) {
|
||||
vl = vlMenuItem;
|
||||
}
|
||||
|
||||
@@ -1797,3 +1827,108 @@ void cTemplateViewAudioTracks::AddViewList(string sViewList, cTemplateViewList *
|
||||
viewList->SetGlobals(globals);
|
||||
viewLists.insert(pair< eViewList, cTemplateViewList*>(vl, viewList));
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* cTemplateViewPlugin
|
||||
************************************************************************************/
|
||||
|
||||
cTemplateViewPlugin::cTemplateViewPlugin(string pluginName, int viewID) {
|
||||
this->pluginName = pluginName;
|
||||
this->viewID = viewID;
|
||||
viewName = "displayplugin";
|
||||
//definition of allowed parameters for class itself
|
||||
set<string> attributes;
|
||||
attributes.insert("x");
|
||||
attributes.insert("y");
|
||||
attributes.insert("width");
|
||||
attributes.insert("height");
|
||||
attributes.insert("fadetime");
|
||||
attributes.insert("scaletvx");
|
||||
attributes.insert("scaletvy");
|
||||
attributes.insert("scaletvwidth");
|
||||
attributes.insert("scaletvheight");
|
||||
funcsAllowed.insert(pair< string, set<string> >(viewName, attributes));
|
||||
|
||||
attributes.clear();
|
||||
attributes.insert("x");
|
||||
attributes.insert("y");
|
||||
attributes.insert("width");
|
||||
attributes.insert("height");
|
||||
attributes.insert("name");
|
||||
funcsAllowed.insert(pair< string, set<string> >("grid", attributes));
|
||||
|
||||
viewElementsAllowed.insert("viewelement");
|
||||
viewGridsAllowed.insert("grid");
|
||||
}
|
||||
|
||||
cTemplateViewPlugin::~cTemplateViewPlugin() {
|
||||
}
|
||||
|
||||
void cTemplateViewPlugin::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {
|
||||
eViewElement ve = veUndefined;
|
||||
string viewElementName = "";
|
||||
bool found = false;
|
||||
for (vector<pair<string, string> >::iterator it = viewElementattributes.begin(); it != viewElementattributes.end(); it++) {
|
||||
if (!(it->first).compare("name")) {
|
||||
viewElementName = it->second;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
esyslog("skindesigner: no name defined for plugin %s viewelement", pluginName.c_str());
|
||||
}
|
||||
|
||||
int viewElementID = config.GetPluginViewElementID(pluginName, viewElementName, viewID);
|
||||
|
||||
if (viewElementID == -1) {
|
||||
esyslog("skindesigner: %s: unknown ViewElement in displayplugin: %s", pluginName.c_str(), viewElementName.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
pix->SetGlobals(globals);
|
||||
|
||||
ve = (eViewElement)viewElementID;
|
||||
map < eViewElement, cTemplateViewElement* >::iterator hit = viewElements.find(ve);
|
||||
if (hit == viewElements.end()) {
|
||||
cTemplateViewElement *viewElement = new cTemplateViewElement();
|
||||
viewElement->SetParameters(viewElementattributes);
|
||||
viewElement->AddPixmap(pix);
|
||||
viewElements.insert(pair< eViewElement, cTemplateViewElement*>(ve, viewElement));
|
||||
} else {
|
||||
(hit->second)->AddPixmap(pix);
|
||||
}
|
||||
}
|
||||
|
||||
void cTemplateViewPlugin::AddPixmapGrid(cTemplatePixmap *pix, vector<pair<string, string> > &gridAttributes) {
|
||||
string gridName = "";
|
||||
bool found = false;
|
||||
for (vector<pair<string, string> >::iterator it = gridAttributes.begin(); it != gridAttributes.end(); it++) {
|
||||
if (!(it->first).compare("name")) {
|
||||
gridName = it->second;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
esyslog("skindesigner: no name defined for plugin %s grid", pluginName.c_str());
|
||||
}
|
||||
int gridID = config.GetPluginViewGridID(pluginName, gridName, viewID);
|
||||
|
||||
if (gridID == -1) {
|
||||
esyslog("skindesigner: %s: unknown Grid in displayplugin: %s", pluginName.c_str(), gridName.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
pix->SetGlobals(globals);
|
||||
|
||||
map < int, cTemplateViewGrid* >::iterator hit = viewGrids.find(gridID);
|
||||
if (hit == viewGrids.end()) {
|
||||
cTemplateViewGrid *viewGrid = new cTemplateViewGrid();
|
||||
viewGrid->SetParameters(gridAttributes);
|
||||
viewGrid->AddPixmap(pix);
|
||||
viewGrids.insert(pair< int, cTemplateViewGrid*>(gridID, viewGrid));
|
||||
} else {
|
||||
(hit->second)->AddPixmap(pix);
|
||||
}
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "templateviewelement.h"
|
||||
#include "templateviewlist.h"
|
||||
#include "templateviewgrid.h"
|
||||
#include "templatepixmap.h"
|
||||
#include "templateviewtab.h"
|
||||
#include "templatefunction.h"
|
||||
@@ -50,6 +51,7 @@ protected:
|
||||
//basic view data structures
|
||||
map < eViewElement, cTemplateViewElement* > viewElements;
|
||||
map < eViewList, cTemplateViewList* > viewLists;
|
||||
map < int, cTemplateViewGrid* > viewGrids;
|
||||
map < eSubView, cTemplateView* > subViews;
|
||||
vector< cTemplateViewTab* > viewTabs;
|
||||
map < string, map< int, cTemplateView*> > pluginViews;
|
||||
@@ -62,6 +64,7 @@ protected:
|
||||
set<string> subViewsAllowed;
|
||||
set<string> viewElementsAllowed;
|
||||
set<string> viewListsAllowed;
|
||||
set<string> viewGridsAllowed;
|
||||
map < string, set < string > > funcsAllowed;
|
||||
void SetFunctionDefinitions(void);
|
||||
public:
|
||||
@@ -73,6 +76,7 @@ public:
|
||||
virtual void AddSubView(string sSubView, cTemplateView *subView) {};
|
||||
virtual void AddPluginView(string plugName, int templNo, cTemplateView *plugView) {};
|
||||
virtual void AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {};
|
||||
virtual void AddPixmapGrid(cTemplatePixmap *pix, vector<pair<string, string> > &gridAttributes) {};
|
||||
virtual void AddViewList(string sViewList, cTemplateViewList *viewList) {};
|
||||
virtual void AddViewTab(cTemplateViewTab *viewTab) {};
|
||||
//Setter Functions
|
||||
@@ -83,6 +87,8 @@ public:
|
||||
cTemplateViewElement *GetViewElement(eViewElement ve);
|
||||
void InitViewElementIterator(void);
|
||||
cTemplateViewElement *GetNextViewElement(void);
|
||||
//access view grids
|
||||
cTemplateViewGrid *GetViewGrid(int gridID);
|
||||
//access list elements
|
||||
cTemplateViewList *GetViewList(eViewList vl);
|
||||
void InitViewListIterator(void);
|
||||
@@ -110,7 +116,8 @@ public:
|
||||
//Checks for parsing template XML files
|
||||
bool ValidSubView(const char *subView);
|
||||
bool ValidViewElement(const char *viewElement);
|
||||
bool ValidViewList(const char *viewList);
|
||||
bool ValidViewList(const char *viewList);
|
||||
bool ValidViewGrid(const char *viewGrid);
|
||||
bool ValidFunction(const char *func);
|
||||
bool ValidAttribute(const char *func, const char *att);
|
||||
//Caching
|
||||
@@ -204,4 +211,17 @@ public:
|
||||
void AddViewList(string sViewList, cTemplateViewList *viewList);
|
||||
};
|
||||
|
||||
// --- cTemplateViewAudioTracks -------------------------------------------------------------
|
||||
|
||||
class cTemplateViewPlugin : public cTemplateView {
|
||||
private:
|
||||
string pluginName;
|
||||
int viewID;
|
||||
public:
|
||||
cTemplateViewPlugin(string pluginName, int viewID);
|
||||
virtual ~cTemplateViewPlugin(void);
|
||||
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
|
||||
void AddPixmapGrid(cTemplatePixmap *pix, vector<pair<string, string> > &gridAttributes);
|
||||
};
|
||||
|
||||
#endif //__TEMPLATEVIEW_H
|
||||
|
@@ -87,7 +87,7 @@ public:
|
||||
virtual ~cTemplateViewElement(void);
|
||||
void SetParameters(vector<pair<string, string> > ¶ms);
|
||||
bool CalculateParameters(void);
|
||||
bool CalculatePixmapParameters(void);
|
||||
virtual bool CalculatePixmapParameters(void);
|
||||
bool CalculatePixmapParametersList(int orientation, int numElements);
|
||||
int GetNumericParameter(eParamType type);
|
||||
void AddPixmap(cTemplatePixmap *pix) { viewPixmaps.push_back(pix); };
|
||||
|
29
libtemplate/templateviewgrid.c
Normal file
29
libtemplate/templateviewgrid.c
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "templateviewgrid.h"
|
||||
#include "../config.h"
|
||||
#include "../libcore/helpers.h"
|
||||
|
||||
cTemplateViewGrid::cTemplateViewGrid(void) : cTemplateViewElement() {
|
||||
}
|
||||
|
||||
cTemplateViewGrid::~cTemplateViewGrid(void) {
|
||||
}
|
||||
|
||||
bool cTemplateViewGrid::CalculatePixmapParameters(void) {
|
||||
bool paramsValid = true;
|
||||
int gridX = parameters->GetNumericParameter(ptX);
|
||||
int gridY = parameters->GetNumericParameter(ptY);
|
||||
int gridWidth = parameters->GetNumericParameter(ptWidth);
|
||||
int gridHeight = parameters->GetNumericParameter(ptHeight);
|
||||
|
||||
for (vector<cTemplatePixmap*>::iterator pix = viewPixmaps.begin(); pix != viewPixmaps.end(); pix++) {
|
||||
(*pix)->SetContainer(gridX, gridY, gridWidth, gridHeight);
|
||||
(*pix)->SetGlobals(globals);
|
||||
paramsValid = paramsValid && (*pix)->CalculateParameters();
|
||||
}
|
||||
return paramsValid;
|
||||
}
|
||||
|
||||
void cTemplateViewGrid::Debug(void) {
|
||||
esyslog("skindesigner: --- Grid: ");
|
||||
cTemplateViewElement::Debug();
|
||||
}
|
25
libtemplate/templateviewgrid.h
Normal file
25
libtemplate/templateviewgrid.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef __TEMPLATEVIEWGRID_H
|
||||
#define __TEMPLATEVIEWGRID_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
|
||||
#include "templateviewelement.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// --- cTemplateViewGrid -------------------------------------------------------------
|
||||
|
||||
class cTemplateViewGrid : public cTemplateViewElement {
|
||||
private:
|
||||
public:
|
||||
cTemplateViewGrid(void);
|
||||
~cTemplateViewGrid(void);
|
||||
bool CalculatePixmapParameters(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
#endif //__TEMPLATEVIEWGRID_H
|
@@ -19,10 +19,6 @@ using namespace std;
|
||||
|
||||
enum eViewList {
|
||||
vlUndefined,
|
||||
//DisplayChannel ViewLists
|
||||
vlDvbDeviceInfoList,
|
||||
//DisplayMenu ViewLists
|
||||
vlTimerList,
|
||||
vlMenuItem
|
||||
};
|
||||
|
||||
|
@@ -195,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;
|
||||
}
|
||||
@@ -844,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;
|
||||
|
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "templateview.h"
|
||||
#include "templateviewlist.h"
|
||||
#include "templateviewgrid.h"
|
||||
#include "templateviewtab.h"
|
||||
#include "../libcore/skinsetup.h"
|
||||
|
||||
@@ -43,6 +44,7 @@ private:
|
||||
void ParseViewElement(const xmlChar * viewElement, xmlNodePtr node, vector<pair<string, string> > &attributes, cTemplateView *subView = NULL);
|
||||
void ParseViewList(xmlNodePtr parentNode, cTemplateView *subView = NULL);
|
||||
void ParseViewTab(xmlNodePtr parentNode, cTemplateView *subView);
|
||||
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);
|
||||
|
Reference in New Issue
Block a user