From 0b9e3787a2a920e010ab53330262fe8644e4b0d0 Mon Sep 17 00:00:00 2001 From: louis Date: Sat, 25 Oct 2014 16:58:05 +0200 Subject: implemented function drawslope --- libtemplate/templatefunction.c | 14 ++++++++++++++ libtemplate/templatefunction.h | 2 ++ libtemplate/templatepixmap.c | 2 ++ libtemplate/templateview.c | 14 ++++++++++++++ 4 files changed, 32 insertions(+) (limited to 'libtemplate') diff --git a/libtemplate/templatefunction.c b/libtemplate/templatefunction.c index 9dca94e..b96f0be 100644 --- a/libtemplate/templatefunction.c +++ b/libtemplate/templatefunction.c @@ -83,6 +83,8 @@ void cTemplateFunction::SetParameters(vector > params) { p.first = ptTransparency; } else if (!name.compare("quadrant")) { p.first = ptQuadrant; + } else if (!name.compare("type")) { + p.first = ptType; } else if (!name.compare("align")) { p.first = ptAlign; } else if (!name.compare("valign")) { @@ -215,6 +217,7 @@ bool cTemplateFunction::CalculateParameters(void) { case ptLayer: case ptTransparency: case ptQuadrant: + case ptType: case ptNumElements: case ptFloatWidth: case ptFloatHeight: @@ -301,6 +304,9 @@ void cTemplateFunction::CompleteParameters(void) { case ftDrawEllipse: CalculateAlign(GetNumericParameter(ptWidth), GetNumericParameter(ptHeight)); break; + case ftDrawSlope: + CalculateAlign(GetNumericParameter(ptWidth), GetNumericParameter(ptHeight)); + break; case ftDrawText: CalculateAlign(GetWidth(), GetHeight()); break; @@ -439,6 +445,7 @@ int cTemplateFunction::GetWidth(bool cutted) { case ftDrawImage: case ftDrawRectangle: case ftDrawEllipse: + case ftDrawSlope: case ftDrawTextBox: funcWidth = GetNumericParameter(ptWidth); break; @@ -459,6 +466,7 @@ int cTemplateFunction::GetHeight(void) { case ftDrawImage: case ftDrawRectangle: case ftDrawEllipse: + case ftDrawSlope: funcHeight = GetNumericParameter(ptHeight); break; case ftDrawTextBox: { @@ -1265,6 +1273,9 @@ string cTemplateFunction::GetFuncName(void) { case ftDrawEllipse: name = "Function DrawEllipse"; break; + case ftDrawSlope: + name = "Function DrawSlope"; + break; case ftNone: name = "Undefined"; break; @@ -1332,6 +1343,9 @@ string cTemplateFunction::GetParamName(eParamType pt) { case ptQuadrant: name = "Quadrant"; break; + case ptType: + name = "Type"; + break; case ptAlign: name = "Align"; break; diff --git a/libtemplate/templatefunction.h b/libtemplate/templatefunction.h index 9a784c5..b6c2d53 100644 --- a/libtemplate/templatefunction.h +++ b/libtemplate/templatefunction.h @@ -32,6 +32,7 @@ enum eFuncType { ftDrawImage, ftDrawRectangle, ftDrawEllipse, + ftDrawSlope, ftNone }; @@ -54,6 +55,7 @@ enum eParamType { ptLayer, ptTransparency, ptQuadrant, + ptType, ptAlign, ptValign, ptScrollMode, diff --git a/libtemplate/templatepixmap.c b/libtemplate/templatepixmap.c index 8aaa4f3..4fbd513 100644 --- a/libtemplate/templatepixmap.c +++ b/libtemplate/templatepixmap.c @@ -107,6 +107,8 @@ void cTemplatePixmap::AddFunction(string name, vector > &pa type = ftDrawRectangle; } else if (!name.compare("drawellipse")) { type = ftDrawEllipse; + } else if (!name.compare("drawslope")) { + type = ftDrawSlope; } if (type == ftNone) { diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c index 37bb13b..7786ce1 100644 --- a/libtemplate/templateview.c +++ b/libtemplate/templateview.c @@ -558,6 +558,20 @@ void cTemplateView::SetFunctionDefinitions(void) { attributes.insert("quadrant"); funcsAllowed.insert(pair< string, set >(name, attributes)); + name = "drawslope"; + attributes.clear(); + attributes.insert("debug"); + attributes.insert("condition"); + attributes.insert("name"); + attributes.insert("x"); + attributes.insert("y"); + attributes.insert("align"); + attributes.insert("valign"); + attributes.insert("width"); + attributes.insert("height"); + attributes.insert("color"); + attributes.insert("type"); + funcsAllowed.insert(pair< string, set >(name, attributes)); } /************************************************************************************ -- cgit v1.2.3