unit FMXTee.Editor.Series.Point3D;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.TabControl,
  FMXTee.Chart, FMXTee.Series, FMXTee.Series.Point3D, FMXTee.Canvas,
  FMXTee.Editor.Stroke, FMXTee.Procs, FMX.Colors, FMX.Edit;

type
  TPoint3DSeriesEditor = class(TForm)
    TabControl1: TTabControl;
    TabOptions: TTabItem;
    TabLine: TTabItem;
    TabBaseLine: TTabItem;
    UDTransp: TSpinBox;
    Label6: TLabel;
    GroupBox1: TGroupBox;
    BColor: TComboColorBox;
    CBColorEach: TCheckBox;
    UDPointDepth: TSpinBox;
    Label2: TLabel;
    procedure FormActivate(Sender: TObject);
    procedure CBColorEachChange(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure UDTranspChange(Sender: TObject);
    procedure UDPointDepthChange(Sender: TObject);
    procedure TabControl1Change(Sender: TObject);
  private
    { Private declarations }
    PointerForm : TCustomForm;
    TheSeries   : TPoint3DSeries;
    FLinePen    : TStrokeEditor;
    FBasePen    : TStrokeEditor;
  public
    { Public declarations }
  end;

var
  Point3DSeriesEditor: TPoint3DSeriesEditor;

implementation

{$R *.fmx}

uses
  FMXTee.Engine, FMXTee.Constants, FMXTee.Editor.Series.Pointer;

procedure TPoint3DSeriesEditor.CBColorEachChange(Sender: TObject);
begin
  TheSeries.ColorEachPoint:=CBColorEach.IsChecked;
  BColor.Enabled:=not TheSeries.ColorEachPoint;
end;

procedure TPoint3DSeriesEditor.FormActivate(Sender: TObject);
begin
  TheSeries:=TPoint3DSeries(TagObject);

  if Assigned(TheSeries) then
  begin
    With TheSeries do
    Begin
      UDPointDepth.Value :=Round(DepthSize);
      CBColorEach.IsChecked:=ColorEachPoint;
      UDTransp.Value:=LineTransparency;
    end;

    BColor.Color:=TheSeries.Color;
    BColor.Enabled:=not TheSeries.ColorEachPoint;

    if not Assigned(PointerForm) then
       PointerForm:=TSeriesPointerEditor.InsertForm(TheSeries.Pointer,TabControl1);
  end;
end;

procedure TPoint3DSeriesEditor.FormDestroy(Sender: TObject);
begin
  FreeAndNil(PointerForm);
end;

procedure TPoint3DSeriesEditor.TabControl1Change(Sender: TObject);
begin
  if (TabControl1.ActiveTab=TabLine) and (not Assigned(FLinePen)) then
     FLinePen:=TStrokeEditor.InsertForm(TheSeries.LinePen,TabLine)
  else
  if (TabControl1.ActiveTab=TabBaseLine) and (not Assigned(FBasePen)) then
     FBasePen:=TStrokeEditor.InsertForm(TheSeries.BaseLine,TabBaseLine);
end;

procedure TPoint3DSeriesEditor.UDPointDepthChange(Sender: TObject);
begin
  TheSeries.DepthSize:=UDPointDepth.Value;
end;

procedure TPoint3DSeriesEditor.UDTranspChange(Sender: TObject);
begin
  TheSeries.LineTransparency:=Round(UDTransp.Value);
end;

initialization
  RegisterClass(TPoint3DSeriesEditor);
end.
