Commit 3a5ec777 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/*: don't forget to delete the timer.
   Use wxApp::OnExit() to cleanup the dialogs provider.
   Added a "Miscellaneous" section to the menu. Added a "Switch interface" and "Add interface" entries to this menu.
* modules/gui/skins/src/*: dialog providers have object types of VLC_OBJECT_DIALOGS.
   Don't forget to attach/detach the dialogs provider to its parent intf.
   Work around a bug in imlib2 when we close the plugin.
* src/misc/objects.c, include/vlc_objects.h: added VLC_OBJECT_DIALOGS for dialogs providers.
* src/interface/interface.c, include/vlc_interface.h: added 2 object variables to switch/add interfaces on the fly (intf-switch and intf-add).
parent 980bfb98
...@@ -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.6 2003/09/18 17:54:02 zorglub Exp $ * $Id: vlc_interface.h,v 1.7 2003/10/14 22:41:41 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -52,8 +52,8 @@ struct intf_thread_t ...@@ -52,8 +52,8 @@ struct intf_thread_t
vlc_bool_t b_block; vlc_bool_t b_block;
/* Specific interfaces */ /* Specific interfaces */
intf_console_t * p_console; /** console */ intf_console_t * p_console; /** console */
intf_sys_t * p_sys; /** system interface */ intf_sys_t * p_sys; /** system interface */
/** Interface module */ /** Interface module */
module_t * p_module; module_t * p_module;
...@@ -67,6 +67,9 @@ struct intf_thread_t ...@@ -67,6 +67,9 @@ struct intf_thread_t
vlc_mutex_t change_lock; vlc_mutex_t change_lock;
vlc_bool_t b_menu_change; vlc_bool_t b_menu_change;
vlc_bool_t b_menu; vlc_bool_t b_menu;
/* Provides the ability to switch an interface on the fly */
char *psz_switch_intf;
}; };
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlc_objects.h: vlc_object_t definition. * vlc_objects.h: vlc_object_t definition.
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: vlc_objects.h,v 1.19 2003/10/08 21:01:07 gbazin Exp $ * $Id: vlc_objects.h,v 1.20 2003/10/14 22:41:41 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#define VLC_OBJECT_HTTPD (-12) #define VLC_OBJECT_HTTPD (-12)
#define VLC_OBJECT_PACKETIZER (-13) #define VLC_OBJECT_PACKETIZER (-13)
#define VLC_OBJECT_ENCODER (-14) #define VLC_OBJECT_ENCODER (-14)
#define VLC_OBJECT_DIALOGS (-15)
#define VLC_OBJECT_GENERIC (-666) #define VLC_OBJECT_GENERIC (-666)
......
...@@ -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.14 2003/09/05 15:55:30 asmax Exp $ * $Id: dialogs.cpp,v 1.15 2003/10/14 22:41:41 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -55,7 +55,8 @@ Dialogs::Dialogs( intf_thread_t *_p_intf ) ...@@ -55,7 +55,8 @@ Dialogs::Dialogs( intf_thread_t *_p_intf )
b_popup_change = VLC_FALSE; b_popup_change = VLC_FALSE;
/* Allocate descriptor */ /* Allocate descriptor */
p_provider = (intf_thread_t *)vlc_object_create( p_intf, VLC_OBJECT_INTF ); p_provider = (intf_thread_t *)vlc_object_create( p_intf,
VLC_OBJECT_DIALOGS );
if( p_provider == NULL ) if( p_provider == NULL )
{ {
msg_Err( p_intf, "out of memory" ); msg_Err( p_intf, "out of memory" );
...@@ -71,6 +72,9 @@ Dialogs::Dialogs( intf_thread_t *_p_intf ) ...@@ -71,6 +72,9 @@ Dialogs::Dialogs( intf_thread_t *_p_intf )
return; return;
} }
/* Attach the dialogs provider to its parent interface */
vlc_object_attach( p_provider, p_intf );
/* Initialize dialogs provider /* Initialize dialogs provider
* (returns as soon as initialization is done) */ * (returns as soon as initialization is done) */
if( p_provider->pf_run ) p_provider->pf_run( p_provider ); if( p_provider->pf_run ) p_provider->pf_run( p_provider );
...@@ -91,6 +95,9 @@ Dialogs::~Dialogs() ...@@ -91,6 +95,9 @@ Dialogs::~Dialogs()
{ {
if( p_provider && p_module ) if( p_provider && p_module )
{ {
/* Detach the dialogs provider from its parent interface */
vlc_object_detach( p_provider );
module_Unneed( p_provider, p_module ); module_Unneed( p_provider, p_module );
vlc_object_destroy( p_provider ); vlc_object_destroy( p_provider );
} }
......
...@@ -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.47 2003/07/20 10:38:49 gbazin Exp $ * $Id: skin_main.cpp,v 1.48 2003/10/14 22:41:41 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>
...@@ -204,7 +204,10 @@ static void Close ( vlc_object_t *p_this ) ...@@ -204,7 +204,10 @@ static void Close ( vlc_object_t *p_this )
#if defined X11_SKINS #if defined X11_SKINS
XDestroyWindow( p_intf->p_sys->display, p_intf->p_sys->mainWin ); XDestroyWindow( p_intf->p_sys->display, p_intf->p_sys->mainWin );
XCloseDisplay( p_intf->p_sys->display );
// There is a bug in imlib2 which prevents us from closing the display
// (__imlib_RenderImage() can free old GC with already closed display)
//XCloseDisplay( p_intf->p_sys->display );
#endif #endif
// Unsuscribe to messages bank // Unsuscribe to messages bank
......
...@@ -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.64 2003/10/08 12:18:50 zorglub Exp $ * $Id: interface.cpp,v 1.65 2003/10/14 22:41:41 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -127,6 +127,7 @@ enum ...@@ -127,6 +127,7 @@ enum
Prefs_Event, Prefs_Event,
Extra_Event, Extra_Event,
Skins_Event,
SliderScroll_Event, SliderScroll_Event,
StopStream_Event, StopStream_Event,
...@@ -258,6 +259,9 @@ Interface::Interface( intf_thread_t *_p_intf ): ...@@ -258,6 +259,9 @@ Interface::Interface( intf_thread_t *_p_intf ):
#endif #endif
UpdateAcceleratorTable(); UpdateAcceleratorTable();
/* Start timer */
timer = new Timer( p_intf, this );
} }
Interface::~Interface() Interface::~Interface()
...@@ -266,7 +270,9 @@ Interface::~Interface() ...@@ -266,7 +270,9 @@ Interface::~Interface()
{ {
delete p_intf->p_sys->p_wxwindow; delete p_intf->p_sys->p_wxwindow;
} }
/* Clean up */ /* Clean up */
delete timer;
} }
/***************************************************************************** /*****************************************************************************
...@@ -327,7 +333,6 @@ void Interface::CreateOurMenuBar() ...@@ -327,7 +333,6 @@ void Interface::CreateOurMenuBar()
settings_menu->AppendCheckItem( Extra_Event, wxU(_("&Extended GUI") ), settings_menu->AppendCheckItem( Extra_Event, wxU(_("&Extended GUI") ),
wxU(_(EXTRA_PREFS)) ); wxU(_(EXTRA_PREFS)) );
/* Create the "Audio" menu */ /* Create the "Audio" menu */
p_audio_menu = new wxMenu; p_audio_menu = new wxMenu;
b_audio_menu = 1; b_audio_menu = 1;
...@@ -340,6 +345,10 @@ void Interface::CreateOurMenuBar() ...@@ -340,6 +345,10 @@ void Interface::CreateOurMenuBar()
p_navig_menu = new wxMenu; p_navig_menu = new wxMenu;
b_navig_menu = 1; b_navig_menu = 1;
/* Create the "Miscellaneous" menu */
p_misc_menu = new wxMenu;
b_misc_menu = 1;
/* Create the "Help" menu */ /* Create the "Help" menu */
wxMenu *help_menu = new wxMenu; wxMenu *help_menu = new wxMenu;
help_menu->Append( About_Event, wxU(_("&About...")), wxU(_(HELP_ABOUT)) ); help_menu->Append( About_Event, wxU(_("&About...")), wxU(_(HELP_ABOUT)) );
...@@ -352,6 +361,7 @@ void Interface::CreateOurMenuBar() ...@@ -352,6 +361,7 @@ void Interface::CreateOurMenuBar()
menubar->Append( p_audio_menu, wxU(_("&Audio")) ); menubar->Append( p_audio_menu, wxU(_("&Audio")) );
menubar->Append( p_video_menu, wxU(_("&Video")) ); menubar->Append( p_video_menu, wxU(_("&Video")) );
menubar->Append( p_navig_menu, wxU(_("&Navigation")) ); menubar->Append( p_navig_menu, wxU(_("&Navigation")) );
menubar->Append( p_misc_menu, wxU(_("&Miscellaneous")) );
menubar->Append( help_menu, wxU(_("&Help")) ); menubar->Append( help_menu, wxU(_("&Help")) );
/* Attach the menu bar to the frame */ /* Attach the menu bar to the frame */
...@@ -739,6 +749,25 @@ void Interface::OnMenuOpen(wxMenuEvent& event) ...@@ -739,6 +749,25 @@ void Interface::OnMenuOpen(wxMenuEvent& event)
} }
else b_navig_menu = 1; else b_navig_menu = 1;
} }
else if( event.GetEventObject() == p_misc_menu )
{
if( b_misc_menu )
{
p_misc_menu = MiscMenu( p_intf, this );
/* Work-around for buggy wxGTK */
wxMenu *menu = GetMenuBar()->GetMenu( 6 );
RecursiveDestroy( menu );
/* End work-around */
menu = GetMenuBar()->Replace( 6, p_misc_menu,
wxU(_("&Miscellaneous")));
if( menu ) delete menu;
b_misc_menu = 0;
}
else b_misc_menu = 1;
}
#else #else
p_audio_menu = AudioMenu( p_intf, this ); p_audio_menu = AudioMenu( p_intf, this );
...@@ -753,6 +782,9 @@ void Interface::OnMenuOpen(wxMenuEvent& event) ...@@ -753,6 +782,9 @@ void Interface::OnMenuOpen(wxMenuEvent& event)
menu = GetMenuBar()->Replace( 5, p_navig_menu, wxU(_("&Navigation")) ); menu = GetMenuBar()->Replace( 5, p_navig_menu, wxU(_("&Navigation")) );
if( menu ) delete menu; if( menu ) delete menu;
p_misc_menu = MiscMenu( p_intf, this );
menu = GetMenuBar()->Replace( 6, p_misc_menu, wxU(_("&Miscellaneous")) );
if( menu ) delete menu;
#endif #endif
} }
...@@ -1242,7 +1274,7 @@ void wxVolCtrl::OnChange( wxMouseEvent& event ) ...@@ -1242,7 +1274,7 @@ void wxVolCtrl::OnChange( wxMouseEvent& event )
void wxVolCtrl::Change( int i_volume ) void wxVolCtrl::Change( int i_volume )
{ {
aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_MAX / 200 ); aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_MAX / 200 / 2 );
SetValue( i_volume ); SetValue( i_volume );
SetToolTip( wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"), SetToolTip( wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"),
i_volume ) ); i_volume ) );
......
...@@ -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.20 2003/08/28 15:59:04 gbazin Exp $ * $Id: menus.cpp,v 1.21 2003/10/14 22:41:41 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -72,7 +72,8 @@ enum ...@@ -72,7 +72,8 @@ enum
AudioMenu_Events = wxID_HIGHEST + 2000, AudioMenu_Events = wxID_HIGHEST + 2000,
VideoMenu_Events = wxID_HIGHEST + 3000, VideoMenu_Events = wxID_HIGHEST + 3000,
NavigMenu_Events = wxID_HIGHEST + 4000, NavigMenu_Events = wxID_HIGHEST + 4000,
PopupMenu_Events = wxID_HIGHEST + 5000 MiscMenu_Events = wxID_HIGHEST + 5000,
PopupMenu_Events = wxID_HIGHEST + 6000
}; };
BEGIN_EVENT_TABLE(Menu, wxMenu) BEGIN_EVENT_TABLE(Menu, wxMenu)
...@@ -135,6 +136,10 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent, ...@@ -135,6 +136,10 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
pi_objects[i++] = p_object->i_object_id; pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "deinterlace"; ppsz_varnames[i] = "deinterlace";
pi_objects[i++] = p_object->i_object_id; pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "aspect-ratio";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "crop";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "directx-on-top"; ppsz_varnames[i] = "directx-on-top";
pi_objects[i++] = p_object->i_object_id; pi_objects[i++] = p_object->i_object_id;
vlc_object_release( p_object ); vlc_object_release( p_object );
...@@ -170,6 +175,24 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent, ...@@ -170,6 +175,24 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
/* Interface menu */
ppsz_varnames[i++] = NULL; /* Separator */
ppsz_varnames[i++] = _("Interface menu");
ppsz_varnames[i++] = NULL; /* Separator */
/* vlc_object_find is needed because of the dialogs provider case */
p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INTF,
FIND_PARENT );
if( p_object != NULL )
{
ppsz_varnames[i] = "intf-switch";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "intf-add";
pi_objects[i++] = p_object->i_object_id;
vlc_object_release( p_object );
}
/* Build menu */ /* Build menu */
Menu popupmenu( p_intf, p_parent, i, Menu popupmenu( p_intf, p_parent, i,
ppsz_varnames, pi_objects, PopupMenu_Events ); ppsz_varnames, pi_objects, PopupMenu_Events );
...@@ -239,6 +262,10 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent ) ...@@ -239,6 +262,10 @@ wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
pi_objects[i++] = p_object->i_object_id; pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "deinterlace"; ppsz_varnames[i] = "deinterlace";
pi_objects[i++] = p_object->i_object_id; pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "aspect-ratio";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "crop";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "directx-on-top"; ppsz_varnames[i] = "directx-on-top";
pi_objects[i++] = p_object->i_object_id; pi_objects[i++] = p_object->i_object_id;
vlc_object_release( p_object ); vlc_object_release( p_object );
...@@ -302,6 +329,32 @@ wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent ) ...@@ -302,6 +329,32 @@ wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
ppsz_varnames, pi_objects, NavigMenu_Events ); ppsz_varnames, pi_objects, NavigMenu_Events );
} }
wxMenu *MiscMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
{
vlc_object_t *p_object;
char *ppsz_varnames[10];
int pi_objects[10];
int i = 0;
/* Initializations */
memset( pi_objects, 0, 4 * sizeof(int) );
p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INTF,
FIND_PARENT );
if( p_object != NULL )
{
ppsz_varnames[i] = "intf-switch";
pi_objects[i++] = p_object->i_object_id;
ppsz_varnames[i] = "intf-add";
pi_objects[i++] = p_object->i_object_id;
vlc_object_release( p_object );
}
/* Build menu */
return new Menu( _p_intf, p_parent, i,
ppsz_varnames, pi_objects, MiscMenu_Events );
}
/***************************************************************************** /*****************************************************************************
* Constructor. * Constructor.
*****************************************************************************/ *****************************************************************************/
......
...@@ -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.32 2003/09/07 22:53:09 fenrir Exp $ * $Id: timer.cpp,v 1.33 2003/10/14 22:41:41 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -113,7 +113,7 @@ void Timer::Notify() ...@@ -113,7 +113,7 @@ void Timer::Notify()
/* Take care of the volume */ /* Take care of the volume */
audio_volume_t i_volume; audio_volume_t i_volume;
aout_VolumeGet( p_intf, &i_volume ); aout_VolumeGet( p_intf, &i_volume );
p_main_interface->volctrl->SetValue( i_volume * 200 / p_main_interface->volctrl->SetValue( i_volume * 200 * 2 /
AOUT_VOLUME_MAX ); AOUT_VOLUME_MAX );
p_main_interface->volctrl->SetToolTip( p_main_interface->volctrl->SetToolTip(
wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"), wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"),
......
...@@ -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.33 2003/10/04 14:59:38 gbazin Exp $ * $Id: wxwindows.cpp,v 1.34 2003/10/14 22:41:41 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -66,6 +66,7 @@ public: ...@@ -66,6 +66,7 @@ public:
Instance( intf_thread_t *_p_intf ); Instance( intf_thread_t *_p_intf );
bool OnInit(); bool OnInit();
int OnExit();
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
...@@ -272,9 +273,6 @@ bool Instance::OnInit() ...@@ -272,9 +273,6 @@ bool Instance::OnInit()
MainInterface->Show( TRUE ); MainInterface->Show( TRUE );
SetTopWindow( MainInterface ); SetTopWindow( MainInterface );
/* Start timer */
new Timer( p_intf, MainInterface );
} }
/* Creates the dialogs provider */ /* Creates the dialogs provider */
...@@ -291,6 +289,19 @@ bool Instance::OnInit() ...@@ -291,6 +289,19 @@ bool Instance::OnInit()
return TRUE; return TRUE;
} }
/*****************************************************************************
* Instance::OnExit: called when the interface execution stops
*****************************************************************************/
int Instance::OnExit()
{
if( p_intf->pf_show_dialog )
{
/* We need to manually clean up the dialogs class */
if( p_intf->p_sys->p_wxwindow ) delete p_intf->p_sys->p_wxwindow;
}
return 0;
}
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 ) intf_dialog_args_t *p_arg )
{ {
......
...@@ -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.64 2003/10/08 19:40:42 gbazin Exp $ * $Id: wxwindows.h,v 1.65 2003/10/14 22:41:41 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -225,6 +225,8 @@ private: ...@@ -225,6 +225,8 @@ private:
vlc_bool_t b_video_menu; vlc_bool_t b_video_menu;
wxMenu *p_navig_menu; wxMenu *p_navig_menu;
vlc_bool_t b_navig_menu; vlc_bool_t b_navig_menu;
wxMenu *p_misc_menu;
vlc_bool_t b_misc_menu;
}; };
/* Dialogs Provider */ /* Dialogs Provider */
...@@ -802,6 +804,7 @@ void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent, ...@@ -802,6 +804,7 @@ void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent ); wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent ); wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent ); wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
wxMenu *MiscMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
class MenuEvtHandler : public wxEvtHandler class MenuEvtHandler : public wxEvtHandler
{ {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* interface, such as command line. * interface, such as command line.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: interface.c,v 1.106 2003/09/18 17:54:02 zorglub Exp $ * $Id: interface.c,v 1.107 2003/10/14 22:41:41 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -52,6 +52,12 @@ ...@@ -52,6 +52,12 @@
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static void Manager( intf_thread_t *p_intf ); static void Manager( intf_thread_t *p_intf );
static void RunInterface( intf_thread_t *p_intf );
static int SwitchIntfCallback( vlc_object_t *, char const *,
vlc_value_t , vlc_value_t , void * );
static int AddIntfCallback( vlc_object_t *, char const *,
vlc_value_t , vlc_value_t , void * );
/***************************************************************************** /*****************************************************************************
* intf_Create: prepare interface before main loop * intf_Create: prepare interface before main loop
...@@ -142,7 +148,7 @@ int intf_RunThread( intf_thread_t *p_intf ) ...@@ -142,7 +148,7 @@ int intf_RunThread( intf_thread_t *p_intf )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_intf->pf_run( p_intf ); RunInterface( p_intf );
p_intf->b_die = VLC_TRUE; p_intf->b_die = VLC_TRUE;
...@@ -151,7 +157,7 @@ int intf_RunThread( intf_thread_t *p_intf ) ...@@ -151,7 +157,7 @@ int intf_RunThread( intf_thread_t *p_intf )
else else
{ {
/* Run the interface in a separate thread */ /* Run the interface in a separate thread */
if( vlc_thread_create( p_intf, "interface", p_intf->pf_run, if( vlc_thread_create( p_intf, "interface", RunInterface,
VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) ) VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) )
{ {
msg_Err( p_intf, "cannot spawn interface thread" ); msg_Err( p_intf, "cannot spawn interface thread" );
...@@ -209,9 +215,8 @@ void intf_Destroy( intf_thread_t *p_intf ) ...@@ -209,9 +215,8 @@ void intf_Destroy( intf_thread_t *p_intf )
vlc_object_destroy( p_intf ); vlc_object_destroy( p_intf );
} }
/* Following functions are local */
/* Following functions are local */
/***************************************************************************** /*****************************************************************************
* Manager: helper thread for blocking interfaces * Manager: helper thread for blocking interfaces
...@@ -246,3 +251,104 @@ static void Manager( intf_thread_t *p_intf ) ...@@ -246,3 +251,104 @@ static void Manager( intf_thread_t *p_intf )
} }
} }
/*****************************************************************************
* RunInterface: setups necessary data and give control to the interface
*****************************************************************************/
static void RunInterface( intf_thread_t *p_intf )
{
vlc_value_t val, text;
/* Variable used for interface switching */
p_intf->psz_switch_intf = NULL;
var_Create( p_intf, "intf-switch", VLC_VAR_STRING |
VLC_VAR_HASCHOICE | VLC_VAR_ISCOMMAND );
text.psz_string = _("Switch interface");
var_Change( p_intf, "intf-switch", VLC_VAR_SETTEXT, &text, NULL );
val.psz_string = "skins"; text.psz_string = "Skins";
var_Change( p_intf, "intf-switch", VLC_VAR_ADDCHOICE, &val, &text );
val.psz_string = "wxwin"; text.psz_string = "wxWindows";
var_Change( p_intf, "intf-switch", VLC_VAR_ADDCHOICE, &val, &text );
var_AddCallback( p_intf, "intf-switch", SwitchIntfCallback, NULL );
/* Variable used for interface spawning */
var_Create( p_intf, "intf-add", VLC_VAR_STRING |
VLC_VAR_HASCHOICE | VLC_VAR_ISCOMMAND );
text.psz_string = _("Add interface");
var_Change( p_intf, "intf-add", VLC_VAR_SETTEXT, &text, NULL );
val.psz_string = "rc"; text.psz_string = "Console";
var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text );
val.psz_string = "logger"; text.psz_string = "Debug logging";
var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text );
val.psz_string = "http"; text.psz_string = "HTTP remote control";
var_Change( p_intf, "intf-add", VLC_VAR_ADDCHOICE, &val, &text );
var_AddCallback( p_intf, "intf-add", AddIntfCallback, NULL );
/* Give control to the interface */
p_intf->pf_run( p_intf );
/* Provide ability to switch the main interface on the fly */
while( p_intf->psz_switch_intf )
{
char *psz_intf = p_intf->psz_switch_intf;
p_intf->psz_switch_intf = NULL;
p_intf->b_die = VLC_FALSE;
/* Make sure the old interface is completely uninitialised */
module_Unneed( p_intf, p_intf->p_module );
p_intf->p_module = module_Need( p_intf, "interface", psz_intf );
free( psz_intf );
if( p_intf->p_module )
{
p_intf->pf_run( p_intf );
}
else break;
}
}
static int SwitchIntfCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
p_intf->psz_switch_intf =
malloc( strlen(newval.psz_string) + sizeof(",none") );
sprintf( p_intf->psz_switch_intf, "%s,none", newval.psz_string );
p_intf->b_die = VLC_TRUE;
return VLC_SUCCESS;
}
static int AddIntfCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
intf_thread_t *p_intf;
char *psz_intf = malloc( strlen(newval.psz_string) + sizeof(",none") );
/* Try to create the interface */
sprintf( psz_intf, "%s,none", newval.psz_string );
p_intf = intf_Create( p_this, psz_intf );
free( psz_intf );
if( p_intf == NULL )
{
msg_Err( p_this, "interface \"%s\" initialization failed",
newval.psz_string );
return VLC_EGENERIC;
}
/* Try to run the interface */
p_intf->b_block = VLC_FALSE;
if( intf_RunThread( p_intf ) != VLC_SUCCESS )
{
vlc_object_detach( p_intf );
intf_Destroy( p_intf );
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* objects.c: vlc_object_t handling * objects.c: vlc_object_t handling
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: objects.c,v 1.41 2003/10/08 21:01:07 gbazin Exp $ * $Id: objects.c,v 1.42 2003/10/14 22:41:41 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -115,6 +115,10 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type ) ...@@ -115,6 +115,10 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type )
i_size = sizeof(intf_thread_t); i_size = sizeof(intf_thread_t);
psz_type = "interface"; psz_type = "interface";
break; break;
case VLC_OBJECT_DIALOGS:
i_size = sizeof(intf_thread_t);
psz_type = "dialogs provider";
break;
case VLC_OBJECT_PLAYLIST: case VLC_OBJECT_PLAYLIST:
i_size = sizeof(playlist_t); i_size = sizeof(playlist_t);
psz_type = "playlist"; psz_type = "playlist";
...@@ -274,13 +278,15 @@ void __vlc_object_destroy( vlc_object_t *p_this ) ...@@ -274,13 +278,15 @@ void __vlc_object_destroy( vlc_object_t *p_this )
if( p_this->i_children ) if( p_this->i_children )
{ {
msg_Err( p_this, "cannot delete object with children" ); msg_Err( p_this, "cannot delete object (%i, %s) with children" ,
p_this->i_object_id, p_this->psz_object_name );
return; return;
} }
if( p_this->p_parent ) if( p_this->p_parent )
{ {
msg_Err( p_this, "cannot delete object with a parent" ); msg_Err( p_this, "cannot delete object (%i, %s) with a parent",
p_this->i_object_id, p_this->psz_object_name );
return; return;
} }
......
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