mirror of
http://gitlab.expertsoft.com.ua/git/expertcad
synced 2026-01-11 18:25:40 +02:00
285 lines
9.7 KiB
ObjectPascal
285 lines
9.7 KiB
ObjectPascal
unit U_CadNormsProp;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, U_LNG, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit,
|
||
StdCtrls, ExtCtrls, RzPanel, cxLookAndFeelPainters, cxButtons, U_ESCadClasess,
|
||
cxRadioGroup, cxCheckBox, siComp, siLngLnk, RzButton, RzRadChk, cxGraphics,
|
||
cxLookAndFeels, Menus;
|
||
|
||
type
|
||
TF_CadNormsProp = class(TForm)
|
||
gbFieldsWidth: TRzGroupBox;
|
||
lb1: TLabel;
|
||
Label1: TLabel;
|
||
edNumberSize: TcxMaskEdit;
|
||
lb2: TLabel;
|
||
lb3: TLabel;
|
||
lb4: TLabel;
|
||
lb5: TLabel;
|
||
Label6: TLabel;
|
||
edNameSize: TcxMaskEdit;
|
||
edIzmSize: TcxMaskEdit;
|
||
edCountSize: TcxMaskEdit;
|
||
edColumnsSize: TcxMaskEdit;
|
||
edLineHeight: TcxMaskEdit;
|
||
Label8: TLabel;
|
||
Label9: TLabel;
|
||
Label10: TLabel;
|
||
Label11: TLabel;
|
||
Label12: TLabel;
|
||
RzGroupBox1: TRzGroupBox;
|
||
Label14: TLabel;
|
||
edTextSize: TcxMaskEdit;
|
||
bCancel: TcxButton;
|
||
bOK: TcxButton;
|
||
RzGroupBox2: TRzGroupBox;
|
||
Label13: TLabel;
|
||
edTableWidth: TcxMaskEdit;
|
||
Bevel1: TBevel;
|
||
lng_Forms: TsiLangLinked;
|
||
rbBold: TRzCheckBox;
|
||
rbItalic: TRzCheckBox;
|
||
rbUnderline: TRzCheckBox;
|
||
rbStrikeOut: TRzCheckBox;
|
||
procedure bCancelClick(Sender: TObject);
|
||
procedure bOKClick(Sender: TObject);
|
||
procedure edNumberSizeKeyPress(Sender: TObject; var Key: Char);
|
||
procedure edTableWidthKeyPress(Sender: TObject; var Key: Char);
|
||
procedure FormShow(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
public
|
||
{ Public declarations }
|
||
function Execute(aCadNormsObject: TCadNorms): Boolean;
|
||
end;
|
||
|
||
var
|
||
F_CadNormsProp: TF_CadNormsProp;
|
||
|
||
implementation
|
||
uses U_BaseCommon, U_SCSComponent, U_Common, U_Constants;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TF_CadNormsProp.bCancelClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
function TF_CadNormsProp.Execute(aCadNormsObject: TCadNorms): Boolean;
|
||
var
|
||
DblValue: Double;
|
||
IntValue: Integer;
|
||
SetValue: TFontStyles;
|
||
begin
|
||
try
|
||
// MaskEdit
|
||
edNumberSize.Properties.EditMask := '\d?\d?\d?' + DecimalSeparator + '\d?\d?';
|
||
edNameSize.Properties.EditMask := '\d?\d?\d?' + DecimalSeparator + '\d?\d?';
|
||
edIzmSize.Properties.EditMask := '\d?\d?\d?' + DecimalSeparator + '\d?\d?';
|
||
edCountSize.Properties.EditMask := '\d?\d?\d?' + DecimalSeparator + '\d?\d?';
|
||
edColumnsSize.Properties.EditMask := '\d?\d?\d?' + DecimalSeparator + '\d?\d?';
|
||
edLineHeight.Properties.EditMask := '\d?\d?\d?' + DecimalSeparator + '\d?\d?';
|
||
edTextSize.Properties.EditMask := '\d?\d?' + DecimalSeparator + '\d?\d?';
|
||
|
||
lb1.Caption := cCadNormsProp_Mes6 + cCadNormsProp_Mes1;
|
||
lb2.Caption := cCadNormsProp_Mes6 + cCadNormsProp_Mes2;
|
||
lb3.Caption := cCadNormsProp_Mes6 + cCadNormsProp_Mes3;
|
||
lb4.Caption := cCadNormsProp_Mes6 + cCadNormsProp_Mes4;
|
||
lb5.Caption := cCadNormsProp_Mes6 + cCadNormsProp_Mes5;
|
||
|
||
Result := False;
|
||
if (GCurrProjUnitOfMeasure = umSM) or (GCurrProjUnitOfMeasure = umM) then
|
||
begin
|
||
edNumberSize.Text := FormatFloat(ffMask, aCadNormsObject.fNumberSize);
|
||
edNameSize.Text := FormatFloat(ffMask, aCadNormsObject.fNameSize);
|
||
edIzmSize.Text := FormatFloat(ffMask, aCadNormsObject.fIzmSize);
|
||
edCountSize.Text := FormatFloat(ffMask, aCadNormsObject.fCountSize);
|
||
edColumnsSize.Text := FormatFloat(ffMask, aCadNormsObject.fColumnSize);
|
||
edLineHeight.Text := FormatFloat(ffMask, aCadNormsObject.fLineHeight);
|
||
end
|
||
else
|
||
if (GCurrProjUnitOfMeasure = umIn) or (GCurrProjUnitOfMeasure = umFt) then
|
||
begin
|
||
edNumberSize.Text := FormatFloat(ffMask, FloatInUOM(aCadNormsObject.fNumberSize, umMM, umIn));
|
||
edNameSize.Text := FormatFloat(ffMask, FloatInUOM(aCadNormsObject.fNameSize, umMM, umIn));
|
||
edIzmSize.Text := FormatFloat(ffMask, FloatInUOM(aCadNormsObject.fIzmSize, umMM, umIn));
|
||
edCountSize.Text := FormatFloat(ffMask, FloatInUOM(aCadNormsObject.fCountSize, umMM, umIn));
|
||
edColumnsSize.Text := FormatFloat(ffMask, FloatInUOM(aCadNormsObject.fColumnSize, umMM, umIn));
|
||
edLineHeight.Text := FormatFloat(ffMask, FloatInUOM(aCadNormsObject.fLineHeight, umMM, umIn));
|
||
end;
|
||
|
||
edTableWidth.Text := IntToStr(aCadNormsObject.fTableWidth);
|
||
edTextSize.Text := IntToStr(aCadNormsObject.fTextSize);
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
rbBold.Checked := False;
|
||
rbItalic.Checked := False;
|
||
rbUnderline.Checked := False;
|
||
rbStrikeOut.Checked := False;
|
||
if fsBold in aCadNormsObject.fTextStyle then
|
||
rbBold.Checked := True;
|
||
if fsItalic in aCadNormsObject.fTextStyle then
|
||
rbItalic.Checked := True;
|
||
if fsUnderline in aCadNormsObject.fTextStyle then
|
||
rbUnderline.Checked := True;
|
||
if fsStrikeOut in aCadNormsObject.fTextStyle then
|
||
rbStrikeOut.Checked := True;
|
||
|
||
if ShowModal = mrOK then
|
||
begin
|
||
DblValue := StrToFloat_My(edNumberSize.Text);
|
||
if (GCurrProjUnitOfMeasure = umIn) or (GCurrProjUnitOfMeasure = umFt) then
|
||
DblValue := FloatInUOM(DblValue, umIn, umMM);
|
||
if not DoubleCMP(DblValue, aCadNormsObject.fNumberSize) then
|
||
begin
|
||
aCadNormsObject.fNumberSize := DblValue;
|
||
Result := True;
|
||
end;
|
||
DblValue := StrToFloat_My(edNameSize.Text);
|
||
if (GCurrProjUnitOfMeasure = umIn) or (GCurrProjUnitOfMeasure = umFt) then
|
||
DblValue := FloatInUOM(DblValue, umIn, umMM);
|
||
if not DoubleCMP(DblValue, aCadNormsObject.fNameSize) then
|
||
begin
|
||
aCadNormsObject.fNameSize := DblValue;
|
||
Result := True;
|
||
end;
|
||
DblValue := StrToFloat_My(edIzmSize.Text);
|
||
if (GCurrProjUnitOfMeasure = umIn) or (GCurrProjUnitOfMeasure = umFt) then
|
||
DblValue := FloatInUOM(DblValue, umIn, umMM);
|
||
if not DoubleCMP(DblValue, aCadNormsObject.fIzmSize) then
|
||
begin
|
||
aCadNormsObject.fIzmSize := DblValue;
|
||
Result := True;
|
||
end;
|
||
DblValue := StrToFloat_My(edCountSize.Text);
|
||
if (GCurrProjUnitOfMeasure = umIn) or (GCurrProjUnitOfMeasure = umFt) then
|
||
DblValue := FloatInUOM(DblValue, umIn, umMM);
|
||
if not DoubleCMP(DblValue, aCadNormsObject.fCountSize) then
|
||
begin
|
||
aCadNormsObject.fCountSize := DblValue;
|
||
Result := True;
|
||
end;
|
||
DblValue := StrToFloat_My(edColumnsSize.Text);
|
||
if (GCurrProjUnitOfMeasure = umIn) or (GCurrProjUnitOfMeasure = umFt) then
|
||
DblValue := FloatInUOM(DblValue, umIn, umMM);
|
||
if not DoubleCMP(DblValue, aCadNormsObject.fColumnSize) then
|
||
begin
|
||
aCadNormsObject.fColumnSize := DblValue;
|
||
Result := True;
|
||
end;
|
||
DblValue := StrToFloat_My(edLineHeight.Text);
|
||
if (GCurrProjUnitOfMeasure = umIn) or (GCurrProjUnitOfMeasure = umFt) then
|
||
DblValue := FloatInUOM(DblValue, umIn, umMM);
|
||
if not DoubleCMP(DblValue, aCadNormsObject.fLineHeight) then
|
||
begin
|
||
aCadNormsObject.fLineHeight := DblValue;
|
||
Result := True;
|
||
end;
|
||
IntValue := StrToInt(edTableWidth.Text);
|
||
if IntValue <> aCadNormsObject.fTableWidth then
|
||
begin
|
||
aCadNormsObject.fTableWidth := IntValue;
|
||
Result := True;
|
||
end;
|
||
IntValue := StrToInt(edTextSize.Text);
|
||
if IntValue <> aCadNormsObject.fTextSize then
|
||
begin
|
||
aCadNormsObject.fTextSize := IntValue;
|
||
Result := True;
|
||
end;
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
SetValue := [];
|
||
if rbBold.Checked then
|
||
SetValue := SetValue + [fsBold];
|
||
if rbItalic.Checked then
|
||
SetValue := SetValue + [fsItalic];
|
||
if rbUnderline.Checked then
|
||
SetValue := SetValue + [fsUnderline];
|
||
if rbStrikeOut.Checked then
|
||
SetValue := SetValue + [fsStrikeOut];
|
||
if SetValue <> aCadNormsObject.fTextStyle then
|
||
begin
|
||
aCadNormsObject.fTextStyle := SetValue;
|
||
Result := True;
|
||
end;
|
||
end;
|
||
except
|
||
on E: Exception do AddExceptionToLogEx('TF_CadNormsProp.Execute', E.Message);
|
||
end;
|
||
end;
|
||
|
||
procedure TF_CadNormsProp.bOKClick(Sender: TObject);
|
||
begin
|
||
try
|
||
if not GProjectChanged then // Tolik 28/08/2019 --
|
||
SetProjectChanged(True);
|
||
except
|
||
on E: Exception do AddExceptionToLogEx('TF_CadNormsProp.bOKClick', E.Message);
|
||
end;
|
||
end;
|
||
|
||
procedure TF_CadNormsProp.edNumberSizeKeyPress(Sender: TObject;
|
||
var Key: Char);
|
||
begin
|
||
try
|
||
if (Key = '.') or (Key = ',') then
|
||
if Key <> DecimalSeparator then
|
||
Key := #0;
|
||
|
||
if Key = #13 then
|
||
begin
|
||
bOK.SetFocus;
|
||
bOK.Click;
|
||
end;
|
||
except
|
||
on E: Exception do AddExceptionToLogEx('TF_CadNormsProp.edNumberSizeKeyPress', E.Message);
|
||
end;
|
||
end;
|
||
|
||
procedure TF_CadNormsProp.edTableWidthKeyPress(Sender: TObject;
|
||
var Key: Char);
|
||
begin
|
||
try
|
||
if Key = #13 then
|
||
begin
|
||
bOK.SetFocus;
|
||
bOK.Click;
|
||
end;
|
||
except
|
||
on E: Exception do AddExceptionToLogEx('TF_CadNormsProp.edTableWidthKeyPress', E.Message);
|
||
end;
|
||
end;
|
||
|
||
procedure TF_CadNormsProp.FormShow(Sender: TObject);
|
||
begin
|
||
try
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if (GCurrProjUnitOfMeasure = umSM) or (GCurrProjUnitOfMeasure = umM) then
|
||
begin
|
||
Label1.Caption := cMetric_mm;
|
||
Label8.Caption := cMetric_mm;
|
||
Label9.Caption := cMetric_mm;
|
||
Label10.Caption := cMetric_mm;
|
||
Label11.Caption := cMetric_mm;
|
||
Label12.Caption := cMetric_mm;
|
||
end;
|
||
if (GCurrProjUnitOfMeasure = umIn) or (GCurrProjUnitOfMeasure = umFt) then
|
||
begin
|
||
Label1.Caption := cWhitworth_in;
|
||
Label8.Caption := cWhitworth_in;
|
||
Label9.Caption := cWhitworth_in;
|
||
Label10.Caption := cWhitworth_in;
|
||
Label11.Caption := cWhitworth_in;
|
||
Label12.Caption := cWhitworth_in;
|
||
end;
|
||
except
|
||
on E: Exception do AddExceptionToLogEx('TF_CadNormsProp.FormShow', E.Message);
|
||
end;
|
||
end;
|
||
|
||
end.
|