summaryrefslogtreecommitdiff
path: root/libtemplate/templateloopfunction.c
diff options
context:
space:
mode:
Diffstat (limited to 'libtemplate/templateloopfunction.c')
-rw-r--r--libtemplate/templateloopfunction.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/libtemplate/templateloopfunction.c b/libtemplate/templateloopfunction.c
index 4de9ec4..07219ac 100644
--- a/libtemplate/templateloopfunction.c
+++ b/libtemplate/templateloopfunction.c
@@ -21,8 +21,8 @@ void cTemplateLoopFunction::AddFunction(string name, vector<pair<string, string>
if (!name.compare("drawtext")) {
type = ftDrawText;
} else if (!name.compare("drawtextbox")) {
- type = ftDrawTextBox;
- } else if (!name.compare("drawimage")) {
+ type = ftDrawTextBox;
+ } else if (!name.compare("drawimage")) {
type = ftDrawImage;
} else if (!name.compare("drawrectangle")) {
type = ftDrawRectangle;
@@ -149,6 +149,21 @@ int cTemplateLoopFunction::GetLoopElementsHeight(void) {
return maxHeight;
}
+int cTemplateLoopFunction::CalculateHeight(map < string, vector< map< string, string > > > *loopTokens) {
+ if (!loopTokens) {
+ return 0;
+ }
+ int rowHeight = GetLoopElementsHeight();
+ string loopName = GetParameter(ptName);
+ map < string, vector< map< string, string > > >::iterator hit = loopTokens->find(loopName);
+ if (hit == loopTokens->end())
+ return 0;
+ vector< map< string, string > > toks = hit->second;
+ int numElements = toks.size();
+
+ return numElements * rowHeight;
+}
+
bool cTemplateLoopFunction::ReplaceWidthFunctions(void) {
bool replaced = false;
InitIterator();