mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
support for global variables type 'double'
This commit is contained in:
parent
ebe8ac563b
commit
7fbcc9d330
1
HISTORY
1
HISTORY
@ -16,3 +16,4 @@ Version 0.0.2
|
|||||||
- added {durationhours} and {durationminutes} tokens in several view elements
|
- added {durationhours} and {durationminutes} tokens in several view elements
|
||||||
- added discusage icons to menu header view element so that it discusage can be displayed in every menu view
|
- added discusage icons to menu header view element so that it discusage can be displayed in every menu view
|
||||||
- added numeric day, month and year tokens in different view elements
|
- added numeric day, month and year tokens in different view elements
|
||||||
|
- support for global variables type "double"
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<!ELEMENT var (#PCDATA)>
|
<!ELEMENT var (#PCDATA)>
|
||||||
<!ATTLIST var
|
<!ATTLIST var
|
||||||
name NMTOKEN #REQUIRED
|
name NMTOKEN #REQUIRED
|
||||||
type (int|string) #REQUIRED>
|
type (int|double|string) #REQUIRED>
|
||||||
|
|
||||||
<!ELEMENT token (trans)+>
|
<!ELEMENT token (trans)+>
|
||||||
<!ATTLIST token
|
<!ATTLIST token
|
||||||
|
@ -27,6 +27,7 @@ public:
|
|||||||
virtual ~cGlobals(void) {};
|
virtual ~cGlobals(void) {};
|
||||||
map <string, tColor> colors;
|
map <string, tColor> colors;
|
||||||
map <string, int> intVars;
|
map <string, int> intVars;
|
||||||
|
map <string, double> doubleVars;
|
||||||
map <string, string> stringVars;
|
map <string, string> stringVars;
|
||||||
map <string, string> fonts;
|
map <string, string> fonts;
|
||||||
map <string, map< string, string > > translations;
|
map <string, map< string, string > > translations;
|
||||||
|
@ -156,6 +156,17 @@ bool cNumericParameter::CheckExpression(int &val, string &parsedVal) {
|
|||||||
parsedValue = parsedValue.replace(foundToken, token.size(), st.str());
|
parsedValue = parsedValue.replace(foundToken, token.size(), st.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (map<string, double>::iterator globDouble = globals->doubleVars.begin(); globDouble != globals->doubleVars.end(); globDouble++) {
|
||||||
|
stringstream sToken;
|
||||||
|
sToken << "{" << globDouble->first << "}";
|
||||||
|
string token = sToken.str();
|
||||||
|
size_t foundToken = parsedValue.find(token);
|
||||||
|
if (foundToken != string::npos) {
|
||||||
|
stringstream st;
|
||||||
|
st << globDouble->second;
|
||||||
|
parsedValue = parsedValue.replace(foundToken, token.size(), st.str());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsNumber(parsedValue)) {
|
if (IsNumber(parsedValue)) {
|
||||||
|
@ -291,6 +291,9 @@ void cXmlParser::InsertVariable(string name, string type, string value) {
|
|||||||
if (!type.compare("int")) {
|
if (!type.compare("int")) {
|
||||||
int val = atoi(value.c_str());
|
int val = atoi(value.c_str());
|
||||||
globals->intVars.insert(pair<string, int>(name, val));
|
globals->intVars.insert(pair<string, int>(name, val));
|
||||||
|
} else if (!type.compare("double")) {
|
||||||
|
double val = atof(value.c_str());
|
||||||
|
globals->doubleVars.insert(pair<string, double>(name, val));
|
||||||
} else if (!type.compare("string")) {
|
} else if (!type.compare("string")) {
|
||||||
globals->stringVars.insert(pair<string, string>(name, value));
|
globals->stringVars.insert(pair<string, string>(name, value));
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
<var type="int" name="border">5</var>
|
<var type="int" name="border">5</var>
|
||||||
<var type="int" name="fadeTime">0</var>
|
<var type="int" name="fadeTime">0</var>
|
||||||
<var type="string" name="stringglobal">hützligrütz</var>
|
<var type="string" name="stringglobal">hützligrütz</var>
|
||||||
|
<var type="double" name="pi">3.14</var>
|
||||||
</variables>
|
</variables>
|
||||||
<!--
|
<!--
|
||||||
translations used in the skin
|
translations used in the skin
|
||||||
|
Loading…
Reference in New Issue
Block a user