Audacity 3.2.0
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ExportMultipleDialog Class Referencefinal

Presents a dialog box allowing the user to export multiple files either by exporting each track as a separate file, or by exporting each label as a separate file. More...

#include <ExportMultiple.h>

Inheritance diagram for ExportMultipleDialog:
[legend]
Collaboration diagram for ExportMultipleDialog:
[legend]

Public Types

using ProgressResult = BasicUI::ProgressResult
 

Public Member Functions

 ExportMultipleDialog (AudacityProject *parent)
 
virtual ~ExportMultipleDialog ()
 
int ShowModal ()
 
- Public Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
void SetTitle (const TranslatableString &title)
 
void SetLabel (const TranslatableString &title)
 
void SetName (const TranslatableString &title)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Member Functions

void CanExport ()
 
void CountTracksAndLabels ()
 
bool DirOk ()
 
ProgressResult ExportMultipleByLabel (bool byName, const wxString &prefix, bool addNumber)
 Export multiple labeled regions of the project to separate files. More...
 
ProgressResult ExportMultipleByTrack (bool byName, const wxString &prefix, bool addNumber)
 Export each track in the project to a separate file. More...
 
ProgressResult DoExport (std::unique_ptr< ProgressDialog > &pDialog, unsigned channels, const wxFileName &name, bool selectedOnly, double t0, double t1, const Tags &tags)
 
wxString MakeFileName (const wxString &input)
 Takes an arbitrary text string and converts it to a form that can be used as a file name, if necessary prompting the user to edit the file name produced. More...
 
void PopulateOrExchange (ShuttleGui &S)
 
void EnableControls ()
 
void OnFormat (wxCommandEvent &event)
 
void OnOptions (wxCommandEvent &event)
 
void OnCreate (wxCommandEvent &event)
 
void OnChoose (wxCommandEvent &event)
 
void OnLabel (wxCommandEvent &event)
 
void OnFirst (wxCommandEvent &event)
 
void OnFirstFileName (wxCommandEvent &event)
 
void OnTrack (wxCommandEvent &event)
 
void OnByName (wxCommandEvent &event)
 
void OnByNumber (wxCommandEvent &event)
 
void OnPrefix (wxCommandEvent &event)
 
void OnCancel (wxCommandEvent &event)
 
void OnHelp (wxCommandEvent &event)
 
void OnExport (wxCommandEvent &event)
 

Private Attributes

Exporter mExporter
 
std::vector< ExportPlugin * > mPlugins
 
AudacityProjectmProject
 
TrackListmTracks
 
const LabelTrackmLabels
 
int mNumLabels
 
int mNumWaveTracks
 
int mFilterIndex
 
int mPluginIndex
 
int mSubFormatIndex
 
bool mInitialized
 
FilePaths mExported
 
wxChoice * mFormat
 
wxButton * mOptions
 
wxTextCtrl * mDir
 
wxButton * mCreate
 
wxButton * mChoose
 
wxRadioButton * mLabel
 
wxStaticText * mLabelLabel
 
wxCheckBox * mFirst
 
wxStaticText * mFirstFileLabel
 
wxTextCtrl * mFirstFileName
 
wxRadioButton * mTrack
 
wxStaticText * mTrackLabel
 
wxRadioButton * mByNumberAndName
 
wxRadioButton * mByName
 
wxRadioButton * mByNumber
 
wxStaticText * mPrefixLabel
 
wxTextCtrl * mPrefix
 
wxCheckBox * mOverwrite
 
wxButton * mCancel
 
wxButton * mExport
 
wxSimplebook * mBook
 
SelectionStatemSelectionState
 

Detailed Description

Presents a dialog box allowing the user to export multiple files either by exporting each track as a separate file, or by exporting each label as a separate file.

Definition at line 32 of file ExportMultiple.h.

Member Typedef Documentation

◆ ProgressResult

Definition at line 35 of file ExportMultiple.h.

Constructor & Destructor Documentation

◆ ExportMultipleDialog()

ExportMultipleDialog::ExportMultipleDialog ( AudacityProject parent)

◆ ~ExportMultipleDialog()

ExportMultipleDialog::~ExportMultipleDialog ( )
virtual

Definition at line 165 of file ExportMultiple.cpp.

166{
167}

Member Function Documentation

◆ CanExport()

void ExportMultipleDialog::CanExport ( )
private

◆ CountTracksAndLabels()

void ExportMultipleDialog::CountTracksAndLabels ( )
private

Definition at line 169 of file ExportMultiple.cpp.

170{
171 bool anySolo = !(( mTracks->Any<const WaveTrack>() + &WaveTrack::GetSolo ).empty());
172
174 (mTracks->Leaders< const WaveTrack >() -
176
177 // only the first label track
178 mLabels = *mTracks->Any< const LabelTrack >().begin();
180}
const LabelTrack * mLabels
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:89
int GetNumLabels() const
Definition: LabelTrack.cpp:940
bool GetSolo() const
Definition: Track.h:918
bool GetNotSolo() const
Definition: Track.h:920
bool GetMute() const
Definition: Track.h:917
auto Leaders() -> TrackIterRange< TrackType >
Definition: Track.h:1463
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1429
A Track that contains audio waveform data.
Definition: WaveTrack.h:57
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:150

References TrackList::Any(), PackedArray::begin(), PlayableTrack::GetMute(), PlayableTrack::GetNotSolo(), LabelTrack::GetNumLabels(), PlayableTrack::GetSolo(), TrackList::Leaders(), mLabels, mNumLabels, mNumWaveTracks, mTracks, and size.

Here is the call graph for this function:

◆ DirOk()

bool ExportMultipleDialog::DirOk ( )
private

Definition at line 672 of file ExportMultiple.cpp.

673{
674 wxFileName fn;
675
676 fn.AssignDir(mDir->GetValue());
677
678 if (fn.DirExists()) {
679 return true;
680 }
681
682 auto prompt = XO("\"%s\" doesn't exist.\n\nWould you like to create it?")
683 .Format( fn.GetFullPath() );
684
685 int action = AudacityMessageBox(
686 prompt,
687 XO("Warning"),
688 wxYES_NO | wxICON_EXCLAMATION);
689 if (action != wxYES) {
690 return false;
691 }
692
693 return fn.Mkdir(0777, wxPATH_MKDIR_FULL);
694}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
#define XO(s)
Definition: Internat.h:31
static const auto fn

References AudacityMessageBox(), fn, mDir, and XO.

Referenced by OnExport().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoExport()

ProgressResult ExportMultipleDialog::DoExport ( std::unique_ptr< ProgressDialog > &  pDialog,
unsigned  channels,
const wxFileName &  name,
bool  selectedOnly,
double  t0,
double  t1,
const Tags tags 
)
private

Export one file of an export multiple set

Called once for each file in the list to do a (non-interactive) export

Parameters
channelsNumber of channels to export
nameThe file name (and path) to export to
selectedOnlyShould we export the selected tracks only?
t0Start time for export
t1End time for export
tagsMetadata to include in the file (if possible).

Definition at line 1062 of file ExportMultiple.cpp.

1069{
1070 wxFileName name;
1071
1072 wxLogDebug(wxT("Doing multiple Export: File name \"%s\""), (inName.GetFullName()));
1073 wxLogDebug(wxT("Channels: %i, Start: %lf, End: %lf "), channels, t0, t1);
1074 if (selectedOnly)
1075 wxLogDebug(wxT("Selected Region Only"));
1076 else
1077 wxLogDebug(wxT("Whole Project"));
1078
1079 wxFileName backup;
1080 if (mOverwrite->GetValue()) {
1081 name = inName;
1082 backup.Assign(name);
1083
1084 int suffix = 0;
1085 do {
1086 backup.SetName(name.GetName() +
1087 wxString::Format(wxT("%d"), suffix));
1088 ++suffix;
1089 }
1090 while (backup.FileExists());
1091 ::wxRenameFile(inName.GetFullPath(), backup.GetFullPath());
1092 }
1093 else {
1094 name = inName;
1095 int i = 2;
1096 wxString base(name.GetName());
1097 while (name.FileExists()) {
1098 name.SetName(wxString::Format(wxT("%s-%d"), base, i++));
1099 }
1100 }
1101
1103 const wxString fullPath{name.GetFullPath()};
1104
1105 auto cleanup = finally( [&] {
1106 bool ok =
1107 success == ProgressResult::Stopped ||
1108 success == ProgressResult::Success;
1109 if (backup.IsOk()) {
1110 if ( ok )
1111 // Remove backup
1112 ::wxRemoveFile(backup.GetFullPath());
1113 else {
1114 // Restore original
1115 ::wxRemoveFile(fullPath);
1116 ::wxRenameFile(backup.GetFullPath(), fullPath);
1117 }
1118 }
1119 else {
1120 if ( ! ok )
1121 // Remove any new, and only partially written, file.
1122 ::wxRemoveFile(fullPath);
1123 }
1124 } );
1125
1126 // Call the format export routine
1127 success = mPlugins[mPluginIndex]->Export(mProject,
1128 pDialog,
1129 channels,
1130 fullPath,
1131 selectedOnly,
1132 t0,
1133 t1,
1134 NULL,
1135 &tags,
1137
1138 if (success == ProgressResult::Success || success == ProgressResult::Stopped) {
1139 mExported.push_back(fullPath);
1140 }
1141
1142 Refresh();
1143 Update();
1144
1145 return success;
1146}
const TranslatableString name
Definition: Distortion.cpp:82
std::vector< ExportPlugin * > mPlugins
wxCheckBox * mOverwrite
AudacityProject * mProject
ProgressResult
Definition: BasicUI.h:145

References RefreshCode::Cancelled, mOverwrite, name, and BasicUI::Success.

Referenced by ExportMultipleByLabel(), and ExportMultipleByTrack().

Here is the caller graph for this function:

◆ EnableControls()

void ExportMultipleDialog::EnableControls ( )
private

Definition at line 444 of file ExportMultiple.cpp.

445{
446 bool enable;
447
448 if (!mInitialized) {
449 return;
450 }
451
452 mFirst->Enable(mLabel->GetValue());
453
454 enable = mLabel->GetValue() &&
455 (mByName->GetValue() || mByNumberAndName->GetValue()) &&
456 mFirst->GetValue();
457 mFirstFileLabel->Enable(enable);
458 mFirstFileName->Enable(enable);
459
460 enable = mByNumber->GetValue();
461 mPrefixLabel->Enable(enable);
462 mPrefix->Enable(enable);
463
464 bool ok = true;
465
466 if (mLabel->GetValue() && mFirst->GetValue() &&
467 mFirstFileName->GetValue().empty() &&
468 mPrefix->GetValue().empty())
469 ok = false;
470
471 if (mByNumber->GetValue() &&
472 mPrefix->GetValue().empty())
473 ok = false;
474
475 mExport->Enable(ok);
476}
wxTextCtrl * mFirstFileName
wxRadioButton * mByName
wxRadioButton * mLabel
wxStaticText * mFirstFileLabel
wxRadioButton * mByNumberAndName
wxStaticText * mPrefixLabel
wxRadioButton * mByNumber

References mByName, mByNumber, mByNumberAndName, mExport, mFirst, mFirstFileLabel, mFirstFileName, mInitialized, mLabel, mPrefix, and mPrefixLabel.

Referenced by OnByName(), OnByNumber(), OnFirst(), OnFirstFileName(), OnFormat(), OnLabel(), OnPrefix(), OnTrack(), and ShowModal().

Here is the caller graph for this function:

◆ ExportMultipleByLabel()

ProgressResult ExportMultipleDialog::ExportMultipleByLabel ( bool  byName,
const wxString &  prefix,
bool  addNumber 
)
private

Export multiple labeled regions of the project to separate files.

Uses a single label track in the project to split up the audio into a series of sections, each of which is exported to a separate file.

Parameters
byNameControls whether files are named after the text in the labels that define them (true), or just numbered (false).
prefixThe string used to prefix the file number if files are being numbered rather than named

Definition at line 752 of file ExportMultiple.cpp.

754{
755 wxASSERT(mProject);
756 int numFiles = mNumLabels;
757 int l = 0; // counter for files done
758 std::vector<ExportKit> exportSettings; // dynamic array for settings.
759 exportSettings.reserve(numFiles); // Allocate some guessed space to use.
760
761 // Account for exporting before first label
762 if( mFirst->GetValue() ) {
763 l--;
764 numFiles++;
765 }
766
767 // Figure out how many channels we should export.
768 auto channels = GetNumExportChannels( *mTracks );
769
770 FilePaths otherNames; // keep track of file names we will use, so we
771 // don't duplicate them
772 ExportKit setting; // the current batch of settings
773 setting.destfile.SetPath(mDir->GetValue());
774 setting.destfile.SetExt(mPlugins[mPluginIndex]->GetExtension(mSubFormatIndex));
775 wxLogDebug(wxT("Plug-in index = %d, Sub-format = %d"), mPluginIndex, mSubFormatIndex);
776 wxLogDebug(wxT("File extension is %s"), setting.destfile.GetExt());
777 wxString name; // used to hold file name whilst we mess with it
778 wxString title; // un-messed-with title of file for tagging with
779
780 const LabelStruct *info = NULL;
781 /* Examine all labels a first time, sort out all data but don't do any
782 * exporting yet (so this run is quick but interactive) */
783 while( l < mNumLabels ) {
784
785 // Get file name and starting time
786 if( l < 0 ) {
787 // create wxFileName for output file
788 name = (mFirstFileName->GetValue());
789 setting.t0 = 0.0;
790 } else {
791 info = mLabels->GetLabel(l);
792 name = (info->title);
793 setting.t0 = info->selectedRegion.t0();
794 }
795
796 // Figure out the ending time
797 if( info && !info->selectedRegion.isPoint() ) {
798 setting.t1 = info->selectedRegion.t1();
799 } else if( l < mNumLabels-1 ) {
800 // Use start of next label as end
801 const LabelStruct *info1 = mLabels->GetLabel(l+1);
802 setting.t1 = info1->selectedRegion.t0();
803 } else {
804 setting.t1 = mTracks->GetEndTime();
805 }
806
807 if( name.empty() )
808 name = _("untitled");
809
810 // store title of label to use in tags
811 title = name;
812
813 // Numbering files...
814 if( !byName ) {
815 name.Printf(wxT("%s-%02d"), prefix, l+1);
816 } else if( addNumber ) {
817 // Following discussion with GA, always have 2 digits
818 // for easy file-name sorting (on Windows)
819 name.Prepend(wxString::Format(wxT("%02d-"), l+1));
820 }
821
822 // store sanitised and user checked name in object
823 setting.destfile.SetName(MakeFileName(name));
824 if( setting.destfile.GetName().empty() )
825 { // user cancelled dialogue, or deleted everything in field.
826 // or maybe the label was empty??
827 // So we ignore this one and keep going.
828 }
829 else
830 {
831 // FIXME: TRAP_ERR User could have given an illegal filename prefix.
832 // in that case we should tell them, not fail silently.
833 wxASSERT(setting.destfile.IsOk()); // burp if file name is broke
834
835 // Make sure the (final) file name is unique within the set of exports
836 FileNames::MakeNameUnique(otherNames, setting.destfile);
837
838 /* do the metadata for this file */
839 // copy project metadata to start with
840 setting.filetags = Tags::Get( *mProject );
841 setting.filetags.LoadDefaults();
842 if (exportSettings.size()) {
843 setting.filetags = exportSettings.back().filetags;
844 }
845 // over-ride with values
846 setting.filetags.SetTag(TAG_TITLE, title);
847 setting.filetags.SetTag(TAG_TRACK, l+1);
848 // let the user have a crack at editing it, exit if cancelled
850 bool bShowTagsDialog = settings.GetShowId3Dialog();
851
852 bShowTagsDialog = bShowTagsDialog && mPlugins[mPluginIndex]->GetCanMetaData(mSubFormatIndex);
853
854 if( bShowTagsDialog ){
855 bool bCancelled = !TagsEditorDialog::ShowEditDialog(setting.filetags,
857 XO("Edit Metadata Tags"), bShowTagsDialog);
858 gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &bShowTagsDialog, true);
859 settings.SetShowId3Dialog( bShowTagsDialog );
860 if( bCancelled )
862 }
863 }
864
865 /* add the settings to the array of settings to be used for export */
866 exportSettings.push_back(setting);
867
868 l++; // next label, count up one
869 }
870
871 auto ok = ProgressResult::Success; // did it work?
872 int count = 0; // count the number of successful runs
873 ExportKit activeSetting; // pointer to the settings in use for this export
874 /* Go round again and do the exporting (so this run is slow but
875 * non-interactive) */
876 std::unique_ptr<ProgressDialog> pDialog;
877 for (count = 0; count < numFiles; count++) {
878 /* get the settings to use for the export from the array */
879 activeSetting = exportSettings[count];
880 // Bug 1440 fix.
881 if( activeSetting.destfile.GetName().empty() )
882 continue;
883
884 // Export it
885 ok = DoExport(pDialog, channels, activeSetting.destfile, false,
886 activeSetting.t0, activeSetting.t1, activeSetting.filetags);
887 if (ok == ProgressResult::Stopped) {
888 AudacityMessageDialog dlgMessage(
889 nullptr,
890 XO("Continue to export remaining files?"),
891 XO("Export"),
892 wxYES_NO | wxNO_DEFAULT | wxICON_WARNING);
893 if (dlgMessage.ShowModal() != wxID_YES ) {
894 // User decided not to continue - bail out!
895 break;
896 }
897 }
898 else if (ok != ProgressResult::Success) {
899 break;
900 }
901 }
902
903 return ok;
904}
static unsigned GetNumExportChannels(const TrackList &tracks)
#define _(s)
Definition: Internat.h:75
static const auto title
FileConfig * gPrefs
Definition: Prefs.cpp:71
#define TAG_TRACK
Definition: Tags.h:61
#define TAG_TITLE
Definition: Tags.h:58
static Settings & settings()
Definition: TrackInfo.cpp:87
Wrap wxMessageDialog so that caption IS translatable.
wxString MakeFileName(const wxString &input)
Takes an arbitrary text string and converts it to a form that can be used as a file name,...
ProgressResult DoExport(std::unique_ptr< ProgressDialog > &pDialog, unsigned channels, const wxFileName &name, bool selectedOnly, double t0, double t1, const Tags &tags)
A LabelStruct holds information for ONE label in a LabelTrack.
Definition: LabelTrack.h:31
wxString title
Definition: LabelTrack.h:72
SelectedRegion selectedRegion
Definition: LabelTrack.h:71
const LabelStruct * GetLabel(int index) const
Definition: LabelTrack.cpp:945
static ProjectSettings & Get(AudacityProject &project)
static ProjectWindow * Find(AudacityProject *pProject)
double t1() const
bool isPoint() const
double t0() const
static AUDACITY_DLL_API bool ShowEditDialog(Tags &tags, wxWindow *parent, const TranslatableString &title, bool force=false)
Definition: TagsEditor.cpp:23
static Tags & Get(AudacityProject &project)
Definition: Tags.cpp:214
double GetEndTime() const
Definition: Track.cpp:1030
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
FILES_API void MakeNameUnique(FilePaths &otherNames, wxFileName &newName)

References _, RefreshCode::Cancelled, DoExport(), TranslatableString::empty(), ProjectWindow::Find(), ProjectSettings::Get(), Tags::Get(), TrackList::GetEndTime(), LabelTrack::GetLabel(), GetNumExportChannels(), gPrefs, SelectedRegion::isPoint(), MakeFileName(), FileNames::MakeNameUnique(), mDir, mFirst, mFirstFileName, mLabels, mNumLabels, mPluginIndex, mPlugins, mProject, mSubFormatIndex, mTracks, name, LabelStruct::selectedRegion, settings(), TagsEditorDialog::ShowEditDialog(), BasicUI::Success, SelectedRegion::t0(), SelectedRegion::t1(), TAG_TITLE, TAG_TRACK, LabelStruct::title, title, and XO.

Referenced by OnExport().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ExportMultipleByTrack()

ProgressResult ExportMultipleDialog::ExportMultipleByTrack ( bool  byName,
const wxString &  prefix,
bool  addNumber 
)
private

Export each track in the project to a separate file.

Parameters
byNameControls whether files are named after the track names (true), or just numbered (false).
prefixThe string used to prefix the file number if files are being numbered rather than named

Definition at line 906 of file ExportMultiple.cpp.

908{
909 wxASSERT(mProject);
910 int l = 0; // track counter
911 auto ok = ProgressResult::Success;
912 FilePaths otherNames;
913 std::vector<ExportKit> exportSettings; // dynamic array we will use to store the
914 // settings needed to do the exports with in
915 exportSettings.reserve(mNumWaveTracks); // Allocate some guessed space to use.
916 ExportKit setting; // the current batch of settings
917 setting.destfile.SetPath(mDir->GetValue());
918 setting.destfile.SetExt(mPlugins[mPluginIndex]->GetExtension(mSubFormatIndex));
919
920 wxString name; // used to hold file name whilst we mess with it
921 wxString title; // un-messed-with title of file for tagging with
922
923 /* Remember which tracks were selected, and set them to deselected */
925 for (auto tr : mTracks->Selected<WaveTrack>())
926 tr->SetSelected(false);
927
928 bool anySolo = !(( mTracks->Any<const WaveTrack>() + &WaveTrack::GetSolo ).empty());
929
930 bool skipSilenceAtBeginning;
931 gPrefs->Read(wxT("/AudioFiles/SkipSilenceAtBeginning"), &skipSilenceAtBeginning, false);
932
933 /* Examine all tracks in turn, collecting export information */
934 for (auto tr : mTracks->Leaders<WaveTrack>() -
936
937 // Get the times for the track
938 auto channels = TrackList::Channels(tr);
939 setting.t0 = skipSilenceAtBeginning ? channels.min(&Track::GetStartTime) : 0;
940 setting.t1 = channels.max( &Track::GetEndTime );
941
942 // number of export channels?
943 setting.channels = channels.size();
944 if (setting.channels == 1 &&
945 !(tr->GetChannel() == WaveTrack::MonoChannel &&
946 tr->GetPan() == 0.0))
947 setting.channels = 2;
948
949 // Get name and title
950 title = tr->GetName();
951 if( title.empty() )
952 title = _("untitled");
953
954 if (byName) {
955 name = title;
956 if (addNumber) {
957 name.Prepend(
958 wxString::Format(wxT("%02d-"), l+1));
959 }
960 }
961 else {
962 name = (wxString::Format(wxT("%s-%02d"), prefix, l+1));
963 }
964
965 // store sanitised and user checked name in object
966 setting.destfile.SetName(MakeFileName(name));
967
968 if (setting.destfile.GetName().empty())
969 { // user cancelled dialogue, or deleted everything in field.
970 // So we ignore this one and keep going.
971 }
972 else
973 {
974
975 // FIXME: TRAP_ERR User could have given an illegal track name.
976 // in that case we should tell them, not fail silently.
977 wxASSERT(setting.destfile.IsOk()); // burp if file name is broke
978
979 // Make sure the (final) file name is unique within the set of exports
980 FileNames::MakeNameUnique(otherNames, setting.destfile);
981
982 /* do the metadata for this file */
983 // copy project metadata to start with
984 setting.filetags = Tags::Get( *mProject );
985 setting.filetags.LoadDefaults();
986 if (exportSettings.size()) {
987 setting.filetags = exportSettings.back().filetags;
988 }
989 // over-ride with values
990 setting.filetags.SetTag(TAG_TITLE, title);
991 setting.filetags.SetTag(TAG_TRACK, l+1);
992 // let the user have a crack at editing it, exit if cancelled
994 bool bShowTagsDialog = settings.GetShowId3Dialog();
995
996 bShowTagsDialog = bShowTagsDialog && mPlugins[mPluginIndex]->GetCanMetaData(mSubFormatIndex);
997
998 if( bShowTagsDialog ){
999 bool bCancelled = !TagsEditorDialog::ShowEditDialog(setting.filetags,
1001 XO("Edit Metadata Tags"), bShowTagsDialog);
1002 gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &bShowTagsDialog, true);
1003 settings.SetShowId3Dialog( bShowTagsDialog );
1004 if( bCancelled )
1006 }
1007 }
1008 /* add the settings to the array of settings to be used for export */
1009 exportSettings.push_back(setting);
1010
1011 l++; // next track, count up one
1012 }
1013 // end of user-interactive data gathering loop, start of export processing
1014 // loop
1015 int count = 0; // count the number of successful runs
1016 ExportKit activeSetting; // pointer to the settings in use for this export
1017 std::unique_ptr<ProgressDialog> pDialog;
1018
1019 for (auto tr : mTracks->Leaders<WaveTrack>() -
1020 (anySolo ? &WaveTrack::GetNotSolo : &WaveTrack::GetMute)) {
1021
1022 wxLogDebug( "Get setting %i", count );
1023 /* get the settings to use for the export from the array */
1024 activeSetting = exportSettings[count];
1025 if( activeSetting.destfile.GetName().empty() ){
1026 count++;
1027 continue;
1028 }
1029
1030 /* Select the track */
1032 const auto range = TrackList::Channels(tr);
1033 for (auto channel : range)
1034 channel->SetSelected(true);
1035
1036 // Export the data. "channels" are per track.
1037 ok = DoExport(pDialog,
1038 activeSetting.channels, activeSetting.destfile, true,
1039 activeSetting.t0, activeSetting.t1, activeSetting.filetags);
1040 if (ok == ProgressResult::Stopped) {
1041 AudacityMessageDialog dlgMessage(
1042 nullptr,
1043 XO("Continue to export remaining files?"),
1044 XO("Export"),
1045 wxYES_NO | wxNO_DEFAULT | wxICON_WARNING);
1046 if (dlgMessage.ShowModal() != wxID_YES ) {
1047 // User decided not to continue - bail out!
1048 break;
1049 }
1050 }
1051 else if (ok != ProgressResult::Success) {
1052 break;
1053 }
1054 // increment export counter
1055 count++;
1056
1057 }
1058
1059 return ok ;
1060}
SelectionState & mSelectionState
@ MonoChannel
Definition: Track.h:277
virtual double GetStartTime() const =0
virtual double GetEndTime() const =0
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1446
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1533

