IDE+LCL: debugging Disable/EnableAutoSizing

git-svn-id: trunk@50176 -
This commit is contained in:
mattias 2015-10-26 21:34:11 +00:00
parent 19211cc93e
commit 9b0d4c01b6
26 changed files with 217 additions and 151 deletions

View File

@ -108,6 +108,10 @@ uses
LazConfigStorage, Laz2_XMLCfg, LazFileCache,
AnchorDockStr, AnchorDockStorage;
{$IFDEF DebugDisableAutoSizing}
const ADAutoSizingReason = 'TAnchorDockMaster Delayed';
{$ENDIF}
type
TAnchorDockHostSite = class;
@ -799,13 +803,16 @@ procedure CopyAnchorBounds(Source, Target: TControl);
var
a: TAnchorKind;
begin
Target.DisableAutoSizing;
Target.BoundsRect:=Source.BoundsRect;
Target.Anchors:=Source.Anchors;
Target.Align:=Source.Align;
for a:=low(TAnchorKind) to high(TAnchorKind) do
Target.AnchorSide[a].Assign(Source.AnchorSide[a]);
Target.EnableAutoSizing;
Target.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('CopyAnchorBounds'){$ENDIF};
try
Target.BoundsRect:=Source.BoundsRect;
Target.Anchors:=Source.Anchors;
Target.Align:=Source.Align;
for a:=low(TAnchorKind) to high(TAnchorKind) do
Target.AnchorSide[a].Assign(Source.AnchorSide[a]);
finally
Target.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('CopyAnchorBounds'){$ENDIF};
end;
end;
procedure AnchorAndChangeBounds(AControl: TControl; Side: TAnchorKind;
@ -1514,7 +1521,7 @@ function TAnchorDockMaster.CreateNeededControls(Tree: TAnchorDockLayoutTree;
raise EAnchorDockLayoutError.Create('not a docksite: '+DbgSName(AControl));
finally
if not DisableAutoSizing then
AControl.EnableAutoSizing;
AControl.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}(ADAutoSizingReason){$ENDIF};
end;
end else begin
debugln(['CreateControlsForNode ',Node.Name,' failed to create']);
@ -1994,7 +2001,7 @@ begin
//debugln(['TAnchorDockMaster.DisableControlAutoSizing ',DbgSName(AControl)]);
fDisabledAutosizing.Add(AControl);
AControl.FreeNotification(Self);
AControl.DisableAutoSizing;
AControl.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}(ADAutoSizingReason){$ENDIF};
end;
procedure TAnchorDockMaster.EnableAllAutoSizing;
@ -2007,7 +2014,7 @@ begin
AControl:=TControl(fDisabledAutosizing[i]);
//debugln(['TAnchorDockMaster.EnableAllAutoSizing ',DbgSName(AControl)]);
fDisabledAutosizing.Delete(i);
AControl.EnableAutoSizing;
AControl.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}(ADAutoSizingReason){$ENDIF};
i:=Min(i,fDisabledAutosizing.Count)-1;
end;
end;
@ -2592,7 +2599,7 @@ begin
raise Exception.Create('TAnchorDockMaster.MakeDockable '+
adrsControlIsAlreadyADocksite);
Site:=nil;
AControl.DisableAutoSizing;
AControl.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockMaster.DisableControlAutoSizing'){$ENDIF};
try
if AControl is TAnchorDockHostSite then begin
// already a site
@ -2621,7 +2628,7 @@ begin
end;
finally
if Site<>nil then
Site.EnableAutoSizing;
Site.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}(ADAutoSizingReason){$ENDIF};
end;
end else if AControl.Parent is TAnchorDockHostSite then begin
// AControl is already docked => show site
@ -2634,7 +2641,7 @@ begin
if (Site<>nil) and Show then
MakeVisible(Site,BringToFront);
finally
AControl.EnableAutoSizing;
AControl.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockMaster.DisableControlAutoSizing'){$ENDIF};
end;
// BringToFront
if Show and BringToFront and (Site<>nil) then begin
@ -2660,7 +2667,7 @@ begin
adrsModalFormsCanNotBeMadeDockable);
if Sites=[] then
raise Exception.Create('TAnchorDockMaster.MakeDockSite Sites=[]');
AForm.DisableAutoSizing;
AForm.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockMaster.MakeDockSite'){$ENDIF};
try
if FControls.IndexOf(AForm)<0 then begin
FControls.Add(AForm);
@ -2674,7 +2681,7 @@ begin
AForm.UseDockManager:=true;
AForm.DockSite:=true;
finally
AForm.EnableAutoSizing;
AForm.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockMaster.MakeDockSite'){$ENDIF};
end;
end;
@ -3117,7 +3124,7 @@ begin
if fNeedFree.IndexOf(AControl)>=0 then exit;
if csDestroying in AControl.ComponentState then exit;
fNeedFree.Add(AControl);
AControl.DisableAutoSizing;
AControl.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}(ADAutoSizingReason){$ENDIF};
AControl.Parent:=nil;
AControl.Visible:=false;
end;
@ -3271,16 +3278,26 @@ var
NewName: String;
begin
Result:=TAnchorDockHostSite(SiteClass.NewInstance);
{$IFDEF DebugDisableAutoSizing}
if DisableAutoSizing then
Result.DisableAutoSizing(ADAutoSizingReason)
else
Result.DisableAutoSizing('TAnchorDockMaster.CreateSite');
{$ELSE}
Result.DisableAutoSizing;
Result.CreateNew(Self,1);
i:=0;
repeat
inc(i);
NewName:=NamePrefix+AnchorDockSiteName+IntToStr(i);
until (Screen.FindForm(NewName)=nil) and (FindComponent(NewName)=nil);
Result.Name:=NewName;
if not DisableAutoSizing then
Result.EnableAutoSizing;
{$ENDIF};
try
Result.CreateNew(Self,1);
i:=0;
repeat
inc(i);
NewName:=NamePrefix+AnchorDockSiteName+IntToStr(i);
until (Screen.FindForm(NewName)=nil) and (FindComponent(NewName)=nil);
Result.Name:=NewName;
finally
if not DisableAutoSizing then
Result.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockMaster.CreateSite'){$ENDIF};
end;
end;
function TAnchorDockMaster.CreateSplitter(NamePrefix: string
@ -3336,12 +3353,12 @@ begin
if UpdatingLayout then exit;
//debugln(['TAnchorDockHostSite.ExecuteDock Self="',Caption,'" Control=',DbgSName(NewControl),' DropOnControl=',DbgSName(DropOnControl),' Align=',dbgs(DockAlign)]);
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.ExecuteDock HostSite'){$ENDIF};
try
BeginUpdateLayout;
try
DockMaster.SimplifyPendingLayouts;
NewControl.DisableAutoSizing;
NewControl.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.ExecuteDock NewControl'){$ENDIF};
if (NewControl.Parent=Self) and (SiteType=adhstLayout) then begin
// change of layout, one child is docked to the outer side
@ -3383,12 +3400,12 @@ begin
Result:=DockAnotherControl(nil,NewControl,DockAlign,DropOnControl<>nil);
end;
NewControl.EnableAutoSizing;
NewControl.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.ExecuteDock NewControl'){$ENDIF};
finally
EndUpdateLayout;
end;
finally
EnableAutoSizing;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.ExecuteDock HostSite'){$ENDIF};
end;
end;
@ -4073,7 +4090,7 @@ begin
{$IFDEF VerboseAnchorDockPages}
debugln(['TAnchorDockHostSite.SimplifyPages "',Caption,'" PageCount=1']);
{$ENDIF}
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.SimplifyPages'){$ENDIF};
BeginUpdateLayout;
try
// move the content of the Page to the place where Pages is
@ -4090,7 +4107,7 @@ begin
SimplifyOneControl;
finally
EndUpdateLayout;
EnableAutoSizing;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.SimplifyPages'){$ENDIF};
end;
//debugln(['TAnchorDockHostSite.SimplifyPages END Self="',Caption,'"']);
//DebugWriteChildAnchors(GetParentForm(Self),true,true);
@ -4112,7 +4129,7 @@ begin
if SiteType<>adhstOneControl then exit;
if not IsOneSiteLayout(Site) then exit;
debugln(['TAnchorDockHostSite.SimplifyOneControl Self="',Caption,'" Site="',Site.Caption,'"']);
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.SimplifyOneControl'){$ENDIF};
BeginUpdateLayout;
try
// move the content of Site up and free Site
@ -4154,7 +4171,7 @@ begin
DockMaster.NeedFree(Site);
finally
EndUpdateLayout;
EnableAutoSizing;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.SimplifyOneControl'){$ENDIF};
end;
//debugln(['TAnchorDockHostSite.SimplifyOneControl END Self="',Caption,'"']);
@ -4245,7 +4262,7 @@ begin
try
AControl.ManualDock(Result,nil,alClient);
finally
Result.EnableAutoSizing;
Result.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}(ADAutoSizingReason){$ENDIF};
end;
end;
end;
@ -4323,11 +4340,14 @@ begin
Result:=true;
// => undock
BeginUpdateLayout;
DisableAutoSizing;
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]);
Visible:=false;
Parent:=nil;
EnableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.CheckIfOneControlHidden'){$ENDIF};
try
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]);
Visible:=false;
Parent:=nil;
finally
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.CheckIfOneControlHidden'){$ENDIF};
end;
EndUpdateLayout;
if (not (Child is TCustomForm)) or (csDestroying in Child.ComponentState) then
Release;
@ -4391,12 +4411,15 @@ var
p: TPoint;
begin
if Parent=nil then exit;
DisableAutoSizing;
p := Point(0,0);
p := ClientToScreen(p);
Parent:=nil;
SetBounds(p.x,p.y,Width,Height);
EnableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.Undock'){$ENDIF};
try
p := Point(0,0);
p := ClientToScreen(p);
Parent:=nil;
SetBounds(p.x,p.y,Width,Height);
finally
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.Undock'){$ENDIF};
end;
end;
function TAnchorDockHostSite.CanMerge: boolean;
@ -4419,7 +4442,7 @@ begin
if (SiteType<>adhstLayout) or (ParentSite.SiteType<>adhstLayout) then
RaiseGDBException('');
ParentSite.BeginUpdateLayout;
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.Merge'){$ENDIF};
try
for i := ControlCount - 1 downto 0 do begin
Child := Controls[i];
@ -4512,7 +4535,7 @@ begin
ParentSite:=TAnchorDockHostSite(Parent);
if not OnlyCheckIfPossible then begin
ParentSite.BeginUpdateLayout;
ParentSite.DisableAutoSizing;
ParentSite.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.EnlargeSideResizeTwoSplitters'){$ENDIF};
end;
try
// check ShrinkSplitter
@ -4569,7 +4592,7 @@ begin
finally
if not OnlyCheckIfPossible then begin
ParentSite.EnableAutoSizing;
ParentSite.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.EnlargeSideResizeTwoSplitters'){$ENDIF};
ParentSite.EndUpdateLayout;
end;
end;
@ -4660,7 +4683,7 @@ begin
//debugln(['TAnchorDockHostSite.EnlargeSideRotateSplitter BEFORE Self=',DbgSName(Self),'=',dbgs(BoundsRect),' Side=',dbgs(Side),' CWSide=',dbgs(CWSide),' CWSplitter=',CWSplitter.Name,'=',dbgs(CWSplitter.BoundsRect),' CCWSide=',dbgs(CCWSide),' CCWSplitter=',CCWSplitter.Name,'=',dbgs(CCWSplitter.BoundsRect),' Behind=',dbgs(BehindSide),'=',RotateSplitter.Name,'=',dbgs(RotateSplitter.BoundsRect)]);
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.EnlargeSideRotateSplitter'){$ENDIF};
try
// enlarge the two neighbor splitters
AnchorAndChangeBounds(CWSplitter,Side,RotateSplitter.AnchorSide[Side].Control);
@ -4706,7 +4729,7 @@ begin
end;
//debugln(['TAnchorDockHostSite.EnlargeSideRotateSplitter AFTER Self=',DbgSName(Self),'=',dbgs(BoundsRect),' Side=',dbgs(Side),' CWSide=',dbgs(CWSide),' CWSplitter=',CWSplitter.Name,'=',dbgs(CWSplitter.BoundsRect),' CCWSide=',dbgs(CCWSide),' CCWSplitter=',CCWSplitter.Name,'=',dbgs(CCWSplitter.BoundsRect),' Behind=',dbgs(BehindSide),'=',RotateSplitter.Name,'=',dbgs(RotateSplitter.BoundsRect)]);
finally
EnableAutoSizing;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.EnlargeSideRotateSplitter'){$ENDIF};
end;
end;
@ -4775,7 +4798,7 @@ begin
end;
adhstOneControl:
begin
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.CloseSite'){$ENDIF};
NeedEnableAutoSizing:=true;
try
AControl:=GetOneControl;
@ -4817,7 +4840,7 @@ begin
Parent:=nil;
finally
if NeedEnableAutoSizing then
EnableAutoSizing;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.CloseSite'){$ENDIF};
end;
end;
end;
@ -4827,26 +4850,29 @@ procedure TAnchorDockHostSite.RemoveControl(AControl: TControl);
begin
//debugln(['TAnchorDockHostSite.RemoveControl ',DbgSName(Self),'=',Caption,' ',DbgSName(AControl)]);
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.RemoveControl'){$ENDIF};
inherited RemoveControl(AControl);
if not (csDestroying in ComponentState) then begin
if (not ((AControl is TAnchorDockHeader)
or (AControl is TAnchorDockSplitter)))
then begin
//debugln(['TAnchorDockHostSite.RemoveControl START ',Caption,' ',dbgs(SiteType),' ',DbgSName(AControl),' UpdatingLayout=',UpdatingLayout]);
if (SiteType=adhstLayout) then
RemoveControlFromLayout(AControl)
else
DockMaster.NeedSimplify(Self);
UpdateDockCaption;
//debugln(['TAnchorDockHostSite.RemoveControl END ',Caption,' ',dbgs(SiteType),' ',DbgSName(AControl)]);
try
inherited RemoveControl(AControl);
if not (csDestroying in ComponentState) then begin
if (not ((AControl is TAnchorDockHeader)
or (AControl is TAnchorDockSplitter)))
then begin
//debugln(['TAnchorDockHostSite.RemoveControl START ',Caption,' ',dbgs(SiteType),' ',DbgSName(AControl),' UpdatingLayout=',UpdatingLayout]);
if (SiteType=adhstLayout) then
RemoveControlFromLayout(AControl)
else
DockMaster.NeedSimplify(Self);
UpdateDockCaption;
//debugln(['TAnchorDockHostSite.RemoveControl END ',Caption,' ',dbgs(SiteType),' ',DbgSName(AControl)]);
end;
end;
finally
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.RemoveControl'){$ENDIF};
end;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.RemoveControl'){$ENDIF};
end;
procedure TAnchorDockHostSite.InsertControl(AControl: TControl; Index: integer);
begin
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.InsertControl'){$ENDIF};
try
inherited InsertControl(AControl, Index);
if not ((AControl is TAnchorDockSplitter)
@ -4854,7 +4880,7 @@ begin
then
UpdateDockCaption;
finally
EnableAutoSizing;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.InsertControl'){$ENDIF};
end;
end;
@ -5320,10 +5346,13 @@ end;
procedure TAnchorDockHeader.SetAlign(Value: TAlign);
begin
if Value=Align then exit;
DisableAutoSizing;
inherited SetAlign(Value);
UpdateHeaderControls;
EnableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.SetAlign'){$ENDIF};
try
inherited SetAlign(Value);
UpdateHeaderControls;
finally
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockHostSite.SetAlign'){$ENDIF};
end;
end;
procedure TAnchorDockHeader.DoOnShowHint(HintInfo: PHintInfo);
@ -5457,7 +5486,7 @@ begin
//debugln(['TAnchorDockManager.InsertControl DockSite="',DockSite.Caption,'" Control=',DbgSName(ADockObject.Control),' InsertAt=',dbgs(ADockObject.DropAlign)])
end else begin
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)]);
Site.DisableAutoSizing;
Site.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockManager.InsertControl'){$ENDIF};
try
// align dragged Control
Child:=ADockObject.Control;
@ -5512,7 +5541,7 @@ begin
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)]);
finally
Site.EnableAutoSizing;
Site.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockManager.InsertControl'){$ENDIF};
end;
end;
end;
@ -5997,10 +6026,13 @@ end;
procedure TAnchorDockSplitter.SetBounds(ALeft, ATop, AWidth, AHeight: integer);
begin
DisableAutoSizing;
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
UpdateDockBounds;
EnableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockSplitter.SetBounds'){$ENDIF};
try
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
UpdateDockBounds;
finally
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockSplitter.SetBounds'){$ENDIF};
end;
end;
procedure TAnchorDockSplitter.SetBoundsKeepDockBounds(ALeft, ATop, AWidth, AHeight: integer);

View File

@ -111,21 +111,24 @@ var
begin
Dlg:=TForm.Create(nil);
try
Dlg.DisableAutoSizing;
Dlg.Position:=poScreenCenter;
Dlg.AutoSize:=true;
Dlg.Caption:=adrsGeneralDockingOptions;
Dlg.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('ShowAnchorDockOptions'){$ENDIF};
try
Dlg.Position:=poScreenCenter;
Dlg.AutoSize:=true;
Dlg.Caption:=adrsGeneralDockingOptions;
OptsFrame:=TAnchorDockOptionsFrame.Create(Dlg);
OptsFrame.Align:=alClient;
OptsFrame.Parent:=Dlg;
OptsFrame.Master:=ADockMaster;
OptsFrame:=TAnchorDockOptionsFrame.Create(Dlg);
OptsFrame.Align:=alClient;
OptsFrame.Parent:=Dlg;
OptsFrame.Master:=ADockMaster;
BtnPanel:=TButtonPanel.Create(Dlg);
BtnPanel.ShowButtons:=[pbOK, pbCancel];
BtnPanel.OKButton.OnClick:=@OptsFrame.OkClick;
BtnPanel.Parent:=Dlg;
Dlg.EnableAutoSizing;
BtnPanel:=TButtonPanel.Create(Dlg);
BtnPanel.ShowButtons:=[pbOK, pbCancel];
BtnPanel.OKButton.OnClick:=@OptsFrame.OkClick;
BtnPanel.Parent:=Dlg;
finally
Dlg.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('ShowAnchorDockOptions'){$ENDIF};
end;
Result:=Dlg.ShowModal;
finally
Dlg.Free;

