From 84998105248cef2cb5576fc40cc9328ac496fabe Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 25 Jun 2003 21:02:20 +0000 Subject: [PATCH] reduced TProgressBar setproperties calls git-svn-id: trunk@4319 - --- lcl/comctrls.pp | 4 ++ lcl/include/progressbar.inc | 134 ++++++++++++++++++------------------ 2 files changed, 71 insertions(+), 67 deletions(-) diff --git a/lcl/comctrls.pp b/lcl/comctrls.pp index 38b012ee24..26eddca1d6 100644 --- a/lcl/comctrls.pp +++ b/lcl/comctrls.pp @@ -457,6 +457,7 @@ type protected procedure ApplyChanges; procedure InitializeWnd; override; + procedure Loaded; override; { procedure SetBarTextFormat; } public constructor Create(AOwner: TComponent); override; @@ -1800,6 +1801,9 @@ end. { ============================================================================= $Log$ + Revision 1.80 2003/06/25 21:02:19 mattias + reduced TProgressBar setproperties calls + Revision 1.79 2003/06/19 16:36:35 mattias started codeexplorer diff --git a/lcl/include/progressbar.inc b/lcl/include/progressbar.inc index 950a22a1c5..3e92ed560d 100644 --- a/lcl/include/progressbar.inc +++ b/lcl/include/progressbar.inc @@ -1,3 +1,4 @@ +// included by comctrls.pp {****************************************************************************** TProgressBar ****************************************************************************** @@ -41,16 +42,17 @@ ------------------------------------------------------------------------------} constructor TProgressBar.Create (AOwner : TComponent); begin - inherited Create (AOwner); - fCompStyle := csProgressBar; - FPosition := 0; - FStep := 10; - FMin := 0; - FMax := 100; - FSmooth := false; - FOrientation := pbHorizontal; - FBarShowText := false; - FBarTextFormat := '%v from [%l-%u] (=%p%%)'; + inherited Create (AOwner); + fCompStyle := csProgressBar; + FPosition := 0; + FStep := 10; + FMin := 0; + FMax := 100; + FSmooth := false; + FOrientation := pbHorizontal; + FBarShowText := false; + FBarTextFormat := '%v from [%l-%u] (=%p%%)'; + SetInitialBounds(0,0,100,20); end; {------------------------------------------------------------------------------ @@ -63,8 +65,14 @@ end; ------------------------------------------------------------------------------} procedure TProgressBar.InitializeWnd; begin - inherited InitializeWnd; - ApplyChanges; + inherited InitializeWnd; + ApplyChanges; +end; + +procedure TProgressBar.Loaded; +begin + inherited Loaded; + ApplyChanges; end; {------------------------------------------------------------------------------ @@ -76,10 +84,9 @@ end; ------------------------------------------------------------------------------} function TProgressBar.GetMin: Integer; begin - result := FMin; + Result := FMin; end; - {------------------------------------------------------------------------------ Method: TProgressBar.GetMax Params: Nothing @@ -89,10 +96,9 @@ end; ------------------------------------------------------------------------------} function TProgressBar.GetMax: Integer; begin - result := FMax; + Result := FMax; end; - {------------------------------------------------------------------------------ Method: TProgressBar.GetPosition Params: Nothing @@ -102,10 +108,9 @@ end; ------------------------------------------------------------------------------} function TProgressBar.GetPosition: Integer; begin - result := FPosition; + Result := FPosition; end; - {------------------------------------------------------------------------------ Method: TProgressBar.SetParams Params: Min & Max for the progressbar @@ -115,8 +120,8 @@ end; ------------------------------------------------------------------------------} procedure TProgressBar.SetParams(AMin, AMax: Integer); begin - SetMax (AMax); - SetMin (AMin); + SetMax (AMax); + SetMin (AMin); end; @@ -129,11 +134,11 @@ end; ------------------------------------------------------------------------------} procedure TProgressBar.SetMin(Value: Integer); begin - if FMin <> Value then - begin - FMin := Value; - ApplyChanges; - end; + if FMin <> Value then + begin + FMin := Value; + ApplyChanges; + end; end; @@ -146,14 +151,13 @@ end; ------------------------------------------------------------------------------} procedure TProgressBar.SetMax(Value: Integer); begin - if FMax <> Value then - begin - FMax := Value; - ApplyChanges; - end; + if FMax <> Value then + begin + FMax := Value; + ApplyChanges; + end; end; - {------------------------------------------------------------------------------ Method: TProgressBar.SetPosition Params: New acutal position for the progressbar @@ -163,11 +167,11 @@ end; ------------------------------------------------------------------------------} procedure TProgressBar.SetPosition(Value: Integer); begin - if FPosition <> Value then - begin - FPosition := Value; - ApplyChanges; - end; + if FPosition <> Value then + begin + FPosition := Value; + ApplyChanges; + end; end; @@ -180,11 +184,11 @@ end; ------------------------------------------------------------------------------} procedure TProgressBar.SetStep(Value: Integer); begin - if FStep <> Value then - begin - FStep := Value; - ApplyChanges; - end; + if FStep <> Value then + begin + FStep := Value; + ApplyChanges; + end; end; {------------------------------------------------------------------------------ @@ -196,11 +200,11 @@ end; ------------------------------------------------------------------------------} procedure TProgressBar.SetOrientation (Value : TProgressBarOrientation); begin - if FOrientation <> Value then - begin - Forientation := Value; - ApplyChanges; - end; + if FOrientation <> Value then + begin + Forientation := Value; + ApplyChanges; + end; end; {------------------------------------------------------------------------------ @@ -215,7 +219,7 @@ begin inc (FPosition, FStep); if FPosition > FMax then FPosition := FMax; if FPosition < FMin then FPosition := FMin; - CNSendMessage (LM_SetValue, Self, @FPosition); + CNSendMessage(LM_SetValue, Self, @FPosition); end; @@ -237,7 +241,6 @@ begin StepIt; end; - {------------------------------------------------------------------------------ Method: TProgressBar.ApplyChanges Params: Nothing @@ -247,8 +250,8 @@ end; ------------------------------------------------------------------------------} procedure TProgressBar.ApplyChanges; begin - if HandleAllocated - then CNSendMessage (LM_SETPROPERTIES, Self, nil); + if HandleAllocated and (not (csLoading in ComponentState)) then + CNSendMessage(LM_SETPROPERTIES, Self, nil); end; @@ -261,11 +264,11 @@ end; ------------------------------------------------------------------------------} procedure TProgressBar.SetSmooth (Value : boolean); begin - if FSmooth <> value then - begin - FSmooth := value; - ApplyChanges; - end; + if FSmooth <> value then + begin + FSmooth := value; + ApplyChanges; + end; end; @@ -282,23 +285,20 @@ end; ------------------------------------------------------------------------------} procedure TProgressBar.SetBarShowText (Value : boolean); begin - if FBarShowText <> Value then - begin - FBarShowText := Value; - ApplyChanges; - end; + if FBarShowText <> Value then + begin + FBarShowText := Value; + ApplyChanges; + end; end; -{ -procedure TProgressBar.SetBarTextFormat (value : string); -begin - FBarTextFormat := Value; - ApplyChanges; -end; -} +// included by comctrls.pp { $Log$ + Revision 1.4 2003/06/25 21:02:20 mattias + reduced TProgressBar setproperties calls + Revision 1.3 2002/05/10 06:05:55 lazarus MG: changed license to LGPL