/*****************************************************************************
* theme.cpp
*****************************************************************************
- * Copyright (C) 2003 VideoLAN
+ * Copyright (C) 2003 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
- * Olivier Teulière <ipkiss@via.ecp.fr>
+ * Olivier Teulière <ipkiss@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
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "theme.hpp"
if( !strcmp( save, "" ) )
{
// Show the windows
- m_windowManager.showAll();
+ m_windowManager.showAll( true );
return;
}
// Save config to file
config_PutPsz( getIntf(), "skins2-config", save );
- config_SaveConfigFile( getIntf(), "skins2" );
// Free memory
delete[] save;
} \
return (*it).second.get();
+// This macro takes an ID of the form "id1;id2;id3", and returns the object
+// corresponding to the first valid ID. If no ID is valid, it returns NULL.
+// XXX: should we use a template method instead?
+#define FIND_FIRST_OBJECT( mapDataPtr, mapName ) \
+ string rightPart = id; \
+ string::size_type pos; \
+ do \
+ { \
+ pos = rightPart.find( ";" ); \
+ string leftPart = rightPart.substr( 0, pos ); \
+ map<string, mapDataPtr>::const_iterator it = mapName.find( leftPart ); \
+ if( it != mapName.end() ) \
+ { \
+ return (*it).second.get(); \
+ break; \
+ } \
+ \
+ if( pos != string::npos ) \
+ { \
+ rightPart = rightPart.substr( pos, rightPart.size() ); \
+ rightPart = \
+ rightPart.substr( rightPart.find_first_not_of( " \t;" ), \
+ rightPart.size() ); \
+ } \
+ } \
+ while( pos != string::npos ); \
+ return NULL;
+
GenericBitmap *Theme::getBitmapById( const string &id )
{
- FIND_OBJECT( GenericBitmapPtr, m_bitmaps );
+ FIND_FIRST_OBJECT( GenericBitmapPtr, m_bitmaps );
}
GenericFont *Theme::getFontById( const string &id )
{
- FIND_OBJECT( GenericFontPtr, m_fonts );
+ FIND_FIRST_OBJECT( GenericFontPtr, m_fonts );
+}
+
+Popup *Theme::getPopupById( const string &id )
+{
+ FIND_OBJECT( PopupPtr, m_popups );
}
TopWindow *Theme::getWindowById( const string &id )