From 754079f0e262faff30434af074baa0b6e39fc7c8 Mon Sep 17 00:00:00 2001 From: blikblum Date: Mon, 8 Dec 2008 01:36:47 +0000 Subject: [PATCH] * Readd the fixes to the header position that were lost after rev 619 git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@621 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../virtualtreeview-unstable/VirtualTrees.pas | 92 ++++++++++--------- 1 file changed, 51 insertions(+), 41 deletions(-) diff --git a/components/virtualtreeview-unstable/VirtualTrees.pas b/components/virtualtreeview-unstable/VirtualTrees.pas index d8784f506..0166e3f0c 100644 --- a/components/virtualtreeview-unstable/VirtualTrees.pas +++ b/components/virtualtreeview-unstable/VirtualTrees.pas @@ -10569,46 +10569,49 @@ var begin if (hoVisible in FOptions) and Treeview.HandleAllocated then - with Treeview do + with Treeview do + begin + if Column = nil then + R := FHeaderRect + else begin - if Column = nil then - R := FHeaderRect - else + R := Column.GetRect; + if not (coFixed in Column.Options) then + OffsetRect(R, -FEffectiveOffsetX, 0); + if UseRightToLeftAlignment then + OffsetRect(R, ComputeRTLOffset, 0); + if ExpandToBorder then begin - R := Column.GetRect; - if not (coFixed in Column.Options) then - OffsetRect(R, -FEffectiveOffsetX, 0); - if UseRightToLeftAlignment then - OffsetRect(R, ComputeRTLOffset, 0); - if ExpandToBorder then + if (hoFullRepaintOnResize in FHeader.FOptions) then + begin + R.Left := FHeaderRect.Left; + R.Right := FHeaderRect.Right; + end else begin - if (hoFullRepaintOnResize in FHeader.FOptions) then - begin - R.Left := FHeaderRect.Left; - R.Right := FHeaderRect.Right; - end else - begin if UseRightToLeftAlignment then R.Left := FHeaderRect.Left else R.Right := FHeaderRect.Right; - end; end; end; - - { - // Current position of the owner in screen coordinates. - GetWindowRect(Handle, RW); - - // Consider the header within this rectangle. - OffsetRect(R, RW.Left, RW.Top); - - // Expressed in client coordinates (because RedrawWindow wants them so, they will actually become negative). - MapWindowPoints(0, Handle, R, 2); - RedrawWindow(Handle, @R, 0, RDW_FRAME or RDW_INVALIDATE or RDW_VALIDATE or RDW_NOINTERNALPAINT or - RDW_NOERASE or RDW_NOCHILDREN); - } end; + //lclheader + RedrawWindow(Handle, @R, 0, RDW_FRAME or RDW_INVALIDATE or RDW_VALIDATE or RDW_NOINTERNALPAINT or + RDW_NOERASE or RDW_NOCHILDREN); + + { + // Current position of the owner in screen coordinates. + GetWindowRect(Handle, RW); + + // Consider the header within this rectangle. + OffsetRect(R, RW.Left, RW.Top); + + // Expressed in client coordinates (because RedrawWindow wants them so, they will actually become negative). + MapWindowPoints(0, Handle, R, 2); + RedrawWindow(Handle, @R, 0, RDW_FRAME or RDW_INVALIDATE or RDW_VALIDATE or RDW_NOINTERNALPAINT or + RDW_NOERASE or RDW_NOCHILDREN); + } + end; end; //---------------------------------------------------------------------------------------------------------------------- @@ -29223,7 +29226,8 @@ begin if toChildrenAbove in FOptions.FPaintOptions then begin PosHoldable := (FOffsetY + (Integer(Node.TotalHeight - NodeHeight[Node]))) <= 0; - NodeInView := Up.Top < ClientHeight; + //lclheader + NodeInView := Up.Top < inherited GetClientRect.Bottom; Steps := 0; if NodeInView then begin @@ -29240,7 +29244,8 @@ begin FOffsetY + (Up.Bottom - Integer(Node.TotalHeight))); Up.Top := Max(Up.Bottom - Integer(Node.TotalHeight), FOffsetY + (Up.Bottom - Integer(Node.TotalHeight))); - Up.Bottom := ClientHeight; + //lclheader + Up.Bottom := inherited GetClientRect.Bottom; end; end; end @@ -29248,12 +29253,15 @@ begin begin Mode := tamScrollUp; Inc(Up.Top, NodeHeight[Node]); - Up.Bottom := ClientHeight; + //lclheader + Up.Bottom := inherited GetClientRect.Bottom; + Steps := Min(Up.Bottom - Up.Top + 1, Node.TotalHeight - NodeHeight[Node]); - end;; + end; // No animation necessary if the node is below the current client height. - if Up.Top < ClientHeight then + //lclheader + if Up.Top < inherited GetClientRect.Bottom then begin Window := Handle; DC := GetDC(Handle); @@ -29269,7 +29277,7 @@ begin end; // Remind old height to keep the nodes position if toChildrenAbove is set. - OldHeight := Node.TotalHeight; + OldHeight := Node.TotalHeight; // collapse the node AdjustTotalHeight(Node, NodeHeight[Node]); @@ -29327,12 +29335,14 @@ begin // is to keep the nodes visual position so the user does not get confused. As a result we need to // scroll the view when the expanding is done. To determine what to do after expanding we need to check // the cases below. - TotalFit := NewHeight + Integer(NodeHeight[Node]) <= ClientHeight; - PosHoldable := TotalFit and ((FOffsetY - NewHeight) >= -(Integer(FRangeY) - ClientHeight)); + //lclheader + //todo: add a variable to hold the actual clientheight + TotalFit := NewHeight + Integer(NodeHeight[Node]) <= inherited GetClientRect.Bottom; + PosHoldable := TotalFit and ((FOffsetY - NewHeight) >= -(Integer(FRangeY) - inherited GetClientRect.Bottom)); ChildrenInView := (Down.Top - NewHeight) >= 0; - NodeInView := (PosHoldable or ((Down.Bottom + NewHeight) <= ClientHeight)) - and (Down.Bottom < ClientHeight - 1); - Down.Bottom := ClientHeight; + NodeInView := (PosHoldable or ((Down.Bottom + NewHeight) <= inherited GetClientRect.Bottom)) + and (Down.Bottom < inherited GetClientRect.Bottom - 1); + Down.Bottom := inherited GetClientRect.Bottom; end; end;