diff options
author | louis <louis.braun@gmx.de> | 2016-06-18 13:09:26 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2016-06-18 13:09:26 +0200 |
commit | 0460690ec8e9f9aaf8f86abce9ece2ff16233424 (patch) | |
tree | a2d89e10520a195552023aa6ebd425e5a95f6725 | |
parent | 97a9c7e40f320c20061317170ad37cb62cec23fb (diff) | |
download | vdr-plugin-skindesigner-0460690ec8e9f9aaf8f86abce9ece2ff16233424.tar.gz vdr-plugin-skindesigner-0460690ec8e9f9aaf8f86abce9ece2ff16233424.tar.bz2 |
added valign bottom for vertical loops
-rw-r--r-- | coreengine/definitions.h | 1 | ||||
-rw-r--r-- | coreengine/functions.c | 21 | ||||
-rw-r--r-- | coreengine/functions.h | 1 | ||||
-rw-r--r-- | dtd/functions.dtd | 5 |
4 files changed, 26 insertions, 2 deletions
diff --git a/coreengine/definitions.h b/coreengine/definitions.h index 5d8ecc0..e2a8e4d 100644 --- a/coreengine/definitions.h +++ b/coreengine/definitions.h @@ -1785,6 +1785,7 @@ enum class eLoopAttribs { rowheight, name, orientation, + valign, overflow, maxitems, count diff --git a/coreengine/functions.c b/coreengine/functions.c index dd5ecfe..928abf3 100644 --- a/coreengine/functions.c +++ b/coreengine/functions.c @@ -1170,6 +1170,8 @@ void cFuncLoop::Set(vector<stringpair> &attributes) { SetOrientation(id, attVal); } else if (IdEqual(id, (int)eLoopAttribs::overflow)) { SetOverflow(id, attVal); + } else if (IdEqual(id, (int)eLoopAttribs::valign)) { + SetAlign(id, attVal); } else { attribCtors[id] = new cNumericExpr(attVal); } @@ -1235,6 +1237,7 @@ void cFuncLoop::Render(cPixmap *p, int x0, int y0, int cw, int rh) { int maxItems = GetValue((int)eLoopAttribs::maxitems); eOrientation orientation = (eOrientation)GetValue((int)eLoopAttribs::orientation); eOverflowType overflow = (eOverflowType)GetValue((int)eLoopAttribs::overflow); + eAlign vAlign = (eAlign)GetValue((int)eLoopAttribs::valign); int loopWidth = Width(); if (loopWidth <= 0) @@ -1251,6 +1254,22 @@ void cFuncLoop::Render(cPixmap *p, int x0, int y0, int cw, int rh) { int loopY = Y(); int x = (loopX > 0) ? loopX : 0; int y = (loopY > 0) ? loopY : 0; + + //set y position for vertical loop with valign bottom + if (orientation == eOrientation::vertical && vAlign == eAlign::bottom) { + int actRowheight = (rowHeight > 0) ? rowHeight : RowHeight(); + if (actRowheight > 0) { + float fTotalItems = (float)loopHeight / (float)actRowheight; + int totalItems = (int)fTotalItems; + if (fTotalItems - (float)totalItems > 0.5f) + totalItems++; + if (maxItems > 0 && maxItems < totalItems) + totalItems = maxItems; + if (numRows < totalItems) + y += (totalItems - numRows) * actRowheight; + } + } + for (int row = 0; row < numRows; ++row) { if (maxItems > 0 && row >= maxItems) { break; @@ -1371,12 +1390,14 @@ void cFuncLoop::SetAttributesDefs(void) { attribIDs.insert(pair<string, int>("rowheight", (int)eLoopAttribs::rowheight)); attribIDs.insert(pair<string, int>("name", (int)eLoopAttribs::name)); attribIDs.insert(pair<string, int>("orientation", (int)eLoopAttribs::orientation)); + attribIDs.insert(pair<string, int>("valign", (int)eLoopAttribs::valign)); attribIDs.insert(pair<string, int>("overflow", (int)eLoopAttribs::overflow)); attribIDs.insert(pair<string, int>("maxitems", (int)eLoopAttribs::maxitems)); attribNames.insert(pair<int, string>((int)eLoopAttribs::columnwidth, "columnwidth")); attribNames.insert(pair<int, string>((int)eLoopAttribs::rowheight, "rowheight")); attribNames.insert(pair<int, string>((int)eLoopAttribs::name, "name")); attribNames.insert(pair<int, string>((int)eLoopAttribs::orientation, "orientation")); + attribNames.insert(pair<int, string>((int)eLoopAttribs::valign, "valign")); attribNames.insert(pair<int, string>((int)eLoopAttribs::overflow, "overflow")); attribNames.insert(pair<int, string>((int)eLoopAttribs::maxitems, "maxitems")); } diff --git a/coreengine/functions.h b/coreengine/functions.h index 90d2045..1607618 100644 --- a/coreengine/functions.h +++ b/coreengine/functions.h @@ -187,6 +187,7 @@ public: void Render(cPixmap *p, int x0 = 0, int y0 = 0, int colWidth = 0, int rowHeight = 0); int FuncWidth(void); int FuncHeight(void); + int Valign(void) { return GetValue((int)eLoopAttribs::valign); }; void Debug(void); }; diff --git a/dtd/functions.dtd b/dtd/functions.dtd index b7b4e0a..e1d1390 100644 --- a/dtd/functions.dtd +++ b/dtd/functions.dtd @@ -50,8 +50,8 @@ <!ELEMENT loop (drawtext|drawtextbox|drawtextvertical|drawimage|drawrectangle|drawellipse|drawslope)+> <!ATTLIST loop - x CDATA #REQUIRED - y CDATA #REQUIRED + x CDATA #IMPLIED + y CDATA #IMPLIED width CDATA #IMPLIED height CDATA #IMPLIED columnwidth CDATA #IMPLIED @@ -60,6 +60,7 @@ orientation (horizontal|vertical|absolute) #REQUIRED overflow (linewrap|cut) #IMPLIED maxitems CDATA #IMPLIED + valign (top|bottom) #IMPLIED debug (true|false) #IMPLIED > |