]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/open.cpp
This fixes bugs 1285 and 1343
[vlc] / modules / gui / wxwindows / open.cpp
index 53966617e0069fb3be081b543adcae9c5959175e..e7043fb7bdb2177f18c0aef2573f713e01dfe8c3 100644 (file)
@@ -2,7 +2,7 @@
  * open.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: open.cpp,v 1.45 2003/11/27 06:37:10 adn Exp $
+ * $Id: open.cpp,v 1.46 2003/12/09 00:46:03 yoann Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -110,6 +110,7 @@ BEGIN_EVENT_TABLE(OpenDialog, wxFrame)
 
     /* Events generated by the disc panel */
     EVT_RADIOBOX(DiscType_Event, OpenDialog::OnDiscTypeChange)
+    EVT_TEXT(DiscDevice_Event, OpenDialog::OnDiscDeviceChange)
     EVT_TEXT(DiscDevice_Event, OpenDialog::OnDiscPanelChange)
     EVT_TEXT(DiscTitle_Event, OpenDialog::OnDiscPanelChange)
     EVT_SPINCTRL(DiscTitle_Event, OpenDialog::OnDiscPanelChange)
@@ -236,6 +237,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
 #endif
     sout_dialog = NULL;
     subsfile_dialog = NULL;
+    b_disc_device_changed = false;
 
     /* Create a panel to put everything in */
     wxPanel *panel = new wxPanel( this, -1 );
@@ -282,7 +284,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
                          wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
         sout_button = new wxButton( panel, SoutSettings_Event,
                                     wxU(_("Settings...")) );
-         sout_button->Disable();
+        sout_button->Disable();
 
         char *psz_sout = config_GetPsz( p_intf, "sout" );
         if( psz_sout && *psz_sout )
@@ -673,7 +675,8 @@ void OpenDialog::UpdateMRL( int i_access_method )
                 disc_type->GetSelection() == 1 ? wxT("dvdsimple") :
                 disc_type->GetSelection() == 2 ? wxT("vcd") : wxT("cdda") )
                   + demux + wxT(":")
-                  + disc_device->GetLineText(0)
+//                  + disc_device->GetLineText(0)
+                  + disc_device->GetValue()
                   + wxString::Format( wxT("@%d:%d"),
                                       disc_title->GetValue(),
                                       disc_chapter->GetValue() );
@@ -933,20 +936,61 @@ void OpenDialog::OnDiscPanelChange( wxCommandEvent& event )
     UpdateMRL( DISC_ACCESS );
 }
 
+void OpenDialog::OnDiscDeviceChange( wxCommandEvent& event )
+{
+    char *psz_device;
+
+    switch( disc_type->GetSelection() )
+    {
+        case 3:
+            psz_device = config_GetPsz( p_intf, "cd-audio" );
+            break;
+                                                                                                                           
+        case 2:
+            psz_device = config_GetPsz( p_intf, "vcd" );
+            break;
+                                                                                                                            
+        default:
+            psz_device = config_GetPsz( p_intf, "dvd" );
+            break;
+    }
+
+    if( strcmp( psz_device, disc_device->GetValue().c_str() ) )
+    {
+        b_disc_device_changed = true;
+    }
+
+    UpdateMRL( DISC_ACCESS );
+}
+
 void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
 {
     char *psz_device;
 
     switch( disc_type->GetSelection() )
     {
+    case 3:
+        psz_device = config_GetPsz( p_intf, "cd-audio" );
+        if( !b_disc_device_changed )
+        {
+            disc_device->SetValue( psz_device ? wxU(psz_device) : wxT("") );
+        }
+        break;
+
     case 2:
         psz_device = config_GetPsz( p_intf, "vcd" );
-        disc_device->SetValue( psz_device ? wxU(psz_device) : wxT("") );
+        if( !b_disc_device_changed )
+        {
+            disc_device->SetValue( psz_device ? wxU(psz_device) : wxT("") );
+        }
         break;
 
     default:
         psz_device = config_GetPsz( p_intf, "dvd" );
-        disc_device->SetValue( psz_device ? wxU(psz_device) : wxT("") );
+        if( !b_disc_device_changed )
+        {
+            disc_device->SetValue( psz_device ? wxU(psz_device) : wxT("") );
+        }
         break;
     }