mirror of
http://gitlab.expertsoft.com.ua/git/expertcad
synced 2026-01-11 22:45:39 +02:00
295 lines
9.9 KiB
ObjectPascal
295 lines
9.9 KiB
ObjectPascal
unit U_ChooseSCSObjectsProp;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, U_LNG, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, cxControls, cxContainer, cxEdit, cxLabel, ExtCtrls, RzPanel,
|
|
StdCtrls, cxRadioGroup, cxLookAndFeelPainters, cxButtons,
|
|
/// PowerCad
|
|
PCPanel, PCDrawBox, PCDrawing, PowerCad, PCTypesUtils,
|
|
DrawObjects, ExtDlgs, PCLayerDlg, OleCtnrs, PCgui, GuiStrings,
|
|
DrawEngine, U_ESCadClasess, U_SCSEngineTest, cxImage, cxMaskEdit,
|
|
RzButton, ToolWin, cxDropDownEdit, cxColorComboBox, Mask, cxImageComboBox,
|
|
RzCmboBx, RzEdit, RzSpnEdt, Contnrs, siComp, siLngLnk, U_Common, cxGraphics,
|
|
cxLookAndFeels, Menus;
|
|
|
|
type
|
|
TF_ChooseSCSObjectsProp = class(TForm)
|
|
cxLabel1: TcxLabel;
|
|
gbTypes: TRzGroupBox;
|
|
cxLabel2: TcxLabel;
|
|
cxLabel3: TcxLabel;
|
|
cbConnObjects: TcxRadioButton;
|
|
cbConnConnectors: TcxRadioButton;
|
|
cbConnRaises: TcxRadioButton;
|
|
cbLineTraces: TcxRadioButton;
|
|
cbLineRaises: TcxRadioButton;
|
|
RzPanel1: TRzPanel;
|
|
bOK: TcxButton;
|
|
bCancel: TcxButton;
|
|
lng_Forms: TsiLangLinked;
|
|
procedure FormKeyPress(Sender: TObject; var Key: Char);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
function Execute(aSCSObject: TFigure): Boolean;
|
|
function FindFirstByObjectsType(aObjectsTypeProp: TObjectsTypeProp): TFigure;
|
|
end;
|
|
|
|
var
|
|
F_ChooseSCSObjectsProp: TF_ChooseSCSObjectsProp;
|
|
|
|
implementation
|
|
uses USCS_main, U_BaseCommon, U_Constants, U_CAD, U_SCSObjectsProp;
|
|
|
|
{$R *.dfm}
|
|
|
|
{ TF_ChooseSCSObjectsProp }
|
|
|
|
function TF_ChooseSCSObjectsProp.Execute(aSCSObject: TFigure): Boolean;
|
|
var
|
|
i, j: Integer;
|
|
FFigure: TFigure;
|
|
FObjectsTypeProp: TObjectsTypeProp;
|
|
begin
|
|
try
|
|
// ÎÁÚÅÊÒ ÎÄÈÍ
|
|
if GCadForm.PCad.SelectedCount = 1 then
|
|
begin
|
|
F_SCSObjectsProp.FObjectsTypeProp := otp_Single;
|
|
if CheckFigureByClassName(aSCSObject, cTOrthoLine) then
|
|
begin
|
|
F_SCSObjectsProp.Show;
|
|
F_SCSObjectsProp.PageSCSObjects.ActivePageIndex := 1;
|
|
// åñëè ýòî ñ-ï
|
|
if TOrthoLine(aSCSObject).FIsRaiseUpDown then
|
|
F_SCSObjectsProp.OrtholinePropertiesForRaise
|
|
else
|
|
// åñëè ýòî òðàññà
|
|
F_SCSObjectsProp.OrtholinePropertiesForNormal;
|
|
F_SCSObjectsProp.LoadOrtholineProperties(TOrthoLine(aSCSObject));
|
|
F_SCSObjectsProp.bLineOK.Enabled := True;
|
|
end
|
|
else
|
|
if CheckFigureByClassName(aSCSObject, cTConnectorObject) then
|
|
begin
|
|
F_SCSObjectsProp.Show;
|
|
F_SCSObjectsProp.PageSCSObjects.ActivePageIndex := 0;
|
|
// åñëè ýòî âåðøèíà ñ-ï
|
|
if TConnectorObject(aSCSObject).FConnRaiseType <> crt_None then
|
|
F_SCSObjectsProp.ConnectorPropertiesForRaise
|
|
else
|
|
// åñëè ýòî îáû÷íûé îáúåêò (ÐÒ èëè ñîåäèíèòåëü)
|
|
F_SCSObjectsProp.ConnectorPropertiesForNormal(TConnectorObject(aSCSObject).ConnectorType);
|
|
F_SCSObjectsProp.LoadConnectorProperties(TConnectorObject(aSCSObject));
|
|
F_SCSObjectsProp.bConnOK.Enabled := True;
|
|
end;
|
|
end
|
|
else
|
|
// ÅÑÒÜ ÃÐÓÏÏÀ ÎÁÚÅÊÒÎÂ
|
|
begin
|
|
// âûñòàâèòü ïðèñóòñòâóþùèå îáúåêòû
|
|
cbConnObjects.Enabled := False;
|
|
cbConnConnectors.Enabled := False;
|
|
cbConnRaises.Enabled := False;
|
|
cbLineTraces.Enabled := False;
|
|
cbLineRaises.Enabled := False;
|
|
for i := 0 to GCadForm.PCad.SelectedCount - 1 do
|
|
begin
|
|
FFigure := TFigure(GCadForm.PCad.Selection[i]);
|
|
// ÒÎ
|
|
if CheckFigureByClassName(FFigure, cTConnectorObject) then
|
|
begin
|
|
// Âåðøèíà ñ-ï
|
|
if TConnectorObject(FFigure).FConnRaiseType <> crt_None then
|
|
begin
|
|
cbConnRaises.Enabled := True;
|
|
if TConnectorObject(FFigure) = aSCSObject then
|
|
cbConnRaises.Checked := True;
|
|
end
|
|
else
|
|
begin
|
|
// ñîåäèíèòåëü
|
|
if TConnectorObject(FFigure).ConnectorType = ct_Clear then
|
|
begin
|
|
cbConnConnectors.Enabled := True;
|
|
if TConnectorObject(FFigure) = aSCSObject then
|
|
cbConnConnectors.Checked := True;
|
|
end
|
|
else
|
|
// Îáúåêò
|
|
begin
|
|
cbConnObjects.Enabled := True;
|
|
if TConnectorObject(FFigure) = aSCSObject then
|
|
cbConnObjects.Checked := True;
|
|
end;
|
|
end;
|
|
end
|
|
// ËÎ
|
|
else if CheckFigureByClassName(FFigure, cTOrthoLine) then
|
|
begin
|
|
// c-ï
|
|
if TOrthoLine(FFigure).FIsRaiseUpDown then
|
|
begin
|
|
cbLineRaises.Enabled := True;
|
|
if TOrthoLine(FFigure) = aSCSObject then
|
|
cbLineRaises.Checked := True;
|
|
end
|
|
else
|
|
// Òðàññà
|
|
begin
|
|
cbLineTraces.Enabled := True;
|
|
if TOrthoLine(FFigure) = aSCSObject then
|
|
cbLineTraces.Checked := True;
|
|
end;
|
|
end;
|
|
end;
|
|
// ÂÛÂÅÑÒÈ ÑÂÎÉÑÒÂÀ ÄËß ÍÓÆÍÎÉ ÃÐÓÏÏÛ
|
|
if ShowModal = mrOK then
|
|
begin
|
|
// ãðóïïà
|
|
if cbConnObjects.Checked then
|
|
FObjectsTypeProp := otp_ConnObjects;
|
|
if cbConnConnectors.Checked then
|
|
FObjectsTypeProp := otp_ConnConnectors;
|
|
if cbConnRaises.Checked then
|
|
FObjectsTypeProp := otp_ConnRaises;
|
|
if cbLineTraces.Checked then
|
|
FObjectsTypeProp := otp_LineTraces;
|
|
if cbLineRaises.Checked then
|
|
FObjectsTypeProp := otp_LineRaises;
|
|
// íàéòè îáúåêò äàííîé ãðóïïû
|
|
FFigure := FindFirstByObjectsType(FObjectsTypeProp);
|
|
|
|
// îò íåãî ïîêàçàòü ñâîéñòâà
|
|
F_SCSObjectsProp.FObjectsTypeProp := FObjectsTypeProp;
|
|
if CheckFigureByClassName(FFigure, cTOrthoLine) then
|
|
begin
|
|
F_SCSObjectsProp.Show;
|
|
F_SCSObjectsProp.PageSCSObjects.ActivePageIndex := 1;
|
|
// åñëè ýòî ñ-ï
|
|
if TOrthoLine(FFigure).FIsRaiseUpDown then
|
|
F_SCSObjectsProp.OrtholinePropertiesForRaise
|
|
else
|
|
// åñëè ýòî òðàññà
|
|
F_SCSObjectsProp.OrtholinePropertiesForNormal;
|
|
F_SCSObjectsProp.LoadOrtholineProperties(TOrthoLine(FFigure));
|
|
F_SCSObjectsProp.bLineOK.Enabled := True;
|
|
end
|
|
else
|
|
if CheckFigureByClassName(FFigure, cTConnectorObject) then
|
|
begin
|
|
F_SCSObjectsProp.Show;
|
|
F_SCSObjectsProp.PageSCSObjects.ActivePageIndex := 0;
|
|
// åñëè ýòî âåðøèíà ñ-ï
|
|
if TConnectorObject(FFigure).FConnRaiseType <> crt_None then
|
|
F_SCSObjectsProp.ConnectorPropertiesForRaise
|
|
else
|
|
// åñëè ýòî îáû÷íûé îáúåêò (ÐÒ èëè ñîåäèíèòåëü)
|
|
F_SCSObjectsProp.ConnectorPropertiesForNormal(TConnectorObject(FFigure).ConnectorType);
|
|
F_SCSObjectsProp.LoadConnectorProperties(TConnectorObject(FFigure));
|
|
F_SCSObjectsProp.bConnOK.Enabled := True;
|
|
end;
|
|
end;
|
|
|
|
end;
|
|
except
|
|
on E: Exception do AddExceptionToLogEx('TF_ChooseSCSObjectsProp.Execute', E.Message);
|
|
end;
|
|
end;
|
|
|
|
function TF_ChooseSCSObjectsProp.FindFirstByObjectsType(aObjectsTypeProp: TObjectsTypeProp): TFigure;
|
|
var
|
|
i, j: Integer;
|
|
FFigure: TFigure;
|
|
begin
|
|
try
|
|
Result := nil;
|
|
if aObjectsTypeProp = otp_ConnObjects then
|
|
begin
|
|
for i := 0 to GCadForm.PCad.SelectedCount - 1 do
|
|
begin
|
|
FFigure := TFigure(GCadForm.PCad.Selection[i]);
|
|
if CheckFigureByClassName(FFigure, cTConnectorObject) then
|
|
if TConnectorObject(FFigure).FConnRaiseType = crt_None then
|
|
if TConnectorObject(FFigure).ConnectorType <> ct_Clear then
|
|
begin
|
|
Result := TConnectorObject(FFigure);
|
|
exit;
|
|
end;
|
|
end;
|
|
end;
|
|
if aObjectsTypeProp = otp_ConnConnectors then
|
|
begin
|
|
for i := 0 to GCadForm.PCad.SelectedCount - 1 do
|
|
begin
|
|
FFigure := TFigure(GCadForm.PCad.Selection[i]);
|
|
if CheckFigureByClassName(FFigure, cTConnectorObject) then
|
|
if TConnectorObject(FFigure).FConnRaiseType = crt_None then
|
|
if TConnectorObject(FFigure).ConnectorType = ct_Clear then
|
|
begin
|
|
Result := TConnectorObject(FFigure);
|
|
exit;
|
|
end;
|
|
end;
|
|
end;
|
|
if aObjectsTypeProp = otp_ConnRaises then
|
|
begin
|
|
for i := 0 to GCadForm.PCad.SelectedCount - 1 do
|
|
begin
|
|
FFigure := TFigure(GCadForm.PCad.Selection[i]);
|
|
if CheckFigureByClassName(FFigure, cTConnectorObject) then
|
|
if TConnectorObject(FFigure).FConnRaiseType <> crt_None then
|
|
begin
|
|
Result := TConnectorObject(FFigure);
|
|
exit;
|
|
end;
|
|
end;
|
|
end;
|
|
if aObjectsTypeProp = otp_LineTraces then
|
|
begin
|
|
for i := 0 to GCadForm.PCad.SelectedCount - 1 do
|
|
begin
|
|
FFigure := TFigure(GCadForm.PCad.Selection[i]);
|
|
if CheckFigureByClassName(FFigure, cTOrthoLine) then
|
|
if not TOrthoLine(FFigure).FIsRaiseUpDown then
|
|
begin
|
|
Result := TOrthoLine(FFigure);
|
|
exit;
|
|
end;
|
|
end;
|
|
end;
|
|
if aObjectsTypeProp = otp_LineRaises then
|
|
begin
|
|
for i := 0 to GCadForm.PCad.SelectedCount - 1 do
|
|
begin
|
|
FFigure := TFigure(GCadForm.PCad.Selection[i]);
|
|
if CheckFigureByClassName(FFigure, cTOrthoLine) then
|
|
if TOrthoLine(FFigure).FIsRaiseUpDown then
|
|
begin
|
|
Result := TOrthoLine(FFigure);
|
|
exit;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
except
|
|
on E: Exception do AddExceptionToLogEx('TF_ChooseSCSObjectsProp.FindFirstByObjectsType', E.Message);
|
|
end;
|
|
end;
|
|
|
|
procedure TF_ChooseSCSObjectsProp.FormKeyPress(Sender: TObject; var Key: Char);
|
|
begin
|
|
// if Key = #13 then
|
|
// begin
|
|
// bOK.SetFocus;
|
|
// bOK.Click;
|
|
// end;
|
|
if Key = #27 then
|
|
Close;
|
|
end;
|
|
|
|
end.
|