1// SPDX-License-Identifier: LGPL-3.0-only (modified to allow linking) 2{ 3 Part of BGRA Controls. Made by third party. 4 For detailed information see readme.txt 5 6 Site: https://sourceforge.net/p/bgra-controls/ 7 Wiki: http://wiki.lazarus.freepascal.org/BGRAControls 8 Forum: http://forum.lazarus.freepascal.org/index.php/board,46.0.html 9} 10 11unit DTAnalogCommon; 12 13{$mode objfpc}{$H+} 14 15interface 16 17uses 18 Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, 19 BGRABitmap, BGRABitmapTypes; 20 21type 22 TDTFillStyle = (fsnone, fsGradient{, fsTexture}); 23 24 TDTNeedleStyle = (nsLine, nsTriangle{, nsLineExt, nsTriangleExt}); 25 26 { TDTOrigin } 27 28 TDTOrigin = packed record 29 CenterPoint: TPoint; 30 Radius: integer; 31 end; 32 33 { TDTPointerCapSettings } 34 35 TDTPointerCapSettings = class(TPersistent) 36 private 37 FEdgeColor: TColor; 38 FEdgeThickness: integer; 39 FFillColor: TColor; 40 FOnChange: TNotifyEvent; 41 FRadius: integer; 42 procedure SetEdgeColor(AValue: TColor); 43 procedure SetEdgeThickness(AValue: integer); 44 procedure SetFillColor(AValue: TColor); 45 procedure SetOnChange(AValue: TNotifyEvent); 46 procedure SetRadius(AValue: integer); 47 protected 48 public 49 constructor Create; 50 destructor Destroy; override; 51 property OnChange: TNotifyEvent read FOnChange write SetOnChange; 52 published 53 property EdgeColor: TColor read FEdgeColor write SetEdgeColor; 54 property FillColor: TColor read FFillColor write SetFillColor; 55 property Radius: integer read FRadius write SetRadius; 56 property EdgeThickness: integer read FEdgeThickness write SetEdgeThickness; 57 end; 58 59 { TDTPointerSettings } 60 61 TDTPointerSettings = class(TPersistent) 62 private 63 FColor: TColor; 64 FLength: integer; 65 FOnChange: TNotifyEvent; 66 FThickness: integer; 67 procedure SetColor(AValue: TColor); 68 procedure SetLength(AValue: integer); 69 procedure SetOnChange(AValue: TNotifyEvent); 70 procedure SetThickness(AValue: integer); 71 protected 72 public 73 constructor Create; 74 destructor Destroy; override; 75 property OnChange: TNotifyEvent read FOnChange write SetOnChange; 76 published 77 property Color: TColor read FColor write SetColor; 78 property Length: integer read FLength write SetLength; 79 property Thickness: integer read FThickness write SetThickness; 80 end; 81 82 { TDTNeedleSettings } 83 84 TDTNeedleSettings = class(TPersistent) 85 private 86 FCapColor: TColor; 87 FCapEdgeColor: TColor; 88 FCapRadius: integer; 89 FNeedleColor: TColor; 90 FNeedleLength: integer; 91 FNeedleStyle: TDTNeedleStyle; 92 FOnChange: TNotifyEvent; 93 procedure SetCapColor(AValue: TColor); 94 procedure SetCapEdgeColor(AValue: TColor); 95 procedure SetCapRadius(AValue: integer); 96 procedure SetNeedleColor(AValue: TColor); 97 procedure SetNeedleLength(AValue: integer); 98 procedure SetNeedleStyle(AValue: TDTNeedleStyle); 99 procedure SetOnChange(AValue: TNotifyEvent); 100 protected 101 public 102 constructor Create; 103 destructor Destroy; override; 104 property OnChange: TNotifyEvent read FOnChange write SetOnChange; 105 property NeedleStyle: TDTNeedleStyle read FNeedleStyle write SetNeedleStyle; 106 published 107 property NeedleColor: TColor read FNeedleColor write SetNeedleColor; 108 property NeedleLength: integer read FNeedleLength write SetNeedleLength; 109 property CapRadius: integer read FCapRadius write SetCapRadius; 110 property CapColor: TColor read FCapColor write SetCapColor; 111 property CapEdgeColor: TColor read FCapEdgeColor write SetCapEdgeColor; 112 end; 113 114 { TDTScaleSettings } 115 116 TDTScaleSettings = class(TPersistent) 117 private 118 FEnableScaleText: boolean; 119 FMaximum: integer; 120 FTesting: boolean; 121 FTextFont: string; 122 FTextRadius: integer; 123 FTextSize: integer; 124 FTickColor: TColor; 125 FEnableMainTicks: boolean; 126 FEnableRangeIndicator: boolean; 127 FEnableSubTicks: boolean; 128 FLengthMainTick: integer; 129 FLengthSubTick: integer; 130 FMainTickCount: integer; 131 FMinimum: integer; 132 FOnChange: TNotifyEvent; 133 FSubTickCount: integer; 134 FTextColor: TColor; 135 FThicknessMainTick: integer; 136 FThicknessSubTick: integer; 137 FAngle: integer; 138 procedure SetEnableScaleText(AValue: boolean); 139 procedure SetFAngle(AValue: integer); 140 procedure SetMaximum(AValue: integer); 141 procedure SetTesting(AValue: boolean); 142 procedure SetTextFont(AValue: string); 143 procedure SetTextRadius(AValue: integer); 144 procedure SetTextSize(AValue: integer); 145 procedure SetTickColor(AValue: TColor); 146 procedure SetEnableMainTicks(AValue: boolean); 147 procedure SetEnableRangeIndicator(AValue: boolean); 148 procedure SetEnableSubTicks(AValue: boolean); 149 procedure SetLengthMainTick(AValue: integer); 150 procedure SetLengthSubTick(AValue: integer); 151 procedure SetMainTickCount(AValue: integer); 152 procedure SetOnChange(AValue: TNotifyEvent); 153 procedure SetSubTickCount(AValue: integer); 154 procedure SetTextColor(AValue: TColor); 155 procedure SetThicknessMainTick(AValue: integer); 156 procedure SetThicknessSubTick(AValue: integer); 157 protected 158 property Testing: boolean read FTesting write SetTesting; 159 public 160 constructor Create; 161 destructor Destroy; override; 162 property OnChange: TNotifyEvent read FOnChange write SetOnChange; 163 published 164 property TickColor: TColor read FTickColor write SetTickColor; 165 property TextColor: TColor read FTextColor write SetTextColor; 166 property TextSize: integer read FTextSize write SetTextSize; 167 property TextFont: string read FTextFont write SetTextFont; 168 property EnableMainTicks: boolean read FEnableMainTicks write SetEnableMainTicks; 169 property EnableSubTicks: boolean read FEnableSubTicks write SetEnableSubTicks; 170 property EnableScaleText: boolean read FEnableScaleText write SetEnableScaleText; 171 property Maximum: integer read FMaximum write SetMaximum; 172 property MainTickCount: integer read FMainTickCount write SetMainTickCount; 173 property SubTickCount: integer read FSubTickCount write SetSubTickCount; 174 property LengthMainTick: integer read FLengthMainTick write SetLengthMainTick; 175 property LengthSubTick: integer read FLengthSubTick write SetLengthSubTick; 176 property ThicknessMainTick: integer read FThicknessMainTick write SetThicknessMainTick; 177 property ThicknessSubTick: integer read FThicknessSubTick write SetThicknessSubTick; 178 property TextRadius: integer read FTextRadius write SetTextRadius; 179 property Angle: integer read FAngle write SetFAngle; 180 property EnableRangeIndicator: boolean read FEnableRangeIndicator write SetEnableRangeIndicator; 181 //property RangeMinValue: integer read FRangeMinValue write SetRangeMinValue; 182 //property RangeMidValue: integer read FRangeMidValue write SetRangeMidValue; 183 //property RangeMaxValue: integer read FRangeMaxValue write SetRangeMaxValue; 184 //property RangeMinColor: TColor read FRangeMinColor write SetRangeMinColor; 185 //property RangeMidColor: TColor read FRangeMidColor write SetRangeMidColor; 186 //property RangeMaxColor: TColor read FRangeMaxColor write SetRangeMaxColor; 187 end; 188 189 { TDTFaceSettings } 190 191 TDTFaceSettings = class(TPersistent) 192 private 193 FColorEnd: TColor; 194 FColorFrame: TColor; 195 FColorStart: TColor; 196 FFillStyle: TDTFillStyle; 197 FOnChange: TNotifyEvent; 198 procedure SetColorEnd(AValue: TColor); 199 procedure SetColorFrame(AValue: TColor); 200 procedure SetColorStart(AValue: TColor); 201 procedure SetFillStyle(AValue: TDTFillStyle); 202 procedure SetOnChange(AValue: TNotifyEvent); 203 protected 204 public 205 constructor Create; 206 destructor Destroy; override; 207 property OnChange: TNotifyEvent read FOnChange write SetOnChange; 208 published 209 property FillStyle: TDTFillStyle read FFillStyle write SetFillStyle; 210 property ColorFrame: TColor read FColorFrame write SetColorFrame; 211 property ColorStart: TColor read FColorStart write SetColorStart; 212 property ColorEnd: TColor read FColorEnd write SetColorEnd; 213 end; 214 215 { TDTBaseAnalogDevice } 216 217 TDTBaseAnalogDevice = class(TGraphicControl) 218 private 219 FFaceSettings: TDTFaceSettings; 220 FScaleSettings: TDTScaleSettings; 221 procedure SetFaceSettings(AValue: TDTFaceSettings); 222 procedure SetScaleSettings(AValue: TDTScaleSettings); 223 protected 224 procedure DoChange({%H-}Sender: TObject); 225 public 226 fGaugeBitmap: TBGRABitmap; 227 FFrameBitmap: TBGRABitmap; 228 FFaceBitmap: TBGRABitmap; 229 constructor Create(AOwner: TComponent); override; 230 destructor Destroy; override; 231 property FaceSettings: TDTFaceSettings read FFaceSettings write SetFaceSettings; 232 property ScaleSettings: TDTScaleSettings read FScaleSettings write SetScaleSettings; 233 procedure Paint; override; 234 procedure DrawGauge; 235 procedure DrawFrame; 236 procedure DrawFace; 237 end; 238 239function Initializebitmap(var Bitmap: TBGRABitmap; Width, Height: integer): TDTOrigin; 240 241implementation 242 243function Initializebitmap(var Bitmap: TBGRABitmap; Width, Height: integer): TDTOrigin; 244begin 245 246 Bitmap.SetSize(Width, Height); 247 248 // Clear bitmap to transparent 249 BitMap.Fill(BGRA(0, 0, 0, 0)); 250 251 // Get origin information 252 Result.CenterPoint.x := Width div 2; 253 Result.CenterPoint.y := Height div 2; 254 255 Result.Radius := Result.CenterPoint.y; 256 257 if Result.CenterPoint.x > Result.CenterPoint.y then 258 Result.Radius := Result.CenterPoint.y; 259 260 if Result.CenterPoint.x < Result.CenterPoint.y then 261 Result.Radius := Result.CenterPoint.x; 262 263end; 264 265{ TDTPointerCapSettings } 266 267procedure TDTPointerCapSettings.SetEdgeColor(AValue: TColor); 268begin 269 if FEdgeColor = AValue then 270 Exit; 271 FEdgeColor := AValue; 272 273 if Assigned(FOnChange) then 274 FOnChange(Self); 275end; 276 277procedure TDTPointerCapSettings.SetEdgeThickness(AValue: integer); 278begin 279 if FEdgeThickness = AValue then 280 Exit; 281 FEdgeThickness := AValue; 282 283 if Assigned(FOnChange) then 284 FOnChange(Self); 285end; 286 287procedure TDTPointerCapSettings.SetFillColor(AValue: TColor); 288begin 289 if FFillColor = AValue then 290 Exit; 291 FFillColor := AValue; 292 293 if Assigned(FOnChange) then 294 FOnChange(Self); 295end; 296 297procedure TDTPointerCapSettings.SetOnChange(AValue: TNotifyEvent); 298begin 299 if FOnChange = AValue then 300 Exit; 301 FOnChange := AValue; 302 303 if Assigned(FOnChange) then 304 FOnChange(Self); 305end; 306 307procedure TDTPointerCapSettings.SetRadius(AValue: integer); 308begin 309 if FRadius = AValue then 310 Exit; 311 FRadius := AValue; 312 313 if Assigned(FOnChange) then 314 FOnChange(Self); 315end; 316 317constructor TDTPointerCapSettings.Create; 318begin 319 FEdgeColor := $00CCDCDC; 320 FFillColor := $003F3F3F; 321 FRadius := 10; 322 FEdgeThickness := 1; 323end; 324 325destructor TDTPointerCapSettings.Destroy; 326begin 327 inherited Destroy; 328end; 329 330{ TDTPointerSettings } 331 332procedure TDTPointerSettings.SetColor(AValue: TColor); 333begin 334 if FColor = AValue then 335 Exit; 336 FColor := AValue; 337 338 if Assigned(FOnChange) then 339 FOnChange(Self); 340end; 341 342procedure TDTPointerSettings.SetLength(AValue: integer); 343begin 344 if FLength = AValue then 345 Exit; 346 FLength := AValue; 347 348 if Assigned(FOnChange) then 349 FOnChange(Self); 350end; 351 352procedure TDTPointerSettings.SetOnChange(AValue: TNotifyEvent); 353begin 354 if FOnChange = AValue then 355 Exit; 356 FOnChange := AValue; 357 358 if Assigned(FOnChange) then 359 FOnChange(Self); 360end; 361 362procedure TDTPointerSettings.SetThickness(AValue: integer); 363begin 364 if FThickness = AValue then 365 Exit; 366 FThickness := AValue; 367 368 if Assigned(FOnChange) then 369 FOnChange(Self); 370end; 371 372constructor TDTPointerSettings.Create; 373begin 374 FColor := BGRA(199, 199, 173); 375 FLength := 100; 376 FThickness := 3; 377end; 378 379destructor TDTPointerSettings.Destroy; 380begin 381 inherited Destroy; 382end; 383 384{ TDTBaseAnalogDevice } 385 386procedure TDTBaseAnalogDevice.SetFaceSettings(AValue: TDTFaceSettings); 387begin 388 if FFaceSettings = AValue then 389 Exit; 390 FFaceSettings := AValue; 391 392 DoChange(self); 393end; 394 395procedure TDTBaseAnalogDevice.SetScaleSettings(AValue: TDTScaleSettings); 396begin 397 if FScaleSettings = AValue then 398 Exit; 399 FScaleSettings := AValue; 400 401 DoChange(self); 402end; 403 404procedure TDTBaseAnalogDevice.DoChange(Sender: TObject); 405begin 406 Invalidate; 407end; 408 409constructor TDTBaseAnalogDevice.Create(AOwner: TComponent); 410begin 411 inherited Create(AOwner); 412 413 Width := 240; 414 Height := 240; 415 416 FScaleSettings := TDTScaleSettings.Create; 417 ScaleSettings.OnChange := @DoChange; 418 419 ScaleSettings.TextRadius := round((Width * 0.6) / 2); 420 421 FFaceSettings := TDTFaceSettings.Create; 422 FaceSettings.OnChange := @DoChange; 423 424 FGaugeBitmap := TBGRABitmap.Create; 425 FFaceBitmap := TBGRABitmap.Create; 426 FFrameBitmap := TBGRABitmap.Create; 427 428end; 429 430destructor TDTBaseAnalogDevice.Destroy; 431begin 432 FScaleSettings.Free; 433 FFaceSettings.Free; 434 435 fGaugeBitmap.Free; 436 FFaceBitmap.Free; 437 FFrameBitmap.Free; 438 inherited Destroy; 439end; 440 441procedure TDTBaseAnalogDevice.Paint; 442begin 443 inherited Paint; 444 FGaugeBitmap.Fill(BGRA(0, 0, 0, 0)); 445 446 fGaugeBitmap.SetSize(Width, Height); 447 448 DrawGauge; 449 450 FGaugeBitmap.BlendImage(0, 0, FFrameBitmap, boLinearBlend); 451 FGaugeBitmap.BlendImage(0, 0, FFaceBitmap, boLinearBlend); 452 453 FGaugeBitmap.Draw(Canvas, 0, 0, False); 454 455end; 456 457procedure TDTBaseAnalogDevice.DrawGauge; 458begin 459 DrawFrame; 460 DrawFace; 461end; 462 463procedure TDTBaseAnalogDevice.DrawFrame; 464var 465 Origin: TDTOrigin; 466 r: integer; 467begin 468 469 Origin := Initializebitmap(FFrameBitmap, Width, Height); 470 471 r := round(Origin.Radius * 0.95); 472 473 // Draw Bitmap frame 474 FFrameBitmap.FillEllipseAntialias(Origin.CenterPoint.x, 475 Origin.CenterPoint.y, 476 r, r, FFaceSettings.ColorFrame); 477 478 // Draw thin antialiased border to smooth against background 479 FFrameBitmap.EllipseAntialias(Origin.CenterPoint.x, 480 Origin.CenterPoint.y, 481 r, r, ColorToBGRA(clBlack, 120), 1); 482 483end; 484 485procedure TDTBaseAnalogDevice.DrawFace; 486var 487 Origin: TDTOrigin; 488 r: integer; 489begin 490 491 Origin := Initializebitmap(FFaceBitmap, Width, Height); 492 493 r := round(Origin.Radius * 0.95) - 5; 494 495 case FFaceSettings.FillStyle of 496 fsGradient: 497 FFaceBitmap.FillEllipseLinearColorAntialias(Origin.CenterPoint.x, Origin.CenterPoint.y, r, r, ColorToBGRA(FFaceSettings.ColorStart), ColorToBGRA(FFaceSettings.ColorEnd)); 498 fsnone: 499 FFaceBitmap.FillEllipseAntialias(Origin.CenterPoint.x, Origin.CenterPoint.y, r, r, FFaceSettings.ColorStart); 500 end; 501 502end; 503 504{ TDTNeedleSettings } 505 506procedure TDTNeedleSettings.SetCapColor(AValue: TColor); 507begin 508 if FCapColor = AValue then 509 Exit; 510 FCapColor := AValue; 511 512 if Assigned(FOnChange) then 513 FOnChange(Self); 514end; 515 516procedure TDTNeedleSettings.SetCapEdgeColor(AValue: TColor); 517begin 518 if FCapEdgeColor = AValue then 519 Exit; 520 FCapEdgeColor := AValue; 521 522 if Assigned(FOnChange) then 523 FOnChange(Self); 524end; 525 526procedure TDTNeedleSettings.SetCapRadius(AValue: integer); 527begin 528 if FCapRadius = AValue then 529 Exit; 530 FCapRadius := AValue; 531 532 if Assigned(FOnChange) then 533 FOnChange(Self); 534end; 535 536procedure TDTNeedleSettings.SetNeedleColor(AValue: TColor); 537begin 538 if FNeedleColor = AValue then 539 Exit; 540 FNeedleColor := AValue; 541 542 if Assigned(FOnChange) then 543 FOnChange(Self); 544end; 545 546procedure TDTNeedleSettings.SetNeedleLength(AValue: integer); 547begin 548 if FNeedleLength = AValue then 549 Exit; 550 FNeedleLength := AValue; 551 552 if Assigned(FOnChange) then 553 FOnChange(Self); 554end; 555 556procedure TDTNeedleSettings.SetNeedleStyle(AValue: TDTNeedleStyle); 557begin 558 if FNeedleStyle = AValue then 559 Exit; 560 FNeedleStyle := AValue; 561 562 if Assigned(FOnChange) then 563 FOnChange(Self); 564end; 565 566procedure TDTNeedleSettings.SetOnChange(AValue: TNotifyEvent); 567begin 568 if FOnChange = AValue then 569 Exit; 570 FOnChange := AValue; 571 572 if Assigned(FOnChange) then 573 FOnChange(Self); 574end; 575 576constructor TDTNeedleSettings.Create; 577begin 578 FCapColor := BGRA(63, 63, 63); 579 FCapEdgeColor := BGRA(220, 220, 204); 580 FCapRadius := 10; 581 582 FNeedleStyle := nsLine; 583 FNeedleColor := BGRA(255, 81, 81); 584 FNeedleLength := 100; 585end; 586 587destructor TDTNeedleSettings.Destroy; 588begin 589 inherited Destroy; 590end; 591 592{ TDTScaleSettings } 593 594constructor TDTScaleSettings.Create; 595begin 596 FTickColor := bgra(223, 196, 125); 597 FTextColor := bgra(140, 208, 211); 598 FTextFont := 'Calibri'; 599 FTextSize := 15; 600 FEnableMainTicks := True; 601 FEnableSubTicks := True; 602 FEnableScaleText := True; 603 FMainTickCount := 10; 604 FSubTickCount := 5; 605 FMaximum := 100; 606 FMinimum := 0; 607 FLengthMainTick := 15; 608 FLengthSubTick := 8; 609 FThicknessMainTick := 3; 610 FThicknessSubTick := 1; 611 FAngle := 300; 612 FEnableRangeIndicator := True; 613end; 614 615destructor TDTScaleSettings.Destroy; 616begin 617 inherited Destroy; 618end; 619 620procedure TDTScaleSettings.SetTextFont(AValue: string); 621begin 622 if FTextFont = AValue then 623 Exit; 624 FTextFont := AValue; 625 626 if Assigned(FOnChange) then 627 FOnChange(Self); 628end; 629 630procedure TDTScaleSettings.SetEnableScaleText(AValue: boolean); 631begin 632 if FEnableScaleText = AValue then 633 Exit; 634 FEnableScaleText := AValue; 635 636 if Assigned(FOnChange) then 637 FOnChange(Self); 638end; 639 640procedure TDTScaleSettings.SetFAngle(AValue: integer); 641begin 642 if FAngle=AValue then Exit; 643 FAngle:=AValue; 644end; 645 646procedure TDTScaleSettings.SetMaximum(AValue: integer); 647begin 648 if FMaximum = AValue then 649 Exit; 650 FMaximum := AValue; 651 652 if Assigned(FOnChange) then 653 FOnChange(Self); 654end; 655 656procedure TDTScaleSettings.SetTesting(AValue: boolean); 657begin 658 if FTesting = AValue then 659 Exit; 660 FTesting := AValue; 661 662 if Assigned(FOnChange) then 663 FOnChange(Self); 664end; 665 666procedure TDTScaleSettings.SetTextRadius(AValue: integer); 667begin 668 if FTextRadius = AValue then 669 Exit; 670 FTextRadius := AValue; 671 672 if Assigned(FOnChange) then 673 FOnChange(Self); 674end; 675 676procedure TDTScaleSettings.SetTextSize(AValue: integer); 677begin 678 if FTextSize = AValue then 679 Exit; 680 FTextSize := AValue; 681 682 if Assigned(FOnChange) then 683 FOnChange(Self); 684end; 685 686procedure TDTScaleSettings.SetTickColor(AValue: TColor); 687begin 688 if FTickColor = AValue then 689 Exit; 690 FTickColor := AValue; 691 692 if Assigned(FOnChange) then 693 FOnChange(Self); 694end; 695 696procedure TDTScaleSettings.SetEnableMainTicks(AValue: boolean); 697begin 698 if FEnableMainTicks = AValue then 699 Exit; 700 FEnableMainTicks := AValue; 701 702 if Assigned(FOnChange) then 703 FOnChange(Self); 704end; 705 706procedure TDTScaleSettings.SetEnableRangeIndicator(AValue: boolean); 707begin 708 if FEnableRangeIndicator = AValue then 709 Exit; 710 FEnableRangeIndicator := AValue; 711 712 if Assigned(FOnChange) then 713 FOnChange(Self); 714end; 715 716procedure TDTScaleSettings.SetEnableSubTicks(AValue: boolean); 717begin 718 if FEnableSubTicks = AValue then 719 Exit; 720 FEnableSubTicks := AValue; 721 722 if Assigned(FOnChange) then 723 FOnChange(Self); 724end; 725 726procedure TDTScaleSettings.SetLengthMainTick(AValue: integer); 727begin 728 if FLengthMainTick = AValue then 729 Exit; 730 FLengthMainTick := AValue; 731 732 if Assigned(FOnChange) then 733 FOnChange(Self); 734end; 735 736procedure TDTScaleSettings.SetLengthSubTick(AValue: integer); 737begin 738 if FLengthSubTick = AValue then 739 Exit; 740 FLengthSubTick := AValue; 741 742 if Assigned(FOnChange) then 743 FOnChange(Self); 744end; 745 746procedure TDTScaleSettings.SetMainTickCount(AValue: integer); 747begin 748 if FMainTickCount = AValue then 749 Exit; 750 FMainTickCount := AValue; 751 752 if Assigned(FOnChange) then 753 FOnChange(Self); 754end; 755 756procedure TDTScaleSettings.SetOnChange(AValue: TNotifyEvent); 757begin 758 if FOnChange = AValue then 759 Exit; 760 FOnChange := AValue; 761 762 if Assigned(FOnChange) then 763 FOnChange(Self); 764end; 765 766procedure TDTScaleSettings.SetSubTickCount(AValue: integer); 767begin 768 if FSubTickCount = AValue then 769 Exit; 770 FSubTickCount := AValue; 771 772 if Assigned(FOnChange) then 773 FOnChange(Self); 774end; 775 776procedure TDTScaleSettings.SetTextColor(AValue: TColor); 777begin 778 if FTextColor = AValue then 779 Exit; 780 FTextColor := AValue; 781 782 if Assigned(FOnChange) then 783 FOnChange(Self); 784end; 785 786procedure TDTScaleSettings.SetThicknessMainTick(AValue: integer); 787begin 788 if FThicknessMainTick = AValue then 789 Exit; 790 FThicknessMainTick := AValue; 791 792 if Assigned(FOnChange) then 793 FOnChange(Self); 794end; 795 796procedure TDTScaleSettings.SetThicknessSubTick(AValue: integer); 797begin 798 if FThicknessSubTick = AValue then 799 Exit; 800 FThicknessSubTick := AValue; 801 802 if Assigned(FOnChange) then 803 FOnChange(Self); 804end; 805 806{ TDTFaceSettings } 807 808constructor TDTFaceSettings.Create; 809begin 810 FColorFrame := BGRA(35, 35, 35); 811 FColorStart := BGRA(63, 63, 63); 812 FColorEnd := BGRA(93, 93, 93); 813 FFillStyle := fsGradient; 814end; 815 816destructor TDTFaceSettings.Destroy; 817begin 818 inherited Destroy; 819end; 820 821procedure TDTFaceSettings.SetColorEnd(AValue: TColor); 822begin 823 if FColorEnd = AValue then 824 Exit; 825 FColorEnd := AValue; 826 827 if Assigned(FOnChange) then 828 FOnChange(Self); 829end; 830 831procedure TDTFaceSettings.SetColorFrame(AValue: TColor); 832begin 833 if FColorFrame = AValue then 834 Exit; 835 FColorFrame := AValue; 836 837 if Assigned(FOnChange) then 838 FOnChange(Self); 839end; 840 841procedure TDTFaceSettings.SetColorStart(AValue: TColor); 842begin 843 if FColorStart = AValue then 844 Exit; 845 FColorStart := AValue; 846 847 if Assigned(FOnChange) then 848 FOnChange(Self); 849end; 850 851procedure TDTFaceSettings.SetFillStyle(AValue: TDTFillStyle); 852begin 853 if FFillStyle = AValue then 854 Exit; 855 FFillStyle := AValue; 856 857 if Assigned(FOnChange) then 858 FOnChange(Self); 859end; 860 861procedure TDTFaceSettings.SetOnChange(AValue: TNotifyEvent); 862begin 863 if FOnChange = AValue then 864 Exit; 865 FOnChange := AValue; 866 867 if Assigned(FOnChange) then 868 FOnChange(Self); 869end; 870 871{ TDTBackGround } 872 873end. 874