diff options
author | louis <louis.braun@gmx.de> | 2016-04-12 16:26:42 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2016-04-12 16:26:42 +0200 |
commit | fe1016fed662261cb79577b47133f2921e287d28 (patch) | |
tree | 6a6696fb06c62ef711cf43d1899d93a8e79aa65b | |
parent | 53530335ae9f772c584d1141b223c5e6e7ae9592 (diff) | |
download | vdr-plugin-skindesigner-fe1016fed662261cb79577b47133f2921e287d28.tar.gz vdr-plugin-skindesigner-fe1016fed662261cb79577b47133f2921e287d28.tar.bz2 |
enlarged svgtemplates for menuicons and skinparts
-rw-r--r-- | extensions/imagecache.c | 4 | ||||
-rw-r--r-- | extensions/imageloader.c | 26 | ||||
-rw-r--r-- | extensions/imageloader.h | 4 | ||||
-rw-r--r-- | skins/metrixhd/xmlfiles/plug-weatherforecast-weatherforecast.xml | 2 |
4 files changed, 27 insertions, 9 deletions
diff --git a/extensions/imagecache.c b/extensions/imagecache.c index fc05f5f..016022c 100644 --- a/extensions/imagecache.c +++ b/extensions/imagecache.c @@ -433,7 +433,7 @@ bool cImageCache::LoadIcon(eImageType type, string name) { return LoadImage(*subIconSkinPath, name, "png"); //and finally check if a svg template exists - cSVGTemplate svgTemplate(name, svgTemplatePath); + cSVGTemplate svgTemplate(name, *subdir, svgTemplatePath); if (!svgTemplate.Exists()) return false; svgTemplate.ReadTemplate(); @@ -484,7 +484,7 @@ bool cImageCache::LoadSkinpart(string name) { return LoadImage(skinPartsPathSkin.c_str(), name, "png"); //check if a svg template exists - cSVGTemplate svgTemplate(name, svgTemplatePath); + cSVGTemplate svgTemplate(name, "skinparts", svgTemplatePath); if (!svgTemplate.Exists()) return false; svgTemplate.ReadTemplate(); diff --git a/extensions/imageloader.c b/extensions/imageloader.c index 62d284f..bd2d268 100644 --- a/extensions/imageloader.c +++ b/extensions/imageloader.c @@ -405,21 +405,37 @@ void cImageImporterJPG::GetImageSize(int &width, int &height) { // SVG Template class // -cSVGTemplate::cSVGTemplate(string imageName, string templatePath) { +cSVGTemplate::cSVGTemplate(string imageName, string imagePath, string templatePath) { this->imageName = imageName; + this->imagePath = imagePath; this->templatePath = templatePath; + filePath = CreateImagePath(); startTokenColor = "{sdcol("; startTokenOpac = "{sdopac("; endToken = ")}"; - filePath = templatePath; - filePath += imageName + ".svg"; } cSVGTemplate::~cSVGTemplate(void) { } +string cSVGTemplate::CreateImagePath(void) { + //check if imageName is a path + if (imageName.find("/") != string::npos) { + splitstring s(imageName.c_str()); + vector<string> flds = s.split('/', 1); + int num = flds.size() - 1; + for (int i=0; i < num; i++) { + imagePath = *cString::sprintf("%s/%s", imagePath.c_str(), flds[i].c_str()); + } + imageName = flds[num]; + } + string path = templatePath; + path += imagePath + "/" + imageName + ".svg"; + return path; +} + bool cSVGTemplate::Exists(void) { - return FileExists(templatePath, imageName, "svg"); + return FileExists(filePath); } void cSVGTemplate::ReadTemplate(void) { @@ -464,7 +480,7 @@ bool cSVGTemplate::ParseTemplate(void) { } string cSVGTemplate::WriteImage(void) { - string tempPath = *cString::sprintf("/tmp/skindesigner/svg/%s/%s/", Setup.OSDSkin, Setup.OSDTheme); + string tempPath = *cString::sprintf("/tmp/skindesigner/svg/%s/%s/%s/", Setup.OSDSkin, Setup.OSDTheme, imagePath.c_str()); CreateFolder(tempPath); string fileName = tempPath + imageName + ".svg"; ofstream tmpimg; diff --git a/extensions/imageloader.h b/extensions/imageloader.h index 12bd8d2..bb81102 100644 --- a/extensions/imageloader.h +++ b/extensions/imageloader.h @@ -95,16 +95,18 @@ public: class cSVGTemplate { private: string imageName; + string imagePath; string templatePath; string filePath; string startTokenColor; string startTokenOpac; string endToken; vector<string> svgTemplate; + string CreateImagePath(void); string GetColorName(string line, size_t tokenStart, size_t tokenEnd); void ReplaceTokens(string &line, size_t tokenStart, size_t tokenEnd, tColor color); public: - cSVGTemplate(string imageName, string templatePath); + cSVGTemplate(string imageName, string imagePath, string templatePath); virtual ~cSVGTemplate(void); bool Exists(void); void ReadTemplate(void); diff --git a/skins/metrixhd/xmlfiles/plug-weatherforecast-weatherforecast.xml b/skins/metrixhd/xmlfiles/plug-weatherforecast-weatherforecast.xml index 078353c..2b1aa38 100644 --- a/skins/metrixhd/xmlfiles/plug-weatherforecast-weatherforecast.xml +++ b/skins/metrixhd/xmlfiles/plug-weatherforecast-weatherforecast.xml @@ -105,7 +105,7 @@ <drawtextbox x="0" y="0" width="100%" height="100%" align="center" valign="center" font="{light}" fontsize="40%" color="{clrWhite}" text="{menuitemtext}" /> </area> </listelement> - <currentelement debug="true" delay="100" fadetime="300"> + <currentelement delay="100" fadetime="300"> <area condition="{iscurrent}" x="10%" y="5%" width="80%" height="70%" layer="3"> <drawimage name="weathericon" imagetype="icon" path="{icon}" x="2%" y="0" width="{areaheight}*0.4" height="{areaheight}*0.4"/> <drawtext align="right" y="0" font="{semibold}" fontsize="10%" color="{clrWhite}" text="{city}" /> |