| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688 |
- // SPDX-License-Identifier: LGPL-3.0-linking-exception
- {
- Part of BGRA Controls. Made by third party.
- For detailed information see readme.txt
- Site: https://sourceforge.net/p/bgra-controls/
- Wiki: http://wiki.lazarus.freepascal.org/BGRAControls
- Forum: http://forum.lazarus.freepascal.org/index.php/board,46.0.html
- }
- {******************************* CONTRIBUTOR(S) ******************************
- - Edivando S. Santos Brasil | [email protected]
- (Compatibility with delphi VCL 11/2018)
- - Sandy Ganz | [email protected]
- Evolved from DTAnalogCommon, specific for New Gauge Work
- Massive overhaul, fixes and features, begat Super Gauge
- Needed to split off as changes broke compatibility badly
- ***************************** END CONTRIBUTOR(S) *****************************}
- unit SuperGaugeCommon;
- {$I bgracontrols.inc}
- interface
- uses
- Classes, SysUtils, {$IFDEF FPC}LResources,{$ELSE}Types, {$ENDIF} Forms, Controls, Graphics, Dialogs,
- BGRABitmap, BGRABitmapTypes, BGRAGradients, BCTypes;
- type
- TSGFillStyle = (fsNone, fsGradient, fsFlat, fsPhong); // Add more if needed here
- TSGPointerStyle = (psLine, psLineExt, psArc , psTriangle {, psTriangleLine, psTriangleLineExt}); // Todo : Add others at some point
- TSGLEDStyle = (lsNone, lsFlat, lsShaded);
- TSGLEDShape = (lshRound, lshSquare, lshTriangle, lshDownTriangle);
- TSGPointerCapPosition = (cpUnder, cpOver);
- TSGCapStyle = (csNone, csFlat, csShaded, csPhong);
- TSGTickArc = (taNone, taOuter, taInner, taBoth); // Arc above or below ticks, inner/both is automatic on inner, main if exist, minor othewise
- TSGRangeCheckType = (rcNone, rcGaugeOutOfRange, rcBetween, rcBothInclusive, rcStartInclusive,
- rcEndInclusive, rcBothBetweenOutside, rcBothInclusiveOutside,
- rcGreaterStart, rcLessEnd); // added for range check led, see code for details
- TSGMarkerStyle = (msCenter, msLeft, msRight);
- { TSGOrigin }
- TSGOrigin = packed record
- CenterPoint: TPoint;
- Radius: integer;
- end;
- { TSGPointerCapSettings }
- TSGPointerCapSettings = class(TPersistent)
- private
- FEdgeColor: TColor;
- FEdgeThickness: integer;
- FFillColor: TColor;
- FOnChange: TNotifyEvent;
- FRadius: integer;
- FCurveExponent: single;
- FCapStyle: TSGCapStyle;
- FCapPosition: TSGPointerCapPosition;
- FDirty: boolean;
- procedure SetEdgeColor(AValue: TColor);
- procedure SetEdgeThickness(AValue: integer);
- procedure SetFillColor(AValue: TColor);
- procedure SetOnChange(AValue: TNotifyEvent);
- procedure SetRadius(AValue: integer);
- procedure SetLightIntensity(const AValue: integer);
- function GetLightIntensity: integer;
- procedure SetCurveExponent(const AValue: single);
- procedure SetCapStyle(const AValue: TSGCapStyle);
- procedure SetPointerCapPos(const AValue: TSGPointerCapPosition);
- procedure DirtyOnChange;
- protected
- public
- FPhong: TPhongShading;
- property Dirty: boolean read FDirty write FDirty;
- constructor Create;
- destructor Destroy; override;
- property OnChange: TNotifyEvent read FOnChange write SetOnChange;
- published
- property EdgeColor: TColor read FEdgeColor write SetEdgeColor default clGray;
- property FillColor: TColor read FFillColor write SetFillColor default clBlack;
- property Radius: integer read FRadius write SetRadius default 30;
- property EdgeThickness: integer read FEdgeThickness write SetEdgeThickness default 2;
- property LightIntensity: integer read GetLightIntensity write SetLightIntensity default 300;
- property CurveExponent: single read FCurveExponent write SetCurveExponent default 0.05;
- property CapStyle: TSGCapStyle read FCapStyle write SetCapStyle default csPhong;
- property CapPosition: TSGPointerCapPosition read FCapPosition write SetPointerCapPos default cpUnder;
- end;
- { TSGPointerSettings }
- TSGPointerSettings = class(TPersistent)
- private
- FColor: TColor;
- FLength: integer;
- FExtensionLength: integer;
- FOnChange: TNotifyEvent;
- FThickness: integer;
- FStyle: TSGPointerStyle;
- FDirty: boolean;
- procedure SetColor(AValue: TColor);
- procedure SetLength(AValue: integer);
- procedure SetOnChange(AValue: TNotifyEvent);
- procedure SetThickness(AValue: integer);
- procedure SetStyle(AValue: TSGPointerStyle);
- procedure SetExtensionLength(AValue: integer);
- procedure DirtyOnChange;
- protected
- public
- constructor Create;
- destructor Destroy; override;
- property OnChange: TNotifyEvent read FOnChange write SetOnChange;
- property Dirty: boolean read FDirty write FDirty;
- published
- property Color: TColor read FColor write SetColor;
- property Length: integer read FLength write SetLength default 160;
- property ExtensionLength: integer read FExtensionLength write SetExtensionLength default 20;
- property Thickness: integer read FThickness write SetThickness default 5;
- property Style: TSGPointerStyle read FStyle write SetStyle default psLineExt;
- end;
- { TSGScaleSettings }
- TSGScaleSettings = class(TPersistent)
- private
- FEnableScaleText: boolean;
- FStart: integer;
- FStep: integer;
- FMaximum: integer;
- FMinimum: integer;
- FTextFont: string;
- FTextRadius: integer;
- FTextSize: integer;
- FTextStyle: TFontStyles;
- FTickColor: TColor;
- FEnableMainTicks: boolean;
- FEnableSubTicks: boolean;
- FReverseScale: boolean;
- FThicknessMainTick: integer;
- FThicknessSubTick: integer;
- FLengthMainTick: integer;
- FLengthSubTick: integer;
- FMainTickCount: integer;
- FOnChange: TNotifyEvent;
- FSubTickCount: integer;
- FTextColor: TColor;
- FScaleRadius: integer;
- FTickArcStyle: TSGTickArc;
- FDirty: boolean;
- procedure SetEnableScaleText(AValue: boolean);
- procedure SetStart(AValue: integer);
- procedure SetStep(AValue: integer);
- procedure SetMaximum(AValue: integer);
- procedure SetMinimum(AValue: integer);
- procedure SetTextFont(AValue: string);
- procedure SetTextRadius(AValue: integer);
- procedure SetTextSize(AValue: integer);
- procedure SetTextStyle(AValue: TFontStyles);
- procedure SetTickColor(AValue: TColor);
- procedure SetEnableMainTicks(AValue: boolean);
- procedure SetEnableSubTicks(AValue: boolean);
- procedure SetReverseScale(AValue: boolean);
- procedure SetLengthMainTick(AValue: integer);
- procedure SetLengthSubTick(AValue: integer);
- procedure SetMainTickCount(AValue: integer);
- procedure SetOnChange(AValue: TNotifyEvent);
- procedure SetSubTickCount(AValue: integer);
- procedure SetTextColor(AValue: TColor);
- procedure SetThicknessMainTick(AValue: integer);
- procedure SetThicknessSubTick(AValue: integer);
- procedure SetTickArcStyle(AValue: TSGTickArc);
- procedure SetScaleRadius(AValue: integer);
- procedure DirtyOnChange;
- protected
- public
- constructor Create;
- destructor Destroy; override;
- property OnChange: TNotifyEvent read FOnChange write SetOnChange;
- property Dirty: boolean read FDirty write FDirty;
- published
- property TickColor: TColor read FTickColor write SetTickColor;
- property TextColor: TColor read FTextColor write SetTextColor;
- property TextSize: integer read FTextSize write SetTextSize default 20;
- property TextStyle: TFontStyles read FTextStyle write SetTextStyle;
- property TextFont: string read FTextFont write SetTextFont;
- property EnableMainTicks: boolean read FEnableMainTicks write SetEnableMainTicks;
- property EnableSubTicks: boolean read FEnableSubTicks write SetEnableSubTicks;
- property EnableScaleText: boolean read FEnableScaleText write SetEnableScaleText;
- property ReverseScale: boolean read FReverseScale write SetReverseScale default False;
- property Start: integer read FStart write SetStart default 0;
- property Step: integer read FStep write SetStep default 1;
- property MainTickCount: integer read FMainTickCount write SetMainTickCount;
- property SubTickCount: integer read FSubTickCount write SetSubTickCount;
- property LengthMainTick: integer read FLengthMainTick write SetLengthMainTick;
- property LengthSubTick: integer read FLengthSubTick write SetLengthSubTick;
- property ThicknessMainTick: integer read FThicknessMainTick write SetThicknessMainTick;
- property ThicknessSubTick: integer read FThicknessSubTick write SetThicknessSubTick;
- property TextRadius: integer read FTextRadius write SetTextRadius default 120;
- property ScaleRadius: integer read FScaleRadius write SetScaleRadius;
- property TickArcStyle : TSGTickArc read FTickArcStyle write SetTickArcStyle default taOuter;
- end;
- { TSGBandSettings }
- TSGBandSettings = class(TPersistent)
- private
- FEnabled: boolean;
- FStartValue: single;
- FEndValue: single;
- FEnableText: boolean;
- FText: TCaption;
- FTextFont: string;
- FTextStyle: TFontStyles;
- FTextRadius: integer;
- FTextSize: integer;
- FTextColor: TColor;
- FOnChange: TNotifyEvent;
- FBandThickness: integer;
- FBandRadius: integer; // defines the outer Radius length in pixels, likely center of width/thickness
- FBandColor: TColor;
- FDirty: boolean;
- procedure SetEnabled(AValue: boolean);
- procedure SetStartValue(AValue: single);
- procedure SetEndValue(AValue: single);
- procedure SetEnableText(AValue: boolean);
- procedure SetText(AValue: TCaption);
- procedure SetTextSize(AValue: integer);
- procedure SetTextFont(AValue: string);
- procedure SetTextStyle(AValue: TFontStyles);
- procedure SetTextRadius(AValue: integer);
- procedure SetTextColor(AValue: TColor);
- procedure SetOnChange(AValue: TNotifyEvent);
- procedure SetBandThickness(AValue: integer);
- procedure SetBandRadius(AValue: integer);
- procedure SetBandColor(AValue: TColor);
- procedure DirtyOnChange;
- protected
- public
- constructor Create;
- destructor Destroy; override;
- property OnChange: TNotifyEvent read FOnChange write SetOnChange;
- property Dirty: boolean read FDirty write FDirty;
- published
- property Enabled: boolean read FEnabled write SetEnabled default False;
- property StartValue: single read FStartValue write SetStartValue default 0.0;
- property EndValue: single read FEndValue write SetEndValue default 100.0;
- property EnableText: boolean read FEnableText write SetEnableText;
- property Text: TCaption read FText write SetText;
- property TextSize: integer read FTextSize write SetTextSize default 20;
- property TextFont: string read FTextFont write SetTextFont;
- property TextStyle: TFontStyles read FTextStyle write SetTextStyle;
- property TextRadius: integer read FTextRadius write SetTextRadius;
- property TextColor: TColor read FTextColor write SetTextColor;
- property Thickness: integer read FBandThickness write SetBandThickness;
- property BandRadius: integer read FBandRadius write SetBandRadius;
- Property BandColor: TColor read FBandColor write SetBandColor;
- end;
- { TSGFaceSettings }
- TSGFaceSettings = class(TPersistent)
- private
- FInnerColor: TColor;
- FOuterColor: TColor;
- FFillStyle: TSGFillStyle;
- FPicture: TPicture;
- FPictureEnabled: boolean;
- FPictureOffsetX, FPictureOffsetY: integer;
- FCurveExponent: single;
- FOnChange: TNotifyEvent;
- FDirty: boolean;
- procedure SetInnerColor(AValue: TColor);
- procedure SetOuterColor(AValue: TColor);
- procedure SetFillStyle(AValue: TSGFillStyle);
- procedure SetPicture(AValue: TPicture);
- procedure SetPictureEnabled(AValue: boolean);
- procedure SetPictureOffsetX(AValue: integer);
- procedure SetPictureOffsetY(AValue: integer);
- procedure SetLightIntensity(const AValue: integer);
- function GetLightIntensity: integer;
- procedure SetCurveExponent(const AValue: single);
- procedure SetOnChange(AValue: TNotifyEvent);
- procedure DirtyOnChange;
- protected
- public
- FPhong: TPhongShading;
- constructor Create;
- destructor Destroy; override;
- property OnChange: TNotifyEvent read FOnChange write SetOnChange;
- property Dirty: boolean read FDirty write FDirty;
- published
- property FillStyle: TSGFillStyle read FFillStyle write SetFillStyle;
- property InnerColor: TColor read FInnerColor write SetInnerColor;
- property OuterColor: TColor read FOuterColor write SetOuterColor;
- property Picture: TPicture read FPicture write SetPicture;
- property PictureEnabled: boolean read FPictureEnabled write SetPictureEnabled;
- property PictureOffsetX: integer read FPictureOffsetX write SetPictureOffsetX default 0;
- property PictureOffsetY: integer read FPictureOffsetY write SetPictureOffsetY default 0;
- property LightIntensity: integer read GetLightIntensity write SetLightIntensity default 300;
- property CurveExponent: single read FCurveExponent write SetCurveExponent default 0.05;
- end;
- { TSGFrameSettings }
- TSGFrameSettings = class(TPersistent)
- private
- FFrameColor: TColor;
- FBorderColor: TColor;
- FBorderRadius: integer;
- FOnChange: TNotifyEvent;
- FDirty: boolean;
- procedure SetBorderRadius(AValue: integer);
- procedure SetFrameColor(AValue: TColor);
- procedure SetBorderColor(AValue: TColor);
- procedure SetOnChange(AValue: TNotifyEvent);
- procedure DirtyOnChange;
- protected
- public
- constructor Create;
- destructor Destroy; override;
- property OnChange: TNotifyEvent read FOnChange write SetOnChange;
- property Dirty: boolean read FDirty write FDirty;
- published
- property BorderRadius: integer read FBorderRadius write SetBorderRadius;
- property FrameColor: TColor read FFrameColor write SetFrameColor;
- property BorderColor: TColor read FBorderColor write SetBorderColor;
- end;
- { TSGLEDSettings }
- TSGLEDSettings = class(TPersistent)
- private
- FActiveColor: TColor;
- FInactiveColor: TColor;
- FBorderColor: TColor;
- FSize: integer;
- FOffsetX, FOffsetY: integer;
- FStyle: TSGLEDStyle;
- FShape: TSGLEDShape;
- FOnChange: TNotifyEvent;
- FActive: boolean;
- FDirty: boolean;
- procedure SetActive(AValue: boolean);
- procedure SetActiveNoDoChange(AValue: boolean);
- procedure SetActiveColor(AValue: TColor);
- procedure SetInactiveColor(AValue: TColor);
- procedure SetBorderColor(AValue: TColor);
- procedure SetSize(AValue: integer);
- procedure SetOffsetX(AValue: integer);
- procedure SetOffsetY(AValue: integer);
- procedure SetStyle(AValue: TSGLEDStyle);
- procedure SetShape(AValue: TSGLEDShape);
- procedure SetOnChange(AValue: TNotifyEvent);
- procedure DirtyOnChange;
- protected
- public
- constructor Create;
- destructor Destroy; override;
- property OnChange: TNotifyEvent read FOnChange write SetOnChange;
- property Dirty: boolean read FDirty write FDirty;
- published
- property ActiveColor: TColor read FActiveColor write SetActiveColor;
- property InactiveColor: TColor read FInactiveColor write SetInactiveColor;
- property BorderColor: TColor read FBorderColor write SetBorderColor;
- property Size: integer read FSize write SetSize default 10;
- property OffsetX: integer read FOffsetX write SetOffsetX default 0;
- property OffsetY: integer read FOffsetY write SetOffsetY default 50;
- property Style: TSGLEDStyle read FStyle write SetStyle default lsShaded;
- property Shape: TSGLEDShape read FShape write SetShape default lshRound;
- property Active: boolean read FActive write SetActive;
- property ActiveNoDoChange: boolean read FActive write SetActiveNoDoChange;
- end;
- { TSGRangeCheckLEDSettings }
- TSGRangeCheckLEDSettings = class(TSGLEDSettings)
- private
- FRangeStartValue : single;
- FRangeEndValue : single;
- FRangeType: TSGRangeCheckType;
- procedure SetRangeStartValue(AValue: single);
- procedure SetRangeEndValue(AValue: single);
- procedure SetRangeType(AValue: TSGRangeCheckType);
- protected
- public
- constructor Create;
- destructor Destroy; override;
- published
- property RangeStartValue: single read FRangeStartValue write SetRangeStartValue default 0;
- property RangeEndValue: single read FRangeEndValue write SetRangeEndValue default 100;
- property RangeType: TSGRangeCheckType read FRangeType write SetRangeType;
- property ActiveColor;
- property InactiveColor;
- property BorderColor;
- property Size;
- property OffsetX; // origin at center based offset
- property OffsetY;
- property Style;
- end;
- { TSGTextSettings }
- TSGTextSettings = class(TPersistent)
- private
- FEnabled: boolean;
- FFontEx: TBCFont;
- FText : TCaption;
- FOffsetX, FOffsetY: integer;
- FOnChange: TNotifyEvent;
- FDirty: boolean;
- procedure SetEnabled(AValue: boolean);
- procedure SetOffsetX(AValue: integer);
- procedure SetOffsetY(AValue: integer);
- procedure SetOnChange(AValue: TNotifyEvent);
- procedure DirtyOnChange;
- procedure SetText(AValue: TCaption);
- procedure SetFontEx(AValue: TBCFont);
- protected
- public
- constructor Create;
- destructor Destroy; override;
- property OnChange: TNotifyEvent read FOnChange write SetOnChange;
- property Dirty: boolean read FDirty write FDirty;
- published
- property Enabled: boolean read FEnabled write SetEnabled default False;
- property FontEx: TBCFont read FFontEx write SetFontEx;
- property Text: TCaption read FText write SetText;
- property OffsetX: integer read FOffsetX write SetOffsetX;
- property OffsetY: integer read FOffsetY write SetOffsetY;
- end;
- { TSGMarkerSettings }
- // Marker can be left or right or centered. The flat side should
- // be aligned with the markers value or in the case of centered, will
- // be the center of the marker. Like - \| - Left, |/ - Right, \/ - Centered
- TSGMarkerSettings = class(TPersistent)
- private
- FValue: single; // this is the internal gauge value not user value
- FEnabled: boolean;
- FColor: TColor;
- FHeight: integer;
- FRadius: integer;
- FWidth: integer;
- FStyle: TSGMarkerStyle;
- FOnChange: TNotifyEvent;
- FDirty: boolean;
- procedure SetValue(AValue: single);
- procedure SetEnabled(AValue: boolean);
- procedure SetColor(AValue: TColor);
- procedure SetHeight(AValue: integer);
- procedure SetRadius(AValue: integer);
- procedure SetWidth(AValue: integer);
- procedure SetOnChange(AValue: TNotifyEvent);
- procedure SetStyle(AValue: TSGMarkerStyle);
- procedure DirtyOnChange;
- protected
- public
- constructor Create;
- destructor Destroy; override;
- property OnChange: TNotifyEvent read FOnChange write SetOnChange;
- property Dirty: boolean read FDirty write FDirty;
- published
- property Value: single read FValue write SetValue default 0.0;
- property Enabled: boolean read FEnabled write SetEnabled default False;
- property Color: TColor read FColor write SetColor;
- property Height: integer read FHeight write SetHeight;
- property Radius: integer read FRadius write SetRadius;
- property Width: integer read FWidth write SetWidth;
- property Style: TSGMarkerStyle read FStyle write SetStyle default msCenter;
- end;
- function Initializebitmap(var Bitmap: TBGRABitmap; Width, Height: integer): TSGOrigin;
- implementation
- function Initializebitmap(var Bitmap: TBGRABitmap; Width, Height: integer): TSGOrigin;
- begin
- Bitmap.SetSize(Width, Height);
- // Clear bitmap to transparent
- BitMap.Fill(BGRA(0, 0, 0, 0));
- // Get origin information
- Result.CenterPoint.x := Width div 2;
- Result.CenterPoint.y := Height div 2;
- // Take the smallest so radius will always fit
- if Result.CenterPoint.x < Result.CenterPoint.y then
- Result.Radius := Result.CenterPoint.x
- else
- Result.Radius := Result.CenterPoint.y;
- end;
- { TSGPointerCapSettings }
- procedure TSGPointerCapSettings.SetCapStyle(const AValue: TSGCapStyle);
- begin
- if FCapStyle = AValue then
- Exit;
- FCapStyle := AValue;
- DirtyOnChange;
- end;
- procedure TSGPointerCapSettings.SetPointerCapPos(const AValue: TSGPointerCapPosition);
- begin
- if FCapPosition = AValue then
- Exit;
- FCapPosition := AValue;
- DirtyOnChange;
- end;
- procedure TSGPointerCapSettings.SetLightIntensity(const AValue: integer);
- begin
- if AValue = FPhong.LightSourceIntensity then
- Exit;
- FPhong.LightSourceIntensity := AValue;
- DirtyOnChange;
- end;
- function TSGPointerCapSettings.GetLightIntensity: integer;
- begin
- Result := round(FPhong.LightSourceIntensity);
- end;
- procedure TSGPointerCapSettings.SetCurveExponent(const AValue: single);
- begin
- if FCurveExponent = AValue then
- Exit;
- FCurveExponent := AValue;
- DirtyOnChange;
- end;
- procedure TSGPointerCapSettings.SetEdgeColor(AValue: TColor);
- begin
- if FEdgeColor = AValue then
- Exit;
- FEdgeColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGPointerCapSettings.SetEdgeThickness(AValue: integer);
- begin
- if (FEdgeThickness = AValue) or (AValue < 0) then
- Exit;
- FEdgeThickness := AValue;
- DirtyOnChange;
- end;
- procedure TSGPointerCapSettings.SetFillColor(AValue: TColor);
- begin
- if FFillColor = AValue then
- Exit;
- FFillColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGPointerCapSettings.SetOnChange(AValue: TNotifyEvent);
- begin
- FOnChange := AValue;
- // no dirty needed possibly, call directly
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- procedure TSGPointerCapSettings.SetRadius(AValue: integer);
- begin
- if FRadius = AValue then
- Exit;
- FRadius := AValue;
- DirtyOnChange;
- end;
- constructor TSGPointerCapSettings.Create;
- begin
- // create a phong shader, will need to delete on clean up
- FPhong := TPhongShading.Create;
- FPhong.LightPositionZ := 100;
- FPhong.LightSourceIntensity := 300;
- FPhong.NegativeDiffusionFactor := 0.8;
- FPhong.AmbientFactor := 0.5;
- FPhong.DiffusionFactor := 0.6;
- FCurveExponent := 0.05;
- FCapStyle := csPhong;
- FCapPosition := cpUnder;
- FEdgeColor := clGray;
- FFillColor := clBlack;
- FRadius := 20;
- FEdgeThickness := 2;
- FDirty := True;
- end;
- destructor TSGPointerCapSettings.Destroy;
- begin
- FPhong.Free;
- inherited Destroy;
- end;
- procedure TSGPointerCapSettings.DirtyOnChange;
- begin
- FDirty := True; // if we get here some props must have changed, mark dirty
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- { TSGPointerSettings }
- procedure TSGPointerSettings.SetColor(AValue: TColor);
- begin
- if FColor = AValue then
- Exit;
- FColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGPointerSettings.SetLength(AValue: integer);
- begin
- if FLength = AValue then
- Exit;
- FLength := AValue;
- DirtyOnChange;
- end;
- procedure TSGPointerSettings.SetOnChange(AValue: TNotifyEvent);
- begin
- FOnChange := AValue;
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- procedure TSGPointerSettings.SetThickness(AValue: integer);
- begin
- if FThickness = AValue then
- Exit;
- FThickness := AValue;
- DirtyOnChange;
- end;
- procedure TSGPointerSettings.SetStyle(AValue: TSGPointerStyle);
- begin
- if FStyle = AValue then
- Exit;
- FStyle := AValue;
- DirtyOnChange;
- end;
- procedure TSGPointerSettings.SetExtensionLength(AValue: integer);
- begin
- if FExtensionLength = AValue then
- Exit;
- FExtensionLength := AValue;
- DirtyOnChange;
- end;
- constructor TSGPointerSettings.Create;
- begin
- FColor := BGRA(255, 127, 63); // Orange pointer
- FLength := 160;
- FThickness := 5;
- FExtensionLength := 20;
- FStyle := psLineExt;
- FDirty := True;
- end;
- procedure TSGPointerSettings.DirtyOnChange;
- begin
- FDirty := True; // if we get here a prop must have changed, mark dirty
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- destructor TSGPointerSettings.Destroy;
- begin
- inherited Destroy;
- end;
- { TSGScaleSettings }
- constructor TSGScaleSettings.Create;
- begin
- FTickColor := BGRA(223, 196, 125); // Tan
- FTextColor := BGRA(140, 208, 211); // Light Blue
- FTextFont := 'Calibri';
- FTextSize := 20;
- FTextRadius := 120;
- FEnableMainTicks := True;
- FEnableSubTicks := True;
- FEnableScaleText := True;
- FReverseScale := False;
- FMainTickCount := 10;
- FSubTickCount := 5;
- FStart := 0;
- FStep := 1;
- FLengthMainTick := 15;
- FLengthSubTick := 8;
- FThicknessMainTick := 3;
- FThicknessSubTick := 1;
- FTickArcStyle := taOuter;
- FScaleRadius := 155;
- FDirty := True;
- end;
- destructor TSGScaleSettings.Destroy;
- begin
- inherited Destroy;
- end;
- procedure TSGScaleSettings.SetTextFont(AValue: string);
- begin
- if FTextFont = AValue then
- Exit;
- FTextFont := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetEnableScaleText(AValue: boolean);
- begin
- if FEnableScaleText = AValue then
- Exit;
- FEnableScaleText := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetReverseScale(AValue: boolean);
- begin
- if FReverseScale = AValue then
- Exit;
- FReverseScale := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetScaleRadius(AValue: integer);
- begin
- if (FScaleRadius = AValue) or (AValue < 1) then
- Exit;
- FScaleRadius := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetMaximum(AValue: integer);
- begin
- if (FMaximum = AValue) or (AValue <= FMinimum) then
- Exit;
- FMaximum := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetStart(AValue: integer);
- begin
- if (FStart = AValue)then
- Exit;
- FStart := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetStep(AValue: integer);
- begin
- if (FStep = AValue)then
- Exit;
- FStep := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetMinimum(AValue: integer);
- begin
- if (FMinimum = AValue) then
- Exit;
- FMinimum := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetTextRadius(AValue: integer);
- begin
- if (FTextRadius = AValue) or (AValue < 1) then
- Exit;
- FTextRadius := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetTextSize(AValue: integer);
- begin
- if (FTextSize = AValue) or (AValue < 1) then
- Exit;
- FTextSize := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetTickColor(AValue: TColor);
- begin
- if FTickColor = AValue then
- Exit;
- FTickColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetTickArcStyle(AValue: TSGTickArc);
- begin
- if FTickArcStyle = AValue then
- exit;
- FTickArcStyle := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetEnableMainTicks(AValue: boolean);
- begin
- if FEnableMainTicks = AValue then
- Exit;
- FEnableMainTicks := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetEnableSubTicks(AValue: boolean);
- begin
- if FEnableSubTicks = AValue then
- Exit;
- FEnableSubTicks := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetLengthMainTick(AValue: integer);
- begin
- if (FLengthMainTick = AValue) or (AValue < 1) then
- Exit;
- FLengthMainTick := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetLengthSubTick(AValue: integer);
- begin
- if (FLengthSubTick = AValue) or (AValue < 1) then
- Exit;
- FLengthSubTick := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetMainTickCount(AValue: integer);
- begin
- if (FMainTickCount = AValue) or (AValue < 1) then
- Exit;
- FMainTickCount := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetOnChange(AValue: TNotifyEvent);
- begin
- FOnChange := AValue;
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- procedure TSGScaleSettings.SetSubTickCount(AValue: integer);
- begin
- if (FSubTickCount = AValue) or (AValue < 1) then
- Exit;
- FSubTickCount := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetTextColor(AValue: TColor);
- begin
- if FTextColor = AValue then
- Exit;
- FTextColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetTextStyle(AValue: TFontStyles);
- begin
- if FTextStyle = AValue then
- Exit;
- FTextStyle := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetThicknessMainTick(AValue: integer);
- begin
- if (FThicknessMainTick = AValue) or (AValue < 1) then
- Exit;
- FThicknessMainTick := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.SetThicknessSubTick(AValue: integer);
- begin
- if (FThicknessSubTick = AValue) or (AValue < 1) then
- Exit;
- FThicknessSubTick := AValue;
- DirtyOnChange;
- end;
- procedure TSGScaleSettings.DirtyOnChange;
- begin
- FDirty := True; // if we get here a prop must have changed, mark dirty
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- { TSGBandSettings}
- constructor TSGBandSettings.Create;
- begin
- FEnabled := False;
- FEnableText := False;
- FText := '';
- FTextColor := clBlack;
- FTextFont := 'default';
- FTextStyle := [];
- FTextSize := 20;
- FTextRadius := 100;
- FStartValue := 0;
- FEndValue := 20;
- FBandRadius := 100;
- FBandColor := clGreen;
- FBandThickness := 40;
- FStartValue := 0;
- FEndValue := 100;
- FDirty := True;
- end;
- destructor TSGBandSettings.Destroy;
- begin
- inherited Destroy;
- end;
- procedure TSGBandSettings.SetEnabled(AValue: boolean);
- begin
- if FEnabled = AValue then
- Exit;
- FEnabled := AValue;
- DirtyOnChange;
- end;
- procedure TSGBandSettings.SetTextFont(AValue: string);
- begin
- if FTextFont = AValue then
- Exit;
- FTextFont := AValue;
- DirtyOnChange;
- end;
- procedure TSGBandSettings.SetTextStyle(AValue: TFontStyles);
- begin
- if FTextStyle = AValue then
- Exit;
- FTextStyle := AValue;
- DirtyOnChange;
- end;
- procedure TSGBandSettings.SetEnableText(AValue: boolean);
- begin
- if FEnableText = AValue then
- Exit;
- FEnableText := AValue;
- DirtyOnChange;
- end;
- procedure TSGBandSettings.SetText(AValue: TCaption);
- begin
- if FText = AValue then
- Exit;
- FText := AValue;
- DirtyOnChange;
- end;
- procedure TSGBandSettings.SetTextRadius(AValue: integer);
- begin
- if (FTextRadius = AValue) or (AValue < 1) then
- Exit;
- FTextRadius := AValue;
- DirtyOnChange;
- end;
- procedure TSGBandSettings.SetBandRadius(AValue: integer);
- begin
- if (FBandRadius = AValue) or (AValue < 1) then
- Exit;
- FBandRadius := AValue;
- DirtyOnChange;
- end;
- procedure TSGBandSettings.SetStartValue(AValue: single);
- begin
- if (FStartValue = AValue) or (AValue >= FEndValue) then
- Exit;
- FStartValue := AValue;
- DirtyOnChange;
- end;
- procedure TSGBandSettings.SetEndValue(AValue: single);
- begin
- if (FEndValue = AValue) or (AValue <= FStartValue) then
- Exit;
- FEndValue := AValue;
- DirtyOnChange;
- end;
- procedure TSGBandSettings.SetTextSize(AValue: integer);
- begin
- if (FTextSize = AValue) or (AValue < 1) then
- Exit;
- FTextSize := AValue;
- DirtyOnChange;
- end;
- procedure TSGBandSettings.SetOnChange(AValue: TNotifyEvent);
- begin
- FOnChange := AValue;
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- procedure TSGBandSettings.SetTextColor(AValue: TColor);
- begin
- if FTextColor = AValue then
- Exit;
- FTextColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGBandSettings.SetBandColor(AValue: TColor);
- begin
- if FBandColor = AValue then
- Exit;
- FBandColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGBandSettings.SetBandThickness(AValue: integer);
- begin
- if (FBandThickness = AValue) or (AValue < 1) then
- Exit;
- FBandThickness := AValue;
- DirtyOnChange;
- end;
- procedure TSGBandSettings.DirtyOnChange;
- begin
- FDirty := True;
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- { TSGFaceSettings }
- constructor TSGFaceSettings.Create;
- begin
- // create a Phong shader, will need to delete on clean up
- FPhong := TPhongShading.Create;
- FPhong.LightPositionZ := 100;
- FPhong.LightSourceIntensity := 300;
- FPhong.NegativeDiffusionFactor := 0.8;
- FPhong.AmbientFactor := 0.5;
- FPhong.DiffusionFactor := 0.6;
- FCurveExponent := 0.05;
- FOuterColor := clBlack;
- FInnerColor := clGray;
- FFillStyle := fsGradient;
- FPicture := TPicture.Create;
- FPictureEnabled := FALSE;
- FPictureOffsetX := 0;
- FPictureOffsetY := 0;
- FDirty := True;
- end;
- destructor TSGFaceSettings.Destroy;
- begin
- FPhong.Free;
- FPicture.Free;
- inherited Destroy;
- end;
- procedure TSGFaceSettings.SetInnerColor(AValue: TColor);
- begin
- if FInnerColor = AValue then
- Exit;
- FInnerColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGFaceSettings.SetOuterColor(AValue: TColor);
- begin
- if FOuterColor = AValue then
- Exit;
- FOuterColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGFaceSettings.SetFillStyle(AValue: TSGFillStyle);
- begin
- if FFillStyle = AValue then
- Exit;
- FFillStyle := AValue;
- DirtyOnChange;
- end;
- procedure TSGFaceSettings.SetPicture(AValue: TPicture);
- begin
- if FPicture = AValue then
- Exit;
- FPicture := AValue;
- DirtyOnChange;
- end;
- procedure TSGFaceSettings.SetPictureEnabled(AValue: boolean);
- begin
- if FPictureEnabled = AValue then
- Exit;
- FPictureEnabled := AValue;
- DirtyOnChange;
- end;
- procedure TSGFaceSettings.SetPictureOffsetX(AValue: integer);
- begin
- if FPictureOffsetX = AValue then
- Exit;
- FPictureOffsetX := AValue;
- DirtyOnChange;
- end;
- procedure TSGFaceSettings.SetPictureOffsetY(AValue: integer);
- begin
- if FPictureOffsetY = AValue then
- Exit;
- FPictureOffsetY := AValue;
- DirtyOnChange;
- end;
- procedure TSGFaceSettings.SetLightIntensity(const AValue: integer);
- begin
- if AValue = FPhong.LightSourceIntensity then
- Exit;
- FPhong.LightSourceIntensity := AValue;
- DirtyOnChange;
- end;
- function TSGFaceSettings.GetLightIntensity: integer;
- begin
- Result := round(FPhong.LightSourceIntensity);
- end;
- procedure TSGFaceSettings.SetCurveExponent(const AValue: single);
- begin
- if FCurveExponent = AValue then
- Exit;
- FCurveExponent := AValue;
- DirtyOnChange;
- end;
- procedure TSGFaceSettings.SetOnChange(AValue: TNotifyEvent);
- begin
- FOnChange := AValue;
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- procedure TSGFaceSettings.DirtyOnChange;
- begin
- FDirty := True; // if we get here a prop must have changed, mark dirty
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- { TSGFrameSettings }
- constructor TSGFrameSettings.Create;
- begin
- FFrameColor := clBlack;
- FBorderColor := clGray;
- FBorderRadius := 2;
- FDirty := True;
- end;
- destructor TSGFrameSettings.Destroy;
- begin
- inherited Destroy;
- end;
- procedure TSGFrameSettings.SetBorderRadius(AValue: integer);
- begin
- if (FBorderRadius = AValue) or (AValue < 0) then
- Exit;
- FBorderRadius := AValue;
- DirtyOnChange;
- end;
- procedure TSGFrameSettings.SetFrameColor(AValue: TColor);
- begin
- if FFrameColor = AValue then
- Exit;
- FFrameColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGFrameSettings.SetBorderColor(AValue: TColor);
- begin
- if FBorderColor = AValue then
- Exit;
- FBorderColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGFrameSettings.SetOnChange(AValue: TNotifyEvent);
- begin
- FOnChange := AValue;
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- procedure TSGFrameSettings.DirtyOnChange;
- begin
- FDirty := True; // if we get here a prop must have changed, mark dirty
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- { TSGLEDSettings }
- constructor TSGLEDSettings.Create;
- begin
- FActiveColor := clRed;
- FInActiveColor := clBlack;
- FBorderColor := clGray;
- FSize := 10;
- FOffsetX := 0;
- FOffsetY := 50;
- FStyle := lsShaded;
- FDirty := True;
- end;
- destructor TSGLEDSettings.Destroy;
- begin
- inherited Destroy;
- end;
- procedure TSGLEDSettings.SetActive(AValue: boolean);
- begin
- if FActive = AValue then
- Exit;
- FActive := AValue;
- DirtyOnChange;
- end;
- // HACK, need to have a way to NOT dirty on change
- procedure TSGLEDSettings.SetActiveNoDoChange(AValue: boolean);
- begin
- if FActive = AValue then
- Exit;
- FActive := AValue;
- end;
- procedure TSGLEDSettings.SetActiveColor(AValue: TColor);
- begin
- if FActiveColor = AValue then
- Exit;
- FActiveColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGLEDSettings.SetInactiveColor(AValue: TColor);
- begin
- if FInactiveColor = AValue then
- Exit;
- FInActiveColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGLEDSettings.SetBorderColor(AValue: TColor);
- begin
- if FBorderColor = AValue then
- Exit;
- FBorderColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGLEDSettings.SetSize(AValue: integer);
- begin
- if FSize = AValue then
- Exit;
- FSize := AValue;
- DirtyOnChange;
- end;
- procedure TSGLEDSettings.SetOffsetX(AValue: integer);
- begin
- if FOffsetX = AValue then
- Exit;
- FOffsetX := AValue;
- DirtyOnChange;
- end;
- procedure TSGLEDSettings.SetOffsetY(AValue: integer);
- begin
- if FOffsetY = AValue then
- Exit;
- FOffsetY := AValue;
- DirtyOnChange;
- end;
- procedure TSGLEDSettings.SetStyle(AValue: TSGLEDStyle);
- begin
- if FStyle = AValue then
- Exit;
- FStyle := AValue;
- DirtyOnChange;
- end;
- procedure TSGLEDSettings.SetShape(AValue: TSGLEDShape);
- begin
- if FShape = AValue then
- Exit;
- FShape := AValue;
- DirtyOnChange;
- end;
- procedure TSGLEDSettings.SetOnChange(AValue: TNotifyEvent);
- begin
- FOnChange := AValue;
- // this will not dirty it, may need to not sure
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- procedure TSGLEDSettings.DirtyOnChange;
- begin
- FDirty := True; // if we get here a prop must have changed, mark dirty
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- { TSGRangeCheckLEDSettings }
- constructor TSGRangeCheckLEDSettings.Create;
- begin
- inherited Create;
- FRangeStartValue := 0;
- FRangeEndValue := 100;
- FRangeType := rcNone;
- FOffsetX := 90;
- FOffsetY := 120;
- end;
- destructor TSGRangeCheckLEDSettings.Destroy;
- begin
- inherited Destroy;
- end;
- procedure TSGRangeCheckLEDSettings.SetRangeStartValue(AValue: single);
- begin
- if (FRangeStartValue = AValue) or (AValue > FRangeEndValue) then
- Exit;
- FRangeStartValue := AValue;
- DirtyOnChange;
- end;
- procedure TSGRangeCheckLEDSettings.SetRangeEndValue(AValue: single);
- begin
- if (FRangeEndValue = AValue) or (AValue < FRangeStartValue) then
- Exit;
- FRangeEndValue := AValue;
- DirtyOnChange;
- end;
- procedure TSGRangeCheckLEDSettings.SetRangeType(AValue: TSGRangeCheckType);
- begin
- if FRangeType = AValue then
- Exit;
- FRangeType := AValue;
- DirtyOnChange;
- end;
- { TSGTextSettings }
- constructor TSGTextSettings.Create;
- begin
- FText := 'Gauge';
- OffsetX := 0;
- OffsetY := 50; // default should be clear of default cap radius when it's drawn
- FDirty := True;
- // create font, must free in dtor
- FFontEx := TBCFont.Create(nil);
- FFontEx.Color := clWhite;
- FFontEx.Style := [fsBold];
- FFontEx.Height := 24;
- end;
- destructor TSGTextSettings.Destroy;
- begin
- FFontEx.Free;
- inherited Destroy;
- end;
- procedure TSGTextSettings.SetEnabled(AValue: boolean);
- begin
- if FEnabled = AValue then
- Exit;
- FEnabled := AValue;
- DirtyOnChange;
- end;
- procedure TSGTextSettings.SetText(AValue: TCaption);
- begin
- if FText = AValue then
- Exit;
- FText := AValue;
- DirtyOnChange;
- end;
- procedure TSGTextSettings.SetOffsetX(AValue: integer);
- begin
- if FOffsetX = AValue then
- Exit;
- FOffsetX := AValue;
- DirtyOnChange;
- end;
- procedure TSGTextSettings.SetOffsetY(AValue: integer);
- begin
- if FOffsetY = AValue then
- Exit;
- FOffsetY := AValue;
- DirtyOnChange;
- end;
- procedure TSGTextSettings.SetOnChange(AValue: TNotifyEvent);
- begin
- FOnChange := AValue;
- // this will not dirty it, may need to not sure
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- procedure TSGTextSettings.DirtyOnChange;
- begin
- FDirty := True;
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- procedure TSGTextSettings.SetFontEx(AValue: TBCFont);
- begin
- FFontEx.Assign(AValue);
- FDirty := True;
- DirtyOnChange;
- end;
- {TSGMarkerSettings}
- constructor TSGMarkerSettings.Create;
- begin
- FEnabled := False;
- FColor := clLime;
- FHeight := 20;
- FWidth := 10;
- FRadius := 165;
- FStyle := msCenter;
- FDirty := True;
- FValue := 0.0;
- end;
- destructor TSGMarkerSettings.Destroy;
- begin
- inherited Destroy;
- end;
- procedure TSGMarkerSettings.SetValue(AValue: single);
- begin
- if FValue = AValue then
- Exit;
- FValue := AValue;
- DirtyOnChange;
- end;
- procedure TSGMarkerSettings.SetEnabled(AValue: boolean);
- begin
- if FEnabled = AValue then
- Exit;
- FEnabled := AValue;
- DirtyOnChange;
- end;
- procedure TSGMarkerSettings.SetColor(AValue: TColor);
- begin
- if FColor = AValue then
- Exit;
- FColor := AValue;
- DirtyOnChange;
- end;
- procedure TSGMarkerSettings.SetHeight(AValue: integer);
- begin
- if FHeight = AValue then
- Exit;
- FHeight := AValue;
- DirtyOnChange;
- end;
- procedure TSGMarkerSettings.SetRadius(AValue: integer);
- begin
- if FRadius = AValue then
- Exit;
- FRadius := AValue;
- DirtyOnChange;
- end;
- procedure TSGMarkerSettings.SetWidth(AValue: integer);
- begin
- if FWidth = AValue then
- Exit;
- FWidth := AValue;
- DirtyOnChange;
- end;
- procedure TSGMarkerSettings.SetOnChange(AValue: TNotifyEvent);
- begin
- FOnChange := AValue;
- // no dirty needed possibly, call directly
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- procedure TSGMarkerSettings.SetStyle(AValue: TSGMarkerStyle);
- begin
- if FStyle = AValue then
- Exit;
- FStyle := AValue;
- DirtyOnChange;
- end;
- procedure TSGMarkerSettings.DirtyOnChange;
- begin
- FDirty := True; // if we get here some props must have changed, mark dirty
- if Assigned(FOnChange) then
- FOnChange(Self);
- end;
- end.
|