1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02:00

Define TrackView::Copy, cause all track duplications to invoke it...

... but it does nothing yet.

This will be important to preserve undo/redo behavior of view changes, when
view state is moved out of the proper Track objects.
This commit is contained in:
Paul Licameli 2019-06-16 09:19:44 -04:00
parent 79191d985d
commit c8b62f5d8a
3 changed files with 12 additions and 1 deletions

View File

@ -43,6 +43,8 @@ and TimeTrack.
#include "TrackPanel.h" // for TrackInfo
#include "tracks/ui/TrackView.h"
#ifdef _MSC_VER
//Disable truncation warnings
#pragma warning( disable : 4786 )
@ -120,7 +122,9 @@ Track::Holder Track::Duplicate() const
// invoke "virtual constructor" to copy track object proper:
auto result = Clone();
// other steps to be added here
if (mpView)
// Copy view state that might be important to undo/redo
TrackView::Get( *result ).Copy( *mpView );
return result;
}

View File

@ -24,6 +24,10 @@ TrackView::~TrackView()
{
}
void TrackView::Copy( const TrackView & )
{
}
TrackView &TrackView::Get( Track &track )
{
return *track.GetTrackView();

View File

@ -30,6 +30,9 @@ public:
: CommonTrackCell{ pTrack } {}
virtual ~TrackView() = 0;
// Copy view state, for undo/redo purposes
virtual void Copy( const TrackView &other );
static TrackView &Get( Track & );
static const TrackView &Get( const Track & );