Audacity 3.2.0
Classes | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
ProjectHistory Class Referencefinal

#include <ProjectHistory.h>

Inheritance diagram for ProjectHistory:
[legend]
Collaboration diagram for ProjectHistory:
[legend]

Classes

struct  AutoSave
 

Public Member Functions

 ProjectHistory (AudacityProject &project)
 
 ProjectHistory (const ProjectHistory &)=delete
 
ProjectHistoryoperator= (const ProjectHistory &)=delete
 
 ~ProjectHistory () override
 
void InitialState ()
 
void SetStateTo (unsigned int n, bool doAutosave=true)
 
bool UndoAvailable () const
 
bool RedoAvailable () const
 
void PushState (const TranslatableString &desc, const TranslatableString &shortDesc)
 
void PushState (const TranslatableString &desc, const TranslatableString &shortDesc, UndoPush flags)
 
void RollbackState ()
 
void ModifyState (bool bWantsAutoSave)
 
void PopState (const UndoState &state, bool doAutosave=true)
 
bool GetDirty () const
 
void SetDirty (bool value)
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

static ProjectHistoryGet (AudacityProject &project)
 
static const ProjectHistoryGet (const AudacityProject &project)
 

Private Attributes

AudacityProjectmProject
 
bool mDirty { false }
 

Detailed Description

Definition at line 21 of file ProjectHistory.h.

Constructor & Destructor Documentation

◆ ProjectHistory() [1/2]

ProjectHistory::ProjectHistory ( AudacityProject project)
inlineexplicit

Definition at line 38 of file ProjectHistory.h.

39 : mProject{ project }
40 {}
AudacityProject & mProject

◆ ProjectHistory() [2/2]

ProjectHistory::ProjectHistory ( const ProjectHistory )
delete

◆ ~ProjectHistory()

ProjectHistory::~ProjectHistory ( )
overridedefault

Member Function Documentation

◆ Get() [1/2]

ProjectHistory & ProjectHistory::Get ( AudacityProject project)
static

Definition at line 24 of file ProjectHistory.cpp.

25{
26 return project.AttachedObjects::Get< ProjectHistory >( sProjectHistoryKey );
27}
static AudacityProject::AttachedObjects::RegisteredFactory sProjectHistoryKey

References sProjectHistoryKey.

Referenced by ProjectFileManager::AddImportedTracks(), SetLabelCommand::Apply(), SetEnvelopeCommand::ApplyInner(), MacroCommands::ApplyMacro(), ProjectSelectionManager::AS_ModifySelection(), TrackSelectHandle::Cancel(), LabelGlyphHandle::Cancel(), StretchHandle::Cancel(), CutlineHandle::Cancel(), SampleHandle::Cancel(), EnvelopeHandle::Cancel(), TimeShiftHandle::Cancel(), LabelTrackView::Char(), TrackPanelResizeHandle::Click(), SubViewAdjustHandle::Click(), SelectHandle::Click(), GainSliderHandle::CommitChanges(), PanSliderHandle::CommitChanges(), SubViewCloseHandle::CommitChanges(), MinimizeButtonHandle::CommitChanges(), anonymous_namespace{LabelMenus.cpp}::DoAddLabel(), anonymous_namespace{TrackMenus.cpp}::DoAlign(), anonymous_namespace{SelectMenus.cpp}::DoBoundaryMove(), LabelTrackView::DoChar(), anonymous_namespace{ClipMenus.cpp}::DoClipLeftOrRight(), anonymous_namespace{ClipMenus.cpp}::DoCursorClipBoundary(), anonymous_namespace{SelectMenus.cpp}::DoCursorMove(), LOFImportFileHandle::doDurationAndScrollOffset(), LabelTrackView::DoEditLabels(), Exporter::DoEditMetadata(), EffectUI::DoEffect(), WaveformVRulerControls::DoHandleWheelRotation(), SpectrumVRulerControls::DoHandleWheelRotation(), DoImportMIDI(), LabelTrackView::DoKeyDown(), SelectUtilities::DoListSelection(), anonymous_namespace{TrackMenus.cpp}::DoMixAndRender(), TrackUtilities::DoMoveTrack(), anonymous_namespace{NavigationMenus.cpp}::DoNextTrack(), anonymous_namespace{TrackMenus.cpp}::DoPanTracks(), anonymous_namespace{EditMenus.cpp}::DoPasteNothingSelected(), anonymous_namespace{EditMenus.cpp}::DoPasteText(), ProjectAudioManager::DoPlayStopSelect(), anonymous_namespace{NavigationMenus.cpp}::DoPrevTrack(), TrackUtilities::DoRemoveTrack(), TrackUtilities::DoRemoveTracks(), anonymous_namespace{ClipMenus.cpp}::DoSelectClip(), anonymous_namespace{ClipMenus.cpp}::DoSelectClipBoundary(), anonymous_namespace{SelectUtilities.cpp}::DoSelectTimeAndAudioTracks(), SelectUtilities::DoSelectTimeAndTracks(), TrackUtilities::DoTrackMute(), TrackUtilities::DoTrackSolo(), SpectrumVZoomHandle::DoZoom(), WaveformVZoomHandle::DoZoom(), WaveClipTrimHandle::AdjustBorder::Finish(), WaveClipTrimHandle::AdjustBetweenBorders::Finish(), Get(), MixerTrackCluster::HandleSliderGain(), MixerTrackCluster::HandleSliderPan(), NoteTrackVRulerControls::HandleWheelRotation(), ProjectFileManager::Import(), AUPImportFileHandle::Import(), LabelTrackView::KeyDown(), LOFImportFileHandle::lofOpenFiles(), MenuManager::ModifyUndoMenuItems(), TrackActions::Handler::MuteTracks(), ProjectManager::New(), RealtimeEffectListWindow::OnAddEffectClicked(), ProjectAudioManager::OnAudioIOStopRecording(), anonymous_namespace{RealtimeEffectPanel.cpp}::RealtimeEffectControl::OnChangeButtonClicked(), NoteTrackMenuTable::OnChangeOctave(), ViewActions::Handler::OnCollapseAllTracks(), LabelTrackView::OnContextMenu(), LabelEditActions::Handler::OnCopyLabels(), SelectActions::Handler::OnCursorSelEnd(), SelectActions::Handler::OnCursorSelStart(), SelectActions::Handler::OnCursorTrackEnd(), SelectActions::Handler::OnCursorTrackStart(), EditActions::Handler::OnCut(), LabelEditActions::Handler::OnCutLabels(), EditActions::Handler::OnDelete(), LabelEditActions::Handler::OnDeleteLabels(), HistoryDialog::OnDiscard(), EditActions::Handler::OnDisjoin(), LabelEditActions::Handler::OnDisjoinLabels(), EditActions::Handler::OnDuplicate(), TrackPanel::OnEnsureVisible(), AudacityApp::OnExceptionInMainLoop(), ViewActions::Handler::OnExpandAllTracks(), FormatMenuTable::OnFormatChange(), FileActions::Handler::OnImportLabels(), HistoryDialog::OnItemSelected(), EditActions::Handler::OnJoin(), LabelEditActions::Handler::OnJoinLabels(), anonymous_namespace{SelectMenus.cpp}::OnlyHandleKeyUp(), WaveTrackMenuTable::OnMergeStereo(), LabelEditActions::Handler::OnNewLabelTrack(), anonymous_namespace{WaveTrackMenuItems.cpp}::Handler::OnNewStereoTrack(), anonymous_namespace{TimeTrackMenuItems.cpp}::Handler::OnNewTimeTrack(), anonymous_namespace{WaveTrackMenuItems.cpp}::Handler::OnNewWaveTrack(), LabelEditActions::Handler::OnPasteNewLabel(), EditActions::Handler::OnRedo(), TrackActions::Handler::OnResample(), SelectActions::Handler::OnSelectCursorEnd(), SelectActions::Handler::OnSelectCursorStoredCursor(), SelectActions::Handler::OnSelectionRestore(), SelectActions::Handler::OnSelectNone(), SelectActions::Handler::OnSelectStartCursor(), SelectActions::Handler::OnSelectSyncLockSel(), SelectActions::Handler::OnSelectTrackStartToEnd(), SelectActions::Handler::OnSelToEnd(), SelectActions::Handler::OnSelToStart(), WaveTrackMenuTable::OnSetDisplay(), TrackMenuTable::OnSetName(), SelectUtilities::OnSetRegion(), TimeTrackMenuTable::OnSetTimeTrackRange(), EditActions::Handler::OnSilence(), LabelEditActions::Handler::OnSilenceLabels(), SelectActions::Handler::OnSkipEnd(), SelectActions::Handler::OnSkipStart(), TrackActions::Handler::OnSortName(), TrackActions::Handler::OnSortTime(), anonymous_namespace{SpectrumView.cpp}::SpectrogramSettingsHandler::OnSpectrogramSettings(), SpectrumVRulerMenuTable::OnSpectrumScaleType(), EditActions::Handler::OnSplit(), EditActions::Handler::OnSplitCut(), LabelEditActions::Handler::OnSplitCutLabels(), EditActions::Handler::OnSplitDelete(), LabelEditActions::Handler::OnSplitDeleteLabels(), LabelEditActions::Handler::OnSplitLabels(), EditActions::Handler::OnSplitNew(), WaveTrackMenuTable::OnSplitStereo(), WaveTrackMenuTable::OnSplitStereoMono(), WaveTrackMenuTable::OnSwapChannels(), WaveTrackAffordanceControls::OnTextEditFinished(), TransportActions::Handler::OnTimerRecord(), TimeTrackMenuTable::OnTimeTrackLin(), TimeTrackMenuTable::OnTimeTrackLog(), TimeTrackMenuTable::OnTimeTrackLogInt(), EditActions::Handler::OnTrim(), EditActions::Handler::OnUndo(), WaveColorMenuTable::OnWaveColorChange(), WaveformVRulerMenuTable::OnWaveformScaleType(), SelectActions::Handler::OnZeroCrossing(), NoteTrackVRulerMenuTable::OnZoom(), ViewActions::Handler::OnZoomFitV(), ProjectFileManager::OpenProjectFile(), SpectralDataManager::ProcessTracks(), RealtimeEffectListWindow::RealtimeEffectListWindow(), RealtimeEffectPanel::RealtimeEffectPanel(), RedoAvailableFlag(), TrackPanelResizeHandle::Release(), LabelGlyphHandle::Release(), NoteTrackButtonHandle::Release(), NoteTrackVZoomHandle::Release(), StretchHandle::Release(), CutlineHandle::Release(), SampleHandle::Release(), SubViewAdjustHandle::Release(), SubViewRearrangeHandle::Release(), BrushHandle::Release(), EnvelopeHandle::Release(), SelectHandle::Release(), TimeShiftHandle::Release(), TrackSelectHandle::Release(), anonymous_namespace{RealtimeEffectPanel.cpp}::RealtimeEffectControl::RemoveFromList(), ProjectManager::ResetProjectToEmpty(), ProjectManager::SafeToOpenProjectInto(), NoteTrackAffordanceHandle::SelectAt(), WaveTrackAffordanceHandle::SelectAt(), WaveTrackView::SelectNextClip(), anonymous_namespace{RealtimeEffectPanel.cpp}::RealtimeEffectControl::SetEffect(), RateMenuTable::SetRate(), anonymous_namespace{TrackMenus.cpp}::SetTrackGain(), anonymous_namespace{TrackMenus.cpp}::SetTrackPan(), RealtimeEffectStateUI::Show(), ProjectSelectionManager::SSBL_ModifySpectralSelection(), WaveTrackAffordanceControls::StartEditClipName(), SelectHandle::StartSelection(), UndoAvailableFlag(), and ProjectManager::ProjectChooser::~ProjectChooser().

