]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/open.cpp
wx/*: fix a few string additions
[vlc] / modules / gui / wxwindows / open.cpp
index fcd1a5aedb451010156691bce30700770bb03764..17033bc76a58c8f931055d672929029cb87a3585 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * open.cpp : wxWindows plugin for vlc
  *****************************************************************************
- * Copyright (C) 2000-2004 VideoLAN
+ * Copyright (C) 2000-2005 VideoLAN
  * $Id$
  *
  * Authors: Gildas Bazin <gbazin@videolan.org>
@@ -37,6 +37,8 @@
 
 #include <vlc/intf.h>
 
+#include <vector>
+
 #include "wxwindows.h"
 #include "preferences_widgets.h"
 
@@ -221,9 +223,6 @@ AutoBuiltPanel::AutoBuiltPanel( wxWindow *parent, OpenDialog *dialog,
 
     if( b_advanced )
     {
-        wxPanel *dummy_panel = new wxPanel( this, -1 );
-        sizer->Add( dummy_panel, 1 );
-
         wxButton *button =
             new wxButton( this, AdvancedOptions_Event,
                           wxU(_("Advanced options...")) );
@@ -279,7 +278,7 @@ AutoBuiltPanel::AutoBuiltPanel( wxWindow *parent, OpenDialog *dialog,
         while( p_item->i_type != CONFIG_HINT_END && p_item++ );
 
         /* Separation */
-        dummy_panel = new wxPanel( p_advanced_dialog, -1 );
+        wxPanel *dummy_panel = new wxPanel( p_advanced_dialog, -1 );
         sizer->Add( dummy_panel, 1 );
         wxStaticLine *static_line =
             new wxStaticLine( p_advanced_dialog, wxID_OK );
@@ -373,6 +372,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
     SetIcon( *p_intf->p_sys->p_icon );
     file_dialog = NULL;
     i_disc_type_selection = 0;
+    i_disc_title = 0;
     i_open_arg = i_arg;
 
     sout_dialog = NULL;
@@ -392,8 +392,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
     wxStaticText *mrl_label = new wxStaticText( panel, -1,
                                                 wxU(_("Open:")) );
     mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""),
-                                wxPoint(20,25), wxSize(120, -1),
-                                0, NULL );
+                                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.")) );
@@ -443,11 +442,15 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
     caching_checkbox = new wxCheckBox( panel, CachingEnable_Event,
                                        wxU(_("Caching")) );
     caching_checkbox->SetToolTip( wxU(_("Change the default caching value "
-                                        "(in miliseconds)")) );
+                                        "(in milliseconds)")) );
     common_opt_sizer->Add( caching_checkbox, 0,
                            wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
     caching_value = new wxSpinCtrl( panel, CachingChange_Event );
+#ifdef WIN32  /* WIN32 uses 16 bit integer */
+    caching_value->SetRange( 0, 32767 );
+#else
     caching_value->SetRange( 0, 1000000 );
+#endif
     caching_value->Disable();
     common_opt_sizer->Add( caching_value, 0,
                            wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
@@ -478,7 +481,8 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
         AutoBuiltPanel *autopanel =
             new AutoBuiltPanel( notebook, this, p_intf, p_module );
         input_tab_array.Add( autopanel );
-        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ),
+        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ?
+                        p_module->psz_shortname : p_module->psz_object_name ),
                            i_access_method == CAPTURE_ACCESS );
     }
 
@@ -488,7 +492,8 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
         AutoBuiltPanel *autopanel =
             new AutoBuiltPanel( notebook, this, p_intf, p_module );
         input_tab_array.Add( autopanel );
-        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ),
+        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ?
+                        p_module->psz_shortname : p_module->psz_object_name ),
                            i_access_method == CAPTURE_ACCESS );
     }
 
@@ -498,7 +503,8 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
         AutoBuiltPanel *autopanel =
             new AutoBuiltPanel( notebook, this, p_intf, p_module );
         input_tab_array.Add( autopanel );
-        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ),
+        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ?
+                        p_module->psz_shortname : p_module->psz_object_name ),
                            i_access_method == CAPTURE_ACCESS );
     }
 
@@ -508,7 +514,8 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
         AutoBuiltPanel *autopanel =
             new AutoBuiltPanel( notebook, this, p_intf, p_module );
         input_tab_array.Add( autopanel );
-        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ),
+        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ?
+                        p_module->psz_shortname : p_module->psz_object_name ),
                            i_access_method == CAPTURE_ACCESS );
     }
 
