mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 22:39:21 +02:00
LCL: autosize: removed autosizecanstart
git-svn-id: trunk@24042 -
This commit is contained in:
parent
a16afe8843
commit
f736a0b704
@ -1026,7 +1026,9 @@ type
|
||||
{$ENDIF}
|
||||
procedure BeginAutoSizing; // set AutoSizing=true, can be used to prevent circles
|
||||
procedure EndAutoSizing; // set AutoSizing=false
|
||||
{$IFDEF OldAutoSize}
|
||||
function AutoSizeCanStart: boolean; virtual;
|
||||
{$ENDIF}
|
||||
procedure AnchorSideChanged(TheAnchorSide: TAnchorSide); virtual;
|
||||
procedure ForeignAnchorSideChanged(TheAnchorSide: TAnchorSide;
|
||||
Operation: TAnchorSideChangeOperation); virtual;
|
||||
|
@ -574,6 +574,9 @@ type
|
||||
function IsShortcut(var Message: TLMKey): boolean; virtual;
|
||||
procedure MakeFullyVisible(AMonitor: TMonitor = nil; UseWorkarea: Boolean = False);
|
||||
function AutoSizeCheckParent: Boolean; override;
|
||||
procedure GetPreferredSize(var PreferredWidth, PreferredHeight: integer;
|
||||
Raw: boolean = false;
|
||||
WithThemeSpace: boolean = true); override;
|
||||
procedure Release;
|
||||
function CanFocus: Boolean; override;
|
||||
procedure SetFocus; override;
|
||||
|
@ -2399,8 +2399,8 @@ procedure TControl.DoAllAutoSize;
|
||||
i: Integer;
|
||||
begin
|
||||
if AControl.AutoSizeDelayed then exit;
|
||||
|
||||
if not (cfAutoSizeNeeded in AControl.FControlFlags) then exit;
|
||||
|
||||
//DebugLn(['TControl.DoAllAutoSize.AutoSizeControl ',DbgSName(AControl),' AutoSize=',AControl.AutoSize]);
|
||||
Exclude(AControl.FControlFlags,cfAutoSizeNeeded);
|
||||
if AControl.AutoSize then
|
||||
@ -2472,6 +2472,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
{------------------------------------------------------------------------------
|
||||
function TControl.AutoSizeCanStart: boolean;
|
||||
|
||||
@ -2505,6 +2506,7 @@ begin
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
function TControl.AutoSizePhase: TControlAutoSizePhase;
|
||||
|
@ -560,8 +560,6 @@ end;
|
||||
procedure TCustomForm.WMPaint(var Message: TLMPaint);
|
||||
begin
|
||||
//DebugLn('[TCustomForm.WMPaint] ',Name,':',ClassName);
|
||||
if AutoSizingLockCount = 0 then
|
||||
Include(FFormState, fsDisableAutoSize);
|
||||
inherited WMPaint(Message);
|
||||
//DebugLn('[TCustomForm.WMPaint] END ',Name,':',ClassName);
|
||||
end;
|
||||
@ -581,6 +579,18 @@ begin
|
||||
{$IFDEF CHECK_POSITION}
|
||||
DebugLn('[TCustomForm.WMSize] ',DbgSName(Self),' Message.SizeType=',dbgs(Message.SizeType),' Message.Width=',dbgs(Message.Width),' Message.Height=',dbgs(Message.Height));
|
||||
{$ENDIF}
|
||||
|
||||
if (Parent=nil) and ((Message.SizeType and SIZE_SourceIsInterface)>0) then
|
||||
begin
|
||||
// this is a top level form (constraints depend on window manager)
|
||||
// and the widgetset set a size
|
||||
if (Message.Width<>Width) or (Message.Height<>Height) then
|
||||
begin
|
||||
// the window manager sets another size => disable autosize to prevent endless loop
|
||||
Include(FFormState,fsDisableAutoSize);
|
||||
end;
|
||||
end;
|
||||
|
||||
Assert(False, 'Trace:WMSIZE in TCustomForm');
|
||||
if not (csDesigning in ComponentState) then
|
||||
begin
|
||||
@ -1158,11 +1168,22 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomForm.GetPreferredSize(var PreferredWidth,
|
||||
PreferredHeight: integer; Raw: boolean; WithThemeSpace: boolean);
|
||||
begin
|
||||
if fsDisableAutoSize in FFormState then begin
|
||||
PreferredWidth:=Width;
|
||||
PreferredHeight:=Height;
|
||||
end else begin
|
||||
inherited GetPreferredSize(PreferredWidth, PreferredHeight, Raw,
|
||||
WithThemeSpace);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomForm.DoAutoSize;
|
||||
begin
|
||||
//DebugLn(['TCustomForm.DoAutoSize ',DbgSName(Self),' ',WindowState=wsNormal,' ',fsDisableAutoSize in FFormState,' ',dbgs(BoundsRect),' ',dbgs(ClientRect)]);
|
||||
if (WindowState=wsNormal) and (not (fsDisableAutoSize in FFormState)) then
|
||||
inherited DoAutoSize;
|
||||
inherited DoAutoSize;
|
||||
end;
|
||||
|
||||
procedure TCustomForm.SetAutoSize(Value: Boolean);
|
||||
|
@ -3319,7 +3319,7 @@ begin
|
||||
{$IFDEF VerboseAllAutoSize}
|
||||
debugln('TWinControl.DoAutoSize ',DbgSName(Self));
|
||||
{$ENDIF}
|
||||
if (not AutoSizeCanStart) or (AutoSizePhase<>caspComputingBounds) then begin
|
||||
if (AutoSizePhase<>caspComputingBounds) then begin
|
||||
{$IFDEF VerboseAllAutoSize}
|
||||
DebugLn(['TWinControl.DoAutoSize DELAYED AutoSizeCanStart=',AutoSizeCanStart,' AutoSizeDelayed=',AutoSizeDelayed,' AutoSizePhase=',AutoSizePhaseNames[AutoSizePhase]]);
|
||||
{$ENDIF}
|
||||
|
Loading…
Reference in New Issue
Block a user