jvcllaz: Add TJvLED and TJvDialButton (in new package JvHMILazR/D - "human-machine-interface")

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6654 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-09-26 13:31:56 +00:00
parent db62cc2003
commit 9e0a19c239
19 changed files with 2374 additions and 1 deletions

View File

@ -0,0 +1,3 @@
tjvdialbutton.bmp
tjvled.bmp
tjvsegmentedleddisplay.bmp

View File

@ -0,0 +1 @@
lazres ../../../resource/jvhmireg.res @images.txt

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,28 @@
unit JvHMIReg;
{$mode objfpc}{$H+}
interface
uses
SysUtils;
procedure Register;
implementation
{$R ../../resource/jvhmireg.res}
uses
Classes, Controls,
JvDsgnConsts, JvDialButton, JvLED;
procedure Register;
begin
RegisterComponents(RsPaletteJvcl, [
TJvDialButton, TJvLED
]);
end;
end.

View File

@ -3,4 +3,5 @@ tjvid3v2.bmp
tjvgradient.bmp
tjvgradientheaderpanel.bmp
tjvspecialprogress.bmp
tjvanimatedimage.bmp
tjvbmpanimator.bmp

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<Flags>
<UseDefaultCompilerOptions Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="JvLEDDemo"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="jvhmilazr"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="JvLEDDemo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="LEDMain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="LEDDemoMain"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="JvLEDDemo"/>
</Target>
<SearchPaths>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,13 @@
program JvLEDDemo;
uses
Interfaces, Forms,
LEDMain in 'LEDMain.pas' {LEDDemoMain};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TLEDDemoMain, LEDDemoMain);
Application.Run;
end.

View File

@ -0,0 +1,430 @@
object LEDDemoMain: TLEDDemoMain
Left = 497
Height = 234
Top = 199
Width = 329
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'Example for JvLED'
ClientHeight = 234
ClientWidth = 329
Color = clBtnFace
DefaultMonitor = dmDesktop
Font.Color = clWindowText
OnActivate = FormActivate
Position = poScreenCenter
LCLVersion = '2.1.0.0'
Scaled = False
object JvLED1: TJvLED
Left = 0
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED2: TJvLED
Left = 24
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED3: TJvLED
Left = 48
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED4: TJvLED
Left = 72
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED5: TJvLED
Left = 96
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED6: TJvLED
Left = 120
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED7: TJvLED
Left = 144
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED8: TJvLED
Left = 168
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED9: TJvLED
Left = 192
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED10: TJvLED
Left = 216
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED11: TJvLED
Left = 240
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED12: TJvLED
Left = 264
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED13: TJvLED
Left = 288
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED14: TJvLED
Left = 312
Top = 0
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED15: TJvLED
Left = 312
Top = 24
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED16: TJvLED
Left = 312
Top = 48
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED17: TJvLED
Left = 312
Top = 72
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED18: TJvLED
Left = 312
Top = 96
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED19: TJvLED
Left = 312
Top = 120
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED20: TJvLED
Left = 312
Top = 144
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED21: TJvLED
Left = 312
Top = 168
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED22: TJvLED
Left = 312
Top = 192
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED23: TJvLED
Left = 312
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED24: TJvLED
Left = 288
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED25: TJvLED
Left = 264
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED26: TJvLED
Left = 240
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED27: TJvLED
Left = 216
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED28: TJvLED
Left = 192
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED29: TJvLED
Left = 168
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED30: TJvLED
Left = 144
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED31: TJvLED
Left = 120
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED32: TJvLED
Left = 96
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED33: TJvLED
Left = 72
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED34: TJvLED
Left = 48
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED35: TJvLED
Left = 24
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED36: TJvLED
Left = 0
Top = 216
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED37: TJvLED
Left = 0
Top = 192
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED38: TJvLED
Left = 0
Top = 168
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED39: TJvLED
Left = 0
Top = 144
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED40: TJvLED
Left = 0
Top = 120
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED41: TJvLED
Left = 0
Top = 96
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED42: TJvLED
Left = 0
Top = 72
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object JvLED43: TJvLED
Left = 0
Top = 48
Active = True
ColorOff = clBlack
Interval = 200
end
object JvLED44: TJvLED
Left = 0
Top = 24
Active = True
ColorOff = clBlack
Interval = 200
Status = False
end
object Data7: TJvLED
Left = 72
Top = 88
ColorOn = clRed
ColorOff = clBlack
Status = False
end
object Data6: TJvLED
Left = 96
Top = 88
ColorOn = clRed
ColorOff = clBlack
Status = False
end
object Data5: TJvLED
Left = 120
Top = 88
ColorOn = clRed
ColorOff = clBlack
Status = False
end
object Data4: TJvLED
Left = 144
Top = 88
ColorOn = clRed
ColorOff = clBlack
Status = False
end
object Data3: TJvLED
Left = 168
Top = 88
ColorOn = clRed
ColorOff = clBlack
Status = False
end
object Data2: TJvLED
Left = 192
Top = 88
ColorOn = clRed
ColorOff = clBlack
Status = False
end
object Data1: TJvLED
Left = 216
Top = 88
ColorOn = clRed
ColorOff = clBlack
Status = False
end
object Data0: TJvLED
Left = 240
Top = 88
ColorOn = clRed
ColorOff = clBlack
Status = False
end
object Label1: TLabel
Left = 126
Height = 15
Top = 132
Width = 23
Caption = 'Hex:'
ParentColor = False
end
object Label2: TLabel
Left = 72
Height = 15
Top = 72
Width = 36
Caption = 'Binary:'
ParentColor = False
end
object HexText: TEdit
Left = 152
Height = 23
Top = 128
Width = 25
MaxLength = 2
OnChange = HexTextChange
TabOrder = 0
Text = '00'
end
end

