{********************************************}
{    TDonutSeries Editor Dialog              }
{ Copyright (c) 1999-2020 by Steema Software }
{********************************************}
unit TeeDonutEdit;
{$I TeeDefs.inc}

interface

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

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

     Chart, Series, TeeDonut, TeeProcs, TeCanvas;

type
  TDonutSeriesEditor = class(TForm)
    EDonut: TEdit;
    UDDonut: TUpDown;
    Label1: TLabel;
    procedure FormShow(Sender: TObject);
    procedure EDonutChange(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
    Donut : TDonutSeries;
    FPieForm : TCustomForm;
  public
    { Public declarations }
  end;

implementation

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

Uses TeeConst, TeeProCo, TeePieEdit, TeeEdiSeri, TeePenDlg, TeeCircledEdit;

procedure TDonutSeriesEditor.FormShow(Sender: TObject);
begin
  Donut:=TDonutSeries(Tag);

  if Assigned(Donut) then
  begin
    if not Assigned(FPieForm) then
    begin
      FPieForm:=TFormTeeSeries.InsertSeriesForm(Parent,TPieSeriesEditor,
                                                 1,TeeMsg_GalleryDonut,
                                                 Donut);

      TPieSeriesEditor(FPieForm).CheckCircledEditor;
    end;

    UDDonut.Position:=Donut.DonutPercent;
  end;
end;

procedure TDonutSeriesEditor.EDonutChange(Sender: TObject);
begin
  if Showing then Donut.DonutPercent:=UDDonut.Position;
end;

procedure TDonutSeriesEditor.FormCreate(Sender: TObject);
begin
  BorderStyle:=TeeBorderStyle;
end;

procedure TDonutSeriesEditor.FormDestroy(Sender: TObject);
begin
  FreeAndNil(FPieForm);
end;

initialization
  RegisterClass(TDonutSeriesEditor);
end.