References _, TrackList::Any(), RefreshCode::Cancelled, TrackList::Channels(), DoExport(), ProjectWindow::Find(), ProjectSettings::Get(), Tags::Get(), Track::GetEndTime(), PlayableTrack::GetMute(), PlayableTrack::GetNotSolo(), PlayableTrack::GetSolo(), Track::GetStartTime(), gPrefs, TrackList::Leaders(), MakeFileName(), FileNames::MakeNameUnique(), mDir, mNumWaveTracks, Track::MonoChannel, mPluginIndex, mPlugins, mProject, mSelectionState, mSubFormatIndex, mTracks, name, TrackList::Selected(), settings(), TagsEditorDialog::ShowEditDialog(), BasicUI::Success, TAG_TITLE, TAG_TRACK, title, and XO.

Referenced by OnExport().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MakeFileName()

wxString ExportMultipleDialog::MakeFileName ( const wxString &  input)
private

Takes an arbitrary text string and converts it to a form that can be used as a file name, if necessary prompting the user to edit the file name produced.

Definition at line 1148 of file ExportMultiple.cpp.

1149{
1150 wxString newname = input; // name we are generating
1151
1152 // strip out anything that isn't allowed in file names on this platform
1153 auto changed = Internat::SanitiseFilename(newname, wxT("_"));
1154
1155 if(changed)
1156 { // need to get user to fix file name
1157 // build the dialog
1159 wxString excluded = ::wxJoin( Internat::GetExcludedCharacters(), wxT(' '), wxT('\0') );
1160 // TODO: For Russian language we should have separate cases for 2 and more than 2 letters.
1161 if( excluded.length() > 1 ){
1162 msg = XO(
1163// i18n-hint: The second %s gives some letters that can't be used.
1164"Label or track \"%s\" is not a legal file name.\nYou cannot use any of these characters:\n\n%s\n\nSuggested replacement:")
1165 .Format( input, excluded );
1166 } else {
1167 msg = XO(
1168// i18n-hint: The second %s gives a letter that can't be used.
1169"Label or track \"%s\" is not a legal file name. You cannot use \"%s\".\n\nSuggested replacement:")
1170 .Format( input, excluded );
1171 }
1172
1173 AudacityTextEntryDialog dlg( this, msg, XO("Save As..."), newname );
1174
1175
1176 // And tell the validator about excluded chars
1177 dlg.SetTextValidator( wxFILTER_EXCLUDE_CHAR_LIST );
1178 wxTextValidator *tv = dlg.GetTextValidator();
1179 tv->SetExcludes(Internat::GetExcludedCharacters());
1180
1181 // Show the dialog and bail if the user cancels
1182 if( dlg.ShowModal() == wxID_CANCEL )
1183 {
1184 return wxEmptyString;
1185 }
1186 // Extract the name from the dialog
1187 newname = dlg.GetValue();
1188 } // phew - end of file name sanitisation procedure
1189 return newname;
1190}
Wrap wxTextEntryDialog so that caption IS translatable.
static bool SanitiseFilename(wxString &name, const wxString &sub)
Check a proposed file name string for illegal characters and remove them return true iff name is "vis...
Definition: Internat.cpp:240
static const wxArrayString & GetExcludedCharacters()
Definition: Internat.h:149
Holds a msgid for the translation catalog; may also bind format arguments.

References Internat::GetExcludedCharacters(), Internat::SanitiseFilename(), and XO.

Referenced by ExportMultipleByLabel(), and ExportMultipleByTrack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnByName()

void ExportMultipleDialog::OnByName ( wxCommandEvent &  event)
private

Definition at line 559 of file ExportMultiple.cpp.

560{
562}

References EnableControls().

Here is the call graph for this function:

◆ OnByNumber()

void ExportMultipleDialog::OnByNumber ( wxCommandEvent &  event)
private

Definition at line 564 of file ExportMultiple.cpp.

565{
567}

References EnableControls().

Here is the call graph for this function:

◆ OnCancel()

void ExportMultipleDialog::OnCancel ( wxCommandEvent &  event)
private

Definition at line 574 of file ExportMultiple.cpp.

575{
576 EndModal(0);
577}

◆ OnChoose()

void ExportMultipleDialog::OnChoose ( wxCommandEvent &  event)
private

Definition at line 529 of file ExportMultiple.cpp.

530{
531 wxDirDialogWrapper dlog(this,
532 XO("Choose a location to save the exported files"),
533 mDir->GetValue());
534 dlog.ShowModal();
535 if (!dlog.GetPath().empty())
536 mDir->SetValue(dlog.GetPath());
537}

References mDir, and XO.

◆ OnCreate()

void ExportMultipleDialog::OnCreate ( wxCommandEvent &  event)
private

Definition at line 509 of file ExportMultiple.cpp.

510{
511 wxFileName fn;
512
513 fn.AssignDir(mDir->GetValue());
514
515 bool ok = fn.Mkdir(0777, wxPATH_MKDIR_FULL);
516
517 if (!ok) {
518 // Mkdir will produce an error dialog
519 return;
520 }
521
523 XO("\"%s\" successfully created.").Format( fn.GetPath() ),
524 XO("Export Multiple"),
525 wxOK | wxCENTRE,
526 this);
527}
Abstract base class used in importing a file.

References AudacityMessageBox(), fn, mDir, and XO.

Here is the call graph for this function:

◆ OnExport()

void ExportMultipleDialog::OnExport ( wxCommandEvent &  event)
private

Definition at line 584 of file ExportMultiple.cpp.

585{
588
589 gPrefs->Flush();
590
591 FileNames::UpdateDefaultPath(FileNames::Operation::Export, mDir->GetValue());
592
593 // Make sure the output directory is in good shape
594 if (!DirOk()) {
595 return;
596 }
597
598 mFilterIndex = mFormat->GetSelection();
599 if (mFilterIndex != wxNOT_FOUND)
600 {
601 size_t c = 0;
602 int i = -1;
603 for (const auto &pPlugin : mPlugins)
604 {
605 ++i;
606 for (int j = 0; j < pPlugin->GetFormatCount(); j++, c++)
607 {
608 if ((size_t)mFilterIndex == c)
609 { // this is the selected format. Store the plug-in and sub-format
610 // needed to achieve it.
611 mPluginIndex = i;
612 mSubFormatIndex = j;
613 mBook->GetPage(mFilterIndex)->TransferDataFromWindow();
614 }
615 }
616 }
617 }
618
619// bool overwrite = mOverwrite->GetValue();
620 ProgressResult ok = ProgressResult::Failed;
621 mExported.clear();
622
623 // Give 'em the result
624 auto cleanup = finally( [&]
625 {
626 auto msg = (ok == ProgressResult::Success
627 ? XO("Successfully exported the following %lld file(s).")
628 : ok == ProgressResult::Failed
629 ? XO("Something went wrong after exporting the following %lld file(s).")
631 ? XO("Export canceled after exporting the following %lld file(s).")
632 : ok == ProgressResult::Stopped
633 ? XO("Export stopped after exporting the following %lld file(s).")
634 : XO("Something went really wrong after exporting the following %lld file(s).")
635 ).Format((long long) mExported.size());
636
637 wxString FileList;
638 for (size_t i = 0; i < mExported.size(); i++) {
639 FileList += mExported[i];
640 FileList += '\n';
641 }
642
643 // TODO: give some warning dialog first, when only some files exported
644 // successfully.
645
646 GuardedCall( [&] {
647 // This results dialog is a child of this dialog.
649 XO("Export Multiple"),
650 msg,
651 FileList,
652 450,400);
653 } );
654 } );
655
656 if (mLabel->GetValue()) {
657 ok = ExportMultipleByLabel(mByName->GetValue() || mByNumberAndName->GetValue(),
658 mPrefix->GetValue(),
659 mByNumberAndName->GetValue());
660 }
661 else {
662 ok = ExportMultipleByTrack(mByName->GetValue() || mByNumberAndName->GetValue(),
663 mPrefix->GetValue(),
664 mByNumberAndName->GetValue());
665 }
666
667 if (ok == ProgressResult::Success || ok == ProgressResult::Stopped) {
668 EndModal(1);
669 }
670}
R GuardedCall(const F1 &body, const F2 &handler=F2::Default(), F3 delayedHandler=DefaultDelayedHandlerAction) noexcept(noexcept(handler(std::declval< AudacityException * >())) &&noexcept(handler(nullptr)) &&noexcept(std::function< void(AudacityException *)>{std::move(delayedHandler)}))
Execute some code on any thread; catch any AudacityException; enqueue error report on the main thread...
@ eIsSavingToPrefs
Definition: ShuttleGui.h:49
#define S(N)
Definition: ToChars.cpp:64
ProgressResult ExportMultipleByTrack(bool byName, const wxString &prefix, bool addNumber)
Export each track in the project to a separate file.
wxSimplebook * mBook
ProgressResult ExportMultipleByLabel(bool byName, const wxString &prefix, bool addNumber)
Export multiple labeled regions of the project to separate files.
void PopulateOrExchange(ShuttleGui &S)
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
static void ShowInfoDialog(wxWindow *parent, const TranslatableString &dlogTitle, const TranslatableString &shortMsg, const wxString &message, const int xSize, const int ySize)
Displays cuttable information in a text ctrl, with an OK button.
Definition: HelpSystem.cpp:90
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628
FILES_API void UpdateDefaultPath(Operation op, const FilePath &path)

