{*************************************************}
{ TeeChart Pro PDF Canvas and Exporting Editor    }
{ Copyright (c) 2000-2020 by Steema Software      }
{ All Rights Reserved                             }
{*************************************************}
unit TeePDFOptions;
{$I TeeDefs.inc}

interface

uses
  {$IFNDEF LINUX}
  {$IFNDEF FMX}
  Windows,
  {$ENDIF}
  {$ENDIF}
  Classes, SysUtils, Graphics, Controls, Forms,
  Dialogs, TeePDFCanvas, StdCtrls, ExtCtrls, TeCanvas;

type
  TPDFOptions = class(TForm)
    RGOrient: TRadioGroup;
    Label1: TLabel;
    CBPosition: TComboFlat;
    Label2: TLabel;
    CBPageSize: TComboFlat;
    procedure FormShow(Sender: TObject);
    procedure RGOrientClick(Sender: TObject);
    procedure CBPageSizeChange(Sender: TObject);
    procedure CBPositionChange(Sender: TObject);
  private
    { Private declarations }
    IFormat : TPDFExportFormat;
  public
    { Public declarations }
  end;

implementation

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

procedure TPDFOptions.FormShow(Sender: TObject);
begin
  if Tag<>0 then
  begin
    IFormat:=TPDFExportFormat(Tag);

    RGOrient.ItemIndex:=Ord(IFormat.Orientation);
    CBPageSize.ItemIndex:=Ord(IFormat.PageSize);
    CBPosition.ItemIndex:=Ord(IFormat.Position);
  end;
end;

procedure TPDFOptions.RGOrientClick(Sender: TObject);
begin
  IFormat.Orientation:=TPDFPageOrientation(RGOrient.ItemIndex);
end;

procedure TPDFOptions.CBPageSizeChange(Sender: TObject);
begin
  IFormat.PageSize:=TPDFPageSize(CBPageSize.ItemIndex);
end;

procedure TPDFOptions.CBPositionChange(Sender: TObject);
begin
  IFormat.Position:=TPDFPosition(CBPosition.ItemIndex);
end;

initialization
  TeeActivateGroup;
  RegisterClass(TPDFOptions);
end.
