From e8291960bd4b221ff7e55aa55fd45aaeb3c8d37a Mon Sep 17 00:00:00 2001 From: louis Date: Sun, 12 Apr 2015 17:10:06 +0200 Subject: added possibility for blinking images, texts, rectangles, ellipses and slopes --- libtemplate/templatefunction.c | 34 ++++++++++++++++++++++++++++++++++ libtemplate/templatefunction.h | 10 ++++++++++ libtemplate/templateview.c | 12 ++++++++++++ 3 files changed, 56 insertions(+) (limited to 'libtemplate') diff --git a/libtemplate/templatefunction.c b/libtemplate/templatefunction.c index 7b76539..c99fa37 100644 --- a/libtemplate/templatefunction.c +++ b/libtemplate/templatefunction.c @@ -143,6 +143,10 @@ void cTemplateFunction::SetParameters(vector > params) { p.first = ptDeterminateFont; } else if (!name.compare("direction")) { p.first = ptDirection; + } else if (!name.compare("animtype")) { + p.first = ptAnimType; + } else if (!name.compare("animfreq")) { + p.first = ptAnimFreq; } else { p.first = ptNone; } @@ -242,6 +246,7 @@ bool cTemplateFunction::CalculateParameters(void) { case ptScaleTvY: case ptScaleTvWidth: case ptScaleTvHeight: + case ptAnimFreq: SetNumericParameter(type, value); break; case ptAlign: @@ -287,6 +292,9 @@ bool cTemplateFunction::CalculateParameters(void) { case ptDirection: paramValid = SetDirection(value); break; + case ptAnimType: + paramValid = SetAnimType(value); + break; default: paramValid = true; break; @@ -736,6 +744,16 @@ bool cTemplateFunction::DoExecute(void) { return condParam->IsTrue(); } +bool cTemplateFunction::IsAnimated(void) { + map< eParamType, int >::iterator hit = numericParameters.find(ptAnimType); + if (hit == numericParameters.end()) + return false; + eAnimType type = (eAnimType)hit->second; + if (type > atNone) + return true; + return false; +} + /******************************************************************* * Private Functions *******************************************************************/ @@ -1125,6 +1143,16 @@ bool cTemplateFunction::SetDirection(string value) { return true; } +bool cTemplateFunction::SetAnimType(string value) { + int animType = atNone; + if (!value.compare("blink")) + animType = atBlink; + else if (!value.compare("animated")) + animType = atAnimated; + numericParameters.insert(pair(ptAnimType, animType)); + return true; +} + void cTemplateFunction::SetDebugGrid(string value) { int numGridsX = 0; int numGridsY = 0; @@ -1653,6 +1681,12 @@ string cTemplateFunction::GetParamName(eParamType pt) { case ptDirection: name = "Text Direction"; break; + case ptAnimType: + name = "Animation Type"; + break; + case ptAnimFreq: + name = "Animation Frequency"; + break; default: name = "Unknown"; break; diff --git a/libtemplate/templatefunction.h b/libtemplate/templatefunction.h index fdc66b0..c781568 100644 --- a/libtemplate/templatefunction.h +++ b/libtemplate/templatefunction.h @@ -86,6 +86,8 @@ enum eParamType { ptCache, ptDeterminateFont, ptDirection, + ptAnimType, + ptAnimFreq, ptNone }; @@ -98,6 +100,12 @@ enum eImageType { itImage }; +enum eAnimType { + atNone, + atBlink, + atAnimated +}; + enum eFloatType { flNone, flTopLeft, @@ -168,6 +176,7 @@ protected: bool SetDetached(string value); bool SetBackground(string value); bool SetDirection(string value); + bool SetAnimType(string value); void SetDebugGrid(string value); void ParseStringParameters(void); void ParseNumericalParameters(void); @@ -232,6 +241,7 @@ public: bool ParsedCompletely(void) { return parsedCompletely; }; bool DoExecute(void); bool Updated(void) { return updated; }; + bool IsAnimated(void); //Debug void Debug(void); }; diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c index b7a4110..1117d10 100644 --- a/libtemplate/templateview.c +++ b/libtemplate/templateview.c @@ -744,6 +744,8 @@ void cTemplateView::SetFunctionDefinitions(void) { attributes.insert("fontsize"); attributes.insert("color"); attributes.insert("text"); + attributes.insert("animtype"); + attributes.insert("animfreq"); funcsAllowed.insert(pair< string, set >(name, attributes)); name = "drawtextbox"; @@ -781,6 +783,8 @@ void cTemplateView::SetFunctionDefinitions(void) { attributes.insert("fontsize"); attributes.insert("color"); attributes.insert("text"); + attributes.insert("animtype"); + attributes.insert("animfreq"); funcsAllowed.insert(pair< string, set >(name, attributes)); name = "drawimage"; @@ -799,6 +803,8 @@ void cTemplateView::SetFunctionDefinitions(void) { attributes.insert("align"); attributes.insert("valign"); attributes.insert("cache"); + attributes.insert("animtype"); + attributes.insert("animfreq"); funcsAllowed.insert(pair< string, set >(name, attributes)); name = "drawrectangle"; @@ -813,6 +819,8 @@ void cTemplateView::SetFunctionDefinitions(void) { attributes.insert("width"); attributes.insert("height"); attributes.insert("color"); + attributes.insert("animtype"); + attributes.insert("animfreq"); funcsAllowed.insert(pair< string, set >(name, attributes)); name = "drawellipse"; @@ -828,6 +836,8 @@ void cTemplateView::SetFunctionDefinitions(void) { attributes.insert("height"); attributes.insert("color"); attributes.insert("quadrant"); + attributes.insert("animtype"); + attributes.insert("animfreq"); funcsAllowed.insert(pair< string, set >(name, attributes)); name = "drawslope"; @@ -843,6 +853,8 @@ void cTemplateView::SetFunctionDefinitions(void) { attributes.insert("height"); attributes.insert("color"); attributes.insert("type"); + attributes.insert("animtype"); + attributes.insert("animfreq"); funcsAllowed.insert(pair< string, set >(name, attributes)); } -- cgit v1.2.3