1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/*
* $Id: skin.c,v 1.3 2005/01/01 23:44:36 lordjaxom Exp $
*/
#include "xml/skin.h"
#include "i18n.h"
#include <vdr/tools.h>
#include <vdr/config.h>
const std::string ScreenBases[] = { "relative", "absolute" };
cxVersion::cxVersion(int ma, int min):
mMajor(ma),
mMinor(min)
{
}
bool cxVersion::Parse(const std::string &Text)
{
int dot = Text.find(".");
std::string ma(Text, 0, dot), min(Text, dot+1);
char *e = NULL;
const char *t = NULL;
long l=0;
t = ma.c_str();
l = strtol(t, &e, 10);
if (e ==t || *e != '\0') {
return false;
} else {
mMajor = l;
}
t = min.c_str();
l = strtol(t, &e, 10);
if (e ==t || *e != '\0') {
return false;
} else {
mMinor = l;
}
return true;
}
cxSkin::cxSkin(const std::string &Name, cText2SkinI18n *I18n, cText2SkinTheme *Theme):
mName(Name),
mI18n(I18n),
mTheme(Theme)
{
}
void cxSkin::SetBase(eScreenBase Base)
{
if (Base != (eScreenBase)-1)
mBase = Base;
switch (mBase) {
case relative:
mBaseOffset = txPoint(Setup.OSDLeft, Setup.OSDTop);
mBaseSize = txSize(Setup.OSDWidth, Setup.OSDHeight);
break;
case absolute:
mBaseOffset = txPoint(0, 0);
mBaseSize = txSize(720, 576); //XXX
break;
default:
break;
}
}
bool cxSkin::ParseBase(const std::string &Text)
{
int i;
for (i = 0; i < (int)__COUNT_BASE__; ++i) {
if (ScreenBases[i] == Text)
break;
}
if (i < (int)__COUNT_BASE__) {
SetBase((eScreenBase)i);
return true;
}
return false;
}
std::string cxSkin::Translate(const std::string &Text)
{
if (mI18n != NULL)
return mI18n->Translate(Text);
return Text;
}
|