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;
Result.SetBounds(Bounds.Left,Bounds.Top,NewWidth,NewHeight);
Result.SetClientSize(Point(NewClientWidth,NewClientHeight));
{$IFDEF DebugDisableAutoSizing}
debugln('TControl.CreateFloatingDockSite A ',DbgSName(Self),' ',DbgSName(Result),' ',dbgs(Result.BoundsRect));
{$ENDIF}
Result.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.CreateFloatingDockSite'){$ENDIF};
end;
end;
@ -3828,31 +3830,34 @@ var
begin
if FAlign = Value then exit;
//DebugLn(['TControl.SetAlign ',DbgSName(Self),' Old=',DbgS(FAlign),' New=',DbgS(Value),' ',Anchors<>AnchorAlign[FAlign]]);
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.setalign'){$ENDIF};
OldBaseBounds:=BaseBounds;
OldAlign := FAlign;
FAlign := Value;
if (not (csLoading in ComponentState))
and (Align in [alLeft,alTop,alRight,alBottom,alClient]) then begin
// Align for alLeft,alTop,alRight,alBottom,alClient takes precedence
// over AnchorSides => clean up
for a:=low(TAnchorKind) to High(TAnchorKind) do
begin
if not (a in AnchorAlign[FAlign]) then continue;
AnchorSide[a].Control:=nil;
AnchorSide[a].Side:=asrTop;
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.SetAlign'){$ENDIF};
try
OldBaseBounds:=BaseBounds;
OldAlign := FAlign;
FAlign := Value;
if (not (csLoading in ComponentState))
and (Align in [alLeft,alTop,alRight,alBottom,alClient]) then begin
// Align for alLeft,alTop,alRight,alBottom,alClient takes precedence
// over AnchorSides => clean up
for a:=low(TAnchorKind) to High(TAnchorKind) do
begin
if not (a in AnchorAlign[FAlign]) then continue;
AnchorSide[a].Control:=nil;
AnchorSide[a].Side:=asrTop;
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;
// 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;
{------------------------------------------------------------------------------

View File

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

View File

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