lcl: LDockTree: fix drop to non-empty root zone (issue #0013770)

git-svn-id: trunk@20080 -
This commit is contained in:
paul 2009-05-20 14:55:59 +00:00
parent c521333873
commit 656d65cb06
3 changed files with 37 additions and 38 deletions

View File

@ -2125,11 +2125,11 @@ type
FDockSite: TWinControl;
FDockZoneClass: TDockZoneClass;
FFlags: TDockTreeFlags;
FRootZone: TDockZone;
FUpdateCount: Integer;
procedure DeleteZone(Zone: TDockZone);
procedure SetDockSite(const AValue: TWinControl);
protected
FRootZone: TDockZone;
function HitTest(const MousePos: TPoint; var HTFlag: Integer): TControl; virtual;
procedure PaintDockFrame(ACanvas: TCanvas; AControl: TControl;
const ARect: TRect); virtual;

View File

@ -87,15 +87,13 @@ end;
function TDockZone.GetHeight: Integer;
begin
if not Visible then
Result := 0
Exit(0);
if FTree.RootZone = Self then
Result := FTree.FDockSite.ClientHeight
else
if (FChildControl <> nil) then
begin
if FTree.RootZone = Self then
Result := FChildControl.ClientHeight
else
Result := FChildControl.Height
end
Result := FChildControl.Height
else
begin
if FParentZone.Orientation = doHorizontal then
@ -108,15 +106,13 @@ end;
function TDockZone.GetLeft: Integer;
begin
if not Visible then
Exit(0);
if FTree.RootZone = Self then
Result := 0
else
if (FChildControl <> nil) then
begin
if FTree.RootZone = Self then
Result := 0
else
Result := FChildControl.Left
end
Result := FChildControl.Left
else
begin
if FParentZone.Orientation = doVertical then
@ -153,13 +149,11 @@ begin
if not Visible then
Exit(0);
if FTree.RootZone = Self then
Result := 0
else
if (FChildControl <> nil) then
begin
if FTree.RootZone = Self then
Result := 0
else
Result := FChildControl.Top
end
Result := FChildControl.Top
else
begin
if FParentZone.Orientation = doHorizontal then
@ -195,13 +189,11 @@ begin
if not Visible then
Exit(0);
if FTree.RootZone = Self then
Result := FTree.FDockSite.ClientWidth
else
if (FChildControl <> nil) then
begin
if FTree.RootZone = Self then
Result := FChildControl.ClientWidth
else
Result := FChildControl.Width
end
Result := FChildControl.Width
else
begin
if FParentZone.Orientation = doVertical then

View File

@ -1122,7 +1122,8 @@ begin
//DebugLn(['TLazDockTree.AnchorDockLayout CurControl.Parent=',DbgSName(CurControl.Parent),' ',CurControl.Visible]);
for a := Low(TAnchorKind) to High(TAnchorKind) do
begin
CurControl.AnchorSide[a].Control := AnchorControls[a];
if AnchorControls[a] <> CurControl then
CurControl.AnchorSide[a].Control := AnchorControls[a];
if (AnchorControls[a] <> nil) and (AnchorControls[a].Parent = CurControl.Parent) then
CurControl.AnchorSide[a].Side := DefaultSideForAnchorKind[a]
else
@ -1307,6 +1308,8 @@ begin
if OldParentZone <> nil then
OldParentZone.ReplaceChild(DropZone, NewParentZone);
NewParentZone.AddAsFirstChild(DropZone);
if RootZone = DropZone then
FRootZone := NewParentZone;
end;
if DropZone.Parent = nil then
@ -1808,19 +1811,23 @@ function TLazDockZone.GetParentControl: TWinControl;
var
Zone: TDockZone;
begin
Result:=nil;
Zone:=Parent;
while Zone<>nil do begin
if Zone.Orientation=doPages then begin
Result:=(Zone as TLazDockZone).Pages;
exit;
end;
if (Zone.Parent=nil) then begin
Result := nil;
Zone := Parent;
while Zone <> nil do
begin
if Zone.Orientation = doPages then
Exit((Zone as TLazDockZone).Pages);
if (Zone.Parent = nil) then
begin
if Zone.ChildControl is TWinControl then
Result:=TWinControl(Zone.ChildControl);
exit;
Result := TWinControl(Zone.ChildControl)
else
if Zone = Tree.RootZone then
Result := Tree.DockSite;
Exit;
end;
Zone:=Zone.Parent;
Zone := Zone.Parent;
end;
end;