unit FMXTee.Editor.Series.Arrow;

interface

uses
  SysUtils, Types, Classes, Variants, FMX.Types, FMX.Controls, FMX.Forms,
  FMXTee.Procs, FMX.Edit, FMX.Dialogs, FMXTee.Series.Arrow;

type
  TArrowSeriesEditor = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    LPercent: TLabel;
    Label4: TLabel;
    BPen: TButton;
    BBrush: TButton;
    GroupBox1: TGroupBox;
    CBColorEach: TCheckBox;
    BArrowColor: TButton;
    UDArrowWidth: TSpinBox;
    UDArrowHeight: TSpinBox;
    SBPercent: TScrollBar;
    BGradient: TButton;
    UDTransp: TSpinBox;
    procedure BBrushClick(Sender: TObject);
    procedure SBPercentChange(Sender: TObject);
    procedure CBColorEachChange(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure BGradientClick(Sender: TObject);
    procedure UDTranspChange(Sender: TObject);
    procedure BPenClick(Sender: TObject);
    procedure BArrowColorClick(Sender: TObject);
    procedure UDArrowWidthChange(Sender: TObject);
    procedure UDArrowHeightChange(Sender: TObject);
  private
   { Private declarations }
    Arrow : TArrowSeries;

    procedure RefreshArrow(AArrow:TArrowSeries);
  public
   { Public declarations }
  end;

implementation

{$R *.fmx}

uses
  FMXTee.Editor.Stroke, FMXTee.Editor.Brush, FMXTee.Editor.Gradient,
  FMXTee.Canvas;

procedure TArrowSeriesEditor.FormActivate(Sender: TObject);
begin
  if not Assigned(Arrow) then
     RefreshArrow(TArrowSeries(TagObject));
end;

procedure TArrowSeriesEditor.RefreshArrow(AArrow: TArrowSeries);
begin
  Arrow:=AArrow;

  CBColorEach.IsChecked:=Arrow.ColorEachPoint;
  UDArrowWidth.Value:=Arrow.ArrowWidth;
  UDArrowHeight.Value:=Arrow.ArrowHeight;
  UDTransp.Value:=Arrow.Transparency;
  SBPercent.Value:=Arrow.ArrowPercent;
end;

procedure TArrowSeriesEditor.BArrowColorClick(Sender: TObject);
begin
  Arrow.Color:=EditColor(Self,Arrow.Color);
end;

procedure TArrowSeriesEditor.BBrushClick(Sender: TObject);
begin
  TBrushEditor.Edit(Self,Arrow.Brush);
end;

procedure TArrowSeriesEditor.UDArrowHeightChange(Sender: TObject);
begin
  if Assigned(Arrow) then
     Arrow.ArrowHeight:=Round(UDArrowHeight.Value);
end;

procedure TArrowSeriesEditor.UDArrowWidthChange(Sender: TObject);
begin
  if Assigned(Arrow) then
     Arrow.ArrowWidth:=Round(UDArrowWidth.Value);
end;

procedure TArrowSeriesEditor.UDTranspChange(Sender: TObject);
begin
  if Assigned(Arrow) then
     Arrow.Transparency:=Round(UDTransp.Value);
end;

procedure TArrowSeriesEditor.BGradientClick(Sender: TObject);
begin
  TGradientEditor.Edit(Self,Arrow.Brush.Gradient);
end;

procedure TArrowSeriesEditor.BPenClick(Sender: TObject);
begin
  TStrokeEditor.Edit(Self,Arrow.Pen);
end;

procedure TArrowSeriesEditor.CBColorEachChange(Sender: TObject);
begin
  Arrow.ColorEachPoint:=CBColorEach.IsChecked;
end;

procedure TArrowSeriesEditor.SBPercentChange(Sender: TObject);
begin
  if Assigned(Arrow) then
     Arrow.ArrowPercent:=Round(SBPercent.Value);
end;

initialization
  RegisterSeriesEditor(TArrowSeriesEditor);
end.
