MG: improvements for fpc1.1

git-svn-id: trunk@3539 -
This commit is contained in:
lazarus 2002-10-23 11:45:30 +00:00
parent 4b80bf49f0
commit 5a82543198
2 changed files with 14 additions and 16 deletions

View File

@ -86,6 +86,7 @@ type
var Value: string); var Value: string);
procedure OnGlobalValuesChanged; procedure OnGlobalValuesChanged;
function GetMainCode(Code: TCodeBuffer): TCodeBuffer; function GetMainCode(Code: TCodeBuffer): TCodeBuffer;
procedure CreateScanner(Code: TCodeBuffer);
function InitCurCodeTool(Code: TCodeBuffer): boolean; function InitCurCodeTool(Code: TCodeBuffer): boolean;
function InitResourceTool: boolean; function InitResourceTool: boolean;
function FindCodeToolForSource(Code: TCodeBuffer): TCustomCodeTool; function FindCodeToolForSource(Code: TCodeBuffer): TCustomCodeTool;
@ -490,12 +491,17 @@ begin
Result:=SourceCache.LoadFile(Result.LastIncludedByFile); Result:=SourceCache.LoadFile(Result.LastIncludedByFile);
if Result=nil then exit; if Result=nil then exit;
end; end;
if FilenameHasSourceExt(Result.Filename) and (Result.Scanner=nil) then begin CreateScanner(Result);
end;
procedure TCodeToolManager.CreateScanner(Code: TCodeBuffer);
begin
if FilenameHasSourceExt(Code.Filename) and (Code.Scanner=nil) then begin
// create a scanner for the unit/program // create a scanner for the unit/program
Result.Scanner:=TLinkScanner.Create; Code.Scanner:=TLinkScanner.Create;
Result.Scanner.OnGetInitValues:=@OnScannerGetInitValues; Code.Scanner.OnGetInitValues:=@OnScannerGetInitValues;
Result.Scanner.OnSetGlobalWriteLock:=@OnToolSetWriteLock; Code.Scanner.OnSetGlobalWriteLock:=@OnToolSetWriteLock;
Result.Scanner.OnGetGlobalWriteLockInfo:=@OnToolGetWriteLockInfo; Code.Scanner.OnGetGlobalWriteLockInfo:=@OnToolGetWriteLockInfo;
end; end;
end; end;
@ -1610,7 +1616,6 @@ end;
function TCodeToolManager.GetCodeToolForSource(Code: TCodeBuffer; function TCodeToolManager.GetCodeToolForSource(Code: TCodeBuffer;
ExceptionOnError: boolean): TCustomCodeTool; ExceptionOnError: boolean): TCustomCodeTool;
// return a codetool for the source // return a codetool for the source
var MainCode: TCodeBuffer;
begin begin
Result:=nil; Result:=nil;
if Code=nil then begin if Code=nil then begin
@ -1621,14 +1626,7 @@ begin
end; end;
Result:=FindCodeToolForSource(Code); Result:=FindCodeToolForSource(Code);
if Result=nil then begin if Result=nil then begin
MainCode:=GetMainCode(Code); // create a scanner CreateScanner(Code);
if (MainCode<>Code) then begin
if ExceptionOnError then
raise Exception.Create('[TCodeToolManager.GetCodeToolForSource]'
+' the source "'+Code.Filename+'"'
+' is an include file of "'+MainCode.Filename+'"');
exit;
end;
if Code.Scanner=nil then begin if Code.Scanner=nil then begin
if ExceptionOnError then if ExceptionOnError then
raise Exception.CreateFmt(ctsNoScannerFound,[Code.Filename]); raise Exception.CreateFmt(ctsNoScannerFound,[Code.Filename]);

View File

@ -13,7 +13,7 @@
Author: Mattias Gaertner Author: Mattias Gaertner
Abstract: Abstract:
This unit defines the TObjectInspector which is a descendent of TCustomForm. This unit defines the TObjectInspector.
It uses TOIPropertyGrid and TOIPropertyGridRow which are also defined in this It uses TOIPropertyGrid and TOIPropertyGridRow which are also defined in this
unit. The object inspector uses property editors (see TPropertyEditor) to unit. The object inspector uses property editors (see TPropertyEditor) to
display and control properties, thus the object inspector is merely an display and control properties, thus the object inspector is merely an
@ -280,7 +280,7 @@ type
TOnSelectComponentInOI = procedure(AComponent:TComponent) of object; TOnSelectComponentInOI = procedure(AComponent:TComponent) of object;
TObjectInspector = class (TCustomForm) TObjectInspector = class (TForm)
AvailCompsComboBox: TComboBox; AvailCompsComboBox: TComboBox;
NoteBook:TNoteBook; NoteBook:TNoteBook;
PropertyGrid:TOIPropertyGrid; PropertyGrid:TOIPropertyGrid;