{********************************************}
{    TFastLineSeries Editor Dialog           }
{ Copyright (c) 1996-2020 by Steema Software }
{********************************************}
unit TeeFLineEdi;
{$I TeeDefs.inc}

interface

uses
  {$IFNDEF LINUX}
  Windows,
  {$ENDIF}

  {$IFDEF D16}
  System.UITypes,
  {$ENDIF}
  
  Graphics, Forms, Controls, StdCtrls, ComCtrls, ExtCtrls,

  Classes, TeePenDlg, TeeProcs, TeCanvas, TeEngine, Series, TeeGalleryPanel;

type
  TFastLineSeriesEditor = class(TPenDialog)
    TabSheet3: TTabSheet;
    GBStair: TGroupBox;
    CBStairs: TCheckBox;
    CBInvStairs: TCheckBox;
    CBNulls: TComboFlat;
    CBDrawAll: TCheckBox;
    CBDrawAllStyle: TComboFlat;
    CBFastPen: TCheckBox;
    Label3: TLabel;
    Label4: TLabel;
    CBDrawStyle: TComboFlat;
    procedure FormShow(Sender: TObject);
    procedure BColorClick(Sender: TObject);
    procedure CBDrawAllClick(Sender: TObject);
    procedure CBStairsClick(Sender: TObject);
    procedure CBInvStairsClick(Sender: TObject);
    procedure CBNullsChange(Sender: TObject);
    procedure CBDrawAllStyleChange(Sender: TObject);
    procedure CBFastPenClick(Sender: TObject);
    procedure CBDrawStyleChange(Sender: TObject);
  private
    { Private declarations }
    FastLine : TFastLineSeries;
  public
    { Public declarations }
  end;

implementation

{$IFNDEF LCL}
{$R *.DFM}
{$ELSE}
{$R *.lfm}
{$ENDIF}

procedure TFastLineSeriesEditor.FormShow(Sender: TObject);
begin
  FastLine:=TFastLineSeries(Tag);

  if Assigned(FastLine) then
  begin
    ThePen:=FastLine.Pen;

    CBDrawAll.Checked:=FastLine.DrawAllPoints;
    CBDrawAllStyle.ItemIndex:=Ord(FastLine.DrawAllPointsStyle);
    CBStairs.Checked:=FastLine.Stairs;
    CBInvStairs.Checked:=FastLine.InvertedStairs;
    CBInvStairs.Enabled:=CBStairs.Checked;
    CBNulls.ItemIndex:=Ord(FastLine.TreatNulls);
    CBFastPen.Checked:=FastLine.FastPen;
    CBDrawStyle.ItemIndex:=Ord(FastLine.DrawStyle);
  end;

  inherited;
end;

procedure TFastLineSeriesEditor.BColorClick(Sender: TObject);
begin
  inherited;
  FastLine.SeriesColor:=ThePen.Color;
  CBStyle.Repaint;
end;

procedure TFastLineSeriesEditor.CBDrawAllClick(Sender: TObject);
begin
  FastLine.DrawAllPoints:=CBDrawAll.Checked;
  CBDrawAllStyle.Enabled:=not FastLine.DrawAllPoints;
end;

procedure TFastLineSeriesEditor.CBStairsClick(Sender: TObject);
begin
  FastLine.Stairs:=CBStairs.Checked;
  CBInvStairs.Enabled:=CBStairs.Checked;
end;

procedure TFastLineSeriesEditor.CBInvStairsClick(Sender: TObject);
begin
  FastLine.InvertedStairs:=CBInvStairs.Checked;
end;

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

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

procedure TFastLineSeriesEditor.CBFastPenClick(Sender: TObject);
begin
  FastLine.FastPen:=CBFastPen.Checked;
end;

procedure TFastLineSeriesEditor.CBDrawStyleChange(Sender: TObject);
begin
  FastLine.DrawStyle:=TFastLineDrawStyle(CBDrawStyle.ItemIndex);
end;

initialization
  RegisterSeriesEditor(TFastLineSeriesEditor);
end.
