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

interface

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

  Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls,

  TeeSpline, TeeBaseFuncEdit, TeCanvas, ExtCtrls;

type
  TSmoothFuncEditor = class(TBaseFunctionEditor)
    CBInterp: TCheckBox;
    Label1: TLabel;
    Edit1: TEdit;
    UDFactor: TUpDown;
    procedure CBInterpClick(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}

procedure TSmoothFuncEditor.ApplyFormChanges;
begin
  inherited;

  with TSmoothingFunction(IFunction) do
  begin
    BeginUpdate;
    try
      Interpolate:=CBInterp.Checked;
      Factor:=UDFactor.Position;
    finally
      EndUpdate;
    end;
  end;
end;

procedure TSmoothFuncEditor.SetFunction;
begin
  inherited;

  with TSmoothingFunction(IFunction) do
  begin
    CBInterp.Checked:=Interpolate;
    UDFactor.Position:=Factor;
  end;
end;

procedure TSmoothFuncEditor.CBInterpClick(Sender: TObject);
begin
  EnableApply;
end;

initialization
  RegisterClass(TSmoothFuncEditor);
end.

