mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-26 13:19:29 +02:00
IDE, IDEIntf: allow no mouse offset in hint window manager
git-svn-id: trunk@53367 -
This commit is contained in:
parent
c49f1ff869
commit
cf080374cd
@ -181,7 +181,7 @@ type
|
|||||||
constructor Create; overload;
|
constructor Create; overload;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function HintIsVisible: boolean;
|
function HintIsVisible: boolean;
|
||||||
function ShowHint(ScreenPos: TPoint; TheHint: string): boolean;
|
function ShowHint(ScreenPos: TPoint; TheHint: string; const MouseOffset: Boolean = True): boolean;
|
||||||
procedure HideHint;
|
procedure HideHint;
|
||||||
procedure HideIfVisible;
|
procedure HideIfVisible;
|
||||||
public
|
public
|
||||||
@ -352,7 +352,8 @@ begin
|
|||||||
Result := FHtmlHelpProvider;
|
Result := FHtmlHelpProvider;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function THintWindowManager.ShowHint(ScreenPos: TPoint; TheHint: string): boolean;
|
function THintWindowManager.ShowHint(ScreenPos: TPoint; TheHint: string;
|
||||||
|
const MouseOffset: Boolean): boolean;
|
||||||
var
|
var
|
||||||
ms: TMemoryStream;
|
ms: TMemoryStream;
|
||||||
NewWidth, NewHeight: integer;
|
NewWidth, NewHeight: integer;
|
||||||
@ -363,7 +364,10 @@ var
|
|||||||
begin
|
begin
|
||||||
HintWinRect := HintTextWindow.CalcHintRect(Screen.Width, TheHint, Nil);
|
HintWinRect := HintTextWindow.CalcHintRect(Screen.Width, TheHint, Nil);
|
||||||
HintTextWindow.HintRect := HintWinRect; // Adds borders.
|
HintTextWindow.HintRect := HintWinRect; // Adds borders.
|
||||||
HintTextWindow.OffsetHintRect(ScreenPos);
|
if MouseOffset then
|
||||||
|
HintTextWindow.OffsetHintRect(ScreenPos)
|
||||||
|
else
|
||||||
|
HintTextWindow.OffsetHintRect(ScreenPos, 0);
|
||||||
HintTextWindow.ActivateHint(TheHint);
|
HintTextWindow.ActivateHint(TheHint);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -385,7 +389,10 @@ var
|
|||||||
if NewHeight <= 0 then
|
if NewHeight <= 0 then
|
||||||
NewHeight := 200;
|
NewHeight := 200;
|
||||||
HintRenderWindow.HintRectAdjust := Rect(0, 0, NewWidth, NewHeight);
|
HintRenderWindow.HintRectAdjust := Rect(0, 0, NewWidth, NewHeight);
|
||||||
HintRenderWindow.OffsetHintRect(ScreenPos);
|
if MouseOffset then
|
||||||
|
HintRenderWindow.OffsetHintRect(ScreenPos)
|
||||||
|
else
|
||||||
|
HintRenderWindow.OffsetHintRect(ScreenPos, 0);
|
||||||
HintRenderWindow.ActivateRendered;
|
HintRenderWindow.ActivateRendered;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ type
|
|||||||
procedure ActivateHint(const ClientPos: TPoint; const ABaseURL, AHint: string;
|
procedure ActivateHint(const ClientPos: TPoint; const ABaseURL, AHint: string;
|
||||||
AAutoShown: Boolean = True); overload;
|
AAutoShown: Boolean = True); overload;
|
||||||
procedure ActivateHint(ClientRect: TRect; const ABaseURL, AHint: string;
|
procedure ActivateHint(ClientRect: TRect; const ABaseURL, AHint: string;
|
||||||
AAutoShown: Boolean); overload;
|
AAutoShown: Boolean; AMouseOffset: Boolean = True); overload;
|
||||||
|
|
||||||
// selections
|
// selections
|
||||||
function SelectionAvailable: boolean; override;
|
function SelectionAvailable: boolean; override;
|
||||||
@ -1007,9 +1007,9 @@ type
|
|||||||
procedure HideHintTimer(Sender: TObject);
|
procedure HideHintTimer(Sender: TObject);
|
||||||
public
|
public
|
||||||
procedure ActivateHint(const ScreenRect: TRect; const ABaseURL, AHint: string;
|
procedure ActivateHint(const ScreenRect: TRect; const ABaseURL, AHint: string;
|
||||||
AAutoShown: Boolean = True); overload;
|
AAutoShown: Boolean = True; AMouseOffset: Boolean = True); overload;
|
||||||
procedure ActivateHint(const ScreenPos: TPoint; const ABaseURL, AHint: string;
|
procedure ActivateHint(const ScreenPos: TPoint; const ABaseURL, AHint: string;
|
||||||
AAutoShown: Boolean = True); overload;
|
AAutoShown: Boolean = True; AMouseOffset: Boolean = True); overload;
|
||||||
procedure HideAutoHintAfterMouseMoved;
|
procedure HideAutoHintAfterMouseMoved;
|
||||||
procedure HideAutoHint;
|
procedure HideAutoHint;
|
||||||
procedure UpdateHintTimer;
|
procedure UpdateHintTimer;
|
||||||
@ -1146,9 +1146,9 @@ type
|
|||||||
// Hints
|
// Hints
|
||||||
FHints: TSourceEditorHintWindowManager;
|
FHints: TSourceEditorHintWindowManager;
|
||||||
procedure ActivateHint(const ScreenRect: TRect; const BaseURL, TheHint: string;
|
procedure ActivateHint(const ScreenRect: TRect; const BaseURL, TheHint: string;
|
||||||
AutoShown: Boolean = True); overload;
|
AutoShown: Boolean = True; AMouseOffset: Boolean = True); overload;
|
||||||
procedure ActivateHint(const ScreenPos: TPoint; const BaseURL, TheHint: string;
|
procedure ActivateHint(const ScreenPos: TPoint; const BaseURL, TheHint: string;
|
||||||
AutoShown: Boolean = True); overload;
|
AutoShown: Boolean = True; AMouseOffset: Boolean = True); overload;
|
||||||
private
|
private
|
||||||
FCodeTemplateModul: TSynEditAutoComplete;
|
FCodeTemplateModul: TSynEditAutoComplete;
|
||||||
FGotoDialog: TfrmGoto;
|
FGotoDialog: TfrmGoto;
|
||||||
@ -1896,13 +1896,13 @@ end;
|
|||||||
{ TSourceEditorHintWindowManager }
|
{ TSourceEditorHintWindowManager }
|
||||||
|
|
||||||
procedure TSourceEditorHintWindowManager.ActivateHint(const ScreenPos: TPoint;
|
procedure TSourceEditorHintWindowManager.ActivateHint(const ScreenPos: TPoint;
|
||||||
const ABaseURL, AHint: string; AAutoShown: Boolean);
|
const ABaseURL, AHint: string; AAutoShown: Boolean; AMouseOffset: Boolean);
|
||||||
begin
|
begin
|
||||||
ActivateHint(Rect(ScreenPos.x, ScreenPos.y, ScreenPos.x, ScreenPos.y), ABaseURL, AHint, AAutoShown);
|
ActivateHint(Rect(ScreenPos.x, ScreenPos.y, ScreenPos.x, ScreenPos.y), ABaseURL, AHint, AAutoShown, AMouseOffset);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditorHintWindowManager.ActivateHint(const ScreenRect: TRect;
|
procedure TSourceEditorHintWindowManager.ActivateHint(const ScreenRect: TRect;
|
||||||
const ABaseURL, AHint: string; AAutoShown: Boolean);
|
const ABaseURL, AHint: string; AAutoShown: Boolean; AMouseOffset: Boolean);
|
||||||
begin
|
begin
|
||||||
FAutoShown := AAutoShown;
|
FAutoShown := AAutoShown;
|
||||||
BaseURL := ABaseURL;
|
BaseURL := ABaseURL;
|
||||||
@ -1912,13 +1912,13 @@ begin
|
|||||||
begin
|
begin
|
||||||
FAutoHintMousePos := Mouse.CursorPos;
|
FAutoHintMousePos := Mouse.CursorPos;
|
||||||
if not(HintIsVisible and (FLastHint = AHint)) then
|
if not(HintIsVisible and (FLastHint = AHint)) then
|
||||||
ShowHint(ScreenRect.TopLeft,AHint);
|
ShowHint(ScreenRect.TopLeft,AHint,AMouseOffset);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
if HintIsVisible and (FLastHint = AHint) then
|
if HintIsVisible and (FLastHint = AHint) then
|
||||||
HideIfVisible
|
HideIfVisible
|
||||||
else
|
else
|
||||||
ShowHint(ScreenRect.TopLeft,AHint);
|
ShowHint(ScreenRect.TopLeft,AHint,AMouseOffset);
|
||||||
end;
|
end;
|
||||||
FAutoHideHintTimer.Enabled := AAutoShown;
|
FAutoHideHintTimer.Enabled := AAutoShown;
|
||||||
end;
|
end;
|
||||||
@ -3303,14 +3303,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditor.ActivateHint(ClientRect: TRect; const ABaseURL,
|
procedure TSourceEditor.ActivateHint(ClientRect: TRect; const ABaseURL,
|
||||||
AHint: string; AAutoShown: Boolean);
|
AHint: string; AAutoShown: Boolean; AMouseOffset: Boolean);
|
||||||
var
|
var
|
||||||
ScreenRect: TRect;
|
ScreenRect: TRect;
|
||||||
begin
|
begin
|
||||||
if SourceNotebook=nil then exit;
|
if SourceNotebook=nil then exit;
|
||||||
ScreenRect.TopLeft:=EditorComponent.ClientToScreen(ClientRect.TopLeft);
|
ScreenRect.TopLeft:=EditorComponent.ClientToScreen(ClientRect.TopLeft);
|
||||||
ScreenRect.BottomRight:=EditorComponent.ClientToScreen(ClientRect.BottomRight);
|
ScreenRect.BottomRight:=EditorComponent.ClientToScreen(ClientRect.BottomRight);
|
||||||
Manager.ActivateHint(ScreenRect,ABaseURL,AHint,AAutoShown);
|
Manager.ActivateHint(ScreenRect,ABaseURL,AHint,AAutoShown,AMouseOffset);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------S T A R T F I N D-----------------------------}
|
{------------------------------S T A R T F I N D-----------------------------}
|
||||||
@ -10736,19 +10736,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditorManager.ActivateHint(const ScreenPos: TPoint;
|
procedure TSourceEditorManager.ActivateHint(const ScreenPos: TPoint;
|
||||||
const BaseURL, TheHint: string; AutoShown: Boolean);
|
const BaseURL, TheHint: string; AutoShown: Boolean; AMouseOffset: Boolean);
|
||||||
begin
|
begin
|
||||||
if csDestroying in ComponentState then exit;
|
if csDestroying in ComponentState then exit;
|
||||||
|
|
||||||
FHints.ActivateHint(ScreenPos, BaseURL, TheHint, AutoShown);
|
FHints.ActivateHint(ScreenPos, BaseURL, TheHint, AutoShown, AMouseOffset);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditorManager.ActivateHint(const ScreenRect: TRect;
|
procedure TSourceEditorManager.ActivateHint(const ScreenRect: TRect;
|
||||||
const BaseURL, TheHint: string; AutoShown: Boolean);
|
const BaseURL, TheHint: string; AutoShown: Boolean; AMouseOffset: Boolean);
|
||||||
begin
|
begin
|
||||||
if csDestroying in ComponentState then exit;
|
if csDestroying in ComponentState then exit;
|
||||||
|
|
||||||
FHints.ActivateHint(ScreenRect, BaseURL, TheHint, AutoShown);
|
FHints.ActivateHint(ScreenRect, BaseURL, TheHint, AutoShown, AMouseOffset);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceEditorManager.OnCodeTemplateTokenNotFound(Sender: TObject;
|
procedure TSourceEditorManager.OnCodeTemplateTokenNotFound(Sender: TObject;
|
||||||
|
Loading…
Reference in New Issue
Block a user