Browse Source

FlashProgressBar added ShowYLine in Graph Style; Renamed some properties; Updated Demo

FlashProgressBar added ShowYLine in Graph Style;
Renamed some properties;
Updated Demo
Massimo Magnano 11 months ago
parent
commit
d7f7ee62ae
4 changed files with 1074 additions and 574 deletions
  1. 1 1
      README.md
  2. 169 80
      bgraflashprogressbar.pas
  3. 761 429
      test/test_progressbar/umain.lfm
  4. 143 64
      test/test_progressbar/umain.pas

+ 1 - 1
README.md

@@ -114,7 +114,7 @@ Author: Circular.
 
 
 ### TBGRAFlashProgressBar
 ### TBGRAFlashProgressBar
 
 
-A progress bar inspired in the old Flash Player Setup for Windows progress dialog. You can change Colors and Style to Normal, MultiProgress (SubTotal and Total), Marquee (with or without Bounce effect), pbstTimer (Countdown), pbstGraph (as the details of Copy File). Also you can use the event OnRedraw to paint custom styles on it like text or override the entire default drawing.
+A progress bar inspired in the old Flash Player Setup for Windows progress dialog. You can change Colors and Style to Normal, MultiProgress (SubTotal and Total), Marquee (with or without Bounce effect), Timer (Countdown), Graph (as the details of Copy File). Also you can use the event OnRedraw to paint custom styles on it like text or override the entire default drawing.
 
 
 Author: Circular, Massimo Magnano.
 Author: Circular, Massimo Magnano.
 
 

+ 169 - 80
bgraflashprogressbar.pas

@@ -52,6 +52,10 @@ type
 
 
   TBGRAFlashProgressBar = class(TBGRAGraphicCtrl)
   TBGRAFlashProgressBar = class(TBGRAGraphicCtrl)
   private
   private
+    FGraphShowYLine: Boolean;
+    FGraphYLineAfter: String;
+    FGraphYLineCaption: String;
+    FGraphYLineDigits: Integer;
     procedure SetBackgroundRandomize(AValue: boolean);
     procedure SetBackgroundRandomize(AValue: boolean);
     procedure SetBackgroundRandomizeMaxIntensity(AValue: word);
     procedure SetBackgroundRandomizeMaxIntensity(AValue: word);
     procedure SetBackgroundRandomizeMinIntensity(AValue: word);
     procedure SetBackgroundRandomizeMinIntensity(AValue: word);
@@ -61,9 +65,13 @@ type
     procedure SetCaptionPercentDigits(AValue: Integer);
     procedure SetCaptionPercentDigits(AValue: Integer);
     procedure SetCaptionPercentTimerFormat(AValue: String);
     procedure SetCaptionPercentTimerFormat(AValue: String);
     procedure SetCaptionShowPercent(AValue: Boolean);
     procedure SetCaptionShowPercent(AValue: Boolean);
-    procedure SetCaptionShowPercentAlign(AValue: TAlignment);
-    procedure SetCaptionShowPercentAlignSub(AValue: TAlignment);
+    procedure SetCaptionPercentAlign(AValue: TAlignment);
+    procedure SetCaptionPercentSubAlign(AValue: TAlignment);
     procedure SetCaptionShowPercentSub(AValue: Boolean);
     procedure SetCaptionShowPercentSub(AValue: Boolean);
+    procedure SetGraphShowYLine(AValue: Boolean);
+    procedure SetGraphYLineAfter(AValue: String);
+    procedure SetGraphYLineCaption(AValue: String);
+    procedure SetGraphYLineDigits(AValue: Integer);
     procedure SetShowDividers(AValue: Boolean);
     procedure SetShowDividers(AValue: Boolean);
     procedure SetMarqueeBounce(AValue: Word);
     procedure SetMarqueeBounce(AValue: Word);
     procedure SetMarqueeDirection(AValue: TBGRAPBarMarqueeDirection);
     procedure SetMarqueeDirection(AValue: TBGRAPBarMarqueeDirection);
@@ -74,7 +82,7 @@ type
     procedure SetMinValue(AValue: Double);
     procedure SetMinValue(AValue: Double);
     procedure SetMinYValue(AValue: Double);
     procedure SetMinYValue(AValue: Double);
     procedure SetRandSeed(AValue: integer);
     procedure SetRandSeed(AValue: integer);
-    procedure SetShowYDividers(AValue: Boolean);
+    procedure SetGraphShowYDividers(AValue: Boolean);
     procedure SetStyle(AValue: TBGRAPBarStyle);
     procedure SetStyle(AValue: TBGRAPBarStyle);
     procedure SetTimerInterval(AValue: Cardinal);
     procedure SetTimerInterval(AValue: Cardinal);
     procedure SetValueSub(AValue: Double);
     procedure SetValueSub(AValue: Double);
@@ -84,8 +92,8 @@ type
     FCaptionPercentDigits: Integer;
     FCaptionPercentDigits: Integer;
     FCaptionPercentTimerFormat: String;
     FCaptionPercentTimerFormat: String;
     FCaptionShowPercent: Boolean;
     FCaptionShowPercent: Boolean;
-    FCaptionShowPercentAlign: TAlignment;
-    FCaptionShowPercentAlignSub: TAlignment;
+    FCaptionPercentAlign: TAlignment;
+    FCaptionPercentSubAlign: TAlignment;
     FCaptionShowPercentSub: Boolean;
     FCaptionShowPercentSub: Boolean;
     FMarqueeBounce: Word;
     FMarqueeBounce: Word;
     FOnRedraw: TBGRAProgressBarRedrawEvent;
     FOnRedraw: TBGRAProgressBarRedrawEvent;
@@ -94,7 +102,7 @@ type
     FBackgroundRandomizeMaxIntensity: word;
     FBackgroundRandomizeMaxIntensity: word;
     FBackgroundRandomizeMinIntensity: word;
     FBackgroundRandomizeMinIntensity: word;
     FShowDividers,
     FShowDividers,
-    FShowYDividers: Boolean;
+    FGraphShowYDividers: Boolean;
     FBarColor,
     FBarColor,
     FBarColorSub: TColor;
     FBarColorSub: TColor;
     FMarqueeDirection: TBGRAPBarMarqueeDirection;
     FMarqueeDirection: TBGRAPBarMarqueeDirection;
@@ -124,8 +132,8 @@ type
     marqueeWall,
     marqueeWall,
     marqueeBouncing: Boolean;
     marqueeBouncing: Boolean;
     marqueeCurMode: TBGRAPBarMarqueeDirection;
     marqueeCurMode: TBGRAPBarMarqueeDirection;
-    AGraphValues: TGraphValues;  //array of Real Graph Values
-    AGraphPoints: array of TPointF; //array of Calculated xpos and ypos
+    GraphValues: TGraphValues;  //array of Real Graph Values
+    GraphPoints: array of TPointF; //array of Calculated xpos and ypos
 
 
     procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: boolean); override;
     procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: boolean); override;
     procedure DoOnResize; override;
     procedure DoOnResize; override;
@@ -172,9 +180,9 @@ type
     property Anchors;
     property Anchors;
     property Caption;
     property Caption;
     property CaptionShowPercent: Boolean read FCaptionShowPercent write SetCaptionShowPercent default False;
     property CaptionShowPercent: Boolean read FCaptionShowPercent write SetCaptionShowPercent default False;
-    property CaptionShowPercentAlign: TAlignment read FCaptionShowPercentAlign write SetCaptionShowPercentAlign default taCenter;
+    property CaptionPercentAlign: TAlignment read FCaptionPercentAlign write SetCaptionPercentAlign default taCenter;
     property CaptionShowPercentSub: Boolean read FCaptionShowPercentSub write SetCaptionShowPercentSub default False;
     property CaptionShowPercentSub: Boolean read FCaptionShowPercentSub write SetCaptionShowPercentSub default False;
-    property CaptionShowPercentAlignSub: TAlignment read FCaptionShowPercentAlignSub write SetCaptionShowPercentAlignSub default taLeftJustify;
+    property CaptionPercentSubAlign: TAlignment read FCaptionPercentSubAlign write SetCaptionPercentSubAlign default taLeftJustify;
     property CaptionPercentDigits: Integer read FCaptionPercentDigits write SetCaptionPercentDigits default 0;
     property CaptionPercentDigits: Integer read FCaptionPercentDigits write SetCaptionPercentDigits default 0;
     property CaptionPercentTimerFormat: String read FCaptionPercentTimerFormat write SetCaptionPercentTimerFormat;
     property CaptionPercentTimerFormat: String read FCaptionPercentTimerFormat write SetCaptionPercentTimerFormat;
     property Font;
     property Font;
@@ -194,7 +202,6 @@ type
     property BackgroundRandomizeMaxIntensity: Word read FBackgroundRandomizeMaxIntensity write SetBackgroundRandomizeMaxIntensity;
     property BackgroundRandomizeMaxIntensity: Word read FBackgroundRandomizeMaxIntensity write SetBackgroundRandomizeMaxIntensity;
     property BackgroundRandomize: Boolean read FBackgroundRandomize write SetBackgroundRandomize;
     property BackgroundRandomize: Boolean read FBackgroundRandomize write SetBackgroundRandomize;
     property ShowDividers: Boolean read FShowDividers write SetShowDividers default False;
     property ShowDividers: Boolean read FShowDividers write SetShowDividers default False;
-    property ShowYDividers: Boolean read FShowYDividers write SetShowYDividers default False;
     property Style: TBGRAPBarStyle read FStyle write SetStyle default pbstNormal;
     property Style: TBGRAPBarStyle read FStyle write SetStyle default pbstNormal;
     property MarqueeWidth: Word read FMarqueeWidth write SetMarqueeWidth default 0;
     property MarqueeWidth: Word read FMarqueeWidth write SetMarqueeWidth default 0;
     property MarqueeSpeed: TBGRAPBarMarqueeSpeed read FMarqueeSpeed write SetMarqueeSpeed default pbmsMedium;
     property MarqueeSpeed: TBGRAPBarMarqueeSpeed read FMarqueeSpeed write SetMarqueeSpeed default pbmsMedium;
@@ -204,6 +211,12 @@ type
     property TimerInterval: Cardinal read FTimerInterval write SetTimerInterval default 100;
     property TimerInterval: Cardinal read FTimerInterval write SetTimerInterval default 100;
     property TimerAutoRestart: Boolean read FTimerAutoRestart write FTimerAutoRestart default True;
     property TimerAutoRestart: Boolean read FTimerAutoRestart write FTimerAutoRestart default True;
 
 
+    property GraphShowYDividers: Boolean read FGraphShowYDividers write SetGraphShowYDividers default False;
+    property GraphShowYLine: Boolean read FGraphShowYLine write SetGraphShowYLine default False;
+    property GraphYLineCaption: String read FGraphYLineCaption write SetGraphYLineCaption;
+    property GraphYLineAfter: String read FGraphYLineAfter write SetGraphYLineAfter;
+    property GraphYLineDigits: Integer read FGraphYLineDigits write SetGraphYLineDigits default 0;
+
     property OnClick;
     property OnClick;
     property OnMouseDown;
     property OnMouseDown;
     property OnMouseEnter;
     property OnMouseEnter;
@@ -316,19 +329,19 @@ begin
   Invalidate;
   Invalidate;
 end;
 end;
 
 
-procedure TBGRAFlashProgressBar.SetCaptionShowPercentAlign(AValue: TAlignment);
+procedure TBGRAFlashProgressBar.SetCaptionPercentAlign(AValue: TAlignment);
 begin
 begin
-  if FCaptionShowPercentAlign=AValue then Exit;
-  FCaptionShowPercentAlign:=AValue;
+  if FCaptionPercentAlign=AValue then Exit;
+  FCaptionPercentAlign:=AValue;
 
 
   if Assigned(FOnChange) then FOnChange(Self);
   if Assigned(FOnChange) then FOnChange(Self);
   Invalidate;
   Invalidate;
 end;
 end;
 
 
-procedure TBGRAFlashProgressBar.SetCaptionShowPercentAlignSub(AValue: TAlignment);
+procedure TBGRAFlashProgressBar.SetCaptionPercentSubAlign(AValue: TAlignment);
 begin
 begin
-  if FCaptionShowPercentAlignSub=AValue then Exit;
-  FCaptionShowPercentAlignSub:=AValue;
+  if FCaptionPercentSubAlign=AValue then Exit;
+  FCaptionPercentSubAlign:=AValue;
 
 
   if Assigned(FOnChange) then FOnChange(Self);
   if Assigned(FOnChange) then FOnChange(Self);
   Invalidate;
   Invalidate;
@@ -343,6 +356,42 @@ begin
   Invalidate;
   Invalidate;
 end;
 end;
 
 
+procedure TBGRAFlashProgressBar.SetGraphShowYLine(AValue: Boolean);
+begin
+  if FGraphShowYLine=AValue then Exit;
+  FGraphShowYLine:=AValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
+end;
+
+procedure TBGRAFlashProgressBar.SetGraphYLineAfter(AValue: String);
+begin
+  if FGraphYLineAfter=AValue then Exit;
+  FGraphYLineAfter:=AValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
+end;
+
+procedure TBGRAFlashProgressBar.SetGraphYLineCaption(AValue: String);
+begin
+  if FGraphYLineCaption=AValue then Exit;
+  FGraphYLineCaption:=AValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
+end;
+
+procedure TBGRAFlashProgressBar.SetGraphYLineDigits(AValue: Integer);
+begin
+  if FGraphYLineDigits=AValue then Exit;
+  FGraphYLineDigits:=AValue;
+
+  if Assigned(FOnChange) then FOnChange(Self);
+  Invalidate;
+end;
+
 procedure TBGRAFlashProgressBar.SetShowDividers(AValue: Boolean);
 procedure TBGRAFlashProgressBar.SetShowDividers(AValue: Boolean);
 begin
 begin
   if FShowDividers=AValue then Exit;
   if FShowDividers=AValue then Exit;
