Audacity  3.0.3
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]

Public Member Functions

 ProjectHistory (AudacityProject &project)
 
 ProjectHistory (const ProjectHistory &) PROHIBITED
 
ProjectHistoryoperator= (const ProjectHistory &) PROHIBITED
 
 ~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 20 of file ProjectHistory.h.

Constructor & Destructor Documentation

◆ ProjectHistory() [1/2]

ProjectHistory::ProjectHistory ( AudacityProject project)
inlineexplicit

Definition at line 27 of file ProjectHistory.h.

28  : mProject{ project }
29  {}

◆ ProjectHistory() [2/2]

ProjectHistory::ProjectHistory ( const ProjectHistory )

◆ ~ProjectHistory()

ProjectHistory::~ProjectHistory ( )
overridedefault

Member Function Documentation

◆ Get() [1/2]

ProjectHistory & ProjectHistory::Get ( AudacityProject project)
static

Definition at line 26 of file ProjectHistory.cpp.

27 {
28  return project.AttachedObjects::Get< ProjectHistory >( sProjectHistoryKey );
29 }

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(), anonymous_namespace{WaveTrackView.cpp}::SubViewAdjustHandle::Click(), SelectHandle::Click(), GainSliderHandle::CommitChanges(), PanSliderHandle::CommitChanges(), anonymous_namespace{WaveTrackView.cpp}::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(), Get(), MixerTrackCluster::HandleSliderGain(), MixerTrackCluster::HandleSliderPan(), NoteTrackVRulerControls::HandleWheelRotation(), ProjectFileManager::Import(), AUPImportFileHandle::Import(), LabelTrackView::KeyDown(), LOFImportFileHandle::lofOpenFiles(), MenuManager::ModifyUndoMenuItems(), TrackActions::Handler::MuteTracks(), ProjectManager::New(), ProjectAudioManager::OnAudioIOStopRecording(), 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(), TrackActions::Handler::OnNewLabelTrack(), TrackActions::Handler::OnNewStereoTrack(), TrackActions::Handler::OnNewTimeTrack(), TrackActions::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(), SelectActions::Handler::OnSetLeftSelection(), TrackMenuTable::OnSetName(), SelectActions::Handler::OnSetRightSelection(), 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(), RedoAvailableFlag(), TrackPanelResizeHandle::Release(), LabelGlyphHandle::Release(), NoteTrackButtonHandle::Release(), NoteTrackVZoomHandle::Release(), StretchHandle::Release(), CutlineHandle::Release(), SampleHandle::Release(), anonymous_namespace{WaveTrackView.cpp}::SubViewAdjustHandle::Release(), anonymous_namespace{WaveTrackView.cpp}::SubViewRearrangeHandle::Release(), BrushHandle::Release(), EnvelopeHandle::Release(), SelectHandle::Release(), TimeShiftHandle::Release(), TrackSelectHandle::Release(), ProjectManager::ResetProjectToEmpty(), ProjectManager::SafeToOpenProjectInto(), NoteTrackAffordanceHandle::SelectAt(), WaveTrackAffordanceHandle::SelectAt(), WaveTrackAffordanceControls::SelectNextClip(), RateMenuTable::SetRate(), anonymous_namespace{TrackMenus.cpp}::SetTrackGain(), anonymous_namespace{TrackMenus.cpp}::SetTrackPan(), 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 31 of file ProjectHistory.cpp.

32 {
33  return Get( const_cast< AudacityProject & >( project ) );
34 }

References Get().

Here is the call graph for this function:

◆ GetDirty()

bool ProjectHistory::GetDirty ( ) const
inline

Definition at line 51 of file ProjectHistory.h.

51 { return mDirty; }

References mDirty.

◆ InitialState()

void ProjectHistory::InitialState ( )

Definition at line 42 of file ProjectHistory.cpp.

43 {
44  auto &project = mProject;
45  auto &tracks = TrackList::Get( project );
46  auto &viewInfo = ViewInfo::Get( project );
47  auto &undoManager = UndoManager::Get( project );
48  auto &tags = Tags::Get( project );
49 
50  undoManager.ClearStates();
51 
52  undoManager.PushState(
53  &tracks, viewInfo.selectedRegion, tags.shared_from_this(),
54  XO("Created new project"), {});
55 
56  undoManager.StateSaved();
57 }

References ViewInfo::Get(), Tags::Get(), TrackList::Get(), UndoManager::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 124 of file ProjectHistory.cpp.

125 {
126  auto &project = mProject;
127  auto &projectFileIO = ProjectFileIO::Get( project );
128  if (bWantsAutoSave)
129  AutoSaveOrThrow( projectFileIO );
130 
131  // remaining no-fail operations "commit" the changes of undo manager state
132  auto &tracks = TrackList::Get( project );
133  auto &viewInfo = ViewInfo::Get( project );
134  auto &undoManager = UndoManager::Get( project );
135  auto &tags = Tags::Get( project );
136  undoManager.ModifyState(
137  &tracks, viewInfo.selectedRegion, tags.shared_from_this());
138 }

References anonymous_namespace{ProjectHistory.cpp}::AutoSaveOrThrow(), ViewInfo::Get(), ProjectFileIO::Get(), Tags::Get(), TrackList::Get(), UndoManager::Get(), and mProject.

Referenced by MacroCommands::ApplyMacro(), TrackPanelResizeHandle::Click(), anonymous_namespace{WaveTrackView.cpp}::SubViewAdjustHandle::Click(), SelectHandle::Click(), anonymous_namespace{WaveTrackView.cpp}::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(), SelectActions::Handler::OnSetLeftSelection(), SelectActions::Handler::OnSetRightSelection(), SelectActions::Handler::OnSkipEnd(), SelectActions::Handler::OnSkipStart(), anonymous_namespace{SpectrumView.cpp}::SpectrogramSettingsHandler::OnSpectrogramSettings(), SpectrumVRulerMenuTable::OnSpectrumScaleType(), WaveformVRulerMenuTable::OnWaveformScaleType(), SelectActions::Handler::OnZeroCrossing(), NoteTrackVRulerMenuTable::OnZoom(), ViewActions::Handler::OnZoomFitV(), TrackPanelResizeHandle::Release(), NoteTrackButtonHandle::Release(), NoteTrackVZoomHandle::Release(), anonymous_namespace{WaveTrackView.cpp}::SubViewAdjustHandle::Release(), anonymous_namespace{WaveTrackView.cpp}::SubViewRearrangeHandle::Release(), BrushHandle::Release(), SelectHandle::Release(), NoteTrackAffordanceHandle::SelectAt(), WaveTrackAffordanceHandle::SelectAt(), WaveTrackAffordanceControls::SelectNextClip(), and SelectHandle::StartSelection().

Here is the call graph for this function:

◆ operator=()

ProjectHistory& ProjectHistory::operator= ( const ProjectHistory )

◆ PopState()

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

Definition at line 143 of file ProjectHistory.cpp.

144 {
145  auto &project = mProject;
146  auto &projectFileIO = ProjectFileIO::Get( project );
147  if (doAutosave)
148  AutoSaveOrThrow( projectFileIO );
149 
150  // remaining no-fail operations "commit" the changes of undo manager state
151  auto &dstTracks = TrackList::Get( project );
152  auto &viewInfo = ViewInfo::Get( project );
153 
154  viewInfo.selectedRegion = state.selectedRegion;
155 
156  // Restore tags
157  Tags::Set( project, state.tags );
158 
159  TrackList *const tracks = state.tracks.get();
160 
161  dstTracks.Clear();
162 
163  for (auto t : tracks->Any())
164  {
165  dstTracks.Add(t->Duplicate());
166  }
167 
168 }

References TrackList::Any(), anonymous_namespace{ProjectHistory.cpp}::AutoSaveOrThrow(), ViewInfo::Get(), ProjectFileIO::Get(), TrackList::Get(), mProject, UndoState::selectedRegion, Tags::Set(), UndoState::tags, 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 90 of file ProjectHistory.cpp.

92 {
93  PushState(desc, shortDesc, UndoPush::NONE);
94 }

References desc, and NONE.

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(), MixerTrackCluster::HandleSliderGain(), MixerTrackCluster::HandleSliderPan(), LabelTrackView::KeyDown(), 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(), TrackActions::Handler::OnNewLabelTrack(), TrackActions::Handler::OnNewStereoTrack(), TrackActions::Handler::OnNewTimeTrack(), TrackActions::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(), LabelGlyphHandle::Release(), StretchHandle::Release(), CutlineHandle::Release(), SampleHandle::Release(), BrushHandle::Release(), EnvelopeHandle::Release(), TimeShiftHandle::Release(), TrackSelectHandle::Release(), RateMenuTable::SetRate(), anonymous_namespace{TrackMenus.cpp}::SetTrackGain(), anonymous_namespace{TrackMenus.cpp}::SetTrackPan(), and WaveTrackAffordanceControls::StartEditClipName().

◆ PushState() [2/2]

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

Definition at line 96 of file ProjectHistory.cpp.

99 {
100  auto &project = mProject;
101  auto &projectFileIO = ProjectFileIO::Get( project );
102  if((flags & UndoPush::NOAUTOSAVE) == UndoPush::NONE)
103  AutoSaveOrThrow( projectFileIO );
104 
105  // remaining no-fail operations "commit" the changes of undo manager state
106  auto &tracks = TrackList::Get( project );
107  auto &viewInfo = ViewInfo::Get( project );
108  auto &undoManager = UndoManager::Get( project );
109  auto &tags = Tags::Get( project );
110  undoManager.PushState(
111  &tracks, viewInfo.selectedRegion, tags.shared_from_this(),
112  desc, shortDesc, flags);
113 
114  mDirty = true;
115 }

References anonymous_namespace{ProjectHistory.cpp}::AutoSaveOrThrow(), desc, ViewInfo::Get(), ProjectFileIO::Get(), Tags::Get(), TrackList::Get(), UndoManager::Get(), mDirty, mProject, NOAUTOSAVE, and NONE.

Here is the call graph for this function:

◆ RedoAvailable()

bool ProjectHistory::RedoAvailable ( ) const

Definition at line 68 of file ProjectHistory.cpp.

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

References TrackList::Get(), UndoManager::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 117 of file ProjectHistory.cpp.

118 {
119  auto &project = mProject;
120  auto &undoManager = UndoManager::Get( project );
121  SetStateTo( undoManager.GetCurrentState(), false );
122 }

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 52 of file ProjectHistory.h.

52 { mDirty = value; }

◆ SetStateTo()

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

Definition at line 170 of file ProjectHistory.cpp.

171 {
172  auto &project = mProject;
173  auto &undoManager = UndoManager::Get( project );
174 
175  undoManager.SetStateTo(n,
176  [this, doAutosave]( const UndoStackElem &elem ){
177  PopState(elem.state, doAutosave); } );
178 }

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 59 of file ProjectHistory.cpp.

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

References TrackList::Get(), UndoManager::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 57 of file ProjectHistory.h.

Referenced by GetDirty(), and PushState().

◆ mProject

AudacityProject& ProjectHistory::mProject
private

The documentation for this class was generated from the following files:
ViewInfo::Get
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:161
ProjectHistory::mProject
AudacityProject & mProject
Definition: ProjectHistory.h:55
UndoState::tracks
std::shared_ptr< TrackList > tracks
Definition: UndoManager.h:92
ProjectHistory::mDirty
bool mDirty
Definition: ProjectHistory.h:57
TrackList
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:1280
UndoPush::NONE
@ NONE
XO
#define XO(s)
Definition: Internat.h:31
ProjectFileIO::Get
static ProjectFileIO & Get(AudacityProject &project)
Definition: ProjectFileIO.cpp:265
ProjectHistory
Definition: ProjectHistory.h:22
sProjectHistoryKey
static AudacityProject::AttachedObjects::RegisteredFactory sProjectHistoryKey
Definition: ProjectHistory.cpp:20
desc
const TranslatableString desc
Definition: ExportPCM.cpp:58
Tags::Get
static Tags & Get(AudacityProject &project)
Definition: Tags.cpp:237
UndoPush::NOAUTOSAVE
@ NOAUTOSAVE
ProjectHistory::PopState
void PopState(const UndoState &state, bool doAutosave=true)
Definition: ProjectHistory.cpp:143
UndoStackElem::state
UndoState state
Definition: UndoManager.h:110
Tags::Set
static Tags & Set(AudacityProject &project, const std::shared_ptr< Tags > &tags)
Definition: Tags.cpp:247
anonymous_namespace{ProjectHistory.cpp}::AutoSaveOrThrow
void AutoSaveOrThrow(ProjectFileIO &projectFileIO)
Definition: ProjectHistory.cpp:78
ProjectHistory::PushState
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
Definition: ProjectHistory.cpp:90
TrackList::Get
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:506
UndoManager::Get
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:57
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
UndoState::tags
std::shared_ptr< Tags > tags
Definition: UndoManager.h:93
TrackList::Any
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1371
UndoState::selectedRegion
SelectedRegion selectedRegion
Definition: UndoManager.h:94
ProjectHistory::Get
static ProjectHistory & Get(AudacityProject &project)
Definition: ProjectHistory.cpp:26
UndoStackElem
Holds one item with description and time range for the UndoManager.
Definition: UndoManager.h:97
ProjectHistory::SetStateTo
void SetStateTo(unsigned int n, bool doAutosave=true)
Definition: ProjectHistory.cpp:170