]> git.sesse.net Git - vlc/commitdiff
* modules/gui/wxwindows/*: added a "simple open" entry to the "File" menu of the...
authorGildas Bazin <gbazin@videolan.org>
Sat, 12 Jul 2003 13:33:10 +0000 (13:33 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sat, 12 Jul 2003 13:33:10 +0000 (13:33 +0000)
modules/gui/wxwindows/fileinfo.cpp
modules/gui/wxwindows/interface.cpp
modules/gui/wxwindows/messages.cpp
modules/gui/wxwindows/playlist.cpp
modules/gui/wxwindows/streamout.cpp
modules/gui/wxwindows/wxwindows.h

index dfa9ece49eddd2dd658356943ede5cad7b955b0b..32ee83e13cb6f28d14124d5ef7a1253dabb58ac2 100644 (file)
@@ -2,7 +2,7 @@
  * fileinfo.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * 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>
  *
@@ -93,7 +93,7 @@ FileInfo::FileInfo( intf_thread_t *_p_intf, wxWindow *p_parent ):
     fileinfo_root_label = wxT("");
 
     /* 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();
 
     /* Place everything in sizers */
index c1204a055fff3651cd7aca388f2d567b3679ef4f..a0f1fdfcea2642747be16ffb8b8d8533729b1bd0 100644 (file)
@@ -2,7 +2,7 @@
  * interface.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * 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>
  *
@@ -124,6 +124,7 @@ enum
 {
     /* menu items */
     Exit_Event = wxID_HIGHEST,
+    OpenFileSimple_Event,
     OpenFile_Event,
     OpenDisc_Event,
     OpenNet_Event,
@@ -167,6 +168,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
     EVT_RIGHT_UP(Interface::OnContextMenu)
 
     /* Toolbar events */
+    EVT_MENU(OpenFileSimple_Event, Interface::OnOpenFileSimple)
     EVT_MENU(OpenFile_Event, Interface::OnOpenFile)
     EVT_MENU(OpenDisc_Event, Interface::OnOpenDisc)
     EVT_MENU(OpenNet_Event, Interface::OnOpenNet)
@@ -194,6 +196,7 @@ Interface::Interface( intf_thread_t *_p_intf ):
     p_prefs_dialog = NULL;
     i_old_playing_status = PAUSE_S;
     p_open_dialog = NULL;
+    p_file_dialog = NULL;
 
     /* Give our interface a nice little icon */
     p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
@@ -242,6 +245,7 @@ Interface::~Interface()
     /* Clean up */
     if( p_open_dialog ) delete p_open_dialog;
     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;
 }
 
@@ -267,14 +271,16 @@ void Interface::CreateOurMenuBar()
 
     /* Create the "File" menu */
     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)) );
     file_menu->Append( OpenDisc_Event, wxU(_("Open &Disc...")),
                        wxU(_(HELP_DISC)) );
-    file_menu->Append( OpenNet_Event, wxU(_("&Network Stream...")),
+    file_menu->Append( OpenNet_Event, wxU(_("Open &Network Stream...")),
                        wxU(_(HELP_NET)) );
 #if 0
-    file_menu->Append( OpenSat_Event, wxU(_("&Satellite Stream...")),
+    file_menu->Append( OpenSat_Event, wxU(_("Open &Satellite Stream...")),
                        wxU(_(HELP_NET)) );
 #endif
 #if 0
@@ -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) )
 {
     Open( FILE_ACCESS );
index a513753218ccbbe2b8ac181793eebf996077a4d8..f9b5b9d59ce3afb506d7dbd61523e6abefa7fbf9 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * 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 Teulière <ipkiss@via.ecp.fr>
  *
@@ -102,15 +102,18 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ):
     dbg_attr = new wxTextAttr( *wxBLACK );
 
     /* 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();
 
     /* 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();
 
     /* 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();
 
     /* Create the Verbose checkbox */
@@ -123,9 +126,9 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ):
     wxBoxSizer *buttons_sizer = new wxBoxSizer( wxHORIZONTAL );
     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( 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( verbose_checkbox, 0, wxEXPAND |wxALIGN_RIGHT | wxALL, 5 );
+    buttons_sizer->Add( verbose_checkbox, 0, wxEXPAND|wxALIGN_RIGHT|wxALL, 5 );
     buttons_sizer->Layout();
     wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
     wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
@@ -215,15 +218,16 @@ void Messages::OnClear( wxCommandEvent& WXUNUSED(event) )
 void Messages::OnSaveLog( wxCommandEvent& WXUNUSED(event) )
 {
     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 );
     
     if( save_log_dialog && save_log_dialog->ShowModal() == wxID_OK )
     {
-       if( !textctrl->SaveFile( save_log_dialog->GetPath() ) )
-           {
-               // [FIX ME] should print an error message
-           }
+        if( !textctrl->SaveFile( save_log_dialog->GetPath() ) )
+        {
+            // [FIX ME] should print an error message
+        }
     }
 }
 
