diff options
author | louis <louis.braun@gmx.de> | 2015-03-31 06:57:02 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2015-03-31 06:57:02 +0200 |
commit | 3d43200af00372dd54abe2b86b00ca15a4fc6d82 (patch) | |
tree | 0acd63aa794fabae179d90c74e7ad38ad9d872c0 /libtemplate/templatefunction.c | |
parent | 1ba2ae905ad33f8e311100fd4e9e48653ca4b63d (diff) | |
download | vdr-plugin-skindesigner-3d43200af00372dd54abe2b86b00ca15a4fc6d82.tar.gz vdr-plugin-skindesigner-3d43200af00372dd54abe2b86b00ca15a4fc6d82.tar.bz2 |
added possibility to draw vertical text bottomum and topdown
Diffstat (limited to 'libtemplate/templatefunction.c')
-rw-r--r-- | libtemplate/templatefunction.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/libtemplate/templatefunction.c b/libtemplate/templatefunction.c index 5e72948..afbc5fa 100644 --- a/libtemplate/templatefunction.c +++ b/libtemplate/templatefunction.c @@ -135,6 +135,8 @@ void cTemplateFunction::SetParameters(vector<pair<string, string> > params) { p.first = ptCache;
} else if (!name.compare("determinatefont")) {
p.first = ptDeterminateFont;
+ } else if (!name.compare("direction")) {
+ p.first = ptDirection;
} else {
p.first = ptNone;
}
@@ -276,6 +278,9 @@ bool cTemplateFunction::CalculateParameters(void) { case ptBackground:
paramValid = SetBackground(value);
break;
+ case ptDirection:
+ paramValid = SetDirection(value);
+ break;
default:
paramValid = true;
break;
@@ -420,6 +425,8 @@ int cTemplateFunction::GetNumericParameter(eParamType type) { return 0;
else if (type == ptBackground)
return 0;
+ else if (type == ptDirection)
+ return diBottomUp;
return -1;
}
return hit->second;
@@ -475,6 +482,9 @@ int cTemplateFunction::GetWidth(bool cutted) { else
funcWidth = fontManager->Width(fontName, GetNumericParameter(ptFontSize), parsedText.c_str());
break; }
+ case ftDrawTextVertical:
+ funcWidth = GetNumericParameter(ptFontSize)*1.2;
+ break;
case ftFill:
case ftDrawImage:
case ftDrawRectangle:
@@ -496,6 +506,9 @@ int cTemplateFunction::GetHeight(void) { case ftDrawText:
funcHeight = fontManager->Height(fontName, GetNumericParameter(ptFontSize));
break;
+ case ftDrawTextVertical:
+ funcHeight = fontManager->Width(fontName, GetNumericParameter(ptFontSize), parsedText.c_str());
+ break;
case ftFill:
case ftDrawImage:
case ftDrawRectangle:
@@ -1092,6 +1105,16 @@ bool cTemplateFunction::SetBackground(string value) { return true;
}
+bool cTemplateFunction::SetDirection(string value) {
+ int direction = diNone;
+ if (!value.compare("bottomup"))
+ direction = diBottomUp;
+ else if (!value.compare("topdown"))
+ direction = diTopDown;
+ numericParameters.insert(pair<eParamType, int>(ptDirection, direction));
+ return true;
+}
+
void cTemplateFunction::ParseStringParameters(void) {
//first replace stringtokens in Text (drawText)
stringstream text;
@@ -1581,7 +1604,10 @@ string cTemplateFunction::GetParamName(eParamType pt) { break;
case ptDeterminateFont:
name = "Determinate Font";
- break;
+ break;
+ case ptDirection:
+ name = "Text Direction";
+ break;
default:
name = "Unknown";
break;
|