gemini
gemini copied to clipboard
Improve undo-redo
I made some improvements on the undo redo system:
- Allow to override a new protected method
Document.CreateUndoRedoManagerto change the implementation ofIUndoRedoManager. - Add method
IUndoRedoManager.PushActionto stack an action without executing it.- Interesting when the first action implementation (the "do") is different from the redo, or executed before the action is stacked (for example, a painting brush draw a line continuously but push an action only when the brush is not applied anymore).
- Fix
UndoRedoManager.UndoAllnot callingOnBeginandOnEnd. - Improve the History tool:
- Gray text for redo actions instead of undo actions. (more intuitive to see undone actions in gray)
- Selection synchronization fixed.
- Slider aligned on items.
- Text trimmed + tooltips when text is too long.
Update 23/07:
- Dispose
IUndoableAction(if they implement IDisposable) when they are removed from undo stack. It allows to free resources kept in case the action is undone/redone. - Dispose
IUndoRedoManagerwhen the document is closed to dispose all the IUndoableAction remaining in the stack.
