KiCad PCB EDA Suite
DIALOG_PAD_PROPERTIES Class Reference

class DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder More...

#include <dialog_pad_properties.h>

Inheritance diagram for DIALOG_PAD_PROPERTIES:
DIALOG_PAD_PROPERTIES_BASE DIALOG_SHIM KIWAY_HOLDER

Public Types

enum  HOLDER_TYPE { DIALOG, FRAME, PANEL, SCREEN }
 

Public Member Functions

 DIALOG_PAD_PROPERTIES (PCB_BASE_FRAME *aParent, D_PAD *aPad)
 
 ~DIALOG_PAD_PROPERTIES ()
 
void SetInitialFocus (wxWindow *aWindow)
 Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown. More...
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal ()
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
EDA_UNITS_T GetUserUnits () const
 
HOLDER_TYPE GetType ()
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Static Public Member Functions

static bool IsCtrl (int aChar, const wxKeyEvent &e)
 
static bool IsShiftCtrl (int aChar, const wxKeyEvent &e)
 

Protected Types

enum  { wxID_DIALOG_EDIT_PAD = 1000, wxID_PADNUMCTRL }
 

Protected Member Functions

void FinishDialogSettings ()
 In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls. More...
 
void SetSizeInDU (int x, int y)
 Set the dialog to the given dimensions in "dialog units". More...
 
int HorizPixelsFromDU (int x)
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int VertPixelsFromDU (int y)
 Convert an integer number of dialog units to pixels, vertically. More...
 

Protected Attributes

wxNotebook * m_notebook
 
wxPanel * m_panelGeneral
 
wxStaticText * m_PadNumText
 
wxTextCtrl * m_PadNumCtrl
 
wxStaticText * m_PadNameText
 
NET_SELECTORm_PadNetSelector
 
wxStaticText * m_staticText44
 
wxChoice * m_PadType
 
wxStaticText * m_staticText45
 
wxChoice * m_PadShape
 
wxStaticText * m_posXLabel
 
wxTextCtrl * m_posXCtrl
 
wxStaticText * m_posXUnits
 
wxStaticText * m_posYLabel
 
wxTextCtrl * m_posYCtrl
 
wxStaticText * m_posYUnits
 
wxStaticText * m_sizeXLabel
 
wxTextCtrl * m_sizeXCtrl
 
wxStaticText * m_sizeXUnits
 
wxStaticText * m_sizeYLabel
 
wxTextCtrl * m_sizeYCtrl
 
wxStaticText * m_sizeYUnits
 
wxStaticText * m_PadOrientText
 
wxComboBox * m_orientation
 
wxStaticText * m_staticText491
 
wxStaticText * m_offsetXLabel
 
wxTextCtrl * m_offsetXCtrl
 
wxStaticText * m_offsetXUnits
 
wxStaticText * m_offsetYLabel
 
wxTextCtrl * m_offsetYCtrl
 
wxStaticText * m_offsetYUnits
 
wxStaticText * m_trapDeltaLabel
 
wxTextCtrl * m_trapDeltaCtrl
 
wxStaticText * m_trapDeltaUnits
 
wxStaticText * m_trapAxisLabel
 
wxChoice * m_trapAxisCtrl
 
wxStaticText * m_staticTextCornerSizeRatio
 
TEXT_CTRL_EVALm_tcCornerSizeRatio
 
wxStaticText * m_staticTextCornerSizeRatioUnit
 
wxStaticText * m_cornerRadiusLabel
 
wxTextCtrl * m_tcCornerRadius
 
wxStaticText * m_cornerRadiusUnits
 
wxStaticText * m_staticTextChamferRatio
 
TEXT_CTRL_EVALm_tcChamferRatio
 
wxStaticText * m_staticTextChamferRatioUnit
 
wxStaticText * m_staticTextChamferCorner
 
wxCheckBox * m_cbTopLeft
 
wxCheckBox * m_cbTopRight
 
wxCheckBox * m_cbBottomLeft
 
wxCheckBox * m_cbBottomRight
 
wxBoxSizer * m_middleBoxSizer
 
wxStaticText * m_holeShapeLabel
 
wxChoice * m_holeShapeCtrl
 
wxStaticText * m_staticText51
 
wxStaticText * m_holeXLabel
 
wxTextCtrl * m_holeXCtrl
 
wxStaticText * m_holeXUnits
 
wxStaticText * m_holeYLabel
 
wxTextCtrl * m_holeYCtrl
 
wxStaticText * m_holeYUnits
 
wxStaticText * m_padToDieLabel
 
wxTextCtrl * m_padToDieCtrl
 
wxStaticText * m_padToDieUnits
 
wxBoxSizer * m_FlippedWarningSizer
 
wxStaticBitmap * m_FlippedWarningIcon
 
wxStaticText * m_staticText86
 
wxStaticText * m_staticText511
 
wxChoice * m_rbCopperLayersSel
 
wxStaticText * m_techLayersLabel
 
wxCheckBox * m_PadLayerAdhCmp
 
wxCheckBox * m_PadLayerAdhCu
 
wxCheckBox * m_PadLayerPateCmp
 
wxCheckBox * m_PadLayerPateCu
 
wxCheckBox * m_PadLayerSilkCmp
 
wxCheckBox * m_PadLayerSilkCu
 
wxCheckBox * m_PadLayerMaskCmp
 
wxCheckBox * m_PadLayerMaskCu
 
wxCheckBox * m_PadLayerDraft
 
wxCheckBox * m_PadLayerECO1
 
wxCheckBox * m_PadLayerECO2
 
wxPanel * m_localSettingsPanel
 
wxStaticText * m_staticTextInfoPosValue
 
wxStaticText * m_staticTextInfoNegVal
 
wxStaticText * m_clearanceLabel
 
wxTextCtrl * m_clearanceCtrl
 
wxStaticText * m_clearanceUnits
 
wxStaticText * m_maskClearanceLabel
 
wxTextCtrl * m_maskClearanceCtrl
 
wxStaticText * m_maskClearanceUnits
 
wxStaticText * m_pasteClearanceLabel
 
wxTextCtrl * m_pasteClearanceCtrl
 
wxStaticText * m_pasteClearanceUnits
 
wxStaticText * m_staticTextRatio
 
TEXT_CTRL_EVALm_SolderPasteMarginRatioCtrl
 
wxStaticText * m_SolderPasteRatioMarginUnits
 
wxSimplebook * m_nonCopperWarningBook
 
wxStaticText * m_nonCopperNote
 
wxStaticText * m_staticTextInfoPaste
 
wxStaticBitmap * m_nonCopperWarningIcon
 
wxStaticText * m_nonCopperWarningText
 
wxStaticBoxSizer * m_sbSizerZonesSettings
 
wxStaticText * m_staticText40
 
wxChoice * m_ZoneConnectionChoice
 
wxStaticText * m_spokeWidthLabel
 
wxTextCtrl * m_spokeWidthCtrl
 
wxStaticText * m_spokeWidthUnits
 
wxStaticText * m_thermalGapLabel
 
wxTextCtrl * m_thermalGapCtrl
 
wxStaticText * m_thermalGapUnits
 
wxStaticText * m_staticTextcps
 
wxChoice * m_ZoneCustomPadShape
 
wxPanel * m_panelCustomShapePrimitives
 
wxBoxSizer * m_bSizerPanelPrimitives
 
wxStaticText * m_staticTextPrimitivesList
 
wxStaticText * m_staticTextPrimitiveListWarning
 
wxListView * m_listCtrlPrimitives
 
wxButton * m_buttonDel
 
wxButton * m_buttonEditShape
 
wxButton * m_buttonAddShape
 
wxButton * m_buttonDup
 
wxButton * m_buttonGeometry
 
wxStaticText * m_parentInfoLine1
 
wxStaticText * m_parentInfoLine2
 
wxPanel * m_panelShowPad
 
PCB_DRAW_PANEL_GALm_panelShowPadGal
 
KIGFX::GAL_DISPLAY_OPTIONS m_galOptions
 
wxCheckBox * m_cbShowPadOutline
 
wxStaticLine * m_staticline13
 
wxStdDialogButtonSizer * m_sdbSizer
 
wxButton * m_sdbSizerOK
 
wxButton * m_sdbSizerCancel
 
EDA_UNITS_T m_units
 
std::string m_hash_key
 
bool m_firstPaintEvent
 
wxWindow * m_initialFocusTarget
 
WX_EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 
std::vector< wxWindow * > m_tabOrder
 

Private Member Functions

void prepareCanvas ()
 
void initValues ()
 
void displayPrimitivesList ()
 
bool padValuesOK ()
 test if all values are acceptable for the pad More...
 
void redraw ()
 
void editPrimitive ()
 
void updateRoundRectCornerValues ()
 
void enablePrimitivePage (bool aEnable)
 enable (or disable) the primitive page editor More...
 
void setPadLayersList (LSET layer_mask)
 Function setPadLayersList updates the CheckBox states in pad layers list,. More...
 
bool transferDataToPad (D_PAD *aPad)
 Copy values from dialog field to aPad's members. More...
 
void OnInitDialog (wxInitDialogEvent &event) override
 
void OnResize (wxSizeEvent &event)
 
void OnCancel (wxCommandEvent &event) override
 
void OnUpdateUI (wxUpdateUIEvent &event) override
 
void OnUpdateUINonCopperWarning (wxUpdateUIEvent &event) override
 
void OnPadShapeSelection (wxCommandEvent &event) override
 
void OnDrillShapeSelected (wxCommandEvent &event) override
 
void onChangePadMode (wxCommandEvent &event) override
 
void PadOrientEvent (wxCommandEvent &event) override
 
void PadTypeSelected (wxCommandEvent &event) override
 
void OnSetLayers (wxCommandEvent &event) override
 
void OnPaintShowPanel (wxPaintEvent &event) override
 
void onCornerSizePercentChange (wxCommandEvent &event) override
 
void onCornerRadiusChange (wxCommandEvent &event) override
 
void OnValuesChanged (wxCommandEvent &event) override
 Called when a dimension has changed. More...
 
bool TransferDataFromWindow () override
 Updates the different parameters for the component being edited. More...
 
bool TransferDataToWindow () override
 
void onDeletePrimitive (wxCommandEvent &event) override
 Event handlers of basic shapes list panel. More...
 
void onEditPrimitive (wxCommandEvent &event) override
 
void onAddPrimitive (wxCommandEvent &event) override
 
void onGeometryTransform (wxCommandEvent &event) override
 
void onDuplicatePrimitive (wxCommandEvent &event) override
 
void onPrimitiveDClick (wxMouseEvent &event) override
 Called on a double click on the basic shapes list. More...
 
void OnPrimitiveSelection (wxListEvent &event) override
 Called on selection/deselection of a basic shape. More...
 

Private Attributes

PCB_BASE_FRAMEm_parent
 
D_PADm_currentPad
 
D_PADm_dummyPad
 
D_PADm_padMaster
 
BOARDm_board
 
bool m_isFlipped
 
bool m_canUpdate
 
bool m_canEditNetName
 
std::vector< PAD_CS_PRIMITIVEm_primitives
 
COLOR4D m_selectedColor
 
std::vector< DRAWSEGMENT * > m_highlight
 
KIGFX::ORIGIN_VIEWITEMm_axisOrigin
 
UNIT_BINDER m_posX
 
UNIT_BINDER m_posY
 
UNIT_BINDER m_sizeX
 
UNIT_BINDER m_sizeY
 
UNIT_BINDER m_offsetX
 
UNIT_BINDER m_offsetY
 
UNIT_BINDER m_padToDie
 
UNIT_BINDER m_trapDelta
 
UNIT_BINDER m_cornerRadius
 
UNIT_BINDER m_holeX
 
UNIT_BINDER m_holeY
 
wxFloatingPointValidator< double > m_OrientValidator
 
double m_OrientValue
 
UNIT_BINDER m_clearance
 
UNIT_BINDER m_maskClearance
 
UNIT_BINDER m_pasteClearance
 
UNIT_BINDER m_spokeWidth
 
UNIT_BINDER m_thermalGap
 

Static Private Attributes

static bool m_sketchPreview = false
 

Detailed Description

class DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder

Definition at line 47 of file dialog_pad_properties.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protectedinherited

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 
SCREEN 

Definition at line 42 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ DIALOG_PAD_PROPERTIES()

DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES ( PCB_BASE_FRAME aParent,
D_PAD aPad 
)

Definition at line 104 of file dialog_pad_properties.cpp.

