* Synchronize with main VTV repository up to svn rev 180

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@775 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2009-04-11 12:41:14 +00:00
parent 71288d8d81
commit e2b84fd41a

View File

@ -2,7 +2,7 @@ unit VirtualTrees;
{$mode delphi}{$H+} {$mode delphi}{$H+}
// Version 4.8.3 // Version 4.8.5
// //
// The contents of this file are subject to the Mozilla Public License // The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in compliance // Version 1.1 (the "License"); you may not use this file except in compliance
@ -27,6 +27,12 @@ unit VirtualTrees;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// //
// March 2009 // March 2009
// - Bug fix: fixed an issue in TVirtualTreeColumns.HandleClick that could lead to a case where no header click event
// is triggered
// - Bug fix: fixed an issue in TBaseVirtualTree.HandleHotTrack that could lead to an endless loop under certain
// conditions
// - Improvement: removed unused variables in TVirtualTreeColumn.ComputeHeaderLayout
// - Bug fix: corrected TBaseVirtualTree.GetVisibleParent
// - Improvement: extended hot node tracking to track the hot column too // - Improvement: extended hot node tracking to track the hot column too
// - Improvement: new THitPosition hiOnItemButtonExact used to draw hot buttons when using Windows Vista's Explorer // - Improvement: new THitPosition hiOnItemButtonExact used to draw hot buttons when using Windows Vista's Explorer
// theme // theme
@ -315,7 +321,7 @@ uses
const const
{$I lclconstants.inc} {$I lclconstants.inc}
VTVersion = '4.8.3'; VTVersion = '4.8.5';
VTTreeStreamVersion = 2; VTTreeStreamVersion = 2;
VTHeaderStreamVersion = 6; // The header needs an own stream version to indicate changes only relevant to the header. VTHeaderStreamVersion = 6; // The header needs an own stream version to indicate changes only relevant to the header.
@ -7802,9 +7808,6 @@ var
TextSpacing: Integer; TextSpacing: Integer;
UseText: Boolean; UseText: Boolean;
R: TRect; R: TRect;
CaptionText: UTF8String;
H1,
H2: Integer;
begin begin
UseText := Length(FText) > 0; UseText := Length(FText) > 0;
@ -8934,17 +8937,18 @@ begin
Shift := FHeader.GetShiftState; Shift := FHeader.GetShiftState;
if DblClick then if DblClick then
Shift := Shift + [ssDouble]; Shift := Shift + [ssDouble];
if not Items[NewClickIndex].FHasImage then // If there is no image for this column, perform normal HeaderClick. if Items[NewClickIndex].FHasImage and PtInRect(Items[NewClickIndex].FImageRect, P) then
FHeader.Treeview.DoHeaderClick(NewClickIndex, Button, Shift, P.X, P.Y) begin
if Items[NewClickIndex].CheckBox then
begin
FHeader.Treeview.UpdateColumnCheckState(Items[NewClickIndex]);
FHeader.Treeview.DoHeaderCheckBoxClick(NewClickIndex, Button, Shift, P.X, P.Y);
end
else
FHeader.Treeview.DoHeaderImageClick(NewClickIndex, Button, Shift, P.X, P.Y)
end
else else
if PtInRect(Items[NewClickIndex].FImageRect, P) then FHeader.Treeview.DoHeaderClick(NewClickIndex, Button, Shift, P.X, P.Y);
if not Items[NewClickIndex].CheckBox then
FHeader.Treeview.DoHeaderImageClick(NewClickIndex, Button, Shift, P.X, P.Y)
else
begin
FHeader.Treeview.UpdateColumnCheckState(Items[NewClickIndex]);
FHeader.Treeview.DoHeaderCheckBoxClick(NewClickIndex, Button, Shift, P.X, P.Y);
end;
FHeader.Invalidate(Items[NewClickIndex]); FHeader.Invalidate(Items[NewClickIndex]);
end end
else else
@ -20294,7 +20298,9 @@ procedure TBaseVirtualTree.DoHeaderImageClick(Column: TColumnIndex; Button: TMou
begin begin
if Assigned(FOnHeaderImageClick) then if Assigned(FOnHeaderImageClick) then
FOnHeaderImageClick(FHeader, Column, Button, Shift, X, Y); FOnHeaderImageClick(FHeader, Column, Button, Shift, X, Y)
else if Assigned(FOnHeaderClick) then
FOnHeaderClick(FHeader, Column, Button, Shift, X, Y)
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -21943,7 +21949,7 @@ begin
FCurrentHotColumn := HitInfo.HitColumn; FCurrentHotColumn := HitInfo.HitColumn;
end; end;
ButtonIsHit := hiOnItemButtonExact in HitInfo.HitPositions; ButtonIsHit := (hiOnItemButtonExact in HitInfo.HitPositions) and (toHotTrack in FOptions.FPaintOptions);
if Assigned(FCurrentHotNode) and ((FHotNodeButtonHit <> ButtonIsHit) or DoInvalidate) then if Assigned(FCurrentHotNode) and ((FHotNodeButtonHit <> ButtonIsHit) or DoInvalidate) then
begin begin
FHotNodeButtonHit := ButtonIsHit and (toHotTrack in FOptions.FPaintOptions); FHotNodeButtonHit := ButtonIsHit and (toHotTrack in FOptions.FPaintOptions);
@ -28662,20 +28668,8 @@ begin
Assert(Assigned(Node), 'Node must not be nil.'); Assert(Assigned(Node), 'Node must not be nil.');
Result := Node; Result := Node;
while Result <> FRoot do while (Result <> FRoot) and not FullyVisible[Result] do
begin Result := Result.Parent;
// FRoot is always expanded hence the loop will safely stop there if no other node is expanded
repeat
Result := Result.Parent;
until vsExpanded in Result.States;
if (Result = FRoot) or FullyVisible[Result] then
Break;
// if there is still a collapsed parent node then advance to it and repeat the entire loop
while (Result <> FRoot) and (vsExpanded in Result.Parent.States) do
Result := Result.Parent;
end;
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------