Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
f500f796
Commit
f500f796
authored
Nov 22, 2009
by
JP Dinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skins2: (Almost entirely) replace another two macros with functions.
parent
82e866f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
239 additions
and
225 deletions
+239
-225
modules/gui/skins2/parser/skin_parser.cpp
modules/gui/skins2/parser/skin_parser.cpp
+230
-225
modules/gui/skins2/parser/skin_parser.hpp
modules/gui/skins2/parser/skin_parser.hpp
+9
-0
No files found.
modules/gui/skins2/parser/skin_parser.cpp
View file @
f500f796
...
...
@@ -52,22 +52,26 @@ SkinParser::~SkinParser()
}
}
inline
bool
SkinParser
::
MissingAttr
(
AttrList_t
&
attr
,
const
string
&
name
,
const
char
*
a
)
{
if
(
attr
.
find
(
a
)
==
attr
.
end
()
)
{
msg_Err
(
getIntf
(),
"bad theme (element: %s, missing attribute: %s)"
,
name
.
c_str
(),
a
);
m_errors
=
true
;
return
true
;
}
return
false
;
}
void
SkinParser
::
handleBeginElement
(
const
string
&
rName
,
AttrList_t
&
attr
)
{
#define CheckDefault( a, b ) \
if( attr.find(a) == attr.end() ) attr[strdup(a)] = strdup(b);
#define RequireDefault( a ) \
if( attr.find(a) == attr.end() ) \
{ \
msg_Err( getIntf(), "bad theme (element: %s, missing attribute: %s)", \
rName.c_str(), a ); \
m_errors = true; return; \
}
#define RequireAttr( attr, name, a ) \
if( MissingAttr( attr, name, a ) ) return;
if
(
rName
==
"Include"
)
{
Require
Default
(
"file"
);
Require
Attr
(
attr
,
rName
,
"file"
);
OSFactory
*
pFactory
=
OSFactory
::
instance
(
getIntf
()
);
string
fullPath
=
m_path
+
pFactory
->
getDirSeparator
()
+
attr
[
"file"
];
...
...
@@ -80,8 +84,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"IniFile"
)
{
Require
Default
(
"id"
);
Require
Default
(
"file"
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Attr
(
attr
,
rName
,
"file"
);
const
BuilderData
::
IniFile
iniFile
(
uniqueId
(
attr
[
"id"
]
),
attr
[
"file"
]
);
...
...
@@ -90,12 +94,12 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Anchor"
)
{
Require
Default
(
"priority"
);
CheckDefault
(
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
CheckDefault
(
"points"
,
"(0,0)"
);
CheckDefault
(
"range"
,
"10"
);
Require
Attr
(
attr
,
rName
,
"priority"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"points"
,
"(0,0)"
);
DefaultAttr
(
attr
,
"range"
,
"10"
);
const
BuilderData
::
Anchor
anchor
(
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
attr
[
"lefttop"
],
...
...
@@ -106,11 +110,11 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Bitmap"
)
{
Require
Default
(
"id"
);
Require
Default
(
"file"
);
Require
Default
(
"alphacolor"
);
CheckDefault
(
"nbframes"
,
"1"
);
CheckDefault
(
"fps"
,
"4"
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Attr
(
attr
,
rName
,
"file"
);
Require
Attr
(
attr
,
rName
,
"alphacolor"
);
DefaultAttr
(
attr
,
"nbframes"
,
"1"
);
DefaultAttr
(
attr
,
"fps"
,
"4"
);
m_curBitmapId
=
uniqueId
(
attr
[
"id"
]
);
const
BuilderData
::
Bitmap
bitmap
(
m_curBitmapId
,
...
...
@@ -121,13 +125,13 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"SubBitmap"
)
{
Require
Default
(
"id"
);
Require
Default
(
"x"
);
Require
Default
(
"y"
);
Require
Default
(
"width"
);
Require
Default
(
"height"
);
CheckDefault
(
"nbframes"
,
"1"
);
CheckDefault
(
"fps"
,
"4"
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Attr
(
attr
,
rName
,
"x"
);
Require
Attr
(
attr
,
rName
,
"y"
);
Require
Attr
(
attr
,
rName
,
"width"
);
Require
Attr
(
attr
,
rName
,
"height"
);
DefaultAttr
(
attr
,
"nbframes"
,
"1"
);
DefaultAttr
(
attr
,
"fps"
,
"4"
);
const
BuilderData
::
SubBitmap
bitmap
(
uniqueId
(
attr
[
"id"
]
),
m_curBitmapId
,
atoi
(
attr
[
"x"
]
),
atoi
(
attr
[
"y"
]
),
...
...
@@ -138,9 +142,9 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"BitmapFont"
)
{
Require
Default
(
"id"
);
Require
Default
(
"file"
);
CheckDefault
(
"type"
,
"digits"
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Attr
(
attr
,
rName
,
"file"
);
DefaultAttr
(
attr
,
"type"
,
"digits"
);
const
BuilderData
::
BitmapFont
font
(
uniqueId
(
attr
[
"id"
]
),
attr
[
"file"
],
attr
[
"type"
]
);
...
...
@@ -149,7 +153,7 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"PopupMenu"
)
{
Require
Default
(
"id"
);
Require
Attr
(
attr
,
rName
,
"id"
);
m_popupPosList
.
push_back
(
0
);
m_curPopupId
=
uniqueId
(
attr
[
"id"
]
);
...
...
@@ -159,8 +163,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"MenuItem"
)
{
Require
Default
(
"label"
);
CheckDefault
(
"action"
,
"none"
);
Require
Attr
(
attr
,
rName
,
"label"
);
DefaultAttr
(
attr
,
"action"
,
"none"
);
const
BuilderData
::
MenuItem
item
(
attr
[
"label"
],
attr
[
"action"
],
m_popupPosList
.
back
(),
...
...
@@ -179,20 +183,20 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Button"
)
{
Require
Default
(
"up"
);
CheckDefault
(
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
CheckDefault
(
"down"
,
"none"
);
CheckDefault
(
"over"
,
"none"
);
CheckDefault
(
"action"
,
"none"
);
CheckDefault
(
"tooltiptext"
,
""
);
CheckDefault
(
"help"
,
""
);
Require
Attr
(
attr
,
rName
,
"up"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"down"
,
"none"
);
DefaultAttr
(
attr
,
"over"
,
"none"
);
DefaultAttr
(
attr
,
"action"
,
"none"
);
DefaultAttr
(
attr
,
"tooltiptext"
,
""
);
DefaultAttr
(
attr
,
"help"
,
""
);
const
BuilderData
::
Button
button
(
uniqueId
(
attr
[
"id"
]
),
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
...
...
@@ -208,26 +212,26 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Checkbox"
)
{
Require
Default
(
"up1"
);
Require
Default
(
"up2"
);
Require
Default
(
"state"
);
CheckDefault
(
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
CheckDefault
(
"down1"
,
"none"
);
CheckDefault
(
"over1"
,
"none"
);
CheckDefault
(
"down2"
,
"none"
);
CheckDefault
(
"over2"
,
"none"
);
CheckDefault
(
"action1"
,
"none"
);
CheckDefault
(
"action2"
,
"none"
);
CheckDefault
(
"tooltiptext1"
,
""
);
CheckDefault
(
"tooltiptext2"
,
""
);
CheckDefault
(
"help"
,
""
);
Require
Attr
(
attr
,
rName
,
"up1"
);
Require
Attr
(
attr
,
rName
,
"up2"
);
Require
Attr
(
attr
,
rName
,
"state"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"down1"
,
"none"
);
DefaultAttr
(
attr
,
"over1"
,
"none"
);
DefaultAttr
(
attr
,
"down2"
,
"none"
);
DefaultAttr
(
attr
,
"over2"
,
"none"
);
DefaultAttr
(
attr
,
"action1"
,
"none"
);
DefaultAttr
(
attr
,
"action2"
,
"none"
);
DefaultAttr
(
attr
,
"tooltiptext1"
,
""
);
DefaultAttr
(
attr
,
"tooltiptext2"
,
""
);
DefaultAttr
(
attr
,
"help"
,
""
);
const
BuilderData
::
Checkbox
checkbox
(
uniqueId
(
attr
[
"id"
]
),
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
...
...
@@ -245,9 +249,9 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Font"
)
{
Require
Default
(
"id"
);
Require
Default
(
"file"
);
CheckDefault
(
"size"
,
"12"
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Attr
(
attr
,
rName
,
"file"
);
DefaultAttr
(
attr
,
"size"
,
"12"
);
const
BuilderData
::
Font
fontData
(
uniqueId
(
attr
[
"id"
]
),
attr
[
"file"
],
atoi
(
attr
[
"size"
]
)
);
...
...
@@ -256,8 +260,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Group"
)
{
CheckDefault
(
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
m_xOffset
+=
atoi
(
attr
[
"x"
]
);
m_yOffset
+=
atoi
(
attr
[
"y"
]
);
...
...
@@ -267,19 +271,19 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Image"
)
{
Require
Default
(
"image"
);
CheckDefault
(
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
CheckDefault
(
"action"
,
"none"
);
CheckDefault
(
"action2"
,
"none"
);
CheckDefault
(
"resize"
,
"mosaic"
);
CheckDefault
(
"help"
,
""
);
Require
Attr
(
attr
,
rName
,
"image"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"action"
,
"none"
);
DefaultAttr
(
attr
,
"action2"
,
"none"
);
DefaultAttr
(
attr
,
"resize"
,
"mosaic"
);
DefaultAttr
(
attr
,
"help"
,
""
);
const
BuilderData
::
Image
imageData
(
uniqueId
(
attr
[
"id"
]
),
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
...
...
@@ -295,13 +299,13 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Layout"
)
{
Require
Default
(
"width"
);
Require
Default
(
"height"
);
CheckDefault
(
"id"
,
"none"
);
CheckDefault
(
"minwidth"
,
"-1"
);
CheckDefault
(
"maxwidth"
,
"-1"
);
CheckDefault
(
"minheight"
,
"-1"
);
CheckDefault
(
"maxheight"
,
"-1"
);
Require
Attr
(
attr
,
rName
,
"width"
);
Require
Attr
(
attr
,
rName
,
"height"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
DefaultAttr
(
attr
,
"minwidth"
,
"-1"
);
DefaultAttr
(
attr
,
"maxwidth"
,
"-1"
);
DefaultAttr
(
attr
,
"minheight"
,
"-1"
);
DefaultAttr
(
attr
,
"maxheight"
,
"-1"
);
m_curLayoutId
=
uniqueId
(
attr
[
"id"
]
);
const
BuilderData
::
Layout
layout
(
m_curLayoutId
,
atoi
(
attr
[
"width"
]
),
...
...
@@ -314,14 +318,14 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Panel"
)
{
CheckDefault
(
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
Require
Default
(
"width"
);
Require
Default
(
"height"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
Require
Attr
(
attr
,
rName
,
"width"
);
Require
Attr
(
attr
,
rName
,
"height"
);
string
panelId
=
uniqueId
(
"none"
);
const
BuilderData
::
Panel
panel
(
panelId
,
...
...
@@ -339,28 +343,28 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Playlist"
)
{
Require
Default
(
"id"
);
Require
Default
(
"font"
);
CheckDefault
(
"visible"
,
"true"
);
CheckDefault
(
"flat"
,
"true"
);
// Only difference here
CheckDefault
(
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
CheckDefault
(
"width"
,
"0"
);
CheckDefault
(
"height"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
CheckDefault
(
"bgimage"
,
"none"
);
CheckDefault
(
"itemimage"
,
"none"
);
CheckDefault
(
"openimage"
,
"none"
);
CheckDefault
(
"closedimage"
,
"none"
);
CheckDefault
(
"fgcolor"
,
"#000000"
);
CheckDefault
(
"playcolor"
,
"#FF0000"
);
CheckDefault
(
"bgcolor1"
,
"#FFFFFF"
);
CheckDefault
(
"bgcolor2"
,
"#FFFFFF"
);
CheckDefault
(
"selcolor"
,
"#0000FF"
);
CheckDefault
(
"help"
,
""
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Attr
(
attr
,
rName
,
"font"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"flat"
,
"true"
);
// Only difference here
DefaultAttr
(
attr
,
"x"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
DefaultAttr
(
attr
,
"width"
,
"0"
);
DefaultAttr
(
attr
,
"height"
,
"0"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"bgimage"
,
"none"
);
DefaultAttr
(
attr
,
"itemimage"
,
"none"
);
DefaultAttr
(
attr
,
"openimage"
,
"none"
);
DefaultAttr
(
attr
,
"closedimage"
,
"none"
);
DefaultAttr
(
attr
,
"fgcolor"
,
"#000000"
);
DefaultAttr
(
attr
,
"playcolor"
,
"#FF0000"
);
DefaultAttr
(
attr
,
"bgcolor1"
,
"#FFFFFF"
);
DefaultAttr
(
attr
,
"bgcolor2"
,
"#FFFFFF"
);
DefaultAttr
(
attr
,
"selcolor"
,
"#0000FF"
);
DefaultAttr
(
attr
,
"help"
,
""
);
m_curTreeId
=
uniqueId
(
attr
[
"id"
]
);
const
BuilderData
::
Tree
treeData
(
m_curTreeId
,
atoi
(
attr
[
"x"
]
)
+
...
...
@@ -384,28 +388,28 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
}
else
if
(
rName
==
"Playtree"
)
{
Require
Default
(
"id"
);
Require
Default
(
"font"
);
CheckDefault
(
"visible"
,
"true"
);
CheckDefault
(
"flat"
,
"false"
);
CheckDefault
(
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
CheckDefault
(
"width"
,
"0"
);
CheckDefault
(
"height"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
CheckDefault
(
"bgimage"
,
"none"
);
CheckDefault
(
"itemimage"
,
"none"
);
CheckDefault
(
"openimage"
,
"none"
);
CheckDefault
(
"closedimage"
,
"none"
);
CheckDefault
(
"fgcolor"
,
"#000000"
);
CheckDefault
(
"playcolor"
,
"#FF0000"
);
CheckDefault
(
"bgcolor1"
,
"#FFFFFF"
);
CheckDefault
(
"bgcolor2"
,
"#FFFFFF"
);
CheckDefault
(
"selcolor"
,
"#0000FF"
);
CheckDefault
(
"help"
,
""
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Attr
(
attr
,
rName
,
"font"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"flat"
,
"false"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
DefaultAttr
(
attr
,
"width"
,
"0"
);
DefaultAttr
(
attr
,
"height"
,
"0"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"bgimage"
,
"none"
);
DefaultAttr
(
attr
,
"itemimage"
,
"none"
);
DefaultAttr
(
attr
,
"openimage"
,
"none"
);
DefaultAttr
(
attr
,
"closedimage"
,
"none"
);
DefaultAttr
(
attr
,
"fgcolor"
,
"#000000"
);
DefaultAttr
(
attr
,
"playcolor"
,
"#FF0000"
);
DefaultAttr
(
attr
,
"bgcolor1"
,
"#FFFFFF"
);
DefaultAttr
(
attr
,
"bgcolor2"
,
"#FFFFFF"
);
DefaultAttr
(
attr
,
"selcolor"
,
"#0000FF"
);
DefaultAttr
(
attr
,
"help"
,
""
);
m_curTreeId
=
uniqueId
(
attr
[
"id"
]
);
const
BuilderData
::
Tree
treeData
(
m_curTreeId
,
atoi
(
attr
[
"x"
]
)
+
...
...
@@ -428,21 +432,21 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"RadialSlider"
)
{
Require
Default
(
"sequence"
);
Require
Default
(
"nbimages"
);
CheckDefault
(
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
CheckDefault
(
"minangle"
,
"0"
);
CheckDefault
(
"maxangle"
,
"360"
);
CheckDefault
(
"value"
,
"none"
);
CheckDefault
(
"tooltiptext"
,
""
);
CheckDefault
(
"help"
,
""
);
Require
Attr
(
attr
,
rName
,
"sequence"
);
Require
Attr
(
attr
,
rName
,
"nbimages"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"minangle"
,
"0"
);
DefaultAttr
(
attr
,
"maxangle"
,
"360"
);
DefaultAttr
(
attr
,
"value"
,
"none"
);
DefaultAttr
(
attr
,
"tooltiptext"
,
""
);
DefaultAttr
(
attr
,
"help"
,
""
);
const
BuilderData
::
RadialSlider
radial
(
uniqueId
(
attr
[
"id"
]
),
attr
[
"visible"
],
...
...
@@ -460,22 +464,22 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Slider"
)
{
Require
Default
(
"up"
);
Require
Default
(
"points"
);
CheckDefault
(
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
CheckDefault
(
"down"
,
"none"
);
CheckDefault
(
"over"
,
"none"
);
CheckDefault
(
"thickness"
,
"10"
);
CheckDefault
(
"value"
,
"none"
);
CheckDefault
(
"tooltiptext"
,
""
);
CheckDefault
(
"help"
,
""
);
Require
Attr
(
attr
,
rName
,
"up"
);
Require
Attr
(
attr
,
rName
,
"points"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"down"
,
"none"
);
DefaultAttr
(
attr
,
"over"
,
"none"
);
DefaultAttr
(
attr
,
"thickness"
,
"10"
);
DefaultAttr
(
attr
,
"value"
,
"none"
);
DefaultAttr
(
attr
,
"tooltiptext"
,
""
);
DefaultAttr
(
attr
,
"help"
,
""
);
string
newValue
=
attr
[
"value"
];
if
(
m_curTreeId
!=
""
)
...
...
@@ -498,11 +502,11 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"SliderBackground"
)
{
Require
Default
(
"image"
);
CheckDefault
(
"nbhoriz"
,
"1"
);
CheckDefault
(
"nbvert"
,
"1"
);
CheckDefault
(
"padhoriz"
,
"0"
);
CheckDefault
(
"padvert"
,
"0"
);
Require
Attr
(
attr
,
rName
,
"image"
);
DefaultAttr
(
attr
,
"nbhoriz"
,
"1"
);
DefaultAttr
(
attr
,
"nbvert"
,
"1"
);
DefaultAttr
(
attr
,
"padhoriz"
,
"0"
);
DefaultAttr
(
attr
,
"padvert"
,
"0"
);
// Retrieve the current slider data
BuilderData
::
Slider
&
slider
=
m_pData
->
m_listSlider
.
back
();
...
...
@@ -516,21 +520,21 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Text"
)
{
Require
Default
(
"font"
);
CheckDefault
(
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
CheckDefault
(
"text"
,
""
);
CheckDefault
(
"color"
,
"#000000"
);
CheckDefault
(
"scrolling"
,
"auto"
);
CheckDefault
(
"alignment"
,
"left"
);
CheckDefault
(
"width"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
CheckDefault
(
"help"
,
""
);
Require
Attr
(
attr
,
rName
,
"font"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
DefaultAttr
(
attr
,
"text"
,
""
);
DefaultAttr
(
attr
,
"color"
,
"#000000"
);
DefaultAttr
(
attr
,
"scrolling"
,
"auto"
);
DefaultAttr
(
attr
,
"alignment"
,
"left"
);
DefaultAttr
(
attr
,
"width"
,
"0"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"help"
,
""
);
const
BuilderData
::
Text
textData
(
uniqueId
(
attr
[
"id"
]
),
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
...
...
@@ -549,11 +553,11 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Theme"
)
{
Require
Default
(
"version"
);
CheckDefault
(
"tooltipfont"
,
"defaultfont"
);
CheckDefault
(
"magnet"
,
"15"
);
CheckDefault
(
"alpha"
,
"255"
);
CheckDefault
(
"movealpha"
,
"255"
);
Require
Attr
(
attr
,
rName
,
"version"
);
DefaultAttr
(
attr
,
"tooltipfont"
,
"defaultfont"
);
DefaultAttr
(
attr
,
"magnet"
,
"15"
);
DefaultAttr
(
attr
,
"alpha"
,
"255"
);
DefaultAttr
(
attr
,
"movealpha"
,
"255"
);
// Check the version
if
(
strcmp
(
attr
[
"version"
],
SKINS_DTD_VERSION
)
)
...
...
@@ -572,28 +576,28 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"ThemeInfo"
)
{
CheckDefault
(
"name"
,
""
);
CheckDefault
(
"author"
,
""
);
CheckDefault
(
"email"
,
""
);
CheckDefault
(
"website"
,
""
);
DefaultAttr
(
attr
,
"name"
,
""
);
DefaultAttr
(
attr
,
"author"
,
""
);
DefaultAttr
(
attr
,
"email"
,
""
);
DefaultAttr
(
attr
,
"website"
,
""
);
msg_Info
(
getIntf
(),
"skin: %s author: %s"
,
attr
[
"name"
],
attr
[
"author"
]
);
}
else
if
(
rName
==
"Video"
)
{
CheckDefault
(
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
CheckDefault
(
"width"
,
"0"
);
CheckDefault
(
"height"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
CheckDefault
(
"autoresize"
,
"false"
);
CheckDefault
(
"help"
,
""
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
DefaultAttr
(
attr
,
"width"
,
"0"
);
DefaultAttr
(
attr
,
"height"
,
"0"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"autoresize"
,
"false"
);
DefaultAttr
(
attr
,
"help"
,
""
);
const
BuilderData
::
Video
videoData
(
uniqueId
(
attr
[
"id"
]
),
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
...
...
@@ -610,12 +614,12 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Window"
)
{
CheckDefault
(
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
CheckDefault
(
"dragdrop"
,
"true"
);
CheckDefault
(
"playondrop"
,
"true"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
DefaultAttr
(
attr
,
"dragdrop"
,
"true"
);
DefaultAttr
(
attr
,
"playondrop"
,
"true"
);
m_curWindowId
=
uniqueId
(
attr
[
"id"
]
);
const
BuilderData
::
Window
window
(
m_curWindowId
,
...
...
@@ -625,6 +629,7 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
convertBoolean
(
attr
[
"playondrop"
]
)
);
m_pData
->
m_listWindow
.
push_back
(
window
);
}
#undef RequireAttr
}
...
...
modules/gui/skins2/parser/skin_parser.hpp
View file @
f500f796
...
...
@@ -87,6 +87,15 @@ private:
/// Check if the id is unique, and if not generate a new one
const
string
uniqueId
(
const
string
&
id
);
/// Helper for handleBeginElement: Provide default attribute if missing.
static
void
DefaultAttr
(
AttrList_t
&
attr
,
const
char
*
a
,
const
char
*
b
)
{
if
(
attr
.
find
(
a
)
==
attr
.
end
()
)
attr
[
strdup
(
a
)]
=
strdup
(
b
);
}
/// Helper for handleBeginElement: Complain if a named attribute is missing.
bool
MissingAttr
(
AttrList_t
&
attr
,
const
string
&
name
,
const
char
*
a
);
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment