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; return false;
} }
// Check for down mixing
if (!CheckMix()) {
return false;
}
// Let user edit MetaData // Let user edit MetaData
if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) { if (mPlugins[mFormat]->GetCanMetaData(mSubFormat)) {
if (!(project->GetTags()->ShowEditDialog(project, _("Edit Metadata"), mProject->GetShowId3Dialog()))) { 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. // Ensure filename doesn't interfere with project files.
if (!CheckFilename()) { if (!CheckFilename()) {
return false; return false;
@ -776,14 +776,18 @@ bool Exporter::CheckMix()
if (numLeft > 1 || numRight > 1 || mNumLeft + mNumRight + mNumMono > mChannels) { if (numLeft > 1 || numRight > 1 || mNumLeft + mNumRight + mNumMono > mChannels) {
if (mChannels == 2) { if (mChannels == 2) {
ShowWarningDialog(mProject, if (ShowWarningDialog(mProject,
wxT("MixStereo"), wxT("MixStereo"),
_("Your tracks will be mixed down to two stereo channels in the exported file.")); _("Your tracks will be mixed down to two stereo channels in the exported file."),
true) == wxID_CANCEL)
return false;
} }
else { else {
ShowWarningDialog(mProject, if (ShowWarningDialog(mProject,
wxT("MixMono"), wxT("MixMono"),
_("Your tracks will be mixed down to a single mono channel in the exported file.")); _("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: public:
// constructors and destructors // constructors and destructors
WarningDialog(wxWindow *parent, WarningDialog(wxWindow *parent,
wxString message); wxString message,
bool showCancelButton);
private: private:
void OnOK(wxCommandEvent& event); void OnOK(wxCommandEvent& event);
@ -49,10 +50,10 @@ BEGIN_EVENT_TABLE(WarningDialog, wxDialog)
EVT_BUTTON(wxID_OK, WarningDialog::OnOK) EVT_BUTTON(wxID_OK, WarningDialog::OnOK)
END_EVENT_TABLE() END_EVENT_TABLE()
WarningDialog::WarningDialog(wxWindow *parent, wxString message) WarningDialog::WarningDialog(wxWindow *parent, wxString message, bool showCancelButton)
: wxDialog(parent, wxID_ANY, (wxString)_("Warning"), : wxDialog(parent, wxID_ANY, (wxString)_("Warning"),
wxDefaultPosition, wxDefaultSize, 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); ShuttleGui S(this, eIsCreating);
@ -64,7 +65,7 @@ WarningDialog::WarningDialog(wxWindow *parent, wxString message)
} }
S.SetBorder(0); S.SetBorder(0);
S.AddStandardButtons(eOkButton); S.AddStandardButtons(showCancelButton ? eOkButton | eCancelButton : eOkButton);
Fit(); Fit();
CentreOnParent(); CentreOnParent();
@ -72,32 +73,26 @@ WarningDialog::WarningDialog(wxWindow *parent, wxString message)
void WarningDialog::OnOK(wxCommandEvent& event) 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, int ShowWarningDialog(wxWindow *parent,
wxString internalDialogName, wxString internalDialogName,
wxString message) wxString message,
bool showCancelButton)
{ {
wxString key(wxT("/Warnings/") + internalDialogName); wxString key(wxT("/Warnings/") + internalDialogName);
if (!gPrefs->Read(key, (long) true)) { 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(); 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 /// the box, the internalDialogName is noted in the
/// preferences. The internalDialogName is never seen by /// preferences. The internalDialogName is never seen by
/// the user; it should be unique to each message. /// the user; it should be unique to each message.
void ShowWarningDialog(wxWindow *parent, int ShowWarningDialog(wxWindow *parent,
wxString internalDialogName, wxString internalDialogName,
wxString message); wxString message,
bool showCancelButton = false);
#endif // __AUDACITY_WARNING__ #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