Commit 975daf79 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/*: added a "simple open" entry to the "File" menu of the interface and playlist. That entry just opens a wxFileDialog().
parent 5f5d4e18
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* fileinfo.cpp : wxWindows plugin for vlc * fileinfo.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: fileinfo.cpp,v 1.16 2003/06/09 19:08:33 asmax Exp $ * $Id: fileinfo.cpp,v 1.17 2003/07/12 13:33:10 gbazin Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -93,7 +93,7 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -93,7 +93,7 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, wxWindow *p_parent ):
fileinfo_root_label = wxT(""); fileinfo_root_label = wxT("");
/* Create the OK button */ /* Create the OK button */
wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("OK")) ); wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("Close")) );
ok_button->SetDefault(); ok_button->SetDefault();
/* Place everything in sizers */ /* Place everything in sizers */
......
...@@ -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.44 2003/07/09 21:42:28 gbazin Exp $ * $Id: interface.cpp,v 1.45 2003/07/12 13:33:10 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -124,6 +124,7 @@ enum ...@@ -124,6 +124,7 @@ enum
{ {
/* menu items */ /* menu items */
Exit_Event = wxID_HIGHEST, Exit_Event = wxID_HIGHEST,
OpenFileSimple_Event,
OpenFile_Event, OpenFile_Event,
OpenDisc_Event, OpenDisc_Event,
OpenNet_Event, OpenNet_Event,
...@@ -167,6 +168,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) ...@@ -167,6 +168,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
EVT_RIGHT_UP(Interface::OnContextMenu) EVT_RIGHT_UP(Interface::OnContextMenu)
/* Toolbar events */ /* Toolbar events */
EVT_MENU(OpenFileSimple_Event, Interface::OnOpenFileSimple)
EVT_MENU(OpenFile_Event, Interface::OnOpenFile) EVT_MENU(OpenFile_Event, Interface::OnOpenFile)
EVT_MENU(OpenDisc_Event, Interface::OnOpenDisc) EVT_MENU(OpenDisc_Event, Interface::OnOpenDisc)
EVT_MENU(OpenNet_Event, Interface::OnOpenNet) EVT_MENU(OpenNet_Event, Interface::OnOpenNet)
...@@ -194,6 +196,7 @@ Interface::Interface( intf_thread_t *_p_intf ): ...@@ -194,6 +196,7 @@ Interface::Interface( intf_thread_t *_p_intf ):
p_prefs_dialog = NULL; p_prefs_dialog = NULL;
i_old_playing_status = PAUSE_S; i_old_playing_status = PAUSE_S;
p_open_dialog = NULL; p_open_dialog = NULL;
p_file_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 );
...@@ -242,6 +245,7 @@ Interface::~Interface() ...@@ -242,6 +245,7 @@ Interface::~Interface()
/* Clean up */ /* Clean up */
if( p_open_dialog ) delete p_open_dialog; if( p_open_dialog ) delete p_open_dialog;
if( p_prefs_dialog ) p_prefs_dialog->Destroy(); if( p_prefs_dialog ) p_prefs_dialog->Destroy();
if( p_file_dialog ) delete p_file_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;
} }
...@@ -267,14 +271,16 @@ void Interface::CreateOurMenuBar() ...@@ -267,14 +271,16 @@ void Interface::CreateOurMenuBar()
/* Create the "File" menu */ /* Create the "File" menu */
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
file_menu->Append( OpenFile_Event, wxU(_("&Open File...")), file_menu->Append( OpenFileSimple_Event, wxU(_("Simple &Open ...")),
wxU(_(HELP_FILE)) );
file_menu->Append( OpenFile_Event, wxU(_("Open &File...")),
wxU(_(HELP_FILE)) ); wxU(_(HELP_FILE)) );
file_menu->Append( OpenDisc_Event, wxU(_("Open &Disc...")), file_menu->Append( OpenDisc_Event, wxU(_("Open &Disc...")),
wxU(_(HELP_DISC)) ); wxU(_(HELP_DISC)) );
file_menu->Append( OpenNet_Event, wxU(_("&Network Stream...")), file_menu->Append( OpenNet_Event, wxU(_("Open &Network Stream...")),
wxU(_(HELP_NET)) ); wxU(_(HELP_NET)) );
#if 0 #if 0
file_menu->Append( OpenSat_Event, wxU(_("&Satellite Stream...")), file_menu->Append( OpenSat_Event, wxU(_("Open &Satellite Stream...")),
wxU(_(HELP_NET)) ); wxU(_(HELP_NET)) );
#endif #endif
#if 0 #if 0
...@@ -645,6 +651,35 @@ void Interface::OnPreferences( wxCommandEvent& WXUNUSED(event) ) ...@@ -645,6 +651,35 @@ void Interface::OnPreferences( wxCommandEvent& WXUNUSED(event) )
} }
} }
void Interface::OnOpenFileSimple( wxCommandEvent& WXUNUSED(event) )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
if( p_file_dialog == NULL )
p_file_dialog = new wxFileDialog( this, wxU(_("Open file")),
wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );
if( p_file_dialog && p_file_dialog->ShowModal() == wxID_OK )
{
wxArrayString paths;
p_file_dialog->GetPaths( paths );
for( size_t i = 0; i < paths.GetCount(); i++ )
playlist_Add( p_playlist, (const char *)paths[i].mb_str(),
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO),
PLAYLIST_END );
}
vlc_object_release( p_playlist );
}
void Interface::OnOpenFile( wxCommandEvent& WXUNUSED(event) ) void Interface::OnOpenFile( wxCommandEvent& WXUNUSED(event) )
{ {
Open( FILE_ACCESS ); Open( FILE_ACCESS );
......
...@@ -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.11 2003/07/11 23:14:03 gbazin Exp $ * $Id: messages.cpp,v 1.12 2003/07/12 13:33:10 gbazin Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* *
...@@ -102,15 +102,18 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -102,15 +102,18 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ):
dbg_attr = new wxTextAttr( *wxBLACK ); dbg_attr = new wxTextAttr( *wxBLACK );
/* Create the OK button */ /* Create the OK button */
wxButton *ok_button = new wxButton( messages_panel, wxID_OK, wxU(_("OK"))); wxButton *ok_button = new wxButton( messages_panel, wxID_OK,
wxU(_("Close")));
ok_button->SetDefault(); ok_button->SetDefault();
/* Create the Clear button */ /* Create the Clear button */
wxButton *clear_button = new wxButton( messages_panel, wxID_CLEAR, wxU(_("Clear"))); wxButton *clear_button = new wxButton( messages_panel, wxID_CLEAR,
wxU(_("Clear")));
clear_button->SetDefault(); clear_button->SetDefault();
/* Create the Save Log button */ /* Create the Save Log button */
wxButton *save_log_button = new wxButton( messages_panel, wxID_SAVEAS, wxU(_("Save As..."))); wxButton *save_log_button = new wxButton( messages_panel, wxID_SAVEAS,
wxU(_("Save As...")));
save_log_button->SetDefault(); save_log_button->SetDefault();
/* Create the Verbose checkbox */ /* Create the Verbose checkbox */
...@@ -123,9 +126,9 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -123,9 +126,9 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ):
wxBoxSizer *buttons_sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *buttons_sizer = new wxBoxSizer( wxHORIZONTAL );
buttons_sizer->Add( ok_button, 0, wxEXPAND |wxALIGN_LEFT| wxALL, 5 ); buttons_sizer->Add( ok_button, 0, wxEXPAND |wxALIGN_LEFT| wxALL, 5 );
buttons_sizer->Add( clear_button, 0, wxEXPAND |wxALIGN_LEFT| wxALL, 5 ); buttons_sizer->Add( clear_button, 0, wxEXPAND |wxALIGN_LEFT| wxALL, 5 );
buttons_sizer->Add( save_log_button, 0, wxEXPAND |wxALIGN_LEFT| wxALL, 5 ); buttons_sizer->Add( save_log_button, 0, wxEXPAND |wxALIGN_LEFT| wxALL, 5 );
buttons_sizer->Add( new wxPanel( this, -1 ), 1, wxALL, 5 ); buttons_sizer->Add( new wxPanel( this, -1 ), 1, wxALL, 5 );
buttons_sizer->Add( verbose_checkbox, 0, wxEXPAND |wxALIGN_RIGHT | wxALL, 5 ); buttons_sizer->Add( verbose_checkbox, 0, wxEXPAND|wxALIGN_RIGHT|wxALL, 5 );
buttons_sizer->Layout(); buttons_sizer->Layout();
wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
...@@ -215,15 +218,16 @@ void Messages::OnClear( wxCommandEvent& WXUNUSED(event) ) ...@@ -215,15 +218,16 @@ void Messages::OnClear( wxCommandEvent& WXUNUSED(event) )
void Messages::OnSaveLog( wxCommandEvent& WXUNUSED(event) ) void Messages::OnSaveLog( wxCommandEvent& WXUNUSED(event) )
{ {
if( save_log_dialog == NULL ) if( save_log_dialog == NULL )
save_log_dialog = new wxFileDialog( this, wxU(_("Save Messages As a file...")), save_log_dialog = new wxFileDialog( this,
wxU(_("Save Messages As a file...")),
wxT(""), wxT("messages"), wxT("*"), wxSAVE | wxOVERWRITE_PROMPT ); wxT(""), wxT("messages"), wxT("*"), wxSAVE | wxOVERWRITE_PROMPT );
if( save_log_dialog && save_log_dialog->ShowModal() == wxID_OK ) if( save_log_dialog && save_log_dialog->ShowModal() == wxID_OK )
{ {
if( !textctrl->SaveFile( save_log_dialog->GetPath() ) ) if( !textctrl->SaveFile( save_log_dialog->GetPath() ) )
{ {
// [FIX ME] should print an error message // [FIX ME] should print an error message
} }
} }
} }
......
...@@ -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.11 2003/05/20 23:17:59 gbazin Exp $ * $Id: playlist.cpp,v 1.12 2003/07/12 13:33:10 gbazin Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* *
...@@ -59,7 +59,8 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable, ...@@ -59,7 +59,8 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
enum enum
{ {
/* menu items */ /* menu items */
AddMRL_Event = 1, AddFile_Event = 1,
AddMRL_Event,
Close_Event, Close_Event,
Open_Event, Open_Event,
Save_Event, Save_Event,
...@@ -74,6 +75,7 @@ enum ...@@ -74,6 +75,7 @@ enum
BEGIN_EVENT_TABLE(Playlist, wxFrame) BEGIN_EVENT_TABLE(Playlist, wxFrame)
/* Menu events */ /* Menu events */
EVT_MENU(AddFile_Event, Playlist::OnAddFile)
EVT_MENU(AddMRL_Event, Playlist::OnAddMRL) EVT_MENU(AddMRL_Event, Playlist::OnAddMRL)
EVT_MENU(Close_Event, Playlist::OnClose) EVT_MENU(Close_Event, Playlist::OnClose)
EVT_MENU(Open_Event, Playlist::OnOpen) EVT_MENU(Open_Event, Playlist::OnOpen)
...@@ -112,6 +114,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, Interface *_p_main_interface ): ...@@ -112,6 +114,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, Interface *_p_main_interface ):
/* Create our "Manage" menu */ /* Create our "Manage" menu */
wxMenu *manage_menu = new wxMenu; wxMenu *manage_menu = new wxMenu;
manage_menu->Append( AddFile_Event, wxU(_("&Simple Add...")) );
manage_menu->Append( AddMRL_Event, wxU(_("&Add MRL...")) ); manage_menu->Append( AddMRL_Event, wxU(_("&Add MRL...")) );
manage_menu->Append( Open_Event, wxU(_("&Open Playlist...")) ); manage_menu->Append( Open_Event, wxU(_("&Open Playlist...")) );
manage_menu->Append( Save_Event, wxU(_("&Save Playlist...")) ); manage_menu->Append( Save_Event, wxU(_("&Save Playlist...")) );
...@@ -359,6 +362,38 @@ void Playlist::OnOpen( wxCommandEvent& WXUNUSED(event) ) ...@@ -359,6 +362,38 @@ void Playlist::OnOpen( wxCommandEvent& WXUNUSED(event) )
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
void Playlist::OnAddFile( wxCommandEvent& WXUNUSED(event) )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
if( p_main_interface->p_file_dialog == NULL )
p_main_interface->p_file_dialog =
new wxFileDialog( this, wxU(_("Open file")), wxT(""), wxT(""),
wxT("*"), wxOPEN | wxMULTIPLE );
if( p_main_interface->p_file_dialog &&
p_main_interface->p_file_dialog->ShowModal() == wxID_OK )
{
wxArrayString paths;
p_main_interface->p_file_dialog->GetPaths( paths );
for( size_t i = 0; i < paths.GetCount(); i++ )
playlist_Add( p_playlist, (const char *)paths[i].mb_str(),
PLAYLIST_APPEND, PLAYLIST_END );
}
vlc_object_release( p_playlist );
Rebuild();
}
void Playlist::OnAddMRL( wxCommandEvent& WXUNUSED(event) ) void Playlist::OnAddMRL( wxCommandEvent& WXUNUSED(event) )
{ {
playlist_t *p_playlist = playlist_t *p_playlist =
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* streamout.cpp : wxWindows plugin for vlc * streamout.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: streamout.cpp,v 1.23 2003/07/11 23:36:01 gbazin Exp $ * $Id: streamout.cpp,v 1.24 2003/07/12 13:33:10 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -773,8 +773,8 @@ void SoutDialog::OnFileChange( wxCommandEvent& WXUNUSED(event) ) ...@@ -773,8 +773,8 @@ void SoutDialog::OnFileChange( wxCommandEvent& WXUNUSED(event) )
void SoutDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) ) void SoutDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
{ {
wxFileDialog dialog( this, wxU(_("Save file")), wxFileDialog dialog( this, wxU(_("Save file")), wxT(""), wxT(""), wxT("*"),
wxT(""), wxT(""), wxT("*"), wxSAVE ); wxSAVE | wxOVERWRITE_PROMPT );
if( dialog.ShowModal() == wxID_OK ) if( dialog.ShowModal() == wxID_OK )
{ {
......
...@@ -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.41 2003/07/11 23:36:01 gbazin Exp $ * $Id: wxwindows.h,v 1.42 2003/07/12 13:33:10 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -130,6 +130,9 @@ public: ...@@ -130,6 +130,9 @@ public:
* (and keep the last settings) */ * (and keep the last settings) */
OpenDialog *p_open_dialog; OpenDialog *p_open_dialog;
/* idem for the simple open file dialog */
wxFileDialog *p_file_dialog;
private: private:
void CreateOurMenuBar(); void CreateOurMenuBar();
void CreateOurToolBar(); void CreateOurToolBar();
...@@ -145,6 +148,7 @@ private: ...@@ -145,6 +148,7 @@ private:
void OnFileInfo( wxCommandEvent& event ); void OnFileInfo( wxCommandEvent& event );
void OnPreferences( wxCommandEvent& event ); void OnPreferences( wxCommandEvent& event );
void OnOpenFileSimple( wxCommandEvent& event );
void OnOpenFile( wxCommandEvent& event ); void OnOpenFile( wxCommandEvent& event );
void OnOpenDisc( wxCommandEvent& event ); void OnOpenDisc( wxCommandEvent& event );
void OnOpenNet( wxCommandEvent& event ); void OnOpenNet( wxCommandEvent& event );
...@@ -289,7 +293,8 @@ enum ...@@ -289,7 +293,8 @@ enum
FILE_ACCESS = 0, FILE_ACCESS = 0,
DISC_ACCESS, DISC_ACCESS,
NET_ACCESS, NET_ACCESS,
SAT_ACCESS SAT_ACCESS,
FILE_SIMPLE_ACCESS
}; };
/* Stream output Dialog */ /* Stream output Dialog */
...@@ -469,6 +474,7 @@ private: ...@@ -469,6 +474,7 @@ private:
void DeleteItem( int item ); void DeleteItem( int item );
/* Event handlers (these functions should _not_ be virtual) */ /* Event handlers (these functions should _not_ be virtual) */
void OnAddFile( wxCommandEvent& event );
void OnAddMRL( wxCommandEvent& event ); void OnAddMRL( wxCommandEvent& event );
void OnClose( wxCommandEvent& event ); void OnClose( wxCommandEvent& event );
void OnOpen( wxCommandEvent& event ); void OnOpen( wxCommandEvent& event );
......
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