LCL: AnchorDocking: Cleanup: Comment not needed debug lines.

git-svn-id: trunk@59822 -
This commit is contained in:
michl 2018-12-13 23:36:26 +00:00
parent 2bb0b31bbb
commit 75136b6580
2 changed files with 41 additions and 2 deletions

View File

@ -91,6 +91,7 @@ unit AnchorDocking;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
// better use this definitions in project options, as it used in other units too
{ $DEFINE VerboseAnchorDockRestore} { $DEFINE VerboseAnchorDockRestore}
{ $DEFINE VerboseADCustomSite} { $DEFINE VerboseADCustomSite}
{ $DEFINE VerboseAnchorDockPages} { $DEFINE VerboseAnchorDockPages}
@ -3381,8 +3382,10 @@ begin
if AFormOrDockPanel=nil then continue; if AFormOrDockPanel=nil then continue;
if SavedSites.IndexOf(AFormOrDockPanel)>=0 then continue; if SavedSites.IndexOf(AFormOrDockPanel)>=0 then continue;
SavedSites.Add(AFormOrDockPanel); SavedSites.Add(AFormOrDockPanel);
{$IFDEF VerboseAnchorDockRestore}
debugln(['TAnchorDockMaster.SaveMainLayoutToTree AForm=',DbgSName(AFormOrDockPanel)]); debugln(['TAnchorDockMaster.SaveMainLayoutToTree AForm=',DbgSName(AFormOrDockPanel)]);
DebugWriteChildAnchors(AFormOrDockPanel,true,true); DebugWriteChildAnchors(AFormOrDockPanel,true,true);
{$ENDIF}
if AFormOrDockPanel is TAnchorDockPanel then begin if AFormOrDockPanel is TAnchorDockPanel then begin
SaveFormOrDockPanel(GetParentFormOrDockPanel(AFormOrDockPanel),true,false); SaveFormOrDockPanel(GetParentFormOrDockPanel(AFormOrDockPanel),true,false);
//LayoutNode:=LayoutTree.NewNode(LayoutTree.Root); //LayoutNode:=LayoutTree.NewNode(LayoutTree.Root);
@ -3638,7 +3641,9 @@ var
aManager: TAnchorDockManager; aManager: TAnchorDockManager;
DockObject: TDragDockObject; DockObject: TDragDockObject;
begin begin
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockMaster.ManualDock SrcSite=',DbgSName(SrcSite),' TargetSite=',DbgSName(TargetSite),' Align=',dbgs(Align),' TargetControl=',DbgSName(TargetControl)]); debugln(['TAnchorDockMaster.ManualDock SrcSite=',DbgSName(SrcSite),' TargetSite=',DbgSName(TargetSite),' Align=',dbgs(Align),' TargetControl=',DbgSName(TargetControl)]);
{$ENDIF}
if SrcSite=TargetSite then exit; if SrcSite=TargetSite then exit;
if SrcSite.IsParentOf(TargetSite) then if SrcSite.IsParentOf(TargetSite) then
raise Exception.Create('TAnchorDockMaster.ManualDock SrcSite.IsParentOf(TargetSite)'); raise Exception.Create('TAnchorDockMaster.ManualDock SrcSite.IsParentOf(TargetSite)');
@ -3650,7 +3655,9 @@ begin
Site:=aManager.GetChildSite; Site:=aManager.GetChildSite;
if Site=nil then begin if Site=nil then begin
// dock as first site into custom dock site // dock as first site into custom dock site
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockMaster.ManualDock dock as first site into custom dock site: SrcSite=',DbgSName(SrcSite),' TargetSite=',DbgSName(TargetSite),' Align=',dbgs(Align)]); debugln(['TAnchorDockMaster.ManualDock dock as first site into custom dock site: SrcSite=',DbgSName(SrcSite),' TargetSite=',DbgSName(TargetSite),' Align=',dbgs(Align)]);
{$ENDIF}
BeginUpdate; BeginUpdate;
try try
DockObject := TDragDockObject.Create(SrcSite); DockObject := TDragDockObject.Create(SrcSite);
@ -4111,7 +4118,9 @@ var
OldControl: TControl; OldControl: TControl;
begin begin
Result:=true; Result:=true;
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockHostSite.DockSecondControl Self="',Caption,'" AControl=',DbgSName(NewControl),' Align=',dbgs(DockAlign),' Inside=',Inside]); debugln(['TAnchorDockHostSite.DockSecondControl Self="',Caption,'" AControl=',DbgSName(NewControl),' Align=',dbgs(DockAlign),' Inside=',Inside]);
{$ENDIF}
if SiteType<>adhstOneControl then if SiteType<>adhstOneControl then
RaiseGDBException('TAnchorDockHostSite.DockSecondControl inconsistency: not adhstOneControl'); RaiseGDBException('TAnchorDockHostSite.DockSecondControl inconsistency: not adhstOneControl');
if not (DockAlign in [alLeft,alTop,alRight,alBottom]) then if not (DockAlign in [alLeft,alTop,alRight,alBottom]) then
@ -4132,8 +4141,9 @@ begin
OldSite.BoundsRect:=Rect(0,0,ClientWidth,ClientHeight); OldSite.BoundsRect:=Rect(0,0,ClientWidth,ClientHeight);
Result:=DockAnotherControl(OldSite,NewControl,DockAlign,Inside); Result:=DockAnotherControl(OldSite,NewControl,DockAlign,Inside);
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockHostSite.DockSecondControl END Self="',Caption,'" AControl=',DbgSName(NewControl),' Align=',dbgs(DockAlign),' Inside=',Inside]); debugln(['TAnchorDockHostSite.DockSecondControl END Self="',Caption,'" AControl=',DbgSName(NewControl),' Align=',dbgs(DockAlign),' Inside=',Inside]);
{$ENDIF}
end; end;
function TAnchorDockHostSite.DockAnotherControl(Sibling, NewControl: TControl; function TAnchorDockHostSite.DockAnotherControl(Sibling, NewControl: TControl;
@ -4234,8 +4244,10 @@ begin
BoundsIncreased:=true; BoundsIncreased:=true;
TAnchorDockManager(Parent.DockManager).FSiteClientRect:=Parent.ClientRect; TAnchorDockManager(Parent.DockManager).FSiteClientRect:=Parent.ClientRect;
end; end;
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockHostSite.DockAnotherControl AFTER ENLARGE ',Caption]); debugln(['TAnchorDockHostSite.DockAnotherControl AFTER ENLARGE ',Caption]);
//DebugWriteChildAnchors(Self,true,true); //DebugWriteChildAnchors(Self,true,true);
{$ENDIF}
end; end;
// anchors // anchors
@ -4626,7 +4638,9 @@ var
Sibling: TControl; Sibling: TControl;
SplitterCount: Integer; SplitterCount: Integer;
begin begin
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockHostSite.RemoveControlFromLayout Self="',Caption,'" AControl=',DbgSName(AControl),'="',AControl.Caption,'"']); debugln(['TAnchorDockHostSite.RemoveControlFromLayout Self="',Caption,'" AControl=',DbgSName(AControl),'="',AControl.Caption,'"']);
{$ENDIF}
if SiteType<>adhstLayout then if SiteType<>adhstLayout then
RaiseGDBException('TAnchorDockHostSite.RemoveControlFromLayout inconsistency'); RaiseGDBException('TAnchorDockHostSite.RemoveControlFromLayout inconsistency');
@ -4769,7 +4783,9 @@ begin
SimplifyPages SimplifyPages
else if (SiteType=adhstOneControl) then begin else if (SiteType=adhstOneControl) then begin
AControl:=GetOneControl; AControl:=GetOneControl;
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockHostSite.Simplify ',DbgSName(Self),' ',DbgSName(AControl)]); debugln(['TAnchorDockHostSite.Simplify ',DbgSName(Self),' ',DbgSName(AControl)]);
{$ENDIF}
if AControl is TAnchorDockHostSite then if AControl is TAnchorDockHostSite then
SimplifyOneControl SimplifyOneControl
else if ((AControl=nil) or (csDestroying in AControl.ComponentState)) then else if ((AControl=nil) or (csDestroying in AControl.ComponentState)) then
@ -4826,7 +4842,9 @@ var
begin begin
if SiteType<>adhstOneControl then exit; if SiteType<>adhstOneControl then exit;
if not IsOneSiteLayout(Site) then exit; if not IsOneSiteLayout(Site) then exit;
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockHostSite.SimplifyOneControl Self="',Caption,'" Site="',Site.Caption,'"']); debugln(['TAnchorDockHostSite.SimplifyOneControl Self="',Caption,'" Site="',Site.Caption,'"']);
{$ENDIF}
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.SimplifyOneControl'){$ENDIF}; DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.SimplifyOneControl'){$ENDIF};
BeginUpdateLayout; BeginUpdateLayout;
try try
@ -5031,7 +5049,9 @@ begin
BeginUpdateLayout; BeginUpdateLayout;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.CheckIfOneControlHidden'){$ENDIF}; DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.CheckIfOneControlHidden'){$ENDIF};
try try
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockHostSite.CheckIfOneControlHidden ',DbgSName(Self),' UpdatingLayout=',UpdatingLayout,' Visible=',Visible,' Parent=',DbgSName(Parent),' csDestroying=',csDestroying in ComponentState,' SiteType=',dbgs(SiteType),' Child=',DbgSName(Child),' Child.csDestroying=',csDestroying in Child.ComponentState]); debugln(['TAnchorDockHostSite.CheckIfOneControlHidden ',DbgSName(Self),' UpdatingLayout=',UpdatingLayout,' Visible=',Visible,' Parent=',DbgSName(Parent),' csDestroying=',csDestroying in ComponentState,' SiteType=',dbgs(SiteType),' Child=',DbgSName(Child),' Child.csDestroying=',csDestroying in Child.ComponentState]);
{$ENDIF}
Visible:=false; Visible:=false;
Parent:=nil; Parent:=nil;
finally finally
@ -5529,7 +5549,9 @@ var
SplitterAnchorKind:TAnchorKind; SplitterAnchorKind:TAnchorKind;
MaxSize:integer; MaxSize:integer;
begin begin
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockHostSite.MinimizeSite ',DbgSName(Self),' SiteType=',dbgs(SiteType)]); debugln(['TAnchorDockHostSite.MinimizeSite ',DbgSName(Self),' SiteType=',dbgs(SiteType)]);
{$ENDIF}
if Minimized then if Minimized then
AControl:=FMinimizedControl AControl:=FMinimizedControl
else else
@ -5613,7 +5635,9 @@ begin
Result:=CloseQuery; Result:=CloseQuery;
if not Result then exit; if not Result then exit;
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockHostSite.CloseSite ',DbgSName(Self),' SiteType=',dbgs(SiteType)]); debugln(['TAnchorDockHostSite.CloseSite ',DbgSName(Self),' SiteType=',dbgs(SiteType)]);
{$ENDIF}
case SiteType of case SiteType of
adhstNone: adhstNone:
begin begin
@ -5977,13 +6001,17 @@ begin
end; end;
destructor TAnchorDockHostSite.Destroy; destructor TAnchorDockHostSite.Destroy;
{$IFDEF VerboseAnchorDocking}
var i: Integer; var i: Integer;
{$ENDIF}
begin begin
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockHostSite.Destroy ',DbgSName(Self),' Caption="',Caption,'" Self=',dbgs(Pointer(Self)),' ComponentCount=',ComponentCount,' ControlCount=',ControlCount]); debugln(['TAnchorDockHostSite.Destroy ',DbgSName(Self),' Caption="',Caption,'" Self=',dbgs(Pointer(Self)),' ComponentCount=',ComponentCount,' ControlCount=',ControlCount]);
for i:=0 to ComponentCount-1 do for i:=0 to ComponentCount-1 do
debugln(['TAnchorDockHostSite.Destroy Component ',i,'/',ComponentCount,' ',DbgSName(Components[i])]); debugln(['TAnchorDockHostSite.Destroy Component ',i,'/',ComponentCount,' ',DbgSName(Components[i])]);
for i:=0 to ControlCount-1 do for i:=0 to ControlCount-1 do
debugln(['TAnchorDockHostSite.Destroy Control ',i,'/',ControlCount,' ',DbgSName(Controls[i])]); debugln(['TAnchorDockHostSite.Destroy Control ',i,'/',ControlCount,' ',DbgSName(Controls[i])]);
{$ENDIF}
FreePages; FreePages;
inherited Destroy; inherited Destroy;
end; end;
@ -6587,7 +6615,9 @@ begin
// handled by TAnchorDockHostSite // handled by TAnchorDockHostSite
//debugln(['TAnchorDockManager.InsertControl DockSite="',DockSite.Caption,'" Control=',DbgSName(ADockObject.Control),' InsertAt=',dbgs(ADockObject.DropAlign)]) //debugln(['TAnchorDockManager.InsertControl DockSite="',DockSite.Caption,'" Control=',DbgSName(ADockObject.Control),' InsertAt=',dbgs(ADockObject.DropAlign)])
end else begin end else begin
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockManager.InsertControl DockSite=nil Site="',DbgSName(Site),'" Control=',DbgSName(ADockObject.Control),' InsertAt=',dbgs(ADockObject.DropAlign),' Site.Bounds=',dbgs(Site.BoundsRect),' Control.Client=',dbgs(ADockObject.Control.ClientRect),' Parent=',DbgSName(ADockObject.Control.Parent)]); debugln(['TAnchorDockManager.InsertControl DockSite=nil Site="',DbgSName(Site),'" Control=',DbgSName(ADockObject.Control),' InsertAt=',dbgs(ADockObject.DropAlign),' Site.Bounds=',dbgs(Site.BoundsRect),' Control.Client=',dbgs(ADockObject.Control.ClientRect),' Parent=',DbgSName(ADockObject.Control.Parent)]);
{$ENDIF}
Site.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockManager.InsertControl'){$ENDIF}; Site.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockManager.InsertControl'){$ENDIF};
try try
// align dragged Control // align dragged Control
@ -6650,8 +6680,9 @@ begin
// only allow to dock one control // only allow to dock one control
DragManager.RegisterDockSite(Site,false); DragManager.RegisterDockSite(Site,false);
{$IFDEF VerboseAnchorDocking}
debugln(['TAnchorDockManager.InsertControl AFTER Site="',DbgSName(Site),'" Control=',DbgSName(ADockObject.Control),' InsertAt=',dbgs(ADockObject.DropAlign),' Site.Bounds=',dbgs(Site.BoundsRect),' Control.ClientRect=',dbgs(ADockObject.Control.ClientRect)]); debugln(['TAnchorDockManager.InsertControl AFTER Site="',DbgSName(Site),'" Control=',DbgSName(ADockObject.Control),' InsertAt=',dbgs(ADockObject.DropAlign),' Site.Bounds=',dbgs(Site.BoundsRect),' Control.ClientRect=',dbgs(ADockObject.Control.ClientRect)]);
{$ENDIF}
finally finally
Site.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockManager.InsertControl'){$ENDIF}; Site.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockManager.InsertControl'){$ENDIF};
end; end;

