2 Commits a15eed330c ... ca0ea5ca2a

Autore SHA1 Messaggio Data
  Garbata Team ca0ea5ca2a Add Label and Go to Label event commands 1 anno fa
  Garbata Team 6eea265ee8 Fix width for HiDPI in new EC selection window 1 anno fa

+ 3 - 0
forms/ec/ec_goto.lfm

@@ -0,0 +1,3 @@
+inherited ECGotoFrame: TECGotoFrame
+  Caption = 'Go to label'
+end

+ 3 - 0
forms/ec/ec_goto.lrj

@@ -0,0 +1,3 @@
+{"version":1,"strings":[
+{"hash":20737804,"name":"tecgotoframe.caption","sourcebytes":[71,111,32,116,111,32,108,97,98,101,108],"value":"Go to label"}
+]}

+ 38 - 0
forms/ec/ec_goto.pas

@@ -0,0 +1,38 @@
+unit ec_goto;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ec_labelbase;
+
+type
+
+  { TECGotoFrame }
+
+  TECGotoFrame = class(TECLabelBaseFrame)
+  private
+
+  public
+    function GetCommandCode: Integer; override;
+  end;
+
+var
+  ECGotoFrame: TECGotoFrame;
+
+implementation
+
+uses constants;
+
+{$R *.lfm}
+
+{ TECGotoFrame }
+
+function TECGotoFrame.GetCommandCode: Integer;
+begin
+  Result := GOTO_EC_CODE;
+end;
+
+end.
+

+ 3 - 0
forms/ec/ec_label.lfm

@@ -0,0 +1,3 @@
+inherited ECLabelFrame: TECLabelFrame
+  Caption = 'Label'
+end

+ 3 - 0
forms/ec/ec_label.lrj

@@ -0,0 +1,3 @@
+{"version":1,"strings":[
+{"hash":5404860,"name":"teclabelframe.caption","sourcebytes":[76,97,98,101,108],"value":"Label"}
+]}

+ 38 - 0
forms/ec/ec_label.pas

@@ -0,0 +1,38 @@
+unit ec_label;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ec_labelbase;
+
+type
+
+  { TECLabelFrame }
+
+  TECLabelFrame = class(TECLabelBaseFrame)
+  private
+
+  public
+    function GetCommandCode: Integer; override;
+  end;
+
+var
+  ECLabelFrame: TECLabelFrame;
+
+implementation
+
+uses constants;
+
+{$R *.lfm}
+
+{ TECLabelFrame }
+
+function TECLabelFrame.GetCommandCode: Integer;
+begin
+  Result := LABEL_EC_CODE;
+end;
+
+end.
+

+ 48 - 0
forms/ec/ec_labelbase.lfm

@@ -0,0 +1,48 @@
+inherited ECLabelBaseFrame: TECLabelBaseFrame
+  Left = 490
+  Height = 120
+  Top = 245
+  Width = 269
+  Caption = 'ECLabelBaseFrame'
+  ClientHeight = 120
+  ClientWidth = 269
+  OnShow = FormShow
+  inherited EcResultPanel: TPanel
+    Top = 78
+    Width = 269
+    ClientWidth = 269
+    inherited EcResultLineBevel: TBevel
+      Width = 269
+    end
+    inherited EcOkBitBtn: TBitBtn
+      Left = 118
+      Width = 62
+    end
+    inherited EcCancelBitBtn: TBitBtn
+      Left = 184
+      Width = 82
+    end
+  end
+  object LabelNameLabel: TLabel[1]
+    Left = 8
+    Height = 15
+    Top = 8
+    Width = 61
+    BorderSpacing.Left = 8
+    BorderSpacing.Top = 8
+    Caption = 'Label name'
+    ParentColor = False
+  end
+  object LabelNameEdit: TEdit[2]
+    AnchorSideLeft.Control = LabelNameLabel
+    AnchorSideTop.Control = LabelNameLabel
+    AnchorSideTop.Side = asrBottom
+    Left = 8
+    Height = 23
+    Top = 27
+    Width = 256
+    Anchors = [akTop, akLeft, akRight]
+    BorderSpacing.Top = 4
+    TabOrder = 1
+  end
+end

+ 4 - 0
forms/ec/ec_labelbase.lrj

@@ -0,0 +1,4 @@
+{"version":1,"strings":[
+{"hash":235739285,"name":"teclabelbaseframe.caption","sourcebytes":[69,67,76,97,98,101,108,66,97,115,101,70,114,97,109,101],"value":"ECLabelBaseFrame"},
+{"hash":199516597,"name":"teclabelbaseframe.labelnamelabel.caption","sourcebytes":[76,97,98,101,108,32,110,97,109,101],"value":"Label name"}
+]}

+ 73 - 0
forms/ec/ec_labelbase.pas

@@ -0,0 +1,73 @@
+unit ec_labelbase;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, Buttons,
+  StdCtrls, ec_base;
+
+type
+
+  { TECLabelBaseFrame }
+
+  TECLabelBaseFrame = class(TECBaseFrame)
+    LabelNameEdit: TEdit;
+    LabelNameLabel: TLabel;
+    procedure FormShow(Sender: TObject);
+  public
+    function GetCommandCode: Integer; virtual;
+    procedure InitExisting; override;
+    procedure MakeResultingCommand; override;
+  end;
+
+var
+  ECLabelBaseFrame: TECLabelBaseFrame;
+
+implementation
+
+uses
+  fpjson;
+
+{$R *.lfm}
+
+{ TECLabelBaseFrame }
+
+procedure TECLabelBaseFrame.FormShow(Sender: TObject);
+begin
+  LabelNameEdit.SetFocus;
+end;
+
+function TECLabelBaseFrame.GetCommandCode: Integer;
+begin
+  GetCommandCode := 0;
+  raise ENotImplemented.Create('Called GetCommandCode of TECLabelBaseFrame');
+end;
+
+procedure TECLabelBaseFrame.InitExisting;
+var
+  Params: TJSONArray = nil;
+  LabelName: String = '';
+begin
+  Params := GetFirstParams;
+
+  if (Params <> nil) and (Params.Count >= 1) and (Params[0].JSONType = jtString)
+  then
+      LabelName := Params[0].AsString;
+
+  LabelNameEdit.Text := LabelName;
+end;
+
+procedure TECLabelBaseFrame.MakeResultingCommand;
+begin
+  ResultingCommand := SingleLineResultingCommand(
+    GetCommandCode,
+    TJSONArray.Create([
+      LabelNameEdit.Text
+    ])
+  );
+end;
+
+end.
+

+ 0 - 0
forms/newecformunit.pas


Some files were not shown because too many files changed in this diff