diff --git a/src/export/Export.cpp b/src/export/Export.cpp index b1708ae42..4873bfb4f 100644 --- a/src/export/Export.cpp +++ b/src/export/Export.cpp @@ -373,6 +373,11 @@ bool Exporter::Process(AudacityProject *project, bool selectedOnly, double t0, d return false; } + // Check for down mixing + if (!CheckMix()) { + return false; + } + // Let user edit MetaData if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) { if (!(project->GetTags()->ShowEditDialog(project, _("Edit Metadata"), mProject->GetShowId3Dialog()))) { @@ -380,11 +385,6 @@ bool Exporter::Process(AudacityProject *project, bool selectedOnly, double t0, d } } - // Check for down mixing - if (!CheckMix()) { - return false; - } - // Ensure filename doesn't interfere with project files. if (!CheckFilename()) { return false; @@ -776,14 +776,18 @@ bool Exporter::CheckMix() if (numLeft > 1 || numRight > 1 || mNumLeft + mNumRight + mNumMono > mChannels) { if (mChannels == 2) { - ShowWarningDialog(mProject, - wxT("MixStereo"), - _("Your tracks will be mixed down to two stereo channels in the exported file.")); + if (ShowWarningDialog(mProject, + wxT("MixStereo"), + _("Your tracks will be mixed down to two stereo channels in the exported file."), + true) == wxID_CANCEL) + return false; } else { - ShowWarningDialog(mProject, - wxT("MixMono"), - _("Your tracks will be mixed down to a single mono channel in the exported file.")); + if (ShowWarningDialog(mProject, + wxT("MixMono"), + _("Your tracks will be mixed down to a single mono channel in the exported file."), + true) == wxID_CANCEL) + return false; } } } diff --git a/src/widgets/Warning.cpp b/src/widgets/Warning.cpp index 866275db8..4d2134256 100644 --- a/src/widgets/Warning.cpp +++ b/src/widgets/Warning.cpp @@ -35,7 +35,8 @@ class WarningDialog : public wxDialog public: // constructors and destructors WarningDialog(wxWindow *parent, - wxString message); + wxString message, + bool showCancelButton); private: void OnOK(wxCommandEvent& event); @@ -49,10 +50,10 @@ BEGIN_EVENT_TABLE(WarningDialog, wxDialog) EVT_BUTTON(wxID_OK, WarningDialog::OnOK) END_EVENT_TABLE() -WarningDialog::WarningDialog(wxWindow *parent, wxString message) +WarningDialog::WarningDialog(wxWindow *parent, wxString message, bool showCancelButton) : wxDialog(parent, wxID_ANY, (wxString)_("Warning"), wxDefaultPosition, wxDefaultSize, - wxCAPTION | wxSYSTEM_MENU) // Unlike wxDEFAULT_DIALOG_STYLE, no wxCLOSE_BOX. + (showCancelButton ? wxDEFAULT_DIALOG_STYLE : wxCAPTION | wxSYSTEM_MENU)) // Unlike wxDEFAULT_DIALOG_STYLE, no wxCLOSE_BOX. { ShuttleGui S(this, eIsCreating); @@ -64,7 +65,7 @@ WarningDialog::WarningDialog(wxWindow *parent, wxString message) } S.SetBorder(0); - S.AddStandardButtons(eOkButton); + S.AddStandardButtons(showCancelButton ? eOkButton | eCancelButton : eOkButton); Fit(); CentreOnParent(); @@ -72,32 +73,26 @@ WarningDialog::WarningDialog(wxWindow *parent, wxString message) void WarningDialog::OnOK(wxCommandEvent& event) { - EndModal(mCheckBox->GetValue() == false); + EndModal(mCheckBox->GetValue() ? wxID_NO : wxID_YES); // return YES, if message should be shown again } -void ShowWarningDialog(wxWindow *parent, - wxString internalDialogName, - wxString message) +int ShowWarningDialog(wxWindow *parent, + wxString internalDialogName, + wxString message, + bool showCancelButton) { wxString key(wxT("/Warnings/") + internalDialogName); if (!gPrefs->Read(key, (long) true)) { - return; + return wxID_OK; } - WarningDialog dlog(parent, message); + WarningDialog dlog(parent, message, showCancelButton); - gPrefs->Write(key, dlog.ShowModal()); + int retCode = dlog.ShowModal(); + if (retCode == wxID_CANCEL) + return retCode; + + gPrefs->Write(key, (retCode == wxID_YES)); gPrefs->Flush(); + return wxID_OK; } - -// Indentation settings for Vim and Emacs and unique identifier for Arch, a -// version control system. Please do not modify past this point. -// -// Local Variables: -// c-basic-offset: 3 -// indent-tabs-mode: nil -// End: -// -// vim: et sts=3 sw=3 -// arch-tag: b84d77e0-4375-43f0-868e-3130e18c14c8 - diff --git a/src/widgets/Warning.h b/src/widgets/Warning.h index d44d7f297..1f87cf9ed 100644 --- a/src/widgets/Warning.h +++ b/src/widgets/Warning.h @@ -20,20 +20,9 @@ /// the box, the internalDialogName is noted in the /// preferences. The internalDialogName is never seen by /// the user; it should be unique to each message. -void ShowWarningDialog(wxWindow *parent, - wxString internalDialogName, - wxString message); +int ShowWarningDialog(wxWindow *parent, + wxString internalDialogName, + wxString message, + bool showCancelButton = false); #endif // __AUDACITY_WARNING__ - -// Indentation settings for Vim and Emacs and unique identifier for Arch, a -// version control system. Please do not modify past this point. -// -// Local Variables: -// c-basic-offset: 3 -// indent-tabs-mode: nil -// End: -// -// vim: et sts=3 sw=3 -// arch-tag: 2b69f33b-2dc8-4b9f-99a1-65d57f554133 -