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
524b6573
Commit
524b6573
authored
Apr 17, 2006
by
Cyril Deguet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* agressive backport of [15248]
parent
8f4538a6
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
289 additions
and
52 deletions
+289
-52
modules/gui/skins2/Modules.am
modules/gui/skins2/Modules.am
+2
-0
modules/gui/skins2/parser/builder.cpp
modules/gui/skins2/parser/builder.cpp
+38
-4
modules/gui/skins2/parser/builder.hpp
modules/gui/skins2/parser/builder.hpp
+4
-0
modules/gui/skins2/parser/builder_data.def
modules/gui/skins2/parser/builder_data.def
+3
-2
modules/gui/skins2/parser/builder_data.hpp
modules/gui/skins2/parser/builder_data.hpp
+24
-12
modules/gui/skins2/parser/interpreter.cpp
modules/gui/skins2/parser/interpreter.cpp
+14
-0
modules/gui/skins2/parser/interpreter.hpp
modules/gui/skins2/parser/interpreter.hpp
+3
-0
modules/gui/skins2/parser/skin_parser.cpp
modules/gui/skins2/parser/skin_parser.cpp
+20
-13
modules/gui/skins2/parser/skin_parser.hpp
modules/gui/skins2/parser/skin_parser.hpp
+2
-1
modules/gui/skins2/src/file_bitmap.cpp
modules/gui/skins2/src/file_bitmap.cpp
+0
-2
modules/gui/skins2/src/ini_file.cpp
modules/gui/skins2/src/ini_file.cpp
+81
-0
modules/gui/skins2/src/ini_file.hpp
modules/gui/skins2/src/ini_file.hpp
+49
-0
modules/gui/skins2/src/var_manager.cpp
modules/gui/skins2/src/var_manager.cpp
+12
-0
modules/gui/skins2/src/var_manager.hpp
modules/gui/skins2/src/var_manager.hpp
+8
-0
modules/gui/skins2/utils/var_text.cpp
modules/gui/skins2/utils/var_text.cpp
+18
-16
modules/gui/skins2/utils/var_text.hpp
modules/gui/skins2/utils/var_text.hpp
+3
-0
share/skins2/skin.dtd
share/skins2/skin.dtd
+6
-1
share/skins2/winamp2.xml
share/skins2/winamp2.xml
+2
-1
No files found.
modules/gui/skins2/Modules.am
View file @
524b6573
...
...
@@ -113,6 +113,8 @@ SOURCES_skins2 = \
src/generic_layout.hpp \
src/generic_window.cpp \
src/generic_window.hpp \
src/ini_file.cpp \
src/ini_file.hpp \
src/logger.cpp \
src/logger.hpp \
src/os_factory.cpp \
...
...
modules/gui/skins2/parser/builder.cpp
View file @
524b6573
...
...
@@ -26,6 +26,7 @@
#include "builder.hpp"
#include "builder_data.hpp"
#include "interpreter.hpp"
#include "skin_parser.hpp"
#include "../src/file_bitmap.hpp"
#include "../src/os_factory.hpp"
#include "../src/generic_bitmap.hpp"
...
...
@@ -33,6 +34,7 @@
#include "../src/anchor.hpp"
#include "../src/bitmap_font.hpp"
#include "../src/ft2_font.hpp"
#include "../src/ini_file.hpp"
#include "../src/generic_layout.hpp"
#include "../src/popup.hpp"
#include "../src/theme.hpp"
...
...
@@ -94,6 +96,7 @@ Theme *Builder::build()
// Create everything from the data in the XML
ADD_OBJECTS
(
Theme
);
ADD_OBJECTS
(
IniFile
);
ADD_OBJECTS
(
Bitmap
);
ADD_OBJECTS
(
SubBitmap
);
ADD_OBJECTS
(
BitmapFont
);
...
...
@@ -153,6 +156,14 @@ void Builder::addTheme( const BuilderData::Theme &rData )
}
void
Builder
::
addIniFile
(
const
BuilderData
::
IniFile
&
rData
)
{
// Parse the INI file
IniFile
iniFile
(
getIntf
(),
rData
.
m_id
,
getFilePath
(
rData
.
m_file
)
);
iniFile
.
parseFile
();
}
void
Builder
::
addBitmap
(
const
BuilderData
::
Bitmap
&
rData
)
{
GenericBitmap
*
pBmp
=
...
...
@@ -816,10 +827,16 @@ void Builder::addList( const BuilderData::List &rData )
// XXX check when it is null
VarBool
*
pVisible
=
pInterpreter
->
getVarBool
(
rData
.
m_visible
,
m_pTheme
);
// Get the color values
uint32_t
fgColor
=
getColor
(
rData
.
m_fgColor
);
uint32_t
playColor
=
getColor
(
rData
.
m_playColor
);
uint32_t
bgColor1
=
getColor
(
rData
.
m_bgColor1
);
uint32_t
bgColor2
=
getColor
(
rData
.
m_bgColor2
);
uint32_t
selColor
=
getColor
(
rData
.
m_selColor
);
// Create the list control
CtrlList
*
pList
=
new
CtrlList
(
getIntf
(),
*
pVar
,
*
pFont
,
pBgBmp
,
rData
.
m_fgColor
,
rData
.
m_playColor
,
rData
.
m_bgColor1
,
rData
.
m_bgColor2
,
rData
.
m_selColor
,
fgColor
,
playColor
,
bgColor1
,
bgColor2
,
selColor
,
UString
(
getIntf
(),
rData
.
m_help
.
c_str
()
),
pVisible
);
// Compute the position of the control
...
...
@@ -873,11 +890,17 @@ void Builder::addTree( const BuilderData::Tree &rData )
VarBool
*
pVisible
=
pInterpreter
->
getVarBool
(
rData
.
m_visible
,
m_pTheme
);
VarBool
*
pFlat
=
pInterpreter
->
getVarBool
(
rData
.
m_flat
,
m_pTheme
);
// Get the color values
uint32_t
fgColor
=
getColor
(
rData
.
m_fgColor
);
uint32_t
playColor
=
getColor
(
rData
.
m_playColor
);
uint32_t
bgColor1
=
getColor
(
rData
.
m_bgColor1
);
uint32_t
bgColor2
=
getColor
(
rData
.
m_bgColor2
);
uint32_t
selColor
=
getColor
(
rData
.
m_selColor
);
// Create the list control
CtrlTree
*
pTree
=
new
CtrlTree
(
getIntf
(),
*
pVar
,
*
pFont
,
pBgBmp
,
pItemBmp
,
pOpenBmp
,
pClosedBmp
,
rData
.
m_fgColor
,
rData
.
m_playColor
,
rData
.
m_bgColor1
,
rData
.
m_bgColor2
,
rData
.
m_selColor
,
fgColor
,
playColor
,
bgColor1
,
bgColor2
,
selColor
,
UString
(
getIntf
(),
rData
.
m_help
.
c_str
()
),
pVisible
,
pFlat
);
// Compute the position of the control
...
...
@@ -1069,3 +1092,14 @@ Bezier *Builder::getPoints( const char *pTag ) const
return
new
Bezier
(
getIntf
(),
xBez
,
yBez
);
}
uint32_t
Builder
::
getColor
(
const
string
&
rVal
)
const
{
// Check it the value is a registered constant
Interpreter
*
pInterpreter
=
Interpreter
::
instance
(
getIntf
()
);
string
val
=
pInterpreter
->
getConstant
(
rVal
);
// Convert to an int value
return
SkinParser
::
convertColor
(
val
.
c_str
()
);
}
modules/gui/skins2/parser/builder.hpp
View file @
524b6573
...
...
@@ -65,6 +65,7 @@ class Builder: public SkinObject
Theme
*
m_pTheme
;
void
addTheme
(
const
BuilderData
::
Theme
&
rData
);
void
addIniFile
(
const
BuilderData
::
IniFile
&
rData
);
void
addBitmap
(
const
BuilderData
::
Bitmap
&
rData
);
void
addSubBitmap
(
const
BuilderData
::
SubBitmap
&
rData
);
void
addBitmapFont
(
const
BuilderData
::
BitmapFont
&
rData
);
...
...
@@ -100,6 +101,9 @@ class Builder: public SkinObject
/// Function to parse "points" tags
Bezier
*
getPoints
(
const
char
*
pTag
)
const
;
/// Compute a color value
uint32_t
getColor
(
const
string
&
rVal
)
const
;
/// Image handler (used to load image files)
image_handler_t
*
m_pImageHandler
;
};
...
...
modules/gui/skins2/parser/builder_data.def
View file @
524b6573
...
...
@@ -12,9 +12,10 @@ Anchor xPos:int yPos:int range:int priority:int points:string layoutId:string
Button id:string xPos:int yPos:int leftTop:string rightBottom:string visible:string upId:string downId:string overId:string actionId:string tooltip:string help:string layer:int windowId:string layoutId:string
Checkbox id:string xPos:int yPos:int leftTop:string rightBottom:string visible:string up1Id:string down1Id:string over1Id:string up2Id:string down2Id:string over2Id:string state:string action1:string action2:string tooltip1:string tooltip2:string help:string layer:int windowId:string layoutId:string
Image id:string xPos:int yPos:int leftTop:string rightBottom:string visible:string bmpId:string actionId:string action2Id:string resize:string help:string layer:int windowId:string layoutId:string
IniFile id:string file:string
Text id:string xPos:int yPos:int visible:string fontId:string text:string width:int leftTop:string rightBottom:string color:uint32_t scrolling:string alignment:string help:string layer:int windowId:string layoutId:string
RadialSlider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string sequence:string nbImages:int minAngle:float maxAngle:float value:string tooltip:string help:string layer:int windowId:string layoutId:string
Slider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string upId:string downId:string overId:string points:string thickness:int value:string imageId:string nbHoriz:int nbVert:int padHoriz:int padVert:int tooltip:string help:string layer:int windowId:string layoutId:string
List id:string xPos:int yPos:int visible:string width:int height:int leftTop:string rightBottom:string fontId:string var:string bgImageId:string fgColor:
uint32_t playColor:uint32_t bgColor1:uint32_t bgColor2:uint32_t selColor:uint32_t
help:string layer:int windowId:string layoutId:string
Tree id:string xPos:int yPos:int visible:string flat:string width:int height:int leftTop:string rightBottom:string fontId:string var:string bgImageId:string itemImageId:string openImageId:string closedImageId:string fgColor:
uint32_t playColor:uint32_t bgColor1:uint32_t bgColor2:uint32_t selColor:uint32_t
help:string layer:int windowId:string layoutId:string
List id:string xPos:int yPos:int visible:string width:int height:int leftTop:string rightBottom:string fontId:string var:string bgImageId:string fgColor:
string playColor:string bgColor1:string bgColor2:string selColor:string
help:string layer:int windowId:string layoutId:string
Tree id:string xPos:int yPos:int visible:string flat:string width:int height:int leftTop:string rightBottom:string fontId:string var:string bgImageId:string itemImageId:string openImageId:string closedImageId:string fgColor:
string playColor:string bgColor1:string bgColor2:string selColor:string
help:string layer:int windowId:string layoutId:string
Video id:string xPos:int yPos:int width:int height:int leftTop:string rightBottom:string visible:string autoResize:bool help:string layer:int windowId:string layoutId:string
modules/gui/skins2/parser/builder_data.hpp
View file @
524b6573
...
...
@@ -279,6 +279,18 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom(
/// List
list
<
Image
>
m_listImage
;
/// Type definition
struct
IniFile
{
IniFile
(
const
string
&
id
,
const
string
&
file
)
:
m_id
(
id
),
m_file
(
file
)
{}
string
m_id
;
string
m_file
;
};
/// List
list
<
IniFile
>
m_listIniFile
;
/// Type definition
struct
Text
{
...
...
@@ -366,7 +378,7 @@ m_id( id ), m_visible( visible ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( lef
/// Type definition
struct
List
{
List
(
const
string
&
id
,
int
xPos
,
int
yPos
,
const
string
&
visible
,
int
width
,
int
height
,
const
string
&
leftTop
,
const
string
&
rightBottom
,
const
string
&
fontId
,
const
string
&
var
,
const
string
&
bgImageId
,
uint32_t
fgColor
,
uint32_t
playColor
,
uint32_t
bgColor1
,
uint32_t
bgColor2
,
uint32_t
selColor
,
const
string
&
help
,
int
layer
,
const
string
&
windowId
,
const
string
&
layoutId
)
:
List
(
const
string
&
id
,
int
xPos
,
int
yPos
,
const
string
&
visible
,
int
width
,
int
height
,
const
string
&
leftTop
,
const
string
&
rightBottom
,
const
string
&
fontId
,
const
string
&
var
,
const
string
&
bgImageId
,
const
string
&
fgColor
,
const
string
&
playColor
,
const
string
&
bgColor1
,
const
string
&
bgColor2
,
const
string
&
selColor
,
const
string
&
help
,
int
layer
,
const
string
&
windowId
,
const
string
&
layoutId
)
:
m_id
(
id
),
m_xPos
(
xPos
),
m_yPos
(
yPos
),
m_visible
(
visible
),
m_width
(
width
),
m_height
(
height
),
m_leftTop
(
leftTop
),
m_rightBottom
(
rightBottom
),
m_fontId
(
fontId
),
m_var
(
var
),
m_bgImageId
(
bgImageId
),
m_fgColor
(
fgColor
),
m_playColor
(
playColor
),
m_bgColor1
(
bgColor1
),
m_bgColor2
(
bgColor2
),
m_selColor
(
selColor
),
m_help
(
help
),
m_layer
(
layer
),
m_windowId
(
windowId
),
m_layoutId
(
layoutId
)
{}
string
m_id
;
...
...
@@ -380,11 +392,11 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_width( width
string
m_fontId
;
string
m_var
;
string
m_bgImageId
;
uint32_t
m_fgColor
;
uint32_t
m_playColor
;
uint32_t
m_bgColor1
;
uint32_t
m_bgColor2
;
uint32_t
m_selColor
;
string
m_fgColor
;
string
m_playColor
;
string
m_bgColor1
;
string
m_bgColor2
;
string
m_selColor
;
string
m_help
;
int
m_layer
;
string
m_windowId
;
...
...
@@ -396,7 +408,7 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_width( width
/// Type definition
struct
Tree
{
Tree
(
const
string
&
id
,
int
xPos
,
int
yPos
,
const
string
&
visible
,
const
string
&
flat
,
int
width
,
int
height
,
const
string
&
leftTop
,
const
string
&
rightBottom
,
const
string
&
fontId
,
const
string
&
var
,
const
string
&
bgImageId
,
const
string
&
itemImageId
,
const
string
&
openImageId
,
const
string
&
closedImageId
,
uint32_t
fgColor
,
uint32_t
playColor
,
uint32_t
bgColor1
,
uint32_t
bgColor2
,
uint32_t
selColor
,
const
string
&
help
,
int
layer
,
const
string
&
windowId
,
const
string
&
layoutId
)
:
Tree
(
const
string
&
id
,
int
xPos
,
int
yPos
,
const
string
&
visible
,
const
string
&
flat
,
int
width
,
int
height
,
const
string
&
leftTop
,
const
string
&
rightBottom
,
const
string
&
fontId
,
const
string
&
var
,
const
string
&
bgImageId
,
const
string
&
itemImageId
,
const
string
&
openImageId
,
const
string
&
closedImageId
,
const
string
&
fgColor
,
const
string
&
playColor
,
const
string
&
bgColor1
,
const
string
&
bgColor2
,
const
string
&
selColor
,
const
string
&
help
,
int
layer
,
const
string
&
windowId
,
const
string
&
layoutId
)
:
m_id
(
id
),
m_xPos
(
xPos
),
m_yPos
(
yPos
),
m_visible
(
visible
),
m_flat
(
flat
),
m_width
(
width
),
m_height
(
height
),
m_leftTop
(
leftTop
),
m_rightBottom
(
rightBottom
),
m_fontId
(
fontId
),
m_var
(
var
),
m_bgImageId
(
bgImageId
),
m_itemImageId
(
itemImageId
),
m_openImageId
(
openImageId
),
m_closedImageId
(
closedImageId
),
m_fgColor
(
fgColor
),
m_playColor
(
playColor
),
m_bgColor1
(
bgColor1
),
m_bgColor2
(
bgColor2
),
m_selColor
(
selColor
),
m_help
(
help
),
m_layer
(
layer
),
m_windowId
(
windowId
),
m_layoutId
(
layoutId
)
{}
string
m_id
;
...
...
@@ -414,11 +426,11 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_flat( flat )
string
m_itemImageId
;
string
m_openImageId
;
string
m_closedImageId
;
uint32_t
m_fgColor
;
uint32_t
m_playColor
;
uint32_t
m_bgColor1
;
uint32_t
m_bgColor2
;
uint32_t
m_selColor
;
string
m_fgColor
;
string
m_playColor
;
string
m_bgColor1
;
string
m_bgColor2
;
string
m_selColor
;
string
m_help
;
int
m_layer
;
string
m_windowId
;
...
...
modules/gui/skins2/parser/interpreter.cpp
View file @
524b6573
...
...
@@ -416,3 +416,17 @@ VarTree *Interpreter::getVarTree( const string &rName, Theme *pTheme )
VarTree
*
pVar
=
(
VarTree
*
)
pVarManager
->
getVar
(
rName
,
"tree"
);
return
pVar
;
}
string
Interpreter
::
getConstant
(
const
string
&
rValue
)
{
// Check if the value is a registered constant
string
val
=
VarManager
::
instance
(
getIntf
()
)
->
getConst
(
rValue
);
if
(
val
.
empty
()
)
{
// if not, keep the value as is
val
=
rValue
;
}
return
val
;
}
modules/gui/skins2/parser/interpreter.hpp
View file @
524b6573
...
...
@@ -63,6 +63,9 @@ class Interpreter: public SkinObject
/// Returns the tree variable corresponding to the given name
VarTree
*
getVarTree
(
const
string
&
rName
,
Theme
*
pTheme
);
/// Get a constant value
string
getConstant
(
const
string
&
rValue
);
private:
/// Map of global commands
map
<
string
,
CmdGenericPtr
>
m_commandMap
;
...
...
modules/gui/skins2/parser/skin_parser.cpp
View file @
524b6573
...
...
@@ -23,6 +23,7 @@
#include "skin_parser.hpp"
#include "../src/os_factory.hpp"
#include "interpreter.hpp"
#include <math.h>
SkinParser
::
SkinParser
(
intf_thread_t
*
pIntf
,
const
string
&
rFileName
,
...
...
@@ -72,6 +73,16 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
subParser
.
parse
();
}
else
if
(
rName
==
"IniFile"
)
{
RequireDefault
(
"id"
);
RequireDefault
(
"file"
);
const
BuilderData
::
IniFile
iniFile
(
attr
[
"id"
],
attr
[
"file"
]
);
m_pData
->
m_listIniFile
.
push_back
(
iniFile
);
}
else
if
(
rName
==
"Anchor"
)
{
RequireDefault
(
"priority"
);
...
...
@@ -304,13 +315,10 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
const
BuilderData
::
List
listData
(
m_curListId
,
atoi
(
attr
[
"x"
]
)
+
m_xOffset
,
atoi
(
attr
[
"y"
]
)
+
m_yOffset
,
attr
[
"visible"
],
atoi
(
attr
[
"width"
]),
atoi
(
attr
[
"height"
]
),
attr
[
"lefttop"
],
attr
[
"rightbottom"
],
attr
[
"font"
],
"playlist"
,
attr
[
"bgimage"
],
convertColor
(
attr
[
"fgcolor"
]
),
convertColor
(
attr
[
"playcolor"
]
),
convertColor
(
attr
[
"bgcolor1"
]
),
convertColor
(
attr
[
"bgcolor2"
]
),
convertColor
(
attr
[
"selcolor"
]
),
attr
[
"help"
],
attr
[
"lefttop"
],
attr
[
"rightbottom"
],
attr
[
"font"
],
"playlist"
,
attr
[
"bgimage"
],
attr
[
"fgcolor"
],
attr
[
"playcolor"
],
attr
[
"bgcolor1"
],
attr
[
"bgcolor2"
],
attr
[
"selcolor"
],
attr
[
"help"
],
m_curLayer
,
m_curWindowId
,
m_curLayoutId
);
m_curLayer
++
;
m_pData
->
m_listList
.
push_back
(
listData
);
...
...
@@ -348,11 +356,9 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
attr
[
"font"
],
"playtree"
,
attr
[
"bgimage"
],
attr
[
"itemimage"
],
attr
[
"openimage"
],
attr
[
"closedimage"
],
convertColor
(
attr
[
"fgcolor"
]
),
convertColor
(
attr
[
"playcolor"
]
),
convertColor
(
attr
[
"bgcolor1"
]
),
convertColor
(
attr
[
"bgcolor2"
]
),
convertColor
(
attr
[
"selcolor"
]
),
attr
[
"help"
],
attr
[
"fgcolor"
],
attr
[
"playcolor"
],
attr
[
"bgcolor1"
],
attr
[
"bgcolor2"
],
attr
[
"selcolor"
],
attr
[
"help"
],
m_curLayer
,
m_curWindowId
,
m_curLayoutId
);
m_curLayer
++
;
m_pData
->
m_listTree
.
push_back
(
treeData
);
...
...
@@ -576,8 +582,9 @@ bool SkinParser::convertBoolean( const char *value ) const
}
int
SkinParser
::
convertColor
(
const
char
*
transcolor
)
const
int
SkinParser
::
convertColor
(
const
char
*
transcolor
)
{
// TODO: move to the builder
unsigned
long
iRed
,
iGreen
,
iBlue
;
iRed
=
iGreen
=
iBlue
=
0
;
sscanf
(
transcolor
,
"#%2lX%2lX%2lX"
,
&
iRed
,
&
iGreen
,
&
iBlue
);
...
...
modules/gui/skins2/parser/skin_parser.hpp
View file @
524b6573
...
...
@@ -40,6 +40,8 @@ class SkinParser: public XMLParser
const
BuilderData
&
getData
()
const
{
return
*
m_pData
;
}
static
int
convertColor
(
const
char
*
transcolor
);
private:
/// Path of the theme
const
string
m_path
;
...
...
@@ -72,7 +74,6 @@ class SkinParser: public XMLParser
/// Helper functions
//@{
bool
convertBoolean
(
const
char
*
value
)
const
;
int
convertColor
(
const
char
*
transcolor
)
const
;
/// Transform to int, and check that it is in the given range (if not,
/// the closest range boundary will be used)
int
convertInRange
(
const
char
*
value
,
int
minValue
,
int
maxValue
,
...
...
modules/gui/skins2/src/file_bitmap.cpp
View file @
524b6573
...
...
@@ -37,8 +37,6 @@ FileBitmap::FileBitmap( intf_thread_t *pIntf, image_handler_t *pImageHandler,
fmt_out
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'V'
,
'3'
,
'2'
);
fprintf
(
stderr
,
"FILE %s
\n
"
,
fileName
.
c_str
());
pPic
=
image_ReadUrl
(
pImageHandler
,
fileName
.
c_str
(),
&
fmt_in
,
&
fmt_out
);
if
(
!
pPic
)
return
;
...
...
modules/gui/skins2/src/ini_file.cpp
0 → 100644
View file @
524b6573
/*****************************************************************************
* ini_file.cpp
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "ini_file.hpp"
#include "var_manager.hpp"
#include <fstream>
IniFile
::
IniFile
(
intf_thread_t
*
pIntf
,
const
string
&
rName
,
const
string
&
rPath
)
:
SkinObject
(
pIntf
),
m_name
(
rName
),
m_path
(
rPath
)
{
}
void
IniFile
::
parseFile
()
{
VarManager
*
pVarManager
=
VarManager
::
instance
(
getIntf
()
);
// Open the file
fstream
fs
(
m_path
.
c_str
(),
fstream
::
in
);
if
(
fs
.
is_open
()
)
{
string
section
;
string
line
;
while
(
!
fs
.
eof
()
)
{
// Read the next line
fs
>>
line
;
switch
(
line
[
0
]
)
{
// "[section]" line ?
case
'['
:
section
=
line
.
substr
(
1
,
line
.
size
()
-
2
);
break
;
// Comment
case
';'
:
case
'#'
:
break
;
// Variable declaration
default:
size_t
eqPos
=
line
.
find
(
'='
);
string
var
=
line
.
substr
(
0
,
eqPos
);
string
val
=
line
.
substr
(
eqPos
+
1
,
line
.
size
()
-
eqPos
-
1
);
// register the value in the var manager
pVarManager
->
registerConst
(
m_name
+
"."
+
section
+
"."
+
var
,
val
);
}
}
fs
.
close
();
}
else
{
msg_Err
(
getIntf
(),
"Failed to open INI file %s"
,
m_path
.
c_str
()
);
}
}
modules/gui/skins2/src/ini_file.hpp
0 → 100644
View file @
524b6573
/*****************************************************************************
* ini_file.hpp
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef INI_FILE_HPP
#define INI_FILE_HPP
#include "skin_common.hpp"
#include <string>
#include <map>
/// INI file parser
class
IniFile
:
public
SkinObject
{
public:
IniFile
(
intf_thread_t
*
pIntf
,
const
string
&
rName
,
const
string
&
rPath
);
virtual
~
IniFile
()
{}
/// Parse the INI file and fill the VarManager
void
parseFile
();
private:
string
m_name
;
string
m_path
;
};
#endif
modules/gui/skins2/src/var_manager.cpp
View file @
524b6573
...
...
@@ -131,3 +131,15 @@ Variable *VarManager::getVar( const string &rName, const string &rType )
}
}
void
VarManager
::
registerConst
(
const
string
&
rName
,
const
string
&
rValue
)
{
m_constMap
[
rName
]
=
rValue
;
}
string
VarManager
::
getConst
(
const
string
&
rName
)
{
return
m_constMap
[
rName
];
}
modules/gui/skins2/src/var_manager.hpp
View file @
524b6573
...
...
@@ -57,6 +57,12 @@ class VarManager: public SkinObject
/// Get the help text variable
VarText
&
getHelpText
()
{
return
*
m_pHelpText
;
}
/// Register a constant value
void
registerConst
(
const
string
&
rName
,
const
string
&
rValue
);
/// Get a constant value by its name
string
getConst
(
const
string
&
rName
);
private:
/// Tooltip text
VarText
*
m_pTooltipText
;
...
...
@@ -68,6 +74,8 @@ class VarManager: public SkinObject
list
<
string
>
m_varList
;
/// List of anonymous registed variables
list
<
VariablePtr
>
m_anonVarList
;
/// Map of constant values
map
<
string
,
string
>
m_constMap
;
/// Private because it is a singleton
VarManager
(
intf_thread_t
*
pIntf
);
...
...
modules/gui/skins2/utils/var_text.cpp
View file @
524b6573
...
...
@@ -43,15 +43,7 @@ VarText::~VarText()
if
(
m_substVars
)
{
// Remove the observers
VlcProc
*
pVlcProc
=
VlcProc
::
instance
(
getIntf
()
);
pVlcProc
->
getTimeVar
().
delObserver
(
this
);
pVlcProc
->
getVolumeVar
().
delObserver
(
this
);
pVlcProc
->
getStreamURIVar
().
delObserver
(
this
);
pVlcProc
->
getStreamNameVar
().
delObserver
(
this
);
pVlcProc
->
getStreamBitRateVar
().
delObserver
(
this
);
pVlcProc
->
getStreamSampleRateVar
().
delObserver
(
this
);
VarManager
*
pVarManager
=
VarManager
::
instance
(
getIntf
()
);
pVarManager
->
getHelpText
().
delObserver
(
this
);
delObservers
();
}
}
...
...
@@ -149,15 +141,10 @@ void VarText::set( const UString &rText )
if
(
m_substVars
)
{
// Stop observing other variables
delObservers
();
VlcProc
*
pVlcProc
=
VlcProc
::
instance
(
getIntf
()
);
pVlcProc
->
getTimeVar
().
delObserver
(
this
);
pVlcProc
->
getVolumeVar
().
delObserver
(
this
);
pVlcProc
->
getStreamNameVar
().
delObserver
(
this
);
pVlcProc
->
getStreamURIVar
().
delObserver
(
this
);
pVlcProc
->
getStreamBitRateVar
().
delObserver
(
this
);
pVlcProc
->
getStreamSampleRateVar
().
delObserver
(
this
);
VarManager
*
pVarManager
=
VarManager
::
instance
(
getIntf
()
);
pVarManager
->
getHelpText
().
delObserver
(
this
);
// Observe needed variables
if
(
m_text
.
find
(
"$H"
)
!=
UString
::
npos
)
...
...
@@ -228,3 +215,18 @@ void VarText::onUpdate( Subject<VarText,void*> &rVariable, void *arg )
}
}
void
VarText
::
delObservers
()
{
// Stop observing other variables
VlcProc
*
pVlcProc
=
VlcProc
::
instance
(
getIntf
()
);
pVlcProc
->
getTimeVar
().
delObserver
(
this
);
pVlcProc
->
getVolumeVar
().
delObserver
(
this
);
pVlcProc
->
getStreamNameVar
().
delObserver
(
this
);
pVlcProc
->
getStreamURIVar
().
delObserver
(
this
);
pVlcProc
->
getStreamBitRateVar
().
delObserver
(
this
);
pVlcProc
->
getStreamSampleRateVar
().
delObserver
(
this
);
VarManager
*
pVarManager
=
VarManager
::
instance
(
getIntf
()
);
pVarManager
->
getHelpText
().
delObserver
(
this
);
}
modules/gui/skins2/utils/var_text.hpp
View file @
524b6573
...
...
@@ -53,6 +53,9 @@ class VarText: public Variable, public Subject<VarText, void*>,
virtual
void
onUpdate
(
Subject
<
VarText
,
void
*>
&
rVariable
,
void
*
);
private:
/// Stop observing other variables
void
delObservers
();
/// Variable type
static
const
string
m_type
;
/// The text of the variable
...
...
share/skins2/skin.dtd
View file @
524b6573
...
...
@@ -2,7 +2,7 @@
-->
<!ELEMENT Theme (ThemeInfo,(Include|Bitmap|BitmapFont|Font|PopupMenu|Window)*)>
<!ELEMENT Theme (ThemeInfo,(Include|
IniFile|
Bitmap|BitmapFont|Font|PopupMenu|Window)*)>
<!ATTLIST Theme
version CDATA #REQUIRED
tooltipfont CDATA "defaultfont"
...
...
@@ -12,6 +12,11 @@
>
<!-- main elements -->
<!ELEMENT IniFile EMPTY>
<!ATTLIST IniFile
id CDATA #REQUIRED
file CDATA #REQUIRED
>
<!ELEMENT Include EMPTY>
<!ATTLIST Include
file CDATA #REQUIRED
...
...
share/skins2/winamp2.xml
View file @
524b6573
...
...
@@ -149,6 +149,7 @@
<BitmapFont
id=
"digits_font"
file=
"nums_ex.bmp"
type=
"digits"
/>
<BitmapFont
id=
"digits_font_2"
file=
"numbers.bmp"
type=
"digits"
/>
<BitmapFont
id=
"text_font"
file=
"text.bmp"
type=
"text"
/>
<IniFile
id=
"pledit"
file=
"pledit.txt"
/>
<Window
id=
"main_window"
x=
"100"
y=
"100"
>
<Layout
id=
"small_layout"
width=
"275"
height=
"14"
>
...
...
@@ -342,7 +343,7 @@
<Image
x=
"255"
y=
"96"
image=
"pl_resize"
action=
"resizeSE"
lefttop=
"rightbottom"
rightbottom=
"rightbottom"
/>
<Button
x=
"254"
y=
"3"
up=
"pl_switch_up"
down=
"pl_switch_down"
over=
"pl_switch_up"
action=
"playlist_window.setLayout(pl_small_layout)"
tooltiptext=
"Switch"
lefttop=
"righttop"
rightbottom=
"righttop"
/>
<Button
x=
"264"
y=
"3"
up=
"pl_close_up"
down=
"pl_close_down"
over=
"pl_close_up"
action=
"playlist_window.hide()"
tooltiptext=
"Close the window"
lefttop=
"righttop"
rightbottom=
"righttop"
/>
<Playlist
id=
"playlist"
x=
"10"
y=
"20"
width=
"240"
height=
"58"
lefttop=
"lefttop"
rightbottom=
"rightbottom"
font=
"playlist_font"
fgcolor=
"
#dfdfff"
playcolor=
"#ffffff"
bgcolor1=
"#000000"
bgcolor2=
"#000000"
selcolor=
"#404040
"
>
<Playlist
id=
"playlist"
x=
"10"
y=
"20"
width=
"240"
height=
"58"
lefttop=
"lefttop"
rightbottom=
"rightbottom"
font=
"playlist_font"
fgcolor=
"
pledit.Text.Normal"
playcolor=
"pledit.Text.Current"
bgcolor1=
"pledit.Text.NormalBG"
bgcolor2=
"pledit.Text.NormalBG"
selcolor=
"pledit.Text.SelectedBG
"
>
<Slider
id=
"playlist_slider"
x=
"264"
y=
"28"
lefttop=
"righttop"
rightbottom=
"rightbottom"
up=
"pl_slider_up"
down=
"pl_slider_down"
points=
"(0,40),(0,0)"
/>
</Playlist>
<Button
x=
"14"
y=
"86"
up=
"pl_add_up"
down=
"pl_add_down"
over=
"pl_add_up"
action=
"playlist.add()"
lefttop=
"leftbottom"
rightbottom=
"leftbottom"
/>
...
...
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