unit FMXTee.Editor.Series.HighLowLine;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Colors,
  FMXTee.Procs, FMXTee.Engine, FMXTee.Series.Error, FMXTee.Canvas,
  FMXTee.Editor.Stroke, FMXTee.Series.HighLowLine, FMXTee.Editor.Series.Pointer,
  FMX.TabControl;

type
  THighLowLineSeriesEditor = class(TForm)
    BBorder: TButton;
    BColor: TComboColorBox;
    CBColorEach: TCheckBox;
    TabControl1: TTabControl;
    TabOptions: TTabItem;
    TabHigh: TTabItem;
    TabLow: TTabItem;
    procedure FormActivate(Sender: TObject);
    procedure CBColorEachChange(Sender: TObject);
    procedure BColorChange(Sender: TObject);
    procedure BBorderClick(Sender: TObject);
    procedure TabControl1Change(Sender: TObject);
  private
    { Private declarations }
    HighLow : THighLowLineSeries;
    FHighPointer : TSeriesPointerEditor;
    FLowPointer  : TSeriesPointerEditor;
  public
    { Public declarations }
  end;

var
  HighLowLineSeriesEditor: THighLowLineSeriesEditor;

implementation

{$R *.fmx}

uses
  Math,
  FMXTee.Constants, FMXTee.ProConstants, FMXTee.Chart;

procedure THighLowLineSeriesEditor.BBorderClick(Sender: TObject);
begin
  TStrokeEditor.Edit(Self, HighLow.Pen);
end;

procedure THighLowLineSeriesEditor.BColorChange(Sender: TObject);
begin
  HighLow.Color:=BColor.Color;
end;

procedure THighLowLineSeriesEditor.CBColorEachChange(Sender: TObject);
begin
  HighLow.ColorEachPoint:=CBColorEach.IsChecked;
end;

procedure THighLowLineSeriesEditor.FormActivate(Sender: TObject);
begin
  HighLow:=THighLowLineSeries(TagObject);

  if Assigned(HighLow) then
  begin
    BColor.Color:=HighLow.Color;
    CBColorEach.IsChecked:=HighLow.ColorEachPoint;
  end;
end;

procedure THighLowLineSeriesEditor.TabControl1Change(Sender: TObject);
begin
  if (TabControl1.ActiveTab=TabHigh) and (not assigned(FHighPointer)) then
     FHighPointer:=TSeriesPointerEditor.InsertForm(HighLow.HighPointer,TabHigh)
  else
  if (TabControl1.ActiveTab=TabLow) and (not assigned(FLowPointer)) then
     FHighPointer:=TSeriesPointerEditor.InsertForm(HighLow.LowPointer,TabLow)
end;

initialization
  RegisterClass(THighLowLineSeriesEditor);
end.
