From 9e3c98202f3c13ffe15f8d7d63b04736338ec8e5 Mon Sep 17 00:00:00 2001 From: James Crook Date: Fri, 9 Apr 2021 19:05:19 +0100 Subject: [PATCH] Bug 2734 - Apply macro may not create the macro-output folder in the source directory Now macro-output is placed in your default documents folder (if no path specified) or in the path you specify (if a path was specified). --- src/FileNames.h | 3 ++- src/menus/FileMenus.cpp | 5 +++++ src/prefs/DirectoriesPrefs.cpp | 11 +++++++++++ src/prefs/DirectoriesPrefs.h | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/FileNames.h b/src/FileNames.h index 2c7cc5399..cb7eee067 100644 --- a/src/FileNames.h +++ b/src/FileNames.h @@ -138,7 +138,8 @@ namespace FileNames Open, Save, Import, - Export + Export, + MacrosOut }; enum class PathType { diff --git a/src/menus/FileMenus.cpp b/src/menus/FileMenus.cpp index 202728df7..2c01eb66d 100644 --- a/src/menus/FileMenus.cpp +++ b/src/menus/FileMenus.cpp @@ -61,6 +61,10 @@ void DoExport(AudacityProject &project, const FileExtension &format) success = e.Process(false, t0, t1); } else { + // We either use a configured output path, + // or we use the default documents folder - just as for exports. + FilePath pathName = FileNames::FindDefaultPath(FileNames::Operation::MacrosOut); +/* // If we've gotten to this point, we are in batch mode, have a file format, // and the project has either been saved or a file has been imported. So, we // want to use the project's path if it has been saved, otherwise use the @@ -68,6 +72,7 @@ void DoExport(AudacityProject &project, const FileExtension &format) FilePath pathName = !projectFileIO.IsTemporary() ? wxPathOnly(projectFileIO.GetFileName()) : project.GetInitialImportPath(); +*/ wxFileName fileName(pathName, projectName, format.Lower()); // Append the "macro-output" directory to the path diff --git a/src/prefs/DirectoriesPrefs.cpp b/src/prefs/DirectoriesPrefs.cpp index 756bc7b25..379e35a09 100644 --- a/src/prefs/DirectoriesPrefs.cpp +++ b/src/prefs/DirectoriesPrefs.cpp @@ -122,6 +122,7 @@ enum SaveTextID, ImportTextID, ExportTextID, + MacrosTextID, TextsEnd, ButtonsStart = 1020, @@ -129,6 +130,7 @@ enum SaveButtonID, ImportButtonID, ExportButtonID, + MacrosButtonID, ButtonsEnd }; @@ -226,6 +228,15 @@ void DirectoriesPrefs::PopulateOrExchange(ShuttleGui &S) wxT("")}, 30); S.Id(ExportButtonID).AddButton(XXO("Bro&wse...")); + + S.Id(MacrosTextID); + mMacrosText = S.TieTextBox(XXO("&Macro output:"), + {PreferenceKey(Operation::MacrosOut, PathType::User), + wxT("")}, + 30); + S.Id(MacrosButtonID).AddButton(XXO("Bro&wse...")); + + } S.EndMultiColumn(); } diff --git a/src/prefs/DirectoriesPrefs.h b/src/prefs/DirectoriesPrefs.h index 2a9aa758d..db3a5e94c 100644 --- a/src/prefs/DirectoriesPrefs.h +++ b/src/prefs/DirectoriesPrefs.h @@ -49,6 +49,7 @@ class DirectoriesPrefs final : public PrefsPanel wxTextCtrl *mSaveText; wxTextCtrl *mImportText; wxTextCtrl *mExportText; + wxTextCtrl *mMacrosText; DECLARE_EVENT_TABLE() };