View File

@ -0,0 +1,114 @@
unit LEDMain;
interface
uses
SysUtils, Classes, Graphics, Controls, StdCtrls, Forms,
JvLED;
type
TLEDDemoMain = class(TForm)
JvLED1: TJvLED;
JvLED2: TJvLED;
JvLED3: TJvLED;
JvLED4: TJvLED;
JvLED5: TJvLED;
JvLED6: TJvLED;
JvLED7: TJvLED;
JvLED8: TJvLED;
JvLED9: TJvLED;
JvLED10: TJvLED;
JvLED11: TJvLED;
JvLED12: TJvLED;
JvLED13: TJvLED;
JvLED14: TJvLED;
JvLED15: TJvLED;
JvLED16: TJvLED;
JvLED17: TJvLED;
JvLED18: TJvLED;
JvLED19: TJvLED;
JvLED20: TJvLED;
JvLED21: TJvLED;
JvLED22: TJvLED;
JvLED23: TJvLED;
JvLED24: TJvLED;
JvLED25: TJvLED;
JvLED26: TJvLED;
JvLED27: TJvLED;
JvLED28: TJvLED;
JvLED29: TJvLED;
JvLED30: TJvLED;
JvLED31: TJvLED;
JvLED32: TJvLED;
JvLED33: TJvLED;
JvLED34: TJvLED;
JvLED35: TJvLED;
JvLED36: TJvLED;
JvLED37: TJvLED;
JvLED38: TJvLED;
JvLED39: TJvLED;
JvLED40: TJvLED;
JvLED41: TJvLED;
JvLED42: TJvLED;
JvLED43: TJvLED;
JvLED44: TJvLED;
Data7: TJvLED;
Data6: TJvLED;
Data5: TJvLED;
Data4: TJvLED;
Data3: TJvLED;
Data2: TJvLED;
Data1: TJvLED;
Data0: TJvLED;
HexText: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure FormActivate(Sender: TObject);
procedure HexTextChange(Sender: TObject);
public
Activated: Boolean;
Changing: Boolean;
HexValue: Byte;
HexLEDs: array [0..7] of TJvLED;
end;
var
LEDDemoMain: TLEDDemoMain;
implementation
{$R *.lfm}
procedure TLEDDemoMain.FormActivate(Sender: TObject);
var
I: Integer;
begin
if not Activated then
begin
Activated := True;
for I := Low(HexLEDs) to High(HexLEDs) do
HexLEDs[I] := TJvLED(FindComponent(Format('Data%d', [I])));
end;
end;
procedure TLEDDemoMain.HexTextChange(Sender: TObject);
var
I: Integer;
value: LongInt;
begin
if not Changing then
begin
Changing := True;
if TryStrToInt('$' + HexText.Text, value) then
HexValue := value
else begin
HexText.Text := '';
HexValue := 0;
end;
for I := Low(HexLEDs) to High(HexLEDs) do
HexLEDs[I].Status := Odd(HexValue shr I);
Changing := False;
end;
end;
end.

View File

@ -46,7 +46,7 @@
</Item7>
<Item8>
<Filename Value="..\run\JvMM\jvbmpanimator.pas"/>
<UnitName Value="jvbmpanimator"/>
<UnitName Value="JvBmpAnimator"/>
</Item8>
</Files>
<RequiredPkgs Count="2">

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<Package Version="4">
<PathDelim Value="\"/>
<Name Value="jvhmilazd"/>
<Type Value="RunAndDesignTime"/>
<Author Value="Various authors - see header of each unit for original author."/>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<OtherUnitFiles Value="..\design\JvHMI"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\design\JvHMI"/>
</SearchPaths>
</CompilerOptions>
<Description Value="JVCL Human-Machine-Interface (HMI) Components (design-time) containing these components
- TJvDialButton
- TJvLED
- TJvSegmentedLEDDisplay"/>
<License Value="The JVCL is released in accordance with the MPL 1.1 license. To get your own copy or read it, go to http://www.mozilla.org/MPL/MPL-1.1.html. "/>
<Version Major="1" Release="4"/>
<Files Count="1">
<Item1>
<Filename Value="..\design\JvHMI\jvhmireg.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="JvHMIReg"/>
</Item1>
</Files>
<RequiredPkgs Count="2">
<Item1>
<PackageName Value="JvCoreLazD"/>
</Item1>
<Item2>
<PackageName Value="jvhmilazr"/>
</Item2>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
</Package>
</CONFIG>

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<Package Version="4">
<PathDelim Value="\"/>
<Name Value="jvhmilazr"/>
<Author Value="Various authors - see header of each unit for original author."/>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<OtherUnitFiles Value="..\run\JvHMI"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\run\JvHMI"/>
</SearchPaths>
</CompilerOptions>
<Description Value="JVCL Human-Machine-Interface (HMI) Components (run-time) containing these components
- TJvDialButton
- TJvLED
- TJvSegmentedLEDDisplay"/>
<License Value="The JVCL is released in accordance with the MPL 1.1 license. To get your own copy or read it, go to http://www.mozilla.org/MPL/MPL-1.1.html. "/>
<Version Major="1" Release="4"/>
<Files Count="2">
<Item1>
<Filename Value="..\run\JvHMI\jvdialbutton.pas"/>
<UnitName Value="JvDialButton"/>
</Item1>
<Item2>
<Filename Value="..\run\JvHMI\jvled.pas"/>
<UnitName Value="JvLED"/>
</Item2>
</Files>
<RequiredPkgs Count="2">
<Item1>
<PackageName Value="JvCoreLazR"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
</Package>
</CONFIG>

Binary file not shown.

Binary file not shown.

View File

@ -686,6 +686,11 @@ resourcestring
resourcestring
RsClose = 'Close';
//=== JvDialButton.pas =======================================================
resourcestring
RsPropertyOutOfRange = 'Property %s out of valid range';
RsOutOfRange = 'Value must be between %d and %d';
//=== JvDrawImage.pas ========================================================
resourcestring
RsImageMustBeSquare = 'image must be square for Spirographs';

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,277 @@
{-----------------------------------------------------------------------------
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/MPL-1.1.html
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: JvTransled.PAS, released on 2002-12-23.
The Initial Developer of the Original Code is Thomas Hensle (http://www.thensle.de)
Portions created by Thomas Hensle are Copyright (C) 2002 Thomas Hensle.
Portions created by XXXX Corp. are Copyright (C) 2002, 2003 XXXX Corp.
All Rights Reserved.
Contributor(s):
Thomas Huber (Thomas_D_huber att t-online dott de)
peter3 (load new image only when needed, center image in control, draw border at designtime)
marcelb (merging of JvTransLED and JvBlinkingLED)
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.delphi-jedi.org
Known Issues:
-----------------------------------------------------------------------------}
// $Id$
unit JvLED;
{$mode objfpc}{$H+}
interface
uses
LCLIntf,
//Windows, Messages,
Controls, Forms, Graphics, ExtCtrls, Classes,
JvComponent;
type
TJvCustomLED = class(TJvGraphicControl)
private
FImgPict: TBitmap;
FImgMask: TBitmap;
FTimer: TTimer;
FColorOn: TColor;
FColorOff: TColor;
FActive: Boolean;
FStatus: Boolean;
FOnChange: TNotifyEvent;
procedure SetColorOn(Value: TColor);
procedure SetColorOff(Value: TColor);
procedure SetInterval(Value: Cardinal);
function GetInterval: Cardinal;
procedure SetActive(Value: Boolean);
function GetActive: Boolean;
procedure SetStatus(Value: Boolean);
function GetStatus: Boolean;
procedure DoBlink(Sender: TObject);
protected
procedure ColorChanged; override;
procedure Paint; override;
property Active: Boolean read GetActive write SetActive default False;
property Color default clLime;
property ColorOn: TColor read FColorOn write SetColorOn default clLime;
property ColorOff: TColor read FColorOff write SetColorOff default clRed;
property Interval: Cardinal read GetInterval write SetInterval default 1000;
property Status: Boolean read GetStatus write SetStatus default True;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
end;
TJvLED = class(TJvCustomLED)
published
property Active;
property Align;
property Anchors;
property AutoSize;
property DragCursor;
property DragKind;
property OnEndDock;
property OnStartDock;
property ColorOn;
property ColorOff;
property Constraints;
property DragMode;
property Height default 17;
property Interval;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Status;
property Visible;
property Width default 17;
property OnChange;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
end;
implementation
uses
SysUtils;
{$R ../../resource/jvled.res}
const
cMaskLEDName = 'JvCustomLEDMASK';
cGreenLEDName = 'JvCustomLEDGREEN';
//=== { TJvCustomLED } =======================================================
constructor TJvCustomLED.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FImgPict := TBitmap.Create;
FImgMask := TBitmap.Create;
FImgMask.LoadFromResourceName(HInstance, cMaskLEDName);
FTimer := TTimer.Create(Self);
FTimer.Enabled := False;
FTimer.OnTimer := @DoBlink;
FTimer.Interval := 1000;
Color := clLime;
Width := 17;
Height := 17;
ColorOn := clLime;
ColorOff := clRed;
Active := False;
Status := True;
end;
destructor TJvCustomLED.Destroy;
begin
FTimer.Enabled := False;
FTimer.OnTimer := nil;
FImgPict.Free;
FImgMask.Free;
inherited Destroy;
end;
procedure TJvCustomLED.Paint;
var
DestRect, SrcRect: TRect;
begin
if csDesigning in ComponentState then
begin
Canvas.Pen.Style := psDash;
Canvas.Brush.Style := bsClear;
Canvas.Rectangle(ClientRect);
end;
SrcRect := Rect(0, 0, FImgPict.Width, FImgPict.Height);
DestRect := SrcRect;
OffsetRect(DestRect, (ClientWidth - FImgPict.Width) div 2, (ClientHeight - FImgPict.Height) div 2);
Canvas.CopyMode := cmSrcAnd;
with Canvas do
begin
CopyRect(DestRect, FImgMask.Canvas, SrcRect);
CopyMode := cmSrcPaint;
CopyRect(DestRect, FImgPict.Canvas, SrcRect);
end;
end;
procedure TJvCustomLED.SetColorOn(Value: TColor);
begin
FColorOn := Value;
if Status then
Color := Value;
end;
procedure TJvCustomLED.SetColorOff(Value: TColor);
begin
FColorOff := Value;
if not Status then
Color := Value;
end;
function TJvCustomLED.GetInterval: Cardinal;
begin
Result := FTimer.Interval;
end;
procedure TJvCustomLED.SetInterval(Value: Cardinal);
begin
if Value <> FTimer.Interval then
FTimer.Interval := Value;
end;
function TJvCustomLED.GetActive: Boolean;
begin
Result := FActive;
end;
procedure TJvCustomLED.SetActive(Value: Boolean);
begin
FActive := Value;
if not (csDesigning in ComponentState) then
FTimer.Enabled := Value;
end;
procedure TJvCustomLED.SetStatus(Value: Boolean);
begin
if Value <> FStatus then
begin
FStatus := Value;
if FStatus then
Color := ColorOn
else
Color := ColorOff;
if Assigned(FOnChange) then
FOnChange(Self);
end;
end;
function TJvCustomLED.GetStatus: Boolean;
begin
Result := FStatus;
end;
procedure TJvCustomLED.DoBlink(Sender: TObject);
begin
if not IsIconic(Application.Handle) then
Status := not Status;
end;
procedure TJvCustomLED.SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
begin
if AutoSize and (Align in [alNone, alCustom]) then
inherited SetBounds(ALeft, ATop, FImgPict.Width, FImgPict.Height)
else
inherited SetBounds(ALeft, ATop, AWidth, AHeight);
end;
procedure TJvCustomLED.ColorChanged;
var
X, Y: Integer;
begin
inherited ColorChanged;
{ Work around a TBitmap.ReadDIB() bug where FreeContext() is not called. This
missing call leads to a GDI-Handle leak when the application is minimized
because then FreeBitmapContexts() is not called. }
FImgPict.Assign(nil);
FImgPict.LoadFromResourceName(HInstance, cGreenLEDName);
FImgPict.PixelFormat := pf24bit;
for X := 0 to FImgPict.Width - 1 do
for Y := 0 to FImgPict.Height - 1 do
if FImgPict.Canvas.Pixels[X, Y] = clLime then
FImgPict.Canvas.Pixels[X, Y] := Color;
Repaint;
end;
{$IFDEF UNITVERSIONING}
initialization
RegisterUnitVersion(HInstance, UnitVersioning);
finalization
UnregisterUnitVersion(HInstance);
{$ENDIF UNITVERSIONING}
end.