You've already forked lazarus-ccr
Industrial: Add new component TLCDDisplay (ported by Boban Spasic).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8302 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
163
components/industrialstuff/Example/LCDDisplay/project1.lpi
Normal file
163
components/industrialstuff/Example/LCDDisplay/project1.lpi
Normal file
@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="project1"/>
|
||||
<Scaled Value="True"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
</General>
|
||||
<LazDoc Paths="..\docs"/>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
<Item Name="Debug">
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="project1"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value=".."/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<IncludeAssertionCode Value="True"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<Checks>
|
||||
<IOChecks Value="True"/>
|
||||
<RangeChecks Value="True"/>
|
||||
<OverflowChecks Value="True"/>
|
||||
<StackChecks Value="True"/>
|
||||
</Checks>
|
||||
<VerifyObjMethodCallValidity Value="True"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
<UseHeaptrc Value="True"/>
|
||||
<TrashVariables Value="True"/>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
</Item>
|
||||
<Item Name="Release">
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="project1"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value=".."/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<SmartLinkUnit Value="True"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="3"/>
|
||||
</Optimizations>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<GenerateDebugInfo Value="False"/>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
</Debugging>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
</Item>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<RequiredPackages>
|
||||
<Item>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<PackageName Value="industrial"/>
|
||||
</Item>
|
||||
</RequiredPackages>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="untmain.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="frmMain"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="untMain"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="..\..\..\..\..\svn\lazarus-ccr\components\industrialstuff\source\indlcldisplay.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="indLCLDisplay"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="project1"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value=".."/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
24
components/industrialstuff/Example/LCDDisplay/project1.lpr
Normal file
24
components/industrialstuff/Example/LCDDisplay/project1.lpr
Normal file
@ -0,0 +1,24 @@
|
||||
program project1;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}
|
||||
cthreads,
|
||||
{$ENDIF}
|
||||
{$IFDEF HASAMIGA}
|
||||
athreads,
|
||||
{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, untMain, TLCDLines_unit;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TfrmMain, frmMain);
|
||||
Application.Run;
|
||||
end.
|
||||
|
337
components/industrialstuff/Example/LCDDisplay/untmain.lfm
Normal file
337
components/industrialstuff/Example/LCDDisplay/untmain.lfm
Normal file
@ -0,0 +1,337 @@
|
||||
object frmMain: TfrmMain
|
||||
Left = 510
|
||||
Height = 531
|
||||
Top = 217
|
||||
Width = 921
|
||||
Caption = 'LCDLines Demo'
|
||||
ClientHeight = 531
|
||||
ClientWidth = 921
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
LCLVersion = '2.3.0.0'
|
||||
object rgFrameStyle: TRadioGroup
|
||||
Left = 24
|
||||
Height = 105
|
||||
Top = 336
|
||||
Width = 108
|
||||
AutoFill = True
|
||||
Caption = 'Frame style'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 85
|
||||
ClientWidth = 104
|
||||
Items.Strings = (
|
||||
'fsRelief'
|
||||
'fsNone'
|
||||
'fsLowered'
|
||||
'fsRaised'
|
||||
)
|
||||
OnClick = rgFrameStyleClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object rgFrameColorStyle: TRadioGroup
|
||||
Left = 149
|
||||
Height = 65
|
||||
Top = 336
|
||||
Width = 123
|
||||
AutoFill = True
|
||||
Caption = 'Frame color style'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 45
|
||||
ClientWidth = 119
|
||||
Items.Strings = (
|
||||
'stWindows'
|
||||
'stColor'
|
||||
)
|
||||
OnClick = rgFrameColorStyleClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object cbtFrameColor: TColorButton
|
||||
Left = 288
|
||||
Height = 25
|
||||
Top = 410
|
||||
Width = 123
|
||||
BorderWidth = 2
|
||||
ButtonColorAutoSize = False
|
||||
ButtonColorSize = 16
|
||||
ButtonColor = clBlack
|
||||
Caption = 'Frame color'
|
||||
Margin = 8
|
||||
OnColorChanged = cbtFrameColorColorChanged
|
||||
end
|
||||
object rgDotShape: TRadioGroup
|
||||
Left = 427
|
||||
Height = 65
|
||||
Top = 336
|
||||
Width = 120
|
||||
AutoFill = True
|
||||
Caption = 'Dot shape'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 45
|
||||
ClientWidth = 116
|
||||
Items.Strings = (
|
||||
'stSquare'
|
||||
'stRound'
|
||||
)
|
||||
OnClick = rgDotShapeClick
|
||||
TabOrder = 2
|
||||
end
|
||||
object mmText: TMemo
|
||||
Left = 704
|
||||
Height = 65
|
||||
Top = 336
|
||||
Width = 168
|
||||
OnChange = mmTextChange
|
||||
TabOrder = 3
|
||||
end
|
||||
object rgFrameHeight: TRadioGroup
|
||||
Left = 563
|
||||
Height = 65
|
||||
Top = 336
|
||||
Width = 120
|
||||
AutoFill = True
|
||||
Caption = 'Frame height'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 45
|
||||
ClientWidth = 116
|
||||
Items.Strings = (
|
||||
'double'
|
||||
'single'
|
||||
)
|
||||
OnClick = rgFrameHeightClick
|
||||
TabOrder = 4
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 427
|
||||
Height = 15
|
||||
Top = 413
|
||||
Width = 44
|
||||
Caption = 'Dot size:'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
end
|
||||
object seDotSize: TSpinEdit
|
||||
Left = 491
|
||||
Height = 23
|
||||
Top = 410
|
||||
Width = 58
|
||||
OnChange = seDotSizeChange
|
||||
TabOrder = 5
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 427
|
||||
Height = 15
|
||||
Top = 441
|
||||
Width = 60
|
||||
Caption = 'Dots space:'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
end
|
||||
object seDotsSpace: TSpinEdit
|
||||
Left = 491
|
||||
Height = 23
|
||||
Top = 438
|
||||
Width = 58
|
||||
OnChange = seDotsSpaceChange
|
||||
TabOrder = 6
|
||||
end
|
||||
object Label3: TLabel
|
||||
Left = 563
|
||||
Height = 15
|
||||
Top = 413
|
||||
Width = 58
|
||||
Caption = 'Frame size:'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
end
|
||||
object seFrameSize: TSpinEdit
|
||||
Left = 625
|
||||
Height = 23
|
||||
Top = 410
|
||||
Width = 58
|
||||
OnChange = seFrameSizeChange
|
||||
TabOrder = 7
|
||||
end
|
||||
object cbAutoSize: TCheckBox
|
||||
Left = 149
|
||||
Height = 19
|
||||
Top = 413
|
||||
Width = 64
|
||||
Caption = 'AutoSize'
|
||||
OnChange = cbAutoSizeChange
|
||||
TabOrder = 8
|
||||
end
|
||||
object cbCharSpace: TCheckBox
|
||||
Left = 704
|
||||
Height = 19
|
||||
Top = 470
|
||||
Width = 76
|
||||
Caption = 'Char space'
|
||||
OnChange = cbCharSpaceChange
|
||||
TabOrder = 9
|
||||
end
|
||||
object cbtBoardColor: TColorButton
|
||||
Left = 288
|
||||
Height = 25
|
||||
Top = 436
|
||||
Width = 123
|
||||
BorderWidth = 2
|
||||
ButtonColorAutoSize = False
|
||||
ButtonColorSize = 16
|
||||
ButtonColor = clBlack
|
||||
Caption = 'Board color'
|
||||
Margin = 8
|
||||
OnColorChanged = cbtBoardColorColorChanged
|
||||
end
|
||||
object cbtDotONColor: TColorButton
|
||||
Left = 288
|
||||
Height = 25
|
||||
Top = 464
|
||||
Width = 123
|
||||
BorderWidth = 2
|
||||
ButtonColorAutoSize = False
|
||||
ButtonColorSize = 16
|
||||
ButtonColor = clBlack
|
||||
Caption = 'Dot color ON'
|
||||
Margin = 8
|
||||
OnColorChanged = cbtDotONColorColorChanged
|
||||
end
|
||||
object cbtDotOFFColor: TColorButton
|
||||
Left = 288
|
||||
Height = 25
|
||||
Top = 492
|
||||
Width = 123
|
||||
BorderWidth = 2
|
||||
ButtonColorAutoSize = False
|
||||
ButtonColorSize = 16
|
||||
ButtonColor = clBlack
|
||||
Caption = 'Dot color OFF'
|
||||
Margin = 8
|
||||
OnColorChanged = cbtDotOFFColorColorChanged
|
||||
end
|
||||
object seDisplayLineCount: TSpinEdit
|
||||
Left = 814
|
||||
Height = 23
|
||||
Top = 410
|
||||
Width = 58
|
||||
OnChange = seDisplayLineCountChange
|
||||
TabOrder = 10
|
||||
end
|
||||
object Label4: TLabel
|
||||
Left = 704
|
||||
Height = 15
|
||||
Top = 413
|
||||
Width = 95
|
||||
Caption = 'Screen row count:'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
end
|
||||
object seWidth: TSpinEdit
|
||||
Left = 625
|
||||
Height = 23
|
||||
Top = 438
|
||||
Width = 58
|
||||
OnChange = seWidthChange
|
||||
TabOrder = 11
|
||||
end
|
||||
object Label5: TLabel
|
||||
Left = 563
|
||||
Height = 15
|
||||
Top = 441
|
||||
Width = 35
|
||||
Caption = 'Width:'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
end
|
||||
object seHeigth: TSpinEdit
|
||||
Left = 625
|
||||
Height = 23
|
||||
Top = 466
|
||||
Width = 58
|
||||
OnChange = seHeigthChange
|
||||
TabOrder = 12
|
||||
end
|
||||
object Label6: TLabel
|
||||
Left = 563
|
||||
Height = 15
|
||||
Top = 469
|
||||
Width = 39
|
||||
Caption = 'Heigth:'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
end
|
||||
object Label7: TLabel
|
||||
Left = 704
|
||||
Height = 15
|
||||
Top = 441
|
||||
Width = 91
|
||||
Caption = 'Screen col count:'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
end
|
||||
object seDisplayCharCount: TSpinEdit
|
||||
Left = 814
|
||||
Height = 23
|
||||
Top = 438
|
||||
Width = 58
|
||||
OnChange = seDisplayCharCountChange
|
||||
TabOrder = 13
|
||||
end
|
||||
object cbColorSchemes: TComboBox
|
||||
Left = 288
|
||||
Height = 23
|
||||
Top = 354
|
||||
Width = 100
|
||||
ItemHeight = 15
|
||||
Items.Strings = (
|
||||
'csCustom'
|
||||
'csBlue'
|
||||
'csGreen'
|
||||
'csInvGreen'
|
||||
)
|
||||
OnChange = cbColorSchemesChange
|
||||
TabOrder = 14
|
||||
Text = 'cbColorSchemes'
|
||||
end
|
||||
object Label8: TLabel
|
||||
Left = 288
|
||||
Height = 15
|
||||
Top = 336
|
||||
Width = 76
|
||||
Caption = 'Color scheme:'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
end
|
||||
object Label9: TLabel
|
||||
Left = 288
|
||||
Height = 15
|
||||
Top = 392
|
||||
Width = 119
|
||||
Caption = 'Custom color scheme:'
|
||||
Color = clDefault
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
229
components/industrialstuff/Example/LCDDisplay/untmain.pas
Normal file
229
components/industrialstuff/Example/LCDDisplay/untmain.pas
Normal file
@ -0,0 +1,229 @@
|
||||
unit untMain;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
|
||||
Spin, indLCDDisplay;
|
||||
|
||||
type
|
||||
|
||||
{ TfrmMain }
|
||||
|
||||
TfrmMain = class(TForm)
|
||||
cbAutoSize: TCheckBox;
|
||||
cbCharSpace: TCheckBox;
|
||||
cbtFrameColor: TColorButton;
|
||||
cbtBoardColor: TColorButton;
|
||||
cbtDotONColor: TColorButton;
|
||||
cbtDotOFFColor: TColorButton;
|
||||
cbColorSchemes: TComboBox;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
Label4: TLabel;
|
||||
Label5: TLabel;
|
||||
Label6: TLabel;
|
||||
Label7: TLabel;
|
||||
Label8: TLabel;
|
||||
Label9: TLabel;
|
||||
mmText: TMemo;
|
||||
rgFrameStyle: TRadioGroup;
|
||||
rgFrameColorStyle: TRadioGroup;
|
||||
rgDotShape: TRadioGroup;
|
||||
rgFrameHeight: TRadioGroup;
|
||||
seDotSize: TSpinEdit;
|
||||
seFrameSize: TSpinEdit;
|
||||
seDotsSpace: TSpinEdit;
|
||||
seDisplayCharCount: TSpinEdit;
|
||||
seWidth: TSpinEdit;
|
||||
seHeigth: TSpinEdit;
|
||||
seDisplayLineCount: TSpinEdit;
|
||||
procedure cbAutoSizeChange(Sender: TObject);
|
||||
procedure cbCharSpaceChange(Sender: TObject);
|
||||
procedure cbColorSchemesChange(Sender: TObject);
|
||||
procedure cbtFrameColorColorChanged(Sender: TObject);
|
||||
procedure cbtBoardColorColorChanged(Sender: TObject);
|
||||
procedure cbtDotONColorColorChanged(Sender: TObject);
|
||||
procedure cbtDotOFFColorColorChanged(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure mmTextChange(Sender: TObject);
|
||||
procedure rgFrameStyleClick(Sender: TObject);
|
||||
procedure rgFrameColorStyleClick(Sender: TObject);
|
||||
procedure rgDotShapeClick(Sender: TObject);
|
||||
procedure rgFrameHeightClick(Sender: TObject);
|
||||
procedure seDisplayCharCountChange(Sender: TObject);
|
||||
procedure seDotSizeChange(Sender: TObject);
|
||||
procedure seDotsSpaceChange(Sender: TObject);
|
||||
procedure seFrameSizeChange(Sender: TObject);
|
||||
procedure seHeigthChange(Sender: TObject);
|
||||
procedure seDisplayLineCountChange(Sender: TObject);
|
||||
procedure seWidthChange(Sender: TObject);
|
||||
private
|
||||
LCDLines1: TLCDLines;
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
frmMain: TfrmMain;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TfrmMain }
|
||||
|
||||
procedure TfrmMain.cbtFrameColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.FrameColor := cbtFrameColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.cbtBoardColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.BoardColor := cbtBoardColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.cbtDotONColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.DotColorON := cbtDotONColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.cbtDotOFFColorColorChanged(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.DotColorOFF := cbtDotOFFColor.ButtonColor;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.FormCreate(Sender: TObject);
|
||||
begin
|
||||
LCDLines1 := TLCDLines.Create(self);
|
||||
with LCDLines1 do
|
||||
begin
|
||||
Left := 24;
|
||||
Height := 101;
|
||||
Top := 16;
|
||||
Width := 290;
|
||||
AutoSize := True;
|
||||
DotColorOn := 5162664;
|
||||
DotColorOff := 2900284;
|
||||
DisplayCharCount := 0;
|
||||
Lines.Add('TLCDLines');
|
||||
ColorScheme := csInvGreen;
|
||||
Parent := self;
|
||||
end
|
||||
end;
|
||||
|
||||
procedure TfrmMain.FormShow(Sender: TObject);
|
||||
begin
|
||||
mmText.Lines := LCDLines1.Lines;
|
||||
seDisplayLineCount.Value := LCDLines1.DisplayLineCount;
|
||||
seDisplayCharCount.Value := LCDLines1.DisplayCharCount;
|
||||
seFrameSize.Value := LCDLines1.FrameSize;
|
||||
seDotSize.Value := LCDLines1.DotSize;
|
||||
seDotsSpace.Value := LCDLines1.DotsSpace;
|
||||
seWidth.Value := LCDLines1.Width;
|
||||
seHeigth.Value := LCDLines1.Height;
|
||||
cbAutoSize.Checked := LCDLines1.AutoSize;
|
||||
cbCharSpace.Checked := LCDLines1.CharSpace;
|
||||
cbtFrameColor.ButtonColor := LCDLines1.FrameColor;
|
||||
cbtBoardColor.ButtonColor := LCDLines1.BoardColor;
|
||||
cbtDotONColor.ButtonColor := LCDLines1.DotColorOn;
|
||||
cbtDotOFFColor.ButtonColor := LCDLines1.DotColorOff;
|
||||
rgFrameStyle.ItemIndex := integer(LCDLines1.FrameStyle);
|
||||
rgFrameColorStyle.ItemIndex := integer(LCDLines1.FrameColorStyle);
|
||||
rgDotShape.ItemIndex := integer(LCDLines1.DotShape);
|
||||
rgFrameHeight.ItemIndex := integer(LCDLines1.FrameHeight);
|
||||
cbColorSchemes.ItemIndex:= integer(LCDLines1.ColorScheme);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.cbAutoSizeChange(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.AutoSize := cbAutoSize.Checked;
|
||||
if not cbAutoSize.Checked then
|
||||
begin
|
||||
LCDLines1.Width := seWidth.Value;
|
||||
LCDLines1.Height := seHeigth.Value;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.cbCharSpaceChange(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.CharSpace := cbCharSpace.Checked;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.cbColorSchemesChange(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.ColorScheme := TColorScheme(cbColorSchemes.ItemIndex);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.mmTextChange(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.Lines.Assign(mmText.Lines);
|
||||
if LCDLines1.AutoSize then
|
||||
begin
|
||||
LCDLines1.InvalidatePreferredSize;
|
||||
LCDLines1.AdjustSize;
|
||||
end;
|
||||
LCDLines1.Invalidate;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.rgFrameStyleClick(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.FrameStyle := TFrameStyle(rgFrameStyle.ItemIndex);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.rgFrameColorStyleClick(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.FrameColorStyle := TFrameColorStyle(rgFrameColorStyle.ItemIndex);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.rgDotShapeClick(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.DotShape := TDotShape(rgDotShape.ItemIndex);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.rgFrameHeightClick(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.FrameHeight := TFrameHeight(rgFrameHeight.ItemIndex);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.seDisplayCharCountChange(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.DisplayCharCount := seDisplayCharCount.Value;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.seDotSizeChange(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.DotSize := seDotSize.Value;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.seDotsSpaceChange(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.DotsSpace := seDotsSpace.Value;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.seFrameSizeChange(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.FrameSize := seFrameSize.Value;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.seHeigthChange(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.Height := seHeigth.Value;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.seDisplayLineCountChange(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.DisplayLineCount := seDisplayLineCount.Value;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.seWidthChange(Sender: TObject);
|
||||
begin
|
||||
LCDLines1.Width := seWidth.Value;
|
||||
end;
|
||||
|
||||
end.
|
@ -28,79 +28,84 @@
|
||||
<Description Value="Industrial-themed components and gauges:
|
||||
- LED indicators
|
||||
- LED seven-sigment display
|
||||
- Multi-line LCD display
|
||||
- Gauges
|
||||
- stop-light lamps
|
||||
- analog gauges
|
||||
- thermometer-like gauge
|
||||
- knob
|
||||
- on/off switch
|
||||
- multislider"/>
|
||||
- Stop-light lamps
|
||||
- Analog gauges
|
||||
- Thermometer-like gauge
|
||||
- Knob
|
||||
- On/off switch
|
||||
- Multislider"/>
|
||||
<License Value="MPL + GPL + modified LGPL (see unit headers)."/>
|
||||
<Version Minor="5"/>
|
||||
<Files Count="14">
|
||||
<Item1>
|
||||
<Files>
|
||||
<Item>
|
||||
<Filename Value="source\indled.pas"/>
|
||||
<UnitName Value="IndLed"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\sensors.pas"/>
|
||||
<UnitName Value="Sensors"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\AllIndustrialRegister.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="AllIndustrialRegister"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\lednumber.pas"/>
|
||||
<UnitName Value="LedNumber"/>
|
||||
</Item4>
|
||||
<Item5>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\indgnoumeter.pas"/>
|
||||
<UnitName Value="indGnouMeter"/>
|
||||
</Item5>
|
||||
<Item6>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\AdvLed.pas"/>
|
||||
<UnitName Value="AdvLed"/>
|
||||
</Item6>
|
||||
<Item7>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\indcyBaseLed.pas"/>
|
||||
<UnitName Value="indcyBaseLed"/>
|
||||
</Item7>
|
||||
<Item8>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\indcyClasses.pas"/>
|
||||
<UnitName Value="indcyClasses"/>
|
||||
</Item8>
|
||||
<Item9>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\indcyGraphics.pas"/>
|
||||
<UnitName Value="indcyGraphics"/>
|
||||
</Item9>
|
||||
<Item10>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\indcyTypes.pas"/>
|
||||
<UnitName Value="indcyTypes"/>
|
||||
</Item10>
|
||||
<Item11>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\a3naloggauge.pas"/>
|
||||
<UnitName Value="A3nalogGauge"/>
|
||||
</Item11>
|
||||
<Item12>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\mknob.pas"/>
|
||||
<UnitName Value="MKnob"/>
|
||||
</Item12>
|
||||
<Item13>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\switches.pas"/>
|
||||
<UnitName Value="switches"/>
|
||||
</Item13>
|
||||
<Item14>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\indsliders.pas"/>
|
||||
<UnitName Value="indsliders"/>
|
||||
</Item14>
|
||||
<UnitName Value="indSliders"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Filename Value="source\indlcddisplay.pas"/>
|
||||
<UnitName Value="indLCDDisplay"/>
|
||||
</Item>
|
||||
</Files>
|
||||
<LazDoc Paths="D:\Prog_Lazarus\svn\lazarus-ccr\components\industrialstuff\fpdoc"/>
|
||||
<RequiredPkgs Count="1">
|
||||
<Item1>
|
||||
<RequiredPkgs>
|
||||
<Item>
|
||||
<PackageName Value="IDEIntf"/>
|
||||
</Item1>
|
||||
</Item>
|
||||
</RequiredPkgs>
|
||||
<UsageOptions>
|
||||
<UnitPath Value="$(PkgOutDir)"/>
|
||||
|
@ -10,7 +10,7 @@ interface
|
||||
uses
|
||||
IndLed, Sensors, AllIndustrialRegister, LedNumber, indGnouMeter, AdvLed,
|
||||
indcyBaseLed, indcyClasses, indcyGraphics, indcyTypes, A3nalogGauge, MKnob,
|
||||
switches, indSliders, LazarusPackageIntf;
|
||||
switches, indSliders, indLCDDisplay, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -28,3 +28,6 @@ tonoffswitch_200.png
|
||||
tmultislider.png
|
||||
tmultislider_150.png
|
||||
tmultislider_200.png
|
||||
tlcddisplay.png
|
||||
tlcddisplay_150.png
|
||||
tlcddisplay_200.png
|
||||
|
BIN
components/industrialstuff/resources/tlcddisplay.png
Normal file
BIN
components/industrialstuff/resources/tlcddisplay.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 596 B |
BIN
components/industrialstuff/resources/tlcddisplay_150.png
Normal file
BIN
components/industrialstuff/resources/tlcddisplay_150.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
components/industrialstuff/resources/tlcddisplay_200.png
Normal file
BIN
components/industrialstuff/resources/tlcddisplay_200.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -11,8 +11,8 @@ interface
|
||||
|
||||
|
||||
uses
|
||||
Classes, LResources, AdvLed, IndLed, LedNumber, Sensors, IndGnouMeter,
|
||||
A3nalogGauge, MKnob, Switches, indSliders;
|
||||
Classes, LResources, AdvLed, IndLed, LedNumber, Sensors, indGnouMeter,
|
||||
A3nalogGauge, MKnob, Switches, indSliders, indLCDDisplay;
|
||||
|
||||
procedure Register;
|
||||
|
||||
@ -26,7 +26,7 @@ begin
|
||||
RegisterComponents ('Industrial',[
|
||||
TAdvLed, TIndLed, TLedNumber, TStopLightSensor,
|
||||
TAnalogSensor, TA3nalogGauge, TindGnouMeter,
|
||||
TmKnob, TOnOffSwitch, TMultiSlider
|
||||
TmKnob, TOnOffSwitch, TMultiSlider, TLCDDisplay
|
||||
]);
|
||||
|
||||
end;
|
||||
|
898
components/industrialstuff/source/indlcddisplay.pas
Normal file
898
components/industrialstuff/source/indlcddisplay.pas
Normal file
@ -0,0 +1,898 @@
|
||||
{
|
||||
*****************************************************************************
|
||||
See the file COPYING.modifiedLGPL.txt, included in your Lazarus installation
|
||||
for details about the license.
|
||||
*****************************************************************************
|
||||
Based on LCDLine by Yuriy Tereshchenko
|
||||
Initial Lazarus port and multi-line extension: Boban Spasic (spasic@gmail.com)
|
||||
Further optimizations and extensions: Werner Pamler
|
||||
}
|
||||
unit indLCDDisplay;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, Controls, fgl, Graphics, LResources, LCLIntf;
|
||||
|
||||
type
|
||||
TFrameStyle = (fsRelief, fsNone, fsLowered, fsRaised);
|
||||
TFrameColorStyle = (stWindows, stColor);
|
||||
TFrameHeight = (fhDouble, fhSingle);
|
||||
TDotShape = (stSquare, stRound);
|
||||
TColorScheme = (csCustom, csBlue, csGreen, csInvGreen);
|
||||
|
||||
type
|
||||
TDotMatrix = array of integer;
|
||||
TDotMatrixList = specialize TFPGMap<string, TDotMatrix>;
|
||||
|
||||
TLCDDisplay = class(TGraphicControl)
|
||||
private
|
||||
BitMap: TBitMap;
|
||||
{
|
||||
one char consists of Col x Row of dots
|
||||
dots have size and space between dots
|
||||
}
|
||||
FDotSize: integer; // dot size in pixels
|
||||
FDotsSpace: integer; // inter-dots space in pixels
|
||||
FDotColsCount: integer; // number of dot-cols in char matrix
|
||||
FDotRowsCount: integer; // number of dot-rows in char matrix
|
||||
FCharCount: integer;
|
||||
FGlobalDotColsCount: integer;
|
||||
FCharWidth: integer;
|
||||
|
||||
FFrameSize: integer;
|
||||
FBoardWidth: integer;
|
||||
FBoardHeight: integer;
|
||||
FLEDWidth: integer;
|
||||
FLEDHeight: integer;
|
||||
|
||||
FFrameColor: TColor;
|
||||
FBoardColor: TColor;
|
||||
FDotColorOn: TColor;
|
||||
FDotColorOff: TColor;
|
||||
|
||||
FLenText: integer;
|
||||
FDisplayLineCount: integer;
|
||||
FDisplayCharCount: integer;
|
||||
FLines: TStringList;
|
||||
FCharSpace: boolean;
|
||||
FColorScheme: TColorScheme;
|
||||
FCountOn: integer;
|
||||
FFrameStyle: TFrameStyle;
|
||||
FFrameHeight: TFrameHeight;
|
||||
FFrameColorStyle: TFrameColorStyle;
|
||||
FDotShape: TDotShape;
|
||||
|
||||
FCharList: TDotMatrixList;
|
||||
|
||||
procedure SetDotShape(const Value: TDotShape);
|
||||
procedure SetFrameColorStyle(const Value: TFrameColorStyle);
|
||||
procedure SetFrameHeight(const Value: TFrameHeight);
|
||||
procedure SetFrameStyle(const Value: TFrameStyle);
|
||||
procedure SetCharSpace(const Value: boolean);
|
||||
procedure SetColorScheme(const Value: TColorScheme);
|
||||
|
||||
function GetCharCount: longint;
|
||||
function GetGlobalDotColsCount: longint;
|
||||
procedure SetDisplayLineCount(const Value: integer);
|
||||
procedure SetDisplayCharCount(const Value: integer);
|
||||
procedure SetLines(const Value: TStringList);
|
||||
procedure SetDotColorOff(const Value: TColor);
|
||||
procedure SetDotColorOn(const Value: TColor);
|
||||
procedure SetBoardColor(const Value: TColor);
|
||||
procedure SetFrameColor(const Value: TColor);
|
||||
procedure SetFrameSize(const Value: integer);
|
||||
procedure SetDotSize(const Value: integer);
|
||||
procedure SetDotsSpace(const Value: integer);
|
||||
|
||||
function CalcCharCount: integer;
|
||||
procedure InitCharList(AHorDots, AVertDots: integer);
|
||||
//calculate widths and heigths of the char matrix, background border and frame
|
||||
procedure DrawCalc();
|
||||
//draw frame
|
||||
procedure DrawBorder();
|
||||
//background grid of dots that are off
|
||||
procedure DrawGrid();
|
||||
//space between chars
|
||||
procedure DrawSpace();
|
||||
//call DrawChar for every char
|
||||
procedure DrawText();
|
||||
//call DrawDot for every dot that is on
|
||||
procedure DrawChar(Row, Col, NChar: integer);
|
||||
procedure DrawDot(Row, Col: integer; DotColor: TColor);
|
||||
//draw frame shadow
|
||||
procedure DrawShadow(StartP, EndP: TPoint; LineColor1, LineColor2: TColor);
|
||||
procedure DrawBitmapToCanvas();
|
||||
|
||||
protected
|
||||
procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
|
||||
{%H-}WithThemeSpace: boolean); override;
|
||||
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||
const AXProportion, AYProportion: double); override;
|
||||
procedure Paint; override;
|
||||
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure AddDotMatrix(AChar: string; const Dots: array of integer);
|
||||
|
||||
property DotColsCount: integer read FDotColsCount;
|
||||
property DotRowsCount: integer read FDotRowsCount;
|
||||
|
||||
property CharCount: longint read GetCharCount;
|
||||
property GlobalDotColsCount: longint read GetGlobalDotColsCount;
|
||||
|
||||
|
||||
published
|
||||
property AutoSize;
|
||||
property BorderSpacing;
|
||||
property ShowHint;
|
||||
property Visible;
|
||||
property OnClick;
|
||||
property OnDblClick;
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
|
||||
property DotSize: integer read FDotSize write SetDotSize default 4;
|
||||
property DotsSpace: integer read FDotsSpace write SetDotsSpace default 1;
|
||||
property FrameSize: integer read FFrameSize write SetFrameSize default 8;
|
||||
|
||||
property FrameColor: TColor read FFrameColor write SetFrameColor default clBtnFace;
|
||||
// To use BoardColor, ColorScheme must be set to csCustom
|
||||
property BoardColor: TColor read FBoardColor write SetBoardColor default clBlack;
|
||||
// To use DotColorOn, ColorScheme must be set to csCustom
|
||||
property DotColorOn: TColor read FDotColorOn write SetDotColorOn default clSkyBlue;
|
||||
// To use DotColorOff, ColorScheme must be set to csCustom
|
||||
property DotColorOff: TColor read FDotColorOff write SetDotColorOff default clTeal;
|
||||
// Vertical screen size in chars
|
||||
// Without AutoSize, if the frame is too small
|
||||
// a part off the text will not be visible
|
||||
// e.g. frame is big enough for one line
|
||||
// and the text contains 3 lines
|
||||
// - just the middle line will be visible
|
||||
property DisplayLineCount: integer read FDisplayLineCount write SetDisplayLineCount default 2;
|
||||
// Horizontal screen size in chars
|
||||
// Set to <=0 (zero) to have a real AutoSize
|
||||
// Has no effect without AutoSize
|
||||
property DisplayCharCount: integer read FDisplayCharCount write SetDisplayCharCount default 10;
|
||||
// The text to display
|
||||
// It will be truncated according
|
||||
// to ScreenRowCount and ScreenColCount
|
||||
property Lines: TStringList read FLines write SetLines;
|
||||
// Insert one-dot space between chars
|
||||
property CharSpace: boolean read FCharSpace write SetCharSpace default False;
|
||||
// Pre-defined color schemes
|
||||
// Set to csCustom in order to use
|
||||
// the BoardColor, DotColorOn and DotColorOff
|
||||
property ColorScheme: TColorScheme
|
||||
read FColorScheme write SetColorScheme default csCustom;
|
||||
property FrameStyle: TFrameStyle
|
||||
read FFrameStyle write SetFrameStyle default fsRelief;
|
||||
property FrameHeight: TFrameHeight
|
||||
read FFrameHeight write SetFrameHeight default fhDouble;
|
||||
property FrameColorStyle: TFrameColorStyle
|
||||
read FFrameColorStyle write SetFrameColorStyle default stWindows;
|
||||
property DotShape: TDotShape read FDotShape write SetDotShape default stSquare;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Dialogs, LazUTF8, LazUnicode;
|
||||
|
||||
constructor TLCDDisplay.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
ControlStyle := ControlStyle + [csOpaque];
|
||||
|
||||
Width := 156;
|
||||
Height := 76;
|
||||
|
||||
FDisplayLineCount := 2;
|
||||
FDisplayCharCount := 10;
|
||||
|
||||
FCharList := TDotMatrixList.Create;
|
||||
FCharList.Sorted := True;
|
||||
|
||||
FDotColsCount := 5;
|
||||
FDotRowsCount := 7;
|
||||
InitCharList(FDotColsCount, FDotRowsCount);
|
||||
|
||||
FDotSize := 4;
|
||||
FDotsSpace := 1;
|
||||
FFrameSize := 8;
|
||||
FBoardWidth := 4;
|
||||
|
||||
FFrameColor := clBtnFace;
|
||||
FBoardColor := clBlack;
|
||||
FDotColorOn := clSkyBlue;
|
||||
FDotColorOff := clTeal;
|
||||
|
||||
BitMap := TBitMap.Create;
|
||||
FCountOn := 255;
|
||||
|
||||
FLines := TStringList.Create;
|
||||
end;
|
||||
|
||||
destructor TLCDDisplay.Destroy;
|
||||
begin
|
||||
BitMap.Free;
|
||||
FCharList.Free;
|
||||
FLines.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.AddDotMatrix(AChar: string; const Dots: array of integer);
|
||||
var
|
||||
matrix: TDotMatrix = nil;
|
||||
i: integer;
|
||||
begin
|
||||
if Length(Dots) <> FDotRowsCount then
|
||||
raise Exception.Create('AddDotMatrix: Incorrect number of rows.');
|
||||
SetLength(matrix, FDotRowsCount);
|
||||
for i := 0 to FDotRowsCount - 1 do
|
||||
matrix[i] := Dots[i];
|
||||
FCharList.Add(AChar, matrix);
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer;
|
||||
WithThemeSpace: boolean);
|
||||
begin
|
||||
FCharWidth := (DotSize * FDotColsCount) + (DotsSpace * (FDotColsCount + 1)); //pixels
|
||||
FCharCount := CalcCharCount;
|
||||
FGlobalDotColsCount := (FCharCount * FDotColsCount) + (FCharCount - 1); //dots
|
||||
|
||||
// total matrix width
|
||||
FLEDWidth := (FGlobalDotColsCount * DotSize) + ((FGlobalDotColsCount - 1) * DotsSpace);
|
||||
// total matrix height
|
||||
FLEDHeight := (FDisplayLineCount * FDotRowsCount * (DotSize + DotsSpace)) +
|
||||
((FDisplayLineCount - 1) * (DotSize + DotsSpace));
|
||||
if FCharSpace then
|
||||
FLEDHeight := FLEDHeight + ((FDisplayLineCount - 1) * DotsSpace);
|
||||
|
||||
//background around text matrix - left/right pixels
|
||||
FBoardWidth := DotSize + DotsSpace;
|
||||
//background around text matrix - up/down pixels
|
||||
FBoardHeight := DotSize + DotsSpace;
|
||||
|
||||
//Total size incl. frame
|
||||
PreferredWidth := FLEDWidth + (2 * FrameSize) + (2 * FBoardWidth);
|
||||
PreferredHeight := FLEDHeight + (2 * FrameSize) + (2 * FBoardWidth);
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||
const AXProportion, AYProportion: double);
|
||||
begin
|
||||
inherited;
|
||||
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
|
||||
begin
|
||||
FDotSize := round(FDotSize * AXProportion);
|
||||
FDotsSpace := round(FDotsSpace * AXProportion);
|
||||
FFrameSize := round(FFrameSize * AXProportion);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.DrawCalc();
|
||||
begin
|
||||
FCharWidth := (DotSize * FDotColsCount) + (DotsSpace * (FDotColsCount + 1)); //pixels
|
||||
FCharCount := ((Width - (2 * FrameSize)) + DotSize) div (FCharWidth + DotSize);
|
||||
FGlobalDotColsCount := (FCharCount * FDotColsCount) + (FCharCount - 1); //dots
|
||||
|
||||
// total matrix width
|
||||
FLEDWidth := (FGlobalDotColsCount * DotSize) + ((FGlobalDotColsCount - 1) * DotsSpace);
|
||||
// total matrix height
|
||||
FLEDHeight := (FDisplayLineCount * FDotRowsCount * (DotSize + DotsSpace)) +
|
||||
((FDisplayLineCount - 1) * (DotSize + DotsSpace));
|
||||
if FCharSpace then
|
||||
FLEDHeight := FLEDHeight + ((FDisplayLineCount - 1) * DotsSpace);
|
||||
|
||||
FBoardWidth := (Width - 2 * FrameSize - FLEDWidth) div 2;
|
||||
FBoardHeight := (Height - 2 * FrameSize - FLEDHeight) div 2;
|
||||
|
||||
BitMap.Width := Width;
|
||||
BitMap.Height := Height;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.DrawBorder();
|
||||
var
|
||||
FStart, FEnd: TPoint;
|
||||
BStart, BEnd: TPoint;
|
||||
Color1, Color2, Color3, Color4: TColor;
|
||||
C: longint;
|
||||
R, G, B: integer;
|
||||
const
|
||||
K1 = 4.637;
|
||||
K2 = 1.364;
|
||||
K3 = 1.372093;
|
||||
K4 = 2.088495;
|
||||
begin
|
||||
|
||||
BStart.X := FrameSize;
|
||||
BStart.Y := FrameSize;
|
||||
BEnd.X := Width - FrameSize;
|
||||
BEnd.Y := Height - FrameSize;
|
||||
|
||||
with BitMap.Canvas do
|
||||
begin
|
||||
Brush.Color := FrameColor;
|
||||
Pen.Color := FrameColor;
|
||||
Rectangle(0, 0, BitMap.Width, BitMap.Height);
|
||||
Brush.Color := FBoardColor;
|
||||
Pen.Color := FBoardColor;
|
||||
Rectangle(BStart.X, BStart.Y, BEnd.X, BEnd.Y);
|
||||
end;
|
||||
|
||||
if FrameStyle = fsNone then
|
||||
Exit;
|
||||
|
||||
if FrameColorStyle = stWindows then
|
||||
C := ColorToRGB(clBtnFace)
|
||||
else
|
||||
C := ColorToRGB(FrameColor);
|
||||
|
||||
R := RED(C);
|
||||
G := GREEN(C);
|
||||
B := BLUE(C);
|
||||
|
||||
if FrameColorStyle = stWindows then
|
||||
Color1 := clWhite
|
||||
else
|
||||
Color1 := RGBToColor(Round(R / K1 + 200), Round(G / K1 + 200), Round(B / K1 + 200));
|
||||
|
||||
Color2 := RGBToColor(Round(R / K2 + 68), Round(G / K2 + 68), Round(B / K2 + 68));
|
||||
Color3 := RGBToColor(Round(R / K3), Round(G / K3), Round(B / K3));
|
||||
|
||||
if FrameHeight = fhDouble then
|
||||
Color4 := RGBToColor(Round(R / K4), Round(G / K4), Round(B / K4))
|
||||
else
|
||||
Color4 := Color3;
|
||||
|
||||
FStart.X := 0;
|
||||
FStart.Y := 0;
|
||||
FEnd.X := Width - 1;
|
||||
FEnd.Y := Height - 1;
|
||||
|
||||
BStart.X := FrameSize;
|
||||
BStart.Y := FrameSize;
|
||||
BEnd.X := Width - FrameSize - 1;
|
||||
BEnd.Y := Height - FrameSize - 1;
|
||||
|
||||
if (FrameStyle = fsRaised) or (FrameStyle = fsRelief) then
|
||||
begin
|
||||
DrawShadow(FStart, FEnd, Color1, Color4);
|
||||
|
||||
if FrameHeight = fhDouble then
|
||||
begin
|
||||
FStart.X := FStart.X + 1;
|
||||
FStart.Y := FStart.Y + 1;
|
||||
FEnd.X := FEnd.X - 1;
|
||||
FEnd.Y := FEnd.Y - 1;
|
||||
DrawShadow(FStart, FEnd, Color2, Color3);
|
||||
end;
|
||||
end;
|
||||
|
||||
if (FrameStyle = fsLowered) or (FrameStyle = fsRelief) then
|
||||
begin
|
||||
DrawShadow(BStart, BEnd, Color3, Color1);
|
||||
if FrameHeight = fhDouble then
|
||||
begin
|
||||
BStart.X := BStart.X + 1;
|
||||
BStart.Y := BStart.Y + 1;
|
||||
BEnd.X := BEnd.X - 1;
|
||||
BEnd.Y := BEnd.Y - 1;
|
||||
DrawShadow(BStart, BEnd, Color4, Color2);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.DrawShadow(StartP, EndP: TPoint; LineColor1, LineColor2: TColor);
|
||||
begin
|
||||
with BitMap.Canvas do
|
||||
begin
|
||||
Pen.Color := LineColor1;
|
||||
MoveTo(EndP.X, StartP.Y);
|
||||
LineTo(StartP.X, StartP.Y);
|
||||
LineTo(StartP.X, EndP.Y);
|
||||
|
||||
Pen.Color := LineColor2;
|
||||
MoveTo(EndP.X, StartP.Y);
|
||||
LineTo(EndP.X, EndP.Y);
|
||||
LineTo(StartP.X - 1, EndP.Y);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.DrawGrid();
|
||||
var
|
||||
y, x: integer;
|
||||
NRow, NCol: integer;
|
||||
begin
|
||||
|
||||
NRow := (FDotRowsCount + 1) * FDisplayLineCount - 1;
|
||||
NCol := (FDotColsCount + 1) * FCharCount - 1;
|
||||
|
||||
for y := 0 to NRow - 1 do
|
||||
for x := 0 to NCol - 1 do
|
||||
DrawDot(y, x, FDotColorOff);
|
||||
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.DrawSpace();
|
||||
var
|
||||
y, x: integer;
|
||||
NRow, NCol: integer;
|
||||
i, j, lc: integer;
|
||||
begin
|
||||
//i - vertical spaces
|
||||
//j - horizontal spaces
|
||||
for lc := 0 to FDisplayLineCount - 1 do
|
||||
begin
|
||||
NRow := FDotRowsCount + 1;
|
||||
NCol := (FDotColsCount + 1) * FCharCount - 1;
|
||||
|
||||
j := 0;
|
||||
for y := 0 to (NRow * (lc + 1)) do
|
||||
begin
|
||||
i := 0;
|
||||
for x := 0 to NCol - 1 do
|
||||
begin
|
||||
if ((i = 5) or (j = 7)) and (y < (NRow * (lc + 1))) then
|
||||
begin
|
||||
DrawDot(y, x, FBoardColor);
|
||||
i := 0;
|
||||
end
|
||||
else
|
||||
i := i + 1;
|
||||
end;
|
||||
if j = 7 then
|
||||
begin
|
||||
j := 0;
|
||||
end
|
||||
else
|
||||
j := j + 1;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.DrawText();
|
||||
var
|
||||
x, y, c: integer;
|
||||
DotRow: integer;
|
||||
DotOn: boolean;
|
||||
i, j: integer;
|
||||
line: string;
|
||||
ch: string;
|
||||
matrix: TDotMatrix;
|
||||
begin
|
||||
for i := 0 to FDisplayLineCount - 1 do
|
||||
begin
|
||||
if i < FLines.Count then
|
||||
begin
|
||||
line := FLines[i];
|
||||
FLenText := UTF8Length(line);
|
||||
|
||||
c := 0;
|
||||
for ch in line do
|
||||
begin
|
||||
Inc(c);
|
||||
if not FCharList.Find(ch, j) then
|
||||
exit;
|
||||
matrix := FCharList[ch];
|
||||
for y := 0 to FDotRowsCount - 1 do
|
||||
begin
|
||||
DotRow := matrix[y];
|
||||
for x := 0 to 4 do
|
||||
begin
|
||||
DotOn := DotRow and (1 shl (5 - x - 1)) > 0;
|
||||
if DotOn then
|
||||
DrawChar(y + 8 * i, x, c);
|
||||
end; // for x
|
||||
end; // for y
|
||||
end; // for ch
|
||||
end;
|
||||
|
||||
if CharSpace then
|
||||
DrawSpace();
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TLCDDisplay.DrawChar(Row, Col, NChar: integer);
|
||||
begin
|
||||
|
||||
Col := Col + ((FDotColsCount + 1) * (NChar - 1));
|
||||
if Col > FGlobalDotColsCount - 1 then
|
||||
Exit;
|
||||
if Col < 0 then
|
||||
Exit;
|
||||
DrawDot(Row, Col, FDotColorOn);
|
||||
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.DrawDot(Row, Col: integer; DotColor: TColor);
|
||||
var
|
||||
DotR: TRect;
|
||||
begin
|
||||
DotR.Left := FrameSize + FBoardWidth + (DotSize + DotsSpace) * Col;
|
||||
DotR.Top := FrameSize + FBoardHeight + (DotSize + DotsSpace) * Row;
|
||||
DotR.Right := DotR.Left + DotSize;
|
||||
DotR.Bottom := DotR.Top + DotSize;
|
||||
|
||||
if FFrameHeight = fhSingle then
|
||||
begin
|
||||
if (DotR.Top <= FFrameSize) or (DotR.Bottom >= Height - FFrameSize) then
|
||||
exit;
|
||||
if (DotR.Left <= FFrameSize) or (DotR.Right >= Width - FFrameSize) then
|
||||
exit;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (DotR.Top <= FFrameSize + 1) or (DotR.Bottom >= Height - FFrameSize - 1) then
|
||||
exit;
|
||||
if (DotR.Left <= FFrameSize + 1) or (DotR.Right >= Width - FFrameSize - 1) then
|
||||
exit;
|
||||
end;
|
||||
|
||||
with BitMap.Canvas do
|
||||
begin
|
||||
Pen.Color := DotColor;
|
||||
Brush.Color := DotColor;
|
||||
|
||||
if DotShape = stSquare then
|
||||
FillRect(DotR)
|
||||
else
|
||||
Ellipse(DotR.Left, DotR.Top, DotR.Right, DotR.Bottom);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.DrawBitmapToCanvas();
|
||||
begin
|
||||
Canvas.Draw(0, 0, BitMap);
|
||||
end;
|
||||
|
||||
// Find the longest's line length
|
||||
function TLCDDisplay.CalcCharCount: integer;
|
||||
var
|
||||
len: integer;
|
||||
i, tmp: integer;
|
||||
begin
|
||||
len := 1;
|
||||
if FDisplayCharCount > 0 then
|
||||
Result := FDisplayCharCount
|
||||
else
|
||||
begin
|
||||
for i := 0 to FDisplayLineCount - 1 do
|
||||
begin
|
||||
if i < Lines.Count then
|
||||
begin
|
||||
tmp := UTF8Length(Lines[i]);
|
||||
if tmp > Len then Len := tmp;
|
||||
end;
|
||||
end;
|
||||
Result := Len;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.InitCharList(AHorDots, AVertDots: integer);
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
FCharList.Clear;
|
||||
if (AHorDots = 5) and (AVertDots = 7) then
|
||||
begin
|
||||
for i := 0 to 32 do
|
||||
AddDotMatrix(char(i), [0, 0, 0, 0, 0, 0, 0]);
|
||||
AddDotMatrix('!', [4, 4, 4, 4, 4, 0, 4]); // #33
|
||||
AddDotMatrix('"', [10, 10, 0, 0, 0, 0, 0]); // #34
|
||||
AddDotMatrix('#', [0, 10, 31, 10, 31, 10, 0]); // #35
|
||||
AddDotMatrix('$', [4, 15, 20, 14, 5, 30, 4]); // #36
|
||||
AddDotMatrix('%', [25, 26, 2, 4, 8, 11, 19]); // #37
|
||||
AddDotMatrix('&', [12, 18, 20, 8, 21, 18, 13]); // #38
|
||||
AddDotMatrix('''', [4, 4, 0, 0, 0, 0, 0]); // #39
|
||||
AddDotMatrix('(', [2, 4, 8, 8, 8, 4, 2]); // #40
|
||||
AddDotMatrix(')', [8, 4, 2, 2, 2, 4, 8]); // #41
|
||||
AddDotMatrix('*', [0, 4, 21, 14, 21, 4, 0]); // #42
|
||||
AddDotMatrix('+', [0, 4, 4, 31, 4, 4, 0]); // #43
|
||||
AddDotMatrix(',', [0, 0, 0, 0, 12, 4, 8]); // #44
|
||||
AddDotMatrix('-', [0, 0, 0, 14, 0, 0, 0]); // #45
|
||||
AddDotMatrix('.', [0, 0, 0, 0, 0, 12, 12]); // #46
|
||||
AddDotMatrix('/', [1, 1, 2, 4, 8, 16, 16]); // #47
|
||||
AddDotMatrix('0', [14, 17, 19, 21, 25, 17, 14]); // #48
|
||||
AddDotMatrix('1', [4, 12, 4, 4, 4, 4, 14]); // #49
|
||||
AddDotMatrix('2', [14, 17, 1, 2, 4, 8, 31]); // #50
|
||||
AddDotMatrix('3', [14, 17, 1, 6, 1, 17, 14]); // #51
|
||||
AddDotMatrix('4', [2, 6, 10, 18, 31, 2, 2]); // #52
|
||||
AddDotMatrix('5', [31, 16, 30, 1, 1, 17, 14]); // #53
|
||||
AddDotMatrix('6', [14, 17, 16, 30, 17, 17, 14]); // #54
|
||||
AddDotMatrix('7', [31, 1, 1, 2, 4, 4, 4]); // #55
|
||||
AddDotMatrix('8', [14, 17, 17, 14, 17, 17, 14]); // #56
|
||||
AddDotMatrix('9', [14, 17, 17, 15, 1, 17, 14]); // #57
|
||||
AddDotMatrix(':', [0, 12, 12, 0, 12, 12, 0]); // #58
|
||||
AddDotMatrix(';', [0, 12, 12, 0, 12, 4, 8]); // #59
|
||||
AddDotMatrix('<', [2, 4, 8, 16, 8, 4, 2]); // #60
|
||||
AddDotMatrix('=', [0, 0, 31, 0, 31, 0, 0]); // #61
|
||||
AddDotMatrix('>', [8, 4, 2, 1, 2, 4, 8]); // #62
|
||||
AddDotMatrix('?', [14, 17, 1, 2, 4, 0, 4]); // #63
|
||||
AddDotMatrix('@', [14, 17, 19, 21, 23, 16, 15]); // #64
|
||||
AddDotMatrix('A', [14, 17, 17, 31, 17, 17, 17]); // #65
|
||||
AddDotMatrix('B', [30, 17, 17, 30, 17, 17, 30]); // #66
|
||||
AddDotMatrix('C', [14, 17, 16, 16, 16, 17, 14]); // #67
|
||||
AddDotMatrix('D', [30, 17, 17, 17, 17, 17, 30]); // #68
|
||||
AddDotMatrix('E', [31, 16, 16, 30, 16, 16, 31]); // #69
|
||||
AddDotMatrix('F', [31, 16, 16, 30, 16, 16, 16]); // #70
|
||||
AddDotMatrix('G', [14, 17, 16, 19, 17, 17, 14]); // #71
|
||||
AddDotMatrix('H', [17, 17, 17, 31, 17, 17, 17]); // #72
|
||||
AddDotMatrix('I', [14, 4, 4, 4, 4, 4, 14]); // #73
|
||||
AddDotMatrix('J', [1, 1, 1, 1, 17, 17, 14]); // #74
|
||||
AddDotMatrix('K', [17, 18, 20, 24, 20, 18, 17]); // #75
|
||||
AddDotMatrix('L', [16, 16, 16, 16, 16, 16, 31]); // #76
|
||||
AddDotMatrix('M', [17, 27, 21, 21, 17, 17, 17]); // #77
|
||||
AddDotMatrix('N', [17, 25, 21, 19, 17, 17, 17]); // #78
|
||||
AddDotMatrix('O', [14, 17, 17, 17, 17, 17, 14]); // #79
|
||||
AddDotMatrix('P', [30, 17, 17, 30, 16, 16, 16]); // #80
|
||||
AddDotMatrix('Q', [14, 17, 17, 17, 17, 14, 1]); // #81
|
||||
AddDotMatrix('R', [30, 17, 17, 30, 17, 17, 17]); // #82
|
||||
AddDotMatrix('S', [14, 17, 16, 14, 1, 17, 14]); // #83
|
||||
AddDotMatrix('T', [31, 4, 4, 4, 4, 4, 4]); // #84
|
||||
AddDotMatrix('U', [17, 17, 17, 17, 17, 17, 14]); // #85
|
||||
AddDotMatrix('V', [17, 17, 17, 17, 17, 10, 4]); // #86
|
||||
AddDotMatrix('W', [17, 17, 17, 17, 21, 27, 17]); // #87
|
||||
AddDotMatrix('X', [17, 10, 4, 4, 4, 10, 17]); // #88
|
||||
AddDotMatrix('Y', [17, 17, 17, 10, 4, 4, 4]); // #89
|
||||
AddDotMatrix('Z', [31, 1, 2, 4, 8, 16, 31]); // #90
|
||||
AddDotMatrix('[', [12, 8, 8, 8, 8, 8, 12]); // #91
|
||||
AddDotMatrix('\', [0, 16, 8, 4, 2, 1, 0]); // #92
|
||||
AddDotMatrix(']', [6, 2, 2, 2, 2, 2, 6]); // #93
|
||||
AddDotMatrix('^', [4, 10, 17, 0, 0, 0, 0]); // #94
|
||||
AddDotMatrix('_', [0, 0, 0, 0, 0, 0, 31]); // #95
|
||||
AddDotMatrix('`', [6, 4, 2, 0, 0, 0, 0]); // #96
|
||||
AddDotMatrix('a', [0, 0, 14, 1, 15, 17, 15]); // #97
|
||||
AddDotMatrix('b', [16, 16, 30, 17, 17, 17, 30]); // #98
|
||||
AddDotMatrix('c', [0, 0, 15, 16, 16, 16, 15]); // #99
|
||||
AddDotMatrix('d', [1, 1, 15, 17, 17, 17, 15]); // #100
|
||||
AddDotMatrix('e', [0, 0, 14, 17, 31, 16, 14]); // #101
|
||||
AddDotMatrix('f', [3, 4, 31, 4, 4, 4, 4]); // #102
|
||||
AddDotMatrix('g', [0, 0, 15, 17, 15, 1, 14]); // #103
|
||||
AddDotMatrix('h', [16, 16, 22, 25, 17, 17, 17]);// #104
|
||||
AddDotMatrix('i', [4, 0, 12, 4, 4, 4, 14]); // #105
|
||||
AddDotMatrix('j', [2, 0, 6, 2, 2, 18, 12]); // #106
|
||||
AddDotMatrix('k', [16, 16, 18, 20, 24, 20, 18]);// #107
|
||||
AddDotMatrix('l', [12, 4, 4, 4, 4, 4, 14]); // #108
|
||||
AddDotMatrix('m', [0, 0, 26, 21, 21, 21, 21]); // #109
|
||||
AddDotMatrix('n', [0, 0, 22, 25, 17, 17, 17]); // #110
|
||||
AddDotMatrix('o', [0, 0, 14, 17, 17, 17, 14]); // #111
|
||||
AddDotMatrix('p', [0, 0, 30, 17, 30, 16, 16]); // #112
|
||||
AddDotMatrix('q', [0, 0, 15, 17, 15, 1, 1]); // #113
|
||||
AddDotMatrix('r', [0, 0, 11, 12, 8, 8, 8]); // #114
|
||||
AddDotMatrix('s', [0, 0, 14, 16, 14, 1, 30]); // #115
|
||||
AddDotMatrix('t', [4, 4, 31, 4, 4, 4, 3]); // #116
|
||||
AddDotMatrix('u', [0, 0, 17, 17, 17, 19, 13]); // #117
|
||||
AddDotMatrix('v', [0, 0, 17, 17, 17, 10, 4]); // #118
|
||||
AddDotMatrix('w', [0, 0, 17, 17, 21, 21, 10]); // #119
|
||||
AddDotMatrix('x', [0, 0, 17, 10, 4, 10, 17]); // #120
|
||||
AddDotMatrix('y', [0, 0, 17, 17, 15, 1, 14]); // #121
|
||||
AddDotMatrix('z', [0, 0, 31, 2, 4, 8, 31]); // #122
|
||||
AddDotMatrix('{', [3, 4, 4, 8, 4, 4, 3]); // #123
|
||||
AddDotMatrix('|', [4, 4, 4, 4, 4, 4, 4]); // #124
|
||||
AddDotMatrix('}', [24, 4, 4, 2, 4, 4, 24]); // #125
|
||||
AddDotMatrix('~', [8, 21, 2, 0, 0, 0, 0]); // #126
|
||||
AddDotMatrix(#127, [0, 0, 0, 0, 0, 0, 0]); // #127
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.Paint();
|
||||
begin
|
||||
DrawCalc();
|
||||
DrawBorder();
|
||||
DrawGrid();
|
||||
DrawText();
|
||||
DrawBitmapToCanvas();
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetBoardColor(const Value: TColor);
|
||||
begin
|
||||
if Value = FBoardColor then
|
||||
Exit;
|
||||
FBoardColor := Value;
|
||||
SetColorScheme(csCustom);
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetDotColorOff(const Value: TColor);
|
||||
begin
|
||||
if Value = FDotColorOff then
|
||||
Exit;
|
||||
FDotColorOff := Value;
|
||||
SetColorScheme(csCustom);
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetDotColorOn(const Value: TColor);
|
||||
begin
|
||||
if Value = FDotColorOn then
|
||||
Exit;
|
||||
FDotColorOn := Value;
|
||||
SetColorScheme(csCustom);
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetDotSize(const Value: integer);
|
||||
begin
|
||||
if Value = DotSize then
|
||||
Exit;
|
||||
FDotSize := Value;
|
||||
if AutoSize then
|
||||
begin
|
||||
InvalidatePreferredSize;
|
||||
AdjustSize;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetDotsSpace(const Value: integer);
|
||||
begin
|
||||
if Value = DotsSpace then
|
||||
Exit;
|
||||
FDotsSpace := Value;
|
||||
if AutoSize then
|
||||
begin
|
||||
InvalidatePreferredSize;
|
||||
AdjustSize;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetDotShape(const Value: TDotShape);
|
||||
begin
|
||||
if Value = DotShape then
|
||||
Exit;
|
||||
FDotShape := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetFrameColor(const Value: TColor);
|
||||
begin
|
||||
if Value = FrameColor then
|
||||
Exit;
|
||||
FFrameColor := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetFrameColorStyle(const Value: TFrameColorStyle);
|
||||
begin
|
||||
if Value = FrameColorStyle then
|
||||
Exit;
|
||||
FFrameColorStyle := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetFrameHeight(const Value: TFrameHeight);
|
||||
begin
|
||||
if Value = FrameHeight then
|
||||
Exit;
|
||||
FFrameHeight := Value;
|
||||
if AutoSize then
|
||||
begin
|
||||
InvalidatePreferredSize;
|
||||
AdjustSize;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetFrameSize(const Value: integer);
|
||||
begin
|
||||
if Value = FrameSize then
|
||||
Exit;
|
||||
FFrameSize := Value;
|
||||
if AutoSize then
|
||||
begin
|
||||
InvalidatePreferredSize;
|
||||
AdjustSize;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetFrameStyle(const Value: TFrameStyle);
|
||||
begin
|
||||
if Value = FrameStyle then
|
||||
Exit;
|
||||
FFrameStyle := Value;
|
||||
if AutoSize then
|
||||
begin
|
||||
InvalidatePreferredSize;
|
||||
AdjustSize;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetCharSpace(const Value: boolean);
|
||||
begin
|
||||
if Value = CharSpace then
|
||||
Exit;
|
||||
FCharSpace := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetColorScheme(const Value: TColorScheme);
|
||||
begin
|
||||
if Value = FColorScheme then Exit;
|
||||
case Value of
|
||||
csBlue: begin
|
||||
FBoardColor := clBlack;
|
||||
FDotColorOff := clTeal;
|
||||
FDotColorOn := clSkyBlue;
|
||||
end;
|
||||
csGreen: begin
|
||||
FBoardColor := 5162664;
|
||||
FDotColorOff := 5162664;
|
||||
FDotColorOn := 2900284;
|
||||
end;
|
||||
csInvGreen: begin
|
||||
FBoardColor := clBlack;
|
||||
FDotColorOff := 2900284;
|
||||
FDotColorOn := 5162664;
|
||||
end;
|
||||
csCustom: begin
|
||||
end;
|
||||
end;
|
||||
FColorScheme := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetDisplayLineCount(const Value: integer);
|
||||
begin
|
||||
if Value = FDisplayLineCount then
|
||||
Exit;
|
||||
FDisplayLineCount := Value;
|
||||
if AutoSize then
|
||||
begin
|
||||
InvalidatePreferredSize;
|
||||
AdjustSize;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetDisplayCharCount(const Value: integer);
|
||||
begin
|
||||
if Value = FDisplayCharCount then
|
||||
Exit;
|
||||
FDisplayCharCount := Value;
|
||||
if AutoSize then
|
||||
begin
|
||||
InvalidatePreferredSize;
|
||||
AdjustSize;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TLCDDisplay.SetLines(const Value: TStringList);
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
FLines.Clear;
|
||||
for i := 0 to FDisplayLineCount - 1 do
|
||||
begin
|
||||
if i < Value.Count then
|
||||
FLines.Add(Value[i])
|
||||
else
|
||||
FLines.Add(' ');
|
||||
end;
|
||||
if AutoSize then
|
||||
begin
|
||||
InvalidatePreferredSize;
|
||||
AdjustSize;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
function TLCDDisplay.GetCharCount: longint;
|
||||
begin
|
||||
DrawCalc();
|
||||
Result := FCharCount;
|
||||
end;
|
||||
|
||||
function TLCDDisplay.GetGlobalDotColsCount: longint;
|
||||
begin
|
||||
DrawCalc();
|
||||
Result := FGlobalDotColsCount;
|
||||
end;
|
||||
|
||||
end.
|
Binary file not shown.
Reference in New Issue
Block a user