summaryrefslogtreecommitdiff
path: root/xml/object.c
diff options
context:
space:
mode:
authorChristian Tusche <chr13@gmx.net>2007-05-06 17:26:51 +0200
committerThomas Günther <tom@toms-cafe.de>2009-06-04 00:56:47 +0200
commitf6f140b2ea0bb1de9e055e920ef9c0c43c6e2add (patch)
treea5c927131e9c94b114bc659dd5d048a23926c95e /xml/object.c
parentb32f1eaf9ae246f656ebd27c2fbb5d29d2bec34c (diff)
downloadvdr-plugin-text2skin-f6f140b2ea0bb1de9e055e920ef9c0c43c6e2add.tar.gz
vdr-plugin-text2skin-f6f140b2ea0bb1de9e055e920ef9c0c43c6e2add.tar.bz2
2007-05-06: Version 1.1-cvs_ext-0.10c (text2skin-1.1-cvs_ext-0.10c.diff)
- 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)
Diffstat (limited to 'xml/object.c')
-rw-r--r--xml/object.c114
1 files changed, 114 insertions, 0 deletions
diff --git a/xml/object.c b/xml/object.c
index 81dc854..587eab5 100644
--- a/xml/object.c
+++ b/xml/object.c
@@ -30,6 +30,7 @@ cxObject::cxObject(cxDisplay *Parent):
mFontWidth(0),
mDelay(150),
mIndex(0),
+ mRefresh(this),
mObjects(NULL)
{
}
@@ -59,6 +60,7 @@ cxObject::cxObject(const cxObject &Src):
mFontSize(Src.mFontSize),
mFontWidth(Src.mFontWidth),
mDelay(Src.mDelay),
+ mRefresh(Src.mRefresh),
mObjects(NULL)
{
if (Src.mCondition)
@@ -223,3 +225,115 @@ cxObjects::~cxObjects()
delete operator[](i);
}
+
+
+
+
+
+cxRefresh::cxRefresh( cxObject *Object ):
+ mRefreshType(0xFF),
+ mText(NULL),
+ mChanged(NULL),
+ mObject(Object),
+ mForce(true),
+ mFull(true)
+{
+}
+
+cxRefresh::~cxRefresh()
+{
+ delete mText;
+}
+
+bool cxRefresh::Dirty(uint dirty, bool force)
+{
+ bool need_changed = !mForce && !force && !(mRefreshType & dirty & ~(1<<update));
+
+ if( !(mRefreshType & dirty) )
+ return false;
+
+ if( mChanged == NULL && need_changed )
+ return false;
+ else if( mChanged == NULL )
+ return true;
+
+ mEval = mChanged->Evaluate();
+
+ if( mEval == mLastEval && need_changed ) {
+ return false;
+ } else {
+ mLastEval = mEval;
+ }
+
+ return true;
+}
+
+
+
+
+
+bool cxRefresh::Parse(const std::string &Text)
+{
+ uint refresh=0;
+ bool force=false, full=false;
+
+ if( Text.find("all") != std::string::npos )
+ refresh |= (1<<all);
+
+ if( Text.find("timeout") != std::string::npos )
+ refresh |= (1<<timeout);
+
+ if( Text.find("update") != std::string::npos )
+ refresh |= (1<<update);
+
+ //if( Text.find("message") =! std::string::npos )
+ // refresh |= (1<<list);
+
+ if( Text.find("list") != std::string::npos )
+ refresh |= (1<<list);
+
+ if( Text.find("scroll") != std::string::npos )
+ refresh |= (1<<scroll);
+
+ if( Text.find("allways") != std::string::npos )
+ refresh |= 0xFF;
+
+ if( Text.find("full") != std::string::npos )
+ full = true;
+
+ if( Text.find("force") != std::string::npos )
+ force = true;
+
+ if( refresh == 0)
+ return false;
+
+ mForce = force;
+ mFull = full;
+ mRefreshType = refresh;
+
+ return true;
+}
+
+bool cxRefresh::ParseChanged(const std::string &Text)
+{
+ if( mObject == NULL )
+ return false;
+
+ if(mText == NULL)
+ mText = new cxString(mObject, false);
+
+ if ( mText->Parse(Text) ) {
+ mChanged = mText;
+ return true;
+ }
+
+ return false;
+}
+
+cxRefresh &cxRefresh::operator=(const cxRefresh &a)
+{
+ mRefreshType = a.mRefreshType;
+ mForce = a.mForce;
+ mFull = a.mFull;
+ return *this;
+}