unit U_ArchWallParams; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, U_BaseCommon, U_BaseConstants, U_ArchCommon, RzButton, ExtCtrls, RzPanel, siComp, siLngLnk, Mask, RzEdit, RzRadChk; type TF_ArchWallParams = class(TForm) pnOkCancel: TRzPanel; btOk: TRzBitBtn; btCancel: TRzBitBtn; lng_Forms: TsiLangLinked; pnParams: TRzPanel; lbCoordz: TLabel; lbHeight: TLabel; fCoordz: TRzNumericEdit; fHeight: TRzNumericEdit; lbThickness: TLabel; fThickness: TRzNumericEdit; lbWidth: TLabel; fWidth: TRzNumericEdit; lbWidthOut: TLabel; fWidthOut: TRzNumericEdit; pnBasement: TRzPanel; fBasement: TRzCheckBox; gbBasement: TRzGroupBox; lbBasementThickness: TLabel; fBasementThickness: TRzNumericEdit; lbBasementDepth: TLabel; fBasementDepth: TRzNumericEdit; RzGroupBox2: TRzGroupBox; lbPlinthThickness: TLabel; fPlinthThickness: TRzNumericEdit; lbPlinthHeight: TLabel; fPlinthHeight: TRzNumericEdit; RzGroupBox3: TRzGroupBox; lbBasementColumnCount: TLabel; fBasementColumnCount: TRzNumericEdit; lbBasementColumnH: TLabel; fBasementColumnH: TRzNumericEdit; lbBasementColumnW: TLabel; fBasementColumnW: TRzNumericEdit; lbBasementColumnL: TLabel; fBasementColumnL: TRzNumericEdit; pnMain: TRzPanel; lbGroupName: TLabel; fGroupName: TRzEdit; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure pnOkCancelResize(Sender: TObject); procedure fBasementClick(Sender: TObject); private GForm: TForm; FPropsUOM: TStringList; FType: Integer; procedure SetCaptions; procedure SetControls; public Constructor Create(AOwner: TComponent; AForm: TForm); Destructor Destroy; override; function Execute(AType: Integer; AArchWndInfo: TComponent; AIsArc: Boolean): TArchInfoBasic; published property PropMainForm: TForm read GForm; property PropsUOM: TStringList read FPropsUOM; end; function ShowArchWallParams(AType: Integer; AArchWndInfo: TComponent; AIsArc: Boolean): TArchInfoBasic; var F_ArchWallParams: TF_ArchWallParams; implementation Uses U_Main; {$R *.dfm} constructor TF_ArchWallParams.Create(AOwner: TComponent; AForm: TForm); begin GForm := AForm; inherited Create(AOwner); end; destructor TF_ArchWallParams.Destroy; begin inherited; end; function TF_ArchWallParams.Execute(AType: Integer; AArchWndInfo: TComponent; AIsArc: Boolean): TArchInfoBasic; var Info: TArchInfoBasic; begin Result := nil; FType := AType; lbWidth.Visible := True; fWidth.Visible := true; fWidth.Enabled := true; SetCaptions; SetControls; fWidth.ReadOnly := AIsArc; fWidthOut.ReadOnly := AIsArc; Info := CreateArchSegmentInfo(AType); if AArchWndInfo <> nil then Info.Assign(AArchWndInfo) else begin if Info is TArchWallInfo then begin TArchWallInfo(Info).Height := 1.5; TArchWallInfo(Info).Width := 1; TArchWallInfo(Info).Thickness := 0.4; if Info is TArchWallDivInfo then TArchWallDivInfo(Info).Coordz := 0; end else if Info is TArchRoofHipInfo then begin TArchRoofHipInfo(Info).Height := 2; TArchRoofHipInfo(Info).Length := 1; end; end; ObjectPropsToForm(Info, Self); if Info is TArchRoofHipInfo then begin lbWidth.Caption := cArchParams_Msg01 +', '+ GetNameUOM(TF_Main(GForm).FUOM, true); fWidth.Value := FloatInUOM(TArchRoofHipInfo(Info).LengthProj, umM, TF_Main(GForm).FUOM); lbWidth.Visible := false; //10.05.2012 - блокируем редактирвание длин fWidth.Visible := false; //10.05.2012 - блокируем редактирвание длин end; Info.Free; if ShowModal = mrOk then begin Result := CreateArchSegmentInfo(AType); ObjectPropsFromForm(Result, Self); if Result is TArchRoofHipInfo then TArchRoofHipInfo(Result).LengthProj := FloatInUOM(fWidth.Value, TF_Main(GForm).FUOM, umM); // Сохраняем параметры как по-умолчанию SetArchObjToDefaultParams(Result, AType); end; end; procedure TF_ArchWallParams.SetCaptions; begin if FType = ctArhWall then Caption := cArchWallParams_Msg01 else if FType = ctArhWallDivision then Caption := cArchWallParams_Msg02 else if FType = ctArhRoofHip then Caption := cArchWallParams_Msg03; //lbHeight.Caption := cArchParams_Msg06 +', '+ GetNameUOM(TF_Main(GForm).FUOM, true); //lbThickness.Caption := cArchParams_Msg09 +', '+ GetNameUOM(TF_Main(GForm).FUOM, true); //lbCoordz.Caption := cArchParams_Msg05 +', '+ GetNameUOM(TF_Main(GForm).FUOM, true); //lbLength.Caption := cArchParams_Msg10 +', '+ GetNameUOM(TF_Main(GForm).FUOM, true); SetLableCaptions(Self, TF_Main(GForm).FUOM); end; procedure TF_ArchWallParams.SetControls; begin lbWidthOut.Visible := FType <> ctArhRoofHip; fWidthOut.Visible := lbWidthOut.Visible; lbThickness.Visible := FType <> ctArhRoofHip; fThickness.Visible := lbThickness.Visible; lbCoordz.Visible := FType = ctArhWallDivision; fCoordz.Visible := lbCoordz.Visible; pnBasement.Visible := FType = ctArhWall; if FType <> ctArhRoofHip then pnParams.Height := 129 else pnParams.Height := 65; Self.AutoSize := false; pnMain.AutoSize := false; pnMain.AutoSize := true; Self.AutoSize := true; end; procedure TF_ArchWallParams.FormCreate(Sender: TObject); begin pnOkCancelResize(pnOkCancel); fBasementClick(fBasement); FPropsUOM := TStringList.Create; SetFormControlDisplayFormat(Self); end; procedure TF_ArchWallParams.FormDestroy(Sender: TObject); begin FPropsUOM.Free; end; function ShowArchWallParams(AType: Integer; AArchWndInfo: TComponent; AIsArc: Boolean): TArchInfoBasic; begin Result := nil; try if F_ArchWallParams = nil then F_ArchWallParams := TF_ArchWallParams.Create(F_ProjMan, F_ProjMan); Result := F_ArchWallParams.Execute(AType, AArchWndInfo, AIsArc); except on E: Exception do AddExceptionToLogEx('ShowArchWallParams', E.Message); end; end; procedure TF_ArchWallParams.pnOkCancelResize(Sender: TObject); begin SetMiddleControlChilds(TControl(Sender), TControl(Self)); end; procedure TF_ArchWallParams.fBasementClick(Sender: TObject); begin // EnableControl(gbBasement, fBasement.Checked); end; end.