]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/parser/skin_parser.cpp
* skin_parser.cpp: fixed the hack for nums_ex.bmp/numbers.bmp
[vlc] / modules / gui / skins2 / parser / skin_parser.cpp
index 7f5a7e8c1c2db1df3c23e4fdab1078ff08d35f9b..8796238ecddb975e325e50e3c3ca798a6c87fd08 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * skin_parser.cpp
  *****************************************************************************
- * Copyright (C) 2004 VideoLAN
+ * Copyright (C) 2004 the VideoLAN team
  * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
@@ -22,6 +22,7 @@
  *****************************************************************************/
 
 #include "skin_parser.hpp"
+#include "../src/os_factory.hpp"
 #include <math.h>
 
 SkinParser::SkinParser( intf_thread_t *pIntf, const string &rFileName,
@@ -64,19 +65,34 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
         RequireDefault( "file" );
         RequireDefault( "alphacolor" );
 
-        const BuilderData::Bitmap bitmap( uniqueId( attr["id"] ),
+        m_curBitmapId = uniqueId( attr["id"] );
+        const BuilderData::Bitmap bitmap( m_curBitmapId,
                 convertFileName( attr["file"] ),
                 convertColor( attr["alphacolor"] ) );
         m_data.m_listBitmap.push_back( bitmap );
     }
 
+    else if( rName == "SubBitmap" )
+    {
+        RequireDefault( "id" );
+        RequireDefault( "x" );
+        RequireDefault( "y" );
+        RequireDefault( "width" );
+        RequireDefault( "height" );
+
+        const BuilderData::SubBitmap bitmap( uniqueId( attr["id"] ),
+                m_curBitmapId, atoi( attr["x"] ), atoi( attr["y"] ),
+                atoi( attr["width"] ), atoi( attr["height"] ) );
+        m_data.m_listSubBitmap.push_back( bitmap );
+    }
+
     else if( rName == "BitmapFont" )
     {
         RequireDefault( "id" );
         RequireDefault( "file" );
         CheckDefault( "type", "digits" );
 
-        const BuilderData::BitmapFont font( uniqueId( attr["id"] ),
+        const BuilderData::BitmapFont font( attr["id"],
                 convertFileName( attr["file"] ),
                 attr["type"] );
         m_data.m_listBitmapFont.push_back( font );
@@ -173,13 +189,14 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
         CheckDefault( "lefttop", "lefttop" );
         CheckDefault( "rightbottom", "lefttop" );
         CheckDefault( "action", "none" );
+        CheckDefault( "resize", "mosaic" );
         CheckDefault( "help", "" );
 
         const BuilderData::Image imageData( uniqueId( attr["id"] ),
                 atoi( attr["x"] ) + m_xOffset, atoi( attr["y"] ) + m_yOffset,
                 attr["lefttop"], attr["rightbottom"], attr["visible"],
-                attr["image"], attr["action"], attr["help"], m_curLayer,
-                m_curWindowId, m_curLayoutId );
+                attr["image"], attr["action"], attr["resize"], attr["help"],
+                m_curLayer, m_curWindowId, m_curLayoutId );
         m_curLayer++;
         m_data.m_listImage.push_back( imageData );
     }
@@ -214,6 +231,7 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
         CheckDefault( "height", "0" );
         CheckDefault( "lefttop", "lefttop" );
         CheckDefault( "rightbottom", "lefttop" );
+        CheckDefault( "bgimage", "none" );
         CheckDefault( "fgcolor", "#000000" );
         CheckDefault( "playcolor", "#FF0000" );
         CheckDefault( "bgcolor1", "#FFFFFF" );
@@ -226,7 +244,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
                 m_xOffset, atoi( attr["y"] ) + m_yOffset, attr["visible"],
                 atoi( attr["width"]), atoi( attr["height"] ),
                 attr["lefttop"], attr["rightbottom"],
-                attr["font"], "playlist", convertColor( attr["fgcolor"] ),
+                attr["font"], "playlist", attr["bgimage"],
+                convertColor( attr["fgcolor"] ),
                 convertColor( attr["playcolor"] ),
                 convertColor( attr["bgcolor1"] ),
                 convertColor( attr["bgcolor2"] ),
@@ -236,6 +255,46 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
         m_data.m_listList.push_back( listData );
     }
 
+    else if( rName == "Playtree" )
+    {
+        RequireDefault( "id" );
+        RequireDefault( "font" );
+        CheckDefault( "visible", "true" );
+        CheckDefault( "x", "0" );
+        CheckDefault( "y", "0" );
+        CheckDefault( "width", "0" );
+        CheckDefault( "height", "0" );
+        CheckDefault( "lefttop", "lefttop" );
+        CheckDefault( "rightbottom", "lefttop" );
+        CheckDefault( "bgimage", "none" );
+        CheckDefault( "itemimage", "none" );
+        CheckDefault( "openimage", "none" );
+        CheckDefault( "closedimage", "none" );
+        CheckDefault( "fgcolor", "#000000" );
+        CheckDefault( "playcolor", "#FF0000" );
+        CheckDefault( "bgcolor1", "#FFFFFF" );
+        CheckDefault( "bgcolor2", "#FFFFFF" );
+        CheckDefault( "selcolor", "#0000FF" );
+        CheckDefault( "help", "" );
+
+        m_curTreeId = uniqueId( attr["id"] );
+        const BuilderData::Tree treeData( m_curTreeId, atoi( attr["x"] ) +
+                m_xOffset, atoi( attr["y"] ) + m_yOffset, attr["visible"],
+                atoi( attr["width"]), atoi( attr["height"] ),
+                attr["lefttop"], attr["rightbottom"],
+                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"],
+                m_curLayer, m_curWindowId, m_curLayoutId );
+        m_curLayer++;
+        m_data.m_listTree.push_back( treeData );
+    }
+
     else if( rName == "RadialSlider" )
     {
         RequireDefault( "sequence" );
@@ -289,6 +348,11 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
             // Slider associated to a list
             newValue = "playlist.slider";
         }
+        else if( m_curTreeId != "" )
+        {
+            // Slider associated to a tree
+            newValue = "playtree.slider";
+        }
         const BuilderData::Slider slider( uniqueId( attr["id"] ),
                 attr["visible"],
                 atoi( attr["x"] ) + m_xOffset, atoi( attr["y"] ) + m_yOffset,
@@ -364,14 +428,15 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
         CheckDefault( "height", "0" );
         CheckDefault( "lefttop", "lefttop" );
         CheckDefault( "rightbottom", "lefttop" );
+        CheckDefault( "autoresize", "false" );
         CheckDefault( "help", "" );
 
         const BuilderData::Video videoData( uniqueId( attr["id"] ),
                 atoi( attr["x"] ) + m_xOffset, atoi( attr["y"] ) + m_yOffset,
                 atoi( attr["width"] ), atoi( attr["height" ]),
                 attr["lefttop"], attr["rightbottom"],
-                attr["visible"], attr["help"], m_curLayer,
-                m_curWindowId, m_curLayoutId );
+                attr["visible"], convertBoolean( attr["autoresize"] ),
+                attr["help"], m_curLayer, m_curWindowId, m_curLayoutId );
         m_curLayer++;
         m_data.m_listVideo.push_back( videoData );
     }
@@ -405,11 +470,14 @@ void SkinParser::handleEndElement( const string &rName )
         m_xOffsetList.pop_back();
         m_yOffsetList.pop_back();
     }
-
     else if( rName == "Playlist" )
     {
         m_curListId = "";
     }
+    else if( rName == "Playtree" )
+    {
+        m_curTreeId = "";
+    }
 }
 
 
@@ -430,7 +498,8 @@ int SkinParser::convertColor( const char *transcolor ) const
 
 string SkinParser::convertFileName( const char *fileName ) const
 {
-    return m_path + string( fileName );
+    OSFactory *pFactory = OSFactory::instance( getIntf() );
+    return m_path + pFactory->getDirSeparator() + string( fileName );
 }