Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
anonymous_namespace{Track.cpp}::TrackListRestorer Struct Referencefinal
Inheritance diagram for anonymous_namespace{Track.cpp}::TrackListRestorer:
[legend]
Collaboration diagram for anonymous_namespace{Track.cpp}::TrackListRestorer:
[legend]

Public Member Functions

 TrackListRestorer (AudacityProject &project)
 
void RestoreUndoRedoState (AudacityProject &project) override
 Modify the project when undoing or redoing to some state in history. More...
 
bool CanUndoOrRedo (const AudacityProject &project) override
 Whether undo or redo is now permitted; default returns true. More...
 
- Public Member Functions inherited from UndoStateExtension
virtual ~UndoStateExtension ()
 
virtual void RestoreUndoRedoState (AudacityProject &project)=0
 Modify the project when undoing or redoing to some state in history. More...
 
virtual bool CanUndoOrRedo (const AudacityProject &project)
 Whether undo or redo is now permitted; default returns true. More...
 

Public Attributes

const std::shared_ptr< TrackListmpTracks
 

Detailed Description

Definition at line 1376 of file Track.cpp.

Constructor & Destructor Documentation

◆ TrackListRestorer()

anonymous_namespace{Track.cpp}::TrackListRestorer::TrackListRestorer ( AudacityProject project)
inline

Definition at line 1377 of file Track.cpp.

1378 : mpTracks{ TrackList::Create(nullptr) }
1379 {
1380 for (auto pTrack : TrackList::Get(project)) {
1381 if (pTrack->GetId() == TrackId{})
1382 // Don't copy a pending added track
1383 continue;
1384 mpTracks->Append(std::move(*pTrack->Duplicate()));
1385 }
1386 }
const auto project
An in-session identifier of track objects across undo states. It does not persist between sessions.
Definition: Track.h:91
static TrackListHolder Create(AudacityProject *pOwner)
Definition: Track.cpp:365
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:347
const std::shared_ptr< TrackList > mpTracks
Definition: Track.cpp:1396

References TrackList::Append(), TrackList::Get(), and project.

Here is the call graph for this function:

Member Function Documentation

◆ CanUndoOrRedo()

bool anonymous_namespace{Track.cpp}::TrackListRestorer::CanUndoOrRedo ( const AudacityProject project)
inlineoverridevirtual

Whether undo or redo is now permitted; default returns true.

Reimplemented from UndoStateExtension.

Definition at line 1393 of file Track.cpp.

1393 {
1395 }
bool HasPendingTracks() const
Definition: Track.cpp:1269

References TrackList::Get(), TrackList::HasPendingTracks(), and project.

Here is the call graph for this function:

◆ RestoreUndoRedoState()

void anonymous_namespace{Track.cpp}::TrackListRestorer::RestoreUndoRedoState ( AudacityProject project)
inlineoverridevirtual

Modify the project when undoing or redoing to some state in history.

Implements UndoStateExtension.

Definition at line 1387 of file Track.cpp.

1387 {
1388 auto &dstTracks = TrackList::Get(project);
1389 dstTracks.Clear();
1390 for (auto pTrack : *mpTracks)
1391 dstTracks.Append(std::move(*pTrack->Duplicate()));
1392 }

References TrackList::Get(), and project.

Here is the call graph for this function:

Member Data Documentation

◆ mpTracks

const std::shared_ptr<TrackList> anonymous_namespace{Track.cpp}::TrackListRestorer::mpTracks

Definition at line 1396 of file Track.cpp.


The documentation for this struct was generated from the following file: