Cocoa undo considerations
Cocoa undo considerations
- Subject: Cocoa undo considerations
- From: Raphael Sebbe <email@hidden>
- Date: Wed, 11 Jul 2001 20:34:21 +0200
Hi all,
I am currently looking into implementing undo support for my app.
Perhaps people who are familiar with undo could answer these questions :
- It should be implemented at the model (from MVC) level. Right ?
- NSUndoManager's -setActionName: should be invoked at the controller
level, as a single click in the GUI can make 10's of pushes on the undo
stack and having the last elementary action name would not make sense;
and only the controller knows what the GUI wants to do. Still OK ?
- Again regarding controllers : should those push an extra invocation
into the undo manager that tells which part of the GUI will need to
redisplay itself on undo ?
- Adding undo/redo to methods modifying objects is pretty
straightforward. But when a method removes (delete) an object, this
object should not be deallocated but instead stored in a "saved objects"
pool (ie, NSMutableArray), so that the invocations stored in the undo
manager stay valid. And that pool should be emptied when one wants to
get rid of the undo stack. Makes sense ?
- Are there other things to have in mind when implementing undo ?
Many thanks,
Raphael