◆ Get() [2/2]

const ProjectHistory & ProjectHistory::Get ( const AudacityProject project)
static

Definition at line 29 of file ProjectHistory.cpp.

30{
31 return Get( const_cast< AudacityProject & >( project ) );
32}
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
static ProjectHistory & Get(AudacityProject &project)

References Get().

Here is the call graph for this function:

◆ GetDirty()

bool ProjectHistory::GetDirty ( ) const
inline

Definition at line 62 of file ProjectHistory.h.

62{ return mDirty; }

◆ InitialState()

void ProjectHistory::InitialState ( )

Definition at line 40 of file ProjectHistory.cpp.

41{
42 auto &project = mProject;
43 auto &tracks = TrackList::Get( project );
44 auto &viewInfo = ViewInfo::Get( project );
45 auto &undoManager = UndoManager::Get( project );
46
47 undoManager.ClearStates();
48
49 undoManager.PushState(
50 tracks, viewInfo.selectedRegion,
51 XO("Created new project"), {});
52
53 undoManager.StateSaved();
54}
#define XO(s)
Definition: Internat.h:31
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:486
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:67
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

References UndoManager::Get(), ViewInfo::Get(), TrackList::Get(), mProject, and XO.

Referenced by ProjectFileManager::OpenProjectFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ModifyState()