View File

@ -2246,7 +2246,7 @@ begin
Result:=Screen.FindForm(aFormName);
if Result<>nil then begin
if DisableAutoSizing then
Result.DisableAutoSizing;
Result.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockMaster Delayed'){$ENDIF};
exit;
end;
if AutoCreate then begin
@ -2312,13 +2312,23 @@ procedure TIDEWindowCreatorList.CreateForm(var AForm;
begin
if TCustomForm(AForm)=nil then begin
TCustomForm(AForm):=TCustomForm(AFormClass.NewInstance);
{$IFDEF DebugDisableAutoSizing}
if DoDisableAutoSizing then
TCustomForm(AForm).DisableAutoSizing('TAnchorDockMaster Delayed')
else
TCustomForm(AForm).DisableAutoSizing('TIDEWindowCreatorList.CreateForm');
{$ELSE}
TCustomForm(AForm).DisableAutoSizing;
TCustomForm(AForm).Create(TheOwner);
if not DoDisableAutoSizing then
TCustomForm(AForm).EnableAutoSizing;
{$ENDIF};
try
TCustomForm(AForm).Create(TheOwner);
finally
if not DoDisableAutoSizing then
TCustomForm(AForm).EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TIDEWindowCreatorList.CreateForm'){$ENDIF};
end;
SimpleLayoutStorage.SetDefaultPosition(TCustomForm(AForm));
end else if DoDisableAutoSizing then
TCustomForm(AForm).DisableAutoSizing;
TCustomForm(AForm).DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TAnchorDockMaster Delayed'){$ENDIF};
end;
procedure TIDEWindowCreatorList.RestoreSimpleLayout;

View File

@ -255,7 +255,7 @@ begin
if not CUPSLibInstalled then Exit;
fcupsHttp:=httpConnect(cupsServer(),ippPort());
if not Assigned(fcupsHttp) then
raise Exception.Create('Unable to contact server!');
raise Exception.Create('Unable to contact server: '+GetLastError);
end;
end;

View File

@ -87,7 +87,7 @@ begin
Exit;
try
FillByte(pe, SizeOf(pe), 0);
FillByte(pe{%H-}, SizeOf(pe), 0);
pe.dwSize := SizeOf(pe);
if Process32FirstW(hShot, pe) then
repeat

View File

@ -1201,7 +1201,7 @@ begin
NewSelection:=TControlSelection.Create;
NewComponents:=TFPList.Create;
try
Form.DisableAutoSizing;
Form.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TDesigner.DoInsertFromStream'){$ENDIF};
try
// read component stream from clipboard
@ -1230,7 +1230,7 @@ begin
FOnPastedComponents(Self,FLookupRoot);
finally
Form.EnableAutoSizing;
Form.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TDesigner.DoInsertFromStream'){$ENDIF};
end;
finally
NewComponents.Free;
@ -2271,7 +2271,7 @@ var
NewLeft,NewTop,NewWidth,NewHeight,DisableAutoSize);
if NewComponent=nil then exit;
if DisableAutoSize and (NewComponent is TControl) then
TControl(NewComponent).EnableAutoSizing;
TControl(NewComponent).EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TDesigner.MouseUpOnControl'){$ENDIF};
TheFormEditor.FixupReferences(NewComponent); // e.g. frame references a datamodule
// modified
@ -4105,7 +4105,7 @@ begin
lisSelectedAndChildControls, mrCancel]);
if not (MsgResult in [mrYes,mrYesToAll]) then exit;
HasChanged:=false;
Form.DisableAutoSizing;
Form.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TDesigner.OnResetPopupMenuClick'){$ENDIF};
ResetComps:=TFPList.Create;
try
for i:=0 to ControlSelection.Count-1 do begin
@ -4127,7 +4127,7 @@ begin
end;
finally
ResetComps.Free;
Form.EnableAutoSizing;
Form.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TDesigner.OnResetPopupMenuClick'){$ENDIF};
if HasChanged then
Modified;
end;

