{**********************************************}
{   TPolarGridSeries                           }
{   Copyright (c) 2006-2020 by Steema Software }
{**********************************************}
unit TeePolarGridEditor;
{$I TeeDefs.inc}

interface

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

  Graphics, StdCtrls, ComCtrls, Controls, ExtCtrls,

  TeCanvas, TeeProcs, TeEngine, Chart, Series, TeePolar, TeeSurfa,
  TeePolarEditor, TeeGriEd, TeePenDlg, TeePolarGrid;

type
  TPolarGridEditor = class(TPolarSeriesEditor)
    TabPalette: TTabSheet;
    CBCentered: TCheckBox;
    LGridStyle: TLabel;
    CBGridStyle: TComboFlat;
    procedure FormShow(Sender: TObject);
    procedure CBCenteredClick(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure CBGridStyleChange(Sender: TObject);
  private
    { Private declarations }
    I3DEditor : TGrid3DSeriesEditor;
  public
    { Public declarations }
  end;

implementation

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

procedure TPolarGridEditor.FormShow(Sender: TObject);
begin
  inherited;

  CBCentered.Top:=CBClose.Top;
  CBClose.Hide;

  LGridStyle.Top:=LDrawStyle.Top;
  LGridStyle.Left:=LDrawStyle.Left;

  CBGridStyle.Top:=CBDrawStyle.Top;
  CBGridStyle.Left:=CBDrawStyle.Left;

  LDrawStyle.Hide;
  CBDrawStyle.Hide;

  I3DEditor:=TGrid3DSeriesEditor.Create(nil);

  if Assigned(Polar) then
  begin
    AddFormTo(I3DEditor,TabPalette,TPolarGridSeries(Polar).Palette.Series);
    TeeTranslateControl(I3DEditor);

    CBCentered.Checked:=TPolarGridSeries(Polar).Centered;
    CBGridStyle.ItemIndex:=Ord(TPolarGridSeries(Polar).GridStyle);
  end;
end;

procedure TPolarGridEditor.CBCenteredClick(Sender: TObject);
begin
  TPolarGridSeries(Polar).Centered:=CBCentered.Checked;
end;

procedure TPolarGridEditor.FormDestroy(Sender: TObject);
begin
  I3DEditor.Free;
  inherited;
end;

procedure TPolarGridEditor.CBGridStyleChange(Sender: TObject);
begin
  TPolarGridSeries(Polar).GridStyle:=TPolarGridStyle(CBGridStyle.ItemIndex);
end;

initialization
  RegisterClass(TPolarGridEditor);
end.