void ProjectHistory::ModifyState ( bool  bWantsAutoSave)

Definition at line 106 of file ProjectHistory.cpp.

107{
108 auto &project = mProject;
109 if (bWantsAutoSave)
110 AutoSave::Call(project);
111
112 // remaining no-fail operations "commit" the changes of undo manager state
113 auto &tracks = TrackList::Get( project );
114 auto &viewInfo = ViewInfo::Get( project );
115 auto &undoManager = UndoManager::Get( project );
116 undoManager.ModifyState(tracks, viewInfo.selectedRegion);
117}
static result_type Call(Arguments &&...arguments)
Null check of the installed function is done for you.

References GlobalHook< AutoSave, void(AudacityProject &) >::Call(), UndoManager::Get(), ViewInfo::Get(), TrackList::Get(), and mProject.

Referenced by MacroCommands::ApplyMacro(), TrackPanelResizeHandle::Click(), SubViewAdjustHandle::Click(), SelectHandle::Click(), SubViewCloseHandle::CommitChanges(), MinimizeButtonHandle::CommitChanges(), anonymous_namespace{SelectMenus.cpp}::DoBoundaryMove(), anonymous_namespace{ClipMenus.cpp}::DoCursorClipBoundary(), anonymous_namespace{SelectMenus.cpp}::DoCursorMove(), LOFImportFileHandle::doDurationAndScrollOffset(), WaveformVRulerControls::DoHandleWheelRotation(), SpectrumVRulerControls::DoHandleWheelRotation(), SelectUtilities::DoListSelection(), ProjectAudioManager::DoPlayStopSelect(), anonymous_namespace{ClipMenus.cpp}::DoSelectClip(), anonymous_namespace{ClipMenus.cpp}::DoSelectClipBoundary(), anonymous_namespace{SelectUtilities.cpp}::DoSelectTimeAndAudioTracks(), SelectUtilities::DoSelectTimeAndTracks(), TrackUtilities::DoTrackMute(), TrackUtilities::DoTrackSolo(), SpectrumVZoomHandle::DoZoom(), WaveformVZoomHandle::DoZoom(), NoteTrackVRulerControls::HandleWheelRotation(), LOFImportFileHandle::lofOpenFiles(), TrackActions::Handler::MuteTracks(), NoteTrackMenuTable::OnChangeOctave(), ViewActions::Handler::OnCollapseAllTracks(), SelectActions::Handler::OnCursorSelEnd(), SelectActions::Handler::OnCursorSelStart(), SelectActions::Handler::OnCursorTrackEnd(), SelectActions::Handler::OnCursorTrackStart(), TrackPanel::OnEnsureVisible(), ViewActions::Handler::OnExpandAllTracks(), anonymous_namespace{SelectMenus.cpp}::OnlyHandleKeyUp(), SelectActions::Handler::OnSelectCursorEnd(), SelectActions::Handler::OnSelectCursorStoredCursor(), SelectActions::Handler::OnSelectionRestore(), SelectActions::Handler::OnSelectNone(), SelectActions::Handler::OnSelectStartCursor(), SelectActions::Handler::OnSelectSyncLockSel(), SelectActions::Handler::OnSelectTrackStartToEnd(), SelectActions::Handler::OnSelToEnd(), SelectActions::Handler::OnSelToStart(), WaveTrackMenuTable::OnSetDisplay(), SelectUtilities::OnSetRegion(), SelectActions::Handler::OnSkipEnd(), SelectActions::Handler::OnSkipStart(), anonymous_namespace{SpectrumView.cpp}::SpectrogramSettingsHandler::OnSpectrogramSettings(), SpectrumVRulerMenuTable::OnSpectrumScaleType(), WaveformVRulerMenuTable::OnWaveformScaleType(), SelectActions::Handler::OnZeroCrossing(), NoteTrackVRulerMenuTable::OnZoom(), ViewActions::Handler::OnZoomFitV(), SpectralDataManager::ProcessTracks(), RealtimeEffectPanel::RealtimeEffectPanel(), TrackPanelResizeHandle::Release(), NoteTrackButtonHandle::Release(), NoteTrackVZoomHandle::Release(), SubViewAdjustHandle::Release(), SubViewRearrangeHandle::Release(), BrushHandle::Release(), SelectHandle::Release(), NoteTrackAffordanceHandle::SelectAt(), WaveTrackAffordanceHandle::SelectAt(), WaveTrackView::SelectNextClip(), anonymous_namespace{RealtimeEffectPanel.cpp}::RealtimeEffectControl::SetEffect(), RealtimeEffectStateUI::Show(), and SelectHandle::StartSelection().

