Commit d9389c28 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/*:

  + added a "Open Capture Device..." menu entry.
  + a bit of clean-up.
parent 9f61c50e
...@@ -39,6 +39,59 @@ ...@@ -39,6 +39,59 @@
/* include the icon graphic */ /* include the icon graphic */
#include "../../../share/vlc32x32.xpm" #include "../../../share/vlc32x32.xpm"
/* Dialogs Provider */
class DialogsProvider: public wxFrame
{
public:
/* Constructor */
DialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
virtual ~DialogsProvider();
private:
void Open( int i_access_method, int i_arg );
/* Event handlers (these functions should _not_ be virtual) */
void OnExit( wxCommandEvent& event );
void OnPlaylist( wxCommandEvent& event );
void OnMessages( wxCommandEvent& event );
void OnFileInfo( wxCommandEvent& event );
void OnPreferences( wxCommandEvent& event );
void OnStreamWizardDialog( wxCommandEvent& event );
void OnWizardDialog( wxCommandEvent& event );
void OnBookmarks( wxCommandEvent& event );
void OnOpenFileGeneric( wxCommandEvent& event );
void OnOpenFileSimple( wxCommandEvent& event );
void OnOpenFile( wxCommandEvent& event );
void OnOpenDisc( wxCommandEvent& event );
void OnOpenNet( wxCommandEvent& event );
void OnOpenCapture( wxCommandEvent& event );
void OnOpenSat( wxCommandEvent& event );
void OnPopupMenu( wxCommandEvent& event );
void OnIdle( wxIdleEvent& event );
void OnExitThread( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
public:
/* Secondary windows */
OpenDialog *p_open_dialog;
wxFileDialog *p_file_dialog;
Playlist *p_playlist_dialog;
Messages *p_messages_dialog;
FileInfo *p_fileinfo_dialog;
StreamDialog *p_streamwizard_dialog;
WizardDialog *p_wizard_dialog;
wxFrame *p_prefs_dialog;
wxWindow *p_bookmarks_dialog;
wxFileDialog *p_file_generic_dialog;
};
DEFINE_LOCAL_EVENT_TYPE( wxEVT_DIALOG ); DEFINE_LOCAL_EVENT_TYPE( wxEVT_DIALOG );
BEGIN_EVENT_TABLE(DialogsProvider, wxFrame) BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
...@@ -49,6 +102,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame) ...@@ -49,6 +102,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
EVT_COMMAND(INTF_DIALOG_FILE, wxEVT_DIALOG, DialogsProvider::OnOpenFile) EVT_COMMAND(INTF_DIALOG_FILE, wxEVT_DIALOG, DialogsProvider::OnOpenFile)
EVT_COMMAND(INTF_DIALOG_DISC, wxEVT_DIALOG, DialogsProvider::OnOpenDisc) EVT_COMMAND(INTF_DIALOG_DISC, wxEVT_DIALOG, DialogsProvider::OnOpenDisc)
EVT_COMMAND(INTF_DIALOG_NET, wxEVT_DIALOG, DialogsProvider::OnOpenNet) EVT_COMMAND(INTF_DIALOG_NET, wxEVT_DIALOG, DialogsProvider::OnOpenNet)
EVT_COMMAND(INTF_DIALOG_CAPTURE, wxEVT_DIALOG,
DialogsProvider::OnOpenCapture)
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, EVT_COMMAND(INTF_DIALOG_FILE_GENERIC, wxEVT_DIALOG,
...@@ -74,6 +129,11 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame) ...@@ -74,6 +129,11 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
DialogsProvider::OnExitThread) DialogsProvider::OnExitThread)
END_EVENT_TABLE() END_EVENT_TABLE()
wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent )
{
return new DialogsProvider( p_intf, p_parent );
}
/***************************************************************************** /*****************************************************************************
* Constructor. * Constructor.
*****************************************************************************/ *****************************************************************************/
...@@ -355,6 +415,11 @@ void DialogsProvider::OnOpenNet( wxCommandEvent& event ) ...@@ -355,6 +415,11 @@ void DialogsProvider::OnOpenNet( wxCommandEvent& event )
Open( NET_ACCESS, event.GetInt() ); Open( NET_ACCESS, event.GetInt() );
} }
void DialogsProvider::OnOpenCapture( wxCommandEvent& event )
{
Open( CAPTURE_ACCESS, event.GetInt() );
}
void DialogsProvider::Open( int i_access_method, int i_arg ) void DialogsProvider::Open( int i_access_method, int i_arg )
{ {
/* Show/hide the open dialog */ /* Show/hide the open dialog */
......
...@@ -113,6 +113,7 @@ enum ...@@ -113,6 +113,7 @@ enum
OpenFile_Event, OpenFile_Event,
OpenDisc_Event, OpenDisc_Event,
OpenNet_Event, OpenNet_Event,
OpenCapture_Event,
OpenSat_Event, OpenSat_Event,
OpenOther_Event, OpenOther_Event,
EjectDisc_Event, EjectDisc_Event,
...@@ -183,6 +184,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) ...@@ -183,6 +184,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
EVT_MENU(OpenFile_Event, Interface::OnShowDialog) EVT_MENU(OpenFile_Event, Interface::OnShowDialog)
EVT_MENU(OpenDisc_Event, Interface::OnShowDialog) EVT_MENU(OpenDisc_Event, Interface::OnShowDialog)
EVT_MENU(OpenNet_Event, Interface::OnShowDialog) EVT_MENU(OpenNet_Event, Interface::OnShowDialog)
EVT_MENU(OpenCapture_Event, Interface::OnShowDialog)
EVT_MENU(OpenSat_Event, Interface::OnShowDialog) EVT_MENU(OpenSat_Event, Interface::OnShowDialog)
EVT_MENU(StreamWizard_Event, Interface::OnShowDialog) EVT_MENU(StreamWizard_Event, Interface::OnShowDialog)
EVT_MENU(Wizard_Event, Interface::OnShowDialog) EVT_MENU(Wizard_Event, Interface::OnShowDialog)
...@@ -316,61 +318,32 @@ void Interface::OnControlEvent( wxCommandEvent& event ) ...@@ -316,61 +318,32 @@ void Interface::OnControlEvent( wxCommandEvent& event )
*****************************************************************************/ *****************************************************************************/
void Interface::CreateOurMenuBar() void Interface::CreateOurMenuBar()
{ {
#define HELP_SIMPLE N_("Quick file open")
#define HELP_ADV N_("Advanced open")
#define HELP_FILE N_("Open a file")
#define HELP_DISC N_("Open Disc Media")
#define HELP_NET N_("Open a network stream")
#define HELP_SAT N_("Open a satellite stream")
#define HELP_EJECT N_("Eject the DVD/CD")
#define HELP_EXIT N_("Exit this program")
#define HELP_STREAMWIZARD N_("Open the streaming wizard")
#define HELP_PLAYLIST N_("Open the playlist")
#define HELP_LOGS N_("Show the program logs")
#define HELP_FILEINFO N_("Show information about the file being played")
#define HELP_PREFS N_("Go to the preferences menu")
#define HELP_EXTENDED N_("Shows the extended GUI")
#define HELP_BOOKMARKS N_("Shows the bookmarks window")
#define HELP_ABOUT N_("About this program")
/* Create the "File" menu */ /* Create the "File" menu */
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append( OpenFileSimple_Event, file_menu->Append( OpenFileSimple_Event,
wxU(_("Quick &Open File...\tCtrl-O")), wxU(_("Quick &Open File...\tCtrl-O")) );
wxU(_(HELP_SIMPLE)) );
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append( OpenFile_Event, wxU(_("Open &File...\tCtrl-F")), file_menu->Append( OpenFile_Event, wxU(_("Open &File...\tCtrl-F")) );
wxU(_(HELP_FILE))); file_menu->Append( OpenDisc_Event, wxU(_("Open &Disc...\tCtrl-D")) );
file_menu->Append( OpenDisc_Event, wxU(_("Open &Disc...\tCtrl-D")),
wxU(_(HELP_DISC)));
file_menu->Append( OpenNet_Event, file_menu->Append( OpenNet_Event,
wxU(_("Open &Network Stream...\tCtrl-N")), wxU(_("Open &Network Stream...\tCtrl-N")) );
wxU(_(HELP_NET))); file_menu->Append( OpenCapture_Event,
wxU(_("Open &Capture Device...\tCtrl-C")) );
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append( StreamWizard_Event, file_menu->Append( StreamWizard_Event,
wxU(_("Streaming &Wizard...\tCtrl-W")), wxU(_("Streaming &Wizard...\tCtrl-W")) );
wxU(_(HELP_STREAMWIZARD)) ); file_menu->Append( Wizard_Event, wxU(_("New Wizard...")) );
file_menu->Append( Wizard_Event, wxU(_("New Wizard...")),
wxU(_(HELP_STREAMWIZARD)) );
file_menu->AppendSeparator(); file_menu->AppendSeparator();
file_menu->Append( Exit_Event, wxU(_("E&xit\tCtrl-X")), file_menu->Append( Exit_Event, wxU(_("E&xit\tCtrl-X")) );
wxU(_(HELP_EXIT)) );
/* Create the "View" menu */ /* Create the "View" menu */
wxMenu *view_menu = new wxMenu; wxMenu *view_menu = new wxMenu;
view_menu->Append( Playlist_Event, wxU(_("&Playlist...\tCtrl-P")), view_menu->Append( Playlist_Event, wxU(_("&Playlist...\tCtrl-P")) );
wxU(_(HELP_PLAYLIST)) ); view_menu->Append( Logs_Event, wxU(_("&Messages...\tCtrl-M")) );
view_menu->Append( Logs_Event, wxU(_("&Messages...\tCtrl-M")),
wxU(_(HELP_LOGS)) );
view_menu->Append( FileInfo_Event, view_menu->Append( FileInfo_Event,
wxU(_("Stream and Media &info...\tCtrl-I")), wxU(_("Stream and Media &info...\tCtrl-I")) );
wxU(_(HELP_FILEINFO)) );
/* Create the "Auto-generated" menus */ /* Create the "Auto-generated" menus */
p_settings_menu = SettingsMenu( p_intf, this ); p_settings_menu = SettingsMenu( p_intf, this );
...@@ -380,8 +353,7 @@ void Interface::CreateOurMenuBar() ...@@ -380,8 +353,7 @@ void Interface::CreateOurMenuBar()
/* 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 VLC media player")), help_menu->Append( About_Event, wxU(_("About VLC media player")) );
wxU(_(HELP_ABOUT)) );
/* Append the freshly created menus to the menu bar... */ /* Append the freshly created menus to the menu bar... */
wxMenuBar *menubar = new wxMenuBar( wxMB_DOCKABLE ); wxMenuBar *menubar = new wxMenuBar( wxMB_DOCKABLE );
...@@ -439,7 +411,6 @@ void VLCVolCtrl::OnPaint( wxPaintEvent &evt ) ...@@ -439,7 +411,6 @@ void VLCVolCtrl::OnPaint( wxPaintEvent &evt )
void Interface::CreateOurToolBar() void Interface::CreateOurToolBar()
{ {
#define HELP_STOP N_("Stop") #define HELP_STOP N_("Stop")
#define HELP_PLAY N_("Play") #define HELP_PLAY N_("Play")
#define HELP_PAUSE N_("Pause") #define HELP_PAUSE N_("Pause")
#define HELP_PLO N_("Playlist") #define HELP_PLO N_("Playlist")
...@@ -771,11 +742,10 @@ void Interface::OnMenuOpen(wxMenuEvent& event) ...@@ -771,11 +742,10 @@ void Interface::OnMenuOpen(wxMenuEvent& event)
/* Add static items */ /* Add static items */
p_settings_menu->AppendCheckItem( Extended_Event, p_settings_menu->AppendCheckItem( Extended_Event,
wxU(_("&Extended GUI") ), wxU(_(HELP_EXTENDED)) ); wxU(_("&Extended GUI") ) );
p_settings_menu->AppendCheckItem( Bookmarks_Event, p_settings_menu->AppendCheckItem( Bookmarks_Event,
wxU(_("&Bookmarks...") ), wxU(_(HELP_BOOKMARKS)) ); wxU(_("&Bookmarks...") ) );
p_settings_menu->Append( Prefs_Event, wxU(_("&Preferences...")), p_settings_menu->Append( Prefs_Event, wxU(_("&Preferences...")) );
wxU(_(HELP_PREFS)) );
} }
else if( event.GetEventObject() == p_audio_menu ) else if( event.GetEventObject() == p_audio_menu )
...@@ -860,6 +830,9 @@ void Interface::OnShowDialog( wxCommandEvent& event ) ...@@ -860,6 +830,9 @@ void Interface::OnShowDialog( wxCommandEvent& event )
case OpenNet_Event: case OpenNet_Event:
i_id = INTF_DIALOG_NET; i_id = INTF_DIALOG_NET;
break; break;
case OpenCapture_Event:
i_id = INTF_DIALOG_CAPTURE;
break;
case OpenSat_Event: case OpenSat_Event:
i_id = INTF_DIALOG_SAT; i_id = INTF_DIALOG_SAT;
break; break;
......
...@@ -313,7 +313,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent, ...@@ -313,7 +313,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
i_access_method == NET_ACCESS ); i_access_method == NET_ACCESS );
#ifndef WIN32 #ifndef WIN32
notebook->AddPage( V4LPanel( notebook ), wxU(_("Video for Linux")), notebook->AddPage( V4LPanel( notebook ), wxU(_("Video for Linux")),
i_access_method == V4L_ACCESS ); i_access_method == CAPTURE_ACCESS );
#endif #endif
module_t *p_module = config_FindModule( VLC_OBJECT(p_intf), "dshow" ); module_t *p_module = config_FindModule( VLC_OBJECT(p_intf), "dshow" );
...@@ -322,7 +322,8 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent, ...@@ -322,7 +322,8 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
AutoBuiltPanel *autopanel = AutoBuiltPanel *autopanel =
new AutoBuiltPanel( notebook, this, p_intf, p_module ); new AutoBuiltPanel( notebook, this, p_intf, p_module );
input_tab_array.Add( autopanel ); input_tab_array.Add( autopanel );
notebook->AddPage( autopanel, wxU( p_module->psz_longname ) ); notebook->AddPage( autopanel, wxU( p_module->psz_longname ),
i_access_method == CAPTURE_ACCESS );
} }
/* Update Disc panel */ /* Update Disc panel */
...@@ -812,7 +813,7 @@ void OpenDialog::UpdateMRL( int i_access_method ) ...@@ -812,7 +813,7 @@ void OpenDialog::UpdateMRL( int i_access_method )
break; break;
#ifndef WIN32 #ifndef WIN32
case V4L_ACCESS: case CAPTURE_ACCESS:
mrltemp = ( video_type->GetSelection() == 0 ? wxT("v4l") : mrltemp = ( video_type->GetSelection() == 0 ? wxT("v4l") :
video_type->GetSelection() == 1 ? wxT("v4l") : video_type->GetSelection() == 1 ? wxT("v4l") :
video_type->GetSelection() == 2 ? wxT("pvr") : video_type->GetSelection() == 2 ? wxT("pvr") :
...@@ -1164,7 +1165,7 @@ void OpenDialog::OnNetTypeChange( wxCommandEvent& event ) ...@@ -1164,7 +1165,7 @@ void OpenDialog::OnNetTypeChange( wxCommandEvent& event )
*****************************************************************************/ *****************************************************************************/
void OpenDialog::OnV4LPanelChange( wxCommandEvent& WXUNUSED(event) ) void OpenDialog::OnV4LPanelChange( wxCommandEvent& WXUNUSED(event) )
{ {
UpdateMRL( V4L_ACCESS ); UpdateMRL( CAPTURE_ACCESS );
} }
void OpenDialog::OnV4LTypeChange( wxCommandEvent& WXUNUSED(event) ) void OpenDialog::OnV4LTypeChange( wxCommandEvent& WXUNUSED(event) )
...@@ -1187,7 +1188,7 @@ void OpenDialog::OnV4LTypeChange( wxCommandEvent& WXUNUSED(event) ) ...@@ -1187,7 +1188,7 @@ void OpenDialog::OnV4LTypeChange( wxCommandEvent& WXUNUSED(event) )
break; break;
} }
UpdateMRL( V4L_ACCESS ); UpdateMRL( CAPTURE_ACCESS );
} }
void OpenDialog::OnV4LSettingsChange( wxCommandEvent& WXUNUSED(event) ) void OpenDialog::OnV4LSettingsChange( wxCommandEvent& WXUNUSED(event) )
...@@ -1201,7 +1202,7 @@ void OpenDialog::OnV4LSettingsChange( wxCommandEvent& WXUNUSED(event) ) ...@@ -1201,7 +1202,7 @@ void OpenDialog::OnV4LSettingsChange( wxCommandEvent& WXUNUSED(event) )
v4l_mrl = v4l_dialog->GetOptions(); v4l_mrl = v4l_dialog->GetOptions();
} }
UpdateMRL( V4L_ACCESS ); UpdateMRL( CAPTURE_ACCESS );
} }
#endif #endif
......
...@@ -298,7 +298,7 @@ bool Instance::OnInit() ...@@ -298,7 +298,7 @@ bool Instance::OnInit()
/* Creates the dialogs provider */ /* Creates the dialogs provider */
p_intf->p_sys->p_wxwindow = p_intf->p_sys->p_wxwindow =
new DialogsProvider( p_intf, p_intf->pf_show_dialog ? CreateDialogsProvider( p_intf, p_intf->pf_show_dialog ?
NULL : p_intf->p_sys->p_wxwindow ); NULL : p_intf->p_sys->p_wxwindow );
p_intf->p_sys->pf_show_dialog = ShowDialog; p_intf->p_sys->pf_show_dialog = ShowDialog;
......
...@@ -92,6 +92,7 @@ DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 ); ...@@ -92,6 +92,7 @@ DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
#define MODE_AUTHOR 2 #define MODE_AUTHOR 2
#define MODE_TITLE 3 #define MODE_TITLE 3
class DialogsProvider;
class PrefsTreeCtrl; class PrefsTreeCtrl;
class AutoBuiltPanel; class AutoBuiltPanel;
class VideoWindow; class VideoWindow;
...@@ -139,6 +140,7 @@ struct intf_sys_t ...@@ -139,6 +140,7 @@ struct intf_sys_t
wxArrayString SeparateEntries( wxString ); wxArrayString SeparateEntries( wxString );
wxWindow *VideoWindow( intf_thread_t *p_intf, wxWindow *p_parent ); wxWindow *VideoWindow( intf_thread_t *p_intf, wxWindow *p_parent );
wxWindow *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent ); wxWindow *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent );
wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
namespace wxvlc namespace wxvlc
{ {
...@@ -269,60 +271,6 @@ private: ...@@ -269,60 +271,6 @@ private:
wxMenu *p_navig_menu; wxMenu *p_navig_menu;
}; };
/*class BookmarksDialog;
*/
/* Dialogs Provider */
class DialogsProvider: public wxFrame
{
public:
/* Constructor */
DialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
virtual ~DialogsProvider();
private:
void Open( int i_access_method, int i_arg );
/* Event handlers (these functions should _not_ be virtual) */
void OnExit( wxCommandEvent& event );
void OnPlaylist( wxCommandEvent& event );
void OnMessages( wxCommandEvent& event );
void OnFileInfo( wxCommandEvent& event );
void OnPreferences( wxCommandEvent& event );
void OnStreamWizardDialog( wxCommandEvent& event );
void OnWizardDialog( wxCommandEvent& event );
void OnBookmarks( wxCommandEvent& event );
void OnOpenFileGeneric( wxCommandEvent& event );
void OnOpenFileSimple( wxCommandEvent& event );
void OnOpenFile( wxCommandEvent& event );
void OnOpenDisc( wxCommandEvent& event );
void OnOpenNet( wxCommandEvent& event );
void OnOpenSat( wxCommandEvent& event );
void OnPopupMenu( wxCommandEvent& event );
void OnIdle( wxIdleEvent& event );
void OnExitThread( wxCommandEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
public:
/* Secondary windows */
OpenDialog *p_open_dialog;
wxFileDialog *p_file_dialog;
Playlist *p_playlist_dialog;
Messages *p_messages_dialog;
FileInfo *p_fileinfo_dialog;
StreamDialog *p_streamwizard_dialog;
WizardDialog *p_wizard_dialog;
wxFrame *p_prefs_dialog;
wxWindow *p_bookmarks_dialog;
wxFileDialog *p_file_generic_dialog;
};
/* Open Dialog */ /* Open Dialog */
WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel); WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
class OpenDialog: public wxFrame class OpenDialog: public wxFrame
...@@ -453,12 +401,11 @@ enum ...@@ -453,12 +401,11 @@ enum
FILE_ACCESS = 0, FILE_ACCESS = 0,
DISC_ACCESS, DISC_ACCESS,
NET_ACCESS, NET_ACCESS,
#ifndef WIN32
V4L_ACCESS, /* Auto-built panels */
#endif CAPTURE_ACCESS
MAX_ACCESS,
FILE_SIMPLE_ACCESS
}; };
#define MAX_ACCESS CAPTURE_ACCESS
/* V4L Dialog */ /* V4L Dialog */
class V4LDialog: public wxDialog class V4LDialog: public wxDialog
......
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