unit FMXTee.Editor.Series.FastLine;

interface

uses
  SysUtils, Types, Classes, Variants, FMX.Types, FMX.Controls, FMX.Forms,
  FMX.ListBox, FMX.Dialogs, FMXTee.Series, FMXTee.Editor.Stroke, FMX.Edit,
  FMX.Colors, FMXTee.Engine;

type
  TFastLineSeriesEditor = class(TStrokeEditor)
    Label2: TLabel;
    CBDrawAll: TCheckBox;
    GBStair: TGroupBox;
    CBStairs: TCheckBox;
    CBInvStairs: TCheckBox;
    CBNulls: TComboBox;
    CBDrawAllStyle: TComboBox;
    procedure CBNullsChange(Sender: TObject);
    procedure CBDrawAllStyleChange(Sender: TObject);
    procedure CBDrawAllChange(Sender: TObject);
    procedure CBStairsChange(Sender: TObject);
    procedure CBInvStairsChange(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
   { Private declarations }
    Fast : TFastLineSeries;

    procedure RefreshFast(const AFast:TFastLineSeries);
  public
   { Public declarations }
  end;

implementation

{$R *.fmx}

uses
  FMXTee.Procs;

procedure TFastLineSeriesEditor.CBDrawAllChange(Sender: TObject);
begin
  Fast.DrawAllPoints:=CBDrawAll.IsChecked;
end;

procedure TFastLineSeriesEditor.CBStairsChange(Sender: TObject);
begin
  Fast.Stairs:=CBStairs.IsChecked;
end;

procedure TFastLineSeriesEditor.FormActivate(Sender: TObject);
begin
  inherited;

  RefreshFast(TFastLineSeries(TagObject));
end;

procedure TFastLineSeriesEditor.RefreshFast(const AFast: TFastLineSeries);
begin
  if Fast<>AFast then
  begin
    Fast:=AFast;

    RefreshPen(Fast.Pen);

    CBStairs.IsChecked:=Fast.Stairs;
    CBInvStairs.IsChecked:=Fast.InvertedStairs;
    CBDrawAll.IsChecked:=Fast.DrawAllPoints;
    CBDrawAllStyle.ItemIndex:=Ord(Fast.DrawAllPointsStyle);

    CBNulls.ItemIndex:=Ord(Fast.TreatNulls);

    // Pending: CBDrawStyle (segments, all)


  end;

  CBVisible.Visible:=False;
  Panel1.Visible:=False;
end;

procedure TFastLineSeriesEditor.CBInvStairsChange(Sender: TObject);
begin
  Fast.InvertedStairs:=CBInvStairs.IsChecked;
end;

procedure TFastLineSeriesEditor.CBNullsChange(Sender: TObject);
begin
  Fast.TreatNulls:=TTreatNullsStyle(CBNulls.ItemIndex);
end;

procedure TFastLineSeriesEditor.CBDrawAllStyleChange(Sender: TObject);
begin
  Fast.DrawAllPointsStyle:=TDrawAllPointsStyle(CBDrawAllStyle.ItemIndex);
end;

initialization
  RegisterSeriesEditor(TFastLineSeriesEditor);
end.
