[Lazarus] Undo/Redo in Form Designer

Martin lazarus at mfriebe.de
Sun Dec 16 15:22:31 CET 2012


On 16/12/2012 11:21, Alexander Klenin wrote:
> We had quite a lot of discussion with him about the implementation method.
> I favored storing a series of snapshots too, while he preferred a
> "list of reversible actions" design.
>
> Main arguments were: storing snapshots is much simpler to implement
> and more reliable,
> while using a list of actions requires less memory
You can analyse/diff the snapshons, and store the diff, or even the 
action only whenever possible

>   and is similar to
> what SynEdit does, so should
> integrate better.
> (I am of the opinion that the IDE should have a common undo history
> for form designer and code editor).
>
> He went on and implemented his approach as a proof of concept, and
> after several iterations
> the code is working for some cases, but the complexity is indeed rather high.
> We have now reached a point where expert opinion is needed: is
> Alexander's approach viable,
> or should he abandon it and start from scratch?
>

As before, if you set align, it also changes anchors. Changing align 
back, may *not* restore the anchors.
For properties in the LCL (or even components that come with Lazarus it 
is possible to maintain a list. Though that adds maintenance, and 
permanent danger of the list being out-dated.
For 3rd party components no such list can be done. It is simply not 
known. They can even change the behaviour of some of the LCL properties.

So actions only will never be able to undo everything. Yet capturing 
them may have some value.
- It can be used as a trigger to take snapshots. Maybe snapshots can be 
taken on idle. (That however would mean that some steps would only have 
"action undo". And it needs to enssure, that a snapshot is taken at 
least every n actions. And IMHO even complex Forms will stream fast 
enough to be streamed always. Yet on Laptops this may considerable 
affect battery live. And 3rd party components could have slow code in 
the streaming.
- It can be used in order to "redo"








More information about the Lazarus mailing list