summaryrefslogtreecommitdiff
path: root/xml/parser.c
diff options
context:
space:
mode:
authorChristian Tusche <chr13@gmx.net>2009-06-06 23:17:58 +0200
committerThomas Günther <tom@toms-cafe.de>2009-06-06 23:17:58 +0200
commit2a4bf008cd0a14d53fefec0c34573aab12424373 (patch)
tree12ee1c3021b4965f095b5ea81ab3a60f01217449 /xml/parser.c
parent60cd7db51838bb076312fd10e08bca0f4a005f82 (diff)
parent3ab2393b6932b34e7f0e69af7f843d1303104d79 (diff)
downloadvdr-plugin-text2skin-2a4bf008cd0a14d53fefec0c34573aab12424373.tar.gz
vdr-plugin-text2skin-2a4bf008cd0a14d53fefec0c34573aab12424373.tar.bz2
Added chr13-optimizations (thanks to Christian Tusche / closes #39)
- increased efficiency in drawing list items in the main menu - introduce relative Pos and Size of objects to given BasePos, BaseSize (used to draw list items) - increase skin file version to 1.1 - the position of list items is interpreted relative to the "list" container when file version >= 1.1 - when a position is specified for "block" elements, the position of all contained elements is interpreted relative to the container position - selective update of changed objects refresh can be controlled for individual objects by the attributes "refresh" and "changed" default behaviour is to redraw everything (compatible with old skins) - moved state tracking of marquee, blink, scroll from cText2SkinRender to cxObject - fixed use of Update.Lock() in render.h - new: dynamic width/height of objects - new: Option "bgColor" used for items "Text", "Marquee", and "Blink". - remember period to next timeout when doing a non-timeout refresh prevent occasional start/stop of marquee-text
Diffstat (limited to 'xml/parser.c')
-rw-r--r--xml/parser.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/xml/parser.c b/xml/parser.c
index f573398..fe93602 100644
--- a/xml/parser.c
+++ b/xml/parser.c
@@ -45,7 +45,7 @@
#define ATTRIB_OPT_NUMBER(_attr,_target) \
if (attrs.find(_attr) != attrs.end()) { \
char *_e; const char *_t = attrs[_attr].c_str(); \
- long _l = strtol(_t, &_e, 10); \
+ long _l = strtol(_t, &_e, 0); \
if (_e ==_t || *_e != '\0') { \
esyslog("ERROR: Text2Skin: Invalid numeric value \"%s\" in attribute %s", \
_t, _attr); \
@@ -91,7 +91,7 @@ bool xStartElem(const std::string &name, std::map<std::string,std::string> &attr
if (context.size() == 0) {
if (name == "skin") {
- ATTRIB_MAN_STRING("version", skin->mVersion);
+ ATTRIB_MAN_FUNC ("version", skin->mVersion.Parse);
ATTRIB_MAN_STRING("name", skin->mTitle);
ATTRIB_MAN_FUNC ("screenBase", skin->ParseBase);
}
@@ -102,7 +102,8 @@ bool xStartElem(const std::string &name, std::map<std::string,std::string> &attr
if (name == "display") {
display = new cxDisplay(skin);
ATTRIB_MAN_FUNC ("id", display->ParseType);
- }
+ ATTRIB_OPT_FUNC ("refresh", display->mRefreshDefault.Parse);
+ }
else
TAG_ERR_REMAIN("skin");
}
@@ -129,12 +130,18 @@ bool xStartElem(const std::string &name, std::map<std::string,std::string> &attr
else {
object = new cxObject(display);
if (object->ParseType(name)) {
+ if (parents.size() > 0)
+ object->mRefresh = parents.back()->mRefresh;
+ else
+ object->mRefresh = display->mRefreshDefault;
+
ATTRIB_OPT_NUMBER("x1", object->mPos1.x);
ATTRIB_OPT_NUMBER("y1", object->mPos1.y);
ATTRIB_OPT_NUMBER("x2", object->mPos2.x);
ATTRIB_OPT_NUMBER("y2", object->mPos2.y);
ATTRIB_OPT_FUNC ("condition", object->ParseCondition);
-
+ ATTRIB_OPT_FUNC ("refresh", object->mRefresh.Parse);
+ ATTRIB_OPT_FUNC ("changed", object->mRefresh.ParseChanged);
if (name == "image") {
ATTRIB_OPT_NUMBER("x", object->mPos1.x);
ATTRIB_OPT_NUMBER("y", object->mPos1.y);
@@ -152,11 +159,12 @@ bool xStartElem(const std::string &name, std::map<std::string,std::string> &attr
|| name == "blink"
|| name == "scrolltext") {
ATTRIB_OPT_STRING("color", object->mFg);
+ ATTRIB_OPT_STRING("bgColor", object->mBg);
ATTRIB_OPT_FUNC ("align", object->ParseAlignment);
ATTRIB_OPT_FUNC ("font", object->ParseFontFace);
if (name == "blink") {
- ATTRIB_OPT_STRING("blinkColor", object->mBg);
+ ATTRIB_OPT_STRING("blinkColor", object->mBl);
ATTRIB_OPT_NUMBER("delay", object->mDelay);
if (object->mDelay == 0)
@@ -190,6 +198,11 @@ bool xStartElem(const std::string &name, std::map<std::string,std::string> &attr
ATTRIB_MAN_NUMBER("height", object->mPos2.y);
--object->mPos2.y;
}
+ else if (name == "block"
+ || name == "list") {
+ ATTRIB_OPT_NUMBER("w", object->mVirtSize.w);
+ ATTRIB_OPT_NUMBER("h", object->mVirtSize.h);
+ }
} else
TAG_ERR_REMAIN(context[context.size() - 1].c_str());
}
@@ -256,6 +269,20 @@ bool xEndElem(const std::string &name) {
}
}
+ if (object->mRefresh.mChanged == NULL) {
+ switch (object->mType) {
+ case cxObject::text:
+ case cxObject::marquee:
+ case cxObject::blink:
+ case cxObject::scrolltext:
+ object->mRefresh.mChanged = &object->mText;
+ break;
+
+ default:
+ break;
+ }
+ }
+
object->mIndex = oindex++;
if (parents.size() > 0) {
Dprintf("pushing to parent\n");