104  :
105  DIALOG_PAD_PROPERTIES_BASE( aParent ),
106  m_parent( aParent ),
107  m_canUpdate( false ),
110  m_sizeX( aParent, m_sizeXLabel, m_sizeXCtrl, m_sizeXUnits, true ),
111  m_sizeY( aParent, m_sizeYLabel, m_sizeYCtrl, m_sizeYUnits, true ),
117  m_holeX( aParent, m_holeXLabel, m_holeXCtrl, m_holeXUnits, true ),
118  m_holeY( aParent, m_holeYLabel, m_holeYCtrl, m_holeYUnits, true ),
125 {
126  m_currentPad = aPad; // aPad can be NULL, if the dialog is called
127  // from the footprint editor to set default pad setup
128 
130 
132 
133  m_OrientValidator.SetRange( -360.0, 360.0 );
134  m_orientation->SetValidator( m_OrientValidator );
135  m_OrientValidator.SetWindow( m_orientation );
136 
137  m_cbShowPadOutline->SetValue( m_sketchPreview );
138 
139  m_FlippedWarningIcon->SetBitmap( KiBitmap( dialog_warning_xpm ) );
140  m_nonCopperWarningIcon->SetBitmap( KiBitmap( dialog_warning_xpm ) );
141 
143  m_dummyPad = new D_PAD( (MODULE*) NULL );
144 
145  if( aPad )
146  {
147  *m_dummyPad = *aPad;
149  }
150  else // We are editing a "master" pad, i.e. a template to create new pads
152 
153  initValues();
154 
155  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
156  infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
157  m_techLayersLabel->SetFont( infoFont );
158  m_parentInfoLine1->SetFont( infoFont );
159  m_parentInfoLine2->SetFont( infoFont );
160  m_nonCopperNote->SetFont( infoFont );
161  m_staticTextInfoPaste->SetFont( infoFont );
162 
163  infoFont.SetStyle( wxFONTSTYLE_ITALIC );
164  m_staticTextInfoNegVal->SetFont( infoFont );
165  m_staticTextInfoPosValue->SetFont( infoFont );
166 
167  // Usually, TransferDataToWindow is called by OnInitDialog
168  // calling it here fixes all widget sizes so FinishDialogSettings can safely fix minsizes
170 
171  // Initialize canvas to be able to display the dummy pad:
172  prepareCanvas();
173 
175  m_sdbSizerOK->SetDefault();
176  m_canUpdate = true;
177 
178  m_PadNetSelector->Connect( NET_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES::OnValuesChanged ), NULL, this );
179 
180  // Now all widgets have the size fixed, call FinishDialogSettings
182 }
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
wxFloatingPointValidator< double > m_OrientValidator
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:118
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
#define SELECTED
Definition: base_struct.h:127
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
void SetNetInfo(NETINFO_LIST *aNetInfoList)
DIALOG_PAD_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_DIALOG_EDIT_PAD, const wxString &title=_("Pad Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
NETINFO_LIST & GetNetInfo()
Definition: class_board.h:738
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:266
BOARD * GetBoard() const

References BRIGHTENED, EDA_ITEM::ClearFlags(), DIALOG_SHIM::FinishDialogSettings(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetDesignSettings(), BOARD::GetNetInfo(), HIGHLIGHTED, initValues(), KiBitmap(), m_board, m_canUpdate, DIALOG_PAD_PROPERTIES_BASE::m_cbShowPadOutline, m_currentPad, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_FlippedWarningIcon, DIALOG_PAD_PROPERTIES_BASE::m_nonCopperNote, DIALOG_PAD_PROPERTIES_BASE::m_nonCopperWarningIcon, DIALOG_PAD_PROPERTIES_BASE::m_orientation, m_OrientValidator, BOARD_DESIGN_SETTINGS::m_Pad_Master, m_padMaster, DIALOG_PAD_PROPERTIES_BASE::m_PadNetSelector, DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl, m_parent, DIALOG_PAD_PROPERTIES_BASE::m_parentInfoLine1, DIALOG_PAD_PROPERTIES_BASE::m_parentInfoLine2, DIALOG_PAD_PROPERTIES_BASE::m_sdbSizerOK, m_sketchPreview, DIALOG_PAD_PROPERTIES_BASE::m_staticTextInfoNegVal, DIALOG_PAD_PROPERTIES_BASE::m_staticTextInfoPaste, DIALOG_PAD_PROPERTIES_BASE::m_staticTextInfoPosValue, DIALOG_PAD_PROPERTIES_BASE::m_techLayersLabel, OnValuesChanged(), prepareCanvas(), SELECTED, DIALOG_SHIM::SetInitialFocus(), NET_SELECTOR::SetNetInfo(), and TransferDataToWindow().

◆ ~DIALOG_PAD_PROPERTIES()

DIALOG_PAD_PROPERTIES::~DIALOG_PAD_PROPERTIES ( )

Definition at line 185 of file dialog_pad_properties.cpp.

186 {
187  m_PadNetSelector->Disconnect( NET_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES::OnValuesChanged ), NULL, this );
188 
189  delete m_dummyPad;
190  delete m_axisOrigin;
191 }
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin

References m_axisOrigin, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_PadNetSelector, and OnValuesChanged().

Member Function Documentation

◆ displayPrimitivesList()

void DIALOG_PAD_PROPERTIES::displayPrimitivesList ( )
private

Definition at line 791 of file dialog_pad_properties.cpp.

792 {
793  m_listCtrlPrimitives->ClearAll();
794 
795  wxListItem itemCol;
796  itemCol.SetImage(-1);
797 
798  for( int ii = 0; ii < 5; ++ii )
799  m_listCtrlPrimitives->InsertColumn(ii, itemCol);
800 
801  wxString bs_info[5];
802 
803  for( unsigned ii = 0; ii < m_primitives.size(); ++ii )
804  {
805  const PAD_CS_PRIMITIVE& primitive = m_primitives[ii];
806 
807  for( unsigned jj = 0; jj < 5; ++jj )
808  bs_info[jj].Empty();
809 
810  bs_info[4] = wxString::Format( _( "width %s" ),
811  MessageTextFromValue( m_units, primitive.m_Thickness, true ) );
812 
813  switch( primitive.m_Shape )
814  {
815  case S_SEGMENT: // usual segment : line with rounded ends
816  bs_info[0] = _( "Segment" );
817  bs_info[1] = _( "from " ) + formatCoord( m_units, primitive.m_Start );
818  bs_info[2] = _( "to " ) + formatCoord( m_units, primitive.m_End );
819  break;
820 
821  case S_CURVE: // Bezier segment
822  bs_info[0] = _( "Bezier" );
823  bs_info[1] = _( "from " ) + formatCoord( m_units, primitive.m_Start );
824  bs_info[2] = _( "to " ) + formatCoord( m_units, primitive.m_End );
825  break;
826 
827  case S_ARC: // Arc with rounded ends
828  bs_info[0] = _( "Arc" );
829  bs_info[1] = _( "center " ) + formatCoord( m_units, primitive.m_Start );// Center
830  bs_info[2] = _( "start " ) + formatCoord( m_units, primitive.m_End ); // Start point
831  bs_info[3] = wxString::Format( _( "angle %s" ), FormatAngle( primitive.m_ArcAngle ) );
832  break;
833 
834  case S_CIRCLE: // ring or circle
835  if( primitive.m_Thickness )
836  bs_info[0] = _( "ring" );
837  else
838  bs_info[0] = _( "circle" );
839 
840  bs_info[1] = formatCoord( m_units, primitive.m_Start );
841  bs_info[2] = wxString::Format( _( "radius %s" ),
842  MessageTextFromValue( m_units, primitive.m_Radius, true ) );
843  break;
844 
845  case S_POLYGON: // polygon
846  bs_info[0] = "Polygon";
847  bs_info[1] = wxString::Format( _( "corners count %d" ), (int) primitive.m_Poly.size() );
848  break;
849 
850  default:
851  bs_info[0] = "Unknown primitive";
852  break;
853  }
854 
855  long tmp = m_listCtrlPrimitives->InsertItem(ii, bs_info[0]);
856  m_listCtrlPrimitives->SetItemData(tmp, ii);
857 
858  for( int jj = 0, col = 0; jj < 5; ++jj )
859  {
860  m_listCtrlPrimitives->SetItem(tmp, col++, bs_info[jj]);
861  }
862  }
863 
864  // Now columns are filled, ensure correct width of columns
865  for( unsigned ii = 0; ii < 5; ++ii )
866  m_listCtrlPrimitives->SetColumnWidth( ii, wxLIST_AUTOSIZE );
867 }
wxPoint m_Start
angle of an arc, from its starting point, in 0.1 deg
Definition: class_pad.h:98
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
wxString MessageTextFromValue(EDA_UNITS_T aUnits, int aValue, bool aUseMils)
Definition: base_units.cpp:125
static wxString formatCoord(EDA_UNITS_T aUnits, wxPoint aCoord)
std::string FormatAngle(double aAngle)
Function FormatAngle converts aAngle from board units to a string appropriate for writing to file.
Definition: base_units.cpp:511
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:96
std::vector< wxPoint > m_Poly
Bezier Control point 2.
Definition: class_pad.h:102
Arcs (with rounded ends)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89
Bezier Curve.
wxPoint m_End
is also the center of the circle and arc
Definition: class_pad.h:99
#define _(s)
STROKE_T m_Shape
Definition: class_pad.h:92
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:93
std::vector< PAD_CS_PRIMITIVE > m_primitives
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
EDA_UNITS_T m_units
Definition: dialog_shim.h:185
double m_ArcAngle
radius of a circle
Definition: class_pad.h:97

References _, Format(), FormatAngle(), formatCoord(), PAD_CS_PRIMITIVE::m_ArcAngle, PAD_CS_PRIMITIVE::m_End, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, PAD_CS_PRIMITIVE::m_Poly, m_primitives, PAD_CS_PRIMITIVE::m_Radius, PAD_CS_PRIMITIVE::m_Shape, PAD_CS_PRIMITIVE::m_Start, PAD_CS_PRIMITIVE::m_Thickness, DIALOG_SHIM::m_units, MessageTextFromValue(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, and S_SEGMENT.

Referenced by editPrimitive(), initValues(), onAddPrimitive(), onDeletePrimitive(), onDuplicatePrimitive(), and onGeometryTransform().

◆ editPrimitive()

void DIALOG_PAD_PROPERTIES::editPrimitive ( )
private

Definition at line 1822 of file dialog_pad_properties.cpp.

1823 {
1824  long select = m_listCtrlPrimitives->GetFirstSelected();
1825 
1826  if( select < 0 )
1827  {
1828  wxMessageBox( _( "No shape selected" ) );
1829  return;
1830  }
1831 
1832  PAD_CS_PRIMITIVE& shape = m_primitives[select];
1833 
1834  if( shape.m_Shape == S_POLYGON )
1835  {
1836  DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, m_parent, &shape );
1837 
1838  if( dlg.ShowModal() != wxID_OK )
1839  return;
1840 
1841  dlg.TransferDataFromWindow();
1842  }
1843 
1844  else
1845  {
1846  DIALOG_PAD_PRIMITIVES_PROPERTIES dlg( this, m_parent, &shape );
1847 
1848  if( dlg.ShowModal() != wxID_OK )
1849  return;
1850 
1851  dlg.TransferDataFromWindow();
1852  }
1853 
1855 
1856  if( m_canUpdate )
1857  {
1859  redraw();
1860  }
1861 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
polygon (not yet used for tracks, but could be in microwave apps)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89
#define _(s)
STROKE_T m_Shape
Definition: class_pad.h:92
a dialog to edit basic polygonal shape parameters
std::vector< PAD_CS_PRIMITIVE > m_primitives
a dialog to edit basics shapes parameters.

References _, displayPrimitivesList(), m_canUpdate, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, m_parent, m_primitives, PAD_CS_PRIMITIVE::m_Shape, redraw(), S_POLYGON, DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::TransferDataFromWindow(), and transferDataToPad().

Referenced by onEditPrimitive(), and onPrimitiveDClick().

◆ Enable()

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 238 of file dialog_shim.cpp.

239 {
240  // so we can do logging of this state change:
241 
242 #if 0 && defined(DEBUG)
243  const char* type_id = typeid( *this ).name();
244  printf( "DIALOG_SHIM %s: %s\n", type_id, enable ? "enabled" : "disabled" );
245  fflush(0); //Needed on msys2 to immediately print the message
246 #endif
247 
248  return wxDialog::Enable( enable );
249 }

◆ enablePrimitivePage()

void DIALOG_PAD_PROPERTIES::enablePrimitivePage ( bool  aEnable)
private

enable (or disable) the primitive page editor

Definition at line 218 of file dialog_pad_properties.cpp.

219 {
220  // Enable or disable the widgets in page managing custom shape primitives
221  m_listCtrlPrimitives->Enable( aEnable );
222  m_buttonDel->Enable( aEnable );
223  m_buttonEditShape->Enable( aEnable );
224  m_buttonAddShape->Enable( aEnable );
225  m_buttonDup->Enable( aEnable );
226  m_buttonGeometry->Enable( aEnable );
227 }

References DIALOG_PAD_PROPERTIES_BASE::m_buttonAddShape, DIALOG_PAD_PROPERTIES_BASE::m_buttonDel, DIALOG_PAD_PROPERTIES_BASE::m_buttonDup, DIALOG_PAD_PROPERTIES_BASE::m_buttonEditShape, DIALOG_PAD_PROPERTIES_BASE::m_buttonGeometry, and DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives.

Referenced by initValues(), and OnPadShapeSelection().

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 398 of file dialog_shim.cpp.

399 {
400  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
401  // handle validation in the same way as other dialogs.
402  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
403  return;
404 
405  SetReturnCode( retCode );
406 
407  if( !IsQuasiModal() )
408  {
409  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
410  return;
411  }
412 
413  if( m_qmodal_loop )
414  {
415  if( m_qmodal_loop->IsRunning() )
416  m_qmodal_loop->Exit( 0 );
417  else
418  m_qmodal_loop->ScheduleExit( 0 );
419 
420  m_qmodal_loop = NULL;
421  }
422 
425 
426  Show( false );
427 }
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:194
bool IsQuasiModal()
Definition: dialog_shim.h:127
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:197

References DIALOG_SHIM::IsQuasiModal(), DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, and DIALOG_SHIM::Show().

Referenced by HK_PROMPT_DIALOG::EndFlexible(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_COMPONENTS_LIBID::onCancel(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnCancelButtonClick(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), HTML_MESSAGE_BOX::OnOKButtonClick(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_COMPONENT::OnUseBrowser(), and DIALOG_SHIM::~DIALOG_SHIM().

◆ FinishDialogSettings()

void DIALOG_SHIM::FinishDialogSettings ( )
protectedinherited

In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls.

FinishDialogSettings must be called from derived classes, when all widgets are initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at end of TransferDataToWindow, or better at end of a wxInitDialogEvent handler

In any case, the best way is to call it in a wxInitDialogEvent handler after calling TransfertDataToWindow(), which is the default wxInitDialogEvent handler wxDialog

Definition at line 138 of file dialog_shim.cpp.

139 {
140  // must be called from the constructor of derived classes,
141  // when all widgets are initialized, and therefore their size fixed
142 
143  // SetSizeHints fixes the minimal size of sizers in the dialog
144  // (SetSizeHints calls Fit(), so no need to call it)
145  GetSizer()->SetSizeHints( this );
146 
147  // the default position, when calling the first time the dlg
148  Center();
149 }

References PCAD2KICAD::Center.

Referenced by DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_EDIT_SHEET_PIN::DIALOG_EDIT_SHEET_PIN(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS(), DIALOG_FP_BROWSER_DISPLAY_OPTIONS::DIALOG_FP_BROWSER_DISPLAY_OPTIONS(), DIALOG_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_OPTIONS(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_GLOBAL_LIB_TABLE_CONFIG::DIALOG_GLOBAL_LIB_TABLE_CONFIG(), DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), DIALOG_INSPECTOR::DIALOG_INSPECTOR(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NETLIST::DIALOG_NETLIST(), DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::DIALOG_PAD_PRIMITIVE_POLY_PROPS(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES(), DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_NET_FROM_LIST::DIALOG_SELECT_NET_FROM_LIST(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), PAGED_DIALOG::finishInitialization(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), DIALOG_COLOR_PICKER::TransferDataToWindow(), and DIALOG_BOARD_STATISTICS::TransferDataToWindow().

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( )
inlineinherited

Definition at line 49 of file kiway_holder.h.

49 { return m_type; }
HOLDER_TYPE m_type
Definition: kiway_holder.h:82

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), PL_EDITOR_FRAME::SaveSettings(), and GERBVIEW_FRAME::SaveSettings().

◆ GetUserUnits()

◆ HorizPixelsFromDU()

int DIALOG_SHIM::HorizPixelsFromDU ( int  x)
protectedinherited

Convert an integer number of dialog units to pixels, horizontally.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 159 of file dialog_shim.cpp.

160 {
161  wxSize sz( x, 0 );
162  return ConvertDialogToPixels( sz ).x;
163 }

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), and DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT().

◆ initValues()

void DIALOG_PAD_PROPERTIES::initValues ( )
private

Definition at line 561 of file dialog_pad_properties.cpp.

562 {
563  wxString msg;
564  double angle;
565 
566  // Disable pad net name wxTextCtrl if the caller is the footprint editor
567  // because nets are living only in the board managed by the board editor
569 
570  // Setup layers names from board
571  // Should be made first, before calling m_rbCopperLayersSel->SetSelection()
572  m_rbCopperLayersSel->SetString( 0, m_board->GetLayerName( F_Cu ) );
573  m_rbCopperLayersSel->SetString( 1, m_board->GetLayerName( B_Cu ) );
574 
575  m_PadLayerAdhCmp->SetLabel( m_board->GetLayerName( F_Adhes ) );
576  m_PadLayerAdhCu->SetLabel( m_board->GetLayerName( B_Adhes ) );
578  m_PadLayerPateCu->SetLabel( m_board->GetLayerName( B_Paste ) );
580  m_PadLayerSilkCu->SetLabel( m_board->GetLayerName( B_SilkS ) );
581  m_PadLayerMaskCmp->SetLabel( m_board->GetLayerName( F_Mask ) );
582  m_PadLayerMaskCu->SetLabel( m_board->GetLayerName( B_Mask ) );
583  m_PadLayerECO1->SetLabel( m_board->GetLayerName( Eco1_User ) );
584  m_PadLayerECO2->SetLabel( m_board->GetLayerName( Eco2_User ) );
586 
587  m_isFlipped = false;
588 
589  if( m_currentPad )
590  {
592 
593  // Diplay parent footprint info
594  MODULE* footprint = m_currentPad->GetParent();
595  wxString msg1, msg2;
596 
597  if( footprint )
598  {
599  wxString side = footprint->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" );
600  msg1.Printf( _("Footprint %s (%s),"), footprint->GetReference(), footprint->GetValue() );
601  msg2.Printf( _("%s, rotated %.1f deg"), side, footprint->GetOrientation() / 10.0 );
602  }
603 
604  m_parentInfoLine1->SetLabel( msg1 );
605  m_parentInfoLine2->SetLabel( msg2 );
606  }
607 
608  if( m_isFlipped )
609  {
610  wxPoint pt = m_dummyPad->GetOffset();
611  pt.y = -pt.y;
612  m_dummyPad->SetOffset( pt );
613 
614  wxSize sz = m_dummyPad->GetDelta();
615  sz.y = -sz.y;
616  m_dummyPad->SetDelta( sz );
617 
618  // flip pad's layers
620 
621  // flip custom pad shapes
623  }
624 
626 
628 
629  m_PadNumCtrl->SetValue( m_dummyPad->GetName() );
631 
632  // Display current pad parameters units:
635 
638 
641 
644 
645  if( m_dummyPad->GetDelta().x )
646  {
648  m_trapAxisCtrl->SetSelection( 0 );
649  }
650  else
651  {
653  m_trapAxisCtrl->SetSelection( 1 );
654  }
655 
657 
663 
664  // Prefer "-0" to "0" for normally negative values
666  m_pasteClearanceCtrl->SetValue( wxT( "-" ) + m_pasteClearanceCtrl->GetValue() );
667 
668  msg.Printf( wxT( "%f" ), m_dummyPad->GetLocalSolderPasteMarginRatio() * 100.0 );
669 
670  if( m_dummyPad->GetLocalSolderPasteMarginRatio() == 0.0 && msg[0] == '0' )
671  // Sometimes Printf adds a sign if the value is small
672  m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
673  else
675 
677  {
678  default:
679  case PAD_ZONE_CONN_INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
680  case PAD_ZONE_CONN_FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
681  case PAD_ZONE_CONN_THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
682  case PAD_ZONE_CONN_NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
683  }
684 
686  m_ZoneCustomPadShape->SetSelection( 1 );
687  else
688  m_ZoneCustomPadShape->SetSelection( 0 );
689 
690  if( m_currentPad )
691  {
693  MODULE* footprint = m_currentPad->GetParent();
694 
695  if( footprint )
696  angle -= footprint->GetOrientation();
697 
698  if( m_isFlipped )
699  angle = -angle;
700 
702  }
703 
705 
706  NORMALIZE_ANGLE_180( angle ); // ? normalizing is in D_PAD::SetOrientation()
707 
708  // Set layers used by this pad: :
710 
711  // Pad Orient
712  // Note: use ChangeValue() instead of SetValue() so that we don't generate events
713  m_orientation->ChangeValue( StringFromValue( DEGREES, angle ) );
714 
715  switch( m_dummyPad->GetShape() )
716  {
717  default:
718  case PAD_SHAPE_CIRCLE: m_PadShape->SetSelection( CHOICE_SHAPE_CIRCLE ); break;
719  case PAD_SHAPE_OVAL: m_PadShape->SetSelection( CHOICE_SHAPE_OVAL ); break;
720  case PAD_SHAPE_RECT: m_PadShape->SetSelection( CHOICE_SHAPE_RECT ); break;
721  case PAD_SHAPE_TRAPEZOID: m_PadShape->SetSelection( CHOICE_SHAPE_TRAPEZOID ); break;
722  case PAD_SHAPE_ROUNDRECT: m_PadShape->SetSelection( CHOICE_SHAPE_ROUNDRECT ); break;
724 
725  case PAD_SHAPE_CUSTOM:
728  else
730  break;
731  }
732 
733 
738 
740 
741  // Type of pad selection
742  bool aperture = m_dummyPad->GetAttribute() == PAD_ATTRIB_CONN && m_dummyPad->IsAperturePad();
743  bool mechanical = m_dummyPad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED;
744 
745  if( aperture )
746  {
747  m_PadType->SetSelection( 4 );
748  }
749  else
750  {
751  switch( m_dummyPad->GetAttribute() )
752  {
753  case PAD_ATTRIB_STANDARD: m_PadType->SetSelection( 0 ); break;
754  case PAD_ATTRIB_SMD: m_PadType->SetSelection( 1 ); break;
755  case PAD_ATTRIB_CONN: m_PadType->SetSelection( 2 ); break;
756  case PAD_ATTRIB_HOLE_NOT_PLATED: m_PadType->SetSelection( 3 ); break;
757  }
758  }
759 
760  // Disable Pad name,and pad to die length for mechanical and aperture pads
761  m_PadNumText->Enable( !mechanical && !aperture );
762  m_PadNumCtrl->Enable( !mechanical && !aperture );
763  m_PadNameText->Enable( !mechanical && !aperture && m_canEditNetName && m_currentPad );
764  m_PadNetSelector->Enable( !mechanical && !aperture && m_canEditNetName && m_currentPad );
765  m_padToDie.Enable( !mechanical && !aperture );
766 
768  m_holeShapeCtrl->SetSelection( 0 );
769  else
770  m_holeShapeCtrl->SetSelection( 1 );
771 
772  // Update some dialog widgets state (Enable/disable options):
773  wxCommandEvent cmd_event;
775  OnDrillShapeSelected( cmd_event );
776  OnPadShapeSelection( cmd_event );
778 
779  // Update basic shapes list
781 }
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:438
double GetOrientation() const
Definition: class_module.h:218
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask,...
Definition: lset.cpp:521
int GetNetCode() const
Function GetNetCode.
void enablePrimitivePage(bool aEnable)
enable (or disable) the primitive page editor
void FlipPrimitives()
Flip the basic shapes, in custom pads.
Definition: class_pad.cpp:470
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:288
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:231
void setPadLayersList(LSET layer_mask)
Function setPadLayersList updates the CheckBox states in pad layers list,.
bool IsFlipped() const
Definition: class_pad.cpp:137
int GetPadToDieLength() const
Definition: class_pad.h:436
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:62
const wxString GetValue() const
Function GetValue.
Definition: class_module.h:457
void NORMALIZE_ANGLE_180(T &Angle)
Definition: trigo.h:346
int GetThermalGap() const
Definition: class_pad.cpp:747
int GetLocalClearance() const
Definition: class_pad.h:441
void SetValue(const wxString &aValue) override
Set a new value in evaluator buffer, and display it in the wxTextCtrl.
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:429
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:432
int GetChamferPositions() const
has meaning only for chamfered rect pads
Definition: class_pad.h:693
Pads are not covered.
Definition: zones.h:52
const std::vector< PAD_CS_PRIMITIVE > & GetPrimitives() const
Accessor to the basic shape list.
Definition: class_pad.h:353
const wxPoint & GetOffset() const
Definition: class_pad.h:293
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:412
int GetThermalWidth() const
Definition: class_pad.cpp:736
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:426
void SetSelectedNetcode(int aNetcode)
ZoneConnection GetLocalZoneConnection() const
Definition: class_pad.h:509
void OnPadShapeSelection(wxCommandEvent &event) override
const wxString & GetName() const
Definition: class_pad.h:195
void OnDrillShapeSelected(wxCommandEvent &event) override
const wxSize & GetDelta() const
Definition: class_pad.h:287
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:63
#define _(s)
MODULE * GetParent() const
Definition: class_pad.h:167
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: class_pad.h:237
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:425
std::vector< PAD_CS_PRIMITIVE > m_primitives
bool IsType(FRAME_T aType) const
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:406
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
const wxSize & GetDrillSize() const
Definition: class_pad.h:290
bool IsAperturePad() const
Definition: class_pad.h:433
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:430
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221
const wxSize & GetSize() const
Definition: class_pad.h:284
const wxPoint GetPosition() const override
Definition: class_pad.h:225
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:444
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:292
Use thermal relief for pads.
Definition: zones.h:53
void Enable(bool aEnable)
Function Enable Enables/diasables the label, widget and units label.
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:447
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:286
wxString StringFromValue(EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:217
pads are covered by copper
Definition: zones.h:54

References _, PNS::angle(), B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, CHOICE_SHAPE_CHAMFERED_RECT, CHOICE_SHAPE_CIRCLE, CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR, CHOICE_SHAPE_CUSTOM_RECT_ANCHOR, CHOICE_SHAPE_OVAL, CHOICE_SHAPE_RECT, CHOICE_SHAPE_ROUNDRECT, CHOICE_SHAPE_TRAPEZOID, CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL, DEGREES, displayPrimitivesList(), Dwgs_User, Eco1_User, Eco2_User, UNIT_BINDER::Enable(), enablePrimitivePage(), F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, FlipLayerMask(), D_PAD::FlipPrimitives(), FRAME_PCB_EDITOR, D_PAD::GetAnchorPadShape(), D_PAD::GetAttribute(), D_PAD::GetChamferPositions(), D_PAD::GetCustomShapeInZoneOpt(), D_PAD::GetDelta(), D_PAD::GetDrillShape(), D_PAD::GetDrillSize(), BOARD::GetLayerName(), D_PAD::GetLayerSet(), D_PAD::GetLocalClearance(), D_PAD::GetLocalSolderMaskMargin(), D_PAD::GetLocalSolderPasteMargin(), D_PAD::GetLocalSolderPasteMarginRatio(), D_PAD::GetLocalZoneConnection(), D_PAD::GetName(), BOARD_CONNECTED_ITEM::GetNetCode(), D_PAD::GetOffset(), MODULE::GetOrientation(), D_PAD::GetOrientation(), D_PAD::GetPadToDieLength(), D_PAD::GetParent(), D_PAD::GetPosition(), D_PAD::GetPrimitives(), MODULE::GetReference(), D_PAD::GetShape(), D_PAD::GetSize(), D_PAD::GetThermalGap(), D_PAD::GetThermalWidth(), MODULE::GetValue(), D_PAD::IsAperturePad(), D_PAD::IsFlipped(), MODULE::IsFlipped(), EDA_BASE_FRAME::IsType(), m_board, m_canEditNetName, DIALOG_PAD_PROPERTIES_BASE::m_cbBottomLeft, DIALOG_PAD_PROPERTIES_BASE::m_cbBottomRight, DIALOG_PAD_PROPERTIES_BASE::m_cbTopLeft, DIALOG_PAD_PROPERTIES_BASE::m_cbTopRight, m_clearance, m_currentPad, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_FlippedWarningSizer, DIALOG_PAD_PROPERTIES_BASE::m_holeShapeCtrl, m_holeX, m_holeY, m_isFlipped, m_maskClearance, m_offsetX, m_offsetY, DIALOG_PAD_PROPERTIES_BASE::m_orientation, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerAdhCmp, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerAdhCu, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerDraft, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerECO1, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerECO2, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerMaskCmp, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerMaskCu, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerPateCmp, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerPateCu, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerSilkCmp, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerSilkCu, DIALOG_PAD_PROPERTIES_BASE::m_PadNameText, DIALOG_PAD_PROPERTIES_BASE::m_PadNetSelector, DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadNumText, DIALOG_PAD_PROPERTIES_BASE::m_PadShape, m_padToDie, DIALOG_PAD_PROPERTIES_BASE::m_PadType, m_parent, DIALOG_PAD_PROPERTIES_BASE::m_parentInfoLine1, DIALOG_PAD_PROPERTIES_BASE::m_parentInfoLine2, m_pasteClearance, DIALOG_PAD_PROPERTIES_BASE::m_pasteClearanceCtrl, m_posX, m_posY, m_primitives, DIALOG_PAD_PROPERTIES_BASE::m_rbCopperLayersSel, m_sizeX, m_sizeY, DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginRatioCtrl, m_spokeWidth, m_thermalGap, DIALOG_PAD_PROPERTIES_BASE::m_trapAxisCtrl, m_trapDelta, DIALOG_PAD_PROPERTIES_BASE::m_ZoneConnectionChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneCustomPadShape, NORMALIZE_ANGLE_180(), OnDrillShapeSelected(), OnPadShapeSelection(), PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED, PAD_ATTRIB_SMD, PAD_ATTRIB_STANDARD, PAD_DRILL_SHAPE_OBLONG, PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, PAD_ZONE_CONN_FULL, PAD_ZONE_CONN_INHERITED, PAD_ZONE_CONN_NONE, PAD_ZONE_CONN_THERMAL, RECT_CHAMFER_BOTTOM_LEFT, RECT_CHAMFER_BOTTOM_RIGHT, RECT_CHAMFER_TOP_LEFT, RECT_CHAMFER_TOP_RIGHT, D_PAD::SetDelta(), D_PAD::SetLayerSet(), D_PAD::SetOffset(), D_PAD::SetOrientation(), setPadLayersList(), NET_SELECTOR::SetSelectedNetcode(), TEXT_CTRL_EVAL::SetValue(), UNIT_BINDER::SetValue(), StringFromValue(), and updateRoundRectCornerValues().

Referenced by DIALOG_PAD_PROPERTIES().

◆ IsCtrl()

static bool DIALOG_SHIM::IsCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 137 of file dialog_shim.h.

138  {
139  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() && !e.ShiftDown() && !e.MetaDown();
140  }

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook(), and DIALOG_LABEL_EDITOR::OnCharHook().

◆ IsQuasiModal()

◆ IsShiftCtrl()

static bool DIALOG_SHIM::IsShiftCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 142 of file dialog_shim.h.

143  {
144  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() && e.ShiftDown() && !e.MetaDown();
145  }

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook(), and DIALOG_LABEL_EDITOR::OnCharHook().

◆ Kiway()

KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 56 of file kiway_holder.h.

57  {
58  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
59  return *m_kiway;
60  }
KIWAY * m_kiway
Definition: kiway_holder.h:81

References KIWAY_HOLDER::m_kiway.

Referenced by TREEPROJECT_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_CONTROL::AddSymbolToSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), SCH_EDIT_FRAME::CreateScreens(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), CVPCB_MAINFRAME::DisplayStatus(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), EDIT_TOOL::EditFpInFpEditor(), SCH_EDIT_FRAME::EditSheet(), SCH_EDITOR_CONTROL::EditWithLibEdit(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::InitSheet(), KICAD_MANAGER_FRAME::language_change(), KIWAY_PLAYER::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadSheetFromFile(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), PL_EDITOR_FRAME::OnExit(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), LIB_EDIT_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), EDA_BASE_FRAME::OnPreferences(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::rescueProject(), EE_INSPECTION_TOOL::RunSimulation(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ onAddPrimitive()

void DIALOG_PAD_PROPERTIES::onAddPrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1914 of file dialog_pad_properties.cpp.

1915 {
1916  // Ask user for shape type
1917  wxString shapelist[] = { _( "Segment" ), _( "Arc" ), _( "Bezier" ),
1918  _( "Ring/Circle" ), _( "Polygon" ) };
1919 
1920  int type = wxGetSingleChoiceIndex( _( "Shape type:" ), _( "Add Primitive" ),
1921  arrayDim( shapelist ), shapelist, 0, this );
1922 
1923  // User pressed cancel
1924  if( type == -1 )
1925  return;
1926 
1927  STROKE_T listtype[] = { S_SEGMENT, S_ARC, S_CURVE, S_CIRCLE, S_POLYGON };
1928 
1929  PAD_CS_PRIMITIVE primitive( listtype[type] );
1930  primitive.m_Thickness = m_board->GetDesignSettings().GetLineThickness( F_Cu );
1931 
1932  if( listtype[type] == S_POLYGON )
1933  {
1934  DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, m_parent, &primitive );
1935 
1936  if( dlg.ShowModal() != wxID_OK )
1937  return;
1938  }
1939  else
1940  {
1941  DIALOG_PAD_PRIMITIVES_PROPERTIES dlg( this, m_parent, &primitive );
1942 
1943  if( dlg.ShowModal() != wxID_OK )
1944  return;
1945  }
1946 
1947  m_primitives.push_back( primitive );
1948 
1950 
1951  if( m_canUpdate )
1952  {
1954  redraw();
1955  }
1956 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
polygon (not yet used for tracks, but could be in microwave apps)
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:531
usual segment : line with rounded ends
int GetLineThickness(PCB_LAYER_ID aLayer) const
Function GetLineThickness Returns the default graphic segment thickness from the layer class for the ...
Arcs (with rounded ends)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89
STROKE_T
Enum STROKE_T is the set of shapes for segments (graphic segments and tracks) which are often in the ...
Bezier Curve.
#define _(s)
a dialog to edit basic polygonal shape parameters
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
std::vector< PAD_CS_PRIMITIVE > m_primitives
a dialog to edit basics shapes parameters.

References _, arrayDim(), displayPrimitivesList(), F_Cu, BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetLineThickness(), m_board, m_canUpdate, m_dummyPad, m_parent, m_primitives, PAD_CS_PRIMITIVE::m_Thickness, redraw(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_SEGMENT, and transferDataToPad().

◆ OnCancel()

void DIALOG_PAD_PROPERTIES::OnCancel ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 207 of file dialog_pad_properties.cpp.

208 {
209  // Mandatory to avoid m_panelShowPadGal trying to draw something
210  // in a non valid context during closing process:
212 
213  // Now call default handler for wxID_CANCEL command event
214  event.Skip();
215 }
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...

References DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal, and EDA_DRAW_PANEL_GAL::StopDrawing().

◆ onChangePadMode()

void DIALOG_PAD_PROPERTIES::onChangePadMode ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 876 of file dialog_pad_properties.cpp.

877 {
878  m_sketchPreview = m_cbShowPadOutline->GetValue();
879 
881 
882  // fix the pad render mode (filled/not filled)
883  KIGFX::PCB_RENDER_SETTINGS* settings =
884  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
885 
890 
891  redraw();
892 }
multilayer pads, usually with holes
void SetSketchModeGraphicItems(bool aEnabled)
Turns on/off sketch mode for graphic items (DRAWSEGMENTs, texts).
Definition: pcb_painter.h:133
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
Class PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:61
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
smd pads, front layer
void SetSketchMode(int aItemLayer, bool aEnabled)
Function SetSketchMode Turns on/off sketch mode for given item layer.
Definition: pcb_painter.h:113
Class VIEW.
Definition: view.h:61

References KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PADS_TH, DIALOG_PAD_PROPERTIES_BASE::m_cbShowPadOutline, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal, m_sketchPreview, redraw(), KIGFX::PCB_RENDER_SETTINGS::SetSketchMode(), and KIGFX::PCB_RENDER_SETTINGS::SetSketchModeGraphicItems().

◆ onCornerRadiusChange()

void DIALOG_PAD_PROPERTIES::onCornerRadiusChange ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 476 of file dialog_pad_properties.cpp.

477 {
480  return;
481 
482  double rrRadius = m_cornerRadius.GetValue();
483 
484  if( rrRadius < 0.0 )
485  {
486  rrRadius = 0.0;
487  m_tcCornerRadius->ChangeValue( wxString::Format( "%.1f", rrRadius ) );
488  }
489 
492 
493  auto ratio = wxString::Format( "%.1f", m_dummyPad->GetRoundRectRadiusRatio() * 100 );
494  m_tcCornerSizeRatio->ChangeValue( ratio );
495  redraw();
496 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
void SetRoundRectCornerRadius(double aRadius)
Set the rounded rectangle radius ratio based on a given radius.
Definition: class_pad.cpp:218
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
virtual long long int GetValue()
Function GetValue Returns the current value in Internal Units.
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:644
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221

References Format(), D_PAD::GetRoundRectRadiusRatio(), D_PAD::GetShape(), UNIT_BINDER::GetValue(), m_cornerRadius, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerRadius, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_ROUNDRECT, redraw(), D_PAD::SetRoundRectCornerRadius(), and transferDataToPad().

◆ onCornerSizePercentChange()

void DIALOG_PAD_PROPERTIES::onCornerSizePercentChange ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 499 of file dialog_pad_properties.cpp.

500 {
503  return;
504 
505  wxString value = m_tcCornerSizeRatio->GetValue();
506  double ratioPercent;
507 
508  bool asChanged = false;
509 
510  if( value.ToDouble( &ratioPercent ) )
511  {
512  // Clamp ratioPercent to acceptable value (0.0 to 50.0)
513  if( ratioPercent < 0.0 )
514  {
515  ratioPercent = 0.0;
516  value.Printf( "%.1f", ratioPercent );
517  m_tcCornerSizeRatio->ChangeValue( value );
518  }
519 
520  if( ratioPercent > 50.0 )
521  {
522  ratioPercent = 0.5;
523  value.Printf( "%.1f", ratioPercent*100.0 );
524  m_tcCornerSizeRatio->ChangeValue( value );
525  }
526 
527  asChanged = true;
528  }
529 
530  value = m_tcChamferRatio->GetValue();
531 
532  if( value.ToDouble( &ratioPercent ) )
533  {
534  // Clamp ratioPercent to acceptable value (0.0 to 50.0)
535  if( ratioPercent < 0.0 )
536  {
537  ratioPercent = 0.0;
538  value.Printf( "%.1f", ratioPercent );
539  m_tcChamferRatio->ChangeValue( value );
540  }
541 
542  if( ratioPercent > 50.0 )
543  {
544  ratioPercent = 0.5;
545  value.Printf( "%.1f", ratioPercent*100.0 );
546  m_tcChamferRatio->ChangeValue( value );
547  }
548 
549  asChanged = true;
550  }
551 
552  if( asChanged )
553  {
556  redraw();
557  }
558 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:546
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221
virtual void ChangeValue(int aValue)
Function ChangeValue Changes the value (in Internal Units) for the text field, taking care of units c...

References UNIT_BINDER::ChangeValue(), D_PAD::GetRoundRectCornerRadius(), D_PAD::GetShape(), m_cornerRadius, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_tcChamferRatio, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_ROUNDRECT, redraw(), and transferDataToPad().

◆ onDeletePrimitive()

void DIALOG_PAD_PROPERTIES::onDeletePrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Event handlers of basic shapes list panel.

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1886 of file dialog_pad_properties.cpp.

1887 {
1888  long select = m_listCtrlPrimitives->GetFirstSelected();
1889 
1890  if( select < 0 )
1891  return;
1892 
1893  // Multiple selections are allowed. get them and remove corresponding shapes
1894  std::vector<long> indexes;
1895  indexes.push_back( select );
1896 
1897  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
1898  indexes.push_back( select );
1899 
1900  // Erase all select shapes
1901  for( unsigned ii = indexes.size(); ii > 0; --ii )
1902  m_primitives.erase( m_primitives.begin() + indexes[ii-1] );
1903 
1905 
1906  if( m_canUpdate )
1907  {
1909  redraw();
1910  }
1911 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
std::vector< PAD_CS_PRIMITIVE > m_primitives

References displayPrimitivesList(), m_canUpdate, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, m_primitives, redraw(), and transferDataToPad().

◆ OnDrillShapeSelected()

void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 990 of file dialog_pad_properties.cpp.

991 {
993  redraw();
994 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.

References m_dummyPad, redraw(), and transferDataToPad().

Referenced by initValues().

◆ onDuplicatePrimitive()

void DIALOG_PAD_PROPERTIES::onDuplicatePrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1994 of file dialog_pad_properties.cpp.

1995 {
1996  long select = m_listCtrlPrimitives->GetFirstSelected();
1997 
1998  if( select < 0 )
1999  {
2000  wxMessageBox( _( "No shape selected" ) );
2001  return;
2002  }
2003 
2004  // Multiple selections are allowed. Build selected shapes list
2005  std::vector<PAD_CS_PRIMITIVE*> shapeList;
2006  shapeList.push_back( &m_primitives[select] );
2007 
2008  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
2009  shapeList.push_back( &m_primitives[select] );
2010 
2011  DIALOG_PAD_PRIMITIVES_TRANSFORM dlg( this, m_parent, shapeList, true );
2012 
2013  if( dlg.ShowModal() != wxID_OK )
2014  return;
2015 
2016  // Transfer new settings
2017  // save duplicates to a separate vector to avoid m_primitives reallocation,
2018  // as shapeList contains pointers to its elements
2019  std::vector<PAD_CS_PRIMITIVE> duplicates;
2020  dlg.Transform( &duplicates, dlg.GetDuplicateCount() );
2021  std::move( duplicates.begin(), duplicates.end(), std::back_inserter( m_primitives ) );
2022 
2024 
2025  if( m_canUpdate )
2026  {
2028  redraw();
2029  }
2030 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
#define _(s)
std::vector< PAD_CS_PRIMITIVE > m_primitives
A dialog to apply geometry transforms to a shape or set of shapes (move, rotate around origin,...

References _, displayPrimitivesList(), DIALOG_PAD_PRIMITIVES_TRANSFORM::GetDuplicateCount(), m_canUpdate, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, m_parent, m_primitives, redraw(), transferDataToPad(), and DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform().

◆ onEditPrimitive()

void DIALOG_PAD_PROPERTIES::onEditPrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1880 of file dialog_pad_properties.cpp.

1881 {
1882  editPrimitive();
1883 }

References editPrimitive().

◆ onGeometryTransform()

void DIALOG_PAD_PROPERTIES::onGeometryTransform ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1959 of file dialog_pad_properties.cpp.

1960 {
1961  long select = m_listCtrlPrimitives->GetFirstSelected();
1962 
1963  if( select < 0 )
1964  {
1965  wxMessageBox( _( "No shape selected" ) );
1966  return;
1967  }
1968 
1969  // Multiple selections are allowed. Build selected shapes list
1970  std::vector<PAD_CS_PRIMITIVE*> shapeList;
1971  shapeList.push_back( &m_primitives[select] );
1972 
1973  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
1974  shapeList.push_back( &m_primitives[select] );
1975 
1976  DIALOG_PAD_PRIMITIVES_TRANSFORM dlg( this, m_parent, shapeList, false );
1977 
1978  if( dlg.ShowModal() != wxID_OK )
1979  return;
1980 
1981  // Transfert new settings:
1982  dlg.Transform();
1983 
1985 
1986  if( m_canUpdate )
1987  {
1989  redraw();
1990  }
1991 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
#define _(s)
std::vector< PAD_CS_PRIMITIVE > m_primitives
A dialog to apply geometry transforms to a shape or set of shapes (move, rotate around origin,...

References _, displayPrimitivesList(), m_canUpdate, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, m_parent, m_primitives, redraw(), transferDataToPad(), and DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform().

◆ OnInitDialog()

void DIALOG_PAD_PROPERTIES::OnInitDialog ( wxInitDialogEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 197 of file dialog_pad_properties.cpp.

198 {
199  m_selectedColor = COLOR4D( 1.0, 1.0, 1.0, 0.7 );
200 
201  // Needed on some WM to be sure the pad is redrawn according to the final size
202  // of the canvas, with the right zoom factor
203  redraw();
204 }
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References m_selectedColor, and redraw().

◆ OnPadShapeSelection()

void DIALOG_PAD_PROPERTIES::OnPadShapeSelection ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 896 of file dialog_pad_properties.cpp.

897 {
898  bool is_custom = false;
899 
900  switch( m_PadShape->GetSelection() )
901  {
902  case CHOICE_SHAPE_CIRCLE:
903  m_trapDelta.Enable( false );
904  m_trapAxisLabel->Enable( false );
905  m_trapAxisCtrl->Enable( false );
906  m_sizeY.Enable( false );
907  m_offsetX.Enable( false );
908  m_offsetY.Enable( false );
909  break;
910 
911  case CHOICE_SHAPE_OVAL:
912  m_trapDelta.Enable( false );
913  m_trapAxisLabel->Enable( false );
914  m_trapAxisCtrl->Enable( false );
915  m_sizeY.Enable( true );
916  m_offsetX.Enable( true );
917  m_offsetY.Enable( true );
918  break;
919 
920  case CHOICE_SHAPE_RECT:
921  m_trapDelta.Enable( false );
922  m_trapAxisLabel->Enable( false );
923  m_trapAxisCtrl->Enable( false );
924  m_sizeY.Enable( true );
925  m_offsetX.Enable( true );
926  m_offsetY.Enable( true );
927  break;
928 
930  m_trapDelta.Enable( true );
931  m_trapAxisLabel->Enable( true );
932  m_trapAxisCtrl->Enable( true );
933  m_sizeY.Enable( true );
934  m_offsetX.Enable( true );
935  m_offsetY.Enable( true );
936  break;
937 
940  m_trapDelta.Enable( false );
941  m_trapAxisLabel->Enable( false );
942  m_trapAxisCtrl->Enable( false );
943  m_sizeY.Enable( true );
944  m_offsetX.Enable( true );
945  m_offsetY.Enable( true );
946  // Ensure m_tcCornerSizeRatio contains the right value:
947  m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f",
949  break;
950 
951  case CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR: // PAD_SHAPE_CUSTOM, circular anchor
952  case CHOICE_SHAPE_CUSTOM_RECT_ANCHOR: // PAD_SHAPE_CUSTOM, rect anchor
953  is_custom = true;
954  m_trapDelta.Enable( false );
955  m_trapAxisLabel->Enable( false );
956  m_trapAxisCtrl->Enable( false );
958  m_offsetX.Enable( false );
959  m_offsetY.Enable( false );
960  break;
961  }
962 
963  enablePrimitivePage( is_custom );
964 
965  // A few widgets are enabled only for rounded rect and chamfered pads:
966  bool chamfered_rect_enable = m_PadShape->GetSelection() == CHOICE_SHAPE_CHAMFERED_RECT;
967  bool round_rect_enable = m_PadShape->GetSelection() == CHOICE_SHAPE_ROUNDRECT ||
968  chamfered_rect_enable;
969  m_staticTextCornerSizeRatio->Enable( round_rect_enable );
970  m_tcCornerSizeRatio->Enable( round_rect_enable );
971  m_staticTextCornerSizeRatioUnit->Enable( round_rect_enable );
972  m_cornerRadius.Enable( round_rect_enable );
973 
974  m_cbTopLeft->Enable( chamfered_rect_enable );
975  m_cbTopRight->Enable( chamfered_rect_enable );
976  m_cbBottomLeft->Enable( chamfered_rect_enable );
977  m_cbBottomRight->Enable( chamfered_rect_enable );
978  m_tcChamferRatio->Enable( chamfered_rect_enable );
979 
980  m_staticTextcps->Enable( is_custom );
981  m_ZoneCustomPadShape->Enable( is_custom );
982 
984 
986  redraw();
987 }
void enablePrimitivePage(bool aEnable)
enable (or disable) the primitive page editor
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:644
void Enable(bool aEnable)
Function Enable Enables/diasables the label, widget and units label.

References CHOICE_SHAPE_CHAMFERED_RECT, CHOICE_SHAPE_CIRCLE, CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR, CHOICE_SHAPE_CUSTOM_RECT_ANCHOR, CHOICE_SHAPE_OVAL, CHOICE_SHAPE_RECT, CHOICE_SHAPE_ROUNDRECT, CHOICE_SHAPE_TRAPEZOID, UNIT_BINDER::Enable(), enablePrimitivePage(), Format(), D_PAD::GetRoundRectRadiusRatio(), DIALOG_PAD_PROPERTIES_BASE::m_cbBottomLeft, DIALOG_PAD_PROPERTIES_BASE::m_cbBottomRight, DIALOG_PAD_PROPERTIES_BASE::m_cbTopLeft, DIALOG_PAD_PROPERTIES_BASE::m_cbTopRight, m_cornerRadius, m_dummyPad, m_offsetX, m_offsetY, DIALOG_PAD_PROPERTIES_BASE::m_PadShape, m_sizeY, DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerSizeRatio, DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerSizeRatioUnit, DIALOG_PAD_PROPERTIES_BASE::m_staticTextcps, DIALOG_PAD_PROPERTIES_BASE::m_tcChamferRatio, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, DIALOG_PAD_PROPERTIES_BASE::m_trapAxisCtrl, DIALOG_PAD_PROPERTIES_BASE::m_trapAxisLabel, m_trapDelta, DIALOG_PAD_PROPERTIES_BASE::m_ZoneCustomPadShape, redraw(), transferDataToPad(), and updateRoundRectCornerValues().

Referenced by initValues().

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 299 of file dialog_shim.cpp.

300 {
301  if( m_firstPaintEvent )
302  {
303 #ifdef __WXMAC__
304  fixOSXCancelButtonIssue( this );
305 #endif
306 
307  selectAllInTextCtrls( GetChildren() );
308 
310  m_initialFocusTarget->SetFocus();
311  else
312  SetFocus(); // Focus the dialog itself
313 
314  m_firstPaintEvent = false;
315  }
316 
317  event.Skip();
318 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:192
bool m_firstPaintEvent
Definition: dialog_shim.h:191
static void selectAllInTextCtrls(wxWindowList &children)

References DIALOG_SHIM::m_firstPaintEvent, DIALOG_SHIM::m_initialFocusTarget, and selectAllInTextCtrls().

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ OnPaintShowPanel()

void DIALOG_PAD_PROPERTIES::OnPaintShowPanel ( wxPaintEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 276 of file dialog_pad_properties.cpp.

277 {
278  wxPaintDC dc( m_panelShowPad );
279  PAD_DRAWINFO drawInfo;
280 
282 
283  if( m_dummyPad->GetLayerSet()[F_Cu] )
285 
286  if( m_dummyPad->GetLayerSet()[B_Cu] )
288 
289  // What could happen: the pad color is *actually* black, or no copper was selected
290  if( color == BLACK )
291  color = LIGHTGRAY;
292 
293  drawInfo.m_Color = color;
294  drawInfo.m_HoleColor = DARKGRAY;
295  drawInfo.m_Offset = m_dummyPad->GetPosition();
296  drawInfo.m_Display_padnum = true;
297  drawInfo.m_Display_netname = true;
298  drawInfo.m_ShowPadFilled = !m_sketchPreview;
299 
301  drawInfo.m_ShowNotPlatedHole = true;
302 
303  // Shows the local pad clearance
305 
306  wxSize dc_size = dc.GetSize();
307  dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
308 
309  // Calculate a suitable scale to fit the available draw area
310  int dim = m_dummyPad->GetBoundingRadius() *2;
311 
312  // Invalid x size. User could enter zero, or have deleted all text prior to
313  // entering a new value; this is also treated as zero. If dim is left at
314  // zero, the drawing scale is zero and we get a crash.
315  if( dim == 0 )
316  {
317  // If drill size has been set, use that. Otherwise default to 1mm.
318  dim = m_dummyPad->GetDrillSize().x;
319 
320  if( dim == 0 )
321  dim = Millimeter2iu( 1.0 );
322  }
323 
324  if( m_dummyPad->GetLocalClearance() > 0 )
325  dim += m_dummyPad->GetLocalClearance() * 2;
326 
327  double scale = (double) dc_size.x / dim;
328 
329  // If the pad is a circle, use the x size here instead.
330  int ysize;
331 
333  ysize = m_dummyPad->GetSize().x;
334  else
335  ysize = m_dummyPad->GetSize().y;
336 
337  dim = ysize + std::abs( m_dummyPad->GetDelta().x );
338 
339  // Invalid y size. See note about x size above.
340  if( dim == 0 )
341  {
342  dim = m_dummyPad->GetDrillSize().y;
343 
344  if( dim == 0 )
345  dim = Millimeter2iu( 0.1 );
346  }
347 
348  if( m_dummyPad->GetLocalClearance() > 0 )
349  dim += m_dummyPad->GetLocalClearance() * 2;
350 
351  double altscale = (double) dc_size.y / dim;
352  scale = std::min( scale, altscale );
353 
354  // Give a margin
355  scale *= 0.7;
356  dc.SetUserScale( scale, scale );
357 
358  GRResetPenAndBrush( &dc );
359  m_dummyPad->PrintShape( &dc, drawInfo );
360 
361  // draw selected primitives:
362  long select = m_listCtrlPrimitives->GetFirstSelected();
363 
364  while( select >= 0 )
365  {
366  PAD_CS_PRIMITIVE& primitive = m_primitives[select];
367 
368  // The best way to calculate parameters to draw a primitive is to
369  // use a dummy DRAWSEGMENT and use its methods
370  // Note: in legacy canvas, the pad has the 0,0 position
371  DRAWSEGMENT dummySegment;
372  primitive.ExportTo( &dummySegment );
373  dummySegment.Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() );
374 
375  switch( primitive.m_Shape )
376  {
377  case S_SEGMENT: // usual segment : line with rounded ends
378  if( !m_sketchPreview )
379  GRFilledSegment( NULL, &dc, dummySegment.GetStart(), dummySegment.GetEnd(),
380  primitive.m_Thickness, m_selectedColor );
381  else
382  GRCSegm( NULL, &dc, dummySegment.GetStart(), dummySegment.GetEnd(),
383  primitive.m_Thickness, m_selectedColor );
384  break;
385 
386  case S_ARC: // Arc with rounded ends
387  if( !m_sketchPreview )
388  GRArc1( NULL, &dc, dummySegment.GetArcEnd(), dummySegment.GetArcStart(),
389  dummySegment.GetCenter(), primitive.m_Thickness, m_selectedColor );
390  else
391  {
392  GRArc1( NULL, &dc, dummySegment.GetArcEnd(), dummySegment.GetArcStart(),
393  dummySegment.GetCenter(), 0, m_selectedColor );
394 /* GRArc1( NULL, &dc, dummySegment.GetArcEnd(), dummySegment.GetArcStart(),
395  dummySegment.GetCenter() - primitive.m_Thickness, 0, m_selectedColor );*/
396  }
397  break;
398 
399  case S_CIRCLE: // ring or circle
400  if( primitive.m_Thickness )
401  {
402  if( !m_sketchPreview )
403  GRCircle( nullptr, &dc, dummySegment.GetCenter(), primitive.m_Radius,
404  primitive.m_Thickness, m_selectedColor );
405  else
406  {
407  GRCircle( nullptr, &dc, dummySegment.GetCenter(),
408  primitive.m_Radius + primitive.m_Thickness/2, 0, m_selectedColor );
409  GRCircle( nullptr, &dc, dummySegment.GetCenter(),
410  primitive.m_Radius - primitive.m_Thickness/2, 0, m_selectedColor );
411  }
412  }
413  else
414  {
415  if( !m_sketchPreview )
416  GRFilledCircle( nullptr, &dc, dummySegment.GetCenter(), primitive.m_Radius,
417  m_selectedColor );
418  else
419  GRCircle( nullptr, &dc, dummySegment.GetCenter(), primitive.m_Radius, 0,
420  m_selectedColor );
421  }
422  break;
423 
424  case S_POLYGON: // polygon
425  {
426  std::vector<wxPoint> poly = dummySegment.BuildPolyPointsList();
427  GRClosedPoly( nullptr, &dc, poly.size(), &poly[0], !m_sketchPreview,
429  }
430  break;
431 
432  default:
433  break;
434  }
435 
436  select = m_listCtrlPrimitives->GetNextSelected( select );
437  }
438 
439  // Draw X and Y axis. This is particularly useful to show the
440  // reference position of pads with offset and no hole, or custom pad shapes
441  const int t = 0; // line thickness
442  GRLine( nullptr, &dc, -int( dc_size.x/scale ), 0, int( dc_size.x/scale ), 0, t, LIGHTBLUE );
443  GRLine( nullptr, &dc, 0, -int( dc_size.y/scale ), 0, int( dc_size.y/scale ), t, LIGHTBLUE );
444 
445  event.Skip();
446 }
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:120
bool m_Display_padnum
Definition: class_pad.h:73
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
const wxPoint GetCenter() const override
Function GetCenter()
const wxPoint GetArcEnd() const
void ExportTo(DRAWSEGMENT *aTarget)
Export the PAD_CS_PRIMITIVE parameters to a DRAWSEGMENT useful to draw a primitive shape.
int color
Definition: DXF_plotter.cpp:62
polygon (not yet used for tracks, but could be in microwave apps)
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:312
usual segment : line with rounded ends
const std::vector< wxPoint > BuildPolyPointsList() const
Build and return the list of corners in a std::vector<wxPoint> It must be used only to convert the SH...
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
void GRFilledCircle(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:623
#define abs(a)
Definition: auxiliary.h:84
int GetLocalClearance() const
Definition: class_pad.h:441
void GRClosedPoly(EDA_RECT *ClipBox, wxDC *DC, int n, wxPoint Points[], bool Fill, COLOR4D Color, COLOR4D BgColor)
Function GRClosedPoly draws a closed polygon onto the drawing context aDC and optionally fills and/or...
Definition: gr_basic.cpp:556
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:429
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:96
PCB_GENERAL_SETTINGS & Settings()
Arcs (with rounded ends)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:426
COLOR4D m_HoleColor
Definition: class_pad.h:68
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.h:622
void PrintShape(wxDC *aDC, PAD_DRAWINFO &aDrawInfo)
Function PrintShape basic function to print a pad.
const wxPoint & GetArcStart() const
bool m_ShowNotPlatedHole
Definition: class_pad.h:78
const wxSize & GetDelta() const
Definition: class_pad.h:287
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:230
STROKE_T m_Shape
Definition: class_pad.h:92
int m_PadClearance
Definition: class_pad.h:71
COLORS_DESIGN_SETTINGS & Colors()
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:93
virtual void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
wxPoint m_Offset
Definition: class_pad.h:81
const int scale
smd pads, front layer
std::vector< PAD_CS_PRIMITIVE > m_primitives
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:406
void GRFilledSegment(EDA_RECT *aClipBox, wxDC *aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor)
Definition: gr_basic.cpp:423
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:600
const wxSize & GetDrillSize() const
Definition: class_pad.h:290
bool m_ShowPadFilled
Definition: class_pad.h:75
COLOR4D m_Color
Definition: class_pad.h:66
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221
Definition: colors.h:45
bool m_Display_netname
Definition: class_pad.h:74
const wxSize & GetSize() const
Definition: class_pad.h:284
const wxPoint GetPosition() const override
Definition: class_pad.h:225
#define min(a, b)
Definition: auxiliary.h:85
void GRArc1(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int xc, int yc, COLOR4D Color)
Definition: gr_basic.cpp:644
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References abs, B_Cu, BLACK, DRAWSEGMENT::BuildPolyPointsList(), color, PCB_GENERAL_SETTINGS::Colors(), DARKGRAY, PAD_CS_PRIMITIVE::ExportTo(), F_Cu, DRAWSEGMENT::GetArcEnd(), DRAWSEGMENT::GetArcStart(), D_PAD::GetAttribute(), D_PAD::GetBoundingRadius(), DRAWSEGMENT::GetCenter(), D_PAD::GetDelta(), D_PAD::GetDrillSize(), DRAWSEGMENT::GetEnd(), COLORS_DESIGN_SETTINGS::GetItemColor(), D_PAD::GetLayerSet(), D_PAD::GetLocalClearance(), D_PAD::GetOrientation(), D_PAD::GetPosition(), D_PAD::GetShape(), D_PAD::GetSize(), DRAWSEGMENT::GetStart(), GRArc1(), GRCircle(), GRClosedPoly(), GRCSegm(), GRFilledCircle(), GRFilledSegment(), GRLine(), GRResetPenAndBrush(), LAYER_PAD_BK, LAYER_PAD_FR, LIGHTBLUE, LIGHTGRAY, PAD_DRAWINFO::m_Color, PAD_DRAWINFO::m_Display_netname, PAD_DRAWINFO::m_Display_padnum, m_dummyPad, PAD_DRAWINFO::m_HoleColor, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, PAD_DRAWINFO::m_Offset, PAD_DRAWINFO::m_PadClearance, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPad, m_parent, m_primitives, PAD_CS_PRIMITIVE::m_Radius, m_selectedColor, PAD_CS_PRIMITIVE::m_Shape, PAD_DRAWINFO::m_ShowNotPlatedHole, PAD_DRAWINFO::m_ShowPadFilled, m_sketchPreview, PAD_CS_PRIMITIVE::m_Thickness, min, PAD_ATTRIB_HOLE_NOT_PLATED, PAD_SHAPE_CIRCLE, D_PAD::PrintShape(), DRAWSEGMENT::Rotate(), S_ARC, S_CIRCLE, S_POLYGON, S_SEGMENT, scale, and PCB_BASE_FRAME::Settings().

◆ onPrimitiveDClick()

void DIALOG_PAD_PROPERTIES::onPrimitiveDClick ( wxMouseEvent &  event)
overrideprivatevirtual

Called on a double click on the basic shapes list.

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1873 of file dialog_pad_properties.cpp.

1874 {
1875  editPrimitive();
1876 }

References editPrimitive().

◆ OnPrimitiveSelection()

void DIALOG_PAD_PROPERTIES::OnPrimitiveSelection ( wxListEvent &  event)
overrideprivatevirtual

Called on selection/deselection of a basic shape.

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1864 of file dialog_pad_properties.cpp.

1865 {
1866  // Called on a double click on the basic shapes list
1867  // To Do: highligth the primitive(s) currently selected.
1868  redraw();
1869 }

References redraw().

◆ OnResize()

void DIALOG_PAD_PROPERTIES::OnResize ( wxSizeEvent &  event)
private

Definition at line 869 of file dialog_pad_properties.cpp.

870 {
871  redraw();
872  event.Skip();
873 }

References redraw().

Referenced by prepareCanvas().

◆ OnSetLayers()

void DIALOG_PAD_PROPERTIES::OnSetLayers ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1124 of file dialog_pad_properties.cpp.

1125 {
1127  redraw();
1128 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.

References m_dummyPad, redraw(), and transferDataToPad().

◆ OnUpdateUI()

void DIALOG_PAD_PROPERTIES::OnUpdateUI ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1054 of file dialog_pad_properties.cpp.

1055 {
1056  int ii = m_PadType->GetSelection();
1057 
1058  if( (unsigned)ii >= arrayDim( code_type ) ) // catches < 0 also
1059  ii = 0;
1060 
1061  bool hasHole, hasConnection;
1062 
1063  switch( ii )
1064  {
1065  default:
1066  case 0: /* PTH */ hasHole = true; hasConnection = true; break;
1067  case 1: /* SMD */ hasHole = false; hasConnection = true; break;
1068  case 2: /* CONN */ hasHole = false; hasConnection = true; break;
1069  case 3: /* NPTH */ hasHole = true; hasConnection = false; break;
1070  case 4: /* Aperture */ hasHole = false; hasConnection = false; break;
1071  }
1072 
1073  // Enable/disable hole controls
1074  m_holeShapeLabel->Enable( hasHole );
1075  m_holeShapeCtrl->Enable( hasHole );
1076  m_holeX.Enable( hasHole );
1077  m_holeY.Enable( hasHole && m_holeShapeCtrl->GetSelection() == 1 );
1078 
1079  // Enable/disable Pad number, net and pad length-to-die
1080  m_PadNumText->Enable( hasConnection );
1081  m_PadNumCtrl->Enable( hasConnection );
1082  m_PadNameText->Enable( hasConnection );
1083  m_PadNetSelector->Enable( hasConnection && m_canEditNetName && m_currentPad );
1084  m_padToDie.Enable( hasConnection );
1085 
1086  // Enable/disable Copper Layers control
1087  m_rbCopperLayersSel->Enable( ii != 4 );
1088 }
static PAD_ATTR_T code_type[]
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
void Enable(bool aEnable)
Function Enable Enables/diasables the label, widget and units label.

References arrayDim(), code_type, UNIT_BINDER::Enable(), m_canEditNetName, m_currentPad, DIALOG_PAD_PROPERTIES_BASE::m_holeShapeCtrl, DIALOG_PAD_PROPERTIES_BASE::m_holeShapeLabel, m_holeX, m_holeY, DIALOG_PAD_PROPERTIES_BASE::m_PadNameText, DIALOG_PAD_PROPERTIES_BASE::m_PadNetSelector, DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadNumText, m_padToDie, DIALOG_PAD_PROPERTIES_BASE::m_PadType, and DIALOG_PAD_PROPERTIES_BASE::m_rbCopperLayersSel.

◆ OnUpdateUINonCopperWarning()

void DIALOG_PAD_PROPERTIES::OnUpdateUINonCopperWarning ( wxUpdateUIEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 114 of file dialog_pad_properties.h.

115  {
116  bool isOnCopperLayer = ( m_dummyPad->GetLayerSet() & LSET::AllCuMask() ).any();
117  m_nonCopperWarningBook->SetSelection( isOnCopperLayer ? 0 : 1 );
118  }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:676
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:426

References LSET::AllCuMask(), D_PAD::GetLayerSet(), m_dummyPad, and DIALOG_PAD_PROPERTIES_BASE::m_nonCopperWarningBook.

◆ OnValuesChanged()

void DIALOG_PAD_PROPERTIES::OnValuesChanged ( wxCommandEvent &  event)
overrideprivatevirtual

Called when a dimension has changed.

Update the graphical pad shown in the panel.

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1809 of file dialog_pad_properties.cpp.

1810 {
1811  if( m_canUpdate )
1812  {
1814  // If the pad size has changed, update the displayed values
1815  // for rounded rect pads
1817 
1818  redraw();
1819  }
1820 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.

References m_canUpdate, m_dummyPad, redraw(), transferDataToPad(), and updateRoundRectCornerValues().

Referenced by DIALOG_PAD_PROPERTIES(), and ~DIALOG_PAD_PROPERTIES().

◆ PadOrientEvent()

void DIALOG_PAD_PROPERTIES::PadOrientEvent ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 997 of file dialog_pad_properties.cpp.

998 {
1000  redraw();
1001 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.

References m_dummyPad, redraw(), and transferDataToPad().

◆ PadTypeSelected()

void DIALOG_PAD_PROPERTIES::PadTypeSelected ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1004 of file dialog_pad_properties.cpp.

1005 {
1006  int ii = m_PadType->GetSelection();
1007 
1008  if( (unsigned)ii >= arrayDim( code_type ) ) // catches < 0 also
1009  ii = 0;
1010 
1011  bool hasHole, hasConnection;
1012 
1013  switch( ii )
1014  {
1015  default:
1016  case 0: /* PTH */ hasHole = true; hasConnection = true; break;
1017  case 1: /* SMD */ hasHole = false; hasConnection = true; break;
1018  case 2: /* CONN */ hasHole = false; hasConnection = true; break;
1019  case 3: /* NPTH */ hasHole = true; hasConnection = false; break;
1020  case 4: /* Aperture */ hasHole = false; hasConnection = false; break;
1021  }
1022 
1023  LSET layer_mask = std_pad_layers[ii];
1024  setPadLayersList( layer_mask );
1025 
1026  if( !hasHole )
1027  {
1028  m_holeX.SetValue( 0 );
1029  m_holeY.SetValue( 0 );
1030  }
1031  else if ( m_holeX.GetValue() == 0 && m_currentPad )
1032  {
1035  }
1036 
1037  if( !hasConnection )
1038  {
1039  m_PadNumCtrl->SetValue( wxEmptyString );
1041  m_padToDie.SetValue( 0 );
1042  }
1043  else if( m_PadNumCtrl->GetValue().IsEmpty() && m_currentPad )
1044  {
1045  m_PadNumCtrl->SetValue( m_currentPad->GetName() );
1047  }
1048 
1050  redraw();
1051 }
int GetNetCode() const
Function GetNetCode.
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
void setPadLayersList(LSET layer_mask)
Function setPadLayersList updates the CheckBox states in pad layers list,.
static PAD_ATTR_T code_type[]
Class LSET is a set of PCB_LAYER_IDs.
void SetSelectedNetcode(int aNetcode)
const wxString & GetName() const
Definition: class_pad.h:195
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
static const LSET std_pad_layers[]
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
const wxSize & GetDrillSize() const
Definition: class_pad.h:290
virtual long long int GetValue()
Function GetValue Returns the current value in Internal Units.

References arrayDim(), code_type, D_PAD::GetDrillSize(), D_PAD::GetName(), BOARD_CONNECTED_ITEM::GetNetCode(), UNIT_BINDER::GetValue(), m_currentPad, m_dummyPad, m_holeX, m_holeY, DIALOG_PAD_PROPERTIES_BASE::m_PadNetSelector, DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl, m_padToDie, DIALOG_PAD_PROPERTIES_BASE::m_PadType, redraw(), setPadLayersList(), NET_SELECTOR::SetSelectedNetcode(), UNIT_BINDER::SetValue(), std_pad_layers, and transferDataToPad().

◆ padValuesOK()

bool DIALOG_PAD_PROPERTIES::padValuesOK ( )
private

test if all values are acceptable for the pad

Definition at line 1132 of file dialog_pad_properties.cpp.

1133 {
1134  bool error = transferDataToPad( m_dummyPad );
1135  bool skip_tstoffset = false; // the offset prm is not always tested
1136 
1137  wxArrayString error_msgs;
1138  wxString msg;
1139 
1140  // Test for incorrect values
1141  if( (m_dummyPad->GetSize().x <= 0) ||
1142  ((m_dummyPad->GetSize().y <= 0) && (m_dummyPad->GetShape() != PAD_SHAPE_CIRCLE)) )
1143  {
1144  error_msgs.Add( _( "Pad size must be greater than zero" ) );
1145  }
1146 
1147  if( (m_dummyPad->GetSize().x < m_dummyPad->GetDrillSize().x) ||
1148  (m_dummyPad->GetSize().y < m_dummyPad->GetDrillSize().y) )
1149  {
1150  error_msgs.Add( _( "Incorrect value for pad drill: pad drill bigger than pad size" ) );
1151  skip_tstoffset = true; // offset prm will be not tested because if the drill value
1152  // is incorrect the offset prm is always seen as incorrect, even if it is 0
1153  }
1154 
1155  if( m_dummyPad->GetLocalClearance() < 0 )
1156  {
1157  error_msgs.Add( _( "Pad local clearance must be zero or greater than zero" ) );
1158  }
1159 
1160  // Some pads need a negative solder mask clearance (mainly for BGA with small pads)
1161  // However the negative solder mask clearance must not create negative mask size
1162  // Therefore test for minimal acceptable negative value
1163  // Hovewer, a negative value can give strange result with custom shapes, so it is not
1164  // allowed for custom pad shape
1166  {
1168  error_msgs.Add( _( "Pad local solder mask clearance must be zero or greater than zero" ) );
1169  else
1170  {
1171  int min_smClearance = -std::min( m_dummyPad->GetSize().x, m_dummyPad->GetSize().y )/2;
1172 
1173  if( m_dummyPad->GetLocalSolderMaskMargin() <= min_smClearance )
1174  {
1175  error_msgs.Add( wxString::Format(
1176  _( "Pad local solder mask clearance must be greater than %s" ),
1177  StringFromValue( GetUserUnits(), min_smClearance, true, true ) ) );
1178  }
1179  }
1180  }
1181 
1182  // Some pads need a positive solder paste clearance (mainly for BGA with small pads)
1183  // Hovewer, a positive value can create issues if the resulting shape is too big.
1184  // (like a solder paste creating a solder paste area on a neighbour pad or on the solder mask)
1185  // So we could ask for user to confirm the choice
1186  // Currently there are no test
1187 
1188  LSET padlayers_mask = m_dummyPad->GetLayerSet();
1189 
1190  if( padlayers_mask == 0 )
1191  error_msgs.Add( _( "Error: pad has no layer" ) );
1192 
1193  if( !padlayers_mask[F_Cu] && !padlayers_mask[B_Cu] )
1194  {
1195  if( m_dummyPad->GetDrillSize().x || m_dummyPad->GetDrillSize().y )
1196  {
1197  // Note: he message is shown in an HTML window
1198  msg = _( "Error: the pad is not on a copper layer and has a hole" );
1199 
1201  {
1202  msg += wxT( "<br><br><i>" );
1203  msg += _( "For NPTH pad, set pad size value to pad drill value,"
1204  " if you do not want this pad plotted in gerber files" );
1205  }
1206 
1207  error_msgs.Add( msg );
1208  }
1209  }
1210 
1211  if( !skip_tstoffset )
1212  {
1213  wxPoint max_size;
1214  max_size.x = std::abs( m_dummyPad->GetOffset().x );
1215  max_size.y = std::abs( m_dummyPad->GetOffset().y );
1216  max_size.x += m_dummyPad->GetDrillSize().x / 2;
1217  max_size.y += m_dummyPad->GetDrillSize().y / 2;
1218 
1219  if( ( m_dummyPad->GetSize().x / 2 < max_size.x ) ||
1220  ( m_dummyPad->GetSize().y / 2 < max_size.y ) )
1221  {
1222  error_msgs.Add( _( "Incorrect value for pad offset" ) );
1223  }
1224  }
1225 
1226  if( error )
1227  error_msgs.Add( _( "Too large value for pad delta size" ) );
1228 
1229  switch( m_dummyPad->GetAttribute() )
1230  {
1231  case PAD_ATTRIB_HOLE_NOT_PLATED: // Not plated, but through hole, a hole is expected
1232  case PAD_ATTRIB_STANDARD : // Pad through hole, a hole is also expected
1233  if( m_dummyPad->GetDrillSize().x <= 0 ||
1235  error_msgs.Add( _( "Error: Through hole pad: drill diameter set to 0" ) );
1236  break;
1237 
1238  case PAD_ATTRIB_CONN: // Connector pads are smd pads, just they do not have solder paste.
1239  if( padlayers_mask[B_Paste] || padlayers_mask[F_Paste] )
1240  error_msgs.Add( _( "Error: Connector pads are not on the solder paste layer\n"
1241  "Use SMD pads instead" ) );
1242  // Fall trough
1243  case PAD_ATTRIB_SMD: // SMD and Connector pads (One external copper layer only)
1244  {
1245  LSET innerlayers_mask = padlayers_mask & LSET::InternalCuMask();
1246 
1247  if( ( padlayers_mask[F_Cu] && padlayers_mask[B_Cu] ) ||
1248  innerlayers_mask.count() != 0 )
1249  error_msgs.Add( _( "Error: only one external copper layer allowed for SMD or Connector pads" ) );
1250  }
1251  break;
1252  }
1253 
1254 
1257  {
1258  wxString value = m_tcCornerSizeRatio->GetValue();
1259  double rrRadiusRatioPercent;
1260 
1261  if( !value.ToDouble( &rrRadiusRatioPercent ) )
1262  error_msgs.Add( _( "Incorrect corner size value" ) );
1263  else
1264  {
1265  if( rrRadiusRatioPercent < 0.0 )
1266  error_msgs.Add( _( "Incorrect (negative) corner size value" ) );
1267  else if( rrRadiusRatioPercent > 50.0 )
1268  error_msgs.Add( _( "Corner size value must be smaller than 50%" ) );
1269  }
1270  }
1271 
1273  {
1275  error_msgs.Add( _( "Incorrect pad shape: the shape must be equivalent to only one polygon" ) );
1276  }
1277 
1278 
1279  if( error_msgs.GetCount() )
1280  {
1281  HTML_MESSAGE_BOX dlg( this, _("Pad setup errors list" ) );
1282  dlg.ListSet( error_msgs );
1283  dlg.ShowModal();
1284  }
1285 
1286  return error_msgs.GetCount() == 0;
1287 }
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:438
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:62
#define abs(a)
Definition: auxiliary.h:84
int GetLocalClearance() const
Definition: class_pad.h:441
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:429
Class LSET is a set of PCB_LAYER_IDs.
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
const wxPoint & GetOffset() const
Definition: class_pad.h:293
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:412
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:426
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:636
Class HTML_MESSAGE_BOX.
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:63
#define _(s)
EDA_UNITS_T GetUserUnits() const
Definition: dialog_shim.h:135
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
const wxSize & GetDrillSize() const
Definition: class_pad.h:290
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221
const wxSize & GetSize() const
Definition: class_pad.h:284
wxString StringFromValue(EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:217
#define min(a, b)
Definition: auxiliary.h:85

References _, abs, B_Cu, B_Paste, F_Cu, F_Paste, Format(), D_PAD::GetAttribute(), D_PAD::GetDrillShape(), D_PAD::GetDrillSize(), D_PAD::GetLayerSet(), D_PAD::GetLocalClearance(), D_PAD::GetLocalSolderMaskMargin(), D_PAD::GetOffset(), D_PAD::GetShape(), D_PAD::GetSize(), DIALOG_SHIM::GetUserUnits(), LSET::InternalCuMask(), HTML_MESSAGE_BOX::ListSet(), m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, D_PAD::MergePrimitivesAsPolygon(), min, PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED, PAD_ATTRIB_SMD, PAD_ATTRIB_STANDARD, PAD_DRILL_SHAPE_OBLONG, PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_ROUNDRECT, StringFromValue(), and transferDataToPad().

Referenced by TransferDataFromWindow().

◆ prepareCanvas()

void DIALOG_PAD_PROPERTIES::prepareCanvas ( )
private

Definition at line 230 of file dialog_pad_properties.cpp.

231 {
232  // Initialize the canvas to display the pad
233 
234  // Show the X and Y axis. It is usefull because pad shape can have an offset
235  // or be a complex shape.
236  KIGFX::COLOR4D axis_color = LIGHTBLUE;
237 
239  Millimeter2iu( 0.2 ),
241  m_axisOrigin->SetDrawAtZero( true );
242 
246 
247  bool mousewheelPan = m_parent->GetCanvas()->GetViewControls()->IsMousewheelPanEnabled();
249 
250  m_panelShowPadGal->Show();
251  m_panelShowPad->Hide();
252 
254 
255  // fix the pad render mode (filled/not filled)
256  auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
257  bool sketchMode = m_cbShowPadOutline->IsChecked();
258  settings->SetSketchMode( LAYER_PADS_TH, sketchMode );
259  settings->SetSketchMode( LAYER_PAD_FR, sketchMode );
260  settings->SetSketchMode( LAYER_PAD_BK, sketchMode );
261  settings->SetSketchModeGraphicItems( sketchMode );
262 
263  // gives a non null grid size (0.001mm) because GAL layer does not like a 0 size grid:
264  double gridsize = 0.001 * IU_PER_MM;
265  view->GetGAL()->SetGridSize( VECTOR2D( gridsize, gridsize ) );
266  // And do not show the grid:
267  view->GetGAL()->SetGridVisibility( false );
268  view->Add( m_dummyPad );
269  view->Add( m_axisOrigin );
270 
272  Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) );
273 }
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
multilayer pads, usually with holes
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void EnableMousewheelPan(bool aEnable)
Function EnableMousewheelPan() Enables or disables mousewheel panning.
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:180
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
PCB_GENERAL_SETTINGS & Settings()
void SetDrawAtZero(bool aDrawFlag)
Function SetDrawAtZero() Set the draw at zero flag.
void SetStealsFocus(bool aStealsFocus)
Set whether focus is taken on certain events (mouseover, keys, etc).
void OnResize(wxSizeEvent &event)
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
void UseColorScheme(const COLORS_DESIGN_SETTINGS *aSettings)
Function UseColorScheme Applies layer color settings.
COLORS_DESIGN_SETTINGS & Colors()
bool SwitchBackend(GAL_TYPE aGalType) override
Function SwitchBackend Switches method of rendering graphics.
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
smd pads, front layer
virtual bool IsMousewheelPanEnabled() const
Function IsMousewheelPanEnabled()
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
Class VIEW.
Definition: view.h:61
const wxPoint GetPosition() const override
Definition: class_pad.h:225
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References KIGFX::VIEW::Add(), PCB_GENERAL_SETTINGS::Colors(), KIGFX::ORIGIN_VIEWITEM::CROSS, KIGFX::VIEW_CONTROLS::EnableMousewheelPan(), EDA_DRAW_PANEL_GAL::GetBackend(), PCB_BASE_FRAME::GetCanvas(), KIGFX::VIEW::GetGAL(), KIGFX::VIEW::GetPainter(), D_PAD::GetPosition(), KIGFX::PAINTER::GetSettings(), PCB_DRAW_PANEL_GAL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), KIGFX::VIEW_CONTROLS::IsMousewheelPanEnabled(), LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PADS_TH, LIGHTBLUE, m_axisOrigin, DIALOG_PAD_PROPERTIES_BASE::m_cbShowPadOutline, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPad, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal, m_parent, OnResize(), KIGFX::ORIGIN_VIEWITEM::SetDrawAtZero(), KIGFX::GAL::SetGridSize(), KIGFX::GAL::SetGridVisibility(), EDA_DRAW_PANEL_GAL::SetStealsFocus(), PCB_BASE_FRAME::Settings(), EDA_DRAW_PANEL_GAL::StartDrawing(), PCB_DRAW_PANEL_GAL::SwitchBackend(), and PCB_DRAW_PANEL_GAL::UseColorScheme().

Referenced by DIALOG_PAD_PROPERTIES().

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

Definition at line 34 of file kiway_holder.cpp.

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:170

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), LIB_CONTROL::AddSymbolToSchematic(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), CVPCB_MAINFRAME::DisplayStatus(), PCB_EDIT_FRAME::doAutoSave(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), LIB_CONTROL::ExportSymbolAsSVG(), LIB_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::GetSelectedAlias(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectFile(), CVPCB_MAINFRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), SCH_EDIT_FRAME::LoadSheetFromFile(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), DIALOG_SCH_SHEET_PROPS::OnBrowseClicked(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), SCH_EDIT_FRAME::OnCloseWindow(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_BOM::OnRunGenerator(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDITOR_CONTROL::Paste(), MODULE_EDITOR_TOOLS::PasteFootprint(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), SCH_DRAWING_TOOLS::PlaceComponent(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Print(), SCH_EDIT_FRAME::PrintPage(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SCH_EDIT_FRAME::RescueLegacyProject(), SCH_EDIT_FRAME::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), LIB_EDIT_FRAME::savePartAs(), SCH_EDIT_FRAME::SaveProject(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), DIALOG_BOARD_STATISTICS::saveReportClicked(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectCompFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), LIB_EDIT_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), KICAD_MANAGER_FRAME::SetProjectFileName(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), LIB_VIEW_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::UpdateTitle(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

◆ redraw()

void DIALOG_PAD_PROPERTIES::redraw ( )
private

Definition at line 1290 of file dialog_pad_properties.cpp.

1291 {
1294 
1295  // The layer used to place primitive items selected when editing custom pad shapes
1296  // we use here a layer never used in a pad:
1297  #define SELECTED_ITEMS_LAYER Dwgs_User
1298 
1300  KIGFX::PCB_RENDER_SETTINGS* settings =
1301  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
1303 
1304  view->Update( m_dummyPad );
1305 
1306  // delete previous items if highlight list
1307  while( m_highlight.size() )
1308  {
1309  delete m_highlight.back(); // the dtor also removes item from view
1310  m_highlight.pop_back();
1311  }
1312 
1313  // highlight selected primitives:
1314  long select = m_listCtrlPrimitives->GetFirstSelected();
1315 
1316  while( select >= 0 )
1317  {
1318  PAD_CS_PRIMITIVE& primitive = m_primitives[select];
1319 
1320  DRAWSEGMENT* dummySegment = new DRAWSEGMENT;
1321  dummySegment->SetLayer( SELECTED_ITEMS_LAYER );
1322  primitive.ExportTo( dummySegment );
1323  dummySegment->Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() );
1324  dummySegment->Move( m_dummyPad->GetPosition() );
1325 
1326  // Update selected primitive (highlight selected)
1327  switch( primitive.m_Shape )
1328  {
1329  case S_SEGMENT:
1330  case S_ARC:
1331  case S_CURVE:
1332  break;
1333 
1334  case S_CIRCLE: // ring or circle
1335  if( primitive.m_Thickness == 0 ) // filled circle
1336  { // the filled circle option does not exist in a DRAWSEGMENT
1337  // but it is easy to create it with a circle having the
1338  // right radius and outline width
1339  wxPoint end = dummySegment->GetCenter();
1340  end.x += primitive.m_Radius / 2;
1341  dummySegment->SetEnd( end );
1342  dummySegment->SetWidth( primitive.m_Radius );
1343  }
1344  break;
1345 
1346  case S_POLYGON:
1347  break;
1348 
1349  default:
1350  delete dummySegment;
1351  dummySegment = nullptr;
1352  break;
1353  }
1354 
1355  if( dummySegment )
1356  {
1357  view->Add( dummySegment );
1358  m_highlight.push_back( dummySegment );
1359  }
1360 
1361  select = m_listCtrlPrimitives->GetNextSelected( select );
1362  }
1363 
1364  BOX2I bbox = m_dummyPad->ViewBBox();
1365 
1366  if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
1367  {
1368  // gives a size to the full drawable area
1369  BOX2I drawbox;
1370  drawbox.Move( m_dummyPad->GetPosition() );
1371  drawbox.Inflate( bbox.GetSize().x * 2, bbox.GetSize().y * 2 );
1372 
1373  view->SetBoundary( drawbox );
1374 
1375  // Autozoom
1376  view->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) );
1377 
1378  // Add a margin
1379  view->SetScale( m_panelShowPadGal->GetView()->GetScale() * 0.7 );
1380 
1383  }
1384 }
void Move(const Vec &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
Definition: box2.h:118
void SetViewport(const BOX2D &aViewport)
Function SetViewport() Sets the visible area of the VIEW.
Definition: view.cpp:550
virtual void Move(const wxPoint &aMoveVector) override
Function Move move this object.
virtual void SetTopLayer(int aLayer, bool aEnabled=true)
Function SetTopLayer() Sets given layer to be displayed on the top or sets back the default order of ...
Definition: view.cpp:860
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
const wxPoint GetCenter() const override
Function GetCenter()
void ExportTo(DRAWSEGMENT *aTarget)
Export the PAD_CS_PRIMITIVE parameters to a DRAWSEGMENT useful to draw a primitive shape.
polygon (not yet used for tracks, but could be in microwave apps)
BOX2< VECTOR2D > BOX2D
Definition: box2.h:521
usual segment : line with rounded ends
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
Class PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:61
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers.
Definition: class_pad.cpp:1418
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:96
Arcs (with rounded ends)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Function SetLayerColor Changes the color used to draw a layer.
Definition: painter.h:232
Bezier Curve.
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
STROKE_T m_Shape
Definition: class_pad.h:92
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: view.cpp:578
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:93
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:300
virtual void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
std::vector< PAD_CS_PRIMITIVE > m_primitives
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:406
#define SELECTED_ITEMS_LAYER
void SetEnd(const wxPoint &aEnd)
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
const Vec & GetSize() const
Definition: box2.h:187
const Vec & GetOrigin() const
Definition: box2.h:191
Class VIEW.
Definition: view.h:61
void SetBoundary(const BOX2D &aBoundary)
Function SetBoundary() Sets limits for view area.
Definition: view.h:267
const wxPoint GetPosition() const override
Definition: class_pad.h:225
double GetScale() const
Function GetScale()
Definition: view.h:257
std::vector< DRAWSEGMENT * > m_highlight
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...
void SetWidth(int aWidth)

References KIGFX::VIEW::Add(), PAD_CS_PRIMITIVE::ExportTo(), DRAWSEGMENT::GetCenter(), D_PAD::GetOrientation(), BOX2< Vec >::GetOrigin(), KIGFX::VIEW::GetPainter(), D_PAD::GetPosition(), KIGFX::VIEW::GetScale(), KIGFX::PAINTER::GetSettings(), BOX2< Vec >::GetSize(), PCB_DRAW_PANEL_GAL::GetView(), BOX2< Vec >::Inflate(), m_dummyPad, m_highlight, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal, m_primitives, PAD_CS_PRIMITIVE::m_Radius, m_selectedColor, PAD_CS_PRIMITIVE::m_Shape, PAD_CS_PRIMITIVE::m_Thickness, BOX2< Vec >::Move(), DRAWSEGMENT::Move(), EDA_DRAW_PANEL_GAL::Refresh(), DRAWSEGMENT::Rotate(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_SEGMENT, SELECTED_ITEMS_LAYER, KIGFX::VIEW::SetBoundary(), DRAWSEGMENT::SetEnd(), BOARD_ITEM::SetLayer(), KIGFX::RENDER_SETTINGS::SetLayerColor(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::SetTopLayer(), KIGFX::VIEW::SetViewport(), DRAWSEGMENT::SetWidth(), EDA_DRAW_PANEL_GAL::StartDrawing(), EDA_DRAW_PANEL_GAL::StopDrawing(), KIGFX::VIEW::Update(), D_PAD::ViewBBox(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by editPrimitive(), onAddPrimitive(), onChangePadMode(), onCornerRadiusChange(), onCornerSizePercentChange(), onDeletePrimitive(), OnDrillShapeSelected(), onDuplicatePrimitive(), onGeometryTransform(), OnInitDialog(), OnPadShapeSelection(), OnPrimitiveSelection(), OnResize(), OnSetLayers(), OnValuesChanged(), PadOrientEvent(), and PadTypeSelected().

◆ SetInitialFocus()

void DIALOG_SHIM::SetInitialFocus ( wxWindow *  aWindow)
inlineinherited

Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.

Definition at line 118 of file dialog_shim.h.

119  {
120  m_initialFocusTarget = aWindow;
121  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:192

References DIALOG_SHIM::m_initialFocusTarget.

Referenced by DIALOG_BOM::DIALOG_BOM(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FIND::DIALOG_FIND(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_SCH_FIND::DIALOG_SCH_FIND(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchAllClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchRefClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchSelectedClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchValueClicked(), PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE(), PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), LIB_EDIT_FRAME::savePartAs(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow(), DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataToWindow(), and DIALOG_COPPER_ZONE::TransferDataToWindow().

◆ SetKiway()

void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

Parameters
aDestis the recipient of aKiway pointer. It is only used for debugging, since "this" is not a wxWindow*. "this" is a KIWAY_HOLDER mix-in.
aKiwayis often from a parent window, or from KIFACE::CreateWindow().

Definition at line 41 of file kiway_holder.cpp.

42 {
43 #if defined(DEBUG)
44  // offer a trap point for debugging most any window
45  wxASSERT( aDest );
46  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
47  {
48  int breakhere=1;
49  (void) breakhere;
50  }
51 #endif
52 
53  (void) aDest;
54 
55  m_kiway = aKiway;
56 }
KIWAY * m_kiway
Definition: kiway_holder.h:81
const char * name
Definition: DXF_plotter.cpp:61

References KIWAY_HOLDER::m_kiway, and name.

Referenced by InvokePcbLibTableEditor(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

◆ setPadLayersList()

void DIALOG_PAD_PROPERTIES::setPadLayersList ( LSET  layer_mask)
private

Function setPadLayersList updates the CheckBox states in pad layers list,.

Parameters
layer_mask= pad layer mask (ORed layers bit mask)

Definition at line 1091 of file dialog_pad_properties.cpp.

1092 {
1093  LSET cu_set = layer_mask & LSET::AllCuMask();
1094 
1095  if( cu_set == LSET( F_Cu ) )
1096  m_rbCopperLayersSel->SetSelection( 0 );
1097  else if( cu_set == LSET( B_Cu ) )
1098  m_rbCopperLayersSel->SetSelection( 1 );
1099  else if( cu_set.any() )
1100  m_rbCopperLayersSel->SetSelection( 2 );
1101  else
1102  m_rbCopperLayersSel->SetSelection( 3 );
1103 
1104  m_PadLayerAdhCmp->SetValue( layer_mask[F_Adhes] );
1105  m_PadLayerAdhCu->SetValue( layer_mask[B_Adhes] );
1106 
1107  m_PadLayerPateCmp->SetValue( layer_mask[F_Paste] );
1108  m_PadLayerPateCu->SetValue( layer_mask[B_Paste] );
1109 
1110  m_PadLayerSilkCmp->SetValue( layer_mask[F_SilkS] );
1111  m_PadLayerSilkCu->SetValue( layer_mask[B_SilkS] );
1112 
1113  m_PadLayerMaskCmp->SetValue( layer_mask[F_Mask] );
1114  m_PadLayerMaskCu->SetValue( layer_mask[B_Mask] );
1115 
1116  m_PadLayerECO1->SetValue( layer_mask[Eco1_User] );
1117  m_PadLayerECO2->SetValue( layer_mask[Eco2_User] );
1118 
1119  m_PadLayerDraft->SetValue( layer_mask[Dwgs_User] );
1120 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:676
Class LSET is a set of PCB_LAYER_IDs.

References LSET::AllCuMask(), B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, Dwgs_User, Eco1_User, Eco2_User, F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerAdhCmp, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerAdhCu, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerDraft, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerECO1, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerECO2, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerMaskCmp, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerMaskCu, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerPateCmp, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerPateCu, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerSilkCmp, DIALOG_PAD_PROPERTIES_BASE::m_PadLayerSilkCu, and DIALOG_PAD_PROPERTIES_BASE::m_rbCopperLayersSel.

Referenced by initValues(), and PadTypeSelected().

◆ SetSizeInDU()

void DIALOG_SHIM::SetSizeInDU ( int  x,
int  y 
)
protectedinherited

Set the dialog to the given dimensions in "dialog units".

These are units equivalent to 4* the average character width and 8* the average character height, allowing a dialog to be sized in a way that scales it with the system font.

Definition at line 152 of file dialog_shim.cpp.

153 {
154  wxSize sz( x, y );
155  SetSize( ConvertDialogToPixels( sz ) );
156 }

Referenced by DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), and HTML_MESSAGE_BOX::SetDialogSizeInDU().

◆ Show()

bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 179 of file dialog_shim.cpp.

180 {
181  bool ret;
182  const char* hash_key;
183 
184  if( m_hash_key.size() )
185  {
186  // a special case like EDA_LIST_DIALOG, which has multiple uses.
187  hash_key = m_hash_key.c_str();
188  }
189  else
190  {
191  hash_key = typeid(*this).name();
192  }
193 
194  // Show or hide the window. If hiding, save current position and size.
195  // If showing, use previous position and size.
196  if( show )
197  {
198 #ifndef __WINDOWS__
199  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
200 #endif
201  ret = wxDialog::Show( show );
202 
203  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
204  EDA_RECT savedDialogRect = class_map[ hash_key ];
205 
206  if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
207  {
208  SetSize( savedDialogRect.GetPosition().x,
209  savedDialogRect.GetPosition().y,
210  std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
211  std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
212  0 );
213  }
214 
215  // Be sure that the dialog appears in a visible area
216  // (the dialog position might have been stored at the time when it was
217  // shown on another display)
218  if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
219  Centre();
220  }
221  else
222  {
223  // Save the dialog's position & size before hiding, using classname as key
224  class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() );
225 
226 #ifdef __WXMAC__
227  if ( m_eventLoop )
228  m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
229 #endif
230 
231  ret = wxDialog::Show( show );
232  }
233 
234  return ret;
235 }
std::string m_hash_key
Definition: dialog_shim.h:186
static RECT_MAP class_map
const wxPoint GetPosition() const
Definition: eda_rect.h:115
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
const wxSize GetSize() const
Definition: eda_rect.h:103

References class_map, EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, and max.

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickFootprints(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), DIALOG_SHIM::ShowQuasiModal(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

◆ ShowQuasiModal()

int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 344 of file dialog_shim.cpp.

345 {
346  // This is an exception safe way to zero a pointer before returning.
347  // Yes, even though DismissModal() clears this first normally, this is
348  // here in case there's an exception before the dialog is dismissed.
349  struct NULLER
350  {
351  void*& m_what;
352  NULLER( void*& aPtr ) : m_what( aPtr ) {}
353  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
354  } clear_this( (void*&) m_qmodal_loop );
355 
356  // release the mouse if it's currently captured as the window having it
357  // will be disabled when this dialog is shown -- but will still keep the
358  // capture making it impossible to do anything in the modal dialog itself
359  wxWindow* win = wxWindow::GetCapture();
360  if( win )
361  win->ReleaseMouse();
362 
363  // Get the optimal parent
364  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
365 
366  // Show the optimal parent
367  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
368 
369  wxASSERT_MSG( !m_qmodal_parent_disabler,
370  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
371 
372  // quasi-modal: disable only my "optimal" parent
374 
375 #ifdef __WXMAC__
376  // Apple in its infinite wisdom will raise a disabled window before even passing
377  // us the event, so we have no way to stop it. Instead, we must set an order on
378  // the windows so that the quasi-modal will be pushed in front of the disabled
379  // window when it is raised.
380  ReparentQuasiModal();
381 #endif
382  Show( true );
383 
384  m_qmodal_showing = true;
385 
386  WX_EVENT_LOOP event_loop;
387 
388  m_qmodal_loop = &event_loop;
389 
390  event_loop.Run();
391 
392  m_qmodal_showing = false;
393 
394  return GetReturnCode();
395 }
bool m_qmodal_showing
Definition: dialog_shim.h:196
#define WX_EVENT_LOOP
Definition: kiway_player.h:41
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:194
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:197
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:35
#define DBG(x)
Definition: fctsys.h:33

References DBG, DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, DIALOG_SHIM::Show(), and WX_EVENT_LOOP.

Referenced by LIB_EDIT_TOOL::editFieldProperties(), SCH_EDITOR_CONTROL::EditSymbolFields(), LIB_EDIT_TOOL::editSymbolProperties(), GLOBAL_EDIT_TOOL::EditTracksAndVias(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), PCB_BASE_FRAME::InstallPadOptionsFrame(), InvokeDialogEditComponentsLibId(), InvokeDialogRescueEach(), InvokeDialogUpdateFields(), SCH_EDITOR_CONTROL::NavigateHierarchy(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_BASE_FRAME::SelectCompFromLibTree(), and PCB_BASE_FRAME::SelectFootprintFromLibTree().

◆ TransferDataFromWindow()

bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow ( )
overrideprivate

Updates the different parameters for the component being edited.

Automatically fired from the OK button click.

Definition at line 1402 of file dialog_pad_properties.cpp.

1403 {
1404  BOARD_COMMIT commit( m_parent );
1405 
1406  if( !wxDialog::TransferDataFromWindow() )
1407  return false;
1408 
1409  if( !m_panelGeneral->TransferDataFromWindow() )
1410  return false;
1411 
1412  if( !m_localSettingsPanel->TransferDataFromWindow() )
1413  return false;
1414 
1415  if( !padValuesOK() )
1416  return false;
1417 
1418  int isign = m_isFlipped ? -1 : 1;
1419 
1421  // m_padMaster is a pattern: ensure there is no net for this pad:
1423 
1424  if( !m_currentPad ) // Set current Pad parameters
1425  return true;
1426 
1427  commit.Modify( m_currentPad );
1428 
1429  // redraw the area where the pad was, without pad (delete pad on screen)
1431  m_parent->GetCanvas()->Refresh();
1433 
1434  // Update values
1438 
1439  wxSize size;
1440  MODULE* footprint = m_currentPad->GetParent();
1441 
1442  if( footprint )
1443  {
1444  footprint->SetLastEditTime();
1445 
1446  // compute the pos 0 value, i.e. pad position for footprint with orientation = 0
1447  // i.e. relative to footprint origin (footprint position)
1448  wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition();
1449  RotatePoint( &pt, -footprint->GetOrientation() );
1450  m_currentPad->SetPos0( pt );
1452  + footprint->GetOrientation() );
1453  }
1454 
1456 
1457  size = m_padMaster->GetDelta();
1458  size.y *= isign;
1459  m_currentPad->SetDelta( size );
1460 
1463 
1464  wxPoint offset = m_padMaster->GetOffset();
1465  offset.y *= isign;
1466  m_currentPad->SetOffset( offset );
1467 
1469 
1472 
1473 
1476 
1477  if( m_isFlipped )
1478  {
1481  }
1482 
1484 
1485  if( m_isFlipped )
1486  {
1488  }
1489 
1491 
1492  int padNetcode = NETINFO_LIST::UNCONNECTED;
1493 
1494  // For PAD_ATTRIB_HOLE_NOT_PLATED, ensure there is no net name selected
1496  padNetcode = m_PadNetSelector->GetSelectedNetcode();
1497 
1498  m_currentPad->SetNetCode( padNetcode );
1509 
1510  // rounded rect pads with radius ratio = 0 are in fact rect pads.
1511  // So set the right shape (and perhaps issues with a radius = 0)
1514  {
1516  }
1517 
1518  // define the way the clearance area is defined in zones
1520 
1521  if( footprint )
1522  footprint->CalculateBoundingBox();
1523 
1525 
1526  // redraw the area where the pad was
1527  m_parent->GetCanvas()->Refresh();
1528 
1529  commit.Push( _( "Modify pad" ) );
1530 
1531  return true;
1532 }
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:438
double GetOrientation() const
Definition: class_module.h:218
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask,...
Definition: lset.cpp:521
void FlipPrimitives()
Flip the basic shapes, in custom pads.
Definition: class_pad.cpp:470
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:231
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
int GetPadToDieLength() const
Definition: class_pad.h:436
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:224
int GetSelectedNetcode()
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:289
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:206
void SetRoundRectRadiusRatio(double aRadiusScale)
has meaning only for rounded rect pads Set the scaling factor between the smaller Y or Y size and the...
Definition: class_pad.h:656
int GetThermalGap() const
Definition: class_pad.cpp:747
int GetLocalClearance() const
Definition: class_pad.h:441
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:429
int GetChamferPositions() const
has meaning only for chamfered rect pads
Definition: class_pad.h:693
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:258
const std::vector< PAD_CS_PRIMITIVE > & GetPrimitives() const
Accessor to the basic shape list.
Definition: class_pad.h:353
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:265
void SetZoneConnection(ZoneConnection aType)
Definition: class_pad.h:507
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12).
Definition: class_pad.h:187
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:277
const wxPoint & GetOffset() const
Definition: class_pad.h:293
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:412
double GetChamferRectRatio() const
has meaning only for chamfered rect pads
Definition: class_pad.h:670
int GetThermalWidth() const
Definition: class_pad.cpp:736
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:426
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:343
void SetThermalWidth(int aWidth)
Definition: class_pad.h:511
const wxString & GetName() const
Definition: class_pad.h:195
void SetSize(const wxSize &aSize)
Definition: class_pad.h:283
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Sets net using a net code.
void SetPadToDieLength(int aLength)
Definition: class_pad.h:435
const wxSize & GetDelta() const
Definition: class_pad.h:287
#define _(s)
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:421
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void SetLocalClearance(int aClearance)
Definition: class_pad.h:442
MODULE * GetParent() const
Definition: class_pad.h:167
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:448
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: class_pad.h:237
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:425
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:410
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:439
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:406
const wxSize & GetDrillSize() const
Definition: class_pad.h:290
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:222
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:430
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:644
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:266
bool padValuesOK()
test if all values are acceptable for the pad
void SetChamferRectRatio(double aChamferScale)
has meaning only for chamfered rect pads Set the ratio between the smaller Y or Y size and the radius...
Definition: class_pad.h:681
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:445
void SetCustomShapeInZoneOpt(CUST_PAD_SHAPE_IN_ZONE aOption)
Set the option for the custom pad shape to use as clearance area in copper zones.
Definition: class_pad.h:247
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221
ZoneConnection GetZoneConnection() const
Definition: class_pad.cpp:725
const wxSize & GetSize() const
Definition: class_pad.h:284
const wxPoint GetPosition() const override
Definition: class_pad.h:225
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:444
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:292
void SetThermalGap(int aGap)
Definition: class_pad.h:514
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:463
const wxPoint GetPosition() const override
Definition: class_module.h:213
bool SetPrimitives(const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
Import to the basic shape list.
void DeletePrimitivesList()
clear the basic shapes list
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:447
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:132
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:286
void SetChamferPositions(int aChamferPositions)
has meaning only for chamfered rect pads set the position of the chamfer for a 0 orientation,...
Definition: class_pad.h:701

References _, MODULE::CalculateBoundingBox(), EDA_ITEM::ClearFlags(), D_PAD::DeletePrimitivesList(), DO_NOT_DRAW, FlipLayerMask(), D_PAD::FlipPrimitives(), D_PAD::GetAnchorPadShape(), D_PAD::GetAttribute(), PCB_BASE_FRAME::GetCanvas(), D_PAD::GetChamferPositions(), D_PAD::GetChamferRectRatio(), D_PAD::GetCustomShapeInZoneOpt(), D_PAD::GetDelta(), D_PAD::GetDrillShape(), D_PAD::GetDrillSize(), D_PAD::GetLayerSet(), D_PAD::GetLocalClearance(), D_PAD::GetLocalSolderMaskMargin(), D_PAD::GetLocalSolderPasteMargin(), D_PAD::GetLocalSolderPasteMarginRatio(), D_PAD::GetName(), D_PAD::GetOffset(), MODULE::GetOrientation(), D_PAD::GetOrientation(), D_PAD::GetPadToDieLength(), D_PAD::GetParent(), MODULE::GetPosition(), D_PAD::GetPosition(), D_PAD::GetPrimitives(), D_PAD::GetRoundRectRadiusRatio(), NET_SELECTOR::GetSelectedNetcode(), D_PAD::GetShape(), D_PAD::GetSize(), D_PAD::GetThermalGap(), D_PAD::GetThermalWidth(), D_PAD::GetZoneConnection(), m_currentPad, m_isFlipped, DIALOG_PAD_PROPERTIES_BASE::m_localSettingsPanel, m_padMaster, DIALOG_PAD_PROPERTIES_BASE::m_PadNetSelector, DIALOG_PAD_PROPERTIES_BASE::m_panelGeneral, m_parent, COMMIT::Modify(), PAD_ATTRIB_HOLE_NOT_PLATED, PAD_SHAPE_CUSTOM, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, padValuesOK(), BOARD_COMMIT::Push(), EDA_DRAW_PANEL_GAL::Refresh(), RotatePoint(), D_PAD::SetAnchorPadShape(), D_PAD::SetAttribute(), D_PAD::SetChamferPositions(), D_PAD::SetChamferRectRatio(), D_PAD::SetCustomShapeInZoneOpt(), D_PAD::SetDelta(), D_PAD::SetDrillShape(), D_PAD::SetDrillSize(), EDA_ITEM::SetFlags(), MODULE::SetLastEditTime(), D_PAD::SetLayerSet(), D_PAD::SetLocalClearance(), D_PAD::SetLocalSolderMaskMargin(), D_PAD::SetLocalSolderPasteMargin(), D_PAD::SetLocalSolderPasteMarginRatio(), EDA_DRAW_FRAME::SetMsgPanel(), D_PAD::SetName(), BOARD_CONNECTED_ITEM::SetNetCode(), D_PAD::SetOffset(), D_PAD::SetOrientation(), D_PAD::SetPadToDieLength(), D_PAD::SetPos0(), D_PAD::SetPosition(), D_PAD::SetPrimitives(), D_PAD::SetRoundRectRadiusRatio(), D_PAD::SetShape(), D_PAD::SetSize(), D_PAD::SetThermalGap(), D_PAD::SetThermalWidth(), D_PAD::SetZoneConnection(), transferDataToPad(), and NETINFO_LIST::UNCONNECTED.

◆ transferDataToPad()

bool DIALOG_PAD_PROPERTIES::transferDataToPad ( D_PAD aPad)
private

Copy values from dialog field to aPad's members.

Definition at line 1535 of file dialog_pad_properties.cpp.

1536 {
1537  wxString msg;
1538 
1539  if( !Validate() )
1540  return true;
1541  if( !m_panelGeneral->Validate() )
1542  return true;
1543  if( !m_localSettingsPanel->Validate() )
1544  return true;
1545  if( !m_spokeWidth.Validate( 0, INT_MAX ) )
1546  return false;
1547 
1548  m_OrientValidator.TransferFromWindow();
1549 
1550  aPad->SetAttribute( code_type[m_PadType->GetSelection()] );
1551  aPad->SetShape( code_shape[m_PadShape->GetSelection()] );
1554 
1555  if( aPad->GetShape() == PAD_SHAPE_CUSTOM )
1556  aPad->SetPrimitives( m_primitives );
1557 
1558  // Read pad clearances values:
1563  aPad->SetThermalGap( m_thermalGap.GetValue() );
1564  double dtmp = 0.0;
1565  msg = m_SolderPasteMarginRatioCtrl->GetValue();
1566  msg.ToDouble( &dtmp );
1567 
1568  // A -50% margin ratio means no paste on a pad, the ratio must be >= -50%
1569  if( dtmp < -50.0 )
1570  dtmp = -50.0;
1571  // A margin ratio is always <= 0
1572  // 0 means use full pad copper area
1573  if( dtmp > 0.0 )
1574  dtmp = 0.0;
1575 
1576  aPad->SetLocalSolderPasteMarginRatio( dtmp / 100 );
1577 
1578  switch( m_ZoneConnectionChoice->GetSelection() )
1579  {
1580  default:
1581  case 0: aPad->SetZoneConnection( PAD_ZONE_CONN_INHERITED ); break;
1582  case 1: aPad->SetZoneConnection( PAD_ZONE_CONN_FULL ); break;
1583  case 2: aPad->SetZoneConnection( PAD_ZONE_CONN_THERMAL ); break;
1584  case 3: aPad->SetZoneConnection( PAD_ZONE_CONN_NONE ); break;
1585  }
1586 
1587  aPad->SetPosition( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
1588  aPad->SetPos0( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
1589 
1590  if( m_holeShapeCtrl->GetSelection() == 0 )
1591  {
1593  aPad->SetDrillSize( wxSize( m_holeX.GetValue(), m_holeX.GetValue() ) );
1594  }
1595  else
1596  {
1598  aPad->SetDrillSize( wxSize( m_holeX.GetValue(), m_holeY.GetValue() ) );
1599  }
1600 
1601  if( aPad->GetShape() == PAD_SHAPE_CIRCLE )
1602  aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeX.GetValue() ) );
1603  else
1604  aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeY.GetValue() ) );
1605 
1606  // Read pad length die
1608 
1609  // For a trapezoid, test delta value (be sure delta is not too large for pad size)
1610  // remember DeltaSize.x is the Y size variation
1611  bool error = false;
1612 
1613  if( aPad->GetShape() == PAD_SHAPE_TRAPEZOID )
1614  {
1615  wxSize delta;
1616 
1617  // For a trapezoid, only one of delta.x or delta.y is not 0, depending on
1618  // the direction.
1619  if( m_trapAxisCtrl->GetSelection() == 0 )
1620  delta.x = m_trapDelta.GetValue();
1621  else
1622  delta.y = m_trapDelta.GetValue();
1623 
1624  if( delta.x < 0 && delta.x <= -aPad->GetSize().y )
1625  {
1626  delta.x = -aPad->GetSize().y + 2;
1627  error = true;
1628  }
1629 
1630  if( delta.x > 0 && delta.x >= aPad->GetSize().y )
1631  {
1632  delta.x = aPad->GetSize().y - 2;
1633  error = true;
1634  }
1635 
1636  if( delta.y < 0 && delta.y <= -aPad->GetSize().x )
1637  {
1638  delta.y = -aPad->GetSize().x + 2;
1639  error = true;
1640  }
1641 
1642  if( delta.y > 0 && delta.y >= aPad->GetSize().x )
1643  {
1644  delta.y = aPad->GetSize().x - 2;
1645  error = true;
1646  }
1647 
1648  aPad->SetDelta( delta );
1649  }
1650 
1651  aPad->SetOffset( wxPoint( m_offsetX.GetValue(), m_offsetY.GetValue() ) );
1652  aPad->SetOrientation( m_OrientValue * 10.0 );
1653  aPad->SetName( m_PadNumCtrl->GetValue() );
1655 
1656  int chamfers = 0;
1657 
1658  if( m_cbTopLeft->GetValue() )
1659  chamfers |= RECT_CHAMFER_TOP_LEFT;
1660 
1661  if( m_cbTopRight->GetValue() )
1662  chamfers |= RECT_CHAMFER_TOP_RIGHT;
1663 
1664  if( m_cbBottomLeft->GetValue() )
1665  chamfers |= RECT_CHAMFER_BOTTOM_LEFT;
1666 
1667  if( m_cbBottomRight->GetValue() )
1668  chamfers |= RECT_CHAMFER_BOTTOM_RIGHT;
1669 
1670  aPad->SetChamferPositions( chamfers );
1671 
1672  // Clear some values, according to the pad type and shape
1673  switch( aPad->GetShape() )
1674  {
1675  case PAD_SHAPE_CIRCLE:
1676  aPad->SetOffset( wxPoint( 0, 0 ) );
1677  aPad->SetDelta( wxSize( 0, 0 ) );
1678  break;
1679 
1680  case PAD_SHAPE_RECT:
1681  aPad->SetDelta( wxSize( 0, 0 ) );
1682  break;
1683 
1684  case PAD_SHAPE_OVAL:
1685  aPad->SetDelta( wxSize( 0, 0 ) );
1686  break;
1687 
1688  case PAD_SHAPE_TRAPEZOID:
1689  break;
1690 
1691  case PAD_SHAPE_ROUNDRECT:
1693  aPad->SetDelta( wxSize( 0, 0 ) );
1694  break;
1695 
1696  case PAD_SHAPE_CUSTOM:
1697  aPad->SetOffset( wxPoint( 0, 0 ) );
1698  aPad->SetDelta( wxSize( 0, 0 ) );
1699 
1700  // The pad custom has a "anchor pad" (a basic shape: round or rect pad)
1701  // that is the minimal area of this pad, and is usefull to ensure a hole