unit U_MasterComponToCAD;

interface

uses
  U_ArchCommon, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, siComp, siLngLnk, RzButton, ExtCtrls, RzPanel, Mask,
  RzEdit, RzRadChk;

type
  TF_MasterComponToCAD = class(TForm)
    pnOkCancel: TRzPanel;
    btOk: TRzBitBtn;
    btCancel: TRzBitBtn;
    lng_Forms: TsiLangLinked;
    RzPanel1: TRzPanel;
    lbStep: TLabel;
    fStep: TRzNumericEdit;
    cbSetToConnectors: TRzCheckBox;
    cbSetToConnectorsOnly: TRzCheckBox;
    procedure cbSetToConnectorsOnlyClick(Sender: TObject);
    
  private
    GForm: TForm;

    procedure SetControls;
  public
    function Execute(AFrom: TForm): Boolean;

    Constructor Create(AOwner: TComponent; AForm: TForm);
    Destructor Destroy; override;
  end;

  function MasterComponToCAD(AFrom: TForm): Boolean;

var
  F_MasterComponToCAD: TF_MasterComponToCAD;

implementation

Uses U_Main;

{$R *.dfm}

procedure TF_MasterComponToCAD.SetControls;
begin
  SetLableCaptions(Self, TF_Main(GForm).FUOM);
end;

function TF_MasterComponToCAD.Execute(AFrom: TForm): Boolean;
begin
  Result := false;
  GForm := AFrom;

  SetControls;

  fStep.Value := 1;
  if ShowModal = mrOK then
    Result := true;
end;

constructor TF_MasterComponToCAD.Create(AOwner: TComponent; AForm: TForm);
begin
  GForm := AForm;
  inherited Create(AOwner);
end;

destructor TF_MasterComponToCAD.Destroy;
begin
  inherited;
end;

function MasterComponToCAD(AFrom: TForm): Boolean;
begin
  if F_MasterComponToCAD = nil then
  begin
    F_MasterComponToCAD := TF_MasterComponToCAD.Create(Application, nil);
    F_MasterComponToCAD.fStep.Value := 1;
  end;
  Result := F_MasterComponToCAD.Execute(AFrom);
end;

procedure TF_MasterComponToCAD.cbSetToConnectorsOnlyClick(Sender: TObject);
begin
  if cbSetToConnectorsOnly.Checked then
  begin
    cbSetToConnectors.Enabled := False;
    fStep.Enabled := False;
  end
  else
  begin
    cbSetToConnectors.Enabled := True;
    fStep.Enabled := True;
  end;
end;

end.