On Mon, Jun 15, 2009 at 6:18 PM, Ryan Joseph<thealchemistgu...@gmail.com> wrote:
> I'm not sure I follow you. How do I know the user wants to undo and that it
> was in response to my change of the NSTextStorage? It seems like one way or
> another I need to keep a stack of changes with information on what operation
> they performed to the NSTextStorage. Thanks.

You already can.

Undo and Redo are typically view-centered operations.  That is, they
perform actions in response to things the user does with your views.
If they type into an NSTextView, the NSTextView ensures that, in
response to their typing, the undo stack is updated.

You're essentially assuming the role of NSTextView here.  Instead of
providing methods like -cut:, you're providing some method
-doCustomThing:.  -doCustomThing:, like -cut:, operates on the
NSTextStorage instance.  And just like Apple had to when they wrote
-cut:, you need to provide undo/redo support in your implementation of
-doCustomThing:.

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to