1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-16 16:20:50 +02:00

Sven Giermann's patch for bug 598

This commit is contained in:
v.audacity 2012-12-17 02:00:32 +00:00
parent 1104956f81
commit 4b99632c73
3 changed files with 37 additions and 49 deletions

View File

@ -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;
}
}
}

View File

@ -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

View File

@ -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