UndoManager
UndoManager
- Subject: UndoManager
- From: Craig Bakalian <email@hidden>
- Date: Thu, 14 Nov 2002 06:45:28 -0500
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?
Also, I am trying to make the distinction between [[undoMangager
prepareWithInvocationTarget: self] someMethod: ], and [undoManager
registerUndoWithTarget: self selector:@selector( ) object: ]; Both
of these methods need to register the state that the object was in
before the edit, cut, copy, or paste occured, right? So, what is the
difference?
The above code really shows what is going on, because the
insertGraphics definition registers the undoManager to
removeGraphicsAtIndex.
Craig Bakalian
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.