summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlordjaxom <lordjaxom>2004-12-21 20:26:25 +0000
committerlordjaxom <lordjaxom>2004-12-21 20:26:25 +0000
commitdaa586ba0112a61d92a57e33e648f00b4105dd65 (patch)
tree9c4bb00087570023bf7706b60d2124ebfedb7d7d
parentc05277882c111760d4e275b8521bb057e913a946 (diff)
downloadvdr-plugin-text2skin-daa586ba0112a61d92a57e33e648f00b4105dd65.tar.gz
vdr-plugin-text2skin-daa586ba0112a61d92a57e33e648f00b4105dd65.tar.bz2
- finished {CurrentRecording}
- improved marquee - added some missing checks
-rw-r--r--bitmap.c6
-rw-r--r--bitmap.h4
-rw-r--r--marquee.c63
-rw-r--r--marquee.h10
-rw-r--r--render.c17
-rw-r--r--render.h4
-rw-r--r--status.c5
-rw-r--r--xml/string.c8
-rw-r--r--xml/string.h15
-rw-r--r--xml/type.h21
10 files changed, 84 insertions, 69 deletions
diff --git a/bitmap.c b/bitmap.c
index 55dedba..c600a47 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -1,5 +1,5 @@
/*
- * $Id: bitmap.c,v 1.1 2004/12/19 22:03:08 lordjaxom Exp $
+ * $Id: bitmap.c,v 1.2 2004/12/21 20:26:25 lordjaxom Exp $
*/
#include "bitmap.h"
@@ -90,7 +90,7 @@ cText2SkinBitmap::~cText2SkinBitmap() {
mBitmaps.clear();
}
-cBitmap &cText2SkinBitmap::Get(int &UpdateIn) {
+cBitmap &cText2SkinBitmap::Get(uint &UpdateIn) {
if (mBitmaps.size() == 1)
return *mBitmaps[0];
@@ -107,7 +107,7 @@ cBitmap &cText2SkinBitmap::Get(int &UpdateIn) {
upd = mDelay - diff;
}
- if (UpdateIn == 0 || UpdateIn > upd)
+ if (UpdateIn == 0 || UpdateIn > (uint)upd)
UpdateIn = upd;
return *mBitmaps[mCurrent];
diff --git a/bitmap.h b/bitmap.h
index 9d95203..f09d6cc 100644
--- a/bitmap.h
+++ b/bitmap.h
@@ -1,5 +1,5 @@
/*
- * $Id: bitmap.h,v 1.1 2004/12/19 22:03:09 lordjaxom Exp $
+ * $Id: bitmap.h,v 1.2 2004/12/21 20:26:25 lordjaxom Exp $
*/
#ifndef VDR_TEXT2SKIN_BITMAP_H
@@ -30,7 +30,7 @@ public:
virtual ~cText2SkinBitmap();
void Reset(void) { mCurrent = 0; mLastGet = 0; }
- cBitmap &Get(int &UpdateIn);
+ cBitmap &Get(uint &UpdateIn);
void SetColor(int Index, tColor Color);
void SetAlpha(int Alpha);
diff --git a/marquee.c b/marquee.c
index 0397718..7305964 100644
--- a/marquee.c
+++ b/marquee.c
@@ -1,5 +1,5 @@
/*
- * $Id: marquee.c,v 1.1 2004/12/19 22:03:14 lordjaxom Exp $
+ * $Id: marquee.c,v 1.2 2004/12/21 20:26:25 lordjaxom Exp $
*/
#include "marquee.h"
@@ -25,14 +25,14 @@ cText2SkinMarquee::cText2SkinMarquee(const cText2SkinMarquee &Src):
cText2SkinMarquee::cText2SkinMarquee(cText2SkinScreen *Screen, int Left, int Top, int Width,
int Height, const std::string &Text, const cFont *Font,
- tColor ColorFg, tColor ColorBg, int &UpdateIn)
+ tColor ColorFg, tColor ColorBg, uint &UpdateIn)
{
Set(Screen, Left, Top, Width, Height, Text, Font, ColorFg, ColorBg, UpdateIn);
}
void cText2SkinMarquee::Set(cText2SkinScreen *Screen, int Left, int Top, int Width, int Height,
const std::string &Text, const cFont *Font, tColor ColorFg,
- tColor ColorBg, int &UpdateIn)
+ tColor ColorBg, uint &UpdateIn)
{
mScreen = Screen;
mFont = Font;
@@ -50,43 +50,38 @@ void cText2SkinMarquee::Set(cText2SkinScreen *Screen, int Left, int Top, int Wid
DrawText(UpdateIn);
}
-void cText2SkinMarquee::DrawText(int &mUpdateIn)
+void cText2SkinMarquee::DrawText(uint &UpdateIn)
{
uint now = time_ms();
- if (!mScrolling || (mNextTime > 0 && now < mNextTime)) {
- mScreen->DrawText(mLeft, mTop, mText.c_str() + mOffset, mColorFg, mColorBg, mFont, mWidth,
- mHeight);
- if (mScrolling) {
- uint updatein = mNextTime - now;
- if (mUpdateIn == 0 || (uint)mUpdateIn > updatein)
- mUpdateIn = updatein;
+ if (mNextTime == 0)
+ mNextTime = now + 1500;
+ else if (now >= mNextTime) {
+ uint nextin = 250;
+ if (mDirection > 0) {
+ if (mFont->Width(mText.c_str() + mOffset) <= mWidth) {
+ --mDirection;
+ nextin = 1500;
+ }
+ else
+ ++mOffset;
}
- return;
- }
-
- int nextupdate = 250;
- if (mDirection > 0) {
- if (mFont->Width(mText.c_str() + mOffset) <= mWidth) {
- --mDirection;
- nextupdate = 1500;
- }
- else
- ++mOffset;
- }
- else {
- if (mOffset <= 0) {
- ++mDirection;
- nextupdate = 1500;
+ else {
+ if (mOffset <= 0) {
+ ++mDirection;
+ nextin = 1500;
+ }
+ else
+ --mOffset;
}
- else
- --mOffset;
+ mNextTime = now + nextin;
}
- mNextTime = now + nextupdate;
+ if (mScrolling) {
+ uint updatein = mNextTime - now;
+ if (UpdateIn == 0 || updatein < UpdateIn)
+ UpdateIn = updatein;
+ }
mScreen->DrawText(mLeft, mTop, mText.c_str() + mOffset, mColorFg, mColorBg, mFont, mWidth,
- mHeight);
-
- if (mUpdateIn == 0 || mUpdateIn > nextupdate)
- mUpdateIn = nextupdate;
+ mHeight);
}
diff --git a/marquee.h b/marquee.h
index c989e47..e39443b 100644
--- a/marquee.h
+++ b/marquee.h
@@ -1,5 +1,5 @@
/*
- * $Id: marquee.h,v 1.1 2004/12/19 22:03:14 lordjaxom Exp $
+ * $Id: marquee.h,v 1.2 2004/12/21 20:26:25 lordjaxom Exp $
*/
#ifndef VDR_TEXT2SKIN_MARQUEE_H
@@ -33,12 +33,14 @@ public:
cText2SkinMarquee(const cText2SkinMarquee &Src);
cText2SkinMarquee(cText2SkinScreen *Screen, int Left, int Top, int Width, int Height,
const std::string &Text, const cFont *Font, tColor ColorFg, tColor ColorBg,
- int &UpdateIn);
+ uint &UpdateIn);
void Set(cText2SkinScreen *Screen, int Left, int Top, int Width, int Height,
const std::string &Text, const cFont *Font, tColor ColorFg, tColor ColorBg,
- int &UpdateIn);
- void DrawText(int &UpdateIn);
+ uint &UpdateIn);
+ void DrawText(uint &UpdateIn);
+
+ const std::string &Text(void) const { return mText; }
};
#endif // VDR_TEXT2SKIN_MARQUEE_H
diff --git a/render.c b/render.c
index a30811d..952dbbd 100644
--- a/render.c
+++ b/render.c
@@ -1,5 +1,5 @@
/*
- * $Id: render.c,v 1.2 2004/12/21 18:35:54 lordjaxom Exp $
+ * $Id: render.c,v 1.3 2004/12/21 20:26:25 lordjaxom Exp $
*/
#include "render.h"
@@ -292,7 +292,11 @@ void cText2SkinRender::DrawMarquee(const txPoint &Pos, const txSize &Size, const
cText2SkinMarquee marquee(mScreen, Pos.x, Pos.y, Size.w, Size.h, Text, Font, Fg ? *Fg : 0,
clrTransparent, mUpdateIn);
mMarquees.push_back(marquee);
- } else
+ }
+ else if (Text != mMarquees[Index].Text())
+ mMarquees[Index].Set(mScreen, Pos.x, Pos.y, Size.w, Size.h, Text, Font, Fg ? *Fg : 0,
+ clrTransparent, mUpdateIn);
+ else
mMarquees[Index].DrawText(mUpdateIn);
}
@@ -494,8 +498,15 @@ cxType cText2SkinRender::GetToken(const txToken &Token)
Dprintf("MenuTitle result: |%s|\n", res.String().c_str());
}
}
- if (!res.NoCache())
+ if (res.UpdateIn() > 0) {
+ Dprintf("Passing token without cacheing\n");
+ if (mRender->mUpdateIn == 0 || res.UpdateIn() < mRender->mUpdateIn) {
+ Dprintf("updating in %d\n", res.UpdateIn());
+ mRender->mUpdateIn = res.UpdateIn();
+ }
+ } else
mRender->mTokenCache[Token] = res;
+
return res;
}
return cxType::False;
diff --git a/render.h b/render.h
index 807a916..bb8331a 100644
--- a/render.h
+++ b/render.h
@@ -1,5 +1,5 @@
/*
- * $Id: render.h,v 1.3 2004/12/21 18:35:54 lordjaxom Exp $
+ * $Id: render.h,v 1.4 2004/12/21 20:26:25 lordjaxom Exp $
*/
#ifndef VDR_TEXT2SKIN_RENDER_H
@@ -57,7 +57,7 @@ private:
cCondVar mDoUpdate;
cMutex mDoUpdateMutex;
cCondVar mStarted;
- int mUpdateIn;
+ uint mUpdateIn;
// coordinate transformation
txSize mBaseSize;
diff --git a/status.c b/status.c
index aaa7def..8d83072 100644
--- a/status.c
+++ b/status.c
@@ -1,5 +1,5 @@
/*
- * $Id: status.c,v 1.2 2004/12/21 18:35:54 lordjaxom Exp $
+ * $Id: status.c,v 1.3 2004/12/21 20:26:25 lordjaxom Exp $
*/
#include "status.h"
@@ -107,6 +107,7 @@ cxType cText2SkinStatus::GetTokenData(const txToken &Token)
return ReplayNames[mReplayMode];
case tCurrentRecording:
+ Dprintf("token attrib type is: %d, number: %d\n", Token.Attrib.Type, Token.Attrib.Number);
if (Token.Attrib.Type == aNumber) {
return mRecordings.size() > (uint)Token.Attrib.Number
? (cxType)mRecordings[Token.Attrib.Number].name
@@ -127,7 +128,7 @@ cxType cText2SkinStatus::GetTokenData(const txToken &Token)
}
cxType res = mRecordings[mCurrentRecording].name;
- res.SetNoCache();
+ res.SetUpdate(next);
return res;
}
return false;
diff --git a/xml/string.c b/xml/string.c
index 5d6b397..a037de0 100644
--- a/xml/string.c
+++ b/xml/string.c
@@ -1,5 +1,5 @@
/*
- * $Id: string.c,v 1.2 2004/12/21 18:35:55 lordjaxom Exp $
+ * $Id: string.c,v 1.3 2004/12/21 20:26:25 lordjaxom Exp $
*/
#include "xml/string.h"
@@ -110,9 +110,11 @@ bool cxString::Parse(const std::string &Text) {
else {
char *end;
int n = strtol(attr.c_str(), &end, 10);
- if (end != attr.c_str() && end == '\0')
+ Dprintf("attr: %s, n: %d, end: |%s|\n", attr.c_str(), n, end);
+ if (end != attr.c_str() && *end == '\0') {
+ Dprintf("a number\n");
lastToken.Attrib = n;
- else
+ } else
lastToken.Attrib = attr;
}
diff --git a/xml/string.h b/xml/string.h
index e53bafb..b3b0c8d 100644
--- a/xml/string.h
+++ b/xml/string.h
@@ -1,5 +1,5 @@
/*
- * $Id: string.h,v 1.2 2004/12/21 18:35:55 lordjaxom Exp $
+ * $Id: string.h,v 1.3 2004/12/21 20:26:25 lordjaxom Exp $
*/
#ifndef VDR_TEXT2SKIN_XML_STRING_H
@@ -112,10 +112,10 @@ struct txAttrib {
std::string Text;
int Number;
- txAttrib(const std::string &a): Type(aString), Text(a) {}
- txAttrib(int n): Type(aNumber), Number(0) {}
+ txAttrib(const std::string &a): Type(aString), Text(a), Number(0) {}
+ txAttrib(int n): Type(aNumber), Text(""), Number(n) {}
txAttrib(exAttrib t): Type(t), Text(""), Number(0) {}
- txAttrib(void): Type(aNone) {}
+ txAttrib(void): Type(aNone), Text(""), Number(0) {}
friend bool operator== (const txAttrib &A, const txAttrib &B);
friend bool operator< (const txAttrib &A, const txAttrib &B);
@@ -124,13 +124,16 @@ struct txAttrib {
inline bool operator== (const txAttrib &A, const txAttrib &B)
{
return A.Type == B.Type
- && A.Text == B.Text;
+ && A.Text == B.Text
+ && A.Number == B.Number;
}
inline bool operator< (const txAttrib &A, const txAttrib &B)
{
return A.Type == B.Type
- ? A.Text < B.Text
+ ? A.Text == B.Text
+ ? A.Number < B.Number
+ : A.Text < B.Text
: A.Type < B.Type;
}
diff --git a/xml/type.h b/xml/type.h
index c60c404..dea7c05 100644
--- a/xml/type.h
+++ b/xml/type.h
@@ -1,5 +1,5 @@
/*
- * $Id: type.h,v 1.2 2004/12/21 18:35:55 lordjaxom Exp $
+ * $Id: type.h,v 1.3 2004/12/21 20:26:25 lordjaxom Exp $
*/
#ifndef VDR_TEXT2SKIN_XML_TYPE_H
@@ -20,24 +20,25 @@ private:
eType mType;
std::string mString;
int mNumber;
- bool mNoCache;
+ bool mCache;
+ uint mUpdateIn;
public:
static cxType True;
static cxType False;
- cxType(void): mType(boolean), mNumber(0), mNoCache(false) {}
- cxType(const char *String): mType(string), mString(String ?: ""), mNoCache(false) {}
- cxType(std::string String): mType(string), mString(String), mNoCache(false) {}
- cxType(int Number): mType(number), mNumber(Number), mNoCache(false) {}
- cxType(time_t Number): mType(number), mNumber(Number), mNoCache(false) {}
- cxType(bool Value): mType(boolean), mNumber(Value ? 1 : 0), mNoCache(false) {}
+ cxType(void): mType(boolean), mNumber(0), mUpdateIn(0) {}
+ cxType(const char *String): mType(string), mString(String ?: ""), mUpdateIn(0) {}
+ cxType(std::string String): mType(string), mString(String), mUpdateIn(0) {}
+ cxType(int Number): mType(number), mNumber(Number), mUpdateIn(0) {}
+ cxType(time_t Number): mType(number), mNumber(Number), mUpdateIn(0) {}
+ cxType(bool Value): mType(boolean), mNumber(Value ? 1 : 0), mUpdateIn(0) {}
const std::string &String(void);
int Number(void) const { return mType == number ? mNumber : 0; }
- void SetNoCache(bool Enable = true) { mNoCache = Enable; }
- bool NoCache(void) const { return mNoCache; }
+ void SetUpdate(uint UpdateIn) { mUpdateIn = UpdateIn; }
+ uint UpdateIn(void) const { return mUpdateIn; }
operator std::string () { return String(); }
operator int () { return Number(); }