Commit ae65b15b authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/*, include/vlc_interface.h: new generic "open file" dialog.
* modules/gui/skins/*: use the new generic "open file" dialog to load skins.
parent ce09ec77
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* interface, such as message output. * interface, such as message output.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vlc_interface.h,v 1.3 2003/07/17 18:58:23 gbazin Exp $ * $Id: vlc_interface.h,v 1.4 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
typedef struct intf_dialog_args_t intf_dialog_args_t;
/***************************************************************************** /*****************************************************************************
* intf_thread_t: describe an interface thread * intf_thread_t: describe an interface thread
***************************************************************************** *****************************************************************************
...@@ -45,7 +47,8 @@ struct intf_thread_t ...@@ -45,7 +47,8 @@ struct intf_thread_t
void ( *pf_run ) ( intf_thread_t * ); void ( *pf_run ) ( intf_thread_t * );
/* Specific for dialogs providers */ /* Specific for dialogs providers */
void ( *pf_show_dialog ) ( intf_thread_t *, int, int ); void ( *pf_show_dialog ) ( intf_thread_t *, int, int,
intf_dialog_args_t * );
/* XXX: new message passing stuff will go here */ /* XXX: new message passing stuff will go here */
vlc_mutex_t change_lock; vlc_mutex_t change_lock;
...@@ -53,6 +56,33 @@ struct intf_thread_t ...@@ -53,6 +56,33 @@ struct intf_thread_t
vlc_bool_t b_menu; vlc_bool_t b_menu;
}; };
/*****************************************************************************
* intf_dialog_args_t: arguments structure passed to a dialogs provider.
*****************************************************************************
* This struct describes the arguments passed to the dialogs provider.
* For now they are only used with INTF_DIALOG_FILE_GENERIC.
*****************************************************************************/
struct intf_dialog_args_t
{
char *psz_title;
vlc_bool_t b_blocking;
vlc_bool_t b_ready;
vlc_mutex_t lock;
vlc_cond_t wait;
char **psz_results;
int i_results;
void (*pf_callback) ( intf_dialog_args_t * );
void *p_arg;
/* Specifically for INTF_DIALOG_FILE_GENERIC */
char *psz_extensions;
vlc_bool_t b_save;
vlc_bool_t b_multiple;
};
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -93,3 +123,7 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) ); ...@@ -93,3 +123,7 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) );
#define INTF_DIALOG_PREFS 13 #define INTF_DIALOG_PREFS 13
#define INTF_DIALOG_POPUPMENU 20 #define INTF_DIALOG_POPUPMENU 20
#define INTF_DIALOG_FILE_GENERIC 30
#define INTF_DIALOG_EXIT 99
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dialogs.cpp: Handles all the different dialog boxes we provide. * dialogs.cpp: Handles all the different dialog boxes we provide.
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: dialogs.cpp,v 1.11 2003/07/17 18:58:23 gbazin Exp $ * $Id: dialogs.cpp,v 1.12 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -96,45 +96,87 @@ Dialogs::~Dialogs() ...@@ -96,45 +96,87 @@ Dialogs::~Dialogs()
} }
} }
void Dialogs::ShowDialog( intf_thread_t *p_intf, int i_dialog_event, void Dialogs::ShowOpen( bool b_play )
int i_arg )
{ {
if( p_provider && p_provider->pf_show_dialog )
p_provider->pf_show_dialog( p_provider, INTF_DIALOG_FILE,
(int)b_play, 0 );
} }
void Dialogs::ShowOpen( bool b_play ) static void ShowOpenSkinCallback( intf_dialog_args_t *p_arg )
{ {
if( p_provider && p_provider->pf_show_dialog ) if( p_arg->i_results )
p_provider->pf_show_dialog( p_provider, INTF_DIALOG_FILE, b_play ); {
intf_thread_t *p_intf = (intf_thread_t *)p_arg->p_arg;
p_intf->p_sys->p_new_theme_file = strdup( p_arg->psz_results[0] );
if( !p_arg->b_blocking )
{
// Tell vlc to change skin after hiding interface
OSAPI_PostMessage( NULL, VLC_HIDE, VLC_LOAD_SKIN, 0 );
}
}
} }
void Dialogs::ShowOpenSkin() void Dialogs::ShowOpenSkin( bool b_block )
{ {
if( p_provider && p_provider->pf_show_dialog ) if( p_provider && p_provider->pf_show_dialog )
p_provider->pf_show_dialog( p_provider, INTF_DIALOG_FILE, 0 ); {
intf_dialog_args_t *p_arg =
(intf_dialog_args_t *)malloc( sizeof(intf_dialog_args_t) );
memset( p_arg, 0, sizeof(intf_dialog_args_t) );
p_arg->b_blocking = b_block;
if( b_block )
{
vlc_mutex_init( p_intf, &p_arg->lock );
vlc_cond_init( p_intf, &p_arg->wait );
}
p_arg->psz_title = strdup( _("Open a skin file") );
p_arg->psz_extensions =
strdup( "Skin files (*.vlt)|*.vlt|Skin files (*.xml)|*.xml|" );
p_arg->p_arg = p_intf;
p_arg->pf_callback = ShowOpenSkinCallback;
p_provider->pf_show_dialog( p_provider, INTF_DIALOG_FILE_GENERIC,
0, p_arg );
if( b_block )
{
vlc_mutex_lock( &p_arg->lock );
if( !p_arg->b_ready )
{
vlc_cond_wait( &p_arg->wait, &p_arg->lock );
}
vlc_mutex_unlock( &p_arg->lock );
}
}
} }
void Dialogs::ShowMessages() void Dialogs::ShowMessages()
{ {
if( p_provider && p_provider->pf_show_dialog ) if( p_provider && p_provider->pf_show_dialog )
p_provider->pf_show_dialog( p_provider, INTF_DIALOG_MESSAGES, 0 ); p_provider->pf_show_dialog( p_provider, INTF_DIALOG_MESSAGES, 0, 0 );
} }
void Dialogs::ShowPrefs() void Dialogs::ShowPrefs()
{ {
if( p_provider && p_provider->pf_show_dialog ) if( p_provider && p_provider->pf_show_dialog )
p_provider->pf_show_dialog( p_provider, INTF_DIALOG_PREFS, 0 ); p_provider->pf_show_dialog( p_provider, INTF_DIALOG_PREFS, 0, 0 );
} }
void Dialogs::ShowFileInfo() void Dialogs::ShowFileInfo()
{ {
if( p_provider && p_provider->pf_show_dialog ) if( p_provider && p_provider->pf_show_dialog )
p_provider->pf_show_dialog( p_provider, INTF_DIALOG_FILEINFO, 0 ); p_provider->pf_show_dialog( p_provider, INTF_DIALOG_FILEINFO, 0, 0 );
} }
void Dialogs::ShowPopup() void Dialogs::ShowPopup()
{ {
if( p_provider && p_provider->pf_show_dialog ) if( p_provider && p_provider->pf_show_dialog )
p_provider->pf_show_dialog( p_provider, INTF_DIALOG_POPUPMENU, 0 ); p_provider->pf_show_dialog( p_provider, INTF_DIALOG_POPUPMENU, 0, 0 );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dialogs.h: Dialogs class * dialogs.h: Dialogs class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: dialogs.h,v 1.7 2003/07/17 17:30:40 gbazin Exp $ * $Id: dialogs.h,v 1.8 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -45,9 +45,8 @@ class Dialogs ...@@ -45,9 +45,8 @@ class Dialogs
// Destructor // Destructor
virtual ~Dialogs(); virtual ~Dialogs();
static void ShowDialog( intf_thread_t *, int, int );
void ShowOpen( bool b_play ); void ShowOpen( bool b_play );
void ShowOpenSkin(); void ShowOpenSkin( bool b_block );
void ShowMessages(); void ShowMessages();
void ShowPrefs(); void ShowPrefs();
void ShowFileInfo(); void ShowFileInfo();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* skin_common.h: Private Skin interface description * skin_common.h: Private Skin interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: skin_common.h,v 1.22 2003/07/17 17:30:40 gbazin Exp $ * $Id: skin_common.h,v 1.23 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -75,9 +75,6 @@ struct intf_sys_t ...@@ -75,9 +75,6 @@ struct intf_sys_t
// Interface dialogs // Interface dialogs
Dialogs *p_dialogs; Dialogs *p_dialogs;
// Send an event to show a dialog
void (*pf_showdialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg );
// Popup menu // Popup menu
vlc_bool_t b_popup_change; vlc_bool_t b_popup_change;
#if !defined(MODULE_NAME_IS_basic_skins) #if !defined(MODULE_NAME_IS_basic_skins)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* skin-main.cpp: skins plugin for VLC * skin-main.cpp: skins plugin for VLC
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: skin_main.cpp,v 1.46 2003/07/18 20:06:00 gbazin Exp $ * $Id: skin_main.cpp,v 1.47 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -87,8 +87,6 @@ static int Open ( vlc_object_t *p_this ) ...@@ -87,8 +87,6 @@ static int Open ( vlc_object_t *p_this )
}; };
p_intf->pf_run = Run; p_intf->pf_run = Run;
p_intf->p_sys->pf_showdialog = Dialogs::ShowDialog;
// Suscribe to messages bank // Suscribe to messages bank
p_intf->p_sys->p_sub = msg_Subscribe( p_intf ); p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
...@@ -269,36 +267,16 @@ static void Run( intf_thread_t *p_intf ) ...@@ -269,36 +267,16 @@ static void Run( intf_thread_t *p_intf )
if( !Loader->Load( user_skin ) && !Loader->Load( default_skin ) ) if( !Loader->Load( user_skin ) && !Loader->Load( default_skin ) )
{ {
#endif #endif
#if 0 p_intf->p_sys->p_dialogs->ShowOpenSkin( 1 /* block */ );
#if !defined(MODULE_NAME_IS_basic_skins)
wxMutexGuiEnter(); // try to load selected file
wxFileDialog dialog( NULL, if( !p_intf->p_sys->p_new_theme_file ||
wxU(_("Open a skin file")), wxT(""), wxT(""), !Loader->Load( (string)p_intf->p_sys->p_new_theme_file ) )
wxT("Skin files (*.vlt)|*.vlt|Skin files (*.xml)|*.xml|"
"All files|*.*"), wxOPEN );
if( dialog.ShowModal() == wxID_OK )
{
// try to load selected file
if( ! Loader->Load( (string)dialog.GetPath().mb_str() ) )
{
// He, he, what the hell is he doing ?
delete Loader;
wxMutexGuiLeave();
return;
}
wxMutexGuiLeave();
}
else
#endif
#endif
{ {
// He, he, what the hell is he doing ?
delete Loader; delete Loader;
#if 0 delete p_intf->p_sys->p_dialogs;
#if !defined(MODULE_NAME_IS_basic_skins) if( skin_last ) free( skin_last );
wxMutexGuiLeave();
#endif
#endif
return; return;
} }
} }
...@@ -308,6 +286,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -308,6 +286,7 @@ static void Run( intf_thread_t *p_intf )
p_intf->p_sys->p_theme->InitTheme(); p_intf->p_sys->p_theme->InitTheme();
p_intf->p_sys->p_theme->ShowTheme(); p_intf->p_sys->p_theme->ShowTheme();
if( skin_last ) free( skin_last );
delete Loader; delete Loader;
msg_Dbg( p_intf, "Load theme time : %i ms", OSAPI_GetTime() - a ); msg_Dbg( p_intf, "Load theme time : %i ms", OSAPI_GetTime() - a );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlcproc.cpp: VlcProc class * vlcproc.cpp: VlcProc class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: vlcproc.cpp,v 1.40 2003/06/24 22:26:01 asmax Exp $ * $Id: vlcproc.cpp,v 1.41 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -370,7 +370,7 @@ void VlcProc::LoadSkin() ...@@ -370,7 +370,7 @@ void VlcProc::LoadSkin()
{ {
if( p_intf->p_sys->p_new_theme_file == NULL ) if( p_intf->p_sys->p_new_theme_file == NULL )
{ {
p_intf->p_sys->p_dialogs->ShowOpenSkin(); p_intf->p_sys->p_dialogs->ShowOpenSkin( 0 /*none blocking*/ );
} }
else else
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dialogs.cpp : wxWindows plugin for vlc * dialogs.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: dialogs.cpp,v 1.3 2003/07/18 11:39:39 gbazin Exp $ * $Id: dialogs.cpp,v 1.4 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -63,6 +63,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame) ...@@ -63,6 +63,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
EVT_COMMAND(INTF_DIALOG_NET, wxEVT_DIALOG, DialogsProvider::OnOpenNet) EVT_COMMAND(INTF_DIALOG_NET, wxEVT_DIALOG, DialogsProvider::OnOpenNet)
EVT_COMMAND(INTF_DIALOG_FILE_SIMPLE, wxEVT_DIALOG, EVT_COMMAND(INTF_DIALOG_FILE_SIMPLE, wxEVT_DIALOG,
DialogsProvider::OnOpenFileSimple) DialogsProvider::OnOpenFileSimple)
EVT_COMMAND(INTF_DIALOG_FILE_GENERIC, wxEVT_DIALOG,
DialogsProvider::OnOpenFileGeneric)
EVT_COMMAND(INTF_DIALOG_PLAYLIST, wxEVT_DIALOG, EVT_COMMAND(INTF_DIALOG_PLAYLIST, wxEVT_DIALOG,
DialogsProvider::OnPlaylist) DialogsProvider::OnPlaylist)
...@@ -74,6 +76,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame) ...@@ -74,6 +76,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
DialogsProvider::OnFileInfo) DialogsProvider::OnFileInfo)
EVT_COMMAND(INTF_DIALOG_POPUPMENU, wxEVT_DIALOG, EVT_COMMAND(INTF_DIALOG_POPUPMENU, wxEVT_DIALOG,
DialogsProvider::OnPopupMenu) DialogsProvider::OnPopupMenu)
EVT_COMMAND(INTF_DIALOG_EXIT, wxEVT_DIALOG,
DialogsProvider::OnExitThread)
END_EVENT_TABLE() END_EVENT_TABLE()
/***************************************************************************** /*****************************************************************************
...@@ -90,6 +94,7 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent ) ...@@ -90,6 +94,7 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent )
p_messages_dialog = NULL; p_messages_dialog = NULL;
p_fileinfo_dialog = NULL; p_fileinfo_dialog = NULL;
p_prefs_dialog = NULL; p_prefs_dialog = NULL;
p_file_generic_dialog = NULL;
/* Give our interface a nice little icon */ /* Give our interface a nice little icon */
p_intf->p_sys->p_icon = new wxIcon( vlc_xpm ); p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
...@@ -110,6 +115,7 @@ DialogsProvider::~DialogsProvider() ...@@ -110,6 +115,7 @@ DialogsProvider::~DialogsProvider()
if( p_playlist_dialog ) delete p_playlist_dialog; if( p_playlist_dialog ) delete p_playlist_dialog;
if( p_messages_dialog ) delete p_messages_dialog; if( p_messages_dialog ) delete p_messages_dialog;
if( p_fileinfo_dialog ) delete p_fileinfo_dialog; if( p_fileinfo_dialog ) delete p_fileinfo_dialog;
if( p_file_generic_dialog ) delete p_file_generic_dialog;
if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon; if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon;
} }
...@@ -177,6 +183,77 @@ void DialogsProvider::OnPreferences( wxCommandEvent& WXUNUSED(event) ) ...@@ -177,6 +183,77 @@ void DialogsProvider::OnPreferences( wxCommandEvent& WXUNUSED(event) )
} }
} }
void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event )
{
intf_dialog_args_t *p_arg = (intf_dialog_args_t *)event.GetClientData();
if( p_arg == NULL )
{
msg_Dbg( p_intf, "OnOpenFileGeneric() called with NULL arg" );
return;
}
if( p_file_generic_dialog == NULL )
p_file_generic_dialog = new wxFileDialog( this );
if( p_file_generic_dialog )
{
p_file_generic_dialog->SetMessage( wxU(p_arg->psz_title) );
p_file_generic_dialog->SetWildcard( wxU(p_arg->psz_extensions) );
p_file_generic_dialog->SetStyle( (p_arg->b_save ? wxSAVE : wxOPEN) |
(p_arg->b_multiple ? wxMULTIPLE:0) );
}
if( p_file_generic_dialog &&
p_file_generic_dialog->ShowModal() == wxID_OK )
{
wxArrayString paths;
p_file_generic_dialog->GetPaths( paths );
p_arg->i_results = paths.GetCount();
p_arg->psz_results = (char **)malloc( p_arg->i_results *
sizeof(char *) );
for( size_t i = 0; i < paths.GetCount(); i++ )
{
p_arg->psz_results[i] = strdup( paths[i].mb_str() );
}
}
/* Callback */
if( p_arg->pf_callback )
{
p_arg->pf_callback( p_arg );
}
/* Blocking or not ? */
if( p_arg->b_blocking )
{
vlc_mutex_lock( &p_arg->lock );
p_arg->b_ready = 1;
vlc_cond_signal( &p_arg->wait );
vlc_mutex_unlock( &p_arg->lock );
}
/* Clean-up */
if( p_arg->b_blocking )
{
vlc_mutex_destroy( &p_arg->lock );
vlc_cond_destroy( &p_arg->wait );
}
if( p_arg->psz_results )
{
for( int i = 0; i < p_arg->i_results; i++ )
{
free( p_arg->psz_results[i] );
}
free( p_arg->psz_results );
}
if( p_arg->psz_title ) free( p_arg->psz_title );
if( p_arg->psz_extensions ) free( p_arg->psz_extensions );
free( p_arg );
}
void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event ) void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
{ {
playlist_t *p_playlist = playlist_t *p_playlist =
...@@ -248,3 +325,9 @@ void DialogsProvider::OnPopupMenu( wxCommandEvent& event ) ...@@ -248,3 +325,9 @@ void DialogsProvider::OnPopupMenu( wxCommandEvent& event )
::PopupMenu( p_intf, this, mousepos ); ::PopupMenu( p_intf, this, mousepos );
} }
void DialogsProvider::OnExitThread( wxCommandEvent& WXUNUSED(event) )
{
delete this;
wxTheApp->ExitMainLoop();
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* interface.cpp : wxWindows plugin for vlc * interface.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: interface.cpp,v 1.49 2003/07/19 16:33:55 gbazin Exp $ * $Id: interface.cpp,v 1.50 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -239,6 +239,10 @@ Interface::Interface( intf_thread_t *_p_intf ): ...@@ -239,6 +239,10 @@ Interface::Interface( intf_thread_t *_p_intf ):
Interface::~Interface() Interface::~Interface()
{ {
if( p_intf->p_sys->p_wxwindow )
{
delete p_intf->p_sys->p_wxwindow;
}
/* Clean up */ /* Clean up */
} }
...@@ -547,13 +551,13 @@ void Interface::OnContextMenu2(wxContextMenuEvent& event) ...@@ -547,13 +551,13 @@ void Interface::OnContextMenu2(wxContextMenuEvent& event)
} }
if( p_intf->p_sys->pf_show_dialog ) if( p_intf->p_sys->pf_show_dialog )
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 0 ); p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 0, 0 );
} }
#endif #endif
void Interface::OnContextMenu(wxMouseEvent& event) void Interface::OnContextMenu(wxMouseEvent& event)
{ {
if( p_intf->p_sys->pf_show_dialog ) if( p_intf->p_sys->pf_show_dialog )
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 0 ); p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 0, 0 );
} }
void Interface::OnExit( wxCommandEvent& WXUNUSED(event) ) void Interface::OnExit( wxCommandEvent& WXUNUSED(event) )
...@@ -619,7 +623,7 @@ void Interface::OnShowDialog( wxCommandEvent& event ) ...@@ -619,7 +623,7 @@ void Interface::OnShowDialog( wxCommandEvent& event )
} }
p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1 ); p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* menus.cpp : wxWindows plugin for vlc * menus.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: menus.cpp,v 1.16 2003/07/17 17:30:40 gbazin Exp $ * $Id: menus.cpp,v 1.17 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -585,7 +585,7 @@ void Menu::OnShowDialog( wxCommandEvent& event ) ...@@ -585,7 +585,7 @@ void Menu::OnShowDialog( wxCommandEvent& event )
} }
p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1 ); p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
} }
} }
...@@ -630,7 +630,7 @@ void MenuEvtHandler::OnShowDialog( wxCommandEvent& event ) ...@@ -630,7 +630,7 @@ void MenuEvtHandler::OnShowDialog( wxCommandEvent& event )
} }
p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1 ); p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.cpp : wxWindows plugin for vlc * playlist.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: messages.cpp,v 1.12 2003/07/12 13:33:10 gbazin Exp $ * $Id: messages.cpp,v 1.13 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* *
...@@ -119,7 +119,7 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -119,7 +119,7 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ):
/* Create the Verbose checkbox */ /* Create the Verbose checkbox */
wxCheckBox *verbose_checkbox = wxCheckBox *verbose_checkbox =
new wxCheckBox( messages_panel, Verbose_Event, wxU(_("Verbose")) ); new wxCheckBox( messages_panel, Verbose_Event, wxU(_("Verbose")) );
b_verbose = p_intf->p_libvlc->i_verbose > 0; b_verbose = p_intf->p_libvlc->i_verbose > 2;
verbose_checkbox->SetValue( b_verbose ); verbose_checkbox->SetValue( b_verbose );
/* Place everything in sizers */ /* Place everything in sizers */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.cpp : wxWindows plugin for vlc * playlist.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: playlist.cpp,v 1.13 2003/07/17 17:30:40 gbazin Exp $ * $Id: playlist.cpp,v 1.14 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* *
...@@ -363,7 +363,7 @@ void Playlist::OnOpen( wxCommandEvent& WXUNUSED(event) ) ...@@ -363,7 +363,7 @@ void Playlist::OnOpen( wxCommandEvent& WXUNUSED(event) )
void Playlist::OnAddFile( wxCommandEvent& WXUNUSED(event) ) void Playlist::OnAddFile( wxCommandEvent& WXUNUSED(event) )
{ {
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE_SIMPLE, 0 ); p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE_SIMPLE, 0, 0 );
#if 0 #if 0
Rebuild(); Rebuild();
...@@ -372,7 +372,7 @@ void Playlist::OnAddFile( wxCommandEvent& WXUNUSED(event) ) ...@@ -372,7 +372,7 @@ void Playlist::OnAddFile( wxCommandEvent& WXUNUSED(event) )
void Playlist::OnAddMRL( wxCommandEvent& WXUNUSED(event) ) void Playlist::OnAddMRL( wxCommandEvent& WXUNUSED(event) )
{ {
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE, 0 ); p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE, 0, 0 );
#if 0 #if 0
Rebuild(); Rebuild();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* timer.cpp : wxWindows plugin for vlc * timer.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: timer.cpp,v 1.28 2003/07/18 11:39:39 gbazin Exp $ * $Id: timer.cpp,v 1.29 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -284,7 +284,7 @@ static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable, ...@@ -284,7 +284,7 @@ static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
intf_thread_t *p_intf = (intf_thread_t *)param; intf_thread_t *p_intf = (intf_thread_t *)param;
if( p_intf->p_sys->pf_show_dialog ) if( p_intf->p_sys->pf_show_dialog )
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 0 ); p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 0, 0 );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.cpp : wxWindows plugin for vlc * wxwindows.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: wxwindows.cpp,v 1.22 2003/07/19 16:33:55 gbazin Exp $ * $Id: wxwindows.cpp,v 1.23 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -66,7 +66,7 @@ static int OpenDialogs ( vlc_object_t * ); ...@@ -66,7 +66,7 @@ static int OpenDialogs ( vlc_object_t * );
static void Run ( intf_thread_t * ); static void Run ( intf_thread_t * );
static void Init ( intf_thread_t * ); static void Init ( intf_thread_t * );
static void ShowDialog ( intf_thread_t *, int, int ); static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * );
/***************************************************************************** /*****************************************************************************
* Local classes declarations. * Local classes declarations.
...@@ -164,6 +164,14 @@ static void Close( vlc_object_t *p_this ) ...@@ -164,6 +164,14 @@ static void Close( vlc_object_t *p_this )
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub ); msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
if( p_intf->pf_show_dialog )
{
/* We must destroy the dialogs thread */
wxCommandEvent event( wxEVT_DIALOG, INTF_DIALOG_EXIT );
p_intf->p_sys->p_wxwindow->AddPendingEvent( event );
vlc_thread_join( p_intf );
}
/* Destroy structure */ /* Destroy structure */
free( p_intf->p_sys ); free( p_intf->p_sys );
} }
...@@ -286,10 +294,12 @@ bool Instance::OnInit() ...@@ -286,10 +294,12 @@ bool Instance::OnInit()
return TRUE; return TRUE;
} }
static void ShowDialog( intf_thread_t *p_intf, int i_dialog_event, int i_arg ) static void ShowDialog( intf_thread_t *p_intf, int i_dialog_event, int i_arg,
intf_dialog_args_t *p_arg )
{ {
wxCommandEvent event( wxEVT_DIALOG, i_dialog_event ); wxCommandEvent event( wxEVT_DIALOG, i_dialog_event );
event.SetInt( i_arg ); event.SetInt( i_arg );
event.SetClientData( p_arg );
/* Hack to prevent popup events to be enqueued when /* Hack to prevent popup events to be enqueued when
* one is already active */ * one is already active */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description * wxwindows.h: private wxWindows interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.46 2003/07/19 16:33:55 gbazin Exp $ * $Id: wxwindows.h,v 1.47 2003/07/20 10:38:49 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -53,7 +53,7 @@ class FileInfo; ...@@ -53,7 +53,7 @@ class FileInfo;
#if wxUSE_UNICODE #if wxUSE_UNICODE
# define wxU(utf8) wxString(utf8, wxConvUTF8) # define wxU(utf8) wxString(utf8, wxConvUTF8)
#else #else
# define wxU(ut8 ) wxString(wxConvUTF8.cMB2WC(ut8), *wxConvCurrent) # define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
#endif #endif
#else // ENABLE_NLS && HAVE_GETTEXT && WIN32 && !HAVE_INCLUDED_GETTEXT #else // ENABLE_NLS && HAVE_GETTEXT && WIN32 && !HAVE_INCLUDED_GETTEXT
...@@ -93,7 +93,8 @@ struct intf_sys_t ...@@ -93,7 +93,8 @@ struct intf_sys_t
int i_playing; /* playlist selected item */ int i_playing; /* playlist selected item */
/* Send an event to show a dialog */ /* Send an event to show a dialog */
void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg ); void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
intf_dialog_args_t *p_arg );
/* Popup menu */ /* Popup menu */
wxMenu *p_popup_menu; wxMenu *p_popup_menu;
...@@ -207,6 +208,7 @@ private: ...@@ -207,6 +208,7 @@ private:
void OnFileInfo( wxCommandEvent& event ); void OnFileInfo( wxCommandEvent& event );
void OnPreferences( wxCommandEvent& event ); void OnPreferences( wxCommandEvent& event );
void OnOpenFileGeneric( wxCommandEvent& event );
void OnOpenFileSimple( wxCommandEvent& event ); void OnOpenFileSimple( wxCommandEvent& event );
void OnOpenFile( wxCommandEvent& event ); void OnOpenFile( wxCommandEvent& event );
void OnOpenDisc( wxCommandEvent& event ); void OnOpenDisc( wxCommandEvent& event );
...@@ -217,6 +219,8 @@ private: ...@@ -217,6 +219,8 @@ private:
void OnIdle( wxIdleEvent& event ); void OnIdle( wxIdleEvent& event );
void OnExitThread( wxCommandEvent& event );
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
intf_thread_t *p_intf; intf_thread_t *p_intf;
...@@ -229,6 +233,7 @@ public: ...@@ -229,6 +233,7 @@ public:
Messages *p_messages_dialog; Messages *p_messages_dialog;
FileInfo *p_fileinfo_dialog; FileInfo *p_fileinfo_dialog;
wxFrame *p_prefs_dialog; wxFrame *p_prefs_dialog;
wxFileDialog *p_file_generic_dialog;
}; };
/* Open Dialog */ /* Open Dialog */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment