[lazarus] Form editing: Undo/Redo
Michael.VanCanneyt at Wisa.be
Michael.VanCanneyt at Wisa.be
Thu Jun 20 15:13:29 EDT 2002
On Thu, 20 Jun 2002, Mattias Gaertner wrote:
> On Thu, 20 Jun 2002 15:57:00 +0200 (W. Europe Daylight Time)
> Michael Van Canneyt <michael.vancanneyt at wisa.be> wrote:
>
> > > > >I want to implement Undo/Redo for the form editing, but I'm not sure how
> > > > >this should be done.
> > > > >Normally an undolist just keeps tracks of the changes. But for example
> > > > >moving a control can result in changing other controls and many other
> > > > >things. So, for a correct undo, one have to stream the form after every
> > > > >move/resize/add/delete/change property operation. Or is there a better way?
> > [...]
> > > Forms can contain images and I want undo/redo for at least 10 open forms and 100 steps and, as Martyn mentioned, for almost all kinds of form editing, not just like Delphi.
> > > The needed memory should be reduced by saving only the diffs between the streams. Does anybody know a unit for diffing/patching?
> >
> > The streaming method contains some functionality for streaming diffs.
> > The problem is that you need 2 instances of one object for this to work.
> > The 'root' object and the 'child' object.
> >
> > To produce a diff stream, it should be sufficient to have the 'root'
> > object as the form before the operation, and the child object as the
> > form after the operation. The streaming method should then only record
> > differences. (this is, BTW, how form inheritance works: root is the
> > parent form, and the child form is the descendent form).
>
> AFAIK this is only done for standard types.
Yes.
> The big data (e.g. images, nodes) is stored via DefineProperties,
> which seldom support ancestor comparison.
True.
> And I'm not sure if the ancestor technique can be used at all.
> We would need a copy to compare. And creating a copy means stream
> writing, stream reading, component creating and destroying the copy.
That is what I meant with the two copies. I didn't say it would be easy, I
just wanted to indicate that maybe this technique can be looked at.
Michael.
More information about the Lazarus
mailing list