91 m_startX( aParent, m_startXLabel, m_startXCtrl, m_startXUnits ),
92 m_startY( aParent, m_startYLabel, m_startYCtrl, m_startYUnits ),
93 m_endX( aParent, m_endXLabel, m_endXCtrl, m_endXUnits ),
94 m_endY( aParent, m_endYLabel, m_endYCtrl, m_endYUnits ),
95 m_thickness( aParent, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits ),
96 m_segmentLength( aParent, m_segmentLengthLabel, m_segmentLengthCtrl, m_segmentLengthUnits ),
97 m_segmentAngle( aParent, m_segmentAngleLabel, m_segmentAngleCtrl, m_segmentAngleUnits ),
98 m_angle( aParent, m_angleLabel, m_angleCtrl, m_angleUnits ),
99 m_rectangleHeight( aParent, m_rectangleHeightLabel, m_rectangleHeightCtrl, m_rectangleHeightUnits ),
100 m_rectangleWidth( aParent, m_rectangleWidthLabel, m_rectangleWidthCtrl, m_rectangleWidthUnits ),
101 m_bezierCtrl1X( aParent, m_BezierPointC1XLabel, m_BezierC1X_Ctrl, m_BezierPointC1XUnit ),
102 m_bezierCtrl1Y( aParent, m_BezierPointC1YLabel, m_BezierC1Y_Ctrl, m_BezierPointC1YUnit ),
103 m_bezierCtrl2X( aParent, m_BezierPointC2XLabel, m_BezierC2X_Ctrl, m_BezierPointC2XUnit ),
104 m_bezierCtrl2Y( aParent, m_BezierPointC2YLabel, m_BezierC2Y_Ctrl, m_BezierPointC2YUnit ),
105 m_flipStartEnd( false )
140 for(
const auto& [ lineStyle, lineStyleDesc ] :
lineTypeNames )
216 wxCHECK_RET( aShape, wxT(
"ShowGraphicItemPropertiesDialog() error: NULL item" ) );
253 if( style == LINE_STYLE::DEFAULT )
254 style = LINE_STYLE::SOLID;
335 wxFAIL_MSG(
"Line type not found in the type lookup map" );
339 return DIALOG_SHAPE_PROPERTIES_BASE::TransferDataToWindow();
345 if( !DIALOG_SHAPE_PROPERTIES_BASE::TransferDataFromWindow() )
354 int segment_length = 0;
356 int rectangle_height = 0;
357 int rectangle_width = 0;
409 if( !( change_begin && change_end ) )
414 if( change_length || change_angle )
419 -
KiROUND( segment_length * segment_angle.
Cos() ) );
421 +
KiROUND( segment_length * segment_angle.
Sin() ) );
426 +
KiROUND( segment_length * segment_angle.
Cos() ) );
428 -
KiROUND( segment_length * segment_angle.
Sin() ) );
451 if( !( change_begin && change_end ) )
456 if( change_height || change_width )
517 commit.Push(
_(
"Modify drawing properties" ) );
529 wxArrayString errors;
531 if( !DIALOG_SHAPE_PROPERTIES_BASE::Validate() )
540 errors.Add(
_(
"Arc angle cannot be zero." ) );
544 errors.Add( wxString::Format(
_(
"Invalid Arc with radius %f and angle %f." ),
554 double max_offset = std::max(
std::abs( center.
x ) + radius,
557 if( max_offset >= ( std::numeric_limits<VECTOR2I::coord_type>::max() / 2.0 )
558 || center == start || center == end )
560 errors.Add( wxString::Format(
_(
"Invalid Arc with radius %f and angle %f." ),
566 errors.Add(
_(
"Line width must be greater than zero." ) );
570 case SHAPE_T::CIRCLE:
573 errors.Add(
_(
"Radius must be greater than zero." ) );
576 errors.Add(
_(
"Line width must be greater than zero for an unfilled circle." ) );
580 case SHAPE_T::RECTANGLE:
583 errors.Add(
_(
"Rectangle cannot be empty." ) );
586 errors.Add(
_(
"Line width must be greater than zero for an unfilled rectangle." ) );
592 errors.Add(
_(
"Line width must be greater than zero for an unfilled polygon." ) );
596 case SHAPE_T::SEGMENT:
598 errors.Add(
_(
"Line width must be greater than zero." ) );
602 case SHAPE_T::BEZIER:
604 errors.Add(
_(
"Line width must be greater than zero for an unfilled curve." ) );
613 if( errors.GetCount() )
620 return errors.GetCount() == 0;
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
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()
UNIT_BINDER m_bezierCtrl1X
bool TransferDataToWindow() override
DIALOG_SHAPE_PROPERTIES(SCH_EDIT_FRAME *aParent, SCH_SHAPE *aShape)
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 SetEnd(const VECTOR2I &aEnd)
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
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)
#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".