IDE: renamed lazdoc structures to codehelp

git-svn-id: trunk@13518 -
This commit is contained in:
mattias 2007-12-29 11:36:35 +00:00
parent c26a8750c8
commit e585e2ff74
4 changed files with 147 additions and 153 deletions

View File

@ -1,10 +1,4 @@
{ {
/***************************************************************************
LazDoc.pas
----------
***************************************************************************/
*************************************************************************** ***************************************************************************
* * * *
* This source is free software; you can redistribute it and/or modify * * This source is free software; you can redistribute it and/or modify *
@ -98,9 +92,9 @@ type
procedure EndUpdate; procedure EndUpdate;
end; end;
{ TLDSourceToFPDocFile - cache item for source to FPDoc file mapping } { TCHSourceToFPDocFile - cache item for source to FPDoc file mapping }
TLDSourceToFPDocFile = class TCHSourceToFPDocFile = class
public public
SourceFilename: string; SourceFilename: string;
FPDocFilename: string; FPDocFilename: string;
@ -108,9 +102,9 @@ type
FilesTimeStamp: integer; FilesTimeStamp: integer;
end; end;
{ TLazDocElement } { TCodeHelpElement }
TLazDocElement = class TCodeHelpElement = class
public public
CodeContext: TFindContext; CodeContext: TFindContext;
CodeXYPos: TCodeXYPosition; CodeXYPos: TCodeXYPosition;
@ -120,14 +114,14 @@ type
FPDocFile: TLazFPDocFile; FPDocFile: TLazFPDocFile;
end; end;
{ TLazDocElementChain } { TCodeHelpElementChain }
TLazDocElementChain = class TCodeHelpElementChain = class
private private
FItems: TFPList; // list of TLazDocElement FItems: TFPList; // list of TCodeHelpElement
function GetCount: integer; function GetCount: integer;
function GetItems(Index: integer): TLazDocElement; function GetItems(Index: integer): TCodeHelpElement;
function Add: TLazDocElement; function Add: TCodeHelpElement;
public public
CodePos: TCodePosition; CodePos: TCodePosition;
IDEChangeStep: integer; IDEChangeStep: integer;
@ -135,7 +129,7 @@ type
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
procedure Clear; procedure Clear;
property Items[Index: integer]: TLazDocElement read GetItems; default; property Items[Index: integer]: TCodeHelpElement read GetItems; default;
property Count: integer read GetCount; property Count: integer read GetCount;
function IndexOfFile(AFile: TLazFPDocFile): integer; function IndexOfFile(AFile: TLazFPDocFile): integer;
function IsValid: boolean; function IsValid: boolean;
@ -143,17 +137,17 @@ type
function DocFile: TLazFPDocFile; function DocFile: TLazFPDocFile;
end; end;
TLazDocChangeEvent = procedure(Sender: TObject; LazDocFPFile: TLazFPDocFile) of object; TCodeHelpChangeEvent = procedure(Sender: TObject; LazDocFPFile: TLazFPDocFile) of object;
TLazDocManagerHandler = ( TCodeHelpManagerHandler = (
ldmhDocChanging, chmhDocChanging,
ldmhDocChanged chmhDocChanged
); );
TLazDocParseResult = ( TCodeHelpParseResult = (
ldprParsing, // means: done a small step, but not yet finished the job chprParsing, // means: done a small step, but not yet finished the job
ldprFailed, chprFailed,
ldprSuccess chprSuccess
); );
{ TLazDocManager } { TLazDocManager }
@ -161,14 +155,14 @@ type
TCodeHelpManager = class TCodeHelpManager = class
private private
FDocs: TAvgLvlTree;// tree of loaded TLazFPDocFile FDocs: TAvgLvlTree;// tree of loaded TLazFPDocFile
FHandlers: array[TLazDocManagerHandler] of TMethodList; FHandlers: array[TCodeHelpManagerHandler] of TMethodList;
FSrcToDocMap: TAvgLvlTree; // tree of TLDSourceToFPDocFile sorted for SourceFilename FSrcToDocMap: TAvgLvlTree; // tree of TCHSourceToFPDocFile sorted for SourceFilename
FDeclarationCache: TDeclarationInheritanceCache; FDeclarationCache: TDeclarationInheritanceCache;
procedure AddHandler(HandlerType: TLazDocManagerHandler; procedure AddHandler(HandlerType: TCodeHelpManagerHandler;
const AMethod: TMethod; AsLast: boolean = false); const AMethod: TMethod; AsLast: boolean = false);
procedure RemoveHandler(HandlerType: TLazDocManagerHandler; procedure RemoveHandler(HandlerType: TCodeHelpManagerHandler;
const AMethod: TMethod); const AMethod: TMethod);
procedure CallDocChangeEvents(HandlerType: TLazDocManagerHandler; procedure CallDocChangeEvents(HandlerType: TCodeHelpManagerHandler;
Doc: TLazFPDocFile); Doc: TLazFPDocFile);
function DoCreateFPDocFileForSource(const SrcFilename: string): string; function DoCreateFPDocFileForSource(const SrcFilename: string): string;
function CreateFPDocFile(const ExpandedFilename, PackageName, function CreateFPDocFile(const ExpandedFilename, PackageName,
@ -196,35 +190,35 @@ type
CodeNode: TCodeTreeNode): string; CodeNode: TCodeTreeNode): string;
function GetFPDocNode(Tool: TCodeTool; CodeNode: TCodeTreeNode; Complete: boolean; function GetFPDocNode(Tool: TCodeTool; CodeNode: TCodeTreeNode; Complete: boolean;
out FPDocFile: TLazFPDocFile; out DOMNode: TDOMNode; out FPDocFile: TLazFPDocFile; out DOMNode: TDOMNode;
out CacheWasUsed: boolean): TLazDocParseResult; out CacheWasUsed: boolean): TCodeHelpParseResult;
function GetDeclarationChain(Code: TCodeBuffer; X, Y: integer; function GetDeclarationChain(Code: TCodeBuffer; X, Y: integer;
out ListOfPCodeXYPosition: TFPList; out ListOfPCodeXYPosition: TFPList;
out CacheWasUsed: boolean): TLazDocParseResult; out CacheWasUsed: boolean): TCodeHelpParseResult;
function GetCodeContext(CodePos: PCodeXYPosition; function GetCodeContext(CodePos: PCodeXYPosition;
out FindContext: TFindContext; out FindContext: TFindContext;
Complete: boolean; Complete: boolean;
out CacheWasUsed: boolean): TLazDocParseResult; out CacheWasUsed: boolean): TCodeHelpParseResult;
function GetElementChain(Code: TCodeBuffer; X, Y: integer; Complete: boolean; function GetElementChain(Code: TCodeBuffer; X, Y: integer; Complete: boolean;
out Chain: TLazDocElementChain; out Chain: TCodeHelpElementChain;
out CacheWasUsed: boolean): TLazDocParseResult; out CacheWasUsed: boolean): TCodeHelpParseResult;
function GetHint(Code: TCodeBuffer; X, Y: integer; Complete: boolean; function GetHint(Code: TCodeBuffer; X, Y: integer; Complete: boolean;
out Hint: string; out Hint: string;
out CacheWasUsed: boolean): TLazDocParseResult; out CacheWasUsed: boolean): TCodeHelpParseResult;
function CreateElement(Code: TCodeBuffer; X, Y: integer; function CreateElement(Code: TCodeBuffer; X, Y: integer;
out Element: TLazDocElement): Boolean; out Element: TCodeHelpElement): Boolean;
public public
// Event lists // Event lists
procedure RemoveAllHandlersOfObject(AnObject: TObject); procedure RemoveAllHandlersOfObject(AnObject: TObject);
procedure AddHandlerOnChanging(const OnDocChangingEvent: TLazDocChangeEvent; procedure AddHandlerOnChanging(const OnDocChangingEvent: TCodeHelpChangeEvent;
AsLast: boolean = false); AsLast: boolean = false);
procedure RemoveHandlerOnChanging(const OnDocChangingEvent: TLazDocChangeEvent); procedure RemoveHandlerOnChanging(const OnDocChangingEvent: TCodeHelpChangeEvent);
procedure AddHandlerOnChanged(const OnDocChangedEvent: TLazDocChangeEvent; procedure AddHandlerOnChanged(const OnDocChangedEvent: TCodeHelpChangeEvent;
AsLast: boolean = false); AsLast: boolean = false);
procedure RemoveHandlerOnChanged(const OnDocChangedEvent: TLazDocChangeEvent); procedure RemoveHandlerOnChanged(const OnDocChangedEvent: TCodeHelpChangeEvent);
end; end;
var var
LazDocBoss: TCodeHelpManager = nil;// set by the IDE CodeHelpBoss: TCodeHelpManager = nil;// set by the IDE
function CompareLazFPDocFilenames(Data1, Data2: Pointer): integer; function CompareLazFPDocFilenames(Data1, Data2: Pointer): integer;
function CompareAnsistringWithLazFPDocFile(Key, Data: Pointer): integer; function CompareAnsistringWithLazFPDocFile(Key, Data: Pointer): integer;
@ -273,13 +267,13 @@ end;
function CompareLDSrc2DocSrcFilenames(Data1, Data2: Pointer): integer; function CompareLDSrc2DocSrcFilenames(Data1, Data2: Pointer): integer;
begin begin
Result:=CompareFilenames(TLDSourceToFPDocFile(Data1).SourceFilename, Result:=CompareFilenames(TCHSourceToFPDocFile(Data1).SourceFilename,
TLDSourceToFPDocFile(Data2).SourceFilename); TCHSourceToFPDocFile(Data2).SourceFilename);
end; end;
function CompareAnsistringWithLDSrc2DocSrcFile(Key, Data: Pointer): integer; function CompareAnsistringWithLDSrc2DocSrcFile(Key, Data: Pointer): integer;
begin begin
Result:=CompareFilenames(AnsiString(Key),TLDSourceToFPDocFile(Data).SourceFilename); Result:=CompareFilenames(AnsiString(Key),TCHSourceToFPDocFile(Data).SourceFilename);
end; end;
{ TLazFPDocFile } { TLazFPDocFile }
@ -475,7 +469,7 @@ begin
if (ldffDocChangingCalled in FFlags) then exit; if (ldffDocChangingCalled in FFlags) then exit;
Include(FFlags,ldffDocChangingCalled); Include(FFlags,ldffDocChangingCalled);
end; end;
LazDocBoss.CallDocChangeEvents(ldmhDocChanging,Self); CodeHelpBoss.CallDocChangeEvents(chmhDocChanging,Self);
end; end;
procedure TLazFPDocFile.DocChanged; procedure TLazFPDocFile.DocChanged;
@ -485,7 +479,7 @@ begin
exit; exit;
end; end;
Exclude(FFlags,ldffDocChangedNeedsCalling); Exclude(FFlags,ldffDocChangedNeedsCalling);
LazDocBoss.CallDocChangeEvents(ldmhDocChanged,Self); CodeHelpBoss.CallDocChangeEvents(chmhDocChanged,Self);
end; end;
procedure TLazFPDocFile.BeginUpdate; procedure TLazFPDocFile.BeginUpdate;
@ -504,7 +498,7 @@ begin
end; end;
end; end;
procedure TCodeHelpManager.AddHandler(HandlerType: TLazDocManagerHandler; procedure TCodeHelpManager.AddHandler(HandlerType: TCodeHelpManagerHandler;
const AMethod: TMethod; AsLast: boolean); const AMethod: TMethod; AsLast: boolean);
begin begin
if FHandlers[HandlerType]=nil then if FHandlers[HandlerType]=nil then
@ -512,20 +506,20 @@ begin
FHandlers[HandlerType].Add(AMethod); FHandlers[HandlerType].Add(AMethod);
end; end;
procedure TCodeHelpManager.RemoveHandler(HandlerType: TLazDocManagerHandler; procedure TCodeHelpManager.RemoveHandler(HandlerType: TCodeHelpManagerHandler;
const AMethod: TMethod); const AMethod: TMethod);
begin begin
FHandlers[HandlerType].Remove(AMethod); FHandlers[HandlerType].Remove(AMethod);
end; end;
procedure TCodeHelpManager.CallDocChangeEvents(HandlerType: TLazDocManagerHandler; procedure TCodeHelpManager.CallDocChangeEvents(HandlerType: TCodeHelpManagerHandler;
Doc: TLazFPDocFile); Doc: TLazFPDocFile);
var var
i: LongInt; i: LongInt;
begin begin
i:=FHandlers[HandlerType].Count; i:=FHandlers[HandlerType].Count;
while FHandlers[HandlerType].NextDownIndex(i) do while FHandlers[HandlerType].NextDownIndex(i) do
TLazDocChangeEvent(FHandlers[HandlerType].Items[i])(Self,Doc); TCodeHelpChangeEvent(FHandlers[HandlerType].Items[i])(Self,Doc);
end; end;
function TCodeHelpManager.DoCreateFPDocFileForSource(const SrcFilename: string function TCodeHelpManager.DoCreateFPDocFileForSource(const SrcFilename: string
@ -781,7 +775,7 @@ begin
{$IFDEF VerboseLazDoc} {$IFDEF VerboseLazDoc}
DebugLn(['TLazDocManager.LoadFPDocFile parsing ',ADocFile.Filename]); DebugLn(['TLazDocManager.LoadFPDocFile parsing ',ADocFile.Filename]);
{$ENDIF} {$ENDIF}
CallDocChangeEvents(ldmhDocChanging,ADocFile); CallDocChangeEvents(chmhDocChanging,ADocFile);
// parse XML // parse XML
ADocFile.ChangeStep:=ADocFile.CodeBuffer.ChangeStep; ADocFile.ChangeStep:=ADocFile.CodeBuffer.ChangeStep;
@ -799,7 +793,7 @@ begin
if not Result then if not Result then
FreeAndNil(ADocFile.Doc); FreeAndNil(ADocFile.Doc);
MemStream.Free; MemStream.Free;
CallDocChangeEvents(ldmhDocChanging,ADocFile); CallDocChangeEvents(chmhDocChanging,ADocFile);
end; end;
end; end;
@ -937,7 +931,7 @@ var
var var
CodeBuf: TCodeBuffer; CodeBuf: TCodeBuffer;
AVLNode: TAvgLvlTreeNode; AVLNode: TAvgLvlTreeNode;
MapEntry: TLDSourceToFPDocFile; MapEntry: TCHSourceToFPDocFile;
begin begin
Result:=''; Result:='';
CacheWasUsed:=true; CacheWasUsed:=true;
@ -963,7 +957,7 @@ begin
AVLNode:=FSrcToDocMap.FindKey(Pointer(SrcFilename), AVLNode:=FSrcToDocMap.FindKey(Pointer(SrcFilename),
@CompareAnsistringWithLDSrc2DocSrcFile); @CompareAnsistringWithLDSrc2DocSrcFile);
if AVLNode<>nil then begin if AVLNode<>nil then begin
MapEntry:=TLDSourceToFPDocFile(AVLNode.Data); MapEntry:=TCHSourceToFPDocFile(AVLNode.Data);
if (MapEntry.FPDocFilenameTimeStamp=CompilerParseStamp) if (MapEntry.FPDocFilenameTimeStamp=CompilerParseStamp)
and (MapEntry.FilesTimeStamp=FileStateCache.TimeStamp) then begin and (MapEntry.FilesTimeStamp=FileStateCache.TimeStamp) then begin
Result:=MapEntry.FPDocFilename; Result:=MapEntry.FPDocFilename;
@ -992,7 +986,7 @@ begin
// save to cache // save to cache
if MapEntry=nil then begin if MapEntry=nil then begin
MapEntry:=TLDSourceToFPDocFile.Create; MapEntry:=TCHSourceToFPDocFile.Create;
MapEntry.SourceFilename:=SrcFilename; MapEntry.SourceFilename:=SrcFilename;
FSrcToDocMap.Add(MapEntry); FSrcToDocMap.Add(MapEntry);
end; end;
@ -1036,7 +1030,7 @@ end;
function TCodeHelpManager.GetFPDocNode(Tool: TCodeTool; CodeNode: TCodeTreeNode; function TCodeHelpManager.GetFPDocNode(Tool: TCodeTool; CodeNode: TCodeTreeNode;
Complete: boolean; out FPDocFile: TLazFPDocFile; out DOMNode: TDOMNode; Complete: boolean; out FPDocFile: TLazFPDocFile; out DOMNode: TDOMNode;
out CacheWasUsed: boolean): TLazDocParseResult; out CacheWasUsed: boolean): TCodeHelpParseResult;
var var
SrcFilename: String; SrcFilename: String;
FPDocFilename: String; FPDocFilename: String;
@ -1049,44 +1043,44 @@ begin
// find corresponding FPDoc file // find corresponding FPDoc file
SrcFilename:=Tool.MainFilename; SrcFilename:=Tool.MainFilename;
FPDocFilename:=GetFPDocFilenameForSource(SrcFilename,false,CacheWasUsed); FPDocFilename:=GetFPDocFilenameForSource(SrcFilename,false,CacheWasUsed);
if FPDocFilename='' then exit(ldprFailed); if FPDocFilename='' then exit(chprFailed);
if (not CacheWasUsed) and (not Complete) then exit(ldprParsing); if (not CacheWasUsed) and (not Complete) then exit(chprParsing);
// load FPDoc file // load FPDoc file
if not LoadFPDocFile(FPDocFilename,true,false,FPDocFile,CacheWasUsed) then if not LoadFPDocFile(FPDocFilename,true,false,FPDocFile,CacheWasUsed) then
exit(ldprFailed); exit(chprFailed);
if (not CacheWasUsed) and (not Complete) then exit(ldprParsing); if (not CacheWasUsed) and (not Complete) then exit(chprParsing);
// find FPDoc node // find FPDoc node
ElementName:=CodeNodeToElementName(Tool,CodeNode); ElementName:=CodeNodeToElementName(Tool,CodeNode);
if ElementName='' then exit(ldprFailed); if ElementName='' then exit(chprFailed);
DOMNode:=FPDocFile.GetElementWithName(ElementName); DOMNode:=FPDocFile.GetElementWithName(ElementName);
if DOMNode=nil then exit(ldprFailed); if DOMNode=nil then exit(chprFailed);
Result:=ldprSuccess; Result:=chprSuccess;
end; end;
function TCodeHelpManager.GetDeclarationChain(Code: TCodeBuffer; X, Y: integer; function TCodeHelpManager.GetDeclarationChain(Code: TCodeBuffer; X, Y: integer;
out ListOfPCodeXYPosition: TFPList; out CacheWasUsed: boolean out ListOfPCodeXYPosition: TFPList; out CacheWasUsed: boolean
): TLazDocParseResult; ): TCodeHelpParseResult;
begin begin
if FDeclarationCache.FindDeclarations(Code,X,Y,ListOfPCodeXYPosition, if FDeclarationCache.FindDeclarations(Code,X,Y,ListOfPCodeXYPosition,
CacheWasUsed) CacheWasUsed)
then then
Result:=ldprSuccess Result:=chprSuccess
else else
Result:=ldprFailed; Result:=chprFailed;
end; end;
function TCodeHelpManager.GetCodeContext(CodePos: PCodeXYPosition; out function TCodeHelpManager.GetCodeContext(CodePos: PCodeXYPosition; out
FindContext: TFindContext; Complete: boolean; out CacheWasUsed: boolean FindContext: TFindContext; Complete: boolean; out CacheWasUsed: boolean
): TLazDocParseResult; ): TCodeHelpParseResult;
var var
CurTool: TCodeTool; CurTool: TCodeTool;
CleanPos: integer; CleanPos: integer;
Node: TCodeTreeNode; Node: TCodeTreeNode;
begin begin
Result:=ldprFailed; Result:=chprFailed;
FindContext:=CleanFindContext; FindContext:=CleanFindContext;
CacheWasUsed:=true; CacheWasUsed:=true;
@ -1134,17 +1128,17 @@ begin
// success // success
FindContext.Tool:=CurTool; FindContext.Tool:=CurTool;
FindContext.Node:=Node; FindContext.Node:=Node;
Result:=ldprSuccess; Result:=chprSuccess;
end; end;
function TCodeHelpManager.GetElementChain(Code: TCodeBuffer; X, Y: integer; function TCodeHelpManager.GetElementChain(Code: TCodeBuffer; X, Y: integer;
Complete: boolean; out Chain: TLazDocElementChain; out CacheWasUsed: boolean Complete: boolean; out Chain: TCodeHelpElementChain; out CacheWasUsed: boolean
): TLazDocParseResult; ): TCodeHelpParseResult;
var var
ListOfPCodeXYPosition: TFPList; ListOfPCodeXYPosition: TFPList;
i: Integer; i: Integer;
CodePos: PCodeXYPosition; CodePos: PCodeXYPosition;
LDElement: TLazDocElement; LDElement: TCodeHelpElement;
SrcFilename: String; SrcFilename: String;
FPDocFilename: String; FPDocFilename: String;
FindContext: TFindContext; FindContext: TFindContext;
@ -1155,15 +1149,15 @@ begin
//DebugLn(['TLazDocManager.GetElementChain GetDeclarationChain...']); //DebugLn(['TLazDocManager.GetElementChain GetDeclarationChain...']);
// get the declaration chain // get the declaration chain
Result:=GetDeclarationChain(Code,X,Y,ListOfPCodeXYPosition,CacheWasUsed); Result:=GetDeclarationChain(Code,X,Y,ListOfPCodeXYPosition,CacheWasUsed);
if Result<>ldprSuccess then exit; if Result<>chprSuccess then exit;
if (not CacheWasUsed) and (not Complete) then exit(ldprParsing); if (not CacheWasUsed) and (not Complete) then exit(chprParsing);
{$IFDEF VerboseLazDoc} {$IFDEF VerboseLazDoc}
DebugLn(['TLazDocManager.GetElementChain init the element chain: ListOfPCodeXYPosition.Count=',ListOfPCodeXYPosition.Count,' ...']); DebugLn(['TLazDocManager.GetElementChain init the element chain: ListOfPCodeXYPosition.Count=',ListOfPCodeXYPosition.Count,' ...']);
{$ENDIF} {$ENDIF}
// init the element chain // init the element chain
Result:=ldprParsing; Result:=chprParsing;
Chain:=TLazDocElementChain.Create; Chain:=TCodeHelpElementChain.Create;
Chain.CodePos.Code:=Code; Chain.CodePos.Code:=Code;
Chain.MakeValid; Chain.MakeValid;
Code.LineColToPosition(Y,X,Chain.CodePos.P); Code.LineColToPosition(Y,X,Chain.CodePos.P);
@ -1172,9 +1166,9 @@ begin
// get source position of declaration // get source position of declaration
CodePos:=PCodeXYPosition(ListOfPCodeXYPosition[i]); CodePos:=PCodeXYPosition(ListOfPCodeXYPosition[i]);
Result:=GetCodeContext(CodePos,FindContext,Complete,CacheWasUsed); Result:=GetCodeContext(CodePos,FindContext,Complete,CacheWasUsed);
if Result=ldprFailed then continue; // skip invalid contexts if Result=chprFailed then continue; // skip invalid contexts
if Result<>ldprSuccess then continue; if Result<>chprSuccess then continue;
if (not CacheWasUsed) and (not Complete) then exit(ldprParsing); if (not CacheWasUsed) and (not Complete) then exit(chprParsing);
// add element // add element
LDElement:=Chain.Add; LDElement:=Chain.Add;
@ -1186,13 +1180,13 @@ begin
SrcFilename:=LDElement.CodeContext.Tool.MainFilename; SrcFilename:=LDElement.CodeContext.Tool.MainFilename;
FPDocFilename:=GetFPDocFilenameForSource(SrcFilename,false,CacheWasUsed); FPDocFilename:=GetFPDocFilenameForSource(SrcFilename,false,CacheWasUsed);
//DebugLn(['TLazDocManager.GetElementChain FPDocFilename=',FPDocFilename]); //DebugLn(['TLazDocManager.GetElementChain FPDocFilename=',FPDocFilename]);
if (not CacheWasUsed) and (not Complete) then exit(ldprParsing); if (not CacheWasUsed) and (not Complete) then exit(chprParsing);
if FPDocFilename<>'' then begin if FPDocFilename<>'' then begin
// load FPDoc file // load FPDoc file
LoadFPDocFile(FPDocFilename,true,false,LDElement.FPDocFile, LoadFPDocFile(FPDocFilename,true,false,LDElement.FPDocFile,
CacheWasUsed); CacheWasUsed);
if (not CacheWasUsed) and (not Complete) then exit(ldprParsing); if (not CacheWasUsed) and (not Complete) then exit(chprParsing);
end; end;
end; end;
@ -1212,38 +1206,38 @@ begin
//DebugLn(['TLazDocManager.GetElementChain ElementNode=',LDElement.ElementNode<>nil]); //DebugLn(['TLazDocManager.GetElementChain ElementNode=',LDElement.ElementNode<>nil]);
end; end;
Result:=ldprSuccess; Result:=chprSuccess;
finally finally
if Result<>ldprSuccess then if Result<>chprSuccess then
FreeAndNil(Chain); FreeAndNil(Chain);
end; end;
end; end;
function TCodeHelpManager.GetHint(Code: TCodeBuffer; X, Y: integer; function TCodeHelpManager.GetHint(Code: TCodeBuffer; X, Y: integer;
Complete: boolean; out Hint: string; out CacheWasUsed: boolean Complete: boolean; out Hint: string; out CacheWasUsed: boolean
): TLazDocParseResult; ): TCodeHelpParseResult;
function EndNow(var LastResult: TLazDocParseResult): boolean; function EndNow(var LastResult: TCodeHelpParseResult): boolean;
begin begin
if LastResult<>ldprSuccess then begin if LastResult<>chprSuccess then begin
Result:=true; Result:=true;
if Hint<>'' then if Hint<>'' then
LastResult:=ldprSuccess LastResult:=chprSuccess
else else
LastResult:=ldprFailed; LastResult:=chprFailed;
exit; exit;
end; end;
if (not CacheWasUsed) and (not Complete) then begin if (not CacheWasUsed) and (not Complete) then begin
Result:=true; Result:=true;
LastResult:=ldprParsing; LastResult:=chprParsing;
end; end;
Result:=false; Result:=false;
end; end;
var var
Chain: TLazDocElementChain; Chain: TCodeHelpElementChain;
i: Integer; i: Integer;
Item: TLazDocElement; Item: TCodeHelpElement;
NodeValues: TFPDocElementValues; NodeValues: TFPDocElementValues;
f: TFPDocItem; f: TFPDocItem;
ListOfPCodeXYPosition: TFPList; ListOfPCodeXYPosition: TFPList;
@ -1314,7 +1308,7 @@ begin
end; end;
end; end;
end; end;
Result:=ldprSuccess; Result:=chprSuccess;
finally finally
FreeListOfPCodeXYPosition(ListOfPCodeXYPosition); FreeListOfPCodeXYPosition(ListOfPCodeXYPosition);
Chain.Free; Chain.Free;
@ -1324,7 +1318,7 @@ begin
end; end;
function TCodeHelpManager.CreateElement(Code: TCodeBuffer; X, Y: integer; function TCodeHelpManager.CreateElement(Code: TCodeBuffer; X, Y: integer;
out Element: TLazDocElement): Boolean; out Element: TCodeHelpElement): Boolean;
var var
CacheWasUsed: boolean; CacheWasUsed: boolean;
SrcFilename: String; SrcFilename: String;
@ -1338,14 +1332,14 @@ begin
end; end;
DebugLn(['TLazDocManager.CreateElement START ',Code.Filename,' ',X,',',Y]); DebugLn(['TLazDocManager.CreateElement START ',Code.Filename,' ',X,',',Y]);
Element:=TLazDocElement.Create; Element:=TCodeHelpElement.Create;
try try
// check if code context can have a fpdoc element // check if code context can have a fpdoc element
Element.CodeXYPos.Code:=Code; Element.CodeXYPos.Code:=Code;
Element.CodeXYPos.X:=X; Element.CodeXYPos.X:=X;
Element.CodeXYPos.Y:=Y; Element.CodeXYPos.Y:=Y;
if GetCodeContext(@Element.CodeXYPos,Element.CodeContext,true, if GetCodeContext(@Element.CodeXYPos,Element.CodeContext,true,
CacheWasUsed)<>ldprSuccess then CacheWasUsed)<>chprSuccess then
begin begin
DebugLn(['TLazDocManager.CreateElement GetCodeContext failed for ',Code.Filename,' ',X,',',Y]); DebugLn(['TLazDocManager.CreateElement GetCodeContext failed for ',Code.Filename,' ',X,',',Y]);
exit; exit;
@ -1385,7 +1379,7 @@ var
begin begin
AVLNode:=FDocs.FindLowest; AVLNode:=FDocs.FindLowest;
while AVLNode<>nil do begin while AVLNode<>nil do begin
CallDocChangeEvents(ldmhDocChanging,TLazFPDocFile(AVLNode.Data)); CallDocChangeEvents(chmhDocChanging,TLazFPDocFile(AVLNode.Data));
AVLNode:=FDocs.FindSuccessor(AVLNode); AVLNode:=FDocs.FindSuccessor(AVLNode);
end; end;
FDocs.FreeAndClear; FDocs.FreeAndClear;
@ -1398,68 +1392,68 @@ end;
procedure TCodeHelpManager.RemoveAllHandlersOfObject(AnObject: TObject); procedure TCodeHelpManager.RemoveAllHandlersOfObject(AnObject: TObject);
var var
HandlerType: TLazDocManagerHandler; HandlerType: TCodeHelpManagerHandler;
begin begin
for HandlerType:=Low(TLazDocManagerHandler) to High(TLazDocManagerHandler) do for HandlerType:=Low(TCodeHelpManagerHandler) to High(TCodeHelpManagerHandler) do
FHandlers[HandlerType].RemoveAllMethodsOfObject(AnObject); FHandlers[HandlerType].RemoveAllMethodsOfObject(AnObject);
end; end;
procedure TCodeHelpManager.AddHandlerOnChanging( procedure TCodeHelpManager.AddHandlerOnChanging(
const OnDocChangingEvent: TLazDocChangeEvent; AsLast: boolean); const OnDocChangingEvent: TCodeHelpChangeEvent; AsLast: boolean);
begin begin
AddHandler(ldmhDocChanging,TMethod(OnDocChangingEvent),AsLast); AddHandler(chmhDocChanging,TMethod(OnDocChangingEvent),AsLast);
end; end;
procedure TCodeHelpManager.RemoveHandlerOnChanging( procedure TCodeHelpManager.RemoveHandlerOnChanging(
const OnDocChangingEvent: TLazDocChangeEvent); const OnDocChangingEvent: TCodeHelpChangeEvent);
begin begin
RemoveHandler(ldmhDocChanging,TMethod(OnDocChangingEvent)); RemoveHandler(chmhDocChanging,TMethod(OnDocChangingEvent));
end; end;
procedure TCodeHelpManager.AddHandlerOnChanged( procedure TCodeHelpManager.AddHandlerOnChanged(
const OnDocChangedEvent: TLazDocChangeEvent; AsLast: boolean); const OnDocChangedEvent: TCodeHelpChangeEvent; AsLast: boolean);
begin begin
AddHandler(ldmhDocChanged,TMethod(OnDocChangedEvent),AsLast); AddHandler(chmhDocChanged,TMethod(OnDocChangedEvent),AsLast);
end; end;
procedure TCodeHelpManager.RemoveHandlerOnChanged( procedure TCodeHelpManager.RemoveHandlerOnChanged(
const OnDocChangedEvent: TLazDocChangeEvent); const OnDocChangedEvent: TCodeHelpChangeEvent);
begin begin
RemoveHandler(ldmhDocChanged,TMethod(OnDocChangedEvent)); RemoveHandler(chmhDocChanged,TMethod(OnDocChangedEvent));
end; end;
{ TLazDocElementChain } { TCodeHelpElementChain }
function TLazDocElementChain.GetCount: integer; function TCodeHelpElementChain.GetCount: integer;
begin begin
Result:=FItems.Count; Result:=FItems.Count;
end; end;
function TLazDocElementChain.GetItems(Index: integer): TLazDocElement; function TCodeHelpElementChain.GetItems(Index: integer): TCodeHelpElement;
begin begin
Result:=TLazDocElement(FItems[Index]); Result:=TCodeHelpElement(FItems[Index]);
end; end;
function TLazDocElementChain.Add: TLazDocElement; function TCodeHelpElementChain.Add: TCodeHelpElement;
begin begin
Result:=TLazDocElement.Create; Result:=TCodeHelpElement.Create;
FItems.Add(Result); FItems.Add(Result);
end; end;
constructor TLazDocElementChain.Create; constructor TCodeHelpElementChain.Create;
begin begin
FItems:=TFPList.Create; FItems:=TFPList.Create;
end; end;
destructor TLazDocElementChain.Destroy; destructor TCodeHelpElementChain.Destroy;
begin begin
Clear; Clear;
FreeAndNil(FItems); FreeAndNil(FItems);
inherited Destroy; inherited Destroy;
end; end;
procedure TLazDocElementChain.Clear; procedure TCodeHelpElementChain.Clear;
var var
i: Integer; i: Integer;
begin begin
@ -1467,7 +1461,7 @@ begin
FItems.Clear; FItems.Clear;
end; end;
function TLazDocElementChain.IndexOfFile(AFile: TLazFPDocFile): integer; function TCodeHelpElementChain.IndexOfFile(AFile: TLazFPDocFile): integer;
begin begin
Result:=FItems.Count-1; Result:=FItems.Count-1;
while (Result>=0) do begin while (Result>=0) do begin
@ -1476,19 +1470,19 @@ begin
end; end;
end; end;
function TLazDocElementChain.IsValid: boolean; function TCodeHelpElementChain.IsValid: boolean;
begin begin
Result:=(IDEChangeStep=CompilerParseStamp) Result:=(IDEChangeStep=CompilerParseStamp)
and (CodetoolsChangeStep=CodeToolBoss.CodeTreeNodesDeletedStep); and (CodetoolsChangeStep=CodeToolBoss.CodeTreeNodesDeletedStep);
end; end;
procedure TLazDocElementChain.MakeValid; procedure TCodeHelpElementChain.MakeValid;
begin begin
IDEChangeStep:=CompilerParseStamp; IDEChangeStep:=CompilerParseStamp;
CodetoolsChangeStep:=CodeToolBoss.CodeTreeNodesDeletedStep; CodetoolsChangeStep:=CodeToolBoss.CodeTreeNodesDeletedStep;
end; end;
function TLazDocElementChain.DocFile: TLazFPDocFile; function TCodeHelpElementChain.DocFile: TLazFPDocFile;
begin begin
Result:=nil; Result:=nil;
if (Count>0) then if (Count>0) then

View File

@ -112,20 +112,20 @@ type
FFlags: TLazDocFormFlags; FFlags: TLazDocFormFlags;
fUpdateLock: Integer; fUpdateLock: Integer;
fSourceFilename: string; fSourceFilename: string;
fChain: TLazDocElementChain; fChain: TCodeHelpElementChain;
function GetDoc: TXMLdocument; function GetDoc: TXMLdocument;
function GetDocFile: TLazFPDocFile; function GetDocFile: TLazFPDocFile;
function GetSourceFilename: string; function GetSourceFilename: string;
function GetFirstElement: TDOMNode; function GetFirstElement: TDOMNode;
function GetContextTitle(Element: TLazDocElement): string; function GetContextTitle(Element: TCodeHelpElement): string;
function MakeLink: String; function MakeLink: String;
function FindInheritedIndex: integer; function FindInheritedIndex: integer;
procedure Save; procedure Save;
function GetValues: TFPDocElementValues; function GetValues: TFPDocElementValues;
procedure SetModified(const AValue: boolean); procedure SetModified(const AValue: boolean);
function WriteNode(Element: TLazDocElement; Values: TFPDocElementValues; function WriteNode(Element: TCodeHelpElement; Values: TFPDocElementValues;
Interactive: Boolean): Boolean; Interactive: Boolean): Boolean;
procedure UpdateChain; procedure UpdateChain;
procedure UpdateCaption; procedure UpdateCaption;
@ -134,9 +134,9 @@ type
procedure UpdateInheritedControls; procedure UpdateInheritedControls;
procedure OnLazDocChanging(Sender: TObject; LazDocFPFile: TLazFPDocFile); procedure OnLazDocChanging(Sender: TObject; LazDocFPFile: TLazFPDocFile);
procedure OnLazDocChanged(Sender: TObject; LazDocFPFile: TLazFPDocFile); procedure OnLazDocChanged(Sender: TObject; LazDocFPFile: TLazFPDocFile);
procedure LoadGUIValues(Element: TLazDocElement); procedure LoadGUIValues(Element: TCodeHelpElement);
procedure MoveToInherited(Element: TLazDocElement); procedure MoveToInherited(Element: TCodeHelpElement);
function CreateElement(Element: TLazDocElement): Boolean; function CreateElement(Element: TCodeHelpElement): Boolean;
public public
procedure Reset; procedure Reset;
procedure InvalidateChain; procedure InvalidateChain;
@ -248,8 +248,8 @@ begin
Reset; Reset;
LazDocBoss.AddHandlerOnChanging(@OnLazDocChanging); CodeHelpBoss.AddHandlerOnChanging(@OnLazDocChanging);
LazDocBoss.AddHandlerOnChanged(@OnLazDocChanged); CodeHelpBoss.AddHandlerOnChanged(@OnLazDocChanged);
Application.AddOnIdleHandler(@ApplicationIdle); Application.AddOnIdleHandler(@ApplicationIdle);
Name := NonModalIDEWindowNames[nmiwLazDocName]; Name := NonModalIDEWindowNames[nmiwLazDocName];
@ -260,7 +260,7 @@ procedure TFPDocEditor.FormDestroy(Sender: TObject);
begin begin
Reset; Reset;
FreeAndNil(fChain); FreeAndNil(fChain);
LazDocBoss.RemoveAllHandlersOfObject(Self); CodeHelpBoss.RemoveAllHandlersOfObject(Self);
Application.RemoveAllHandlersOfObject(Self); Application.RemoveAllHandlersOfObject(Self);
end; end;
@ -358,7 +358,7 @@ end;
procedure TFPDocEditor.MoveToInheritedButtonClick(Sender: TObject); procedure TFPDocEditor.MoveToInheritedButtonClick(Sender: TObject);
var var
i: Integer; i: Integer;
Element: TLazDocElement; Element: TCodeHelpElement;
Candidates: TFPList; Candidates: TFPList;
FPDocSelectInheritedDlg: TFPDocSelectInheritedDlg; FPDocSelectInheritedDlg: TFPDocSelectInheritedDlg;
ShortDescr: String; ShortDescr: String;
@ -383,7 +383,7 @@ begin
if (Candidates=nil) or (Candidates.Count=0) then exit; if (Candidates=nil) or (Candidates.Count=0) then exit;
if Candidates.Count=1 then begin if Candidates.Count=1 then begin
// there is only one candidate // there is only one candidate
Element:=TLazDocElement(Candidates[0]); Element:=TCodeHelpElement(Candidates[0]);
if (Element.ElementNode<>nil) then begin if (Element.ElementNode<>nil) then begin
ShortDescr:=Element.FPDocFile.GetValueFromNode(Element.ElementNode,fpdiShort); ShortDescr:=Element.FPDocFile.GetValueFromNode(Element.ElementNode,fpdiShort);
if ShortDescr<>'' then begin if ShortDescr<>'' then begin
@ -401,14 +401,14 @@ begin
FPDocSelectInheritedDlg:=TFPDocSelectInheritedDlg.Create(nil); FPDocSelectInheritedDlg:=TFPDocSelectInheritedDlg.Create(nil);
FPDocSelectInheritedDlg.InheritedComboBox.Items.Clear; FPDocSelectInheritedDlg.InheritedComboBox.Items.Clear;
for i:=0 to Candidates.Count-1 do begin for i:=0 to Candidates.Count-1 do begin
Element:=TLazDocElement(Candidates[i]); Element:=TCodeHelpElement(Candidates[i]);
FPDocSelectInheritedDlg.InheritedComboBox.Items.Add( FPDocSelectInheritedDlg.InheritedComboBox.Items.Add(
GetContextTitle(Element)); GetContextTitle(Element));
end; end;
if FPDocSelectInheritedDlg.ShowModal<>mrOk then exit; if FPDocSelectInheritedDlg.ShowModal<>mrOk then exit;
i:=FPDocSelectInheritedDlg.InheritedComboBox.ItemIndex; i:=FPDocSelectInheritedDlg.InheritedComboBox.ItemIndex;
if i<0 then exit; if i<0 then exit;
Element:=TLazDocElement(Candidates[i]); Element:=TCodeHelpElement(Candidates[i]);
end; end;
// move the content of the current entry to the inherited entry // move the content of the current entry to the inherited entry
@ -424,7 +424,7 @@ begin
Save; Save;
end; end;
function TFPDocEditor.GetContextTitle(Element: TLazDocElement): string; function TFPDocEditor.GetContextTitle(Element: TCodeHelpElement): string;
// get codetools path. for example: TButton.Align // get codetools path. for example: TButton.Align
begin begin
Result:=''; Result:='';
@ -483,7 +483,7 @@ end;
procedure TFPDocEditor.UpdateValueControls; procedure TFPDocEditor.UpdateValueControls;
var var
Element: TLazDocElement; Element: TCodeHelpElement;
begin begin
if fUpdateLock>0 then begin if fUpdateLock>0 then begin
Include(FFLags,ldffValueControlsNeedsUpdate); Include(FFLags,ldffValueControlsNeedsUpdate);
@ -504,7 +504,7 @@ end;
procedure TFPDocEditor.UpdateInheritedControls; procedure TFPDocEditor.UpdateInheritedControls;
var var
i: LongInt; i: LongInt;
Element: TLazDocElement; Element: TCodeHelpElement;
ShortDescr: String; ShortDescr: String;
begin begin
if fUpdateLock>0 then begin if fUpdateLock>0 then begin
@ -538,8 +538,8 @@ end;
procedure TFPDocEditor.UpdateChain; procedure TFPDocEditor.UpdateChain;
var var
Code: TCodeBuffer; Code: TCodeBuffer;
LDResult: TLazDocParseResult; LDResult: TCodeHelpParseResult;
NewChain: TLazDocElementChain; NewChain: TCodeHelpElementChain;
CacheWasUsed: Boolean; CacheWasUsed: Boolean;
begin begin
FreeAndNil(fChain); FreeAndNil(fChain);
@ -564,16 +564,16 @@ begin
end; end;
// start getting the lazdoc element chain // start getting the lazdoc element chain
LDResult:=LazDocBoss.GetElementChain(Code,CaretXY.X,CaretXY.Y,true, LDResult:=CodeHelpBoss.GetElementChain(Code,CaretXY.X,CaretXY.Y,true,
NewChain,CacheWasUsed); NewChain,CacheWasUsed);
case LDResult of case LDResult of
ldprParsing: chprParsing:
begin begin
Include(FFLags,ldffChainNeedsUpdate); Include(FFLags,ldffChainNeedsUpdate);
DebugLn(['TFPDocEditForm.UpdateChain ToDo: still parsing LazDocBoss.GetElementChain for ',fSourceFilename,' ',dbgs(CaretXY)]); DebugLn(['TFPDocEditForm.UpdateChain ToDo: still parsing LazDocBoss.GetElementChain for ',fSourceFilename,' ',dbgs(CaretXY)]);
exit; exit;
end; end;
ldprFailed: chprFailed:
begin begin
DebugLn(['TFPDocEditForm.UpdateChain failed LazDocBoss.GetElementChain for ',fSourceFilename,' ',dbgs(CaretXY)]); DebugLn(['TFPDocEditForm.UpdateChain failed LazDocBoss.GetElementChain for ',fSourceFilename,' ',dbgs(CaretXY)]);
exit; exit;
@ -602,7 +602,7 @@ begin
end; end;
procedure TFPDocEditor.LoadGUIValues(Element: TLazDocElement); procedure TFPDocEditor.LoadGUIValues(Element: TCodeHelpElement);
var var
EnabledState: Boolean; EnabledState: Boolean;
Values: TFPDocElementValues; Values: TFPDocElementValues;
@ -651,7 +651,7 @@ begin
FModified:=OldModified; FModified:=OldModified;
end; end;
procedure TFPDocEditor.MoveToInherited(Element: TLazDocElement); procedure TFPDocEditor.MoveToInherited(Element: TCodeHelpElement);
var var
Values: TFPDocElementValues; Values: TFPDocElementValues;
begin begin
@ -659,16 +659,16 @@ begin
WriteNode(Element,Values,true); WriteNode(Element,Values,true);
end; end;
function TFPDocEditor.CreateElement(Element: TLazDocElement): Boolean; function TFPDocEditor.CreateElement(Element: TCodeHelpElement): Boolean;
var var
NewElement: TLazDocElement; NewElement: TCodeHelpElement;
begin begin
DebugLn(['TFPDocEditForm.CreateElement ']); DebugLn(['TFPDocEditForm.CreateElement ']);
if (Element=nil) or (Element.ElementName='') then exit(false); if (Element=nil) or (Element.ElementName='') then exit(false);
NewElement:=nil; NewElement:=nil;
Include(FFlags,ldffWriting); Include(FFlags,ldffWriting);
try try
Result:=LazDocBoss.CreateElement(Element.CodeXYPos.Code, Result:=CodeHelpBoss.CreateElement(Element.CodeXYPos.Code,
Element.CodeXYPos.X,Element.CodeXYPos.Y,NewElement); Element.CodeXYPos.X,Element.CodeXYPos.Y,NewElement);
finally finally
Exclude(FFlags,ldffWriting); Exclude(FFlags,ldffWriting);
@ -784,7 +784,7 @@ begin
SaveButton.Enabled:=FModified; SaveButton.Enabled:=FModified;
end; end;
function TFPDocEditor.WriteNode(Element: TLazDocElement; function TFPDocEditor.WriteNode(Element: TCodeHelpElement;
Values: TFPDocElementValues; Interactive: Boolean): Boolean; Values: TFPDocElementValues; Interactive: Boolean): Boolean;
var var
TopNode: TDOMNode; TopNode: TDOMNode;
@ -923,7 +923,7 @@ begin
Exclude(FFlags,ldffWriting); Exclude(FFlags,ldffWriting);
end; end;
if LazDocBoss.SaveFPDocFile(CurDocFile)<>mrOk then begin if CodeHelpBoss.SaveFPDocFile(CurDocFile)<>mrOk then begin
DebugLn(['TFPDocEditForm.WriteNode failed writing ',CurDocFile.Filename]); DebugLn(['TFPDocEditForm.WriteNode failed writing ',CurDocFile.Filename]);
exit; exit;
end; end;
@ -948,7 +948,7 @@ function TFPDocEditor.FindInheritedIndex: integer;
// returns Index in chain of an overriden Element with a short description // returns Index in chain of an overriden Element with a short description
// returns -1 if not found // returns -1 if not found
var var
Element: TLazDocElement; Element: TCodeHelpElement;
begin begin
if (fChain<>nil) then begin if (fChain<>nil) then begin
Result:=1; Result:=1;

View File

@ -90,7 +90,7 @@ var
Item: TIdentifierListItem; Item: TIdentifierListItem;
Code: TCodeBuffer; Code: TCodeBuffer;
CacheWasUsed: boolean; CacheWasUsed: boolean;
Chain: TLazDocElementChain; Chain: TCodeHelpElementChain;
Y,X: integer; Y,X: integer;
begin begin
if (SourceEditorWindow=nil) or (CodeToolBoss=nil) if (SourceEditorWindow=nil) or (CodeToolBoss=nil)
@ -115,7 +115,7 @@ begin
DebugLn(['TFPDocHintProvider.ReadLazDocData FAILED X=',X,' Y=',Y]); DebugLn(['TFPDocHintProvider.ReadLazDocData FAILED X=',X,' Y=',Y]);
exit; exit;
end; end;
LazDocBoss.GetElementChain(Code,X,Y,true,Chain,CacheWasUsed); CodeHelpBoss.GetElementChain(Code,X,Y,true,Chain,CacheWasUsed);
DebugLn(['TFPDocHintProvider.ReadLazDocData Chain=',Chain<>nil]); DebugLn(['TFPDocHintProvider.ReadLazDocData Chain=',Chain<>nil]);
if Chain=nil then begin if Chain=nil then begin
DebugLn(['TFPDocHintProvider.ReadLazDocData FAILED Chain=nil']); DebugLn(['TFPDocHintProvider.ReadLazDocData FAILED Chain=nil']);

View File

@ -433,7 +433,7 @@ begin
RegisterIDEHelpDatabases; RegisterIDEHelpDatabases;
RegisterDefaultIDEHelpViewers; RegisterDefaultIDEHelpViewers;
LazDocBoss:=TCodeHelpManager.Create; CodeHelpBoss:=TCodeHelpManager.Create;
// register property editors for URL handling // register property editors for URL handling
RegisterPropertyEditor(TypeInfo(AnsiString), RegisterPropertyEditor(TypeInfo(AnsiString),
@ -442,7 +442,7 @@ end;
destructor THelpManager.Destroy; destructor THelpManager.Destroy;
begin begin
FreeThenNil(LazDocBoss); FreeThenNil(CodeHelpBoss);
FPCMessagesHelpDB:=nil; FPCMessagesHelpDB:=nil;
FreeThenNil(HelpDatabases); FreeThenNil(HelpDatabases);
FreeThenNil(HelpViewers); FreeThenNil(HelpViewers);
@ -889,7 +889,7 @@ begin
Hint:=''; Hint:='';
Code:=CodeToolBoss.LoadFile(ExpandedFilename,true,false); Code:=CodeToolBoss.LoadFile(ExpandedFilename,true,false);
if Code=nil then exit; if Code=nil then exit;
if LazDocBoss.GetHint(Code,CodePos.X,CodePos.Y,true,Hint,CacheWasUsed)=ldprSuccess if CodeHelpBoss.GetHint(Code,CodePos.X,CodePos.Y,true,Hint,CacheWasUsed)=chprSuccess
then then
exit(shrSuccess); exit(shrSuccess);
DebugLn(['THelpManager.GetHintForSourcePosition not found']); DebugLn(['THelpManager.GetHintForSourcePosition not found']);