diff --git a/src/HistoryWindow.cpp b/src/HistoryWindow.cpp index dead18864..19f881db9 100644 --- a/src/HistoryWindow.cpp +++ b/src/HistoryWindow.cpp @@ -161,6 +161,7 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager): EVT_CLIPBOARD_CHANGE, &HistoryWindow::UpdateDisplay, this); parent->Bind(EVT_UNDO_PUSHED, &HistoryWindow::UpdateDisplay, this); parent->Bind(EVT_UNDO_MODIFIED, &HistoryWindow::UpdateDisplay, this); + parent->Bind(EVT_UNDO_OR_REDO, &HistoryWindow::UpdateDisplay, this); parent->Bind(EVT_UNDO_RESET, &HistoryWindow::UpdateDisplay, this); } diff --git a/src/Lyrics.cpp b/src/Lyrics.cpp index 65d224207..91ecb74ed 100644 --- a/src/Lyrics.cpp +++ b/src/Lyrics.cpp @@ -122,6 +122,7 @@ LyricsPanel::LyricsPanel(wxWindow* parent, wxWindowID id, project->Bind(EVT_UNDO_PUSHED, &LyricsPanel::UpdateLyrics, this); project->Bind(EVT_UNDO_MODIFIED, &LyricsPanel::UpdateLyrics, this); + project->Bind(EVT_UNDO_OR_REDO, &LyricsPanel::UpdateLyrics, this); project->Bind(EVT_UNDO_RESET, &LyricsPanel::UpdateLyrics, this); wxTheApp->Bind(EVT_AUDIOIO_PLAYBACK, &LyricsPanel::OnStartStop, this); diff --git a/src/UndoManager.cpp b/src/UndoManager.cpp index 9d61b6518..fa6ab15fa 100644 --- a/src/UndoManager.cpp +++ b/src/UndoManager.cpp @@ -41,6 +41,7 @@ UndoManager wxDEFINE_EVENT(EVT_UNDO_PUSHED, wxCommandEvent); wxDEFINE_EVENT(EVT_UNDO_MODIFIED, wxCommandEvent); +wxDEFINE_EVENT(EVT_UNDO_OR_REDO, wxCommandEvent); wxDEFINE_EVENT(EVT_UNDO_RESET, wxCommandEvent); using ConstBlockFilePtr = const BlockFile*; @@ -356,7 +357,7 @@ void UndoManager::Undo(const Consumer &consumer) consumer( stack[current]->state ); // wxWidgets will own the event object - mProject.QueueEvent( safenew wxCommandEvent{ EVT_UNDO_RESET } ); + mProject.QueueEvent( safenew wxCommandEvent{ EVT_UNDO_OR_REDO } ); } void UndoManager::Redo(const Consumer &consumer) @@ -384,7 +385,7 @@ void UndoManager::Redo(const Consumer &consumer) consumer( stack[current]->state ); // wxWidgets will own the event object - mProject.QueueEvent( safenew wxCommandEvent{ EVT_UNDO_RESET } ); + mProject.QueueEvent( safenew wxCommandEvent{ EVT_UNDO_OR_REDO } ); } bool UndoManager::UnsavedChanges() diff --git a/src/UndoManager.h b/src/UndoManager.h index d5854fb24..fa383e3ce 100644 --- a/src/UndoManager.h +++ b/src/UndoManager.h @@ -64,7 +64,11 @@ wxDECLARE_EXPORTED_EVENT(AUDACITY_DLL_API, EVT_UNDO_PUSHED, wxCommandEvent); // Project state did not change, but current state was modified in Undo history wxDECLARE_EXPORTED_EVENT(AUDACITY_DLL_API, EVT_UNDO_MODIFIED, wxCommandEvent); -// Project state changed because of undo or redo or rollback; undo manager +// Project state changed because of undo or redo; undo manager +// contents did not change other than the pointer to current state +wxDECLARE_EXPORTED_EVENT(AUDACITY_DLL_API, EVT_UNDO_OR_REDO, wxCommandEvent); + +// Project state for changed other than single-step undo/redo; undo manager // contents did not change other than the pointer to current state wxDECLARE_EXPORTED_EVENT(AUDACITY_DLL_API, EVT_UNDO_RESET, wxCommandEvent); @@ -138,7 +142,8 @@ class AUDACITY_DLL_API UndoManager void SetLongDescription(unsigned int n, const wxString &desc); // These functions accept a callback that uses the state, - // and then they send to the project EVT_UNDO_RESET when that has finished. + // and then they send to the project EVT_UNDO_RESET or EVT_UNDO_OR_REDO when + // that has finished. using Consumer = std::function< void( const UndoState & ) >; void SetStateTo(unsigned int n, const Consumer &consumer); void Undo(const Consumer &consumer);