mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 19:19:19 +02:00
anchordocking: keep splitters in client area
git-svn-id: trunk@28179 -
This commit is contained in:
parent
6d389c0b43
commit
7d0511c8ac
@ -1238,8 +1238,10 @@ var
|
||||
aManager: TAnchorDockManager;
|
||||
NewBounds: TRect;
|
||||
begin
|
||||
if Parent=nil then
|
||||
if Parent=nil then begin
|
||||
WorkArea:=Site.Monitor.WorkareaRect;
|
||||
//debugln(['SetupSite WorkArea=',dbgs(WorkArea)]);
|
||||
end;
|
||||
if IsCustomSite(Site) then begin
|
||||
aManager:=TAnchorDockManager(Site.DockManager);
|
||||
if Node.Count>0 then begin
|
||||
@ -4874,28 +4876,20 @@ end;
|
||||
|
||||
procedure TAnchorDockManager.ResetBounds(Force: Boolean);
|
||||
var
|
||||
Child: TAnchorDockHostSite;
|
||||
OldSiteClientRect: TRect;
|
||||
WidthDiff: Integer;
|
||||
HeightDiff: Integer;
|
||||
SiteMinSize: TPoint;
|
||||
ChildMaxSize: TPoint;
|
||||
ClientRectChanged: Boolean;
|
||||
AControl: TControl;
|
||||
b: TRect;
|
||||
|
||||
procedure AlignChilds;
|
||||
var
|
||||
i: Integer;
|
||||
b: TRect;
|
||||
AControl: TControl;
|
||||
ChildMaxSize: TPoint;
|
||||
SiteMinSize: TPoint;
|
||||
Child: TAnchorDockHostSite;
|
||||
begin
|
||||
if Force then ;
|
||||
|
||||
//debugln(['TAnchorDockManager.ResetBounds Site="',Site.Caption,'" Force=',Force,' ',dbgs(Site.ClientRect)]);
|
||||
OldSiteClientRect:=FSiteClientRect;
|
||||
FSiteClientRect:=Site.ClientRect;
|
||||
WidthDiff:=FSiteClientRect.Right-OldSiteClientRect.Right;
|
||||
HeightDiff:=FSiteClientRect.Bottom-OldSiteClientRect.Bottom;
|
||||
ClientRectChanged:=(WidthDiff<>0) or (HeightDiff<>0);
|
||||
if (not ClientRectChanged) and (not PreferredSiteSizeAsSiteMinimum) then
|
||||
exit;
|
||||
|
||||
if ClientRectChanged and DockMaster.Restoring then begin
|
||||
// ClientRect changed => restore bounds
|
||||
for i:=0 to Site.ControlCount-1 do begin
|
||||
@ -4905,13 +4899,30 @@ begin
|
||||
b:=TAnchorDockHostSite(AControl).DockRestoreBounds
|
||||
else if AControl is TAnchorDockSplitter then
|
||||
b:=TAnchorDockSplitter(AControl).DockRestoreBounds;
|
||||
if (b.Right>b.Left) and (b.Bottom>b.Top) then begin
|
||||
if (b.Right<=b.Left) or (b.Bottom<=b.Top) then
|
||||
b:=AControl.BoundsRect;
|
||||
//debugln(['TAnchorDockManager.ResetBounds RESTORE ',DbgSName(AControl),' Cur=',dbgs(AControl.BoundsRect),' Restore=',dbgs(b)]);
|
||||
if AControl is TAnchorDockSplitter then begin
|
||||
// fit splitter into clientarea
|
||||
if AControl.AnchorSide[akLeft].Control=nil then
|
||||
b.Left:=Max(0,Min(b.Left,Site.ClientWidth-10));
|
||||
if AControl.AnchorSide[akTop].Control=nil then
|
||||
b.Top:=Max(0,Min(b.Top,Site.ClientHeight-10));
|
||||
if TAnchorDockSplitter(AControl).ResizeAnchor in [akLeft,akRight] then
|
||||
begin
|
||||
b.Right:=b.Left+DockMaster.SplitterWidth;
|
||||
b.Bottom:=Max(1,Min(b.Bottom,Site.ClientHeight-b.Top));
|
||||
end
|
||||
else begin
|
||||
b.Right:=Max(1,Min(b.Right,Site.ClientWidth-b.Left));
|
||||
b.Bottom:=b.Top+DockMaster.SplitterWidth;
|
||||
end;
|
||||
end;
|
||||
|
||||
AControl.BoundsRect:=b;
|
||||
if AControl is TAnchorDockSplitter then
|
||||
TAnchorDockSplitter(AControl).UpdateDockBounds;
|
||||
end;
|
||||
end;
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -4946,6 +4957,19 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
if Force then ;
|
||||
|
||||
//debugln(['TAnchorDockManager.ResetBounds Site="',Site.Caption,'" Force=',Force,' ',dbgs(Site.ClientRect)]);
|
||||
OldSiteClientRect:=FSiteClientRect;
|
||||
FSiteClientRect:=Site.ClientRect;
|
||||
WidthDiff:=FSiteClientRect.Right-OldSiteClientRect.Right;
|
||||
HeightDiff:=FSiteClientRect.Bottom-OldSiteClientRect.Bottom;
|
||||
ClientRectChanged:=(WidthDiff<>0) or (HeightDiff<>0);
|
||||
if ClientRectChanged or PreferredSiteSizeAsSiteMinimum then
|
||||
AlignChilds;
|
||||
end;
|
||||
|
||||
procedure TAnchorDockManager.SaveToStream(Stream: TStream);
|
||||
begin
|
||||
if Stream=nil then ;
|
||||
|
Loading…
Reference in New Issue
Block a user