From bf2bc01b64bcac65204234f9057a28f1b1b70188 Mon Sep 17 00:00:00 2001 From: "v.audacity" Date: Mon, 25 Nov 2013 04:59:07 +0000 Subject: [PATCH] Steve's patch for http://bugzilla.audacityteam.org/show_bug.cgi?id=687 Changes in AudacityProject::SaveAs() warning dialogs, per 'Save Project warning' discussion on audacity-quality, plus some further changes of my own. Similar changes for 'Save Compressed Project'. Added Cancel button to both warnings, so user can opt out immediately, rather than have to wait another dialog. Added wxMessageBox's best 'warning' icon to our WarningDialog constructor, so it shows in title bar. It's low-rez (32x32), but all that's available with wxWidgets 2.8.12. Easy to remove if too ugly. --- src/Menus.cpp | 6 +++--- src/Project.cpp | 22 ++++++++++++++++++---- src/export/Export.cpp | 2 +- src/widgets/Warning.cpp | 2 ++ 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/Menus.cpp b/src/Menus.cpp index 6773b7ab5..73f6e5635 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -263,12 +263,12 @@ void AudacityProject::CreateMenusAndCommands() ///////////////////////////////////////////////////////////////////////////// // Enable Export audio commands only when there are audio tracks. - c->AddItem(wxT("Export"), _("&Export..."), FN(OnExport), wxT("Ctrl+Shift+E"), + c->AddItem(wxT("Export"), _("&Export Audio..."), FN(OnExport), wxT("Ctrl+Shift+E"), AudioIONotBusyFlag | WaveTracksExistFlag, AudioIONotBusyFlag | WaveTracksExistFlag); // Enable Export Selection commands only when there's a selection. - c->AddItem(wxT("ExportSel"), _("Expo&rt Selection..."), FN(OnExportSelection), + c->AddItem(wxT("ExportSel"), _("Expo&rt Selected Audio..."), FN(OnExportSelection), AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag, AudioIONotBusyFlag | TimeSelectedFlag | WaveTracksSelectedFlag); @@ -3054,7 +3054,7 @@ void AudacityProject::OnExportSelection() Exporter e; wxGetApp().SetMissingAliasedFileWarningShouldShow(true); - e.SetFileDialogTitle( _("Export Selection") ); + e.SetFileDialogTitle( _("Export Selected Audio") ); e.Process(this, true, mViewInfo.sel0, mViewInfo.sel1); } diff --git a/src/Project.cpp b/src/Project.cpp index 876a13025..ac2c0595a 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -3556,14 +3556,28 @@ bool AudacityProject::SaveAs(bool bWantSaveCompressed /*= false*/) wxString sDialogTitle; if (bWantSaveCompressed) { - ShowWarningDialog(this, wxT("FirstProjectSave"), - _("Audacity compressed project files (.aup) save your work in a smaller, compressed (.ogg) format. \nCompressed project files are a good way to transmit your project online, because they are much smaller. \nTo open a compressed project takes longer than usual, as it imports each compressed track. \n\nMost other programs can't open Audacity project files.\nWhen you want to save a file that can be opened by other programs, select one of the\nExport commands.")); + if (ShowWarningDialog(this, wxT("FirstProjectSave"), + _("\ +'Save Compressed Project' is for an Audacity project, not an audio file.\n\ +For an audio file that will open in other apps, use 'Export'.\n\n\ +\ +Compressed project files are a good way to transmit your project online, \n\ +but they have some loss of fidelity.\n\n\ +\ +To open a compressed project takes longer than usual, as it imports \n\ +each compressed track.\n"), + true) != wxID_OK) + return false; sDialogTitle.Printf(_("Save Compressed Project \"%s\" As..."), sProjName.c_str()); } else { - ShowWarningDialog(this, wxT("FirstProjectSave"), - _("You are saving an Audacity project file (.aup).\n\nSaving a project creates a file that only Audacity can open.\n\nTo save an audio file for other programs, use one of the \"File > Export\" commands.\n")); + if (ShowWarningDialog(this, wxT("FirstProjectSave"), + _("\ +'Save Project' is for an Audacity project, not an audio file.\n\ +For an audio file that will open in other apps, use 'Export'.\n"), + true) != wxID_OK) + return false; sDialogTitle.Printf(_("Save Project \"%s\" As..."), sProjName.c_str()); } diff --git a/src/export/Export.cpp b/src/export/Export.cpp index 4afe99579..fd6e340f6 100644 --- a/src/export/Export.cpp +++ b/src/export/Export.cpp @@ -289,7 +289,7 @@ Mixer* ExportPlugin::CreateMixer(int numInputTracks, WaveTrack **inputTracks, Exporter::Exporter() { mMixerSpec = NULL; - SetFileDialogTitle( _("Export File") ); + SetFileDialogTitle( _("Export Audio") ); RegisterPlugin(New_ExportPCM()); RegisterPlugin(New_ExportMP3()); diff --git a/src/widgets/Warning.cpp b/src/widgets/Warning.cpp index 31133b309..c763c4cd3 100644 --- a/src/widgets/Warning.cpp +++ b/src/widgets/Warning.cpp @@ -23,6 +23,7 @@ the ability to not see similar warnings again for this session. #include "../Prefs.h" #include "../ShuttleGui.h" +#include #include #include #include @@ -55,6 +56,7 @@ WarningDialog::WarningDialog(wxWindow *parent, wxString message, bool showCancel wxDefaultPosition, wxDefaultSize, (showCancelButton ? wxDEFAULT_DIALOG_STYLE : wxCAPTION | wxSYSTEM_MENU)) // Unlike wxDEFAULT_DIALOG_STYLE, no wxCLOSE_BOX. { + SetIcon(wxArtProvider::GetIcon(wxART_WARNING, wxART_MESSAGE_BOX)); ShuttleGui S(this, eIsCreating); S.SetBorder(10);