Thanks.
My idea is that trash would be a simple list whose items would be pointers to (not really) deleted components.
When someone deletes any component then it will not be really deleted (like TButton.Free) but will stay created and pointer on it will be added to trash-list.
That may cause issues too:
Scenario Button1 and Button2; Button2's left side is anchored to Button1 (so the Anchorside has a pointer to button1)
When you delete button1, then the anchor must be removed.
AFAIK, that is done by "TComponent.Notification" (something automatically done, on destruction).
So if you do not destroy, then you have an invalid anchor.
And, independent of how you store the information, you must find such additional changes too, as undo should restore the anchor, I guess
Restoring component from trash is then similar to creating new component with at least three differencies:
1) Creating component is not necessary
2) Check if component's previous parent is still present
3) Check component's name duplicity.
Check for anchors, check inheritance (if frames are involved, or visual form inheritance..., check events, scheck duplicate event names, datasource dependencies, other links to other components ...
The list of dependencies is endless.
On the other hand, a system that undoes every step (across all forms), then that ensures that at the time of an undo, the entire state is exactly as it was at the time of the action (since all changes after the action were undone)
Advantage of this solution is that there is not necessary do any change with Source Editor.
How so?
Unless you leave the line
Button1: TButton;
If you delete button1, (even if you move it into a trash) you must remove this line.
so you must restore it on undo?
And thats another already existing issue. Any changes to the source, are part of SynEdits undo list (and must be, because synedit, stores undo in a way that requires them to be complete.
So if you press undo in the edit, you may just delete the line
Button1: TButton;
but the component remains.....
You can not exclude the insertion of this line from synedit's undo info, or you loose all undo from before....
So the final goal would have to be one single unified undo system across the entire IDE; or at least for each source and form together (but then you need to ensure that form undo does not fail on frames etc).
------------------
Of course not all of it has to be done in one step...
But you have to keep it in mind.