added possibility for blinking images, texts, rectangles, ellipses and slopes

This commit is contained in:
louis
2015-04-12 17:10:06 +02:00
parent 22da0fccd4
commit e8291960bd
14 changed files with 434 additions and 14 deletions

View File

@@ -143,6 +143,10 @@ void cTemplateFunction::SetParameters(vector<pair<string, string> > 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<eParamType, int>(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;

View File

@@ -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);
};

View File

@@ -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<string> >(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<string> >(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<string> >(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<string> >(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<string> >(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<string> >(name, attributes));
}