Re: NSUndoManager and undo history
Re: NSUndoManager and undo history
- Subject: Re: NSUndoManager and undo history
- From: "John C. Randolph" <email@hidden>
- Date: Sun, 23 Apr 2006 00:22:54 -0700
On Apr 22, 2006, at 3:10 PM, David Catmull wrote:
I want to have a history window like Photoshop, which shows the
contents of the undo/redo stack and lets the user jump to any point
in the stack by clicking in the list. The basic problem is there
doesn't seem to be any way to access NSUndoManager's undo/redo stacks.
What would be cool would be to do this with bindings, where the
undo/redo stack is managed by an NSArrayController. The undo stack
would be in effect everything up to and including the current
selection, and the redo stack is everything after.
There are two ways to do that: either subclass NSUndoManager or
replace it. Subclassing means maintaining my own copy of the undo/
redo stack, which is error-prone. Replacing it is just plain a lot
of work.
Has anyone tackled this problem before? Is anyone interested in
tackling it with me?
I think that what you want is doable without replacing the undo
manager. Have an object that signs up for all the undo manager
notifications, and keeps a list of the strings returned by -
undoMenuItemTitle after each NSUndoManagerCheckpointNotification.
Then, to navigate among the states in the undo/redo stack, just send
the appropriate number of -undo or -redo messages to the undo manager.
-jcr
John C. Randolph <email@hidden> (408) 914-0013
Roaming Cocoa Engineer,
Available for your projects at great Expense and Inconvenience.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden