93 m_startX( aParent, m_startXLabel, m_startXCtrl, m_startXUnits ),
94 m_startY( aParent, m_startYLabel, m_startYCtrl, m_startYUnits ),
95 m_endX( aParent, m_endXLabel, m_endXCtrl, m_endXUnits ),
96 m_endY( aParent, m_endYLabel, m_endYCtrl, m_endYUnits ),
97 m_thickness( aParent, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits ),
98 m_segmentLength( aParent, m_segmentLengthLabel, m_segmentLengthCtrl, m_segmentLengthUnits ),
99 m_segmentAngle( aParent, m_segmentAngleLabel, m_segmentAngleCtrl, m_segmentAngleUnits ),
100 m_angle( aParent, m_angleLabel, m_angleCtrl, m_angleUnits ),
101 m_rectangleHeight( aParent, m_rectangleHeightLabel, m_rectangleHeightCtrl, m_rectangleHeightUnits ),
102 m_rectangleWidth( aParent, m_rectangleWidthLabel, m_rectangleWidthCtrl, m_rectangleWidthUnits ),
103 m_bezierCtrl1X( aParent, m_BezierPointC1XLabel, m_BezierC1X_Ctrl, m_BezierPointC1XUnit ),
104 m_bezierCtrl1Y( aParent, m_BezierPointC1YLabel, m_BezierC1Y_Ctrl, m_BezierPointC1YUnit ),
105 m_bezierCtrl2X( aParent, m_BezierPointC2XLabel, m_BezierC2X_Ctrl, m_BezierPointC2XUnit ),
106 m_bezierCtrl2Y( aParent, m_BezierPointC2YLabel, m_BezierC2Y_Ctrl, m_BezierPointC2YUnit ),
107 m_flipStartEnd( false )
142 for(
const auto& [ lineStyle, lineStyleDesc ] :
lineTypeNames )
214 wxCHECK_RET( aShape, wxT(
"ShowGraphicItemPropertiesDialog() error: NULL item" ) );
250 if( style == LINE_STYLE::DEFAULT )
251 style = LINE_STYLE::SOLID;
332 wxFAIL_MSG(
"Line type not found in the type lookup map" );
337 return DIALOG_SHAPE_PROPERTIES_BASE::TransferDataToWindow();
343 if( !DIALOG_SHAPE_PROPERTIES_BASE::TransferDataFromWindow() )
352 int segment_length = 0;
354 int rectangle_height = 0;
355 int rectangle_width = 0;
407 if( !( change_begin && change_end ) )
412 if( change_length || change_angle )
417 -
KiROUND( segment_length * segment_angle.
Cos() ) );
419 +
KiROUND( segment_length * segment_angle.
Sin() ) );
424 +
KiROUND( segment_length * segment_angle.
Cos() ) );
426 -
KiROUND( segment_length * segment_angle.
Sin() ) );
449 if( !( change_begin && change_end ) )
454 if( change_height || change_width )
515 commit.Push(
_(
"Edit Shape Properties" ) );
527 wxArrayString errors;
529 if( !DIALOG_SHAPE_PROPERTIES_BASE::Validate() )
538 errors.Add(
_(
"Arc angle cannot be zero." ) );
542 errors.Add( wxString::Format(
_(
"Invalid Arc with radius %f and angle %f." ),
552 double max_offset = std::max(
std::abs( center.
x ) + radius,
555 if( max_offset >= ( std::numeric_limits<VECTOR2I::coord_type>::max() / 2.0 )
556 || center == start || center == end )
558 errors.Add( wxString::Format(
_(
"Invalid Arc with radius %f and angle %f." ),
564 errors.Add(
_(
"Line width must be greater than zero." ) );
568 case SHAPE_T::CIRCLE:
571 errors.Add(
_(
"Radius must be greater than zero." ) );
574 errors.Add(
_(
"Line width must be greater than zero for an unfilled circle." ) );
578 case SHAPE_T::RECTANGLE:
581 errors.Add(
_(
"Rectangle cannot be empty." ) );
584 errors.Add(
_(
"Line width must be greater than zero for an unfilled rectangle." ) );
590 errors.Add(
_(
"Line width must be greater than zero for an unfilled polygon." ) );
594 case SHAPE_T::SEGMENT:
596 errors.Add(
_(
"Line width must be greater than zero." ) );
600 case SHAPE_T::BEZIER:
602 errors.Add(
_(
"Line width must be greater than zero for an unfilled curve." ) );
611 if( errors.GetCount() )
618 return errors.GetCount() == 0;
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
virtual void SetLocked(bool aLocked)
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
virtual bool IsLocked() const
virtual bool IsOnCopperLayer() const
const NETINFO_LIST & GetNetInfo() const
Class DIALOG_SHAPE_PROPERTIES_BASE.
wxStaticText * m_startPointLabel
wxGridBagSizer * m_sizerStartEnd
NET_SELECTOR * m_netSelector
wxStaticText * m_netLabel
wxGridBagSizer * m_sizerBezier
PCB_LAYER_BOX_SELECTOR * m_LayerSelectionCtrl
wxStaticText * m_endPointLabel
wxStaticText * m_lineStyleLabel
wxBitmapComboBox * m_lineStyleCombo
wxStaticText * m_endXLabel
wxCheckBox * m_filledCtrl
wxTextCtrl * m_startXCtrl
PCB_BASE_EDIT_FRAME * m_parent
UNIT_BINDER m_bezierCtrl1Y
DIALOG_SHAPE_PROPERTIES(SCH_BASE_FRAME *aParent, SCH_SHAPE *aShape)
~DIALOG_SHAPE_PROPERTIES()
UNIT_BINDER m_bezierCtrl1X
bool TransferDataToWindow() override
UNIT_BINDER m_rectangleHeight
UNIT_BINDER m_segmentLength
void onLayerSelection(wxCommandEvent &event) override
UNIT_BINDER m_rectangleWidth
void onFilledCheckbox(wxCommandEvent &event) override
UNIT_BINDER m_segmentAngle
bool TransferDataFromWindow() override
UNIT_BINDER m_bezierCtrl2Y
UNIT_BINDER m_bezierCtrl2X
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
EDA_ANGLE Round(int digits) const
FRAME_T GetFrameType() const
EDA_ANGLE GetArcAngle() const
const VECTOR2I & GetBezierC2() const
void SetBezierC2(const VECTOR2I &aPt)
void SetCenter(const VECTOR2I &aCenter)
void SetLength(const double &aLength)
void RebuildBezierToSegmentsPointsList(int aMinSegLen)
Rebuild the m_bezierPoints vertex list that approximate the Bezier curve by a list of segments.
int GetRectangleWidth() const
void SetFilled(bool aFlag)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
void SetRectangle(const long long int &aHeight, const long long int &aWidth)
void SetSegmentAngle(const EDA_ANGLE &aAngle)
void SetBezierC1(const VECTOR2I &aPt)
wxString SHAPE_T_asString() const
const VECTOR2I & GetBezierC1() const
int GetRectangleHeight() const
EDA_ANGLE GetSegmentAngle() const
static const TOOL_EVENT SelectedEvent
void ListSet(const wxString &aList)
Add a list of items.
int GetLayerSelection() const
int SetLayerSelection(int layer)
bool SetLayersHotkeys(bool value)
LSET is a set of PCB_LAYER_IDs.
static LSET ForbiddenFootprintLayers()
Layers which are not allowed within footprint definitions.
void SetNetInfo(const NETINFO_LIST *aNetInfoList)
void SetBoard(BOARD *aBoard)
void SetIndeterminateString(const wxString &aString)
void SetSelectedNetcode(int aNetcode)
Common, abstract interface for edit frames.
void ShowGraphicItemPropertiesDialog(PCB_SHAPE *aShape)
virtual PCB_LAYER_ID GetActiveLayer() const
The main frame for Pcbnew.
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
void SetNotAllowedLayerSet(LSET aMask)
int GetWidth() const override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
wxString GetFriendlyName() const override
STROKE_PARAMS GetStroke() const override
void SetStroke(const STROKE_PARAMS &aStroke) override
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Simple container to manage line stroke parameters.
void SetLineStyle(LINE_STYLE aLineStyle)
void SetWidth(int aWidth)
LINE_STYLE GetLineStyle() const
virtual long long int GetValue()
Return the current value in Internal Units.
virtual void SetPrecision(int aLength)
Normally not needed, but can be used to set the precision when using internal units that are floats (...
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
virtual EDA_ANGLE GetAngleValue()
virtual double GetDoubleValue()
Return the current value in Internal Units.
virtual void SetAngleValue(const EDA_ANGLE &aValue)
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void Show(bool aShow, bool aResize=false)
Show/hide the label, widget and units label.
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
static constexpr EDA_ANGLE ANGLE_0
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
static bool isCopper(const PNS::ITEM *aItem)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
LINE_STYLE
Dashed line types.
const VECTOR2I CalcArcCenter(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Determine the center of an arc or circle given three points on its circumference.
double EuclideanNorm(const VECTOR2I &vector)
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".