From bf42bc94f5af7b62fef4247a6e93b356b82a2764 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 3 Mar 2008 03:17:02 +0000 Subject: [PATCH] simplify docking code a bit git-svn-id: trunk@14371 - --- lcl/include/control.inc | 5 ++--- lcl/include/dragobject.inc | 21 ++------------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/lcl/include/control.inc b/lcl/include/control.inc index e987352fd1..306353b5df 100644 --- a/lcl/include/control.inc +++ b/lcl/include/control.inc @@ -201,11 +201,10 @@ begin DropAlign, FDockRect); end else begin - FDockRect.TopLeft := Point( - DragPos.X - DragDockObject.DockOffset.x, - DragPos.Y - DragDockObject.DockOffset.y); with FDockRect do begin + Left := DragPos.X; + Top := DragPos.Y; Right := Left + Control.UndockWidth; Bottom := Top + Control.UndockHeight; end; diff --git a/lcl/include/dragobject.inc b/lcl/include/dragobject.inc index 17fc9b7fb6..3ae448540a 100644 --- a/lcl/include/dragobject.inc +++ b/lcl/include/dragobject.inc @@ -74,24 +74,9 @@ end; { TDragDockObject } procedure TDragDockObject.AdjustDockRect(ARect: TRect); - - function AbsMin(Value1, Value2: Integer): Integer; - begin - if Abs(Value1) < Abs(Value2) then Result := Value1 - else Result := Value2; - end; - -var - DeltaX, DeltaY: Integer; begin - if (ARect.Left > FDragPos.x) or (ARect.Right < FDragPos.x) then - DeltaX := AbsMin(ARect.Left - FDragPos.x, ARect.Right - FDragPos.x) - else DeltaX := 0; - if (ARect.Top > FDragPos.y) or (ARect.Bottom < FDragPos.y) then - DeltaY := AbsMin(ARect.Top - FDragPos.y, ARect.Bottom - FDragPos.y) - else DeltaY := 0; - if (DeltaX <> 0) or (DeltaY <> 0) then - OffsetRect(FDockRect, -DeltaX, -DeltaY); + with DockOffset do + OffsetRect(FDockRect, -X, -Y); end; function TDragDockObject.GetDragCursor(Accepted: Boolean; X, Y: Integer): TCursor; @@ -105,6 +90,4 @@ begin FControl.DoEndDock(Target, X, Y); end; - - // included by controls.pp