]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/open.cpp
* modules/gui/skins/x11/x11_window.cpp: small bugfix for icons support.
[vlc] / modules / gui / wxwindows / open.cpp
index fa8a9fe8bde3a680b91573fd81ca79323aa9fd17..fa5bd67d7afe14542032867b5ee70a79ef7edfd1 100644 (file)
@@ -2,7 +2,7 @@
  * open.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: open.cpp,v 1.3 2003/01/28 14:00:49 fenrir Exp $
+ * $Id: open.cpp,v 1.26 2003/05/24 17:52:49 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
 #include <wx/textctrl.h>
 #include <wx/combobox.h>
 #include <wx/spinctrl.h>
+#include <wx/statline.h>
+#include <wx/tokenzr.h>
 
 #include <vlc/intf.h>
 
+#if defined MODULE_NAME_IS_skins
+#   include "../skins/src/skin_common.h"
+#endif
+
 #include "wxwindows.h"
 
 #ifndef wxRB_SINGLE
-   #define wxRB_SINGLE 0
+#   define wxRB_SINGLE 0
 #endif
 
 /*****************************************************************************
@@ -73,16 +79,25 @@ enum
     DiscChapter_Event,
 
     NetType_Event,
-    NetRadio1_Event, NetRadio2_Event, NetRadio3_Event, NetRadio4_Event,
-    NetPort1_Event, NetPort2_Event, NetPort3_Event, NetPort4_Event,
-    NetAddr1_Event, NetAddr2_Event, NetAddr3_Event, NetAddr4_Event,
+    NetRadio1_Event, NetRadio2_Event, NetRadio3_Event,
+    NetPort1_Event, NetPort2_Event, NetPort3_Event,
+    NetAddr1_Event, NetAddr2_Event, NetAddr3_Event,
+
+    SubsFileEnable_Event,
+    SubsFileSettings_Event,
+
+    SoutEnable_Event,
+    SoutSettings_Event,
+
+    DemuxDump_Event,
+    DemuxDumpEnable_Event,
+    DemuxDumpBrowse_Event,
 };
 
 BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
     /* Button events */
     EVT_BUTTON(wxID_OK, OpenDialog::OnOk)
     EVT_BUTTON(wxID_CANCEL, OpenDialog::OnCancel)
-    EVT_BUTTON(FileBrowse_Event, OpenDialog::OnFileBrowse)
 
     EVT_NOTEBOOK_PAGE_CHANGED(Notebook_Event, OpenDialog::OnPageChange)
 
@@ -90,6 +105,7 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
 
     /* Events generated by the file panel */
     EVT_TEXT(FileName_Event, OpenDialog::OnFilePanelChange)
+    EVT_BUTTON(FileBrowse_Event, OpenDialog::OnFileBrowse)
 
     /* Events generated by the disc panel */
     EVT_RADIOBOX(DiscType_Event, OpenDialog::OnDiscTypeChange)
@@ -103,7 +119,6 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
     EVT_RADIOBUTTON(NetRadio1_Event, OpenDialog::OnNetTypeChange)
     EVT_RADIOBUTTON(NetRadio2_Event, OpenDialog::OnNetTypeChange)
     EVT_RADIOBUTTON(NetRadio3_Event, OpenDialog::OnNetTypeChange)
-    EVT_RADIOBUTTON(NetRadio4_Event, OpenDialog::OnNetTypeChange)
     EVT_TEXT(NetPort1_Event, OpenDialog::OnNetPanelChange)
     EVT_SPINCTRL(NetPort1_Event, OpenDialog::OnNetPanelChange)
     EVT_TEXT(NetPort2_Event, OpenDialog::OnNetPanelChange)
@@ -112,21 +127,38 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
     EVT_SPINCTRL(NetPort3_Event, OpenDialog::OnNetPanelChange)
     EVT_TEXT(NetAddr2_Event, OpenDialog::OnNetPanelChange)
     EVT_TEXT(NetAddr3_Event, OpenDialog::OnNetPanelChange)
-    EVT_TEXT(NetAddr4_Event, OpenDialog::OnNetPanelChange)
+
+    /* Events generated by the subtitle file buttons */
+    EVT_CHECKBOX(SubsFileEnable_Event, OpenDialog::OnSubsFileEnable)
+    EVT_BUTTON(SubsFileSettings_Event, OpenDialog::OnSubsFileSettings)
+
+    /* Events generated by the stream output buttons */
+    EVT_CHECKBOX(SoutEnable_Event, OpenDialog::OnSoutEnable)
+    EVT_BUTTON(SoutSettings_Event, OpenDialog::OnSoutSettings)
+
+    /* Events generated by the demux dump buttons */
+    EVT_CHECKBOX(DemuxDumpEnable_Event, OpenDialog::OnDemuxDumpEnable)
+    EVT_TEXT(DemuxDump_Event, OpenDialog::OnDemuxDumpChange)
+    EVT_BUTTON(DemuxDumpBrowse_Event, OpenDialog::OnDemuxDumpBrowse)
 
 END_EVENT_TABLE()
 
 /*****************************************************************************
  * Constructor.
  *****************************************************************************/
-OpenDialog::OpenDialog( intf_thread_t *_p_intf, Interface *_p_main_interface,
+OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
                         int i_access_method ):
-    wxDialog( _p_main_interface, -1, _("Open Target"), wxDefaultPosition,
+    wxDialog( _p_parent, -1, wxU(_("Open Target")), wxDefaultPosition,
              wxDefaultSize, wxDEFAULT_FRAME_STYLE )
 {
     /* Initializations */
     p_intf = _p_intf;
-    p_main_interface = _p_main_interface;
+    p_parent = _p_parent;
+    SetIcon( *p_intf->p_sys->p_icon );
+    file_dialog = NULL;
+    sout_dialog = NULL;
+    subsfile_dialog = NULL;
+    demuxdump_dialog = NULL;
 
     /* Create a panel to put everything in */
     wxPanel *panel = new wxPanel( this, -1 );
@@ -135,42 +167,130 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, Interface *_p_main_interface,
     /* Create MRL combobox */
     wxBoxSizer *mrl_sizer_sizer = new wxBoxSizer( wxHORIZONTAL );
     wxStaticBox *mrl_box = new wxStaticBox( panel, -1,
-                               _("Media Resource Locator (MRL)") );
+                               wxU(_("Media Resource Locator (MRL)")) );
     wxStaticBoxSizer *mrl_sizer = new wxStaticBoxSizer( mrl_box,
                                                         wxHORIZONTAL );
     wxStaticText *mrl_label = new wxStaticText( panel, -1,
-                                                _("Open Target:") );
-    mrl_combo = new wxComboBox( panel, MRL_Event, mrl,
+                                                wxU(_("Open Target:")) );
+    mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""),
                                 wxPoint(20,25), wxSize(120, -1),
                                 0, NULL );
-    mrl_sizer->Add( mrl_label, 0, wxEXPAND | wxALL, 5 );
-    mrl_sizer->Add( mrl_combo, 1, wxEXPAND | wxALL, 5 );
+    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 );
 
 
     /* Create Static Text */
     wxStaticText *label = new wxStaticText( panel, -1,
-        _("Alternatively, you can build an MRL using one of the "
-          "following predefined targets:") );
+        wxU(_("Alternatively, you can build an MRL using one of the "
+              "following predefined targets:")) );
+
+    /* Create Subtitles File checkox */
+    wxFlexGridSizer *subsfile_sizer = new wxFlexGridSizer( 2, 1, 20 );
+    subsfile_checkbox = new wxCheckBox( panel, SubsFileEnable_Event,
+                                        wxU(_("Subtitles file")) );
+    subsfile_checkbox->SetToolTip( wxU(_("Load an additional subtitles file. "
+                                   "Currently only works with AVI files.")) );
+    subsfile_sizer->Add( subsfile_checkbox, 0,
+                         wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
+    subsfile_button = new wxButton( panel, SubsFileSettings_Event,
+                                    wxU(_("Settings...")) );
+    subsfile_button->Disable();
+
+    char *psz_subsfile = config_GetPsz( p_intf, "sub-file" );
+    if( psz_subsfile && *psz_subsfile )
+    {
+        subsfile_checkbox->SetValue(TRUE);
+        subsfile_button->Enable();
+    }
+    if( psz_subsfile ) free( psz_subsfile );
+
+    subsfile_sizer->Add( subsfile_button, 1,
+                         wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
+
+    /* Create Stream Output checkox */
+    wxFlexGridSizer *sout_sizer = new wxFlexGridSizer( 2, 1, 20 );
+    sout_checkbox = new wxCheckBox( panel, SoutEnable_Event,
+                                    wxU(_("Stream output")) );
+    sout_checkbox->SetToolTip( wxU(_("Use VLC as a stream server")) );
+    sout_sizer->Add( sout_checkbox, 0,
+                     wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
+    sout_button = new wxButton( panel, SoutSettings_Event,
+                                wxU(_("Settings...")) );
+    sout_button->Disable();
+
+    char *psz_sout = config_GetPsz( p_intf, "sout" );
+    if( psz_sout && *psz_sout )
+    {
+        sout_checkbox->SetValue(TRUE);
+        sout_button->Enable();
+    }
+    if( psz_sout ) free( psz_sout );
+
+    sout_sizer->Add( sout_button, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
+
+    /* Create Demux Dump checkox */
+    wxBoxSizer *demuxdump_sizer = new wxBoxSizer( wxHORIZONTAL );
+    demuxdump_checkbox = new wxCheckBox( panel, DemuxDumpEnable_Event,
+                               wxU(_("Capture input stream")) );
+    demuxdump_checkbox->SetToolTip(
+        wxU(_("Capture the stream you are playing to a file")) );
+    demuxdump_textctrl = new wxTextCtrl( panel, DemuxDump_Event, wxT(""),
+                                         wxDefaultPosition, wxDefaultSize,
+                                         wxTE_PROCESS_ENTER);
+    demuxdump_button = new wxButton( panel, DemuxDumpBrowse_Event,
+                                     wxU(_("Browse...")) );
+
+    char *psz_demuxdump = config_GetPsz( p_intf, "demuxdump-file" );
+    if( psz_demuxdump && *psz_demuxdump )
+    {
+        demuxdump_textctrl->SetValue( wxU(psz_demuxdump) );
+    }
+    if( psz_demuxdump ) free( psz_demuxdump );
+
+    demuxdump_textctrl->Disable();
+    demuxdump_button->Disable();
+    demuxdump_sizer->Add( demuxdump_checkbox, 0,
+                          wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
+    demuxdump_sizer->Add( demuxdump_button, 0,
+                          wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, 10 );
+    demuxdump_sizer->Add( demuxdump_textctrl, 1, wxRIGHT, 10 );
+
+    /* Separation */
+    wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
+
+    /* Create the buttons */
+    wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("OK")) );
+    ok_button->SetDefault();
+    wxButton *cancel_button = new wxButton( panel, wxID_CANCEL,
+                                            wxU(_("Cancel")) );
 
     /* Create notebook */
-    wxNotebook *notebook = new wxNotebook( panel, Notebook_Event );
+    notebook = new wxNotebook( panel, Notebook_Event );
     wxNotebookSizer *notebook_sizer = new wxNotebookSizer( notebook );
 
-    notebook->AddPage( FilePanel( notebook ), _("File"),
+    notebook->AddPage( FilePanel( notebook ), wxU(_("File")),
                        i_access_method == FILE_ACCESS );
-    notebook->AddPage( DiscPanel( notebook ), _("Disc"),
+    notebook->AddPage( DiscPanel( notebook ), wxU(_("Disc")),
                        i_access_method == DISC_ACCESS );
-    notebook->AddPage( NetPanel( notebook ), _("Network"),
+    notebook->AddPage( NetPanel( notebook ), wxU(_("Network")),
                        i_access_method == NET_ACCESS );
-    notebook->AddPage( SatPanel( notebook ), _("Satellite"),
+#ifndef WIN32
+    notebook->AddPage( SatPanel( notebook ), wxU(_("Satellite")),
                        i_access_method == SAT_ACCESS );
+#endif
 
-    /* Create the buttons */
-    wxButton *ok_button = new wxButton( panel, wxID_OK, _("OK") );
-    ok_button->SetDefault();
-    wxButton *cancel_button = new wxButton( panel, wxID_CANCEL, _("Cancel") );
+    /* Update Disc panel */
+    wxCommandEvent dummy_event;
+    OnDiscTypeChange( dummy_event );
 
+    /* Update Net panel */
+    dummy_event.SetId( NetRadio1_Event );
+    OnNetTypeChange( dummy_event );
 
     /* Update MRL */
     wxNotebookEvent event = wxNotebookEvent( wxEVT_NULL, 0, i_access_method );
@@ -186,7 +306,11 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, Interface *_p_main_interface,
     panel_sizer->Add( mrl_sizer_sizer, 0, wxEXPAND, 5 );
     panel_sizer->Add( label, 0, wxEXPAND | wxALL, 5 );
     panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 );
-    panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT );
+    panel_sizer->Add( subsfile_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
+    panel_sizer->Add( sout_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
+    panel_sizer->Add( demuxdump_sizer, 0, wxEXPAND | wxALIGN_LEFT | wxALL, 5 );
+    panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
+    panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
     panel_sizer->Layout();
     panel->SetSizerAndFit( panel_sizer );
     main_sizer->Add( panel, 1, wxGROW, 0 );
@@ -196,6 +320,22 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, Interface *_p_main_interface,
 
 OpenDialog::~OpenDialog()
 {
+    /* Clean up */
+    if( file_dialog ) delete file_dialog;
+    if( sout_dialog ) delete sout_dialog;
+    if( subsfile_dialog ) delete subsfile_dialog;
+    if( demuxdump_dialog ) delete demuxdump_dialog;
+}
+
+int OpenDialog::ShowModal( int i_access_method )
+{
+    notebook->SetSelection( i_access_method );
+    return wxDialog::ShowModal();
+}
+
+int OpenDialog::ShowModal()
+{
+    return wxDialog::ShowModal();
 }
 
 /*****************************************************************************
@@ -208,15 +348,14 @@ wxPanel *OpenDialog::FilePanel( wxWindow* parent )
 
     wxBoxSizer *sizer = new wxBoxSizer( wxHORIZONTAL );
 
-    file_combo = new wxComboBox( panel, FileName_Event, "",
+    file_combo = new wxComboBox( panel, FileName_Event, wxT(""),
                                  wxPoint(20,25), wxSize(200, -1), 0, NULL );
     wxButton *browse_button = new wxButton( panel, FileBrowse_Event,
-                                            _("Browse...") );
+                                            wxU(_("Browse...")) );
     sizer->Add( file_combo, 1, wxALL, 5 );
     sizer->Add( browse_button, 0, wxALL, 5 );
 
     panel->SetSizerAndFit( sizer );
-
     return panel;
 }
 
@@ -230,52 +369,40 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
 
     static const wxString disc_type_array[] =
     {
-        _("DVD"),
-        _("DVD (menus support)"),
-        _("VCD")
+        wxU(_("DVD (menus support)")),
+        wxU(_("DVD")),
+        wxU(_("VCD")),
+        wxU(_("CD Audio"))
+
     };
 
-    disc_type = new wxRadioBox( panel, DiscType_Event, _("Disc type"),
+    disc_type = new wxRadioBox( panel, DiscType_Event, wxU(_("Disc type")),
                                 wxDefaultPosition, wxDefaultSize,
                                 WXSIZEOF(disc_type_array), disc_type_array,
                                 WXSIZEOF(disc_type_array), wxRA_SPECIFY_COLS );
     sizer_row->Add( disc_type, 0, wxEXPAND | wxALL, 5 );
 
-    wxStaticText *label = new wxStaticText( panel, -1, _("Device Name") );
-    disc_device = new wxTextCtrl( panel, DiscDevice_Event, "",
+    wxStaticText *label = new wxStaticText( panel, -1, wxU(_("Device name")) );
+    disc_device = new wxTextCtrl( panel, DiscDevice_Event, wxT(""),
                                   wxDefaultPosition, wxDefaultSize,
                                   wxTE_PROCESS_ENTER);
 
     sizer->Add( label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
     sizer->Add( disc_device, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
 
-    int val = 1;
-    label = new wxStaticText( panel, -1, _("Title") );
-    disc_title = new wxSpinCtrl( panel, DiscTitle_Event,
-                                 wxString::Format(_("%d"), val),
-                                 wxDefaultPosition, wxDefaultSize,
-                                 wxSP_ARROW_KEYS,
-                                 1, 255, val);
+    label = new wxStaticText( panel, -1, wxU(_("Title")) );
+    disc_title = new wxSpinCtrl( panel, DiscTitle_Event );
 
     sizer->Add( label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
     sizer->Add( disc_title, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
 
-    label = new wxStaticText( panel, -1, _("Chapter") );
-    disc_chapter = new wxSpinCtrl( panel, DiscChapter_Event,
-                                   wxString::Format(_("%d"), val),
-                                   wxDefaultPosition, wxDefaultSize,
-                                   wxSP_ARROW_KEYS,
-                                   1, 255, val);
+    label = new wxStaticText( panel, -1, wxU(_("Chapter")) );
+    disc_chapter = new wxSpinCtrl( panel, DiscChapter_Event );
     sizer->Add( label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
     sizer->Add( disc_chapter, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
     sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 );
 
     panel->SetSizerAndFit( sizer_row );
-
-    /* Update Disc panel */
-    wxCommandEvent dummy_event;
-    OnDiscTypeChange( dummy_event );
-
     return panel;
 }
 
@@ -286,17 +413,16 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent )
                                   wxSize(200, 200) );
 
     wxBoxSizer *sizer_row = new wxBoxSizer( wxVERTICAL );
-    wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 4, 20 );
+    wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 3, 20 );
 
     static const wxString net_type_array[] =
     {
-        _("UDP/RTP"),
-        _("UDP/RTP Multicast"),
-        _("Channel server"),
-        _("HTTP/FTP/MMS")
+        wxU(_("UDP/RTP")),
+        wxU(_("UDP/RTP Multicast")),
+        wxU(_("HTTP/FTP/MMS"))
     };
 
-    for( i=0; i<4; i++ )
+    for( i=0; i<3; i++ )
     {
         net_radios[i] = new wxRadioButton( panel, NetRadio1_Event + i,
                                            net_type_array[i],
@@ -312,9 +438,9 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent )
     wxStaticText *label;
     int val = config_GetInt( p_intf, "server-port" );
     subpanel_sizer = new wxFlexGridSizer( 2, 1, 20 );
-    label = new wxStaticText( net_subpanels[0], -1, _("Port") );
+    label = new wxStaticText( net_subpanels[0], -1, wxU(_("Port")) );
     net_ports[0] = new wxSpinCtrl( net_subpanels[0], NetPort1_Event,
-                                   wxString::Format(_("%d"), val),
+                                   wxString::Format(wxT("%d"), val),
                                    wxDefaultPosition, wxDefaultSize,
                                    wxSP_ARROW_KEYS,
                                    0, 16000, val);
@@ -327,17 +453,17 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent )
 
     /* UDP/RTP Multicast row */
     subpanel_sizer = new wxFlexGridSizer( 4, 1, 20 );
-    label = new wxStaticText( net_subpanels[1], -1, _("Address") );
-    net_addrs[1] = new wxTextCtrl( net_subpanels[1], NetAddr2_Event, "",
+    label = new wxStaticText( net_subpanels[1], -1, wxU(_("Address")) );
+    net_addrs[1] = new wxTextCtrl( net_subpanels[1], NetAddr2_Event, wxT(""),
                                    wxDefaultPosition, wxDefaultSize,
                                    wxTE_PROCESS_ENTER);
     subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
     subpanel_sizer->Add( net_addrs[1], 1,
                          wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
 
-    label = new wxStaticText( net_subpanels[1], -1, _("Port") );
+    label = new wxStaticText( net_subpanels[1], -1, wxU(_("Port")) );
     net_ports[1] = new wxSpinCtrl( net_subpanels[1], NetPort2_Event,
-                                   wxString::Format(_("%d"), val),
+                                   wxString::Format(wxT("%d"), val),
                                    wxDefaultPosition, wxDefaultSize,
                                    wxSP_ARROW_KEYS,
                                    0, 16000, val);
@@ -347,57 +473,29 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent )
                          wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
     net_subpanels[1]->SetSizerAndFit( subpanel_sizer );
 
-    /* Channel server row */
-    subpanel_sizer = new wxFlexGridSizer( 4, 1, 20 );
-    label = new wxStaticText( net_subpanels[2], -1, _("Address") );
-    net_addrs[2] = new wxTextCtrl( net_subpanels[2], NetAddr3_Event, "",
-                                   wxDefaultPosition, wxDefaultSize,
-                                   wxTE_PROCESS_ENTER);
-    subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
-    subpanel_sizer->Add( net_addrs[2], 1,
-                         wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
-
-    label = new wxStaticText( net_subpanels[2], -1, _("Port") );
-    net_ports[2] = new wxSpinCtrl( net_subpanels[2], NetPort3_Event,
-                                   wxString::Format(_("%d"), val),
-                                   wxDefaultPosition, wxDefaultSize,
-                                   wxSP_ARROW_KEYS,
-                                   0, 16000, val);
-
-    subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
-    subpanel_sizer->Add( net_ports[2], 1,
-                         wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
-    net_subpanels[2]->SetSizerAndFit( subpanel_sizer );
-
     /* HTTP row */
     subpanel_sizer = new wxFlexGridSizer( 2, 1, 20 );
-    label = new wxStaticText( net_subpanels[3], -1, _("URL") );
-    net_addrs[3] = new wxTextCtrl( net_subpanels[3], NetAddr4_Event, "",
+    label = new wxStaticText( net_subpanels[2], -1, wxU(_("URL")) );
+    net_addrs[2] = new wxTextCtrl( net_subpanels[2], NetAddr3_Event, wxT(""),
                                    wxDefaultPosition, wxSize( 200, -1 ),
                                    wxTE_PROCESS_ENTER);
     subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
-    subpanel_sizer->Add( net_addrs[3], 1,
+    subpanel_sizer->Add( net_addrs[2], 1,
                          wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
-    net_subpanels[3]->SetSizerAndFit( subpanel_sizer );
+    net_subpanels[2]->SetSizerAndFit( subpanel_sizer );
 
     /* Stuff everything into the main panel */
-    for( i=0; i<4; i++ )
+    for( i=0; i<3; i++ )
     {
-        sizer->Add( net_radios[i], 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
-        sizer->Add( net_subpanels[i], 1,
-                    wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
+        sizer->Add( net_radios[i], 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL |
+                    wxALL, 5 );
+        sizer->Add( net_subpanels[i], 1, wxEXPAND | wxALIGN_LEFT |
+                    wxALIGN_CENTER_VERTICAL | wxALL, 5  );
     }
 
     sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 );
 
     panel->SetSizerAndFit( sizer_row );
-
-    /* Update Net panel */
-    net_addrs[3]->SetValue( "http://" );
-    wxCommandEvent dummy_event;
-    dummy_event.SetId( NetRadio1_Event );
-    OnNetTypeChange( dummy_event );
-
     return panel;
 }
 
@@ -410,16 +508,29 @@ wxPanel *OpenDialog::SatPanel( wxWindow* parent )
 
 void OpenDialog::UpdateMRL( int i_access_method )
 {
+    wxString demux, mrltemp;
+
+    i_current_access_method = i_access_method;
+
+    /* Check if the user asked for demuxdump */
+    if( demuxdump_checkbox->GetValue() )
+    {
+        demux = wxT("/demuxdump");
+    }
+
     switch( i_access_method )
     {
     case FILE_ACCESS:
-        mrl = "file://" + file_combo->GetValue();
+        //mrltemp = wxT("file") + demux + wxT(":") + file_combo->GetValue();
+        mrltemp = file_combo->GetValue();
         break;
     case DISC_ACCESS:
-        mrl = ( disc_type->GetSelection() == 0 ? "dvdold://" :
-                disc_type->GetSelection() == 1 ? "dvd://" : "vcd://" )
+        mrltemp = ( disc_type->GetSelection() == 0 ? wxT("dvd") :
+                disc_type->GetSelection() == 1 ? wxT("dvdsimple") :
+                disc_type->GetSelection() == 2 ? wxT("vcd") : wxT("cdda") )
+                  + demux + wxT(":")
                   + disc_device->GetLineText(0)
-                  + wxString::Format( "@%d:%d",
+                  + wxString::Format( wxT("@%d:%d"),
                                       disc_title->GetValue(),
                                       disc_chapter->GetValue() );
         break;
@@ -430,43 +541,87 @@ void OpenDialog::UpdateMRL( int i_access_method )
             if( net_ports[0]->GetValue() !=
                 config_GetInt( p_intf, "server-port" ) )
             {
-                mrl = wxString::Format( "udp://@:%d",
-                                        net_ports[0]->GetValue() );
+                mrltemp = wxT("udp") + demux +
+                          wxString::Format( wxT("://@:%d"),
+                                            net_ports[0]->GetValue() );
             }
             else
             {
-                mrl = "udp://";
+                mrltemp = wxT("udp") + demux + wxT("://");
             }
             break;
 
         case 1:
-            mrl = "udp://@" + net_addrs[1]->GetLineText(0);
+            mrltemp = wxT("udp") + demux + wxT("://@") +
+                      net_addrs[1]->GetLineText(0);
             if( net_ports[1]->GetValue() !=
                 config_GetInt( p_intf, "server-port" ) )
             {
-                mrl = mrl + wxString::Format( ":%d",
+                mrltemp = mrltemp + wxString::Format( wxT(":%d"),
                                               net_ports[1]->GetValue() );
             }
             break;
 
         case 2:
-            mrl = "udp://";
-            break;
-
-        case 3:
             /* http access */     
-            mrl = net_addrs[3]->GetLineText(0);
+            mrltemp = wxT("http") + demux + wxT("://") +
+                      net_addrs[2]->GetLineText(0);
             break;
         }
         break;
     case SAT_ACCESS:
-        mrl = "satellite://";
+        mrltemp = wxT("satellite") + demux + wxT("://");
         break;
     default:
         break;
     }
 
-    mrl_combo->SetValue( mrl );
+    mrl_combo->SetValue( mrltemp );
+}
+
+wxArrayString OpenDialog::SeparateEntries( wxString entries )
+{
+    vlc_bool_t b_quotes_mode = VLC_FALSE;
+
+    wxArrayString entries_array;
+    wxString entry;
+
+    wxStringTokenizer token( entries, wxT(" \t\r\n\""), wxTOKEN_RET_DELIMS );
+
+    while( token.HasMoreTokens() )
+    {
+        entry += token.GetNextToken();
+
+        if( entry.IsEmpty() ) continue;
+
+        if( !b_quotes_mode && entry.Last() == wxT('\"') )
+        {
+            /* Enters quotes mode */
+            entry.RemoveLast();
+            b_quotes_mode = VLC_TRUE;
+        }
+        else if( b_quotes_mode && entry.Last() == wxT('\"') )
+        {
+            /* Finished the quotes mode */
+            entry.RemoveLast();
+            if( !entry.IsEmpty() ) entries_array.Add( entry );
+            entry.Empty();
+            b_quotes_mode = VLC_FALSE;
+        }
+        else if( !b_quotes_mode && entry.Last() != wxT('\"') )
+        {
+            /* we found a non-quoted standalone string */
+            entry.RemoveLast();
+            if( !entry.IsEmpty() ) entries_array.Add( entry );
+            entry.Empty();
+        } 
+        else
+        {;}
+    }
+
+    if( !entry.IsEmpty() ) entries_array.Add( entry );
+
+    return entries_array;
 }
 
 /*****************************************************************************
@@ -474,6 +629,8 @@ void OpenDialog::UpdateMRL( int i_access_method )
  *****************************************************************************/
 void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
 {
+    mrl_combo->Append( mrl_combo->GetValue() );
+    mrl = SeparateEntries( mrl_combo->GetValue() );
     EndModal( wxID_OK );
 }
 
@@ -489,7 +646,7 @@ void OpenDialog::OnPageChange( wxNotebookEvent& event )
 
 void OpenDialog::OnMRLChange( wxCommandEvent& event )
 {
-    mrl = event.GetString();
+    //mrl = SeparateEntries( event.GetString() );
 }
 
 /*****************************************************************************
@@ -502,12 +659,27 @@ void OpenDialog::OnFilePanelChange( wxCommandEvent& WXUNUSED(event) )
 
 void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
 {
-    wxFileDialog dialog( this, _("Open file"), _(""), _(""), _("*.*"),
-                         wxOPEN );
+    if( file_dialog == NULL )
+        file_dialog = new wxFileDialog( this, wxU(_("Open file")),
+            wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );
 
-    if( dialog.ShowModal() == wxID_OK )
+    if( file_dialog && file_dialog->ShowModal() == wxID_OK )
     {
-        file_combo->SetValue( dialog.GetPath() );      
+        wxArrayString paths;
+        wxString path;
+
+        file_dialog->GetPaths( paths );
+
+        for( size_t i = 0; i < paths.GetCount(); i++ )
+        {
+            if( paths[i].Find( wxT(' ') ) >= 0 )
+                path += wxT("\"") + paths[i] + wxT("\" ");
+            else
+                path += paths[i] + wxT(" ");
+        }
+
+        file_combo->SetValue( path );
+        file_combo->Append( path );
         UpdateMRL( FILE_ACCESS );
     }
 }
@@ -526,19 +698,35 @@ void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
 
     switch( disc_type->GetSelection() )
     {
-    case 3:
+    case 2:
         psz_device = config_GetPsz( p_intf, "vcd" );
-        disc_device->SetValue( psz_device ? psz_device : "" );
+        disc_device->SetValue( psz_device ? wxU(psz_device) : wxT("") );
         break;
 
     default:
         psz_device = config_GetPsz( p_intf, "dvd" );
-        disc_device->SetValue( psz_device ? psz_device : "" );
+        disc_device->SetValue( psz_device ? wxU(psz_device) : wxT("") );
         break;
     }
 
     if( psz_device ) free( psz_device );
 
+    switch( disc_type->GetSelection() )
+    {
+    case 0:
+        disc_title->SetRange( 0, 255 );
+        disc_title->SetValue( 0 );
+        break;
+
+    default:
+        disc_title->SetRange( 1, 255 );
+        disc_title->SetValue( 1 );
+        break;
+    }
+
+    disc_chapter->SetRange( 1, 255 );
+    disc_chapter->SetValue( 1 );
+
     UpdateMRL( DISC_ACCESS );
 }
 
@@ -556,7 +744,7 @@ void OpenDialog::OnNetTypeChange( wxCommandEvent& event )
 
     i_net_type = event.GetId() - NetRadio1_Event;
 
-    for(i=0; i<4; i++)
+    for(i=0; i<3; i++)
     {
         net_radios[i]->SetValue( event.GetId() == (NetRadio1_Event+i) );
         net_subpanels[i]->Enable( event.GetId() == (NetRadio1_Event+i) );
@@ -564,3 +752,112 @@ void OpenDialog::OnNetTypeChange( wxCommandEvent& event )
 
     UpdateMRL( NET_ACCESS );
 }
+
+/*****************************************************************************
+ * Subtitles file event methods.
+ *****************************************************************************/
+void OpenDialog::OnSubsFileEnable( wxCommandEvent& event )
+{
+    subsfile_button->Enable( event.GetInt() != 0 );
+    if( !event.GetInt() )
+    {
+        config_PutPsz( p_intf, "sub-file", "" );
+    }
+    else
+    {
+        demuxdump_checkbox->SetValue( 0 );
+        wxCommandEvent event = wxCommandEvent( wxEVT_NULL );
+        event.SetInt( 0 );
+        OnDemuxDumpEnable( event );
+    }
+}
+
+void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) )
+{
+    /* Show/hide the open dialog */
+    if( subsfile_dialog == NULL )
+        subsfile_dialog = new SubsFileDialog( p_intf, p_parent );
+
+    if( subsfile_dialog && subsfile_dialog->ShowModal() == wxID_OK )
+    {
+        config_PutPsz( p_intf, "sub-file",
+            (const char *)subsfile_dialog->file_combo->GetValue().mb_str() );
+        config_PutInt( p_intf, "sub-delay",
+                       subsfile_dialog->delay_spinctrl->GetValue() );
+        config_PutFloat( p_intf, "sub-fps",
+                         subsfile_dialog->fps_spinctrl->GetValue() );
+    }
+}
+
+/*****************************************************************************
+ * Stream output event methods.
+ *****************************************************************************/
+void OpenDialog::OnSoutEnable( wxCommandEvent& event )
+{
+    sout_button->Enable( event.GetInt() != 0 );
+    if( !event.GetInt() )
+    {
+        config_PutPsz( p_intf, "sout", "" );
+    }
+    else
+    {
+        demuxdump_checkbox->SetValue( 0 );
+        wxCommandEvent event = wxCommandEvent( wxEVT_NULL );
+        event.SetInt( 0 );
+        OnDemuxDumpEnable( event );
+    }
+}
+
+void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) )
+{
+    /* Show/hide the open dialog */
+    if( sout_dialog == NULL )
+        sout_dialog = new SoutDialog( p_intf, p_parent );
+
+    if( sout_dialog && sout_dialog->ShowModal() == wxID_OK )
+    {
+        config_PutPsz( p_intf, "sout",
+                       (const char *)sout_dialog->mrl.mb_str() );
+    }
+}
+
+/*****************************************************************************
+ * Demux dump event methods.
+ *****************************************************************************/
+void OpenDialog::OnDemuxDumpEnable( wxCommandEvent& event )
+{
+    demuxdump_textctrl->Enable( event.GetInt() != 0 );
+    demuxdump_button->Enable( event.GetInt() != 0 );
+
+    if( event.GetInt() )
+    {
+        sout_checkbox->SetValue( 0 );
+        subsfile_checkbox->SetValue( 0 );
+        wxCommandEvent event = wxCommandEvent( wxEVT_NULL );
+        event.SetInt( 0 );
+        OnSoutEnable( event );
+        OnSubsFileEnable( event );
+    }
+
+    UpdateMRL( i_current_access_method );
+}
+
+void OpenDialog::OnDemuxDumpBrowse( wxCommandEvent& WXUNUSED(event) )
+{
+    if( demuxdump_dialog == NULL )
+        demuxdump_dialog = new wxFileDialog( this, wxU(_("Save file")),
+                               wxT(""), wxT(""), wxT("*"), wxSAVE );
+
+    if( demuxdump_dialog && demuxdump_dialog->ShowModal() == wxID_OK )
+    {
+        demuxdump_textctrl->SetValue( demuxdump_dialog->GetPath() );
+        wxCommandEvent event = wxCommandEvent( wxEVT_NULL );
+        OnDemuxDumpChange( event );
+    }
+}
+
+void OpenDialog::OnDemuxDumpChange( wxCommandEvent& WXUNUSED(event) )
+{
+    config_PutPsz( p_intf, "demuxdump-file",
+                   demuxdump_textctrl->GetValue().mb_str() );
+}