View File

@ -1043,7 +1043,7 @@ begin
//debugln('[TJITForms.DoCreateJITComponent] Creating an instance of JIT class "'+NewClassName+'" = class('+AncestorClass.ClassName+') ...');
Instance:=TComponent(FCurReadClass.NewInstance);
if DisableAutoSize and (Instance is TControl) then
TControl(Instance).DisableAutoSizing;
TControl(Instance).DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TJITComponentList.DoCreateJITComponent'){$ENDIF};
//debugln('[TJITForms.DoCreateJITComponent] Initializing new instance ... ',DbgS(Instance));
TComponent(FCurReadJITComponent):=Instance;
try

View File

@ -324,7 +324,7 @@ begin
if (FEffectiveFilter = edOptionsFilter.Text)
and (FEffectiveShowModified = cbShowModified.Checked) then Exit;
Container := sbAllOptions;
Container.DisableAutoSizing;
Container.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TfrmAllCompilerOptions.RenderAndFilterOptions'){$ENDIF};
try
// First filter and set Visible flag.
FOptionsReader.FilterOptions(UTF8LowerCase(edOptionsFilter.Text),
@ -337,7 +337,7 @@ begin
FEffectiveShowModified := cbShowModified.Checked;
FocusControl(edOptionsFilter);
finally
Container.EnableAutoSizing;
Container.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TfrmAllCompilerOptions.RenderAndFilterOptions'){$ENDIF};
Container.Invalidate;
end;
end;

View File

@ -446,7 +446,7 @@ begin
IDEWindowCreators.CreateForm(CodeBrowserView,TCodeBrowserView,
DisableAutoSizing,LazarusIDE.OwningComponent)
else if DisableAutoSizing then
CodeBrowserView.DisableAutoSizing;
CodeBrowserView.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('CreateCodeBrowser'){$ENDIF};
end;
procedure ShowCodeBrowser(const Identifier: string);

View File

@ -38,7 +38,7 @@ unit Compiler;
interface
uses
Classes, SysUtils, Process, LCLProc, Forms, Controls, contnrs, strutils, FileUtil,
Classes, SysUtils, LCLProc, Forms, Controls, contnrs, strutils, FileUtil,
IDEExternToolIntf, IDEMsgIntf, LazIDEIntf, LazUTF8,
IDECmdLine, LazarusIDEStrConsts, CompilerOptions, Project,
DefineTemplates, TransferMacros, EnvironmentOpts, LazFileUtils;

View File

@ -693,7 +693,7 @@ begin
DisableAutoSize);
if AComponent<>nil then begin
if DisableAutoSize and (AComponent is TControl) then
TControl(AComponent).EnableAutoSizing;
TControl(AComponent).EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TComponentPalette.ComponentBtnDblClick'){$ENDIF};
GlobalDesignHook.PersistentAdded(AComponent,true);
end;
end;

View File

@ -1242,7 +1242,7 @@ begin
try
NewComponent := TComponent(TypeClass.newinstance);
if DisableAutoSize and (NewComponent is TControl) then
TControl(NewComponent).DisableAutoSizing;
TControl(NewComponent).DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomFormEditor.CreateComponent'){$ENDIF};
SetComponentDesignMode(NewComponent,true);
if DescendFromDesignerBaseClass(TypeClass)>=0 then begin
// this class can have its own lfm streams (e.g. a TFrame)

View File

@ -1444,7 +1444,7 @@ begin
then begin
CurDialog := TDebuggerDlg(DEBUGDIALOGCLASS[ADialogType].NewInstance);
if FInStateChange then CurDialog.BeginUpdate;
CurDialog.DisableAutoSizing;
CurDialog.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TDebugManager.ViewDebugDialog'){$ENDIF};
CurDialog.Create(Self);
FDialogs[ADialogType]:=CurDialog;
CurDialog.Name:= DebugDialogNames[ADialogType];
@ -1468,7 +1468,7 @@ begin
end
else begin
CurDialog:=FDialogs[ADialogType];
CurDialog.DisableAutoSizing;
CurDialog.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TDebugManager.ViewDebugDialog'){$ENDIF};
if (CurDialog is TBreakPointsDlg)
then begin
if (Project1<>nil) then
@ -1487,11 +1487,11 @@ begin
end;
end;
if not DoDisableAutoSizing then
CurDialog.EnableAutoSizing;
CurDialog.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TDebugManager.ViewDebugDialog'){$ENDIF};
if Show then
begin
CurDialog.BeginUpdate;
IDEWindowCreators.ShowForm(CurDialog,BringToFront, vmOnlyMoveOffScreenToVisible);
IDEWindowCreators.ShowForm(CurDialog,BringToFront,vmOnlyMoveOffScreenToVisible);
CurDialog.EndUpdate;
end;
end;

