]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/parser/builder.cpp
* all: beginning of bitmap font support. At the moment only the digits
[vlc] / modules / gui / skins2 / parser / builder.cpp
index 372d166ad2a1387b46ea2f9264d661b1f681b091..219a15e1f703ae8e6c06880b2373e9b03712d160 100755 (executable)
@@ -2,7 +2,7 @@
  * builder.cpp
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: builder.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
+ * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *          Olivier Teulière <ipkiss@via.ecp.fr>
@@ -29,8 +29,9 @@
 #include "../src/png_bitmap.hpp"
 #include "../src/os_factory.hpp"
 #include "../src/generic_bitmap.hpp"
-#include "../src/generic_window.hpp"
+#include "../src/top_window.hpp"
 #include "../src/anchor.hpp"
+#include "../src/bitmap_font.hpp"
 #include "../src/ft2_font.hpp"
 #include "../src/theme.hpp"
 #include "../controls/ctrl_button.hpp"
 #include "../controls/ctrl_slider.hpp"
 #include "../controls/ctrl_radialslider.hpp"
 #include "../controls/ctrl_text.hpp"
+#include "../controls/ctrl_video.hpp"
 #include "../utils/position.hpp"
 #include "../utils/var_bool.hpp"
 #include "../utils/var_text.hpp"
 
 
-Builder::Builder( intf_thread_t *pIntf, BuilderData &rData):
-    SkinObject( pIntf ), m_rData( rData ), m_interpreter( pIntf ),
-    m_pTheme( NULL )
+Builder::Builder( intf_thread_t *pIntf, const BuilderData &rData):
+    SkinObject( pIntf ), m_rData( rData ), m_pTheme( NULL )
 {
 }
 
 
 CmdGeneric *Builder::parseAction( const string &rAction )
 {
-    return m_interpreter.parseAction( rAction, m_pTheme );
+    return Interpreter::instance( getIntf() )->parseAction( rAction, m_pTheme );
 }
 
 
@@ -81,6 +82,7 @@ Theme *Builder::build()
     // Create everything from the data in the XML
     ADD_OBJECTS( Theme );
     ADD_OBJECTS( Bitmap );
+    ADD_OBJECTS( BitmapFont );
     ADD_OBJECTS( Font );
     ADD_OBJECTS( Window );
     ADD_OBJECTS( Layout );
@@ -92,6 +94,7 @@ Theme *Builder::build()
     ADD_OBJECTS( RadialSlider );
     ADD_OBJECTS( Slider );
     ADD_OBJECTS( List );
+    ADD_OBJECTS( Video );
 
     return m_pTheme;
 }
@@ -104,16 +107,27 @@ Theme *Builder::build()
         pBmp = m_pTheme->m_bitmaps[id].get(); \
         if( pBmp == NULL ) \
         { \
-            msg_Err( getIntf(), "Unknown Bitmap id: %s", id.c_str() ); \
+            msg_Err( getIntf(), "unknown bitmap id: %s", id.c_str() ); \
             return; \
         } \
     }
 
 void Builder::addTheme( const BuilderData::Theme &rData )
 {
-    m_pTheme->getWindowManager().setMagnetValue( rData.m_magnet );
-    m_pTheme->getWindowManager().setAlphaValue( rData.m_alpha );
-    m_pTheme->getWindowManager().setMoveAlphaValue( rData.m_moveAlpha );
+    WindowManager &rManager = m_pTheme->getWindowManager();
+    rManager.setMagnetValue( rData.m_magnet );
+    rManager.setAlphaValue( rData.m_alpha );
+    rManager.setMoveAlphaValue( rData.m_moveAlpha );
+    GenericFont *pFont = getFont( rData.m_tooltipfont );
+    if( pFont )
+    {
+        rManager.createTooltip( *pFont );
+    }
+    else
+    {
+        msg_Warn( getIntf(), "Invalid tooltip font: %s",
+                  rData.m_tooltipfont.c_str() );
+    }
 }
 
 
@@ -125,35 +139,55 @@ void Builder::addBitmap( const BuilderData::Bitmap &rData )
 }
 
 
+void Builder::addBitmapFont( const BuilderData::BitmapFont &rData )
+{
+    GenericBitmap *pBmp = new PngBitmap( getIntf(), rData.m_file, 0 );
+    m_pTheme->m_bitmaps[rData.m_id] = GenericBitmapPtr( pBmp );
+
+    GenericFont *pFont = new BitmapFont( getIntf(), *pBmp );
+    if( pFont->init() )
+    {
+        m_pTheme->m_fonts[rData.m_id] = GenericFontPtr( pFont );
+    }
+    else
+    {
+        delete pFont;
+    }
+}
+
+
 void Builder::addFont( const BuilderData::Font &rData )
 {
-    GenericFont *pFont = new FT2Font( getIntf(), rData.m_fontName,
+    GenericFont *pFont = new FT2Font( getIntf(), rData.m_fontFile,
                                       rData.m_size );
-    pFont->init();
-    m_pTheme->m_fonts[rData.m_id] = GenericFontPtr( pFont );
+    if( pFont->init() )
+    {
+        m_pTheme->m_fonts[rData.m_id] = GenericFontPtr( pFont );
+    }
+    else
+    {
+        delete pFont;
+    }
 }
 
 
 void Builder::addWindow( const BuilderData::Window &rData )
 {
-    // XXX:  font to fix
-    GenericFont *pFont = new FT2Font( getIntf(), "FreeSans.ttf", 12 );
-    pFont->init();
-    GenericWindow *pWin =
-        new GenericWindow( getIntf(), rData.m_xPos, rData.m_yPos,
-                           m_pTheme->getWindowManager(), *pFont,
+    TopWindow *pWin =
+        new TopWindow( getIntf(), rData.m_xPos, rData.m_yPos,
+                           m_pTheme->getWindowManager(),
                            rData.m_dragDrop, rData.m_playOnDrop );
 
-    m_pTheme->m_windows[uniqueId( rData.m_id) ] = GenericWindowPtr( pWin );
+    m_pTheme->m_windows[rData.m_id] = TopWindowPtr( pWin );
 }
 
 
 void Builder::addLayout( const BuilderData::Layout &rData )
 {
-    GenericWindow *pWin = m_pTheme->m_windows[rData.m_windowId].get();
+    TopWindow *pWin = m_pTheme->m_windows[rData.m_windowId].get();
     if( pWin == NULL )
     {
-        msg_Err( getIntf(), "Unknown Window id: %s", rData.m_windowId.c_str() );
+        msg_Err( getIntf(), "unknown window id: %s", rData.m_windowId.c_str() );
         return;
     }
 
@@ -167,7 +201,7 @@ void Builder::addLayout( const BuilderData::Layout &rData )
                                                 rData.m_height,
                                                 minWidth, maxWidth, minHeight,
                                                 maxHeight );
-    m_pTheme->m_layouts[uniqueId( rData.m_id) ] = GenericLayoutPtr( pLayout );
+    m_pTheme->m_layouts[rData.m_id] = GenericLayoutPtr( pLayout );
 
     // Attach the layout to its window
     pWin->setActiveLayout( pLayout );
@@ -176,15 +210,25 @@ void Builder::addLayout( const BuilderData::Layout &rData )
 
 void Builder::addAnchor( const BuilderData::Anchor &rData )
 {
-    GenericWindow *pWin = m_pTheme->m_windows[rData.m_windowId].get();
+    TopWindow *pWin = m_pTheme->m_windows[rData.m_windowId].get();
     if( pWin == NULL )
     {
-        msg_Err( getIntf(), "Unknown Window id: %s", rData.m_windowId.c_str() );
+        msg_Err( getIntf(), "unknown window id: %s", rData.m_windowId.c_str() );
         return;
     }
 
+    Bezier *pCurve = getPoints( rData.m_points.c_str() );
+    if( pCurve == NULL )
+    {
+        msg_Err( getIntf(), "Invalid format in tag points=\"%s\"",
+                 rData.m_points.c_str() );
+        return;
+    }
+    m_pTheme->m_curves.push_back( BezierPtr( pCurve ) );
+
     Anchor *pAnc = new Anchor( getIntf(), rData.m_xPos, rData.m_yPos,
-                               rData.m_range, rData.m_priority, *pWin );
+                               rData.m_range, rData.m_priority,
+                               *pCurve, *pWin );
     pWin->addAnchor( pAnc );
 }
 
@@ -204,7 +248,7 @@ void Builder::addButton( const BuilderData::Button &rData )
     GenericLayout *pLayout = m_pTheme->m_layouts[rData.m_layoutId].get();
     if( pLayout == NULL )
     {
-        msg_Err( getIntf(), "Unknown Layout id: %s", rData.m_layoutId.c_str() );
+        msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
         return;
     }
 
@@ -215,9 +259,14 @@ void Builder::addButton( const BuilderData::Button &rData )
         return;
     }
 
