{ *************************************************************************** }
{                                                                             }
{ EControl Syntax Editor SDK                                                  }
{                                                                             }
{ Copyright (c) 2004 - 2008 EControl Ltd., Zaharov Michael                    }
{     www.econtrol.ru                                                         }
{     support@econtrol.ru                                                     }
{                                                                             }
{ *************************************************************************** }
{$I ecSyntEdit.INC}

unit ecPageSetupEditor;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, ecPageSetupBase, ecSyntAnal, ecSyntMemo, StdCtrls, ExtCtrls, ecPrint,
  ecPopupCtrl;

type
  TPageSetupEditorDlg = class(TPageSetupBaseDlg)
    Label8: TLabel;
    ComboBox3: TComboBox;
    CheckRangeHL: TCheckBox;
    CheckTransparent: TCheckBox;
    CheckLineHL: TCheckBox;
    CheckHideCollapsed: TCheckBox;
    CheckWordWrap: TCheckBox;
    Button3: TButton;
    CheckBox1: TCheckBox;
    CheckPrintStaples: TCheckBox;
  private
    { Private declarations }
  public
    procedure SetParams(ecPrinter: TecCustomPrinter); override;
    procedure GetParams(ecPrinter: TecCustomPrinter); override;
  end;

function SyntPageSetup(APrinter: TecSyntPrinter): Boolean;

implementation

{$R *.dfm}

function SyntPageSetup(APrinter: TecSyntPrinter): Boolean;
begin
  Result := False;
end;


{ TPageSetupEditorDlg }

procedure TPageSetupEditorDlg.GetParams(ecPrinter: TecCustomPrinter);
var opt: TSyntMemoPrintOptions;
begin
  inherited;
  with TecSyntPrinter(ecPrinter) do
   begin
    opt := [];
    if CheckWordWrap.Checked then Include(opt, mpWordWrap);
    if CheckHideCollapsed.Checked then Include(opt, mpHideCollapsed);
    if CheckLineHL.Checked then Include(opt, mpLineHighlight);
    if CheckRangeHL.Checked then Include(opt, mpBlockHighlight);
    if CheckPrintStaples.Checked then Include(opt, mpBlockStaples);
    if not CheckTransparent.Checked then Include(opt, mpBackColor);
    Options := opt;
    LineNumbersPos := TLineNumbersPos(ComboBox3.ItemIndex);
    FontLineNumders := Button3.Font;
    PrintSelection := CheckBox1.Checked;
   end;
end;

procedure TPageSetupEditorDlg.SetParams(ecPrinter: TecCustomPrinter);
begin
  inherited;
  with TecSyntPrinter(ecPrinter) do
   begin
    CheckWordWrap.Checked := mpWordWrap in Options;
    CheckHideCollapsed.Checked := mpHideCollapsed in Options;
    CheckLineHL.Checked := mpLineHighlight in Options;
    CheckRangeHL.Checked := mpBlockHighlight in Options;
    CheckTransparent.Checked := not (mpBackColor in Options);
    CheckPrintStaples.Checked := mpBlockStaples in Options;
    ComboBox3.ItemIndex := integer(LineNumbersPos);
    Button3.Font := FontLineNumders;
    CheckBox1.Checked := PrintSelection;
   end;
end;

end.