References RefreshCode::Cancelled, DirOk(), eIsSavingToPrefs, ExportMultipleByLabel(), ExportMultipleByTrack(), FileConfig::Flush(), gPrefs, GuardedCall(), mBook, mByName, mByNumberAndName, mDir, mExported, mFilterIndex, mFormat, mLabel, mPluginIndex, mPlugins, mPrefix, mSubFormatIndex, PopulateOrExchange(), S, HelpSystem::ShowInfoDialog(), BasicUI::Success, FileNames::UpdateDefaultPath(), and XO.

Here is the call graph for this function:

◆ OnFirst()

void ExportMultipleDialog::OnFirst ( wxCommandEvent &  event)
private

Definition at line 544 of file ExportMultiple.cpp.

545{
547}

References EnableControls().

Here is the call graph for this function:

◆ OnFirstFileName()

void ExportMultipleDialog::OnFirstFileName ( wxCommandEvent &  event)
private

Definition at line 549 of file ExportMultiple.cpp.

550{
552}

References EnableControls().

Here is the call graph for this function:

◆ OnFormat()

void ExportMultipleDialog::OnFormat ( wxCommandEvent &  event)
private

Definition at line 478 of file ExportMultiple.cpp.

479{
480 mBook->ChangeSelection(mFormat->GetSelection());
481
483}

References EnableControls(), mBook, and mFormat.

Here is the call graph for this function:

◆ OnHelp()

void ExportMultipleDialog::OnHelp ( wxCommandEvent &  event)
private

Definition at line 579 of file ExportMultiple.cpp.

580{
581 HelpSystem::ShowHelp(this, L"Export_Multiple", true);
582}
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:237

References HelpSystem::ShowHelp().

Here is the call graph for this function:

◆ OnLabel()

void ExportMultipleDialog::OnLabel ( wxCommandEvent &  event)
private

Definition at line 539 of file ExportMultiple.cpp.

540{
542}

References EnableControls().

Here is the call graph for this function:

◆ OnOptions()

void ExportMultipleDialog::OnOptions ( wxCommandEvent &  event)
private

Definition at line 485 of file ExportMultiple.cpp.

486{
487 const int sel = mFormat->GetSelection();
488 if (sel != wxNOT_FOUND)
489 {
490 size_t c = 0;
491 int i = -1;
492 for (const auto &pPlugin : mPlugins)
493 {
494 ++i;
495 for (int j = 0; j < pPlugin->GetFormatCount(); j++)
496 {
497 if ((size_t)sel == c)
498 {
499 mPluginIndex = i;
500 mSubFormatIndex = j;
501 }
502 c++;
503 }
504 }
505 }
506 mPlugins[mPluginIndex]->DisplayOptions(this,mSubFormatIndex);
507}

References mFormat, mPluginIndex, mPlugins, and mSubFormatIndex.

◆ OnPrefix()

void ExportMultipleDialog::OnPrefix ( wxCommandEvent &  event)
private

Definition at line 569 of file ExportMultiple.cpp.

570{
572}

References EnableControls().

Here is the call graph for this function:

◆ OnTrack()

void ExportMultipleDialog::OnTrack ( wxCommandEvent &  event)
private

Definition at line 554 of file ExportMultiple.cpp.

555{
557}

References EnableControls().

Here is the call graph for this function:

◆ PopulateOrExchange()

void ExportMultipleDialog::PopulateOrExchange ( ShuttleGui S)
private

Definition at line 225 of file ExportMultiple.cpp.