@@ -441,10 +490,10 @@ begin
   Invalidate;
   Invalidate;
 end;
 end;
 
 
-procedure TBGRAFlashProgressBar.SetShowYDividers(AValue: Boolean);
+procedure TBGRAFlashProgressBar.SetGraphShowYDividers(AValue: Boolean);
 begin
 begin
-  if FShowYDividers=AValue then Exit;
-  FShowYDividers:=AValue;
+  if FGraphShowYDividers=AValue then Exit;
+  FGraphShowYDividers:=AValue;
 
 
   if Assigned(FOnChange) then FOnChange(Self);
   if Assigned(FOnChange) then FOnChange(Self);
   Invalidate;
   Invalidate;
@@ -478,7 +527,7 @@ begin
       end;
       end;
       pbstGraph: begin
       pbstGraph: begin
         //Save space for the 2 points to close the polygon
         //Save space for the 2 points to close the polygon
-        if (Length(AGraphPoints) < 2) then SetLength(AGraphPoints, 2);
+        if (Length(GraphPoints) < 2) then SetLength(GraphPoints, 2);
       end;
       end;
     else internalTimer.Enabled:= False;
     else internalTimer.Enabled:= False;
     end;
     end;
@@ -568,7 +617,7 @@ end;
 procedure TBGRAFlashProgressBar.CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: boolean);
 procedure TBGRAFlashProgressBar.CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: boolean);
 begin
 begin
   PreferredWidth  := 380;
   PreferredWidth  := 380;
-  PreferredHeight := 33;
+  PreferredHeight := 34;
 end;
 end;
 
 
 procedure TBGRAFlashProgressBar.DoOnResize;
 procedure TBGRAFlashProgressBar.DoOnResize;
@@ -646,10 +695,11 @@ begin
   Randomize;
   Randomize;
   FRandSeed := RandSeed;
   FRandSeed := RandSeed;
   FCaptionShowPercent:= False;
   FCaptionShowPercent:= False;
-  FCaptionShowPercentAlign:= taCenter;
-  FCaptionShowPercentAlignSub:= taLeftJustify;
+  FCaptionPercentAlign:= taCenter;
+  FCaptionPercentSubAlign:= taLeftJustify;
   FCaptionPercentDigits:= 0;
   FCaptionPercentDigits:= 0;
   Caption:= '';
   Caption:= '';
+
   // Style
   // Style
   FStyle:=pbstNormal;
   FStyle:=pbstNormal;
   FBarColor := BGRA(102, 163, 226);
   FBarColor := BGRA(102, 163, 226);
@@ -659,7 +709,7 @@ begin
   FBackgroundRandomizeMinIntensity := 4000;
   FBackgroundRandomizeMinIntensity := 4000;
   FBackgroundRandomizeMaxIntensity := 5000;
   FBackgroundRandomizeMaxIntensity := 5000;
   FShowDividers:= False;
   FShowDividers:= False;
-  FShowYDividers:= False;
+  FGraphShowYDividers:= False;
 
 
   //Marquee
   //Marquee
   FMarqueeWidth:= 0; //AutoWidth
   FMarqueeWidth:= 0; //AutoWidth
@@ -679,8 +729,13 @@ begin
   //Graph
   //Graph
   FMinYValue := 0;
   FMinYValue := 0;
   FMaxYValue := 100;
   FMaxYValue := 100;
-  AGraphValues:= nil;
-  AGraphPoints:= nil;
+  GraphValues:= nil;
+  GraphPoints:= nil;
+  FGraphShowYDividers:= False;
+  FGraphShowYLine:= False;
+  FGraphYLineCaption:= '';
+  FGraphYLineAfter:= '';
+  FGraphYLineDigits:= 0;
 
 
   internalTimer:= TFPTimer.Create(nil);
   internalTimer:= TFPTimer.Create(nil);
   internalTimer.Enabled:= False;
   internalTimer.Enabled:= False;
@@ -691,8 +746,8 @@ end;
 destructor TBGRAFlashProgressBar.Destroy;
 destructor TBGRAFlashProgressBar.Destroy;
 begin
 begin
   internalTimer.Free;
   internalTimer.Free;
-  AGraphValues:= nil;
-  AGraphPoints:= nil;
+  GraphValues:= nil;
+  GraphPoints:= nil;
   FBGRA.Free;
   FBGRA.Free;
 
 
   inherited Destroy;
   inherited Destroy;
@@ -799,23 +854,22 @@ var
   procedure DrawDividers(DrawYDiv: Boolean);
   procedure DrawDividers(DrawYDiv: Boolean);
   var
   var
     lColD: TBGRAPixel;
     lColD: TBGRAPixel;
-    xpos: Single;
+    posS: Single;
     i: Integer;
     i: Integer;
 
 
   begin
   begin
     lColD:= BGRA(128, 128, 128, 128);
     lColD:= BGRA(128, 128, 128, 128);
     for i:= 1 to 9 do
     for i:= 1 to 9 do
     begin
     begin
-      xpos:= content.left+(i*10*(content.right-content.left)/100);
-      ABitmap.DrawLineAntialias(xpos, 2, xpos, content.Bottom-1, lColD, 1, True);
+      posS:= content.left+(i*10*(content.right-content.left)/100);
+      ABitmap.DrawLineAntialias(posS, 2, posS, content.Bottom-1, lColD, 1, True);
     end;
     end;
 
 
     if DrawYDiv then
     if DrawYDiv then
       for i:= 1 to 9 do
       for i:= 1 to 9 do
       begin
       begin
-        //Read as ypos, i reuse the variable
-        xpos:= content.Bottom-1-(i*10*(content.Bottom-content.Top)/100);
-        ABitmap.DrawLineAntialias(2, xpos, content.Right-1, xpos, lColD, 1, True);
+        posS:= content.Bottom-1-(i*10*(content.Bottom-content.Top)/100);
+        ABitmap.DrawLineAntialias(2, posS, content.Right-1, posS, lColD, 1, True);
       end;
       end;
   end;
   end;
 
 
@@ -823,28 +877,63 @@ var
   var
   var
     lCol,
     lCol,
     lColB: TBGRAPixel;
     lColB: TBGRAPixel;
-    xposS: Single;
+    posS: Single;
+    curIndex: Integer;
+    fx: TBGRATextEffect;
 
 
   begin
   begin
     lCol := FBarColor;
     lCol := FBarColor;
     lColB:= ApplyLightness(lCol, 37000);
     lColB:= ApplyLightness(lCol, 37000);
 
 
