gettingstarted
[Top] [All Lists]

Re: Undo engine

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Undo engine
From: Artly There <rb1 at artlythere dot com>
Date: Mon, 28 Feb 2005 17:36:34 -0500
Delivered-to: gettingstarted at lists dot realsoftware dot com
On Sunday, February 27, 2005, at 11:57  AM, RBNUBE wrote:

Thanks, Robert.

Unfortunately, it's not cross-platform.  I also looked at UndoToolkit
which is also not cross-platform. This is such a common feature of most
software, so I wonder why it's not easy to find plugins or classes.

Are most of you coding your own or not providing this feature?


What prevents it from working as cross-platform? Can it be altered? What is it that you are (usually) wishing to undo?

To answer your question...

Assuming I can get the rest of my very large app from another environs R&D'ed on over as to the workings, I'll be making an application specific one.

For a text editor I wrote in the other environs, I just shoved a copy of the current file off to disk (temp items folder) before each major edit and tracked the files in an array (via FSSpecs). That allowed for potentially unlimited undos, though I set it for 16 initially. I deleted any older ones when writing a new one, and loaded up the correct one as needed on an Undo/ReDo. The first undo/redo was always from RAM though. This kept the usual needs fast (though disk is not bad). You need to track free disk space with this setup, and check for locked volumes.

For my graphics app, I'll be storing things like selections or color/interface changes in an array, and offloading major bitmap edits into the Temporary Items or some other folder and reloading as needed like so...

For each Doc, I kept an array of Undo file FSSpec's (MacOS) . For each doc I kept an UndoPtr (pointer to the current array location) and each Undo/Redo would increment or decrement that UndoPtr.

As the last file was deleted, I'd just shuffle the items up a notch, and put in the new entry at the bottom (location (0) )

If multiple undo's were chosen, leaving one with a pointer at say item 5 out of a possible 10 items (10 was the oldest), and a new edit was begun, then the list was reset to start at the item 5, and the more recent bottom 0-4 thrown out...and then the array shuffled again. (or was it items 6-10) :) I forget. :)

The logic can get kind of convoluted, but as to implementing all this, it's fairly simple actually. Best to diagram it out perhaps. If your needs are not that huge, (undoing small edit fields all day ) then doing this in RAM would be the approach to use.

Robert


<snip>

On Saturday, February 26, 2005, at 06:27  PM, RBNUBE wrote:

Does anyone know of a good, cross-platform undo engine?

I don't know if it's cross platform (should be) but try this one:
<http://www.belle-nuit.com/realbasic/>

See the Undo Engine item.

Robert

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>