mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 17:39:23 +02:00
IDE: fixed storing IDE directives for build/run file
git-svn-id: trunk@48345 -
This commit is contained in:
parent
d40e78e415
commit
c180175375
24
ide/main.pp
24
ide/main.pp
@ -73,6 +73,7 @@ uses
|
||||
// codetools
|
||||
FileProcs, FindDeclarationTool, LinkScanner, BasicCodeTools, CodeToolsStructs,
|
||||
CodeToolManager, CodeCache, DefineTemplates, KeywordFuncLists, CodeTree,
|
||||
StdCodeTools,
|
||||
// synedit
|
||||
AllSynEdit, SynEditKeyCmds, SynEditMarks,
|
||||
// IDE interface
|
||||
@ -803,6 +804,8 @@ type
|
||||
function DoConfigBuildFile: TModalResult;
|
||||
function GetIDEDirectives(AnUnitInfo: TUnitInfo;
|
||||
DirectiveList: TStrings): TModalResult;
|
||||
function FilterIDEDirective(Tool: TStandardCodeTool;
|
||||
StartPos, {%H-}EndPos: integer): boolean;
|
||||
|
||||
// useful information methods
|
||||
procedure GetCurrentUnit(out ActiveSourceEditor: TSourceEditor;
|
||||
@ -7707,7 +7710,7 @@ begin
|
||||
if FilenameIsPascalSource(ActiveUnitInfo.Filename) then begin
|
||||
// parse source for IDE directives (i.e. % comments)
|
||||
CodeResult:=CodeToolBoss.SetIDEDirectives(ActiveUnitInfo.Source,
|
||||
DirectiveList);
|
||||
DirectiveList,@FilterIDEDirective);
|
||||
ApplyCodeToolChanges;
|
||||
if not CodeResult then begin
|
||||
DoJumpToCodeToolBossError;
|
||||
@ -7737,7 +7740,7 @@ begin
|
||||
Result:=mrCancel;
|
||||
if FilenameIsPascalSource(AnUnitInfo.Filename) then begin
|
||||
// parse source for IDE directives (i.e. % comments)
|
||||
CodeResult:=CodeToolBoss.GetIDEDirectives(AnUnitInfo.Source,DirectiveList);
|
||||
CodeResult:=CodeToolBoss.GetIDEDirectives(AnUnitInfo.Source,DirectiveList,@FilterIDEDirective);
|
||||
if not CodeResult then begin
|
||||
DoJumpToCodeToolBossError;
|
||||
exit;
|
||||
@ -7749,6 +7752,23 @@ begin
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
function TMainIDE.FilterIDEDirective(Tool: TStandardCodeTool; StartPos,
|
||||
EndPos: integer): boolean;
|
||||
var
|
||||
Src: PChar;
|
||||
d: TIDEDirective;
|
||||
begin
|
||||
Result:=false;
|
||||
Src:=@Tool.Src[StartPos];
|
||||
if (Src^<>'{') then exit;
|
||||
inc(Src);
|
||||
if (Src^<>'%') then exit;
|
||||
inc(Src);
|
||||
for d in TIDEDirective do
|
||||
if CompareIdentifiers(Src,PChar(IDEDirectiveNames[d]))=0 then
|
||||
exit(true);
|
||||
end;
|
||||
|
||||
function TMainIDE.DoConvertDFMtoLFM: TModalResult;
|
||||
var
|
||||
OpenDialog: TOpenDialog;
|
||||
|
Loading…
Reference in New Issue
Block a user