• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSUndoManager and undo history
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSUndoManager and undo history (From: David Catmull <email@hidden>)

  • Prev by Date: Re: Observing Core Data model changes
  • Next by Date: Re: Core Data / NSTableView Binding
  • Previous by thread: NSUndoManager and undo history
  • Next by thread: Observing Core Data model changes
  • Index(es):
    • Date
    • Thread