IDE: moved code to find hint for source position to helpmanager

git-svn-id: trunk@12987 -
This commit is contained in:
mattias 2007-11-23 15:39:19 +00:00
parent 6874d3b117
commit 9c3ea995b8
3 changed files with 24 additions and 7 deletions

View File

@ -116,10 +116,10 @@ type
function AsString: string;
function GetDesc: TCodeTreeNodeDesc;
constructor Create(NewCompatibility: TIdentifierCompatibility;
NewHasChilds: boolean; NewHistoryIndex: integer;
NewIdentifier: PChar; NewLevel: integer;
NewNode: TCodeTreeNode; NewTool: TFindDeclarationTool;
NewDefaultDesc: TCodeTreeNodeDesc);
NewHasChilds: boolean; NewHistoryIndex: integer;
NewIdentifier: PChar; NewLevel: integer;
NewNode: TCodeTreeNode; NewTool: TFindDeclarationTool;
NewDefaultDesc: TCodeTreeNodeDesc);
function IsProcNodeWithParams: boolean;
function IsPropertyWithParams: boolean;
function CheckHasChilds: boolean;

View File

@ -101,6 +101,9 @@ type
var ErrMsg: string): TShowHelpResult; override;
procedure ShowHelpForMessage(Line: integer); override;
procedure ShowHelpForObjectInspector(Sender: TObject); override;
function GetHintForSourcePosition(const ExpandedFilename: string;
const CodePos: TPoint;
out Hint: string): TShowHelpResult;
function ConvertSourcePosToPascalHelpContext(const CaretPos: TPoint;
const Filename: string): TPascalHelpContextList; override;
@ -873,6 +876,19 @@ begin
end;
end;
function THelpManager.GetHintForSourcePosition(const ExpandedFilename: string;
const CodePos: TPoint; out Hint: string): TShowHelpResult;
var
Code: TCodeBuffer;
begin
Hint:='';
Code:=CodeToolBoss.LoadFile(ExpandedFilename,true,false);
if Code=nil then exit;
Hint:=CodeToolBoss.FindSmartHint(Code,CodePos.X,CodePos.Y);
CodeToolBoss.Abortable:=false;
end;
function THelpManager.ConvertSourcePosToPascalHelpContext(
const CaretPos: TPoint; const Filename: string): TPascalHelpContextList;
var

View File

@ -11999,9 +11999,10 @@ begin
writeln('[TMainIDE.OnSrcNotebookShowHintForSource] ************ ',ActiveUnitInfo.Source.Filename,' X=',CaretPos.X,' Y=',CaretPos.Y);
{$ENDIF}
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.OnSrcNotebookShowHintForSource A');{$ENDIF}
SmartHintStr:=CodeToolBoss.FindSmartHint(ActiveUnitInfo.Source,
CaretPos.X,CaretPos.Y);
CodeToolBoss.Abortable:=false;
{$IFDEF EnableLazDocHint}
THelpManager(HelpBoss).GetHintForSourcePosition(ActiveUnitInfo.Filename,
CaretPos,SmartHintStr);
{$ENDIF}
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.OnSrcNotebookShowHintForSource B');{$ENDIF}
end;
itDebugger: begin