IDE: src edit hints: do not show empty hints

git-svn-id: trunk@31239 -
This commit is contained in:
mattias 2011-06-15 11:10:59 +00:00
parent 7c49448b51
commit 9463fcca22
2 changed files with 20 additions and 12 deletions

View File

@ -2374,18 +2374,21 @@ begin
finally
ElementNames.Free;
FreeListOfPCodeXYPosition(ListOfPCodeXYPosition);
if chhoShowFocusHint in Options then begin
Cmd:=EditorOpts.KeyMap.FindByCommand(ecFocusHint);
if (Cmd<>nil) and (not IDEShortCutEmpty(Cmd.ShortcutA)) then begin
HTMLHint:=HTMLHint+'<div class="focushint">Press '
+KeyAndShiftStateToEditorKeyString(Cmd.ShortcutA)+' for focus</div>'+LineEnding;
if HTMLHint<>'' then begin
if (chhoShowFocusHint in Options) then begin
Cmd:=EditorOpts.KeyMap.FindByCommand(ecFocusHint);
if (Cmd<>nil) and (not IDEShortCutEmpty(Cmd.ShortcutA)) then begin
HTMLHint:=HTMLHint+'<div class="focushint">Press '
+KeyAndShiftStateToEditorKeyString(Cmd.ShortcutA)+' for focus</div>'+LineEnding;
end;
end;
end;
HTMLHint:='<html><head><link rel="stylesheet" href="lazdoc://lazarus/lazdoc.css" type="text/css"></head>'+LineEnding
+'<body>'+LineEnding+HTMLHint+'</body>'+LineEnding;
HTMLHint:='<html><head><link rel="stylesheet" href="lazdoc://lazarus/lazdoc.css" type="text/css"></head>'+LineEnding
+'<body>'+LineEnding+HTMLHint+'</body>'+LineEnding;
Result:=chprSuccess;
end else
Result:=chprFailed;
end;
debugln(['TCodeHelpManager.GetHTMLHint ',HTMLHint]);
Result:=chprSuccess;
end;
function TCodeHelpManager.GetPasDocCommentsAsHTML(Tool: TFindDeclarationTool;

View File

@ -16127,6 +16127,7 @@ var
ActiveUnitInfo: TUnitInfo;
BaseURL, SmartHintStr, Expression, DebugEval, DebugEvalDerefer: String;
DBGType,DBGTypeDerefer: TDBGType;
HasHint: Boolean;
begin
//DebugLn(['TMainIDE.OnSrcNotebookShowHintForSource START']);
if (SrcEdit=nil) then exit;
@ -16141,11 +16142,14 @@ begin
writeln('');
writeln('[TMainIDE.OnSrcNotebookShowHintForSource] ************ ',ActiveUnitInfo.Source.Filename,' X=',CaretPos.X,' Y=',CaretPos.Y);
{$ENDIF}
HasHint:=false;
if EditorOpts.AutoToolTipSymbTools then begin
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.OnSrcNotebookShowHintForSource A');{$ENDIF}
TIDEHelpManager(HelpBoss).GetHintForSourcePosition(ActiveUnitInfo.Filename,
if TIDEHelpManager(HelpBoss).GetHintForSourcePosition(ActiveUnitInfo.Filename,
CaretPos,BaseURL,SmartHintStr,
[{$IFDEF EnableFocusHint}ihmchAddFocusHint{$ENDIF}]);
[{$IFDEF EnableFocusHint}ihmchAddFocusHint{$ENDIF}])=shrSuccess
then
HasHint:=true;
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.OnSrcNotebookShowHintForSource B');{$ENDIF}
end;
case ToolStatus of
@ -16180,6 +16184,7 @@ begin
end;
FreeAndNil(DBGType);
FreeAndNil(DBGTypeDerefer);
HasHint:=true;
Expression := Expression + ' = ' + DebugEval;
if SmartHintStr<>'' then
SmartHintStr:=LineEnding+LineEnding+SmartHintStr;
@ -16187,7 +16192,7 @@ begin
end;
end;
if SmartHintStr <> '' then
if HasHint then
SrcEdit.ActivateHint(ClientPos, BaseURL, SmartHintStr);
end;