Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
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
Show 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()
...
@@ -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
)
void
SkinParser
::
handleBeginElement
(
const
string
&
rName
,
AttrList_t
&
attr
)
{
{
#define CheckDefault( a, b ) \
#define RequireAttr( attr, name, a ) \
if( attr.find(a) == attr.end() ) attr[strdup(a)] = strdup(b);
if( MissingAttr( attr, name, a ) ) return;
#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; \
}
if
(
rName
==
"Include"
)
if
(
rName
==
"Include"
)
{
{
Require
Default
(
"file"
);
Require
Attr
(
attr
,
rName
,
"file"
);
OSFactory
*
pFactory
=
OSFactory
::
instance
(
getIntf
()
);
OSFactory
*
pFactory
=
OSFactory
::
instance
(
getIntf
()
);
string
fullPath
=
m_path
+
pFactory
->
getDirSeparator
()
+
attr
[
"file"
];
string
fullPath
=
m_path
+
pFactory
->
getDirSeparator
()
+
attr
[
"file"
];
...
@@ -80,8 +84,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -80,8 +84,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"IniFile"
)
else
if
(
rName
==
"IniFile"
)
{
{
Require
Default
(
"id"
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Default
(
"file"
);
Require
Attr
(
attr
,
rName
,
"file"
);
const
BuilderData
::
IniFile
iniFile
(
uniqueId
(
attr
[
"id"
]
),
const
BuilderData
::
IniFile
iniFile
(
uniqueId
(
attr
[
"id"
]
),
attr
[
"file"
]
);
attr
[
"file"
]
);
...
@@ -90,12 +94,12 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -90,12 +94,12 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Anchor"
)
else
if
(
rName
==
"Anchor"
)
{
{
Require
Default
(
"priority"
);
Require
Attr
(
attr
,
rName
,
"priority"
);
CheckDefault
(
"x"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
CheckDefault
(
"points"
,
"(0,0)"
);
DefaultAttr
(
attr
,
"points"
,
"(0,0)"
);
CheckDefault
(
"range"
,
"10"
);
DefaultAttr
(
attr
,
"range"
,
"10"
);
const
BuilderData
::
Anchor
anchor
(
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
const
BuilderData
::
Anchor
anchor
(
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
attr
[
"lefttop"
],
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
attr
[
"lefttop"
],
...
@@ -106,11 +110,11 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -106,11 +110,11 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Bitmap"
)
else
if
(
rName
==
"Bitmap"
)
{
{
Require
Default
(
"id"
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Default
(
"file"
);
Require
Attr
(
attr
,
rName
,
"file"
);
Require
Default
(
"alphacolor"
);
Require
Attr
(
attr
,
rName
,
"alphacolor"
);
CheckDefault
(
"nbframes"
,
"1"
);
DefaultAttr
(
attr
,
"nbframes"
,
"1"
);
CheckDefault
(
"fps"
,
"4"
);
DefaultAttr
(
attr
,
"fps"
,
"4"
);
m_curBitmapId
=
uniqueId
(
attr
[
"id"
]
);
m_curBitmapId
=
uniqueId
(
attr
[
"id"
]
);
const
BuilderData
::
Bitmap
bitmap
(
m_curBitmapId
,
const
BuilderData
::
Bitmap
bitmap
(
m_curBitmapId
,
...
@@ -121,13 +125,13 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -121,13 +125,13 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"SubBitmap"
)
else
if
(
rName
==
"SubBitmap"
)
{
{
Require
Default
(
"id"
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Default
(
"x"
);
Require
Attr
(
attr
,
rName
,
"x"
);
Require
Default
(
"y"
);
Require
Attr
(
attr
,
rName
,
"y"
);
Require
Default
(
"width"
);
Require
Attr
(
attr
,
rName
,
"width"
);
Require
Default
(
"height"
);
Require
Attr
(
attr
,
rName
,
"height"
);
CheckDefault
(
"nbframes"
,
"1"
);
DefaultAttr
(
attr
,
"nbframes"
,
"1"
);
CheckDefault
(
"fps"
,
"4"
);
DefaultAttr
(
attr
,
"fps"
,
"4"
);
const
BuilderData
::
SubBitmap
bitmap
(
uniqueId
(
attr
[
"id"
]
),
const
BuilderData
::
SubBitmap
bitmap
(
uniqueId
(
attr
[
"id"
]
),
m_curBitmapId
,
atoi
(
attr
[
"x"
]
),
atoi
(
attr
[
"y"
]
),
m_curBitmapId
,
atoi
(
attr
[
"x"
]
),
atoi
(
attr
[
"y"
]
),
...
@@ -138,9 +142,9 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -138,9 +142,9 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"BitmapFont"
)
else
if
(
rName
==
"BitmapFont"
)
{
{
Require
Default
(
"id"
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Default
(
"file"
);
Require
Attr
(
attr
,
rName
,
"file"
);
CheckDefault
(
"type"
,
"digits"
);
DefaultAttr
(
attr
,
"type"
,
"digits"
);
const
BuilderData
::
BitmapFont
font
(
uniqueId
(
attr
[
"id"
]
),
const
BuilderData
::
BitmapFont
font
(
uniqueId
(
attr
[
"id"
]
),
attr
[
"file"
],
attr
[
"type"
]
);
attr
[
"file"
],
attr
[
"type"
]
);
...
@@ -149,7 +153,7 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -149,7 +153,7 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"PopupMenu"
)
else
if
(
rName
==
"PopupMenu"
)
{
{
Require
Default
(
"id"
);
Require
Attr
(
attr
,
rName
,
"id"
);
m_popupPosList
.
push_back
(
0
);
m_popupPosList
.
push_back
(
0
);
m_curPopupId
=
uniqueId
(
attr
[
"id"
]
);
m_curPopupId
=
uniqueId
(
attr
[
"id"
]
);
...
@@ -159,8 +163,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -159,8 +163,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"MenuItem"
)
else
if
(
rName
==
"MenuItem"
)
{
{
Require
Default
(
"label"
);
Require
Attr
(
attr
,
rName
,
"label"
);
CheckDefault
(
"action"
,
"none"
);
DefaultAttr
(
attr
,
"action"
,
"none"
);
const
BuilderData
::
MenuItem
item
(
attr
[
"label"
],
attr
[
"action"
],
const
BuilderData
::
MenuItem
item
(
attr
[
"label"
],
attr
[
"action"
],
m_popupPosList
.
back
(),
m_popupPosList
.
back
(),
...
@@ -179,20 +183,20 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -179,20 +183,20 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Button"
)
else
if
(
rName
==
"Button"
)
{
{
Require
Default
(
"up"
);
Require
Attr
(
attr
,
rName
,
"up"
);
CheckDefault
(
"id"
,
"none"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
CheckDefault
(
"down"
,
"none"
);
DefaultAttr
(
attr
,
"down"
,
"none"
);
CheckDefault
(
"over"
,
"none"
);
DefaultAttr
(
attr
,
"over"
,
"none"
);
CheckDefault
(
"action"
,
"none"
);
DefaultAttr
(
attr
,
"action"
,
"none"
);
CheckDefault
(
"tooltiptext"
,
""
);
DefaultAttr
(
attr
,
"tooltiptext"
,
""
);
CheckDefault
(
"help"
,
""
);
DefaultAttr
(
attr
,
"help"
,
""
);
const
BuilderData
::
Button
button
(
uniqueId
(
attr
[
"id"
]
),
const
BuilderData
::
Button
button
(
uniqueId
(
attr
[
"id"
]
),
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
...
@@ -208,26 +212,26 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -208,26 +212,26 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Checkbox"
)
else
if
(
rName
==
"Checkbox"
)
{
{
Require
Default
(
"up1"
);
Require
Attr
(
attr
,
rName
,
"up1"
);
Require
Default
(
"up2"
);
Require
Attr
(
attr
,
rName
,
"up2"
);
Require
Default
(
"state"
);
Require
Attr
(
attr
,
rName
,
"state"
);
CheckDefault
(
"id"
,
"none"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
CheckDefault
(
"down1"
,
"none"
);
DefaultAttr
(
attr
,
"down1"
,
"none"
);
CheckDefault
(
"over1"
,
"none"
);
DefaultAttr
(
attr
,
"over1"
,
"none"
);
CheckDefault
(
"down2"
,
"none"
);
DefaultAttr
(
attr
,
"down2"
,
"none"
);
CheckDefault
(
"over2"
,
"none"
);
DefaultAttr
(
attr
,
"over2"
,
"none"
);
CheckDefault
(
"action1"
,
"none"
);
DefaultAttr
(
attr
,
"action1"
,
"none"
);
CheckDefault
(
"action2"
,
"none"
);
DefaultAttr
(
attr
,
"action2"
,
"none"
);
CheckDefault
(
"tooltiptext1"
,
""
);
DefaultAttr
(
attr
,
"tooltiptext1"
,
""
);
CheckDefault
(
"tooltiptext2"
,
""
);
DefaultAttr
(
attr
,
"tooltiptext2"
,
""
);
CheckDefault
(
"help"
,
""
);
DefaultAttr
(
attr
,
"help"
,
""
);
const
BuilderData
::
Checkbox
checkbox
(
uniqueId
(
attr
[
"id"
]
),
const
BuilderData
::
Checkbox
checkbox
(
uniqueId
(
attr
[
"id"
]
),
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
...
@@ -245,9 +249,9 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -245,9 +249,9 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Font"
)
else
if
(
rName
==
"Font"
)
{
{
Require
Default
(
"id"
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Default
(
"file"
);
Require
Attr
(
attr
,
rName
,
"file"
);
CheckDefault
(
"size"
,
"12"
);
DefaultAttr
(
attr
,
"size"
,
"12"
);
const
BuilderData
::
Font
fontData
(
uniqueId
(
attr
[
"id"
]
),
const
BuilderData
::
Font
fontData
(
uniqueId
(
attr
[
"id"
]
),
attr
[
"file"
],
atoi
(
attr
[
"size"
]
)
);
attr
[
"file"
],
atoi
(
attr
[
"size"
]
)
);
...
@@ -256,8 +260,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -256,8 +260,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Group"
)
else
if
(
rName
==
"Group"
)
{
{
CheckDefault
(
"x"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
m_xOffset
+=
atoi
(
attr
[
"x"
]
);
m_xOffset
+=
atoi
(
attr
[
"x"
]
);
m_yOffset
+=
atoi
(
attr
[
"y"
]
);
m_yOffset
+=
atoi
(
attr
[
"y"
]
);
...
@@ -267,19 +271,19 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -267,19 +271,19 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Image"
)
else
if
(
rName
==
"Image"
)
{
{
Require
Default
(
"image"
);
Require
Attr
(
attr
,
rName
,
"image"
);
CheckDefault
(
"id"
,
"none"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
CheckDefault
(
"action"
,
"none"
);
DefaultAttr
(
attr
,
"action"
,
"none"
);
CheckDefault
(
"action2"
,
"none"
);
DefaultAttr
(
attr
,
"action2"
,
"none"
);
CheckDefault
(
"resize"
,
"mosaic"
);
DefaultAttr
(
attr
,
"resize"
,
"mosaic"
);
CheckDefault
(
"help"
,
""
);
DefaultAttr
(
attr
,
"help"
,
""
);
const
BuilderData
::
Image
imageData
(
uniqueId
(
attr
[
"id"
]
),
const
BuilderData
::
Image
imageData
(
uniqueId
(
attr
[
"id"
]
),
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
...
@@ -295,13 +299,13 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -295,13 +299,13 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Layout"
)
else
if
(
rName
==
"Layout"
)
{
{
Require
Default
(
"width"
);
Require
Attr
(
attr
,
rName
,
"width"
);
Require
Default
(
"height"
);
Require
Attr
(
attr
,
rName
,
"height"
);
CheckDefault
(
"id"
,
"none"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
CheckDefault
(
"minwidth"
,
"-1"
);
DefaultAttr
(
attr
,
"minwidth"
,
"-1"
);
CheckDefault
(
"maxwidth"
,
"-1"
);
DefaultAttr
(
attr
,
"maxwidth"
,
"-1"
);
CheckDefault
(
"minheight"
,
"-1"
);
DefaultAttr
(
attr
,
"minheight"
,
"-1"
);
CheckDefault
(
"maxheight"
,
"-1"
);
DefaultAttr
(
attr
,
"maxheight"
,
"-1"
);
m_curLayoutId
=
uniqueId
(
attr
[
"id"
]
);
m_curLayoutId
=
uniqueId
(
attr
[
"id"
]
);
const
BuilderData
::
Layout
layout
(
m_curLayoutId
,
atoi
(
attr
[
"width"
]
),
const
BuilderData
::
Layout
layout
(
m_curLayoutId
,
atoi
(
attr
[
"width"
]
),
...
@@ -314,14 +318,14 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -314,14 +318,14 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Panel"
)
else
if
(
rName
==
"Panel"
)
{
{
CheckDefault
(
"x"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
Require
Default
(
"width"
);
Require
Attr
(
attr
,
rName
,
"width"
);
Require
Default
(
"height"
);
Require
Attr
(
attr
,
rName
,
"height"
);
string
panelId
=
uniqueId
(
"none"
);
string
panelId
=
uniqueId
(
"none"
);
const
BuilderData
::
Panel
panel
(
panelId
,
const
BuilderData
::
Panel
panel
(
panelId
,
...
@@ -339,28 +343,28 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -339,28 +343,28 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Playlist"
)
else
if
(
rName
==
"Playlist"
)
{
{
Require
Default
(
"id"
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Default
(
"font"
);
Require
Attr
(
attr
,
rName
,
"font"
);
CheckDefault
(
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
CheckDefault
(
"flat"
,
"true"
);
// Only difference here
DefaultAttr
(
attr
,
"flat"
,
"true"
);
// Only difference here
CheckDefault
(
"x"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
CheckDefault
(
"width"
,
"0"
);
DefaultAttr
(
attr
,
"width"
,
"0"
);
CheckDefault
(
"height"
,
"0"
);
DefaultAttr
(
attr
,
"height"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
CheckDefault
(
"bgimage"
,
"none"
);
DefaultAttr
(
attr
,
"bgimage"
,
"none"
);
CheckDefault
(
"itemimage"
,
"none"
);
DefaultAttr
(
attr
,
"itemimage"
,
"none"
);
CheckDefault
(
"openimage"
,
"none"
);
DefaultAttr
(
attr
,
"openimage"
,
"none"
);
CheckDefault
(
"closedimage"
,
"none"
);
DefaultAttr
(
attr
,
"closedimage"
,
"none"
);
CheckDefault
(
"fgcolor"
,
"#000000"
);
DefaultAttr
(
attr
,
"fgcolor"
,
"#000000"
);
CheckDefault
(
"playcolor"
,
"#FF0000"
);
DefaultAttr
(
attr
,
"playcolor"
,
"#FF0000"
);
CheckDefault
(
"bgcolor1"
,
"#FFFFFF"
);
DefaultAttr
(
attr
,
"bgcolor1"
,
"#FFFFFF"
);
CheckDefault
(
"bgcolor2"
,
"#FFFFFF"
);
DefaultAttr
(
attr
,
"bgcolor2"
,
"#FFFFFF"
);
CheckDefault
(
"selcolor"
,
"#0000FF"
);
DefaultAttr
(
attr
,
"selcolor"
,
"#0000FF"
);
CheckDefault
(
"help"
,
""
);
DefaultAttr
(
attr
,
"help"
,
""
);
m_curTreeId
=
uniqueId
(
attr
[
"id"
]
);
m_curTreeId
=
uniqueId
(
attr
[
"id"
]
);
const
BuilderData
::
Tree
treeData
(
m_curTreeId
,
atoi
(
attr
[
"x"
]
)
+
const
BuilderData
::
Tree
treeData
(
m_curTreeId
,
atoi
(
attr
[
"x"
]
)
+
...
@@ -384,28 +388,28 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -384,28 +388,28 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
}
}
else
if
(
rName
==
"Playtree"
)
else
if
(
rName
==
"Playtree"
)
{
{
Require
Default
(
"id"
);
Require
Attr
(
attr
,
rName
,
"id"
);
Require
Default
(
"font"
);
Require
Attr
(
attr
,
rName
,
"font"
);
CheckDefault
(
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
CheckDefault
(
"flat"
,
"false"
);
DefaultAttr
(
attr
,
"flat"
,
"false"
);
CheckDefault
(
"x"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
CheckDefault
(
"width"
,
"0"
);
DefaultAttr
(
attr
,
"width"
,
"0"
);
CheckDefault
(
"height"
,
"0"
);
DefaultAttr
(
attr
,
"height"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
CheckDefault
(
"bgimage"
,
"none"
);
DefaultAttr
(
attr
,
"bgimage"
,
"none"
);
CheckDefault
(
"itemimage"
,
"none"
);
DefaultAttr
(
attr
,
"itemimage"
,
"none"
);
CheckDefault
(
"openimage"
,
"none"
);
DefaultAttr
(
attr
,
"openimage"
,
"none"
);
CheckDefault
(
"closedimage"
,
"none"
);
DefaultAttr
(
attr
,
"closedimage"
,
"none"
);
CheckDefault
(
"fgcolor"
,
"#000000"
);
DefaultAttr
(
attr
,
"fgcolor"
,
"#000000"
);
CheckDefault
(
"playcolor"
,
"#FF0000"
);
DefaultAttr
(
attr
,
"playcolor"
,
"#FF0000"
);
CheckDefault
(
"bgcolor1"
,
"#FFFFFF"
);
DefaultAttr
(
attr
,
"bgcolor1"
,
"#FFFFFF"
);
CheckDefault
(
"bgcolor2"
,
"#FFFFFF"
);
DefaultAttr
(
attr
,
"bgcolor2"
,
"#FFFFFF"
);
CheckDefault
(
"selcolor"
,
"#0000FF"
);
DefaultAttr
(
attr
,
"selcolor"
,
"#0000FF"
);
CheckDefault
(
"help"
,
""
);
DefaultAttr
(
attr
,
"help"
,
""
);
m_curTreeId
=
uniqueId
(
attr
[
"id"
]
);
m_curTreeId
=
uniqueId
(
attr
[
"id"
]
);
const
BuilderData
::
Tree
treeData
(
m_curTreeId
,
atoi
(
attr
[
"x"
]
)
+
const
BuilderData
::
Tree
treeData
(
m_curTreeId
,
atoi
(
attr
[
"x"
]
)
+
...
@@ -428,21 +432,21 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -428,21 +432,21 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"RadialSlider"
)
else
if
(
rName
==
"RadialSlider"
)
{
{
Require
Default
(
"sequence"
);
Require
Attr
(
attr
,
rName
,
"sequence"
);
Require
Default
(
"nbimages"
);
Require
Attr
(
attr
,
rName
,
"nbimages"
);
CheckDefault
(
"id"
,
"none"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
CheckDefault
(
"minangle"
,
"0"
);
DefaultAttr
(
attr
,
"minangle"
,
"0"
);
CheckDefault
(
"maxangle"
,
"360"
);
DefaultAttr
(
attr
,
"maxangle"
,
"360"
);
CheckDefault
(
"value"
,
"none"
);
DefaultAttr
(
attr
,
"value"
,
"none"
);
CheckDefault
(
"tooltiptext"
,
""
);
DefaultAttr
(
attr
,
"tooltiptext"
,
""
);
CheckDefault
(
"help"
,
""
);
DefaultAttr
(
attr
,
"help"
,
""
);
const
BuilderData
::
RadialSlider
radial
(
uniqueId
(
attr
[
"id"
]
),
const
BuilderData
::
RadialSlider
radial
(
uniqueId
(
attr
[
"id"
]
),
attr
[
"visible"
],
attr
[
"visible"
],
...
@@ -460,22 +464,22 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -460,22 +464,22 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Slider"
)
else
if
(
rName
==
"Slider"
)
{
{
Require
Default
(
"up"
);
Require
Attr
(
attr
,
rName
,
"up"
);
Require
Default
(
"points"
);
Require
Attr
(
attr
,
rName
,
"points"
);
CheckDefault
(
"id"
,
"none"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
CheckDefault
(
"down"
,
"none"
);
DefaultAttr
(
attr
,
"down"
,
"none"
);
CheckDefault
(
"over"
,
"none"
);
DefaultAttr
(
attr
,
"over"
,
"none"
);
CheckDefault
(
"thickness"
,
"10"
);
DefaultAttr
(
attr
,
"thickness"
,
"10"
);
CheckDefault
(
"value"
,
"none"
);
DefaultAttr
(
attr
,
"value"
,
"none"
);
CheckDefault
(
"tooltiptext"
,
""
);
DefaultAttr
(
attr
,
"tooltiptext"
,
""
);
CheckDefault
(
"help"
,
""
);
DefaultAttr
(
attr
,
"help"
,
""
);
string
newValue
=
attr
[
"value"
];
string
newValue
=
attr
[
"value"
];
if
(
m_curTreeId
!=
""
)
if
(
m_curTreeId
!=
""
)
...
@@ -498,11 +502,11 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -498,11 +502,11 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"SliderBackground"
)
else
if
(
rName
==
"SliderBackground"
)
{
{
Require
Default
(
"image"
);
Require
Attr
(
attr
,
rName
,
"image"
);
CheckDefault
(
"nbhoriz"
,
"1"
);
DefaultAttr
(
attr
,
"nbhoriz"
,
"1"
);
CheckDefault
(
"nbvert"
,
"1"
);
DefaultAttr
(
attr
,
"nbvert"
,
"1"
);
CheckDefault
(
"padhoriz"
,
"0"
);
DefaultAttr
(
attr
,
"padhoriz"
,
"0"
);
CheckDefault
(
"padvert"
,
"0"
);
DefaultAttr
(
attr
,
"padvert"
,
"0"
);
// Retrieve the current slider data
// Retrieve the current slider data
BuilderData
::
Slider
&
slider
=
m_pData
->
m_listSlider
.
back
();
BuilderData
::
Slider
&
slider
=
m_pData
->
m_listSlider
.
back
();
...
@@ -516,21 +520,21 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -516,21 +520,21 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Text"
)
else
if
(
rName
==
"Text"
)
{
{
Require
Default
(
"font"
);
Require
Attr
(
attr
,
rName
,
"font"
);
CheckDefault
(
"id"
,
"none"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
CheckDefault
(
"text"
,
""
);
DefaultAttr
(
attr
,
"text"
,
""
);
CheckDefault
(
"color"
,
"#000000"
);
DefaultAttr
(
attr
,
"color"
,
"#000000"
);
CheckDefault
(
"scrolling"
,
"auto"
);
DefaultAttr
(
attr
,
"scrolling"
,
"auto"
);
CheckDefault
(
"alignment"
,
"left"
);
DefaultAttr
(
attr
,
"alignment"
,
"left"
);
CheckDefault
(
"width"
,
"0"
);
DefaultAttr
(
attr
,
"width"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
CheckDefault
(
"help"
,
""
);
DefaultAttr
(
attr
,
"help"
,
""
);
const
BuilderData
::
Text
textData
(
uniqueId
(
attr
[
"id"
]
),
const
BuilderData
::
Text
textData
(
uniqueId
(
attr
[
"id"
]
),
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
...
@@ -549,11 +553,11 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -549,11 +553,11 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Theme"
)
else
if
(
rName
==
"Theme"
)
{
{
Require
Default
(
"version"
);
Require
Attr
(
attr
,
rName
,
"version"
);
CheckDefault
(
"tooltipfont"
,
"defaultfont"
);
DefaultAttr
(
attr
,
"tooltipfont"
,
"defaultfont"
);
CheckDefault
(
"magnet"
,
"15"
);
DefaultAttr
(
attr
,
"magnet"
,
"15"
);
CheckDefault
(
"alpha"
,
"255"
);
DefaultAttr
(
attr
,
"alpha"
,
"255"
);
CheckDefault
(
"movealpha"
,
"255"
);
DefaultAttr
(
attr
,
"movealpha"
,
"255"
);
// Check the version
// Check the version
if
(
strcmp
(
attr
[
"version"
],
SKINS_DTD_VERSION
)
)
if
(
strcmp
(
attr
[
"version"
],
SKINS_DTD_VERSION
)
)
...
@@ -572,28 +576,28 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -572,28 +576,28 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"ThemeInfo"
)
else
if
(
rName
==
"ThemeInfo"
)
{
{
CheckDefault
(
"name"
,
""
);
DefaultAttr
(
attr
,
"name"
,
""
);
CheckDefault
(
"author"
,
""
);
DefaultAttr
(
attr
,
"author"
,
""
);
CheckDefault
(
"email"
,
""
);
DefaultAttr
(
attr
,
"email"
,
""
);
CheckDefault
(
"website"
,
""
);
DefaultAttr
(
attr
,
"website"
,
""
);
msg_Info
(
getIntf
(),
"skin: %s author: %s"
,
attr
[
"name"
],
msg_Info
(
getIntf
(),
"skin: %s author: %s"
,
attr
[
"name"
],
attr
[
"author"
]
);
attr
[
"author"
]
);
}
}
else
if
(
rName
==
"Video"
)
else
if
(
rName
==
"Video"
)
{
{
CheckDefault
(
"id"
,
"none"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
CheckDefault
(
"width"
,
"0"
);
DefaultAttr
(
attr
,
"width"
,
"0"
);
CheckDefault
(
"height"
,
"0"
);
DefaultAttr
(
attr
,
"height"
,
"0"
);
CheckDefault
(
"lefttop"
,
"lefttop"
);
DefaultAttr
(
attr
,
"lefttop"
,
"lefttop"
);
CheckDefault
(
"rightbottom"
,
"lefttop"
);
DefaultAttr
(
attr
,
"rightbottom"
,
"lefttop"
);
CheckDefault
(
"xkeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"xkeepratio"
,
"false"
);
CheckDefault
(
"ykeepratio"
,
"false"
);
DefaultAttr
(
attr
,
"ykeepratio"
,
"false"
);
CheckDefault
(
"autoresize"
,
"false"
);
DefaultAttr
(
attr
,
"autoresize"
,
"false"
);
CheckDefault
(
"help"
,
""
);
DefaultAttr
(
attr
,
"help"
,
""
);
const
BuilderData
::
Video
videoData
(
uniqueId
(
attr
[
"id"
]
),
const
BuilderData
::
Video
videoData
(
uniqueId
(
attr
[
"id"
]
),
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
...
@@ -610,12 +614,12 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -610,12 +614,12 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
else
if
(
rName
==
"Window"
)
else
if
(
rName
==
"Window"
)
{
{
CheckDefault
(
"id"
,
"none"
);
DefaultAttr
(
attr
,
"id"
,
"none"
);
CheckDefault
(
"visible"
,
"true"
);
DefaultAttr
(
attr
,
"visible"
,
"true"
);
CheckDefault
(
"x"
,
"0"
);
DefaultAttr
(
attr
,
"x"
,
"0"
);
CheckDefault
(
"y"
,
"0"
);
DefaultAttr
(
attr
,
"y"
,
"0"
);
CheckDefault
(
"dragdrop"
,
"true"
);
DefaultAttr
(
attr
,
"dragdrop"
,
"true"
);
CheckDefault
(
"playondrop"
,
"true"
);
DefaultAttr
(
attr
,
"playondrop"
,
"true"
);
m_curWindowId
=
uniqueId
(
attr
[
"id"
]
);
m_curWindowId
=
uniqueId
(
attr
[
"id"
]
);
const
BuilderData
::
Window
window
(
m_curWindowId
,
const
BuilderData
::
Window
window
(
m_curWindowId
,
...
@@ -625,6 +629,7 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
...
@@ -625,6 +629,7 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
convertBoolean
(
attr
[
"playondrop"
]
)
);
convertBoolean
(
attr
[
"playondrop"
]
)
);
m_pData
->
m_listWindow
.
push_back
(
window
);
m_pData
->
m_listWindow
.
push_back
(
window
);
}
}
#undef RequireAttr
}
}
...
...
modules/gui/skins2/parser/skin_parser.hpp
View file @
f500f796
...
@@ -87,6 +87,15 @@ private:
...
@@ -87,6 +87,15 @@ private:
/// Check if the id is unique, and if not generate a new one
/// Check if the id is unique, and if not generate a new one
const
string
uniqueId
(
const
string
&
id
);
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
#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