summaryrefslogtreecommitdiff
path: root/libtemplate
diff options
context:
space:
mode:
Diffstat (limited to 'libtemplate')
-rw-r--r--libtemplate/template.c36
-rw-r--r--libtemplate/template.h2
-rw-r--r--libtemplate/templatefunction.c7
-rw-r--r--libtemplate/templatefunction.h3
-rw-r--r--libtemplate/templatepixmap.c2
-rw-r--r--libtemplate/templateview.c65
-rw-r--r--libtemplate/templateview.h4
-rw-r--r--libtemplate/templateviewelement.h6
-rw-r--r--libtemplate/xmlparser.c2
9 files changed, 116 insertions, 11 deletions
diff --git a/libtemplate/template.c b/libtemplate/template.c
index 01a7b28..189efd0 100644
--- a/libtemplate/template.c
+++ b/libtemplate/template.c
@@ -56,7 +56,8 @@ bool cTemplate::ReadFromXML(string xmlfile) {
if (!parser.ParseView()) {
return false;
}
- //read additional plugin templates
+
+ //read additional plugin menu templates
bool ok = true;
if (viewType == vtDisplayMenu) {
config.InitPluginMenuIterator();
@@ -114,6 +115,39 @@ void cTemplate::CacheImages(void) {
}
}
+bool cTemplate::SetSubViews(string plugName, int viewID) {
+ map <int,string> subViews = config.GetPluginSubViews(plugName, viewID);
+
+ if (subViews.size() == 0) {
+ return true;
+ }
+
+ for (map<int,string>::iterator it = subViews.begin(); it != subViews.end(); it ++) {
+ int subViewID = it->first;
+ stringstream templateName;
+ templateName << "plug-" << plugName << "-" << it->second;
+ string subViewTemplate = templateName.str();
+ cTemplateView *plgTemplateView = new cTemplateViewPlugin(plugName, subViewID);
+ plgTemplateView->SetGlobals(globals);
+ cXmlParser parser;
+ if (!parser.ReadView(plgTemplateView, subViewTemplate)) {
+ esyslog("skindesigner: error reading plugin %s template", plugName.c_str());
+ delete plgTemplateView;
+ return false;
+ }
+ if (!parser.ParseView()) {
+ esyslog("skindesigner: error reading plugin %s template", plugName.c_str());
+ delete plgTemplateView;
+ return false;
+ }
+ stringstream svid;
+ svid << subViewID;
+ rootView->AddSubView(svid.str(), plgTemplateView);
+ }
+ return true;
+}
+
+
void cTemplate::Debug(void) {
rootView->Debug();
}
diff --git a/libtemplate/template.h b/libtemplate/template.h
index 79a824b..75dce5c 100644
--- a/libtemplate/template.h
+++ b/libtemplate/template.h
@@ -52,6 +52,8 @@ public:
//get fonts for pre caching
vector< pair<string, int> > GetUsedFonts(void);
void CacheImages(void);
+ //Set Plugin Subviews
+ bool SetSubViews(string plugName, int viewID);
//Debug
void Debug(void);
};
diff --git a/libtemplate/templatefunction.c b/libtemplate/templatefunction.c
index 0b3de8a..8156633 100644
--- a/libtemplate/templatefunction.c
+++ b/libtemplate/templatefunction.c
@@ -725,11 +725,16 @@ bool cTemplateFunction::SetNumericParameter(eParamType type, string value) {
break;
case ptY:
case ptHeight:
- case ptFontSize:
case ptScaleTvY:
case ptScaleTvHeight:
param.SetVertical();
break;
+ case ptFontSize: {
+ if (this->type == ftDrawTextVertical)
+ param.SetHorizontal();
+ else
+ param.SetVertical();
+ break; }
case ptLayer:
param.SetDefault(1);
break;
diff --git a/libtemplate/templatefunction.h b/libtemplate/templatefunction.h
index f7af25c..e63850e 100644
--- a/libtemplate/templatefunction.h
+++ b/libtemplate/templatefunction.h
@@ -29,6 +29,7 @@ enum eFuncType {
ftFill,
ftDrawText,
ftDrawTextBox,
+ ftDrawTextVertical,
ftDrawImage,
ftDrawRectangle,
ftDrawEllipse,
@@ -198,6 +199,8 @@ public:
//Dynamic width or height parameter
int GetWidth(bool cutted = true);
int GetHeight(void);
+ int GetContainerWidth(void) { return containerWidth; };
+ int GetContainerHeight(void) { return containerHeight; };
void GetNeededWidths(multimap<eParamType,string> *widths);
void GetNeededHeights(multimap<eParamType,string> *heights);
void GetNeededPosX(multimap<eParamType,string> *posXs);
diff --git a/libtemplate/templatepixmap.c b/libtemplate/templatepixmap.c
index 40e35a3..52ae63f 100644
--- a/libtemplate/templatepixmap.c
+++ b/libtemplate/templatepixmap.c
@@ -124,6 +124,8 @@ void cTemplatePixmap::AddFunction(string name, vector<pair<string, string> > &pa
type = ftDrawText;
} else if (!name.compare("drawtextbox")) {
type = ftDrawTextBox;
+ } else if (!name.compare("drawtextvertical")) {
+ type = ftDrawTextVertical;
} else if (!name.compare("drawimage")) {
type = ftDrawImage;
} else if (!name.compare("drawrectangle")) {
diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c
index 753b242..c37b5f0 100644
--- a/libtemplate/templateview.c
+++ b/libtemplate/templateview.c
@@ -642,6 +642,22 @@ void cTemplateView::SetFunctionDefinitions(void) {
attributes.insert("floatheight");
funcsAllowed.insert(pair< string, set<string> >(name, attributes));
+ name = "drawtextvertical";
+ attributes.clear();
+ attributes.insert("debug");
+ attributes.insert("condition");
+ attributes.insert("name");
+ attributes.insert("x");
+ attributes.insert("y");
+ attributes.insert("height");
+ attributes.insert("align");
+ attributes.insert("valign");
+ attributes.insert("font");
+ attributes.insert("fontsize");
+ attributes.insert("color");
+ attributes.insert("text");
+ funcsAllowed.insert(pair< string, set<string> >(name, attributes));
+
name = "drawimage";
attributes.clear();
attributes.insert("debug");
@@ -1849,6 +1865,20 @@ cTemplateViewPlugin::cTemplateViewPlugin(string pluginName, int viewID) {
attributes.insert("scaletvheight");
funcsAllowed.insert(pair< string, set<string> >(viewName, attributes));
+ //definition of allowed parameters for viewtab
+ attributes.clear();
+ attributes.insert("debug");
+ attributes.insert("name");
+ attributes.insert("condition");
+ attributes.insert("x");
+ attributes.insert("y");
+ attributes.insert("width");
+ attributes.insert("height");
+ attributes.insert("layer");
+ attributes.insert("transparency");
+ attributes.insert("scrollheight");
+ funcsAllowed.insert(pair< string, set<string> >("tab", attributes));
+
attributes.clear();
attributes.insert("x");
attributes.insert("y");
@@ -1858,15 +1888,23 @@ cTemplateViewPlugin::cTemplateViewPlugin(string pluginName, int viewID) {
funcsAllowed.insert(pair< string, set<string> >("grid", attributes));
viewElementsAllowed.insert("viewelement");
+ viewElementsAllowed.insert("scrollbar");
+ viewElementsAllowed.insert("tablabels");
viewGridsAllowed.insert("grid");
}
cTemplateViewPlugin::~cTemplateViewPlugin() {
}
+void cTemplateViewPlugin::AddSubView(string sSubView, cTemplateView *subView) {
+ int subViewId = atoi(sSubView.c_str());
+ subViews.insert(pair< eSubView, cTemplateView* >((eSubView)subViewId, subView));
+}
+
void cTemplateViewPlugin::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {
eViewElement ve = veUndefined;
string viewElementName = "";
+ int viewElementID = -1;
bool found = false;
for (vector<pair<string, string> >::iterator it = viewElementattributes.begin(); it != viewElementattributes.end(); it++) {
if (!(it->first).compare("name")) {
@@ -1875,15 +1913,22 @@ void cTemplateViewPlugin::AddPixmap(string sViewElement, cTemplatePixmap *pix, v
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;
+ if (found) {
+ viewElementID = config.GetPluginViewElementID(pluginName, viewElementName, viewID);
+ } else {
+ //check for internal view elements
+ ePluginInteralViewElements pve = pveUndefined;
+ if (!sViewElement.compare("scrollbar")) {
+ pve = pveScrollbar;
+ } else if (!sViewElement.compare("tablabels")) {
+ pve = pveTablabels;
+ }
+ if (pve == pveUndefined) {
+ esyslog("skindesigner: %s: unknown ViewElement in displayplugin: %s", pluginName.c_str(), viewElementName.c_str());
+ return;
+ }
+ viewElementID = pve;
}
pix->SetGlobals(globals);
@@ -1932,3 +1977,7 @@ void cTemplateViewPlugin::AddPixmapGrid(cTemplatePixmap *pix, vector<pair<string
(hit->second)->AddPixmap(pix);
}
}
+
+void cTemplateViewPlugin::AddViewTab(cTemplateViewTab *viewTab) {
+ viewTabs.push_back(viewTab);
+}
diff --git a/libtemplate/templateview.h b/libtemplate/templateview.h
index 7e0d43e..79564b7 100644
--- a/libtemplate/templateview.h
+++ b/libtemplate/templateview.h
@@ -211,7 +211,7 @@ public:
void AddViewList(string sViewList, cTemplateViewList *viewList);
};
-// --- cTemplateViewAudioTracks -------------------------------------------------------------
+// --- cTemplateViewPlugin -------------------------------------------------------------
class cTemplateViewPlugin : public cTemplateView {
private:
@@ -220,8 +220,10 @@ private:
public:
cTemplateViewPlugin(string pluginName, int viewID);
virtual ~cTemplateViewPlugin(void);
+ void AddSubView(string sSubView, cTemplateView *subView);
void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes);
void AddPixmapGrid(cTemplatePixmap *pix, vector<pair<string, string> > &gridAttributes);
+ void AddViewTab(cTemplateViewTab *viewTab);
};
#endif //__TEMPLATEVIEW_H
diff --git a/libtemplate/templateviewelement.h b/libtemplate/templateviewelement.h
index ebddcd2..be7bb74 100644
--- a/libtemplate/templateviewelement.h
+++ b/libtemplate/templateviewelement.h
@@ -70,6 +70,12 @@ enum eViewElement {
veVolume
};
+enum ePluginInteralViewElements {
+ pveScrollbar = -1,
+ pveTablabels = -2,
+ pveUndefined = 0
+};
+
class cTemplateViewElement {
protected:
bool debugTokens;
diff --git a/libtemplate/xmlparser.c b/libtemplate/xmlparser.c
index e086ba4..aa7d498 100644
--- a/libtemplate/xmlparser.c
+++ b/libtemplate/xmlparser.c
@@ -200,6 +200,8 @@ bool cXmlParser::ParseView(void) {
vector<pair<string, string> > attribs;
ParseAttributes(attr, node, attribs);
ParseGrid(node->xmlChildrenNode, attribs);
+ } else if (!xmlStrcmp(node->name, (const xmlChar *) "tab")) {
+ ParseViewTab(node, view);
} else {
return false;
}