[Lazarus] Undo/Redo in Form Designer

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Dec 16 15:29:38 CET 2012


On Sun, 16 Dec 2012 14:08:22 +0000
Martin <lazarus at mfriebe.de> wrote:

> On 16/12/2012 08:51, Juha Manninen wrote:
>[...]
> 1) Monitor all properties/ property editors. This allows to detect 
> changes to individual properties, made by the user. Such as name height, 
> caption, align, options....
> 
> This is not complete. Some properties may have side effects. hanging 
> anchors, can change positions. Setting an option may clear another 
> published property.
> Yet for step 1 those can be ignored. This is a huge topic and needs a 
> discussion off its own. Afaik the only way to detect those changes, is 
> to stream the entire form.

Yes. 
Note: Even those properties that do not have side effects might have
side effects in descendants of the component.

 
> 2) creation of new controls

With side effects: change of source, unit section, package list of
project.

 
> 3) deletion of controls (bringing it back, even with the wrong order is 
> already a step, but only if the code allows to fix that later)
> 
> 4) change Baseclass
> 
> 5) change z-order (afaik also creation order)
> 
> 6) .... (I am sure there is more)

It can become very complex. Snapshots are slow, but they would solve
most of the issues.

 
> ----
> Then it must record, whenever it makes changes to the editor. So they 
> can be undone too.

Yes. And the changes can spread over multiple syn edits.

 
> And eventually, when it makes changes to the editor, it must register 
> there, so the editor can send an event, if that change is undone by the 
> editors undo system (or redone).

Yes.

Mattias




More information about the Lazarus mailing list