109 m_startX( aParent, m_startXLabel, m_startXCtrl, m_startXUnits ),
110 m_startY( aParent, m_startYLabel, m_startYCtrl, m_startYUnits ),
111 m_endX( aParent, m_endXLabel, m_endXCtrl, m_endXUnits ),
112 m_endY( aParent, m_endYLabel, m_endYCtrl, m_endYUnits ),
113 m_thickness( aParent, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits ),
114 m_segmentLength( aParent, m_segmentLengthLabel, m_segmentLengthCtrl, m_segmentLengthUnits ),
115 m_segmentAngle( aParent, m_segmentAngleLabel, m_segmentAngleCtrl, m_segmentAngleUnits ),
116 m_angle( aParent, m_angleLabel, m_angleCtrl, m_angleUnits ),
117 m_rectangleHeight( aParent, m_rectangleHeightLabel, m_rectangleHeightCtrl, m_rectangleHeightUnits ),
118 m_rectangleWidth( aParent, m_rectangleWidthLabel, m_rectangleWidthCtrl, m_rectangleWidthUnits ),
119 m_bezierCtrl1X( aParent, m_BezierPointC1XLabel, m_BezierC1X_Ctrl, m_BezierPointC1XUnit ),
120 m_bezierCtrl1Y( aParent, m_BezierPointC1YLabel, m_BezierC1Y_Ctrl, m_BezierPointC1YUnit ),
121 m_bezierCtrl2X( aParent, m_BezierPointC2XLabel, m_BezierC2X_Ctrl, m_BezierPointC2XUnit ),
122 m_bezierCtrl2Y( aParent, m_BezierPointC2YLabel, m_BezierC2Y_Ctrl, m_BezierPointC2YUnit ),
123 m_solderMaskMargin( aParent, m_solderMaskMarginLabel, m_solderMaskMarginCtrl, m_solderMaskMarginUnit ),
124 m_flipStartEnd( false )
162 for(
const auto& [ lineStyle, lineStyleDesc ] :
lineTypeNames )
248 wxCHECK_RET( aShape, wxT(
"ShowGraphicItemPropertiesDialog() error: NULL item" ) );
286 if( style == LINE_STYLE::DEFAULT )
287 style = LINE_STYLE::SOLID;
375 wxFAIL_MSG(
"Line type not found in the type lookup map" );
389 return DIALOG_SHAPE_PROPERTIES_BASE::TransferDataToWindow();
395 if( !DIALOG_SHAPE_PROPERTIES_BASE::TransferDataFromWindow() )
404 int segment_length = 0;
406 int rectangle_height = 0;
407 int rectangle_width = 0;
465 if( !( change_begin && change_end ) )
470 if( change_length || change_angle )
475 -
KiROUND( segment_length * segment_angle.
Cos() ) );
477 +
KiROUND( segment_length * segment_angle.
Sin() ) );
482 +
KiROUND( segment_length * segment_angle.
Cos() ) );
484 -
KiROUND( segment_length * segment_angle.
Sin() ) );
507 if( !( change_begin && change_end ) )
512 if( change_height || change_width )
581 commit.Push(
_(
"Edit Shape Properties" ) );
593 wxArrayString errors;
595 if( !DIALOG_SHAPE_PROPERTIES_BASE::Validate() )
604 errors.Add(
_(
"Arc angle cannot be zero." ) );
608 errors.Add( wxString::Format(
_(
"Invalid Arc with radius %f and angle %f." ),
617 double radius = ( center - start ).EuclideanNorm();
618 double max_offset = std::max(
std::abs( center.
x ) + radius,
621 if( max_offset >= ( std::numeric_limits<VECTOR2I::coord_type>::max() / 2.0 )
622 || center == start || center == end )
624 errors.Add( wxString::Format(
_(
"Invalid Arc with radius %f and angle %f." ),
630 errors.Add(
_(
"Line width must be greater than zero." ) );
634 case SHAPE_T::CIRCLE:
637 errors.Add(
_(
"Radius must be greater than zero." ) );
640 errors.Add(
_(
"Line width must be greater than zero for an unfilled circle." ) );
644 case SHAPE_T::RECTANGLE:
647 errors.Add(
_(
"Rectangle cannot be empty." ) );
650 errors.Add(
_(
"Line width must be greater than zero for an unfilled rectangle." ) );
656 errors.Add(
_(
"Line width must be greater than zero for an unfilled polygon." ) );
660 case SHAPE_T::SEGMENT:
662 errors.Add(
_(
"Line width must be greater than zero." ) );
666 case SHAPE_T::BEZIER:
668 errors.Add(
_(
"Line width must be greater than zero for an unfilled curve." ) );
677 if( errors.GetCount() )
684 return errors.GetCount() == 0;
constexpr int ARC_HIGH_DEF
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
BASE_SET & set(size_t pos)
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
virtual void SetLocked(bool aLocked)
virtual bool IsLocked() const
virtual bool IsOnCopperLayer() const
const NETINFO_LIST & GetNetInfo() const
Class DIALOG_SHAPE_PROPERTIES_BASE.
wxCheckBox * m_hasSolderMask
wxStaticText * m_startPointLabel
wxGridBagSizer * m_sizerStartEnd
NET_SELECTOR * m_netSelector
wxStaticText * m_netLabel
wxGridBagSizer * m_sizerBezier
wxStaticText * m_solderMaskMarginUnit
PCB_LAYER_BOX_SELECTOR * m_LayerSelectionCtrl
wxTextCtrl * m_solderMaskMarginCtrl
wxStaticText * m_endPointLabel
wxStaticText * m_lineStyleLabel
wxStaticText * m_techLayersLabel
wxStaticText * m_solderMaskMarginLabel
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)
UNIT_BINDER m_solderMaskMargin
~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 onTechLayersChanged(wxCommandEvent &event) override
void onFilledCheckbox(wxCommandEvent &event) override
UNIT_BINDER m_segmentAngle
void showHideTechLayers()
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_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
EDA_ANGLE GetArcAngle() const
const VECTOR2I & GetBezierC2() const
void SetBezierC2(const VECTOR2I &aPt)
void SetCenter(const VECTOR2I &aCenter)
void SetLength(const double &aLength)
int GetRectangleWidth() const
void SetFilled(bool aFlag)
void RebuildBezierToSegmentsPointsList(int aMaxError)
Rebuild the m_bezierPoints vertex list that approximate the Bezier curve by a list of segments.
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)
std::optional< int > GetLocalSolderMaskMargin() const
bool HasSolderMask() const
void SetHasSolderMask(bool aVal)
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
wxString GetFriendlyName() const override
STROKE_PARAMS GetStroke() const override
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
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.
bool IsNull() const
Return true if the control holds no value (ie: empty string, not 0).
static constexpr EDA_ANGLE ANGLE_0
#define IN_EDIT
Item currently edited.
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
bool IsExternalCopperLayer(int aLayerId)
Tests whether a layer is an external (F_Cu or B_Cu) copper layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
This file contains miscellaneous commonly used macros and functions.
#define UNIMPLEMENTED_FOR(type)
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
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.
#define INDETERMINATE_STATE
Used for holding indeterminate values, such as with multiple selections holding different values or c...
VECTOR2< int32_t > VECTOR2I