PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: David Kenny on November 12, 2009, 01:49:30 PM

Title: Undo/Redo in the forms designer?
Post by: David Kenny on November 12, 2009, 01:49:30 PM
I would like to be able to Undo additions, changes, moves, resizing and deletions of controls in the forms designer.  It would be similarly useful in the properties dialog (until it is closed at least). I know anything like this couldn't be considered for a while.  I'm in no hurry.  ;)

David
Title: Re: Undo/Redo in the forms designer?
Post by: Rolf Brandt on November 12, 2009, 07:49:21 PM
Not even in VB6 that was possible. I think that would be an enormous complexity.
Title: Re: Undo/Redo in the forms designer?
Post by: Michael Stefanik on November 12, 2009, 08:20:06 PM
Quote from: Rolf Brandt on November 12, 2009, 07:49:21 PM
Not even in VB6 that was possible. I think that would be an enormous complexity.

No doubt, but also keep in mind that VB6 is an IDE that's well over 10 years old. The current versions of Visual Studio fully support multiple levels of undo/redo when visually designing a form.
Title: Re: Undo/Redo in the forms designer?
Post by: David Kenny on November 12, 2009, 09:49:42 PM
QuoteNot even in VB6 that was possible. I think that would be an enormous complexity.

Rolf,  I am guessing you would agree that the word 'possible' in your statement should have been 'available'.  Unless you have some inside info? :)

From me:  only requests. 

Paul is always able to deny my requests for any reason.  I will still think highly of him!   ;D

David
Title: Re: Undo/Redo in the forms designer?
Post by: Rolf Brandt on November 13, 2009, 02:44:29 AM
Hi David,

you are of course right - available would be the more correct statement.

And of course these request and ideas are very essential for a product. They stimulate thinking and finally make a good product a better product. In my own commercial software products it was also my customers who came up with many ideas and features which I never would have thought of myself.

And finally - of course I would love to have a feature like that too!

When I made my comment I just thought that Paul created already a very comfortable environment. But we cannot expect to get all the tools, gadgets, and comfort we would find in Visual Studio. After all Paul is on himself, I don't know how big the Visual Studion developer team is. Also consider the price of the product and compare that especially against the new VS2010.

But never the less - ideas for new featiures are definitely always helpful, and I am pretty sure that Paul put this on the wish list. It was probably just my protective mother instinct (;-) that sparked my comment. I certainly did not want to offend you.

Rolf

Title: Re: Undo/Redo in the forms designer?
Post by: David Kenny on November 13, 2009, 01:51:27 PM
Rolf,

Honestly, I was never offended. I have thought a lot about what it would take to implement Undo/Redo in the GUI portion of the designer. It doesn't sound too difficult to me.  I understand however, that I didn't write the GUI and I don't know how it was implemented. It's obviously an after thought in this situation and therefor might require extensive reworking, or not. 

I would create a double-linked-list of actions:

Action Process
Addition   Save all the new attribues
Deletion   Save all the old attribues
Change   Save the original info and the new info

Then when processing Undo/Redo's:

Old Action   UndoRedo
Addition   DeleteAdd
Deletion   AddDelete
Change   Restore old info  Restore new info

Any additions, deletions or changes in the middle of the linked list (IOW, the user was Undoing before the action) result in the list being pruned past the current position and the new action being saved at the end.

All the actions can be in one list, or you could get fancy and keep a list for each control and the user would have to specify which control is being processed.

I know this is highly simplistic, but I think it's complete enough to see it could work.

David
Title: Re: Undo/Redo in the forms designer?
Post by: Paul Squires on November 13, 2009, 02:51:44 PM
Sounds like it could work. In practice though I wonder just how much overhead would be incurred. Just thinking out loud, but say that you have selected a group of 20 controls. Now you "nudge" that group a pixel at a time using the keyboard arrow keys. Every pixel movement would involve saving data and state information for 20 controls. Not saying it can't be done... I'm just wondering what kind of horsepower would be needed to make it seem snappy.
Title: Re: Undo/Redo in the forms designer?
Post by: David Kenny on November 13, 2009, 03:51:06 PM
I don't think you would be able to 'feel' the overhead for even dozens of controls (this is not VB :P).  We are just talking about maybe hundreds of bytes for each control? 

I think, however, I would replace the last undo with the new data, if the action and the controls were the same as the last one. The important part is the starting position and the final position.  If you wanted to, you could add a timer and decide that after 3 (could be any number you choose) seconds, you treat it as a separate - Undoable event. That way if you did repeating 'nudges' and paused to look at the results, you could keep the intermediate results in the Undo list.  But, to reiterate, 'nudging' a control 300 pixels to the right, should not produce 300 Undo entries. Only one, unless the there was a 'minimum' pause in there.

David