mirror of
http://gitlab.expertsoft.com.ua/git/expertcad
synced 2026-01-11 22:45:39 +02:00
144 lines
3.7 KiB
ObjectPascal
144 lines
3.7 KiB
ObjectPascal
unit U_OrtholineParams;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, U_LNG, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, cxLookAndFeelPainters, StdCtrls, cxButtons, cxControls,
|
|
cxContainer, cxEdit, cxTextEdit,
|
|
/// PowerCad
|
|
PCPanel, PCDrawBox, PCDrawing, PowerCad, PCTypesUtils,
|
|
DrawObjects, ExtDlgs, PCLayerDlg, OleCtnrs, PCgui, GuiStrings,
|
|
DrawEngine, U_ESCadClasess, U_SCSEngineTest, cxMaskEdit, siComp, siLngLnk,
|
|
cxGraphics, cxLookAndFeels, Menus;
|
|
|
|
type
|
|
TF_OrthoLineParams = class(TForm)
|
|
bOK: TcxButton;
|
|
bCancel: TcxButton;
|
|
Label1: TLabel;
|
|
Label2: TLabel;
|
|
bDefault: TcxButton;
|
|
edGAP: TcxMaskEdit;
|
|
edNUM: TcxMaskEdit;
|
|
lng_Forms: TsiLangLinked;
|
|
procedure bCancelClick(Sender: TObject);
|
|
procedure bDefaultClick(Sender: TObject);
|
|
procedure bOKClick(Sender: TObject);
|
|
procedure FormShow(Sender: TObject);
|
|
procedure FormKeyPress(Sender: TObject; var Key: Char);
|
|
procedure edGAPKeyPress(Sender: TObject; var Key: Char);
|
|
procedure edNUMKeyPress(Sender: TObject; var Key: Char);
|
|
procedure edGAPExit(Sender: TObject);
|
|
procedure edNUMExit(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
CurrentGap: string;
|
|
CurrentCount: string;
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
F_OrthoLineParams: TF_OrthoLineParams;
|
|
|
|
implementation
|
|
uses USCS_Main, U_CAD, U_Common, U_BaseCommon, U_Constants;
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure TF_OrthoLineParams.bCancelClick(Sender: TObject);
|
|
begin
|
|
Close;
|
|
end;
|
|
|
|
procedure TF_OrthoLineParams.bDefaultClick(Sender: TObject);
|
|
begin
|
|
edGAP.Text := '4';
|
|
edNUM.Text := '2';
|
|
GDefaultGap := 4;
|
|
GDefaultNum := 2;
|
|
end;
|
|
|
|
procedure TF_OrthoLineParams.bOKClick(Sender: TObject);
|
|
begin
|
|
try
|
|
if (CurrentGap <> edGAP.Text) or (CurrentCount <> edNUM.Text) then
|
|
begin
|
|
GDefaultGap := StrToFloat_My(edGAP.Text);
|
|
GDefaultNum := StrToInt(edNUM.Text);
|
|
GCurrentConnectorType := ct_Clear;
|
|
if GDefaultNum = 1 then
|
|
GDefaultGap := 1;
|
|
if GDefaultNum > 1 then
|
|
if GDefaultGap < 2 then
|
|
GDefaultGap := 2;
|
|
end;
|
|
GCadForm.PCad.SetTool(toFigure, 'TOrthoLine');
|
|
except
|
|
on E: Exception do AddExceptionToLogEx('TF_OrthoLineParams.bOKClick', E.Message);
|
|
end;
|
|
end;
|
|
|
|
procedure TF_OrthoLineParams.FormShow(Sender: TObject);
|
|
begin
|
|
// MaskEdit
|
|
edGAP.Properties.EditMask := '\d?\d?' + DecimalSeparator + '\d?';
|
|
GDefaultGap := ABS(GDefaultGap);
|
|
GDefaultNum := ABS(GDefaultNum);
|
|
edGAP.Text := FormatFloat(ffMask, GDefaultGap);
|
|
edNUM.Text := IntToStr(GDefaultNum);
|
|
CurrentGap := edGAP.Text;
|
|
CurrentCount := edNUM.Text;
|
|
bOK.SetFocus;
|
|
edGAP.SetFocus;
|
|
edGAP.SelStart := 0;
|
|
edGAP.SelLength := Length(edGAP.Text) + 1;
|
|
end;
|
|
|
|
procedure TF_OrthoLineParams.FormKeyPress(Sender: TObject; var Key: Char);
|
|
begin
|
|
if Key = #27 then
|
|
Close;
|
|
end;
|
|
|
|
procedure TF_OrthoLineParams.edGAPKeyPress(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_OrthoLineParams.edGAPKeyPress', E.Message);
|
|
end;
|
|
end;
|
|
|
|
procedure TF_OrthoLineParams.edNUMKeyPress(Sender: TObject; var Key: Char);
|
|
begin
|
|
if Key = #13 then
|
|
begin
|
|
bOK.SetFocus;
|
|
bOK.Click;
|
|
end;
|
|
end;
|
|
|
|
procedure TF_OrthoLineParams.edGAPExit(Sender: TObject);
|
|
begin
|
|
if edGAP.Text = '' then
|
|
edGAP.Text := CurrentGap;
|
|
end;
|
|
|
|
procedure TF_OrthoLineParams.edNUMExit(Sender: TObject);
|
|
begin
|
|
if edNUM.Text = '' then
|
|
edNUM.Text := CurrentCount;
|
|
end;
|
|
|
|
end.
|