unit TeePolarContourEditor;
{$I TeeDefs.inc}

interface

uses
  {$IFNDEF LINUX}
  Windows, Messages,
  {$ENDIF}
  SysUtils, Classes,
  Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, Buttons,

  TeePolarEditor, TeCanvas, TeeContourEdit;

type
  TPolarContourSeriesEditor = class(TPolarSeriesEditor)
    TabLevels: TTabSheet;
    procedure FormShow(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
    Grid3DForm : TCustomForm;
    ContourForm : TContourSeriesEditor;

  public
    { Public declarations }
  end;

implementation

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

uses
  TeePolarContour, TeeGriEd, TeeSurfa, TeeProcs;

procedure TPolarContourSeriesEditor.FormShow(Sender: TObject);
var tmpContour : TContourSeries;
begin
  inherited;

  if Assigned(Polar) then
  begin
    if not Assigned(ContourForm) then
    begin
      ContourForm:=TContourSeriesEditor.Create(nil);

      tmpContour:=TPolarContourSeries(Polar).Contour;

      ContourForm.Tag:=ObjectToTag(tmpContour);

      while ContourForm.TabSheet2.ControlCount>0 do
         ContourForm.TabSheet2.Controls[0].Parent:=TabLevels;

      TeeTranslateControl(ContourForm);
      ContourForm.FormShow(Self);

      Grid3DForm:=TeeInsertGrid3DForm(Parent,tmpContour);
    end;
  end;
end;

procedure TPolarContourSeriesEditor.FormDestroy(Sender: TObject);
begin
  Grid3DForm.Free;
  ContourForm.Free;
  inherited;
end;

initialization
  RegisterClass(TPolarContourSeriesEditor);
end.