-    xposS:= content.left+((FValue-FMinValue)/(FMaxValue-FMinValue)*(content.right-content.left));
-    if (xposS > content.Right-1) then xposS:= content.Right-1;
+    posS:= content.left+((FValue-FMinValue)/(FMaxValue-FMinValue)*(content.right-content.left));
+    if (posS > content.Right-1) then posS:= content.Right-1;
 
 
     //Fixed Points to Close the Path
     //Fixed Points to Close the Path
-    AGraphPoints[0].x:= xposS;
-    AGraphPoints[0].y:= content.Bottom-1;
-    AGraphPoints[1].x:= content.Left;
-    AGraphPoints[1].y:= content.Bottom-1;
+    GraphPoints[0].x:= posS;
+    GraphPoints[0].y:= content.Bottom-1;
+    GraphPoints[1].x:= content.Left;
+    GraphPoints[1].y:= content.Bottom-1;
 
 
     //Draw Value Position
     //Draw Value Position
-    xpos:= Round(xposS);
+    xpos:= Round(posS);
     ABitmap.RectangleAntialias(content.left, content.Top, xpos, content.Bottom-1, lColB, 1, lColB);
     ABitmap.RectangleAntialias(content.left, content.Top, xpos, content.Bottom-1, lColB, 1, lColB);
 
 
-    if FShowDividers then DrawDividers(FShowYDividers);
+    if FShowDividers then DrawDividers(FGraphShowYDividers);
+
+    //Draw the Graph
+    if (Length(GraphPoints) > 2) then
+    begin
+      ABitmap.DrawPolygonAntialias(GraphPoints, lCol, 1, lCol);
+
+      if FGraphShowYLine then
+      begin
+        curIndex:= Length(GraphValues)-1;
+
+        //Check if we have at least one Value
+        if (curIndex >= 0) then
+        begin
+          lColB:= BGRA(0, 0, 0, 192);
+          pStr:= FGraphYLineCaption+FloatToStrF(GraphValues[curIndex].YValue, ffFixed, 15, FGraphYLineDigits)+FGraphYLineAfter;
+
+          //Get last Value Y Point and draw a horizontal line
+          curIndex:= Length(GraphPoints)-1;
+          posS:= GraphPoints[curIndex].y;
+          ABitmap.DrawLineAntialias(2, posS, tx-4, posS, lColB, 1, True);
+
+          try
+             fx:= TBGRATextEffect.Create(pStr, Font.Name, 12, True);
+
+             //Write the text above the line if possible
+             if (Round(posS-fx.TextHeight) >= 2) then posS:= posS-fx.TextHeight;
 
 
-    if (Length(AGraphPoints) > 2) then ABitmap.DrawPolygonAntialias(AGraphPoints, lCol, 1, lCol);
+             fx.Draw(ABitmap, tx-6, Round(posS), lColB, taRightJustify);
+
+          finally
+            fx.Free;
+          end;
+        end;
+      end;
+    end;
 
 
     //Draw Value Text
     //Draw Value Text
     pStr:= '';
     pStr:= '';
@@ -853,7 +942,7 @@ var
       pValue:= 100*(FValue - FMinValue)/FMaxValue;
       pValue:= 100*(FValue - FMinValue)/FMaxValue;
       if (pValue <> 0) then pStr:= FloatToStrF(pValue, ffFixed, 15, FCaptionPercentDigits)+'%'
       if (pValue <> 0) then pStr:= FloatToStrF(pValue, ffFixed, 15, FCaptionPercentDigits)+'%'
     end;
     end;
-    DrawText(Caption+pStr, FCaptionShowPercentAlign);
+    DrawText(Caption+pStr, FCaptionPercentAlign);
  end;
  end;
 
 
 begin
 begin
@@ -861,7 +950,7 @@ begin
   tx := ABitmap.Width;
   tx := ABitmap.Width;
   ty := ABitmap.Height;
   ty := ABitmap.Height;
 
 
-  ABitmap.Rectangle(0, 0, tx, ty, BGRA(255, 255, 255, 6), BackgroundColor, dmSet);
+  ABitmap.Rectangle(0, 0, tx, ty, BGRA(255, 255, 255, 6), FBackgroundColor, dmSet);
   if (tx > 2) and (ty > 2) then
   if (tx > 2) and (ty > 2) then
     ABitmap.Rectangle(1, 1, tx - 1, ty - 1, BGRA(29, 29, 29), dmSet);
     ABitmap.Rectangle(1, 1, tx - 1, ty - 1, BGRA(29, 29, 29), dmSet);
 
 
@@ -869,11 +958,11 @@ begin
   begin
   begin
     content  := Rect(2, 2, tx - 2, ty - 2);
     content  := Rect(2, 2, tx - 2, ty - 2);
     randseed := FRandSeed;
     randseed := FRandSeed;
-    if BackgroundRandomize then
+    if FBackgroundRandomize then
     for y := content.Top to content.Bottom - 1 do
     for y := content.Top to content.Bottom - 1 do
     begin
     begin
-      bgColor := BackgroundColor;
-      bgColor.Intensity := RandomRange(BackgroundRandomizeMinIntensity, BackgroundRandomizeMaxIntensity);
+      bgColor := FBackgroundColor;
+      bgColor.Intensity := RandomRange(FBackgroundRandomizeMinIntensity, FBackgroundRandomizeMaxIntensity);
       ABitmap.HorizLine(content.Left, y, content.Right - 1, bgColor, dmSet);
       ABitmap.HorizLine(content.Left, y, content.Right - 1, bgColor, dmSet);
     end;
     end;
     if tx >= 6 then
     if tx >= 6 then
@@ -905,7 +994,7 @@ begin
               pValue:= 100*(FValue - FMinValue)/FMaxValue;
               pValue:= 100*(FValue - FMinValue)/FMaxValue;
               if (pValue <> 0) then pStr:= FloatToStrF(pValue, ffFixed, 15, FCaptionPercentDigits)+'%'
               if (pValue <> 0) then pStr:= FloatToStrF(pValue, ffFixed, 15, FCaptionPercentDigits)+'%'
             end;
             end;
-            DrawText(Caption+pStr, FCaptionShowPercentAlign);
+            DrawText(Caption+pStr, FCaptionPercentAlign);
           end;
           end;
         end
         end
         else if FShowDividers then DrawDividers(False);
         else if FShowDividers then DrawDividers(False);
@@ -948,7 +1037,7 @@ begin
             pValue:= 100*(FValue - FMinValue)/FMaxValue;
             pValue:= 100*(FValue - FMinValue)/FMaxValue;
             if (pValue <> 0) then pStr:= FloatToStrF(pValue, ffFixed, 15, FCaptionPercentDigits)+'%'
             if (pValue <> 0) then pStr:= FloatToStrF(pValue, ffFixed, 15, FCaptionPercentDigits)+'%'
           end;
           end;
-          DrawText(Caption+pStr, FCaptionShowPercentAlign);
+          DrawText(Caption+pStr, FCaptionPercentAlign);
 
 
           //Draw ValueSub Text
           //Draw ValueSub Text
           pStr:= '';
           pStr:= '';
@@ -957,7 +1046,7 @@ begin
             pValue:= 100*(FValueSub - FMinValue)/FMaxValue;
             pValue:= 100*(FValueSub - FMinValue)/FMaxValue;
             if (pValue <> 0) then pStr:= FloatToStrF(pValue, ffFixed, 15, FCaptionPercentDigits)+'%'
             if (pValue <> 0) then pStr:= FloatToStrF(pValue, ffFixed, 15, FCaptionPercentDigits)+'%'
           end;
           end;
-          DrawText(pStr, FCaptionShowPercentAlignSub);
+          DrawText(pStr, FCaptionPercentSubAlign);
         end
         end
         else if FShowDividers then DrawDividers(False);
         else if FShowDividers then DrawDividers(False);
       end;
       end;
@@ -1054,7 +1143,7 @@ begin
             begin
             begin
               if (FValue <> 0) then pStr:= FormatDateTime(FCaptionPercentTimerFormat, FValue)
               if (FValue <> 0) then pStr:= FormatDateTime(FCaptionPercentTimerFormat, FValue)
             end;
             end;
-            DrawText(Caption+pStr, FCaptionShowPercentAlign);
+            DrawText(Caption+pStr, FCaptionPercentAlign);
           end;
           end;
         end
         end
         else if FShowDividers then DrawDividers(False);
         else if FShowDividers then DrawDividers(False);
@@ -1086,47 +1175,47 @@ begin
            if (AValue > FValue)
            if (AValue > FValue)
            then begin
            then begin
                   //Add a new Value in the array
                   //Add a new Value in the array
-                  curIndex:= Length(AGraphValues);
-                  SetLength(AGraphValues, curIndex+1);
-                  AGraphValues[curIndex].XValue:= AValue;
-                  AGraphValues[curIndex].YValue:= AYValue;
+                  curIndex:= Length(GraphValues);
+                  SetLength(GraphValues, curIndex+1);
+                  GraphValues[curIndex].XValue:= AValue;
+                  GraphValues[curIndex].YValue:= AYValue;
 
 
                   //Calculate new Value x/y Position and add in the array
                   //Calculate new Value x/y Position and add in the array
-                  curIndex:= Length(AGraphPoints);
-                  SetLength(AGraphPoints, curIndex+1);
-                  AGraphPoints[curIndex].x:= 2+((AValue-FMinValue) / (FMaxValue-FMinValue))*(Width-4);
-                  AGraphPoints[curIndex].y:= Height-3-((AYValue-FMinYValue) / (FMaxYValue-FMinYValue))*(Height-4);
+                  curIndex:= Length(GraphPoints);
+                  SetLength(GraphPoints, curIndex+1);
+                  GraphPoints[curIndex].x:= 2+((AValue-FMinValue) / (FMaxValue-FMinValue))*(Width-4);
+                  GraphPoints[curIndex].y:= Height-3-((AYValue-FMinYValue) / (FMaxYValue-FMinYValue))*(Height-4);
 
 
-                  if (AGraphPoints[curIndex].x > Width-4) then AGraphPoints[curIndex].x:= Width-4;
-                  if (AGraphPoints[curIndex].y < 2) then AGraphPoints[curIndex].y:= 2;
+                  if (GraphPoints[curIndex].x > Width-4) then GraphPoints[curIndex].x:= Width-4;
+                  if (GraphPoints[curIndex].y < 2) then GraphPoints[curIndex].y:= 2;
                 end
                 end
            else begin
            else begin
                   //Deletes all values from the array that are no longer visible
                   //Deletes all values from the array that are no longer visible
-                  curIndex:= Length(AGraphValues)-1;
-                  while (curIndex>=0) and (AGraphValues[curIndex].XValue > AValue) do
+                  curIndex:= Length(GraphValues)-1;
+                  while (curIndex>=0) and (GraphValues[curIndex].XValue > AValue) do
                   begin
                   begin
-                    SetLength(AGraphValues, curIndex);
-                    SetLength(AGraphPoints, curIndex+2); //there are 2 fixed points at the beginning
+                    SetLength(GraphValues, curIndex);
+                    SetLength(GraphPoints, curIndex+2); //there are 2 fixed points at the beginning
                     dec(curIndex);
                     dec(curIndex);
                   end;
                   end;
 
 
                   //If the last XValue is the same then assign the YValue else add a new Value
                   //If the last XValue is the same then assign the YValue else add a new Value
-                  if (curIndex>=0) and (AGraphValues[curIndex].XValue = AValue)
-                  then AGraphValues[curIndex].YValue:= AYValue
+                  if (curIndex>=0) and (GraphValues[curIndex].XValue = AValue)
+                  then GraphValues[curIndex].YValue:= AYValue
                   else begin
                   else begin
-                         curIndex:= Length(AGraphValues);
-                         SetLength(AGraphValues, curIndex+1);
-                         AGraphValues[curIndex].XValue:= AValue;
-                         AGraphValues[curIndex].YValue:= AYValue;
-                         SetLength(AGraphPoints, Length(AGraphPoints)+1);
+                         curIndex:= Length(GraphValues);
+                         SetLength(GraphValues, curIndex+1);
+                         GraphValues[curIndex].XValue:= AValue;
+                         GraphValues[curIndex].YValue:= AYValue;
+                         SetLength(GraphPoints, Length(GraphPoints)+1);
                        end;
                        end;
 
 
-                  curIndex:= Length(AGraphPoints)-1;
-                  AGraphPoints[curIndex].x:= 2+((AValue-FMinValue) / (FMaxValue-FMinValue))*(Width-4);
-                  AGraphPoints[curIndex].y:= Height-3-((AYValue-FMinYValue) / (FMaxYValue-FMinYValue))*(Height-4);
+                  curIndex:= Length(GraphPoints)-1;
+                  GraphPoints[curIndex].x:= 2+((AValue-FMinValue) / (FMaxValue-FMinValue))*(Width-4);
+                  GraphPoints[curIndex].y:= Height-3-((AYValue-FMinYValue) / (FMaxYValue-FMinYValue))*(Height-4);
 
 
-                  if (AGraphPoints[curIndex].x > Width-4) then AGraphPoints[curIndex].x:= Width-4;
-                  if (AGraphPoints[curIndex].y < 2) then AGraphPoints[curIndex].y:= 2;
+                  if (GraphPoints[curIndex].x > Width-4) then GraphPoints[curIndex].x:= Width-4;
+                  if (GraphPoints[curIndex].y < 2) then GraphPoints[curIndex].y:= 2;
                 end;
                 end;
 
 
            FValue:= AValue;
            FValue:= AValue;

File diff suppressed because it is too large
+ 761 - 429
test/test_progressbar/umain.lfm


+ 143 - 64
test/test_progressbar/umain.pas

@@ -13,42 +13,65 @@ type
   { TForm1 }
   { TForm1 }
 
 
   TForm1 = class(TForm)
   TForm1 = class(TForm)