Here is the call graph for this function:

◆ operator=()

ProjectHistory & ProjectHistory::operator= ( const ProjectHistory )
delete

◆ PopState()

void ProjectHistory::PopState ( const UndoState state,
bool  doAutosave = true 
)

Definition at line 122 of file ProjectHistory.cpp.

123{
124 auto &project = mProject;
125 if (doAutosave)
126 AutoSave::Call(project);
127
128 // remaining no-fail operations "commit" the changes of undo manager state
129 TrackList *const tracks = state.tracks.get();
130 wxASSERT(tracks);
131 auto &dstTracks = TrackList::Get( project );
132 auto &viewInfo = ViewInfo::Get( project );
133
134 viewInfo.selectedRegion = state.selectedRegion;
135
136 // Restore extra state
137 for (auto &pExtension : state.extensions)
138 if (pExtension)
139 pExtension->RestoreUndoRedoState(project);
140
141 dstTracks.Clear();
142 for (auto t : tracks->Any())
143 dstTracks.Add(t->Duplicate());
144}
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1338
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1437
std::shared_ptr< TrackList > tracks
Definition: UndoManager.h:123
Extensions extensions
Definition: UndoManager.h:122
SelectedRegion selectedRegion
Definition: UndoManager.h:124

References TrackList::Any(), GlobalHook< AutoSave, void(AudacityProject &) >::Call(), UndoState::extensions, ViewInfo::Get(), TrackList::Get(), mProject, UndoState::selectedRegion, and UndoState::tracks.

Referenced by EditActions::Handler::OnRedo(), EditActions::Handler::OnUndo(), and SetStateTo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PushState() [1/2]

void ProjectHistory::PushState ( const TranslatableString desc,
const TranslatableString shortDesc 
)

Definition at line 74 of file ProjectHistory.cpp.

76{
77 PushState(desc, shortDesc, UndoPush::NONE);
78}
const TranslatableString desc
Definition: ExportPCM.cpp:58
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)

References desc, NONE, and PushState().

