{********************************************}
{     TeeChart Pro Charting Library          }
{ Copyright (c) 1995-2020 by Steema Software }
{         All Rights Reserved                }
{********************************************}
unit TeeAlligatorFuncEditor;
{$I TeeDefs.inc}

interface

uses
  {$IFNDEF LINUX}
  Windows, Messages,
  {$ENDIF}
  SysUtils, Classes,

  Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls,
  StatChar, TeePenDlg, TeeBaseFuncEdit, ExtCtrls;

type
  TAlligatorFuncEditor = class(TBaseFunctionEditor)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    procedure PageControl1Change(Sender: TObject);
  private
    { Private declarations }
  protected
    procedure ApplyFormChanges; override;
    Procedure SetFunction; override;
  public
    { Public declarations }
  end;

implementation

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

uses
  TeEngine, Series;

procedure TAlligatorFuncEditor.ApplyFormChanges;
begin
  inherited;
end;

procedure TAlligatorFuncEditor.SetFunction;
begin
  inherited;

  PageControl1Change(Self);
end;

procedure TAlligatorFuncEditor.PageControl1Change(Sender: TObject);
var tmp : TAlligatorFunction;
begin
  tmp:=TAlligatorFunction(IFunction);

  if PageControl1.ActivePage.ControlCount=0 then
     if PageControl1.ActivePage=TabSheet1 then
     begin
       if tmp.ParentSeries is TCustomLineSeries then
          TPenDialog.InsertForm(TCustomLineSeries(tmp.ParentSeries).LinePen,TabSheet1)
       else
          TabSheet1.TabVisible:=False;
     end
     else
     if PageControl1.ActivePage=TabSheet2 then
        TPenDialog.InsertForm(tmp.TeethPen,TabSheet2)
     else
     if PageControl1.ActivePage=TabSheet3 then
        TPenDialog.InsertForm(tmp.LipsPen,TabSheet3);
end;

initialization
  RegisterClass(TAlligatorFuncEditor);
end.

