diff --git a/components/industrialstuff/Example/A3nalogGaugeSample/demo.lpi b/components/industrialstuff/Example/A3nalogGaugeSample/demo.lpi new file mode 100644 index 000000000..6d9767498 --- /dev/null +++ b/components/industrialstuff/Example/A3nalogGaugeSample/demo.lpi @@ -0,0 +1,82 @@ + + + + + + + + + + <Scaled Value="True"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <XPManifest> + <DpiAware Value="True"/> + </XPManifest> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="LCL"/> + </Item1> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="demo.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="main.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="..\..\source\a3naloggauge.pas"/> + <IsPartOfProject Value="True"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="demo"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <OtherUnitFiles Value="..\..\source"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/components/industrialstuff/Example/A3nalogGaugeSample/demo.lpr b/components/industrialstuff/Example/A3nalogGaugeSample/demo.lpr new file mode 100644 index 000000000..3a16cc3c8 --- /dev/null +++ b/components/industrialstuff/Example/A3nalogGaugeSample/demo.lpr @@ -0,0 +1,14 @@ +program demo; + +uses + Interfaces, Forms, + main in 'main.pas' {MainForm}; + +{$R *.RES} + +begin + Application.Scaled:=True; + Application.Initialize; + Application.CreateForm(TMainForm, MainForm); + Application.Run; +end. diff --git a/components/industrialstuff/Example/A3nalogGaugeSample/main.lfm b/components/industrialstuff/Example/A3nalogGaugeSample/main.lfm new file mode 100644 index 000000000..af205f8b4 --- /dev/null +++ b/components/industrialstuff/Example/A3nalogGaugeSample/main.lfm @@ -0,0 +1,602 @@ +object MainForm: TMainForm + Left = 427 + Height = 483 + Top = 104 + Width = 779 + Caption = 'AntiAliased Analog Gauge demo' + ClientHeight = 483 + ClientWidth = 779 + Color = clBtnFace + Font.Color = clWindowText + OnCreate = FormCreate + Position = poDefaultPosOnly + LCLVersion = '1.9.0.0' + Scaled = False + object Panel1: TPanel + Left = 0 + Height = 216 + Top = 224 + Width = 779 + Align = alBottom + BevelOuter = bvNone + ClientHeight = 216 + ClientWidth = 779 + TabOrder = 0 + object MarginLabel: TLabel + Left = 8 + Height = 15 + Top = 120 + Width = 38 + Caption = 'Margin' + FocusControl = MarginEdit + ParentColor = False + end + object CenterLabel: TLabel + Left = 104 + Height = 15 + Top = 120 + Width = 70 + Caption = 'Center radius' + FocusControl = CenterRadEdit + ParentColor = False + end + object CircleLabel: TLabel + Left = 199 + Height = 15 + Top = 120 + Width = 65 + Caption = 'Circle radius' + FocusControl = CircleRadEdit + ParentColor = False + end + object ScaleLabel: TLabel + Left = 295 + Height = 15 + Top = 120 + Width = 58 + Caption = 'Scale value' + FocusControl = ScaleEdit + ParentColor = False + end + object AngleLabel: TLabel + Left = 393 + Height = 15 + Top = 120 + Width = 59 + Caption = 'Scale angle' + FocusControl = AngleEdit + ParentColor = False + end + object MinimLabel: TLabel + Left = 295 + Height = 15 + Top = 40 + Width = 53 + Caption = 'Minimum' + FocusControl = MinimEdit + ParentColor = False + end + object MaximLabel: TLabel + Left = 393 + Height = 15 + Top = 40 + Width = 54 + Caption = 'Maximum' + FocusControl = MaximEdit + ParentColor = False + end + object WidthLabel: TLabel + Left = 8 + Height = 15 + Top = 168 + Width = 65 + Caption = 'Arrow width' + FocusControl = WidthEdit + ParentColor = False + end + object NumMainLabel: TLabel + Left = 104 + Height = 15 + Top = 168 + Width = 54 + Caption = 'Main ticks' + FocusControl = NumMainEdit + ParentColor = False + end + object MainLenLabel: TLabel + Left = 199 + Height = 15 + Top = 168 + Width = 67 + Caption = 'Main length ' + FocusControl = MainLenEdit + ParentColor = False + end + object SubLenLabel: TLabel + Left = 295 + Height = 15 + Top = 168 + Width = 57 + Caption = 'Sub length' + FocusControl = SubLenEdit + ParentColor = False + end + object CaptionLabel: TLabel + Left = 393 + Height = 15 + Top = 168 + Width = 42 + Caption = 'Caption' + FocusControl = CaptionEdit + ParentColor = False + end + object FPSLabel: TLabel + Left = 498 + Height = 15 + Top = 24 + Width = 22 + Caption = 'FPS:' + ParentColor = False + end + object FreqLabel: TLabel + Left = 393 + Height = 15 + Top = 0 + Width = 89 + Caption = 'Timer delay (ms)' + FocusControl = FreqEdit + ParentColor = False + end + object AAModeLabel: TLabel + Left = 295 + Height = 15 + Top = 0 + Width = 62 + Caption = 'Antialiasing' + FocusControl = AAModeBox + ParentColor = False + end + object FaceColorButton: TButton + Left = 8 + Height = 25 + Top = 56 + Width = 88 + Caption = 'Face color' + OnClick = FaceColorButtonClick + TabOrder = 0 + end + object CenterColorButton: TButton + Left = 104 + Height = 25 + Top = 56 + Width = 88 + Caption = 'Center color' + OnClick = CenterColorButtonClick + TabOrder = 1 + end + object CenterRadEdit: TSpinEdit + Left = 104 + Height = 23 + Top = 136 + Width = 88 + MaxValue = 0 + OnChange = CenterRadEditChange + TabOrder = 2 + end + object CircleColorButton: TButton + Left = 199 + Height = 25 + Top = 56 + Width = 88 + Caption = 'Circle color' + OnClick = CircleColorButtonClick + TabOrder = 3 + end + object CircleRadEdit: TSpinEdit + Left = 199 + Height = 23 + Top = 136 + Width = 88 + MaxValue = 0 + OnChange = CircleRadEditChange + TabOrder = 4 + end + object MarginEdit: TSpinEdit + Left = 8 + Height = 23 + Top = 136 + Width = 88 + MaxValue = 0 + OnChange = MarginEditChange + TabOrder = 5 + end + object ScaleEdit: TSpinEdit + Left = 295 + Height = 23 + Top = 136 + Width = 88 + MaxValue = 0 + OnChange = ScaleEditChange + TabOrder = 6 + end + object AngleEdit: TSpinEdit + Left = 393 + Height = 23 + Top = 136 + Width = 88 + MaxValue = 0 + OnChange = AngleEditChange + TabOrder = 7 + end + object MinimEdit: TSpinEdit + Left = 295 + Height = 23 + Top = 56 + Width = 88 + MaxValue = 0 + OnChange = MinimEditChange + TabOrder = 8 + end + object MaximEdit: TSpinEdit + Left = 393 + Height = 23 + Top = 56 + Width = 88 + MaxValue = 0 + OnChange = MaximEditChange + TabOrder = 9 + end + object WidthEdit: TSpinEdit + Left = 8 + Height = 23 + Top = 184 + Width = 88 + MaxValue = 0 + OnChange = WidthEditChange + TabOrder = 10 + end + object NumMainEdit: TSpinEdit + Left = 104 + Height = 23 + Top = 184 + Width = 88 + MaxValue = 0 + OnChange = NumMainEditChange + TabOrder = 11 + end + object MainLenEdit: TSpinEdit + Left = 199 + Height = 23 + Top = 184 + Width = 75 + MaxValue = 0 + OnChange = MainLenEditChange + TabOrder = 12 + end + object SubLenEdit: TSpinEdit + Left = 295 + Height = 23 + Top = 184 + Width = 88 + MaxValue = 0 + OnChange = SubLenEditChange + TabOrder = 13 + end + object MarginBox: TCheckBox + Left = 490 + Height = 19 + Top = 84 + Width = 90 + Caption = 'Show margin' + OnClick = MarginBoxClick + TabOrder = 14 + end + object CirclesBox: TCheckBox + Left = 659 + Height = 19 + Top = 84 + Width = 85 + Caption = 'Show circles' + OnClick = CirclesBoxClick + TabOrder = 15 + end + object MainTicksBox: TCheckBox + Left = 490 + Height = 19 + Top = 100 + Width = 106 + Caption = 'Show main ticks' + OnClick = MainTicksBoxClick + TabOrder = 16 + end + object SubticksBox: TCheckBox + Left = 490 + Height = 19 + Top = 116 + Width = 98 + Caption = 'Show sub ticks' + OnClick = SubticksBoxClick + TabOrder = 17 + end + object IndMinBox: TCheckBox + Left = 490 + Height = 19 + Top = 132 + Width = 155 + Caption = 'Show indicator minimum' + OnClick = IndMinBoxClick + TabOrder = 18 + end + object IndMidBox: TCheckBox + Left = 490 + Height = 19 + Top = 148 + Width = 123 + Caption = 'Show indicator mid' + OnClick = IndMidBoxClick + TabOrder = 19 + end + object IndMaxBox: TCheckBox + Left = 490 + Height = 19 + Top = 164 + Width = 156 + Caption = 'Show indicator maximum' + OnClick = IndMaxBoxClick + TabOrder = 20 + end + object ValuesBox: TCheckBox + Left = 659 + Height = 19 + Top = 100 + Width = 85 + Caption = 'Show values' + OnClick = ValuesBoxClick + TabOrder = 21 + end + object CenterBox: TCheckBox + Left = 659 + Height = 19 + Top = 116 + Width = 85 + Caption = 'Show center' + OnClick = CenterBoxClick + TabOrder = 22 + end + object FrameBox: TCheckBox + Left = 659 + Height = 19 + Top = 132 + Width = 83 + Caption = 'Show frame' + OnClick = FrameBoxClick + TabOrder = 23 + end + object Draw3DBox: TCheckBox + Left = 659 + Height = 19 + Top = 148 + Width = 66 + Caption = 'Show 3D' + OnClick = Draw3DBoxClick + TabOrder = 24 + end + object CaptionBox: TCheckBox + Left = 659 + Height = 19 + Top = 164 + Width = 92 + Caption = 'Show caption' + OnClick = CaptionBoxClick + TabOrder = 25 + end + object CaptionEdit: TEdit + Left = 393 + Height = 23 + Top = 184 + Width = 377 + OnChange = CaptionEditChange + TabOrder = 26 + Text = 'CaptionEdit' + end + object FreqEdit: TSpinEdit + Left = 393 + Height = 23 + Top = 16 + Width = 88 + MaxValue = 0 + OnChange = FreqEditChange + TabOrder = 27 + end + object TicksColorButton: TButton + Left = 8 + Height = 25 + Top = 88 + Width = 88 + Caption = 'Ticks color' + OnClick = TicksColorButtonClick + TabOrder = 28 + end + object ValueColorButton: TButton + Left = 104 + Height = 25 + Top = 88 + Width = 88 + Caption = 'Values color' + OnClick = ValueColorButtonClick + TabOrder = 29 + end + object CaptionColorButton: TButton + Left = 199 + Height = 25 + Top = 88 + Width = 88 + Caption = 'Caption color' + OnClick = CaptionColorButtonClick + TabOrder = 30 + end + object ArrowColorButton: TButton + Left = 295 + Height = 25 + Top = 88 + Width = 88 + Caption = 'Arrow color' + OnClick = ArrowColorButtonClick + TabOrder = 31 + end + object MarginColorButton: TButton + Left = 393 + Height = 25 + Top = 88 + Width = 88 + Caption = 'Margin color' + OnClick = MarginColorButtonClick + TabOrder = 32 + end + object MinColorButton: TButton + Left = 490 + Height = 25 + Top = 56 + Width = 88 + Caption = 'Min color' + OnClick = MinColorButtonClick + TabOrder = 33 + end + object MidColorButton: TButton + Left = 584 + Height = 25 + Top = 56 + Width = 88 + Caption = 'Mid color' + OnClick = MidColorButtonClick + TabOrder = 34 + end + object MaxColorButton: TButton + Left = 678 + Height = 25 + Top = 56 + Width = 88 + Caption = 'Max color' + OnClick = MaxColorButtonClick + TabOrder = 35 + end + object AAModeBox: TComboBox + Left = 295 + Height = 23 + Top = 16 + Width = 88 + ItemHeight = 15 + Items.Strings = ( + 'None' + 'Biline' + 'Triline' + 'Quadral' + ) + OnChange = AAModeBoxChange + Style = csDropDownList + TabOrder = 36 + end + object StyleBox: TComboBox + Left = 199 + Height = 23 + Top = 16 + Width = 88 + ItemHeight = 15 + ItemIndex = 2 + Items.Strings = ( + 'Left' + 'Right' + 'Center' + ) + OnChange = StyleBoxChange + Style = csDropDownList + TabOrder = 37 + Text = 'Center' + end + object AAModeLabel1: TLabel + Left = 199 + Height = 15 + Top = 0 + Width = 25 + Caption = 'Style' + FocusControl = StyleBox + ParentColor = False + end + end + object Panel2: TPanel + Left = 0 + Height = 43 + Top = 440 + Width = 779 + Align = alBottom + BevelOuter = bvNone + ClientHeight = 43 + ClientWidth = 779 + TabOrder = 1 + object CloseButton: TButton + Left = 8 + Height = 25 + Top = 8 + Width = 88 + Caption = 'Close' + OnClick = CloseButtonClick + TabOrder = 0 + end + object AboutLabel: TLabel + Left = 96 + Height = 40 + Top = 0 + Width = 682 + Alignment = taCenter + Anchors = [akLeft, akRight, akBottom] + AutoSize = False + Caption = 'Anti Aliased Analog Gauge component demonstration. '#13#10'(c) Irnis Haliullin, http://www.irnis.net/' + Layout = tlCenter + ParentColor = False + OnClick = AboutLabelClick + OnMouseMove = AboutLabelMouseMove + end + end + object Panel3: TPanel + Left = 0 + Height = 224 + Top = 0 + Width = 779 + Align = alClient + BevelOuter = bvNone + TabOrder = 2 + end + object Timer: TTimer + Interval = 10 + OnTimer = TimerTimer + left = 88 + top = 112 + end + object ColorDialog: TColorDialog + Color = clBlack + CustomColors.Strings = ( + 'ColorA=000000' + 'ColorB=000080' + 'ColorC=008000' + 'ColorD=008080' + 'ColorE=800000' + 'ColorF=800080' + 'ColorG=808000' + 'ColorH=808080' + 'ColorI=C0C0C0' + 'ColorJ=0000FF' + 'ColorK=00FF00' + 'ColorL=00FFFF' + 'ColorM=FF0000' + 'ColorN=FF00FF' + 'ColorO=FFFF00' + 'ColorP=FFFFFF' + 'ColorQ=C0DCC0' + 'ColorR=F0CAA6' + 'ColorS=F0FBFF' + 'ColorT=A4A0A0' + ) + left = 224 + top = 120 + end +end diff --git a/components/industrialstuff/Example/A3nalogGaugeSample/main.pas b/components/industrialstuff/Example/A3nalogGaugeSample/main.pas new file mode 100644 index 000000000..3bc18bcab --- /dev/null +++ b/components/industrialstuff/Example/A3nalogGaugeSample/main.pas @@ -0,0 +1,684 @@ +unit main; + +{$DEFINE TICKER} + +{$IFDEF LCL} + {$MODE DELPHI} + {$IFNDEF WINDOWS}{$UNDEF TICKER}{$ENDIF} +{$ENDIF} + +interface + +uses + Windows, Messages, ShellApi, SysUtils, Classes, Graphics, Controls, + Forms, Dialogs, ExtCtrls, StdCtrls, Spin, A3nalogGauge; + +type + + { TMainForm } + + TMainForm = class(TForm) + Panel1: TPanel; + Panel2: TPanel; + Panel3: TPanel; + StyleBox: TComboBox; + AAModeLabel1: TLabel; + Timer: TTimer; + ColorDialog: TColorDialog; + FPSLabel: TLabel; + FreqLabel: TLabel; + FreqEdit: TSpinEdit; + + FaceColorButton: TButton; + CenterColorButton: TButton; + CircleColorButton: TButton; + MinimLabel: TLabel; + MinimEdit: TSpinEdit; + MaximLabel: TLabel; + MaximEdit: TSpinEdit; + MinColorButton: TButton; + MidColorButton: TButton; + MaxColorButton: TButton; + TicksColorButton: TButton; + ValueColorButton: TButton; + CaptionColorButton: TButton; + ArrowColorButton: TButton; + MarginColorButton: TButton; + MarginLabel: TLabel; + MarginEdit: TSpinEdit; + CenterLabel: TLabel; + CenterRadEdit: TSpinEdit; + CircleLabel: TLabel; + CircleRadEdit: TSpinEdit; + ScaleLabel: TLabel; + ScaleEdit: TSpinEdit; + AngleLabel: TLabel; + AngleEdit: TSpinEdit; + WidthLabel: TLabel; + WidthEdit: TSpinEdit; + NumMainLabel: TLabel; + NumMainEdit: TSpinEdit; + MainLenLabel: TLabel; + MainLenEdit: TSpinEdit; + SubLenLabel: TLabel; + SubLenEdit: TSpinEdit; + MarginBox: TCheckBox; + MainTicksBox: TCheckBox; + SubticksBox: TCheckBox; + IndMinBox: TCheckBox; + IndMidBox: TCheckBox; + IndMaxBox: TCheckBox; + CirclesBox: TCheckBox; + ValuesBox: TCheckBox; + CenterBox: TCheckBox; + FrameBox: TCheckBox; + Draw3DBox: TCheckBox; + CaptionBox: TCheckBox; + CaptionLabel: TLabel; + CaptionEdit: TEdit; + CloseButton: TButton; + AboutLabel: TLabel; + AAModeBox: TComboBox; + AAModeLabel: TLabel; + procedure FormCreate(Sender: TObject); + procedure StyleBoxChange(Sender: TObject); + procedure TimerTimer(Sender: TObject); + {$IFDEF TICKER} + procedure FramesChanged(Sender: TObject); + {$ENDIF} + + procedure AAModeBoxChange(Sender: TObject); + procedure FreqEditChange(Sender: TObject); + procedure FaceColorButtonClick(Sender: TObject); + procedure CenterColorButtonClick(Sender: TObject); + procedure CircleColorButtonClick(Sender: TObject); + procedure MinimEditChange(Sender: TObject); + procedure MaximEditChange(Sender: TObject); + procedure MinColorButtonClick(Sender: TObject); + procedure MidColorButtonClick(Sender: TObject); + procedure MaxColorButtonClick(Sender: TObject); + procedure TicksColorButtonClick(Sender: TObject); + procedure ValueColorButtonClick(Sender: TObject); + procedure CaptionColorButtonClick(Sender: TObject); + procedure ArrowColorButtonClick(Sender: TObject); + procedure MarginColorButtonClick(Sender: TObject); + procedure MarginEditChange(Sender: TObject); + procedure CenterRadEditChange(Sender: TObject); + procedure CircleRadEditChange(Sender: TObject); + procedure ScaleEditChange(Sender: TObject); + procedure AngleEditChange(Sender: TObject); + procedure WidthEditChange(Sender: TObject); + procedure NumMainEditChange(Sender: TObject); + procedure MainLenEditChange(Sender: TObject); + procedure SubLenEditChange(Sender: TObject); + procedure MarginBoxClick(Sender: TObject); + procedure MainTicksBoxClick(Sender: TObject); + procedure SubticksBoxClick(Sender: TObject); + procedure IndMinBoxClick(Sender: TObject); + procedure IndMidBoxClick(Sender: TObject); + procedure IndMaxBoxClick(Sender: TObject); + procedure CirclesBoxClick(Sender: TObject); + procedure ValuesBoxClick(Sender: TObject); + procedure CenterBoxClick(Sender: TObject); + procedure FrameBoxClick(Sender: TObject); + procedure Draw3DBoxClick(Sender: TObject); + procedure CaptionBoxClick(Sender: TObject); + procedure CaptionEditChange(Sender: TObject); + procedure CloseButtonClick(Sender: TObject); + procedure AboutLabelMouseMove(Sender: TObject; Shift: TShiftState; X, + Y: Integer); + procedure AboutLabelClick(Sender: TObject); + private + AnalogGauge1: TA3nalogGauge; + AnalogGauge2: TA3nalogGauge; + AnalogGauge3: TA3nalogGauge; + FDelta: Double; + end; + +var + MainForm: TMainForm; + +implementation + +{$IFDEF FPC} + {$R *.lfm} +{$ELSE} + {$R *.dfm} + {$DEFINE TICKER} +{$ENDIF} + +procedure TMainForm.FormCreate(Sender: TObject); +begin + AnalogGauge1 := TA3nalogGauge.Create(self); + with AnalogGauge1 do begin + Parent := Panel3; + Left := 8; + Top := 16; + Width := 278; + Height := 200; //245; + Anchors := [akLeft, akTop, akBottom]; + Angle := 90; + Caption := 'mV'; + AntiAliased := aaNone; + CaptionFont.Style := [fsBold]; + end; + AnalogGauge2 := TA3nalogGauge.Create(self); + with AnalogGauge2 do begin + Parent := Panel3; + Left := 295; + Top := 16; + Width := 185; + Height := 200; + Anchors := [akLeft, akRight, akTop, akBottom]; + Caption := 'mV'; + AntiAliased := aaNone; + CaptionFont.Style := [fsBold]; + end; + AnalogGauge3 := TA3nalogGauge.Create(self); + with AnalogGauge3 do begin + Parent := Panel3; + Left := 490; + Top := 16; + Width := 278; + Height := 200; //245; + Anchors := [akRight, akTop, akBottom]; + Angle := 180; + Caption := 'mV'; + AntiAliased := aaNone; + CaptionFont.Style := [fsBold]; + end; + + CenterRadEdit.Value := AnalogGauge1.CenterRadius; + CircleRadEdit.Value := AnalogGauge1.CircleRadius; + MarginEdit.Value := AnalogGauge1.Margin; + ScaleEdit.Value := AnalogGauge1.Scale; + AngleEdit.Value := AnalogGauge1.Angle; + MinimEdit.Value := AnalogGauge1.IndMinimum; + MaximEdit.Value := AnalogGauge1.IndMaximum; + WidthEdit.Value := AnalogGauge1.ArrowWidth; + NumMainEdit.Value := AnalogGauge1.NumberMainTicks; + MainLenEdit.Value := AnalogGauge1.LengthMainTicks; + SubLenEdit.Value := AnalogGauge1.LengthSubTicks; + MarginBox.Checked := foShowMargin in AnalogGauge1.FaceOptions; + CirclesBox.Checked := foShowCircles in AnalogGauge1.FaceOptions; + MainTicksBox.Checked := foShowMainTicks in AnalogGauge1.FaceOptions; + SubTicksBox.Checked := foShowSubTicks in AnalogGauge1.FaceOptions; + IndMinBox.Checked := foShowIndicatorMin in AnalogGauge1.FaceOptions; + IndMidBox.Checked := foShowIndicatorMid in AnalogGauge1.FaceOptions; + IndMaxBox.Checked := foShowIndicatorMax in AnalogGauge1.FaceOptions; + ValuesBox.Checked := foShowValues in AnalogGauge1.FaceOptions; + CenterBox.Checked := foShowCenter in AnalogGauge1.FaceOptions; + FrameBox.Checked := foShowFrame in AnalogGauge1.FaceOptions; + Draw3DBox.Checked := foShow3D in AnalogGauge1.FaceOptions; + CaptionBox.Checked := foShowCaption in AnalogGauge1.FaceOptions; + CaptionEdit.Text := AnalogGauge1.Caption; + FreqEdit.Value := Timer.Interval; + AAModeBox.ItemIndex := 0; + {$IFDEF TICKER} + AnalogGauge1.OnFrames := FramesChanged; + {$ENDIF} +end; + +procedure TMainForm.StyleBoxChange(Sender: TObject); +begin + AnalogGauge1.Style := TStyle(StyleBox.ItemIndex); + AnalogGauge2.Style := TStyle(StyleBox.ItemIndex); + AnalogGauge3.Style := TStyle(StyleBox.ItemIndex); +end; + +procedure TMainForm.TimerTimer(Sender: TObject); +var + V: Double; +begin + V := AnalogGauge1.Position; + if FDelta = 0 then FDelta := 1; + V := V + FDelta; + if V < 0 then begin + V := 0; + FDelta := -FDelta + end else + if V > AnalogGauge1.Scale then begin + V := AnalogGauge1.Scale; + FDelta := -FDelta + end; + AnalogGauge1.Position := V; + AnalogGauge2.Position := V; + AnalogGauge3.Position := V; +end; + +{$IFDEF TICKER} +procedure TMainForm.FramesChanged(Sender: TObject); +begin + FPSLabel.Caption := Format('FPS: %d', [AnalogGauge1.Frames]); +end; +{$ENDIF} + +procedure TMainForm.AAModeBoxChange(Sender: TObject); +var + AA: TAntialiased; +begin + case AAModeBox.ItemIndex of + 1: AA := aaBiline; + 2: AA := aaTriline; + 3: AA := aaQuadral; + else AA := aaNone + end; + AnalogGauge1.AntiAliased := AA; + AnalogGauge2.AntiAliased := AA; + AnalogGauge3.AntiAliased := AA; +end; + +procedure TMainForm.FreqEditChange(Sender: TObject); +begin + Timer.Interval := FreqEdit.Value +end; + +procedure TMainForm.FaceColorButtonClick(Sender: TObject); +begin + ColorDialog.Color := AnalogGauge1.FaceColor; + if ColorDialog.Execute then begin + AnalogGauge1.FaceColor := ColorDialog.Color; + AnalogGauge2.FaceColor := ColorDialog.Color; + AnalogGauge3.FaceColor := ColorDialog.Color; + end; +end; + +procedure TMainForm.CenterColorButtonClick(Sender: TObject); +begin + ColorDialog.Color := AnalogGauge1.CenterColor; + if ColorDialog.Execute then begin + AnalogGauge1.CenterColor := ColorDialog.Color; + AnalogGauge2.CenterColor := ColorDialog.Color; + AnalogGauge3.CenterColor := ColorDialog.Color; + end; +end; + +procedure TMainForm.CircleColorButtonClick(Sender: TObject); +begin + ColorDialog.Color := AnalogGauge1.CircleColor; + if ColorDialog.Execute then begin + AnalogGauge1.CircleColor := ColorDialog.Color; + AnalogGauge2.CircleColor := ColorDialog.Color; + AnalogGauge3.CircleColor := ColorDialog.Color; + end; +end; + +procedure TMainForm.MinimEditChange(Sender: TObject); +begin + if MinimEdit.Text <> '' then begin + AnalogGauge1.IndMinimum := MinimEdit.Value; + AnalogGauge2.IndMinimum := MinimEdit.Value; + AnalogGauge3.IndMinimum := MinimEdit.Value; + end; +end; + +procedure TMainForm.MaximEditChange(Sender: TObject); +begin + if MaximEdit.Text <> '' then begin + AnalogGauge1.IndMaximum := MaximEdit.Value; + AnalogGauge2.IndMaximum := MaximEdit.Value; + AnalogGauge3.IndMaximum := MaximEdit.Value; + end; +end; + +procedure TMainForm.MinColorButtonClick(Sender: TObject); +begin + ColorDialog.Color := AnalogGauge1.MinColor; + if ColorDialog.Execute then begin + AnalogGauge1.MinColor := ColorDialog.Color; + AnalogGauge2.MinColor := ColorDialog.Color; + AnalogGauge3.MinColor := ColorDialog.Color; + end; +end; + +procedure TMainForm.MidColorButtonClick(Sender: TObject); +begin + ColorDialog.Color := AnalogGauge1.MidColor; + if ColorDialog.Execute then begin + AnalogGauge1.MidColor := ColorDialog.Color; + AnalogGauge2.MidColor := ColorDialog.Color; + AnalogGauge3.MidColor := ColorDialog.Color; + end; +end; + +procedure TMainForm.MaxColorButtonClick(Sender: TObject); +begin + ColorDialog.Color := AnalogGauge1.MaxColor; + if ColorDialog.Execute then begin + AnalogGauge1.MaxColor := ColorDialog.Color; + AnalogGauge2.MaxColor := ColorDialog.Color; + AnalogGauge3.MaxColor := ColorDialog.Color; + end; +end; + +procedure TMainForm.TicksColorButtonClick(Sender: TObject); +begin + ColorDialog.Color := AnalogGauge1.TicksColor; + if ColorDialog.Execute then begin + AnalogGauge1.TicksColor := ColorDialog.Color; + AnalogGauge2.TicksColor := ColorDialog.Color; + AnalogGauge3.TicksColor := ColorDialog.Color; + end; +end; + +procedure TMainForm.ValueColorButtonClick(Sender: TObject); +begin + ColorDialog.Color := AnalogGauge1.ValueColor; + if ColorDialog.Execute then begin + AnalogGauge1.ValueColor := ColorDialog.Color; + AnalogGauge2.ValueColor := ColorDialog.Color; + AnalogGauge3.ValueColor := ColorDialog.Color; + end; +end; + +procedure TMainForm.CaptionColorButtonClick(Sender: TObject); +begin + ColorDialog.Color := AnalogGauge1.CaptionColor; + if ColorDialog.Execute then begin + AnalogGauge1.CaptionColor := ColorDialog.Color; + AnalogGauge2.CaptionColor := ColorDialog.Color; + AnalogGauge3.CaptionColor := ColorDialog.Color; + end; +end; + +procedure TMainForm.ArrowColorButtonClick(Sender: TObject); +begin + ColorDialog.Color := AnalogGauge1.ArrowColor; + if ColorDialog.Execute then begin + AnalogGauge1.ArrowColor := ColorDialog.Color; + AnalogGauge2.ArrowColor := ColorDialog.Color; + AnalogGauge3.ArrowColor := ColorDialog.Color; + end; +end; + +procedure TMainForm.MarginColorButtonClick(Sender: TObject); +begin + ColorDialog.Color := AnalogGauge1.MarginColor; + if ColorDialog.Execute then begin + AnalogGauge1.MarginColor := ColorDialog.Color; + AnalogGauge2.MarginColor := ColorDialog.Color; + AnalogGauge3.MarginColor := ColorDialog.Color; + end; +end; + +procedure TMainForm.MarginEditChange(Sender: TObject); +begin + if MarginEdit.Text <> '' then begin + AnalogGauge1.Margin := MarginEdit.Value; + AnalogGauge2.Margin := MarginEdit.Value; + AnalogGauge3.Margin := MarginEdit.Value; + end; +end; + +procedure TMainForm.CenterRadEditChange(Sender: TObject); +begin + if CenterRadEdit.Text <> '' then begin + AnalogGauge1.CenterRadius := CenterRadEdit.Value; + AnalogGauge2.CenterRadius := CenterRadEdit.Value; + AnalogGauge3.CenterRadius := CenterRadEdit.Value; + end; +end; + +procedure TMainForm.CircleRadEditChange(Sender: TObject); +begin + if CircleRadEdit.Text <> '' then begin + AnalogGauge1.CircleRadius := CircleRadEdit.Value; + AnalogGauge2.CircleRadius := CircleRadEdit.Value; + AnalogGauge3.CircleRadius := CircleRadEdit.Value; + end; +end; + +procedure TMainForm.ScaleEditChange(Sender: TObject); +begin + if ScaleEdit.Text <> '' then begin + AnalogGauge1.Scale := ScaleEdit.Value; + AnalogGauge2.Scale := ScaleEdit.Value; + AnalogGauge3.Scale := ScaleEdit.Value; + end; +end; + +procedure TMainForm.AngleEditChange(Sender: TObject); +begin + if AngleEdit.Text <> '' then begin + AnalogGauge1.Angle := AngleEdit.Value; + AnalogGauge2.Angle := AngleEdit.Value; + AnalogGauge3.Angle := AngleEdit.Value; + end; +end; + +procedure TMainForm.WidthEditChange(Sender: TObject); +begin + if WidthEdit.Text <> '' then begin + AnalogGauge1.ArrowWidth := WidthEdit.Value; + AnalogGauge2.ArrowWidth := WidthEdit.Value; + AnalogGauge3.ArrowWidth := WidthEdit.Value; + end; +end; + +procedure TMainForm.NumMainEditChange(Sender: TObject); +begin + if NumMainEdit.Text <> '' then begin + AnalogGauge1.NumberMainTicks := NumMainEdit.Value; + AnalogGauge2.NumberMainTicks := NumMainEdit.Value; + AnalogGauge3.NumberMainTicks := NumMainEdit.Value; + end; +end; + +procedure TMainForm.MainLenEditChange(Sender: TObject); +begin + if MainLenEdit.Text <> '' then begin + AnalogGauge1.LengthMainTicks := MainLenEdit.Value; + AnalogGauge2.LengthMainTicks := MainLenEdit.Value; + AnalogGauge3.LengthMainTicks := MainLenEdit.Value; + end; +end; + +procedure TMainForm.SubLenEditChange(Sender: TObject); +begin + if SubLenEdit.Text <> '' then begin + AnalogGauge1.LengthSubTicks := SubLenEdit.Value; + AnalogGauge2.LengthSubTicks := SubLenEdit.Value; + AnalogGauge3.LengthSubTicks := SubLenEdit.Value; + end; +end; + +procedure TMainForm.MarginBoxClick(Sender: TObject); +begin + if MarginBox.Checked then begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions + [foShowMargin]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions + [foShowMargin]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions + [foShowMargin]; + end else begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions - [foShowMargin]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions - [foShowMargin]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions - [foShowMargin]; + end; +end; + +procedure TMainForm.MainTicksBoxClick(Sender: TObject); +begin + if MainTicksBox.Checked then begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions + [foShowMainTicks]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions + [foShowMainTicks]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions + [foShowMainTicks]; + end else begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions - [foShowMainTicks]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions - [foShowMainTicks]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions - [foShowMainTicks]; + end; +end; + +procedure TMainForm.SubTicksBoxClick(Sender: TObject); +begin + if SubTicksBox.Checked then begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions + [foShowSubTicks]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions + [foShowSubTicks]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions + [foShowSubTicks]; + end else begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions - [foShowSubTicks]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions - [foShowSubTicks]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions - [foShowSubTicks]; + end; +end; + +procedure TMainForm.IndMinBoxClick(Sender: TObject); +begin + if IndMinBox.Checked then begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions + [foShowIndicatorMin]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions + [foShowIndicatorMin]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions + [foShowIndicatorMin]; + end else begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions - [foShowIndicatorMin]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions - [foShowIndicatorMin]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions - [foShowIndicatorMin]; + end; +end; + +procedure TMainForm.IndMidBoxClick(Sender: TObject); +begin + if IndMidBox.Checked then begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions + [foShowIndicatorMid]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions + [foShowIndicatorMid]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions + [foShowIndicatorMid]; + end else begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions - [foShowIndicatorMid]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions - [foShowIndicatorMid]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions - [foShowIndicatorMid]; + end; +end; + +procedure TMainForm.IndMaxBoxClick(Sender: TObject); +begin + if IndMaxBox.Checked then begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions + [foShowIndicatorMax]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions + [foShowIndicatorMax]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions + [foShowIndicatorMax]; + end else begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions - [foShowIndicatorMax]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions - [foShowIndicatorMax]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions - [foShowIndicatorMax]; + end; +end; + +procedure TMainForm.CirclesBoxClick(Sender: TObject); +begin + if CirclesBox.Checked then begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions + [foShowCircles]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions + [foShowCircles]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions + [foShowCircles]; + end else begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions - [foShowCircles]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions - [foShowCircles]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions - [foShowCircles]; + end; +end; + +procedure TMainForm.ValuesBoxClick(Sender: TObject); +begin + if ValuesBox.Checked then begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions + [foShowValues]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions + [foShowValues]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions + [foShowValues]; + end else begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions - [foShowValues]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions - [foShowValues]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions - [foShowValues]; + end; +end; + +procedure TMainForm.CenterBoxClick(Sender: TObject); +begin + if CenterBox.Checked then begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions + [foShowCenter]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions + [foShowCenter]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions + [foShowCenter]; + end else begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions - [foShowCenter]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions - [foShowCenter]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions - [foShowCenter]; + end; +end; + +procedure TMainForm.FrameBoxClick(Sender: TObject); +begin + if FrameBox.Checked then begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions + [foShowFrame]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions + [foShowFrame]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions + [foShowFrame]; + end else begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions - [foShowFrame]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions - [foShowFrame]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions - [foShowFrame]; + end; +end; + +procedure TMainForm.Draw3DBoxClick(Sender: TObject); +begin + if Draw3DBox.Checked then begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions + [foShow3D]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions + [foShow3D]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions + [foShow3D]; + end else begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions - [foShow3D]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions - [foShow3D]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions - [foShow3D]; + end; +end; + +procedure TMainForm.CaptionBoxClick(Sender: TObject); +begin + if CaptionBox.Checked then begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions + [foShowCaption]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions + [foShowCaption]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions + [foShowCaption]; + end else begin + AnalogGauge1.FaceOptions := AnalogGauge1.FaceOptions - [foShowCaption]; + AnalogGauge2.FaceOptions := AnalogGauge2.FaceOptions - [foShowCaption]; + AnalogGauge3.FaceOptions := AnalogGauge3.FaceOptions - [foShowCaption]; + end; +end; + +procedure TMainForm.CaptionEditChange(Sender: TObject); +begin + AnalogGauge1.Caption := CaptionEdit.Text; + AnalogGauge2.Caption := CaptionEdit.Text; + AnalogGauge3.Caption := CaptionEdit.Text; +end; + +procedure TMainForm.CloseButtonClick(Sender: TObject); +begin + Close +end; + +procedure TMainForm.AboutLabelMouseMove(Sender: TObject; + Shift: TShiftState; X, Y: Integer); +var + Control: TLabel; +begin + Control := Sender as TLabel; + if (X > 0) and (X < Control.Width) and + (Y > 0) and (Y < Control.Height) then begin + Control.Font.Style := Control.Font.Style + [fsUnderLine]; + Control.Cursor := crHandPoint; + Windows.SetCursor(Screen.Cursors[Control.Cursor]); + SetCaptureControl(Control); + end else begin + Control.Font.Style := Control.Font.Style - [fsUnderLine]; + Control.Cursor := crDefault; + SetCaptureControl(nil); + end; +end; + + +procedure TMainForm.AboutLabelClick(Sender: TObject); +var + Control: TLabel; +begin + Control := Sender as TLabel; + Control.Font.Style := Control.Font.Style - [fsUnderLine]; + Control.Cursor := crDefault; SetCaptureControl(nil); + ShellExecute(0, nil, PChar('http://www.irnis.net/'), nil, nil, SW_SHOWDEFAULT); +end; + +end. + diff --git a/components/industrialstuff/Example/Ex_IndustrialStuff.lpi b/components/industrialstuff/Example/Ex_IndustrialStuff.lpi index c6926d941..b8c582ee9 100644 --- a/components/industrialstuff/Example/Ex_IndustrialStuff.lpi +++ b/components/industrialstuff/Example/Ex_IndustrialStuff.lpi @@ -1,7 +1,7 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> <CONFIG> <ProjectOptions> - <Version Value="9"/> + <Version Value="11"/> <PathDelim Value="\"/> <General> <SessionStorage Value="InProjectDir"/> @@ -13,9 +13,6 @@ <i18n> <EnableI18N LFM="False"/> </i18n> - <VersionInfo> - <StringTable ProductVersion=""/> - </VersionInfo> <BuildModes Count="1"> <Item1 Name="Default" Default="True"/> </BuildModes> @@ -25,9 +22,10 @@ <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> </PublishOptions> <RunParams> - <local> - <FormatVersion Value="1"/> - </local> + <FormatVersion Value="2"/> + <Modes Count="1"> + <Mode0 Name="default"/> + </Modes> </RunParams> <RequiredPackages Count="2"> <Item1> @@ -41,7 +39,6 @@ <Unit0> <Filename Value="Ex_IndustrialStuff.lpr"/> <IsPartOfProject Value="True"/> - <UnitName Value="Ex_IndustrialStuff"/> </Unit0> <Unit1> <Filename Value="u_industrial.pas"/> @@ -49,7 +46,6 @@ <ComponentName Value="Form1"/> <HasResources Value="True"/> <ResourceBaseClass Value="Form"/> - <UnitName Value="u_industrial"/> </Unit1> </Units> </ProjectOptions> @@ -82,12 +78,6 @@ </Win32> </Options> </Linking> - <Other> - <CompilerMessages> - <MsgFileName Value=""/> - </CompilerMessages> - <CompilerPath Value="$(CompPath)"/> - </Other> </CompilerOptions> <Debugging> <Exceptions Count="3"> diff --git a/components/industrialstuff/Example/Ex_IndustrialStuff.res b/components/industrialstuff/Example/Ex_IndustrialStuff.res index e66ecf85f..0ad004b9d 100644 Binary files a/components/industrialstuff/Example/Ex_IndustrialStuff.res and b/components/industrialstuff/Example/Ex_IndustrialStuff.res differ diff --git a/components/industrialstuff/Example/u_industrial.lfm b/components/industrialstuff/Example/u_industrial.lfm index 863780a96..1d2d62156 100644 --- a/components/industrialstuff/Example/u_industrial.lfm +++ b/components/industrialstuff/Example/u_industrial.lfm @@ -1,12 +1,12 @@ object Form1: TForm1 - Left = 123 - Height = 166 - Top = 95 - Width = 568 + Left = 159 + Height = 223 + Top = 156 + Width = 824 Caption = 'IndustrialStuff Example' - ClientHeight = 166 - ClientWidth = 568 - LCLVersion = '1.1' + ClientHeight = 223 + ClientWidth = 824 + LCLVersion = '1.9.0.0' object indLed1: TindLed Left = 200 Height = 35 @@ -40,7 +40,6 @@ object Form1: TForm1 Height = 59 Top = 24 Width = 25 - Center = True Picture.Data = { 1754506F727461626C654E6574776F726B47726170686963EF00000089504E47 0D0A1A0A0000000D49484452000000150000002B08020000001805541C000000 @@ -55,23 +54,22 @@ object Form1: TForm1 State = slRED end object LEDNumber1: TLEDNumber - Left = 32 + Left = 40 Height = 28 - Top = 116 + Top = 128 Width = 177 Caption = 'Lazarus' - OffColor = 930866 - OnColor = clLime end object AnalogSensor1: TAnalogSensor Left = 256 - Height = 136 + Height = 152 Top = 8 Width = 153 + BevelOuter = bvNone BorderWidth = 2 BorderStyle = bsSingle Caption = 'level : ' - ClientHeight = 132 + ClientHeight = 148 ClientWidth = 149 Font.Height = -16 Font.Name = 'Arial' @@ -80,9 +78,9 @@ object Form1: TForm1 TabOrder = 0 ShowText = True ShowLevel = True - ColorFore = clLime - ColorBack = clBlack - Value = 20 + ColorRed = clYellow + ColorYellow = clRed + Value = 70 ValueMin = 0 ValueMax = 100 ValueRed = 30 @@ -91,7 +89,7 @@ object Form1: TForm1 end object indGnouMeter1: TindGnouMeter Left = 424 - Height = 129 + Height = 143 Top = 17 Width = 120 Caption = 'indGnouMeter1' @@ -109,7 +107,7 @@ object Form1: TForm1 Transparent = True GapTop = 20 GapBottom = 10 - BarThickness = 5 + BarThickness = 6 MarkerColor = clBlue ShowMarker = True end @@ -129,6 +127,31 @@ object Form1: TForm1 Kind = lkYellowLight State = lsOn Blink = False - AutoSize = True + end + object A3nalogGauge1: TA3nalogGauge + Left = 568 + Height = 192 + Top = 16 + Width = 241 + ArrowWidth = 2 + Caption = 'mV' + CaptionFont.Height = -16 + CaptionFont.Style = [fsBold] + CenterColor = clSilver + FaceOptions = [foShowMainTicks, foShowSubTicks, foShowIndicatorMin, foShowIndicatorMid, foShowIndicatorMax, foShowValues, foShowCenter, foShowFrame, foShowCaption] + IndMaximum = 60 + IndMinimum = 30 + Position = 70 + end + object TrackBar1: TTrackBar + Left = 32 + Height = 25 + Top = 184 + Width = 504 + Frequency = 10 + Max = 100 + OnChange = TrackBar1Change + Position = 70 + TabOrder = 2 end end diff --git a/components/industrialstuff/Example/u_industrial.pas b/components/industrialstuff/Example/u_industrial.pas index f52ac4ddb..7ff40133e 100644 --- a/components/industrialstuff/Example/u_industrial.pas +++ b/components/industrialstuff/Example/u_industrial.pas @@ -5,14 +5,15 @@ unit u_industrial; interface uses - Classes, SysUtils, FileUtil, IndLed, Sensors, LedNumber, - IndGnouMeter, AdvLed, Forms, Controls, Graphics, Dialogs, Arrow; + Classes, SysUtils, FileUtil, IndLed, Sensors, LedNumber, IndGnouMeter, AdvLed, + A3nalogGauge, Forms, Controls, Graphics, Dialogs, Arrow, ComCtrls; type { TForm1 } TForm1 = class(TForm) + A3nalogGauge1: TA3nalogGauge; AdvLed1: TAdvLed; AnalogSensor1: TAnalogSensor; Arrow1: TArrow; @@ -20,6 +21,8 @@ type indLed1: TindLed; LEDNumber1: TLEDNumber; StopLightSensor1: TStopLightSensor; + TrackBar1: TTrackBar; + procedure TrackBar1Change(Sender: TObject); private public @@ -35,5 +38,12 @@ implementation { TForm1 } +procedure TForm1.TrackBar1Change(Sender: TObject); +begin + A3nalogGauge1.Position := Trackbar1.Position; + indGnouMeter1.Value := Trackbar1.Position; + AnalogSensor1.Value := Trackbar1.Position; +end; + end. diff --git a/components/industrialstuff/industrial.lpk b/components/industrialstuff/industrial.lpk index 8d5b2fa90..c814084ac 100644 --- a/components/industrialstuff/industrial.lpk +++ b/components/industrialstuff/industrial.lpk @@ -1,9 +1,10 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> <CONFIG> <Package Version="4"> <PathDelim Value="\"/> <Name Value="industrial"/> - <Author Value="Jurassic Pork"/> + <Type Value="RunAndDesignTime"/> + <Author Value="Jurassic Pork; A3nalogGauge by Irnis Haliullin"/> <CompilerOptions> <Version Value="11"/> <PathDelim Value="\"/> @@ -23,17 +24,11 @@ <GenerateDebugInfo Value="False"/> </Debugging> </Linking> - <Other> - <CompilerMessages> - <MsgFileName Value=""/> - </CompilerMessages> - <CompilerPath Value="$(CompPath)"/> - </Other> </CompilerOptions> <Description Value="Industrial-themed (IPV/PCV) components and gauges (e.g. LEDs)."/> <License Value="MPL + GPL "/> - <Version Minor="1"/> - <Files Count="10"> + <Version Minor="2"/> + <Files Count="11"> <Item1> <Filename Value="source\indled.pas"/> <UnitName Value="IndLed"/> @@ -53,7 +48,7 @@ </Item4> <Item5> <Filename Value="source\indgnoumeter.pas"/> - <UnitName Value="IndGnouMeter"/> + <UnitName Value="indGnouMeter"/> </Item5> <Item6> <Filename Value="source\AdvLed.pas"/> @@ -75,8 +70,11 @@ <Filename Value="source\indcyTypes.pas"/> <UnitName Value="indcyTypes"/> </Item10> + <Item11> + <Filename Value="source\a3naloggauge.pas"/> + <UnitName Value="A3nalogGauge"/> + </Item11> </Files> - <Type Value="RunAndDesignTime"/> <RequiredPkgs Count="1"> <Item1> <PackageName Value="IDEIntf"/> diff --git a/components/industrialstuff/industrial.pas b/components/industrialstuff/industrial.pas index 1cff754a5..aa858d352 100644 --- a/components/industrialstuff/industrial.pas +++ b/components/industrialstuff/industrial.pas @@ -9,7 +9,8 @@ interface uses IndLed, Sensors, AllIndustrialRegister, LedNumber, indGnouMeter, AdvLed, - indcyBaseLed, indcyClasses, indcyGraphics, indcyTypes, LazarusPackageIntf; + indcyBaseLed, indcyClasses, indcyGraphics, indcyTypes, A3nalogGauge, + LazarusPackageIntf; implementation diff --git a/components/industrialstuff/resources/build.bat b/components/industrialstuff/resources/build.bat index bb2e2af88..00f78649b 100644 --- a/components/industrialstuff/resources/build.bat +++ b/components/industrialstuff/resources/build.bat @@ -1,3 +1,3 @@ -..\..\..\tools\lazres ..\source\sensors.res @sensors.txt -..\..\..\tools\lazres ..\source\industrial_icons.res @industrial_icons.txt -..\..\..\tools\lazres ..\source\ledbuttons.res @ledbuttons.txt \ No newline at end of file +lazres ..\source\sensors.res @sensors.txt +lazres ..\source\industrial_icons.res @industrial_icons.txt +lazres ..\source\ledbuttons.res @ledbuttons.txt \ No newline at end of file diff --git a/components/industrialstuff/resources/industrial_icons.txt b/components/industrialstuff/resources/industrial_icons.txt index 902790dc6..5fa942396 100644 --- a/components/industrialstuff/resources/industrial_icons.txt +++ b/components/industrialstuff/resources/industrial_icons.txt @@ -4,3 +4,4 @@ tindgnoumeter.png tindled.png tlednumber.png tstoplightsensor.png +ta3naloggauge.bmp diff --git a/components/industrialstuff/resources/ta3naloggauge.bmp b/components/industrialstuff/resources/ta3naloggauge.bmp new file mode 100644 index 000000000..9c0399b4a Binary files /dev/null and b/components/industrialstuff/resources/ta3naloggauge.bmp differ diff --git a/components/industrialstuff/source/AllIndustrialRegister.pas b/components/industrialstuff/source/AllIndustrialRegister.pas index ce61cd119..cbd55067c 100644 --- a/components/industrialstuff/source/AllIndustrialRegister.pas +++ b/components/industrialstuff/source/AllIndustrialRegister.pas @@ -11,7 +11,8 @@ interface uses - Classes, LResources, AdvLed, IndLed, LedNumber, Sensors, IndGnouMeter; + Classes, LResources, AdvLed, IndLed, LedNumber, Sensors, IndGnouMeter, + A3nalogGauge; procedure Register; @@ -23,7 +24,9 @@ implementation procedure Register; begin RegisterComponents ('Industrial',[ - TAdvLed, TIndLed, TLedNumber, TStopLightSensor, TAnalogSensor, TindGnouMeter]); + TAdvLed, TIndLed, TLedNumber, TStopLightSensor, + TAnalogSensor, TA3nalogGauge, TindGnouMeter + ]); end; diff --git a/components/industrialstuff/source/a3naloggauge.pas b/components/industrialstuff/source/a3naloggauge.pas new file mode 100644 index 000000000..13384969f --- /dev/null +++ b/components/industrialstuff/source/a3naloggauge.pas @@ -0,0 +1,1277 @@ +unit A3nalogGauge; + +{$DEFINE TICKER} + +{$IFDEF FPC} + {$MODE DELPHI} + {$IFNDEF WINDOWS} + {$UNDEF TICKER} + {$ENDIF} +{$ENDIF} + +interface + +uses + {$IFDEF LCL} + LCLIntf, LCLType, LCLProc, LMessages, + {$IFDEF TICKER} Windows,{$ENDIF} // for QueryPerformanceCounter + {$ELSE} + Windows, Messages, + {$ENDIF} + SysUtils, Classes, Graphics, Controls; + +type + TAntialiased = (aaNone, aaBiline, aaTriline, aaQuadral); + + TStyle = (agsLeftStyle, agsRightStyle, agsCenterStyle); + + TFaceOption = ( + foShowMargin, foShowCircles, foShowMainTicks, foShowSubTicks, + foShowIndicatorMin, foShowIndicatorMid, foShowIndicatorMax, + foShowValues, foShowCenter, foShowFrame, foShow3D, foShowCaption + ); + TFaceOptions = set of TFaceOption; + +const + DEFAULT_FACE_OPTIONS = [ + foShowMainTicks, foShowSubTicks, foShowIndicatorMax, + foShowValues, foShowCenter, foShowFrame, foShow3D, foShowCaption + ]; + +type + TA3nalogGauge = class(TCustomControl) + private + // face elements colors + FMinColor: TColor; + FMidColor: TColor; + FMaxColor: TColor; + FFaceColor: TColor; + FTicksColor: TColor; + FValueColor: TColor; + FCaptionColor: TColor; + FArrowColor: TColor; + FMarginColor: TColor; + FCenterColor: TColor; + FCircleColor: TColor; + FFrameColor: TColor; + // face elements sizes, etc. + FCenterRadius: Integer; + FCircleRadius: Integer; + FScaleAngle: Integer; + FMargin: Integer; + FStyle: TStyle; + FArrowWidth: Integer; + FNumMainTicks: Integer; + FLengthMainTicks: Integer; + FLengthSubTicks: Integer; + FFaceOptions: TFaceOptions; + FCaptionFont: TFont; + // values + FPosition: Single; + FScaleValue: Integer; + FMinimum: Integer; + FMaximum: Integer; + FCaption: string; + // event handlers + FOverMax: TNotifyEvent; + FOverMin: TNotifyEvent; + // anti-aliasing mode + FAntiAliased: TAntialiased; + // internal bitmaps + FBackBitmap: TBitmap; + FFaceBitmap: TBitmap; + FAABitmap: TBitmap; + {$IFDEF LCL} + FBitmapsValid: Boolean; + {$ENDIF} + {$IFDEF TICKER} + // performance tracking + FTicker: Int64; + FPeriod: Int64; + FFrames: Integer; + FOnFrames: TNotifyEvent; + {$ENDIF} + // set properties + procedure SetFrameColor(C: TColor); + procedure SetFMinColor(C: TColor); + procedure SetFMidColor(C: TColor); + procedure SetFMaxColor(C: TColor); + procedure SetFFaceColor(C: TColor); + procedure SetFTicksColor(C: TColor); + procedure SetFValueColor(C: TColor); + procedure SetFCaptionColor(C: TColor); + procedure SetFArrowColor(C: TColor); + procedure SetFMarginColor(C: TColor); + procedure SetFCenterColor(C: TColor); + procedure SetFCircleColor(C: TColor); + procedure SetFCenterRadius(I: Integer); + procedure SetFCircleRadius(I: Integer); + procedure SetFScaleAngle(I: Integer); + procedure SetFMargin(I: Integer); + procedure SetFStyle(S: TStyle); + procedure SetFArrowWidth(I: Integer); + procedure SetFNumMainTicks(I: Integer); + procedure SetFLengthMainTicks(I: Integer); + procedure SetFLengthSubTicks(I: Integer); + procedure SetFFaceOptions(O: TFaceOptions); + procedure SetFPosition(V: Single); + procedure SetFScaleValue(I: Integer); + procedure SetFMaximum(I: Integer); + procedure SetFMinimum(I: Integer); + procedure SetFCaption(const S: string); + procedure SetFAntiAliased(V: TAntialiased); + procedure SetCaptionFont(AValue: TFont); + function GetAAMultiplier: Integer; + + protected + procedure CaptionFontChanged(Sender: TObject); + procedure DrawScale(Bitmap: TBitmap; K: Integer); + procedure DrawArrow(Bitmap: TBitmap; K: Integer); + procedure FastAntiAliasPicture; + procedure Loaded; override; + procedure RedrawArrow; + procedure RedrawScale; + procedure Paint; override; + procedure Resize; override; + {$IFDEF LCL} + procedure FontChanged(Sender: TObject); override; + class function GetControlClassDefaultSize: TSize; override; + {$ELSE} + procedure CMFontChanged(var Msg: TMessage); message CM_FontChanged; + procedure WMEraseBkGnd(var Msg: TMessage); message WM_ERASEBKGND; + {$ENDIF} + + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + + published + property Angle: Integer + read FScaleAngle write SetFScaleAngle default 120; + property AntiAliased: TAntialiased + read FAntiAliased write SetFAntiAliased default aaNone; + property ArrowColor: TColor + read FArrowColor write SetFArrowColor default clBlack; + property ArrowWidth: Integer + read FArrowWidth write SetFArrowWidth default 1; + property Caption: string read FCaption write SetFCaption; + property CaptionColor: TColor + read FCaptionColor write SetFCaptionColor default clBlack; + property CaptionFont: TFont + read FCaptionFont write SetCaptionFont; + property CenterColor: TColor + read FCenterColor write SetFCenterColor default clDkGray; + property CenterRadius: Integer + read FCenterRadius write SetFCenterRadius default 8; + property CircleColor: TColor + read FCircleColor write SetFCircleColor default clBlue; + property CircleRadius: Integer + read FCircleRadius write SetFCircleRadius default 3; + property FaceColor: TColor + read FFaceColor write SetFFaceColor default clBtnFace; + property FaceOptions: TFaceOptions + read FFaceOptions write SetFFaceOptions default DEFAULT_FACE_OPTIONS; + property FrameColor: TColor + read FFrameColor write SetFramecolor default clBtnShadow; + property IndMaximum: Integer + read FMaximum write SetFMaximum default 80; + property IndMinimum: Integer + read FMinimum write SetFMinimum default 20; + property LengthMainTicks: Integer + read FLengthMainTicks write SetFLengthMainTicks default 15; + property LengthSubTicks: Integer + read FLengthSubTicks write SetFLengthSubTicks default 8; + property Margin: Integer + read FMargin write SetFMargin default 10; + property MarginColor: TColor + read FMarginColor write SetFMarginColor default clSilver; + property MaxColor: TColor + read FMaxColor write SetFMaxColor default clRed; + property MidColor: TColor + read FMidColor write SetFMidColor default clYellow; + property MinColor: TColor + read FMinColor write SetFMinColor default clGreen; + property NumberMainTicks: Integer + read FNumMainTicks write SetFNumMainTicks default 5; + property Position: Single read FPosition write SetFPosition; + property Scale: Integer + read FScaleValue write SetFScaleValue default 100; + property Style: TStyle + read FStyle write SetFStyle default agsCenterStyle; + property TicksColor: TColor + read FTicksColor write SetFTicksColor default clBlack; + property ValueColor: TColor + read FValueColor write SetFValueColor default clBlack; + property OnOverMax: TNotifyEvent read FOverMax write FOverMax; + property OnOverMin: TNotifyEvent read FOverMin write FOverMin; + {$IFDEF TICKER} + property OnFrames: TNotifyEvent read FOnFrames write FOnFrames; + property Frames: Integer read FFrames; + {$ENDIF} + + property Align; + property Anchors; + {$IFDEF LCL} + property BorderSpacing; + {$ENDIF} + property Font; + property Height default 180; + property Width default 225; + end; + +procedure Register; + +implementation + +uses + {$IFDEF LCL} + IntfGraphics, fpimage, + {$ENDIF} + Math; + +{$IFNDEF LCL} +function GetTickCount64: Int64; +begin + Result := GetTickCount; +end; +{$ENDIF} + + +{ TA3nalogGauge } + +constructor TA3nalogGauge.Create(AOwner: TComponent); +var + w, h: Integer; +begin + inherited; + FBackBitmap := TBitmap.Create; + FFaceBitmap := TBitmap.Create; + FAABitmap := nil; + //*****************************defaults:**************************************** + {$IFDEF LCL} + with GetControlClassDefaultSize do begin + SetInitialBounds(0, 0, CX, CY); + w := CX; + h := CY; + end; + {$ELSE} + w := 225; + h := 180; + Width := w; + Height := h; + {$ENDIF} + FBackBitmap.Width := w; + FBackBitmap.Height := h; + FBackBitmap.Canvas.Brush.Style := bsClear; + FBackBitmap.Canvas.Brush.Color := Self.Color; + FFaceBitmap.Width := w; + FFaceBitmap.Height := h; + FFaceColor := clBtnFace; + FFrameColor := clBtnShadow; + FTicksColor := clBlack; + FValueColor := clBlack; + FCaptionColor := clBlack; + FArrowColor := clBlack; + FMarginColor := clSilver; //Black; + FCenterColor := clDkGray; + FCircleColor := clBlue; + FMinColor := clGreen; + FMidColor := clYellow; + FMaxColor := clRed; + FArrowWidth := 1; + FPosition := 0; + FMargin := 10; + FStyle := agsCenterStyle; + FScaleValue := 100; + FMaximum := 80; + FMinimum := 20; + FScaleAngle := 120; + FCircleRadius := 3; + FCenterRadius := 8; + FNumMainTicks := 5; + FLengthMainTicks := 15; + FLengthSubTicks := 8; + FCaption := ''; + FFaceOptions := DEFAULT_FACE_OPTIONS; + FAntiAliased := aaNone; + FCaptionFont := TFont.Create; + FCaptionFont.OnChange := CaptionFontChanged; +{$IFDEF TICKER} + FTicker := -1; + FFrames := 0; + if not QueryPerformanceFrequency(FPeriod) then + FPeriod := 0; +{$ENDIF} +end; + +destructor TA3nalogGauge.Destroy; +begin + FBackBitmap.Free; + FFaceBitmap.Free; + FAABitmap.Free; + FCaptionFont.Free; + inherited; +end; +{ ------------------------------------------------------------------------- } +procedure SetPenStyles(Pen: TPen; Width: Integer; Color: TColor); +var + HP: HPen; + LB: TLOGBRUSH; +begin + {$IFDEF LCL} + Pen.Width := Width; + Pen.Color := Color; + {$ELSE} + LB.lbStyle := BS_SOLID; + LB.lbColor := Color; + LB.lbHatch := 0; + HP := ExtCreatePen(PS_GEOMETRIC or PS_SOLID or PS_ENDCAP_FLAT or + PS_JOIN_ROUND, Width, LB, 0, nil); + if HP = 0 then begin + Pen.Width := Width; + Pen.Color := Color + end else + Pen.Handle := HP; + {$ENDIF} +end; + +procedure TA3nalogGauge.CaptionFontChanged(Sender: TObject); +begin + RedrawScale; +end; + +procedure TA3nalogGauge.DrawScale(Bitmap: TBitmap; K: Integer); +var + I, J, X, Y, N, M, W, H, R: Integer; + Max, Min: Int64; + A, C, dA: Single; + hFnt, hCapFnt, hTxt, wTxt: Integer; + cosA, sinA: Extended; + cosB, sinB: Extended; + tm: TTextMetric; + pt: TPoint; + txt: String; + txtDist: Integer; +begin + W := Bitmap.Width; + H := Bitmap.Height; + Max := FMaximum; + Min := FMinimum; + N := FNumMainTicks*5; + M := FMargin * K; + R := FCircleRadius * K; + txtDist := 10; + + with Bitmap do begin + Canvas.Brush.Color := FFaceColor; + Canvas.FillRect(Canvas.ClipRect); + Canvas.Font.Assign(Font); + GetTextMetrics(Canvas.Handle, tm); + hfnt := tm.tmHeight * K; + Canvas.Font.Height := hFnt; + + { draw frame } + if foShowFrame in FFaceOptions then begin + if foShow3D in FFaceOptions then begin + Canvas.Pen.Width := 2*K; + Canvas.Pen.Color := clBtnShadow; + Canvas.MoveTo(W, 0); + Canvas.LineTo(0, 0); + Canvas.LineTo(0, H); + Canvas.Pen.Color := clBtnHighlight; + Canvas.LineTo(W, H); + Canvas.LineTo(W, 0); + end else begin + Canvas.Pen.Width := K; + Canvas.Pen.Color := FFrameColor; + Canvas.Rectangle(0, 0, W, H); + end; + end; + + { draw margins } + if foShowMargin in FFaceOptions then begin + Canvas.Pen.Color := FMarginColor; + Canvas.Pen.Width := K; + Canvas.Rectangle(M, M, W - M, H - M); + end; + + { calculate center of scale } + case fStyle of + agsRightStyle: + begin + A := 0; + C := W - M; + X := W - M; + Y := H - M; + if H > W then + J := W - 2*M + else + J := H - 2*M; + if FScaleAngle > 90 then FScaleAngle := 90; + end; + agsLeftStyle: + begin + A := 90; + C := M; + X := M; + Y := H - M; + if H > W then + J := W - 2*M + else + J := H - 2*M; + if FScaleAngle > 90 then FScaleAngle := 90; + end; + agsCenterStyle: + begin + X := W div 2; + A := (180 - fScaleAngle)/2; + C := W/2; + if FScaleAngle >= 180 then begin + J := (W - 2*M) div 2; + Y := H div 2; + end else begin + J := Round(((W - 2*M)/2) / cos(A*pi/180)); + if J > H - 2*M then J := H - 2*M; + Y := (H - J) div 2 + J; + end; + end; + else + raise Exception.Create('Style unknown.'); + end;{case} + + { Draw caption } + if (foShowCaption in FFaceOptions) then begin + SinCos(DegToRad(A + FScaleAngle/2), sinA, cosA); + Canvas.Font.Assign(FCaptionFont); + GetTextMetrics(Canvas.Handle, tm); + hCapFnt := tm.tmHeight * K; + Canvas.Font.Height := hcapFnt; + Canvas.Font.Color := FCaptionColor; + pt := Point(Round(C - J/2 * cosA), Round(Y - J/2 * sinA)); + Canvas.TextOut(pt.X - Canvas.TextWidth(FCaption) div 2, pt.Y, FCaption); + end; + + { Draw min/max indicator arcs } + if (foShowIndicatorMax in FFaceOptions) then begin + SetPenStyles(Canvas.Pen, 4 * K, FMaxColor); + SinCos(DegToRad(A + FScaleAngle), sinA, cosA); + SinCos(DegToRad(A + Max*FScaleAngle/FScaleValue), sinB, cosB); + Canvas.Arc(X - J, Y - J, X + J, Y + J, + Round(C - J * cosA), + Round(Y - J * sinA), + Round(C - J * cosB), + Round(Y - J * sinB) + ); + end; + if (foShowIndicatorMid in FFaceOptions) and (FMinimum < FMaximum) then begin + SetPenStyles(Canvas.Pen, 4 * K, FMidColor); + SinCos(DegToRad(A + Max*FScaleAngle/FScaleValue), sinA, cosA); + SinCos(DegToRad(A + Min*FScaleAngle/FScaleValue), sinB, cosB); + Canvas.Arc(X - J, Y - J, X + J, Y + J, + Round(C - J * cosA), + Round(Y - J * sinA), + Round(C - J * cosB), + Round(Y - J * sinB) + ); + end; + if (foShowIndicatorMin in FFaceOptions) then begin + SinCos(DegToRad(A + Min*FScaleAngle/FScaleValue), sinA, cosA); + SinCos(DegToRad(A), sinB, cosB); + SetPenStyles(Canvas.Pen, 4 * K, FMinColor); + Canvas.Arc(X - J, Y - J, X + J, Y + J, + Round(C - J * cosA), + Round(Y - J * sinA), + Round(C - J * cosB), + Round(Y - J * sinB) + ); + end; + Canvas.Pen.Color := FTicksColor; + Canvas.Pen.Width := K; + + { Draw subticks } + if foShowSubTicks in fFaceOptions then + for I := 0 to N do begin + SinCos(DegToRad(A + I*FScaleAngle/N), sinA, cosA); + Canvas.MoveTo(Round(C-(J-FLengthSubTicks*K)*cosA), Round(Y-(J-FLengthSubTicks*K)*sinA)); + Canvas.LineTo(round(C-(J-K)*cosA), round(Y-(J-K)*sinA)); + end; + + { Draw main ticks } + for I := 0 to FNumMainTicks do begin + dA := I * FScaleAngle / FNumMainTicks; + if foShowMainTicks in fFaceOptions then begin + SinCos(DegToRad(A + dA), sinA, cosA); + Canvas.MoveTo(Round(C-(J-FLengthMainTicks*K)*cosA), Round(Y-(J-FLengthMainTicks*K)*sinA)); + Canvas.LineTo(Round(C-(J-K)*cosA), Round(Y-(J-K)*sinA)); + end; + + { Draw circles } + if foShowCircles in fFaceOptions then begin + SinCos(DegToRad(A + dA), sinA, cosA); + Canvas.Brush.Color := FCircleColor; + pt := Point(Round(C - J*cosA), Round(Y - J*sinA)); + Canvas.Ellipse(pt.X - R, pt.Y - R, pt.X + R, pt.Y + R); + end; + + { Draw main tick values } + if foShowValues in fFaceOptions then begin + Canvas.Font.Assign(Self.Font); + Canvas.Font.Height := hFnt; + hTxt := Canvas.TextHeight('Tg'); + Canvas.Brush.Style := bsClear; + SinCos(DegToRad(A + dA), sinA, cosA); + txt := FormatFloat('0', I * fScaleValue div fNumMainTicks); + wTxt := Canvas.TextWidth(txt); + Canvas.TextOut( + Round(C-(J-(FLengthMainTicks+txtDist)*K-I)*cosA) - wTxt div 2, + Round(Y-(J-(FLengthMainTicks+txtDist)*K)*sinA) - hTxt div 2, + txt + ); + end; + end; + end +end; + +procedure TA3nalogGauge.DrawArrow(Bitmap: TBitmap; K: Integer); +var + J, X, Y, M, W, H, R: Integer; + A, C: Single; + cosA, sinA: Extended; +begin + M := FMargin * K; + R := FCenterRadius * K; + W := Bitmap.Width; + H := Bitmap.Height; + + with Bitmap do begin + case FStyle of + agsRightStyle: + begin + A := 0; + C := W - M; + X := W - M; // X, Y: position of center circle + Y := H - M; + if H > W then + J := W - 2*M // J: Arrow length + else + J := H - 2*M; + if FScaleAngle > 90 then FScaleAngle := 90; + end; + agsLeftStyle: + begin + A := 90; + C := M; + X := M; + Y := H - M; + if H > W then + J := W - 2*M + else + J := H - 2*M; + if FScaleAngle > 90 then FScaleAngle := 90; + end; + agsCenterStyle: + begin + X := W div 2; + A := (180 - fScaleAngle)/2; + C := W/2; + if FScaleAngle >= 180 then begin + J := (W - 2*M) div 2; + Y := H div 2; + end else begin + J := Round(((W - 2*M)/2)/cos(A*pi/180)); + if J > H - 2*M then J := H - 2*M; + Y := (H - J) div 2 + J; + end; + end; + else + raise Exception.Create('Style unknown'); + end;{case} + + SinCos((A + FPosition*FScaleAngle/FScaleValue)*pi/180, sinA, cosA); + Canvas.Pen.Width := FArrowWidth * K; + Canvas.Pen.Color := FArrowColor; + Canvas.MoveTo(X, Y); + Canvas.LineTo(Round(C - J*cosA), Round(Y - J*sinA)); + + { Draw center } + if foShowCenter in FFaceOptions then begin + Canvas.Brush.Color := FCenterColor; + Canvas.Pen.Width := 1; + Canvas.Ellipse(X - R, Y - R, X + R, Y + R); + end; + end; +end; + +procedure TA3nalogGauge.RedrawArrow; +{$IFDEF TICKER} +var + F: Integer; + ticker: Int64; +begin + if FTicker < 0 then + if FPeriod = 0 then + FTicker := GetTickCount64 + else + QueryPerformanceCounter(FTicker); +{$ELSE} +begin +{$ENDIF} + BitBlt( + FFaceBitmap.Canvas.Handle, 0, 0, + FBackBitmap.Width, + FBackBitmap.Height, + FBackBitmap.Canvas.Handle, 0, 0, + SRCCOPY + ); + DrawArrow(FFaceBitmap, GetAAMultiplier); + + if FAntialiased <> aaNone then + FastAntiAliasPicture; + + {$IFNDEF LCL} + Paint; + {$ENDIF} + + {$IFDEF TICKER} + if FPeriod = 0 then begin + ticker := GetTickCount64; + if ticker < FTicker then ticker := ticker + $100000000; + F := 1000 div (ticker - FTicker) + end else begin + QueryPerformanceCounter(ticker); + F := FPeriod div (ticker - FTicker) + end; + if F <> FFrames then begin + FFrames := F; + if Assigned(FOnFrames) then FOnFrames(Self) + end; + FTicker := -1; + + Invalidate; + {$ENDIF} +end; + +procedure TA3nalogGauge.RedrawScale; +begin + {$IFDEF TICKER} + if FPeriod = 0 then + FTicker := GetTickCount64 + else + QueryPerformanceCounter(FTicker); + {$ENDIF} + DrawScale(FBackBitmap, GetAAMultiplier); + RedrawArrow; + {$IFDEF LCL} + FBitmapsValid := true; + {$ENDIF} +end; + +{$IFDEF LCL} +procedure TA3nalogGauge.FastAntiAliasPicture; +var + intfImgAA: TLazIntfImage; + intfImgFace: TLazIntfImage; + totR, totG, totB: Integer; + x, dx, cx: Integer; + y, dy, cy: Integer; + k, k2: Integer; + imgHandle, imgMaskHandle: HBitmap; + clr: TFPColor; +begin + intfImgAA := TLazIntfImage.Create(FAABitmap.Width, FAABitmap.Height); + intfImgFace := TLazIntfImage.Create(FFaceBitmap.Width, FFaceBitmap.Height); + try + intfImgAA.LoadFromBitmap(FAABitmap.Handle, FAABitmap.MaskHandle); + intfImgFace.LoadFromBitmap(FFaceBitmap.Handle, FFaceBitmap.MaskHandle); + k := GetAAMultiplier; + k2 := k * k; + y := 0; + while y < intfImgAA.Height do begin + cy := y * k; + x := 0; + while x < intfImgAA.Width do begin + cx := x * k; + totR := 0; + totG := 0; + totB := 0; + for dy := 0 to k-1 do begin + for dx := 0 to k-1 do begin + clr := intfImgFace.Colors[cx+dx, cy+dy]; + totR := totR + clr.Red; + totG := totG + clr.Green; + totB := totB + clr.Blue; + end; + end; + clr := FPColor(totR div k2, totG div k2, totB div k2); + intfImgAA.Colors[x, y] := clr; + inc(x); + end; + inc(y); + end; + intfimgAA.CreateBitmaps(imgHandle, imgMaskHandle, false); + FAABitmap.Handle := imgHandle; + FAABitmap.MaskHandle := imgMaskHandle; + finally + intfImgAA.Free; + intfImgFace.Free; + end; +end; + +(* +// This code is faster than the version above, but crashes after a few seconds. + +procedure TA3nalogGauge.FastAntiAliasPicture; +const + MaxPixelCount = MaxInt div SizeOf(TRGBTriple); +type + PRGBArray = ^TRGBArray; + TRGBArray = array[0..MaxPixelCount-1] of TRGBTriple; +var + intfImgAA: TLazIntfImage; + intfImgFace: TLazIntfImage; + totR, totG, totB: Integer; + x, cx: Integer; + y, cy: Integer; + i, ci: Integer; + k, k2: Integer; + imgHandle, imgMaskHandle: HBitmap; + Row1, Row2, Row3, Row4, DestRow: PRGBArray; +begin + intfImgAA := TLazIntfImage.Create(FAABitmap.Width, FAABitmap.Height); + intfImgFace := TLazIntfImage.Create(FFaceBitmap.Width, FFaceBitmap.Height); + try + intfImgAA.LoadFromBitmap(FAABitmap.Handle, FAABitmap.MaskHandle); + FAABitmap.Clear; //ReleaseHandle; + intfImgFace.LoadFromBitmap(FFaceBitmap.Handle, FFaceBitmap.MaskHandle); + k := GetAAMultiplier; + k2 := k * k; + for y := 0 to intfImgAA.Height - 1 do begin + // We compute samples of k x k pixels + cy := y * k; + // Get pointer to rows in supersampled image + Row1 := intfImgFace.GetDataLineStart(cy); + if k > 1 then Row2 := intfImgFace.GetDataLineStart(cy + 1); + if k > 2 then Row3 := intfImgFace.GetDataLineStart(cy + 2); + if k > 3 then Row4 := intfImgFace.GetDataLineStart(cy + 3); + // Get a pointer to destination row in output image + DestRow := intfImgAA.GetDataLineStart(y); + // For each column... + for x := 0 to intfImgAA.Width - 1 do begin + // We compute samples of k x k pixels + cx := x * k; + // Initialize result colur + totR := 0; + totG := 0; + totB := 0; + if k > 3 then begin + for i := 0 to 3 do begin + ci := cx + i; + inc(totR, Row1[ci].rgbtRed + Row2[ci].rgbtRed + Row3[ci].rgbtRed + Row4[ci].rgbtRed); + inc(totG, Row1[ci].rgbtGreen + Row2[ci].rgbtGreen + Row3[ci].rgbtGreen + Row4[ci].rgbtGreen); + inc(totB, Row1[ci].rgbtBlue + Row2[ci].rgbtBlue + Row3[ci].rgbtBlue + Row4[ci].rgbtBlue); + end; + end else + if k > 2 then begin + for i := 0 to 2 do begin + ci := cx + i; + inc(totR, Row1[ci].rgbtRed + Row2[ci].rgbtRed + Row3[ci].rgbtRed); + inc(totG, Row1[ci].rgbtGreen + Row2[ci].rgbtGreen + Row3[ci].rgbtGreen); + inc(totB, Row1[ci].rgbtBlue + Row2[ci].rgbtBlue + Row3[ci].rgbtBlue); + end; + end else + if k > 1 then begin + for i := 0 to 1 do begin + ci := cx + i; + inc(totR, Row1[ci].rgbtRed + Row2[ci].rgbtRed); + inc(totG, Row1[ci].rgbtGreen + Row2[ci].rgbtGreen); + inc(totB, Row1[ci].rgbtBlue + Row2[ci].rgbtBlue); + end; + end; + DestRow[x].rgbtRed := totR div k2; + DestRow[x].rgbtGreen := totG div k2; + DestRow[x].rgbtBlue := totB div k2; + end; + end; + intfimgAA.CreateBitmaps(imgHandle, imgMaskHandle, false); + FAABitmap.Handle := imgHandle; + FAABitmap.MaskHandle := imgMaskHandle; + except + intfImgAA.Free; + intfImgFace.Free; + end; +end; + *) +{$ELSE} +const + MaxPixelCount = MaxInt div SizeOf(TRGBTriple); + +type + PRGBArray = ^TRGBArray; + TRGBArray = array[0..MaxPixelCount-1] of TRGBTriple; + +procedure TA3nalogGauge.FastAntiAliasPicture; +var + x, y, cx, cy, cxi: Integer; + totr, totg, totb: Integer; + Row1, Row2, Row3, Row4, DestRow: PRGBArray; + i, k: Integer; +begin + // For each row + K := GetAAMultiplier; + Row2 := nil; + Row3 := nil; + Row4 := nil; + for Y := 0 to FAABitmap.Height - 1 do begin + // We compute samples of K x K pixels + cy := y*K; + // Get pointers to actual, previous and next rows in supersampled bitmap + Row1 := FFaceBitmap.ScanLine[cy]; + if K > 1 then Row2 := FFaceBitmap.ScanLine[cy+1]; + if K > 2 then Row3 := FFaceBitmap.ScanLine[cy+2]; + if K > 3 then Row4 := FFaceBitmap.ScanLine[cy+3]; + // Get a pointer to destination row in output bitmap + DestRow := FAABitmap.ScanLine[y]; + // For each column... + for x := 0 to FAABitmap.Width - 1 do begin + // We compute samples of 3 x 3 pixels + cx := x*K; + // Initialize result color + totr := 0; totg := 0; totb := 0; + if K > 3 then begin + for i := 0 to 3 do begin + cxi := cx + i; + totr := totr + Row1[cxi].rgbtRed + Row2[cxi].rgbtRed + Row3[cxi].rgbtRed + Row4[cxi].rgbtRed; + totg := totg + Row1[cxi].rgbtGreen + Row2[cxi].rgbtGreen + Row3[cxi].rgbtGreen + Row4[cxi].rgbtGreen; + totb := totb + Row1[cxi].rgbtBlue + Row2[cxi].rgbtBlue + Row3[cxi].rgbtBlue + Row4[cxi].rgbtBlue; + end; + DestRow[x].rgbtRed := totr div 16; + DestRow[x].rgbtGreen := totg div 16; + DestRow[x].rgbtBlue := totb div 16; + end else if K > 2 then begin + for i := 0 to 2 do begin + cxi := cx + i; + totr := totr + Row1[cxi].rgbtRed + Row2[cxi].rgbtRed + Row3[cxi].rgbtRed; + totg := totg + Row1[cxi].rgbtGreen + Row2[cxi].rgbtGreen + Row3[cxi].rgbtGreen; + totb := totb + Row1[cxi].rgbtBlue + Row2[cxi].rgbtBlue + Row3[cxi].rgbtBlue; + end; + DestRow[x].rgbtRed := totr div 9; + DestRow[x].rgbtGreen := totg div 9; + DestRow[x].rgbtBlue := totb div 9; + end else if K > 1 then begin + for i := 0 to 1 do begin + cxi := cx + i; + totr := totr + Row1[cxi].rgbtRed + Row2[cxi].rgbtRed; + totg := totg + Row1[cxi].rgbtGreen + Row2[cxi].rgbtGreen; + totb := totb + Row1[cxi].rgbtBlue + Row2[cxi].rgbtBlue; + end; + DestRow[x].rgbtRed := totr div 4; + DestRow[x].rgbtGreen := totg div 4; + DestRow[x].rgbtBlue := totb div 4; + end else begin + DestRow[x].rgbtRed := Row1[cx].rgbtRed; + DestRow[x].rgbtGreen := Row1[cx].rgbtGreen; + DestRow[x].rgbtBlue := Row1[cx].rgbtBlue; + end; + end; + end; +end; +{$ENDIF} + +procedure TA3nalogGauge.Loaded; +begin + inherited; + RedrawScale; + //Invalidate; +end; + +procedure TA3nalogGauge.Paint; +begin + {$IFDEF LCL} + if not FBitmapsValid then + RedrawScale; + {$ENDIF} + + if FAntiAliased = aaNone then + Canvas.Draw(0, 0, FFaceBitmap) + else + Canvas.Draw(0, 0, FAABitmap); +end; + +{$IFNDEF LCL} (* +procedure TA3nalogGauge.WMSize(var Message: TWMSize); +var + K: Integer; +begin + if Width < 60 then Width := 60; + if Height < 50 then Height := 50; + if FAntiAliased = aaNone then begin + FBackBitmap.Width := Width; + FBackBitmap.Height := Height; + FFaceBitmap.Width := Width; + FFaceBitmap.Height := Height; + end else begin + K := GetAAMultiplier; + FBackBitmap.Width := Width * K; + FBackBitmap.Height := Height * K; + FFaceBitmap.Width := Width * K; + FFaceBitmap.Height := Height * K; + FAABitmap.Width := Width; + FAABitmap.Height := Height; + end; + RedrawScale; + inherited; +end; +*) + +procedure TA3nalogGauge.CMFontChanged(var Msg: TMessage); +begin + RedrawScale; +end; + +procedure TA3nalogGauge.WMEraseBkGnd(var Msg: TMessage); +begin + Msg.Result := 1; +end; +{$ENDIF} + +{$IFDEF LCL} +procedure TA3nalogGauge.FontChanged(Sender: TObject); +begin + inherited; + RedrawScale; +end; + +class function TA3nalogGauge.GetControlClassDefaultSize: TSize; +begin + Result.CX := 225; + Result.CY := 180; +end; +{$ENDIF} + +procedure TA3nalogGauge.Resize; +var + K: Integer; +begin + if Width < 60 then + Width := 60; + if Height < 50 then + Height := 50; + + if FAntiAliased = aaNone then begin + FBackBitmap.Width := Width; + FBackBitmap.Height := Height; + FFaceBitmap.Width := Width; + FFaceBitmap.Height := Height; + end else begin + K := GetAAMultiplier; + FBackBitmap.Width := Width * K; + FBackBitmap.Height := Height * K; + FFaceBitmap.Width := Width * K; + FFaceBitmap.Height := Height * K; + FAABitmap.Width := Width; + FAABitmap.Height := Height; + end; + {$IFDEF LCL} + FBitmapsValid := false; + {$ELSE} + RedrawScale; + {$ENDIF} + inherited; +end; +//{$ENDIF} + +procedure TA3nalogGauge.SetCaptionFont(AValue: TFont); +begin + FCaptionFont.Assign(AValue); +end; + +procedure TA3nalogGauge.SetFrameColor(C: TColor); +begin + if C <> FFrameColor then begin + FFrameColor := C; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFMinColor(C: TColor); +begin + if C <> FMinColor then begin + FMinColor := C; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFMidColor(C: TColor); +begin + if C <> FMidColor then begin + FMidColor := C; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFMaxColor(C: TColor); +begin + if C <> FMaxColor then begin + FMaxColor := C; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFFaceColor(C: TColor); +begin + if C <> FFaceColor then begin + FFaceColor := C; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFTicksColor(C: TColor); +begin + if C <> FTicksColor then begin + FTicksColor := C; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFValueColor(C: TColor); +begin + if C <> FValueColor then begin + FValueColor := C; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFCaptionColor(C: TColor); +begin + if C <> FCaptionColor then begin + FCaptionColor := C; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFArrowColor(C: TColor); +begin + if C <> FArrowColor then begin + FArrowColor := C; + RedrawArrow; + end; +end; + +procedure TA3nalogGauge.SetFMarginColor(C: TColor); +begin + if C <> FMarginColor then begin + FMarginColor := C; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFCenterColor(C: TColor); +begin + if C <> FCenterColor then begin + FCenterColor := C; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFCircleColor(C: TColor); +begin + if C <> FCircleColor then begin + FCircleColor := C; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFCenterRadius(I: Integer); +begin + if I <> FCenterRadius then begin + FCenterRadius := I; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFCircleRadius(I: Integer); +begin + if I <> FCircleRadius then begin + FCircleRadius := I; + RedrawScale; + end +end; + +procedure TA3nalogGauge.SetFScaleAngle(I: Integer); +begin + if I <> FScaleAngle then begin + if (I > 10) and (I <= 360) then + FScaleAngle := I; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFMargin(I: Integer); +begin + if I <> FMargin then begin + FMargin := I; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFStyle(S: TStyle); +begin + if S <> FStyle then begin + FStyle := S; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFArrowWidth(I: Integer); +begin + if I <> FArrowWidth then begin + if I < 1 then + FArrowWidth := 1 + else + if I > 5 then + FArrowWidth := 5 + else + FArrowWidth := i; + RedrawArrow; + end +end; + +procedure TA3nalogGauge.SetFNumMainTicks(I: Integer); +begin + if I <> FNumMainTicks then begin + FNumMainTicks := I; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFLengthMainTicks(I: Integer); +begin + if I <> FLengthMainTicks then begin + FLengthMainTicks := I; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFLengthSubTicks(I: Integer); +begin + if I <> FLengthSubTicks then begin + FLengthSubTicks := I; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFFaceOptions(O: TFaceOptions); +begin + if O <> FFaceOptions then begin + FFaceOptions := O; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFPosition(V: Single); +begin + if V <> FPosition then begin + FPosition := V; + if (FPosition > fMaximum) and Assigned(FOverMax) then OnOverMax(Self); + if (FPosition < fMinimum) and Assigned(FOverMin) then OnOverMin(Self); + RedrawArrow; + end +end; + +procedure TA3nalogGauge.SetFScaleValue(I: Integer); +begin + if I <> FScaleValue then begin + if I > 1 then begin + FScaleValue := I; + if FMaximum >= FScaleValue then FMaximum := FScaleValue - 1; + if FMinimum > FScaleValue - FMaximum then FMinimum := FScaleValue - fMaximum; + end; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFMaximum(I: Integer); +begin + if I <> FMaximum then begin + if (I > 0) and (I < FScaleValue) then + FMaximum := I; + RedrawScale; + end; +end; + +procedure TA3nalogGauge.SetFMinimum(I: Integer); +begin + if I <> FMinimum then begin + if (I > 0) and (I < FScaleValue) then + FMinimum := I; + RedrawScale; + end +end; + +procedure TA3nalogGauge.SetFCaption(const S: string); +begin + if S <> FCaption then begin + Canvas.Font := Font; + FCaption := S; + RedrawScale; + end +end; + +procedure TA3nalogGauge.SetFAntiAliased(V: TAntialiased); +var + K: Integer; +begin + if V <> FAntiAliased then begin + FAntiAliased := V; + if FAntiAliased = aaNone then begin + FreeAndNil(FAABitmap); + FreeAndNil(FBackBitmap); + FreeAndNil(FFaceBitmap); + FBackBitmap := TBitmap.Create; + FFaceBitmap := TBitmap.Create; + FBackBitmap.Width := Width; + FFaceBitmap.Width := Width; + FBackBitmap.Height := Height; + FFaceBitmap.Height := Height; + end else begin + K := GetAAMultiplier; + FBackBitmap.PixelFormat := pf24bit; + FFaceBitmap.PixelFormat := pf24bit; + FBackBitmap.Width := Width * K; + FFaceBitmap.Width := Width * K; + FBackBitmap.Height := Height * K; + FFaceBitmap.Height := Height * K; + if not Assigned(FAABitmap) then + FAABitmap := TBitmap.Create; + FAABitmap.PixelFormat := pf24bit; + FAABitmap.Width := Width; + FAABitmap.Height := Height; + end; + RedrawScale; + end +end; + +function TA3nalogGauge.GetAAMultiplier: Integer; +begin + Result := ord(FAntiAliased) + 1; + { + case FAntiAliased of + aaBiline : Result := 2; + aaTriline : Result := 3; + aaQuadral : Result := 4; + else Result := 1 + end + } +end; + + +{ Register } + +procedure Register; +begin + RegisterComponents('Industrial', [TA3nalogGauge]); +end; + +end. + + diff --git a/components/industrialstuff/source/a3naloggauge_readme.txt b/components/industrialstuff/source/a3naloggauge_readme.txt new file mode 100644 index 000000000..65e4abe57 --- /dev/null +++ b/components/industrialstuff/source/a3naloggauge_readme.txt @@ -0,0 +1,84 @@ +AntiAliased AnalogGauge component for Delphi +============================================ +2002, Irnis Haliullin (irnis@irnis.net) + +based on AnalogGauge component source +by Shteg Vyacheslav (slast@softhome.net), + +use the supersampling algoritm source +by Nacho Urenda (nurenda@wanadoo.es) + + +Overview +-------------------------------------------- +A3nalogGauge - simple component for displaying +floating point value as analog voltmeter. In +addition to AnalogGauge component, the A3nalogGauge +allow to use the supersampling antialiasing algorithm +for improvement the image quality. Besides, the +A3nalogGauge contains additional properties for +more powerfull control of the own face. And also +others, less significant improvements. + +Licenses +-------------------------------------------- +This component is free for use in any purposes. + +Contacts +-------------------------------------------- +All questons, bugreports and suggestions +please send by mail to: irnis@irnis.net + + +Reference +-------------------------------------------- +The component contains fallowing properties: + + - these properties define the voltmeter elements colors: + * MinColor: TColor - color of indicator of minimum range; + * MidColor: TColor - color of indicator of normal range; + * MaxColor: TColor - color of indicator of maximum range; + * FaceColor: TColor - voltmeter scale background color; + * TicksColor: TColor - voltmeter scale mark lines color; + * ValueColor: TColor - color of values on mark lines; + * CaptionColor: TColor - values unit name color; + * ArrowColor: TColor - voltmeter pointer arrow color; + * MarginColor: TColor - margin rectangle color; + * CenterColor: TColor - color of a knob on an axis of the pointer arrow; + * CircleColor: TColor - color of circles on mark lines; + + - these properties define the voltmeter elements sizes: + * CenterRadius: Integer - radius of a knob on an axis of the pointer arrow; + * CircleRadius: Integer - radius of circles on mark lines; + * Angle: Integer - the angle of scale segment; + * Margin: Integer - margin width; + * ArrowWidth: Integer - width of pointer arrow; + * LengthMainTicks: Integer - main (marked) tick lines length; + * LengthSubTicks: Integer - additional tick lines length; + * Style: TStyle read - the scale styles (left corner, on center and + right corner); + * NumberMainTicks: Integer - number of main tick lines; + * FaceOptions: TFaceOptions - defines what voltmeter elements will + be displayed; + + * Position: Single read - the value for display; + * Scale: Integer - the maximal value for display (minimal is always 0); + * IndMaximum: Integer - maximal value for normal range; + * IndMinimum: Integer - minimal value for normal range; + * Caption: string - this text will be displayed in the voltmeter centre; + * AntiAliased: TAntialiased = (aaNone, aaBiline, aaTriline, aaQuadral) - + Mode of smoothing. Accordingly: without smoothing, smoothing with + cells of 2x2, 3x3 and 4x4 pixels; + * OnOverMax: TNotifyEvent - this event is fired if the value reached + the maximum of normal range; + * OnOverMin: TNotifyEvent - the same for a minimum; + + - if you have set a "TICKER" condition, the component will calculate own + performance: + +{$IFDEF TICKER} + * Frames: Integer - last repaint speed, frames per second (FPS); + * OnFrames: TNotifyEvent - this event will fired when performance value + has been changed; +{$ENDIF} + diff --git a/components/industrialstuff/source/industrial_icons.res b/components/industrialstuff/source/industrial_icons.res index e95d08c64..cfcf3b06f 100644 Binary files a/components/industrialstuff/source/industrial_icons.res and b/components/industrialstuff/source/industrial_icons.res differ diff --git a/components/industrialstuff/source/ledbuttons.res b/components/industrialstuff/source/ledbuttons.res index dfa1b714f..d47dbcdd3 100644 Binary files a/components/industrialstuff/source/ledbuttons.res and b/components/industrialstuff/source/ledbuttons.res differ