+    // Get the visibility variable
+    // XXX check when it is null
+    Interpreter *pInterpreter = Interpreter::instance( getIntf() );
+    VarBool *pVisible = pInterpreter->getVarBool( rData.m_visible, m_pTheme );
+
     CtrlButton *pButton = new CtrlButton( getIntf(), *pBmpUp, *pBmpOver,
         *pBmpDown, *pCommand, UString( getIntf(), rData.m_tooltip.c_str() ),
-        UString( getIntf(), rData.m_help.c_str() ) );
+        UString( getIntf(), rData.m_help.c_str() ), pVisible );
 
     // Compute the position of the control
     // XXX (we suppose all the images have the same size...)
@@ -228,7 +277,7 @@ void Builder::addButton( const BuilderData::Button &rData )
 
     pLayout->addControl( pButton, pos, rData.m_layer );
 
-    m_pTheme->m_controls[uniqueId( rData.m_id) ] = CtrlGenericPtr( pButton );
+    m_pTheme->m_controls[rData.m_id] = CtrlGenericPtr( pButton );
 }
 
 
@@ -256,7 +305,7 @@ void Builder::addCheckbox( const BuilderData::Checkbox &rData )
     GenericLayout *pLayout = m_pTheme->m_layouts[rData.m_layoutId].get();
     if( pLayout == NULL )
     {
-        msg_Err( getIntf(), "Unknown Layout id: %s", rData.m_layoutId.c_str() );
+        msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
         return;
     }
 
@@ -275,19 +324,24 @@ void Builder::addCheckbox( const BuilderData::Checkbox &rData )
     }
 
     // Get the state variable
-    VarBool *pVar = m_interpreter.getVarBool( rData.m_state, m_pTheme );
+    Interpreter *pInterpreter = Interpreter::instance( getIntf() );
+    VarBool *pVar = pInterpreter->getVarBool( rData.m_state, m_pTheme );
     if( pVar == NULL )
     {
         // TODO: default state
         return;
     }
 
+    // Get the visibility variable
+    // XXX check when it is null
+    VarBool *pVisible = pInterpreter->getVarBool( rData.m_visible, m_pTheme );
+
     // Create the control
     CtrlCheckbox *pCheckbox = new CtrlCheckbox( getIntf(), *pBmpUp1,
         *pBmpOver1, *pBmpDown1, *pBmpUp2, *pBmpOver2, *pBmpDown2, *pCommand1,
         *pCommand2, UString( getIntf(), rData.m_tooltip1.c_str() ),
         UString( getIntf(), rData.m_tooltip2.c_str() ), *pVar,
-        UString( getIntf(), rData.m_help.c_str() ) );
+        UString( getIntf(), rData.m_help.c_str() ), pVisible );
 
     // Compute the position of the control
     // XXX (we suppose all the images have the same size...)
@@ -298,7 +352,7 @@ void Builder::addCheckbox( const BuilderData::Checkbox &rData )
 
     pLayout->addControl( pCheckbox, pos, rData.m_layer );
 
-    m_pTheme->m_controls[uniqueId( rData.m_id) ] = CtrlGenericPtr( pCheckbox );
+    m_pTheme->m_controls[rData.m_id] = CtrlGenericPtr( pCheckbox );
 }
 
 
@@ -310,19 +364,24 @@ void Builder::addImage( const BuilderData::Image &rData )
     GenericLayout *pLayout = m_pTheme->m_layouts[rData.m_layoutId].get();
     if( pLayout == NULL )
     {
-        msg_Err( getIntf(), "Unknown Layout id: %s", rData.m_layoutId.c_str() );
+        msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
         return;
     }
 
-    GenericWindow *pWindow = m_pTheme->m_windows[rData.m_windowId].get();
+    TopWindow *pWindow = m_pTheme->m_windows[rData.m_windowId].get();
     if( pWindow == NULL )
     {
-        msg_Err( getIntf(), "Unknown Window id: %s", rData.m_windowId.c_str() );
+        msg_Err( getIntf(), "unknown window id: %s", rData.m_windowId.c_str() );
         return;
     }
 
+    // Get the visibility variable
+    // XXX check when it is null
+    Interpreter *pInterpreter = Interpreter::instance( getIntf() );
+    VarBool *pVisible = pInterpreter->getVarBool( rData.m_visible, m_pTheme );
+
     CtrlImage *pImage = new CtrlImage( getIntf(), *pBmp,
-                                UString( getIntf(), rData.m_help.c_str() ) );
+        UString( getIntf(), rData.m_help.c_str() ), pVisible );
 
     // Compute the position of the control
     const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
