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");
|
||||
|
||||
//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();
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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}" />
|
||||
|
Loading…
Reference in New Issue
Block a user