{********************************************}
{ TeeChart exporting to Javascript HTML5     }
{ Copyright (c) 2012-2020 by Steema Software }
{         All Rights Reserved                }
{********************************************}
unit TeeJavascriptEditor;
{$I TeeDefs.inc}

interface

uses
  {$IFDEF MSWINDOWS}
  Windows, Messages,
  {$ENDIF}

  SysUtils, Classes,
  Graphics, Controls, Forms, Dialogs, StdCtrls, TeeJavascript;

type
  TTeeJScriptOptions = class(TForm)
    CBFullPage: TCheckBox;
    Label1: TLabel;
    ECanvas: TEdit;
    Label2: TLabel;
    CBPath: TComboBox;
    CBMinify: TCheckBox;
    procedure FormShow(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  private
    { Private declarations }
    IFormat : TJavascriptExportFormat;
  public
    { Public declarations }
  end;

implementation

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

procedure TTeeJScriptOptions.FormShow(Sender: TObject);
begin
  if not Assigned(IFormat) then
  begin
    IFormat:=TJavaScriptExportFormat(Tag);

    if Assigned(IFormat) then
    begin
      CBFullPage.Checked:=IFormat.DoFullPage;
      ECanvas.Text:=IFormat.CanvasName;
      CBPath.Text:=IFormat.SourceScriptPath;
      CBMinify.Checked:=IFormat.Minify;
    end;
  end;
end;

procedure TTeeJScriptOptions.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
  if Assigned(IFormat) then
  begin
    IFormat.DoFullPage:=CBFullPage.Checked;
    IFormat.CanvasName:=ECanvas.Text;
    IFormat.SourceScriptPath:=CBPath.Text;
    IFormat.Minify:=CBMinify.Checked;
  end;

  CanClose:=True;
end;

initialization
  RegisterClass(TTeeJScriptOptions);
finalization
  UnRegisterClass(TTeeJScriptOptions);
end.