+    btBackgroundColor: TColorSpeedButton;
     btBarColorM: TColorSpeedButton;
     btBarColorM: TColorSpeedButton;
+    btGraphAddValue: TBGRASpeedButton;
     btGraphTest: TBGRASpeedButton;
     btGraphTest: TBGRASpeedButton;
-    btStyleMultiP: TBGRASpeedButton;
-    btStyleNormal: TBGRASpeedButton;
-    btStyleTimer: TBGRASpeedButton;
-    btStyleTimer1: TBGRASpeedButton;
+    btTimerPlayPause: TBGRASpeedButton;
     btTimerPlayPause1: TBGRASpeedButton;
     btTimerPlayPause1: TBGRASpeedButton;
     btTimerPlayPause2: TBGRASpeedButton;
     btTimerPlayPause2: TBGRASpeedButton;
     btTimerStart: TBGRASpeedButton;
     btTimerStart: TBGRASpeedButton;
-    btTimerPlayPause: TBGRASpeedButton;
-    btGraphAddValue: TBGRASpeedButton;
+    cbCaptionPercent: TCheckBox;
+    cbBackgroundRandom: TCheckBox;
     cbCaptionPercent1: TCheckBox;
     cbCaptionPercent1: TCheckBox;
     cbCaptionPercentM: TCheckBox;
     cbCaptionPercentM: TCheckBox;
     cbMarqueeWidth: TCheckBox;
     cbMarqueeWidth: TCheckBox;
-    cbCaptionPercent: TCheckBox;
-    cbBackgroundRandom: TCheckBox;
+    cbShowDividers: TCheckBox;
     cbShowDividersY: TCheckBox;
     cbShowDividersY: TCheckBox;
+    cbShowYLine: TCheckBox;
     cbTimerAutoStart: TCheckBox;
     cbTimerAutoStart: TCheckBox;
     cbTimerAutoStart1: TCheckBox;
     cbTimerAutoStart1: TCheckBox;
-    cbShowDividers: TCheckBox;
+    cbRandG: TCheckBox;
     ColorDialog1: TColorDialog;
     ColorDialog1: TColorDialog;
     btBarColor: TColorSpeedButton;
     btBarColor: TColorSpeedButton;
     edCaption: TEdit;
     edCaption: TEdit;
+    edYLineCaption: TEdit;
+    edYLineAfter: TEdit;
+    edYLineDigits: TSpinEdit;
     edCaptionTimerFormat: TEdit;
     edCaptionTimerFormat: TEdit;
-    edGraphValueY: TFloatSpinEdit;
-    edMarqueeWidth: TBCTrackbarUpdown;
     BGRAMaxMProgress: TBGRAFlashProgressBar;
     BGRAMaxMProgress: TBGRAFlashProgressBar;
-    btStyleMarquee: TBGRASpeedButton;
-    edMultiPValueM: TFloatSpinEdit;
     edGraphValue: TFloatSpinEdit;
     edGraphValue: TFloatSpinEdit;
-    edValue: TFloatSpinEdit;
-    edMin: TFloatSpinEdit;
+    edGraphValueY: TFloatSpinEdit;
+    edMarqueeBounce: TSpinEdit;
+    edMarqueeWidth: TBCTrackbarUpdown;
     edMax: TFloatSpinEdit;
     edMax: TFloatSpinEdit;
+    edMax1: TFloatSpinEdit;
+    edMax2: TFloatSpinEdit;
+    edMaxY: TFloatSpinEdit;
+    edMin: TFloatSpinEdit;
+    edMin1: TFloatSpinEdit;
+    edMin2: TFloatSpinEdit;
+    edMinY: TFloatSpinEdit;
+    edMultiPValueSub: TFloatSpinEdit;
+    edValue: TFloatSpinEdit;
+    edValue1: TFloatSpinEdit;
+    GroupBox1: TGroupBox;
+    GroupBox2: TGroupBox;
     Label1: TLabel;
     Label1: TLabel;
     Label10: TLabel;
     Label10: TLabel;
+    Label11: TLabel;
+    Label12: TLabel;
+    Label13: TLabel;
+    Label14: TLabel;
+    Label15: TLabel;
+    Label16: TLabel;
+    Label17: TLabel;
+    Label18: TLabel;
+    Label19: TLabel;
     Label2: TLabel;
     Label2: TLabel;
+    Label20: TLabel;
+    Label21: TLabel;
+    Label22: TLabel;
     Label3: TLabel;
     Label3: TLabel;
     Label4: TLabel;
     Label4: TLabel;
     Label5: TLabel;
     Label5: TLabel;
@@ -57,23 +80,23 @@ type
     Label8: TLabel;
     Label8: TLabel;
     Label9: TLabel;
     Label9: TLabel;
     lbCount: TLabel;
     lbCount: TLabel;
-    rgCaptionAlignM: TRadioGroup;
-    rgMarqueeSpeed: TRadioGroup;
+    PageControl1: TPageControl;
     edCaptionDigits: TSpinEdit;
     edCaptionDigits: TSpinEdit;
     rgCaptionAlign: TRadioGroup;
     rgCaptionAlign: TRadioGroup;
+    rgCaptionAlignM: TRadioGroup;
     rgMarqueeDirection: TRadioGroup;
     rgMarqueeDirection: TRadioGroup;
-    edMarqueeBounce: TSpinEdit;
+    rgMarqueeSpeed: TRadioGroup;
+    TabNormal: TTabSheet;
+    TabMarquee: TTabSheet;
+    TabMultiProgress: TTabSheet;
+    TabTimer: TTabSheet;
+    TabGraph: TTabSheet;
     TimeEdit1: TTimeEdit;
     TimeEdit1: TTimeEdit;
     procedure BCTrackbarUpdown1Change(Sender: TObject; AByUser: boolean);
     procedure BCTrackbarUpdown1Change(Sender: TObject; AByUser: boolean);
     procedure BGRAMaxMProgressTimerEnd(Sender: TObject);
     procedure BGRAMaxMProgressTimerEnd(Sender: TObject);
     procedure btBarColorClick(Sender: TObject);
     procedure btBarColorClick(Sender: TObject);
     procedure btGraphAddValueClick(Sender: TObject);
     procedure btGraphAddValueClick(Sender: TObject);
     procedure btGraphTestClick(Sender: TObject);
     procedure btGraphTestClick(Sender: TObject);
-    procedure btStyleMarqueeClick(Sender: TObject);
-    procedure btStyleMultiPClick(Sender: TObject);
-    procedure btStyleNormalClick(Sender: TObject);
-    procedure btStyleTimer1Click(Sender: TObject);
-    procedure btStyleTimerClick(Sender: TObject);
     procedure btTimerPlayPause2Click(Sender: TObject);
     procedure btTimerPlayPause2Click(Sender: TObject);
     procedure btTimerPlayPauseClick(Sender: TObject);
     procedure btTimerPlayPauseClick(Sender: TObject);
     procedure btTimerStartClick(Sender: TObject);
     procedure btTimerStartClick(Sender: TObject);
