gemini icon indicating copy to clipboard operation
gemini copied to clipboard

Improve undo-redo

Open ReMinoer opened this issue 3 years ago • 0 comments

I made some improvements on the undo redo system:

  • Allow to override a new protected method Document.CreateUndoRedoManager to change the implementation of IUndoRedoManager.
  • Add method IUndoRedoManager.PushAction to 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.UndoAll not calling OnBegin and OnEnd.
  • 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 IUndoRedoManager when the document is closed to dispose all the IUndoableAction remaining in the stack.

MkLntrpzv3

ReMinoer avatar Jun 25 '22 19:06 ReMinoer