mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-02 17:09:26 +02:00
Consolidation of Undo items not limited to three
This commit is contained in:
parent
dc64fabe88
commit
63ae687baf
@ -61,7 +61,6 @@ UndoManager::UndoManager()
|
|||||||
{
|
{
|
||||||
current = -1;
|
current = -1;
|
||||||
saved = -1;
|
saved = -1;
|
||||||
consolidationCount = 0;
|
|
||||||
ResetODChangesFlag();
|
ResetODChangesFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,10 +256,9 @@ void UndoManager::PushState(const TrackList * l,
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
// If consolidate is set to true, group up to 3 identical operations.
|
if ( ((flags & UndoPush::CONSOLIDATE) != UndoPush::MINIMAL) &&
|
||||||
if (((flags & UndoPush::CONSOLIDATE) != UndoPush::MINIMAL) && lastAction == longDescription &&
|
lastAction == longDescription &&
|
||||||
consolidationCount < 2) {
|
mayConsolidate ) {
|
||||||
consolidationCount++;
|
|
||||||
ModifyState(l, selectedRegion, tags);
|
ModifyState(l, selectedRegion, tags);
|
||||||
// MB: If the "saved" state was modified by ModifyState, reset
|
// MB: If the "saved" state was modified by ModifyState, reset
|
||||||
// it so that UnsavedChanges returns true.
|
// it so that UnsavedChanges returns true.
|
||||||
@ -270,7 +268,7 @@ void UndoManager::PushState(const TrackList * l,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
consolidationCount = 0;
|
mayConsolidate = true;
|
||||||
|
|
||||||
i = current + 1;
|
i = current + 1;
|
||||||
while (i < stack.size()) {
|
while (i < stack.size()) {
|
||||||
@ -319,7 +317,7 @@ const UndoState &UndoManager::SetStateTo
|
|||||||
}
|
}
|
||||||
|
|
||||||
lastAction = wxT("");
|
lastAction = wxT("");
|
||||||
consolidationCount = 0;
|
mayConsolidate = false;
|
||||||
|
|
||||||
return stack[current]->state;
|
return stack[current]->state;
|
||||||
}
|
}
|
||||||
@ -333,7 +331,7 @@ const UndoState &UndoManager::Undo(SelectedRegion *selectedRegion)
|
|||||||
*selectedRegion = stack[current]->state.selectedRegion;
|
*selectedRegion = stack[current]->state.selectedRegion;
|
||||||
|
|
||||||
lastAction = wxT("");
|
lastAction = wxT("");
|
||||||
consolidationCount = 0;
|
mayConsolidate = false;
|
||||||
|
|
||||||
return stack[current]->state;
|
return stack[current]->state;
|
||||||
}
|
}
|
||||||
@ -360,7 +358,7 @@ const UndoState &UndoManager::Redo(SelectedRegion *selectedRegion)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
lastAction = wxT("");
|
lastAction = wxT("");
|
||||||
consolidationCount = 0;
|
mayConsolidate = false;
|
||||||
|
|
||||||
return stack[current]->state;
|
return stack[current]->state;
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,9 @@
|
|||||||
|
|
||||||
UndoManager can also automatically consolidate actions into
|
UndoManager can also automatically consolidate actions into
|
||||||
a single state change. If the "consolidate" argument to
|
a single state change. If the "consolidate" argument to
|
||||||
PushState is true, then up to 3 identical events in a row
|
PushState is true, then new changes may accumulate into the most
|
||||||
will result in one PushState and 2 ModifyStates.
|
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
|
Undo() temporarily moves down one state and returns the track
|
||||||
hierarchy. If another PushState is called, the redo information
|
hierarchy. If another PushState is called, the redo information
|
||||||
@ -143,7 +144,7 @@ class AUDACITY_DLL_API UndoManager {
|
|||||||
UndoStack stack;
|
UndoStack stack;
|
||||||
|
|
||||||
wxString lastAction;
|
wxString lastAction;
|
||||||
int consolidationCount;
|
bool mayConsolidate { false };
|
||||||
|
|
||||||
SpaceArray space;
|
SpaceArray space;
|
||||||
unsigned long long mClipboardSpaceUsage {};
|
unsigned long long mClipboardSpaceUsage {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user