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);
procedure OnGlobalValuesChanged;
function GetMainCode(Code: TCodeBuffer): TCodeBuffer;
procedure CreateScanner(Code: TCodeBuffer);
function InitCurCodeTool(Code: TCodeBuffer): boolean;
function InitResourceTool: boolean;
function FindCodeToolForSource(Code: TCodeBuffer): TCustomCodeTool;
@ -490,12 +491,17 @@ begin
Result:=SourceCache.LoadFile(Result.LastIncludedByFile);
if Result=nil then exit;
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
Result.Scanner:=TLinkScanner.Create;
Result.Scanner.OnGetInitValues:=@OnScannerGetInitValues;
Result.Scanner.OnSetGlobalWriteLock:=@OnToolSetWriteLock;
Result.Scanner.OnGetGlobalWriteLockInfo:=@OnToolGetWriteLockInfo;
Code.Scanner:=TLinkScanner.Create;
Code.Scanner.OnGetInitValues:=@OnScannerGetInitValues;
Code.Scanner.OnSetGlobalWriteLock:=@OnToolSetWriteLock;
Code.Scanner.OnGetGlobalWriteLockInfo:=@OnToolGetWriteLockInfo;
end;
end;
@ -1610,7 +1616,6 @@ end;
function TCodeToolManager.GetCodeToolForSource(Code: TCodeBuffer;
ExceptionOnError: boolean): TCustomCodeTool;
// return a codetool for the source
var MainCode: TCodeBuffer;
begin
Result:=nil;
if Code=nil then begin
@ -1621,14 +1626,7 @@ begin
end;
Result:=FindCodeToolForSource(Code);
if Result=nil then begin
MainCode:=GetMainCode(Code); // create a scanner
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;
CreateScanner(Code);
if Code.Scanner=nil then begin
if ExceptionOnError then
raise Exception.CreateFmt(ctsNoScannerFound,[Code.Filename]);

View File

@ -13,7 +13,7 @@
Author: Mattias Gaertner
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
unit. The object inspector uses property editors (see TPropertyEditor) to
display and control properties, thus the object inspector is merely an
@ -280,7 +280,7 @@ type
TOnSelectComponentInOI = procedure(AComponent:TComponent) of object;
TObjectInspector = class (TCustomForm)
TObjectInspector = class (TForm)
AvailCompsComboBox: TComboBox;
NoteBook:TNoteBook;
PropertyGrid:TOIPropertyGrid;