@@ -331,16 +390,17 @@ void Builder::addImage( const BuilderData::Image &rData )
                                        pBmp->getHeight(), *pLayout );
 
     // XXX: test to be changed! XXX
-    if( rData.m_onclickId == "move" )
+    if( rData.m_actionId == "move" )
     {
         CtrlMove *pMove = new CtrlMove( getIntf(), m_pTheme->getWindowManager(),
-             *pImage, *pWindow, UString( getIntf(), rData.m_help.c_str() ) );
+             *pImage, *pWindow, UString( getIntf(), rData.m_help.c_str() ),
+             NULL);
         pLayout->addControl( pMove, pos, rData.m_layer );
     }
-    else if( rData.m_onclickId == "resize" )
+    else if( rData.m_actionId == "resize" )
     {
         CtrlResize *pResize = new CtrlResize( getIntf(), *pImage, *pLayout,
-                UString( getIntf(), rData.m_help.c_str() ) );
+                UString( getIntf(), rData.m_help.c_str() ), NULL );
         pLayout->addControl( pResize, pos, rData.m_layer );
     }
     else
@@ -348,7 +408,7 @@ void Builder::addImage( const BuilderData::Image &rData )
         pLayout->addControl( pImage, pos, rData.m_layer );
     }
 
-    m_pTheme->m_controls[uniqueId( rData.m_id) ] = CtrlGenericPtr( pImage );
+    m_pTheme->m_controls[rData.m_id] = CtrlGenericPtr( pImage );
 }
 
 
@@ -357,11 +417,11 @@ void Builder::addText( const BuilderData::Text &rData )
     GenericLayout *pLayout = m_pTheme->m_layouts[rData.m_layoutId].get();
     if( pLayout == NULL )
     {
-        msg_Err( getIntf(), "Unknown Layout id: %s", rData.m_layoutId.c_str() );
+        msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
         return;
     }
 
-    GenericFont *pFont = m_pTheme->m_fonts[rData.m_fontId].get();
+    GenericFont *pFont = getFont( rData.m_fontId );
     if( pFont == NULL )
     {
         msg_Err( getIntf(), "Unknown font id: %s", rData.m_fontId.c_str() );
@@ -374,8 +434,13 @@ void Builder::addText( const BuilderData::Text &rData )
     pVar->set( msg );
     m_pTheme->m_vars.push_back( VariablePtr( pVar ) );
 
+    // Get the visibility variable
+    // XXX check when it is null
+    Interpreter *pInterpreter = Interpreter::instance( getIntf() );
+    VarBool *pVisible = pInterpreter->getVarBool( rData.m_visible, m_pTheme );
+
     CtrlText *pText = new CtrlText( getIntf(), *pVar, *pFont,
-            UString( getIntf(), rData.m_help.c_str() ) );
+        UString( getIntf(), rData.m_help.c_str() ), rData.m_color, pVisible );
 
     int height = pFont->getSize();
 
@@ -384,7 +449,7 @@ void Builder::addText( const BuilderData::Text &rData )
                                           rData.m_yPos + height, *pLayout ),
                          rData.m_layer );
 
-    m_pTheme->m_controls[uniqueId( rData.m_id) ] = CtrlGenericPtr( pText );
+    m_pTheme->m_controls[rData.m_id] = CtrlGenericPtr( pText );
 }
 
 
@@ -397,23 +462,29 @@ void Builder::addRadialSlider( const BuilderData::RadialSlider &rData )
     GenericLayout *pLayout = m_pTheme->m_layouts[rData.m_layoutId].get();
     if( pLayout == NULL )
     {
-        msg_Err( getIntf(), "Unknown Layout id: %s", rData.m_layoutId.c_str() );
+        msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
         return;
     }
 
     // Get the variable associated to the slider
-    VarPercent *pVar = m_interpreter.getVarPercent( rData.m_value, m_pTheme );
+    Interpreter *pInterpreter = Interpreter::instance( getIntf() );
+    VarPercent *pVar = pInterpreter->getVarPercent( rData.m_value, m_pTheme );
     if( pVar == NULL )
     {
         msg_Err( getIntf(), "Unknown slider value: %s", rData.m_value.c_str() );
         return;
     }
 