View File

@ -234,7 +234,7 @@ begin
IDEWindowCreators.CreateForm(FPDocEditor,TFPDocEditor,
State=iwgfDisabled,LazarusIDE.OwningComponent)
else if State=iwgfDisabled then
FPDocEditor.DisableAutoSizing;
FPDocEditor.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('DoShowFPDocEditor'){$ENDIF};
if State>=iwgfShow then
IDEWindowCreators.ShowForm(FPDocEditor,State=iwgfShowOnTop);

View File

@ -684,6 +684,7 @@
<ComponentName Value="DebugAttachDialogForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="DebugAttachDialog"/>
</Unit101>
<Unit102>
<Filename Value="frames/msgwnd_options.pas"/>
@ -704,6 +705,7 @@
<Unit105>
<Filename Value="compiler.pp"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Compiler"/>
</Unit105>
<Unit106>
<Filename Value="exttooldialog.pas"/>
@ -973,6 +975,7 @@
<Filename Value="checkcompileropts.pas"/>
<IsPartOfProject Value="True"/>
<HasResources Value="True"/>
<UnitName Value="CheckCompilerOpts"/>
</Unit163>
<Unit164>
<Filename Value="inputfiledialog.pas"/>
@ -1095,6 +1098,7 @@
<Unit189>
<Filename Value="applicationbundle.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ApplicationBundle"/>
</Unit189>
<Unit190>
<Filename Value="msgvieweditor.pas"/>

View File

