fix, mouse pos to enable hint window

This commit is contained in:
Basile Burg 2015-03-12 10:38:44 +01:00
parent 557d1b77f5
commit 937f2b0db8
1 changed files with 9 additions and 4 deletions

View File

@ -92,7 +92,8 @@ type
fCallTipWin: TCEEditorHintWindow; fCallTipWin: TCEEditorHintWindow;
fDDocWin: TCEEditorHintWindow; fDDocWin: TCEEditorHintWindow;
fIdleTimer: TIdleTimer; fIdleTimer: TIdleTimer;
fMayHint: boolean; fCanShowHint: boolean;
fOldMousePos: TPoint;
function getMouseStart: Integer; function getMouseStart: Integer;
procedure changeNotify(Sender: TObject); procedure changeNotify(Sender: TObject);
procedure identifierToD2Syn; procedure identifierToD2Syn;
@ -425,7 +426,7 @@ begin
if not Visible then exit; if not Visible then exit;
if not isDSource then exit; if not isDSource then exit;
// //
if not fMayHint then exit; if not fCanShowHint then exit;
if Identifier = '' then exit; if Identifier = '' then exit;
DcdWrapper.getDdocFromCursor(str); DcdWrapper.getDdocFromCursor(str);
// //
@ -630,9 +631,12 @@ procedure TCESynMemo.MouseMove(Shift: TShiftState; X, Y: Integer);
begin begin
fDDocWin.Hide; fDDocWin.Hide;
fCallTipWin.Hide; fCallTipWin.Hide;
fMayHint := ((Y > 10) or (Y < -10)) and ((X > 10) or (X < -10));
fMousePos := PixelsToRowColumn(Point(X,Y));
inherited; inherited;
fCanShowHint := (shift = []) and
(Y - fOldMousePos.y < 2) and (Y - fOldMousePos.y > -2) and
(X - fOldMousePos.x < 2) and (X - fOldMousePos.x > -2);
fOldMousePos := Point(X, Y);
fMousePos := PixelsToRowColumn(fOldMousePos);
if ssLeft in Shift then if ssLeft in Shift then
identifierToD2Syn; identifierToD2Syn;
end; end;
@ -641,6 +645,7 @@ procedure TCESynMemo.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y:In
begin begin
inherited; inherited;
identifierToD2Syn; identifierToD2Syn;
fCanShowHint := false;
fDDocWin.Hide; fDDocWin.Hide;
fCallTipWin.Hide; fCallTipWin.Hide;
end; end;