1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-10 08:25:52 +01:00

Reimplement importation of .aup3 file more simply...

... Breaking dependency of ProjectFileIO on on TimeTrack, and reusing the same
functions that implement cross-document copy and paste of tracks.

Also changing behavior, so that if a TimeTrack exists but another is imported,
then the import quietly replaces the existing completely.
This commit is contained in:
Paul Licameli
2020-11-08 19:24:20 -05:00
parent 15313a27f7
commit 92e36332f3
5 changed files with 39 additions and 354 deletions

View File

@@ -52,6 +52,11 @@ static ProjectFileIORegistry::Entry registerFactory{
TimeTrack::TimeTrack(const ZoomInfo *zoomInfo):
Track()
, mZoomInfo(zoomInfo)
{
CleanState();
}
void TimeTrack::CleanState()
{
mEnvelope = std::make_unique<BoundedEnvelope>(true, TIMETRACK_MIN, TIMETRACK_MAX, 1.0);
@@ -144,7 +149,15 @@ Track::Holder TimeTrack::PasteInto( AudacityProject &project ) const
pNewTrack = pTrack->SharedPointer<TimeTrack>();
else
pNewTrack = std::make_shared<TimeTrack>( &ViewInfo::Get( project ) );
// Should come here only for .aup3 import, not for paste (because the
// track is skipped in cut/copy commands)
// And for import we agree to replace the track contents completely
pNewTrack->CleanState();
pNewTrack->Init(*this);
pNewTrack->Paste(0.0, this);
pNewTrack->SetRangeLower(this->GetRangeLower());
pNewTrack->SetRangeUpper(this->GetRangeUpper());
return pNewTrack;
}