Referenced by SetLabelCommand::Apply(), SetEnvelopeCommand::ApplyInner(), MacroCommands::ApplyMacro(), LabelTrackView::Char(), GainSliderHandle::CommitChanges(), PanSliderHandle::CommitChanges(), anonymous_namespace{LabelMenus.cpp}::DoAddLabel(), anonymous_namespace{TrackMenus.cpp}::DoAlign(), LabelTrackView::DoChar(), anonymous_namespace{ClipMenus.cpp}::DoClipLeftOrRight(), LabelTrackView::DoEditLabels(), Exporter::DoEditMetadata(), EffectUI::DoEffect(), DoImportMIDI(), LabelTrackView::DoKeyDown(), anonymous_namespace{TrackMenus.cpp}::DoMixAndRender(), TrackUtilities::DoMoveTrack(), anonymous_namespace{TrackMenus.cpp}::DoPanTracks(), anonymous_namespace{EditMenus.cpp}::DoPasteNothingSelected(), anonymous_namespace{EditMenus.cpp}::DoPasteText(), TrackUtilities::DoRemoveTrack(), TrackUtilities::DoRemoveTracks(), WaveClipTrimHandle::AdjustBorder::Finish(), WaveClipTrimHandle::AdjustBetweenBorders::Finish(), MixerTrackCluster::HandleSliderGain(), MixerTrackCluster::HandleSliderPan(), LabelTrackView::KeyDown(), RealtimeEffectListWindow::OnAddEffectClicked(), anonymous_namespace{RealtimeEffectPanel.cpp}::RealtimeEffectControl::OnChangeButtonClicked(), LabelTrackView::OnContextMenu(), LabelEditActions::Handler::OnCopyLabels(), EditActions::Handler::OnCut(), LabelEditActions::Handler::OnCutLabels(), EditActions::Handler::OnDelete(), LabelEditActions::Handler::OnDeleteLabels(), EditActions::Handler::OnDisjoin(), LabelEditActions::Handler::OnDisjoinLabels(), EditActions::Handler::OnDuplicate(), FormatMenuTable::OnFormatChange(), FileActions::Handler::OnImportLabels(), EditActions::Handler::OnJoin(), LabelEditActions::Handler::OnJoinLabels(), WaveTrackMenuTable::OnMergeStereo(), LabelEditActions::Handler::OnNewLabelTrack(), anonymous_namespace{WaveTrackMenuItems.cpp}::Handler::OnNewStereoTrack(), anonymous_namespace{TimeTrackMenuItems.cpp}::Handler::OnNewTimeTrack(), anonymous_namespace{WaveTrackMenuItems.cpp}::Handler::OnNewWaveTrack(), LabelEditActions::Handler::OnPasteNewLabel(), TrackActions::Handler::OnResample(), TrackMenuTable::OnSetName(), TimeTrackMenuTable::OnSetTimeTrackRange(), EditActions::Handler::OnSilence(), LabelEditActions::Handler::OnSilenceLabels(), TrackActions::Handler::OnSortName(), TrackActions::Handler::OnSortTime(), EditActions::Handler::OnSplit(), EditActions::Handler::OnSplitCut(), LabelEditActions::Handler::OnSplitCutLabels(), EditActions::Handler::OnSplitDelete(), LabelEditActions::Handler::OnSplitDeleteLabels(), LabelEditActions::Handler::OnSplitLabels(), EditActions::Handler::OnSplitNew(), WaveTrackMenuTable::OnSplitStereo(), WaveTrackMenuTable::OnSplitStereoMono(), WaveTrackMenuTable::OnSwapChannels(), WaveTrackAffordanceControls::OnTextEditFinished(), TimeTrackMenuTable::OnTimeTrackLin(), TimeTrackMenuTable::OnTimeTrackLog(), TimeTrackMenuTable::OnTimeTrackLogInt(), EditActions::Handler::OnTrim(), WaveColorMenuTable::OnWaveColorChange(), SpectralDataManager::ProcessTracks(), PushState(), RealtimeEffectListWindow::RealtimeEffectListWindow(), LabelGlyphHandle::Release(), StretchHandle::Release(), CutlineHandle::Release(), SampleHandle::Release(), BrushHandle::Release(), EnvelopeHandle::Release(), TimeShiftHandle::Release(), TrackSelectHandle::Release(), anonymous_namespace{RealtimeEffectPanel.cpp}::RealtimeEffectControl::RemoveFromList(), RateMenuTable::SetRate(), anonymous_namespace{TrackMenus.cpp}::SetTrackGain(), anonymous_namespace{TrackMenus.cpp}::SetTrackPan(), and WaveTrackAffordanceControls::StartEditClipName().

