1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-17 08:17:59 +01:00

Some inversion of control flow when popping Undo state

This commit is contained in:
Paul Licameli
2018-02-16 14:49:26 -05:00
parent 2741d58880
commit 4f7d308ca3
4 changed files with 19 additions and 25 deletions

View File

@@ -300,8 +300,7 @@ void UndoManager::PushState(const TrackList * l,
lastAction = longDescription;
}
const UndoState &UndoManager::SetStateTo
(unsigned int n, SelectedRegion *selectedRegion)
void UndoManager::SetStateTo(unsigned int n, const Consumer &consumer)
{
n -= 1;
@@ -309,36 +308,30 @@ const UndoState &UndoManager::SetStateTo
current = n;
*selectedRegion = stack[current]->state.selectedRegion;
lastAction = wxT("");
mayConsolidate = false;
return stack[current]->state;
consumer( stack[current]->state );
}
const UndoState &UndoManager::Undo(SelectedRegion *selectedRegion)
void UndoManager::Undo(const Consumer &consumer)
{
wxASSERT(UndoAvailable());
current--;
*selectedRegion = stack[current]->state.selectedRegion;
lastAction = wxT("");
mayConsolidate = false;
return stack[current]->state;
consumer( stack[current]->state );
}
const UndoState &UndoManager::Redo(SelectedRegion *selectedRegion)
void UndoManager::Redo(const Consumer &consumer)
{
wxASSERT(RedoAvailable());
current++;
*selectedRegion = stack[current]->state.selectedRegion;
/*
if (!RedoAvailable()) {
*sel0 = stack[current]->sel0;
@@ -355,7 +348,7 @@ const UndoState &UndoManager::Redo(SelectedRegion *selectedRegion)
lastAction = wxT("");
mayConsolidate = false;
return stack[current]->state;
consumer( stack[current]->state );
}
bool UndoManager::UnsavedChanges()