* skin-main.cpp: skins plugin for VLC
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: skin_main.cpp,v 1.2 2003/03/19 03:11:14 karibu Exp $
+ * $Id: skin_main.cpp,v 1.15 2003/04/21 02:50:49 asmax Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
* USA.
*****************************************************************************/
+//--- GENERAL ---------------------------------------------------------------
+#include <wx/wx.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/vlc.h>
#include <vlc/aout.h>
//--- SKIN ------------------------------------------------------------------
-#include "os_api.h"
+#include "../os_api.h"
#include "event.h"
-#include "dialog.h"
-#include "os_dialog.h"
#include "banks.h"
#include "window.h"
#include "theme.h"
-#include "os_theme.h"
+#include "../os_theme.h"
#include "themeloader.h"
#include "vlcproc.h"
#include "skin_common.h"
+#include "wxdialogs.h"
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Exported interface functions.
//---------------------------------------------------------------------------
+#ifdef WIN32
extern "C" __declspec( dllexport )
int __VLC_SYMBOL( vlc_entry ) ( module_t *p_module );
+#endif
//---------------------------------------------------------------------------
// Local prototypes.
p_intf->p_sys->p_playlist = (playlist_t *)vlc_object_find( p_intf,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+ // Initialize conditions
+ vlc_mutex_init( p_intf, &p_intf->p_sys->init_lock);
+ vlc_cond_init( p_intf, &p_intf->p_sys->init_cond);
+
p_intf->p_sys->p_theme = (Theme *)new OSTheme( p_intf );
return( 0 );
// Unsuscribe to messages bank
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
-
-
+ // Destroy conditions
+ vlc_cond_destroy( &p_intf->p_sys->init_cond);
+ vlc_mutex_destroy( &p_intf->p_sys->init_lock);
+
// Destroy structure
free( p_intf->p_sys );
}
//---------------------------------------------------------------------------
static void Run( intf_thread_t *p_intf )
{
+
+#if !defined WIN32
+/* FIXME: should be elsewhere ? */
+ // Initialize GDK
+ int i_args = 1;
+ char *p_args[] = { "", NULL };
+ char **pp_args = p_args;
+
+ gdk_init( &i_args, &pp_args );
+#endif
+
int a = OSAPI_GetTime();
// Load a theme
if( skin_last == NULL || ! Loader->Load( skin_last ) )
{
// Too bad, it failed. Let's try with the default theme
+#if 0
if( ! Loader->Load( DEFAULT_SKIN_FILE ) )
+#else
+#ifdef WIN32
+ string default_dir = (string)p_intf->p_libvlc->psz_vlcpath +
+ DIRECTORY_SEPARATOR + "skins" +
+ DIRECTORY_SEPARATOR + "default" +
+ DIRECTORY_SEPARATOR + "theme.xml";
+#else
+// FIXME: find VLC directory
+ string default_dir = (string)"./share" +
+ DIRECTORY_SEPARATOR + "skins" +
+ DIRECTORY_SEPARATOR + "default" +
+ DIRECTORY_SEPARATOR + "theme.xml";
+#endif
+ if( ! Loader->Load( default_dir ) )
+#endif
{
// Last chance: the user can select a new theme file
+ wxFileDialog dialog( NULL, _("Open a skin file"), "", "",
+ "Skin files (*.vlt)|*.vlt|Skin files (*.xml)|*.xml|"
+ "All files|*.*", wxOPEN );
- // Initialize file structure
- OpenFileDialog *OpenFile;
- OpenFile = (OpenFileDialog *)new OSOpenFileDialog( _("Open skin"),
- false );
- OpenFile->AddFilter( _("Skin files"), "*.vlt" );
- OpenFile->AddFilter( _("Skin files"), "*.xml" );
- OpenFile->AddFilter( _("All files"), "*.*" );
-
- // Open dialog box
- if( OpenFile->Open() )
+ if( dialog.ShowModal() == wxID_OK )
{
// try to load selected file
- if( ! Loader->Load( OpenFile->FileList.front() ) )
+ if( ! Loader->Load( dialog.GetPath().c_str() ) )
{
// He, he, what the hell is he doing ?
- delete OpenFile;
delete Loader;
return;
}
}
else
{
- delete OpenFile;
delete Loader;
return;
}
-
- delete OpenFile;
}
}
// Refresh the whole interface
OSAPI_PostMessage( NULL, VLC_INTF_REFRESH, 0, (int)true );
- // Run interface message loop
OSRun( p_intf );
}
VLC_FALSE );
add_bool( "show_in_taskbar", VLC_TRUE, NULL, SKIN_TASKBAR,
SKIN_TASKBAR_LONG, VLC_FALSE );
- set_description( _("Skinnable Interface Module") );
+ set_description( _("Skinnable Interface") );
set_capability( "interface", 30 );
set_callbacks( Open, Close );
add_shortcut( "skins" );
OSAPI_PostMessage( NULL, VLC_INTF_REFRESH, 0, (long)false );
// Update the log window
- //p_intf->p_sys->p_theme->UpdateLog( p_intf->p_sys->p_sub );
+ p_intf->p_sys->MessagesDlg->UpdateLog();
+
+ // Update the file info window
+ p_intf->p_sys->InfoDlg->UpdateFileInfo();
//-------------------------------------------------------------------------
if( p_intf->p_sys->p_input != NULL && !p_intf->p_sys->p_input->b_die )
// Refresh slider
- //if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
- //{
+ // if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
+ if( p_input->stream.b_seekable )
+ {
#define p_area p_input->stream.p_selected_area
// Set value of sliders
delete[] text;
#undef p_area
- //}
+ }
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
//-------------------------------------------------------------------------
vlc_mutex_unlock( &p_intf->change_lock );
- return( TRUE );
+ return( VLC_TRUE );
}
-//---------------------------------------------------------------------------