+    // Get the visibility variable
+    // XXX check when it is null
+    VarBool *pVisible = pInterpreter->getVarBool( rData.m_visible, m_pTheme );
+
     // Create the control
     CtrlRadialSlider *pRadial =
         new CtrlRadialSlider( getIntf(), *pSeq, rData.m_nbImages, *pVar,
                               rData.m_minAngle, rData.m_maxAngle,
-                              UString( getIntf(), rData.m_help.c_str() ) );
+                              UString( getIntf(), rData.m_help.c_str() ),
+                              pVisible );
 
     // XXX: resizing is not supported
     // Compute the position of the control
@@ -424,7 +495,7 @@ void Builder::addRadialSlider( const BuilderData::RadialSlider &rData )
 
     pLayout->addControl( pRadial, pos, rData.m_layer );
 
-    m_pTheme->m_controls[uniqueId( rData.m_id) ] = CtrlGenericPtr( pRadial );
+    m_pTheme->m_controls[rData.m_id] = CtrlGenericPtr( pRadial );
 }
 
 
@@ -443,11 +514,10 @@ void Builder::addSlider( const BuilderData::Slider &rData )
     GenericLayout *pLayout = m_pTheme->m_layouts[rData.m_layoutId].get();
     if( pLayout == NULL )
     {
-        msg_Err( getIntf(), "Unknown Layout id: %s", rData.m_layoutId.c_str() );
+        msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
         return;
     }
 
-    // XXX: memory leak!
     Bezier *pCurve = getPoints( rData.m_points.c_str() );
     if( pCurve == NULL )
     {
@@ -455,13 +525,15 @@ void Builder::addSlider( const BuilderData::Slider &rData )
                  rData.m_points.c_str() );
         return;
     }
+    m_pTheme->m_curves.push_back( BezierPtr( pCurve ) );
 
     // Get the visibility variable
     // XXX check when it is null
-    VarBool *pVisible = m_interpreter.getVarBool( rData.m_visible, m_pTheme );
+    Interpreter *pInterpreter = Interpreter::instance( getIntf() );
+    VarBool *pVisible = pInterpreter->getVarBool( rData.m_visible, m_pTheme );
 
     // Get the variable associated to the slider
-    VarPercent *pVar = m_interpreter.getVarPercent( rData.m_value, m_pTheme );
+    VarPercent *pVar = pInterpreter->getVarPercent( rData.m_value, m_pTheme );
     if( pVar == NULL )
     {
         msg_Err( getIntf(), "Unknown slider value: %s", rData.m_value.c_str() );
@@ -487,9 +559,8 @@ void Builder::addSlider( const BuilderData::Slider &rData )
     pLayout->addControl( pBackground, pos, rData.m_layer );
     pLayout->addControl( pCursor, pos, rData.m_layer );
 
-    string newId = uniqueId( rData.m_id );
-    m_pTheme->m_controls[newId] = CtrlGenericPtr( pCursor );
-    m_pTheme->m_controls[newId + "_bg"] = CtrlGenericPtr( pBackground );
+    m_pTheme->m_controls[rData.m_id] = CtrlGenericPtr( pCursor );
+    m_pTheme->m_controls[rData.m_id + "_bg"] = CtrlGenericPtr( pBackground );
 }
 
 
@@ -498,11 +569,11 @@ void Builder::addList( const BuilderData::List &rData )
     GenericLayout *pLayout = m_pTheme->m_layouts[rData.m_layoutId].get();
     if( pLayout == NULL )
     {
-        msg_Err( getIntf(), "Unknown Layout id: %s", rData.m_layoutId.c_str() );
+        msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
         return;
     }
 
-    GenericFont *pFont = m_pTheme->m_fonts[rData.m_fontId].get();
+    GenericFont *pFont = getFont( rData.m_fontId );
     if( pFont == NULL )
     {
         msg_Err( getIntf(), "Unknown font id: %s", rData.m_fontId.c_str() );
@@ -510,18 +581,23 @@ void Builder::addList( const BuilderData::List &rData )
     }
 
     // Get the list variable
-    VarList *pVar = m_interpreter.getVarList( rData.m_var, m_pTheme );
+    Interpreter *pInterpreter = Interpreter::instance( getIntf() );
+    VarList *pVar = pInterpreter->getVarList( rData.m_var, m_pTheme );
     if( pVar == NULL )
     {
         msg_Err( getIntf(), "No such list variable: %s", rData.m_var.c_str() );
         return;
     }
 
