unit U_ArchRoomParams; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, siComp, siLngLnk, ExtCtrls, RzPanel, RzButton, U_BaseCommon, U_BaseConstants, U_BaseSettings, U_ArchCommon, Mask, RzEdit, RzRadChk; type TF_ArchRoomParams = class(TForm) lng_Forms: TsiLangLinked; RzPanel1: TRzPanel; pnOkCancel: TRzPanel; btOk: TRzBitBtn; btCancel: TRzBitBtn; gbSizes: TRzGroupBox; gbThickness: TRzGroupBox; lbLength: TLabel; lbWidth: TLabel; lbThicknessFront: TLabel; lbThicknessLeft: TLabel; lbThicknessRight: TLabel; lbThicknessBack: TLabel; fLength: TRzNumericEdit; fWidth: TRzNumericEdit; fThicknessFront: TRzNumericEdit; fThicknessLeft: TRzNumericEdit; fThicknessRight: TRzNumericEdit; fThicknessBack: TRzNumericEdit; lbHeightWall: TLabel; fHeightWall: TRzNumericEdit; fBasement: TRzCheckBox; procedure pnOkCancelResize(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private GForm: TForm; FPropsUOM: TStringList; FType: Integer; procedure SetCaptions; public Constructor Create(AOwner: TComponent; AForm: TForm); Destructor Destroy; override; function Execute(AType: Integer; aBasement: Boolean): TArchRoomInfo; published property PropMainForm: TForm read GForm; property PropsUOM: TStringList read FPropsUOM; end; function ShowArchRoomParams(AType: Integer; aBasement: Boolean): TArchRoomInfo; var F_ArchRoomParams: TF_ArchRoomParams; implementation Uses U_Main; {$R *.dfm} constructor TF_ArchRoomParams.Create(AOwner: TComponent; AForm: TForm); begin GForm := AForm; inherited Create(AOwner); end; destructor TF_ArchRoomParams.Destroy; begin inherited; end; procedure TF_ArchRoomParams.pnOkCancelResize(Sender: TObject); begin SetMiddleControlChilds(TControl(Sender), TControl(Self)); end; procedure TF_ArchRoomParams.SetCaptions; begin if FType = ctArhRoom then Caption := cArchRoomParams_Msg01 else if FType = ctArhBrickWall then Caption := cArchRoomParams_Msg02 else if FType = ctArhRoofSeg then Caption := cArchRoomParams_Msg03; gbSizes.Caption := cArchParams_Msg25; lbLength.Caption := cArchParams_Msg01 +', '+ GetNameUOM(TF_Main(GForm).FUOM, true); lbWidth.Caption := cArchParams_Msg02 +', '+ GetNameUOM(TF_Main(GForm).FUOM, true); lbHeightWall.Caption := cArchParams_Msg03 +', '+ GetNameUOM(TF_Main(GForm).FUOM, true); lbThicknessFront.Caption := cArchParams_Msg04_01 +', '+ GetNameUOM(TF_Main(GForm).FUOM, true); lbThicknessLeft.Caption := cArchParams_Msg04_02 +', '+ GetNameUOM(TF_Main(GForm).FUOM, true); lbThicknessRight.Caption := cArchParams_Msg04_03 +', '+ GetNameUOM(TF_Main(GForm).FUOM, true); lbThicknessBack.Caption := cArchParams_Msg04_04 +', '+ GetNameUOM(TF_Main(GForm).FUOM, true); if FType = ctArhRoofSeg then begin lbHeightWall.Caption := cArchParams_Msg06 +', '+ GetNameUOM(TF_Main(GForm).FUOM, true); gbSizes.Caption := cDimensionsB; end; end; function TF_ArchRoomParams.Execute(AType: Integer; aBasement: Boolean): TArchRoomInfo; var RoomInfo: TArchRoomInfo; begin Result := nil; FType := AType; SetCaptions; {fLength.Value := RoundCP(FloatInUOM(4, umMetr, TF_Main(GForm).FUOM)); fWidth.Value := RoundCP(FloatInUOM(2, umMetr, TF_Main(GForm).FUOM)); fHeightWall.Value := RoundCP(FloatInUOM(3, umMetr, TF_Main(GForm).FUOM)); fThicknessFront.Value := RoundCP(FloatInUOM(0.5, umMetr, TF_Main(GForm).FUOM)); fThicknessLeft.Value := RoundCP(FloatInUOM(0.5, umMetr, TF_Main(GForm).FUOM)); fThicknessRight.Value := RoundCP(FloatInUOM(0.5, umMetr, TF_Main(GForm).FUOM)); fThicknessBack.Value := RoundCP(FloatInUOM(0.5, umMetr, TF_Main(GForm).FUOM));} RoomInfo := TArchRoomInfo.Create(nil); if LoadArchObjDefaultParams(RoomInfo, AType) = nil then begin RoomInfo.Length := 4; RoomInfo.Width := 2; RoomInfo.HeightWall := ctDefWallHeight; if AType <> ctArhRoofSeg then begin RoomInfo.ThicknessFront := 0.4; RoomInfo.ThicknessLeft := 0.4; RoomInfo.ThicknessRight := 0.4; RoomInfo.ThicknessBack := 0.4; end else begin RoomInfo.HeightWall := ctDefRoofHipHeight; RoomInfo.ThicknessFront := 0.01; RoomInfo.ThicknessLeft := 0.01; RoomInfo.ThicknessRight := 0.01; RoomInfo.ThicknessBack := 0.01; end; end; ObjectPropsToForm(RoomInfo, Self); RoomInfo.Free; fBasement.Checked := aBasement; //04.07.2012 gbThickness.Visible := FType <> ctArhRoofSeg; fBasement.Visible := FType <> ctArhRoofSeg; if FType <> ctArhRoofSeg then Height := 354 else Height := 180; if ShowModal = mrOk then begin if AType = ctArhRoofSeg then Result := TArchRoofSegInfo.Create(nil) else Result := TArchRoomInfo.Create(nil); ObjectPropsFromForm(Result, Self); // Сохраняем параметры как по-умолчанию SetArchObjToDefaultParams(Result, AType); end; end; function ShowArchRoomParams(AType: Integer; aBasement: Boolean): TArchRoomInfo; begin Result := nil; try if F_ArchRoomParams = nil then F_ArchRoomParams := TF_ArchRoomParams.Create(F_ProjMan, F_ProjMan); Result := F_ArchRoomParams.Execute(AType, aBasement); except on E: Exception do AddExceptionToLogEx('ShowArchRoomParams', E.Message); end; end; procedure TF_ArchRoomParams.FormCreate(Sender: TObject); begin pnOkCancelResize(pnOkCancel); GetClassPropList(TArchRoomInfo); FPropsUOM := TStringList.Create; //FPropsUOM.Add(fLength.Name); //FPropsUOM.Add(fWidth.Name); //FPropsUOM.Add(fHeightWall.Name); //FPropsUOM.Add(fThicknessFront.Name); //FPropsUOM.Add(fThicknessLeft.Name); //FPropsUOM.Add(fThicknessRight.Name); //FPropsUOM.Add(fThicknessBack.Name); SetFormControlDisplayFormat(Self); end; procedure TF_ArchRoomParams.FormDestroy(Sender: TObject); begin FPropsUOM.Free; end; end.