mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
added possibility to draw vertical text bottomum and topdown
This commit is contained in:
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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");
|
||||
|
Reference in New Issue
Block a user