Re: Undo - Redo?
Re: Undo - Redo?
- Subject: Re: Undo - Redo?
- From: Marcel Weiher <email@hidden>
- Date: Fri, 26 Apr 2002 16:28:50 +0200
On Friday, April 26, 2002, at 02:53 Uhr, Manfred Lippert wrote:
In a standard implementation of undo/redo, choosing undo invokes the
undo
action you registered, applying the original values that you
registered it
with, and then automatically moves the action from the undo stack to
the
redo stack. Then, when you choose redo, the action is invoked again ...
Actually, I don't think the last part is correct. It certainly doesn't
make sense to me, because a redo action cannot be derived from the undo
action. Take inserting a word. The undo action is to delete a range of
text. The 'redo' action must insert the word again, but that word is
not found in the undo action.
Instead, whatever 'action' is performed in the process of undoing has to
register undo-information just like any other action. In fact, there
shouldn't really be any difference, the "undo action" should be just a
normal action. The 'redo' is just the 'undo' information that was
registered while it was in the process of undoing.
Uhm? I think, here is my problem: My Undo Action is _not_ called when I
choose redo. Why can this be?
It shouldn't be, because you are trying to redo, not undo.
I am doing this in my document controller (subclass of NSDocument):
[[self undoManager]
registerUndoWithTarget:self
selector:@selector(undoAction:)
object:theObject];
If I do undo, my selector "undoAction" is called with the parameter
"theObject". This is correct and works.
Yes, but why is there a special action named "undoAction:"? This seems
suspicious to me.
But when I do redo after that, the action is _not_ called. Nothing
happens.
What happens in 'undoAction:'? Do you register an undo-action for what
you're doing there?
I don't know why. Do I have to do something special in my undoAction?
I think, the opposite is the case: you shouldn't even have a special
undoAction...
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
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.