mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 16:39:30 +02:00
Distinguish another undo event type
This commit is contained in:
parent
06c9896498
commit
e17fc86c23
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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()
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user