diff options
author | louis <louis.braun@gmx.de> | 2015-01-24 10:47:47 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2015-01-24 10:47:47 +0100 |
commit | a74cb93163146e547abc641638874697904672e5 (patch) | |
tree | 5ade879d4ad7808cfb8eca6ad2bd40636a4fa22b /libtemplate/templatefunction.c | |
parent | 5733a499407a11b095887e06df09c4e5d6debeda (diff) | |
download | vdr-plugin-skindesigner-a74cb93163146e547abc641638874697904672e5.tar.gz vdr-plugin-skindesigner-a74cb93163146e547abc641638874697904672e5.tar.bz2 |
introduced globals.xml in skinpath, theme.xml in theme path
Diffstat (limited to 'libtemplate/templatefunction.c')
-rw-r--r-- | libtemplate/templatefunction.c | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/libtemplate/templatefunction.c b/libtemplate/templatefunction.c index 80cf762..0b3de8a 100644 --- a/libtemplate/templatefunction.c +++ b/libtemplate/templatefunction.c @@ -777,16 +777,11 @@ bool cTemplateFunction::SetAlign(eParamType type, string value) { bool cTemplateFunction::SetFont(eParamType type, string value) {
//check if token
- if ((value.find("{") == 0) && (value.find("}") == (value.size()-1))) {
- value = value.substr(1, value.size()-2);
- map<string,string>::iterator hit = globals->fonts.find(value);
- if (hit != globals->fonts.end()) {
- fontName = hit->second;
- } else {
- map<string,string>::iterator def = globals->fonts.find("vdrOsd");
- if (def == globals->fonts.end())
+ if (IsToken(value)) {
+ if (!globals->GetFont(value, fontName)) {
+ if (!globals->GetFont("{vdrOsd}", fontName)) {
return false;
- fontName = def->second;
+ }
}
} else {
//if no token, directly use input
@@ -820,15 +815,10 @@ bool cTemplateFunction::SetImageType(eParamType type, string value) { bool cTemplateFunction::SetColor(eParamType type, string value) {
if (globals) {
- for (map<string, tColor>::iterator col = globals->colors.begin(); col != globals->colors.end(); col++) {
- stringstream sColName;
- sColName << "{" << col->first << "}";
- string colName = sColName.str();
- if (!colName.compare(value)) {
- tColor colVal = col->second;
- colorParameters.insert(pair<eParamType, tColor>(type, colVal));
- return true;
- }
+ tColor colVal = 0x00000000;
+ if (globals->GetColor(value, colVal)) {
+ colorParameters.insert(pair<eParamType, tColor>(type, colVal));
+ return true;
}
}
if (value.size() != 8)
@@ -844,15 +834,7 @@ bool cTemplateFunction::SetColor(eParamType type, string value) { bool cTemplateFunction::SetTextTokens(string value) {
textTokens.clear();
//first replace globals
- for (map<string,string>::iterator globStr = globals->stringVars.begin(); globStr != globals->stringVars.end(); globStr++) {
- stringstream sToken;
- sToken << "{" << globStr->first << "}";
- string token = sToken.str();
- size_t foundToken = value.find(token);
- if (foundToken != string::npos) {
- value = value.replace(foundToken, token.size(), globStr->second);
- }
- }
+ globals->ReplaceStringVars(value);
//now tokenize
bool tokenFound = true;
while (tokenFound) {
|