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 | |
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')
-rw-r--r-- | libtemplate/templatefunction.c | 28 | ||||
-rw-r--r-- | libtemplate/templatefunction.h | 8 | ||||
-rw-r--r-- | libtemplate/templateview.c | 1 |
3 files changed, 36 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;
diff --git a/libtemplate/templatefunction.h b/libtemplate/templatefunction.h index a862aa7..3c7e515 100644 --- a/libtemplate/templatefunction.h +++ b/libtemplate/templatefunction.h @@ -81,6 +81,7 @@ enum eParamType { ptHideRoot, ptCache, ptDeterminateFont, + ptDirection, ptNone }; @@ -105,6 +106,12 @@ enum eOverflowType { otCut }; +enum eDirection { + diNone, + diBottomUp, + diTopDown +}; + class cTemplateFunction { protected: eFuncType type; @@ -156,6 +163,7 @@ protected: bool SetHideRoot(string value); bool SetDetached(string value); bool SetBackground(string value); + bool SetDirection(string value); void ParseStringParameters(void); void ParseNumericalParameters(void); void CalculateAlign(int elementWidth, int elementHeight); diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c index df523a1..a111d70 100644 --- a/libtemplate/templateview.c +++ b/libtemplate/templateview.c @@ -727,6 +727,7 @@ void cTemplateView::SetFunctionDefinitions(void) { attributes.insert("height"); attributes.insert("align"); attributes.insert("valign"); + attributes.insert("direction"); attributes.insert("font"); attributes.insert("fontsize"); attributes.insert("color"); |