From 47c24e80adeb6dd3055b603f80a2b2d69b7c44d6 Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 27 Mar 2012 16:27:45 +0000 Subject: [PATCH] LCL: more verbose form updateshowing git-svn-id: trunk@36385 - --- lcl/controls.pp | 2 ++ lcl/include/control.inc | 20 ++++++++++++++++++++ lcl/include/customform.inc | 14 +++++++------- lcl/include/wincontrol.inc | 23 ++++++++++++++++++----- 4 files changed, 47 insertions(+), 12 deletions(-) diff --git a/lcl/controls.pp b/lcl/controls.pp index 31c3c6683b..21795d0adf 100644 --- a/lcl/controls.pp +++ b/lcl/controls.pp @@ -1434,6 +1434,7 @@ type procedure AdjustSize; virtual;// smart calling DoAutoSize function AutoSizePhases: TControlAutoSizePhases; virtual; function AutoSizeDelayed: boolean; virtual; + function AutoSizeDelayedReport: string; virtual; function AutoSizeDelayedHandle: Boolean; virtual; procedure AnchorToNeighbour(Side: TAnchorKind; Space: integer; Sibling: TControl); @@ -2099,6 +2100,7 @@ type // size, position, bounds function AutoSizePhases: TControlAutoSizePhases; override; function AutoSizeDelayed: boolean; override; + function AutoSizeDelayedReport: string; override; function AutoSizeDelayedHandle: Boolean; override; procedure BeginUpdateBounds; // disable SetBounds procedure EndUpdateBounds; // enable SetBounds diff --git a/lcl/include/control.inc b/lcl/include/control.inc index 874ffc96ce..6f9e76c511 100644 --- a/lcl/include/control.inc +++ b/lcl/include/control.inc @@ -2983,6 +2983,26 @@ begin {$ENDIF} end; +function TControl.AutoSizeDelayedReport: string; +begin + if (FAutoSizingLockCount>0) then + Result:='FAutoSizingLockCount='+dbgs(FAutoSizingLockCount) + else if csLoading in ComponentState then + Result:='csLoading' + else if csDestroying in ComponentState then + Result:='csDestroying' + else if cfLoading in FControlFlags then + Result:='cfLoading' + else if IsControlVisible then + Result:='not IsControlVisible' + else if AutoSizeDelayedHandle then + Result:='AutoSizeDelayedHandle' + else if Parent<>nil then + Result:=Parent.AutoSizeDelayedReport + else + Result:='?'; +end; + {------------------------------------------------------------------------------ TControl AutoSizeDelayedHandle diff --git a/lcl/include/customform.inc b/lcl/include/customform.inc index a6f398cb2a..22e3715038 100644 --- a/lcl/include/customform.inc +++ b/lcl/include/customform.inc @@ -2610,10 +2610,10 @@ end; procedure TCustomForm.UpdateShowing; begin if csLoading in ComponentState then exit; - {$IFDEF CHECK_POSITION} - DebugLn('[TCustomForm.UpdateShowing] A ',DbgSName(Self),' Pos=',DbgS(Left),',',DbgS(Top),' Visible=',DbgS(Visible)); + {$IF defined(CHECK_POSITION) or defined(VerboseFormUpdateShowing) or defined(VerboseShowing)} + DebugLn(['[TCustomForm.UpdateShowing] STAR ',DbgSName(Self),' Pos=',Left,',',Top,' Visible=',Visible,' Showing=',Showing]); {$ENDIF} - { If the the form is about to show, calculate its metrics } + // If the the form is about to show, calculate its metrics if Visible and (not (csDestroying in ComponentState)) then begin if not (csDesigning in ComponentState) then @@ -2624,12 +2624,12 @@ begin DoFirstShow; end; end; - {$IFDEF CHECK_POSITION} - DebugLn('[TCustomForm.UpdateShowing] B ',Name,':',Classname,' Pos=',DbgS(Left),',',DbgS(Top)); + {$IF defined(CHECK_POSITION) or defined(VerboseFormUpdateShowing) or defined(VerboseShowing)} + DebugLn(['[TCustomForm.UpdateShowing] calling inherited ',dbgsname(Self),' Pos=',Left,',',Top]); {$ENDIF} inherited UpdateShowing; - {$IFDEF CHECK_POSITION} - DebugLn('[TCustomForm.UpdateShowing] END ',Name,':',Classname,' Pos=',DbgS(Left),',',DbgS(Top)); + {$IF defined(CHECK_POSITION) or defined(VerboseFormUpdateShowing) or defined(VerboseShowing)} + DebugLn(['[TCustomForm.UpdateShowing] activating ',dbgsname(Self),' Pos=',Left,',',Top]); {$ENDIF} // activate focus if visible if Showing and (not (csDestroying in ComponentState)) then diff --git a/lcl/include/wincontrol.inc b/lcl/include/wincontrol.inc index e593ca0972..8603b2ef11 100644 --- a/lcl/include/wincontrol.inc +++ b/lcl/include/wincontrol.inc @@ -2387,6 +2387,14 @@ begin {$ENDIF} end; +function TWinControl.AutoSizeDelayedReport: string; +begin + if csDestroyingHandle in ControlState then + Result:='csDestroyingHandle' + else + Result:=inherited AutoSizeDelayedReport; +end; + {------------------------------------------------------------------------------ TWinControl AutoSizeDelayedHandle @@ -3308,7 +3316,7 @@ begin {$ENDIF} if not (caspComputingBounds in AutoSizePhases) then begin {$IFDEF VerboseAllAutoSize} - DebugLn(['TWinControl.DoAutoSize DELAYED AutoSizePhase=',AutoSizePhaseNames[AutoSizePhase]]); + DebugLn(['TWinControl.DoAutoSize DELAYED AutoSizePhases=',dbgs(AutoSizePhases)]); {$ENDIF} AdjustSize; exit; @@ -3505,7 +3513,7 @@ begin inc(UpdateShowingCounter); // make child handles visible {$IFDEF VerboseAllAutoSize} - DebugLn(['TWinControl.DoAllAutoSize UPDATESHOWING ',DbgSName(Self),' lclbounds=',dbgs(BoundsRect)]); + DebugLn(['TWinControl.DoAllAutoSize UPDATESHOWING children ',DbgSName(Self),' lclbounds=',dbgs(BoundsRect)]); {$ENDIF} Include(FWinControlFlags,wcfUpdateShowing); try @@ -3525,14 +3533,19 @@ begin // make handle visible => this can trigger events like Form.OnShow where // application does arbitrary stuff {$IFDEF VerboseAllAutoSize} - DebugLn(['TWinControl.DoAllAutoSize UPDATESHOWING ',DbgSName(Self),' lclbounds=',dbgs(BoundsRect)]); + DebugLn(['TWinControl.DoAllAutoSize UPDATESHOWING self ',DbgSName(Self),' lclbounds=',dbgs(BoundsRect)]); {$ENDIF} if not (wcfUpdateShowing in FWinControlFlags) then begin Include(FWinControlFlags, wcfUpdateShowing); try if HandleObjectShouldBeVisible and not Showing then - UpdateShowing; + UpdateShowing + else begin + {$IFDEF VerboseAllAutoSize} + DebugLn(['TWinControl.DoAllAutoSize not UPDATESHOWING self ',DbgSName(Self),' because HandleObjectShouldBeVisible=',HandleObjectShouldBeVisible,' Showing=',Showing]); + {$ENDIF} + end; finally Exclude(FWinControlFlags, wcfUpdateShowing); end; @@ -4310,7 +4323,7 @@ begin if AutoSizeDelayed or (not (caspShowing in AutoSizePhases)) then begin {$IFDEF VerboseShowing} - if AutoSizeDelayed then DebugLn(['TWinControl.UpdateShowing ',DbgSName(Self),' SKIPPING because AutoSizeDelayed']); + if AutoSizeDelayed then DebugLn(['TWinControl.UpdateShowing ',DbgSName(Self),' SKIPPING because AutoSizeDelayed: ',AutoSizeDelayedReport]); if (not (caspShowing in AutoSizePhases)) then DebugLn(['TWinControl.UpdateShowing ',DbgSName(Self),' SKIPPING because wrong phase']); {$ENDIF} exit;