* Synchronize with main VTV repository up to svn rev 214

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2913 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2014-03-24 02:22:09 +00:00
parent 8e35e741ad
commit 70a2c2dc34

View File

@ -27,7 +27,15 @@ unit VirtualTrees;
// (C) 1999-2001 digital publishing AG. All Rights Reserved.
//----------------------------------------------------------------------------------------------------------------------
//
// August 2009
// - Bug fix: TBaseVirtualTree.MoveTo now initializes the target node using the target tree
// - Bug fix: TBaseVirtualTree.FVisibleCount is now calculated correctly when using filtered nodes
// - Improvement: introduced new initial node state ivsFiltered
// July 2009
// - Improvement: modified TVTHeader.HandleHeaderMouseMove to make resizing the autosize column with the
// mouse possible
// - Improvement: modified TBaseVirtualTree.DoCreateEditor so that applications can now return NIL in OnCreateEditor
// to use the standard editor of the tree
// - Bug fix: pressing CTRL + PgUp/PgDown no longer leads to an index-out-of-bounds exception if no columns are used
// - Bug fix: avoided race condition between TBaseVirtualTree.DeleteNode and the worker thread
// - Bug fix: TBaseVirtualTree.ToggleNode could produce an overflow if range checking was enabled
@ -541,7 +549,8 @@ type
ivsExpanded,
ivsHasChildren,
ivsMultiline,
ivsSelected
ivsSelected,
ivsFiltered
);
TVirtualNodeInitStates = set of TVirtualNodeInitState;
@ -5476,7 +5485,7 @@ begin
Run := GetFirst;
while Assigned(Run) do
begin
if vsFiltered in Run.States then
if (vsFiltered in Run.States) and FullyVisible[Run] then
if toShowFilteredNodes in ToBeSet then
begin
Inc(FVisibleCount);
@ -9775,7 +9784,9 @@ function TVTHeader.HandleHeaderMouseMove(var Message: TLMMouseMove): Boolean;
var
P: TPoint;
NextColumn,
I: TColumnIndex;
NewWidth: Integer;
begin
Result := False;
@ -9798,8 +9809,26 @@ begin
if hsColumnWidthTracking in FStates then
begin
if DoColumnWidthTracking(FColumns.FTrackIndex, GetShiftState, FTrackPoint, P) then
begin
if Treeview.UseRightToLeftAlignment then
FColumns[FColumns.FTrackIndex].Width := FTrackPoint.X - XPos
begin
NewWidth := FTrackPoint.X - XPos;
NextColumn := FColumns.GetPreviousVisibleColumn(FColumns.FTrackIndex);
end
else
begin
NewWidth := XPos - FTrackPoint.X;
NextColumn := FColumns.GetNextVisibleColumn(FColumns.FTrackIndex);
end;
// The autosized column cannot be resized using the mouse normally. Instead we resize the next
// visible column, so it look as we directly resize the autosized column.
if (hoAutoResize in FOptions) and (FColumns.FTrackIndex = FAutoSizeIndex) and
(NextColumn > NoColumn) and (coResizable in FColumns[NextColumn].FOptions) and
(FColumns[FColumns.FTrackIndex].FMinWidth < NewWidth) and
(FColumns[FColumns.FTrackIndex].FMaxWidth > NewWidth) then
FColumns[NextColumn].Width := FColumns[NextColumn].Width - NewWidth
+ FColumns[FColumns.FTrackIndex].Width
else
FColumns[FColumns.FTrackIndex].Width := XPos - FTrackPoint.X;
HandleHeaderMouseMove := True;
@ -18486,11 +18515,7 @@ function TBaseVirtualTree.DoCreateEditor(Node: PVirtualNode; Column: TColumnInde
begin
Result := nil;
if Assigned(FOnCreateEditor) then
begin
FOnCreateEditor(Self, Node, Column, Result);
if Result = nil then
ShowError(SEditLinkIsNil, hcTFEditLinkIsNil);
end;
end;
//----------------------------------------------------------------------------------------------------------------------
@ -21476,6 +21501,8 @@ begin
end;
if ivsMultiline in InitStates then
Include(States, vsMultiline);
if ivsFiltered in InitStates then
Include(States, vsFiltered);
// Expanded may already be set (when called from ReinitNode) or be set in DoInitNode, allow both.
if (vsExpanded in Node.States) xor (ivsExpanded in InitStates) then
@ -21767,8 +21794,12 @@ begin
// Add the new node's height only if its parent is expanded.
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible[Node] then
AdjustTotalHeight(Destination.Parent, Node.TotalHeight, True);
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
Inc(FVisibleCount, CountVisibleChildren(Node) + 1);
if FullyVisible[Node] then
begin
Inc(FVisibleCount, CountVisibleChildren(Node));
if not IsEffectivelyFiltered[Node] then
Inc(FVisibleCount);
end;
end;
amInsertAfter:
begin
@ -21797,8 +21828,12 @@ begin
// Add the new node's height only if its parent is expanded.
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible[Node] then
AdjustTotalHeight(Destination.Parent, Node.TotalHeight, True);
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
Inc(FVisibleCount, CountVisibleChildren(Node) + 1);
if FullyVisible[Node] then
begin
Inc(FVisibleCount, CountVisibleChildren(Node));
if not IsEffectivelyFiltered[Node] then
Inc(FVisibleCount);
end;
end;
amAddChildFirst:
begin
@ -21833,8 +21868,12 @@ begin
// Add the new node's height only if its parent is expanded.
if (vsExpanded in Destination.States) and IsEffectivelyVisible[Node] then
AdjustTotalHeight(Destination, Node.TotalHeight, True);
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
Inc(FVisibleCount, CountVisibleChildren(Node) + 1);
if FullyVisible[Node] then
begin
Inc(FVisibleCount, CountVisibleChildren(Node));
if not IsEffectivelyFiltered[Node] then
Inc(FVisibleCount);
end;
end;
amAddChildLast:
begin
@ -21864,8 +21903,12 @@ begin
// Add the new node's height only if its parent is expanded.
if (vsExpanded in Destination.States) and IsEffectivelyVisible[Node] then
AdjustTotalHeight(Destination, Node.TotalHeight, True);
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
Inc(FVisibleCount, CountVisibleChildren(Node) + 1);
if FullyVisible[Node] then
begin
Inc(FVisibleCount, CountVisibleChildren(Node));
if not IsEffectivelyFiltered[Node] then
Inc(FVisibleCount);
end;
end;
else
// amNoWhere: do nothing
@ -21950,7 +21993,12 @@ begin
if AdjustHeight then
AdjustTotalHeight(Parent, -Integer(Node.TotalHeight), True);
if FullyVisible[Node] then
Dec(FVisibleCount, CountVisibleChildren(Node) + 1);
begin
Dec(FVisibleCount, CountVisibleChildren(Node));
if not IsEffectivelyFiltered[Node] then
Dec(FVisibleCount);
end;
if Assigned(Node.PrevSibling) then
Node.PrevSibling.NextSibling := Node.NextSibling
else
@ -28258,10 +28306,10 @@ begin
// Make sure the target node is initialized.
if not (vsInitialized in Target.States) then
InitNode(Target)
TargetTree.InitNode(Target)
else
if (vsHasChildren in Target.States) and (Target.ChildCount = 0) then
InitChildren(Target);
TargetTree.InitChildren(Target);
if TargetTree = Self then
begin