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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user