Re: Synchronising across multiple NSUndoManager stacks
Re: Synchronising across multiple NSUndoManager stacks
- Subject: Re: Synchronising across multiple NSUndoManager stacks
- From: Graham Cox <email@hidden>
- Date: Mon, 24 Mar 2008 14:52:04 +1100
Thanks for the considered reply, Jerry - much appreciated.
I hadn't thought of just using a global undo stack, and having tried
it, it's actually a pretty good solution. Obviously there are times
that the result of the undo targets a document other than the current
one and that can seem a bit confusing, but apart from that there are
no other obvious downsides. I might modify the menu strings to
indicate the target if it's not the current doc to help clarify it,
but that's a UI issue that can wait.
thanks!
------
S.O.S.
On 22 Mar 2008, at 4:15 pm, Jerry Krinock wrote:
On 2008 Mar, 21, at 17:50, Graham Cox wrote:
So the question is, is this a requirement that others have come
across and if so, how did you solve it?
Not exactly that requirement, but something like it: I've had to
deal with objects that can be moved among open documents. My
solution was to use one global undo stack, and also to clear the
stack whenever any document was closed.
It looks like all of your documents and objects live in the same
"globe". Therefore the global undo stack is the most natural
solution. With the Cocoa default scheme, each document having its
own undo stack, I even found it difficult to troubleshoot my undo
stacks because, as I user, when moving between documents, it was
hard for me to say what was ^expected^ behavior when I clicked
'Undo' while this document was active or 'Redo' while that document
was active. Whoa! But once I put everything into one undo stack,
even I could understand it.
Consider how often that Undo gets used. Then consider how much of
your time it is worth to handle all the pathological cases without
introducing bugs, and how many other spec requirements for really
useful features you need to meet before your deadline. If Undo/Redo
works as expected 90% of the time that the user wants it and is
grayed out for the other 10%, that may be good enough.
Probably a computer science guru would know for sure, but since none
of them have replied for over 4 hours I'll give you my opinion based
on engineering common-sense: Trying to solve the general 'Undo'
problem is difficult in theory and intractable in practice. Imagine
a multi-player networked computer game where, against the advice of
intellectuals, you directed your armies to invade another nation
five years ago, but now realize that the intellectuals were
correct. You see why games don't have 'Undo'.
Now, I see that you've considered a global Undo stack as your second
alternative, but I think you could simplify it even further, and
move on.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden