88 m_startX( aParent, m_startXLabel, m_startXCtrl, m_startXUnits ),
89 m_startY( aParent, m_startYLabel, m_startYCtrl, m_startYUnits ),
90 m_endX( aParent, m_endXLabel, m_endXCtrl, m_endXUnits ),
91 m_endY( aParent, m_endYLabel, m_endYCtrl, m_endYUnits ),
92 m_angle( aParent, m_angleLabel, m_angleCtrl, m_angleUnits ),
93 m_thickness( aParent, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits ),
94 m_bezierCtrl1X( aParent, m_BezierPointC1XLabel, m_BezierC1X_Ctrl, m_BezierPointC1XUnit ),
95 m_bezierCtrl1Y( aParent, m_BezierPointC1YLabel, m_BezierC1Y_Ctrl, m_BezierPointC1YUnit ),
96 m_bezierCtrl2X( aParent, m_BezierPointC2XLabel, m_BezierC2X_Ctrl, m_BezierPointC2XUnit ),
97 m_bezierCtrl2Y( aParent, m_BezierPointC2YLabel, m_BezierC2Y_Ctrl, m_BezierPointC2YUnit ),
98 m_flipStartEnd( false )
131 for(
const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry :
lineTypeNames )
148 wxCHECK_RET( aItem != NULL, wxT(
"ShowGraphicItemPropertiesDialog() error: NULL item" ) );
211 SetTitle(
_(
"Circle Properties" ) );
224 SetTitle(
_(
"Arc Properties" ) );
230 SetTitle(
_(
"Polygon Properties" ) );
236 SetTitle(
_(
"Rectangle Properties" ) );
242 SetTitle(
_(
"Line Segment Properties" ) );
253 SetTitle(
_(
"Curve Properties" ) );
305 wxFAIL_MSG(
"Line type not found in the type lookup map" );
309 return DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataToWindow();
315 if( !DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataFromWindow() )
405 commit.
Push(
_(
"Modify drawing properties" ) );
417 wxArrayString errors;
419 if( !DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::Validate() )
428 errors.Add(
_(
"Arc angle cannot be zero." ) );
442 double max_offset = std::max(
std::abs( center.
x ) + radius,
445 if( max_offset >= ( std::numeric_limits<VECTOR2I::coord_type>::max() / 2.0 )
446 || center == start || center == end )
454 errors.Add(
_(
"Line width must be greater than zero." ) );
461 errors.Add(
_(
"Radius must be greater than zero." ) );
464 errors.Add(
_(
"Line width must be greater than zero for an unfilled circle." ) );
471 errors.Add(
_(
"Rectangle cannot be empty." ) );
474 errors.Add(
_(
"Line width must be greater than zero for an unfilled rectangle." ) );
480 errors.Add(
_(
"Line width must be greater than zero for an unfilled polygon." ) );
486 errors.Add(
_(
"Line width must be greater than zero." ) );
492 errors.Add(
_(
"Line width must be greater than zero for an unfilled curve." ) );
501 if( errors.GetCount() )
508 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...
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual STROKE_PARAMS GetStroke() const
virtual void SetLocked(bool aLocked)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
virtual bool IsLocked() const
virtual bool IsOnLayer(PCB_LAYER_ID aLayer, bool aIncludeCourtyards=false) const
Test to see if this object is on the given layer.
COMMIT & Modify(EDA_ITEM *aItem)
Create an undo entry for an item that has been already modified.
Class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE.
wxTextCtrl * m_startXCtrl
wxStaticText * m_bezierCtrlPt2Label
wxStaticText * m_startPointLabel
wxCheckBox * m_filledCtrl
wxStaticText * m_endPointLabel
wxGridBagSizer * m_sizerLeft
wxBitmapComboBox * m_lineStyleCombo
wxStaticText * m_lineStyleLabel
PCB_LAYER_BOX_SELECTOR * m_LayerSelectionCtrl
wxStaticText * m_endXLabel
wxStaticText * m_bezierCtrlPt1Label
void onFilledCheckbox(wxCommandEvent &event) override
~DIALOG_GRAPHIC_ITEM_PROPERTIES()
UNIT_BINDER m_bezierCtrl2X
DIALOG_GRAPHIC_ITEM_PROPERTIES(PCB_BASE_EDIT_FRAME *aParent, BOARD_ITEM *aItem)
bool TransferDataFromWindow() override
UNIT_BINDER m_bezierCtrl1X
bool TransferDataToWindow() override
UNIT_BINDER m_bezierCtrl2Y
void OnInitDlg(wxInitDialogEvent &event) override
UNIT_BINDER m_bezierCtrl1Y
PCB_BASE_EDIT_FRAME * m_parent
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 GetArcAngle() const
const VECTOR2I & GetBezierC2() const
void SetBezierC2(const VECTOR2I &aPt)
void SetCenter(const VECTOR2I &aCenter)
void RebuildBezierToSegmentsPointsList(int aMinSegLen)
Rebuild the m_bezierPoints vertex list that approximate the Bezier curve by a list of segments.
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 SetEnd(const VECTOR2I &aEnd)
void SetBezierC1(const VECTOR2I &aPt)
wxString SHAPE_T_asString() const
const VECTOR2I & GetBezierC1() const
static const TOOL_EVENT SelectedEvent
void SetEnd0(const VECTOR2I &aPoint)
void SetStart0(const VECTOR2I &aPoint)
void SetBezierC2_0(const VECTOR2I &aPoint)
void SetCenter0(const VECTOR2I &aPt)
void SetBezierC1_0(const VECTOR2I &aPoint)
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.
Common, abstract interface for edit frames.
void ShowGraphicItemPropertiesDialog(BOARD_ITEM *aItem)
virtual PCB_LAYER_ID GetActiveLayer() const
The main frame for Pcbnew.
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
void SetNotAllowedLayerSet(LSET aMask)
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
STROKE_PARAMS GetStroke() const override
void SetStroke(const STROKE_PARAMS &aStroke) override
Simple container to manage line stroke parameters.
void SetWidth(int aWidth)
PLOT_DASH_TYPE GetPlotStyle() const
void SetPlotStyle(PLOT_DASH_TYPE aPlotStyle)
virtual long long int GetValue()
Return the current value in Internal Units.
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.
This file is part of the common library.
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)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
PLOT_DASH_TYPE
Dashed line types.
const std::map< PLOT_DASH_TYPE, struct lineTypeStruct > lineTypeNames
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)