Here is the call graph for this function:

◆ PushState() [2/2]

void ProjectHistory::PushState ( const TranslatableString desc,
const TranslatableString shortDesc,
UndoPush  flags 
)

Definition at line 80 of file ProjectHistory.cpp.

83{
84 auto &project = mProject;
86 AutoSave::Call(project);
87
88 // remaining no-fail operations "commit" the changes of undo manager state
89 auto &tracks = TrackList::Get( project );
90 auto &viewInfo = ViewInfo::Get( project );
91 auto &undoManager = UndoManager::Get( project );
92 undoManager.PushState(
93 tracks, viewInfo.selectedRegion,
94 desc, shortDesc, flags);
95
96 mDirty = true;
97}

References GlobalHook< AutoSave, void(AudacityProject &) >::Call(), desc, UndoManager::Get(), ViewInfo::Get(), TrackList::Get(), mDirty, mProject, NOAUTOSAVE, and NONE.

Here is the call graph for this function:

◆ RedoAvailable()

bool ProjectHistory::RedoAvailable ( ) const

Definition at line 65 of file ProjectHistory.cpp.

66{
67 auto &project = mProject;
68 auto &tracks = TrackList::Get( project );
69 auto &undoManager = UndoManager::Get( project );
70 return undoManager.RedoAvailable() &&
71 !tracks.HasPendingTracks();
72}

References UndoManager::Get(), TrackList::Get(), and mProject.

Referenced by RedoAvailableFlag().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RollbackState()

void ProjectHistory::RollbackState ( )

Definition at line 99 of file ProjectHistory.cpp.

100{
101 auto &project = mProject;
102 auto &undoManager = UndoManager::Get( project );
103 SetStateTo( undoManager.GetCurrentState(), false );
104}
void SetStateTo(unsigned int n, bool doAutosave=true)

References UndoManager::Get(), mProject, and SetStateTo().

Referenced by TrackSelectHandle::Cancel(), LabelGlyphHandle::Cancel(), StretchHandle::Cancel(), CutlineHandle::Cancel(), SampleHandle::Cancel(), EnvelopeHandle::Cancel(), TimeShiftHandle::Cancel(), AudacityApp::OnExceptionInMainLoop(), TransportActions::Handler::OnTimerRecord(), and ProjectManager::ProjectChooser::~ProjectChooser().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetDirty()

void ProjectHistory::SetDirty ( bool  value)
inline

Definition at line 63 of file ProjectHistory.h.

63{ mDirty = value; }

◆ SetStateTo()

void ProjectHistory::SetStateTo ( unsigned int  n,
bool  doAutosave = true 
)

Definition at line 146 of file ProjectHistory.cpp.

147{
148 auto &project = mProject;
149 auto &undoManager = UndoManager::Get( project );
150
151 undoManager.SetStateTo(n,
152 [this, doAutosave]( const UndoStackElem &elem ){
153 PopState(elem.state, doAutosave); } );
154}
void PopState(const UndoState &state, bool doAutosave=true)
Holds one item with description and time range for the UndoManager.
Definition: UndoManager.h:127
UndoState state
Definition: UndoManager.h:140

References UndoManager::Get(), mProject, PopState(), and UndoStackElem::state.

Referenced by HistoryDialog::OnDiscard(), HistoryDialog::OnItemSelected(), and RollbackState().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UndoAvailable()

bool ProjectHistory::UndoAvailable ( ) const

Definition at line 56 of file ProjectHistory.cpp.

57{
58 auto &project = mProject;
59 auto &tracks = TrackList::Get( project );
60 auto &undoManager = UndoManager::Get( project );
61 return undoManager.UndoAvailable() &&
62 !tracks.HasPendingTracks();
63}

References UndoManager::Get(), TrackList::Get(), and mProject.

Referenced by UndoAvailableFlag().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mDirty

bool ProjectHistory::mDirty { false }
private

Definition at line 68 of file ProjectHistory.h.

Referenced by PushState().

◆ mProject

AudacityProject& ProjectHistory::mProject
private

The documentation for this class was generated from the following files: