[Lazarus] Undo/Redo in Form Designer
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Sun Dec 16 15:38:54 CET 2012
Alexander Klenin schrieb:
> I'd like to note that Alexander Strokach is my student, and I have
> given him this
> task as a course work assignment (which is a kind of lighter version
> of bachelor's thesis).
>
> 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 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).
When multiple files are modified, together or in sequence, then you have
decide about a common undo history, or one for every file. When e.g. a
PAS and DFM/LFM file have to be changed together, an Undo must revert
both at the same time. Delphi has a bulk change option, so that e.g. a
file wide search/replace can be undone in one go. Likewise changes to
multiple files can be considered as such one big step, consisting of a
number of changes. In the best case the user should have an choice to
undo all or only selected steps of such an big change. Just in case of
an form designer it would be fine to revert changes in the GUI only,
while retaining later changes to the related code.
IMO an Undo (history) list is the state of the art. E.g. Version Control
Systems are based on differences, but they may add snapshots of the last
file state(s) for better performance.
Also consider that the output of "diff" is usable in both directions, to
apply or revert the stored changes. Git e.g. offers to commit/revert
selected chunks of a file diff, at least at the top level ("amend last
commit"), and on selected files. It also allows to "cherry pick"
selected steps from a history, possibly of an different branch.
DoDi
More information about the Lazarus
mailing list