]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/dialogs/open.cpp
Use pl_Release with the right argument.
[vlc] / modules / gui / wxwidgets / dialogs / open.cpp
index 22d8bc866473a4954d76e3fa241b8ae062556575..7430c62290d8bec87ab11ee5bbef3bd144f98ce8 100644 (file)
@@ -18,7 +18,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -29,7 +29,9 @@
 #include "dialogs/preferences_widgets.h"
 #include "dialogs/subtitles.hpp"
 
-#include "charset.h"
+#include "vlc_charset.h"
+
+#undef HAVE_LIBCDIO // Disable broken code
 
 #ifdef HAVE_LIBCDIO
 #include <cdio/cdio.h>
@@ -49,9 +51,6 @@
 #include <wx/statline.h>
 #include <wx/tokenzr.h>
 
-#include <vector>
-
-
 #ifndef wxRB_SINGLE
 #   define wxRB_SINGLE 0
 #endif
@@ -72,7 +71,9 @@ enum
     MRL_Event,
 
     FileBrowse_Event,
+    SubFileBrowse_Event,
     FileName_Event,
+    SubFileName_Event,
 
     DiscType_Event,
 #ifdef HAVE_LIBCDIO
@@ -114,6 +115,8 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
     /* Events generated by the file panel */
     EVT_TEXT(FileName_Event, OpenDialog::OnFilePanelChange)
     EVT_BUTTON(FileBrowse_Event, OpenDialog::OnFileBrowse)
+    EVT_TEXT(SubFileName_Event, OpenDialog::OnSubFileChange)
+    EVT_BUTTON(SubFileBrowse_Event, OpenDialog::OnSubFileBrowse)
 
     /* Events generated by the disc panel */
     EVT_RADIOBOX(DiscType_Event, OpenDialog::OnDiscTypeChange)
@@ -165,13 +168,6 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
 
 END_EVENT_TABLE()
 
-#if 0
-/* Perhaps someday we'll figure out how to add media information to
-   "Stream-and-Media info" when no input thread hasn't been initialized.
-*/
-extern void MediaInsertCDDA( intf_thread_t *_p_intf,  CdIo_t *p_cdio,
-                 track_t i_last_track );
-#endif
 
 /*****************************************************************************
  * AutoBuiltPanel.
@@ -223,16 +219,20 @@ AutoBuiltPanel::AutoBuiltPanel( wxWindow *parent, OpenDialog *dialog,
                                 intf_thread_t *_p_intf,
                                 const module_t *p_module )
   : wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize ),
-    name( wxU(p_module->psz_object_name) ),
+    name( wxU(module_GetObjName(p_module)) ),
     p_advanced_mrl_combo( NULL ),
     p_intf( _p_intf ), p_open_dialog( dialog ), p_advanced_dialog( NULL )
 {
     wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
-    module_config_t *p_item = p_module->p_config;
     bool b_advanced = false;
+    unsigned int i_confsize; 
+    module_config_t *p_config;
+    int n;
 
-    if( p_item ) do
+    p_config = module_GetConfig (p_module, &i_confsize);
+    for( n = 0; n < i_confsize; n++ )
     {
+        module_config_t *p_item = p_config + n;
         if( !(p_item->i_type & CONFIG_HINT) && p_item->b_advanced )
             b_advanced = true;
 
@@ -251,7 +251,6 @@ AutoBuiltPanel::AutoBuiltPanel( wxWindow *parent, OpenDialog *dialog,
 
         sizer->Add( control, 0, wxEXPAND | wxALL, 2 );
     }
-    while( p_item->i_type != CONFIG_HINT_END && p_item++ );
 
     if( b_advanced )
     {
@@ -263,8 +262,8 @@ AutoBuiltPanel::AutoBuiltPanel( wxWindow *parent, OpenDialog *dialog,
         /* Build the advanced dialog */
         p_advanced_dialog =
             new wxDialog( this, -1, ((wxString)wxU(_("Advanced options"))) +
-                          wxT(" (") + wxU( p_module->psz_longname ) + wxT(")"),
-                          wxDefaultPosition, wxDefaultSize,
+                          wxT(" (") + wxU( module_GetLongName(p_module) ) +
+                          wxT(")"), wxDefaultPosition, wxDefaultSize,
                           wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
 
         wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
@@ -287,9 +286,9 @@ AutoBuiltPanel::AutoBuiltPanel( wxWindow *parent, OpenDialog *dialog,
         sizer->Add( mrl_sizer_sizer, 0, wxEXPAND | wxALL, 2 );
 
         /* Add advanced options to panel */
-        module_config_t *p_item = p_module->p_config;
-        if( p_item ) do
+        for( n = 0; n < i_confsize; n++ )
         {
+            module_config_t *p_item = p_config + n;
             if( p_item->i_type & CONFIG_HINT || !p_item->b_advanced )
                 continue;
 
@@ -307,7 +306,6 @@ AutoBuiltPanel::AutoBuiltPanel( wxWindow *parent, OpenDialog *dialog,
 
             sizer->Add( control, 0, wxEXPAND | wxALL, 2 );
         }
-        while( p_item->i_type != CONFIG_HINT_END && p_item++ );
 
         /* Separation */
         wxPanel *dummy_panel = new wxPanel( p_advanced_dialog, -1 );
@@ -318,20 +316,22 @@ AutoBuiltPanel::AutoBuiltPanel( wxWindow *parent, OpenDialog *dialog,
 
         /* Create buttons */
         wxButton *ok_button =
-            new wxButton( p_advanced_dialog, wxID_OK, wxU(_("OK")) );
+            new wxButton( p_advanced_dialog, wxID_OK, wxU(_("&OK")) );
         ok_button->SetDefault();
         wxButton *cancel_button =
-            new wxButton( p_advanced_dialog, wxID_CANCEL, wxU(_("Cancel")) );
-        wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
-        button_sizer->Add( ok_button, 0, wxALL, 5 );
-        button_sizer->Add( cancel_button, 0, wxALL, 5 );
-        button_sizer->Layout();
-        sizer->Add( button_sizer, 0, wxALL, 0 );
+            new wxButton( p_advanced_dialog, wxID_CANCEL, wxU(_("&Cancel")) );
+        wxStdDialogButtonSizer *button_sizer = new wxStdDialogButtonSizer;
+        button_sizer->AddButton( ok_button );
+        button_sizer->AddButton( cancel_button );
+        button_sizer->Realize();
+        sizer->Add( button_sizer, 0, wxEXPAND|wxALL, 5 );
 
         sizer->SetMinSize( 400, -1 );
         p_advanced_dialog->SetSizerAndFit( sizer );
     }
 
+    module_PutConfig (p_config);
+
     this->SetSizerAndFit( sizer );
 }
 
@@ -415,38 +415,21 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
     wxPanel *panel = new wxPanel( this, -1 );
     panel->SetAutoLayout( TRUE );
 
-    /* Create MRL combobox */
-    wxBoxSizer *mrl_sizer_sizer = new wxBoxSizer( wxHORIZONTAL );
-    wxStaticBox *mrl_box = new wxStaticBox( panel, -1,
-                               wxU(_("Media Resource Locator (MRL)")) );
-    wxStaticBoxSizer *mrl_sizer = new wxStaticBoxSizer( mrl_box,
-                                                        wxHORIZONTAL );
-    wxStaticText *mrl_label = new wxStaticText( panel, -1,
-                                                wxU(_("Open:")) );
-    mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""),
-                                wxPoint(20,25), wxSize(120, -1) );
-    mrl_combo->SetToolTip( wxU(_("You can use this field directly by typing "
-        "the full MRL you want to open.\n""Alternatively, the field will be "
-        "filled automatically when you use the controls below.")) );
 
-    mrl_sizer->Add( mrl_label, 0, wxALL | wxALIGN_CENTER, 5 );
-    mrl_sizer->Add( mrl_combo, 1, wxALL | wxALIGN_CENTER, 5 );
-    mrl_sizer_sizer->Add( mrl_sizer, 1, wxEXPAND | wxALL, 5 );
+    /* Advanced options */
+    wxStaticBox *adv_box = new wxStaticBox( panel, -1,
+                               wxU(_("Advanced options")) );
+    wxStaticBoxSizer *adv_sizer = new wxStaticBoxSizer( adv_box,
+                                                        wxVERTICAL );
 
 
-    /* Create Static Text */
-    wxStaticText *label = new wxStaticText( panel, -1,
-        wxU(_("Alternatively, you can build an MRL using one of the "
-              "following predefined targets:")) );
-
     wxFlexGridSizer *common_opt_sizer = new wxFlexGridSizer( 5, 1, 20 );
-
     if( i_method == OPEN_NORMAL )
     {
         /* Create Stream Output checkox */
         sout_checkbox = new wxCheckBox( panel, SoutEnable_Event,
-                                         wxU(_("Stream output")) );
-        sout_checkbox->SetToolTip( wxU(_("Use VLC as a server of streams")) );
+                                         wxU(_("Stream/Save")) );
+        sout_checkbox->SetToolTip( wxU(_("Use VLC as a stream server")) );
         common_opt_sizer->Add( sout_checkbox, 0,
                                wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
 
@@ -461,7 +444,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
             sout_button->Enable();
             subsfile_mrl.Add( wxString(wxT("sout=")) + wxL2U(psz_sout) );
         }
-        if( psz_sout ) free( psz_sout );
+        free( psz_sout );
 
         common_opt_sizer->Add( sout_button, 1, wxALIGN_LEFT |
                                wxALIGN_CENTER_VERTICAL );
@@ -483,14 +466,32 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
     common_opt_sizer->Add( caching_value, 0,
                            wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
 
+
+    wxBoxSizer *mrl_sizer = new wxBoxSizer( wxHORIZONTAL );
+    wxStaticText *mrl_label = new wxStaticText( panel, -1,
+                                                wxU(_("Customize:")) );
+    mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""),
+                                wxDefaultPosition, wxDefaultSize );
+    //Point(20,25), wxSize(120, -1) );
+    mrl_combo->SetToolTip( wxU(_("You can use this field directly by typing "
+        "the full MRL you want to open.\n""Alternatively, the field will be "
+        "filled automatically when you use the controls above.")) );
+
+    mrl_sizer->Add( mrl_label, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
+    mrl_sizer->Add( mrl_combo, 1, wxALL | wxEXPAND | wxALIGN_CENTER_VERTICAL,
+                    5 );
+
+    adv_sizer->Add( common_opt_sizer, 0, wxTOP | wxLEFT|wxRIGHT | wxEXPAND, 5 );
+    adv_sizer->Add( mrl_sizer, 0, wxBOTTOM  | wxLEFT|wxRIGHT  | wxEXPAND, 5 );
+
     /* Separation */
     wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
 
     /* Create the buttons */
-    wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("OK")) );
+    wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("&OK")) );
     ok_button->SetDefault();
     wxButton *cancel_button = new wxButton( panel, wxID_CANCEL,
-                                            wxU(_("Cancel")) );
+                                            wxU(_("&Cancel")) );
 
     /* Create notebook */
     notebook = new wxNotebook( panel, Notebook_Event );
@@ -506,48 +507,48 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
     notebook->AddPage( NetPanel( notebook ), wxU(_("Network")),
                        i_access_method == NET_ACCESS );
 
-    module_t *p_module = config_FindModule( VLC_OBJECT(p_intf), "v4l" );
+    module_t *p_module = module_Find( VLC_OBJECT(p_intf), "v4l" );
     if( p_module )
     {
         AutoBuiltPanel *autopanel =
             new AutoBuiltPanel( notebook, this, p_intf, p_module );
         input_tab_array.Add( autopanel );
-        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ?
-                        p_module->psz_shortname : p_module->psz_object_name ),
+        notebook->AddPage( autopanel, wxU( module_GetName(p_module, 0) ),
                            i_access_method == CAPTURE_ACCESS );
+        module_Put( p_module );
     }
 
-    p_module = config_FindModule( VLC_OBJECT(p_intf), "pvr" );
+    p_module = module_Find( VLC_OBJECT(p_intf), "pvr" );
     if( p_module )
     {
         AutoBuiltPanel *autopanel =
             new AutoBuiltPanel( notebook, this, p_intf, p_module );
         input_tab_array.Add( autopanel );
-        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ?
-                        p_module->psz_shortname : p_module->psz_object_name ),
+        notebook->AddPage( autopanel, wxU( module_GetName(p_module, 0) ),
                            i_access_method == CAPTURE_ACCESS );
+        module_Put( p_module );
     }
 
-    p_module = config_FindModule( VLC_OBJECT(p_intf), "dvb" );
+    p_module = module_Find( VLC_OBJECT(p_intf), "dvb" );
     if( p_module )
     {
         AutoBuiltPanel *autopanel =
             new AutoBuiltPanel( notebook, this, p_intf, p_module );
         input_tab_array.Add( autopanel );
-        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ?
-                        p_module->psz_shortname : p_module->psz_object_name ),
+        notebook->AddPage( autopanel, wxU( module_GetName(p_module, 0) ),
                            i_access_method == CAPTURE_ACCESS );
+        module_Put( p_module );
     }
 
-    p_module = config_FindModule( VLC_OBJECT(p_intf), "dshow" );
+    p_module = module_Find( VLC_OBJECT(p_intf), "dshow" );
     if( p_module )
     {
         AutoBuiltPanel *autopanel =
             new AutoBuiltPanel( notebook, this, p_intf, p_module );
         input_tab_array.Add( autopanel );
-        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ?
-                        p_module->psz_shortname : p_module->psz_object_name ),
+        notebook->AddPage( autopanel, wxU( module_GetName(p_module, 0) ),
                            i_access_method == CAPTURE_ACCESS );
+        module_Put( p_module );
     }
 
     /* Update Disc panel */
@@ -563,22 +564,20 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
     OnPageChange( event );
 
     /* Place everything in sizers */
-    wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
-    button_sizer->Add( ok_button, 0, wxALL, 5 );
-    button_sizer->Add( cancel_button, 0, wxALL, 5 );
-    button_sizer->Layout();
+    wxStdDialogButtonSizer *button_sizer = new wxStdDialogButtonSizer;
+    button_sizer->AddButton( cancel_button );
+    button_sizer->AddButton( ok_button );
+    button_sizer->Realize();
     wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
     wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
-    panel_sizer->Add( mrl_sizer_sizer, 0, wxEXPAND, 5 );
-    panel_sizer->Add( label, 0, wxEXPAND | wxALL, 5 );
 #if (!wxCHECK_VERSION(2,5,2))
     panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 );
 #else
     panel_sizer->Add( notebook, 1, wxEXPAND | wxALL, 5 );
 #endif
-    panel_sizer->Add( common_opt_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
+    panel_sizer->Add( adv_sizer, 0, wxEXPAND | wxALL, 5 );
     panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
-    panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
+    panel_sizer->Add( button_sizer, 0, wxEXPAND | wxALL, 5 );
     panel_sizer->Layout();
     panel->SetSizerAndFit( panel_sizer );
     main_sizer->Add( panel, 1, wxGROW, 0 );
@@ -589,9 +588,9 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
 OpenDialog::~OpenDialog()
 {
     /* Clean up */
-    if( file_dialog ) delete file_dialog;
-    if( sout_dialog ) delete sout_dialog;
-    if( subsfile_dialog ) delete subsfile_dialog;
+    delete file_dialog;
+    delete sout_dialog;
+    delete subsfile_dialog;
 }
 
 int OpenDialog::Show( int i_access_method, int i_arg )
@@ -625,23 +624,30 @@ wxPanel *OpenDialog::FilePanel( wxWindow* parent )
     /* Create browse file line */
     wxBoxSizer *file_sizer = new wxBoxSizer( wxHORIZONTAL );
 
-    file_combo = new wxComboBox( panel, FileName_Event, wxT(""),
-                                 wxPoint(20,25), wxSize(200, -1) );
+    file_sizer->Add( new wxStaticText( panel, -1, wxU(_("Open:") ) ), 0,
+                     wxALL | wxALIGN_CENTER_VERTICAL, 5 );
+
+    file_combo = new wxComboBox( panel, FileName_Event, wxT("") );
     wxButton *browse_button = new wxButton( panel, FileBrowse_Event,
                                             wxU(_("Browse...")) );
-    file_sizer->Add( file_combo, 1, wxALL, 5 );
-    file_sizer->Add( browse_button, 0, wxALL, 5 );
+    file_sizer->Add( file_combo, 1, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
+    file_sizer->Add( browse_button, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
 
-    /* Create Subtitles File checkox */
-    wxFlexGridSizer *subsfile_sizer = new wxFlexGridSizer( 2, 1, 20 );
+    /* Create Subtitles File checkox - button  */
+    wxFlexGridSizer *subtitles_sizer = new wxFlexGridSizer( 2, 1, 20 );
     subsfile_checkbox = new wxCheckBox( panel, SubsFileEnable_Event,
-                                        wxU(_("Subtitle options")) );
-    subsfile_checkbox->SetToolTip( wxU(_("Force options for separate subtitle files.")) );
-    subsfile_sizer->Add( subsfile_checkbox, 0,
-                         wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
+                                        wxU(_("Use a subtitles file")) );
+    subsfile_checkbox->SetToolTip( wxU(_("Use an external subtitles file.")) );
+    subtitles_sizer->Add( subsfile_checkbox, 0,  wxALIGN_CENTER_VERTICAL |
+                          wxALL, 5 );
     subsfile_button = new wxButton( panel, SubsFileSettings_Event,
-                                    wxU(_("Settings...")) );
+                                    wxU(_("Advanced Settings...")) );
     subsfile_button->Disable();
+    subtitles_sizer->Add( subsfile_button, 1, wxALIGN_CENTER_VERTICAL |
+                           wxALL, 5 );
+
+    /* Create subtitles file line */
+    wxBoxSizer *subfile_sizer = new wxBoxSizer( wxHORIZONTAL );
 
     char *psz_subsfile = config_GetPsz( p_intf, "sub-file" );
     if( psz_subsfile && *psz_subsfile )
@@ -650,13 +656,30 @@ wxPanel *OpenDialog::FilePanel( wxWindow* parent )
         subsfile_button->Enable();
         subsfile_mrl.Add( wxString(wxT("sub-file=")) + wxL2U(psz_subsfile) );
     }
-    if( psz_subsfile ) free( psz_subsfile );
-
-    subsfile_sizer->Add( subsfile_button, 1,
-                         wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
+    if( !psz_subsfile )  psz_subsfile = strdup("");
+    subfile_sizer->Add( new wxStaticText( panel, -1, wxU(_("File:") ) ),
+                        0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
+    subfile_combo = new wxComboBox( panel, SubFileName_Event,
+                                    wxL2U( psz_subsfile ) );
+    free( psz_subsfile );
+    subbrowse_button = new wxButton( panel, SubFileBrowse_Event,
+                                     wxU(_("Browse...")) );
+    subfile_sizer->Add( subfile_combo, 1, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
+    subfile_sizer->Add( subbrowse_button, 0, wxALL |wxALIGN_CENTER_VERTICAL, 5 );
+
+    subfile_combo->Disable();
+    subbrowse_button->Disable();
+
+    psz_subsfile = config_GetPsz( p_intf, "sub-file" );
+    if( psz_subsfile && *psz_subsfile )
+    {
+        subfile_combo->Enable();
+        subbrowse_button->Enable();
+    }
 
     sizer->Add( file_sizer, 0, wxEXPAND | wxALL, 5 );
-    sizer->Add( subsfile_sizer, 0, wxEXPAND | wxALL, 5 );
+    sizer->Add( subtitles_sizer, 0, wxLEFT | wxRIGHT | wxTOP, 5 );
+    sizer->Add( subfile_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT| wxBOTTOM, 5 );
     panel->SetSizerAndFit( sizer );
     return panel;
 }
@@ -705,6 +728,7 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
 
 #ifdef WIN32
     char psz_default_device[3] = {0};
+    char *psz_forced;
 
     /* find the drive_name for the first cdrom drive,
      * which is probably "D:" and put the drive_name into
@@ -721,8 +745,10 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
         }
     }
 
+    psz_forced = config_GetPsz( p_intf, "dvd" );
 
-    if( strlen(psz_default_device) > 0 )
+    if( strlen(psz_default_device) > 0 &&
+        ( !psz_forced || psz_forced && !*psz_forced ) )
     {
         if(disc_device)
             disc_device->SetValue( wxL2U(psz_default_device) );
@@ -899,8 +925,7 @@ void OpenDialog::UpdateMRL( int i_access_method )
         {
         case 0: /* DVD with menus */
         case 1: /* DVD without menus */
-            disc_device->SetToolTip( wxU(_("Name of DVD device "
-            "to read from.")) );
+            disc_device->SetToolTip( wxU(_("DVD device to use" ) )  );
             if( i_disc_type_selection == 0 )
             {
                 mrltemp = wxT("dvd://") + disc_device->GetValue();
@@ -939,8 +964,7 @@ void OpenDialog::UpdateMRL( int i_access_method )
                                   config_GetInt( p_intf, "vcdx-PBC"  )
                                   ? 'P' : 'E', i_disc_title );
 #else
-            disc_device->SetToolTip( wxU(_("Name of CD-ROM device "
-            "to read Video CD from.")) );
+            disc_device->SetToolTip( wxU(_("CD-ROM device to use" ) ) );
             mrltemp = wxT("vcd://") + disc_device->GetValue();
             if( i_disc_title > 0 )
                 mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
@@ -963,8 +987,7 @@ void OpenDialog::UpdateMRL( int i_access_method )
             "for a CD-ROM with an audio CD in it." )) );
             mrltemp = wxT("cddax://")
 #else
-            disc_device->SetToolTip( wxU(_("Name of CD-ROM device "
-            "to read audio CD from." )) );
+            disc_device->SetToolTip( wxU(_("CD-ROM device to use" ) ) ) ;
             mrltemp = wxT("cdda://")
 #endif
               + disc_device->GetValue();
@@ -1026,8 +1049,12 @@ void OpenDialog::UpdateMRL( int i_access_method )
                 mrltemp = wxT("http://");
 
             mrltemp += net_addrs[2]->GetLineText(0);
-
-            caching_name = wxT("http-caching");
+            if( ! mrltemp.Left(4).CmpNoCase(wxT("http")) )
+                caching_name = wxT("http-caching");
+            else if( ! mrltemp.Left(3).CmpNoCase(wxT("mms")) )
+                caching_name = wxT("mms-caching");
+            else
+                caching_name= wxT("ftp-caching");
             break;
 
         case 3:
@@ -1105,7 +1132,7 @@ void OpenDialog::UpdateMRL( int i_access_method )
         }
         else
         {
-            int i_value = config_GetInt( p_intf, caching_name.mb_str() );
+            int i_value = config_GetInt( p_intf, caching_name.mb_str(wxConvUTF8) );
             caching_value->SetValue( i_value );
         }
     }
@@ -1131,27 +1158,25 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
     }
 
     /* Update the playlist */
-    playlist_t *p_playlist =
-        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
-                                       FIND_ANYWHERE );
+    playlist_t *p_playlist = pl_Yield( p_intf );
     if( p_playlist == NULL ) return;
 
     for( int i = 0; i < (int)mrl.GetCount(); i++ )
     {
-        vlc_bool_t b_start = !i && i_open_arg;
-        playlist_item_t *p_item;
+        bool b_start = !i && i_open_arg;
+        input_item_t *p_input;
         char *psz_utf8;
 
         psz_utf8 = wxFromLocale( mrl[i] );
-        p_item = playlist_ItemNew( p_intf, psz_utf8, psz_utf8 );
+        p_input = input_ItemNew( p_intf, psz_utf8, NULL );
         wxLocaleFree( psz_utf8 );
 
         /* Insert options */
         while( i + 1 < (int)mrl.GetCount() &&
-               ((const char *)mrl[i + 1].mb_str())[0] == ':' )
+               ((const char *)mrl[i + 1].mb_str(wxConvUTF8))[0] == ':' )
         {
             psz_utf8 = wxFromLocale( mrl[i + 1] );
-            playlist_ItemAddOption( p_item, psz_utf8 );
+            input_ItemAddOption( p_input, psz_utf8 );
             wxLocaleFree( psz_utf8 );
             i++;
         }
@@ -1162,7 +1187,7 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
             for( int j = 0; j < (int)subsfile_mrl.GetCount(); j++ )
             {
                 psz_utf8 = wxFromLocale( subsfile_mrl[j] );
-                playlist_ItemAddOption( p_item, psz_utf8 );
+                input_ItemAddOption( p_input, psz_utf8 );
                 wxLocaleFree( psz_utf8 );
             }
         }
@@ -1173,20 +1198,18 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
             for( int j = 0; j < (int)sout_mrl.GetCount(); j++ )
             {
                 psz_utf8 = wxFromLocale( sout_mrl[j] );
-                playlist_ItemAddOption( p_item, psz_utf8 );
+                input_ItemAddOption( p_input, psz_utf8 );
                 wxLocaleFree( psz_utf8 );
             }
         }
 
-        playlist_AddItem( p_playlist, p_item, PLAYLIST_APPEND, PLAYLIST_END );
-
-        if( b_start )
-        {
-            playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
-        }
+        /* FIXME: playlist_AddInput() can fail */
+        playlist_AddInput( p_playlist, p_input,
+               PLAYLIST_APPEND | ( b_start ? PLAYLIST_GO : PLAYLIST_PREPARSE ),
+               PLAYLIST_END, true, pl_Unlocked );
+        vlc_gc_decref( p_input );
     }
-
-    vlc_object_release( p_playlist );
+    pl_Release( p_intf );
 
     Hide();
 
@@ -1230,6 +1253,12 @@ void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
         file_dialog = new wxFileDialog( this, wxU(_("Open File")),
             wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );
 
+    file_dialog->SetWildcard(wxU(_("All Files (*.*)|*"
+        "|Sound Files (*.mp3, *.ogg, etc.)|" EXTENSIONS_AUDIO
+        "|Video Files (*.avi, *.mpg, etc.)|" EXTENSIONS_VIDEO
+        "|Playlist Files (*.m3u, *.pls, etc.)|" EXTENSIONS_PLAYLIST
+        "|Subtitle Files (*.srt, *.sub, etc.)|" EXTENSIONS_SUBTITLE)));
+
     if( file_dialog && file_dialog->ShowModal() == wxID_OK )
     {
         wxArrayString paths;
@@ -1252,6 +1281,31 @@ void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
     }
 }
 
+void OpenDialog::OnSubFileBrowse( wxCommandEvent& WXUNUSED(event) )
+{
+    wxFileDialog dialog( this, wxU(_("Open subtitles file")),
+                         wxT(""), wxT(""), wxT("*"), wxOPEN );
+
+    if( dialog.ShowModal() == wxID_OK )
+    {
+        subfile_combo->SetValue( dialog.GetPath() );
+    }
+    wxCommandEvent event; OnSubFileChange( event );
+}
+
+void OpenDialog::OnSubFileChange( wxCommandEvent& WXUNUSED(event) )
+{
+    if( subsfile_mrl.GetCount() != 0 )
+    {
+        subsfile_mrl.RemoveAt( 0 );
+        subsfile_mrl.Insert( wxString(wxT("sub-file=")) + subfile_combo->GetValue() , 0 );
+    }
+    else
+    {
+        subsfile_mrl.Add( wxString(wxT("sub-file=")) + subfile_combo->GetValue() );
+    }
+}
+
 /*****************************************************************************
  * Disc panel event methods.
  *****************************************************************************/
@@ -1576,7 +1630,7 @@ void OpenDialog::OnDiscProbe( wxCommandEvent& WXUNUSED(event) )
         break;
     }
 
-    free(psz_device);
+    free( psz_device );
     disc_probe->SetValue(FALSE);
 
     UpdateMRL( DISC_ACCESS );
@@ -1608,11 +1662,11 @@ void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
         disc_chapter->SetRange( 0, 255 );
         disc_title->SetToolTip( wxU(_("Title number.")) );
         disc_sub->SetToolTip( wxU(_(
-          "DVD's can have up to 32 subtitles numbered 0..31. "
-          "Note this is not the same thing as a subtitle name e.g. 'en'. "
+          "DVDs can have up to 32 subtitles numbered 0..31. "
+          "Note this is not the same thing as a subtitle name (e.g. 'en'). "
           "If a value -1 is used, no subtitle will be shown." )) );
         disc_audio->SetToolTip( wxU(_("Audio track number. "
-          "DVD's can have up to 8 audio tracks numbered 0..7."
+          "DVDs can have up to 8 audio tracks numbered 0..7."
         )) );
         break;
 
@@ -1649,10 +1703,10 @@ void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
         disc_sub->SetRange( -1, 3 );    // up to 4 subtitles -1 = no subtitle
         disc_audio->SetRange( 0, 1 );   // up to 2 audio tracks
         disc_sub->SetToolTip( wxU(_(
-          "SVCD's can have up to 4 subtitles numbered 0..3. "
+          "SVCDs can have up to 4 subtitles numbered 0..3. "
           "If a value -1 is used, no subtitle will be shown." )) );
         disc_audio->SetToolTip( wxU(_("Audio track number. "
-          "VCD's can have up to 2 audio tracks numbered 0 or 1. "
+          "VCDs can have up to 2 audio tracks numbered 0 or 1. "
         )) );
         break;
 
@@ -1690,7 +1744,7 @@ void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
     disc_title->SetValue( 0 ); i_disc_title = 0;
     disc_chapter->SetValue( 0 ); i_disc_chapter = 0;
 
-    if( psz_device ) free( psz_device );
+    free( psz_device );
 
     UpdateMRL( DISC_ACCESS );
 }
@@ -1742,6 +1796,8 @@ void OpenDialog::OnNetTypeChange( wxCommandEvent& event )
 void OpenDialog::OnSubsFileEnable( wxCommandEvent& event )
 {
     subsfile_button->Enable( event.GetInt() != 0 );
+    subbrowse_button->Enable( event.GetInt() != 0 );
+    subfile_combo->Enable( event.GetInt() != 0 );
 }
 
 void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) )
@@ -1753,8 +1809,7 @@ void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) )
     if( subsfile_dialog && subsfile_dialog->ShowModal() == wxID_OK )
     {
         subsfile_mrl.Empty();
-        subsfile_mrl.Add( wxString(wxT("sub-file=")) +
-                          subsfile_dialog->file_combo->GetValue() );
+        subsfile_mrl.Add( wxString(wxT("sub-file="))  + subfile_combo->GetValue() );
         if( subsfile_dialog->encoding_combo )
         {
             subsfile_mrl.Add( wxString(wxT("subsdec-encoding=")) +
@@ -1763,17 +1818,17 @@ void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) )
         if( subsfile_dialog->align_combo )
         {
             subsfile_mrl.Add( wxString::Format(wxT("subsdec-align=%i"),
-                              (int)subsfile_dialog->align_combo->GetClientData(
-                              subsfile_dialog->align_combo->GetSelection()) ) );
+                        (int)subsfile_dialog->align_combo->GetClientData(
+                        subsfile_dialog->align_combo->GetSelection()) ) );
         }
         if( subsfile_dialog->size_combo )
         {
             subsfile_mrl.Add( wxString::Format( wxT("freetype-rel-fontsize=%i"),
-                              (int)subsfile_dialog->size_combo->GetClientData(
-                              subsfile_dialog->size_combo->GetSelection()) ) );
+                        (int)subsfile_dialog->size_combo->GetClientData(
+                        subsfile_dialog->size_combo->GetSelection()) ) );
         }
-        subsfile_mrl.Add( wxString::Format( wxT("sub-fps=%i"),
-                          subsfile_dialog->fps_spinctrl->GetValue() ) );
+        subsfile_mrl.Add( wxString( wxT("sub-fps="))+
+                                    subsfile_dialog->fps_ctrl->GetValue()  );
         subsfile_mrl.Add( wxString::Format( wxT("sub-delay=%i"),
                           subsfile_dialog->delay_spinctrl->GetValue() ) );
     }
@@ -1826,7 +1881,7 @@ void OpenDialog::OnCachingChange( wxCommandEvent& event )
  *****************************************************************************/
 wxArrayString SeparateEntries( wxString entries )
 {
-    vlc_bool_t b_quotes_mode = VLC_FALSE;
+    bool b_quotes_mode = false;
 
     wxArrayString entries_array;
     wxString entry;
@@ -1843,13 +1898,13 @@ wxArrayString SeparateEntries( wxString entries )
         {
             /* Enters quotes mode */
             entry.RemoveLast();
-            b_quotes_mode = VLC_TRUE;
+            b_quotes_mode = true;
         }
         else if( b_quotes_mode && entry.Last() == wxT('\"') )
         {
             /* Finished the quotes mode */
             entry.RemoveLast();
-            b_quotes_mode = VLC_FALSE;
+            b_quotes_mode = false;
         }
         else if( !b_quotes_mode && entry.Last() != wxT('\"') )
         {