From 9c3ea995b85d3e1a8be133cee364ed50b532fac3 Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 23 Nov 2007 15:39:19 +0000 Subject: [PATCH] IDE: moved code to find hint for source position to helpmanager git-svn-id: trunk@12987 - --- components/codetools/identcompletiontool.pas | 8 ++++---- ide/helpmanager.pas | 16 ++++++++++++++++ ide/main.pp | 7 ++++--- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/components/codetools/identcompletiontool.pas b/components/codetools/identcompletiontool.pas index cc3de40420..3ae3f61a5e 100644 --- a/components/codetools/identcompletiontool.pas +++ b/components/codetools/identcompletiontool.pas @@ -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; diff --git a/ide/helpmanager.pas b/ide/helpmanager.pas index 92cfc38816..d0cccc1426 100644 --- a/ide/helpmanager.pas +++ b/ide/helpmanager.pas @@ -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 diff --git a/ide/main.pp b/ide/main.pp index 966e9b9560..3656e39e37 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -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