31 #include <wx/valnum.h> 80 void onLayer( wxCommandEvent& event )
override;
86 m_startX( aParent, m_startXLabel, m_startXCtrl, m_startXUnits ),
87 m_startY( aParent, m_startYLabel, m_startYCtrl, m_startYUnits ),
88 m_endX( aParent, m_endXLabel, m_endXCtrl, m_endXUnits ),
89 m_endY( aParent, m_endYLabel, m_endYCtrl, m_endYUnits ),
90 m_angle( aParent, m_angleLabel, m_angleCtrl, m_angleUnits ),
91 m_thickness( aParent, m_thicknessLabel, m_thicknessCtrl, m_thicknessUnits, true ),
92 m_bezierCtrl1X( aParent, m_BezierPointC1XLabel, m_BezierC1X_Ctrl, m_BezierPointC1XUnit ),
93 m_bezierCtrl1Y( aParent, m_BezierPointC1YLabel, m_BezierC1Y_Ctrl, m_BezierPointC1YUnit ),
94 m_bezierCtrl2X( aParent, m_BezierPointC2XLabel, m_BezierC2X_Ctrl, m_BezierPointC2XUnit ),
95 m_bezierCtrl2Y( aParent, m_BezierPointC2YLabel, m_BezierC2Y_Ctrl, m_BezierPointC2YUnit ),
96 m_flipStartEnd( false ),
97 m_AngleValidator( 1, &m_AngleValue ),
101 m_item = dynamic_cast<PCB_SHAPE*>( aItem );
102 m_fp_item = dynamic_cast<FP_SHAPE*>( aItem );
120 m_locked->Show( dynamic_cast<PCB_EDIT_FRAME*>( aParent ) !=
nullptr );
146 wxCHECK_RET( aItem !=
NULL, wxT(
"ShowGraphicItemPropertiesDialog() error: NULL item" ) );
177 SetTitle(
_(
"Circle Properties" ) );
190 SetTitle(
_(
"Arc Properties" ) );
201 SetTitle(
_(
"Polygon Properties" ) );
214 SetTitle(
_(
"Rectangle Properties" ) );
225 SetTitle(
_(
"Line Segment Properties" ) );
282 return DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataToWindow();
288 if( !DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::TransferDataFromWindow() )
296 DisplayError(
this,
_(
"Line width may not be 0 for unfilled shapes." ) );
373 commit.
Push(
_(
"Modify drawing properties" ) );
392 if( !graphicPolygonsLayers.
Contains(
401 wxArrayString error_msgs;
403 if( !DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::Validate() )
412 error_msgs.Add(
_(
"The arc angle cannot be zero." ) );
419 error_msgs.Add(
_(
"The radius cannot be zero." ) );
425 error_msgs.Add(
_(
"The rectangle cannot be empty." ) );
434 wxASSERT_MSG(
false,
"DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate not implemented for shape" 439 if( error_msgs.GetCount() )
446 return error_msgs.GetCount() == 0;
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
wxPoint GetArcEnd() const
COMMIT & Modify(EDA_ITEM *aItem)
Create an undo entry for an item that has been already modified.
wxStaticText * m_startPointLabel
void SetEnd0(const wxPoint &aPoint)
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
void SetBezControl2(const wxPoint &aPoint)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
This file is part of the common library.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
static LSET ForbiddenFootprintLayers()
Layers which are not allowed within footprint definitions.
void SetNotAllowedLayerSet(LSET aMask)
wxStaticText * m_endPointLabel
void SetFilled(bool aFlag)
UNIT_BINDER m_bezierCtrl2Y
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
void SetBezier0_C1(const wxPoint &aPoint)
bool Contains(PCB_LAYER_ID aLayer)
See if the layer set contains a PCB layer.
polygon (not yet used for tracks, but could be in microwave apps)
bool TransferDataFromWindow() override
wxStaticText * m_bezierCtrlPt2Label
static wxString ShowShape(PCB_SHAPE_TYPE_T aShape)
Convert the enum PCB_SHAPE_TYPE_T integer value to a wxString.
usual segment : line with rounded ends
~DIALOG_GRAPHIC_ITEM_PROPERTIES()
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
segment with non rounded ends
UNIT_BINDER m_bezierCtrl1Y
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetBezier0_C2(const wxPoint &aPoint)
wxFloatingPointValidator< double > m_AngleValidator
wxTextCtrl * m_startXCtrl
wxPoint GetArcStart() const
wxCheckBox * m_filledCtrl
LAYER_NUM GetLayerSelection() const
wxTextCtrl * m_thicknessCtrl
void Show(bool aShow, bool aResize=false)
Show/hide the label, widget and units label.
LSET is a set of PCB_LAYER_IDs.
UNIT_BINDER m_bezierCtrl2X
UNIT_BINDER m_bezierCtrl1X
void ListSet(const wxString &aList)
Add a list of items.
PCB_BASE_EDIT_FRAME * m_parent
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
PCB_LAYER_BOX_SELECTOR * m_LayerSelectionCtrl
wxStaticText * m_bezierCtrlPt1Label
int SetLayerSelection(LAYER_NUM layer)
static LSET AllLayersMask()
void SetCenter(const wxPoint &aCenterPoint)
For arcs and circles:
DIALOG_GRAPHIC_ITEM_PROPERTIES(PCB_BASE_EDIT_FRAME *aParent, BOARD_ITEM *aItem)
void SetBezControl1(const wxPoint &aPoint)
bool SetLayersHotkeys(bool value)
void SetStart0(const wxPoint &aPoint)
int LAYER_NUM
This can be replaced with int and removed.
void onLayer(wxCommandEvent &event) override
wxStaticText * m_endXLabel
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
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...
void ShowGraphicItemPropertiesDialog(BOARD_ITEM *aItem)
virtual bool IsLocked() const
wxButton * m_StandardButtonsSizerOK
virtual bool Validate(double aMin, double aMax, EDA_UNITS aUnits=EDA_UNITS::UNSCALED)
Validate the control against the given range, informing the user of any errors found.
Common, abstract interface for edit frames.
const wxPoint & GetBezControl2() const
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
bool TransferDataToWindow() override
void SetWidth(int aWidth)
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Revert the commit by restoring the modified items state.
void RebuildBezierToSegmentsPointsList(int aMinSegLen)
Rebuild the m_BezierPoints vertex list that approximate the Bezier curve by a list of segments Has me...
void SetArcEnd(const wxPoint &aArcEndPoint)
Initialize the end arc point.
virtual long long int GetValue()
Return the current value in Internal Units.
wxGridBagSizer * m_sizerLeft
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
PCB_SHAPE_TYPE_T GetShape() const
Class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE.
const VECTOR2I GetArcCenter(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Determine the center of an arc or circle given three points on its circumference.
virtual void SetAngle(double aAngle, bool aUpdateEnd=true)
Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
static constexpr int Millimeter2iu(double mm)
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
const wxPoint & GetBezControl1() const
PCB_LAYER_ID ToLAYER_ID(int aLayer)
void SetEnd(const wxPoint &aEnd)
void SetArcStart(const wxPoint &aArcStartPoint)
Initialize the start arc point.
void OnInitDlg(wxInitDialogEvent &event) override
virtual void UpdateMsgPanel()
Redraw the message panel.