LCL: debg DisableAutoSizing

git-svn-id: trunk@53655 -
This commit is contained in:
mattias 2016-12-12 19:40:31 +00:00
parent b442564a2a
commit 90b9fc6c74
3 changed files with 42 additions and 31 deletions

View File

@ -885,7 +885,9 @@ begin
NewHeight:=Result.Height-Result.ClientHeight+NewClientHeight; NewHeight:=Result.Height-Result.ClientHeight+NewClientHeight;
Result.SetBounds(Bounds.Left,Bounds.Top,NewWidth,NewHeight); Result.SetBounds(Bounds.Left,Bounds.Top,NewWidth,NewHeight);
Result.SetClientSize(Point(NewClientWidth,NewClientHeight)); Result.SetClientSize(Point(NewClientWidth,NewClientHeight));
{$IFDEF DebugDisableAutoSizing}
debugln('TControl.CreateFloatingDockSite A ',DbgSName(Self),' ',DbgSName(Result),' ',dbgs(Result.BoundsRect)); debugln('TControl.CreateFloatingDockSite A ',DbgSName(Self),' ',DbgSName(Result),' ',dbgs(Result.BoundsRect));
{$ENDIF}
Result.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.CreateFloatingDockSite'){$ENDIF}; Result.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.CreateFloatingDockSite'){$ENDIF};
end; end;
end; end;
@ -3828,31 +3830,34 @@ var
begin begin
if FAlign = Value then exit; if FAlign = Value then exit;
//DebugLn(['TControl.SetAlign ',DbgSName(Self),' Old=',DbgS(FAlign),' New=',DbgS(Value),' ',Anchors<>AnchorAlign[FAlign]]); //DebugLn(['TControl.SetAlign ',DbgSName(Self),' Old=',DbgS(FAlign),' New=',DbgS(Value),' ',Anchors<>AnchorAlign[FAlign]]);
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.setalign'){$ENDIF}; DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.SetAlign'){$ENDIF};
OldBaseBounds:=BaseBounds; try
OldAlign := FAlign; OldBaseBounds:=BaseBounds;
FAlign := Value; OldAlign := FAlign;
if (not (csLoading in ComponentState)) FAlign := Value;
and (Align in [alLeft,alTop,alRight,alBottom,alClient]) then begin if (not (csLoading in ComponentState))
// Align for alLeft,alTop,alRight,alBottom,alClient takes precedence and (Align in [alLeft,alTop,alRight,alBottom,alClient]) then begin
// over AnchorSides => clean up // Align for alLeft,alTop,alRight,alBottom,alClient takes precedence
for a:=low(TAnchorKind) to High(TAnchorKind) do // over AnchorSides => clean up
begin for a:=low(TAnchorKind) to High(TAnchorKind) do
if not (a in AnchorAlign[FAlign]) then continue; begin
AnchorSide[a].Control:=nil; if not (a in AnchorAlign[FAlign]) then continue;
AnchorSide[a].Side:=asrTop; AnchorSide[a].Control:=nil;
AnchorSide[a].Side:=asrTop;
end;
end; end;
// Notes:
// - if anchors had default values then change them to new default values
// This is done for Delphi compatibility.
// - Anchors are not stored if they are AnchorAlign[Align]
if (Anchors = AnchorAlign[OldAlign]) and (Anchors <> AnchorAlign[FAlign]) then
Anchors := AnchorAlign[FAlign];
if not (csLoading in ComponentState) then
BoundsRect:=OldBaseBounds;
//DebugLn(['TControl.SetAlign ',DbgSName(Self),' Cur=',DbgS(FAlign),' New=',DbgS(Value),' ',Anchors<>AnchorAlign[FAlign],' Anchors=',dbgs(Anchors)]);
finally
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.SetAlign'){$ENDIF};
end; end;
// Notes:
// - if anchors had default values then change them to new default values
// This is done for Delphi compatibility.
// - Anchors are not stored if they are AnchorAlign[Align]
if (Anchors = AnchorAlign[OldAlign]) and (Anchors <> AnchorAlign[FAlign]) then
Anchors := AnchorAlign[FAlign];
if not (csLoading in ComponentState) then
BoundsRect:=OldBaseBounds;
//DebugLn(['TControl.SetAlign ',DbgSName(Self),' Cur=',DbgS(FAlign),' New=',DbgS(Value),' ',Anchors<>AnchorAlign[FAlign],' Anchors=',dbgs(Anchors)]);
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.setalign'){$ENDIF};
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------

View File

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

View File

@ -6155,13 +6155,13 @@ var
i: Integer; i: Integer;
begin begin
// scroll inner controls // scroll inner controls
DisableAutoSizing; DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.ScrollBy'){$ENDIF};
try try
for i := 0 to ControlCount - 1 do for i := 0 to ControlCount - 1 do
with Controls[i] do with Controls[i] do
SetBounds(Left + DeltaX, Top + DeltaY, Width, Height); SetBounds(Left + DeltaX, Top + DeltaY, Width, Height);
finally finally
EnableAutoSizing; EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.ScrollBy'){$ENDIF};
end; end;
end; end;