Mattias Gaertner wrote:

On Sun, 28 Jan 2007 11:50:47 -0200
Joao Morais <[EMAIL PROTECTED]> wrote:

Hello,

About changing source code, afaics I have access to an specific
source file using srceditorintf.SourceEditorWindow.SourceEditorIntfWithFileName('someunit.pas').

Inside the TSourceEditorInterface class I have tons of methods used
to change the sources. Please point out some hints that I can follow
to make safe changes to them.

They are safe. Maybe with the exception: Replacing text, moves source marks.

Let's say I need to include one line with "This new line" and remove three lines. I can use Position or Line+Column values.

The line need to be included between lines 5 and 6, or after the position 120.

The lines I need to remove are 12, 13 and 14 (now 13, 14 and 15 because of the new line). If using the Position approach, characters between position 250 and 300, including the last breakline (now between 264 and 314 because of the new line + #10).

About events, where should I look for beforecompile, aftersave and another ide events?

They don't exist yet.
What events do you need exactly?
'BeforeCompile' is too unspecific, because there are dozens actions
between pressing F9 and the real execution of the compiler (e.g. state
checks, auto saves, file checks, auto updates of resource files,
dependency checks, saves, builds, running before compilation tools).

I need to parse some units whenever:

1. the user choose to save the sources -- before or after save -- provided that what he is seeing in the editor is received by the parser;

2. before the project is going to be built by fpc, before or after checks and savings. A var parameter saying Abort: Boolean would be welcome, otherwise I can raise an exception if necessary.

Thanks,
--
Joao Morais

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

Reply via email to