226{
227 ChoiceSetting NumberingSetting{
228 wxT("/Export/TrackNameWithOrWithoutNumbers"),
229 {
230 { wxT("labelTrack"), XXO("Using Label/Track Name") },
231 { wxT("numberBefore"), XXO("Numbering before Label/Track Name") },
232 { wxT("numberAfter"), XXO("Numbering after File name prefix") },
233 },
234 0 // labelTrack
235 };
236
237 wxString name = mProject->GetProjectName();
238 wxString defaultFormat = gPrefs->Read(wxT("/Export/Format"), wxT("WAV"));
239
240 TranslatableStrings visibleFormats;
241 wxArrayStringEx formats;
242 mPluginIndex = -1;
243 mFilterIndex = 0;
244
245 {
246 int i = -1;
247 for (const auto &pPlugin : mPlugins)
248 {
249 ++i;
250 for (int j = 0; j < pPlugin->GetFormatCount(); j++)
251 {
252 auto format = mPlugins[i]->GetDescription(j);
253 visibleFormats.push_back( format );
254 // use MSGID of description as a value too, written into config file
255 // This is questionable. A change in the msgid can make the
256 // preference stored in old config files inapplicable
257 formats.push_back( format.MSGID().GET() );
258 if (mPlugins[i]->GetFormat(j) == defaultFormat) {
259 mPluginIndex = i;
260 mSubFormatIndex = j;
261 }
262 if (mPluginIndex == -1) mFilterIndex++;
263 }
264 }
265 }
266
267 ChoiceSetting FormatSetting{ wxT("/Export/MultipleFormat"),
268 {
269 ByColumns,
270 visibleFormats,
271 formats
272 },
274 };
275
276 // Bug 1304: Set the default file path. It's used if none stored in config.
277 auto DefaultPath = FileNames::FindDefaultPath(FileNames::Operation::Export);
278
279 if (mPluginIndex == -1)
280 {
281 mPluginIndex = 0;
282 mFilterIndex = 0;
283 mSubFormatIndex = 0;
284 }
285
286 S.SetBorder(5);
287 S.StartHorizontalLay(wxEXPAND, true);
288 {
289 S.SetBorder(5);
290 S.StartStatic(XO("Export files to:"), true);
291 {
292 S.StartMultiColumn(4, true);
293 {
294 mDir = S.Id(DirID)
295 .AddTextBox(XXO("Folder:"),
296 DefaultPath,
297 64);
298 S.Id(ChooseID).AddButton(XXO("Choose..."));
299 S.Id(CreateID).AddButton(XXO("Create"));
300
301 mFormat = S.Id(FormatID)
302 .TieChoice( XXO("Format:"),
303 FormatSetting
304 );
305 S.AddVariableText( {}, false);
306 S.AddVariableText( {}, false);
307
308 S.AddPrompt(XXO("Options:"));
309
310 mBook = S.Id(OptionsID)
311 .Style(wxBORDER_STATIC)
312 .StartSimplebook();
313 if (S.GetMode() == eIsCreating)
314 {
315 for (const auto &pPlugin : mPlugins)
316 {
317 for (int j = 0; j < pPlugin->GetFormatCount(); j++)
318 {
319 // Name of simple book page is not displayed
320 S.StartNotebookPage( {} );
321 pPlugin->OptionsCreate(S, j);
322 S.EndNotebookPage();
323 }
324 }
325 mBook->ChangeSelection(mFormat->GetSelection());
326 }
327 S.EndSimplebook();
328 S.AddVariableText( {}, false);
329 S.AddVariableText( {}, false);
330 }
331 S.EndMultiColumn();
332 }
333 S.EndStatic();
334 }
335 S.EndHorizontalLay();
336
337 S.StartHorizontalLay(wxEXPAND, false);
338 {
339 S.SetBorder(5);
340 S.StartStatic(XO("Split files based on:"), 1);
341 {
342 // Row 1
343 S.SetBorder(1);
344
345 // Bug 2692: Place button group in panel so tabbing will work and,
346 // on the Mac, VoiceOver will announce as radio buttons.
347 S.StartPanel();
348 {
349 mTrack = S.Id(TrackID)
350 .AddRadioButton(XXO("Tracks"));
351
352 // Row 2
353 S.SetBorder(1);
354 mLabel = S.Id(LabelID)
355 .AddRadioButtonToGroup(XXO("Labels"));
356 }
357 S.EndPanel();
358
359 S.SetBorder(3);
360 S.StartMultiColumn(2, wxEXPAND);
361 S.SetStretchyCol(1);
362 {
363 // Row 3 (indented)
364 S.AddVariableText(Verbatim(" "), false);
365 mFirst = S.Id(FirstID)
366 .AddCheckBox(XXO("Include audio before first label"), false);
367
368 // Row 4
369 S.AddVariableText( {}, false);
370 S.StartMultiColumn(2, wxEXPAND);
371 S.SetStretchyCol(1);
372 {
374 S.AddVariableText(XO("First file name:"), false);
376 .Prop(1)
377 .Name(XO("First file name"))
378 .TieTextBox( {},
379 name,
380 30);
381 }
382 S.EndMultiColumn();
383 }
384 S.EndMultiColumn();
385
386 S.SetBorder(3);
387 }
388 S.EndStatic();
389
390 S.SetBorder(5);
391 S.StartStatic(XO("Name files:"), 1);
392 {
393 S.SetBorder(2);
394
395 // Bug 2692: Place button group in panel so tabbing will work and,
396 // on the Mac, VoiceOver will announce as radio buttons.
397 S.StartPanel();
398 {
399 S.StartRadioButtonGroup(NumberingSetting);
400 {
401 mByName = S.Id(ByNameID).TieRadioButton();
402
403 mByNumberAndName = S.Id(ByNameAndNumberID).TieRadioButton();
404
405 mByNumber = S.Id(ByNumberID).TieRadioButton();
406 }
407 S.EndRadioButtonGroup();
408 }
409 S.EndPanel();
410
411 S.StartMultiColumn(3, wxEXPAND);
412 S.SetStretchyCol(2);
413 {
414 // Row 3 (indented)
415 S.AddVariableText(Verbatim(" "), false);
416 mPrefixLabel = S.AddVariableText(XO("File name prefix:"), false);
417 mPrefix = S.Id(PrefixID)
418 .Name(XO("File name prefix"))
419 .TieTextBox( {},
420 name,
421 30);
422 }
423 S.EndMultiColumn();
424 }
425 S.EndStatic();
426 }
427 S.EndHorizontalLay();
428
429 S.SetBorder(5);
430 S.StartHorizontalLay(wxEXPAND, false);
431 {
432 mOverwrite = S.Id(OverwriteID).TieCheckBox(XXO("Overwrite existing files"),
433 {wxT("/Export/OverwriteExisting"),
434 false});
435 }
436 S.EndHorizontalLay();
437
438 S.AddStandardButtons(eOkButton | eCancelButton | eHelpButton);
439 mExport = (wxButton *)wxWindow::FindWindowById(wxID_OK, this);
440 mExport->SetLabel(_("Export"));
441
442}
@ LabelID
@ CreateID
@ TrackID
@ PrefixID
@ ByNumberID
@ ChooseID
@ OverwriteID
@ DirID
@ FormatID
@ ByNameAndNumberID
@ OptionsID
@ FirstFileNameID
@ ByNameID
@ FirstID
int format
Definition: ExportPCM.cpp:56
#define XXO(s)
Definition: Internat.h:44
ByColumns_t ByColumns
Definition: Prefs.cpp:474
@ eIsCreating
Definition: ShuttleGui.h:39
@ eOkButton
Definition: ShuttleGui.h:597
@ eCancelButton
Definition: ShuttleGui.h:598
@ eHelpButton
Definition: ShuttleGui.h:601
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
std::vector< TranslatableString > TranslatableStrings
const wxString & GetProjectName() const
Definition: Project.cpp:90
wxRadioButton * mTrack
FILES_API FilePath FindDefaultPath(Operation op)

References _, ByColumns, ByNameAndNumberID, ByNameID, ByNumberID, ChooseID, CreateID, DirID, eCancelButton, eHelpButton, eIsCreating, eOkButton, FileNames::FindDefaultPath(), FirstFileNameID, FirstID, format, FormatID, AudacityProject::GetProjectName(), gPrefs, LabelID, mBook, mByName, mByNumber, mByNumberAndName, mDir, mExport, mFilterIndex, mFirst, mFirstFileLabel, mFirstFileName, mFormat, mLabel, mOverwrite, mPluginIndex, mPlugins, mPrefix, mPrefixLabel, mProject, mSubFormatIndex, mTrack, name, OptionsID, OverwriteID, PrefixID, S, TrackID, Verbatim(), XO, and XXO.

Referenced by OnExport().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowModal()

int ExportMultipleDialog::ShowModal ( )

Definition at line 182 of file ExportMultiple.cpp.

183{
184 // Cannot export if all audio tracks are muted.
185 if (mNumWaveTracks == 0)
186 {
188 XO("All audio is muted."),
189 XO("Cannot Export Multiple"),
190 wxOK | wxCENTRE,
191 this);
192 return wxID_CANCEL;
193 }
194
195 if ((mNumWaveTracks < 1) && (mNumLabels < 1))
196 {
198 XO(
199"You have no unmuted Audio Tracks and no applicable \
200\nlabels, so you cannot export to separate audio files."),
201 XO("Cannot Export Multiple"),
202 wxOK | wxCENTRE,
203 this);
204 return wxID_CANCEL;
205 }
206
207 bool bHasLabels = (mNumLabels > 0);
208 bool bHasTracks = (mNumWaveTracks > 0);
209
210 mLabel->Enable(bHasLabels && bHasTracks);
211 mTrack->Enable(bHasTracks);
212
213 // If you have 2 or more tracks, then it is export by tracks.
214 // If you have no labels, then it is export by tracks.
215 // Otherwise it is export by labels, by default.
216 bool bPreferByLabels = bHasLabels && (mNumWaveTracks < 2);
217 mLabel->SetValue(bPreferByLabels);
218 mTrack->SetValue(!bPreferByLabels);
219
221
222 return wxDialogWrapper::ShowModal();
223}

References AudacityMessageBox(), EnableControls(), mLabel, mNumLabels, mNumWaveTracks, mTrack, and XO.

Referenced by FileActions::Handler::OnExportMultiple().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mBook

wxSimplebook* ExportMultipleDialog::mBook
private

Definition at line 162 of file ExportMultiple.h.

Referenced by OnExport(), OnFormat(), and PopulateOrExchange().

◆ mByName

wxRadioButton* ExportMultipleDialog::mByName
private

