Skip to content

Commit ae85218

Browse files
committed
Further work on #770: After hint animation was removed, we can also remove the global variable FHintWindowDestroyed, which was needed for coordinating hint animations.
1 parent 0a157c2 commit ae85218

File tree

1 file changed

+14
-72
lines changed

1 file changed

+14
-72
lines changed

Source/VirtualTrees.pas

Lines changed: 14 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -850,16 +850,12 @@ TVirtualTreeHintWindow = class(THintWindow)
850850
FTextHeight: Integer;
851851
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
852852
procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
853-
procedure WMShowWindow(var Message: TWMShowWindow); message WM_SHOWWINDOW;
854853
strict protected
855854
procedure CreateParams(var Params: TCreateParams); override;
856855
procedure Paint; override;
857856

858857
property HintData: TVTHintData read FHintData;
859-
function HintWindowDestroyed(): Boolean;
860858
public
861-
constructor Create(AOwner: TComponent); override;
862-
destructor Destroy; override;
863859
function CalcHintRect(MaxWidth: Integer; const AHint: string; AData: Pointer): TRect; override;
864860
function IsHintMsg(var Msg: TMsg): Boolean; override;
865861
end;
@@ -5432,34 +5428,8 @@ function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer
54325428
Result := S_OK;
54335429
end;
54345430

5435-
//----------------- TVirtualTreeHintWindow -----------------------------------------------------------------------------
5436-
5437-
var
5438-
// This variable is necessary to coordinate the complex interaction between different hints in the application
5439-
// and animated hints in our own class. Under certain conditions it can happen that our hint window is destroyed
5440-
// while it is still in the animation loop.
5441-
FHintWindowDestroyed: Boolean = True;
5442-
5443-
//----------------------------------------------------------------------------------------------------------------------
5444-
5445-
5446-
constructor TVirtualTreeHintWindow.Create(AOwner: TComponent);
5447-
5448-
begin
5449-
inherited;
5450-
FHintWindowDestroyed := False;
5451-
end;
54525431

5453-
//----------------------------------------------------------------------------------------------------------------------
5454-
5455-
destructor TVirtualTreeHintWindow.Destroy;
5456-
5457-
begin
5458-
FHintWindowDestroyed := True;
5459-
inherited;
5460-
end;
5461-
5462-
//----------------------------------------------------------------------------------------------------------------------
5432+
//----------------- TVirtualTreeHintWindow -----------------------------------------------------------------------------
54635433

54645434
procedure TVirtualTreeHintWindow.CMTextChanged(var Message: TMessage);
54655435

@@ -5469,16 +5439,6 @@ procedure TVirtualTreeHintWindow.CMTextChanged(var Message: TMessage);
54695439

54705440
//----------------------------------------------------------------------------------------------------------------------
54715441

5472-
function TVirtualTreeHintWindow.HintWindowDestroyed;
5473-
5474-
// This function exists to inform descendants if the hint window has been destroyed.
5475-
5476-
begin
5477-
Result := FHintWindowDestroyed;
5478-
end;
5479-
5480-
//----------------------------------------------------------------------------------------------------------------------
5481-
54825442
procedure TVirtualTreeHintWindow.WMEraseBkgnd(var Message: TWMEraseBkgnd);
54835443

54845444
// The control is fully painted by own code so don't erase its background as this causes flickering.
@@ -5488,22 +5448,6 @@ procedure TVirtualTreeHintWindow.WMEraseBkgnd(var Message: TWMEraseBkgnd);
54885448
end;
54895449

54905450

5491-
//----------------------------------------------------------------------------------------------------------------------
5492-
5493-
procedure TVirtualTreeHintWindow.WMShowWindow(var Message: TWMShowWindow);
5494-
5495-
// Clear hint data when the window becomes hidden.
5496-
5497-
begin
5498-
if not Message.Show then
5499-
begin
5500-
// If the hint window destruction flag to stop any hint window animation was set by a tree
5501-
// during its destruction then reset it here to allow other tree instances to still use
5502-
// this hint window.
5503-
FHintWindowDestroyed := False;
5504-
end;
5505-
end;
5506-
55075451
//----------------------------------------------------------------------------------------------------------------------
55085452

55095453
procedure TVirtualTreeHintWindow.CreateParams(var Params: TCreateParams);
@@ -16035,9 +15979,6 @@ procedure TBaseVirtualTree.CMHintShowPause(var Message: TCMHintShowPause);
1603515979
// Tells the application that the tree (and only the tree) does not want a delayed tool tip.
1603615980
// Normal hints / header hints use the default delay (except for the first time).
1603715981

16038-
var
16039-
P: TPoint;
16040-
1604115982
begin
1604215983
// A little workaround is needed here to make the application class using the correct hint window class.
1604315984
// Once the application gets ShowHint set to true (which is the case when we want to show hints in the tree) then
@@ -16046,15 +15987,19 @@ procedure TBaseVirtualTree.CMHintShowPause(var Message: TCMHintShowPause);
1604615987
// hints for the non-client area to show up (e.g. for the header) by calling CancelHint whenever certain messages
1604715988
// arrive. By setting the hint show pause to 0 if our hint class was not used recently we make sure
1604815989
// that the hint timer (in Forms.pas) is not used and our class is created immediately.
16049-
if FHintWindowDestroyed then
16050-
begin
16051-
GetCursorPos(P);
16052-
// Check if the mouse is in the header or tool tips are enabled, which must be shown without delay anyway.
16053-
if FHeader.UseColumns and (hoShowHint in FHeader.FOptions) and FHeader.InHeader(ScreenToClient(P)) or
16054-
(FHintMode = hmToolTip) then
16055-
Message.Pause^ := 0;
16056-
end
16057-
else
15990+
//
15991+
// Note for newer Delphi versions: Does not work because TApplication.HintMouseMessage() not only checks (Pause = 0) but also TApplication.FHintActive,
15992+
// which is initally False. So this code has been commented. See also issue #728.
15993+
// if FHintWindowDestroyed then
15994+
// begin
15995+
// GetCursorPos(P);
15996+
// // Check if the mouse is in the header or tool tips are enabled, which must be shown without delay anyway.
15997+
// if FHeader.UseColumns and (hoShowHint in FHeader.FOptions) and FHeader.InHeader(ScreenToClient(P)) or
15998+
// (FHintMode = hmToolTip) then
15999+
// Message.Pause^ := 0;
16000+
// end
16001+
// else
16002+
1605816003
if FHintMode = hmToolTip then
1605916004
Message.Pause^ := 0;
1606016005
end;
@@ -17526,9 +17471,6 @@ procedure TBaseVirtualTree.WMNCDestroy(var Message: TWMNCDestroy);
1752617471
// Clean up other stuff.
1752717472
DeleteObject(FDottedBrush);
1752817473
FDottedBrush := 0;
17529-
if tsInAnimation in FStates then
17530-
FHintWindowDestroyed := True; // Stop any pending animation.
17531-
1753217474
inherited;
1753317475
end;
1753417476

0 commit comments

Comments
 (0)