index dafdbc556564e29b4f1caee9a341784e2bd4d05f..0294fa654bcb159b14dce7b2eddbb0ab2c94f8ab 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * 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 Teulière <ipkiss@via.ecp.fr>
  *
@@ -59,7 +59,8 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
 enum
 {
     /* menu items */
-    AddMRL_Event = 1,
+    AddFile_Event = 1,
+    AddMRL_Event,
     Close_Event,
     Open_Event,
     Save_Event,
@@ -74,6 +75,7 @@ enum
 
 BEGIN_EVENT_TABLE(Playlist, wxFrame)
     /* Menu events */
+    EVT_MENU(AddFile_Event, Playlist::OnAddFile)
     EVT_MENU(AddMRL_Event, Playlist::OnAddMRL)
     EVT_MENU(Close_Event, Playlist::OnClose)
     EVT_MENU(Open_Event, Playlist::OnOpen)
@@ -112,6 +114,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, Interface *_p_main_interface ):
 
     /* Create our "Manage" menu */
     wxMenu *manage_menu = new wxMenu;
+    manage_menu->Append( AddFile_Event, wxU(_("&Simple Add...")) );
     manage_menu->Append( AddMRL_Event, wxU(_("&Add MRL...")) );
     manage_menu->Append( Open_Event, wxU(_("&Open Playlist...")) );
     manage_menu->Append( Save_Event, wxU(_("&Save Playlist...")) );
@@ -359,6 +362,38 @@ void Playlist::OnOpen( wxCommandEvent& WXUNUSED(event) )
     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) )
 {
     playlist_t *p_playlist =
index 2f1cf81aad95285dffb98ac2735ec6ce76975a23..ea86acd7d9b7481fbd71ae9af479ccb21b50668a 100644 (file)
@@ -2,7 +2,7 @@
  * streamout.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * 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>
  *
@@ -773,8 +773,8 @@ void SoutDialog::OnFileChange( wxCommandEvent& WXUNUSED(event) )
 
 void SoutDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
 {
-    wxFileDialog dialog( this, wxU(_("Save file")),
-                         wxT(""), wxT(""), wxT("*"), wxSAVE );
+    wxFileDialog dialog( this, wxU(_("Save file")), wxT(""), wxT(""), wxT("*"),
+                         wxSAVE | wxOVERWRITE_PROMPT );
 
     if( dialog.ShowModal() == wxID_OK )
     {
index ca8ed8b12a9979ab0f2cf92ab8e9f1081d52b7b3..d93a85d4a2ebb5ae74208ed4ffe448e487120620 100644 (file)
@@ -2,7 +2,7 @@
  * wxwindows.h: private wxWindows interface description
  *****************************************************************************
  * 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>
  *
@@ -130,6 +130,9 @@ public:
      * (and keep the last settings) */
     OpenDialog  *p_open_dialog;
 
+    /* idem for the simple open file dialog */
+    wxFileDialog *p_file_dialog;
+
 private:
     void CreateOurMenuBar();
     void CreateOurToolBar();
@@ -145,6 +148,7 @@ private:
     void OnFileInfo( wxCommandEvent& event );
     void OnPreferences( wxCommandEvent& event );
 
+    void OnOpenFileSimple( wxCommandEvent& event );
     void OnOpenFile( wxCommandEvent& event );
     void OnOpenDisc( wxCommandEvent& event );
     void OnOpenNet( wxCommandEvent& event );
@@ -289,7 +293,8 @@ enum
     FILE_ACCESS = 0,
     DISC_ACCESS,
     NET_ACCESS,
-    SAT_ACCESS
+    SAT_ACCESS,
+    FILE_SIMPLE_ACCESS
 };
 
 /* Stream output Dialog */
@@ -469,6 +474,7 @@ private:
     void DeleteItem( int item );
 
     /* Event handlers (these functions should _not_ be virtual) */
+    void OnAddFile( wxCommandEvent& event );
     void OnAddMRL( wxCommandEvent& event );
     void OnClose( wxCommandEvent& event );
     void OnOpen( wxCommandEvent& event );