+    // Get the visibility variable
+    // XXX check when it is null
+    VarBool *pVisible = pInterpreter->getVarBool( rData.m_visible, m_pTheme );
+
     // Create the list control
     CtrlList *pList = new CtrlList( getIntf(), *pVar, *pFont,
        rData.m_fgColor, rData.m_playColor, rData.m_bgColor1,
        rData.m_bgColor2, rData.m_selColor,
-       UString( getIntf(), rData.m_help.c_str() ) );
+       UString( getIntf(), rData.m_help.c_str() ), pVisible );
 
     // Compute the position of the control
     const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
@@ -531,49 +607,39 @@ void Builder::addList( const BuilderData::List &rData )
 
     pLayout->addControl( pList, pos, rData.m_layer );
 
-    m_pTheme->m_controls[uniqueId( rData.m_id) ] = CtrlGenericPtr( pList );
+    m_pTheme->m_controls[rData.m_id] = CtrlGenericPtr( pList );
 }
 
 
-const string Builder::generateId() const
+void Builder::addVideo( const BuilderData::Video &rData )
 {
-    static int i = 1;
-
-    const string base = "_ReservedId_";
-    char genId[base.size() + 4];
-    snprintf( genId, base.size() + 4, "%s%i", base.c_str(), i );
-    i++;
-    return genId;
-}
+    GenericLayout *pLayout = m_pTheme->m_layouts[rData.m_layoutId].get();
+    if( pLayout == NULL )
+    {
+        msg_Err( getIntf(), "unknown layout id: %s", rData.m_layoutId.c_str() );
+        return;
+    }
 
+    // Get the visibility variable
+    // XXX check when it is null
+    Interpreter *pInterpreter = Interpreter::instance( getIntf() );
+    VarBool *pVisible = pInterpreter->getVarBool( rData.m_visible, m_pTheme );
 
-const string Builder::uniqueId( const string &id )
-{
-    string newId;
+    CtrlVideo *pVideo = new CtrlVideo( getIntf(),
+        UString( getIntf(), rData.m_help.c_str() ), pVisible );
 
-    if( m_idSet.find( id ) != m_idSet.end() )
-    {
-        // The id was already used
-        if( id != "none" )
-        {
-            msg_Warn( getIntf(), "Non unique id: %s", id.c_str() );
-        }
-        newId = generateId();
-    }
-    else
-    {
-        // OK, this is a new id
-        newId = id;
-    }
+    // Compute the position of the control
+    const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
+                                       rData.m_xPos, rData.m_yPos,
+                                       rData.m_width, rData.m_height,
+                                       *pLayout );
 
-    // Add the id to the set
-    m_idSet.insert( newId );
+    pLayout->addControl( pVideo, pos, rData.m_layer );
 
-    return newId;
+    m_pTheme->m_controls[rData.m_id] = CtrlGenericPtr( pVideo );
 }
 
 
-
 const Position Builder::makePosition( const string &rLeftTop,
                                       const string &rRightBottom,
                                       int xPos, int yPos, int width,
@@ -643,22 +709,50 @@ const Position Builder::makePosition( const string &rLeftTop,
 }
 
 
+GenericFont *Builder::getFont( const string &fontId )
+{
+    GenericFont *pFont = m_pTheme->m_fonts[fontId].get();
+    if( !pFont && fontId == "defaultfont" )
+    {
+#ifdef WIN32_SKINS
+        string defaultFont = (string)getIntf()->p_libvlc->psz_vlcpath +
+                             "\\skins2\\fonts\\FreeSans.ttf";
+#else
+        string defaultFont = (string)DATA_PATH + "/skins2/fonts/FreeSans.ttf";
+#endif
+        pFont = new FT2Font( getIntf(), defaultFont, 12 );
+        if( pFont->init() )
+        {
+            m_pTheme->m_fonts["defaultfont"] = GenericFontPtr( pFont );
+        }
+        else
+        {
+            delete pFont;
+            pFont = NULL;
+        }
+    }
+    return pFont;
+}
+
+
 Bezier *Builder::getPoints( const char *pTag ) const
 {
-    vector<double> xBez, yBez;
+    vector<float> xBez, yBez;
     int x, y, n;
     while( 1 )
     {
-        if( sscanf( pTag, "(%d,%d)%n", &x, &y, &n ) < 2 )
+        if( sscanf( pTag, "(%d,%d)%n", &x, &y, &n ) < 1 )
         {
             return NULL;
         }
+#if 0
         if( x < 0 || y < 0 )
         {
             msg_Err( getIntf(),
                      "Slider points cannot have negative coordinates!" );
             return NULL;
         }
+#endif
         xBez.push_back( x );
         yBez.push_back( y );
         pTag += n;