mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
version 0.3.0
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
@@ -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);
|
||||
};
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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")) {
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -70,6 +70,12 @@ enum eViewElement {
|
||||
veVolume
|
||||
};
|
||||
|
||||
enum ePluginInteralViewElements {
|
||||
pveScrollbar = -1,
|
||||
pveTablabels = -2,
|
||||
pveUndefined = 0
|
||||
};
|
||||
|
||||
class cTemplateViewElement {
|
||||
protected:
|
||||
bool debugTokens;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user