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

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

parent 9b67ddf0
......@@ -61,6 +61,7 @@ enum
DiscDevice_Event,
DiscTitle_Event,
DiscChapter_Event,
DiscSub_Event,
NetType_Event,
NetRadio1_Event, NetRadio2_Event, NetRadio3_Event, NetRadio4_Event,
......@@ -98,6 +99,8 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
EVT_SPINCTRL(DiscTitle_Event, OpenDialog::OnDiscPanelChange)
EVT_TEXT(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 */
EVT_RADIOBUTTON(NetRadio1_Event, OpenDialog::OnNetTypeChange)
......@@ -631,7 +634,6 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
disc_title_label = new wxStaticText( panel, -1, wxU(_("Title")) );
disc_title = new wxSpinCtrl( panel, DiscTitle_Event );
sizer->Add( disc_title_label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
sizer->Add( disc_title, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );
......@@ -640,6 +642,15 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
sizer->Add( disc_chapter_label, 0,
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 );
panel->SetSizerAndFit( sizer_row );
......@@ -766,89 +777,63 @@ void OpenDialog::UpdateMRL( int i_access_method )
//mrltemp = wxT("file") + demux + wxT(":") + file_combo->GetValue();
mrltemp = file_combo->GetValue();
break;
case DISC_ACCESS:
i_disc_type_selection = disc_type->GetSelection();
switch ( i_disc_type_selection )
{
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 */
disc_chapter->Enable();
disc_chapter_label->Enable();
mrltemp = wxT("dvdsimple://")
+ disc_device->GetValue()
+ wxString::Format( wxT("@%d:%d"),
disc_title->GetValue(),
disc_chapter->GetValue() );
break;
if( i_disc_type_selection == 0 )
mrltemp = wxT("dvd://") + disc_device->GetValue();
else
mrltemp = wxT("dvdsimple://") + disc_device->GetValue();
case 2: /* VCD of some sort */
if( i_disc_title > 0 )
{
/* The chapter object is used for subtitles */
mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
if( i_disc_chapter > 0 )
mrltemp += wxString::Format( wxT(":%d"), i_disc_chapter );
}
int i_subtitle = disc_chapter->GetValue();
config_PutInt( p_intf, "spu-channel", i_subtitle );
if( i_disc_sub >= 0 )
mrltemp += wxString::Format( wxT(" :spu-channel=%d"),
i_disc_sub );
break;
disc_chapter->Enable();
disc_chapter_label->Enable();
case 2: /* VCD of some sort */
#ifdef HAVE_VCDX
if ( disc_title->GetValue() )
mrltemp = wxT("vcdx://")
+ disc_device->GetValue()
+ wxString::Format( wxT("@%c%d"),
mrltemp = wxT("vcdx://") + disc_device->GetValue();
if( i_disc_title > 0 )
mrltemp += wxString::Format( wxT("@%c%d"),
config_GetInt( p_intf, "vcdx-PBC" )
? 'P' : 'E',
disc_title->GetValue()
);
else
mrltemp = wxT("vcdx://")
+ disc_device->GetValue();
? 'P' : 'E', i_disc_title );
#else
mrltemp = wxT("vcd://")
+ disc_device->GetValue()
+ wxString::Format( wxT("@%d"),
disc_title->GetValue() );
mrltemp = wxT("vcd://") + disc_device->GetValue();
if( i_disc_title > 0 )
mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
#endif
break;
}
if( i_disc_sub >= 0 )
mrltemp += wxString::Format( wxT(" :spu-channel=%d"),
i_disc_sub );
break;
case 3: /* CD-DA */
disc_chapter->Disable();
disc_chapter_label->Disable();
#ifdef HAVE_CDDAX
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
mrltemp = wxT("cdda://")
+ disc_device->GetValue()
+ wxString::Format( wxT("@%d"),
disc_title->GetValue() );
#endif
mrltemp = wxT("cdda://") + disc_device->GetValue();
if( i_disc_title > 0 )
mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
break;
default: ;
default:
msg_Err( p_intf, "invalid selection (%d)",
disc_type->GetSelection() );
}
break;
case NET_ACCESS:
switch( i_net_type )
{
......@@ -1089,6 +1074,10 @@ void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(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 );
}
......@@ -1124,93 +1113,68 @@ void OpenDialog::OnDiscDeviceChange( wxCommandEvent& event )
void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
{
char *psz_device = NULL;
int i_selection = 1; /* Default Title/Track selection number*/
switch( disc_type->GetSelection() )
{
case 0: /* DVD with menus */
case 4: /* DVD with menus (dvdnav) */
i_selection=0;
/* Fall through... */
case 1: /* DVD of some sort */
case 1: /* DVD without menus */
disc_sub->Enable(); disc_sub_label->Enable();
disc_chapter->Enable(); disc_chapter_label->Enable();
disc_title_label->SetLabel ( wxU(_("Title")) );
psz_device = config_GetPsz( p_intf, "dvd" );
if( !b_disc_device_changed )
{
if( psz_device )
disc_device->SetValue( wxL2U(psz_device) );
else
disc_device->SetValue( wxT("") );
disc_title_label->SetLabel ( wxU(_("Title")) );
if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
else disc_device->SetValue( wxT("") );
}
disc_title->SetRange( i_selection, 255 );
disc_title->SetValue( i_selection );
disc_chapter->SetRange( 1, 255 );
disc_chapter->SetValue( 1 );
disc_chapter_label->SetLabel ( wxU(_("Chapter")) );
disc_title->SetRange( 0, 255 );
disc_chapter->SetRange( 0, 255 );
break;
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" );
if( !b_disc_device_changed )
{
if( psz_device )
disc_device->SetValue( wxL2U(psz_device) );
else
disc_device->SetValue( wxT("") );
if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
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
disc_title_label->SetLabel ( config_GetInt( p_intf, "vcdx-PBC" )
? wxT("Playback LID") : wxT("Entry") );
disc_title->SetRange( 0, 999 );
i_selection = 0;
#else
disc_title_label->SetLabel ( wxU(_("Track")) );
disc_title->SetRange( 1, 98 );
#endif
disc_title->SetValue( i_selection );
/* 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" ) );
disc_title->SetRange( 0, 999 );
break;
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" );
if( !b_disc_device_changed )
{
if( psz_device )
disc_device->SetValue( wxL2U(psz_device) );
else
disc_device->SetValue( wxT("") );
if( psz_device ) disc_device->SetValue( wxL2U(psz_device) );
else disc_device->SetValue( wxT("") );
}
disc_title_label->SetLabel ( wxU(_("Track")) );
#ifdef HAVE_CDDAX
i_selection = 0;
#endif
/* There are at most 99 tracks in a CD-DA */
disc_title->SetRange( i_selection, 99 );
disc_title->SetValue( i_selection );
disc_title->SetRange( 0, 99 );
break;
default:
msg_Err( p_intf, "invalid Disc type selection (%d)",
disc_type->GetSelection() );
break;
}
disc_title->SetValue( 0 ); i_disc_title = 0;
disc_chapter->SetValue( 0 ); i_disc_chapter = 0;
if( psz_device ) free( psz_device );
UpdateMRL( DISC_ACCESS );
......
......@@ -441,13 +441,15 @@ private:
/* Controls for the disc panel */
wxRadioBox *disc_type;
wxTextCtrl *disc_device;
wxSpinCtrl *disc_title;
wxSpinCtrl *disc_chapter;
wxSpinCtrl *disc_title; int i_disc_title;
wxSpinCtrl *disc_chapter; int i_disc_chapter;
wxSpinCtrl *disc_sub; int i_disc_sub;
/* 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_chapter_label;
wxStaticText *disc_sub_label;
/* Indicates if the disc device control was modified */
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