1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 16:39:30 +02:00

Consolidation of Undo items not limited to three

This commit is contained in:
Paul Licameli 2017-05-18 08:59:52 -04:00
parent dc64fabe88
commit 63ae687baf
2 changed files with 11 additions and 12 deletions

View File

@ -61,7 +61,6 @@ UndoManager::UndoManager()
{
current = -1;
saved = -1;
consolidationCount = 0;
ResetODChangesFlag();
}
@ -257,10 +256,9 @@ void UndoManager::PushState(const TrackList * l,
{
unsigned int i;
// If consolidate is set to true, group up to 3 identical operations.
if (((flags & UndoPush::CONSOLIDATE) != UndoPush::MINIMAL) && lastAction == longDescription &&
consolidationCount < 2) {
consolidationCount++;
if ( ((flags & UndoPush::CONSOLIDATE) != UndoPush::MINIMAL) &&
lastAction == longDescription &&
mayConsolidate ) {
ModifyState(l, selectedRegion, tags);
// MB: If the "saved" state was modified by ModifyState, reset
// it so that UnsavedChanges returns true.
@ -270,7 +268,7 @@ void UndoManager::PushState(const TrackList * l,
return;
}
consolidationCount = 0;
mayConsolidate = true;
i = current + 1;
while (i < stack.size()) {
@ -319,7 +317,7 @@ const UndoState &UndoManager::SetStateTo
}
lastAction = wxT("");
consolidationCount = 0;
mayConsolidate = false;
return stack[current]->state;
}
@ -333,7 +331,7 @@ const UndoState &UndoManager::Undo(SelectedRegion *selectedRegion)
*selectedRegion = stack[current]->state.selectedRegion;
lastAction = wxT("");
consolidationCount = 0;
mayConsolidate = false;
return stack[current]->state;
}
@ -360,7 +358,7 @@ const UndoState &UndoManager::Redo(SelectedRegion *selectedRegion)
*/
lastAction = wxT("");
consolidationCount = 0;
mayConsolidate = false;
return stack[current]->state;
}

View File

@ -30,8 +30,9 @@
UndoManager can also automatically consolidate actions into
a single state change. If the "consolidate" argument to
PushState is true, then up to 3 identical events in a row
will result in one PushState and 2 ModifyStates.
PushState is true, then new changes may accumulate into the most
recent Undo state, if descriptions match and if no Undo or Redo or rollback
operation intervened since that state was pushed.
Undo() temporarily moves down one state and returns the track
hierarchy. If another PushState is called, the redo information
@ -143,7 +144,7 @@ class AUDACITY_DLL_API UndoManager {
UndoStack stack;
wxString lastAction;
int consolidationCount;
bool mayConsolidate { false };
SpaceArray space;
unsigned long long mClipboardSpaceUsage {};