@@ -584,7 +591,7 @@ wxPanel *OpenDialog::FilePanel( wxWindow* parent )
     wxBoxSizer *file_sizer = new wxBoxSizer( wxHORIZONTAL );
 
     file_combo = new wxComboBox( panel, FileName_Event, wxT(""),
-                                 wxPoint(20,25), wxSize(200, -1), 0, NULL );
+                                 wxPoint(20,25), wxSize(200, -1) );
     wxButton *browse_button = new wxButton( panel, FileBrowse_Event,
                                             wxU(_("Browse...")) );
     file_sizer->Add( file_combo, 1, wxALL, 5 );
@@ -666,7 +673,7 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
     sizer->Add( disc_sub_label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
     sizer->Add( disc_sub, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
     disc_sub->SetRange( -1, 255 );
-    i_disc_sub = config_GetInt( p_intf, "spu-channel" );
+    i_disc_sub = config_GetInt( p_intf, "sub-track" );
     disc_sub->SetValue( i_disc_sub );
 
     sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 );
@@ -688,7 +695,7 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent )
     {
         wxU(_("UDP/RTP")),
         wxU(_("UDP/RTP Multicast")),
-        wxU(_("HTTP/FTP/MMS")),
+        wxU(_("HTTP/HTTPS/FTP/MMS")),
         wxU(_("RTSP"))
     };
 
@@ -713,7 +720,7 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent )
                                    wxString::Format(wxT("%d"), i_net_ports[0]),
                                    wxDefaultPosition, wxDefaultSize,
                                    wxSP_ARROW_KEYS,
-                                   0, 16000, i_net_ports[0] );
+                                   0, 65535, i_net_ports[0] );
 
     subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
     subpanel_sizer->Add( net_ports[0], 1,
@@ -741,7 +748,7 @@ wxPanel *OpenDialog::NetPanel( wxWindow* parent )
                                    wxString::Format(wxT("%d"), i_net_ports[1]),
                                    wxDefaultPosition, wxDefaultSize,
                                    wxSP_ARROW_KEYS,
-                                   0, 16000, i_net_ports[1] );
+                                   0, 65535, i_net_ports[1] );
 
     subpanel_sizer->Add( label, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
     subpanel_sizer->Add( net_ports[1], 1,
@@ -785,7 +792,7 @@ void OpenDialog::UpdateMRL()
 
 void OpenDialog::UpdateMRL( int i_access_method )
 {
-    wxString demux, mrltemp, caching_name;
+    wxString mrltemp, caching_name;
 
     i_current_access_method = i_access_method;
 
@@ -793,7 +800,7 @@ void OpenDialog::UpdateMRL( int i_access_method )
     {
     case FILE_ACCESS:
         mrltemp = file_combo->GetValue();
-        caching_name = "file-caching";
+        caching_name = wxT("file-caching");
         break;
 
     case DISC_ACCESS:
@@ -806,12 +813,12 @@ void OpenDialog::UpdateMRL( int i_access_method )
             if( i_disc_type_selection == 0 )
             {
                 mrltemp = wxT("dvd://") + disc_device->GetValue();
-                caching_name = "dvdnav-caching";
+                caching_name = wxT("dvdnav-caching");
             }
             else
             {
                 mrltemp = wxT("dvdsimple://") + disc_device->GetValue();
-                caching_name = "dvdread-caching";
+                caching_name = wxT("dvdread-caching");
             }
 
             if( i_disc_title > 0 )
@@ -823,7 +830,7 @@ void OpenDialog::UpdateMRL( int i_access_method )
             }
 
             if( i_disc_sub >= 0 )
-                mrltemp += wxString::Format( wxT("  :spu-channel=%d"),
+                mrltemp += wxString::Format( wxT("  :sub-track=%d"),
                                              i_disc_sub );
             break;
 
@@ -841,18 +848,24 @@ void OpenDialog::UpdateMRL( int i_access_method )
 #endif
 
             if( i_disc_sub >= 0 )
-                mrltemp += wxString::Format( wxT("  :spu-channel=%d"),
+                mrltemp += wxString::Format( wxT("  :sub-track=%d"),
                                              i_disc_sub );
 
-            caching_name = "vcd-caching";
+            caching_name = wxT("vcd-caching");
             break;
 
         case 3: /* CD-DA */
-            mrltemp = wxT("cdda://") + disc_device->GetValue();
+            mrltemp = 
+#ifdef HAVE_CDDAX
+              wxT("cddax://") 
+#else
+              wxT("cdda://") 
+#endif
+              + disc_device->GetValue();
             if( i_disc_title > 0 )
                 mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
 
-            caching_name = "cdda-caching";
+            caching_name = wxT("cdda-caching");
             break;
 
         default:
@@ -866,22 +879,22 @@ void OpenDialog::UpdateMRL( int i_access_method )
         switch( i_net_type )
         {
         case 0:
-            mrltemp = wxT("udp") + demux + wxT("://");
+            mrltemp = wxT("udp://@");
             if ( net_ipv6->GetValue() )
             {
-                mrltemp += wxT("@[::]");
+                mrltemp += wxT("[::]");
             }
             if( i_net_ports[0] !=
                 config_GetInt( p_intf, "server-port" ) )
             {
-                mrltemp += wxString::Format( wxT("@:%d"), i_net_ports[0] );
+                mrltemp += wxString::Format( wxT(":%d"), i_net_ports[0] );
             }
 
-            caching_name = "udp-caching";
+            caching_name = wxT("udp-caching");
             break;
 
         case 1:
-            mrltemp = wxT("udp") + demux + wxT("://@");
+            mrltemp = wxT("udp://@");
             if ((net_addrs[1]->GetLineText(0).Find (':') != -1)
                 && (net_addrs[1]->GetLineText(0)[0u] != '['))
             {
@@ -898,29 +911,28 @@ void OpenDialog::UpdateMRL( int i_access_method )
                 mrltemp += wxString::Format( wxT(":%d"), i_net_ports[1] );
             }
 
-            caching_name = "udp-caching";
+            caching_name = wxT("udp-caching");
             break;
 
         case 2:
             /* http access */
-            if( net_addrs[2]->GetLineText(0).Find(wxT("http://")) )
-            {
-                mrltemp = wxT("http") + demux + wxT("://");
-            }
+            if( net_addrs[2]->GetLineText(0).Find(wxT("://")) == -1 )
+                mrltemp = wxT("http://");
+
             mrltemp += net_addrs[2]->GetLineText(0);
 
-            caching_name = "http-caching";
+            caching_name = wxT("http-caching");
             break;
 
         case 3:
             /* RTSP access */
             if( net_addrs[3]->GetLineText(0).Find(wxT("rtsp://")) != 0 )
             {
-                mrltemp = wxT("rtsp") + demux + wxT("://");
+                mrltemp = wxT("rtsp://");
             }
             mrltemp += net_addrs[3]->GetLineText(0);
 
-            caching_name = "rtsp-caching";
+            caching_name = wxT("rtsp-caching");
             break;
         }
         break;
@@ -980,8 +992,8 @@ void OpenDialog::UpdateMRL( int i_access_method )
     {
         if( caching_value->IsEnabled() )
         {
-            mrltemp += wxString::Format( wxT("  :%s=%d"), caching_name.mb_str(),
-                                         i_caching );
+            mrltemp += wxT("  :") + caching_name +
+                wxString::Format( wxT("=%d"), i_caching );
         }
         else
         {
@@ -1054,8 +1066,7 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
 
         if( b_start )
         {
-            int i_pos = playlist_GetPositionById( p_playlist , i_id );
-            playlist_Command( p_playlist, PLAYLIST_GOTO, i_pos );
+            playlist_Control( p_playlist, PLAYLIST_ITEMPLAY , p_item );
         }
     }
 
@@ -1280,10 +1291,17 @@ void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) )
         if( subsfile_dialog->encoding_combo )
             subsfile_mrl.Add( wxString(wxT("subsdec-encoding=")) +
                               subsfile_dialog->encoding_combo->GetValue() );
-        subsfile_mrl.Add( wxString::Format( wxT("sub-delay=%i"),
-                          subsfile_dialog->delay_spinctrl->GetValue() ) );
+        subsfile_mrl.Add( wxString::Format(wxT("subsdec-align=%i"),
+                           (int)subsfile_dialog->align_combo->GetClientData(
+                           subsfile_dialog->align_combo->GetSelection()) ) );
+
+        subsfile_mrl.Add( wxString::Format( wxT("freetype-rel-fontsize=%i"),
+                          (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::Format( wxT("sub-delay=%i"),
+                          subsfile_dialog->delay_spinctrl->GetValue() ) );
     }
 }