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 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 override
 
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...
 

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_padToDieLabel
 
wxTextCtrl * m_padToDieCtrl
 
wxStaticText * m_padToDieUnits
 
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
 
TEXT_CTRL_EVALm_tcCornerRadius
 
wxStaticText * m_cornerRadiusUnits
 
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
 
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
 
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
 
wxStaticBoxSizer * m_sbSizerCustomShapedZonesSettings
 
wxStaticText * m_staticTextCsZconnTitle
 
wxChoice * m_ZoneConnectionCustom
 
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
 

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
 
virtual 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 56 of file dialog_pad_properties.h.

Member Enumeration Documentation

anonymous enum
protectedinherited

Constructor & Destructor Documentation

DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES ( PCB_BASE_FRAME aParent,
D_PAD aPad 
)

Definition at line 102 of file dialog_pad_properties.cpp.

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_staticTextInfoPosValue, DIALOG_PAD_PROPERTIES_BASE::m_techLayersLabel, OnValuesChanged(), prepareCanvas(), SELECTED, DIALOG_SHIM::SetInitialFocus(), NET_SELECTOR::SetNetInfo(), and TransferDataToWindow().

102  :
103  DIALOG_PAD_PROPERTIES_BASE( aParent ),
104  m_parent( aParent ),
105  m_canUpdate( false ),
108  m_sizeX( aParent, m_sizeXLabel, m_sizeXCtrl, m_sizeXUnits, true ),
109  m_sizeY( aParent, m_sizeYLabel, m_sizeYCtrl, m_sizeYUnits, true ),
115  m_holeX( aParent, m_holeXLabel, m_holeXCtrl, m_holeXUnits, true ),
116  m_holeY( aParent, m_holeYLabel, m_holeYCtrl, m_holeYUnits, true ),
123 {
124  m_currentPad = aPad; // aPad can be NULL, if the dialog is called
125  // from the footprint editor to set default pad setup
126 
128 
130 
131  m_OrientValidator.SetRange( -360.0, 360.0 );
132  m_orientation->SetValidator( m_OrientValidator );
133  m_OrientValidator.SetWindow( m_orientation );
134 
135  m_cbShowPadOutline->SetValue( m_sketchPreview );
136 
137  m_FlippedWarningIcon->SetBitmap( KiBitmap( dialog_warning_xpm ) );
138  m_nonCopperWarningIcon->SetBitmap( KiBitmap( dialog_warning_xpm ) );
139 
141  m_dummyPad = new D_PAD( (MODULE*) NULL );
142 
143  if( aPad )
144  {
145  *m_dummyPad = *aPad;
147  }
148  else // We are editing a "master" pad, i.e. a template to create new pads
150 
151  initValues();
152 
153  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
154  infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
155  m_techLayersLabel->SetFont( infoFont );
156  m_parentInfoLine1->SetFont( infoFont );
157  m_parentInfoLine2->SetFont( infoFont );
158  m_staticTextInfoNegVal->SetFont( infoFont );
159  m_staticTextInfoPosValue->SetFont( infoFont );
160  m_nonCopperNote->SetFont( infoFont );
161 
162  // Usually, TransferDataToWindow is called by OnInitDialog
163  // calling it here fixes all widget sizes so FinishDialogSettings can safely fix minsizes
165 
166  // Initialize canvas to be able to display the dummy pad:
167  prepareCanvas();
168 
170  m_sdbSizerOK->SetDefault();
171  m_canUpdate = true;
172 
173  m_PadNetSelector->Connect( NET_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES::OnValuesChanged ), NULL, this );
174 
175  // Now all widgets have the size fixed, call FinishDialogSettings
177 }
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
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
BOARD * GetBoard() const
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:115
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:121
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:138
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
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:756
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:137
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:257
DIALOG_PAD_PROPERTIES::~DIALOG_PAD_PROPERTIES ( )

Definition at line 180 of file dialog_pad_properties.cpp.

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

181 {
182  m_PadNetSelector->Disconnect( NET_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES::OnValuesChanged ), NULL, this );
183 
184  delete m_dummyPad;
185  delete m_axisOrigin;
186 }
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin

Member Function Documentation

void DIALOG_PAD_PROPERTIES::displayPrimitivesList ( )
private

Definition at line 766 of file dialog_pad_properties.cpp.

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_POLYGON, and S_SEGMENT.

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

767 {
768  m_listCtrlPrimitives->ClearAll();
769 
770  wxListItem itemCol;
771  itemCol.SetImage(-1);
772 
773  for( int ii = 0; ii < 5; ++ii )
774  m_listCtrlPrimitives->InsertColumn(ii, itemCol);
775 
776  wxString bs_info[5];
777 
778  for( unsigned ii = 0; ii < m_primitives.size(); ++ii )
779  {
780  const PAD_CS_PRIMITIVE& primitive = m_primitives[ii];
781 
782  for( unsigned jj = 0; jj < 5; ++jj )
783  bs_info[jj].Empty();
784 
785  bs_info[4] = wxString::Format( _( "width %s" ),
786  MessageTextFromValue( m_units, primitive.m_Thickness, true ) );
787 
788  switch( primitive.m_Shape )
789  {
790  case S_SEGMENT: // usual segment : line with rounded ends
791  bs_info[0] = _( "Segment" );
792  bs_info[1] = _( "from " ) + formatCoord( m_units, primitive.m_Start );
793  bs_info[2] = _( "to " ) + formatCoord( m_units, primitive.m_End );
794  break;
795 
796  case S_ARC: // Arc with rounded ends
797  bs_info[0] = _( "Arc" );
798  bs_info[1] = _( "center " ) + formatCoord( m_units, primitive.m_Start );// Center
799  bs_info[2] = _( "start " ) + formatCoord( m_units, primitive.m_End ); // Start point
800  bs_info[3] = wxString::Format( _( "angle %s" ), FormatAngle( primitive.m_ArcAngle ) );
801  break;
802 
803  case S_CIRCLE: // ring or circle
804  if( primitive.m_Thickness )
805  bs_info[0] = _( "ring" );
806  else
807  bs_info[0] = _( "circle" );
808 
809  bs_info[1] = formatCoord( m_units, primitive.m_Start );
810  bs_info[2] = wxString::Format( _( "radius %s" ),
811  MessageTextFromValue( m_units, primitive.m_Radius, true ) );
812  break;
813 
814  case S_POLYGON: // polygon
815  bs_info[0] = "Polygon";
816  bs_info[1] = wxString::Format( _( "corners count %d" ), (int) primitive.m_Poly.size() );
817  break;
818 
819  default:
820  bs_info[0] = "Unknown primitive";
821  break;
822  }
823 
824  long tmp = m_listCtrlPrimitives->InsertItem(ii, bs_info[0]);
825  m_listCtrlPrimitives->SetItemData(tmp, ii);
826 
827  for( int jj = 0, col = 0; jj < 5; ++jj )
828  {
829  m_listCtrlPrimitives->SetItem(tmp, col++, bs_info[jj]);
830  }
831  }
832 
833  // Now columns are filled, ensure correct width of columns
834  for( unsigned ii = 0; ii < 5; ++ii )
835  m_listCtrlPrimitives->SetColumnWidth( ii, wxLIST_AUTOSIZE );
836 }
wxPoint m_Start
angle of an arc, from its starting point, in 0.1 deg
Definition: class_pad.h:100
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:490
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:98
std::vector< wxPoint > m_Poly
is also the start point of the arc
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:91
wxPoint m_End
is also the center of the circle and arc
Definition: class_pad.h:101
STROKE_T m_Shape
Definition: class_pad.h:94
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:95
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:172
double m_ArcAngle
radius of a circle
Definition: class_pad.h:99
void DIALOG_PAD_PROPERTIES::editPrimitive ( )
private

Definition at line 1809 of file dialog_pad_properties.cpp.

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().

1810 {
1811  long select = m_listCtrlPrimitives->GetFirstSelected();
1812 
1813  if( select < 0 )
1814  {
1815  wxMessageBox( _( "No shape selected" ) );
1816  return;
1817  }
1818 
1819  PAD_CS_PRIMITIVE& shape = m_primitives[select];
1820 
1821  if( shape.m_Shape == S_POLYGON )
1822  {
1823  DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, m_parent, &shape );
1824 
1825  if( dlg.ShowModal() != wxID_OK )
1826  return;
1827 
1828  dlg.TransferDataFromWindow();
1829  }
1830 
1831  else
1832  {
1833  DIALOG_PAD_PRIMITIVES_PROPERTIES dlg( this, m_parent, &shape );
1834 
1835  if( dlg.ShowModal() != wxID_OK )
1836  return;
1837 
1838  dlg.TransferDataFromWindow();
1839  }
1840 
1842 
1843  if( m_canUpdate )
1844  {
1846  redraw();
1847  }
1848 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;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:91
STROKE_T m_Shape
Definition: class_pad.h:94
a dialog to edit basic polygonal shape parameters
std::vector< PAD_CS_PRIMITIVE > m_primitives
a dialog to edit basics shapes parameters.
bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 221 of file dialog_shim.cpp.

222 {
223  // so we can do logging of this state change:
224 
225 #if defined(DEBUG)
226  const char* type_id = typeid( *this ).name();
227  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
228 #endif
229 
230  return wxDialog::Enable( enable );
231 }
void DIALOG_PAD_PROPERTIES::enablePrimitivePage ( bool  aEnable)
private

enable (or disable) the primitive page editor

Definition at line 214 of file dialog_pad_properties.cpp.

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().

215 {
216  // Enable or disable the widgets in page managing custom shape primitives
217  m_listCtrlPrimitives->Enable( aEnable );
218  m_buttonDel->Enable( aEnable );
219  m_buttonEditShape->Enable( aEnable );
220  m_buttonAddShape->Enable( aEnable );
221  m_buttonDup->Enable( aEnable );
222  m_buttonGeometry->Enable( aEnable );
223 }
void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 381 of file dialog_shim.cpp.

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

Referenced by DIALOG_SHIM::OnButton(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_COMPONENT::OnUseBrowser(), and DIALOG_SHIM::~DIALOG_SHIM().

382 {
383  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
384  // handle validation in the same way as other dialogs.
385  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
386  return;
387 
388  SetReturnCode( retCode );
389 
390  if( !IsQuasiModal() )
391  {
392  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
393  return;
394  }
395 
396  if( m_qmodal_loop )
397  {
398  if( m_qmodal_loop->IsRunning() )
399  m_qmodal_loop->Exit( 0 );
400  else
401  m_qmodal_loop->ScheduleExit( 0 );
402 
403  m_qmodal_loop = NULL;
404  }
405 
408 
409  Show( false );
410 }
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:182
bool IsQuasiModal()
Definition: dialog_shim.h:124
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:184
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 120 of file dialog_shim.cpp.

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_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_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_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG(), DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), 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_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES(), 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_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), 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_SIM_SETTINGS::onInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), and DIALOG_COLOR_PICKER::TransferDataToWindow().

