Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
anonymous_namespace{UndoTracks.cpp}::TrackListRestorer Struct Referencefinal
Inheritance diagram for anonymous_namespace{UndoTracks.cpp}::TrackListRestorer:
[legend]
Collaboration diagram for anonymous_namespace{UndoTracks.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 17 of file UndoTracks.cpp.

Constructor & Destructor Documentation

◆ TrackListRestorer()

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

Definition at line 18 of file UndoTracks.cpp.

19 : mpTracks{ TrackList::Create(nullptr) }
20 {
21 for (auto pTrack : TrackList::Get(project)) {
22 if (pTrack->GetId() == TrackId{})
23 // Don't copy a pending added track
24 continue;
25 mpTracks->Add(pTrack->Duplicate());
26 }
27 }
const auto project
An in-session identifier of track objects across undo states. It does not persist between sessions.
Definition: Track.h:79
static TrackListHolder Create(AudacityProject *pOwner)
Definition: Track.cpp:330
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
const std::shared_ptr< TrackList > mpTracks
Definition: UndoTracks.cpp:37

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

Here is the call graph for this function:

Member Function Documentation

◆ CanUndoOrRedo()

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

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

Reimplemented from UndoStateExtension.

Definition at line 34 of file UndoTracks.cpp.

34 {
36 }
bool HasPendingTracks() const
static PendingTracks & Get(AudacityProject &project)

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

Here is the call graph for this function:

◆ RestoreUndoRedoState()

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

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

Implements UndoStateExtension.

Definition at line 28 of file UndoTracks.cpp.

28 {
29 auto &dstTracks = TrackList::Get(project);
30 dstTracks.Clear();
31 for (auto pTrack : *mpTracks)
32 dstTracks.Add(pTrack->Duplicate());
33 }

References TrackList::Get(), and project.

Here is the call graph for this function:

Member Data Documentation

◆ mpTracks

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

Definition at line 37 of file UndoTracks.cpp.


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