mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Bug2567: Macros using cut and paste should work on multiple files
This commit is contained in:
parent
e343bf556b
commit
105558c7bf
@ -37,6 +37,7 @@
|
|||||||
#include <wx/imaglist.h>
|
#include <wx/imaglist.h>
|
||||||
#include <wx/settings.h>
|
#include <wx/settings.h>
|
||||||
|
|
||||||
|
#include "Clipboard.h"
|
||||||
#include "ShuttleGui.h"
|
#include "ShuttleGui.h"
|
||||||
#include "Menus.h"
|
#include "Menus.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
@ -433,6 +434,14 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
mMacroCommands.ReadMacro(name);
|
mMacroCommands.ReadMacro(name);
|
||||||
{
|
{
|
||||||
|
// Move global clipboard contents aside temporarily
|
||||||
|
Clipboard tempClipboard;
|
||||||
|
auto &globalClipboard = Clipboard::Get();
|
||||||
|
globalClipboard.Swap(tempClipboard);
|
||||||
|
auto cleanup = finally([&]{
|
||||||
|
globalClipboard.Swap(tempClipboard);
|
||||||
|
});
|
||||||
|
|
||||||
wxWindowDisabler wd(&activityWin);
|
wxWindowDisabler wd(&activityWin);
|
||||||
for (i = 0; i < (int)files.size(); i++) {
|
for (i = 0; i < (int)files.size(); i++) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -457,6 +466,10 @@ void ApplyMacroDialog::OnApplyToFiles(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
// Ensure project is completely reset
|
// Ensure project is completely reset
|
||||||
ProjectManager::Get(*project).ResetProjectToEmpty();
|
ProjectManager::Get(*project).ResetProjectToEmpty();
|
||||||
|
// Bug2567:
|
||||||
|
// Must also destroy the clipboard, to be sure sample blocks are
|
||||||
|
// all freed and their ids can be reused safely in the next pass
|
||||||
|
globalClipboard.Clear();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
break;
|
break;
|
||||||
|
@ -18,6 +18,14 @@ Clipboard::Clipboard()
|
|||||||
|
|
||||||
Clipboard::~Clipboard() = default;
|
Clipboard::~Clipboard() = default;
|
||||||
|
|
||||||
|
void Clipboard::Swap( Clipboard &other )
|
||||||
|
{
|
||||||
|
std::swap( mTracks, other.mTracks );
|
||||||
|
std::swap( mProject, other.mProject );
|
||||||
|
std::swap( mT0, other.mT0 );
|
||||||
|
std::swap( mT1, other.mT1 );
|
||||||
|
}
|
||||||
|
|
||||||
Clipboard &Clipboard::Get()
|
Clipboard &Clipboard::Get()
|
||||||
{
|
{
|
||||||
static Clipboard instance;
|
static Clipboard instance;
|
||||||
|
@ -43,10 +43,13 @@ public:
|
|||||||
TrackList && newContents, double t0, double t1,
|
TrackList && newContents, double t0, double t1,
|
||||||
const std::weak_ptr<AudacityProject> &pProject );
|
const std::weak_ptr<AudacityProject> &pProject );
|
||||||
|
|
||||||
private:
|
|
||||||
Clipboard();
|
Clipboard();
|
||||||
~Clipboard();
|
~Clipboard();
|
||||||
|
|
||||||
|
void Swap( Clipboard &other );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
std::shared_ptr<TrackList> mTracks;
|
std::shared_ptr<TrackList> mTracks;
|
||||||
std::weak_ptr<AudacityProject> mProject{};
|
std::weak_ptr<AudacityProject> mProject{};
|
||||||
double mT0{ 0 };
|
double mT0{ 0 };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user