Commit b7dc5e88 authored by Cyril Deguet's avatar Cyril Deguet

* all: brand new skins interface ( still _experimental_) for x11 and

  win32, by ipkiss and myself...
 Among the features:
 - framework rewritten from scratch, heavily based on design patterns
  => new controls can be (hopefully) created more easily, portability
  to other OS is better, and the interface is less dependant from
  the vlc core
 - new concept of "layout", to provide a window with several different
  views (as in winamp3 skins)
 - controls can now be placed at a relative position to the edges of
  a window, which allow controls and layouts to be resizable (e.g
  for the playlist window)
 - Use of libpng and libfreetype2 for better portability between x11 and
   win32 => ttf fonts and antialiasing
 - New DTD for the xml theme ( *it will probably change again* )
 - Very very beginning of scripting in the xml file
 - And many things I miss
 - And probably many bugs ;)
parent 4fc0ccfa
SOURCES_skins = \
commands/async_queue.cpp \
commands/async_queue.hpp \
commands/cmd_add_item.cpp \
commands/cmd_add_item.hpp \
commands/cmd_generic.hpp \
commands/cmd_change_skin.cpp \
commands/cmd_change_skin.hpp \
commands/cmd_dialogs.hpp \
commands/cmd_input.cpp \
commands/cmd_input.hpp \
commands/cmd_layout.cpp \
commands/cmd_layout.hpp \
commands/cmd_notify_playlist.cpp \
commands/cmd_notify_playlist.hpp \
commands/cmd_on_top.cpp \
commands/cmd_on_top.hpp \
commands/cmd_playlist.cpp \
commands/cmd_playlist.hpp \
commands/cmd_quit.cpp \
commands/cmd_quit.hpp \
commands/cmd_resize.cpp \
commands/cmd_resize.hpp \
commands/cmd_show_window.hpp \
\
controls/ctrl_button.cpp \
controls/ctrl_button.hpp \
controls/ctrl_checkbox.cpp \
controls/ctrl_checkbox.hpp \
controls/ctrl_flat.hpp \
controls/ctrl_generic.cpp \
controls/ctrl_generic.hpp \
controls/ctrl_image.cpp \
controls/ctrl_image.hpp \
controls/ctrl_list.cpp \
controls/ctrl_list.hpp \
controls/ctrl_move.cpp \
controls/ctrl_move.hpp \
controls/ctrl_resize.cpp \
controls/ctrl_resize.hpp \
controls/ctrl_slider.cpp \
controls/ctrl_slider.hpp \
controls/ctrl_radialslider.cpp \
controls/ctrl_radialslider.hpp \
controls/ctrl_text.hpp \
controls/ctrl_text.cpp \
\
events/evt_enter.hpp \
events/evt_generic.hpp \
events/evt_focus.hpp \
events/evt_input.cpp \
events/evt_input.hpp \
events/evt_key.cpp \
events/evt_key.hpp \
events/evt_leave.hpp \
events/evt_motion.hpp \
events/evt_mouse.cpp \
events/evt_mouse.hpp \
events/evt_refresh.hpp \
events/evt_special.cpp \
events/evt_special.hpp \
events/evt_scroll.cpp \
events/evt_scroll.hpp \
\
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/wrappers.cpp \
parser/wrappers.h \
\
src/anchor.cpp \
src/anchor.hpp \
src/dialogs.cpp \
src/dialogs.hpp \
src/ft2_bitmap.cpp \
src/ft2_bitmap.hpp \
src/ft2_font.cpp \
src/ft2_font.hpp \
src/generic_bitmap.hpp \
src/generic_font.hpp \
src/generic_layout.cpp \
src/generic_layout.hpp \
src/generic_window.cpp \
src/generic_window.hpp \
src/logger.cpp \
src/logger.hpp \
src/os_factory.cpp \
src/os_factory.hpp \
src/os_graphics.hpp \
src/os_loop.hpp \
src/os_timer.hpp \
src/os_window.hpp \
src/os_tooltip.hpp \
src/png_bitmap.cpp \
src/png_bitmap.hpp \
src/scaled_bitmap.cpp \
src/scaled_bitmap.hpp \
src/skin_main.cpp \
src/skin_common.hpp \
src/theme.cpp \
src/theme.hpp \
src/theme_loader.cpp \
src/theme_loader.hpp \
src/tooltip.cpp \
src/tooltip.hpp \
src/var_manager.cpp \
src/var_manager.hpp \
src/vlcproc.cpp \
src/vlcproc.hpp \
src/window_manager.cpp \
src/window_manager.hpp \
\
utils/bezier.cpp \
utils/bezier.hpp \
utils/fsm.cpp \
utils/fsm.hpp \
utils/observer.hpp \
utils/pointer.hpp \
utils/position.cpp \
utils/position.hpp \
utils/ustring.cpp \
utils/ustring.hpp \
utils/variable.hpp \
utils/var_bool.cpp \
utils/var_bool.hpp \
utils/var_list.cpp \
utils/var_list.hpp \
utils/var_percent.cpp \
utils/var_percent.hpp \
utils/var_text.cpp \
utils/var_text.hpp \
\
vars/playlist.cpp \
vars/playlist.hpp \
vars/time.cpp \
vars/time.hpp \
vars/volume.cpp \
vars/volume.hpp \
vars/vlcvars.cpp \
vars/vlcvars.hpp \
\
win32/win32_dragdrop.cpp \
win32/win32_dragdrop.hpp \
win32/win32_factory.cpp \
win32/win32_factory.hpp \
win32/win32_graphics.cpp \
win32/win32_graphics.hpp \
win32/win32_loop.cpp \
win32/win32_loop.hpp \
win32/win32_timer.cpp \
win32/win32_timer.hpp \
win32/win32_tooltip.cpp \
win32/win32_tooltip.hpp \
win32/win32_window.cpp \
win32/win32_window.hpp \
\
x11/x11_display.cpp \
x11/x11_display.hpp \
x11/x11_dragdrop.cpp \
x11/x11_dragdrop.hpp \
x11/x11_factory.cpp \
x11/x11_factory.hpp \
x11/x11_graphics.cpp \
x11/x11_graphics.hpp \
x11/x11_loop.cpp \
x11/x11_loop.hpp \
x11/x11_timer.cpp \
x11/x11_timer.hpp \
x11/x11_window.cpp \
x11/x11_window.hpp \
x11/x11_tooltip.cpp \
x11/x11_tooltip.hpp \
$(NULL)
/*****************************************************************************
* async_queue.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: async_queue.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <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
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "async_queue.hpp"
#include "../src/os_factory.hpp"
#include "../src/os_timer.hpp"
AsyncQueue::AsyncQueue( intf_thread_t *pIntf ): SkinObject( pIntf )
{
// Create a timer
OSFactory *pOsFactory = OSFactory::instance( pIntf );
m_pTimer = pOsFactory->createOSTimer( Callback( this, &doFlush ) );
// Flush the queue every 10 ms
m_pTimer->start( 10, false );
}
AsyncQueue::~AsyncQueue()
{
}
AsyncQueue *AsyncQueue::instance( intf_thread_t *pIntf )
{
if( ! pIntf->p_sys->p_queue )
{
AsyncQueue *pQueue;
pQueue = new AsyncQueue( pIntf );
if( pQueue )
{
// Initialization succeeded
pIntf->p_sys->p_queue = pQueue;
}
}
return pIntf->p_sys->p_queue;
}
void AsyncQueue::destroy( intf_thread_t *pIntf )
{
if( pIntf->p_sys->p_queue )
{
delete pIntf->p_sys->p_queue;
pIntf->p_sys->p_queue = NULL;
}
}
void AsyncQueue::push( const CmdGenericPtr &rcCommand )
{
m_cmdList.push_back( rcCommand );
}
void AsyncQueue::remove( const string &rType )
{
list<CmdGenericPtr>::iterator it;
for( it = m_cmdList.begin(); it != m_cmdList.end(); it++ )
{
// Remove the command if it is of the given type
if( (*it).get()->getType() == rType )
{
list<CmdGenericPtr>::iterator itNew = it;
itNew++;
m_cmdList.erase( it );
it = itNew;
}
}
}
void AsyncQueue::flush()
{
while( m_cmdList.size() > 0 )
{
// Execute the first command in the queue
CmdGenericPtr &rcCommand = m_cmdList.front();
rcCommand.get()->execute();
// And remove it
m_cmdList.pop_front();
}
}
void AsyncQueue::doFlush( SkinObject *pObj )
{
AsyncQueue *pThis = (AsyncQueue*)pObj;
// Flush the queue
pThis->flush();
}
/*****************************************************************************
* async_queue.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: async_queue.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
*
* Authors: Cyril Deguet <asmax@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
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef ASYNC_QUEUE_HPP
#define ASYNC_QUEUE_HPP
#include "cmd_generic.hpp"
#include <list>
#include <string>
class OSTimer;
/// Asynchronous queue for commands
class AsyncQueue: public SkinObject
{
public:
/// Get the instance of AsyncQueue
/// Returns NULL if initialization failed.
static AsyncQueue *instance( intf_thread_t *pIntf );
/// Destroy the instance of AsyncQueue
static void destroy( intf_thread_t *pIntf );
/// Add a command in the queue
void push( const CmdGenericPtr &rcCommand );
/// Remove the commands of the given type
void remove( const string &rType );
/// Flush the queue and execute the commands
void flush();
private:
/// Command queue
list<CmdGenericPtr> m_cmdList;
/// Timer
OSTimer *m_pTimer;
// Private because it is a singleton
AsyncQueue( intf_thread_t *pIntf );
virtual ~AsyncQueue();
/// Callback for the timer
static void doFlush( SkinObject *pObj );
};
#endif
/*****************************************************************************
* cmd_add_item.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: cmd_add_item.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <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
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include <vlc/vlc.h>
#include "cmd_add_item.hpp"
void CmdAddItem::execute()
{
playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
if( pPlaylist == NULL )
{
return;
}
if( m_playNow )
{
// Enqueue and play the item
playlist_Add( pPlaylist, m_name.c_str(), 0, 0,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
}
else
{
// Enqueue the item only
playlist_Add( pPlaylist, m_name.c_str(), 0, 0,
PLAYLIST_APPEND, PLAYLIST_END );
}
}
/*****************************************************************************
* cmd_add_item.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: cmd_add_item.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <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
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef CMD_ADD_ITEM_HPP
#define CMD_ADD_ITEM_HPP
#include "cmd_generic.hpp"
#include <string>
/// "Add item" command
class CmdAddItem: public CmdGeneric
{
public:
CmdAddItem( intf_thread_t *pIntf, const string &rName, bool playNow ):
CmdGeneric( pIntf ), m_name( rName ), m_playNow( playNow ) {}
virtual ~CmdAddItem() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "add item"; }
private:
/// Name of the item to enqueue
string m_name;
/// Should we play the item immediately?
bool m_playNow;
};
#endif
/*****************************************************************************
* cmd_change_skin.cpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: cmd_change_skin.cpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <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
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "cmd_change_skin.hpp"
#include "cmd_quit.hpp"
#include "../src/os_factory.hpp"
#include "../src/os_loop.hpp"
#include "../src/theme.hpp"
#include "../src/theme_loader.hpp"
void CmdChangeSkin::execute()
{
// Save the old theme to restore it in case of problem
Theme *pOldTheme = getIntf()->p_sys->p_theme;
if( pOldTheme )
{
pOldTheme->getWindowManager().hideAll();
}
ThemeLoader loader( getIntf() );
if( loader.load( m_file ) )
{
// Everything went well
msg_Dbg( getIntf(), "New theme successfully loaded (%s)",
m_file.c_str() );
if( pOldTheme )
{
delete pOldTheme;
}
}
else if( pOldTheme )
{
msg_Err( getIntf(), "A problem occurred when loading the new theme,"
" restoring the previous one" );
getIntf()->p_sys->p_theme = pOldTheme;
pOldTheme->getWindowManager().showAll();
}
else
{
msg_Err( getIntf(), "Cannot load the theme, aborting" );
// Quit
CmdQuit cmd( getIntf() );
cmd.execute();
}
}
/*****************************************************************************
* cmd_change_skin.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: cmd_change_skin.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
*
* Authors: Cyril Deguet <asmax@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
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef CMD_CHANGE_SKIN_HPP
#define CMD_CHANGE_SKIN_HPP
#include "cmd_generic.hpp"
class WindowManager;
/// "Change Skin" command
class CmdChangeSkin: public CmdGeneric
{
public:
CmdChangeSkin( intf_thread_t *pIntf, const string &rFile ):
CmdGeneric( pIntf ), m_file( rFile ) {}
virtual ~CmdChangeSkin() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "change skin"; }
private:
/// Skin file to load
string m_file;
};
#endif
/*****************************************************************************
* cmd_dialogs.hpp
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: cmd_dialogs.hpp,v 1.1 2004/01/03 23:31:33 asmax Exp $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulire <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
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef CMD_DIALOGS_HPP
#define CMD_DIALOGS_HPP
#include "cmd_generic.hpp"
#include "../src/dialogs.hpp"
#include "cmd_change_skin.hpp"
template<int TYPE = 0> class CmdDialogs;
// XXX use an enum instead
typedef CmdDialogs<1> CmdDlgChangeSkin;
typedef CmdDialogs<2> CmdDlgFileSimple;
typedef CmdDialogs<3> CmdDlgFile;
typedef CmdDialogs<4> CmdDlgDisc;
typedef CmdDialogs<5> CmdDlgNet;
typedef CmdDialogs<6> CmdDlgMessages;
typedef CmdDialogs<7> CmdDlgPrefs;
typedef CmdDialogs<8> CmdDlgFileInfo;
typedef CmdDialogs<9> CmdDlgPopupMenu;
typedef CmdDialogs<10> CmdDlgAdd;
/// Generic "Open dialog" command
template<int TYPE>
class CmdDialogs: public CmdGeneric
{
public:
CmdDialogs( intf_thread_t *pIntf ): CmdGeneric( pIntf ) {}
virtual ~CmdDialogs() {}
/// This method does the real job of the command
virtual void execute()
{
/// Get the dialogs provider
Dialogs *pDialogs = Dialogs::instance( getIntf() );
if( pDialogs == NULL )
{
return;
}
switch( TYPE )
{
case 1:
pDialogs->showChangeSkin();
break;