Commit 1628f2f2 authored by Cyril Deguet's avatar Cyril Deguet

* all: replaced the flex parser by the libxml one

* src/window_manager.cpp: improved the raise window algorithm
* src/tooltip.cpp: fixed a segfault after changing a theme
parent b6abc4fa
......@@ -67,16 +67,12 @@ SOURCES_skins2 = \
parser/builder.cpp \
parser/builder.hpp \
parser/builder_data.hpp \
parser/flex.c \
parser/interpreter.cpp \
parser/interpreter.hpp \
parser/parser_context.hpp \
parser/skin.c \
parser/skin.h \
parser/skin_parser.cpp \
parser/skin_parser.hpp \
parser/xmlparser.cpp \
parser/xmlparser.hpp \
parser/wrappers.cpp \
parser/wrappers.h \
\
src/anchor.cpp \
src/anchor.hpp \
......
......@@ -2,7 +2,7 @@
* builder.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: builder.cpp,v 1.2 2004/01/11 17:12:17 asmax Exp $
* $Id: builder.cpp,v 1.3 2004/01/25 11:44:19 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -47,7 +47,7 @@
#include "../utils/var_text.hpp"
Builder::Builder( intf_thread_t *pIntf, BuilderData &rData):
Builder::Builder( intf_thread_t *pIntf, const BuilderData &rData):
SkinObject( pIntf ), m_rData( rData ), m_pTheme( NULL )
{
}
......
......@@ -2,7 +2,7 @@
* builder.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: builder.hpp,v 1.2 2004/01/11 17:12:17 asmax Exp $
* $Id: builder.hpp,v 1.3 2004/01/25 11:44:19 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <ipkiss@via.ecp.fr>
......@@ -47,7 +47,7 @@ class Theme;
class Builder: public SkinObject
{
public:
Builder( intf_thread_t *pIntf, BuilderData &rData );
Builder( intf_thread_t *pIntf, const BuilderData &rData );
virtual ~Builder() {}
/// Create a Theme object, ready to use.
......@@ -59,7 +59,7 @@ class Builder: public SkinObject
private:
/// Data from the XML
BuilderData &m_rData;
const BuilderData &m_rData;
/// Theme under construction
Theme *m_pTheme;
......
......@@ -2,7 +2,7 @@
* builder_data.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: builder_data.hpp,v 1.2 2004/01/11 17:12:17 asmax Exp $
* $Id: builder_data.hpp,v 1.3 2004/01/25 11:44:19 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -32,7 +32,6 @@ using namespace std;
#include <vlc/vlc.h>
#include <list>
#include <map>
#include <string>
/// Structure for mapping data from XML file
......
This diff is collapsed.
flexml -SH -a skin.act skin.dtd
sed -e 's/\([SE]Tag_.*\)(void)/\1(void *pContext)/' \
-e 's/int main().*//' skin.c > skin.c.new && mv -f skin.c.new skin.c
sed -e 's/\([SE]Tag_.*\)(void)/\1(void*)/' \
-e 's/extern int yylex(void)/extern int yylex(void*)/' \
-e 's/\/\* XML processor entry point. \*\//#define YY_DECL int yylex(void *pContext)/' skin.h > skin.h.new && mv -f skin.h.new skin.h
flex -oflex.c -B -L skin.l
sed -e 's/\([SE]Tag_[^()]*\)()/\1(pContext)/g' flex.c > flex.c.new && mv -f flex.c.new flex.c
<!-- vim: set filetype=xml : -->
<!DOCTYPE actions SYSTEM "flexml-act.dtd">
<actions>
<top>
<![CDATA[
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "parser/wrappers.h"
]]>
</top>
<start tag="Bitmap">
<![CDATA[
AddBitmap( pContext, {id}, {file}, {alphacolor} );
]]>
</start>
<start tag="Event">
<![CDATA[
AddEvent( pContext, {id}, {event}, {key} );
]]>
</start>
<start tag="Font">
<![CDATA[
AddFont( pContext, {id}, {font}, {size}, {color},
{italic}, {underline} );
]]>
</start>
<start tag="ThemeInfo">
<![CDATA[
AddThemeInfo( pContext, {name}, {author}, {email}, {webpage} );
]]>
</start>
<start tag="Window">
<![CDATA[
StartWindow( pContext, {id}, {x}, {y}, {visible}, {dragdrop},
{playondrop} );
]]>
</start>
<end tag="Window">
<![CDATA[
EndWindow( pContext );
]]>
</end>
<start tag="Layout">
<![CDATA[
StartLayout( pContext, {id}, {width}, {height}, {minwidth},
{maxwidth}, {minheight}, {maxheight} );
]]>
</start>
<end tag="Layout">
<![CDATA[
EndLayout( pContext );
]]>
</end>
<start tag="Group">
<![CDATA[
StartGroup( pContext, {x}, {y} );
]]>
</start>
<end tag="Group">
<![CDATA[
EndGroup( pContext );
]]>
</end>
<start tag="Anchor">
<![CDATA[
AddAnchor( pContext, {x}, {y}, {range}, {priority} );
]]>
</start>
<start tag="Image">
<![CDATA[
AddImage( pContext, {id}, {visible}, {x}, {y}, {lefttop},
{rightbottom}, {image}, {onclick}, {help} );
]]>
</start>
<start tag="Rectangle">
<![CDATA[
AddRectangle( pContext, {id}, {visible}, {x}, {y}, {w}, {h},
{color}, {onclick}, {help} );
]]>
</start>
<start tag="Button">
<![CDATA[
AddButton( pContext, {id}, {x}, {y}, {lefttop}, {rightbottom},
{up}, {down}, {over}, {action}, {tooltiptext}, {help} );
]]>
</start>
<start tag="CheckBox">
<![CDATA[
AddCheckBox( pContext, {id},
{x}, {y}, {lefttop}, {rightbottom},
{up1}, {down1}, {over1}, {up2}, {down2}, {over2},
{state}, {action1}, {action2}, {tooltiptext1},
{tooltiptext2}, {help} );
]]>
</start>
<start tag="Slider">
<![CDATA[
AddSlider( pContext, {id}, {visible}, {x}, {y},
{lefttop}, {rightbottom}, {up}, {down},
{over}, {points}, {thickness}, {value}, {tooltiptext},
{help} );
]]>
</start>
<start tag="RadialSlider">
<![CDATA[
AddRadialSlider( pContext, {id}, {visible}, {x}, {y},
{lefttop}, {rightbottom}, {sequence}, {nbimages},
{minangle}, {maxangle}, {value}, {tooltiptext},
{help} );
]]>
</start>
<start tag="Text">
<![CDATA[
AddText( pContext, {id}, {visible}, {x}, {y}, {text}, {font},
{align}, {width}, {display}, {scroll}, {scrollspace},
{help} );
]]>
</start>
<start tag="Playlist">
<![CDATA[
AddPlaylist( pContext, {id}, {visible}, {x}, {y}, {width},
{height}, {lefttop}, {rightbottom}, {font}, {var},
{fgcolor}, {playcolor}, {bgcolor1}, {bgcolor2},
{selcolor}, {help} );
]]>
</start>
<end tag="Playlist">
<![CDATA[
AddPlaylistEnd( pContext );
]]>
</end>
<start tag="Theme">
<![CDATA[
StartTheme( pContext, {version}, {magnet}, {alpha}, {movealpha}, {fadetime} );
]]>
</start>
<end tag="Theme">
<![CDATA[
EndTheme( pContext );
]]>
</end>
</actions>
/* XML application for skin.dtd.
* Includes actions from skin.act.
* Generated 2004/01/03 15:23:36.
*
* This program was generated with the FleXML XML processor generator,
* (Id: flexml.pl,v 1.24 1999/12/13 16:18:30 krisrose Exp).
* Copyright 1999 Kristoffer Rose. All rights reserved.
*
* You can redistribute and/or modify this program provided the following
* two conditions hold:
*
* 1. The program is distributed WITHOUT ANY WARRANTY from the author of
* FleXML; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* 2. The program distribution conditions do not in any way affect the
* distribution conditions of the FleXML system used to generate this
* file or any version of FleXML derived from that system.
*
* Notice that these are explicit rights granted to you for files
* generated by the FleXML system. For your rights in connection with
* the FleXML system itself please consult the GNU General Public License.
*/
#include "skin.h"
#line 5 "skin.act"
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "parser/wrappers.h"
void STag_Bitmap(void *pContext)
{
#line 12 "skin.act"
AddBitmap( pContext, A_Bitmap_id, A_Bitmap_file, A_Bitmap_alphacolor );
} /* STag_Bitmap */
void STag_Event(void *pContext)
{
#line 17 "skin.act"
AddEvent( pContext, A_Event_id, A_Event_event, A_Event_key );
} /* STag_Event */
void STag_Font(void *pContext)
{
#line 22 "skin.act"
AddFont( pContext, A_Font_id, A_Font_font, A_Font_size, A_Font_color,
A_Font_italic, A_Font_underline );
} /* STag_Font */
void STag_ThemeInfo(void *pContext)
{
#line 28 "skin.act"
AddThemeInfo( pContext, A_ThemeInfo_name, A_ThemeInfo_author, A_ThemeInfo_email, A_ThemeInfo_webpage );
} /* STag_ThemeInfo */
void STag_Window(void *pContext)
{
#line 33 "skin.act"
StartWindow( pContext, A_Window_id, A_Window_x, A_Window_y, A_Window_visible, A_Window_dragdrop,
A_Window_playondrop );
} /* STag_Window */
void ETag_Window(void *pContext)
{
#line 39 "skin.act"
EndWindow( pContext );
} /* ETag_Window */
void STag_Layout(void *pContext)
{
#line 44 "skin.act"
StartLayout( pContext, A_Layout_id, A_Layout_width, A_Layout_height, A_Layout_minwidth,
A_Layout_maxwidth, A_Layout_minheight, A_Layout_maxheight );
} /* STag_Layout */
void ETag_Layout(void *pContext)
{
#line 50 "skin.act"
EndLayout( pContext );
} /* ETag_Layout */
void STag_Group(void *pContext)
{
#line 56 "skin.act"
StartGroup( pContext, A_Group_x, A_Group_y );
} /* STag_Group */
void ETag_Group(void *pContext)
{
#line 61 "skin.act"
EndGroup( pContext );
} /* ETag_Group */
void STag_Anchor(void *pContext)
{
#line 66 "skin.act"
AddAnchor( pContext, A_Anchor_x, A_Anchor_y, A_Anchor_range, A_Anchor_priority );
} /* STag_Anchor */
void STag_Image(void *pContext)
{
#line 71 "skin.act"
AddImage( pContext, A_Image_id, A_Image_visible, A_Image_x, A_Image_y, A_Image_lefttop,
A_Image_rightbottom, A_Image_image, A_Image_onclick, A_Image_help );
} /* STag_Image */
void STag_Rectangle(void *pContext)
{
#line 77 "skin.act"
AddRectangle( pContext, A_Rectangle_id, A_Rectangle_visible, A_Rectangle_x, A_Rectangle_y, A_Rectangle_w, A_Rectangle_h,
A_Rectangle_color, A_Rectangle_onclick, A_Rectangle_help );
} /* STag_Rectangle */
void STag_Button(void *pContext)
{
#line 83 "skin.act"
AddButton( pContext, A_Button_id, A_Button_x, A_Button_y, A_Button_lefttop, A_Button_rightbottom,
A_Button_up, A_Button_down, A_Button_over, A_Button_action, A_Button_tooltiptext, A_Button_help );
} /* STag_Button */
void STag_CheckBox(void *pContext)
{
#line 89 "skin.act"
AddCheckBox( pContext, A_CheckBox_id,
A_CheckBox_x, A_CheckBox_y, A_CheckBox_lefttop, A_CheckBox_rightbottom,
A_CheckBox_up1, A_CheckBox_down1, A_CheckBox_over1, A_CheckBox_up2, A_CheckBox_down2, A_CheckBox_over2,
A_CheckBox_state, A_CheckBox_action1, A_CheckBox_action2, A_CheckBox_tooltiptext1,
A_CheckBox_tooltiptext2, A_CheckBox_help );
} /* STag_CheckBox */
void STag_Slider(void *pContext)
{
#line 98 "skin.act"
AddSlider( pContext, A_Slider_id, A_Slider_visible, A_Slider_x, A_Slider_y,
A_Slider_lefttop, A_Slider_rightbottom, A_Slider_up, A_Slider_down,
A_Slider_over, A_Slider_points, A_Slider_thickness, A_Slider_value, A_Slider_tooltiptext,
A_Slider_help );
} /* STag_Slider */
void STag_RadialSlider(void *pContext)
{
#line 106 "skin.act"
AddRadialSlider( pContext, A_RadialSlider_id, A_RadialSlider_visible, A_RadialSlider_x, A_RadialSlider_y,
A_RadialSlider_lefttop, A_RadialSlider_rightbottom, A_RadialSlider_sequence, A_RadialSlider_nbimages,
A_RadialSlider_minangle, A_RadialSlider_maxangle, A_RadialSlider_value, A_RadialSlider_tooltiptext,
A_RadialSlider_help );
} /* STag_RadialSlider */
void STag_Text(void *pContext)
{
#line 114 "skin.act"
AddText( pContext, A_Text_id, A_Text_visible, A_Text_x, A_Text_y, A_Text_text, A_Text_font,
A_Text_align, A_Text_width, A_Text_display, A_Text_scroll, A_Text_scrollspace,
A_Text_help );
} /* STag_Text */
void STag_Playlist(void *pContext)
{
#line 121 "skin.act"
AddPlaylist( pContext, A_Playlist_id, A_Playlist_visible, A_Playlist_x, A_Playlist_y, A_Playlist_width,
A_Playlist_height, A_Playlist_lefttop, A_Playlist_rightbottom, A_Playlist_font, A_Playlist_var,
A_Playlist_fgcolor, A_Playlist_playcolor, A_Playlist_bgcolor1, A_Playlist_bgcolor2,
A_Playlist_selcolor, A_Playlist_help );
} /* STag_Playlist */
void ETag_Playlist(void *pContext)
{
#line 129 "skin.act"
AddPlaylistEnd( pContext );
} /* ETag_Playlist */
void STag_Theme(void *pContext)
{
#line 134 "skin.act"
StartTheme( pContext, A_Theme_version, A_Theme_magnet, A_Theme_alpha, A_Theme_movealpha, A_Theme_fadetime );
} /* STag_Theme */
void ETag_Theme(void *pContext)
{
#line 139 "skin.act"
EndTheme( pContext );
} /* ETag_Theme */
/* Dummy main: filter XML from stdin. */
/* XML application entry points. */
void ETag_Bitmap(void *pContext) {}
void ETag_Event(void *pContext) {}
void ETag_Font(void *pContext) {}
void ETag_ThemeInfo(void *pContext) {}
void ETag_Anchor(void *pContext) {}
void ETag_Image(void *pContext) {}
void ETag_Rectangle(void *pContext) {}
void ETag_Button(void *pContext) {}
void ETag_CheckBox(void *pContext) {}
void ETag_Slider(void *pContext) {}
void ETag_RadialSlider(void *pContext) {}
void ETag_Text(void *pContext) {}
<!--
-->
<!ELEMENT Theme (ThemeInfo,(Bitmap|Font|Window|Event)*)>
<!ATTLIST Theme
version CDATA "1.0"
magnet CDATA "15"
alpha CDATA "255"
movealpha CDATA "255"
fadetime CDATA "400"
>
<!-- main elements -->
<!ELEMENT Bitmap EMPTY>
<!ATTLIST Bitmap
id CDATA #REQUIRED
file CDATA #REQUIRED
alphacolor CDATA #REQUIRED
>
<!ELEMENT Event EMPTY>
<!ATTLIST Event
id CDATA #REQUIRED
event CDATA #REQUIRED
key CDATA "none"
>
<!ELEMENT Font EMPTY>
<!ATTLIST Font
id CDATA #REQUIRED
font CDATA "arial"
size CDATA "12"
color CDATA "#000000"
italic CDATA "false"
underline CDATA "false"
>
<!ELEMENT ThemeInfo EMPTY>
<!ATTLIST ThemeInfo
name CDATA #IMPLIED
author CDATA #IMPLIED
email CDATA #IMPLIED
webpage CDATA #IMPLIED
>
<!ELEMENT Window (Layout)+>
<!ATTLIST Window
id CDATA #REQUIRED
visible CDATA "true"
x CDATA "\0"
y CDATA "\0"
dragdrop CDATA "true"
playondrop CDATA "true"
>
<!ELEMENT Layout (Group)>
<!ATTLIST Layout
id CDATA "none"
width CDATA #REQUIRED
height CDATA #REQUIRED
minwidth CDATA "-1"
maxwidth CDATA "-1"
minheight CDATA "-1"
maxheight CDATA "-1"
>
<!ELEMENT Group (Group|Image|Button|Playlist|Slider|RadialSlider|Text|CheckBox|
Rectangle|Anchor)+>
<!ATTLIST Group
x CDATA "\0"
y CDATA "\0"
>
<!-- Anchors -->
<!ELEMENT Anchor EMPTY>
<!ATTLIST Anchor
x CDATA "\0"
y CDATA "\0"
priority CDATA #REQUIRED
range CDATA "10"
>
<!-- Controls -->
<!ELEMENT Image EMPTY>
<!ATTLIST Image
id CDATA "none"
visible CDATA "true"
x CDATA "\0"
y CDATA "\0"
lefttop CDATA "lefttop"
rightbottom CDATA "lefttop"
image CDATA #REQUIRED
onclick CDATA "none"
help CDATA "\0"
>
<!ELEMENT Rectangle EMPTY>
<!ATTLIST Rectangle
id CDATA "none"
visible CDATA "true"
x CDATA "\0"
y CDATA "\0"
w CDATA "50"
h CDATA "50"
color CDATA "#C0C0C0"
onclick CDATA "none"
help CDATA "\0"
>
<!ELEMENT Button EMPTY>
<!ATTLIST Button
id CDATA "none"
x CDATA "\0"
y CDATA "\0"
lefttop CDATA "lefttop"
rightbottom CDATA "lefttop"
up CDATA #REQUIRED
down CDATA "none"
over CDATA "none"
action CDATA "none"
tooltiptext CDATA "\0"
help CDATA "\0"
>
<!ELEMENT CheckBox EMPTY>
<!ATTLIST CheckBox
id CDATA "none"
x CDATA "\0"
y CDATA "\0"
lefttop CDATA "lefttop"