@ -5794,7 +5794,7 @@ begin
CodeExplorerView.OnJumpToCode:=@OnCodeExplorerJumpToCode;
CodeExplorerView.OnShowOptions:=@OnCodeExplorerShowOptions;
end else if State=iwgfDisabled then
CodeExplorerView.DisableAutoSizing;
CodeExplorerView.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TMainIDE.DoShowCodeExplorer'){$ENDIF};
if State>=iwgfShow then begin
IDEWindowCreators.ShowForm(CodeExplorerView,State=iwgfShowOnTop);
@ -5834,7 +5834,7 @@ begin
IDEWindowCreators.CreateForm(RestrictionBrowserView,TRestrictionBrowserView,
State=iwgfDisabled,OwningComponent)
else if State=iwgfDisabled then
RestrictionBrowserView.DisableAutoSizing;
RestrictionBrowserView.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TMainIDE.DoShowRestrictionBrowser'){$ENDIF};
RestrictionBrowserView.SetIssueName(RestrictedName);
if State>=iwgfShow then
@ -5848,7 +5848,7 @@ begin
IDEWindowCreators.CreateForm(ComponentListForm,TComponentListForm,
State=iwgfDisabled,OwningComponent);
end else if State=iwgfDisabled then
ComponentListForm.DisableAutoSizing;
ComponentListForm.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TMainIDE.DoShowComponentList'){$ENDIF};
if State>=iwgfShow then
IDEWindowCreators.ShowForm(ComponentListForm,State=iwgfShowOnTop);
end;
@ -5860,7 +5860,7 @@ begin
State=iwgfDisabled,OwningComponent);
JumpHistoryViewWin.OnSelectionChanged := @JumpHistoryViewSelectionChanged;
end else if State=iwgfDisabled then
JumpHistoryViewWin.DisableAutoSizing;
JumpHistoryViewWin.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TMainIDE.DoShowJumpHistory'){$ENDIF};
if State>=iwgfShow then
IDEWindowCreators.ShowForm(JumpHistoryViewWin,State=iwgfShowOnTop);
end;
@ -8526,7 +8526,7 @@ begin
State=iwgfDisabled,LazarusIDE.OwningComponent);
SearchresultsView.OnSelectionChanged := OnSearchResultsViewSelectionChanged;
end else if State=iwgfDisabled then
SearchResultsView.DisableAutoSizing;
SearchResultsView.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TMainIDE.DoShowSearchResultsView'){$ENDIF};
if State>=iwgfShow then
begin
IDEWindowCreators.ShowForm(SearchresultsView,State=iwgfShowOnTop);
@ -11469,7 +11469,7 @@ procedure TMainIDE.CreateObjectInspector(aDisableAutoSize: boolean);
begin
if ObjectInspector1<>nil then begin
if aDisableAutoSize then
ObjectInspector1.DisableAutoSizing;
ObjectInspector1.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TMainIDE.CreateObjectInspector'){$ENDIF};
exit;
end;
IDEWindowCreators.CreateForm(ObjectInspector1,TObjectInspectorDlg,

View File

@ -251,7 +251,7 @@ begin
inherited Notification(AComponent, Operation);
if Operation=opRemove then
begin
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TIDEProgressWindow.Notification'){$ENDIF};
try
for i:=Count-1 downto 0 do
if Items[i]=AComponent then
@ -263,7 +263,7 @@ begin
if Count=0 then
Hide;
finally
EnableAutoSizing;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TIDEProgressWindow.Notification'){$ENDIF};
end;
end;
end;
@ -343,14 +343,14 @@ begin
Result.ProgressBar.Top:=10;
// show panel
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TIDEProgressWindow.AddItem'){$ENDIF};
try
AutoSize:=false;
Result.Panel.Parent:=Self;
AutoSize:=true;
Show;
finally
EnableAutoSizing;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TIDEProgressWindow.AddItem'){$ENDIF};
end;
end;

View File

@ -7596,10 +7596,10 @@ begin
then
exit;
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.MoveEditor'){$ENDIF};
IncUpdateLock;
try
DestWin.DisableAutoSizing;
DestWin.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.MoveEdito DestWinr'){$ENDIF};
DestWin.IncUpdateLock;
try
Edit := FindSourceEditorWithPageIndex(OldPageIndex);
@ -7620,11 +7620,11 @@ begin
DestWin.UpdateStatusBar;
DestWin.NotebookPageChanged(nil); // make sure page SynEdit willl be visible
finally
DestWin.EnableAutoSizing;
DestWin.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.MoveEdito DestWinr'){$ENDIF};
DestWin.DecUpdateLock;
end;
finally
EnableAutoSizing;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.MoveEditor'){$ENDIF};
DecUpdateLock
end;
@ -10891,7 +10891,14 @@ var
i: Integer;
begin
Result := TSourceNotebook(TSourceNotebook.NewInstance);
{$IFDEF DebugDisableAutoSizing}
if DoDisableAutoSizing then
Result.DisableAutoSizing('TAnchorDockMaster Delayed')
else
Result.DisableAutoSizing('TSourceEditorManager.CreateNewWindow');
{$ELSE}
Result.DisableAutoSizing;
{$ENDIF};
if AnID > 0 then
Result.Create(Self, AnID)
else
@ -10910,7 +10917,7 @@ begin
end;
FChangeNotifyLists[semWindowCreate].CallNotifyEvents(Result);
if not DoDisableAutoSizing then
Result.EnableAutoSizing;
Result.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceEditorManager.CreateNewWindow'){$ENDIF};
end;
function TSourceEditorManager.SenderToEditor(Sender: TObject): TSourceEditor;

View File

@ -1830,7 +1830,7 @@ begin
DisableAutoSize);
if DisableAutoSize and (NewUnitInfo.Component<>nil)
and (NewUnitInfo.Component is TControl) then
TControl(NewUnitInfo.Component).EnableAutoSizing;
TControl(NewUnitInfo.Component).EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TLazSourceFileManager.NewFile'){$ENDIF};
end;
if Result<>mrOk then
begin
@ -5774,7 +5774,7 @@ begin
if ofLoadHiddenResource in OpenFlags then
NewControl.ControlStyle:=NewControl.ControlStyle+[csNoDesignVisible];
if DisableAutoSize then
NewControl.EnableAutoSizing;
NewControl.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TLazSourceFileManager.LoadLFM'){$ENDIF};
end;
if NewComponent is TFrame then

View File

@ -511,7 +511,7 @@ procedure TViewUnitDialog.ShowEntries;
var
UEntry: TViewUnitsEntry;
begin
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TViewUnitDialog.ShowEntries'){$ENDIF};
try
// Data items
FilterEdit.Items.Clear;
@ -523,7 +523,7 @@ begin
if UEntry.Selected then
FilterEdit.SelectionList.Add(UEntry.Name);
finally
EnableAutoSizing;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TViewUnitDialog.ShowEntries'){$ENDIF};
end;
end;

View File

@ -5425,6 +5425,7 @@ procedure TControl.EnableAutoSizing
procedure CheckReason;
var
i: Integer;
s: String;
begin
i:=FAutoSizingLockReasons.Count-1;
while i>=0 do begin
@ -5434,7 +5435,10 @@ procedure TControl.EnableAutoSizing
end;
dec(i);
end;
RaiseGDBException('TControl.EnableAutoSizing never disabled with reason: '+Reason);
s:='TControl.EnableAutoSizing '+DbgSName(Self)+' never disabled with reason "'+Reason+'"';
for i:=0 to FAutoSizingLockReasons.Count-1 do
s+=','+LineEnding+'reason['+IntToStr(i)+']="'+FAutoSizingLockReasons[i]+'"';
RaiseGDBException(s);
end;
{$ENDIF}

View File

@ -95,10 +95,10 @@ var bR2L: Boolean;
aBand: TCtrlBand;
begin
bR2L := IsRightToLeft;
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomControlBar.AlignControlsToBands'){$ENDIF};
for aBand in FVisiBands do
AlignControlToBand(aBand, bR2L);
EnableAutoSizing;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomControlBar.AlignControlsToBands'){$ENDIF};
end;
procedure TCustomControlBar.AlignControlToBand(ABand: TCtrlBand; ARightToLeft: Boolean);
@ -217,10 +217,10 @@ var i, aWidth: Integer;
begin
inherited CMBiDiModeChanged(Message);
aWidth := Width;
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomControlBar.CMBiDiModeChanged'){$ENDIF};
for i := 0 to FBands.Count - 1 do
FBands[i].Left := abs(FBands[i].Left - aWidth) - FBands[i].Width;
EnableAutoSizing;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomControlBar.CMBiDiModeChanged'){$ENDIF};
end;
procedure TCustomControlBar.CMBorderChanged(var Message: TLMessage);

View File

@ -645,12 +645,15 @@ begin
if aRowEnd then inc(aTop, FVisiBands[i].FHeight+TCoolBand.cDivider);
end;
if AutoSize then begin
if aCountM1 >= 0 then DisableAutoSizing;
if aCountM1 >= 0 then DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomCoolBar.CalculateAndAlign'){$ENDIF};
inc(FUpdateCount);
InvalidatePreferredSize;
AdjustSize;
if aCountM1 >= 0 then EnableAutoSizing;
dec(FUpdateCount);
try
InvalidatePreferredSize;
AdjustSize;
finally
if aCountM1 >= 0 then EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomCoolBar.CalculateAndAlign'){$ENDIF};
dec(FUpdateCount);
end;
end;
exclude(FWinControlFlags, wcfAligningControls);
end;
@ -758,9 +761,12 @@ begin
inherited EndUpdate;
//DebugLn('EndUpdate calls CalculateAndAlign');
if FUpdateCount = 0 then begin
DisableAutoSizing;
CalculateAndAlign;
EnableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomCoolBar.EndUpdate'){$ENDIF};
try
CalculateAndAlign;
finally
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomCoolBar.EndUpdate'){$ENDIF};
end;
Invalidate;
end;
end;

View File

@ -192,7 +192,7 @@ begin
else
NewControlIndex := FNotebook.GetControlIndex(TCustomPage(FPageList[NewIndex]));
FNotebook.DisableAutoSizing;
FNotebook.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TNBPages.Move'){$ENDIF};
try
// move Page in notebook handle
FNotebook.WSMovePage(APage, NewIndex);
@ -210,7 +210,7 @@ begin
if FNotebook.PageIndex >= 0 then // keep if -1
FNotebook.PageIndex := NewIndex;
finally
FNotebook.EnableAutoSizing;
FNotebook.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TNBPages.Move'){$ENDIF};
end;
end;

View File

@ -961,7 +961,7 @@ var
OldWidth: LongInt;
OldHeight: LongInt;
begin
DisableAutoSizing;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomSplitter.AnchorSplitter'){$ENDIF};
try
OldWidth := Width;
OldHeight := Height;
@ -993,7 +993,7 @@ begin
Height := OldWidth;
end;
finally
EnableAutoSizing;
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomSplitter.AnchorSplitter'){$ENDIF};
end;
end;

View File

@ -628,7 +628,7 @@ begin
DoShowPackageGraph(false);
AForm:=PackageGraphExplorer;
if DoDisableAutoSizing then
AForm.DisableAutoSizing;
AForm.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TPkgManager.CreateIDEWindow'){$ENDIF};
end else if SysUtils.CompareText(PackageEditorWindowPrefix,
copy(aFormName,1,length(PackageEditorWindowPrefix)))=0
then begin