You've already forked lazarus-ccr
Industrial/LCDDisplay: Add handlers for OnKeyDown and OnMouseMove to CharDefs editor.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8316 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -105,13 +105,13 @@ object LCDCharDefsEditor: TLCDCharDefsEditor
|
||||
Left = 176
|
||||
Height = 88
|
||||
Top = 57
|
||||
Width = 87
|
||||
Width = 89
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 5
|
||||
BorderSpacing.Right = 12
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 88
|
||||
ClientWidth = 87
|
||||
ClientWidth = 89
|
||||
TabOrder = 2
|
||||
object btReplace: TBitBtn
|
||||
AnchorSideLeft.Control = pnButtons
|
||||
@ -120,7 +120,7 @@ object LCDCharDefsEditor: TLCDCharDefsEditor
|
||||
Left = 0
|
||||
Height = 26
|
||||
Top = 31
|
||||
Width = 87
|
||||
Width = 89
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 5
|
||||
Caption = 'Replace'
|
||||
@ -140,7 +140,7 @@ object LCDCharDefsEditor: TLCDCharDefsEditor
|
||||
Left = 0
|
||||
Height = 26
|
||||
Top = 62
|
||||
Width = 87
|
||||
Width = 89
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 5
|
||||
@ -160,7 +160,7 @@ object LCDCharDefsEditor: TLCDCharDefsEditor
|
||||
Left = 0
|
||||
Height = 26
|
||||
Top = 0
|
||||
Width = 87
|
||||
Width = 89
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
Caption = 'Add as...'
|
||||
@ -188,7 +188,9 @@ object LCDCharDefsEditor: TLCDCharDefsEditor
|
||||
FixedRows = 0
|
||||
ScrollBars = ssNone
|
||||
TabOrder = 3
|
||||
OnKeyDown = dgDotMatrixKeyDown
|
||||
OnMouseDown = dgDotMatrixMouseDown
|
||||
OnMouseMove = dgDotMatrixMouseMove
|
||||
OnPrepareCanvas = dgDotMatrixPrepareCanvas
|
||||
end
|
||||
object ImageList1: TImageList
|
||||
|
@ -28,8 +28,12 @@ type
|
||||
procedure btDeleteClick(Sender: TObject);
|
||||
procedure btReplaceClick(Sender: TObject);
|
||||
procedure cbCharSelectorChange(Sender: TObject);
|
||||
procedure dgDotMatrixKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure dgDotMatrixMouseDown(Sender: TObject; {%H-}Button: TMouseButton;
|
||||
{%H-}Shift: TShiftState; X, Y: Integer);
|
||||
procedure dgDotMatrixMouseMove(Sender: TObject; Shift: TShiftState; X,
|
||||
Y: Integer);
|
||||
procedure dgDotMatrixPrepareCanvas({%H-}sender: TObject; aCol, aRow: Integer;
|
||||
{%H-}aState: TGridDrawState);
|
||||
procedure FormActivate(Sender: TObject);
|
||||
@ -41,6 +45,7 @@ type
|
||||
FSavedCharDefs: TCharDefs;
|
||||
FSelectedChar: String;
|
||||
FTmpDotRows: TDotRows;
|
||||
FOldRow, FOldCol: Integer;
|
||||
procedure SetLCDDisplay(AValue: TLCDDisplay);
|
||||
procedure PopulateCharSelector;
|
||||
procedure SaveCharDefs;
|
||||
@ -154,6 +159,21 @@ begin
|
||||
FModified := false;
|
||||
end;
|
||||
|
||||
procedure TLCDCharDefsEditor.dgDotMatrixKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
var
|
||||
r, c: integer;
|
||||
begin
|
||||
r := dgDotMatrix.Row;
|
||||
c := dgDotMatrix.Col;
|
||||
if Key = 32 then
|
||||
begin
|
||||
ToggleDot(c, r);
|
||||
dgDotMatrix.InvalidateCell(c, r);
|
||||
FModified := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLCDCharDefsEditor.dgDotMatrixMouseDown(Sender: TObject;
|
||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
@ -162,9 +182,30 @@ begin
|
||||
dgDotMatrix.MouseToCell(X,Y, c, r);
|
||||
ToggleDot(c, r);
|
||||
dgDotMatrix.InvalidateCell(c, r);
|
||||
FOldRow := r;
|
||||
FOldCol := c;
|
||||
FModified := true;
|
||||
end;
|
||||
|
||||
procedure TLCDCharDefsEditor.dgDotMatrixMouseMove(Sender: TObject;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
r, c: Integer;
|
||||
begin
|
||||
if Shift = [ssLeft] then
|
||||
begin
|
||||
dgDotMatrix.MouseToCell(X,Y, c, r);
|
||||
if (c <> FOldCol) or (r <> FOldRow) then
|
||||
begin
|
||||
ToggleDot(c, r);
|
||||
dgDotMatrix.InvalidateCell(c, r);
|
||||
FOldRow := r;
|
||||
FOldCol := c;
|
||||
FModified := true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLCDCharDefsEditor.dgDotMatrixPrepareCanvas(sender: TObject; aCol,
|
||||
aRow: Integer; aState: TGridDrawState);
|
||||
begin
|
||||
|
Reference in New Issue
Block a user