button to choose naming exported file from label text

Definition at line 151 of file ExportMultiple.h.

Referenced by EnableControls(), OnExport(), and PopulateOrExchange().

◆ mByNumber

wxRadioButton* ExportMultipleDialog::mByNumber
private

button to choose numbering exported files

Definition at line 152 of file ExportMultiple.h.

Referenced by EnableControls(), and PopulateOrExchange().

◆ mByNumberAndName

wxRadioButton* ExportMultipleDialog::mByNumberAndName
private

button to choose number AND name for exported files

Definition at line 150 of file ExportMultiple.h.

Referenced by EnableControls(), OnExport(), and PopulateOrExchange().

◆ mCancel

wxButton* ExportMultipleDialog::mCancel
private

Definition at line 159 of file ExportMultiple.h.

◆ mChoose

wxButton* ExportMultipleDialog::mChoose
private

Definition at line 137 of file ExportMultiple.h.

◆ mCreate

wxButton* ExportMultipleDialog::mCreate
private

Definition at line 136 of file ExportMultiple.h.

◆ mDir

wxTextCtrl* ExportMultipleDialog::mDir
private

The directory all the exported files will end up in

Definition at line 134 of file ExportMultiple.h.

Referenced by DirOk(), ExportMultipleByLabel(), ExportMultipleByTrack(), OnChoose(), OnCreate(), OnExport(), and PopulateOrExchange().

◆ mExport

wxButton* ExportMultipleDialog::mExport
private

Definition at line 160 of file ExportMultiple.h.

Referenced by EnableControls(), and PopulateOrExchange().

◆ mExported

FilePaths ExportMultipleDialog::mExported
private

Definition at line 128 of file ExportMultiple.h.

Referenced by OnExport().

◆ mExporter

Exporter ExportMultipleDialog::mExporter
private

Definition at line 107 of file ExportMultiple.h.

◆ mFilterIndex

int ExportMultipleDialog::mFilterIndex
private

The index in the drop-down list of export formats (mFormat) of the selected export format. This list includes all possible plug-in - subformat combinations.

Definition at line 117 of file ExportMultiple.h.

Referenced by OnExport(), and PopulateOrExchange().

◆ mFirst

wxCheckBox* ExportMultipleDialog::mFirst
private

Check box to export audio before first label

Definition at line 142 of file ExportMultiple.h.

Referenced by EnableControls(), ExportMultipleByLabel(), and PopulateOrExchange().

◆ mFirstFileLabel

wxStaticText* ExportMultipleDialog::mFirstFileLabel
private

description text for mFirstFileName

Definition at line 143 of file ExportMultiple.h.

Referenced by EnableControls(), and PopulateOrExchange().

◆ mFirstFileName

wxTextCtrl* ExportMultipleDialog::mFirstFileName
private

Name to use for exporting audio before the first label in the file

Definition at line 144 of file ExportMultiple.h.

Referenced by EnableControls(), ExportMultipleByLabel(), and PopulateOrExchange().

◆ mFormat

wxChoice* ExportMultipleDialog::mFormat
private

Drop-down list of export formats (combinations of plug-in and subformat)

Definition at line 130 of file ExportMultiple.h.

Referenced by OnExport(), OnFormat(), OnOptions(), and PopulateOrExchange().

◆ mInitialized

bool ExportMultipleDialog::mInitialized
private

Definition at line 125 of file ExportMultiple.h.

Referenced by EnableControls().

◆ mLabel

wxRadioButton* ExportMultipleDialog::mLabel
private

button to choose export based on Labels

Definition at line 139 of file ExportMultiple.h.

Referenced by EnableControls(), OnExport(), PopulateOrExchange(), and ShowModal().

◆ mLabelLabel

wxStaticText* ExportMultipleDialog::mLabelLabel
private

description text for mLabel

Definition at line 140 of file ExportMultiple.h.

◆ mLabels

const LabelTrack* ExportMultipleDialog::mLabels
private

Definition at line 113 of file ExportMultiple.h.

Referenced by CountTracksAndLabels(), and ExportMultipleByLabel().

◆ mNumLabels

int ExportMultipleDialog::mNumLabels
private

Definition at line 114 of file ExportMultiple.h.

Referenced by CountTracksAndLabels(), ExportMultipleByLabel(), and ShowModal().

◆ mNumWaveTracks

int ExportMultipleDialog::mNumWaveTracks
private

Definition at line 115 of file ExportMultiple.h.

Referenced by CountTracksAndLabels(), ExportMultipleByTrack(), and ShowModal().

◆ mOptions

wxButton* ExportMultipleDialog::mOptions
private

Definition at line 132 of file ExportMultiple.h.

◆ mOverwrite

wxCheckBox* ExportMultipleDialog::mOverwrite
private

Definition at line 157 of file ExportMultiple.h.

Referenced by DoExport(), and PopulateOrExchange().

◆ mPluginIndex

int ExportMultipleDialog::mPluginIndex
private

The index in mPlugins of the selected export plug-in

Definition at line 121 of file ExportMultiple.h.

Referenced by ExportMultipleByLabel(), ExportMultipleByTrack(), OnExport(), OnOptions(), and PopulateOrExchange().

◆ mPlugins

std::vector<ExportPlugin*> ExportMultipleDialog::mPlugins
private

Array of references to available exporter plug-ins

Definition at line 108 of file ExportMultiple.h.

Referenced by ExportMultipleByLabel(), ExportMultipleByTrack(), OnExport(), OnOptions(), and PopulateOrExchange().

◆ mPrefix

wxTextCtrl* ExportMultipleDialog::mPrefix
private

Definition at line 155 of file ExportMultiple.h.

Referenced by EnableControls(), OnExport(), and PopulateOrExchange().

◆ mPrefixLabel

wxStaticText* ExportMultipleDialog::mPrefixLabel
private

Definition at line 154 of file ExportMultiple.h.

Referenced by EnableControls(), and PopulateOrExchange().

◆ mProject

AudacityProject* ExportMultipleDialog::mProject
private

◆ mSelectionState

SelectionState& ExportMultipleDialog::mSelectionState
private

Definition at line 164 of file ExportMultiple.h.

Referenced by ExportMultipleByTrack().

◆ mSubFormatIndex

int ExportMultipleDialog::mSubFormatIndex
private

The selected subformat number within the selected export plug-in set by mPluginIndex

Definition at line 123 of file ExportMultiple.h.

Referenced by ExportMultipleByLabel(), ExportMultipleByTrack(), OnExport(), OnOptions(), and PopulateOrExchange().

◆ mTrack

wxRadioButton* ExportMultipleDialog::mTrack
private

button to choose export based on tracks

Definition at line 147 of file ExportMultiple.h.

Referenced by PopulateOrExchange(), and ShowModal().

◆ mTrackLabel

wxStaticText* ExportMultipleDialog::mTrackLabel
private

Definition at line 148 of file ExportMultiple.h.

◆ mTracks

TrackList* ExportMultipleDialog::mTracks
private

The list of tracks in the project that is being exported

Definition at line 111 of file ExportMultiple.h.

Referenced by CountTracksAndLabels(), ExportMultipleByLabel(), and ExportMultipleByTrack().


The documentation for this class was generated from the following files: