From f59b54561ea08a7c98ba95d52be5640f26a78c16 Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 4 Feb 2009 20:00:28 +0000 Subject: [PATCH] LCL: TTreeView: accelerated TTreeNode.Index git-svn-id: trunk@18569 - --- lcl/include/treeview.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lcl/include/treeview.inc b/lcl/include/treeview.inc index 7943ae4219..c06163d07c 100644 --- a/lcl/include/treeview.inc +++ b/lcl/include/treeview.inc @@ -1004,6 +1004,7 @@ begin // many algorithms uses the last sibling, so we check that first for speed if (Parent<>nil) and (Parent[Parent.Count-1]=Self) then begin Result:=Parent.Count-1; + FIndex:=Result; exit; end; // count previous siblings @@ -1011,8 +1012,13 @@ begin ANode := Self; while ANode <> nil do begin Inc(Result); + if ANode.FIndex>=0 then begin + inc(Result,ANode.FIndex); + break; + end; ANode := ANode.GetPrevSibling; end; + FIndex:=Result; end; function TTreeNode.GetItems(AnIndex: Integer): TTreeNode;