Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-12

Undo for Form Designer

9 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Juha Manninen

Hi,

there are at least 2 request issues for undo feature for the form designer. I always dreamt of such a feature in Delphi but it still hasn't got one. In Lazarus it would be nice.

I guess other people have thought of it, too. How to implement it? Where to hook the code for undo? Maybe there is even experimental code for it somewhere. I would like to know about the detailed ideas if there are any.

I was browsing Lazarus source code. Designer, ControlSelection... Now I understand why you guys haven't documented the Lazarus internals. Object Pascal has so clear syntax that it doesn't need any documentation! I understood the code immediately when I looked at it! :-)
Ok, not quite. Some high level diagrams and other documents would help indeed. It is possible to understand the program logic from just the source by using editor's code browsing features, but it takes more time.

Regards,
Juha Manninen

Paul Ishenin
to Juha Manninen
Juha Manninen wrote
I was browsing Lazarus source code. Designer, ControlSelection... Now I understand why you guys haven't documented the Lazarus internals. Object Pascal has so clear syntax that it doesn't need any documentation! I understood the code immediately when I looked at it!

lol. No, just documentation costs time and human resources. And previosly we did not have (or they was not promoted) good tools for documenting.

To start lazarus code editing first download a copy from svn. And you need to edit designer.pp unit in the lazarus\designer directory. Good luck :)

Best regards,
Paul Ishenin.

Mattias Gaertner
to Juha Manninen: there are at least 2 request issues for undo feature for the form designer. I always…
Show quoted text 5 lines
Hi, there are at least 2 request issues for undo feature for the form designer. I always dreamt of such a feature in Delphi but it still hasn't got one. In Lazarus it would be nice.

True.

I guess other people have thought of it, too. How to implement it? Where to hook the code for undo? Maybe there is even experimental code for it somewhere. I would like to know about the detailed ideas if there are any.

There is no experimental code yet.

Notes:
Changing a property (e.g. Left) changes some other properties too and there is no hook. So for undo you must store the whole form plus the descendant forms plus the referenced forms plus the source changes. This costs much time and memory. For example with some images you easily get a megabyte.
So it would be unwise to create an undo step on every change.

Mattias

JoshyFun
to Mattias Gaertner

Hello Lazarus-List,

Thursday, December 31, 2009, 4:08:11 PM, you wrote:

MG> Notes:
MG> Changing a property (e.g. Left) changes some other properties too and MG> there is no hook. So for undo you must store the whole form plus the MG> descendant forms plus the referenced forms plus the source changes. This MG> costs much time and memory. For example with some images you easily get MG> a megabyte.
MG> So it would be unwise to create an undo step on every change.

It would be great to at least have 1 step undo, specially when you try to delete a visual object but the selected one is the container ;) Or maybe a container delete with objects inside should raise some kind of warning ?

Best regards, JoshyFun
Zaher Dirkey
to JoshyFun
JoshyFun wrote 17 lines
Hello Lazarus-List, Thursday, December 31, 2009, 4:08:11 PM, you wrote: MG> Notes: MG> Changing a property (e.g. Left) changes some other properties too and MG> there is no hook. So for undo you must store the whole form plus the MG> descendant forms plus the referenced forms plus the source changes. This MG> costs much time and memory. For example with some images you easily get MG> a megabyte. MG> So it would be unwise to create an undo step on every change. It would be great to at least have 1 step undo, specially when you try to delete a visual object but the selected one is the container ;) Or maybe a container delete with objects inside should raise some kind of warning ?

Only undo for Delete, Move, Size is enough with more than 1 steps.

Zaher Dirkey
Juha Manninen
to Mattias Gaertner: On Tue, 29 Dec 2009 00:53:03 +0200 True. There is no experimental code yet. Notes:…
Mattias Gaertner wrote 7 lines
Notes: Changing a property (e.g. Left) changes some other properties too and there is no hook. So for undo you must store the whole form plus the descendant forms plus the referenced forms plus the source changes. This costs much time and memory. For example with some images you easily get a megabyte. So it would be unwise to create an undo step on every change.

It should be possible to store only the changed properties, thus using less memory. A simple comparison with the previous state reveals the changes.

Descendant and referenced forms make it more complicated. I think they can't be ignored because the program could end up being broken otherwise.

Undo would be used mostly for Delete, Move and Size, as noted in other mails in this thread. Including binary images in the undo buffer sounds like an overkill. Such images are always loaded from an external image, they are not edited or created in the Form Designer.

My thought here were at "abstract" level because I don't know the code enough now to create anything concrete.

Regards,
Juha Manninen

Bogusław Brandys
to Juha Manninen

Juha Manninen pisze:

Show quoted text 33 lines
On torstai, 31. joulukuuta 2009 17:08:11 Mattias Gaertner wrote: > Notes: > Changing a property (e.g. Left) changes some other properties too and > there is no hook. So for undo you must store the whole form plus the > descendant forms plus the referenced forms plus the source changes. This > costs much time and memory. For example with some images you easily get > a megabyte. > So it would be unwise to create an undo step on every change. It should be possible to store only the changed properties, thus using less memory. A simple comparison with the previous state reveals the changes. Descendant and referenced forms make it more complicated. I think they can't be ignored because the program could end up being broken otherwise. Undo would be used mostly for Delete, Move and Size, as noted in other mails in this thread. Including binary images in the undo buffer sounds like an overkill. Such images are always loaded from an external image, they are not edited or created in the Form Designer. My thought here were at "abstract" level because I don't know the code enough now to create anything concrete. Regards, Juha Manninen -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Maybe it's overload but every state of project (every change to forms or config) could be stored in database like sqlite and reversed in one step.

Boguslaw

Juha Manninen
to Bogusław Brandys
Bogus?aw Brandys wrote
Maybe it's overload but every state of project (every change to forms or config) could be stored in database like sqlite and reversed in one step.

Internal memory objects should be enough for undo, just like with code editor.

Why does it say [!! SPAM] in the subject? Has there been spam coming from the same address before?

Regards,
Juha

Bogusław Brandys
to Juha Manninen

Juha Manninen pisze:

Show quoted text 12 lines
On maanantai, 4. tammikuuta 2010 14:07:13 Bogus?aw Brandys wrote: > Maybe it's overload but every state of project (every change to forms or > config) could be stored in database like sqlite and reversed in one step. Internal memory objects should be enough for undo, just like with code editor. Why does it say [!! SPAM] in the subject? Has there been spam coming from the same address before? Regards, Juha

Sorry,it's my AV program seem do not like Lazarus list :-)