Commit 1577ef79 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/*: updated open disc dialog.

parent 9b67ddf0
...@@ -61,6 +61,7 @@ enum ...@@ -61,6 +61,7 @@ enum
DiscDevice_Event, DiscDevice_Event,
DiscTitle_Event, DiscTitle_Event,
DiscChapter_Event, DiscChapter_Event,
DiscSub_Event,
NetType_Event, NetType_Event,
NetRadio1_Event, NetRadio2_Event, NetRadio3_Event, NetRadio4_Event, NetRadio1_Event, NetRadio2_Event, NetRadio3_Event, NetRadio4_Event,
...@@ -98,6 +99,8 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog) ...@@ -98,6 +99,8 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
EVT_SPINCTRL(DiscTitle_Event, OpenDialog::OnDiscPanelChange) EVT_SPINCTRL(DiscTitle_Event, OpenDialog::OnDiscPanelChange)
EVT_TEXT(DiscChapter_Event, OpenDialog::OnDiscPanelChange) EVT_TEXT(DiscChapter_Event, OpenDialog::OnDiscPanelChange)
EVT_SPINCTRL(DiscChapter_Event, OpenDialog::OnDiscPanelChange) EVT_SPINCTRL(DiscChapter_Event, OpenDialog::OnDiscPanelChange)
EVT_TEXT(DiscSub_Event, OpenDialog::OnDiscPanelChange)
EVT_SPINCTRL(DiscSub_Event, OpenDialog::OnDiscPanelChange)
/* Events generated by the net panel */ /* Events generated by the net panel */
EVT_RADIOBUTTON(NetRadio1_Event, OpenDialog::OnNetTypeChange) EVT_RADIOBUTTON(NetRadio1_Event, OpenDialog::OnNetTypeChange)
...@@ -631,7 +634,6 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent ) ...@@ -631,7 +634,6 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
disc_title_label = new wxStaticText( panel, -1, wxU(_("Title")) ); disc_title_label = new wxStaticText( panel, -1, wxU(_("Title")) );
disc_title = new wxSpinCtrl( panel, DiscTitle_Event ); disc_title = new wxSpinCtrl( panel, DiscTitle_Event );
sizer->Add( disc_title_label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL ); sizer->Add( disc_title_label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
sizer->Add( disc_title, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL ); sizer->Add( disc_title, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
...@@ -640,6 +642,15 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent ) ...@@ -640,6 +642,15 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
sizer->Add( disc_chapter_label, 0, sizer->Add( disc_chapter_label, 0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL ); wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
sizer->Add( disc_chapter, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL ); sizer->Add( disc_chapter, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
disc_sub_label = new wxStaticText( panel, -1, wxU(_("Subtitles track")) );
disc_sub = new wxSpinCtrl( panel, DiscSub_Event );
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" );
disc_sub->SetValue( i_disc_sub );
sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 ); sizer_row->Add( sizer, 0, wxEXPAND | wxALL, 5 );
panel->SetSizerAndFit( sizer_row ); panel->SetSizerAndFit( sizer_row );
...@@ -766,89 +777,63 @@ void OpenDialog::UpdateMRL( int i_access_method ) ...@@ -766,89 +777,63 @@ void OpenDialog::UpdateMRL( int i_access_method )
//mrltemp = wxT("file") + demux + wxT(":") + file_combo->GetValue(); //mrltemp = wxT("file") + demux + wxT(":") + file_combo->GetValue();
mrltemp = file_combo->GetValue(); mrltemp = file_combo->GetValue();
break; break;
case DISC_ACCESS: case DISC_ACCESS:
i_disc_type_selection = disc_type->GetSelection(); i_disc_type_selection = disc_type->GetSelection();
switch ( i_disc_type_selection ) switch ( i_disc_type_selection )
{ {
case 0: /* DVD with menus */ case 0: /* DVD with menus */
disc_chapter->Enable();
disc_chapter_label->Enable();
mrltemp = wxT("dvd://")
+ disc_device->GetValue()
+ wxString::Format( wxT("@%d:%d"),
disc_title->GetValue(),
disc_chapter->GetValue() );
break;
case 1: /* DVD without menus */ case 1: /* DVD without menus */
disc_chapter->Enable(); if( i_disc_type_selection == 0 )
disc_chapter_label->Enable(); mrltemp = wxT("dvd://") + disc_device->GetValue();
mrltemp = wxT("dvdsimple://") else
+ disc_device->GetValue() mrltemp = wxT("dvdsimple://") + disc_device->GetValue();
+ wxString::Format( wxT("@%d:%d"),
disc_title->GetValue(), if( i_disc_title > 0 )
disc_chapter->GetValue() ); {
break; mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
if( i_disc_chapter > 0 )
mrltemp += wxString::Format( wxT(":%d"), i_disc_chapter );
}
if( i_disc_sub >= 0 )
mrltemp += wxString::Format( wxT(" :spu-channel=%d"),
i_disc_sub );
break;
case 2: /* VCD of some sort */ case 2: /* VCD of some sort */
{
/* The chapter object is used for subtitles */
int i_subtitle = disc_chapter->GetValue();
config_PutInt( p_intf, "spu-channel", i_subtitle );
disc_chapter->Enable();
disc_chapter_label->Enable();
#ifdef HAVE_VCDX #ifdef HAVE_VCDX
if ( disc_title->GetValue() ) mrltemp = wxT("vcdx://") + disc_device->GetValue();
mrltemp = wxT("vcdx://") if( i_disc_title > 0 )
+ disc_device->GetValue() mrltemp += wxString::Format( wxT("@%c%d"),
+ wxString::Format( wxT("@%c%d"),
config_GetInt( p_intf, "vcdx-PBC" ) config_GetInt( p_intf, "vcdx-PBC" )
? 'P' : 'E', ? 'P' : 'E', i_disc_title );
disc_title->GetValue()
);
else
mrltemp = wxT("vcdx://")
+ disc_device->GetValue();
#else #else
mrltemp = wxT("vcd://") mrltemp = wxT("vcd://") + disc_device->GetValue();
+ disc_device->GetValue() if( i_disc_title > 0 )
+ wxString::Format( wxT("@%d"), mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
disc_title->GetValue() );
#endif #endif
break;
}
case 3: /* CD-DA */ if( i_disc_sub >= 0 )
disc_chapter->Disable(); mrltemp += wxString::Format( wxT(" :spu-channel=%d"),
disc_chapter_label->Disable(); i_disc_sub );
#ifdef HAVE_CDDAX break;
if ( disc_title->GetValue() )
mrltemp = wxT("cddax://")
+ disc_device->GetValue()
+ wxString::Format( wxT("@T%d"),
disc_title->GetValue() );
else
mrltemp = wxT("cddax://")
+ disc_device->GetValue();
#else case 3: /* CD-DA */
mrltemp = wxT("cdda://") mrltemp = wxT("cdda://") + disc_device->GetValue();
+ disc_device->GetValue() if( i_disc_title > 0 )
+ wxString::Format( wxT("@%d"), mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
disc_title->GetValue() ); break;
#endif
break;
default: ; default:
msg_Err( p_intf, "invalid selection (%d)", msg_Err( p_intf, "invalid selection (%d)",
disc_type->GetSelection() ); disc_type->GetSelection() );
} }
break; break;
case NET_ACCESS: case NET_ACCESS:
switch( i_net_type ) switch( i_net_type )
{ {
...@@ -1089,6 +1074,10 @@ void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) ) ...@@ -1089,6 +1074,10 @@ void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
*****************************************************************************/ *****************************************************************************/
void OpenDialog::OnDiscPanelChange( wxCommandEvent& event ) void OpenDialog::OnDiscPanelChange( wxCommandEvent& event )
{ {
if( event.GetId() == DiscTitle_Event ) i_disc_title = event.GetInt();
if( event.GetId() == DiscChapter_Event ) i_disc_chapter = event.GetInt();
if( event.GetId() == DiscSub_Event ) i_disc_sub = event.GetInt();
UpdateMRL( DISC_ACCESS ); UpdateMRL( DISC_ACCESS );
} }
...@@ -1124,93 +1113,68 @@ void OpenDialog::OnDiscDeviceChange( wxCommandEvent& event ) ...@@ -1124,93 +1113,68 @@ void OpenDialog::OnDiscDeviceChange( wxCommandEvent& event )
void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) ) void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
{ {
char *psz_device = NULL; char *psz_device = NULL;
int i_selection = 1; /* Default Title/Track selection number*/
switch( disc_type->GetSelection() ) switch( disc_type->GetSelection() )
{ {
case 0: /* DVD with menus */ case 0: /* DVD with menus */
case 4: /* DVD with menus (dvdnav) */ case 1: /* DVD without menus */
i_selection=0; disc_sub->Enable(); disc_sub_label->Enable();
/* Fall through... */ disc_chapter->Enable(); disc_chapter_label->Enable();
disc_title_label->SetLabel ( wxU(_("Title")) );
case 1: /* DVD of some sort */
psz_device = config_GetPsz( p_intf, "dvd" ); psz_device = config_GetPsz( p_intf, "dvd" );
if( !b_disc_device_changed ) if( !b_disc_device_changed )
{ {
if( psz_device ) if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
disc_device->SetValue( wxL2U(psz_device) ); else disc_device->SetValue( wxT("") );
else
disc_device->SetValue( wxT("") );
disc_title_label->SetLabel ( wxU(_("Title")) );
} }
disc_title->SetRange( i_selection, 255 ); disc_title->SetRange( 0, 255 );
disc_title->SetValue( i_selection ); disc_chapter->SetRange( 0, 255 );
disc_chapter->SetRange( 1, 255 );
disc_chapter->SetValue( 1 );
disc_chapter_label->SetLabel ( wxU(_("Chapter")) );
break; break;
case 2: /* VCD of some sort */ case 2: /* VCD of some sort */
disc_sub->Enable(); disc_sub_label->Enable();
disc_chapter->Disable(); disc_chapter_label->Disable();
psz_device = config_GetPsz( p_intf, "vcd" ); psz_device = config_GetPsz( p_intf, "vcd" );
if( !b_disc_device_changed ) if( !b_disc_device_changed )
{ {
if( psz_device ) if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
disc_device->SetValue( wxL2U(psz_device) ); else disc_device->SetValue( wxT("") );
else
disc_device->SetValue( wxT("") );
} }
/* There are at most 98, tracks in a VCD, 999 Segments, 500 entries
I don't know what the limit is for LIDs, 999 is probably safe
though.
FIXME: it would be better however to get the information for
this particular Media possibly from the General Info area.
*/
#ifdef HAVE_VCDX #ifdef HAVE_VCDX
disc_title_label->SetLabel ( config_GetInt( p_intf, "vcdx-PBC" ) disc_title_label->SetLabel ( config_GetInt( p_intf, "vcdx-PBC" )
? wxT("Playback LID") : wxT("Entry") ); ? wxT("Playback LID") : wxT("Entry") );
disc_title->SetRange( 0, 999 );
i_selection = 0;
#else #else
disc_title_label->SetLabel ( wxU(_("Track")) ); disc_title_label->SetLabel ( wxU(_("Track")) );
disc_title->SetRange( 1, 98 );
#endif #endif
disc_title->SetValue( i_selection ); disc_title->SetRange( 0, 999 );
/* We use the chapter to set subtitle number */
disc_chapter_label->SetLabel ( wxU(_("Subtitle")) );
disc_chapter->SetRange( -1, 4 );
disc_chapter->SetValue( config_GetInt( p_intf, "spu-channel" ) );
break; break;
case 3: /* CD-DA */ case 3: /* CD-DA */
disc_sub->Disable(); disc_sub_label->Disable();
disc_chapter->Disable(); disc_chapter_label->Disable();
disc_title_label->SetLabel ( wxU(_("Track")) );
psz_device = config_GetPsz( p_intf, "cd-audio" ); psz_device = config_GetPsz( p_intf, "cd-audio" );
if( !b_disc_device_changed ) if( !b_disc_device_changed )
{ {
if( psz_device ) if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
disc_device->SetValue( wxL2U(psz_device) ); else disc_device->SetValue( wxT("") );
else
disc_device->SetValue( wxT("") );
} }
disc_title_label->SetLabel ( wxU(_("Track")) );
#ifdef HAVE_CDDAX /* There are at most 99 tracks in a CD-DA */
i_selection = 0; disc_title->SetRange( 0, 99 );
#endif
/* There are at most 99 tracks in a CD-DA */
disc_title->SetRange( i_selection, 99 );
disc_title->SetValue( i_selection );
break; break;
default: default:
msg_Err( p_intf, "invalid Disc type selection (%d)", msg_Err( p_intf, "invalid Disc type selection (%d)",
disc_type->GetSelection() ); disc_type->GetSelection() );
break; break;
} }
disc_title->SetValue( 0 ); i_disc_title = 0;
disc_chapter->SetValue( 0 ); i_disc_chapter = 0;
if( psz_device ) free( psz_device ); if( psz_device ) free( psz_device );
UpdateMRL( DISC_ACCESS ); UpdateMRL( DISC_ACCESS );
......
...@@ -441,13 +441,15 @@ private: ...@@ -441,13 +441,15 @@ private:
/* Controls for the disc panel */ /* Controls for the disc panel */
wxRadioBox *disc_type; wxRadioBox *disc_type;
wxTextCtrl *disc_device; wxTextCtrl *disc_device;
wxSpinCtrl *disc_title; wxSpinCtrl *disc_title; int i_disc_title;
wxSpinCtrl *disc_chapter; wxSpinCtrl *disc_chapter; int i_disc_chapter;
wxSpinCtrl *disc_sub; int i_disc_sub;
/* The media equivalent name for a DVD names. For example, /* The media equivalent name for a DVD names. For example,
"Title", is "Track" for a CD-DA */ * "Title", is "Track" for a CD-DA */
wxStaticText *disc_title_label; wxStaticText *disc_title_label;
wxStaticText *disc_chapter_label; wxStaticText *disc_chapter_label;
wxStaticText *disc_sub_label;
/* Indicates if the disc device control was modified */ /* Indicates if the disc device control was modified */
bool b_disc_device_changed; bool b_disc_device_changed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment