You've already forked lazarus-ccr
* 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:
@ -27,7 +27,15 @@ unit VirtualTrees;
|
|||||||
// (C) 1999-2001 digital publishing AG. All Rights Reserved.
|
// (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
|
// 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: 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: avoided race condition between TBaseVirtualTree.DeleteNode and the worker thread
|
||||||
// - Bug fix: TBaseVirtualTree.ToggleNode could produce an overflow if range checking was enabled
|
// - Bug fix: TBaseVirtualTree.ToggleNode could produce an overflow if range checking was enabled
|
||||||
@ -541,7 +549,8 @@ type
|
|||||||
ivsExpanded,
|
ivsExpanded,
|
||||||
ivsHasChildren,
|
ivsHasChildren,
|
||||||
ivsMultiline,
|
ivsMultiline,
|
||||||
ivsSelected
|
ivsSelected,
|
||||||
|
ivsFiltered
|
||||||
);
|
);
|
||||||
TVirtualNodeInitStates = set of TVirtualNodeInitState;
|
TVirtualNodeInitStates = set of TVirtualNodeInitState;
|
||||||
|
|
||||||
@ -5476,7 +5485,7 @@ begin
|
|||||||
Run := GetFirst;
|
Run := GetFirst;
|
||||||
while Assigned(Run) do
|
while Assigned(Run) do
|
||||||
begin
|
begin
|
||||||
if vsFiltered in Run.States then
|
if (vsFiltered in Run.States) and FullyVisible[Run] then
|
||||||
if toShowFilteredNodes in ToBeSet then
|
if toShowFilteredNodes in ToBeSet then
|
||||||
begin
|
begin
|
||||||
Inc(FVisibleCount);
|
Inc(FVisibleCount);
|
||||||
@ -9775,7 +9784,9 @@ function TVTHeader.HandleHeaderMouseMove(var Message: TLMMouseMove): Boolean;
|
|||||||
|
|
||||||
var
|
var
|
||||||
P: TPoint;
|
P: TPoint;
|
||||||
|
NextColumn,
|
||||||
I: TColumnIndex;
|
I: TColumnIndex;
|
||||||
|
NewWidth: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
@ -9798,8 +9809,26 @@ begin
|
|||||||
if hsColumnWidthTracking in FStates then
|
if hsColumnWidthTracking in FStates then
|
||||||
begin
|
begin
|
||||||
if DoColumnWidthTracking(FColumns.FTrackIndex, GetShiftState, FTrackPoint, P) then
|
if DoColumnWidthTracking(FColumns.FTrackIndex, GetShiftState, FTrackPoint, P) then
|
||||||
|
begin
|
||||||
if Treeview.UseRightToLeftAlignment then
|
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
|
else
|
||||||
FColumns[FColumns.FTrackIndex].Width := XPos - FTrackPoint.X;
|
FColumns[FColumns.FTrackIndex].Width := XPos - FTrackPoint.X;
|
||||||
HandleHeaderMouseMove := True;
|
HandleHeaderMouseMove := True;
|
||||||
@ -18486,11 +18515,7 @@ function TBaseVirtualTree.DoCreateEditor(Node: PVirtualNode; Column: TColumnInde
|
|||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
if Assigned(FOnCreateEditor) then
|
if Assigned(FOnCreateEditor) then
|
||||||
begin
|
|
||||||
FOnCreateEditor(Self, Node, Column, Result);
|
FOnCreateEditor(Self, Node, Column, Result);
|
||||||
if Result = nil then
|
|
||||||
ShowError(SEditLinkIsNil, hcTFEditLinkIsNil);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
@ -21476,6 +21501,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
if ivsMultiline in InitStates then
|
if ivsMultiline in InitStates then
|
||||||
Include(States, vsMultiline);
|
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.
|
// 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
|
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.
|
// Add the new node's height only if its parent is expanded.
|
||||||
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible[Node] then
|
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible[Node] then
|
||||||
AdjustTotalHeight(Destination.Parent, Node.TotalHeight, True);
|
AdjustTotalHeight(Destination.Parent, Node.TotalHeight, True);
|
||||||
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
|
if FullyVisible[Node] then
|
||||||
Inc(FVisibleCount, CountVisibleChildren(Node) + 1);
|
begin
|
||||||
|
Inc(FVisibleCount, CountVisibleChildren(Node));
|
||||||
|
if not IsEffectivelyFiltered[Node] then
|
||||||
|
Inc(FVisibleCount);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
amInsertAfter:
|
amInsertAfter:
|
||||||
begin
|
begin
|
||||||
@ -21797,8 +21828,12 @@ begin
|
|||||||
// Add the new node's height only if its parent is expanded.
|
// Add the new node's height only if its parent is expanded.
|
||||||
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible[Node] then
|
if (vsExpanded in Destination.Parent.States) and IsEffectivelyVisible[Node] then
|
||||||
AdjustTotalHeight(Destination.Parent, Node.TotalHeight, True);
|
AdjustTotalHeight(Destination.Parent, Node.TotalHeight, True);
|
||||||
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
|
if FullyVisible[Node] then
|
||||||
Inc(FVisibleCount, CountVisibleChildren(Node) + 1);
|
begin
|
||||||
|
Inc(FVisibleCount, CountVisibleChildren(Node));
|
||||||
|
if not IsEffectivelyFiltered[Node] then
|
||||||
|
Inc(FVisibleCount);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
amAddChildFirst:
|
amAddChildFirst:
|
||||||
begin
|
begin
|
||||||
@ -21833,8 +21868,12 @@ begin
|
|||||||
// Add the new node's height only if its parent is expanded.
|
// Add the new node's height only if its parent is expanded.
|
||||||
if (vsExpanded in Destination.States) and IsEffectivelyVisible[Node] then
|
if (vsExpanded in Destination.States) and IsEffectivelyVisible[Node] then
|
||||||
AdjustTotalHeight(Destination, Node.TotalHeight, True);
|
AdjustTotalHeight(Destination, Node.TotalHeight, True);
|
||||||
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
|
if FullyVisible[Node] then
|
||||||
Inc(FVisibleCount, CountVisibleChildren(Node) + 1);
|
begin
|
||||||
|
Inc(FVisibleCount, CountVisibleChildren(Node));
|
||||||
|
if not IsEffectivelyFiltered[Node] then
|
||||||
|
Inc(FVisibleCount);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
amAddChildLast:
|
amAddChildLast:
|
||||||
begin
|
begin
|
||||||
@ -21864,8 +21903,12 @@ begin
|
|||||||
// Add the new node's height only if its parent is expanded.
|
// Add the new node's height only if its parent is expanded.
|
||||||
if (vsExpanded in Destination.States) and IsEffectivelyVisible[Node] then
|
if (vsExpanded in Destination.States) and IsEffectivelyVisible[Node] then
|
||||||
AdjustTotalHeight(Destination, Node.TotalHeight, True);
|
AdjustTotalHeight(Destination, Node.TotalHeight, True);
|
||||||
if FullyVisible[Node] and not IsEffectivelyFiltered[Node] then
|
if FullyVisible[Node] then
|
||||||
Inc(FVisibleCount, CountVisibleChildren(Node) + 1);
|
begin
|
||||||
|
Inc(FVisibleCount, CountVisibleChildren(Node));
|
||||||
|
if not IsEffectivelyFiltered[Node] then
|
||||||
|
Inc(FVisibleCount);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
// amNoWhere: do nothing
|
// amNoWhere: do nothing
|
||||||
@ -21950,7 +21993,12 @@ begin
|
|||||||
if AdjustHeight then
|
if AdjustHeight then
|
||||||
AdjustTotalHeight(Parent, -Integer(Node.TotalHeight), True);
|
AdjustTotalHeight(Parent, -Integer(Node.TotalHeight), True);
|
||||||
if FullyVisible[Node] then
|
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
|
if Assigned(Node.PrevSibling) then
|
||||||
Node.PrevSibling.NextSibling := Node.NextSibling
|
Node.PrevSibling.NextSibling := Node.NextSibling
|
||||||
else
|
else
|
||||||
@ -28258,10 +28306,10 @@ begin
|
|||||||
|
|
||||||
// Make sure the target node is initialized.
|
// Make sure the target node is initialized.
|
||||||
if not (vsInitialized in Target.States) then
|
if not (vsInitialized in Target.States) then
|
||||||
InitNode(Target)
|
TargetTree.InitNode(Target)
|
||||||
else
|
else
|
||||||
if (vsHasChildren in Target.States) and (Target.ChildCount = 0) then
|
if (vsHasChildren in Target.States) and (Target.ChildCount = 0) then
|
||||||
InitChildren(Target);
|
TargetTree.InitChildren(Target);
|
||||||
|
|
||||||
if TargetTree = Self then
|
if TargetTree = Self then
|
||||||
begin
|
begin
|
||||||
|
Reference in New Issue
Block a user