FROM : Dustin Voss
DATE : Mon Nov 18 07:25:38 2002
On Thursday, November 14, 2002, at 03:45 AM, Craig Bakalian wrote:
> Hi,
> Still coding away at my music notation app. I was just about finished
> the Data Model Classes when bam!, I realized I need redo and undo in
> the app. I went for a walk through the SKTDrawDocument in the
> Sketch.app. I think I understand how to register the selector and
> object with the NSUndoManager, yet in the Sketch.app I see this-
>
> - (void)insertGraphic:(SKTGraphic *)graphic atIndex:(unsigned)index {
> [[[self undoManager] prepareWithInvocationTarget:self]
> removeGraphicAtIndex:index];
> [_graphics insertObject:graphic atIndex:index];
> [graphic setDocument:self];
> [self invalidateGraphic:graphic];
> }
>
> This brings up many questions in my average IQ type head, firstly I
> can't find the instance or function definition of undoManager that
> [self undoManager] , so is this an inherited method? I am assuming that
> [self undoManager] is a getter. I mean, it has to be. So, were is the
> get, in NSDocument?
It is actually declared in NSResponder. NSDocument and NSWindow both
override NSResponder's implementation to return an NSUndoManager, but
NSWindow checks its delegate first, which (in a document window) will
be NSWindowController, and NSWindowController will check with its
NSDocument instance.
(Disclaimer: This is from memory, so I may be wrong.)
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Mon Nov 18 07:25:38 2002
On Thursday, November 14, 2002, at 03:45 AM, Craig Bakalian wrote:
> Hi,
> Still coding away at my music notation app. I was just about finished
> the Data Model Classes when bam!, I realized I need redo and undo in
> the app. I went for a walk through the SKTDrawDocument in the
> Sketch.app. I think I understand how to register the selector and
> object with the NSUndoManager, yet in the Sketch.app I see this-
>
> - (void)insertGraphic:(SKTGraphic *)graphic atIndex:(unsigned)index {
> [[[self undoManager] prepareWithInvocationTarget:self]
> removeGraphicAtIndex:index];
> [_graphics insertObject:graphic atIndex:index];
> [graphic setDocument:self];
> [self invalidateGraphic:graphic];
> }
>
> This brings up many questions in my average IQ type head, firstly I
> can't find the instance or function definition of undoManager that
> [self undoManager] , so is this an inherited method? I am assuming that
> [self undoManager] is a getter. I mean, it has to be. So, were is the
> get, in NSDocument?
It is actually declared in NSResponder. NSDocument and NSWindow both
override NSResponder's implementation to return an NSUndoManager, but
NSWindow checks its delegate first, which (in a document window) will
be NSWindowController, and NSWindowController will check with its
NSDocument instance.
(Disclaimer: This is from memory, so I may be wrong.)
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| Craig Bakalian | Nov 14, 12:45 | |
| Olivier | Nov 15, 15:54 | |
| Jeff Knee | Nov 15, 16:17 | |
| Dustin Voss | Nov 18, 07:25 |






Cocoa mail archive

