memo, public method to show hide ddoc and call tips

This commit is contained in:
Basile Burg 2015-10-15 05:34:37 +02:00
parent 1bf0b42314
commit 1b7d0b93e7
1 changed files with 44 additions and 16 deletions

View File

@ -164,6 +164,11 @@ type
procedure save; procedure save;
procedure saveTempFile; procedure saveTempFile;
// //
procedure showCallTips;
procedure hideCallTips;
procedure showDDocs;
procedure hideDDocs;
//
function breakPointsCount: integer; function breakPointsCount: integer;
function breakPointLine(index: integer): integer; function breakPointLine(index: integer): integer;
property onBreakpointModify: TBreakPointModifyEvent read fBreakpointEvent write fBreakpointEvent; property onBreakpointModify: TBreakPointModifyEvent read fBreakpointEvent write fBreakpointEvent;
@ -600,22 +605,24 @@ begin
end; end;
end; end;
{$REGION DDoc hints ------------------------------------------------------------} {$REGION DDoc & CallTip --------------------------------------------------------}
procedure TCESynMemo.InitHintWins; procedure TCESynMemo.InitHintWins;
begin begin
if fCallTipWin = nil then begin if fCallTipWin = nil then
begin
fCallTipWin := TCEEditorHintWindow.Create(self); fCallTipWin := TCEEditorHintWindow.Create(self);
fCallTipWin.Color := clInfoBk + $01010100; fCallTipWin.Color := clInfoBk + $01010100;
fCallTipWin.Font.Color:= clInfoText; fCallTipWin.Font.Color:= clInfoText;
end; end;
if fDDocWin = nil then begin if fDDocWin = nil then
begin
fDDocWin := TCEEditorHintWindow.Create(self); fDDocWin := TCEEditorHintWindow.Create(self);
fDDocWin.Color := clInfoBk + $01010100; fDDocWin.Color := clInfoBk + $01010100;
fDDocWin.Font.Color:= clInfoText; fDDocWin.Font.Color:= clInfoText;
end; end;
end; end;
procedure TCESynMemo.getCallTips(); procedure TCESynMemo.showCallTips;
var var
str: string; str: string;
pnt: TPoint; pnt: TPoint;
@ -631,6 +638,38 @@ begin
end; end;
end; end;
procedure TCESynMemo.hideCallTips;
begin
fCallTipWin.Hide;
end;
procedure TCESynMemo.showDDocs;
var
str: string;
begin
fCanShowHint := false;
DcdWrapper.getDdocFromCursor(str);
//
if str <> '' then
begin
fDDocWin.FontSize := Font.Size;
fDDocWin.HintRect := fDDocWin.CalcHintRect(0, str, nil);
fDDocWin.OffsetHintRect(mouse.CursorPos, Font.Size);
fDDocWin.ActivateHint(fDDocWin.HintRect, str);
end;
end;
procedure TCESynMemo.hideDDocs;
begin
fDDocWin.Hide;
end;
procedure TCESynMemo.getCallTips();
begin
showCallTips;
end;
procedure TCESynMemo.setHintDelay(aValue: Integer); procedure TCESynMemo.setHintDelay(aValue: Integer);
begin begin
fHintDelay:=aValue; fHintDelay:=aValue;
@ -644,23 +683,12 @@ begin
end; end;
procedure TCESynMemo.HintTimerEvent(sender: TObject); procedure TCESynMemo.HintTimerEvent(sender: TObject);
var
str: string;
begin begin
if not Visible then exit; if not Visible then exit;
if not isDSource then exit; if not isDSource then exit;
// //
if not fCanShowHint then exit; if not fCanShowHint then exit;
fCanShowHint := false; showDDocs;
DcdWrapper.getDdocFromCursor(str);
//
if str <> '' then
begin
fDDocWin.FontSize := Font.Size;
fDDocWin.HintRect := fDDocWin.CalcHintRect(0, str, nil);
fDDocWin.OffsetHintRect(mouse.CursorPos, Font.Size);
fDDocWin.ActivateHint(fDDocWin.HintRect, str);
end;
end; end;
{$ENDREGION --------------------------------------------------------------------} {$ENDREGION --------------------------------------------------------------------}