121 {
122  // must be called from the constructor of derived classes,
123  // when all widgets are initialized, and therefore their size fixed
124 
125  // SetSizeHints fixes the minimal size of sizers in the dialog
126  // (SetSizeHints calls Fit(), so no need to call it)
127  GetSizer()->SetSizeHints( this );
128 
129  // the default position, when calling the first time the dlg
130  Center();
131 }
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 141 of file dialog_shim.cpp.

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

142 {
143  wxSize sz( x, 0 );
144  return ConvertDialogToPixels( sz ).x;
145 }
void DIALOG_PAD_PROPERTIES::initValues ( )
private

Definition at line 528 of file dialog_pad_properties.cpp.

References PNS::angle(), B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, 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, D_PAD::GetAnchorPadShape(), D_PAD::GetAttribute(), 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::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::GetZoneConnection(), D_PAD::IsAperturePad(), D_PAD::IsFlipped(), MODULE::IsFlipped(), EDA_BASE_FRAME::IsType(), m_board, m_canEditNetName, 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_ZoneConnectionCustom, 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_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, 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().

529 {
530  wxString msg;
531  double angle;
532 
533  // Disable pad net name wxTextCtrl if the caller is the footprint editor
534  // because nets are living only in the board managed by the board editor
536 
537 
538  // Setup layers names from board
539  // Should be made first, before calling m_rbCopperLayersSel->SetSelection()
540  m_rbCopperLayersSel->SetString( 0, m_board->GetLayerName( F_Cu ) );
541  m_rbCopperLayersSel->SetString( 1, m_board->GetLayerName( B_Cu ) );
542 
543  m_PadLayerAdhCmp->SetLabel( m_board->GetLayerName( F_Adhes ) );
544  m_PadLayerAdhCu->SetLabel( m_board->GetLayerName( B_Adhes ) );
546  m_PadLayerPateCu->SetLabel( m_board->GetLayerName( B_Paste ) );
548  m_PadLayerSilkCu->SetLabel( m_board->GetLayerName( B_SilkS ) );
549  m_PadLayerMaskCmp->SetLabel( m_board->GetLayerName( F_Mask ) );
550  m_PadLayerMaskCu->SetLabel( m_board->GetLayerName( B_Mask ) );
551  m_PadLayerECO1->SetLabel( m_board->GetLayerName( Eco1_User ) );
552  m_PadLayerECO2->SetLabel( m_board->GetLayerName( Eco2_User ) );
554 
555  m_isFlipped = false;
556 
557  if( m_currentPad )
558  {
560 
561  // Diplay parent footprint info
562  MODULE* footprint = m_currentPad->GetParent();
563  wxString msg1, msg2;
564 
565  if( footprint )
566  {
567  wxString side = footprint->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" );
568  msg1.Printf( _("Footprint %s (%s),"), footprint->GetReference(), footprint->GetValue() );
569  msg2.Printf( _("%s, rotated %.1f deg"), side, footprint->GetOrientation() / 10.0 );
570  }
571 
572  m_parentInfoLine1->SetLabel( msg1 );
573  m_parentInfoLine2->SetLabel( msg2 );
574  }
575 
576  if( m_isFlipped )
577  {
578  wxPoint pt = m_dummyPad->GetOffset();
579  pt.y = -pt.y;
580  m_dummyPad->SetOffset( pt );
581 
582  wxSize sz = m_dummyPad->GetDelta();
583  sz.y = -sz.y;
584  m_dummyPad->SetDelta( sz );
585 
586  // flip pad's layers
588 
589  // flip custom pad shapes
591  }
592 
594 
596 
597  m_PadNumCtrl->SetValue( m_dummyPad->GetName() );
599 
600  // Display current pad parameters units:
603 
606 
609 
612 
613  if( m_dummyPad->GetDelta().x )
614  {
616  m_trapAxisCtrl->SetSelection( 0 );
617  }
618  else
619  {
621  m_trapAxisCtrl->SetSelection( 1 );
622  }
623 
625 
631 
632  // Prefer "-0" to "0" for normally negative values
634  m_pasteClearanceCtrl->SetValue( wxT( "-" ) + m_pasteClearanceCtrl->GetValue() );
635 
636  msg.Printf( wxT( "%f" ), m_dummyPad->GetLocalSolderPasteMarginRatio() * 100.0 );
637 
638  if( m_dummyPad->GetLocalSolderPasteMarginRatio() == 0.0 && msg[0] == '0' )
639  // Sometimes Printf adds a sign if the value is small
640  m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
641  else
643 
644  switch( m_dummyPad->GetZoneConnection() )
645  {
646  default:
648  m_ZoneConnectionChoice->SetSelection( 0 );
649  m_ZoneConnectionCustom->SetSelection( 0 );
650  break;
651 
652  case PAD_ZONE_CONN_FULL:
653  m_ZoneConnectionChoice->SetSelection( 1 );
654  m_ZoneConnectionCustom->SetSelection( 1 );
655  break;
656 
658  m_ZoneConnectionChoice->SetSelection( 2 );
659  m_ZoneConnectionCustom->SetSelection( 0 );
660  break;
661 
662  case PAD_ZONE_CONN_NONE:
663  m_ZoneConnectionChoice->SetSelection( 3 );
664  m_ZoneConnectionCustom->SetSelection( 0 );
665  break;
666  }
667 
669  m_ZoneCustomPadShape->SetSelection( 1 );
670  else
671  m_ZoneCustomPadShape->SetSelection( 0 );
672 
673  if( m_currentPad )
674  {
675  angle = m_currentPad->GetOrientation();
676  MODULE* footprint = m_currentPad->GetParent();
677 
678  if( footprint )
679  angle -= footprint->GetOrientation();
680 
681  if( m_isFlipped )
682  angle = -angle;
683 
684  m_dummyPad->SetOrientation( angle );
685  }
686 
687  angle = m_dummyPad->GetOrientation();
688 
689  NORMALIZE_ANGLE_180( angle ); // ? normalizing is in D_PAD::SetOrientation()
690 
691  // Set layers used by this pad: :
693 
694  // Pad Orient
695  // Note: use ChangeValue() instead of SetValue() so that we don't generate events
696  m_orientation->ChangeValue( StringFromValue( DEGREES, angle ) );
697 
698  switch( m_dummyPad->GetShape() )
699  {
700  default:
701  case PAD_SHAPE_CIRCLE: m_PadShape->SetSelection( CHOICE_SHAPE_CIRCLE ); break;
702  case PAD_SHAPE_OVAL: m_PadShape->SetSelection( CHOICE_SHAPE_OVAL ); break;
703  case PAD_SHAPE_RECT: m_PadShape->SetSelection( CHOICE_SHAPE_RECT ); break;
704  case PAD_SHAPE_TRAPEZOID: m_PadShape->SetSelection( CHOICE_SHAPE_TRAPEZOID ); break;
705  case PAD_SHAPE_ROUNDRECT: m_PadShape->SetSelection( CHOICE_SHAPE_ROUNDRECT ); break;
706 
707  case PAD_SHAPE_CUSTOM:
710  else
712  break;
713  }
714 
716 
717  // Type of pad selection
719  {
720  m_PadType->SetSelection( 4 );
721  }
722  else
723  {
724  switch( m_dummyPad->GetAttribute() )
725  {
726  case PAD_ATTRIB_STANDARD: m_PadType->SetSelection( 0 ); break;
727  case PAD_ATTRIB_SMD: m_PadType->SetSelection( 1 ); break;
728  case PAD_ATTRIB_CONN: m_PadType->SetSelection( 2 ); break;
729  case PAD_ATTRIB_HOLE_NOT_PLATED: m_PadType->SetSelection( 3 ); break;
730  }
731  }
732 
733  // Disable Pad name,and pad to die length for NPTH pads (mechanical pads)
735 
736  m_PadNumText->Enable( enable );
737  m_PadNumCtrl->Enable( enable );
738  m_PadNameText->Enable( enable && m_canEditNetName && m_currentPad );
739  m_PadNetSelector->Enable( enable && m_canEditNetName && m_currentPad );
740  m_padToDie.Enable( enable );
741 
743  m_holeShapeCtrl->SetSelection( 0 );
744  else
745  m_holeShapeCtrl->SetSelection( 1 );
746 
747  // Update some dialog widgets state (Enable/disable options):
748  wxCommandEvent cmd_event;
750  OnDrillShapeSelected( cmd_event );
751  OnPadShapeSelection( cmd_event );
753 
754  // Update basic shapes list
756 }
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:226
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask, paste, solder layers are swapped internal layers are flipped only if the copper layers count is known.
Definition: lset.cpp:521
const std::vector< PAD_CS_PRIMITIVE > & GetPrimitives() const
Accessor to the basic shape list.
Definition: class_pad.h:336
bool IsAperturePad() const
Definition: class_pad.h:409
void enablePrimitivePage(bool aEnable)
enable (or disable) the primitive page editor
void FlipPrimitives()
Flip the basic shapes, in custom pads.
Definition: class_pad.cpp:450
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:405
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
int GetPadToDieLength() const
Definition: class_pad.h:412
void setPadLayersList(LSET layer_mask)
Function setPadLayersList updates the CheckBox states in pad layers list,.
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:414
MODULE * GetParent() const
Definition: class_pad.h:162
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:61
const wxString & GetValue() const
Function GetValue.
Definition: class_module.h:496
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:388
void NORMALIZE_ANGLE_180(T &Angle)
Definition: trigo.h:335
const wxSize & GetDrillSize() const
Definition: class_pad.h:275
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
void SetValue(const wxString &aValue) override
Set a new value in evaluator buffer, and display it in the wxTextCtrl.
Pads are not covered.
Definition: zones.h:52
double GetOrientation() const
Definition: class_module.h:188
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:258
ZoneConnection GetZoneConnection() const
Definition: class_pad.cpp:686
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:402
void SetSelectedNetcode(int aNetcode)
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
int GetThermalWidth() const
Definition: class_pad.cpp:697
void OnPadShapeSelection(wxCommandEvent &event) override
int GetThermalGap() const
Definition: class_pad.cpp:708
const wxSize & GetSize() const
Definition: class_pad.h:269
const wxString & GetName() const
Definition: class_pad.h:190
void OnDrillShapeSelected(wxCommandEvent &event) override
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:420
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:62
bool IsFlipped() const
Definition: class_pad.cpp:133
int GetLocalClearance() const
Definition: class_pad.h:417
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:423
int GetNetCode() const
Function GetNetCode.
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:401
std::vector< PAD_CS_PRIMITIVE > m_primitives
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:462
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: class_pad.h:232
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)
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:382
const wxSize & GetDelta() const
Definition: class_pad.h:272
Usual pad.
Definition: pad_shapes.h:60
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:417
wxString StringFromValue(EDA_UNITS_T aUnits, int aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:210
bool IsType(FRAME_T aType) const
const wxPoint GetPosition() const override
Definition: class_pad.h:220
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:277
Use thermal relief for pads.
Definition: zones.h:53
const wxPoint & GetOffset() const
Definition: class_pad.h:278
void Enable(bool aEnable)
Function Enable Enables/diasables the label, widget and units label.
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:271
pads are covered by copper
Definition: zones.h:54
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 60 of file kiway_player.h.

References KIWAY_HOLDER::GetUserUnits(), KIWAY_HOLDER::m_kiway, KIWAY_HOLDER::Prj(), KIWAY_HOLDER::SetKiway(), and VTBL_ENTRY.

Referenced by TREEPROJECT_ITEM::Activate(), PCB_BASE_EDIT_FRAME::AddLibrary(), SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), 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::KiwayMailIn(), KIWAY_PLAYER::language_change(), KICAD_MANAGER_FRAME::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), KICAD_MANAGER_FRAME::OnEditFpLibTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnEditSymLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), KICAD_MANAGER_FRAME::OnRunPcbFpEditor(), KICAD_MANAGER_FRAME::OnRunSchLibEditor(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar(), LIB_EDIT_FRAME::refreshSchematic(), KICAD_MANAGER_FRAME::RunEeschema(), KICAD_MANAGER_FRAME::RunPcbNew(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), EDA_BASE_FRAME::ShowPreferences(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:94
void DIALOG_PAD_PROPERTIES::onAddPrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1901 of file dialog_pad_properties.cpp.

References arrayDim(), displayPrimitivesList(), m_canUpdate, m_dummyPad, m_parent, m_primitives, redraw(), S_ARC, S_CIRCLE, S_POLYGON, S_SEGMENT, and transferDataToPad().

Referenced by OnUpdateUINonCopperWarning().

1902 {
1903  // Ask user for shape type
1904  wxString shapelist[] = { _( "Segment" ), _( "Arc" ), _( "Ring/Circle" ), _( "Polygon" ) };
1905 
1906  int type = wxGetSingleChoiceIndex( _( "Shape type:" ), _( "Add Primitive" ),
1907  arrayDim( shapelist ), shapelist, 0, this );
1908 
1909  STROKE_T listtype[] = { S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON };
1910 
1911  PAD_CS_PRIMITIVE primitive( listtype[type] );
1912 
1913  if( listtype[type] == S_POLYGON )
1914  {
1915  DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, m_parent, &primitive );
1916 
1917  if( dlg.ShowModal() != wxID_OK )
1918  return;
1919  }
1920  else
1921  {
1922  DIALOG_PAD_PRIMITIVES_PROPERTIES dlg( this, m_parent, &primitive );
1923 
1924  if( dlg.ShowModal() != wxID_OK )
1925  return;
1926  }
1927 
1928  m_primitives.push_back( primitive );
1929 
1931 
1932  if( m_canUpdate )
1933  {
1935  redraw();
1936  }
1937 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
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:91
STROKE_T
Enum STROKE_T is the set of shapes for segments (graphic segments and tracks) which are often in the ...
a dialog to edit basic polygonal shape parameters
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
of elements in an array. This implements type-safe compile time checking
Definition: macros.h:99
std::vector< PAD_CS_PRIMITIVE > m_primitives
a dialog to edit basics shapes parameters.
void DIALOG_PAD_PROPERTIES::OnCancel ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 202 of file dialog_pad_properties.cpp.

References EDA_DRAW_FRAME::IsGalCanvasActive(), DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal, m_parent, and EDA_DRAW_PANEL_GAL::StopDrawing().

203 {
204  // Mandatory to avoid m_panelShowPadGal trying to draw something
205  // in a non valid context during closing process:
206  if( m_parent->IsGalCanvasActive() )
208 
209  // Now call default handler for wxID_CANCEL command event
210  event.Skip();
211 }
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:918
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...
void DIALOG_PAD_PROPERTIES::onChangePadMode ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 845 of file dialog_pad_properties.cpp.

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

Referenced by OnUpdateUINonCopperWarning().

846 {
847  m_sketchPreview = m_cbShowPadOutline->GetValue();
848 
849  if( m_parent->IsGalCanvasActive() )
850  {
852 
853  // fix the pad render mode (filled/not filled)
854  KIGFX::PCB_RENDER_SETTINGS* settings =
855  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
856 
861  }
862 
863  redraw();
864 }
multilayer pads, usually with holes
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
smd pads, back layer
void SetSketchModeGraphicItems(bool aEnabled)
Turns on/off sketch mode for graphic items (DRAWSEGMENTs, texts).
Definition: pcb_painter.h:134
Class PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:62
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:918
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
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:114
Class VIEW.
Definition: view.h:61
void DIALOG_PAD_PROPERTIES::onCornerRadiusChange ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 472 of file dialog_pad_properties.cpp.

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

Referenced by OnUpdateUINonCopperWarning().

473 {
475  return;
476 
477  wxString value = m_tcCornerRadius->GetValue();
478  double rrRadius;
479 
480  if( value.ToDouble( &rrRadius ) )
481  {
482  if( rrRadius < 0.0 )
483  {
484  rrRadius = 0.0;
485  m_tcCornerRadius->ChangeValue( "0.0" );
486  }
487 
489  m_dummyPad->SetRoundRectCornerRadius( Millimeter2iu( rrRadius ) );
490 
491  auto ratio = wxString::Format( "%.1f", m_dummyPad->GetRoundRectRadiusRatio() * 100 );
492  m_tcCornerSizeRatio->ChangeValue( ratio );
493  redraw();
494  }
495 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
void SetRoundRectCornerRadius(double aRadius)
Set the rounded rectangle radius ratio based on a given radius.
Definition: class_pad.cpp:206
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:634
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
void DIALOG_PAD_PROPERTIES::onCornerSizePercentChange ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 498 of file dialog_pad_properties.cpp.

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

Referenced by OnUpdateUINonCopperWarning().

499 {
501  return;
502 
503  wxString value = m_tcCornerSizeRatio->GetValue();
504  double rrRadiusRatioPercent;
505 
506  if( value.ToDouble( &rrRadiusRatioPercent ) )
507  {
508  // Clamp rrRadiusRatioPercent to acceptable value (0.0 to 50.0)
509  if( rrRadiusRatioPercent < 0.0 )
510  {
511  rrRadiusRatioPercent = 0.0;
512  m_tcCornerSizeRatio->ChangeValue( "0.0" );
513  }
514 
515  if( rrRadiusRatioPercent > 50.0 )
516  {
517  rrRadiusRatioPercent = 0.5;
518  m_tcCornerSizeRatio->ChangeValue( "50.0" );
519  }
520 
523  redraw();
524  }
525 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:531
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
virtual void ChangeValue(int aValue)
Function ChangeValue Changes the value (in Internal Units) for the text field, taking care of units c...
void DIALOG_PAD_PROPERTIES::onDeletePrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Event handlers of basic shapes list panel.

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1873 of file dialog_pad_properties.cpp.

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

Referenced by OnUpdateUINonCopperWarning().

1874 {
1875  long select = m_listCtrlPrimitives->GetFirstSelected();
1876 
1877  if( select < 0 )
1878  return;
1879 
1880  // Multiple selections are allowed. get them and remove corresponding shapes
1881  std::vector<long> indexes;
1882  indexes.push_back( select );
1883 
1884  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
1885  indexes.push_back( select );
1886 
1887  // Erase all select shapes
1888  for( unsigned ii = indexes.size(); ii > 0; --ii )
1889  m_primitives.erase( m_primitives.begin() + indexes[ii-1] );
1890 
1892 
1893  if( m_canUpdate )
1894  {
1896  redraw();
1897  }
1898 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
std::vector< PAD_CS_PRIMITIVE > m_primitives
void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 959 of file dialog_pad_properties.cpp.

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

Referenced by initValues(), and OnUpdateUINonCopperWarning().

960 {
962  redraw();
963 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
void DIALOG_PAD_PROPERTIES::onDuplicatePrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1975 of file dialog_pad_properties.cpp.

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().

Referenced by OnUpdateUINonCopperWarning().

1976 {
1977  long select = m_listCtrlPrimitives->GetFirstSelected();
1978 
1979  if( select < 0 )
1980  {
1981  wxMessageBox( _( "No shape selected" ) );
1982  return;
1983  }
1984 
1985  // Multiple selections are allowed. Build selected shapes list
1986  std::vector<PAD_CS_PRIMITIVE*> shapeList;
1987  shapeList.push_back( &m_primitives[select] );
1988 
1989  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
1990  shapeList.push_back( &m_primitives[select] );
1991 
1992  DIALOG_PAD_PRIMITIVES_TRANSFORM dlg( this, m_parent, shapeList, true );
1993 
1994  if( dlg.ShowModal() != wxID_OK )
1995  return;
1996 
1997  // Transfer new settings
1998  // save duplicates to a separate vector to avoid m_primitives reallocation,
1999  // as shapeList contains pointers to its elements
2000  std::vector<PAD_CS_PRIMITIVE> duplicates;
2001  dlg.Transform( &duplicates, dlg.GetDuplicateCount() );
2002  std::move( duplicates.begin(), duplicates.end(), std::back_inserter( m_primitives ) );
2003 
2005 
2006  if( m_canUpdate )
2007  {
2009  redraw();
2010  }
2011 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
std::vector< PAD_CS_PRIMITIVE > m_primitives
A dialog to apply geometry transforms to a shape or set of shapes (move, rotate around origin...
void DIALOG_PAD_PROPERTIES::onEditPrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1867 of file dialog_pad_properties.cpp.

References editPrimitive().

Referenced by OnUpdateUINonCopperWarning().

1868 {
1869  editPrimitive();
1870 }
void DIALOG_PAD_PROPERTIES::onGeometryTransform ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1940 of file dialog_pad_properties.cpp.

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

Referenced by OnUpdateUINonCopperWarning().

1941 {
1942  long select = m_listCtrlPrimitives->GetFirstSelected();
1943 
1944  if( select < 0 )
1945  {
1946  wxMessageBox( _( "No shape selected" ) );
1947  return;
1948  }
1949 
1950  // Multiple selections are allowed. Build selected shapes list
1951  std::vector<PAD_CS_PRIMITIVE*> shapeList;
1952  shapeList.push_back( &m_primitives[select] );
1953 
1954  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
1955  shapeList.push_back( &m_primitives[select] );
1956 
1957  DIALOG_PAD_PRIMITIVES_TRANSFORM dlg( this, m_parent, shapeList, false );
1958 
1959  if( dlg.ShowModal() != wxID_OK )
1960  return;
1961 
1962  // Transfert new settings:
1963  dlg.Transform();
1964 
1966 
1967  if( m_canUpdate )
1968  {
1970  redraw();
1971  }
1972 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
std::vector< PAD_CS_PRIMITIVE > m_primitives
A dialog to apply geometry transforms to a shape or set of shapes (move, rotate around origin...
void DIALOG_PAD_PROPERTIES::OnInitDialog ( wxInitDialogEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 192 of file dialog_pad_properties.cpp.

References m_selectedColor, and redraw().

193 {
194  m_selectedColor = COLOR4D( 1.0, 1.0, 1.0, 0.7 );
195 
196  // Needed on some WM to be sure the pad is redrawn according to the final size
197  // of the canvas, with the right zoom factor
198  redraw();
199 }
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void DIALOG_PAD_PROPERTIES::OnPadShapeSelection ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 867 of file dialog_pad_properties.cpp.

References 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(), m_cornerRadius, m_dummyPad, m_offsetX, m_offsetY, DIALOG_PAD_PROPERTIES_BASE::m_PadShape, DIALOG_PAD_PROPERTIES_BASE::m_sbSizerCustomShapedZonesSettings, DIALOG_PAD_PROPERTIES_BASE::m_sbSizerZonesSettings, m_sizeY, m_spokeWidth, DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerSizeRatio, DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerSizeRatioUnit, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, m_thermalGap, DIALOG_PAD_PROPERTIES_BASE::m_trapAxisCtrl, DIALOG_PAD_PROPERTIES_BASE::m_trapAxisLabel, m_trapDelta, DIALOG_PAD_PROPERTIES_BASE::m_ZoneConnectionChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneConnectionCustom, redraw(), transferDataToPad(), and updateRoundRectCornerValues().

Referenced by initValues(), and OnUpdateUINonCopperWarning().

868 {
869  bool is_custom = false;
870 
871  switch( m_PadShape->GetSelection() )
872  {
873  case CHOICE_SHAPE_CIRCLE:
874  m_trapDelta.Enable( false );
875  m_trapAxisLabel->Enable( false );
876  m_trapAxisCtrl->Enable( false );
877  m_sizeY.Enable( false );
878  m_offsetX.Enable( false );
879  m_offsetY.Enable( false );
880  break;
881 
882  case CHOICE_SHAPE_OVAL:
883  m_trapDelta.Enable( false );
884  m_trapAxisLabel->Enable( false );
885  m_trapAxisCtrl->Enable( false );
886  m_sizeY.Enable( true );
887  m_offsetX.Enable( true );
888  m_offsetY.Enable( true );
889  break;
890 
891  case CHOICE_SHAPE_RECT:
892  m_trapDelta.Enable( false );
893  m_trapAxisLabel->Enable( false );
894  m_trapAxisCtrl->Enable( false );
895  m_sizeY.Enable( true );
896  m_offsetX.Enable( true );
897  m_offsetY.Enable( true );
898  break;
899 
901  m_trapDelta.Enable( true );
902  m_trapAxisLabel->Enable( true );
903  m_trapAxisCtrl->Enable( true );
904  m_sizeY.Enable( true );
905  m_offsetX.Enable( true );
906  m_offsetY.Enable( true );
907  break;
908 
910  m_trapDelta.Enable( false );
911  m_trapAxisLabel->Enable( false );
912  m_trapAxisCtrl->Enable( false );
913  m_sizeY.Enable( true );
914  m_offsetX.Enable( true );
915  m_offsetY.Enable( true );
916  // Ensure m_tcCornerSizeRatio contains the right value:
917  m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f",
919  break;
920 
921  case CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR: // PAD_SHAPE_CUSTOM, circular anchor
922  case CHOICE_SHAPE_CUSTOM_RECT_ANCHOR: // PAD_SHAPE_CUSTOM, rect anchor
923  is_custom = true;
924  m_trapDelta.Enable( false );
925  m_trapAxisLabel->Enable( false );
926  m_trapAxisCtrl->Enable( false );
928  m_offsetX.Enable( false );
929  m_offsetY.Enable( false );
930  break;
931  }
932 
933  enablePrimitivePage( is_custom );
934 
935  // A few widgets are enabled only for rounded rect pads:
936  m_staticTextCornerSizeRatio->Enable( m_PadShape->GetSelection() == CHOICE_SHAPE_ROUNDRECT );
937  m_tcCornerSizeRatio->Enable( m_PadShape->GetSelection() == CHOICE_SHAPE_ROUNDRECT );
940 
941  // PAD_SHAPE_CUSTOM type has constraints for zone connection and thermal shape:
942  // only not connected or solid connection is allowed to avoid destroying the shape.
943  // Enable/disable options only available for custom shaped pads
944  m_ZoneConnectionChoice->Enable( !is_custom );
945  m_ZoneConnectionCustom->Enable( is_custom );
946  m_spokeWidth.Enable( !is_custom );
947  m_thermalGap.Enable( !is_custom );
948 
949  m_sbSizerZonesSettings->Show( !is_custom );
950  m_sbSizerCustomShapedZonesSettings->Show( is_custom );
951 
953 
955  redraw();
956 }
void enablePrimitivePage(bool aEnable)
enable (or disable) the primitive page editor
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
wxStaticBoxSizer * m_sbSizerCustomShapedZonesSettings
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:634
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
void Enable(bool aEnable)
Function Enable Enables/diasables the label, widget and units label.
void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 283 of file dialog_shim.cpp.

References DIALOG_SHIM::m_firstPaintEvent, and DIALOG_SHIM::m_initialFocusTarget.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

284 {
285  if( m_firstPaintEvent )
286  {
287 #ifdef __WXMAC__
288  fixOSXCancelButtonIssue( this );
289  selectAllInTextCtrls( GetChildren() );
290 #endif
291 
293  m_initialFocusTarget->SetFocus();
294  else
295  SetFocus(); // Focus the dialog itself
296 
297  m_firstPaintEvent = false;
298  }
299 
300  event.Skip();
301 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:179
bool m_firstPaintEvent
Definition: dialog_shim.h:178
void DIALOG_PAD_PROPERTIES::OnPaintShowPanel ( wxPaintEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 278 of file dialog_pad_properties.cpp.

References abs, B_Cu, BLACK, DRAWSEGMENT::BuildPolyPointsList(), color, PCB_GENERAL_SETTINGS::Colors(), DARKGRAY, D_PAD::DrawShape(), 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, DRAWSEGMENT::Rotate(), S_ARC, S_CIRCLE, S_POLYGON, S_SEGMENT, scale, and PCB_BASE_FRAME::Settings().

Referenced by OnUpdateUINonCopperWarning().

279 {
280  wxPaintDC dc( m_panelShowPad );
281  PAD_DRAWINFO drawInfo;
282 
284 
285  if( m_dummyPad->GetLayerSet()[F_Cu] )
287 
288  if( m_dummyPad->GetLayerSet()[B_Cu] )
289  color = color.LegacyMix( m_parent->Settings().Colors().GetItemColor( LAYER_PAD_BK ) );
290 
291  // What could happen: the pad color is *actually* black, or no copper was selected
292  if( color == BLACK )
293  color = LIGHTGRAY;
294 
295  drawInfo.m_Color = color;
296  drawInfo.m_HoleColor = DARKGRAY;
297  drawInfo.m_Offset = m_dummyPad->GetPosition();
298  drawInfo.m_Display_padnum = true;
299  drawInfo.m_Display_netname = true;
300  drawInfo.m_ShowPadFilled = !m_sketchPreview;
301 
303  drawInfo.m_ShowNotPlatedHole = true;
304 
305  // Shows the local pad clearance
307 
308  wxSize dc_size = dc.GetSize();
309  dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
310 
311  // Calculate a suitable scale to fit the available draw area
312  int dim = m_dummyPad->GetBoundingRadius() *2;
313 
314  // Invalid x size. User could enter zero, or have deleted all text prior to
315  // entering a new value; this is also treated as zero. If dim is left at
316  // zero, the drawing scale is zero and we get a crash.
317  if( dim == 0 )
318  {
319  // If drill size has been set, use that. Otherwise default to 1mm.
320  dim = m_dummyPad->GetDrillSize().x;
321  if( dim == 0 )
322  dim = Millimeter2iu( 1.0 );
323  }
324 
325  if( m_dummyPad->GetLocalClearance() > 0 )
326  dim += m_dummyPad->GetLocalClearance() * 2;
327 
328  double scale = (double) dc_size.x / dim;
329 
330  // If the pad is a circle, use the x size here instead.
331  int ysize;
332 
334  ysize = m_dummyPad->GetSize().x;
335  else
336  ysize = m_dummyPad->GetSize().y;
337 
338  dim = ysize + std::abs( m_dummyPad->GetDelta().x );
339 
340  // Invalid y size. See note about x size above.
341  if( dim == 0 )
342  {
343  dim = m_dummyPad->GetDrillSize().y;
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->DrawShape( NULL, &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:123
bool m_Display_padnum
Definition: class_pad.h:75
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...
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:405
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
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...
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:415
usual segment : line with rounded ends
const wxSize & GetDrillSize() const
Definition: class_pad.h:275
void GRFilledCircle(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:778
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
#define abs(a)
Definition: auxiliary.h:84
smd pads, back layer
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:711
const wxPoint & GetArcStart() const
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:98
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.h:612
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:91
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:402
COLOR4D m_HoleColor
Definition: class_pad.h:70
const wxSize & GetSize() const
Definition: class_pad.h:269
bool m_ShowNotPlatedHole
Definition: class_pad.h:80
void DrawShape(EDA_RECT *aClipBox, wxDC *aDC, PAD_DRAWINFO &aDrawInfo)
Function DrawShape basic function to draw a pad.
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:285
STROKE_T m_Shape
Definition: class_pad.h:94
int m_PadClearance
Definition: class_pad.h:73
int GetLocalClearance() const
Definition: class_pad.h:417
COLORS_DESIGN_SETTINGS & Colors()
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:95
virtual void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
wxPoint m_Offset
Definition: class_pad.h:83
const int scale
smd pads, front layer
std::vector< PAD_CS_PRIMITIVE > m_primitives
void GRFilledSegment(EDA_RECT *aClipBox, wxDC *aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor)
Definition: gr_basic.cpp:526
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:755
const wxPoint GetArcEnd() const
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:382
const wxSize & GetDelta() const
Definition: class_pad.h:272
bool m_ShowPadFilled
Definition: class_pad.h:77
COLOR4D m_Color
Definition: class_pad.h:68
Definition: colors.h:45
bool m_Display_netname
Definition: class_pad.h:76
const wxPoint GetPosition() const override
Definition: class_pad.h:220
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
#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:799
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
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 1860 of file dialog_pad_properties.cpp.

References editPrimitive().

Referenced by OnUpdateUINonCopperWarning().

1861 {
1862  editPrimitive();
1863 }
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 1851 of file dialog_pad_properties.cpp.

References redraw().

Referenced by OnUpdateUINonCopperWarning().

1852 {
1853  // Called on a double click on the basic shapes list
1854  // To Do: highligth the primitive(s) currently selected.
1855  redraw();
1856 }
void DIALOG_PAD_PROPERTIES::OnResize ( wxSizeEvent &  event)
private

Definition at line 838 of file dialog_pad_properties.cpp.

References redraw().

Referenced by prepareCanvas().

839 {
840  redraw();
841  event.Skip();
842 }
void DIALOG_PAD_PROPERTIES::OnSetLayers ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1093 of file dialog_pad_properties.cpp.

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

Referenced by OnUpdateUINonCopperWarning().

1094 {
1096  redraw();
1097 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
void DIALOG_PAD_PROPERTIES::OnUpdateUI ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1023 of file dialog_pad_properties.cpp.

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.

1024 {
1025  int ii = m_PadType->GetSelection();
1026 
1027  if( (unsigned)ii >= arrayDim( code_type ) ) // catches < 0 also
1028  ii = 0;
1029 
1030  bool hasHole, hasConnection;
1031 
1032  switch( ii )
1033  {
1034  default:
1035  case 0: /* PTH */ hasHole = true; hasConnection = true; break;
1036  case 1: /* SMD */ hasHole = false; hasConnection = true; break;
1037  case 2: /* CONN */ hasHole = false; hasConnection = true; break;
1038  case 3: /* NPTH */ hasHole = true; hasConnection = false; break;
1039  case 4: /* Aperture */ hasHole = false; hasConnection = false; break;
1040  }
1041 
1042  // Enable/disable hole controls
1043  m_holeShapeLabel->Enable( hasHole );
1044  m_holeShapeCtrl->Enable( hasHole );
1045  m_holeX.Enable( hasHole );
1046  m_holeY.Enable( hasHole && m_holeShapeCtrl->GetSelection() == 1 );
1047 
1048  // Enable/disable Pad number, net and pad length-to-die
1049  m_PadNumText->Enable( hasConnection );
1050  m_PadNumCtrl->Enable( hasConnection );
1051  m_PadNameText->Enable( hasConnection );
1052  m_PadNetSelector->Enable( hasConnection && m_canEditNetName && m_currentPad );
1053  m_padToDie.Enable( hasConnection );
1054 
1055  // Enable/disable Copper Layers control
1056  m_rbCopperLayersSel->Enable( ii != 4 );
1057 }
static PAD_ATTR_T code_type[]
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
of elements in an array. This implements type-safe compile time checking
Definition: macros.h:99
void Enable(bool aEnable)
Function Enable Enables/diasables the label, widget and units label.
void DIALOG_PAD_PROPERTIES::OnUpdateUINonCopperWarning ( wxUpdateUIEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 123 of file dialog_pad_properties.h.

References LSET::AllCuMask(), D_PAD::GetLayerSet(), DIALOG_PAD_PROPERTIES_BASE::m_nonCopperWarningBook, onAddPrimitive(), onChangePadMode(), onCornerRadiusChange(), onCornerSizePercentChange(), onDeletePrimitive(), OnDrillShapeSelected(), onDuplicatePrimitive(), onEditPrimitive(), onGeometryTransform(), OnPadShapeSelection(), OnPaintShowPanel(), onPrimitiveDClick(), OnPrimitiveSelection(), OnSetLayers(), OnValuesChanged(), PadOrientEvent(), PadTypeSelected(), TransferDataFromWindow(), and TransferDataToWindow().

124  {
125  bool isOnCopperLayer = ( m_dummyPad->GetLayerSet() & LSET::AllCuMask() ).any();
126  m_nonCopperWarningBook->SetSelection( isOnCopperLayer ? 0 : 1 );
127  }
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:402
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 1796 of file dialog_pad_properties.cpp.

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

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

1797 {
1798  if( m_canUpdate )
1799  {
1801  // If the pad size has changed, update the displayed values
1802  // for rounded rect pads
1804 
1805  redraw();
1806  }
1807 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
void DIALOG_PAD_PROPERTIES::PadOrientEvent ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 966 of file dialog_pad_properties.cpp.

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

Referenced by OnUpdateUINonCopperWarning().

967 {
969  redraw();
970 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
void DIALOG_PAD_PROPERTIES::PadTypeSelected ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 973 of file dialog_pad_properties.cpp.

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(), and transferDataToPad().

Referenced by OnUpdateUINonCopperWarning().

974 {
975  int ii = m_PadType->GetSelection();
976 
977  if( (unsigned)ii >= arrayDim( code_type ) ) // catches < 0 also
978  ii = 0;
979 
980  bool hasHole, hasConnection;
981 
982  switch( ii )
983  {
984  default:
985  case 0: /* PTH */ hasHole = true; hasConnection = true; break;
986  case 1: /* SMD */ hasHole = false; hasConnection = true; break;
987  case 2: /* CONN */ hasHole = false; hasConnection = true; break;
988  case 3: /* NPTH */ hasHole = true; hasConnection = false; break;
989  case 4: /* Aperture */ hasHole = false; hasConnection = false; break;
990  }
991 
992  LSET layer_mask = std_pad_layers[ii];
993  setPadLayersList( layer_mask );
994 
995  if( !hasHole )
996  {
997  m_holeX.SetValue( 0 );
998  m_holeY.SetValue( 0 );
999  }
1000  else if ( m_holeX.GetValue() == 0 && m_currentPad )
1001  {
1004  }
1005 
1006  if( !hasConnection )
1007  {
1008  m_PadNumCtrl->SetValue( wxEmptyString );
1010  m_padToDie.SetValue( 0 );
1011  }
1012  else if( m_PadNumCtrl->GetValue().IsEmpty() && m_currentPad )
1013  {
1014  m_PadNumCtrl->SetValue( m_currentPad->GetName() );
1016  }
1017 
1019  redraw();
1020 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
void setPadLayersList(LSET layer_mask)
Function setPadLayersList updates the CheckBox states in pad layers list,.
const wxSize & GetDrillSize() const
Definition: class_pad.h:275
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
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:190
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
of elements in an array. This implements type-safe compile time checking
Definition: macros.h:99
int GetNetCode() const
Function GetNetCode.
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...
bool DIALOG_PAD_PROPERTIES::padValuesOK ( )
private

test if all values are acceptable for the pad

Definition at line 1101 of file dialog_pad_properties.cpp.

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_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_ROUNDRECT, StringFromValue(), and transferDataToPad().

Referenced by TransferDataFromWindow().

1102 {
1103  bool error = transferDataToPad( m_dummyPad );
1104  bool skip_tstoffset = false; // the offset prm is not always tested
1105 
1106  wxArrayString error_msgs;
1107  wxString msg;
1108 
1109  // Test for incorrect values
1110  if( (m_dummyPad->GetSize().x <= 0) ||
1111  ((m_dummyPad->GetSize().y <= 0) && (m_dummyPad->GetShape() != PAD_SHAPE_CIRCLE)) )
1112  {
1113  error_msgs.Add( _( "Pad size must be greater than zero" ) );
1114  }
1115 
1116  if( (m_dummyPad->GetSize().x < m_dummyPad->GetDrillSize().x) ||
1117  (m_dummyPad->GetSize().y < m_dummyPad->GetDrillSize().y) )
1118  {
1119  error_msgs.Add( _( "Incorrect value for pad drill: pad drill bigger than pad size" ) );
1120  skip_tstoffset = true; // offset prm will be not tested because if the drill value
1121  // is incorrect the offset prm is always seen as incorrect, even if it is 0
1122  }
1123 
1124  if( m_dummyPad->GetLocalClearance() < 0 )
1125  {
1126  error_msgs.Add( _( "Pad local clearance must be zero or greater than zero" ) );
1127  }
1128 
1129  // Some pads need a negative solder mask clearance (mainly for BGA with small pads)
1130  // However the negative solder mask clearance must not create negative mask size
1131  // Therefore test for minimal acceptable negative value
1132  // Hovewer, a negative value can give strange result with custom shapes, so it is not
1133  // allowed for custom pad shape
1135  {
1137  error_msgs.Add( _( "Pad local solder mask clearance must be zero or greater than zero" ) );
1138  else
1139  {
1140  int min_smClearance = -std::min( m_dummyPad->GetSize().x, m_dummyPad->GetSize().y )/2;
1141 
1142  if( m_dummyPad->GetLocalSolderMaskMargin() <= min_smClearance )
1143  {
1144  error_msgs.Add( wxString::Format(
1145  _( "Pad local solder mask clearance must be greater than %s" ),
1146  StringFromValue( GetUserUnits(), min_smClearance, true, true ) ) );
1147  }
1148  }
1149  }
1150 
1151  // Some pads need a positive solder paste clearance (mainly for BGA with small pads)
1152  // Hovewer, a positive value can create issues if the resulting shape is too big.
1153  // (like a solder paste creating a solder paste area on a neighbour pad or on the solder mask)
1154  // So we could ask for user to confirm the choice
1155  // Currently there are no test
1156 
1157  LSET padlayers_mask = m_dummyPad->GetLayerSet();
1158 
1159  if( padlayers_mask == 0 )
1160  error_msgs.Add( _( "Error: pad has no layer" ) );
1161 
1162  if( !padlayers_mask[F_Cu] && !padlayers_mask[B_Cu] )
1163  {
1164  if( m_dummyPad->GetDrillSize().x || m_dummyPad->GetDrillSize().y )
1165  {
1166  // Note: he message is shown in an HTML window
1167  msg = _( "Error: the pad is not on a copper layer and has a hole" );
1168 
1170  {
1171  msg += wxT( "<br><br><i>" );
1172  msg += _( "For NPTH pad, set pad size value to pad drill value,"
1173  " if you do not want this pad plotted in gerber files" );
1174  }
1175 
1176  error_msgs.Add( msg );
1177  }
1178  }
1179 
1180  if( !skip_tstoffset )
1181  {
1182  wxPoint max_size;
1183  max_size.x = std::abs( m_dummyPad->GetOffset().x );
1184  max_size.y = std::abs( m_dummyPad->GetOffset().y );
1185  max_size.x += m_dummyPad->GetDrillSize().x / 2;
1186  max_size.y += m_dummyPad->GetDrillSize().y / 2;
1187 
1188  if( ( m_dummyPad->GetSize().x / 2 < max_size.x ) ||
1189  ( m_dummyPad->GetSize().y / 2 < max_size.y ) )
1190  {
1191  error_msgs.Add( _( "Incorrect value for pad offset" ) );
1192  }
1193  }
1194 
1195  if( error )
1196  error_msgs.Add( _( "Too large value for pad delta size" ) );
1197 
1198  switch( m_dummyPad->GetAttribute() )
1199  {
1200  case PAD_ATTRIB_HOLE_NOT_PLATED: // Not plated, but through hole, a hole is expected
1201  case PAD_ATTRIB_STANDARD : // Pad through hole, a hole is also expected
1202  if( m_dummyPad->GetDrillSize().x <= 0 ||
1204  error_msgs.Add( _( "Error: Through hole pad: drill diameter set to 0" ) );
1205  break;
1206 
1207  case PAD_ATTRIB_CONN: // Connector pads are smd pads, just they do not have solder paste.
1208  if( padlayers_mask[B_Paste] || padlayers_mask[F_Paste] )
1209  error_msgs.Add( _( "Error: Connector pads are not on the solder paste layer\n"
1210  "Use SMD pads instead" ) );
1211  // Fall trough
1212  case PAD_ATTRIB_SMD: // SMD and Connector pads (One external copper layer only)
1213  {
1214  LSET innerlayers_mask = padlayers_mask & LSET::InternalCuMask();
1215 
1216  if( ( padlayers_mask[F_Cu] && padlayers_mask[B_Cu] ) ||
1217  innerlayers_mask.count() != 0 )
1218  error_msgs.Add( _( "Error: only one external copper layer allowed for SMD or Connector pads" ) );
1219  }
1220  break;
1221  }
1222 
1223 
1225  {
1226  wxString value = m_tcCornerSizeRatio->GetValue();
1227  double rrRadiusRatioPercent;
1228 
1229  if( !value.ToDouble( &rrRadiusRatioPercent ) )
1230  error_msgs.Add( _( "Incorrect corner size value" ) );
1231  else
1232  {
1233  if( rrRadiusRatioPercent < 0.0 )
1234  error_msgs.Add( _( "Incorrect (negative) corner size value" ) );
1235  else if( rrRadiusRatioPercent > 50.0 )
1236  error_msgs.Add( _( "Corner size value must be smaller than 50%" ) );
1237  }
1238  }
1239 
1241  {
1243  error_msgs.Add( _( "Incorrect pad shape: the shape must be equivalent to only one polygon" ) );
1244  }
1245 
1246 
1247  if( error_msgs.GetCount() )
1248  {
1249  HTML_MESSAGE_BOX dlg( this, _("Pad setup errors list" ) );
1250  dlg.ListSet( error_msgs );
1251  dlg.ShowModal();
1252  }
1253 
1254  return error_msgs.GetCount() == 0;
1255 }
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:405
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL, int aCircleToSegmentsCount=ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:414
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:61
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:388
const wxSize & GetDrillSize() const
Definition: class_pad.h:275
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
#define abs(a)
Definition: auxiliary.h:84
Class LSET is a set of PCB_LAYER_IDs.
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:402
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:636
const wxSize & GetSize() const
Definition: class_pad.h:269
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:62
int GetLocalClearance() const
Definition: class_pad.h:417
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
Usual pad.
Definition: pad_shapes.h:60
wxString StringFromValue(EDA_UNITS_T aUnits, int aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:210
const wxPoint & GetOffset() const
Definition: class_pad.h:278
#define min(a, b)
Definition: auxiliary.h:85
EDA_UNITS_T GetUserUnits() const override
Definition: dialog_shim.h:132
void DIALOG_PAD_PROPERTIES::prepareCanvas ( )
private

Definition at line 226 of file dialog_pad_properties.cpp.

References KIGFX::VIEW::Add(), PCB_GENERAL_SETTINGS::Colors(), KIGFX::ORIGIN_VIEWITEM::CROSS, KIGFX::VIEW_CONTROLS::EnableMousewheelPan(), EDA_DRAW_PANEL_GAL::GetBackend(), EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL::GetEnableMousewheelPan(), KIGFX::VIEW::GetGAL(), EDA_DRAW_FRAME::GetGalCanvas(), KIGFX::VIEW::GetPainter(), D_PAD::GetPosition(), KIGFX::PAINTER::GetSettings(), EDA_DRAW_PANEL_GAL::GetView(), EDA_DRAW_PANEL_GAL::GetViewControls(), EDA_DRAW_FRAME::IsGalCanvasActive(), 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(), 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().

227 {
228  // Initialize the canvases (legacy or gal) to display the pad
229 
230  // Show the X and Y axis. It is usefull because pad shape can have an offset
231  // or be a complex shape.
232  KIGFX::COLOR4D axis_color = LIGHTBLUE;
233 
235  Millimeter2iu( 0.2 ),
237  m_axisOrigin->SetDrawAtZero( true );
238 
239  if( m_parent->IsGalCanvasActive() )
240  {
244 
245  bool mousewheelPan = m_parent->GetCanvas()->GetEnableMousewheelPan();
247 
248  m_panelShowPadGal->Show();
249  m_panelShowPad->Hide();
250 
252 
253  // fix the pad render mode (filled/not filled)
254  auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
255  bool sketchMode = m_cbShowPadOutline->IsChecked();
256  settings->SetSketchMode( LAYER_PADS_TH, sketchMode );
257  settings->SetSketchMode( LAYER_PAD_FR, sketchMode );
258  settings->SetSketchMode( LAYER_PAD_BK, sketchMode );
259  settings->SetSketchModeGraphicItems( sketchMode );
260 
261  // gives a non null grid size (0.001mm) because GAL layer does not like a 0 size grid:
262  double gridsize = 0.001 * IU_PER_MM;
263  view->GetGAL()->SetGridSize( VECTOR2D( gridsize, gridsize ) );
264  view->Add( m_dummyPad );
265  view->Add( m_axisOrigin );
266 
268  Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) );
269  }
270  else
271  {
272  m_panelShowPad->Show();
273  m_panelShowPadGal->Hide();
274  }
275 }
virtual EDA_DRAW_PANEL * GetCanvas() const
Definition: draw_frame.h:385
multilayer pads, usually with holes
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
virtual void EnableMousewheelPan(bool aEnable)
Function EnableMousewheelPan() Enables or disables mousewheel panning.
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
smd pads, back layer
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin
Class PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:62
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:180
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)
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:918
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
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
bool GetEnableMousewheelPan() const
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:925
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:345
Class VIEW.
Definition: view.h:61
const wxPoint GetPosition() const override
Definition: class_pad.h:220
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
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.

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

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), 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_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(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::Files_io_from_id(), NETLIST_DIALOG::GenNetlist(), 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(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), KIWAY_HOLDER::Kiway(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), 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_GENCAD_EXPORT_OPTIONS::onBrowse(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), CVPCB_MAINFRAME::OnConfigurePaths(), FOOTPRINT_EDIT_FRAME::OnConfigurePaths(), KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), KICAD_MANAGER_FRAME::OnRunGerbview(), DIALOG_BOM::OnRunPlugin(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), KICAD_MANAGER_FRAME::OnSaveProject(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Process_Config(), 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(), 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(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_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(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_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(), LAUNCHER_PANEL::~LAUNCHER_PANEL(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

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_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:142
void DIALOG_PAD_PROPERTIES::redraw ( )
private

Definition at line 1258 of file dialog_pad_properties.cpp.

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(), EDA_DRAW_PANEL_GAL::GetView(), BOX2< Vec >::Inflate(), EDA_DRAW_FRAME::IsGalCanvasActive(), m_dummyPad, m_highlight, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPad, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal, m_parent, 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_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().

1259 {
1260  if( m_parent->IsGalCanvasActive() )
1261  {
1264 
1265  // The layer used to place primitive items selected when editing custom pad shapes
1266  // we use here a layer never used in a pad:
1267  #define SELECTED_ITEMS_LAYER Dwgs_User
1268 
1270  KIGFX::PCB_RENDER_SETTINGS* settings =
1271  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
1273 
1274  view->Update( m_dummyPad );
1275 
1276  // delete previous items if highlight list
1277  while( m_highlight.size() )
1278  {
1279  delete m_highlight.back(); // the dtor also removes item from view
1280  m_highlight.pop_back();
1281  }
1282 
1283  // highlight selected primitives:
1284  long select = m_listCtrlPrimitives->GetFirstSelected();
1285 
1286  while( select >= 0 )
1287  {
1288  PAD_CS_PRIMITIVE& primitive = m_primitives[select];
1289 
1290  DRAWSEGMENT* dummySegment = new DRAWSEGMENT;
1291  dummySegment->SetLayer( SELECTED_ITEMS_LAYER );
1292  primitive.ExportTo( dummySegment );
1293  dummySegment->Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() );
1294  dummySegment->Move( m_dummyPad->GetPosition() );
1295 
1296  // Update selected primitive (highligth selected)
1297  switch( primitive.m_Shape )
1298  {
1299  case S_SEGMENT:
1300  case S_ARC:
1301  break;
1302 
1303  case S_CIRCLE: // ring or circle
1304  if( primitive.m_Thickness == 0 ) // filled circle
1305  { // the filled circle option does not exist in a DRAWSEGMENT
1306  // but it is easy to create it with a circle having the
1307  // right radius and outline width
1308  wxPoint end = dummySegment->GetCenter();
1309  end.x += primitive.m_Radius/2;
1310  dummySegment->SetEnd( end );
1311  dummySegment->SetWidth( primitive.m_Radius );
1312  }
1313  break;
1314 
1315  case S_POLYGON:
1316  break;
1317 
1318  default:
1319  delete dummySegment;
1320  dummySegment = nullptr;
1321  break;
1322  }
1323 
1324  if( dummySegment )
1325  {
1326  view->Add( dummySegment );
1327  m_highlight.push_back( dummySegment );
1328  }
1329 
1330  select = m_listCtrlPrimitives->GetNextSelected( select );
1331  }
1332 
1333  BOX2I bbox = m_dummyPad->ViewBBox();
1334 
1335  if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
1336  {
1337  // gives a size to the full drawable area
1338  BOX2I drawbox;
1339  drawbox.Move( m_dummyPad->GetPosition() );
1340  drawbox.Inflate( bbox.GetSize().x*2, bbox.GetSize().y*2 );
1341 
1342  view->SetBoundary( drawbox );
1343 
1344  // Autozoom
1345  view->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) );
1346 
1347  // Add a margin
1348  view->SetScale( m_panelShowPadGal->GetView()->GetScale() * 0.7 );
1349 
1352  }
1353  }
1354  else
1355  {
1356  m_panelShowPad->Refresh();
1357  }
1358 }
const Vec & GetOrigin() const
Definition: box2.h:191
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:549
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:858
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
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
const Vec & GetSize() const
Definition: box2.h:187
void SetScale(double aScale)
Function SetScale() Sets the scaling factor.
Definition: view.h:250
Class PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:62
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
Definition: class_pad.cpp:1355
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:98
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:91
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Function SetLayerColor Changes the color used to draw a layer.
Definition: painter.h:230
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:918
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
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:1538
STROKE_T m_Shape
Definition: class_pad.h:94
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...
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:95
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, but soon degrees.
Definition: class_pad.h:382
#define SELECTED_ITEMS_LAYER
void SetEnd(const wxPoint &aEnd)
double GetScale() const
Function GetScale()
Definition: view.h:268
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:345
Class VIEW.
Definition: view.h:61
void SetBoundary(const BOX2D &aBoundary)
Function SetBoundary() Sets limits for view area.
Definition: view.h:278
const wxPoint GetPosition() const override
Definition: class_pad.h:220
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)
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 115 of file dialog_shim.h.

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_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_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_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(), and LIB_EDIT_FRAME::savePartAs().

116  {
117  m_initialFocusTarget = aWindow;
118  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:179
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 47 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), InvokePcbLibTableEditor(), KIWAY_HOLDER::Kiway(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

48 {
49 #if defined(DEBUG)
50  // offer a trap point for debugging most any window
51  wxASSERT( aDest );
52  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
53  {
54  int breakhere=1;
55  (void) breakhere;
56  }
57 #endif
58 
59  (void) aDest;
60 
61  m_kiway = aKiway;
62 }
KIWAY * m_kiway
Definition: kiway_player.h:94
const char * name
Definition: DXF_plotter.cpp:61
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 1060 of file dialog_pad_properties.cpp.

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().

1061 {
1062  LSET cu_set = layer_mask & LSET::AllCuMask();
1063 
1064  if( cu_set == LSET( F_Cu ) )
1065  m_rbCopperLayersSel->SetSelection( 0 );
1066  else if( cu_set == LSET( B_Cu ) )
1067  m_rbCopperLayersSel->SetSelection( 1 );
1068  else if( cu_set.any() )
1069  m_rbCopperLayersSel->SetSelection( 2 );
1070  else
1071  m_rbCopperLayersSel->SetSelection( 3 );
1072 
1073  m_PadLayerAdhCmp->SetValue( layer_mask[F_Adhes] );
1074  m_PadLayerAdhCu->SetValue( layer_mask[B_Adhes] );
1075 
1076  m_PadLayerPateCmp->SetValue( layer_mask[F_Paste] );
1077  m_PadLayerPateCu->SetValue( layer_mask[B_Paste] );
1078 
1079  m_PadLayerSilkCmp->SetValue( layer_mask[F_SilkS] );
1080  m_PadLayerSilkCu->SetValue( layer_mask[B_SilkS] );
1081 
1082  m_PadLayerMaskCmp->SetValue( layer_mask[F_Mask] );
1083  m_PadLayerMaskCu->SetValue( layer_mask[B_Mask] );
1084 
1085  m_PadLayerECO1->SetValue( layer_mask[Eco1_User] );
1086  m_PadLayerECO2->SetValue( layer_mask[Eco2_User] );
1087 
1088  m_PadLayerDraft->SetValue( layer_mask[Dwgs_User] );
1089 }
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.
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 134 of file dialog_shim.cpp.

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

135 {
136  wxSize sz( x, y );
137  SetSize( ConvertDialogToPixels( sz ) );
138 }
bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 162 of file dialog_shim.cpp.

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_SCH_FIND::OnCancel(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), DIALOG_SHIM::ShowQuasiModal(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

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

Definition at line 327 of file dialog_shim.cpp.

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 SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), SCH_EDIT_FRAME::InstallHierarchyFrame(), PCB_BASE_FRAME::InstallPadOptionsFrame(), InvokeDialogEditComponentsLibId(), InvokeDialogUpdateFields(), LIB_EDIT_FRAME::OnEditComponentProperties(), PCB_EDIT_FRAME::OnEditTracksAndVias(), SCH_EDIT_FRAME::OnLaunchBomManager(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), EDIT_TOOL::Properties(), SCH_BASE_FRAME::SelectComponentFromLibTree(), and PCB_BASE_FRAME::SelectFootprintFromLibTree().

328 {
329  // This is an exception safe way to zero a pointer before returning.
330  // Yes, even though DismissModal() clears this first normally, this is
331  // here in case there's an exception before the dialog is dismissed.
332  struct NULLER
333  {
334  void*& m_what;
335  NULLER( void*& aPtr ) : m_what( aPtr ) {}
336  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
337  } clear_this( (void*&) m_qmodal_loop );
338 
339  // release the mouse if it's currently captured as the window having it
340  // will be disabled when this dialog is shown -- but will still keep the
341  // capture making it impossible to do anything in the modal dialog itself
342  wxWindow* win = wxWindow::GetCapture();
343  if( win )
344  win->ReleaseMouse();
345 
346  // Get the optimal parent
347  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
348 
349  // Show the optimal parent
350  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
351 
352  wxASSERT_MSG( !m_qmodal_parent_disabler,
353  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
354 
355  // quasi-modal: disable only my "optimal" parent
357 
358 #ifdef __WXMAC__
359  // Apple in its infinite wisdom will raise a disabled window before even passing
360  // us the event, so we have no way to stop it. Instead, we must set an order on
361  // the windows so that the quasi-modal will be pushed in front of the disabled
362  // window when it is raised.
363  ReparentQuasiModal();
364 #endif
365  Show( true );
366 
367  m_qmodal_showing = true;
368 
369  WX_EVENT_LOOP event_loop;
370 
371  m_qmodal_loop = &event_loop;
372 
373  event_loop.Run();
374 
375  m_qmodal_showing = false;
376 
377  return GetReturnCode();
378 }
bool m_qmodal_showing
Definition: dialog_shim.h:183
#define WX_EVENT_LOOP
Definition: kiway_player.h:100
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:182
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:184
Toggle a window&#39;s "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:33
#define DBG(x)
Definition: fctsys.h:33
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 1376 of file dialog_pad_properties.cpp.

References MODULE::CalculateBoundingBox(), EDA_ITEM::ClearFlags(), D_PAD::DeletePrimitivesList(), DO_NOT_DRAW, FlipLayerMask(), D_PAD::FlipPrimitives(), D_PAD::GetAnchorPadShape(), D_PAD::GetAttribute(), D_PAD::GetBoundingBox(), EDA_DRAW_FRAME::GetCanvas(), 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(), BOARD_CONNECTED_ITEM::GetNetCode(), 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_board, 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, BOARD::m_Status_Pcb, COMMIT::Modify(), PAD_ATTRIB_HOLE_NOT_PLATED, PAD_SHAPE_CUSTOM, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_ZONE_CONN_FULL, PAD_ZONE_CONN_NONE, padValuesOK(), BOARD_COMMIT::Push(), EDA_DRAW_PANEL::RefreshDrawingRect(), RotatePoint(), D_PAD::SetAnchorPadShape(), D_PAD::SetAttribute(), 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.

Referenced by OnUpdateUINonCopperWarning().

1377 {
1378  BOARD_COMMIT commit( m_parent );
1379 
1380  if( !wxDialog::TransferDataFromWindow() )
1381  return false;
1382 
1383  if( !m_panelGeneral->TransferDataFromWindow() )
1384  return false;
1385 
1386  if( !m_localSettingsPanel->TransferDataFromWindow() )
1387  return false;
1388 
1389  if( !padValuesOK() )
1390  return false;
1391 
1392  bool rastnestIsChanged = false;
1393  int isign = m_isFlipped ? -1 : 1;
1394 
1396  // m_padMaster is a pattern: ensure there is no net for this pad:
1398 
1399  if( !m_currentPad ) // Set current Pad parameters
1400  return true;
1401 
1402  commit.Modify( m_currentPad );
1403 
1404  // redraw the area where the pad was, without pad (delete pad on screen)
1408 
1409  // Update values
1412 
1414  {
1416  rastnestIsChanged = true;
1417  }
1418 
1419  wxSize size;
1420  MODULE* footprint = m_currentPad->GetParent();
1421 
1422  if( footprint )
1423  {
1424  footprint->SetLastEditTime();
1425 
1426  // compute the pos 0 value, i.e. pad position for footprint with orientation = 0
1427  // i.e. relative to footprint origin (footprint position)
1428  wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition();
1429  RotatePoint( &pt, -footprint->GetOrientation() );
1430  m_currentPad->SetPos0( pt );
1432  + footprint->GetOrientation() );
1433  }
1434 
1436 
1437  size = m_padMaster->GetDelta();
1438  size.y *= isign;
1439  m_currentPad->SetDelta( size );
1440 
1443 
1444  wxPoint offset = m_padMaster->GetOffset();
1445  offset.y *= isign;
1446  m_currentPad->SetOffset( offset );
1447 
1449 
1452 
1453 
1456 
1457  if( m_isFlipped )
1458  {
1461  }
1462 
1464  {
1465  rastnestIsChanged = true;
1467  }
1468 
1469  if( m_isFlipped )
1470  {
1472  }
1473 
1475 
1476  int padNetcode = NETINFO_LIST::UNCONNECTED;
1477 
1478  // For PAD_ATTRIB_HOLE_NOT_PLATED, ensure there is no net name selected
1480  padNetcode = m_PadNetSelector->GetSelectedNetcode();
1481 
1482  if( m_currentPad->GetNetCode() != padNetcode )
1483  {
1484  rastnestIsChanged = true;
1485  m_currentPad->SetNetCode( padNetcode );
1486  }
1487 
1495 
1497  {
1500  else
1502  }
1503  else
1505 
1506 
1507  // rounded rect pads with radius ratio = 0 are in fact rect pads.
1508  // So set the right shape (and perhaps issues with a radius = 0)
1511  {
1513  }
1514 
1515  // define the way the clearance area is defined in zones
1517 
1518  if( footprint )
1519  footprint->CalculateBoundingBox();
1520 
1522 
1523  // redraw the area where the pad was
1525 
1526  commit.Push( _( "Modify pad" ) );
1527 
1528  if( rastnestIsChanged ) // The net ratsnest must be recalculated
1529  m_board->m_Status_Pcb = 0;
1530 
1531  return true;
1532 }
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:226
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask, paste, solder layers are swapped internal layers are flipped only if the copper layers count is known.
Definition: lset.cpp:521
const std::vector< PAD_CS_PRIMITIVE > & GetPrimitives() const
Accessor to the basic shape list.
Definition: class_pad.h:336
void FlipPrimitives()
Flip the basic shapes, in custom pads.
Definition: class_pad.cpp:450
virtual EDA_DRAW_PANEL * GetCanvas() const
Definition: draw_frame.h:385
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:405
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
int GetPadToDieLength() const
Definition: class_pad.h:412
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad&#39;s members.
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:414
MODULE * GetParent() const
Definition: class_pad.h:162
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:219
virtual void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
int GetSelectedNetcode()
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:388
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:274
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
const wxSize & GetDrillSize() const
Definition: class_pad.h:275
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:646
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
Pads are not covered.
Definition: zones.h:52
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:253
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:256
void SetZoneConnection(ZoneConnection aType)
Definition: class_pad.h:489
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:182
double GetOrientation() const
Definition: class_module.h:188
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:262
ZoneConnection GetZoneConnection() const
Definition: class_pad.cpp:686
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:402
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:313
int GetThermalWidth() const
Definition: class_pad.cpp:697
int GetThermalGap() const
Definition: class_pad.cpp:708
void SetThermalWidth(int aWidth)
Definition: class_pad.h:492
const wxSize & GetSize() const
Definition: class_pad.h:269
void SetSize(const wxSize &aSize)
Definition: class_pad.h:268
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
const wxString & GetName() const
Definition: class_pad.h:190
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:420
void SetPadToDieLength(int aLength)
Definition: class_pad.h:411
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:408
int GetLocalClearance() const
Definition: class_pad.h:417
void SetLocalClearance(int aClearance)
Definition: class_pad.h:418
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:423
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:424
int GetNetCode() const
Function GetNetCode.
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:401
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:634
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:386
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:415
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: class_pad.h:232
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:382
const wxSize & GetDelta() const
Definition: class_pad.h:272
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:217
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:417
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:257
bool padValuesOK()
test if all values are acceptable for the pad
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:421
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:242
const wxPoint GetPosition() const override
Definition: class_pad.h:220
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:277
void SetThermalGap(int aGap)
Definition: class_pad.h:495
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:469
const wxPoint GetPosition() const override
Definition: class_module.h:183
bool SetPrimitives(const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
Import to the basic shape list.
void DeletePrimitivesList()
clear the basic shapes list
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: class_pad.cpp:215
const wxPoint & GetOffset() const
Definition: class_pad.h:278
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:126
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:271
pads are covered by copper
Definition: zones.h:54
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:241
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.

References LSET::AllCuMask(), B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, CHOICE_SHAPE_CUSTOM_RECT_ANCHOR, code_shape, code_type, CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL, CUST_PAD_SHAPE_IN_ZONE_OUTLINE, delta, DisplayError(), Dwgs_User, Eco1_User, Eco2_User, F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, D_PAD::GetAnchorPadShape(), D_PAD::GetAttribute(), NET_SELECTOR::GetSelectedNetcode(), D_PAD::GetShape(), D_PAD::GetSize(), UNIT_BINDER::GetValue(), m_clearance, DIALOG_PAD_PROPERTIES_BASE::m_holeShapeCtrl, m_holeX, m_holeY, DIALOG_PAD_PROPERTIES_BASE::m_localSettingsPanel, m_maskClearance, m_offsetX, m_offsetY, m_OrientValidator, m_OrientValue, 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_PadNetSelector, DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadShape, m_padToDie, DIALOG_PAD_PROPERTIES_BASE::m_PadType, DIALOG_PAD_PROPERTIES_BASE::m_panelGeneral, m_pasteClearance, m_posX, m_posY, m_primitives, DIALOG_PAD_PROPERTIES_BASE::m_rbCopperLayersSel, m_sizeX, m_sizeY, DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginRatioCtrl, m_spokeWidth, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, m_thermalGap, DIALOG_PAD_PROPERTIES_BASE::m_trapAxisCtrl, m_trapDelta, DIALOG_PAD_PROPERTIES_BASE::m_ZoneConnectionChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneConnectionCustom, DIALOG_PAD_PROPERTIES_BASE::m_ZoneCustomPadShape, PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED, PAD_ATTRIB_SMD, PAD_ATTRIB_STANDARD, PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG, 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, D_PAD::SetAnchorPadShape(), D_PAD::SetAttribute(), D_PAD::SetCustomShapeInZoneOpt(), D_PAD::SetDelta(), D_PAD::SetDrillShape(), D_PAD::SetDrillSize(), D_PAD::SetLayerSet(), D_PAD::SetLocalClearance(), D_PAD::SetLocalSolderMaskMargin(), D_PAD::SetLocalSolderPasteMargin(), D_PAD::SetLocalSolderPasteMarginRatio(), 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(), NETINFO_LIST::UNCONNECTED, and UNIT_BINDER::Validate().

Referenced by editPrimitive(), onAddPrimitive(), onCornerRadiusChange(), onCornerSizePercentChange(), onDeletePrimitive(), OnDrillShapeSelected(), onDuplicatePrimitive(), onGeometryTransform(), OnPadShapeSelection(), OnSetLayers(), OnValuesChanged(), PadOrientEvent(), PadTypeSelected(), padValuesOK(), and TransferDataFromWindow().

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  // Custom shape has only 2 options:
1588  if( aPad->GetShape() == PAD_SHAPE_CUSTOM )
1589  {
1590  if( m_ZoneConnectionCustom->GetSelection() == 0 )
1592  else
1594  }
1595 
1596  aPad->SetPosition( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
1597  aPad->SetPos0( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
1598 
1599  if( m_holeShapeCtrl->GetSelection() == 0 )
1600  {
1602  aPad->SetDrillSize( wxSize( m_holeX.GetValue(), m_holeX.GetValue() ) );
1603  }
1604  else
1605  {
1607  aPad->SetDrillSize( wxSize( m_holeX.GetValue(), m_holeY.GetValue() ) );
1608  }
1609 
1610  if( aPad->GetShape() == PAD_SHAPE_CIRCLE )
1611  aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeX.GetValue() ) );
1612  else
1613  aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeY.GetValue() ) );
1614 
1615  // Read pad length die
1617 
1618  // For a trapezoid, test delta value (be sure delta is not too large for pad size)
1619  // remember DeltaSize.x is the Y size variation
1620  bool error = false;
1621 
1622  if( aPad->GetShape() == PAD_SHAPE_TRAPEZOID )
1623  {
1624  wxSize delta;
1625 
1626  // For a trapezoid, only one of delta.x or delta.y is not 0, depending on
1627  // the direction.
1628  if( m_trapAxisCtrl->GetSelection() == 0 )
1629  delta.x = m_trapDelta.GetValue();
1630  else
1631  delta.y = m_trapDelta.GetValue();
1632 
1633  if( delta.x < 0 && delta.x <= -aPad->GetSize().y )
1634  {
1635  delta.x = -aPad->GetSize().y + 2;
1636  error = true;
1637  }
1638 
1639  if( delta.x > 0 && delta.x >= aPad->GetSize().y )
1640  {
1641  delta.x = aPad->GetSize().y - 2;
1642  error = true;
1643  }
1644 
1645  if( delta.y < 0 && delta.y <= -aPad->GetSize().x )
1646  {
1647  delta.y = -aPad->GetSize().x + 2;
1648  error = true;
1649  }
1650 
1651  if( delta.y > 0 && delta.y >= aPad->GetSize().x )
1652  {
1653  delta.y = aPad->GetSize().x - 2;
1654  error = true;
1655  }
1656 
1657  aPad->SetDelta( delta );
1658  }
1659 
1660  aPad->SetOffset( wxPoint( m_offsetX.GetValue(), m_offsetY.GetValue() ) );
1661  aPad->SetOrientation( m_OrientValue * 10.0 );
1662  aPad->SetName( m_PadNumCtrl->GetValue() );
1664 
1665  // Clear some values, according to the pad type and shape
1666  switch( aPad->GetShape() )
1667  {
1668  case PAD_SHAPE_CIRCLE:
1669  aPad->SetOffset( wxPoint( 0, 0 ) );
1670  aPad->SetDelta( wxSize( 0, 0 ) );
1671  break;
1672 
1673  case PAD_SHAPE_RECT:
1674  aPad->SetDelta( wxSize( 0, 0 ) );
1675  break;
1676 
1677  case PAD_SHAPE_OVAL:
1678  aPad->SetDelta( wxSize( 0, 0 ) );
1679  break;
1680 
1681  case PAD_SHAPE_TRAPEZOID:
1682  break;
1683 
1684  case PAD_SHAPE_ROUNDRECT:
1685  aPad->SetDelta( wxSize( 0, 0 ) );
1686  break;
1687 
1688  case PAD_SHAPE_CUSTOM:
1689  aPad->SetOffset( wxPoint( 0, 0 ) );
1690  aPad->SetDelta( wxSize( 0, 0 ) );
1691 
1692  // The pad custom has a "anchor pad" (a basic shape: round or rect pad)
1693  // that is the minimal area of this pad, and is usefull to ensure a hole
1694  // diameter is acceptable, and is used in Gerber files as flashed area
1695  // reference
1696  if( aPad->GetAnchorPadShape() == PAD_SHAPE_CIRCLE )
1697  aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeX.GetValue() ) );
1698 
1699  // define the way the clearance area is defined in zones
1700  aPad->SetCustomShapeInZoneOpt( m_ZoneCustomPadShape->GetSelection() == 0 ?
1703  break;
1704 
1705  default:
1706  ;
1707  }
1708 
1709  switch( aPad->GetAttribute() )
1710  {
1711  case PAD_ATTRIB_STANDARD:
1712  break;
1713 
1714  case PAD_ATTRIB_CONN:
1715  case PAD_ATTRIB_SMD:
1716  // SMD and PAD_ATTRIB_CONN has no hole.
1717  // basically, SMD and PAD_ATTRIB_CONN are same type of pads
1718  // PAD_ATTRIB_CONN has just a default non technical layers that differs from SMD
1719  // and are intended to be used in virtual edge board connectors
1720  // However we can accept a non null offset,
1721  // mainly to allow complex pads build from a set of basic pad shapes
1722  aPad->SetDrillSize( wxSize( 0, 0 ) );
1723  break;
1724 
1726  // Mechanical purpose only:
1727  // no offset, no net name, no pad name allowed
1728  aPad->SetOffset( wxPoint( 0, 0 ) );
1729  aPad->SetName( wxEmptyString );
1731  break;
1732 
1733  default:
1734  DisplayError( NULL, wxT( "Error: unknown pad type" ) );
1735  break;
1736  }
1737 
1738  if( aPad->GetShape() == PAD_SHAPE_ROUNDRECT )
1739  {
1740  wxString value = m_tcCornerSizeRatio->GetValue();
1741  double rrRadiusRatioPercent;
1742 
1743  if( value.ToDouble( &rrRadiusRatioPercent ) )
1744  aPad->SetRoundRectRadiusRatio( rrRadiusRatioPercent / 100.0 );
1745  }
1746 
1747  LSET padLayerMask;
1748 
1749  switch( m_rbCopperLayersSel->GetSelection() )
1750  {
1751  case 0: padLayerMask.set( F_Cu ); break;
1752  case 1: padLayerMask.set( B_Cu ); break;
1753  case 2: padLayerMask |= LSET::AllCuMask(); break;
1754  case 3: break; // No copper layers
1755  }
1756 
1757  if( m_PadLayerAdhCmp->GetValue() )
1758  padLayerMask.set( F_Adhes );
1759 
1760  if( m_PadLayerAdhCu->GetValue() )
1761  padLayerMask.set( B_Adhes );
1762 
1763  if( m_PadLayerPateCmp->GetValue() )
1764  padLayerMask.set( F_Paste );
1765 
1766  if( m_PadLayerPateCu->GetValue() )
1767  padLayerMask.set( B_Paste );
1768 
1769  if( m_PadLayerSilkCmp->GetValue() )
1770  padLayerMask.set( F_SilkS );
1771 
1772  if( m_PadLayerSilkCu->GetValue() )
1773  padLayerMask.set( B_SilkS );
1774 
1775  if( m_PadLayerMaskCmp->GetValue() )
1776  padLayerMask.set( F_Mask );
1777 
1778  if( m_PadLayerMaskCu->GetValue() )
1779  padLayerMask.set( B_Mask );
1780 
1781  if( m_PadLayerECO1->GetValue() )
1782  padLayerMask.set( Eco1_User );
1783 
1784  if( m_PadLayerECO2->GetValue() )
1785  padLayerMask.set( Eco2_User );
1786 
1787  if( m_PadLayerDraft->GetValue() )
1788  padLayerMask.set( Dwgs_User );
1789 
1790  aPad->SetLayerSet( padLayerMask );
1791 
1792  return error;
1793 }
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
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:226
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:405
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
virtual bool Validate(int aMin, int aMax, bool setFocusOnError=true)
Function Validate Validates the control against the given range, informing the user of any errors fou...
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:61
wxFloatingPointValidator< double > m_OrientValidator
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:219
int GetSelectedNetcode()
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:274
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:646
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
static const int delta[8][2]
Definition: solve.cpp:112