mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-17 16:40:07 +02:00
Bug2436: Cross-project paste should duplicate block files...
... to avoid data loss! Bug caused by commit c2feee6
This commit is contained in:
parent
c6765efa89
commit
ecb65f8c2b
@ -530,10 +530,12 @@ void WaveTrack::Trim (double t0, double t1)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
WaveTrack::Holder WaveTrack::EmptyCopy() const
|
WaveTrack::Holder WaveTrack::EmptyCopy(
|
||||||
|
const std::shared_ptr<DirManager> &pDirManager ) const
|
||||||
{
|
{
|
||||||
auto result = std::make_shared<WaveTrack>( mDirManager, mFormat, mRate );
|
auto result = std::make_shared<WaveTrack>( mDirManager, mFormat, mRate );
|
||||||
result->Init(*this);
|
result->Init(*this);
|
||||||
|
result->mDirManager = pDirManager ? pDirManager : mDirManager;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,8 @@ private:
|
|||||||
|
|
||||||
// Make another track copying format, rate, color, etc. but containing no
|
// Make another track copying format, rate, color, etc. but containing no
|
||||||
// clips
|
// clips
|
||||||
Holder EmptyCopy() const;
|
Holder EmptyCopy(
|
||||||
|
const std::shared_ptr<DirManager> &pDirManager = {} ) const;
|
||||||
|
|
||||||
// If forClipboard is true,
|
// If forClipboard is true,
|
||||||
// and there is no clip at the end time of the selection, then the result
|
// and there is no clip at the end time of the selection, then the result
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "../AdornedRulerPanel.h"
|
#include "../AdornedRulerPanel.h"
|
||||||
#include "../Clipboard.h"
|
#include "../Clipboard.h"
|
||||||
#include "../CommonCommandFlags.h"
|
#include "../CommonCommandFlags.h"
|
||||||
|
#include "../DirManager.h"
|
||||||
#include "../LabelTrack.h"
|
#include "../LabelTrack.h"
|
||||||
#include "../Menus.h"
|
#include "../Menus.h"
|
||||||
#include "../NoteTrack.h"
|
#include "../NoteTrack.h"
|
||||||
@ -75,6 +76,7 @@ bool DoPasteText(AudacityProject &project)
|
|||||||
bool DoPasteNothingSelected(AudacityProject &project)
|
bool DoPasteNothingSelected(AudacityProject &project)
|
||||||
{
|
{
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
|
auto &dirManager = DirManager::Get( project );
|
||||||
auto &trackFactory = TrackFactory::Get( project );
|
auto &trackFactory = TrackFactory::Get( project );
|
||||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||||
auto &window = ProjectWindow::Get( project );
|
auto &window = ProjectWindow::Get( project );
|
||||||
@ -101,7 +103,7 @@ bool DoPasteNothingSelected(AudacityProject &project)
|
|||||||
// Cause duplication of block files on disk, when copy is
|
// Cause duplication of block files on disk, when copy is
|
||||||
// between projects
|
// between projects
|
||||||
locker.emplace(wc);
|
locker.emplace(wc);
|
||||||
uNewTrack = wc->EmptyCopy();
|
uNewTrack = wc->EmptyCopy( dirManager.shared_from_this() );
|
||||||
pNewTrack = uNewTrack.get();
|
pNewTrack = uNewTrack.get();
|
||||||
},
|
},
|
||||||
#ifdef USE_MIDI
|
#ifdef USE_MIDI
|
||||||
@ -379,6 +381,7 @@ void OnPaste(const CommandContext &context)
|
|||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
|
auto &dirManager = DirManager::Get( project );
|
||||||
auto &trackFactory = TrackFactory::Get( project );
|
auto &trackFactory = TrackFactory::Get( project );
|
||||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||||
const auto &settings = ProjectSettings::Get( project );
|
const auto &settings = ProjectSettings::Get( project );
|
||||||
@ -596,7 +599,7 @@ void OnPaste(const CommandContext &context)
|
|||||||
wt->ClearAndPaste(t0, t1, wc, true, true);
|
wt->ClearAndPaste(t0, t1, wc, true, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
auto tmp = wt->EmptyCopy();
|
auto tmp = wt->EmptyCopy( dirManager.shared_from_this() );
|
||||||
tmp->InsertSilence( 0.0,
|
tmp->InsertSilence( 0.0,
|
||||||
// MJS: Is this correct?
|
// MJS: Is this correct?
|
||||||
clipboard.Duration() );
|
clipboard.Duration() );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user