]> git.sesse.net Git - vlc/commitdiff
This fixes bugs 1285 and 1343
authorYoann Peronneau <yoann@videolan.org>
Tue, 9 Dec 2003 00:46:03 +0000 (00:46 +0000)
committerYoann Peronneau <yoann@videolan.org>
Tue, 9 Dec 2003 00:46:03 +0000 (00:46 +0000)
* added a the default CD Audio device in General Settings -> Input
* added OpenDialog::OnDiscPanelChange in wxwindows/open.cpp

include/vlc_config.h
modules/gui/wxwindows/open.cpp
modules/gui/wxwindows/wxwindows.h
src/libvlc.h

index ba1c2e4c1c3e4a9c6a515e4635f7ceaced1009a7..a12a2fcc5471cc5ca047de7ee9a57c541c2df8b4 100644 (file)
 #if !defined( WIN32 ) && !defined( UNDER_CE )
 #   define DVD_DEVICE "/dev/dvd"
 #   define VCD_DEVICE "/dev/cdrom"
+#   define CDAUDIO_DEVICE "/dev/cdrom"
 #else
 #   define DVD_DEVICE "D:"
 #   define VCD_DEVICE "D:"
+#   define CDAUDIO_DEVICE "D:"
 #endif
 
 /*****************************************************************************
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;
     }
 
index 934665fad550946fc4fc073e5528ef4de67bafbe..a4eac76e8f668bee804c9ebb6b494e380c399e74 100644 (file)
@@ -2,7 +2,7 @@
  * wxwindows.h: private wxWindows interface description
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: wxwindows.h,v 1.75 2003/11/29 13:39:43 gbazin Exp $
+ * $Id: wxwindows.h,v 1.76 2003/12/09 00:46:03 yoann Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -337,6 +337,7 @@ private:
     /* Event handlers for the disc page */
     void OnDiscPanelChange( wxCommandEvent& event );
     void OnDiscTypeChange( wxCommandEvent& event );
+    void OnDiscDeviceChange( wxCommandEvent& event );
 
     /* Event handlers for the net page */
     void OnNetPanelChange( wxCommandEvent& event );
@@ -374,7 +375,10 @@ private:
     wxTextCtrl *disc_device;
     wxSpinCtrl *disc_title;
     wxSpinCtrl *disc_chapter;
-
+    
+    /* Indicates if the disc device control was modified */
+    bool b_disc_device_changed;
+    
     /* Controls for the net panel */
     wxRadioBox *net_type;
     int i_net_type;
index 02094b7f92f41a3612c5ed2832f0acc4b3ac547d..0e95d43ac8bf71f27da268b04a2f63073a051e4d 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.h: main libvlc header
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.h,v 1.114 2003/12/08 19:50:22 gbazin Exp $
+ * $Id: libvlc.h,v 1.115 2003/12/09 00:46:03 yoann Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -339,6 +339,10 @@ static char *ppsz_language_text[] =
 #define VCD_DEV_LONGTEXT N_( \
     "This is the default VCD device to use.")
 
+#define CDAUDIO_DEV_TEXT N_("CD Audio device")
+#define CDAUDIO_DEV_LONGTEXT N_( \
+    "This is the default CD Audio device to use.")
+                                                                                                                            
 #define IPV6_TEXT N_("Force IPv6")
 #define IPV6_LONGTEXT N_( \
     "If you check this box, IPv6 will be used by default for all UDP and " \
@@ -708,6 +712,7 @@ vlc_module_begin();
 
     add_file( "dvd", DVD_DEVICE, NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT, VLC_FALSE );
     add_file( "vcd", VCD_DEVICE, NULL, VCD_DEV_TEXT, VCD_DEV_LONGTEXT, VLC_FALSE );
+    add_file( "cd-audio", CDAUDIO_DEVICE, NULL, CDAUDIO_DEV_TEXT, CDAUDIO_DEV_LONGTEXT, VLC_FALSE );
 
     add_bool( "ipv6", 0, NULL, IPV6_TEXT, IPV6_LONGTEXT, VLC_FALSE );
         change_short('6');