general undo methods?

Richard Gaskin ambassador at fourthworld.com
Sat Feb 19 13:57:57 EST 2005


Geoff Canyon wrote:
> I would store a list of transcript statements designed to undo/redo the 
> things you are doing. So if you move a rectangle to 100,300 I would get 
> the long id of the rectangle and do something like this:
> 
> put "set the loc of" && it && "to" && tNewLoc & cr after gRedoString
> put "set the loc of" && it && "to" && the loc of it & cr before gUndoString
> set the loc of it to tNewLoc
> 
> I did something like this for fields and found it to be remarkably fast 
> and efficient. The really great aspect is that you can undo/redo an 
> arbitrary number of steps with one command: do line 1 to 100 of 
> gUndoString undoes 100 steps, etc.

That's prettyt much where I'm headed now, but there's one aspect that's 
still problematic:  Rev's built-in undo for text editing operations is 
something I don't want to replicate.  For a single-level Undo it's easy 
enough to put a flag in the undo string to tell it to use the built-in 
undo command rather than any custom routine.  But how would one handle 
this for multi-level undo?


-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com


More information about the use-livecode mailing list