Undo and Redo

Preamble

HeadCase features multi-level undo and redo like most advanced Windows applications. These allow one to revert changes that one has made during the current editing session. To undo a change, click the menu item Edit ... Undo or use the keyboard short-cut Ctrl-Z. To redo an undone change, click the menu item Edit ... Redo or use the keyboard short-cut Ctrl-Y. These menu items and short-cuts are Windows standard methods which should be familiar from other applications. When a file has been saved but not closed, Undo can still restore its previous state. When the file has been closed, the undo-redo chain is flushed and the previous state cannot be retrieved.

Developer's Notes

  • Cross-link problem with undo-redo - possibly not serialising the clsid?
  • Replace "ReplaceState?" with simple position shift.
  • Review behaviour at boundary conditions.
  • Possibly refactor down to a single common solution for navigation and undo-redo.
  • Use archives rather than strings if not already done; make sure they are using flyweight efficiently.
  • Change internal structure to a std::list
  • Review behaviour to find out why so few positions are cached and why initial state is not persisting
  • Do not pop initial state when queue exceeds maximum size - excise second instead