summaryrefslogtreecommitdiff
path: root/xml
diff options
context:
space:
mode:
authorlordjaxom <lordjaxom>2004-12-14 20:05:40 +0000
committerlordjaxom <lordjaxom>2004-12-14 20:05:40 +0000
commitb8f29c674cc0ccca207123342c1344bbd0f13796 (patch)
tree2af468bf7acc6df510241c1090d7e6538b6b3cf1 /xml
parent3b0999969632e2820b846ca8adcef6b346ff7441 (diff)
downloadvdr-plugin-text2skin-b8f29c674cc0ccca207123342c1344bbd0f13796.tar.gz
vdr-plugin-text2skin-b8f29c674cc0ccca207123342c1344bbd0f13796.tar.bz2
1.0-pre4v1.0-pre4
Diffstat (limited to 'xml')
-rw-r--r--xml/function.c4
-rw-r--r--xml/function.h2
-rw-r--r--xml/object.c65
-rw-r--r--xml/object.h9
-rw-r--r--xml/parser.c10
-rw-r--r--xml/string.c5
-rw-r--r--xml/string.h5
-rw-r--r--xml/type.c2
-rw-r--r--xml/type.h4
-rw-r--r--xml/xml.c2
10 files changed, 66 insertions, 42 deletions
diff --git a/xml/function.c b/xml/function.c
index 3243257..597bece 100644
--- a/xml/function.c
+++ b/xml/function.c
@@ -1,5 +1,5 @@
/*
- * $Id: function.c,v 1.5 2004/12/10 21:46:46 lordjaxom Exp $
+ * $Id: function.c,v 1.7 2004/12/14 13:13:10 lordjaxom Exp $
*/
#include "xml/function.h"
@@ -160,7 +160,7 @@ const std::string &cxFunction::FunFile(const std::string &Param) const
{
std::string path = cText2SkinRender::ImagePath(Param);
Dprintf("checking file(%s) in cache\n", path.c_str());
- return cText2SkinBitmap::Load(path) ? Param : False;
+ return cText2SkinBitmap::Available(path) ? Param : False;
}
std::string cxFunction::FunPlugin(const std::string &Param) const
diff --git a/xml/function.h b/xml/function.h
index 49928af..abd1199 100644
--- a/xml/function.h
+++ b/xml/function.h
@@ -1,5 +1,5 @@
/*
- * $Id: function.h,v 1.4 2004/12/08 18:47:37 lordjaxom Exp $
+ * $Id: function.h,v 1.5 2004/12/12 20:26:25 lordjaxom Exp $
*/
#ifndef VDR_TEXT2SKIN_XML_FUNCTION_H
diff --git a/xml/object.c b/xml/object.c
index 6932106..b0b8dc0 100644
--- a/xml/object.c
+++ b/xml/object.c
@@ -1,5 +1,5 @@
/*
- * $Id: object.c,v 1.4 2004/12/08 17:13:26 lordjaxom Exp $
+ * $Id: object.c,v 1.5 2004/12/14 20:02:31 lordjaxom Exp $
*/
#include "xml/object.h"
@@ -15,10 +15,12 @@ cxObject::cxObject(cxDisplay *parent):
mPos1(0, 0),
mPos2(-1, -1),
mAlpha(255),
+ mColors(0),
mArc(0),
mAlign(taDefault),
mCondition(NULL),
- mFont(cFont::GetFont(fontOsd)),
+ mFontFace("Osd"),
+ mFontSize(0),
mObjects(NULL),
mDisplay(parent),
mSkin(parent->Skin())
@@ -30,6 +32,7 @@ cxObject::cxObject(const cxObject &Src):
mPos1(Src.mPos1),
mPos2(Src.mPos2),
mAlpha(Src.mAlpha),
+ mColors(Src.mColors),
mArc(Src.mArc),
mFg(Src.mFg),
mBg(Src.mBg),
@@ -42,7 +45,8 @@ cxObject::cxObject(const cxObject &Src):
mCondition(NULL),
mCurrent(Src.mCurrent),
mTotal(Src.mTotal),
- mFont(Src.mFont),
+ mFontFace(Src.mFontFace),
+ mFontSize(Src.mFontSize),
mObjects(NULL),
mDisplay(Src.mDisplay),
mSkin(Src.mSkin)
@@ -59,7 +63,8 @@ cxObject::~cxObject()
delete mObjects;
}
-bool cxObject::ParseType(const std::string &Text) {
+bool cxObject::ParseType(const std::string &Text)
+{
for (int i = 0; i < (int)__COUNT_OBJECT__; ++i) {
if (ObjectNames[i] == Text) {
mType = (eType)i;
@@ -69,7 +74,8 @@ bool cxObject::ParseType(const std::string &Text) {
return false;
}
-bool cxObject::ParseCondition(const std::string &Text) {
+bool cxObject::ParseCondition(const std::string &Text)
+{
cxFunction *result = new cxFunction;
if (result->Parse(Text)) {
delete mCondition;
@@ -79,7 +85,8 @@ bool cxObject::ParseCondition(const std::string &Text) {
return false;
}
-bool cxObject::ParseAlignment(const std::string &Text) {
+bool cxObject::ParseAlignment(const std::string &Text)
+{
if (Text == "center") mAlign = (eTextAlignment)(taTop | taCenter);
else if (Text == "right") mAlign = (eTextAlignment)(taTop | taRight);
else if (Text == "left") mAlign = (eTextAlignment)(taTop | taLeft);
@@ -88,38 +95,48 @@ bool cxObject::ParseAlignment(const std::string &Text) {
return true;
}
-bool cxObject::ParseFontFace(const std::string &Text) {
- /*for (int i = 0; i < eDvbFontSize; ++i) {
- if (FontNames[i] == Text) {
- mFont = cFont::GetFont((eDvbFont)i);
- return true;
- }
- }*/
-
+bool cxObject::ParseFontFace(const std::string &Text)
+{
int size = 0, pos;
std::string face = Text;
if ((pos = face.find(':')) != -1) {
size = atoi(face.substr(pos + 1).c_str());
face.erase(pos);
}
- Dprintf("trying: %s %d\n", ((std::string)SkinPath() + "/fonts/" + face).c_str(), size);
- if ((mFont = cText2SkinFont::Load(SkinPath() + "/fonts", face, size)) != NULL)
- return true;
- else if ((mFont = cText2SkinFont::Load(SkinPath() + "/" + mSkin->Name(), face, size)) != NULL)
- return true;
- return false;
-}
-const std::string &cxObject::TypeName(void) const {
+ mFontFace = face;
+ mFontSize = size;
+ return true;
+}
+
+const std::string &cxObject::TypeName(void) const
+{
return ObjectNames[mType];
}
-txPoint cxObject::Pos(void) const {
+const cFont *cxObject::Font(void) const
+{
+ const cFont *font;
+
+ Dprintf("trying: %s %d\n", (SkinPath() + "/fonts/" + mFontFace).c_str(), mFontSize);
+ if ((font = cText2SkinFont::Load(SkinPath() + "/fonts", mFontFace, mFontSize)) != NULL)
+ return font;
+
+ Dprintf("trying: %s %d\n", (SkinPath() + "/" + mSkin->Name() + "/" + mFontFace).c_str(), mFontSize);
+ if ((font = cText2SkinFont::Load(SkinPath() + "/" + mSkin->Name(), mFontFace, mFontSize)) != NULL)
+ return font;
+
+ return cFont::GetFont(fontOsd);
+}
+
+txPoint cxObject::Pos(void) const
+{
return txPoint(mSkin->BaseOffset().x + (mPos1.x < 0 ? Skin()->BaseSize().w + mPos1.x : mPos1.x),
mSkin->BaseOffset().y + (mPos1.y < 0 ? Skin()->BaseSize().h + mPos1.y : mPos1.y));
}
-txSize cxObject::Size(void) const {
+txSize cxObject::Size(void) const
+{
txPoint p1(mSkin->BaseOffset().x + (mPos1.x < 0 ? Skin()->BaseSize().w + mPos1.x : mPos1.x),
mSkin->BaseOffset().y + (mPos1.y < 0 ? Skin()->BaseSize().h + mPos1.y : mPos1.y));
txPoint p2(mSkin->BaseOffset().x + (mPos2.x < 0 ? Skin()->BaseSize().w + mPos2.x : mPos2.x),
diff --git a/xml/object.h b/xml/object.h
index 8b134a9..41a626a 100644
--- a/xml/object.h
+++ b/xml/object.h
@@ -1,5 +1,5 @@
/*
- * $Id: object.h,v 1.4 2004/12/08 17:13:26 lordjaxom Exp $
+ * $Id: object.h,v 1.5 2004/12/14 20:02:31 lordjaxom Exp $
*/
#ifndef VDR_TEXT2SKIN_XML_OBJECT_H
@@ -65,6 +65,7 @@ private:
txPoint mPos1;
txPoint mPos2;
int mAlpha;
+ int mColors;
int mArc;
std::string mFg;
std::string mBg;
@@ -77,7 +78,8 @@ private:
cxFunction *mCondition;
cxString mCurrent;
cxString mTotal;
- const cFont *mFont;
+ std::string mFontFace;
+ int mFontSize;
cxObjects *mObjects; // used for block objects such as <list>
cxDisplay *mDisplay;
cxSkin *mSkin;
@@ -97,19 +99,20 @@ public:
eType Type(void) const { return mType; }
cxFunction *Condition(void) const { return mCondition; }
int Alpha(void) const { return mAlpha; }
+ int Colors(void) const { return mColors; }
eTextAlignment Align(void) const { return mAlign; }
int Arc(void) const { return mArc; }
std::string Path(void) const { return mPath.Evaluate(); }
std::string Text(void) const { return mText.Evaluate(); }
int Current(void) const { return mCurrent.Evaluate(); }
int Total(void) const { return mTotal.Evaluate(); }
- const cFont *Font(void) const { return mFont; }
cxDisplay *Display(void) const { return mDisplay; }
cxSkin *Skin(void) const { return mSkin; }
const std::string &TypeName(void) const;
txPoint Pos(void) const;
txSize Size(void) const;
+ const cFont *Font(void) const;
const tColor *Fg(void) const;
const tColor *Bg(void) const;
const tColor *Mark(void) const;
diff --git a/xml/parser.c b/xml/parser.c
index 8842d19..62cc69c 100644
--- a/xml/parser.c
+++ b/xml/parser.c
@@ -1,5 +1,5 @@
/*
- * $Id: parser.c,v 1.5 2004/12/10 21:46:46 lordjaxom Exp $
+ * $Id: parser.c,v 1.7 2004/12/14 20:02:31 lordjaxom Exp $
*/
#include "xml/parser.h"
@@ -32,7 +32,6 @@
#define ATTRIB_OPT_STRING(_attr,_target) \
if (attrs.find(_attr) != attrs.end()) { \
_target = attrs[_attr]; \
- attrs.erase(_attr); \
}
#define ATTRIB_MAN_STRING(_attr,_target) \
@@ -53,9 +52,8 @@
return false; \
} else \
_target = _l; \
- attrs.erase(_attr); \
}
-
+
#define ATTRIB_MAN_NUMBER(_attr,_target) \
ATTRIB_OPT_NUMBER(_attr,_target) \
else { \
@@ -71,7 +69,6 @@
attrs[_attr].c_str(), _attr); \
return false; \
} \
- attrs.erase(_attr); \
}
#define ATTRIB_MAN_FUNC(_attr,_func) \
@@ -140,7 +137,10 @@ bool xStartElem(const std::string &name, std::map<std::string,std::string> &attr
if (name == "image") {
ATTRIB_OPT_NUMBER("x", object->mPos1.x);
ATTRIB_OPT_NUMBER("y", object->mPos1.y);
+ ATTRIB_OPT_NUMBER("x", object->mPos2.x);
+ ATTRIB_OPT_NUMBER("y", object->mPos2.y);
ATTRIB_OPT_NUMBER("alpha", object->mAlpha);
+ ATTRIB_OPT_NUMBER("colors", object->mColors);
ATTRIB_OPT_STRING("color", object->mFg);
ATTRIB_OPT_STRING("bgColor", object->mBg);
ATTRIB_MAN_FUNC ("path", object->mPath.Parse);
diff --git a/xml/string.c b/xml/string.c
index 269aa0f..3748df2 100644
--- a/xml/string.c
+++ b/xml/string.c
@@ -1,5 +1,5 @@
/*
- * $Id: string.c,v 1.5 2004/12/08 17:22:28 lordjaxom Exp $
+ * $Id: string.c,v 1.7 2004/12/14 13:13:10 lordjaxom Exp $
*/
#include "xml/string.h"
@@ -10,7 +10,8 @@ static const char *Tokens[__COUNT_TOKEN__] = {
"DateTime",
// Channel Display
- "ChannelNumber", "ChannelName", "ChannelShortName", "ChannelBouquet", "PresentStartDateTime",
+ "ChannelNumber", "ChannelName", "ChannelShortName", "ChannelBouquet", "ChannelPortal",
+ "ChannelSource", "PresentStartDateTime",
"PresentVPSDateTime", "PresentEndDateTime", "PresentDuration", "PresentProgress",
"PresentTitle", "PresentShortText", "PresentDescription", "FollowingStartDateTime",
"FollowingVPSDateTime", "FollowingEndDateTime", "FollowingDuration",
diff --git a/xml/string.h b/xml/string.h
index 5c89d13..650e7f7 100644
--- a/xml/string.h
+++ b/xml/string.h
@@ -1,5 +1,5 @@
/*
- * $Id: string.h,v 1.5 2004/12/08 18:47:37 lordjaxom Exp $
+ * $Id: string.h,v 1.7 2004/12/14 20:02:31 lordjaxom Exp $
*/
#ifndef VDR_TEXT2SKIN_XML_STRING_H
@@ -17,6 +17,8 @@ enum exToken {
tChannelName,
tChannelShortName,
tChannelBouquet,
+ tChannelPortal,
+ tChannelSource,
// next 8 also in Menu
tPresentStartDateTime,
tPresentVPSDateTime,
@@ -100,6 +102,7 @@ struct txToken {
txToken(void): Index(-1), Tab(-1) {}
txToken(exToken t, uint o, const std::string &a): Type(t), Offset(o), Attrib(a), Index(-1), Tab(-1) {}
+
static std::string Token(const txToken &Token);
};
diff --git a/xml/type.c b/xml/type.c
index 0cb5c9a..f26a036 100644
--- a/xml/type.c
+++ b/xml/type.c
@@ -1,5 +1,5 @@
/*
- * $Id: type.c,v 1.2 2004/12/08 17:13:26 lordjaxom Exp $
+ * $Id: type.c,v 1.3 2004/12/12 20:26:25 lordjaxom Exp $
*/
#include "xml/type.h"
diff --git a/xml/type.h b/xml/type.h
index 14e7cca..1776ddf 100644
--- a/xml/type.h
+++ b/xml/type.h
@@ -1,5 +1,5 @@
/*
- * $Id: type.h,v 1.3 2004/12/08 17:13:26 lordjaxom Exp $
+ * $Id: type.h,v 1.5 2004/12/14 20:02:31 lordjaxom Exp $
*/
#ifndef VDR_TEXT2SKIN_XML_TYPE_H
@@ -22,12 +22,12 @@ private:
int mNumber;
public:
+ cxType(void): mType(boolean), mNumber(0) {}
cxType(const char *String): mType(string), mString(String ?: "") {}
cxType(std::string String): mType(string), mString(String) {}
cxType(int Number): mType(number), mNumber(Number) {}
cxType(time_t Number): mType(number), mNumber(Number) {}
cxType(bool Value): mType(boolean), mNumber(Value ? 1 : 0) {}
- cxType(const cxType &Src): mType(Src.mType), mString(Src.mString), mNumber(Src.mNumber) {}
const std::string &String(void);
int Number(void) const;
diff --git a/xml/xml.c b/xml/xml.c
index ebf7d00..2a239af 100644
--- a/xml/xml.c
+++ b/xml/xml.c
@@ -1,5 +1,5 @@
/*
- * $Id: xml.c,v 1.2 2004/12/06 15:01:02 lordjaxom Exp $
+ * $Id: xml.c,v 1.3 2004/12/12 20:26:25 lordjaxom Exp $
* This module was kindly provided by Clemens Kirchgatterer
*/