Article View: comp.sys.mac
Article #15020Re: MacApp's undo ability.
From: lsr
Date: Fri, 13 Mar 1987 02:34
Date: Fri, 13 Mar 1987 02:34
54 lines
2782 bytes
2782 bytes
In article <7932@watlion.UUCP> pgtrubey@watlion.UUCP writes:
>Somebody a while back mentioned something about extending MacApp
>to allow for multiple undo operations as opposed to just being
>able to undo the latest command.
>
>Is there a reason why this wasn't implemented in MacApp?
Mostly complexity of implementation in MacApp and complexity of programming
with that model. Also, there was no user interface defined for multiple
levels of Undo.
We tried to provide an Undo framework that could be extended to support
multiple-level Undo if a programmer wanted it. There are methods one could
override in order to save multiple command objects.
>The only problem that I see is when to <Commit> the commands. You could
>either allow a maximum undo stack, or you could commit commands only when
>something like a file save was being performed.
A lot depends on the implementation of the command.
Commit is usually implemented for commands that postpone changing the
internal data structures until the last minute. But the application
displays the data structure as if it had been changed.
For example, if you take an entire word processor document and change it to
bold, then it is impractical to remember all the previous style changes in
order to undo the command. Instead, you show the user the document as if it
was bold, but don't change the data structures until the command is
committed.
In the case of saving multiple commands, your application has to be able to
apply multiple changes to its data structures. (The user might have done
bold, then italic.)
If you only save a limited number of command objects, then you could call
Commit when one of the command objects "falls off the end", just before it
is freed.
One complication is that some operations (e.g., Save) would require that
all pending commands be committed. This is for convenience, since
committing all the commands brings the data structures up-to-date, so that
they can be written out to disk.
--
Larry Rosenstein
Object Specialist
Apple Computer
AppleLink: Rosenstein1
UUCP: {sun, voder, nsc, mtxinu, dual}!apple!lsr
CSNET: lsr@Apple.CSNET
Technical Details
Message-ID:
<531@apple.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!panda!genrad!decvax!decwrl!nsc!voder!apple!lsrReferences:
<7932@watlion.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!panda!genrad!decvax!decwrl!nsc!voder!apple!lsr From: lsr@apple.UUCP Newsgroups: comp.sys.mac Subject: Re: MacApp's undo ability. Message-ID: <531@apple.UUCP> Date: Thu, 12-Mar-87 21:34:10 EST Article-I.D.: apple.531 Posted: Thu Mar 12 21:34:10 1987 Date-Received: Sat, 14-Mar-87 00:17:36 EST References: <7932@watlion.UUCP> Reply-To: lsr@apple.UUCP (Larry Rosenstein) Distribution: comp Organization: Advanced Technology Group, Apple Computer Lines: 54