| 329 | } |
| 330 | |
| 331 | void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event)) |
| 332 | { |
| 333 | long item = mMacros->GetNextItem(-1, |
| 334 | wxLIST_NEXT_ALL, |
| 335 | wxLIST_STATE_SELECTED); |
| 336 | if (item == -1) { |
| 337 | AudacityMessageBox( XO("No macro selected") ); |
| 338 | return; |
| 339 | } |
| 340 | |
| 341 | wxString name = mMacros->GetItemText(item); |
| 342 | gPrefs->Write(wxT("/Batch/ActiveMacro"), name); |
| 343 | gPrefs->Flush(); |
| 344 | |
| 345 | AudacityProject *project = &mProject; |
| 346 | if (!TrackList::Get( *project ).empty()) { |
| 347 | AudacityMessageBox( |
| 348 | XO("Please save and close the current project first.") ); |
| 349 | return; |
| 350 | } |
| 351 | |
| 352 | // This insures that we start with an empty and temporary project |
| 353 | ProjectFileManager::Get(*project).CloseProject(); |
| 354 | ProjectFileManager::Get(*project).OpenProject(); |
| 355 | |
| 356 | auto prompt = XO("Select file(s) for batch processing..."); |
| 357 | |
| 358 | const auto fileTypes = Importer::Get().GetFileTypes(); |
| 359 | |
| 360 | auto path = FileNames::FindDefaultPath(FileNames::Operation::Open); |
| 361 | FileDialogWrapper dlog(this, |
| 362 | prompt, |
| 363 | path, |
| 364 | wxT(""), |
| 365 | fileTypes, |
| 366 | wxFD_OPEN | wxFD_MULTIPLE | wxRESIZE_BORDER); |
| 367 | |
| 368 | dlog.SetFilterIndex( Importer::SelectDefaultOpenType( fileTypes ) ); |
| 369 | if (dlog.ShowModal() != wxID_OK) { |
| 370 | Raise(); |
| 371 | return; |
| 372 | } |
| 373 | Raise(); |
| 374 | |
| 375 | wxArrayString files; |
| 376 | dlog.GetPaths(files); |
| 377 | |
| 378 | files.Sort(); |
| 379 | |
| 380 | wxDialogWrapper activityWin(this, wxID_ANY, Verbatim( GetTitle() ), |
| 381 | wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER |
| 382 | ); |
| 383 | activityWin.SetName(); |
| 384 | ShuttleGui S(&activityWin, eIsCreating); |
| 385 | |
| 386 | wxListCtrl * fileList = NULL; |
| 387 | |
| 388 | S.StartVerticalLay(1); |
nothing calls this directly
no test coverage detected