View File

@ -1470,7 +1470,9 @@ var
Side: TAnchorKind; Side: TAnchorKind;
Splitter: TAnchorDockLayoutTreeNode; Splitter: TAnchorDockLayoutTreeNode;
begin begin
{$IFDEF VerboseAnchorDocking}
WriteDebugLayout('TAnchorDockLayoutTreeNode.DeleteNode BEFORE DELETE Self='+Name+' Child='+ChildNode.Name+' ',Self); WriteDebugLayout('TAnchorDockLayoutTreeNode.DeleteNode BEFORE DELETE Self='+Name+' Child='+ChildNode.Name+' ',Self);
{$ENDIF}
ChildNode.Parent:=nil; ChildNode.Parent:=nil;
try try
if not ChildNode.IsSplitter then begin if not ChildNode.IsSplitter then begin
@ -1501,7 +1503,9 @@ begin
if Sibling.Anchors[Side]=ChildNode.Name then if Sibling.Anchors[Side]=ChildNode.Name then
Sibling.Anchors[Side]:=''; Sibling.Anchors[Side]:='';
end; end;
{$IFDEF VerboseAnchorDocking}
WriteDebugLayout('TAnchorDockLayoutTreeNode.DeleteNode AFTER DELETE Self='+Name+' Child='+ChildNode.Name+' ',Self); WriteDebugLayout('TAnchorDockLayoutTreeNode.DeleteNode AFTER DELETE Self='+Name+' Child='+ChildNode.Name+' ',Self);
{$ENDIF}
// free node // free node
ChildNode.Free; ChildNode.Free;
end; end;
@ -1624,7 +1628,9 @@ var
GrandChild: TAnchorDockLayoutTreeNode; GrandChild: TAnchorDockLayoutTreeNode;
Side: TAnchorKind; Side: TAnchorKind;
begin begin
{$IFDEF VerboseAnchorDocking}
WriteDebugLayout('TAnchorDockLayoutTreeNode.ReplaceWithChildren BEFORE REPLACE Self='+Name+' Child='+ChildNode.Name+' ',Self); WriteDebugLayout('TAnchorDockLayoutTreeNode.ReplaceWithChildren BEFORE REPLACE Self='+Name+' Child='+ChildNode.Name+' ',Self);
{$ENDIF}
DebugWriteChildAnchors(Self); DebugWriteChildAnchors(Self);
while ChildNode.Count>0 do begin while ChildNode.Count>0 do begin
GrandChild:=ChildNode[0]; GrandChild:=ChildNode[0];
@ -1642,7 +1648,9 @@ begin
end; end;
end; end;
end; end;
{$IFDEF VerboseAnchorDocking}
WriteDebugLayout('TAnchorDockLayoutTreeNode.ReplaceWithChildren AFTER REPLACE Self='+Name+' Child='+ChildNode.Name+' ',Self); WriteDebugLayout('TAnchorDockLayoutTreeNode.ReplaceWithChildren AFTER REPLACE Self='+Name+' Child='+ChildNode.Name+' ',Self);
{$ENDIF}
ChildNode.Free; ChildNode.Free;
DebugWriteChildAnchors(Self); DebugWriteChildAnchors(Self);
end; end;