32 double aValue,
bool aDriving ) :
51 m_valueBinder->SetValue(
static_cast<long long int>( aValue ) );
103 if( degrees <= 0.0 || degrees >= 360.0 )
105 DisplayError(
this,
_(
"Enter an arc angle between 0 and 360 degrees." ) );
120 DisplayError(
this,
_(
"Enter a value greater than zero." ) );
124 return DIALOG_CONSTRAINT_VALUE_BASE::TransferDataFromWindow();
130 if( !aConstraint || !aConstraint->
HasValue() )
139 aCommit.
Modify( aConstraint );
146 [&](
BOARD_ITEM* aItem ) { aCommit.Modify( aItem ); } );
148 aCommit.
Push(
_(
"Edit Geometric Constraint" ) );
CONSTRAINT_DIAGNOSIS ApplyConstraintImmediately(BOARD *aBoard, const PCB_CONSTRAINT *aConstraint, std::vector< PCB_SHAPE * > *aModified, const std::function< void(BOARD_ITEM *)> &aBeforeModify)
Solve a just-created constraint's cluster so the geometry snaps to satisfy it (SolidWorks-style),...
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
wxStaticText * m_valueLabel
DIALOG_CONSTRAINT_VALUE_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Constraint Value"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE)
wxCheckBox * m_drivingCtrl
wxStaticText * m_valueUnits
Value entry for a dimensional geometric constraint (issue #2329): a UNIT_BINDER for the length (or an...
UNIT_BINDER * m_valueBinder
bool GetDriving() const
True if the constraint should drive (lock) the geometry; false for a reference dimension.
DIALOG_CONSTRAINT_VALUE(PCB_BASE_FRAME *aParent, PCB_CONSTRAINT_TYPE aType, double aValue, bool aDriving)
~DIALOG_CONSTRAINT_VALUE() override
double GetConstraintValue()
The entered value, in IU for a length/radius or in degrees for an angle.
bool TransferDataFromWindow() override
Veto an angle outside the closed [0, 180] degree corner-angle range.
void updateValueEnabled()
A reference (non-driving) constraint only measures, so its value is read-only.
PCB_CONSTRAINT_TYPE m_type
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
A geometric constraint between board items (issue #2329).
std::optional< double > GetValue() const
bool IsDriving() const
A driving constraint forces its value; a reference (non-driving) one only measures it.
PCB_CONSTRAINT_TYPE GetConstraintType() const
void SetValue(std::optional< double > aValue)
void SetDriving(bool aDriving)
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
bool EditConstraintValue(PCB_BASE_FRAME *aFrame, PCB_CONSTRAINT *aConstraint, BOARD_COMMIT &aCommit)
Show the value dialog for a valued constraint and stage the change in aCommit (the caller pushes).
bool ConstraintValueIsLength(PCB_CONSTRAINT_TYPE aType)
True if this type's value is a length in IU (serialized in mm); false for an angle in degrees.
PCB_CONSTRAINT_TYPE
The geometric relationship a PCB_CONSTRAINT enforces between its members.
@ ARC_ANGLE
An arc has a driving or reference swept-angle value.