On Mon, 26 Sep 2005 11:31:57 -0300
Alexsander Rosa <[EMAIL PROTECTED]> wrote:

> I added a note on issue 1044:
> http://www.lazarus.freepascal.org/mantis/view.php?id=1044
> 
> As many new-comers, I am not familiar with the structure of the code.
> I have experience in software development, but lack the (unpaid) time
> to follow the code up and down to figure out where (i.e., in which
> line of which file) any changes should be made.
> 
> In this particular issue, it could be useful if someone familiar with
> the code just add an empty function (following some unwritten naming
> convention) as a place holder, with the right parameters. I am willing
> to test a function that receives a single source code (it's a
> TStringList or something like that?), does the clean up, then return
> the cleaned code, maybe in the same parameter, with the var keyword.

Thanks for the offer. 
It is a little bit more complicated.

1.a) If you simply exchange the whole source, all bookmarks would stay at
their old positions and therefore will wander off. 
1.b) A unit can consist of several files (e.g. controls.pp + control.inc +
wincontrol.inc ..).
1.c) You have to find the corresponding method declaration to delete. 
Gladfully the codetools already provide functions for these problems.
2.) The events must be removed from the form too. But this is already done.
We just have to keep the correct order.
3) There are people, who don't want their code auto deleted. I for example
save very often and found it very annoying, that Delphi deleted my newly
created code. So, this feature must be optional. -> IMO a good place for
this option is the codetools option dialog. Maybe on a new page.

My suggestion:
- first add an option to the codetools dialog. For delphi compatibility the
default can be 'on'.
- Then extend RemoveDanglingEvents in checklfmdlg.pas. 
  This is normally done this way:
  - Add a function to the TCodeToolManager (similar to
FindDanglingComponentEvents).
  - Add a function to the StdCodeTools.pas
  - parse the code
  - go through all methods 
    - test if empty
    - find the corresponding method declaration
    - mark the source parts for deletion
  - apply the changes
  - call the function at the beginning of RemoveDanglingEvents 
I will help you here.


Because this is done on every save, we must optimize it:
The deletion should only be executed, if the designer had added events.
The search for corresponding methods should not be a linear search.

Question:
- Should only published methods be auto deleted, or all empty methods?
Should empty procedures/functions be deletes too?


Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to