@@ -83,16 +106,24 @@ type
     procedure cbCaptionPercentChange(Sender: TObject);
     procedure cbCaptionPercentChange(Sender: TObject);
     procedure cbShowDividersChange(Sender: TObject);
     procedure cbShowDividersChange(Sender: TObject);
     procedure cbShowDividersYChange(Sender: TObject);
     procedure cbShowDividersYChange(Sender: TObject);
+    procedure cbShowYLineChange(Sender: TObject);
     procedure cbTimerAutoStartChange(Sender: TObject);
     procedure cbTimerAutoStartChange(Sender: TObject);
     procedure edCaptionChange(Sender: TObject);
     procedure edCaptionChange(Sender: TObject);
     procedure edCaptionDigitsChange(Sender: TObject);
     procedure edCaptionDigitsChange(Sender: TObject);
     procedure edMarqueeBounceChange(Sender: TObject);
     procedure edMarqueeBounceChange(Sender: TObject);
     procedure edMaxChange(Sender: TObject);
     procedure edMaxChange(Sender: TObject);
+    procedure edMaxYChange(Sender: TObject);
     procedure edMinChange(Sender: TObject);
     procedure edMinChange(Sender: TObject);
-    procedure edMultiPValueMChange(Sender: TObject; AByUser: boolean);
+    procedure edMinYChange(Sender: TObject);
+    procedure edMultiPValueSubChange(Sender: TObject; AByUser: boolean);
     procedure edCaptionTimerFormatChange(Sender: TObject);
     procedure edCaptionTimerFormatChange(Sender: TObject);
     procedure edValueChange(Sender: TObject; AByUser: boolean);
     procedure edValueChange(Sender: TObject; AByUser: boolean);
     procedure edMarqueeWidthChange(Sender: TObject; AByUser: boolean);
     procedure edMarqueeWidthChange(Sender: TObject; AByUser: boolean);
+    procedure edYLineAfterChange(Sender: TObject);
+    procedure edYLineCaptionChange(Sender: TObject);
+    procedure edYLineDigitsChange(Sender: TObject);
+    procedure FormShow(Sender: TObject);
+    procedure PageControl1Change(Sender: TObject);
     procedure rgCaptionAlignClick(Sender: TObject);
     procedure rgCaptionAlignClick(Sender: TObject);
     procedure rgCaptionAlignMClick(Sender: TObject);
     procedure rgCaptionAlignMClick(Sender: TObject);
     procedure rgMarqueeDirectionClick(Sender: TObject);
     procedure rgMarqueeDirectionClick(Sender: TObject);
@@ -109,42 +140,12 @@ var
 
 
 implementation
 implementation
 
 
-uses BGRATextFX;
+uses Math;
 
 
 {$R *.lfm}
 {$R *.lfm}
 
 
 { TForm1 }
 { TForm1 }
 
 
-procedure TForm1.btStyleMarqueeClick(Sender: TObject);
-begin
-  BGRAMaxMProgress.Style:= pbstMarquee;
-end;
-
-procedure TForm1.btStyleMultiPClick(Sender: TObject);
-begin
-  BGRAMaxMProgress.Style:= pbstMultiProgress;
-end;
-
-procedure TForm1.btStyleNormalClick(Sender: TObject);
-begin
-  BGRAMaxMProgress.Style:= pbstNormal;
-end;
-
-procedure TForm1.btStyleTimer1Click(Sender: TObject);
-begin
-  BGRAMaxMProgress.Style:= pbstGraph;
-end;
-
-procedure TForm1.btStyleTimerClick(Sender: TObject);
-begin
-  aCount:= 0;
-  BGRAMaxMProgress.MaxValue:= TimeEdit1.Time;
-  BGRAMaxMProgress.TimerAutoRestart:= cbTimerAutoStart.Checked;
-  BGRAMaxMProgress.CaptionShowPercent:= cbCaptionPercent1.Checked;
-  BGRAMaxMProgress.CaptionPercentTimerFormat:= edCaptionTimerFormat.Text;
-  BGRAMaxMProgress.Style:= pbstTimer;
-end;
-
 procedure TForm1.btTimerPlayPause2Click(Sender: TObject);
 procedure TForm1.btTimerPlayPause2Click(Sender: TObject);
 begin
 begin
   BGRAMaxMProgress.StepIt(0);
   BGRAMaxMProgress.StepIt(0);
@@ -195,7 +196,24 @@ end;
 
 
 procedure TForm1.cbShowDividersYChange(Sender: TObject);
 procedure TForm1.cbShowDividersYChange(Sender: TObject);
 begin
 begin
-  BGRAMaxMProgress.ShowYDividers:= cbShowDividersY.Checked;
+  BGRAMaxMProgress.GraphShowYDividers:= cbShowDividersY.Checked;
+  if BGRAMaxMProgress.GraphShowYDividers then
+  begin
+    BGRAMaxMProgress.ShowDividers:= True;
+    cbShowDividers.Checked:= True;
+  end;
+end;
+
+procedure TForm1.cbShowYLineChange(Sender: TObject);
+begin
+  BGRAMaxMProgress.GraphShowYLine:= cbShowYLine.Checked;
+  if BGRAMaxMProgress.GraphShowYLine then
+  begin
+    BGRAMaxMProgress.BackgroundColor:= clWhite;
+    BGRAMaxMProgress.BackgroundRandomize:= False;
+    cbBackgroundRandom.Checked:= False;
+    btBackgroundColor.StateNormal.Color:= clWhite;
+  end;
 end;
 end;
 
 
 procedure TForm1.cbTimerAutoStartChange(Sender: TObject);
 procedure TForm1.cbTimerAutoStartChange(Sender: TObject);
@@ -222,20 +240,34 @@ procedure TForm1.edMaxChange(Sender: TObject);
 begin
 begin
   BGRAMaxMProgress.MaxValue:= edMax.Value;
   BGRAMaxMProgress.MaxValue:= edMax.Value;
   edValue.MaxValue:= BGRAMaxMProgress.MaxValue;
   edValue.MaxValue:= BGRAMaxMProgress.MaxValue;
+  edValue1.MaxValue:= BGRAMaxMProgress.MaxValue;
   edGraphValue.MaxValue:= BGRAMaxMProgress.MaxValue;
   edGraphValue.MaxValue:= BGRAMaxMProgress.MaxValue;
 end;
 end;
 
 
+procedure TForm1.edMaxYChange(Sender: TObject);
+begin
+  BGRAMaxMProgress.MaxYValue:= edMaxY.Value;
+  edGraphValueY.MaxValue:= BGRAMaxMProgress.MaxYValue;
+end;
+
 procedure TForm1.edMinChange(Sender: TObject);
 procedure TForm1.edMinChange(Sender: TObject);
 begin
 begin
   BGRAMaxMProgress.MinValue:= edMin.Value;
   BGRAMaxMProgress.MinValue:= edMin.Value;
   edValue.MinValue:= BGRAMaxMProgress.MinValue;
   edValue.MinValue:= BGRAMaxMProgress.MinValue;
+  edValue1.MinValue:= BGRAMaxMProgress.MinValue;
   edGraphValue.MinValue:= BGRAMaxMProgress.MinValue;
   edGraphValue.MinValue:= BGRAMaxMProgress.MinValue;
 end;
 end;
 
 
-procedure TForm1.edMultiPValueMChange(Sender: TObject; AByUser: boolean);
+procedure TForm1.edMinYChange(Sender: TObject);
 begin
 begin
-  BGRAMaxMProgress.ValueSub:= edMultiPValueM.Value;
-  edMultiPValueM.Value:= BGRAMaxMProgress.ValueSub;
+  BGRAMaxMProgress.MinYValue:= edMinY.Value;
+  edGraphValueY.MinValue:= BGRAMaxMProgress.MinYValue;
+end;
+
+procedure TForm1.edMultiPValueSubChange(Sender: TObject; AByUser: boolean);
+begin
+  BGRAMaxMProgress.ValueSub:= edMultiPValueSub.Value;
+  edMultiPValueSub.Value:= BGRAMaxMProgress.ValueSub;
 end;
 end;
 
 
 procedure TForm1.edCaptionTimerFormatChange(Sender: TObject);
 procedure TForm1.edCaptionTimerFormatChange(Sender: TObject);
@@ -253,14 +285,53 @@ begin
   if AByUser then BGRAMaxMProgress.MarqueeWidth:= edMarqueeWidth.Value;
   if AByUser then BGRAMaxMProgress.MarqueeWidth:= edMarqueeWidth.Value;
 end;
 end;
 
 
+procedure TForm1.edYLineAfterChange(Sender: TObject);
+begin
+  BGRAMaxMProgress.GraphYLineAfter:= edYLineAfter.Text;
+end;
+
+procedure TForm1.edYLineCaptionChange(Sender: TObject);
+begin
+  BGRAMaxMProgress.GraphYLineCaption:= edYLineCaption.Text;
+end;
+
+procedure TForm1.edYLineDigitsChange(Sender: TObject);
+begin
+  BGRAMaxMProgress.GraphYLineDigits:= edYLineDigits.Value;
+end;
+
+procedure TForm1.FormShow(Sender: TObject);
+begin
+  PageControl1.ActivePage:= TabNormal;
+end;
+
+procedure TForm1.PageControl1Change(Sender: TObject);
+begin
+  if (PageControl1.ActivePage.Tag = 4)
+  then BGRAMaxMProgress.Height:= 100 //Graph
+  else BGRAMaxMProgress.Height:= 34;
+
+  if (PageControl1.ActivePage.Tag = 3) then
+  begin
+    //Timer
+    aCount:= 0;
+    BGRAMaxMProgress.MaxValue:= TimeEdit1.Time;
+    BGRAMaxMProgress.TimerAutoRestart:= cbTimerAutoStart.Checked;
+    BGRAMaxMProgress.CaptionShowPercent:= cbCaptionPercent1.Checked;
+    BGRAMaxMProgress.CaptionPercentTimerFormat:= edCaptionTimerFormat.Text;
+  end;
+
+  BGRAMaxMProgress.Style:= TBGRAPBarStyle(PageControl1.ActivePage.Tag);
+end;
+
 procedure TForm1.rgCaptionAlignClick(Sender: TObject);
 procedure TForm1.rgCaptionAlignClick(Sender: TObject);
 begin
 begin
-  BGRAMaxMProgress.CaptionShowPercentAlign:= TAlignment(rgCaptionAlign.ItemIndex);
+  BGRAMaxMProgress.CaptionPercentAlign:= TAlignment(rgCaptionAlign.ItemIndex);
 end;
 end;
 
 
 procedure TForm1.rgCaptionAlignMClick(Sender: TObject);
 procedure TForm1.rgCaptionAlignMClick(Sender: TObject);
 begin
 begin
-  BGRAMaxMProgress.CaptionShowPercentAlignSub:= TAlignment(rgCaptionAlignM.ItemIndex);
+  BGRAMaxMProgress.CaptionPercentSubAlign:= TAlignment(rgCaptionAlignM.ItemIndex);
 end;
 end;
 
 
 procedure TForm1.rgMarqueeDirectionClick(Sender: TObject);
 procedure TForm1.rgMarqueeDirectionClick(Sender: TObject);
@@ -290,7 +361,11 @@ begin
   begin
   begin
     if Sender=btBarColor
     if Sender=btBarColor
     then BGRAMaxMProgress.BarColor:=ColorDialog1.Color
     then BGRAMaxMProgress.BarColor:=ColorDialog1.Color
-    else BGRAMaxMProgress.BarColorSub:=ColorDialog1.Color;
+    else
+    if Sender=btBarColorM then BGRAMaxMProgress.BarColorSub:=ColorDialog1.Color
+    else
+    if Sender=btBackgroundColor then BGRAMaxMProgress.BackgroundColor:=ColorDialog1.Color;
+
 
 
     TColorSpeedButton(Sender).StateNormal.Color:=ColorDialog1.Color;
     TColorSpeedButton(Sender).StateNormal.Color:=ColorDialog1.Color;
   end;
   end;
@@ -311,13 +386,17 @@ begin
   BGRAMaxMProgress.Style:= pbstGraph;
   BGRAMaxMProgress.Style:= pbstGraph;
   BGRAMaxMProgress.Value:= 0;
   BGRAMaxMProgress.Value:= 0;
   iStep:= (BGRAMaxMProgress.MaxValue-BGRAMaxMProgress.MinValue) / 100;
   iStep:= (BGRAMaxMProgress.MaxValue-BGRAMaxMProgress.MinValue) / 100;
-  YVal:= 0;
+  YVal:= 50;
   Randomize;
   Randomize;
   i:= BGRAMaxMProgress.MinValue;
   i:= BGRAMaxMProgress.MinValue;
   while (i <= BGRAMaxMProgress.MaxValue) do
   while (i <= BGRAMaxMProgress.MaxValue) do
   begin
   begin
     i:= i+iStep;
     i:= i+iStep;
-    YVal:= Random * (BGRAMaxMProgress.MaxYValue - BGRAMaxMProgress.MinYValue) + BGRAMaxMProgress.MinYValue;
+
+    if cbRandG.Checked
+    then YVal:= YVal+RandG(BGRAMaxMProgress.MinYValue, 10)
+    else YVal:= Random * (BGRAMaxMProgress.MaxYValue - BGRAMaxMProgress.MinYValue) + BGRAMaxMProgress.MinYValue;
+
     BGRAMaxMProgress.SetValue(i, YVal);
     BGRAMaxMProgress.SetValue(i, YVal);
     Application.ProcessMessages;
     Application.ProcessMessages;
     Sleep(150);
     Sleep(150);

Some files were not shown because too many files changed in this diff