Skip to content

Commit 1a4e8d3

Browse files
joachimmarderSharlikran
authored andcommitted
Further work on JAM-Software#770: After hint animation was removed, we can also remove the global variable FHintWindowDestroyed, which was needed for coordinating hint animations.
1 parent c070629 commit 1a4e8d3

File tree

1 file changed

+14
-72
lines changed

1 file changed

+14
-72
lines changed

Source/VirtualTrees.pas

+14-72
Original file line numberDiff line numberDiff line change
@@ -862,16 +862,12 @@ TVirtualTreeHintWindow = class(THintWindow)
862862
FTextHeight: Integer;
863863
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
864864
procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
865-
procedure WMShowWindow(var Message: TWMShowWindow); message WM_SHOWWINDOW;
866865
strict protected
867866
procedure CreateParams(var Params: TCreateParams); override;
868867
procedure Paint; override;
869868

870869
property HintData: TVTHintData read FHintData;
871-
function HintWindowDestroyed(): Boolean;
872870
public
873-
constructor Create(AOwner: TComponent); override;
874-
destructor Destroy; override;
875871
function CalcHintRect(MaxWidth: Integer; const AHint: string; AData: Pointer): TRect; override;
876872
function IsHintMsg(var Msg: TMsg): Boolean; override;
877873
end;
@@ -5582,34 +5578,8 @@ function TVTDragManager.QueryContinueDrag(EscapePressed: BOOL; KeyState: Integer
55825578
Result := S_OK;
55835579
end;
55845580

5585-
//----------------- TVirtualTreeHintWindow -----------------------------------------------------------------------------
5586-
5587-
var
5588-
// This variable is necessary to coordinate the complex interaction between different hints in the application
5589-
// and animated hints in our own class. Under certain conditions it can happen that our hint window is destroyed
5590-
// while it is still in the animation loop.
5591-
FHintWindowDestroyed: Boolean = True;
5592-
5593-
//----------------------------------------------------------------------------------------------------------------------
5594-
5595-
5596-
constructor TVirtualTreeHintWindow.Create(AOwner: TComponent);
5597-
5598-
begin
5599-
inherited;
5600-
FHintWindowDestroyed := False;
5601-
end;
56025581

5603-
//----------------------------------------------------------------------------------------------------------------------
5604-
5605-
destructor TVirtualTreeHintWindow.Destroy;
5606-
5607-
begin
5608-
FHintWindowDestroyed := True;
5609-
inherited;
5610-
end;
5611-
5612-
//----------------------------------------------------------------------------------------------------------------------
5582+
//----------------- TVirtualTreeHintWindow -----------------------------------------------------------------------------
56135583

56145584
procedure TVirtualTreeHintWindow.CMTextChanged(var Message: TMessage);
56155585

@@ -5619,16 +5589,6 @@ procedure TVirtualTreeHintWindow.CMTextChanged(var Message: TMessage);
56195589

56205590
//----------------------------------------------------------------------------------------------------------------------
56215591

5622-
function TVirtualTreeHintWindow.HintWindowDestroyed;
5623-
5624-
// This function exists to inform descendants if the hint window has been destroyed.
5625-
5626-
begin
5627-
Result := FHintWindowDestroyed;
5628-
end;
5629-
5630-
//----------------------------------------------------------------------------------------------------------------------
5631-
56325592
procedure TVirtualTreeHintWindow.WMEraseBkgnd(var Message: TWMEraseBkgnd);
56335593

56345594
// The control is fully painted by own code so don't erase its background as this causes flickering.
@@ -5638,22 +5598,6 @@ procedure TVirtualTreeHintWindow.WMEraseBkgnd(var Message: TWMEraseBkgnd);
56385598
end;
56395599

56405600

5641-
//----------------------------------------------------------------------------------------------------------------------
5642-
5643-
procedure TVirtualTreeHintWindow.WMShowWindow(var Message: TWMShowWindow);
5644-
5645-
// Clear hint data when the window becomes hidden.
5646-
5647-
begin
5648-
if not Message.Show then
5649-
begin
5650-
// If the hint window destruction flag to stop any hint window animation was set by a tree
5651-
// during its destruction then reset it here to allow other tree instances to still use
5652-
// this hint window.
5653-
FHintWindowDestroyed := False;
5654-
end;
5655-
end;
5656-
56575601
//----------------------------------------------------------------------------------------------------------------------
56585602

56595603
procedure TVirtualTreeHintWindow.CreateParams(var Params: TCreateParams);
@@ -16336,9 +16280,6 @@ procedure TBaseVirtualTree.CMHintShowPause(var Message: TCMHintShowPause);
1633616280
// Tells the application that the tree (and only the tree) does not want a delayed tool tip.
1633716281
// Normal hints / header hints use the default delay (except for the first time).
1633816282

16339-
var
16340-
P: TPoint;
16341-
1634216283
begin
1634316284
// A little workaround is needed here to make the application class using the correct hint window class.
1634416285
// Once the application gets ShowHint set to true (which is the case when we want to show hints in the tree) then
@@ -16347,15 +16288,19 @@ procedure TBaseVirtualTree.CMHintShowPause(var Message: TCMHintShowPause);
1634716288
// hints for the non-client area to show up (e.g. for the header) by calling CancelHint whenever certain messages
1634816289
// arrive. By setting the hint show pause to 0 if our hint class was not used recently we make sure
1634916290
// that the hint timer (in Forms.pas) is not used and our class is created immediately.
16350-
if FHintWindowDestroyed then
16351-
begin
16352-
GetCursorPos(P);
16353-
// Check if the mouse is in the header or tool tips are enabled, which must be shown without delay anyway.
16354-
if FHeader.UseColumns and (hoShowHint in FHeader.FOptions) and FHeader.InHeader(ScreenToClient(P)) or
16355-
(FHintMode = hmToolTip) then
16356-
Message.Pause^ := 0;
16357-
end
16358-
else
16291+
//
16292+
// Note for newer Delphi versions: Does not work because TApplication.HintMouseMessage() not only checks (Pause = 0) but also TApplication.FHintActive,
16293+
// which is initally False. So this code has been commented. See also issue #728.
16294+
// if FHintWindowDestroyed then
16295+
// begin
16296+
// GetCursorPos(P);
16297+
// // Check if the mouse is in the header or tool tips are enabled, which must be shown without delay anyway.
16298+
// if FHeader.UseColumns and (hoShowHint in FHeader.FOptions) and FHeader.InHeader(ScreenToClient(P)) or
16299+
// (FHintMode = hmToolTip) then
16300+
// Message.Pause^ := 0;
16301+
// end
16302+
// else
16303+
1635916304
if FHintMode = hmToolTip then
1636016305
Message.Pause^ := 0;
1636116306
end;
@@ -17837,9 +17782,6 @@ procedure TBaseVirtualTree.WMNCDestroy(var Message: TWMNCDestroy);
1783717782
// Clean up other stuff.
1783817783
DeleteObject(FDottedBrush);
1783917784
FDottedBrush := 0;
17840-
if tsInAnimation in FStates then
17841-
FHintWindowDestroyed := True; // Stop any pending animation.
17842-
1784317785
inherited;
1784417786
end;
1784517787

0 commit comments

Comments
 (0)