mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-24 04:59:43 +01:00
LCL: new autosize: improvements for WMSize
git-svn-id: trunk@22064 -
This commit is contained in:
parent
49c3771c08
commit
32a6f2a37d
@ -3542,7 +3542,7 @@ end;
|
|||||||
TWinControl DoAdjustClientRectChange
|
TWinControl DoAdjustClientRectChange
|
||||||
|
|
||||||
Asks the interface if clientrect has changed since last AlignControl
|
Asks the interface if clientrect has changed since last AlignControl
|
||||||
and calls AlignControl(nil) on change.
|
and calls AdjustSize on change.
|
||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
procedure TWinControl.DoAdjustClientRectChange(const InvalidateRect: Boolean = True);
|
procedure TWinControl.DoAdjustClientRectChange(const InvalidateRect: Boolean = True);
|
||||||
var
|
var
|
||||||
@ -3556,14 +3556,16 @@ begin
|
|||||||
if not CompareRect(@R, @FAdjustClientRectRealized) then
|
if not CompareRect(@R, @FAdjustClientRectRealized) then
|
||||||
begin
|
begin
|
||||||
// client rect changed since last AlignControl
|
// client rect changed since last AlignControl
|
||||||
{$IFDEF VerboseClientRectBugFix}
|
{$IFDEF NewAutoSize}
|
||||||
DebugLn('UUU TWinControl.DoAdjustClientRectChange ClientRect changed ',Name,':',ClassName,
|
DebugLn('UUU TWinControl.DoAdjustClientRectChange ClientRect changed ',Name,':',ClassName,
|
||||||
' Old=',Dbgs(FAdjustClientRectRealized.Right),'x',DbgS(FAdjustClientRectRealized.Bottom),
|
' Old=',Dbgs(FAdjustClientRectRealized.Right),'x',DbgS(FAdjustClientRectRealized.Bottom),
|
||||||
' New=',DbgS(r.Right),'x',DbgS(r.Bottom));
|
' New=',DbgS(r.Right),'x',DbgS(r.Bottom));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
FAdjustClientRectRealized := R;
|
FAdjustClientRectRealized := R;
|
||||||
|
{$IFNDEF NewAutoSize}
|
||||||
ReAlign;
|
ReAlign;
|
||||||
Resize;
|
Resize;
|
||||||
|
{$ENDIF}
|
||||||
AdjustSize;
|
AdjustSize;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -3828,7 +3830,9 @@ begin
|
|||||||
// this often anticipates later LM_SIZE messages from the interface
|
// this often anticipates later LM_SIZE messages from the interface
|
||||||
// and reduces resizes
|
// and reduces resizes
|
||||||
LCLIntf.GetWindowSize(Handle, InterfaceWidth, InterfaceHeight);
|
LCLIntf.GetWindowSize(Handle, InterfaceWidth, InterfaceHeight);
|
||||||
//debugln('TWinControl.GetClientRect ',DbgSName(Self),' Interface=',dbgs(InterfaceWidth),',',dbgs(InterfaceHeight),' Result=',dbgs(Result),' Bounds=',dbgs(BoundsRect));
|
{$IFDEF NewAutoSize}
|
||||||
|
debugln('TWinControl.GetClientRect ',DbgSName(Self),' Interface=',dbgs(InterfaceWidth),',',dbgs(InterfaceHeight),' Result=',dbgs(Result),' Bounds=',dbgs(BoundsRect));
|
||||||
|
{$ENDIF}
|
||||||
Result.Right:=Width-(InterfaceWidth-Result.Right);
|
Result.Right:=Width-(InterfaceWidth-Result.Right);
|
||||||
Result.Bottom:=Height-(InterfaceHeight-Result.Bottom);
|
Result.Bottom:=Height-(InterfaceHeight-Result.Bottom);
|
||||||
end else begin
|
end else begin
|
||||||
@ -6582,6 +6586,12 @@ begin
|
|||||||
DebugLn(['TWinControl.WMSize A ',Name,':',ClassName,' Message=',Message.Width,',',Message.Height,
|
DebugLn(['TWinControl.WMSize A ',Name,':',ClassName,' Message=',Message.Width,',',Message.Height,
|
||||||
' BoundsRealized=',dbgs(FBoundsRealized),' FromIntf=',(Message.SizeType and Size_SourceIsInterface)>0]);
|
' BoundsRealized=',dbgs(FBoundsRealized),' FromIntf=',(Message.SizeType and Size_SourceIsInterface)>0]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
{$IFDEF NewAutoSize}
|
||||||
|
DebugLn(['TWinControl.WMSize A ',dbgsname(Self),' Message=',Message.Width,',',Message.Height,
|
||||||
|
' BoundsRealized=',dbgs(FBoundsRealized),' FromIntf=',(Message.SizeType and Size_SourceIsInterface)>0,
|
||||||
|
' wcfClientRectNeedsUpdate=',wcfClientRectNeedsUpdate in FWinControlFlags]);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
NewLeft:=Left;
|
NewLeft:=Left;
|
||||||
NewTop:=Top;
|
NewTop:=Top;
|
||||||
if (Message.SizeType and Size_SourceIsInterface) > 0 then
|
if (Message.SizeType and Size_SourceIsInterface) > 0 then
|
||||||
@ -6601,12 +6611,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
SetBoundsKeepBase(NewLeft, NewTop, Message.Width, Message.Height, Parent <> nil);
|
SetBoundsKeepBase(NewLeft, NewTop, Message.Width, Message.Height, Parent <> nil);
|
||||||
|
{$IFDEF NewAutoSize}
|
||||||
|
if ((Message.SizeType and Size_SourceIsInterface) > 0)
|
||||||
|
and ClientRectNeedsInterfaceUpdate then
|
||||||
|
DoAdjustClientRectChange;
|
||||||
|
{$ELSE}
|
||||||
if ClientRectNeedsInterfaceUpdate then
|
if ClientRectNeedsInterfaceUpdate then
|
||||||
DoAdjustClientRectChange;
|
DoAdjustClientRectChange;
|
||||||
|
|
||||||
if ((Message.SizeType and Size_SourceIsInterface) > 0) and
|
if ((Message.SizeType and Size_SourceIsInterface) > 0) and
|
||||||
(Parent <> nil) and Parent.AutoSize then
|
(Parent <> nil) and Parent.AutoSize then
|
||||||
Parent.AdjustSize;
|
Parent.AdjustSize;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -7624,12 +7639,13 @@ begin
|
|||||||
NewWidth:=Width-OldClientRect.Right+NewClientWidth;
|
NewWidth:=Width-OldClientRect.Right+NewClientWidth;
|
||||||
NewHeight:=Height-OldClientRect.Bottom+NewClientHeight;
|
NewHeight:=Height-OldClientRect.Bottom+NewClientHeight;
|
||||||
|
|
||||||
{$IFDEF VerboseAutoSize}
|
{$IF defined(VerboseAutoSize) or defined(NewAutoSize)}
|
||||||
debugln('TWinControl.CalculatePreferredSize ',DbgSName(Self),
|
debugln(['TWinControl.CalculatePreferredSize ',DbgSName(Self),
|
||||||
' HandleAllocated=',dbgs(HandleAllocated),
|
' HandleAllocated=',HandleAllocated,
|
||||||
' Cur='+dbgs(Width)+'x'+dbgs(Height)+
|
' Cur=',Width,'x',Height,
|
||||||
' Client='+dbgs(OldClientRect.Right)+'x'+dbgs(OldClientRect.Bottom),
|
' Client=',OldClientRect.Right,'x',OldClientRect.Bottom,
|
||||||
' NewWidth='+dbgs(NewWidth)+' NewHeight=',dbgs(NewHeight));
|
' NewWidth=',NewWidth,' NewHeight=',NewHeight,
|
||||||
|
' NewClientWidth=',NewClientWidth,' NewClientHeight=',NewClientHeight]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
PreferredWidth:=Max(PreferredWidth,NewWidth);
|
PreferredWidth:=Max(PreferredWidth,NewWidth);
|
||||||
PreferredHeight:=Max(PreferredHeight,NewHeight);
|
PreferredHeight:=Max(PreferredHeight,NewHeight);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user