mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 10:56:35 +02:00
removed OldAutoSize
git-svn-id: trunk@25190 -
This commit is contained in:
parent
1cc38bd305
commit
cf55952b42
@ -1001,6 +1001,7 @@ function ParseFPCVerbose(List: TStrings; out UnitPaths: TStrings;
|
||||
SymbolName, SymbolValue, UpLine, NewPath: string;
|
||||
i, len, curpos: integer;
|
||||
begin
|
||||
DebugLn(['ProcessOutputLine ',Line]);
|
||||
len := length(Line);
|
||||
if len <= 6 then Exit; // shortest match
|
||||
|
||||
|
@ -302,7 +302,7 @@ begin
|
||||
if not FormEditingHook.GetDefaultComponentPosition(TypeClass,ParentCI,X,Y)
|
||||
then exit;
|
||||
|
||||
DisableAutoSize:={$IFDEF OldAutoSize}false{$ELSE}true{$ENDIF};
|
||||
DisableAutoSize:=true;
|
||||
CompIntf:=FormEditingHook.CreateComponent(ParentCI,TypeClass,'',X,Y,0,0,
|
||||
DisableAutoSize);
|
||||
if Assigned(CompIntf) then begin
|
||||
|
@ -282,7 +282,7 @@ begin
|
||||
if not FormEditingHook.GetDefaultComponentPosition(TypeClass,ParentCI,X,Y)
|
||||
then exit;
|
||||
//debugln('TComponentPalette.ComponentBtnDblClick ',dbgsName(Sender),' ',dbgs(X),',',dbgs(Y));
|
||||
DisableAutoSize:={$IFDEF OldAutoSize}false{$ELSE}true{$ENDIF};
|
||||
DisableAutoSize:=true;
|
||||
CompIntf:=FormEditingHook.CreateComponent(ParentCI,TypeClass,'',X,Y,0,0,
|
||||
DisableAutoSize);
|
||||
if CompIntf<>nil then begin
|
||||
|
12
ide/main.pp
12
ide/main.pp
@ -1309,20 +1309,16 @@ begin
|
||||
HiddenWindowsOnRun:=TList.Create;
|
||||
|
||||
// menu
|
||||
{$IFNDEF OldAutoSize}
|
||||
MainIDEBar.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TMainIDE.Create'){$ENDIF};
|
||||
try
|
||||
{$ENDIF}
|
||||
SetupStandardIDEMenuItems;
|
||||
SetupMainMenu;
|
||||
SetupSpeedButtons;
|
||||
SetupComponentNoteBook;
|
||||
ConnectMainBarEvents;
|
||||
{$IFNDEF OldAutoSize}
|
||||
finally
|
||||
MainIDEBar.EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TMainIDE.Create'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Create MENU');{$ENDIF}
|
||||
|
||||
// create main IDE register items
|
||||
@ -1791,9 +1787,7 @@ procedure TMainIDE.SetupSpeedButtons;
|
||||
Result.Name := AName;
|
||||
Result.Parent := MainIDEBar.pnlSpeedButtons;
|
||||
Result.Images := IDEImages.Images_16;
|
||||
{$IFNDEF OldAutoSize}
|
||||
Result.AutoSize := true;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
begin
|
||||
@ -1805,9 +1799,7 @@ begin
|
||||
Align := alLeft;
|
||||
Caption := '';
|
||||
BevelOuter := bvNone;
|
||||
{$IFNDEF OldAutoSize}
|
||||
AutoSize := true;
|
||||
{$ENDIF}
|
||||
Visible := EnvironmentOptions.IDESpeedButtonsVisible;
|
||||
end;
|
||||
|
||||
@ -6121,7 +6113,7 @@ begin
|
||||
if NewUnitName='' then
|
||||
NewUnitName:=ExtractFileNameOnly(AnUnitInfo.Filename);
|
||||
// ToDo: create AncestorBinStream(s) via hook, not via parameters
|
||||
DisableAutoSize:={$IFDEF OldAutoSize}false{$ELSE}true{$ENDIF};
|
||||
DisableAutoSize:=true;
|
||||
NewComponent:=FormEditor1.CreateRawComponentFromStream(BinStream,
|
||||
AncestorType,copy(NewUnitName,1,255),true,true,DisableAutoSize,AnUnitInfo);
|
||||
if (NewComponent is TControl) then begin
|
||||
@ -7907,7 +7899,7 @@ begin
|
||||
end else begin
|
||||
// create a designer form for a form/datamodule/frame
|
||||
//DebugLn(['TMainIDE.DoNewFile Name=',NewFileDescriptor.Name,' Class=',NewFileDescriptor.ClassName]);
|
||||
DisableAutoSize:={$IFDEF OldAutoSize}false{$ELSE}true{$ENDIF};
|
||||
DisableAutoSize:=true;
|
||||
Result := CreateNewForm(NewUnitInfo, AncestorType, nil,
|
||||
NewFileDescriptor.UseCreateFormStatements,
|
||||
DisableAutoSize);
|
||||
|
@ -6021,9 +6021,7 @@ begin
|
||||
ReleaseEditor(Edit);
|
||||
Edit.UpdateNoteBook(DestWin, DestWin.NoteBookPage[NewPageIndex]);
|
||||
DestWin.AcceptEditor(Edit);
|
||||
{$IfNDef OldAutoSize}
|
||||
DestWin.NotebookPage[NewPageIndex].ReAlign;
|
||||
{$EndIf}
|
||||
|
||||
NoteBookDeletePage(OldPageIndex);
|
||||
UpdatePageNames;
|
||||
@ -6448,10 +6446,8 @@ Begin
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TSourceNotebook.NewFile] A ');
|
||||
{$ENDIF}
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.NewFile'){$ENDIF};
|
||||
try
|
||||
{$ENDIF}
|
||||
Visible:=true;
|
||||
Result := NewSE(-1, -1, AShareEditor);
|
||||
{$IFDEF IDE_DEBUG}
|
||||
@ -6464,11 +6460,9 @@ Begin
|
||||
Result.PageName:= Manager.FindUniquePageName(NewShortName, Result);
|
||||
UpdatePageNames;
|
||||
UpdateProjectFiles;
|
||||
{$IFNDEF OldAutoSize}
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.NewFile'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
if FocusIt then FocusEditor;
|
||||
{$IFDEF IDE_DEBUG}
|
||||
writeln('[TSourceNotebook.NewFile] end');
|
||||
@ -6486,10 +6480,8 @@ begin
|
||||
TempEditor:=FindSourceEditorWithPageIndex(APageIndex);
|
||||
if TempEditor=nil then exit;
|
||||
//debugln(['TSourceNotebook.CloseFile ',TempEditor.FileName,' ',TempEditor.APageIndex]);
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.CloseFile'){$ENDIF};
|
||||
try
|
||||
{$ENDIF}
|
||||
Visible:=true;
|
||||
EndIncrementalFind;
|
||||
TempEditor.Close;
|
||||
@ -6512,11 +6504,9 @@ begin
|
||||
if not FIsClosing then
|
||||
Close;
|
||||
end;
|
||||
{$IFNDEF OldAutoSize}
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TSourceNotebook.CloseFile'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
if (TempEditor <> nil) then
|
||||
TempEditor.EditorComponent.SetFocus;
|
||||
{$IFDEF IDE_DEBUG}
|
||||
|
@ -84,7 +84,6 @@ type
|
||||
procedure CustomAlignPosition(AControl: TControl; var ANewLeft, ANewTop, ANewWidth,
|
||||
ANewHeight: Integer; var AlignRect: TRect;
|
||||
AlignInfo: TAlignInfo); override;
|
||||
procedure Loaded; override;
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
procedure SetAlign(Value: TAlign); override;
|
||||
procedure CMAppShowBtnGlyphChanged(var Message: TLMessage); message CM_APPSHOWBTNGLYPHCHANGED;
|
||||
@ -284,10 +283,8 @@ end;
|
||||
procedure TCustomButtonPanel.CalculatePreferredSize(var PreferredWidth,
|
||||
PreferredHeight: integer; WithThemeSpace: Boolean);
|
||||
begin
|
||||
{$IFNDEF OldAutoSize}
|
||||
if HandleAllocated then
|
||||
begin
|
||||
{$ENDIF}
|
||||
UpdateSizes;
|
||||
if Align in [alTop, alBottom] then
|
||||
begin
|
||||
@ -302,10 +299,7 @@ begin
|
||||
if ShowBevel then
|
||||
inc(PreferredWidth, Spacing + FBevel.Width);
|
||||
end;
|
||||
{$IFNDEF OldAutoSize}
|
||||
ReAlign;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TCustomButtonPanel.UpdateButtonOrder;
|
||||
@ -333,20 +327,14 @@ end;
|
||||
|
||||
procedure TCustomButtonPanel.SetAlign(Value: TAlign);
|
||||
begin
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing;
|
||||
{$ENDIF}
|
||||
try
|
||||
inherited SetAlign(Value);
|
||||
UpdateBevel;
|
||||
{$IFNDEF OldAutoSize}
|
||||
UpdateSizes;
|
||||
Realign;
|
||||
{$ENDIF}
|
||||
finally
|
||||
{$IFNDEF OldAutoSize}
|
||||
EnableAutoSizing;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -394,9 +382,7 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing;
|
||||
{$ENDIF}
|
||||
try
|
||||
FBevel := TBevel.Create(Self);
|
||||
FBevel.Parent := Self;
|
||||
@ -405,20 +391,10 @@ begin
|
||||
|
||||
UpdateBevel;
|
||||
finally
|
||||
{$IFNDEF OldAutoSize}
|
||||
EnableAutoSizing;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomButtonPanel.Loaded;
|
||||
begin
|
||||
inherited Loaded;
|
||||
{$IFDEF OldAutoSize}
|
||||
Realign;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TCustomButtonPanel.Notification(AComponent: TComponent;
|
||||
Operation: TOperation);
|
||||
var
|
||||
|
@ -1579,9 +1579,6 @@ type
|
||||
function DialogChar(var Message: TLMKey): boolean; override;
|
||||
procedure SetAutoSize(Value: Boolean); override;
|
||||
procedure RealSetText(const AValue: TCaption); override;
|
||||
{$IFDEF OldAutoSize}
|
||||
procedure DoAutoSize; override;
|
||||
{$ENDIF}
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
function CheckMenuDropdown: Boolean; virtual;
|
||||
|
@ -231,10 +231,6 @@ type
|
||||
csClicked,
|
||||
csPalette,
|
||||
csReadingState,
|
||||
{$IFDEF OldAutoSize}
|
||||
// deprecated
|
||||
csAlignmentNeeded,
|
||||
{$ENDIF}
|
||||
csFocusing,
|
||||
csCreating, // not used, exists for Delphi compatibility
|
||||
csPaintCopy,
|
||||
@ -794,7 +790,6 @@ type
|
||||
|
||||
{ TControl }
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
TControlAutoSizePhase = (
|
||||
caspNone,
|
||||
caspChangingProperties,
|
||||
@ -804,7 +799,6 @@ type
|
||||
caspShowing // make handles visible
|
||||
);
|
||||
TControlAutoSizePhases = set of TControlAutoSizePhase;
|
||||
{$ENDIF}
|
||||
|
||||
TTabOrder = -1..32767;
|
||||
|
||||
@ -813,12 +807,7 @@ type
|
||||
var Handled: Boolean) of object;
|
||||
|
||||
TControlFlag = (
|
||||
{$IFDEF OldAutoSize}
|
||||
// obsolete
|
||||
cfRequestAlignNeeded,
|
||||
{$ELSE}
|
||||
cfLoading, // set by TControl.ReadState, unset by TControl.Loaded when all on form finished loading
|
||||
{$ENDIF}
|
||||
cfAutoSizeNeeded,
|
||||
cfLeftLoaded, // cfLeftLoaded is set, when 'Left' is set during loading.
|
||||
cfTopLoaded,
|
||||
@ -830,9 +819,6 @@ type
|
||||
cfBaseBoundsValid,
|
||||
cfPreferredSizeValid,
|
||||
cfPreferredMinSizeValid,
|
||||
{$IFDEF OldAutoSize}
|
||||
cfOnResizeNeeded,
|
||||
{$ENDIF}
|
||||
cfOnChangeBoundsNeeded
|
||||
);
|
||||
TControlFlags = set of TControlFlag;
|
||||
@ -896,10 +882,6 @@ type
|
||||
FHelpType: THelpType;
|
||||
FHint: TTranslateString;
|
||||
FHostDockSite: TWinControl;
|
||||
{$IFDEF OldAutoSize}
|
||||
fLastAlignedBounds: TRect;
|
||||
fLastAlignedBoundsTried: integer;
|
||||
{$ENDIF}
|
||||
FLastChangebounds: TRect;
|
||||
FLastDoChangeBounds: TRect;
|
||||
FLastDoChangeClientSize: TPoint;
|
||||
@ -957,18 +939,14 @@ type
|
||||
FParentFont: Boolean;
|
||||
FParentShowHint: Boolean;
|
||||
FAutoSize: Boolean;
|
||||
{$IFNDEF OldAutoSize}
|
||||
FAutoSizingAll: boolean;
|
||||
{$ENDIF}
|
||||
FAutoSizingSelf: Boolean;
|
||||
FEnabled: Boolean;
|
||||
FMouseEntered: boolean;
|
||||
FVisible: Boolean;
|
||||
function CaptureMouseButtonsIsStored: boolean;
|
||||
procedure DoActionChange(Sender: TObject);
|
||||
{$IFNDEF OldAutoSize}
|
||||
function GetAutoSizingAll: Boolean;
|
||||
{$ENDIF}
|
||||
function GetAnchorSide(Kind: TAnchorKind): TAnchorSide;
|
||||
function GetAnchorSideIndex(Index: integer): TAnchorSide;
|
||||
function GetAnchoredControls(Index: integer): TControl;
|
||||
@ -1032,14 +1010,9 @@ type
|
||||
protected
|
||||
// sizing/aligning
|
||||
procedure DoAutoSize; virtual;
|
||||
{$IFNDEF OldAutoSize}
|
||||
procedure DoAllAutoSize; virtual; // while autosize needed call DoAutoSize, used by AdjustSize and EnableAutoSizing
|
||||
{$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;
|
||||
@ -1064,16 +1037,11 @@ type
|
||||
procedure Resize; virtual;// checks for changes and calls DoOnResize
|
||||
procedure RequestAlign; virtual;// smart calling Parent.AlignControls
|
||||
procedure UpdateAnchorRules;
|
||||
procedure ChangeBounds(ALeft, ATop, AWidth, AHeight: integer
|
||||
{$IFNDEF OldAutoSize}; KeepBase: boolean{$ENDIF}); virtual;
|
||||
procedure ChangeBounds(ALeft, ATop, AWidth, AHeight: integer; KeepBase: boolean); virtual;
|
||||
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); virtual;
|
||||
procedure ChangeScale(Multiplier, Divider: Integer); virtual;
|
||||
function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; virtual;
|
||||
{$IFDEF OldAutoSize}
|
||||
procedure SetAlignedBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
|
||||
{$ELSE}
|
||||
procedure UpdateAlignIndex;
|
||||
{$ENDIF}
|
||||
procedure SetBiDiMode(AValue: TBiDiMode); virtual;
|
||||
procedure SetParentBiDiMode(AValue: Boolean); virtual;
|
||||
function IsAParentAligning: boolean;
|
||||
@ -1089,9 +1057,7 @@ type
|
||||
function HeightIsAnchored: boolean;
|
||||
|
||||
property AutoSizing: Boolean read FAutoSizingSelf;// see Begin/EndAutoSizing
|
||||
{$IFNDEF OldAutoSize}
|
||||
property AutoSizingAll: Boolean read GetAutoSizingAll;// set in DoAllAutoSize
|
||||
{$ENDIF}
|
||||
property AutoSizingLockCount: Integer read FAutoSizingLockCount;
|
||||
protected
|
||||
// protected messages
|
||||
@ -1280,9 +1246,7 @@ type
|
||||
public
|
||||
// size
|
||||
procedure AdjustSize; virtual;// smart calling DoAutoSize
|
||||
{$IFNDEF OldAutoSize}
|
||||
function AutoSizePhases: TControlAutoSizePhases; virtual;
|
||||
{$ENDIF}
|
||||
function AutoSizeDelayed: boolean; virtual;
|
||||
function AutoSizeCheckParent: Boolean; virtual;
|
||||
procedure AnchorToNeighbour(Side: TAnchorKind; Space: integer;
|
||||
@ -1302,7 +1266,7 @@ type
|
||||
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
|
||||
procedure SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
|
||||
procedure SetBoundsKeepBase(aLeft, aTop, aWidth, aHeight: integer
|
||||
{$IFDEF OldAutoSize}; Lock: boolean = true{$ENDIF}); virtual; // if you use this, disable the LCL autosizing for this control
|
||||
); virtual; // if you use this, disable the LCL autosizing for this control
|
||||
procedure GetPreferredSize(var PreferredWidth, PreferredHeight: integer;
|
||||
Raw: boolean = false;
|
||||
WithThemeSpace: boolean = true); virtual;
|
||||
@ -1319,10 +1283,6 @@ type
|
||||
{$ENDIF}
|
||||
procedure UpdateBaseBounds(StoreBounds, StoreParentClientSize,
|
||||
UseLoadedValues: boolean); virtual;
|
||||
{$IFDEF OldAutoSize}
|
||||
procedure LockBaseBounds;
|
||||
procedure UnlockBaseBounds;
|
||||
{$ENDIF}
|
||||
property BaseBounds: TRect read FBaseBounds;
|
||||
property ReadBounds: TRect read FReadBounds;
|
||||
procedure WriteLayoutDebugReport(const Prefix: string); virtual;
|
||||
@ -1617,11 +1577,7 @@ type
|
||||
wcfClientRectNeedsUpdate,
|
||||
wcfColorChanged,
|
||||
wcfFontChanged, // Set if font was changed before handle creation
|
||||
{$IFDEF OldAutoSize}
|
||||
wcfReAlignNeeded,
|
||||
{$ELSE}
|
||||
wcfAllAutoSizing,
|
||||
{$ENDIF}
|
||||
wcfAligningControls,
|
||||
wcfEraseBackground,
|
||||
wcfCreatingHandle, // Set while constructing the handle of this control
|
||||
@ -1693,9 +1649,6 @@ type
|
||||
FTabOrder: integer;
|
||||
FTabList: TFPList;
|
||||
// keep small variables together to save some bytes
|
||||
{$IFDEF OldAutoSize}
|
||||
FAlignLevel: Word;
|
||||
{$ENDIF}
|
||||
FTabStop: Boolean;
|
||||
FShowing: Boolean;
|
||||
FDoubleBuffered: Boolean;
|
||||
@ -1741,9 +1694,6 @@ type
|
||||
function DoAlignChildControls(TheAlign: TAlign; AControl: TControl;
|
||||
AControlList: TFPList; var ARect: TRect): Boolean; virtual;
|
||||
procedure DoChildSizingChange(Sender: TObject); virtual;
|
||||
{$IFDEF OldAutoSize}
|
||||
procedure ResizeDelayedAutoSizeChildren; virtual;
|
||||
{$ENDIF}
|
||||
procedure InvalidatePreferredChildSizes;
|
||||
function CanTab: Boolean; override;
|
||||
function IsClientHeightStored: boolean; override;
|
||||
@ -1757,10 +1707,8 @@ type
|
||||
procedure DoConstraintsChange(Sender: TObject); override;
|
||||
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
|
||||
procedure DoAutoSize; override;
|
||||
{$IFNDEF OldAutoSize}
|
||||
procedure DoAllAutoSize; override;
|
||||
procedure AllAutoSized; virtual; // called by DoAllAutoSize after all bounds are computed, see TCustomForm.AllAutoSized
|
||||
{$ENDIF}
|
||||
procedure CalculatePreferredSize(var PreferredWidth,
|
||||
PreferredHeight: integer;
|
||||
WithThemeSpace: Boolean); override;
|
||||
@ -1928,9 +1876,7 @@ type
|
||||
property VisibleDockClientCount: Integer read GetVisibleDockClientCount;
|
||||
public
|
||||
// size, position, bounds
|
||||
{$IFNDEF OldAutoSize}
|
||||
function AutoSizePhases: TControlAutoSizePhases; override;
|
||||
{$ENDIF}
|
||||
function AutoSizeDelayed: boolean; override;
|
||||
function AutoSizeCheckParent: Boolean; override;
|
||||
procedure BeginUpdateBounds; // disable SetBounds
|
||||
@ -2351,7 +2297,6 @@ const
|
||||
'alNone', 'alTop', 'alBottom', 'alLeft', 'alRight', 'alClient', 'alCustom');
|
||||
AnchorNames: array[TAnchorKind] of string = (
|
||||
'akTop', 'akLeft', 'akRight', 'akBottom');
|
||||
{$IFNDEF OldAutoSize}
|
||||
AutoSizePhaseNames: array[TControlAutoSizePhase] of string = (
|
||||
'caspNone',
|
||||
'caspChangingProperties',
|
||||
@ -2360,7 +2305,6 @@ const
|
||||
'caspRealizingBounds',
|
||||
'caspShowing'
|
||||
);
|
||||
{$ENDIF}
|
||||
|
||||
function FindDragTarget(const Position: TPoint; AllowDisabled: Boolean): TControl;
|
||||
function FindControlAtPosition(const Position: TPoint; AllowDisabled: Boolean): TControl;
|
||||
@ -2415,10 +2359,8 @@ function DbgS(a: TAnchorKind): string; overload;
|
||||
function DbgS(Anchors: TAnchors): string; overload;
|
||||
function DbgS(a: TAlign): string; overload;
|
||||
function DbgS(a: TAnchorKind; Side: TAnchorSideReference): string; overload;
|
||||
{$IFNDEF OldAutoSize}
|
||||
function DbgS(p: TControlAutoSizePhase): string; overload;
|
||||
function DbgS(Phases: TControlAutoSizePhases): string; overload;
|
||||
{$ENDIF}
|
||||
|
||||
operator := (AVariant: Variant): TCaption;
|
||||
|
||||
@ -2605,7 +2547,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
function DbgS(p: TControlAutoSizePhase): string; overload;
|
||||
begin
|
||||
Result:=AutoSizePhaseNames[p];
|
||||
@ -2624,7 +2565,6 @@ begin
|
||||
end;
|
||||
Result:='['+Result+']';
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
RecreateWnd
|
||||
|
@ -530,9 +530,7 @@ type
|
||||
procedure MoveToDefaultPosition; virtual;
|
||||
procedure UpdateShowing; override;
|
||||
procedure SetVisible(Value: boolean); override;
|
||||
{$ifndef OldAutoSize}
|
||||
procedure AllAutoSized; override;
|
||||
{$endif}
|
||||
procedure DoFirstShow; virtual;
|
||||
procedure UpdateWindowState;
|
||||
procedure VisibleChanging; override;
|
||||
|
@ -40,18 +40,6 @@
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TControl.Adjustsize;
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
//debugln(['TControl.AdjustSize START ',DbgSName(Self),' AutoSizeCanStart=',AutoSizeCanStart,' AutoSizeDelayed=',AutoSizeDelayed]);
|
||||
if (not AutoSizeCanStart) or AutoSizeDelayed then begin
|
||||
//debugln('TControl.AdjustSize AutoSizeDelayed ',DbgSName(Self));
|
||||
Include(FControlFlags,cfAutoSizeNeeded);
|
||||
exit;
|
||||
end;
|
||||
//debugln(['TControl.AdjustSize DoAutoSize ',DbgSName(Self)]);
|
||||
DoAutoSize;
|
||||
Exclude(FControlFlags,cfAutoSizeNeeded);
|
||||
{$ELSE}
|
||||
|
||||
{$IFDEF VerboseAdjustSize}
|
||||
if (Parent=nil) and (not (cfAutoSizeNeeded in FControlFlags))
|
||||
and (Self is TCustomForm) then begin
|
||||
@ -71,7 +59,6 @@ begin
|
||||
if not AutoSizeDelayed then
|
||||
DoAllAutoSize;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -336,8 +323,8 @@ end;
|
||||
{------------------------------------------------------------------------------
|
||||
TControl.ChangeBounds
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TControl.ChangeBounds(ALeft, ATop, AWidth, AHeight: integer
|
||||
{$IFNDEF OldAutoSize}; KeepBase: boolean{$ENDIF});
|
||||
procedure TControl.ChangeBounds(ALeft, ATop, AWidth, AHeight: integer;
|
||||
KeepBase: boolean);
|
||||
var
|
||||
SizeChanged, PosChanged : boolean;
|
||||
OldLeft: Integer;
|
||||
@ -390,50 +377,9 @@ begin
|
||||
|
||||
// change base bounds
|
||||
// (base bounds are the base for the automatic resizing)
|
||||
{$IFNDEF OldAutoSize}
|
||||
if not KeepBase then
|
||||
{$ENDIF}
|
||||
UpdateAnchorRules;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
// lock the base bounds while automatic resizing
|
||||
LockBaseBounds;
|
||||
// lock size messages
|
||||
inc(FSizeLock);
|
||||
try
|
||||
// lock the autosizing of the child controls
|
||||
if Self is TWinControl then
|
||||
TWinControl(Self).DisableAlign;
|
||||
try
|
||||
// resize parents client area
|
||||
if Parent <> nil then
|
||||
Parent.AdjustSize;
|
||||
if PosSizeKept then exit;
|
||||
// notify before autosizing
|
||||
BoundsChanged;
|
||||
if PosSizeKept then exit;
|
||||
//if csDesigning in ComponentState then
|
||||
// DebugLn('TControl.ChangeBounds ',Name,':',ClassName,' ',Left,',',Top,',',Width,',',Height);
|
||||
|
||||
// autosize this control and its brothers
|
||||
RequestAlign;
|
||||
if PosSizeKept then exit;
|
||||
// autosize childs
|
||||
if SizeChanged and (Self is TWinControl) then
|
||||
TWinControl(Self).ReAlign;
|
||||
finally
|
||||
// unlock the autosizing of the child controls
|
||||
// (this will autosize the childs)
|
||||
if Self is TWinControl then
|
||||
TWinControl(Self).EnableAlign;
|
||||
// autosize self
|
||||
AdjustSize;
|
||||
end;
|
||||
finally
|
||||
dec(FSizeLock);
|
||||
UnlockBaseBounds;
|
||||
end;
|
||||
{$ELSE}
|
||||
// lock size messages
|
||||
inc(FSizeLock);
|
||||
try
|
||||
@ -445,7 +391,6 @@ begin
|
||||
finally
|
||||
dec(FSizeLock);
|
||||
end;
|
||||
{$ENDIF}
|
||||
if PosSizeKept then exit;
|
||||
|
||||
// send messages, if this is the top level call
|
||||
@ -560,9 +505,7 @@ begin
|
||||
if (FloatingClass<>nil) and (FloatingClass<>TWinControlClass(ClassType)) then
|
||||
begin
|
||||
Result := TWinControl(FloatingClass.NewInstance);
|
||||
{$IFNDEF OldAutoSize}
|
||||
Result.DisableAutoSizing;
|
||||
{$ENDIF}
|
||||
Result.Create(Self);
|
||||
// resize with minimal resizes
|
||||
NewClientWidth:=Bounds.Right-Bounds.Left;
|
||||
@ -572,9 +515,7 @@ begin
|
||||
Result.SetBounds(Bounds.Left,Bounds.Top,NewWidth,NewHeight);
|
||||
Result.SetClientSize(Point(NewClientWidth,NewClientHeight));
|
||||
debugln('TControl.CreateFloatingDockSite A ',DbgSName(Self),' ',DbgSName(Result),' ',dbgs(Result.BoundsRect));
|
||||
{$IFNDEF OldAutoSize}
|
||||
Result.EnableAutoSizing;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -885,9 +826,6 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TControl.DoOnResize;
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
Exclude(FControlFlags,cfOnResizeNeeded);
|
||||
{$ENDIF}
|
||||
if Assigned(FOnResize) then FOnResize(Self);
|
||||
DoCallNotifyHandler(chtOnResize);
|
||||
end;
|
||||
@ -1368,47 +1306,13 @@ begin
|
||||
OnShowHint(Self,HintInfo);
|
||||
end;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
procedure TControl.SetAlignedBounds(aLeft, aTop, aWidth, aHeight: integer);
|
||||
{ try to set the automatic changed bounds
|
||||
If the interface does not like our bounds, it sends a message with the real
|
||||
bounds, which invokes the automatic realigning of the control, .. a circle.
|
||||
To break the circle, only bounds that are different from the last try will
|
||||
be sent.
|
||||
}
|
||||
var
|
||||
NewBounds: TRect;
|
||||
begin
|
||||
NewBounds:=Bounds(aLeft, aTop, aWidth, aHeight);
|
||||
if (fLastAlignedBoundsTried>0)
|
||||
and CompareRect(@NewBounds,@fLastAlignedBounds) then begin
|
||||
inc(fLastAlignedBoundsTried);
|
||||
if fLastAlignedBoundsTried>4 then begin
|
||||
DebugLn(['TControl.SetAlignedBounds ',DbgSName(Self),' last try ',dbgs(NewBounds),' try=',fLastAlignedBoundsTried]);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
fLastAlignedBounds:=NewBounds;
|
||||
fLastAlignedBoundsTried:=1;
|
||||
|
||||
//if AnsiCompareText(ClassName,'TSCROLLBAR')=0 then
|
||||
// DebugLn('TControl.SetAlignedBounds A ',Name,':',ClassName,' ',aLeft,',',aTop,',',aWidth,',',aHeight);
|
||||
|
||||
SetBoundsKeepBase(aLeft, aTop, aWidth, aHeight{$IFDEF OldAutoSize}, true{$ENDIF});
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function TControl.IsAParentAligning: boolean;
|
||||
var
|
||||
p: TWinControl;
|
||||
begin
|
||||
p:=Parent;
|
||||
while (p<>nil) do begin
|
||||
if (wcfAligningControls in p.FWinControlFlags)
|
||||
{$IFDEF OldAutoSize}
|
||||
or (p.FAlignLevel>0)
|
||||
{$ENDIF}
|
||||
then
|
||||
if (wcfAligningControls in p.FWinControlFlags) then
|
||||
exit(true);
|
||||
p:=p.Parent;
|
||||
end;
|
||||
@ -1516,7 +1420,6 @@ begin
|
||||
Result := TControl(FAnchoredControls[Index]);
|
||||
end;
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
function TControl.GetAutoSizingAll: Boolean;
|
||||
begin
|
||||
if Parent <> nil then
|
||||
@ -1524,7 +1427,6 @@ begin
|
||||
else
|
||||
Result := FAutoSizingAll;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TControl GetClientRect
|
||||
@ -2441,16 +2343,13 @@ end;
|
||||
That's why you should always call AdjustSize instead of DoAutoSize.
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TControl.DoAutoSize;
|
||||
{$IFNDEF OldAutoSize}
|
||||
var
|
||||
PreferredWidth: integer;
|
||||
PreferredHeight: integer;
|
||||
ResizeWidth: Boolean;
|
||||
ResizeHeight: Boolean;
|
||||
{$ENDIF}
|
||||
begin
|
||||
// handled by TWinControl, or other descendants
|
||||
{$IFNDEF OldAutoSize}
|
||||
ResizeWidth:=not WidthIsAnchored;
|
||||
ResizeHeight:=not HeightIsAnchored;
|
||||
if ResizeWidth or ResizeHeight then begin
|
||||
@ -2461,7 +2360,6 @@ begin
|
||||
if (not ResizeHeight) or (PreferredHeight<=0) then PreferredHeight:=Height;
|
||||
SetBoundsKeepBase(Left,Top,PreferredWidth,PreferredHeight);
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -2469,7 +2367,6 @@ end;
|
||||
|
||||
Run DoAutoSize until done.
|
||||
------------------------------------------------------------------------------}
|
||||
{$IFNDEF OldAutoSize}
|
||||
procedure TControl.DoAllAutoSize;
|
||||
|
||||
procedure AutoSizeControl(AControl: TControl);
|
||||
@ -2547,7 +2444,6 @@ begin
|
||||
DebugLn(['TControl.DoAllAutoSize END ',DbgSName(Self),' ',dbgs(BoundsRect)]);
|
||||
{$ENDIF}
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TControl.AnchorSideChanged(TheAnchorSide: TAnchorSide);
|
||||
begin
|
||||
@ -2582,43 +2478,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
{------------------------------------------------------------------------------
|
||||
function TControl.AutoSizeCanStart: boolean;
|
||||
|
||||
Returns true if DoAutoSize can start. That means, it tests the minimum
|
||||
requirements to start. Some controls need even more.
|
||||
|
||||
It returns false if
|
||||
- AutoSize=false
|
||||
- or the control is currently autosizing
|
||||
- or the control is not visible
|
||||
- or the control is destroying
|
||||
------------------------------------------------------------------------------}
|
||||
function TControl.AutoSizeCanStart: boolean;
|
||||
begin
|
||||
Result:=AutoSize
|
||||
and (not AutoSizing)
|
||||
and (not (csDestroying in ComponentState))
|
||||
and ((not (csDesigning in ComponentState)) or (Parent<>nil)) // do not autosize forms in the designer
|
||||
and IsControlVisible;
|
||||
{$IFDEF VerboseCanAutoSize}
|
||||
if (not Result) and AutoSize then begin
|
||||
DbgOut('TControl.AutoSizeCanStart Self='+DbgSName(Self)+' ');
|
||||
if not AutoSize then DebugLn('not AutoSize')
|
||||
else if AutoSizing then DebugLn('AutoSizing')
|
||||
else if csDestroying in ComponentState then DebugLn('csDestroying in ComponentState')
|
||||
else if not IsControlVisible then
|
||||
DebugLn('Visible=',dbgs(Visible),
|
||||
' csDesigning=',dbgs(csDesigning in ComponentState),
|
||||
' csNoDesignVisible=',dbgs(csNoDesignVisible in ControlStyle))
|
||||
else DebugLn('?');
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
function TControl.AutoSizePhases: TControlAutoSizePhases;
|
||||
begin
|
||||
if Parent<>nil then
|
||||
@ -2626,7 +2485,6 @@ begin
|
||||
else
|
||||
Result:=[];
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TControl.AutoSizeDelayed: boolean;
|
||||
@ -2639,9 +2497,7 @@ begin
|
||||
Result:=(FAutoSizingLockCount>0)
|
||||
// no autosize during loading or destruction
|
||||
or ([csLoading,csDestroying]*ComponentState<>[])
|
||||
{$IFNDEF OldAutoSize}
|
||||
or (cfLoading in FControlFlags)
|
||||
{$ENDIF}
|
||||
// no autosize for invisible controls
|
||||
or (not IsControlVisible)
|
||||
// if there is no parent, then this control is not visible
|
||||
@ -3123,19 +2979,11 @@ end;
|
||||
procedure TControl.Resize;
|
||||
begin
|
||||
if ([csLoading,csDestroying]*ComponentState<>[]) then exit;
|
||||
{$IFNDEF OldAutoSize}
|
||||
if AutoSizeDelayed then exit;
|
||||
{$ENDIF}
|
||||
|
||||
if (FLastResizeWidth<>Width) or (FLastResizeHeight<>Height)
|
||||
or (FLastResizeClientWidth<>ClientWidth)
|
||||
or (FLastResizeClientHeight<>ClientHeight) then begin
|
||||
{$IFDEF OldAutoSize}
|
||||
if FormIsUpdating then begin
|
||||
Include(FControlFlags,cfOnResizeNeeded);
|
||||
exit;
|
||||
end;
|
||||
{$ENDIF}
|
||||
//if AnsiCompareText('NOTEBOOK',Name)=0 then
|
||||
{DebugLn(['[TControl.Resize] ',Name,':',ClassName,
|
||||
' Last=',FLastResizeWidth,',',FLastResizeHeight,
|
||||
@ -3152,7 +3000,6 @@ end;
|
||||
|
||||
procedure TControl.Loaded;
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
function FindLoadingControl(AControl: TControl): TControl;
|
||||
var
|
||||
i: Integer;
|
||||
@ -3202,7 +3049,6 @@ procedure TControl.Loaded;
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.Loaded.CheckLoading'){$ENDIF};
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
var
|
||||
UseClientWidthForWidth: boolean;
|
||||
@ -3261,27 +3107,12 @@ begin
|
||||
|
||||
UpdateBaseBounds(true,true,true);
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
// obsolete
|
||||
|
||||
// align this control and the brothers
|
||||
if cfRequestAlignNeeded in FControlFlags then
|
||||
RequestAlign;
|
||||
// autosize this control
|
||||
if cfAutoSizeNeeded in FControlFlags then
|
||||
AdjustSize;
|
||||
{$ENDIF}
|
||||
|
||||
// store designed width and height for undocking
|
||||
FUndockHeight := Height;
|
||||
FUndockWidth := Width;
|
||||
if Action <> nil then ActionChange(Action, True);
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
CheckOnChangeBounds;
|
||||
{$ELSE}
|
||||
CheckLoading(Self);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TControl.LoadedAll;
|
||||
@ -3323,29 +3154,20 @@ end;
|
||||
|
||||
procedure TControl.ReadState(Reader: TReader);
|
||||
begin
|
||||
{$IFNDEF OldAutoSize}
|
||||
Include(FControlFlags,cfLoading);
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.ReadState'){$ENDIF};
|
||||
try
|
||||
{$ENDIF}
|
||||
inherited ReadState(Reader);
|
||||
{$IFNDEF OldAutoSize}
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.ReadState'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TControl.FormEndUpdated;
|
||||
// called when control is on a form and EndFormUpdate reached 0
|
||||
// it is called recursively
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
if cfOnResizeNeeded in FControlFlags then
|
||||
Resize;
|
||||
if cfOnChangeBoundsNeeded in FControlFlags then
|
||||
CheckOnChangeBounds;
|
||||
{$ENDIF}
|
||||
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -3353,7 +3175,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TControl.SetBounds(ALeft, ATop, AWidth, AHeight: integer);
|
||||
begin
|
||||
ChangeBounds(ALeft, ATop, AWidth, AHeight{$IFNDEF OldAutoSize},false{$ENDIF});
|
||||
ChangeBounds(ALeft, ATop, AWidth, AHeight, false);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -3375,9 +3197,6 @@ begin
|
||||
//DebugLn(['TControl.SetAlign ',DbgSName(Self),' Old=',AlignNames[FAlign],' New=',AlignNames[Value],' ',Anchors<>AnchorAlign[FAlign]]);
|
||||
OldAlign := FAlign;
|
||||
FAlign := Value;
|
||||
{$IFDEF OldAutoSize}
|
||||
fLastAlignedBoundsTried:=0;
|
||||
{$ENDIF}
|
||||
// if anchors were on default then change them to new default
|
||||
// This is done for Delphi compatibility.
|
||||
if (Anchors = AnchorAlign[OldAlign]) and (Anchors <> AnchorAlign[FAlign]) then
|
||||
@ -3393,12 +3212,7 @@ procedure TControl.SetAnchors(const AValue: TAnchors);
|
||||
begin
|
||||
if Anchors = AValue then Exit;
|
||||
FAnchors := AValue;
|
||||
{$IFDEF OldAutoSize}
|
||||
fLastAlignedBoundsTried:=0;
|
||||
RequestAlign;
|
||||
{$ELSE}
|
||||
AdjustSize;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -3408,19 +3222,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TControl.RequestAlign;
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
if (Parent = nil) or (csDestroying in ComponentState) then exit;
|
||||
if (csLoading in ComponentState) or (not Parent.HandleAllocated) then begin
|
||||
//debugln('TControl.RequestAlign csLoading or not HandleAllocated ',DbgSName(Self));
|
||||
Include(FControlFlags,cfRequestAlignNeeded);
|
||||
exit;
|
||||
end;
|
||||
//debugln('TControl.RequestAlign AlignControl ',DbgSName(Self));
|
||||
Parent.AlignControl(Self);
|
||||
Exclude(FControlFlags,cfRequestAlignNeeded);
|
||||
{$ELSE}
|
||||
AdjustSize;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TControl.UpdateBaseBounds(StoreBounds,
|
||||
@ -3464,24 +3266,8 @@ begin
|
||||
FBaseBounds:=NewBaseBounds;
|
||||
Include(FControlFlags,cfBaseBoundsValid);
|
||||
FBaseParentClientSize:=NewBaseParentClientSize;
|
||||
{$IFDEF OldAutoSize}
|
||||
fLastAlignedBounds:=Rect(0,0,0,0);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
procedure TControl.LockBaseBounds;
|
||||
begin
|
||||
inc(fBaseBoundsLock);
|
||||
end;
|
||||
|
||||
procedure TControl.UnlockBaseBounds;
|
||||
begin
|
||||
dec(fBaseBoundsLock);
|
||||
if fBaseBoundsLock<0 then RaiseGDBException('TControl.UnlockBaseBounds');
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TControl.WriteLayoutDebugReport(const Prefix: string);
|
||||
var
|
||||
a: TAnchorKind;
|
||||
@ -3683,10 +3469,8 @@ end;
|
||||
procedure TControl.SetParent(NewParent: TWinControl);
|
||||
begin
|
||||
if FParent = NewParent then exit;
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.SetParent'){$ENDIF};
|
||||
try
|
||||
{$ENDIF}
|
||||
CheckNewParent(NewParent);
|
||||
if FParent <> nil then FParent.RemoveControl(Self);
|
||||
if cfBoundsRectForNewParentValid in FControlFlags then
|
||||
@ -3695,11 +3479,9 @@ begin
|
||||
BoundsRect := BoundsRectForNewParent;
|
||||
end;
|
||||
if NewParent <> nil then NewParent.InsertControl(Self);
|
||||
{$IFNDEF OldAutoSize}
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.SetParent'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -3869,10 +3651,8 @@ begin
|
||||
if FVisible <> Value then
|
||||
begin
|
||||
//DebugLn(['TControl.SetVisible ',DbgSName(Self),' NewVisible=',Value]);
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.SetVisible'){$ENDIF};
|
||||
try
|
||||
{$ENDIF}
|
||||
VisibleChanging;
|
||||
FVisible := Value;
|
||||
try
|
||||
@ -3883,7 +3663,6 @@ begin
|
||||
AsWincontrol := TWinControl(Self)
|
||||
else
|
||||
AsWincontrol := nil;
|
||||
{$IFNDEF OldAutoSize}
|
||||
InvalidatePreferredSize;
|
||||
if AsWincontrol <> nil then
|
||||
AsWincontrol.InvalidatePreferredChildSizes;
|
||||
@ -3895,39 +3674,12 @@ begin
|
||||
Parent.InvalidatePreferredSize;
|
||||
Parent.AdjustSize;
|
||||
end;
|
||||
{$ELSE}
|
||||
Include(FControlFlags, cfRequestAlignNeeded);
|
||||
// resize parent if it has autosize
|
||||
if (Parent <> nil) and Parent.AutoSize then
|
||||
begin
|
||||
Parent.InvalidatePreferredSize;
|
||||
Parent.AdjustSize;
|
||||
end;
|
||||
if FVisible then
|
||||
begin
|
||||
// control became visible
|
||||
if AsWincontrol <> nil then begin
|
||||
AsWincontrol.InvalidatePreferredChildSizes;
|
||||
Include(AsWincontrol.FWinControlFlags, wcfReAlignNeeded);
|
||||
end;
|
||||
AdjustSize;
|
||||
if (AsWincontrol <> nil) and (wcfReAlignNeeded in AsWincontrol.FWinControlFlags) then
|
||||
AsWincontrol.ReAlign;
|
||||
end;
|
||||
if cfRequestAlignNeeded in FControlFlags then
|
||||
RequestAlign;
|
||||
//DebugLn(['TControl.SetVisible ',dbgsName(AsWincontrol)]);
|
||||
if FVisible and (AsWincontrol <> nil) then
|
||||
AsWincontrol.ResizeDelayedAutoSizeChildren;
|
||||
{$ENDIF}
|
||||
finally
|
||||
VisibleChanged;
|
||||
end;
|
||||
{$IFNDEF OldAutoSize}
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.SetVisible'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
if (csLoading in ComponentState) then
|
||||
ControlState := ControlState + [csVisibleSetInLoading];
|
||||
@ -3956,13 +3708,9 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TControl.HandleObjectShouldBeVisible: boolean;
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
Result:=IsControlVisible;
|
||||
{$ELSE}
|
||||
Result := (not (csDestroying in ComponentState)) and IsControlVisible;
|
||||
if Result and Assigned(Parent) then
|
||||
Result := Parent.HandleObjectShouldBeVisible;
|
||||
{$ENDIF}
|
||||
//DebugLn(['TControl.HandleObjectShouldBeVisible ',DbgSName(Self),' ',Result]);
|
||||
end;
|
||||
|
||||
@ -4052,9 +3800,7 @@ begin
|
||||
RaiseAlreadyDocking;
|
||||
|
||||
// dock
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing;
|
||||
{$ENDIF}
|
||||
Include(FControlState, csDocking);
|
||||
try
|
||||
OldHostDockSite:=HostDockSite;
|
||||
@ -4084,9 +3830,7 @@ begin
|
||||
NewDockSite.FDockClients.Remove(Self);
|
||||
Exclude(FControlState, csDocking);
|
||||
end;
|
||||
{$IFNDEF OldAutoSize}
|
||||
EnableAutoSizing;
|
||||
{$ENDIF}
|
||||
|
||||
//DebugLn(['TControl.Dock END ',DbgSName(Self),' ',DbgSName(HostDockSite)]);
|
||||
end;
|
||||
@ -4231,9 +3975,7 @@ var
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing;
|
||||
{$ENDIF}
|
||||
OldDockSite := Control.HostDockSite;
|
||||
if (OldDockSite<>nil) and (not HostDockSiteManagerAvailable(OldDockSite)) then
|
||||
exit;
|
||||
@ -4247,9 +3989,7 @@ begin
|
||||
OldDockSite.DockManager.SetReplacingControl(nil);
|
||||
end;
|
||||
Result:=Control.ManualDock(NewDockSite,DropControl,ControlSide);
|
||||
{$IFNDEF OldAutoSize}
|
||||
EnableAutoSizing;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TControl.AddHandlerOnResize(const OnResizeEvent: TNotifyEvent;
|
||||
@ -4475,10 +4215,8 @@ constructor TControl.Create(TheOwner: TComponent);
|
||||
var
|
||||
Side: TAnchorKind;
|
||||
begin
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.Create'){$ENDIF};
|
||||
try
|
||||
{$ENDIF}
|
||||
//if AnsiCompareText(ClassName,'TSpeedButton')=0 then
|
||||
// DebugLn('TControl.Create START ',Name,':',ClassName);
|
||||
inherited Create(TheOwner);
|
||||
@ -4512,11 +4250,9 @@ begin
|
||||
FDragCursor := crDrag;
|
||||
FFloatingDockSiteClass := TCustomDockForm;
|
||||
//DebugLn('TControl.Create END ',Name,':',ClassName);
|
||||
{$IFNDEF OldAutoSize}
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.Create'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -4792,19 +4528,9 @@ begin
|
||||
SetBounds(aLeft,aTop,aWidth,aHeight);
|
||||
end;
|
||||
|
||||
procedure TControl.SetBoundsKeepBase(aLeft, aTop, aWidth, aHeight: integer
|
||||
{$IFDEF OldAutoSize}; Lock: boolean{$ENDIF});
|
||||
procedure TControl.SetBoundsKeepBase(aLeft, aTop, aWidth, aHeight: integer);
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
if Lock then LockBaseBounds;
|
||||
try
|
||||
SetBounds(aLeft, aTop, aWidth, aHeight);
|
||||
finally
|
||||
if Lock then UnlockBaseBounds;
|
||||
end;
|
||||
{$ELSE}
|
||||
ChangeBounds(aLeft, aTop, aWidth, aHeight, true);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -4864,22 +4590,6 @@ begin
|
||||
PreferredHeight:=Height;
|
||||
end;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
// if this control is aligned adjust PreferredWidth and/or PreferredHeight
|
||||
if WidthIsAnchored then begin
|
||||
// the control will be expanded to maximum width
|
||||
// -> use the current width, which is or will be eventually set by the
|
||||
// aligning code
|
||||
PreferredWidth:=Width;
|
||||
end;
|
||||
if HeightIsAnchored then begin
|
||||
// the control will be expanded to maximum height
|
||||
// -> use the current height, which is or will be eventually set by the
|
||||
// aligning code
|
||||
PreferredHeight:=Height;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
// apply constraints
|
||||
PreferredWidth:=Constraints.MinMaxWidth(PreferredWidth);
|
||||
PreferredHeight:=Constraints.MinMaxHeight(PreferredHeight);
|
||||
@ -4969,9 +4679,7 @@ begin
|
||||
while AControl<>nil do begin
|
||||
Exclude(AControl.FControlFlags,cfPreferredSizeValid);
|
||||
Exclude(AControl.FControlFlags,cfPreferredMinSizeValid);
|
||||
{$IFNDEF OldAutoSize}
|
||||
if not AControl.IsControlVisible then break;
|
||||
{$ENDIF}
|
||||
AControl:=AControl.Parent;
|
||||
end;
|
||||
end;
|
||||
@ -5008,9 +4716,6 @@ end;
|
||||
procedure TControl.DisableAutoSizing
|
||||
{$IFDEF DebugDisableAutoSizing}(const Reason: string){$ENDIF};
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
inc(FAutoSizingLockCount);
|
||||
{$ELSE}
|
||||
inc(FAutoSizingLockCount);
|
||||
{$IFDEF DebugDisableAutoSizing}
|
||||
if FAutoSizingLockReasons=nil then FAutoSizingLockReasons:=TStringList.Create;
|
||||
@ -5025,29 +4730,11 @@ begin
|
||||
Parent.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.DisableAutoSizing'){$ENDIF};
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TControl.EnableAutoSizing
|
||||
{$IFDEF DebugDisableAutoSizing}(const Reason: string){$ENDIF};
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
procedure AdjustSizeRecursive(AControl: TControl);
|
||||
var
|
||||
AWinControl: TWinControl;
|
||||
i: Integer;
|
||||
begin
|
||||
if cfAutoSizeNeeded in AControl.FControlFlags then
|
||||
AControl.AdjustSize;
|
||||
if AControl is TWinControl then begin
|
||||
AWinControl:=TWinControl(AControl);
|
||||
if AWincontrol.FControls<>nil then
|
||||
for i:=0 to AWincontrol.FControls.Count-1 do
|
||||
AdjustSizeRecursive(TControl(AWincontrol.FControls[i]));
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF DebugDisableAutoSizing}
|
||||
procedure CheckReason;
|
||||
var
|
||||
@ -5071,11 +4758,6 @@ begin
|
||||
{$ENDIF}
|
||||
|
||||
if FAutoSizingLockCount<=0 then RaiseGDBException('TControl.EnableAutoSizing');
|
||||
{$IFDEF OldAutoSize}
|
||||
dec(FAutoSizingLockCount);
|
||||
if FAutoSizingLockCount=0 then
|
||||
AdjustSizeRecursive(Self);
|
||||
{$ELSE}
|
||||
|
||||
dec(FAutoSizingLockCount);
|
||||
//DebugLn([Space(FAutoSizingLockCount*2),'TControl.EnableAutoSizing ',DbgSName(Self),' ',FAutoSizingLockCount]);
|
||||
@ -5088,7 +4770,6 @@ begin
|
||||
end else
|
||||
DoAllAutoSize;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{$IFDEF DebugDisableAutoSizing}
|
||||
@ -5140,14 +4821,10 @@ begin
|
||||
{$ENDIF}
|
||||
//Assert(False, Format('Trace:[TWinControl.WMSize] %s', [ClassName]));
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
SetBoundsKeepBase(Left,Top,Message.Width,Message.Height,Parent<>nil);
|
||||
{$ELSE}
|
||||
if Parent<>nil then
|
||||
SetBoundsKeepBase(Left,Top,Message.Width,Message.Height)
|
||||
else
|
||||
SetBounds(Left,Top,Message.Width,Message.Height);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -5165,16 +4842,11 @@ begin
|
||||
if CheckPosition(Self) then
|
||||
DebugLn('[TControl.WMMove] Name=',Name,':',ClassName,' Message.XPos=',DbgS(Message.XPos),' Message.YPos=',DbgS(Message.YPos),' OldLeft=',DbgS(Left),' OldTop=',DbgS(Top));
|
||||
{$ENDIF}
|
||||
{$IFDEF OldAutoSize}
|
||||
{ Just sync the coordinates }
|
||||
SetBoundsKeepBase(Message.XPos, Message.YPos, Width, Height,Parent<>nil);
|
||||
{$ELSE}
|
||||
// Just sync the coordinates
|
||||
if Parent<>nil then
|
||||
SetBoundsKeepBase(Message.XPos, Message.YPos, Width, Height)
|
||||
else
|
||||
SetBounds(Message.XPos, Message.YPos, Width, Height);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -114,9 +114,7 @@ begin
|
||||
//DebugLn('[TCustomForm.Destroy] A ',Name,':',ClassName);
|
||||
if not (csDestroying in ComponentState) then GlobalNameSpace.BeginWrite;
|
||||
try
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomForm.Destroy'){$ENDIF};
|
||||
{$ENDIF}
|
||||
FreeThenNil(FIcon);
|
||||
FreeIconHandles;
|
||||
Screen.RemoveForm(Self);
|
||||
@ -127,9 +125,7 @@ begin
|
||||
inherited Destroy;
|
||||
//DebugLn('[TCustomForm.Destroy] END ',Name,':',ClassName);
|
||||
finally
|
||||
{$IFNDEF OldAutoSize}
|
||||
if not (csDestroying in ComponentState) then
|
||||
{$ENDIF}
|
||||
GlobalNameSpace.EndWrite;
|
||||
end;
|
||||
end;
|
||||
@ -403,7 +399,6 @@ begin
|
||||
//DebugLn(['[TCustomForm.SetVisible] END ',Name,':',ClassName,' ',Value,' ',(fsCreating in FFormState),' ',Visible]);
|
||||
end;
|
||||
|
||||
{$ifndef OldAutoSize}
|
||||
procedure TCustomForm.AllAutoSized;
|
||||
begin
|
||||
inherited AllAutoSized;
|
||||
@ -413,7 +408,6 @@ begin
|
||||
MoveToDefaultPosition;
|
||||
end;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TCustomForm.SetWindowFocus;
|
||||
@ -696,12 +690,7 @@ begin
|
||||
lMessage.Result := 0;
|
||||
DisableAlign;
|
||||
try
|
||||
{$IFDEF OldAutoSize}
|
||||
if Parent<>nil then
|
||||
Parent.ReAlign
|
||||
else
|
||||
{$ENDIF}
|
||||
AdjustSize;
|
||||
AdjustSize;
|
||||
for i := 0 to ComponentCount - 1 do
|
||||
begin
|
||||
// all TControl descendants have this notification in TWinControl.CMBidiModeChanged
|
||||
@ -930,9 +919,7 @@ begin
|
||||
if FFormUpdateCount=0 then begin
|
||||
FormEndUpdated;
|
||||
Visible:=(fsVisible in FFormState);
|
||||
{$IFNDEF OldAutoSize}
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomForm.BeginFormUpdate'){$ENDIF};
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1080,18 +1067,14 @@ end;
|
||||
procedure TCustomForm.SetParent(NewParent: TWinControl);
|
||||
begin
|
||||
if Parent=NewParent then exit;
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomForm.SetParent'){$ENDIF};
|
||||
{$ENDIF}
|
||||
try
|
||||
if HandleAllocated then DestroyHandle;
|
||||
inherited SetParent(NewParent);
|
||||
if (Parent=nil) and Visible then
|
||||
HandleNeeded;
|
||||
finally
|
||||
{$IFNDEF OldAutoSize}
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomForm.SetParent'){$ENDIF};
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2352,29 +2335,6 @@ begin
|
||||
Assert(False, 'Trace:[TCustomForm.CreateWnd] FMenu.HandleNeeded');
|
||||
UpdateMenu;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
// activate focus if visible
|
||||
if Visible then begin
|
||||
if (ActiveControl = nil) and (not (csDesigning in ComponentState))
|
||||
and (Parent=nil) then begin
|
||||
// automatically choose a control to focus
|
||||
{$IFDEF VerboseFocus}
|
||||
DebugLn('TCustomForm.CreateWnd ',DbgSName(Self),' Set ActiveControl := ',DbgSName(FindDefaultForActiveControl));
|
||||
{$ENDIF}
|
||||
ActiveControl := FindDefaultForActiveControl;
|
||||
end;
|
||||
if (Parent=nil)
|
||||
and (FActiveControl<>nil) and FActiveControl.HandleAllocated
|
||||
and FActiveControl.CanFocus
|
||||
and ([csLoading,csDestroying,csDesigning]*ComponentState=[]) then begin
|
||||
{$IFDEF VerboseFocus}
|
||||
DebugLn('TCustomForm.CreateWnd A ',DbgSName(Self),' FActiveControl=',DbgSName(FActiveControl));
|
||||
{$ENDIF}
|
||||
LCLIntf.SetFocus(FActiveControl.Handle);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
// update icon
|
||||
Perform(CM_ICONCHANGED, 0, 0);
|
||||
//DebugLn('TCustomForm.CreateWnd END ',ClassName);
|
||||
@ -2431,10 +2391,8 @@ end;
|
||||
procedure TCustomForm.BeginFormUpdate;
|
||||
begin
|
||||
inc(FFormUpdateCount);
|
||||
{$IFNDEF OldAutoSize}
|
||||
if FFormUpdateCount=1 then
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomForm.BeginFormUpdate'){$ENDIF};
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -2467,7 +2425,6 @@ begin
|
||||
{$IFDEF CHECK_POSITION}
|
||||
DebugLn('[TCustomForm.UpdateShowing] END ',Name,':',Classname,' Pos=',DbgS(Left),',',DbgS(Top));
|
||||
{$ENDIF}
|
||||
{$IFNDEF OldAutoSize}
|
||||
// activate focus if visible
|
||||
if Showing and (not (csDestroying in ComponentState)) then begin
|
||||
if (ActiveControl = nil) and (not (csDesigning in ComponentState))
|
||||
@ -2489,7 +2446,6 @@ begin
|
||||
end;
|
||||
UpdateShowInTaskBar;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TCustomForm.DoFirstShow;
|
||||
|
@ -102,44 +102,9 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCustomLabel.DoAutoSize;
|
||||
{$IFDEF OldAutoSize}
|
||||
var
|
||||
NewWidth, NewHeight: integer;
|
||||
CurAnchors: TAnchors;
|
||||
{$ENDIF}
|
||||
begin
|
||||
inherited DoAutoSize;
|
||||
//debugln('TCustomLabel.DoAutoSize ',DbgSName(Self),' AutoSizing=',dbgs(AutoSizing),' AutoSize=',dbgs(AutoSize),' Parent=',DbgSName(Parent),' csLoading=',dbgs(csLoading in ComponentState),' Parnet.HandleAllocated=',dbgs((Parent<>nil) and (Parent.HandleAllocated)));
|
||||
{$IFDEF OldAutoSize}
|
||||
if OptimalFill and (not AutoSize) then
|
||||
begin
|
||||
AdjustFontForOptimalFill;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if AutoSizeDelayed then
|
||||
Exit;
|
||||
|
||||
GetPreferredSize(NewWidth, NewHeight);
|
||||
//debugln('TCustomLabel.DoAutoSize ',dbgsName(Self),' Nice ',dbgs(Left),',',dbgs(Top),',w=',dbgs(NewWidth),',h=',dbgs(NewHeight),' Caption="',dbgstr(Caption),'"');
|
||||
CurAnchors := [];
|
||||
if Align in [alLeft, alRight, alBottom, alTop, alClient] then
|
||||
CurAnchors := AnchorAlign[Align];
|
||||
CurAnchors := Anchors + CurAnchors;
|
||||
if (CurAnchors * [akLeft, akRight] = [akLeft, akRight]) or
|
||||
(WordWrap and (NewWidth < Width)) then
|
||||
NewWidth := Width;
|
||||
if CurAnchors * [akTop, akBottom] = [akTop, akBottom] then
|
||||
NewHeight := Height;
|
||||
|
||||
//debugln('TCustomLabel.DoAutoSize ',dbgsName(Self),' Anchored ',dbgs(Left),',',dbgs(Top),',w=',dbgs(NewWidth),',h=',dbgs(NewHeight));
|
||||
FInternalSetBounds := True;
|
||||
try
|
||||
SetBoundsKeepBase(Left, Top, NewWidth, NewHeight);
|
||||
finally
|
||||
FInternalSetBounds := False;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TCustomLabel.SetAlignment(Value : TAlignment);
|
||||
@ -323,9 +288,7 @@ end;
|
||||
procedure TCustomLabel.Loaded;
|
||||
begin
|
||||
inherited Loaded;
|
||||
{$IFNDEF OldAutoSize}
|
||||
AdjustSize;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TCustomLabel.UpdateSize;
|
||||
@ -333,10 +296,6 @@ begin
|
||||
InvalidatePreferredSize;
|
||||
if OptimalFill and (not AutoSize) then
|
||||
AdjustFontForOptimalFill;
|
||||
{$IFDEF OldAutoSize}
|
||||
if (Parent <> nil) and Parent.AutoSize then
|
||||
Parent.AdjustSize;
|
||||
{$ENDIF}
|
||||
AdjustSize;
|
||||
end;
|
||||
|
||||
|
@ -590,10 +590,8 @@ end;
|
||||
|
||||
procedure TCustomNoteBook.AddRemovePageHandle(APage: TCustomPage);
|
||||
begin
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomNoteBook.AddRemovePageHandle'){$ENDIF};
|
||||
try
|
||||
{$ENDIF}
|
||||
if (not (csDestroying in APage.ComponentState))
|
||||
and (APage.TabVisible or (csDesigning in ComponentState)) then begin
|
||||
{$IFDEF NOTEBOOK_DEBUG}
|
||||
@ -603,11 +601,7 @@ begin
|
||||
Include(APage.FFlags,pfAdding);
|
||||
TWSCustomNotebookClass(WidgetSetClass).AddPage(Self, APage, APage.VisibleIndex);
|
||||
APage.FFlags:=APage.FFlags+[pfAdded]-[pfAdding];
|
||||
{$IFDEF OldAutoSize}
|
||||
APage.ResizeDelayedAutoSizeChildren
|
||||
{$ELSE}
|
||||
APage.AdjustSize;
|
||||
{$ENDIF}
|
||||
end else begin
|
||||
{$IFDEF NOTEBOOK_DEBUG}
|
||||
DebugLn(['TCustomNoteBook.AddRemovePageHandle REMOVE ',DbgSName(APage),' pfAdded=',pfAdded in APage.FFlags]);
|
||||
@ -620,11 +614,9 @@ begin
|
||||
APage.DestroyHandle;
|
||||
Exclude(APage.FFlags, pfRemoving);
|
||||
end;
|
||||
{$IFNDEF OldAutoSize}
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TCustomNoteBook.AddRemovePageHandle'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TCustomNotebook.RemovePage(Index: Integer);
|
||||
|
@ -29,17 +29,13 @@ end;
|
||||
|
||||
procedure TScrollingWinControl.CreateWnd;
|
||||
begin
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TScrollingWinControl.CreateWnd'){$ENDIF};
|
||||
try
|
||||
{$ENDIF}
|
||||
inherited CreateWnd;
|
||||
UpdateScrollBars;
|
||||
{$IFNDEF OldAutoSize}
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TScrollingWinControl.CreateWnd'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TScrollingWinControl.GetClientScrollOffset: TPoint;
|
||||
|
@ -45,9 +45,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TSizeConstraints.UpdateInterfaceConstraints;
|
||||
begin
|
||||
{$IFNDEF OldAutoSize}
|
||||
if (Control is TWinControl) and TWinControl(Control).HandleAllocated then
|
||||
{$ENDIF}
|
||||
TWSControlClass(Control.WidgetSetClass).GetConstraints(Control, Self);
|
||||
end;
|
||||
|
||||
|
@ -327,11 +327,7 @@ begin
|
||||
TControl(FButtons[i]).InvalidatePreferredSize;
|
||||
TControl(FButtons[i]).AdjustSize;
|
||||
end;
|
||||
{$IFDEF OldAutoSize}
|
||||
ReAlign;
|
||||
{$ELSE}
|
||||
AdjustSize;
|
||||
{$ENDIF}
|
||||
Invalidate;
|
||||
Exclude(FToolBarFlags,tbfUpdateVisibleBarNeeded);
|
||||
end;
|
||||
@ -453,73 +449,21 @@ begin
|
||||
end;
|
||||
|
||||
procedure TToolBar.DoAutoSize;
|
||||
{$IFDEF OldAutoSize}
|
||||
var
|
||||
NewWidth: Integer;
|
||||
NewHeight: Integer;
|
||||
ModifyWidth, ModifyHeight : Boolean;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
if AutoSizing then Exit; // we shouldn't come here in the first place
|
||||
BeginAutoSizing;
|
||||
try
|
||||
NewWidth:=Width;
|
||||
NewHeight:=Height;
|
||||
GetPreferredSize(NewWidth,NewHeight);
|
||||
ModifyWidth := [akLeft, akRight] * (Anchors+AnchorAlign[Align]) <> [akLeft, akRight];
|
||||
ModifyHeight := [akTop, akBottom] * (Anchors+AnchorAlign[Align]) <> [akTop, akBottom];
|
||||
|
||||
if not ModifyWidth then NewWidth := Width;
|
||||
if not ModifyHeight then NewHeight := Height;
|
||||
|
||||
//DebugLn(['TToolBar.DoAutoSize ',DbgSName(Self),' ',Width,',',Height,' ',NewWidth,',',NewHeight]);
|
||||
if (NewWidth <> Width) or (NewHeight <> Height) then
|
||||
SetBounds(Left, Top, NewWidth, NewHeight);
|
||||
finally
|
||||
EndAutoSizing;
|
||||
end;
|
||||
{$ELSE}
|
||||
// childs are moved in ControlsAligned independent of AutoSize=true
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TToolBar.CalculatePreferredSize(var PreferredWidth,
|
||||
PreferredHeight: integer; WithThemeSpace: Boolean);
|
||||
var
|
||||
{$IFDEF OldAutoSize}
|
||||
ARect, Adjusted: TRect;
|
||||
ACount: Integer;
|
||||
{$ENDIF}
|
||||
NewWidth: Integer;
|
||||
NewHeight: Integer;
|
||||
FixedWidth: Boolean;
|
||||
begin
|
||||
NewWidth:=0;
|
||||
NewHeight:=0;
|
||||
{$IFDEF OldAutoSize}
|
||||
ARect := ClientRect;
|
||||
Adjusted := ARect;
|
||||
AdjustClientRect(Adjusted);
|
||||
ACount := ButtonCount;
|
||||
|
||||
|
||||
if IsVertical then
|
||||
PreferredWidth := ButtonWidth
|
||||
else
|
||||
PreferredWidth := ButtonWidth * ACount;
|
||||
inc(PreferredWidth, (Adjusted.Left - ARect.Left) + (ARect.Right - Adjusted.Right));
|
||||
|
||||
if IsVertical then
|
||||
PreferredWidth := ButtonHeight * ACount
|
||||
else
|
||||
PreferredHeight := ButtonHeight;
|
||||
inc(PreferredHeight, (Adjusted.Top - ARect.Top) + (ARect.Bottom - Adjusted.Bottom));
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
FixedWidth:=false;
|
||||
{$ENDIF}
|
||||
if [akLeft,akRight]*Anchors=[akLeft,akRight] then begin
|
||||
// the width depends on the parent or siblings
|
||||
// use a simpe heuristic to find out if the width is fixed
|
||||
@ -528,22 +472,18 @@ begin
|
||||
and (Parent.AutoSize=false)
|
||||
then begin
|
||||
// the width is fixed
|
||||
{$IFNDEF OldAutoSize}
|
||||
FixedWidth:=true;
|
||||
{$ENDIF}
|
||||
WrapButtons(Width, NewWidth, NewHeight, True);
|
||||
PreferredWidth := NewWidth;
|
||||
PreferredHeight := NewHeight;
|
||||
//DebugLn(['TToolBar.CalculatePreferredSize fixed width: ',PreferredWidth,'x',PreferredHeight]);
|
||||
end;
|
||||
end;
|
||||
{$IFNDEF OldAutoSize}
|
||||
if not FixedWidth then begin
|
||||
WrapButtons(Screen.Width,NewWidth,NewHeight,true);
|
||||
PreferredWidth := NewWidth;
|
||||
PreferredHeight := NewHeight;
|
||||
end;
|
||||
{$ENDIF}
|
||||
//DebugLn(['TToolBar.CalculatePreferredSize ',DbgSName(Self),' ',PreferredWidth,'x',PreferredHeight,' Count=',ControlCount]);
|
||||
end;
|
||||
|
||||
|
@ -404,17 +404,6 @@ begin
|
||||
else inherited RealSetText(AValue);
|
||||
end;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
procedure TToolButton.DoAutoSize;
|
||||
var
|
||||
PreferredWidth: integer;
|
||||
PreferredHeight: integer;
|
||||
begin
|
||||
GetPreferredSize(PreferredWidth,PreferredHeight);
|
||||
SetBounds(Left,Top,PreferredWidth,PreferredHeight);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TToolButton.SetToolBar(NewToolBar: TToolBar);
|
||||
begin
|
||||
if FToolBar = NewToolBar then exit;
|
||||
@ -863,7 +852,7 @@ begin
|
||||
else
|
||||
NewWidth := Width;
|
||||
NewHeight := TToolBar(AParent).ButtonHeight;
|
||||
SetBoundsKeepBase(Left, Top, NewWidth, NewHeight{$IFDEF OldAutoSize}, True{$ENDIF});
|
||||
SetBoundsKeepBase(Left, Top, NewWidth, NewHeight);
|
||||
end;
|
||||
|
||||
// inherited
|
||||
|
@ -2207,17 +2207,10 @@ begin
|
||||
OldBounds:=CurControl.BoundsRect;
|
||||
if not CompareRect(@NewBounds,@OldBounds) then begin
|
||||
Result:=true;
|
||||
{$IFDEF OldAutoSize}
|
||||
CurControl.SetAlignedBounds(NewBounds.Left,
|
||||
NewBounds.Top,
|
||||
NewBounds.Right-NewBounds.Left,
|
||||
NewBounds.Bottom-NewBounds.Top);
|
||||
{$ELSE}
|
||||
CurControl.SetBoundsKeepBase(NewBounds.Left,
|
||||
NewBounds.Top,
|
||||
NewBounds.Right-NewBounds.Left,
|
||||
NewBounds.Bottom-NewBounds.Top);
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -2310,7 +2303,6 @@ begin
|
||||
ReallocMem(Childs[o],0);
|
||||
end;
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
{------------------------------------------------------------------------------
|
||||
function TWinControl.AutoSizePhases: TControlAutoSizePhases;
|
||||
------------------------------------------------------------------------------}
|
||||
@ -2332,23 +2324,13 @@ begin
|
||||
Include(Result,caspChangingProperties);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TWinControl.AutoSizeDelayed: boolean;
|
||||
------------------------------------------------------------------------------}
|
||||
function TWinControl.AutoSizeDelayed: boolean;
|
||||
begin
|
||||
Result:={$IFDEF OldAutoSize}
|
||||
// no handle means not visible
|
||||
(not HandleAllocated)
|
||||
// obsolete
|
||||
or ((not FShowing) and (not (csDesigning in ComponentState)))
|
||||
// during handle creation no autosize
|
||||
or (wcfCreatingChildHandles in FWinControlFlags)
|
||||
{$ELSE}
|
||||
(csDestroyingHandle in ControlState)
|
||||
{$ENDIF}
|
||||
Result:=(csDestroyingHandle in ControlState)
|
||||
or (inherited AutoSizeDelayed);
|
||||
//if Result then debugln('TWinControl.AutoSizeDelayed A ',DbgSName(Self),' wcfCreatingChildHandles=',dbgs(wcfCreatingChildHandles in FWinControlFlags),' csLoading=',dbgs(csLoading in ComponentState));
|
||||
{$IFDEF VerboseCanAutoSize}
|
||||
@ -2946,11 +2928,7 @@ var
|
||||
// lock the base bounds, so that the new automatic bounds do not override
|
||||
// the user settings
|
||||
OldBounds:=Control.BoundsRect;
|
||||
{$IFDEF OldAutoSize}
|
||||
Control.SetAlignedBounds(NewLeft, NewTop, NewWidth, NewHeight);
|
||||
{$ELSE}
|
||||
Control.SetBoundsKeepBase(NewLeft, NewTop, NewWidth, NewHeight);
|
||||
{$ENDIF}
|
||||
//DebugLn(['DoPosition ',DbgSName(Control),' ',cfAutoSizeNeeded in Control.FControlFlags]);
|
||||
NewBounds:=Control.BoundsRect;
|
||||
BoundsMutated:=not CompareRect(@OldBounds,@NewBounds);
|
||||
@ -3093,9 +3071,6 @@ var
|
||||
|
||||
var
|
||||
i: Integer;
|
||||
{$IFDEF OldAutoSize}
|
||||
ChildControl: TControl;
|
||||
{$ENDIF}
|
||||
OldRemainingClientRect: TRect;
|
||||
OldRemainingBorderSpace: TRect;
|
||||
MaxTries: LongInt;
|
||||
@ -3104,30 +3079,6 @@ begin
|
||||
if wcfAligningControls in FWinControlFlags then exit;
|
||||
Include(FWinControlFlags,wcfAligningControls);
|
||||
try
|
||||
{$IFDEF OldAutoSize}
|
||||
// obsolete
|
||||
|
||||
// call delayed autosize
|
||||
for i:=ControlCount-1 downto 0 do begin
|
||||
ChildControl:=Controls[i];
|
||||
if cfAutoSizeNeeded in ChildControl.FControlFlags then begin
|
||||
//DebugLn(['TWinControl.AlignControls ',DbgSName(Self),' autosize needed for child ',DbgSName(ChildControl)]);
|
||||
ChildControl.AdjustSize;
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
// obsolete
|
||||
|
||||
// unset all align needed flags
|
||||
Exclude(FWinControlFlags,wcfReAlignNeeded);
|
||||
for i:=ControlCount-1 downto 0 do begin
|
||||
ChildControl:=Controls[i];
|
||||
Exclude(ChildControl.FControlFlags,cfRequestAlignNeeded);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
//if csDesigning in ComponentState then begin
|
||||
//DebugLn('[TWinControl.AlignControls] ',Name,':',Classname,' ',Left,',',Top,',',Width,',',Height,' AlignWork=',NeedAlignWork,' ControlCount=',ControlCount);
|
||||
//if AControl<>nil then DebugLn(' AControl=',AControl.Name,':',AControl.ClassName);
|
||||
@ -3187,18 +3138,6 @@ begin
|
||||
finally
|
||||
Exclude(FWinControlFlags,wcfAligningControls);
|
||||
end;
|
||||
{$IFDEF OldAutoSize}
|
||||
// obsolete
|
||||
|
||||
// let childs autosize themselves
|
||||
for i:=0 to ControlCount-1 do begin
|
||||
ChildControl:=Controls[i];
|
||||
if cfAutoSizeNeeded in ChildControl.FControlFlags then begin
|
||||
//DebugLn(['TWinControl.AlignControls AdjustSize: ',DbgSName(ChildControl),' ',(not ChildControl.AutoSizeCanStart),' ',ChildControl.AutoSizeDelayed]);
|
||||
ChildControl.AdjustSize;
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TWinControl.CustomAlignInsertBefore(AControl1, AControl2: TControl): Boolean;
|
||||
@ -3214,8 +3153,6 @@ begin
|
||||
then FOnAlignPosition(Self, AControl, ANewLeft, ANewTop, ANewWidth, ANewHeight, AlignRect, AlignInfo);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
function TWinControl.DoAlignChildControls(TheAlign: TAlign; AControl: TControl;
|
||||
AControlList: TFPList; var ARect: TRect): Boolean;
|
||||
begin
|
||||
@ -3230,46 +3167,6 @@ begin
|
||||
ReAlign;
|
||||
end;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
procedure TWinControl.ResizeDelayedAutoSizeChildren;
|
||||
var
|
||||
i: Integer;
|
||||
Child: TControl;
|
||||
AWinControl: TWinControl;
|
||||
begin
|
||||
if ControlCount=0 then exit;
|
||||
//DebugLn(['TWinControl.ResizeDelayedAutoSizeChildren START ',DbgSName(Self),' Visible=',Visible]);
|
||||
if AutoSizeDelayed then exit;
|
||||
//DebugLn(['TWinControl.ResizeDelayedAutoSizeChildren RUN ',DbgSName(Self)]);
|
||||
DisableAlign;
|
||||
try
|
||||
for i:=0 to ControlCount-1 do begin
|
||||
Child:=Controls[i];
|
||||
if Child.AutoSizeDelayed then begin
|
||||
//DebugLn(['TWinControl.ResizeDelayedAutoSizeChildren Child.AutoSizeDelayed Child=',dbgsName(Child)]);
|
||||
continue;
|
||||
end;
|
||||
|
||||
//DebugLn(['TWinControl.ResizeDelayedAutoSizeChildren ',dbgsName(Child),' AutoSize=',Child.AutoSize,' cfAutoSizeNeeded=',cfAutoSizeNeeded in Child.FControlFlags]);
|
||||
if cfRequestAlignNeeded in Child.FControlFlags then
|
||||
Child.RequestAlign;
|
||||
if (cfAutoSizeNeeded in Child.FControlFlags)
|
||||
or (Child.AutoSize and (not (cfPreferredSizeValid in Child.FControlFlags))) then
|
||||
Child.AdjustSize;
|
||||
|
||||
if Child is TWinControl then begin
|
||||
AWinControl:=TWinControl(Child);
|
||||
AWinControl.ResizeDelayedAutoSizeChildren;
|
||||
if wcfReAlignNeeded in AWinControl.FWinControlFlags then
|
||||
AWinControl.ReAlign;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
EnableAlign;
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TWinControl.InvalidatePreferredChildSizes;
|
||||
var
|
||||
AControl: TControl;
|
||||
@ -3339,18 +3236,6 @@ var
|
||||
NewChildBounds: TRect;
|
||||
OldChildBounds: TRect;
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
{$IFDEF VerboseAutoSize}
|
||||
debugln('TWinControl.DoAutoSize ',DbgSName(Self));
|
||||
{$ENDIF}
|
||||
if (not AutoSizeCanStart) or AutoSizeDelayed then begin
|
||||
{$IFDEF VerboseAutoSize}
|
||||
DebugLn(['TWinControl.DoAutoSize DELAYED AutoSizeCanStart=',AutoSizeCanStart,' AutoSizeDelayed=',AutoSizeDelayed]);
|
||||
{$ENDIF}
|
||||
Include(FControlFlags,cfAutoSizeNeeded);
|
||||
exit;
|
||||
end;
|
||||
{$ELSE}
|
||||
{$IFDEF VerboseAllAutoSize}
|
||||
debugln('TWinControl.DoAutoSize ',DbgSName(Self));
|
||||
{$ENDIF}
|
||||
@ -3361,13 +3246,8 @@ begin
|
||||
Include(FControlFlags,cfAutoSizeNeeded);
|
||||
exit;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.DoAutoSize'){$ENDIF};
|
||||
{$IFDEF OldAutoSize}
|
||||
// obsolete
|
||||
DisableAlign;
|
||||
{$ENDIF}
|
||||
try
|
||||
// test if resizing is possible
|
||||
HasVisibleChilds:=false;
|
||||
@ -3454,23 +3334,14 @@ begin
|
||||
inc(NewTop,Height-PreferredHeight);
|
||||
//if CompareText(Name,'NewUnitOkButton')=0 then
|
||||
//debugln(['DoAutoSize Resize ',DbgSName(Self),' Old=',dbgs(BoundsRect),' New=',dbgs(Bounds(NewLeft,NewTop,PreferredWidth,PreferredHeight)),' WidthIsFixed=',WidthIsFixed,' HeightIsFixed=',HeightIsFixed,' Align=',dbgs(Align),' Anchors=',dbgs(Anchors)]);
|
||||
{$IFDEF OldAutoSize}
|
||||
SetAlignedBounds(NewLeft,NewTop,PreferredWidth,PreferredHeight);
|
||||
{$ELSE}
|
||||
SetBoundsKeepBase(NewLeft,NewTop,PreferredWidth,PreferredHeight);
|
||||
{$ENDIF}
|
||||
end;
|
||||
finally
|
||||
Exclude(FControlFlags,cfAutoSizeNeeded);
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.DoAutoSize'){$ENDIF};
|
||||
{$IFDEF OldAutoSize}
|
||||
// obsolete
|
||||
EnableAlign;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
procedure TWinControl.DoAllAutoSize;
|
||||
|
||||
function CheckHandleAllocated(AWinControl: TWinControl): boolean;
|
||||
@ -3595,7 +3466,6 @@ procedure TWinControl.AllAutoSized;
|
||||
begin
|
||||
// see TCustomForm.AllAutoSized
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TWinControl BroadCast
|
||||
@ -3668,12 +3538,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TWinControl.DisableAlign;
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
Inc(FAlignLevel);
|
||||
//DebugLn(['TWinControl.DisableAlign ',dbgsName(Self),' ',FAlignLevel]);
|
||||
{$ELSE}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.DisableAlign'){$ENDIF};
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
@ -3687,7 +3552,7 @@ var
|
||||
R: TRect;
|
||||
begin
|
||||
if InvalidateRect then
|
||||
InvalidateClientRectCache({$IFDEF OldAutoSize}True{$ELSE}False{$ENDIF});
|
||||
InvalidateClientRectCache(False);
|
||||
R := GetClientRect;
|
||||
AdjustClientRect(R);
|
||||
//DebugLn(['TWinControl.DoAdjustClientRectChange ',DbgSName(Self),' ',r.Right,',',r.Bottom,' ',CompareRect(@r,@FAdjustClientRectRealized)]);
|
||||
@ -3700,9 +3565,6 @@ begin
|
||||
' New=',DbgS(r.Right),'x',DbgS(r.Bottom));
|
||||
{$ENDIF}
|
||||
FAdjustClientRectRealized := R;
|
||||
{$IFDEF OldAutoSize}
|
||||
ReAlign;
|
||||
{$ENDIF}
|
||||
AdjustSize;
|
||||
Resize;
|
||||
end;
|
||||
@ -3802,10 +3664,6 @@ var
|
||||
OldHeight: LongInt;
|
||||
begin
|
||||
//DbgOut('[TWinControl.DoSetBounds] ',Name,':',ClassName,' OldHeight=',DbgS(FHeight),' NewHeight=',DbgS(AHeight));
|
||||
{$IFDEF OldAutoSize}
|
||||
InvalidateClientRectCache(False);
|
||||
inherited DoSetBounds(ALeft, ATop, AWidth, AHeight);
|
||||
{$ELSE}
|
||||
OldWidth:=Width;
|
||||
OldHeight:=Height;
|
||||
inherited DoSetBounds(ALeft, ATop, AWidth, AHeight);
|
||||
@ -3814,7 +3672,6 @@ begin
|
||||
if FClientWidth<0 then FClientWidth:=0;
|
||||
inc(FClientHeight,Height-OldHeight);
|
||||
if FClientHeight<0 then FClientHeight:=0;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -3822,17 +3679,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TWinControl.EnableAlign;
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
Dec(FAlignLevel);
|
||||
//DebugLn(['TWinControl.EnableAlign ',dbgsName(Self),' ',FAlignLevel]);
|
||||
if FAlignLevel = 0 then begin
|
||||
if (csAlignmentNeeded in ControlState)
|
||||
or (wcfReAlignNeeded in FWinControlFlags) then
|
||||
ReAlign;
|
||||
end;
|
||||
{$ELSE}
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.DisableAlign'){$ENDIF};
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TWinControl.WriteLayoutDebugReport(const Prefix: string);
|
||||
@ -3957,9 +3804,6 @@ function TWinControl.GetClientRect: TRect;
|
||||
procedure StoreClientRect(NewClientRect: TRect);
|
||||
var
|
||||
ClientSizeChanged: boolean;
|
||||
{$IFDEF OldAutoSize}
|
||||
i: Integer;
|
||||
{$ENDIF}
|
||||
begin
|
||||
if wcfClientRectNeedsUpdate in FWinControlFlags then begin
|
||||
ClientSizeChanged:=(FClientWidth<>NewClientRect.Right)
|
||||
@ -3976,12 +3820,7 @@ function TWinControl.GetClientRect: TRect;
|
||||
{$IFDEF VerboseClientRectBugFix}
|
||||
DebugLn(['StoreClientRect ',DbgSName(Self),' ',FClientWidth,',',FClientHeight,' HandleAllocated=',HandleAllocated,' wcfBoundsRealized=',wcfBoundsRealized in FWinControlFlags]);
|
||||
{$ENDIF}
|
||||
{$IFDEF OldAutoSize}
|
||||
for i:=0 to ControlCount-1 do
|
||||
Controls[i].fLastAlignedBoundsTried:=0;
|
||||
{$ELSE}
|
||||
FAdjustClientRectRealized:=Rect(0,0,0,0);
|
||||
{$ENDIF}
|
||||
end;
|
||||
Exclude(FWinControlFlags,wcfClientRectNeedsUpdate);
|
||||
end;
|
||||
@ -4340,35 +4179,6 @@ var
|
||||
begin
|
||||
bShow := HandleObjectShouldBeVisible;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
if bShow then begin
|
||||
if not HandleAllocated then CreateHandle;
|
||||
if FControls <> nil
|
||||
then begin
|
||||
for n := 0 to FControls.Count - 1 do
|
||||
if TObject(FControls[n]) is TWinControl then
|
||||
TWinControl(FControls[n]).UpdateShowing;
|
||||
end;
|
||||
end;
|
||||
if not HandleAllocated then Exit;
|
||||
|
||||
if FShowing = bShow then Exit;
|
||||
|
||||
ChangeShowing(bShow);
|
||||
|
||||
//DebugLn(['TWinControl.UpdateShowing ',DbgSName(Self),' FShowing=',FShowing,' AutoSizeDelayed=',AutoSizeDelayed]);
|
||||
|
||||
if FShowing then
|
||||
begin
|
||||
DisableAlign;
|
||||
try
|
||||
ResizeDelayedAutoSizeChildren;
|
||||
AdjustSize;
|
||||
finally
|
||||
EnableAlign;
|
||||
end;
|
||||
end;
|
||||
{$ELSE}
|
||||
if bShow then begin
|
||||
if not HandleAllocated then CreateHandle;
|
||||
if FControls <> nil
|
||||
@ -4394,7 +4204,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
ChangeShowing(bShow);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TWinControl.Update;
|
||||
@ -5998,14 +5807,12 @@ begin
|
||||
end;
|
||||
|
||||
AControl.FParent := Self;
|
||||
{$IFNDEF OldAutoSize}
|
||||
if AControl.FAutoSizingLockCount>0 then
|
||||
begin
|
||||
// the AControl has disabled autosizing => disable it for the parent=self too
|
||||
//DebugLn([Space(FAutoSizingLockCount*2+2),'TWinControl.Insert ',DbgSName(Self),' Control=',DbgSName(AControl),' disable Parent']);
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.DisableAutoSizing'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -6015,24 +5822,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TWinControl.ReAlign;
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
if (csDestroying in ComponentState) then exit;
|
||||
if (csLoading in ComponentState) or (not HandleAllocated) then begin
|
||||
Include(FWinControlFlags,wcfReAlignNeeded);
|
||||
exit;
|
||||
end;
|
||||
Exclude(FWinControlFlags,wcfReAlignNeeded);// avoid calling after rekursive EnableAlign
|
||||
{$IFDEF VerboseAutoSize}
|
||||
DebugLn('TWinControl.ReAlign A',Name,':',ClassName,' ', Dbgs(BoundsRect));
|
||||
{$ENDIF}
|
||||
AlignControl(nil);
|
||||
{$IFDEF VerboseAutoSize}
|
||||
DebugLn('TWinControl.ReAlign B',Name,':',ClassName,' ', Dbgs(BoundsRect));
|
||||
{$ENDIF}
|
||||
Exclude(FWinControlFlags,wcfReAlignNeeded);// done
|
||||
{$ELSE}
|
||||
AdjustSize;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -6048,7 +5838,6 @@ begin
|
||||
ListRemove(FControls, AControl);
|
||||
ListRemove(FAlignOrder, AControl);
|
||||
AControl.FParent := nil;
|
||||
{$IFNDEF OldAutoSize}
|
||||
if AControl.FAutoSizingLockCount>0 then
|
||||
begin
|
||||
// AControl has disabled autosizing and thus for its parent=Self too
|
||||
@ -6056,7 +5845,6 @@ begin
|
||||
//DebugLn([Space(FAutoSizingLockCount*2),'TWinControl.Remove ',DbgSName(Self),' Control=',DbgSName(AControl),' enable Parent']);
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TControl.DisableAutoSizing'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -6136,31 +5924,11 @@ end;
|
||||
TWinControl.CMVisibleChanged
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TWinControl.UpdateControlState;
|
||||
{$IFDEF OldAutoSize}
|
||||
var
|
||||
AWinControl: TWinControl;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
AWinControl:= Self;
|
||||
{ If any of the parent is not visible, exit }
|
||||
while AWinControl.Parent <> nil do
|
||||
begin
|
||||
AWinControl:= AWinControl.Parent;
|
||||
if (not AWinControl.Showing) or (not AWinControl.HandleAllocated) then Exit;
|
||||
end;
|
||||
|
||||
if ((AWinControl is TCustomForm) and (AWinControl.Parent=nil))
|
||||
or (AWinControl.FParentWindow <> 0) then
|
||||
begin
|
||||
UpdateShowing;
|
||||
end;
|
||||
{$ELSE}
|
||||
if HandleObjectShouldBeVisible then
|
||||
AdjustSize // this will trigger DoAllAutoSize, which calls UpdateShowing
|
||||
else
|
||||
UpdateShowing; // hide immediately
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -6173,10 +5941,8 @@ end;
|
||||
|
||||
procedure TWinControl.InsertControl(AControl: TControl; Index: integer);
|
||||
begin
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.InsertControl'){$ENDIF};
|
||||
try
|
||||
{$ENDIF}
|
||||
AControl.ValidateContainer(Self);
|
||||
Perform(CM_CONTROLLISTCHANGE, WParam(AControl), LParam(True));
|
||||
Insert(AControl,Index);
|
||||
@ -6194,22 +5960,11 @@ begin
|
||||
AControl.Invalidate;
|
||||
//DebugLn('TWinControl.InsertControl ',Name,':',ClassName);
|
||||
end;
|
||||
{$IFDEF OldAutoSize}
|
||||
if not (csDestroying in ComponentState) then
|
||||
begin
|
||||
if not (csLoading in ComponentState) then
|
||||
AControl.UpdateAnchorRules;
|
||||
AControl.RequestAlign;
|
||||
end;
|
||||
{$ELSE}
|
||||
AdjustSize;
|
||||
{$ENDIF}
|
||||
Perform(CM_CONTROLCHANGE, WParam(AControl), LParam(True));
|
||||
{$IFNDEF OldAutoSize}
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.InsertControl'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
//debugln(['TWinControl.InsertControl ',DbgSName(Self),' ',csDesigning in ComponentState,' ',DbgSName(AControl),' ',csDesigning in AControl.ComponentState]);
|
||||
end;
|
||||
|
||||
@ -6220,10 +5975,8 @@ procedure TWinControl.RemoveControl(AControl: TControl);
|
||||
var
|
||||
AWinControl: TWinControl;
|
||||
begin
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.RemoveControl'){$ENDIF};
|
||||
try
|
||||
{$ENDIF}
|
||||
Perform(CM_CONTROLCHANGE, WParam(AControl), LParam(False));
|
||||
if AControl is TWinControl then
|
||||
begin
|
||||
@ -6239,23 +5992,12 @@ begin
|
||||
Perform(CM_CONTROLLISTCHANGE, WParam(AControl), LParam(False));
|
||||
if not (csDestroying in ComponentState) then
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
if AutoSize then
|
||||
begin
|
||||
InvalidatePreferredSize;
|
||||
AdjustSize;
|
||||
end;
|
||||
Realign;
|
||||
{$ELSE}
|
||||
InvalidatePreferredSize;
|
||||
AdjustSize;
|
||||
{$ENDIF}
|
||||
end;
|
||||
{$IFNDEF OldAutoSize}
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.RemoveControl'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -6265,10 +6007,6 @@ procedure TWinControl.AlignControl(AControl: TControl);
|
||||
var
|
||||
ARect: TRect;
|
||||
NewRect: TRect;
|
||||
{$IFDEF OldAutoSize}
|
||||
i: Integer;
|
||||
ChildControl: TControl;
|
||||
{$ENDIF}
|
||||
begin
|
||||
//if csDesigning in ComponentState then begin
|
||||
// DbgOut('TWinControl.AlignControl ',Name,':',ClassName);
|
||||
@ -6276,47 +6014,8 @@ begin
|
||||
//end;
|
||||
if csDestroying in ComponentState then exit;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
if FAlignLevel <> 0 then begin
|
||||
Include(FControlState, csAlignmentNeeded);
|
||||
exit;
|
||||
end;
|
||||
|
||||
// check if all childs have finished loading
|
||||
for i:=0 to ControlCount-1 do begin
|
||||
ChildControl:=Controls[i];
|
||||
if csLoading in ChildControl.ComponentState then begin
|
||||
// child is loading
|
||||
// -> mark the child, that itself and its brothers needs realigning
|
||||
// (it will do this, when it has finished loading)
|
||||
Include(ChildControl.FControlFlags,cfRequestAlignNeeded);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
{$ELSE}
|
||||
// only called by DoAllAutoSize, so no check needed
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
DisableAlign;
|
||||
try
|
||||
ARect:= GetLogicalClientRect;
|
||||
AlignControls(AControl, ARect);
|
||||
// some widgetsets updates their clientrect when the first child was moved
|
||||
// do a second pass if ClientRect changed
|
||||
NewRect:=GetLogicalClientRect;
|
||||
if not CompareRect(@ARect,@NewRect) then
|
||||
AlignControls(AControl, NewRect);
|
||||
finally
|
||||
Exclude(FControlState, csAlignmentNeeded);
|
||||
EnableAlign;
|
||||
if (FAlignLevel=0) and (not IsAParentAligning) and (FControls<>nil) then
|
||||
for i:=0 to FControls.Count-1 do
|
||||
if TObject(FControls[i]) is TWinControl then
|
||||
TWinControl(FControls[i]).RealizeBoundsRecursive;
|
||||
end;
|
||||
|
||||
{$ELSE}
|
||||
DisableAlign;
|
||||
try
|
||||
ARect:= GetLogicalClientRect;
|
||||
@ -6329,7 +6028,6 @@ begin
|
||||
finally
|
||||
EnableAlign;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -6804,7 +6502,6 @@ begin
|
||||
if HandleAllocated and (not IsIconic(Handle)) then
|
||||
GetWindowSize(Handle, NewWidth, NewHeight);
|
||||
FBoundsRealized := Bounds(Message.XPos, Message.YPos, NewWidth, NewHeight);
|
||||
{$IFNDEF OldAutoSize}
|
||||
if ([caspCreatingHandles,caspComputingBounds]*AutoSizePhases<>[])
|
||||
then begin
|
||||
// while the LCL is creating handles the widgetset may send default bounds
|
||||
@ -6817,16 +6514,11 @@ begin
|
||||
//DebugLn(['TWinControl.WMSize from intf ignored, because phases=',dbgs(AutoSizePhases),' boundsrealized=',wcfBoundsRealized in FWinControlFlags]);
|
||||
exit;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
{$IFDEF OldAutoSize}
|
||||
SetBoundsKeepBase(Message.XPos, Message.YPos, NewWidth, NewHeight, Parent <> nil);
|
||||
{$ELSE}
|
||||
if Parent<>nil then
|
||||
SetBoundsKeepBase(Message.XPos, Message.YPos, NewWidth, NewHeight)
|
||||
else
|
||||
SetBounds(Message.XPos, Message.YPos, NewWidth, NewHeight);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -6887,7 +6579,6 @@ begin
|
||||
{$ENDIF}
|
||||
|
||||
FBoundsRealized := NewBoundsRealized;
|
||||
{$IFNDEF OldAutoSize}
|
||||
//DebugLn(['TWinControl.WMSize ',DbgSName(Self),' phases=',dbgs(AutoSizePhases)]);
|
||||
if ([caspCreatingHandles,caspComputingBounds]*AutoSizePhases<>[])
|
||||
then begin
|
||||
@ -6901,22 +6592,11 @@ begin
|
||||
//DebugLn(['TWinControl.WMSize from intf ignored, because phases=',dbgs(AutoSizePhases),' boundsrealized=',wcfBoundsRealized in FWinControlFlags]);
|
||||
exit;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
if Parent<>nil then
|
||||
{$ENDIF}
|
||||
InvalidatePreferredSize;
|
||||
end;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
SetBoundsKeepBase(NewLeft, NewTop, Message.Width, Message.Height, Parent <> nil);
|
||||
if ClientRectNeedsInterfaceUpdate then
|
||||
DoAdjustClientRectChange;
|
||||
if ((Message.SizeType and Size_SourceIsInterface) > 0) and
|
||||
(Parent <> nil) and Parent.AutoSize then
|
||||
Parent.AdjustSize;
|
||||
{$ELSE}
|
||||
if Parent<>nil then
|
||||
SetBoundsKeepBase(NewLeft, NewTop, Message.Width, Message.Height)
|
||||
else
|
||||
@ -6924,7 +6604,6 @@ begin
|
||||
if ((Message.SizeType and Size_SourceIsInterface) > 0)
|
||||
and ClientRectNeedsInterfaceUpdate then
|
||||
DoAdjustClientRectChange;
|
||||
{$ENDIF}
|
||||
{$IFDEF VerboseClientRectBugFix}
|
||||
//if Name=CheckClientRectName then
|
||||
if ((Message.SizeType and Size_SourceIsInterface) > 0) then
|
||||
@ -6993,7 +6672,6 @@ begin
|
||||
' wcfClientRectNeedsUpdate=',wcfClientRectNeedsUpdate in FWinControlFlags]);
|
||||
{ $ENDIF}
|
||||
FBoundsRealized := NewBoundsRealized;
|
||||
{$IFNDEF OldAutoSize}
|
||||
//DebugLn(['TWinControl.WMSize ',DbgSName(Self),' phases=',dbgs(AutoSizePhases)]);
|
||||
if ([caspCreatingHandles,caspComputingBounds]*AutoSizePhases<>[])
|
||||
or (not (wcfBoundsRealized in FWinControlFlags))
|
||||
@ -7011,9 +6689,7 @@ begin
|
||||
|
||||
if Parent<>nil then
|
||||
InvalidatePreferredSize;
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
if Parent<>nil then
|
||||
SetBoundsKeepBase(NewLeft, NewTop, NewWidth, NewHeight)
|
||||
else
|
||||
@ -7021,7 +6697,6 @@ begin
|
||||
if ((Message.WindowPos^.flags and SWP_SourceIsInterface) > 0)
|
||||
and ClientRectNeedsInterfaceUpdate then
|
||||
DoAdjustClientRectChange;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -7306,36 +6981,28 @@ begin
|
||||
if (csDestroying in ComponentState)
|
||||
or (Parent<>nil) and (csDestroying in Parent.ComponentState) then begin
|
||||
DebugLn('[TWinControl.CreateWnd] NOTE: csDestroying ',DbgSName(Self));
|
||||
{$IFNDEF OldAutoSize}
|
||||
RaiseGDBException('');
|
||||
{$ENDIF}
|
||||
exit;
|
||||
end;
|
||||
|
||||
if wcfInitializing in FWinControlFlags
|
||||
then begin
|
||||
DebugLn('[WARNING] Recursive call to CreateWnd for ',DbgSName(Self), ' while initializing');
|
||||
{$IFNDEF OldAutoSize}
|
||||
RaiseGDBException('');
|
||||
{$ENDIF}
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if wcfCreatingHandle in FWinControlFlags
|
||||
then begin
|
||||
DebugLn('[WARNING] Recursive call to CreateWnd for ',DbgSName(Self), ' while creating handle');
|
||||
{$IFNDEF OldAutoSize}
|
||||
RaiseGDBException('');
|
||||
{$ENDIF}
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if wcfCreatingChildHandles in FWinControlFlags
|
||||
then begin
|
||||
DebugLn('[WARNING] Recursive call to CreateWnd for ',DbgSName(Self), ' while creating children');
|
||||
{$IFNDEF OldAutoSize}
|
||||
RaiseGDBException('');
|
||||
{$ENDIF}
|
||||
Exit;
|
||||
end;
|
||||
|
||||
@ -7348,13 +7015,8 @@ begin
|
||||
FBoundsRealized:=Rect(0,0,0,0);
|
||||
Exclude(FWinControlFlags,wcfBoundsRealized);
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
// obsolete
|
||||
DisableAlign;
|
||||
{$ENDIF}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.CreateWnd'){$ENDIF};
|
||||
try
|
||||
{$IFNDEF OldAutoSize}
|
||||
if (Parent<>nil) and (not Parent.HandleAllocated) then
|
||||
begin
|
||||
// first create the parent handle
|
||||
@ -7362,7 +7024,6 @@ begin
|
||||
if HandleAllocated then exit;
|
||||
DebugLn(['WARNING: TWinControl.CreateWnd: parent created handles, but not ours']);
|
||||
end;
|
||||
{$ENDIF}
|
||||
// Control is not visible at this moment. It will be shown in UpdateShowing
|
||||
FShowing := False;
|
||||
Exclude(FWinControlFlags, wcfHandleVisible);
|
||||
@ -7426,22 +7087,11 @@ begin
|
||||
Exclude(FWinControlFlags, wcfCreatingChildHandles);
|
||||
end;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
// size this control
|
||||
UpdateShowing;
|
||||
AdjustSize;
|
||||
if FControls<>nil then
|
||||
for i:=0 to FControls.Count-1 do
|
||||
TControl(FControls[i]).AdjustSize;
|
||||
// realign childs
|
||||
ReAlign;
|
||||
{$ELSE}
|
||||
if FControls<>nil then
|
||||
for i:=0 to FControls.Count-1 do
|
||||
TControl(FControls[i]).InvalidatePreferredSize;
|
||||
// size this control
|
||||
AdjustSize;
|
||||
{$ENDIF}
|
||||
finally
|
||||
//DebugLn(['TWinControl.CreateWnd created ',DbgSName(Self),' enable autosizing ...']);
|
||||
(* If an error occured and FHandle was not created,
|
||||
@ -7451,10 +7101,6 @@ begin
|
||||
As a side effect the current control will be left in autosize-disabled *)
|
||||
if FHandle <> 0 then
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.CreateWnd'){$ENDIF};
|
||||
{$IFDEF OldAutoSize}
|
||||
// obsolete
|
||||
EnableAlign;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
//DebugLn('[TWinControl.CreateWnd] END ',Name,':',Classname);
|
||||
@ -7480,9 +7126,6 @@ begin
|
||||
|
||||
// First set the WinControl property some interfaces depends on it
|
||||
SetProp(Handle,'WinControl',TWinControl(Self));
|
||||
{$IFDEF OldAutoSize}
|
||||
DisableAlign;
|
||||
{$ENDIF}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.InitializeWnd'){$ENDIF};
|
||||
try
|
||||
{$IFDEF CHECK_POSITION}
|
||||
@ -7491,11 +7134,6 @@ begin
|
||||
' OldRelBounds=',dbgs(FBoundsRealized),
|
||||
' -> NewBounds=',dbgs(BoundsRect));
|
||||
{$ENDIF}
|
||||
{$IFDEF OldAutoSize}
|
||||
// obsolete
|
||||
if (Width>0) and (Height>0) then
|
||||
DoSendBoundsToInterface;
|
||||
{$ENDIF}
|
||||
|
||||
if wcfColorChanged in FWinControlFlags then
|
||||
begin
|
||||
@ -7526,9 +7164,6 @@ begin
|
||||
else TWSWinControlClass(WidgetSetClass).SetCursor(Self, Screen.Cursors[Cursor]);
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.InitializeWnd'){$ENDIF};
|
||||
{$IFDEF OldAutoSize}
|
||||
EnableAlign;
|
||||
{$ENDIF}
|
||||
end;
|
||||
// send pending OnResize
|
||||
Resize;
|
||||
@ -7611,12 +7246,7 @@ var
|
||||
LoadedClientSize: TPoint;
|
||||
CurControl: TWinControl;
|
||||
begin
|
||||
{$IFDEF OldAutoSize}
|
||||
// obsolete
|
||||
DisableAlign;
|
||||
{$ELSE}
|
||||
//DebugLn(['TWinControl.Loaded START ',DbgSName(Self),' cfWidthLoaded=',cfWidthLoaded in FControlFlags,' cfHeightLoaded=',cfHeightLoaded in FControlFlags,' ']);
|
||||
{$ENDIF}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.Loaded'){$ENDIF};
|
||||
try
|
||||
//DebugLn(['TWinControl.Loaded ',DbgSName(Self),' cfWidthLoaded=',cfWidthLoaded in FControlFlags,' cfHeightLoaded=',cfHeightLoaded in FControlFlags,' ']);
|
||||
@ -7675,23 +7305,10 @@ begin
|
||||
|
||||
FixupTabList;
|
||||
|
||||
{$IFDEF OldAutoSize}
|
||||
// obsolete
|
||||
RealizeBounds;
|
||||
if HandleAllocated and ([csDestroying]*ComponentState=[]) then
|
||||
DoSendShowHideToInterface;
|
||||
{$ENDIF}
|
||||
finally
|
||||
{$IFNDEF OldAutoSize}
|
||||
//DebugLn(['TWinControl.Loaded enableautosizing ',DbgSName(Self),' ',dbgs(BoundsRect)]);
|
||||
{$ENDIF}
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.Loaded'){$ENDIF};
|
||||
{$IFDEF OldAutoSize}
|
||||
// obsolete
|
||||
EnableAlign;
|
||||
{$ELSE}
|
||||
//DebugLn(['TWinControl.Loaded END ',DbgSName(Self),' ',dbgs(BoundsRect)]);
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -7718,10 +7335,8 @@ begin
|
||||
if HandleAllocated then
|
||||
begin
|
||||
//DebugLn(['TWinControl.DestroyWnd ',DbgSName(Self)]);
|
||||
{$IFNDEF OldAutoSize}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.DestroyWnd'){$ENDIF};
|
||||
try
|
||||
{$ENDIF}
|
||||
FinalizeWnd;
|
||||
|
||||
if FControls <> nil then
|
||||
@ -7735,11 +7350,9 @@ begin
|
||||
// again. To propely initialize control after we need to restore color
|
||||
// and font. Request update.
|
||||
FWinControlFlags := FWinControlFlags + [wcfColorChanged, wcfFontChanged];
|
||||
{$IFNDEF OldAutoSize}
|
||||
finally
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.DestroyWnd'){$ENDIF};
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -7824,9 +7437,7 @@ begin
|
||||
RaiseGDBException('UnlockRealizeBounds');
|
||||
dec(FRealizeBoundsLockCount);
|
||||
if (FRealizeBoundsLockCount=0)
|
||||
{$IFNDEF OldAutoSize}
|
||||
and (not AutoSizeDelayed) and (caspRealizingBounds in AutoSizePhases)
|
||||
{$ENDIF}
|
||||
then
|
||||
RealizeBounds;
|
||||
end;
|
||||
@ -7989,11 +7600,7 @@ begin
|
||||
if [csDesigning,csDestroying,csLoading]*ComponentState=[csDesigning] then
|
||||
CheckDesignBounds;
|
||||
// LCL bounds are not up2date -> process new bounds
|
||||
{$IFDEF OldAutoSize}
|
||||
LockRealizeBounds;
|
||||
{$ELSE}
|
||||
DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.SetBounds'){$ENDIF};
|
||||
{$ENDIF}
|
||||
try
|
||||
{$IFDEF CHECK_POSITION}
|
||||
//if csDesigning in ComponentState then
|
||||
@ -8005,11 +7612,7 @@ begin
|
||||
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
|
||||
//DebugLn(['TWinControl.SetBounds ',DbgSName(Self),' FUseDockManager=',FUseDockManager,' ',DbgSName(DockManager)]);
|
||||
finally
|
||||
{$IFDEF OldAutoSize}
|
||||
UnlockRealizeBounds;
|
||||
{$ELSE}
|
||||
EnableAutoSizing{$IFDEF DebugDisableAutoSizing}('TWinControl.SetBounds'){$ENDIF};
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -8250,7 +7853,6 @@ var
|
||||
OldBounds: TRect;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFNDEF OldAutoSize}
|
||||
if (Parent=nil) and (not HandleObjectShouldBeVisible) then begin
|
||||
{ do not move invisible forms
|
||||
Reason: It is common to do this:
|
||||
@ -8262,7 +7864,6 @@ begin
|
||||
Only send the last bounds. }
|
||||
exit;
|
||||
end;
|
||||
{$ENDIF}
|
||||
NewBounds:=Bounds(Left, Top, Width, Height);
|
||||
{$IF defined(VerboseResizeFlicker)}
|
||||
if HandleAllocated then begin
|
||||
@ -8307,26 +7908,21 @@ begin
|
||||
end;
|
||||
{$ENDIF}
|
||||
FBoundsRealized:=NewBounds;
|
||||
{$IFNDEF OldAutoSize}
|
||||
OldClientRect:=ClientRect;
|
||||
{$ENDIF}
|
||||
Include(FWinControlFlags,wcfBoundsRealized); // Note: set before calling widgetset, because used in WMSize
|
||||
//if Parent=nil then DebugLn(['TWinControl.DoSendBoundsToInterface ',DbgSName(Self),' ',dbgs(BoundsRect)]);
|
||||
// this can trigger WMSize messages
|
||||
TWSWinControlClass(WidgetSetClass).SetBounds(Self, Left, Top, Width, Height);
|
||||
{$IFNDEF OldAutoSize}
|
||||
NewClientRect:=ClientRect;
|
||||
if not CompareRect(@OldClientRect,@NewClientRect) then begin
|
||||
// the widgetset has changed the clientrect
|
||||
//DebugLn(['TWinControl.DoSendBoundsToInterface ',DbgSName(Self),' Bounds=',dbgs(BoundsRect),' OldClientRect=',dbgs(OldClientRect),' NewClientRect=',dbgs(NewClientRect)]);
|
||||
AdjustSize;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TWinControl.RealizeBounds;
|
||||
|
||||
{$IFNDEF OldAutoSize}
|
||||
procedure Check;
|
||||
var
|
||||
c: TWinControl;
|
||||
@ -8342,7 +7938,6 @@ procedure TWinControl.RealizeBounds;
|
||||
end;
|
||||
RaiseGDBException('');
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
var
|
||||
NewBounds: TRect;
|
||||
@ -8352,9 +7947,6 @@ begin
|
||||
and ([csLoading,csDestroying]*ComponentState=[])
|
||||
and (not (csDestroyingHandle in ControlState))
|
||||
and (not CompareRect(@NewBounds,@FBoundsRealized))
|
||||
{$IFDEF OldAutoSize}
|
||||
and (not IsAParentAligning)
|
||||
{$ENDIF}
|
||||
then begin
|
||||
// the new bounds were not yet sent to the InterfaceObject -> send them
|
||||
{$IFDEF CHECK_POSITION}
|
||||
@ -8383,9 +7975,7 @@ begin
|
||||
if (CompareRect(@NewBounds,@FBoundsRealized)) then debugln('bounds not changed');
|
||||
end;
|
||||
{$ENDIF}
|
||||
{$IFNDEF OldAutoSize}
|
||||
if not HandleAllocated then Check;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -462,9 +462,7 @@ procedure TCarbonWidget.UpdateLCLClientRect;
|
||||
var
|
||||
R: TRect;
|
||||
begin
|
||||
if not Resizing
|
||||
{$IFDEF OldAutoSize} and not (csAlignmentNeeded in LCLObject.ControlState){$ENDIF}
|
||||
then begin
|
||||
if not Resizing then begin
|
||||
GetBounds(R);
|
||||
LCLObject.InvalidateClientRectCache(False);
|
||||
LCLSendSizeMsg(LCLObject, R.Right - R.Left, R.Bottom - R.Top, Size_SourceIsInterface);
|
||||
|
@ -2016,21 +2016,7 @@ begin
|
||||
SaveSizeNotification(Widget);
|
||||
end;
|
||||
{$ELSE}
|
||||
{$IFDEF OldAutoSize}
|
||||
if GTK_WIDGET_REALIZED(Widget) then begin
|
||||
{ The gtk sends the size messages after the resizing. Therefore the parent
|
||||
widget is already resized, but the parent resize message will be emitted
|
||||
after all its childs. So, the gtk resizes in top-bottom order, just like the
|
||||
LCL. But it sends size messages in bottom-top order, which can result in
|
||||
many resizes in the LCL.
|
||||
}
|
||||
// The resize messages of the inner widget of a Control is cached.
|
||||
// This is the resize of an outer widget and sent to the LCL immediately.
|
||||
SendSizeNotificationToLCL(Widget);
|
||||
end;
|
||||
{$ELSE}
|
||||
SendSizeNotificationToLCL(Widget);
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
@ -2588,11 +2574,7 @@ begin
|
||||
|
||||
if (AWidgetInfo^.LCLObject is TScrollingWinControl) then
|
||||
begin
|
||||
{$ifdef OldAutoSize}
|
||||
MaxValue := ARange^.adjustment^.upper - ARange^.adjustment^.page_size;
|
||||
{$else}
|
||||
MaxValue := ARange^.adjustment^.upper;
|
||||
{$endif}
|
||||
if (AValue > MaxValue) or (AValue < ARange^.adjustment^.lower) then
|
||||
begin
|
||||
Result := not Result;
|
||||
|
@ -6633,10 +6633,8 @@ var
|
||||
GtkLeft, GtkTop, GtkWidth, GtkHeight: integer;
|
||||
TopLeftChanged, WidthHeightChanged, IsTopLevelWidget: boolean;
|
||||
MessageDelivered: boolean;
|
||||
{ $IFDEF OldAutoSize}
|
||||
SizeMsg: TLMSize;
|
||||
MoveMsg: TLMMove;
|
||||
{ $ENDIF}
|
||||
PosMsg : TLMWindowPosChanged;
|
||||
MainWidget: PGtkWidget;
|
||||
FixedWidget: PGtkWidget;
|
||||
@ -6672,7 +6670,7 @@ begin
|
||||
FWidgetsResized.Remove(MainWidget);
|
||||
FFixWidgetsResized.Remove(FixedWidget);
|
||||
|
||||
{$IF defined(Gtk1) or defined(OldAutoSize)}
|
||||
{$IF defined(Gtk1)}
|
||||
if not GTK_WIDGET_REALIZED(aWidget) then begin
|
||||
// the widget is not yet realized, so this GTK resize was not a user change.
|
||||
// => ignore
|
||||
@ -6747,9 +6745,7 @@ begin
|
||||
cx := GtkWidth;
|
||||
cy := GtkHeight;
|
||||
flags:=0;
|
||||
{$IFNDEF OldAutoSize}
|
||||
// flags := SWP_SourceIsInterface;
|
||||
{$ENDIF}
|
||||
// flags := SWP_SourceIsInterface;
|
||||
end;
|
||||
MessageDelivered := DeliverMessage(LCLControl, PosMsg) = 0;
|
||||
finally
|
||||
@ -6761,7 +6757,6 @@ begin
|
||||
UpdateLCLSize;
|
||||
end;
|
||||
|
||||
{ $IFDEF OldAutoSize}
|
||||
// then send a LM_SIZE message
|
||||
if WidthHeightChanged then begin
|
||||
{$IFDEF VerboseSizeMsg}
|
||||
@ -6815,7 +6810,6 @@ begin
|
||||
MessageDelivered := (DeliverMessage(LCLControl, MoveMsg) = 0);
|
||||
if not MessageDelivered then exit;
|
||||
end;
|
||||
{ $ENDIF}
|
||||
|
||||
{$ifndef gtk1}
|
||||
if GtkWidgetIsA(aWidget, GTKAPIWidget_Type) and
|
||||
|
@ -410,9 +410,6 @@ var
|
||||
MenuWidget: PGtkWidget; // the popup menu (hbox containing a pixmap and
|
||||
// a label)
|
||||
MenuLabelWidget: PGtkWidget; // the label in the popup menu item
|
||||
{$IFDEF OldAutoSize}
|
||||
allocation: TGtkAllocation;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF NOTEBOOK_DEBUG}
|
||||
DebugLn(['TGtkWSCustomNotebook.AddPage ',dbgsName(ANoteBook),' ',ANotebook.HandleAllocated,' AChild=',dbgsName(AChild),' ',AChild.HandleAllocated,' Child.TabVisible=',AChild.TabVisible]);
|
||||
@ -472,16 +469,9 @@ begin
|
||||
|
||||
// init the size of the page widget
|
||||
//DebugLn(['TGtkWSCustomNotebook.AddPage ',DbgSName(ANoteBook),' ',dbgs(ANoteBook.BoundsRect)]);
|
||||
{$IFDEF OldAutoSize}
|
||||
allocation.x := ANoteBook.Left;
|
||||
allocation.y := ANoteBook.Top;
|
||||
allocation.width := ANoteBook.Width;
|
||||
allocation.height := ANoteBook.Height;
|
||||
gtk_widget_size_allocate(NotebookWidget, @allocation);// Beware: this triggers callbacks
|
||||
{$IFDEF VerboseSizeMsg}
|
||||
DebugLn(['TGtkWSCustomNotebook.AddPage PageWidget^.allocation=',dbgs(PageWidget^.allocation),' NotebookWidget=',dbgs(NotebookWidget^.allocation)]);
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
class procedure TGtkWSCustomNotebook.MovePage(const ANotebook: TCustomNotebook;
|
||||
|
@ -1503,11 +1503,7 @@ begin
|
||||
gtk_frame_set_shadow_type(PGtkFrame(Result), StaticBorderShadowMap[AStaticText.BorderStyle]);
|
||||
|
||||
EventBox := gtk_event_box_new; // our area
|
||||
{$IFDEF OldAutoSize}
|
||||
LblWidget := gtk_label_new(nil); // our text widget
|
||||
{$ELSE}
|
||||
LblWidget := gtk_label_new(PChar(TCustomStaticText(AWinControl).Caption)); // our text widget
|
||||
{$ENDIF}
|
||||
gtk_container_add(PGtkContainer(EventBox), LblWidget);
|
||||
SetLabelAlignment(PGtkLabel(LblWidget), AStaticText.Alignment);
|
||||
gtk_widget_show(LblWidget);
|
||||
|
Loading…
Reference in New Issue
Block a user