📄 open.cpp
字号:
vlc_object_release( p_playlist ); Hide(); if( IsModal() ) EndModal( wxID_OK );}void OpenDialog::OnCancel( wxCommandEvent& WXUNUSED(event) ){ wxCloseEvent cevent; OnClose(cevent);}void OpenDialog::OnClose( wxCloseEvent& WXUNUSED(event) ){ Hide(); if( IsModal() ) EndModal( wxID_CANCEL );}void OpenDialog::OnPageChange( wxNotebookEvent& event ){ UpdateMRL( event.GetSelection() );}void OpenDialog::OnMRLChange( wxCommandEvent& event ){ //mrl = SeparateEntries( event.GetString() );}/***************************************************************************** * File panel event methods. *****************************************************************************/void OpenDialog::OnFilePanelChange( wxCommandEvent& WXUNUSED(event) ){ UpdateMRL( FILE_ACCESS );}void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) ){ if( file_dialog == NULL ) file_dialog = new wxFileDialog( this, wxU(_("Open File")), wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE ); if( file_dialog && file_dialog->ShowModal() == wxID_OK ) { wxArrayString paths; wxString path; file_dialog->GetPaths( paths ); for( size_t i = 0; i < paths.GetCount(); i++ ) { if( paths[i].Find( wxT(' ') ) >= 0 ) path += wxT("\"") + paths[i] + wxT("\" "); else path += paths[i] + wxT(" "); } file_combo->SetValue( path ); file_combo->Append( path ); if( file_combo->GetCount() > 10 ) file_combo->Delete( 0 ); UpdateMRL( FILE_ACCESS ); }}/***************************************************************************** * Disc panel event methods. *****************************************************************************/void OpenDialog::OnDiscPanelChangeSpin( wxSpinEvent& event ){ wxCommandEvent cevent; cevent.SetId(event.GetId()); cevent.SetInt(event.GetPosition()); OnDiscPanelChange(cevent);}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 );}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 ( !psz_device ) psz_device = ""; if( disc_device->GetValue().Cmp( wxL2U( psz_device ) ) ) { b_disc_device_changed = true; } UpdateMRL( DISC_ACCESS );}void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) ){ char *psz_device = NULL; switch( disc_type->GetSelection() ) { case 0: /* DVD with menus */ 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->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("") ); }#ifdef HAVE_VCDX disc_title_label->SetLabel ( config_GetInt( p_intf, "vcdx-PBC" ) ? wxT("Playback LID") : wxT("Entry") );#else disc_title_label->SetLabel ( wxU(_("Track")) );#endif 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("") ); } /* There are at most 99 tracks in a CD-DA */ 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 );}/***************************************************************************** * Net panel event methods. *****************************************************************************/void OpenDialog::OnNetPanelChangeSpin( wxSpinEvent& event ){ wxCommandEvent cevent; cevent.SetId(event.GetId()); cevent.SetInt(event.GetPosition()); OnNetPanelChange(cevent);}void OpenDialog::OnNetPanelChange( wxCommandEvent& event ){ if( event.GetId() >= NetPort1_Event && event.GetId() <= NetPort3_Event ) { i_net_ports[event.GetId() - NetPort1_Event] = event.GetInt(); } UpdateMRL( NET_ACCESS );}void OpenDialog::OnNetTypeChange( wxCommandEvent& event ){ int i; i_net_type = event.GetId() - NetRadio1_Event; for(i=0; i<4; i++) { net_radios[i]->SetValue( event.GetId() == (NetRadio1_Event+i) ); net_subpanels[i]->Enable( event.GetId() == (NetRadio1_Event+i) ); } /* UDP Unicast or multicast -> timeshift */ if( i_net_type == 0 || i_net_type == 1 ) net_timeshift->Enable(); else net_timeshift->Disable(); UpdateMRL( NET_ACCESS );}/***************************************************************************** * Subtitles file event methods. *****************************************************************************/void OpenDialog::OnSubsFileEnable( wxCommandEvent& event ){ subsfile_button->Enable( event.GetInt() != 0 );}void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) ){ /* Show/hide the open dialog */ if( subsfile_dialog == NULL ) subsfile_dialog = new SubsFileDialog( p_intf, this ); if( subsfile_dialog && subsfile_dialog->ShowModal() == wxID_OK ) { subsfile_mrl.Empty(); subsfile_mrl.Add( wxString(wxT("sub-file=")) + subsfile_dialog->file_combo->GetValue() ); if( subsfile_dialog->encoding_combo ) { subsfile_mrl.Add( wxString(wxT("subsdec-encoding=")) + subsfile_dialog->encoding_combo->GetValue() ); } if( subsfile_dialog->align_combo ) { subsfile_mrl.Add( wxString::Format(wxT("subsdec-align=%i"), (int)subsfile_dialog->align_combo->GetClientData( subsfile_dialog->align_combo->GetSelection()) ) ); } if( subsfile_dialog->size_combo ) { 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() ) ); }}/***************************************************************************** * Stream output event methods. *****************************************************************************/void OpenDialog::OnSoutEnable( wxCommandEvent& event ){ sout_button->Enable( event.GetInt() != 0 );}void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) ){ /* Show/hide the open dialog */ if( sout_dialog == NULL ) sout_dialog = new SoutDialog( p_intf, this ); if( sout_dialog && sout_dialog->ShowModal() == wxID_OK ) { sout_mrl = sout_dialog->GetOptions(); }}/***************************************************************************** * Caching event methods. *****************************************************************************/void OpenDialog::OnCachingEnable( wxCommandEvent& event ){ caching_value->Enable( event.GetInt() != 0 ); i_caching = caching_value->GetValue(); UpdateMRL();}void OpenDialog::OnCachingChangeSpin( wxSpinEvent& event ){ wxCommandEvent cevent; OnCachingChange(cevent);}void OpenDialog::OnCachingChange( wxCommandEvent& event ){ i_caching = event.GetInt(); UpdateMRL();}/***************************************************************************** * Utility functions. *****************************************************************************/wxArrayString SeparateEntries( wxString entries ){ vlc_bool_t b_quotes_mode = VLC_FALSE; wxArrayString entries_array; wxString entry; wxStringTokenizer token( entries, wxT(" \t\r\n\""), wxTOKEN_RET_DELIMS ); while( token.HasMoreTokens() ) { entry += token.GetNextToken(); if( entry.IsEmpty() ) continue; if( !b_quotes_mode && entry.Last() == wxT('\"') ) { /* Enters quotes mode */ entry.RemoveLast(); b_quotes_mode = VLC_TRUE; } else if( b_quotes_mode && entry.Last() == wxT('\"') ) { /* Finished the quotes mode */ entry.RemoveLast(); b_quotes_mode = VLC_FALSE; } else if( !b_quotes_mode && entry.Last() != wxT('\"') ) { /* we found a non-quoted standalone string */ if( token.HasMoreTokens() || entry.Last() == wxT(' ') || entry.Last() == wxT('\t') || entry.Last() == wxT('\r') || entry.Last() == wxT('\n') ) entry.RemoveLast(); if( !entry.IsEmpty() ) entries_array.Add( entry ); entry.Empty(); } else {;} } if( !entry.IsEmpty() ) entries_array.Add( entry ); return entries_array;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -