New package for Industrial components, collected and modified by Jurassic Pork.
git-svn-id: trunk@41239 -
35
.gitattributes
vendored
@ -22,6 +22,41 @@ components/IdeLazLogger/languages/idelogger.po svneol=native#text/plain
|
||||
components/IdeLazLogger/languages/idelogger.pt_BR.po svneol=native#text/plain
|
||||
components/IdeLazLogger/languages/idelogger.ru.po svneol=native#text/plain
|
||||
components/IdeLazLogger/languages/idelogger.uk.po svneol=native#text/plain
|
||||
components/IndustrialStuff/Example/ButtonSamples/CMP_Button_Disa.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/Example/ButtonSamples/CMP_Button_Off.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/Example/ButtonSamples/CMP_Button_On.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/Example/Ex_IndustrialStuff.lpi svneol=native#text/plain
|
||||
components/IndustrialStuff/Example/Ex_IndustrialStuff.lpr svneol=native#text/pascal
|
||||
components/IndustrialStuff/Example/Ex_IndustrialStuff.res -text
|
||||
components/IndustrialStuff/Example/u_industrial.lfm svneol=native#text/plain
|
||||
components/IndustrialStuff/Example/u_industrial.pas svneol=native#text/pascal
|
||||
components/IndustrialStuff/industrial.lpk svneol=native#text/plain
|
||||
components/IndustrialStuff/industrial.pas svneol=native#text/pascal
|
||||
components/IndustrialStuff/resources/industrial_icons.lrs svneol=native#text/pascal
|
||||
components/IndustrialStuff/resources/stop_green.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/resources/stop_red.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/resources/stop_unknown.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/resources/stop_yellow.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/resources/tanalogsensor.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/resources/tgrarrow.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/resources/tindadvled.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/resources/tindgnoumeter.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/resources/tindled.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/resources/tlednumber.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/resources/tstoplightsensor.png -text svneol=unset#image/png
|
||||
components/IndustrialStuff/source/AllIndustrialRegister.pas svneol=native#text/pascal
|
||||
components/IndustrialStuff/source/cyBaseLed.pas svneol=native#text/pascal
|
||||
components/IndustrialStuff/source/cyBevel.pas svneol=native#text/pascal
|
||||
components/IndustrialStuff/source/cyClasses.pas svneol=native#text/pascal
|
||||
components/IndustrialStuff/source/cyGraphics.pas svneol=native#text/pascal
|
||||
components/IndustrialStuff/source/cyTypes.pas svneol=native#text/pascal
|
||||
components/IndustrialStuff/source/indadvled.pas svneol=native#text/pascal
|
||||
components/IndustrialStuff/source/indgnoumeter.pas svneol=native#text/pascal
|
||||
components/IndustrialStuff/source/indled.pas svneol=native#text/pascal
|
||||
components/IndustrialStuff/source/industrial_icons.lrs svneol=native#text/pascal
|
||||
components/IndustrialStuff/source/lednumber.pas svneol=native#text/pascal
|
||||
components/IndustrialStuff/source/sensors.lrs svneol=native#text/pascal
|
||||
components/IndustrialStuff/source/sensors.pas svneol=native#text/pascal
|
||||
components/PascalScript/README.lazarus.txt svneol=native#text/pascal
|
||||
components/PascalScript/Samples/Console/sample1.dpr svneol=native#text/pascal
|
||||
components/PascalScript/Samples/Console/sample2.dpr svneol=native#text/pascal
|
||||
|
||||
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
105
components/IndustrialStuff/Example/Ex_IndustrialStuff.lpi
Normal file
@ -0,0 +1,105 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="Ex_IndustrialStuff"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="industrial"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="Ex_IndustrialStuff.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="Ex_IndustrialStuff"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="u_industrial.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="u_industrial"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="Ex_IndustrialStuff"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Checks>
|
||||
<IOChecks Value="True"/>
|
||||
<RangeChecks Value="True"/>
|
||||
<OverflowChecks Value="True"/>
|
||||
<StackChecks Value="True"/>
|
||||
</Checks>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="2"/>
|
||||
</Optimizations>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<MsgFileName Value=""/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
||||
21
components/IndustrialStuff/Example/Ex_IndustrialStuff.lpr
Normal file
@ -0,0 +1,21 @@
|
||||
program Ex_IndustrialStuff;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, u_industrial
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource := True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
||||
BIN
components/IndustrialStuff/Example/Ex_IndustrialStuff.res
Normal file
181
components/IndustrialStuff/Example/u_industrial.lfm
Normal file
@ -0,0 +1,181 @@
|
||||
object Form1: TForm1
|
||||
Left = 123
|
||||
Height = 166
|
||||
Top = 95
|
||||
Width = 568
|
||||
Caption = 'IndustrialStuff Example'
|
||||
ClientHeight = 166
|
||||
ClientWidth = 568
|
||||
LCLVersion = '1.1'
|
||||
object indAdvLed1: TindAdvLed
|
||||
Left = 95
|
||||
Height = 36
|
||||
Top = 32
|
||||
Width = 36
|
||||
AllowAllOff = True
|
||||
LedValue = True
|
||||
PictureOn.Data = {
|
||||
1754506F727461626C654E6574776F726B47726170686963F206000089504E47
|
||||
0D0A1A0A0000000D4948445200000020000000200806000000737A7AF4000000
|
||||
1974455874536F6674776172650041646F626520496D616765526561647971C9
|
||||
653C000006944944415478DA94575F845C5718FF921DC919865CB1E53EACBA65
|
||||
CA7D489987D02DA123842155FBB00FA37D4929DD5212A9B2512AAA64B5124A54
|
||||
5EAAD5684DB5641E1A96444CDE56A58CB6EA3E2CBD62CAA5639D65C851B3F4F7
|
||||
7DE73B77EE5477B3B96BF6DC7BFE7CDFEFFB7D7FCE3947DCD45178FABD3E39FC
|
||||
19FCF996CA2FAABC6BFB12DA6368F7D00EB97FA5DBA567798E2F1CA75AB5C3FD
|
||||
4745E825320DF49D43CF2A463A9871924A6065BBDBEBF5EEE1EB7BCCBDD7ED76
|
||||
770F03E2C8FE0CB06857C7FF77D1F711FA4ECC80A18DE212AAB576B6C2CFD9C5
|
||||
D706BE3E072B4F0E62600E002C2815E07915A2BE8190E759701447142FC6142F
|
||||
41714D67D5A87413394BF9A8203BB654147970D95F58FF1640DC3B140066401D
|
||||
F11E445EC7DB31569A365301405328AEA1778A69C179E15D5B06941705E5790E
|
||||
2005CFD8C3AA4B2BDD959B876040007C88059F30906429A1F474CB0B67C1932D
|
||||
08EF536E07A03D53D2F98929895A942CAE50BAD401C8480CC98699B0A271B401
|
||||
10579EC2406F15CD0FDCB37C7A99E238163E9CCB68B07D95F2F1A0B4DA05EB35
|
||||
4E4B3050DE6EAE53ABB90620CC464ED9A361889E3701E2BBFF0500FA9B50F52B
|
||||
A6D5D334A52489456831DEA4FEF61A94414403B69A046D44111405E82C8303B1
|
||||
B039D9C2BB288DDBD43DF3B5B0918F00E2F7214F45409A9701E2B700E0682505
|
||||
AF03619D834C94C3DF59D1A37E764194471C0B4B6D8A220000E5164A2C5BEE3C
|
||||
13C64418871B9A0945003ACC0774EBA70EE65909DC18EEC4AC3AF47C5175C351
|
||||
F5FD19287F9D580804B005C56400DAD7655212A7942EB6A49F15B2C541B158EF
|
||||
8C8C31A0083292660B400DE8CFA877FF92F8273D95823976833903579F9F0380
|
||||
1917D98331473AE732846E4139B711F29DADB6A2D967BBD35C1120530D0205C3
|
||||
CCF1789A241214C3AC4FC3D12600BB32A63070B10480DCAF03D579897A9D2091
|
||||
3EC92806E2346EC9E2A080DDC132CCD4A8FFA932A6ED846B841179DCD71F5C95
|
||||
0065005A5FCF22E69E1300507E164AEB6CA9D37CCEC63D69D9F2AA55FEF1D5CE
|
||||
33A085681AAA60C8100F32E2A20552B9306523094289258C2F70691700787945
|
||||
12842501B99DA088D82D0FA081C9CED73AEFF340B9065E60404198E93C18EFC2
|
||||
48C68719DC80800CC50A3A5BCA0035C52E5066514EA5C030FAC894D64A0A86FD
|
||||
B1E2F7595B29E03CD3A9AB580D00F02707A445941A43619F15BD28ACE684E0AD
|
||||
3929B5C5242F2DE3BC1615CC428D5468B05899912F009FFAF501860F5A2763CC
|
||||
96B5C50C9437E6A40030E20FA3B55CF7FD92EE42526B9E7A3753CE6E9856DD10
|
||||
A2C46F545C0F48C75DA89EB3FD7641D3D0EC1A15E605C65ED064A69034E725B6
|
||||
A63340072A675F1B5DC7735111C37CDDBA773408E9CFE05BF1BA8925C50A1B02
|
||||
0AF4D5BC4F5DC877AA581618933852E53E7C449E1DF9790917B2B069785B1E6B
|
||||
10BA5F04B5734A0EEA7CA32533EC5877F5B02E30E066EF66EA15F38FD4722ABF
|
||||
11D885079B262D8911C904EF829F0303382CB83D3BF10B380EE2A8E30367AC41
|
||||
56ABF870CE9FDA1A556AF427EF28C5DB5CD450801653FC121FC89312FF430180
|
||||
B3DB0E6C7CC07EE1346110E922361DEC7A8C5E136176429CCEE836C1CF656BF4
|
||||
DD0775BEE519EA2C5F90347748738D8187D0FBB8DC0BD0B1212AF86CA7142EA7
|
||||
5765844F5742A3820816562D96808302691B5EF9D67D5FBCD2B443AD74D9B368
|
||||
43E29A9B739B11CE6C0FD0DCE55CE6331D5B9080B2766BDD5B92F96062049C5A
|
||||
7C2E9014336A2D7E010C3336F8D1491B63175D7B6D5D26B25C66003387007127
|
||||
00A855CE0357B0FE5C61DD31D3B072E868F1F1AA6D6433C973386AC4F59D0593
|
||||
D478562E010CBF16182F461E2C3F2D587E61E592A072133EAC48F6FF033DEF80
|
||||
FEBDFD8EE56F40DCB73C3569621B363E9F8A714E9B8F6E493DA74ADE878A597D
|
||||
8FB17F74DA6BD45EEE685143206EE7A1ACBF0DE55F3EED587E0D13D78DEE5CF1
|
||||
923F23701D28C6056D01448EE8CA01CA59EB8FA4A03AC1CE999E6AC3F2B63203
|
||||
C56366250FC5F70694BFFFD463B916CACBE8FD94CB25EF6611388F1AFED463C2
|
||||
113C6C54D5EAAE55D0590FD60394DE2B88B38D67B99ADDC0B23FF0F5150E9B31
|
||||
FB2F5E4494232E0C58915535BFFD4AEA4DFDBAC216A572BDB0EC401A4EC2DDCD
|
||||
FD6E4773004CE53A8A078BDC8BE8BD8CAF0F8AB16B58A61D9525149A12B8F3C7
|
||||
B3CA7A2E6B37F0FE19944F0EBA1B1E7039154013BC7F8CD79BF83E8FDE558C9E
|
||||
C36E582744B69BBBA09A277C29457B07ED5DF8FBEFC35C4EF76560064246502D
|
||||
E9367A6FABC74F62F485CA551D1B1AED749FF17ACECFBF020C008B84F5EC1E85
|
||||
E8620000000049454E44AE426082
|
||||
}
|
||||
end
|
||||
object indLed1: TindLed
|
||||
Left = 175
|
||||
Height = 35
|
||||
Top = 33
|
||||
Width = 34
|
||||
LedValue = False
|
||||
Bevels = <
|
||||
item
|
||||
HighlightColor = clBlack
|
||||
ShadowColor = clBlack
|
||||
end
|
||||
item
|
||||
Width = 3
|
||||
end
|
||||
item
|
||||
Style = bcLowered
|
||||
end
|
||||
item
|
||||
HighlightColor = clBlack
|
||||
ShadowColor = clBlack
|
||||
end>
|
||||
LedColorOn = clLime
|
||||
LedColorOff = clGreen
|
||||
LedColorDisabled = 22963
|
||||
ShapeLedColorOn = clGreen
|
||||
ShapeLedColorOff = 16384
|
||||
ShapeLedColorDisabled = 13416
|
||||
end
|
||||
object StopLightSensor1: TStopLightSensor
|
||||
Left = 32
|
||||
Height = 59
|
||||
Top = 24
|
||||
Width = 25
|
||||
Center = True
|
||||
Picture.Data = {
|
||||
1754506F727461626C654E6574776F726B47726170686963EF00000089504E47
|
||||
0D0A1A0A0000000D49484452000000150000002B08020000001805541C000000
|
||||
B649444154789CED94010E84200C04FBF47B9A3FE304142AB5AD5B721763DCA0
|
||||
21C1D9D6BA919639D17A7DA24A296D3CE15AC11FF3ADCF089F5F8FA8AED3072C
|
||||
9EC39A85CA77389FAB161E5F15E7C5FA173F3B3F69017FBF6611CF8FABFBE7BF
|
||||
DCFB1EE08FF0B985959F8A9523D5C2E22B9C7F6FAC0B8017CDE3F5A505967F1B
|
||||
76F8C1E2CD3FCEEFD363FBEB3C87350B277F54226C58983CCB7FB3C0F2CF2B47
|
||||
EA4B0B2CFF36ECF083C5F3F3BF84B4F169427D48317D01F81FF539473C105700
|
||||
00000049454E44AE426082
|
||||
}
|
||||
State = slRED
|
||||
end
|
||||
object LEDNumber1: TLEDNumber
|
||||
Left = 32
|
||||
Height = 28
|
||||
Top = 116
|
||||
Width = 177
|
||||
Caption = 'Lazarus'
|
||||
OffColor = 930866
|
||||
OnColor = clLime
|
||||
end
|
||||
object AnalogSensor1: TAnalogSensor
|
||||
Left = 240
|
||||
Height = 136
|
||||
Top = 8
|
||||
Width = 153
|
||||
BorderWidth = 2
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'Test'
|
||||
ClientHeight = 132
|
||||
ClientWidth = 149
|
||||
Font.Height = -16
|
||||
Font.Name = 'Arial'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
ShowText = True
|
||||
ShowLevel = True
|
||||
ColorFore = clLime
|
||||
ColorBack = clBlack
|
||||
Value = 20
|
||||
ValueMin = 0
|
||||
ValueMax = 100
|
||||
ValueRed = 30
|
||||
ValueYellow = 60
|
||||
AnalogKind = akVertical
|
||||
end
|
||||
object indGnouMeter1: TindGnouMeter
|
||||
Left = 424
|
||||
Height = 129
|
||||
Top = 17
|
||||
Width = 120
|
||||
Caption = 'indGnouMeter1'
|
||||
Value = 70
|
||||
ColorFore = clRed
|
||||
ColorBack = clBtnFace
|
||||
SignalUnit = 'Units'
|
||||
ValueMin = 0
|
||||
ValueMax = 100
|
||||
Digits = 0
|
||||
Increment = 10
|
||||
ShowIncrements = True
|
||||
Transparent = True
|
||||
GapTop = 20
|
||||
GapBottom = 10
|
||||
BarThickness = 5
|
||||
MarkerColor = clBlue
|
||||
ShowMarker = True
|
||||
end
|
||||
end
|
||||
36
components/IndustrialStuff/Example/u_industrial.pas
Normal file
@ -0,0 +1,36 @@
|
||||
unit u_industrial;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, indAdvLed, IndLed, grArrow, Sensors, LedNumber,
|
||||
indGnouMeter, Forms, Controls, Graphics, Dialogs;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
AnalogSensor1: TAnalogSensor;
|
||||
indAdvLed1: TindAdvLed;
|
||||
indGnouMeter1: TindGnouMeter;
|
||||
indLed1: TindLed;
|
||||
LEDNumber1: TLEDNumber;
|
||||
StopLightSensor1: TStopLightSensor;
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
end.
|
||||
|
||||
98
components/IndustrialStuff/industrial.lpk
Normal file
@ -0,0 +1,98 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<Package Version="4">
|
||||
<PathDelim Value="\"/>
|
||||
<Name Value="industrial"/>
|
||||
<Author Value="Jurassic Pork"/>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="source"/>
|
||||
<OtherUnitFiles Value="source"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<SmartLinkUnit Value="True"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="2"/>
|
||||
</Optimizations>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<GenerateDebugInfo Value="False"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<MsgFileName Value=""/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<License Value="MPL + GPL "/>
|
||||
<Version Minor="1"/>
|
||||
<Files Count="12">
|
||||
<Item2>
|
||||
<Filename Value="source\indadvled.pas"/>
|
||||
<UnitName Value="indadvled"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Filename Value="source\indled.pas"/>
|
||||
<UnitName Value="indled"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<Filename Value="source\sensors.pas"/>
|
||||
<UnitName Value="Sensors"/>
|
||||
</Item4>
|
||||
<Item5>
|
||||
<Filename Value="source\AllIndustrialRegister.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="AllIndustrialRegister"/>
|
||||
</Item5>
|
||||
<Item6>
|
||||
<Filename Value="source\cyBaseLed.pas"/>
|
||||
<UnitName Value="cyBaseLed"/>
|
||||
</Item6>
|
||||
<Item7>
|
||||
<Filename Value="source\cyBevel.pas"/>
|
||||
<UnitName Value="cyBevel"/>
|
||||
</Item7>
|
||||
<Item8>
|
||||
<Filename Value="source\cyClasses.pas"/>
|
||||
<UnitName Value="cyClasses"/>
|
||||
</Item8>
|
||||
<Item9>
|
||||
<Filename Value="source\cyGraphics.pas"/>
|
||||
<UnitName Value="cyGraphics"/>
|
||||
</Item9>
|
||||
<Item10>
|
||||
<Filename Value="source\cyTypes.pas"/>
|
||||
<UnitName Value="cyTypes"/>
|
||||
</Item10>
|
||||
<Item11>
|
||||
<Filename Value="source\lednumber.pas"/>
|
||||
<UnitName Value="LedNumber"/>
|
||||
</Item11>
|
||||
<Item12>
|
||||
<Filename Value="source\indgnoumeter.pas"/>
|
||||
<UnitName Value="indGnouMeter"/>
|
||||
</Item12>
|
||||
</Files>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<RequiredPkgs Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="IDEIntf"/>
|
||||
</Item1>
|
||||
</RequiredPkgs>
|
||||
<UsageOptions>
|
||||
<UnitPath Value="$(PkgOutDir)"/>
|
||||
</UsageOptions>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<CustomOptions Items="ExternHelp" Version="2">
|
||||
<_ExternHelp Items="Count"/>
|
||||
</CustomOptions>
|
||||
</Package>
|
||||
</CONFIG>
|
||||
22
components/IndustrialStuff/industrial.pas
Normal file
@ -0,0 +1,22 @@
|
||||
{ This file was automatically created by Lazarus. Do not edit!
|
||||
This source is only used to compile and install the package.
|
||||
}
|
||||
|
||||
unit industrial;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
indAdvLed, IndLed, Sensors, AllIndustrialRegister, cyBaseLed, cyBevel,
|
||||
cyClasses, cyGraphics, cyTypes, LedNumber, indGnouMeter, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterUnit('AllIndustrialRegister', @AllIndustrialRegister.Register);
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterPackage('industrial', @Register);
|
||||
end.
|
||||
102
components/IndustrialStuff/resources/industrial_icons.lrs
Normal file
@ -0,0 +1,102 @@
|
||||
LazarusResources.Add('tanalogsensor','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#2#0#0#0'o'#21#170#175
|
||||
+#0#0#0#136'IDATx'#156#229#210'Y'#10#192' '#12#4#208#220#255'T'#189'Y'#170'M'
|
||||
+#234#146#140#11'*'#244#163#131'HP|'#26#144#174'C'#161#127'B'#228#178#2#197's'
|
||||
+#252#140'0iz'#22#216#208#219#25'@'#138'!'#206'.UD'#5'%N'#223#214#131'Da'#26
|
||||
+'C'#222'"'#163#200'`'#208#154#133#140'E'#173#142#178#213#134'J'#171#9'ek'#30
|
||||
+#130'J'#182'"'#132#149#210#26'@b'#157#129'^k'#18#218#11#248#144#203#25'@'#161
|
||||
+'''X'#175'@r>'#21'[/*'#231'-'#200#215#223'A'#243'9'#6#221'`TUS'#201#214#10
|
||||
+#161#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('tgrarrow','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#21#0#0#0#21#8#2#0#0#0'&u2'#193#0#0
|
||||
+#0']IDATx'#156#173#204#193#17#192' '#12#3'A'#247'_'#5'%'#166#131'0'#227#135
|
||||
+#25#130'1'#146#200#253#247#236#185#203'~'#240#230#221'z'#237#242#245#236'%'
|
||||
+#247#248#165#242#200#229#236#235#11#234'w'#23#206#175#23#218#191#158#226'C6'
|
||||
+#143#240#171'D}*'#3'W'#254'('#183#30#148#137#167#228#228#5'9yA'#14#31'Q2'#241
|
||||
+'B'#29#230#217'<'#238#189'v'#138#229#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('tindadvled','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#4'sBIT'#8#8#8#8'|'#8'd'#136#0#0#0#9'pHYs'#0#0#11#18#0#0#11#18#1#210#221
|
||||
+'~'#252#0#0#0#22'tEXtCreation Time'#0'06/12/11'#132'x2'#182#0#0#0#28'tEXtSof'
|
||||
+'tware'#0'Adobe Fireworks CS5q'#181#227'6'#0#0#2'kIDATH'#137#157#150'1n'#27
|
||||
+'1'#16'E'#31#5#245#193#186#222#130#128'}'#15#205#1'r'#131#24#200#22#190#135
|
||||
+#215'Ez'#31#192#5#13'(7'#200#1'f'#1#187#247#1#20'`'#12#168#150#236#218#2#152
|
||||
+#130'Kjw%9J'#6#160#176'$'#135#255#15'?gH'#185#24'#'#231#152'sn'#3'T'#185#31
|
||||
+'ct'#231#172#155#159#11#218#182'-'#222'_'#245'3+'#156's9'#178'm'#140#241#226
|
||||
+'$H'#140#241#160#1#27'`'#19#194'2'#170'j'#28#217#199'[i'#170#26'CX'#198#236
|
||||
+#127#12#235'`'#7#206#185'M'#219#182#149'\'#11#139#203#197'~b'#247'>'#242#235
|
||||
+'^_'#160#6'_'#215#168'j'#165#170'8'#231'6'#211#221#184#225#25'd'#240#219#219
|
||||
+#219'1'#235#238#157#238#249#5#179'u'#25#242#190#134#26#216#15'a'#182#166'i'
|
||||
+#174'G'#146#21#130'S'#224#221'cG0'#5#20'/'#138#1#170#130#7'<B#2'#242#159#146
|
||||
+#140#8#226#199'['#197#252'K'#137#250#238#231'='#230'['#188#159#10#9#214#255
|
||||
+#152#10#141#191'I;'#234'MD'#10#193','#131#135#176#28#131#255#184#7'Q'#196#11
|
||||
+#158#220'&'#230#193'7J'#176#135'"'#159#217#154#16#150'U'#159#129#229#144#171
|
||||
+#239#223#190#150'u'#143'?'#127'a^i'#16#216#245#18#204#147'<'#160#25#187#239
|
||||
+#131#23'%'#4'h'#164'M'#253#193'nf}'#244#228#232#187#223#29'j'#15#189#222#202
|
||||
+#226'r1'#206#166'c'#230#129'F1S<'#245'h'#23's'#160#26'2'#218#19' Z'#250#221
|
||||
+#235#221#231#224#153#195#131#161#128#12#135#171'q'#29#236#222#25#230#157#161
|
||||
+#163#233'a'#223#142#144#24'`'#195#188'exU'#244#133'd'#172'0'#163'd'#206#148
|
||||
+#228#20'x'#153#240'`'#182'*C'#179#169#143#231#234'S'#144#147#224'i'#241#129
|
||||
+#205#128'Q'#133#14'Q'#236'H;i'#214#227#247#209'['#239'<'#139'1'#186#166#185#6
|
||||
+#210#253#146#14'\'#254#130'v'#4#223'Re[O'#22'B'#187#141'1'#186','#209#182'{~'
|
||||
+'I_54'#254#6'S'#249''''#2'oR'#136#134#177#205#0'b'#140#23'"'#178#5'`'#157#10
|
||||
+'E'#188'`'#225#156#208#129#144'*='#203#210'G'#191#191'*'#138#239#211#254','
|
||||
+#196#11#141'_bA0'#229'P2#'#21#245#4'|j'#7#215'u'#8#203'q'#225#25#152#165'*'
|
||||
+#29'e'#137#129#247'R|'#178#13#163'? '#152#146#228#236#26'~'#239#9'V)'#179'>'
|
||||
+#1#135'#or'#140#241'"'#223#132'S'#162#20#237#190#136#178'l!'#180#219#188'v'
|
||||
+#138'w'#244#209'/'#143'EO'#148#201#24#128#183'm'#2'='#5#156#237'@'#162#147
|
||||
+#142#255#249#183#229#15#187#175#156#165#150#179#179'c'#0#0#0#0'IEND'#174'B`'
|
||||
+#130
|
||||
]);
|
||||
LazarusResources.Add('tindgnoumeter','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#4'sBIT'#8#8#8#8'|'#8'd'#136#0#0#0#9'pHYs'#0#0#10#240#0#0#10#240#1'B'#172
|
||||
+'4'#152#0#0#0#22'tEXtCreation Time'#0'09/30/08'#194'>PQ'#0#0#0#28'tEXtSoftwa'
|
||||
+'re'#0'Adobe Fireworks CS4'#6#178#211#160#0#0#0#195'IDATH'#137#237#149'a'#14
|
||||
+#131' '#12#133#223'[v'#175'y'#179#218#155#193#201#186#31#19#194#176#168'(Y'
|
||||
+#150'l_bR'#8#188#167#180'R'#154#25'*'#242#132#170'BD'#168#170'yNDX.&if'#198
|
||||
+#20#3'@'#26#3#192#189'V'#7#128#24#227#219'XD'#188'eY0'#197'!'#132#149#233#205
|
||||
+#221#233'h'#21'O'#166'|'#211#22#238#23#156#193#204'x'#248#136'z'#133#189#184
|
||||
+#203'`+'#201'{'#28'2h%y'#152#1#170#228#246'p'#180#138'N'#243#25#3#18#171#223
|
||||
+'y'#20'9'#7'$'#204#236'u'#214#143'i'#2#0#132'y'#6'0'#168#138#146#184#199#229
|
||||
+'*'#218#18'_'#248#225'*'#250'_'#21#187'|'#127#146'IZ'#217':k.5'#156'V'#31#238
|
||||
+'6'#24'^E'#186#220'A'#133#168#187#185#213#135'K'#158#127'$a'#132#192'k6'#232
|
||||
+#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('tindled','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#4'sBIT'#8#8#8#8'|'#8'd'#136#0#0#0#9'pHYs'#0#0#11#18#0#0#11#18#1#210#221
|
||||
+'~'#252#0#0#0#28'tEXtSoftware'#0'Adobe Fireworks CS5q'#181#227'6'#0#0#0#22't'
|
||||
+'EXtCreation Time'#0'06/12/11'#132'x2'#182#0#0#0#145'IDATH'#137#237#150'a'#10
|
||||
+#131'0'#12#133#191#140#222#210'A'#189#201#244'&'#10#219'9'#159#191'&'#235#156
|
||||
+#221'\'#27'D'#240'A!%'#229'}$'#165#164'&'#9'O'#5#0'3s'#163'\'#158#129#164#170
|
||||
+'k'#24#238')'#160#166#198#241'1'#199'!'#151#252'G16'#201'~'#1#0'h'#219'k5'
|
||||
+#128'K'#139'^'#245#177#130'Y'#221#6#167#149#179'y'#0#192#237#7#243'~='#229
|
||||
+#222#162#19'p'#2#14#0#248#254#208'2'#143#168#28#208#149#153#195#30'w'#16'cS4'
|
||||
+#201#222#149#180#168't'#216'd+'#240'0'#7'0I'#174#191#138#9#166#153#129#188
|
||||
+#147#131#15#235#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('tlednumber','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#14#0#0#0#24#8#6#0#0#0#202#199#204
|
||||
+'W'#0#0#0#1'sRGB'#0#174#206#28#233#0#0#0#6'bKGD'#0#255#0#255#0#255#160#189
|
||||
+#167#147#0#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#0#7'tIME'#7#221
|
||||
+#5#14#11'; A'#194'}'#3#0#0#0'[IDAT8'#203'cd``'#248#207'@'#6'`b '#19'PQ'#227
|
||||
+#127#28'X'#155#144'FF'#28#152#11'S'#217#127#20#219#24'q'#184#13'Mn0'#4#14'}5'
|
||||
+#222#193#163#242#14#190'Pe@'#226#189#128#210#18'H*'#241'j$'#203#169#248#140
|
||||
+#248'?L'#162#131'l'#141#183#169#17#143#216#178#27#245#227'qPk'#4#0#160#183#22
|
||||
+#199']'#6#217'.'#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('tstoplightsensor','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#20#0#0#0#24#8#2#0#0#0'u)J!'#0#0#0#1
|
||||
+'sRGB'#0#174#206#28#233#0#0#0#6'bKGD'#0#255#0#255#0#255#160#189#167#147#0#0#0
|
||||
+#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#0#7'tIME'#7#221#5#17#8#20#1
|
||||
+#21#139#172#160#0#0#0#130'IDAT8'#203#229#147'1'#14#128' '#20'C'#27#195#225
|
||||
+#184#144#3#19'ur'#240'B'#142#189#25'n'#132#24#249#130#17#23';'#241#19'^'#154
|
||||
+#254#230'C'#146'$'#146'h'#22#201#148#146'$g'#127':=Nr'#6#25'3C^'#242#211'='#9
|
||||
+#196'.'#184'QU'#231#165#176'Z*'#206'Vf<^'#152#193#188#147'yX'#207#193'o'#197
|
||||
+#212#211'sA"'#248#237#195#158#215'}'#206#227#186#207#253'='#227#127'='#179
|
||||
+#200#220#215's&'#1#16'_'#222's'#139#179#153'y'#232'='#31#161#199'XO'#233'z'
|
||||
+#22#155#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
BIN
components/IndustrialStuff/resources/stop_green.png
Normal file
|
After Width: | Height: | Size: 235 B |
BIN
components/IndustrialStuff/resources/stop_red.png
Normal file
|
After Width: | Height: | Size: 239 B |
BIN
components/IndustrialStuff/resources/stop_unknown.png
Normal file
|
After Width: | Height: | Size: 244 B |
BIN
components/IndustrialStuff/resources/stop_yellow.png
Normal file
|
After Width: | Height: | Size: 235 B |
BIN
components/IndustrialStuff/resources/tanalogsensor.png
Normal file
|
After Width: | Height: | Size: 193 B |
BIN
components/IndustrialStuff/resources/tgrarrow.png
Normal file
|
After Width: | Height: | Size: 150 B |
BIN
components/IndustrialStuff/resources/tindadvled.png
Normal file
|
After Width: | Height: | Size: 787 B |
BIN
components/IndustrialStuff/resources/tindgnoumeter.png
Normal file
|
After Width: | Height: | Size: 363 B |
BIN
components/IndustrialStuff/resources/tindled.png
Normal file
|
After Width: | Height: | Size: 313 B |
BIN
components/IndustrialStuff/resources/tlednumber.png
Normal file
|
After Width: | Height: | Size: 219 B |
BIN
components/IndustrialStuff/resources/tstoplightsensor.png
Normal file
|
After Width: | Height: | Size: 258 B |
34
components/IndustrialStuff/source/AllIndustrialRegister.pas
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
{**********************************************************************
|
||||
Package industrial Lazarus
|
||||
|
||||
This unit is part of Lazarus Project
|
||||
***********************************************************************}
|
||||
|
||||
unit AllIndustrialRegister;
|
||||
|
||||
interface
|
||||
|
||||
|
||||
uses
|
||||
Classes,lresources,
|
||||
//...........................
|
||||
indAdvLed, indLed, GrArrow, LedNumber, Sensors,indGnouMeter;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
//==========================================================
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents ('Industrial',[
|
||||
TindAdvLed, TIndLed, TLedNumber, TStopLightSensor, TAnalogSensor, TindGnouMeter]);
|
||||
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$i industrial_icons.lrs}
|
||||
|
||||
end.
|
||||
233
components/IndustrialStuff/source/cyBaseLed.pas
Normal file
@ -0,0 +1,233 @@
|
||||
{ Component(s):
|
||||
tcyBaseLed
|
||||
|
||||
Description:
|
||||
A base led component with Group feature
|
||||
Led states : ON/OFF/DISABLE
|
||||
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mauricio
|
||||
* (https://sourceforge.net/projects/tcycomponents/).
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or the
|
||||
* GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which
|
||||
* case the provisions of the GPL or the LGPL are applicable instead of those
|
||||
* above. If you wish to allow use of your version of this file only under the
|
||||
* terms of either the GPL or the LGPL, and not to allow others to use your
|
||||
* version of this file under the terms of the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice and other
|
||||
* provisions required by the LGPL or the GPL. If you do not delete the
|
||||
* provisions above, a recipient may use your version of this file under the
|
||||
* terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****}
|
||||
|
||||
{**********************************************************************
|
||||
Package pl_Cindy.pkg
|
||||
for CodeTyphon Studio (http://www.pilotlogic.com/)
|
||||
***********************************************************************}
|
||||
|
||||
unit cyBaseLed;
|
||||
|
||||
{$MODE Delphi}
|
||||
|
||||
interface
|
||||
|
||||
uses LCLIntf, LCLType, LMessages,Classes, Types, Controls, Graphics, Messages;
|
||||
|
||||
type
|
||||
TLedStatus = (lsOn, lsOff, lsDisabled);
|
||||
|
||||
TcyBaseLed = class(TGraphicControl)
|
||||
private
|
||||
FGroupIndex: Integer;
|
||||
FAllowAllOff: Boolean;
|
||||
FLedValue: Boolean;
|
||||
FReadOnly: Boolean;
|
||||
procedure SetAllowAllOff(Value: Boolean);
|
||||
procedure SetGroupIndex(Value: Integer);
|
||||
procedure UpdateExclusive;
|
||||
protected
|
||||
procedure Click; override;
|
||||
procedure Loaded; override;
|
||||
procedure SetEnabled(Value: Boolean); override;
|
||||
procedure CMButtonPressed(var Message: TLMessage); message CM_BUTTONPRESSED; // Called in UpdateExclusive procedure ...
|
||||
function TransparentColorAtPos(Point: TPoint): boolean; virtual;
|
||||
procedure LedStatusChanged; virtual;
|
||||
procedure SetInternalLedValue(Value: Boolean);
|
||||
function GetLedStatus: TLedStatus; virtual;
|
||||
procedure SetLedvalue(Value: Boolean); virtual;
|
||||
procedure SetReadOnly(AValue: Boolean); virtual;
|
||||
property AllowAllOff: Boolean read FAllowAllOff write SetAllowAllOff default false;
|
||||
property GroupIndex: Integer read FGroupIndex write SetGroupIndex default 0;
|
||||
property LedValue: Boolean read FLedvalue write SetLedvalue;
|
||||
property ReadOnly: Boolean read FReadOnly write SetReadOnly default false;
|
||||
public
|
||||
property Canvas;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
property LedStatus: TLedStatus read GetLedStatus;
|
||||
procedure Switch;
|
||||
published
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
constructor TcyBaseLed.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FAllowAllOff := false;
|
||||
FGroupIndex := 0;
|
||||
FLedvalue:= false;
|
||||
FReadOnly := false;
|
||||
end;
|
||||
|
||||
procedure TcyBaseLed.LedStatusChanged;
|
||||
begin
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TcyBaseLed.Loaded;
|
||||
begin
|
||||
Inherited;
|
||||
ControlStyle := ControlStyle - [csDoubleClicks];
|
||||
end;
|
||||
|
||||
procedure TcyBaseLed.SetReadOnly(AValue: Boolean);
|
||||
begin
|
||||
if AValue <> FReadOnly
|
||||
then FReadOnly := AValue;
|
||||
end;
|
||||
|
||||
procedure TcyBaseLed.SetEnabled(Value: Boolean);
|
||||
begin
|
||||
Inherited;
|
||||
LedStatusChanged;
|
||||
end;
|
||||
|
||||
function TcyBaseLed.TransparentColorAtPos(Point: TPoint): boolean;
|
||||
begin
|
||||
RESULT := false;
|
||||
end;
|
||||
|
||||
procedure TcyBaseLed.Click;
|
||||
var aPt: TPoint;
|
||||
begin
|
||||
if not FReadOnly
|
||||
then begin
|
||||
GetCursorPos(aPt);
|
||||
aPt := Self.ScreenToClient(aPt);
|
||||
|
||||
if Not TransparentColorAtPos(aPt)
|
||||
then LedValue := not FLedValue;
|
||||
end;
|
||||
|
||||
Inherited;
|
||||
end;
|
||||
|
||||
function TcyBaseLed.GetLedStatus: TLedStatus;
|
||||
begin
|
||||
if not Enabled
|
||||
then
|
||||
RESULT := lsDisabled
|
||||
else
|
||||
if FLedValue
|
||||
then RESULT := lsOn
|
||||
else RESULT := lsOff;
|
||||
end;
|
||||
|
||||
// Procedure to force changing value :
|
||||
procedure TcyBaseLed.SetInternalLedValue(Value: Boolean);
|
||||
begin
|
||||
if FLedValue <> Value
|
||||
then begin
|
||||
FLedValue := Value;
|
||||
LedStatusChanged;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyBaseLed.Switch;
|
||||
begin
|
||||
LedValue := not FLedValue;
|
||||
end;
|
||||
|
||||
procedure TcyBaseLed.SetLedvalue(Value: Boolean);
|
||||
begin
|
||||
if Value <> FLedvalue
|
||||
then begin
|
||||
if (not Value) and (not FAllowAllOff) and (FGroupIndex <> 0)
|
||||
then Exit; // Can't turn off all leds of the same group ...
|
||||
|
||||
FLedvalue := Value;
|
||||
LedStatusChanged;
|
||||
|
||||
if Value
|
||||
then UpdateExclusive; // Send message to turn off the other one ...
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyBaseLed.SetAllowAllOff(Value: Boolean);
|
||||
begin
|
||||
if FAllowAllOff <> Value
|
||||
then begin
|
||||
FAllowAllOff := Value;
|
||||
UpdateExclusive; // Inform FAllowAllOff value to the others from the same group
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyBaseLed.SetGroupIndex(Value: Integer);
|
||||
begin
|
||||
if FGroupIndex <> Value
|
||||
then begin
|
||||
FGroupIndex := Value;
|
||||
UpdateExclusive;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyBaseLed.UpdateExclusive;
|
||||
var
|
||||
Msg: TMessage;
|
||||
begin
|
||||
if (FGroupIndex <> 0) and (Parent <> nil)
|
||||
then begin
|
||||
Msg.Msg := CM_BUTTONPRESSED;
|
||||
Msg.WParam := FGroupIndex;
|
||||
Msg.LParam := Longint(Self);
|
||||
Msg.Result := 0;
|
||||
Parent.Broadcast(Msg);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyBaseLed.CMButtonPressed(var Message: TLMessage);
|
||||
var Sender: TcyBaseLed;
|
||||
begin
|
||||
if (csLoading in ComponentState) then exit; // 9999
|
||||
|
||||
if Message.WParam = FGroupIndex // Same group?
|
||||
then begin
|
||||
Sender := TcyBaseLed(Message.LParam);
|
||||
if Sender <> Self
|
||||
then begin
|
||||
if Sender.LedValue and FLedValue // Only one can be turn on on group mode ...
|
||||
then begin;
|
||||
FLedValue := false;
|
||||
LedStatusChanged;
|
||||
end;
|
||||
|
||||
FAllowAllOff := Sender.AllowAllOff;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
182
components/IndustrialStuff/source/cyBevel.pas
Normal file
@ -0,0 +1,182 @@
|
||||
{ Component(s):
|
||||
tcyBevel
|
||||
|
||||
Description:
|
||||
A bevel with multi-bevels
|
||||
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mauricio
|
||||
* (https://sourceforge.net/projects/tcycomponents/).
|
||||
*
|
||||
* No contributors for now ...
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or the
|
||||
* GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which
|
||||
* case the provisions of the GPL or the LGPL are applicable instead of those
|
||||
* above. If you wish to allow use of your version of this file only under the
|
||||
* terms of either the GPL or the LGPL, and not to allow others to use your
|
||||
* version of this file under the terms of the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice and other
|
||||
* provisions required by the LGPL or the GPL. If you do not delete the
|
||||
* provisions above, a recipient may use your version of this file under the
|
||||
* terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****}
|
||||
|
||||
{**********************************************************************
|
||||
Package pl_Cindy.pkg
|
||||
for CodeTyphon Studio (http://www.pilotlogic.com/)
|
||||
***********************************************************************}
|
||||
|
||||
unit cyBevel;
|
||||
|
||||
{$MODE Delphi}
|
||||
|
||||
interface
|
||||
|
||||
uses LCLIntf, LCLType, LMessages,
|
||||
cyTypes, cyClasses, Graphics, ExtCtrls, classes, Messages, Controls;
|
||||
|
||||
type
|
||||
TcyCustomBevel = class(TGraphicControl)
|
||||
private
|
||||
FBevels: TcyBevels;
|
||||
FOnMouseEnter: TNotifyEvent;
|
||||
FOnMouseLeave: TNotifyEvent;
|
||||
FOnPaint: TNotifyEvent;
|
||||
procedure CmMouseEnter(var Msg: TLMessage); message CM_MOUSEENTER; // 9999 for CodeTyphon
|
||||
procedure CmMouseLeave(var Msg: TLMessage); message CM_MOUSELEAVE; // 9999 for CodeTyphon
|
||||
procedure SetBevels(const Value: TcyBevels);
|
||||
protected
|
||||
procedure Paint; override;
|
||||
property Bevels: TcyBevels read FBevels write SetBevels;
|
||||
property OnPaint: TNotifyEvent read FOnPaint write FOnPaint;
|
||||
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
|
||||
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
|
||||
property Height default 105;
|
||||
property Width default 105;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
property Canvas;
|
||||
published
|
||||
end;
|
||||
|
||||
TcyBevel = class(TcyCustomBevel)
|
||||
private
|
||||
protected
|
||||
public
|
||||
published
|
||||
property Align;
|
||||
property Anchors;
|
||||
// property Color;
|
||||
property Constraints;
|
||||
property DragCursor;
|
||||
property DragKind;
|
||||
property DragMode;
|
||||
property Enabled;
|
||||
property Font;
|
||||
// property ParentColor;
|
||||
property ParentFont;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
property ShowHint;
|
||||
property Visible;
|
||||
property OnClick;
|
||||
property OnContextPopup;
|
||||
property OnDblClick;
|
||||
property OnDragDrop;
|
||||
property OnDragOver;
|
||||
property OnEndDock;
|
||||
property OnEndDrag;
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property OnStartDock;
|
||||
property OnStartDrag;
|
||||
// Herited from TcyCustomBevel :
|
||||
property Bevels;
|
||||
property OnMouseEnter;
|
||||
property OnMouseLeave;
|
||||
property OnPaint;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
constructor TcyCustomBevel.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
Width := 105;
|
||||
Height := 105;
|
||||
FBevels := TcyBevels.Create(self, cyClasses.TcyBevel);
|
||||
|
||||
// Determine at design time if
|
||||
// the form is loading or if we have just added the component at design time :
|
||||
if csDesigning in ComponentState
|
||||
then
|
||||
if Owner <> nil
|
||||
then
|
||||
if not (csLoading in Owner.ComponentState) // we have just added the component at design time
|
||||
then FBevels.Add.Style := bcLowered;
|
||||
end;
|
||||
|
||||
destructor TcyCustomBevel.Destroy;
|
||||
begin
|
||||
FBevels.Free;
|
||||
FBevels := Nil;
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TcyCustomBevel.Paint;
|
||||
var Rect: TRect;
|
||||
begin
|
||||
// inherited;
|
||||
Rect := ClientRect;
|
||||
Bevels.DrawBevels(Canvas, Rect, false);
|
||||
|
||||
if csDesigning in ComponentState
|
||||
then
|
||||
if Bevels.Count = 0
|
||||
then
|
||||
with Canvas do
|
||||
begin
|
||||
Pen.Style := psDash;
|
||||
Brush.Style := bsClear;
|
||||
Rectangle(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom);
|
||||
end;
|
||||
|
||||
if Assigned(FOnPaint)
|
||||
then FOnPaint(Self);
|
||||
end;
|
||||
|
||||
procedure TcyCustomBevel.CmMouseEnter(var Msg: TLMessage);
|
||||
begin
|
||||
inherited;
|
||||
if Assigned(FOnMouseEnter) then FOnMouseEnter(Self);
|
||||
end;
|
||||
|
||||
procedure TcyCustomBevel.CmMouseLeave(var Msg: TLMessage);
|
||||
begin
|
||||
inherited;
|
||||
if Assigned(FonMouseLeave) then FOnMouseLeave(Self);
|
||||
end;
|
||||
|
||||
procedure TcyCustomBevel.SetBevels(const Value: TcyBevels);
|
||||
begin
|
||||
FBevels := Value;
|
||||
end;
|
||||
|
||||
end.
|
||||
1092
components/IndustrialStuff/source/cyClasses.pas
Normal file
1971
components/IndustrialStuff/source/cyGraphics.pas
Normal file
91
components/IndustrialStuff/source/cyTypes.pas
Normal file
@ -0,0 +1,91 @@
|
||||
{ Unit cyTypes
|
||||
|
||||
Description:
|
||||
Unit with Types declarations.
|
||||
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mauricio
|
||||
* (https://sourceforge.net/projects/tcycomponents/).
|
||||
*
|
||||
* No contributors for now ...
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or the
|
||||
* GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which
|
||||
* case the provisions of the GPL or the LGPL are applicable instead of those
|
||||
* above. If you wish to allow use of your version of this file only under the
|
||||
* terms of either the GPL or the LGPL, and not to allow others to use your
|
||||
* version of this file under the terms of the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice and other
|
||||
* provisions required by the LGPL or the GPL. If you do not delete the
|
||||
* provisions above, a recipient may use your version of this file under the
|
||||
* terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****}
|
||||
|
||||
{**********************************************************************
|
||||
Package pl_Cindy.pkg
|
||||
for CodeTyphon Studio (http://www.pilotlogic.com/)
|
||||
***********************************************************************}
|
||||
|
||||
unit cyTypes;
|
||||
|
||||
{$MODE Delphi}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
LCLIntf, LCLType, Graphics, Classes, types;
|
||||
|
||||
type
|
||||
// Graphic:
|
||||
TCaptionRender = (crNormal, crPathEllipsis, crEndEllipsis, crWordEllipsis);
|
||||
TCaptionOrientation = (coHorizontal, coHorizontalReversed, coVertical, coVerticalReversed);
|
||||
|
||||
TBgPosition = (bgCentered, bgTopLeft, bgTopCenter, bgTopRight, bgCenterRight, bgBottomRight, bgBottomCenter, bgBottomLeft, bgCenterLeft);
|
||||
TBgStyle = (bgNone, bgNormal, bgMosaic, bgStretch, bgStretchProportional);
|
||||
|
||||
TcyBevelCut = (bcLowered, bcRaised, bcNone, bcTransparent);
|
||||
|
||||
TDgradOrientation = (dgdVertical, dgdHorizontal, dgdAngle, dgdRadial, dgdRectangle);
|
||||
TDgradOrientationShape = (osRadial, osRectangle);
|
||||
TDgradBalanceMode = (bmNormal, bmMirror, bmReverse, bmReverseFromColor, bmInvertReverse, bmInvertReverseFromColor);
|
||||
|
||||
// Cindy components:
|
||||
TRunTimeDesignJob = (rjNothing, rjMove, rjResizeTop, rjResizeBottom, rjResizeLeft, rjResizeTopLeft,
|
||||
rjResizeBottomLeft, rjResizeRight, rjResizeTopRight, rjResizeBottomRight);
|
||||
|
||||
TLineCoord = record
|
||||
BottomCoord, TopCoord: TPoint;
|
||||
end;
|
||||
|
||||
var
|
||||
CaptionOrientationWarning: Boolean = true;
|
||||
|
||||
const
|
||||
DT_PATH_ELLIPSIS = $8000;
|
||||
DT_WORD_ELLIPSIS = $8000;
|
||||
|
||||
cCaptionOrientationWarning = 'Note that text orientation doesn''t work with all fonts!';
|
||||
|
||||
Alignments: array[TAlignment] of Word = (DT_LEFT, DT_RIGHT, DT_CENTER);
|
||||
WordWraps: array[Boolean] of Word = (DT_SINGLELINE, DT_WORDBREAK);
|
||||
TextLayouts: array[TTextLayout] of Longint = (DT_TOP, DT_VCENTER, DT_BOTTOM);
|
||||
CaptionOrientations: array[TCaptionOrientation] of word = (0, 1800, 900, 2700);
|
||||
CaptionRenders: array[TCaptionRender] of Integer = (0, DT_PATH_ELLIPSIS, DT_END_ELLIPSIS, DT_WORD_ELLIPSIS);
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
end.
|
||||
268
components/IndustrialStuff/source/indadvled.pas
Normal file
@ -0,0 +1,268 @@
|
||||
{ Component(s):
|
||||
TindAdvLed ---> old cindy name tcyAdvLed
|
||||
|
||||
Description:
|
||||
An advanced led with Group feature
|
||||
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mauricio
|
||||
* (https://sourceforge.net/projects/tcycomponents/).
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or the
|
||||
* GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which
|
||||
* case the provisions of the GPL or the LGPL are applicable instead of those
|
||||
* above. If you wish to allow use of your version of this file only under the
|
||||
* terms of either the GPL or the LGPL, and not to allow others to use your
|
||||
* version of this file under the terms of the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice and other
|
||||
* provisions required by the LGPL or the GPL. If you do not delete the
|
||||
* provisions above, a recipient may use your version of this file under the
|
||||
* terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****}
|
||||
|
||||
{**********************************************************************
|
||||
Package pl_Cindy.pkg
|
||||
for CodeTyphon Studio (http://www.pilotlogic.com/)
|
||||
***********************************************************************
|
||||
Modified by Jurassic Pork 2013 for package Industrial of Lazarus}
|
||||
|
||||
unit indAdvLed;
|
||||
|
||||
{$MODE Delphi}
|
||||
|
||||
interface
|
||||
|
||||
uses LCLIntf, LCLType, Classes, Types, Controls, Graphics, cyBaseLed, cyGraphics;
|
||||
|
||||
type
|
||||
TcyCustomAdvLed = class(TcyBaseLed)
|
||||
FPictureOn: TPicture;
|
||||
FPictureOff: TPicture;
|
||||
FPictureDisabled: TPicture;
|
||||
private
|
||||
FTransparent: boolean;
|
||||
procedure SetPictureOn(Value: TPicture);
|
||||
procedure SetPictureOff(Value: TPicture);
|
||||
procedure SetPictureDisabled(Value: TPicture);
|
||||
procedure SetTransparent(const Value: boolean);
|
||||
protected
|
||||
function TransparentColorAtPos(Point: TPoint): boolean; override;
|
||||
procedure Paint; override;
|
||||
procedure SetAutoSize(Value: Boolean); override;
|
||||
property Height default 25;
|
||||
property Width default 25;
|
||||
property PictureOn: TPicture read FPictureOn write SetPictureOn;
|
||||
property PictureOff: TPicture read FPictureOff write SetPictureOff;
|
||||
property PictureDisabled: TPicture read FPictureDisabled write SetPictureDisabled;
|
||||
property Transparent: boolean read FTransparent write SetTransparent default false;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure AdjustSize; override;
|
||||
published
|
||||
end;
|
||||
|
||||
TindAdvLed = class(TcyCustomAdvLed)
|
||||
private
|
||||
protected
|
||||
public
|
||||
published
|
||||
property Align;
|
||||
property Autosize;
|
||||
property Anchors;
|
||||
property Color;
|
||||
property Constraints;
|
||||
property Enabled;
|
||||
property Visible;
|
||||
property OnClick;
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
// Herited from TcyBaseLed :
|
||||
property AllowAllOff;
|
||||
property GroupIndex;
|
||||
property LedValue;
|
||||
property ReadOnly;
|
||||
// Herited from TcyCustomAdvLed :
|
||||
property PictureOn;
|
||||
property PictureOff;
|
||||
property PictureDisabled;
|
||||
property Transparent;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('Industrial',[TindAdvLed]);
|
||||
end;
|
||||
|
||||
constructor TcyCustomAdvLed.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FPictureOn := TPicture.Create;
|
||||
FPictureOff := TPicture.Create;
|
||||
FPictureDisabled := TPicture.Create;
|
||||
FTransparent := false;
|
||||
Height := 25;
|
||||
Width := 25;
|
||||
//Autosize := true; // Don' t work
|
||||
end;
|
||||
|
||||
destructor TcyCustomAdvLed.Destroy;
|
||||
begin
|
||||
FPictureOn.Free;
|
||||
FPictureOff.Free;
|
||||
FPictureDisabled.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TcyCustomAdvLed.Paint;
|
||||
var curPicture: TPicture;
|
||||
begin
|
||||
if csDesigning in ComponentState
|
||||
then
|
||||
with Canvas do
|
||||
begin
|
||||
Pen.Style := psDash;
|
||||
Brush.Style := bsClear;
|
||||
Rectangle(0, 0, Width, Height);
|
||||
end;
|
||||
|
||||
case GetLedStatus of
|
||||
lsOn: curPicture := FPictureOn;
|
||||
lsOff: curPicture := FPictureOff;
|
||||
lsDisabled: curPicture := FPictureDisabled;
|
||||
end;
|
||||
|
||||
if ValidGraphic(curPicture.Graphic)
|
||||
then begin
|
||||
if curPicture.Graphic.Transparent <> FTransparent
|
||||
then curPicture.Graphic.Transparent := FTransparent;
|
||||
|
||||
if not AutoSize
|
||||
then begin
|
||||
{ if curPicture.Graphic is TIcon
|
||||
then DrawIconEx(Canvas.Handle, 0, 0, curPicture.Icon.Handle, Width, Height, 0, 0, DI_Normal) // Stretch draw doesn't work for icons!
|
||||
else }Canvas.StretchDraw(ClientRect, curPicture.Graphic);
|
||||
end
|
||||
else
|
||||
Canvas.Draw(0, 0, curPicture.Graphic);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomAdvLed.AdjustSize;
|
||||
var curPicture: TPicture;
|
||||
begin
|
||||
if Autosize
|
||||
then begin
|
||||
case GetLedStatus of
|
||||
lsOn: curPicture := FPictureOn;
|
||||
lsOff: curPicture := FPictureOff;
|
||||
lsDisabled: curPicture := FPictureDisabled;
|
||||
end;
|
||||
|
||||
if ValidGraphic(curPicture.Graphic)
|
||||
then SetBounds(Left, Top, curPicture.Graphic.Width, curPicture.Graphic.Height);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomAdvLed.SetAutoSize(Value: Boolean);
|
||||
begin
|
||||
Inherited;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
function TcyCustomAdvLed.TransparentColorAtPos(Point: TPoint): boolean;
|
||||
var
|
||||
curPicture: TPicture;
|
||||
begin
|
||||
RESULT := false;
|
||||
|
||||
if Transparent
|
||||
then begin
|
||||
case GetLedStatus of
|
||||
lsOn: curPicture := FPictureOn;
|
||||
lsOff: curPicture := FPictureOff;
|
||||
lsDisabled: curPicture := FPictureDisabled;
|
||||
end;
|
||||
|
||||
if ValidGraphic(curPicture.Graphic)
|
||||
then begin
|
||||
if not AutoSize // Convert point coordinates to pixel coordinates ...
|
||||
then begin
|
||||
Point.x := (Point.x * curPicture.Graphic.Width) div Width;
|
||||
Point.y := (Point.y * curPicture.Graphic.Height) div Height;
|
||||
end;
|
||||
|
||||
RESULT := PictureIsTransparentAtPos(curPicture, Point);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomAdvLed.SetPictureOn(Value: TPicture);
|
||||
begin
|
||||
try
|
||||
FPictureOn.Assign(Value);
|
||||
|
||||
if GetLedStatus = lsOn
|
||||
then begin
|
||||
AdjustSize;
|
||||
Invalidate;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomAdvLed.SetPictureOff(Value: TPicture);
|
||||
begin
|
||||
try
|
||||
FPictureOff.Assign(Value);
|
||||
|
||||
if GetLedStatus = lsOff
|
||||
then begin
|
||||
AdjustSize;
|
||||
Invalidate;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomAdvLed.SetPictureDisabled(Value: TPicture);
|
||||
begin
|
||||
try
|
||||
FPictureDisabled.Assign(Value);
|
||||
|
||||
if GetLedStatus = lsDisabled
|
||||
then begin
|
||||
AdjustSize;
|
||||
Invalidate;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomAdvLed.SetTransparent(const Value: boolean);
|
||||
begin
|
||||
if value <> FTransparent
|
||||
then begin
|
||||
FTransparent := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
416
components/IndustrialStuff/source/indgnoumeter.pas
Normal file
@ -0,0 +1,416 @@
|
||||
|
||||
{**********************************************************************
|
||||
extracted from Package pl_ExControls.pkg
|
||||
From PilotLogic Software House
|
||||
for CodeTyphon Project (http://www.pilotlogic.com/)
|
||||
This unit is part of CodeTyphon Project
|
||||
used by Lazarus for Industrial package
|
||||
***********************************************************************}
|
||||
|
||||
unit indGnouMeter;
|
||||
|
||||
interface
|
||||
|
||||
|
||||
uses
|
||||
Classes, Controls, Graphics, SysUtils, Messages, LMessages, Types, LCLType, LCLIntf;
|
||||
|
||||
type
|
||||
TindGnouMeter = class(TGraphicControl)
|
||||
private
|
||||
fValue : Double;
|
||||
fColorFore : TColor;
|
||||
fColorBack : TColor;
|
||||
fSignalUnit : ShortString;
|
||||
fValueMax : Double;
|
||||
fValueMin : Double;
|
||||
fDigits : Byte;
|
||||
fIncrement : Double;
|
||||
fShowIncrements : Boolean;
|
||||
fGapTop : Word;
|
||||
fGapBottom : Word;
|
||||
fBarThickness : Word;
|
||||
fMarkerColor : TColor;
|
||||
fShowMarker : Boolean;
|
||||
//Variables used internallly
|
||||
TopTextHeight: Word;
|
||||
LeftMeter : Word;
|
||||
DisplayValue : String;
|
||||
DrawStyle : Integer;
|
||||
TheRect : TRect;
|
||||
//End of variables used internallly
|
||||
procedure SetValue(val : Double);
|
||||
procedure SetColorBack(val : TColor);
|
||||
procedure SetColorFore(val : TColor);
|
||||
procedure SetSignalUnit(val : ShortString);
|
||||
procedure SetValueMin(val : Double);
|
||||
procedure SetValueMax(val : Double);
|
||||
procedure SetDigits(val : Byte);
|
||||
procedure SetTransparent(val : Boolean);
|
||||
Function GetTransparent : Boolean;
|
||||
procedure SetIncrement(val : Double);
|
||||
procedure SetShowIncrements(val : Boolean);
|
||||
procedure SetGapTop(val : Word);
|
||||
procedure SetGapBottom(val : Word);
|
||||
procedure SetBarThickness(val : Word);
|
||||
procedure SetMarkerColor(val : TColor);
|
||||
procedure SetShowMarker(val : Boolean);
|
||||
procedure DrawTopText;
|
||||
procedure DrawMeterBar;
|
||||
procedure DrawIncrements;
|
||||
Function ValueToPixels(val : Double) : Integer;
|
||||
procedure DrawValueMax;
|
||||
procedure DrawValueMin;
|
||||
procedure DrawMarker;
|
||||
protected
|
||||
procedure Paint;override;
|
||||
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
|
||||
public
|
||||
constructor Create(AOwner : Tcomponent);override;
|
||||
destructor Destroy ; override;
|
||||
published
|
||||
property Align;
|
||||
property Caption;
|
||||
property Visible;
|
||||
property Value : Double read fValue write SetValue;
|
||||
property Color;
|
||||
property Font;
|
||||
property ParentColor;
|
||||
property ColorFore : Tcolor read fColorFore write SetColorFore;
|
||||
property ColorBack : Tcolor read fColorBack write SetColorBack;
|
||||
property SignalUnit : ShortString read fSignalUnit write SetSignalUnit;
|
||||
property ValueMin : Double read fValueMin write SetValueMin;
|
||||
property ValueMax : Double read fValueMax write SetValueMax;
|
||||
property Digits : Byte read fDigits write SetDigits;
|
||||
property Increment : Double read fIncrement write SetIncrement;
|
||||
property ShowIncrements : Boolean read fShowIncrements write SetShowIncrements;
|
||||
property Transparent : Boolean read GetTransparent write SetTransparent;
|
||||
property GapTop : Word read fGapTop write SetGapTop;
|
||||
property GapBottom : Word read fGapBottom write SetGapBottom;
|
||||
property BarThickness : Word read fBarThickness write SetBarThickness;
|
||||
property MarkerColor : TColor read fMarkerColor write SetMarkerColor;
|
||||
property ShowMarker : Boolean read fShowMarker write SetShowMarker;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
constructor TindGnouMeter.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
ControlStyle := ControlStyle + [csReplicatable, csSetCaption];
|
||||
width := 100;
|
||||
height := 200;
|
||||
fColorFore := clRed;
|
||||
fColorBack := clBtnFace;
|
||||
fMarkerColor := clBlue;
|
||||
fValueMin := 0;
|
||||
fValueMax := 100;
|
||||
fIncrement := 10;
|
||||
fShowIncrements := true;
|
||||
fShowMarker := true;
|
||||
fValue := 0;
|
||||
fGapTop := 20;
|
||||
fGapBottom := 10;
|
||||
fBarThickness := 5;
|
||||
fSignalUnit := 'Units';
|
||||
end;
|
||||
|
||||
destructor TindGnouMeter.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.CMTextChanged(var Message: TMessage);
|
||||
begin
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetValue(val : Double);
|
||||
begin
|
||||
if (val <> fValue) and (val >= fValueMin) and (val <= fValueMax) then begin
|
||||
fValue := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetColorFore(val : TColor);
|
||||
begin
|
||||
if val <> fColorFore then begin
|
||||
fColorFore := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetColorBack(val : TColor);
|
||||
begin
|
||||
if val <> fColorBack then begin
|
||||
fColorBack := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetSignalUnit(val : ShortString);
|
||||
begin
|
||||
if val <> fSignalUnit then begin
|
||||
fSignalUnit := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetValueMin(val : Double);
|
||||
begin
|
||||
if (val <> fValueMin) and (val <= fValue) then begin
|
||||
fValueMin := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetValueMax(val : Double);
|
||||
begin
|
||||
if (val <> fValueMax) and (val >= fValue) then begin
|
||||
fValueMax := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetDigits(val : Byte);
|
||||
begin
|
||||
if (val <> fDigits) then begin
|
||||
fDigits := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetIncrement(val : Double);
|
||||
begin
|
||||
if (val <> fIncrement) and (val > 0) then begin
|
||||
fIncrement := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetShowIncrements(val : Boolean);
|
||||
begin
|
||||
if (val <> fShowIncrements) then begin
|
||||
fShowIncrements := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TindGnouMeter.GetTransparent : Boolean;
|
||||
begin
|
||||
Result := not (csOpaque in ControlStyle);
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetTransparent(Val : Boolean);
|
||||
begin
|
||||
if Val <> Transparent then
|
||||
begin
|
||||
if Val then
|
||||
ControlStyle := ControlStyle - [csOpaque]
|
||||
else
|
||||
ControlStyle := ControlStyle + [csOpaque];
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetGapTop(val : Word);
|
||||
begin
|
||||
if (val <> fGapTop) then begin
|
||||
fGapTop := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetGapBottom(val : Word);
|
||||
begin
|
||||
if (val <> fGapBottom) then begin
|
||||
fGapBottom := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetBarThickness(val : Word);
|
||||
begin
|
||||
if (val <> fBarThickness) and (val > 0) then begin
|
||||
fBarThickness := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetMarkerColor(val : TColor);
|
||||
begin
|
||||
if (val <> fMarkerColor) then begin
|
||||
fMarkerColor := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.SetShowMarker(val : Boolean);
|
||||
begin
|
||||
if (val <> fShowMarker) then begin
|
||||
fShowMarker := val;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.DrawIncrements;
|
||||
var
|
||||
i : Double;
|
||||
PosPixels : Word;
|
||||
begin
|
||||
if fShowIncrements then begin
|
||||
With Canvas do begin
|
||||
i := fValueMin;
|
||||
While i <= fValueMax do begin
|
||||
PosPixels := ValueToPixels(i);
|
||||
pen.color := clGray;
|
||||
MoveTo(LeftMeter + BarThickness + 3, PosPixels-1);
|
||||
LineTo(LeftMeter + BarThickness + 7, PosPixels-1);
|
||||
pen.color := clWhite;
|
||||
MoveTo(LeftMeter + BarThickness + 3, PosPixels);
|
||||
LineTo(LeftMeter + BarThickness + 7, PosPixels);
|
||||
i := i+fIncrement;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.DrawMarker;
|
||||
begin
|
||||
If fShowMarker then begin
|
||||
With Canvas do begin
|
||||
pen.color := clWhite;
|
||||
Brush.Style := bsClear;
|
||||
MoveTo(LeftMeter - 2, ValueToPixels(fValue));
|
||||
LineTo(LeftMeter - 6, ValueToPixels(fValue)-4);
|
||||
LineTo(LeftMeter - 6, ValueToPixels(fValue)+4);
|
||||
pen.color := clGray;
|
||||
LineTo(LeftMeter - 2, ValueToPixels(fValue));
|
||||
|
||||
pen.color := fMarkerColor;
|
||||
Brush.color := fMarkerColor;
|
||||
Brush.Style := bsSolid;
|
||||
Polygon([Point(LeftMeter - 3, ValueToPixels(fValue)),
|
||||
Point(LeftMeter - 5, ValueToPixels(fValue)-2),
|
||||
Point(LeftMeter - 5, ValueToPixels(fValue)+2),
|
||||
Point(LeftMeter - 3, ValueToPixels(fValue))]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.DrawTopText;
|
||||
begin
|
||||
With Canvas do begin
|
||||
DisplayValue := Caption;
|
||||
Brush.Style := bsClear;
|
||||
TheRect := ClientRect;
|
||||
DrawStyle := DT_SINGLELINE + DT_NOPREFIX + DT_CENTER + DT_TOP;
|
||||
Font.Style := [fsBold];
|
||||
TopTextHeight := DrawText(Handle, PChar(DisplayValue), Length(DisplayValue), TheRect, DrawStyle);
|
||||
|
||||
Font.Style := [];
|
||||
TheRect.Top := TopTextHeight;
|
||||
DisplayValue := FloatToStrF(Value, ffFixed, 8, fDigits) + ' ' + fSignalUnit;
|
||||
TopTextHeight := TopTextHeight + DrawText(Handle, PChar(DisplayValue),
|
||||
Length(DisplayValue), TheRect, DrawStyle);
|
||||
TopTextHeight := TopTextHeight + fGapTop;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.DrawValueMin;
|
||||
begin
|
||||
With Canvas do begin
|
||||
TheRect := ClientRect;
|
||||
TheRect.Left := LeftMeter + BarThickness + 10;
|
||||
TheRect.Top := TopTextHeight;
|
||||
TheRect.Bottom := Height - fGapBottom + 6;
|
||||
Brush.Style := bsClear;
|
||||
DrawStyle := DT_SINGLELINE + DT_NOPREFIX + DT_LEFT + DT_BOTTOM;
|
||||
DisplayValue := FloatToStrF(ValueMin, ffFixed, 8, fDigits) + ' ' + fSignalUnit;
|
||||
DrawText(Handle, PChar(DisplayValue), Length(DisplayValue), TheRect, DrawStyle);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.DrawValueMax;
|
||||
begin
|
||||
With Canvas do begin
|
||||
TheRect := ClientRect;
|
||||
TheRect.Left := LeftMeter + BarThickness + 10;
|
||||
TheRect.Top := TopTextHeight - 6;
|
||||
Brush.Style := bsClear;
|
||||
DrawStyle := DT_SINGLELINE + DT_NOPREFIX + DT_LEFT + DT_TOP;
|
||||
DisplayValue := FloatToStrF(ValueMax, ffFixed, 8, fDigits) + ' ' + fSignalUnit;
|
||||
DrawText(Handle, PChar(DisplayValue), Length(DisplayValue), TheRect, DrawStyle);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.DrawMeterBar;
|
||||
begin
|
||||
With Canvas do begin
|
||||
pen.Color := fColorBack;
|
||||
Brush.Color := fColorBack;
|
||||
Brush.Style := bsSolid;
|
||||
Rectangle(LeftMeter, ValueToPixels(fValueMax), LeftMeter + fBarThickness, ValueToPixels(fValueMin));
|
||||
|
||||
pen.Color := fColorFore;
|
||||
Brush.Color := fColorFore;
|
||||
Brush.Style := bsSolid;
|
||||
Rectangle(LeftMeter + 1, ValueToPixels(fValue), LeftMeter + fBarThickness, ValueToPixels(fValueMin));
|
||||
|
||||
pen.color := clWhite;
|
||||
Brush.Style := bsClear;
|
||||
MoveTo(LeftMeter + fBarThickness-1, ValueToPixels(fValueMax));
|
||||
LineTo(LeftMeter, ValueToPixels(fValueMax));
|
||||
LineTo(LeftMeter, ValueToPixels(fValueMin)-1);
|
||||
|
||||
pen.color := clGray;
|
||||
LineTo(LeftMeter + fBarThickness, ValueToPixels(fValueMin)-1);
|
||||
LineTo(LeftMeter + fBarThickness, ValueToPixels(fValueMax));
|
||||
|
||||
If (fValue > fValueMin) and (fValue < fValueMax) then begin
|
||||
pen.color := clWhite;
|
||||
MoveTo(LeftMeter+1, ValueToPixels(fValue));
|
||||
LineTo(LeftMeter + fBarThickness, ValueToPixels(fValue));
|
||||
pen.color := clGray;
|
||||
MoveTo(LeftMeter+1, ValueToPixels(fValue)-1);
|
||||
LineTo(LeftMeter + fBarThickness, ValueToPixels(fValue)-1);
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
Function TindGnouMeter.ValueToPixels(val : Double) : Integer;
|
||||
var
|
||||
factor : Double;
|
||||
begin
|
||||
Result := 0;
|
||||
If fValueMax > fValueMin then begin
|
||||
Factor := (Height-fGapBottom-TopTextHeight)/(fValueMin-fValueMax);
|
||||
Result := Round(Factor*val -Factor*fValueMax+TopTextHeight);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TindGnouMeter.Paint;
|
||||
begin
|
||||
LeftMeter := (Width DIV 2) -10 - fBarThickness;
|
||||
With Canvas do
|
||||
begin
|
||||
if not Transparent then
|
||||
begin
|
||||
Brush.Color := Self.Color;
|
||||
Brush.Style := bsSolid;
|
||||
FillRect(ClientRect);
|
||||
end;
|
||||
Brush.Style := bsClear;
|
||||
DrawTopText;
|
||||
DrawValueMin;
|
||||
DrawValueMax;
|
||||
DrawMeterBar;
|
||||
DrawMarker;
|
||||
DrawIncrements;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
381
components/IndustrialStuff/source/indled.pas
Normal file
@ -0,0 +1,381 @@
|
||||
{ Component(s):
|
||||
TindLed ---> old cindy name tcyled
|
||||
|
||||
Description:
|
||||
A simple led with Group feature
|
||||
depending on the state: ON/OFF/DISABLE
|
||||
|
||||
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mauricio
|
||||
* (https://sourceforge.net/projects/tcycomponents/).
|
||||
*
|
||||
* No contributors for now ...
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or the
|
||||
* GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which
|
||||
* case the provisions of the GPL or the LGPL are applicable instead of those
|
||||
* above. If you wish to allow use of your version of this file only under the
|
||||
* terms of either the GPL or the LGPL, and not to allow others to use your
|
||||
* version of this file under the terms of the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice and other
|
||||
* provisions required by the LGPL or the GPL. If you do not delete the
|
||||
* provisions above, a recipient may use your version of this file under the
|
||||
* terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****}
|
||||
|
||||
{**********************************************************************
|
||||
Package pl_Cindy.pkg
|
||||
for CodeTyphon Studio (http://www.pilotlogic.com/)
|
||||
***********************************************************************
|
||||
Modified by Jurassic Pork 2013 for package Industrial of Lazarus}
|
||||
|
||||
unit IndLed;
|
||||
|
||||
{$MODE Delphi}
|
||||
|
||||
interface
|
||||
|
||||
uses Classes, Types, Controls, Graphics, cyBaseLed, cyTypes, cyClasses, cyGraphics;
|
||||
|
||||
type
|
||||
TShapeType = (stRectangle, stRoundRect, stEllipse);
|
||||
|
||||
TcyCustomLed = class(TcyBaseLed)
|
||||
private
|
||||
FLedColorOn: TColor;
|
||||
FLedColorOff: TColor;
|
||||
FLedColorDisabled: TColor;
|
||||
FShapeRoundRectX: Integer;
|
||||
FShapeRoundRectY: Integer;
|
||||
FShapeLedColorOn: TColor;
|
||||
FShapeLedColorOff: TColor;
|
||||
FShapeLedColorDisabled: TColor;
|
||||
FBevels: TcyBevels;
|
||||
FShapeType: TShapeType;
|
||||
FShapePenWidth: Word;
|
||||
FTransparent: boolean;
|
||||
procedure SetShapeLedColorOn(Value: TColor);
|
||||
procedure SetShapePenWidth(Value: Word);
|
||||
procedure SetShapeType(Value: TShapeType);
|
||||
procedure SetShapeRoundRectX(Value: Integer);
|
||||
procedure SetShapeRoundRectY(Value: Integer);
|
||||
procedure SetBevels(const Value: TcyBevels);
|
||||
procedure SetLedColorDisabled(Value: TColor);
|
||||
procedure SetLedColorOff(Value: TColor);
|
||||
procedure SetLedColorOn(Value: TColor);
|
||||
procedure SetTransparent(const Value: boolean);
|
||||
procedure SetShapeLedColorDisabled(const Value: TColor);
|
||||
procedure SetShapeLedColorOff(const Value: TColor);
|
||||
protected
|
||||
procedure Paint; override;
|
||||
function TransparentColorAtPos(Point: TPoint): boolean; override;
|
||||
property Transparent: boolean read FTransparent write SetTransparent default false;
|
||||
property LedColorOn: TColor read FLedColorOn write SetLedColorOn;
|
||||
property LedColorOff: TColor read FLedColorOff write SetLedColorOff;
|
||||
property LedColorDisabled: TColor read FLedColorDisabled write SetLedColorDisabled;
|
||||
property ShapeLedColorOn: TColor read FShapeLedColorOn write SetShapeLedColorOn;
|
||||
property ShapeLedColorOff: TColor read FShapeLedColorOff write SetShapeLedColorOff;
|
||||
property ShapeLedColorDisabled: TColor read FShapeLedColorDisabled write SetShapeLedColorDisabled;
|
||||
property ShapePenWidth: Word read FShapePenWidth write SetShapePenWidth default 1;
|
||||
property ShapeType: TShapeType read FShapeType write SetShapeType default stRectangle;
|
||||
property ShapeRoundRectX: Integer read FShapeRoundRectX write SetShapeRoundRectX default 10;
|
||||
property ShapeRoundRectY: Integer read FShapeRoundRectY write SetShapeRoundRectY default 10;
|
||||
property Bevels: TcyBevels read FBevels write SetBevels;
|
||||
property Height default 25;
|
||||
property Width default 25;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
published
|
||||
end;
|
||||
|
||||
TindLed = class(TcyCustomLed)
|
||||
private
|
||||
protected
|
||||
public
|
||||
published
|
||||
property Align;
|
||||
property Anchors;
|
||||
property Color;
|
||||
property Constraints;
|
||||
property Enabled;
|
||||
property Visible;
|
||||
property OnClick;
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
// Herited from TcyBaseLed :
|
||||
property AllowAllOff;
|
||||
property GroupIndex;
|
||||
property LedValue;
|
||||
property ReadOnly;
|
||||
// Herited from TcyCustomLed :
|
||||
property Bevels;
|
||||
property LedColorOn;
|
||||
property LedColorOff;
|
||||
property LedColorDisabled;
|
||||
property ShapeLedColorOn;
|
||||
property ShapeLedColorOff;
|
||||
property ShapeLedColorDisabled;
|
||||
property ShapePenWidth;
|
||||
property ShapeType;
|
||||
property ShapeRoundRectX;
|
||||
property ShapeRoundRectY;
|
||||
property Transparent;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('Industrial Stuff',[TindLed]);
|
||||
end;
|
||||
|
||||
constructor TcyCustomLed.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FBevels := TcyBevels.Create(self, TcyBevel);
|
||||
|
||||
// Determine at design time if
|
||||
// the form is loading or if we have just added the component at design time :
|
||||
if csDesigning in ComponentState
|
||||
then
|
||||
if Owner <> nil
|
||||
then
|
||||
if not (csLoading in Owner.ComponentState) // we have just added the component at design time
|
||||
then begin
|
||||
with FBevels.Add do // Frame
|
||||
begin
|
||||
HighlightColor := clBlack;
|
||||
ShadowColor := clBlack;
|
||||
end;
|
||||
|
||||
with FBevels.Add do // Inner 3D frame
|
||||
Width := 3;
|
||||
|
||||
with FBevels.Add do // Contrast Frame
|
||||
Style := bcLowered;
|
||||
|
||||
with FBevels.Add do // Border between Bevels and Shape
|
||||
begin
|
||||
HighlightColor := clBlack;
|
||||
ShadowColor := clBlack;
|
||||
Width := 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
FTransparent := false;
|
||||
FShapeType := stRectangle;
|
||||
FShapePenWidth:= 1;
|
||||
FShapeRoundRectX := 10;
|
||||
FShapeRoundRectY := 10;
|
||||
FShapeLedColorOn := clGreen;
|
||||
FShapeLedColorOff := $00004000; // Dark green
|
||||
FShapeLedColorDisabled := $00003468; // Dark maroon
|
||||
FLedColorOn:= clLime;
|
||||
FLedColorOff:= clGreen;
|
||||
FLedColorDisabled:= $000059B3; // Maroon
|
||||
Height := 25;
|
||||
Width := 25;
|
||||
end;
|
||||
|
||||
destructor TcyCustomLed.Destroy;
|
||||
begin
|
||||
FBevels.Free;
|
||||
FBevels := Nil;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TcyCustomLed.Paint;
|
||||
var
|
||||
Rect: TRect;
|
||||
begin
|
||||
Rect := ClientRect;
|
||||
// Draw background :
|
||||
if not FTransparent
|
||||
then begin
|
||||
Canvas.Brush.Color := Color;
|
||||
Canvas.FillRect(Rect);
|
||||
end;
|
||||
|
||||
Bevels.DrawBevels(Canvas, Rect, false);
|
||||
|
||||
case ledStatus of
|
||||
lsOn: Canvas.Brush.Color := FLedColorOn;
|
||||
lsOff: Canvas.Brush.Color := FLedColorOff;
|
||||
lsDisabled: Canvas.Brush.Color := FLedColorDisabled;
|
||||
end;
|
||||
|
||||
if FShapePenWidth > 0
|
||||
then begin
|
||||
Rect := classes.Rect(Rect.Left + FShapePenWidth div 2,
|
||||
Rect.Top + FShapePenWidth div 2,
|
||||
Rect.Right - (FShapePenWidth-1) div 2,
|
||||
Rect.Bottom - (FShapePenWidth-1) div 2);
|
||||
|
||||
case ledStatus of
|
||||
lsOn: Canvas.Pen.Color := FShapeLedColorOn;
|
||||
lsOff: Canvas.Pen.Color := FShapeLedColorOff;
|
||||
lsDisabled: Canvas.Pen.Color := FShapeLedColorDisabled;
|
||||
end;
|
||||
|
||||
Canvas.Pen.Width := FShapePenWidth;
|
||||
end
|
||||
else begin
|
||||
Canvas.Pen.Color := Canvas.Brush.Color;
|
||||
Canvas.Pen.Width := 1;
|
||||
end;
|
||||
|
||||
case FShapeType of
|
||||
stRectangle: canvas.Rectangle(Rect);
|
||||
stRoundRect: canvas.RoundRect(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, ShapeRoundRectX, ShapeRoundRectY);
|
||||
stEllipse : canvas.Ellipse(Rect);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TcyCustomLed.TransparentColorAtPos(Point: TPoint): boolean;
|
||||
begin
|
||||
RESULT := false;
|
||||
|
||||
if FTransparent and (Bevels.Count = 0) and (FShapeType = stEllipse)
|
||||
then RESULT := not PointInEllispe(Point, ClientRect);
|
||||
end;
|
||||
|
||||
procedure TcyCustomLed.SetTransparent(const Value: boolean);
|
||||
begin
|
||||
if value <> FTransparent
|
||||
then begin
|
||||
FTransparent := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomLed.SetShapeLedColorOn(Value: TColor);
|
||||
begin
|
||||
if value <> FShapeLedColorOn
|
||||
then begin
|
||||
FShapeLedColorOn := Value;
|
||||
|
||||
if GetLedStatus = lsOn
|
||||
then Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomLed.SetShapeLedColorOff(const Value: TColor);
|
||||
begin
|
||||
if value <> FShapeLedColorOff
|
||||
then begin
|
||||
FShapeLedColorOff := Value;
|
||||
|
||||
if GetLedStatus = lsOff
|
||||
then Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomLed.SetShapeLedColorDisabled(const Value: TColor);
|
||||
begin
|
||||
if value <> FShapeLedColorDisabled
|
||||
then begin
|
||||
FShapeLedColorDisabled := Value;
|
||||
|
||||
if GetLedStatus = lsDisabled
|
||||
then Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomLed.SetShapePenWidth(Value: Word);
|
||||
begin
|
||||
if value <> FShapePenWidth
|
||||
then begin
|
||||
FShapePenWidth := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomLed.SetShapeRoundRectX(Value: Integer);
|
||||
begin
|
||||
if Value <> FShapeRoundRectX
|
||||
then begin
|
||||
FShapeRoundRectX := value;
|
||||
|
||||
if FShapeType = stRoundRect
|
||||
then Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomLed.SetShapeRoundRectY(Value: Integer);
|
||||
begin
|
||||
if Value <> FShapeRoundRectY
|
||||
then begin
|
||||
FShapeRoundRectY := value;
|
||||
|
||||
if FShapeType = stRoundRect
|
||||
then Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomLed.SetShapeType(Value: TShapeType);
|
||||
begin
|
||||
if value <> FShapeType
|
||||
then begin
|
||||
FShapeType := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomLed.SetLedColorOn(Value: TColor);
|
||||
begin
|
||||
if value <> FLedColorOn
|
||||
then begin
|
||||
FLedColorOn := Value;
|
||||
|
||||
if GetLedStatus = lsOn
|
||||
then Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomLed.SetLedColorOff(Value: TColor);
|
||||
begin
|
||||
if value <> FLedColorOff
|
||||
then begin
|
||||
FLedColorOff := Value;
|
||||
|
||||
if GetLedStatus = lsOff
|
||||
then Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomLed.SetLedColorDisabled(Value: TColor);
|
||||
begin
|
||||
if value <> FLedColorDisabled
|
||||
then begin
|
||||
FLedColorDisabled := Value;
|
||||
|
||||
if GetLedStatus = lsDisabled
|
||||
then Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TcyCustomLed.SetBevels(const Value: TcyBevels);
|
||||
begin
|
||||
FBevels := Value;
|
||||
end;
|
||||
|
||||
end.
|
||||
102
components/IndustrialStuff/source/industrial_icons.lrs
Normal file
@ -0,0 +1,102 @@
|
||||
LazarusResources.Add('tanalogsensor','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#2#0#0#0'o'#21#170#175
|
||||
+#0#0#0#136'IDATx'#156#229#210'Y'#10#192' '#12#4#208#220#255'T'#189'Y'#170'M'
|
||||
+#234#146#140#11'*'#244#163#131'HP|'#26#144#174'C'#161#127'B'#228#178#2#197's'
|
||||
+#252#140'0iz'#22#216#208#219#25'@'#138'!'#206'.UD'#5'%N'#223#214#131'Da'#26
|
||||
+'C'#222'"'#163#200'`'#208#154#133#140'E'#173#142#178#213#134'J'#171#9'ek'#30
|
||||
+#130'J'#182'"'#132#149#210#26'@b'#157#129'^k'#18#218#11#248#144#203#25'@'#161
|
||||
+'''X'#175'@r>'#21'[/*'#231'-'#200#215#223'A'#243'9'#6#221'`TUS'#201#214#10
|
||||
+#161#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('tgrarrow','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#21#0#0#0#21#8#2#0#0#0'&u2'#193#0#0
|
||||
+#0']IDATx'#156#173#204#193#17#192' '#12#3'A'#247'_'#5'%'#166#131'0'#227#135
|
||||
+#25#130'1'#146#200#253#247#236#185#203'~'#240#230#221'z'#237#242#245#236'%'
|
||||
+#247#248#165#242#200#229#236#235#11#234'w'#23#206#175#23#218#191#158#226'C6'
|
||||
+#143#240#171'D}*'#3'W'#254'('#183#30#148#137#167#228#228#5'9yA'#14#31'Q2'#241
|
||||
+'B'#29#230#217'<'#238#189'v'#138#229#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('tindadvled','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#4'sBIT'#8#8#8#8'|'#8'd'#136#0#0#0#9'pHYs'#0#0#11#18#0#0#11#18#1#210#221
|
||||
+'~'#252#0#0#0#22'tEXtCreation Time'#0'06/12/11'#132'x2'#182#0#0#0#28'tEXtSof'
|
||||
+'tware'#0'Adobe Fireworks CS5q'#181#227'6'#0#0#2'kIDATH'#137#157#150'1n'#27
|
||||
+'1'#16'E'#31#5#245#193#186#222#130#128'}'#15#205#1'r'#131#24#200#22#190#135
|
||||
+#215'Ez'#31#192#5#13'(7'#200#1'f'#1#187#247#1#20'`'#12#168#150#236#218#2#152
|
||||
+#130'Kjw%9J'#6#160#176'$'#135#255#15'?gH'#185#24'#'#231#152'sn'#3'T'#185#31
|
||||
+'ct'#231#172#155#159#11#218#182'-'#222'_'#245'3+'#156's9'#178'm'#140#241#226
|
||||
+'$H'#140#241#160#1#27'`'#19#194'2'#170'j'#28#217#199'[i'#170#26'CX'#198#236
|
||||
+#127#12#235'`'#7#206#185'M'#219#182#149'\'#11#139#203#197'~b'#247'>'#242#235
|
||||
+'^_'#160#6'_'#215#168'j'#165#170'8'#231'6'#211#221#184#225#25'd'#240#219#219
|
||||
+#219'1'#235#238#157#238#249#5#179'u'#25#242#190#134#26#216#15'a'#182#166'i'
|
||||
+#174'G'#146#21#130'S'#224#221'cG0'#5#20'/'#138#1#170#130#7'<B#2'#242#159#146
|
||||
+#140#8#226#199'['#197#252'K'#137#250#238#231'='#230'['#188#159#10#9#214#255
|
||||
+#152#10#141#191'I;'#234'MD'#10#193','#131#135#176#28#131#255#184#7'Q'#196#11
|
||||
+#158#220'&'#230#193'7J'#176#135'"'#159#217#154#16#150'U'#159#129#229#144#171
|
||||
+#239#223#190#150'u'#143'?'#127'a^i'#16#216#245#18#204#147'<'#160#25#187#239
|
||||
+#131#23'%'#4'h'#164'M'#253#193'nf}'#244#228#232#187#223#29'j'#15#189#222#202
|
||||
+#226'r1'#206#166'c'#230#129'F1S<'#245'h'#23's'#160#26'2'#218#19' Z'#250#221
|
||||
+#235#221#231#224#153#195#131#161#128#12#135#171'q'#29#236#222#25#230#157#161
|
||||
+#163#233'a'#223#142#144#24'`'#195#188'exU'#244#133'd'#172'0'#163'd'#206#148
|
||||
+#228#20'x'#153#240'`'#182'*C'#179#169#143#231#234'S'#144#147#224'i'#241#129
|
||||
+#205#128'Q'#133#14'Q'#236'H;i'#214#227#247#209'['#239'<'#139'1'#186#166#185#6
|
||||
+#210#253#146#14'\'#254#130'v'#4#223'Re[O'#22'B'#187#141'1'#186','#209#182'{~'
|
||||
+'I_54'#254#6'S'#249''''#2'oR'#136#134#177#205#0'b'#140#23'"'#178#5'`'#157#10
|
||||
+'E'#188'`'#225#156#208#129#144'*='#203#210'G'#191#191'*'#138#239#211#254','
|
||||
+#196#11#141'_bA0'#229'P2#'#21#245#4'|j'#7#215'u'#8#203'q'#225#25#152#165'*'
|
||||
+#29'e'#137#129#247'R|'#178#13#163'? '#152#146#228#236#26'~'#239#9'V)'#179'>'
|
||||
+#1#135'#or'#140#241'"'#223#132'S'#162#20#237#190#136#178'l!'#180#219#188'v'
|
||||
+#138'w'#244#209'/'#143'EO'#148#201#24#128#183'm'#2'='#5#156#237'@'#162#147
|
||||
+#142#255#249#183#229#15#187#175#156#165#150#179#179'c'#0#0#0#0'IEND'#174'B`'
|
||||
+#130
|
||||
]);
|
||||
LazarusResources.Add('tindgnoumeter','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#4'sBIT'#8#8#8#8'|'#8'd'#136#0#0#0#9'pHYs'#0#0#10#240#0#0#10#240#1'B'#172
|
||||
+'4'#152#0#0#0#22'tEXtCreation Time'#0'09/30/08'#194'>PQ'#0#0#0#28'tEXtSoftwa'
|
||||
+'re'#0'Adobe Fireworks CS4'#6#178#211#160#0#0#0#195'IDATH'#137#237#149'a'#14
|
||||
+#131' '#12#133#223'[v'#175'y'#179#218#155#193#201#186#31#19#194#176#168'(Y'
|
||||
+#150'l_bR'#8#188#167#180'R'#154#25'*'#242#132#170'BD'#168#170'yNDX.&if'#198
|
||||
+#20#3'@'#26#3#192#189'V'#7#128#24#227#219'XD'#188'eY0'#197'!'#132#149#233#205
|
||||
+#221#233'h'#21'O'#166'|'#211#22#238#23#156#193#204'x'#248#136'z'#133#189#184
|
||||
+#203'`+'#201'{'#28'2h%y'#152#1#170#228#246'p'#180#138'N'#243#25#3#18#171#223
|
||||
+'y'#20'9'#7'$'#204#236'u'#214#143'i'#2#0#132'y'#6'0'#168#138#146#184#199#229
|
||||
+'*'#218#18'_'#248#225'*'#250'_'#21#187'|'#127#146'IZ'#217':k.5'#156'V'#31#238
|
||||
+'6'#24'^E'#186#220'A'#133#168#187#185#213#135'K'#158#127'$a'#132#192'k6'#232
|
||||
+#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('tindled','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#4'sBIT'#8#8#8#8'|'#8'd'#136#0#0#0#9'pHYs'#0#0#11#18#0#0#11#18#1#210#221
|
||||
+'~'#252#0#0#0#28'tEXtSoftware'#0'Adobe Fireworks CS5q'#181#227'6'#0#0#0#22't'
|
||||
+'EXtCreation Time'#0'06/12/11'#132'x2'#182#0#0#0#145'IDATH'#137#237#150'a'#10
|
||||
+#131'0'#12#133#191#140#222#210'A'#189#201#244'&'#10#219'9'#159#191'&'#235#156
|
||||
+#221'\'#27'D'#240'A!%'#229'}$'#165#164'&'#9'O'#5#0'3s'#163'\'#158#129#164#170
|
||||
+'k'#24#238')'#160#166#198#241'1'#199'!'#151#252'G16'#201'~'#1#0'h'#219'k5'
|
||||
+#128'K'#139'^'#245#177#130'Y'#221#6#167#149#179'y'#0#192#237#7#243'~='#229
|
||||
+#222#162#19'p'#2#14#0#248#254#208'2'#143#168#28#208#149#153#195#30'w'#16'cS4'
|
||||
+#201#222#149#180#168't'#216'd+'#240'0'#7'0I'#174#191#138#9#166#153#129#188
|
||||
+#147#131#15#235#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('tlednumber','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#14#0#0#0#24#8#6#0#0#0#202#199#204
|
||||
+'W'#0#0#0#1'sRGB'#0#174#206#28#233#0#0#0#6'bKGD'#0#255#0#255#0#255#160#189
|
||||
+#167#147#0#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#0#7'tIME'#7#221
|
||||
+#5#14#11'; A'#194'}'#3#0#0#0'[IDAT8'#203'cd``'#248#207'@'#6'`b '#19'PQ'#227
|
||||
+#127#28'X'#155#144'FF'#28#152#11'S'#217#127#20#219#24'q'#184#13'Mn0'#4#14'}5'
|
||||
+#222#193#163#242#14#190'Pe@'#226#189#128#210#18'H*'#241'j$'#203#169#248#140
|
||||
+#248'?L'#162#131'l'#141#183#169#17#143#216#178#27#245#227'qPk'#4#0#160#183#22
|
||||
+#199']'#6#217'.'#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('tstoplightsensor','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#20#0#0#0#24#8#2#0#0#0'u)J!'#0#0#0#1
|
||||
+'sRGB'#0#174#206#28#233#0#0#0#6'bKGD'#0#255#0#255#0#255#160#189#167#147#0#0#0
|
||||
+#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#0#7'tIME'#7#221#5#17#8#20#1
|
||||
+#21#139#172#160#0#0#0#130'IDAT8'#203#229#147'1'#14#128' '#20'C'#27#195#225
|
||||
+#184#144#3#19'ur'#240'B'#142#189#25'n'#132#24#249#130#17#23';'#241#19'^'#154
|
||||
+#254#230'C'#146'$'#146'h'#22#201#148#146'$g'#127':=Nr'#6#25'3C^'#242#211'='#9
|
||||
+#196'.'#184'QU'#231#165#176'Z*'#206'Vf<^'#152#193#188#147'yX'#207#193'o'#197
|
||||
+#212#211'sA"'#248#237#195#158#215'}'#206#227#186#207#253'='#227#127'='#179
|
||||
+#200#220#215's&'#1#16'_'#222's'#139#179#153'y'#232'='#31#161#199'XO'#233'z'
|
||||
+#22#155#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
536
components/IndustrialStuff/source/lednumber.pas
Normal file
@ -0,0 +1,536 @@
|
||||
{*********************************************************}
|
||||
{* VPLEDLABEL.PAS 1.03 -> LEDNumber.PAS *}
|
||||
{*********************************************************}
|
||||
|
||||
{* ***** BEGIN LICENSE BLOCK ***** *}
|
||||
{* Version: MPL 1.1 *}
|
||||
{* *}
|
||||
{* The contents of this file are subject to the Mozilla Public License *}
|
||||
{* Version 1.1 (the "License"); you may not use this file except in *}
|
||||
{* compliance with the License. You may obtain a copy of the License at *}
|
||||
{* http://www.mozilla.org/MPL/ *}
|
||||
{* *}
|
||||
{* Software distributed under the License is distributed on an "AS IS" basis, *}
|
||||
{* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License *}
|
||||
{* for the specific language governing rights and limitations under the *}
|
||||
{* License. *}
|
||||
{* *}
|
||||
{* The Original Code is TurboPower Visual PlanIt *}
|
||||
{* *}
|
||||
{* The Initial Developer of the Original Code is TurboPower Software *}
|
||||
{* *}
|
||||
{* Portions created by TurboPower Software Inc. are Copyright (C) 2002 *}
|
||||
{* TurboPower Software Inc. All Rights Reserved. *}
|
||||
{* *}
|
||||
{* Contributor(s): *}
|
||||
{* Modified by Jurassic Pork for include in industrial Stuff Lazarus package *}
|
||||
{* 05/2013 *}
|
||||
{* ***** END LICENSE BLOCK ***** *}
|
||||
|
||||
unit LedNumber;
|
||||
{- }
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
LMessages,LCLProc,LCLType,LCLIntf,LResources,
|
||||
Classes, Controls, Graphics, SysUtils;
|
||||
|
||||
type
|
||||
TSegmentSize = 2..10;
|
||||
|
||||
TCustomLEDNumber = class(TGraphicControl)
|
||||
protected{private}
|
||||
FBgColor : TColor;
|
||||
FOffColor : TColor;
|
||||
FOnColor : TColor;
|
||||
FColumns : Integer;
|
||||
FRows : Integer;
|
||||
FSize : TSegmentSize;
|
||||
lbDrawBmp : TBitmap;
|
||||
procedure CMTextChanged(var Message: {$IFDEF LCL}TLMessage{$ELSE}TMessage{$ENDIF}); message CM_TEXTCHANGED;
|
||||
procedure Initialize(var Points: array of TPoint);
|
||||
function NewOffset(xOry: char; OldOffset: Integer): Integer;
|
||||
procedure ProcessCaption(Points: array of TPoint);
|
||||
procedure PaintSegment(Segment: Integer; TheColor: TColor;
|
||||
Points: array of TPoint; OffsetX, OffsetY: Integer);
|
||||
procedure ResizeControl(Row, Col, Size: Integer);
|
||||
function GetAbout: string;
|
||||
procedure SetAbout(const Value: string);
|
||||
procedure SetSize(Value: TSegmentSize);
|
||||
procedure SetOnColor(Value: TColor);
|
||||
procedure SetOffColor(Value: TColor);
|
||||
procedure SetRows(Value: Integer);
|
||||
procedure SetColumns(Value: Integer);
|
||||
procedure SetbgColor(Value: TColor);
|
||||
procedure SelectSegments(Segment: Word; Points: array of TPoint;
|
||||
OffsetX, OffsetY: Integer);
|
||||
protected
|
||||
procedure Paint; override;
|
||||
public
|
||||
constructor Create(AOwner:TComponent);override;
|
||||
destructor Destroy; override;
|
||||
{properties}
|
||||
property Version: string read GetAbout write SetAbout stored False;
|
||||
property Columns: Integer read FColumns write SetColumns default 10;
|
||||
property Rows: Integer read FRows write SetRows default 1;
|
||||
property BgColor: TColor read FbgColor write SetbgColor default clBlack;
|
||||
property OffColor: TColor read FOffColor write SetOffColor default $00104E4A;
|
||||
property OnColor: TColor read FOnColor write SetOnColor default clYellow;
|
||||
property Size: TSegmentSize read FSize write SetSize default 2;
|
||||
{Inherited properties}
|
||||
property Caption;
|
||||
property OnClick;
|
||||
property OnDblClick;
|
||||
property OnDragDrop;
|
||||
property OnDragOver;
|
||||
property OnEndDrag;
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
property ShowHint;
|
||||
property Visible;
|
||||
end;
|
||||
|
||||
TLEDNumber = class(TCustomLEDNumber)
|
||||
published
|
||||
property Version;
|
||||
property Caption;
|
||||
property Columns;
|
||||
property Rows;
|
||||
property OnClick;
|
||||
property OnDblClick;
|
||||
property OnDragDrop;
|
||||
property OnDragOver;
|
||||
property OnEndDrag;
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property BgColor;
|
||||
property OffColor;
|
||||
property OnColor;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
property Size;
|
||||
property ShowHint;
|
||||
property Visible;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
// uses
|
||||
// VpConst;
|
||||
|
||||
{ LED Segment Map }
|
||||
{ }
|
||||
{ ------------------------ }
|
||||
{ | 1 | }
|
||||
{ ------------------------ }
|
||||
{ | | \ | | / | | }
|
||||
{ | | \ | | / | | }
|
||||
{ | | \ | | / | | }
|
||||
{ |2 |\3 \ |4 | /5 /|6 | }
|
||||
{ | | \ \| |/ / | | }
|
||||
{ | | \ | | / | | }
|
||||
{ ----------- ----------- }
|
||||
{ | 7 \/ 8 | }
|
||||
{ -----------/\----------- }
|
||||
{ | | / | | \ | | }
|
||||
{ | | / /| |\ \ | | }
|
||||
{ |9 |/10 / |11| \12 \|13| }
|
||||
{ | | / | | \ | | }
|
||||
{ | | / | | \ | | }
|
||||
{ | | / | | \ | | }
|
||||
{ ------------------------ |-----| }
|
||||
{ | 14 | | * | }
|
||||
{ ------------------------ |-----| }
|
||||
{ }
|
||||
{ * Period and comma are drawn here }
|
||||
{ Colon is drawn in the center of }
|
||||
{ segments 4 and 11 }
|
||||
|
||||
{ Each segment is made up of 6 points. The segments that don't need 6 points, }
|
||||
{ such as the period and colon dots, return to the coordinates of the initial }
|
||||
{ point for the remaining unused points. }
|
||||
|
||||
const
|
||||
{LED SEGMENT ARRAYS}
|
||||
MAX_POINTS = 107;
|
||||
|
||||
DigitPoints: array[0..MAX_POINTS] of TPoint =
|
||||
{Segment 1}
|
||||
((X:2;Y:2),(X:3;Y:1),(X:11;Y:1),(X:12;Y:2),(X:11;Y:3),(X:3;Y:3),
|
||||
{Segment 2}
|
||||
(X:2;Y:3),(X:3;Y:4),(X:3;Y:12),(X:2;Y:13),(X:1;Y:12),(X:1;Y:4),
|
||||
{Segment 3}
|
||||
(X:3;Y:3),(X:6;Y:9),(X:6;Y:13),(X:3;Y:7),(X:3;Y:3),(X:3;Y:3),
|
||||
{Segment 4}
|
||||
(X:7;Y:3),(X:8;Y:4),(X:8;Y:12),(X:7;Y:13),(X:6;Y:12),(X:6;Y:4),
|
||||
{Segment 5}
|
||||
(X:11;Y:3),(X:11;Y:7),(X:8;Y:13),(X:8;Y:9),(X:11;Y:3),(X:11;Y:3),
|
||||
{Segment 6}
|
||||
(X:12;Y:3),(X:13;Y:4),(X:13;Y:12),(X:12;Y:13),(X:11;Y:12),(X:11;Y:4),
|
||||
{Segment 7}
|
||||
(X:2;Y:14),(X:3;Y:13),(X:6;Y:13),(X:7;Y:14),(X:6;Y:15),(X:3;Y:15),
|
||||
{Segment 8}
|
||||
(X:7;Y:14),(X:8;Y:13),(X:11;Y:13),(X:12;Y:14),(X:11;Y:15),(X:8;Y:15),
|
||||
{Segment 9}
|
||||
(X:2;Y:15),(X:3;Y:16),(X:3;Y:24),(X:2;Y:25),(X:1;Y:24),(X:1;Y:16),
|
||||
{Segment 10}
|
||||
(X:6;Y:15),(X:6;Y:19),(X:3;Y:25),(X:3;Y:21),(X:6;Y:15),(X:6;Y:15),
|
||||
{Segment 11}
|
||||
(X:7;Y:15),(X:8;Y:16),(X:8;Y:24),(X:7;Y:25),(X:6;Y:24),(X:6;Y:16),
|
||||
{Segment 12}
|
||||
(X:8;Y:15),(X:11;Y:21),(X:11;Y:25),(X:8;Y:19),(X:8;Y:15),(X:8;Y:15),
|
||||
{Segment 13}
|
||||
(X:12;Y:15),(X:13;Y:16),(X:13;Y:24),(X:12;Y:25),(X:11;Y:24),(X:11;Y:16),
|
||||
{Segment 14}
|
||||
(X:2;Y:26),(X:3;Y:25),(X:11;Y:25),(X:12;Y:26),(X:11;Y:27),(X:3;Y:27),
|
||||
{Period }
|
||||
(X:14;Y:25),(X:16;Y:25),(X:16;Y:27),(X:14;Y:27),(X:14;Y:25),(X:14;Y:25),
|
||||
{Comma }
|
||||
(X:14;Y:25),(X:16;Y:25),(X:16;Y:27),(X:13;Y:30),(X:14;Y:27),(X:14;Y:25),
|
||||
{Colon Top }
|
||||
(X:5;Y:7),(X:9;Y:7),(X:9;Y:10),(X:5;Y:10),(X:5;Y:7),(X:5;Y:7),
|
||||
{Colon Btm }
|
||||
(X:5;Y:20),(X:9;Y:20),(X:9;Y:23),(X:5;Y:23),(X:5;Y:20),(X:5;Y:20));
|
||||
|
||||
Characters: Array[0..72] of Word =
|
||||
($0000,$3B70,$1320,$0001,$0300,$0002,$0840,$CCCC,$1020,$8784,
|
||||
{ ' ' * + , - . / 0 1 2 }
|
||||
$870C,$4708,$C30C,$C38C,$8408,$C78C,$C70C,$0810,$2040,$C788,
|
||||
{ 3 4 5 6 7 8 9 < > A }
|
||||
$952C,$C084,$942C,$C384,$C380,$C18C,$4788,$9024,$048C,$4A90,
|
||||
{ B C D E F G H I J K }
|
||||
$4084,$6C88,$6498,$C48C,$C780,$C49E,$C790,$C214,$9020,$448C,
|
||||
{ L M N O P Q R S T U }
|
||||
$48C0,$44D8,$2850,$2820,$8844,$2010,$C788,$952C,$C084,$942C,
|
||||
{ V W X Y Z / a b c d }
|
||||
$C384,$C380,$C18C,$4788,$9024,$048C,$4A90,$4084,$6C88,$6498,
|
||||
{ e f g h i j k l m n }
|
||||
$C48C,$C780,$C49E,$C790,$C214,$9020,$448C,$48C0,$44D8,$2850,
|
||||
{ o p q r s t u v w x }
|
||||
$2820,$8844,$FFFF);
|
||||
{ y z : }
|
||||
|
||||
CharacterNDX: Array[1..122] of integer =
|
||||
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 72, 0, 17, 0, 18, 0, 0, 19, 20, 21, 22, 23, 24,
|
||||
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
|
||||
44, 0, 45, 0, 0, 0, 0, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44);
|
||||
|
||||
|
||||
{===== TCustomLEDNumber ============================================}
|
||||
|
||||
constructor TCustomLEDNumber.Create(AOwner:TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
ControlStyle := [csCaptureMouse,
|
||||
csOpaque,
|
||||
csSetCaption,
|
||||
csClickEvents,
|
||||
csDoubleClicks];
|
||||
lbDrawBmp := TBitmap.Create;
|
||||
Width := 170;
|
||||
Height := 30;
|
||||
FOnColor := clLime;
|
||||
FOffColor := $000E3432;
|
||||
FBgColor := clBlack;
|
||||
FSize := 2;
|
||||
FRows := 1;
|
||||
FColumns := 10;
|
||||
Caption := 'LED-LABEL';
|
||||
end;
|
||||
{=====}
|
||||
|
||||
destructor TCustomLEDNumber.Destroy;
|
||||
begin
|
||||
lbDrawBmp.Free;
|
||||
lbDrawBmp := nil;
|
||||
inherited Destroy;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
function TCustomLEDNumber.GetAbout : string;
|
||||
begin
|
||||
// Result := VpVersionStr;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.SetAbout(const Value : string);
|
||||
begin
|
||||
{Leave empty}
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.CMTextChanged(var Message: {$IFDEF LCL}TLMessage{$ELSE}TMessage{$ENDIF});
|
||||
begin
|
||||
inherited;
|
||||
Invalidate;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.Initialize(var Points: array of TPoint);
|
||||
var
|
||||
I : Integer;
|
||||
begin
|
||||
for I := 0 to MAX_POINTS do begin
|
||||
Points[i].X := DigitPoints[i].X * (FSize - 1);
|
||||
Points[i].Y := DigitPoints[i].Y * (FSize - 1);
|
||||
end;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
function TCustomLEDNumber.NewOffset(xOry:char;oldOffset:integer):integer;
|
||||
begin
|
||||
if (xOry = 'x')then
|
||||
newOffset := oldOffset + 17 * (FSize - 1)
|
||||
else
|
||||
newOffset := oldOffset + 30 * (FSize -1)
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.Paint;
|
||||
var
|
||||
Points: array[0..MAX_POINTS] of TPoint;
|
||||
begin
|
||||
lbDrawBMP.Width := Width;
|
||||
lbDrawBMP.Height := Height;
|
||||
|
||||
Initialize(Points);
|
||||
lbDrawBMP.Canvas.Brush.Color := FBgColor;
|
||||
lbDrawBMP.Canvas.FillRect(ClientRect);
|
||||
ProcessCaption(Points);
|
||||
|
||||
Canvas.CopyMode := cmSrcCopy;
|
||||
Canvas.Draw(0, 0, lbDrawBMP);
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.PaintSegment(Segment: Integer; TheColor: TColor;
|
||||
Points: array of TPoint; OffsetX, OffsetY: Integer);
|
||||
var
|
||||
I: Integer;
|
||||
DrawPts: array[0..5] of TPoint;
|
||||
begin
|
||||
Dec(Segment);
|
||||
lbDrawBMP.Canvas.Pen.Style := psClear;
|
||||
lbDrawBMP.Canvas.Brush.Color := TheColor;
|
||||
for i := 0 to 5 do begin
|
||||
DrawPts[i].X := offsetX + Points[Segment * 6 + i].X;
|
||||
DrawPts[i].Y := offsetY + Points[Segment * 6 + i].Y;
|
||||
end;
|
||||
lbDrawBMP.Canvas.Polygon(DrawPts);
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.SelectSegments(Segment: word; Points: array of TPoint;
|
||||
OffsetX, OffsetY: Integer);
|
||||
var
|
||||
I : integer;
|
||||
Bit : word;
|
||||
MyColor : TColor;
|
||||
Skip : Boolean;
|
||||
begin
|
||||
if (Segment and $FFFF) = $FFFF then begin
|
||||
MyColor := FOnColor;
|
||||
PaintSegment(17, MyColor, Points, OffsetX, OffsetY);
|
||||
PaintSegment(18, MyColor, Points, OffsetX, OffsetY);
|
||||
end
|
||||
else begin
|
||||
Bit := $8000;
|
||||
for I := 1 to 16 do begin
|
||||
Skip := False;
|
||||
if (Segment and Bit) = Bit then
|
||||
MyColor := FOnColor
|
||||
else begin
|
||||
if (i = 15) or (i = 16) then
|
||||
Skip := True;
|
||||
MyColor := FOffColor;
|
||||
end;
|
||||
if (not Skip) and (MyColor <> FBgColor) then
|
||||
PaintSegment(I, MyColor, Points, OffsetX, OffsetY);
|
||||
Bit := Bit div 2;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.ProcessCaption(Points: array of TPoint);
|
||||
var
|
||||
Next : Char;
|
||||
Last : Char;
|
||||
I, X : Integer;
|
||||
Row, ColsPerRow: Integer;
|
||||
Tmp : Integer;
|
||||
OffsetX : Integer;
|
||||
OffsetY : Integer;
|
||||
DisplayStr : string;
|
||||
begin
|
||||
Last := #0;
|
||||
OffsetX := FSize;
|
||||
OffsetY := 0;
|
||||
|
||||
DisplayStr := Caption;
|
||||
|
||||
if Length(DisplayStr) > 0 then
|
||||
if (DisplayStr[1] = ',') or (DisplayStr[1] = '.') then
|
||||
DisplayStr := ' ' + DisplayStr;
|
||||
|
||||
Row := 1;
|
||||
ColsPerRow := 0;
|
||||
for I := 1 to Length(Caption) do begin
|
||||
Next := Caption[I];
|
||||
case Ord(Next) of
|
||||
42..58,60,62,65..90,92,97..122: begin
|
||||
if ColsPerRow = FColumns then begin
|
||||
Row := Row + 1;
|
||||
if Row > FRows then
|
||||
exit;
|
||||
offsetY := newOffset('y',offsetY);
|
||||
offsetX := FSize;
|
||||
ColsPerRow := 0
|
||||
end;
|
||||
if (Next = '.') or (Next = ',') then
|
||||
if (Last = '.') or (Last = ',') then begin
|
||||
SelectSegments(Characters[CharacterNDX[Ord(Next)]], Points,
|
||||
OffsetX, OffsetY);
|
||||
OffsetX := NewOffset('x', OffsetX);
|
||||
end
|
||||
else begin
|
||||
OffsetX := OffsetX - (17 * (FSize - 1));
|
||||
Tmp := (Characters[CharacterNDX[Ord(Next)]]
|
||||
or Characters[CharacterNDX[Ord(Last)]]);
|
||||
SelectSegments(Tmp, Points, OffsetX, OffsetY);
|
||||
OffsetX := NewOffset('x', OffsetX);
|
||||
end
|
||||
else begin
|
||||
SelectSegments(Characters[CharacterNDX[Ord(Next)]], Points, OffsetX,
|
||||
OffsetY);
|
||||
offsetX := NewOffset('x', OffsetX);
|
||||
ColsPerRow := ColsPerRow + 1;
|
||||
end;
|
||||
end;
|
||||
10: begin {eat linefeed}
|
||||
end;
|
||||
13: begin
|
||||
if ColsPerRow < FColumns then
|
||||
for x := 1 to (FColumns - ColsPerRow) do begin
|
||||
SelectSegments(Characters[CharacterNDX[1]], Points, OffsetX, OffsetY);
|
||||
OffsetX := NewOffset('x', OffsetX);
|
||||
end;
|
||||
Row := Row + 1;
|
||||
if Row > FRows then
|
||||
exit;
|
||||
OffsetY := NewOffset('y', OffsetY);
|
||||
OffsetX := FSize;
|
||||
ColsPerRow := 0;
|
||||
end;
|
||||
else begin
|
||||
if ColsPerRow = FColumns then begin
|
||||
Row := Row + 1;
|
||||
if Row > FRows then
|
||||
Exit;
|
||||
OffsetY := NewOffset('y', OffsetY);
|
||||
OffsetX := FSize;
|
||||
ColsPerRow := 0;
|
||||
end;
|
||||
SelectSegments(Characters[CharacterNDX[1]], Points, OffsetX, OffsetY);
|
||||
OffsetX := newOffset('x', OffsetX);
|
||||
ColsPerRow := ColsPerRow + 1;
|
||||
end;
|
||||
end;
|
||||
Last := Next;
|
||||
end;
|
||||
for x := 1 to (FColumns - ColsPerRow) do begin
|
||||
SelectSegments(Characters[CharacterNDX[1]], Points, OffsetX, OffsetY);
|
||||
OffsetX := NewOffset('x', OffsetX);
|
||||
end;
|
||||
if (FColumns * FRows) > Length(caption) then begin
|
||||
for X := Row + 1 to FRows do begin
|
||||
OffsetX := FSize;
|
||||
OffsetY := NewOffset('y', OffsetY);
|
||||
for I := 1 to FColumns do begin
|
||||
SelectSegments(Characters[CharacterNDX[1]], Points, OffsetX, OffsetY);
|
||||
OffsetX := NewOffset('x', OffsetX);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.ResizeControl(Row, Col, Size: Integer);
|
||||
begin
|
||||
FRows := Row;
|
||||
FColumns := Col;
|
||||
FSize := Size;
|
||||
SetBounds(Left, Top, FColumns * 17 * (FSize - 1), FRows * 30 * (FSize - 1));
|
||||
Invalidate;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.SetBgColor(Value:TColor);
|
||||
begin
|
||||
if FBgColor <> Value then begin
|
||||
FBgColor := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.SetOnColor(Value:TColor);
|
||||
begin
|
||||
if FOnColor <> Value then begin
|
||||
FOnColor := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.SetOffColor(Value:TColor);
|
||||
begin
|
||||
if FOffColor <> Value then begin
|
||||
FOffColor := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.SetRows(Value : Integer);
|
||||
begin
|
||||
if FRows <> Value then begin
|
||||
if Value < 1 then
|
||||
Value := 1;
|
||||
ResizeControl(Value, FColumns, FSize);
|
||||
end;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.SetColumns(Value : Integer);
|
||||
begin
|
||||
if FColumns <> Value then begin
|
||||
if Value < 1 then
|
||||
Value := 1;
|
||||
ResizeControl(FRows, Value, FSize);
|
||||
end;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TCustomLEDNumber.SetSize(Value : TSegmentSize);
|
||||
begin
|
||||
if FSize <> Value then begin
|
||||
//if Value < 2 then <- unreachable
|
||||
// Value := 2;
|
||||
//if Value > 10 then
|
||||
// Value := 10;
|
||||
ResizeControl(FRows, FColumns, Value);
|
||||
end;
|
||||
end;
|
||||
{=====}
|
||||
end.
|
||||
48
components/IndustrialStuff/source/sensors.lrs
Normal file
@ -0,0 +1,48 @@
|
||||
LazarusResources.Add('stop_red','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#21#0#0#0'+'#8#2#0#0#0#24#5'T'#28#0
|
||||
+#0#0#182'IDATx'#156#237#148#1#14#132' '#12#4#251#244'{'#154'?'#227#4#20'*'
|
||||
+#181#173'[r'#23'c'#220#160'!'#193#217#214#186#145#150'9'#209'z}'#162'J)m<'
|
||||
+#225'Z'#193#31#243#173#207#8#159'_'#143#168#174#211#7','#158#195#154#133#202
|
||||
+'w8'#159#171#22#30'_'#21#231#197#250#23'?;?i'#1#127#191'f'#17#207#143#171#251
|
||||
+#231#191#220#251#30#224#143#240#185#133#149#159#138#149'#'#213#194#226'+'#156
|
||||
+#127'o'#172#11#128#23#205#227#245#165#5#150#127#27'v'#248#193#226#205'?'#206
|
||||
+#239#211'c'#251#235'<'#135'5'#11''''#127'T"lX'#152'<'#203#127#179#192#242#207
|
||||
+'+G'#234'K'#11','#255'6'#236#240#131#197#243#243#191#132#180#241'iB}H1}'#1
|
||||
+#248#31#245'9G<'#16'W'#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('stop_green','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#21#0#0#0'+'#8#2#0#0#0#24#5'T'#28#0
|
||||
+#0#0#178'IDATx'#156#237#146#11#10#128' '#16'D='#250#30#173#155'm'#153#154#159
|
||||
+'m'#181'Y)('#26#12'DyO'#177'q'#203'\'#220#246#145'5'#204#28'y'#135'g'#3'o'
|
||||
+#230#143'{Z'#248#176'H'#197#28#224'+XQ'#168#252#1#251'-]'#209#227#3#236#127
|
||||
+'oq'#11#128'o/o8_*'#174#242#167#10#224#253#164#2#254#127'Ya'#238#207'0'#239
|
||||
+#232'?'#229'9'#192#215#240#185'b'#212'?'#10'['#170#162#219'?*'#250#159#20'`'
|
||||
+#255#171#147#241#243#165#2#236#127#23#30#240#141#226#239'?'#206#251'Eva'#152
|
||||
+#250#159'`M'#209#237#223#206#248'm]1'#224'y'#143#157#151#227')~'#246#253#164
|
||||
+#226#251#253'_L'#137'<O$?'#146'-+z['#245'98%'#211#193#0#0#0#0'IEND'#174'B`'
|
||||
+#130
|
||||
]);
|
||||
LazarusResources.Add('stop_yellow','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#21#0#0#0'+'#8#2#0#0#0#24#5'T'#28#0
|
||||
+#0#0#178'IDATx'#156#237#148#13#10#128' '#12'F='#186'G'#243'fK'#209#252'['#219
|
||||
+#220#164#136#232#195'@'#140#247#28':ta/.~'#222#26#0'('#188#211''''#130'7'#243
|
||||
+#181'N'#11#159#23'}7W'#240#3'L(H'#190#194#233#23#173#224#248#12#167#235#237
|
||||
+#170'P'#240's'#241#134#253#177'b'#149#191'T('#206#15'+'#212#247#215#20#230
|
||||
+#254#17#243#254#254#143#127#243#176#244#127#133')'#5#215'?'''#6#140'B'#228'a'
|
||||
+#147#159#199'S'#252#238#249'a'#197#223#255'z'#190','#250'n'#190#206#247'0'
|
||||
+#165#16#222#223#136#165#247#155'V'#176#188'o'#239#127'Uh'#248#177'x'#203#254
|
||||
+'X'#161#235#127#30#22#248'I'#241#253#254#15#166#20#30'6'#210#14#201#150#3'v'
|
||||
+#229#19#159#3#227#232' '#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('stop_unknown','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#21#0#0#0'+'#8#2#0#0#0#24#5'T'#28#0
|
||||
+#0#0#187'IDATx'#156#237#149#209#10#128' '#12'E'#253't?'#173'?3'#211#210#233
|
||||
+'r'#243'Nz('#26#4#162#156#179'a'#151'r'#219'Z'#185#248'xk'#133#16'N'#222#225
|
||||
+#21#193#135#249'2'#167#133#207#155#158#172#1#190#129#7#138'!_'#224'x,($>'#195
|
||||
+#199'1'#153#2#224#251#225#13#253#185'b'#150#191'U'#0#247#199#21#240#251#171
|
||||
+#10's~'#212'zG'#254'}]'#3'|'#11#223'+'#180#252#249'|4T'#136#249'K'#240#241'y'
|
||||
+'#S'#128#249'o:'#227#253#185#2#204#191#8'+|'#167#248#243#143#243#215#237#145
|
||||
+#245'<O'#225#145'B'#201#159'K'#17#22#20'"O'#242'_'#20'X'#254#249#15#0#235#207
|
||||
+#21'X'#254'eX'#225';'#197#247#243#191#153#234#228#195'B'#213'K'#178#213#14
|
||||
+#160#254#214#226'['#18#251#151#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
483
components/IndustrialStuff/source/sensors.pas
Normal file
@ -0,0 +1,483 @@
|
||||
{ Copyright (C) 1998-2000, written by Shkolnik Mike
|
||||
FIDOnet: 2:463/106.14
|
||||
E-Mail: mshkolnik@scalabium.com
|
||||
mshkolnik@yahoo.com
|
||||
WEB: http://www.scalabium.com
|
||||
http://www.geocities.com/mshkolnik
|
||||
tel: 380-/44/-552-10-29
|
||||
|
||||
TStopLightSensor and TAnalogSensor sensor components
|
||||
}
|
||||
unit Sensors;
|
||||
|
||||
{$MODE Delphi}
|
||||
|
||||
interface
|
||||
|
||||
uses LCLIntf, LCLType,LResources, Classes, Controls, Graphics, Stdctrls, Extctrls;
|
||||
|
||||
type
|
||||
TStopLights = (slUNKNOWN, slRED, slYELLOW, slGREEN);
|
||||
|
||||
type
|
||||
TSensorPanel = class(TPanel)
|
||||
private
|
||||
FlblShowText: TLabel; {sensor value}
|
||||
FShowText: Boolean;
|
||||
FShowLevel: Boolean; {show the RED and YELLOW levels or not}
|
||||
|
||||
FValue: Double;
|
||||
FValueMin: Double;
|
||||
FValueMax: Double;
|
||||
FValueRed: Double;
|
||||
FValueYellow: Double;
|
||||
|
||||
FColorBack: TColor;
|
||||
FColorFore: TColor;
|
||||
FColorRed: TColor;
|
||||
FColorYellow: TColor;
|
||||
|
||||
function GetCaption: TCaption;
|
||||
procedure SetCaption(AValue: TCaption);
|
||||
|
||||
procedure SetShowText(AValue: Boolean);
|
||||
procedure SetShowLevel(AValue: Boolean);
|
||||
|
||||
procedure SetColorInd(Index: Integer; AValue: TColor);
|
||||
|
||||
procedure SetValue(AValue: Double); virtual;
|
||||
procedure SetValueMin(AValue: Double);
|
||||
procedure SetValueMax(AValue: Double);
|
||||
procedure SetValueRed(AValue: Double);
|
||||
procedure SetValueYellow(AValue: Double);
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
function GetStatus: TStopLights;
|
||||
procedure SetColorState(slStopLight: TStopLights); virtual;
|
||||
published
|
||||
property Caption read GetCaption write SetCaption;
|
||||
|
||||
property ShowText: Boolean read FShowText write SetShowText;
|
||||
property ShowLevel: Boolean read FShowLevel write SetShowLevel;
|
||||
|
||||
property ColorFore: TColor index 0 read FColorFore write SetColorInd default clBlack;
|
||||
property ColorBack: TColor index 1 read FColorBack write SetColorInd default clWhite;
|
||||
property ColorRed: TColor index 2 read FColorRed write SetColorInd default clRed;
|
||||
property ColorYellow: TColor index 3 read FColorYellow write SetColorInd default clYellow;
|
||||
|
||||
property Value: Double read FValue write SetValue;
|
||||
property ValueMin: Double read FValueMin write SetValueMin;
|
||||
property ValueMax: Double read FValueMax write SetValueMax;
|
||||
property ValueRed: Double read FValueRed write SetValueRed;
|
||||
property ValueYellow: Double read FValueYellow write SetValueYellow;
|
||||
end;
|
||||
|
||||
TAnalogKind = (akAnalog, akHorizontal, akVertical);
|
||||
TAnalogSensor = class({TGraphicControl } TSensorPanel)
|
||||
private
|
||||
FAnalogKind: TAnalogKind;
|
||||
|
||||
procedure PaintAsNeedle;
|
||||
procedure PaintAsHorizontal;
|
||||
procedure PaintAsVertical;
|
||||
procedure SetAnalogKind(AValue: TAnalogKind);
|
||||
protected
|
||||
procedure Paint; override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
published
|
||||
property Font;
|
||||
property AnalogKind: TAnalogKind read FAnalogKind write SetAnalogKind;
|
||||
end;
|
||||
|
||||
TStopLightSensor = class(TImage)
|
||||
private
|
||||
FState: TStopLights;
|
||||
procedure SetState(AValue: TStopLights);
|
||||
protected
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
published
|
||||
property State: TStopLights read FState write SetState;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses SysUtils;
|
||||
|
||||
{ TSensorPanel }
|
||||
|
||||
constructor TSensorPanel.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
|
||||
Height := 75;
|
||||
Width := 170;
|
||||
Parent := AOwner as TWinControl;
|
||||
|
||||
FValue := 0;
|
||||
|
||||
FValueMin := 0;
|
||||
FValueMax := 100;
|
||||
FValueRed := 30;
|
||||
FValueYellow := 60;
|
||||
|
||||
FColorFore := {clGreen} clLime;
|
||||
FColorBack := clBlack {clWhite};
|
||||
FColorRed := clRed;
|
||||
FColorYellow := clYellow;
|
||||
|
||||
FlblShowText := TLabel.Create(Self);
|
||||
with FlblShowText do
|
||||
begin
|
||||
Alignment := taCenter;
|
||||
AutoSize := False;
|
||||
Font := Self.Font;
|
||||
Height := 17;
|
||||
Left := 5;
|
||||
Top := 57;
|
||||
Width := 160;
|
||||
Parent := Self;
|
||||
Align := alBottom;
|
||||
end;
|
||||
|
||||
FShowLevel := True;
|
||||
Caption := '';
|
||||
ShowText := True;
|
||||
end;
|
||||
|
||||
destructor TSensorPanel.Destroy;
|
||||
begin
|
||||
// FlblShowText.Free;
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TSensorPanel.GetStatus: TStopLights;
|
||||
begin
|
||||
Result := slUNKNOWN;
|
||||
if (Value > ValueMin) and (Value < ValueMin) then Result := slGREEN;
|
||||
if (Value < ValueYellow) then Result := slYellow;
|
||||
if (Value < ValueRed) then Result := slRED;
|
||||
end;
|
||||
|
||||
procedure TSensorPanel.SetColorState(slStopLight: TStopLights);
|
||||
begin
|
||||
FlblShowText.Font := Font;
|
||||
case slStopLight of
|
||||
slRED: FlblShowText.Font.Color := FColorRed;
|
||||
slYELLOW: FlblShowText.Font.Color := FColorYellow;
|
||||
else // slUNKNOWN, slGREEN
|
||||
// FlblShowText.Font := Font;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSensorPanel.SetValue(AValue: Double);
|
||||
begin
|
||||
if (AValue < FValueMin) then
|
||||
AValue := FValueMin
|
||||
else
|
||||
if (AValue > FValueMax) then
|
||||
AValue := FValueMax;
|
||||
if (FValue <> AValue) then
|
||||
begin
|
||||
FValue := AValue;
|
||||
FlblShowText.Caption := Caption + FloatToStr(FValue);
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TSensorPanel.GetCaption: TCaption;
|
||||
begin
|
||||
Result := FlblShowText.Hint;
|
||||
end;
|
||||
|
||||
procedure TSensorPanel.SetCaption(AValue: TCaption);
|
||||
begin
|
||||
FlblShowText.Hint := AValue;
|
||||
|
||||
inherited Caption := '';
|
||||
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TSensorPanel.SetShowText(AValue: Boolean);
|
||||
begin
|
||||
if (AValue <> FShowText) then
|
||||
begin
|
||||
FShowText := AValue;
|
||||
FlblShowText.Visible := FShowText;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSensorPanel.SetShowLevel(AValue: Boolean);
|
||||
begin
|
||||
if (AValue <> FShowLevel) then
|
||||
begin
|
||||
FShowlevel := AValue;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSensorPanel.SetColorInd(Index: Integer; AValue: TColor);
|
||||
begin
|
||||
if (AValue <> FColorFore) then
|
||||
begin
|
||||
case Index of
|
||||
0: FColorFore := AValue;
|
||||
1: FColorBack := AValue;
|
||||
2: FColorRed := AValue;
|
||||
3: FColorYellow := AValue;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSensorPanel.SetValueMin(AValue: Double);
|
||||
begin
|
||||
if (AValue <> FValueMin) then
|
||||
begin
|
||||
if (AValue > FValueMin) then
|
||||
if not (csLoading in ComponentState) then
|
||||
raise EInvalidOperation.CreateFmt('OutOfRange', [-MaxInt, Round(FValueMax - 1)]);
|
||||
FValueMin := AValue;
|
||||
if (FValue < AValue) then FValue := AValue;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSensorPanel.SetValueMax(AValue: Double);
|
||||
begin
|
||||
if (AValue <> FValueMax) then
|
||||
begin
|
||||
if (AValue < FValueMin) then
|
||||
if not (csLoading in ComponentState) then
|
||||
raise EInvalidOperation.CreateFmt('SOutOfRange', [Round(FValueMin + 1), MaxInt]);
|
||||
FValueMax := AValue;
|
||||
if (FValue > AValue) then FValue := AValue;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSensorPanel.SetValueRed(AValue: Double);
|
||||
begin
|
||||
if (AValue <> FValueRed) then
|
||||
begin
|
||||
if (AValue < FValueMin) or (AValue > FValueMax) then
|
||||
if not (csLoading in ComponentState) then
|
||||
raise EInvalidOperation.CreateFmt('SOutOfRange', [Round(FValueMin), Round(FValueMax)]);
|
||||
FValueRed := AValue;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSensorPanel.SetValueYellow(AValue: Double);
|
||||
begin
|
||||
if (AValue <> FValueYellow) then
|
||||
begin
|
||||
if (AValue < FValueRed) or (AValue > FValueMax) then
|
||||
if not (csLoading in ComponentState) then
|
||||
raise EInvalidOperation.CreateFmt('SOutOfRange', [Round(FValueRed), Round(FValueMax)]);
|
||||
FValueYellow := AValue;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ TAnalogSensor }
|
||||
constructor TAnalogSensor.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
|
||||
Value := 20;
|
||||
AnalogKind := akAnalog;
|
||||
end;
|
||||
|
||||
procedure TAnalogSensor.Paint;
|
||||
begin
|
||||
inherited Paint;
|
||||
case FAnalogKind of
|
||||
akAnalog: PaintAsNeedle;
|
||||
akHorizontal: PaintAsHorizontal;
|
||||
akVertical: PaintAsVertical;
|
||||
end;
|
||||
end;
|
||||
|
||||
function SolveForY(X, Z: Double): Double;
|
||||
begin
|
||||
if Z = 0 then
|
||||
Result := 0
|
||||
else
|
||||
Result := X/Z;
|
||||
end;
|
||||
|
||||
procedure TAnalogSensor.PaintAsNeedle;
|
||||
var MiddleX: Integer;
|
||||
Angle: Double;
|
||||
X, Y, W, H: Integer;
|
||||
begin
|
||||
X := 20;
|
||||
Y := 23;
|
||||
W := ClientWidth - 2*20; //130;
|
||||
H := ClientHeight - 2*23; //33;
|
||||
if (W < 1) or (H < 1) then Exit;
|
||||
|
||||
with Canvas do
|
||||
begin
|
||||
Brush.Color := ColorBack;
|
||||
Pen.Color := clBlack;
|
||||
Pen.Width := 1;
|
||||
|
||||
{ draw a pie }
|
||||
Pie(X, Y, X + W, Y + 2*H, X + W, Y + H - 1, X, Y + H - 1);
|
||||
// Chord(X, Y, X+W, (Y+H)*2, X+W, Y+H-1, X, Y+H-1);
|
||||
|
||||
MiddleX := W div 2;
|
||||
{ draw pie for current value }
|
||||
Brush.Color := ColorFore;
|
||||
Pen.Color := clBlack;
|
||||
MoveTo(X + MiddleX, Y + H - 1);
|
||||
Angle := Pi * SolveForY(FValue - FValueMin, FValueMax - FValueMin);
|
||||
Pie(X, Y, X + W, Y + 2*H, Round(X + MiddleX*(1 - Cos(Angle))), Round(Y - 1 + H*(1 - Sin(Angle))), X, Y+H);
|
||||
|
||||
if FShowLevel then
|
||||
begin
|
||||
// Pen.Width := 1;
|
||||
{ draw a RED level line }
|
||||
Pen.Color := ColorRed;
|
||||
MoveTo(X + MiddleX, Y + H - 1);
|
||||
Angle := Pi * SolveForY(FValueRed - FValueMin, FValueMax - FValueMin);
|
||||
LineTo(Round(X + MiddleX*(1 - Cos(Angle))), Round(Y - 1 + H*(1 - Sin(Angle))));
|
||||
|
||||
{ draw a YELLOW level line }
|
||||
Pen.Color := ColorYellow;
|
||||
MoveTo(X + MiddleX, Y + H - 1);
|
||||
Angle := Pi * SolveForY(FValueYellow - FValueMin, FValueMax - FValueMin);
|
||||
LineTo(Round(X + MiddleX*(1 - Cos(Angle))), Round(Y - 1 + H*(1 - Sin(Angle))));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TAnalogSensor.PaintAsHorizontal;
|
||||
var MiddleX: Integer;
|
||||
X, Y, W, H: Integer;
|
||||
begin
|
||||
X := 20;
|
||||
Y := 23;
|
||||
W := ClientWidth - 2*20; //130;
|
||||
H := ClientHeight - 2*23; //33;
|
||||
if (W < 1) or (H < 1) then Exit;
|
||||
|
||||
with Canvas do
|
||||
begin
|
||||
Brush.Color := ColorBack;
|
||||
Pen.Color := clBlack;
|
||||
Pen.Width := 1;
|
||||
|
||||
Rectangle(X, Y, X + W, Y + H);
|
||||
|
||||
{ draw pie for current value }
|
||||
Brush.Color := ColorFore;
|
||||
Pen.Color := clBlack;
|
||||
MiddleX := Round(W*SolveForY(FValue - FValueMin, FValueMax - FValueMin));
|
||||
Rectangle(X, Y, X + MiddleX, Y + H);
|
||||
|
||||
if FShowLevel then
|
||||
begin
|
||||
{ draw a RED level line }
|
||||
Pen.Color := ColorRed;
|
||||
MiddleX := Round(W*SolveForY(FValueRed - FValueMin, FValueMax - FValueMin));
|
||||
MoveTo(X + MiddleX, Y + 1);
|
||||
LineTo(X + MiddleX, Y + H - 1);
|
||||
|
||||
{ draw a YELLOW level line }
|
||||
Pen.Color := ColorYellow;
|
||||
MiddleX := Round(W*SolveForY(FValueYellow - FValueMin, FValueMax - FValueMin));
|
||||
MoveTo(X + MiddleX, Y + 1);
|
||||
LineTo(X + MiddleX, Y + H - 1);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TAnalogSensor.PaintAsVertical;
|
||||
var MiddleY: Integer;
|
||||
X, Y, W, H: Integer;
|
||||
begin
|
||||
X := 20;
|
||||
Y := 23;
|
||||
W := ClientWidth - 2*20; //130;
|
||||
H := ClientHeight - 2*23; //33;
|
||||
if (W < 1) or (H < 1) then Exit;
|
||||
|
||||
with Canvas do
|
||||
begin
|
||||
Brush.Color := ColorBack;
|
||||
Pen.Color := clBlack;
|
||||
Pen.Width := 1;
|
||||
|
||||
Rectangle(X + W - 1, Y + H - 1, X, Y);
|
||||
|
||||
{ draw pie for current value }
|
||||
Brush.Color := ColorFore;
|
||||
Pen.Color := clBlack;
|
||||
MiddleY := Round(H*SolveForY(FValue - FValueMin, FValueMax - FValueMin));
|
||||
Rectangle(X, Y + H - 1 - MiddleY, X + W - 1, Y + H - 1);
|
||||
|
||||
if FShowLevel then
|
||||
begin
|
||||
{ draw a RED level line }
|
||||
Pen.Color := ColorRed;
|
||||
MiddleY := Round(H*SolveForY(FValueRed - FValueMin, FValueMax - FValueMin));
|
||||
MoveTo(X + 1, Y + H - 1 - MiddleY);
|
||||
LineTo(X + W - 1, Y + H - 1 - MiddleY);
|
||||
|
||||
{ draw a YELLOW level line }
|
||||
Pen.Color := ColorYellow;
|
||||
MiddleY := Round(H*SolveForY(FValueYellow - FValueMin, FValueMax - FValueMin));
|
||||
MoveTo(X + 1, Y + H - 1 - MiddleY);
|
||||
LineTo(X + W - 1, Y + H - 1 - MiddleY);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TAnalogSensor.SetAnalogKind(AValue: TAnalogKind);
|
||||
begin
|
||||
if (AValue <> FAnalogKind) then
|
||||
begin
|
||||
FAnalogKind := AValue;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TStopLightSensor }
|
||||
constructor TStopLightSensor.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
|
||||
Width := 23;
|
||||
Height := 43;
|
||||
Center := True;
|
||||
FState := slRED;
|
||||
State := slUNKNOWN;
|
||||
end;
|
||||
|
||||
procedure TStopLightSensor.SetState(AValue: TStopLights);
|
||||
begin
|
||||
if (AValue <> FState) then
|
||||
begin
|
||||
FState := AValue;
|
||||
|
||||
case AValue of
|
||||
slUNKNOWN: Picture.LoadFromLazarusResource('STOP_UNKNOWN');
|
||||
slRED: Picture.LoadFromLazarusResource('STOP_RED');
|
||||
slYELLOW: Picture.LoadFromLazarusResource('STOP_YELLOW');
|
||||
slGREEN: Picture.LoadFromLazarusResource('STOP_GREEN');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$i sensors.lrs}
|
||||
end.
|
||||