mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
enlarged svgtemplates for menuicons and skinparts
This commit is contained in:
parent
53530335ae
commit
fe1016fed6
@ -433,7 +433,7 @@ bool cImageCache::LoadIcon(eImageType type, string name) {
|
|||||||
return LoadImage(*subIconSkinPath, name, "png");
|
return LoadImage(*subIconSkinPath, name, "png");
|
||||||
|
|
||||||
//and finally check if a svg template exists
|
//and finally check if a svg template exists
|
||||||
cSVGTemplate svgTemplate(name, svgTemplatePath);
|
cSVGTemplate svgTemplate(name, *subdir, svgTemplatePath);
|
||||||
if (!svgTemplate.Exists())
|
if (!svgTemplate.Exists())
|
||||||
return false;
|
return false;
|
||||||
svgTemplate.ReadTemplate();
|
svgTemplate.ReadTemplate();
|
||||||
@ -484,7 +484,7 @@ bool cImageCache::LoadSkinpart(string name) {
|
|||||||
return LoadImage(skinPartsPathSkin.c_str(), name, "png");
|
return LoadImage(skinPartsPathSkin.c_str(), name, "png");
|
||||||
|
|
||||||
//check if a svg template exists
|
//check if a svg template exists
|
||||||
cSVGTemplate svgTemplate(name, svgTemplatePath);
|
cSVGTemplate svgTemplate(name, "skinparts", svgTemplatePath);
|
||||||
if (!svgTemplate.Exists())
|
if (!svgTemplate.Exists())
|
||||||
return false;
|
return false;
|
||||||
svgTemplate.ReadTemplate();
|
svgTemplate.ReadTemplate();
|
||||||
|
@ -405,21 +405,37 @@ void cImageImporterJPG::GetImageSize(int &width, int &height) {
|
|||||||
// SVG Template class
|
// SVG Template class
|
||||||
//
|
//
|
||||||
|
|
||||||
cSVGTemplate::cSVGTemplate(string imageName, string templatePath) {
|
cSVGTemplate::cSVGTemplate(string imageName, string imagePath, string templatePath) {
|
||||||
this->imageName = imageName;
|
this->imageName = imageName;
|
||||||
|
this->imagePath = imagePath;
|
||||||
this->templatePath = templatePath;
|
this->templatePath = templatePath;
|
||||||
|
filePath = CreateImagePath();
|
||||||
startTokenColor = "{sdcol(";
|
startTokenColor = "{sdcol(";
|
||||||
startTokenOpac = "{sdopac(";
|
startTokenOpac = "{sdopac(";
|
||||||
endToken = ")}";
|
endToken = ")}";
|
||||||
filePath = templatePath;
|
|
||||||
filePath += imageName + ".svg";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cSVGTemplate::~cSVGTemplate(void) {
|
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) {
|
bool cSVGTemplate::Exists(void) {
|
||||||
return FileExists(templatePath, imageName, "svg");
|
return FileExists(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cSVGTemplate::ReadTemplate(void) {
|
void cSVGTemplate::ReadTemplate(void) {
|
||||||
@ -464,7 +480,7 @@ bool cSVGTemplate::ParseTemplate(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string cSVGTemplate::WriteImage(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);
|
CreateFolder(tempPath);
|
||||||
string fileName = tempPath + imageName + ".svg";
|
string fileName = tempPath + imageName + ".svg";
|
||||||
ofstream tmpimg;
|
ofstream tmpimg;
|
||||||
|
@ -95,16 +95,18 @@ public:
|
|||||||
class cSVGTemplate {
|
class cSVGTemplate {
|
||||||
private:
|
private:
|
||||||
string imageName;
|
string imageName;
|
||||||
|
string imagePath;
|
||||||
string templatePath;
|
string templatePath;
|
||||||
string filePath;
|
string filePath;
|
||||||
string startTokenColor;
|
string startTokenColor;
|
||||||
string startTokenOpac;
|
string startTokenOpac;
|
||||||
string endToken;
|
string endToken;
|
||||||
vector<string> svgTemplate;
|
vector<string> svgTemplate;
|
||||||
|
string CreateImagePath(void);
|
||||||
string GetColorName(string line, size_t tokenStart, size_t tokenEnd);
|
string GetColorName(string line, size_t tokenStart, size_t tokenEnd);
|
||||||
void ReplaceTokens(string &line, size_t tokenStart, size_t tokenEnd, tColor color);
|
void ReplaceTokens(string &line, size_t tokenStart, size_t tokenEnd, tColor color);
|
||||||
public:
|
public:
|
||||||
cSVGTemplate(string imageName, string templatePath);
|
cSVGTemplate(string imageName, string imagePath, string templatePath);
|
||||||
virtual ~cSVGTemplate(void);
|
virtual ~cSVGTemplate(void);
|
||||||
bool Exists(void);
|
bool Exists(void);
|
||||||
void ReadTemplate(void);
|
void ReadTemplate(void);
|
||||||
|
@ -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}" />
|
<drawtextbox x="0" y="0" width="100%" height="100%" align="center" valign="center" font="{light}" fontsize="40%" color="{clrWhite}" text="{menuitemtext}" />
|
||||||
</area>
|
</area>
|
||||||
</listelement>
|
</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">
|
<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"/>
|
<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}" />
|
<drawtext align="right" y="0" font="{semibold}" fontsize="10%" color="{clrWhite}" text="{city}" />
|
||||||
|
Loading…
Reference in New Issue
Block a user