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 ()
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal ()
 
bool Show (bool show) override
 
bool Enable (bool enable) 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, wxID_PADNETNAMECTRL }
 

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 FixOSXCancelButtonIssue ()
 A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms. More...
 

Protected Attributes

wxNotebook * m_notebook
 
wxPanel * m_panelGeneral
 
wxStaticText * m_PadNumText
 
wxTextCtrl * m_PadNumCtrl
 
wxStaticText * m_PadNameText
 
wxTextCtrl * m_PadNetNameCtrl
 
wxStaticText * m_staticText44
 
wxChoice * m_PadType
 
wxStaticText * m_staticText45
 
wxChoice * m_PadShape
 
wxStaticText * m_staticText4
 
TEXT_CTRL_EVALm_PadPosition_X_Ctrl
 
wxStaticText * m_PadPosX_Unit
 
wxStaticText * m_staticText41
 
TEXT_CTRL_EVALm_PadPosition_Y_Ctrl
 
wxStaticText * m_PadPosY_Unit
 
wxStaticText * m_staticText12
 
TEXT_CTRL_EVALm_ShapeSize_X_Ctrl
 
wxStaticText * m_PadShapeSizeX_Unit
 
wxStaticText * m_staticText15
 
TEXT_CTRL_EVALm_ShapeSize_Y_Ctrl
 
wxStaticText * m_PadShapeSizeY_Unit
 
wxStaticText * m_PadOrientText
 
wxChoice * m_PadOrient
 
wxStaticText * m_staticText491
 
TEXT_CTRL_EVALm_PadOrientCtrl
 
wxStaticText * m_customOrientUnits
 
wxStaticText * m_staticText17
 
TEXT_CTRL_EVALm_ShapeOffset_X_Ctrl
 
wxStaticText * m_PadShapeOffsetX_Unit
 
wxStaticText * m_staticText19
 
TEXT_CTRL_EVALm_ShapeOffset_Y_Ctrl
 
wxStaticText * m_PadShapeOffsetY_Unit
 
wxStaticText * m_staticText38
 
TEXT_CTRL_EVALm_LengthPadToDieCtrl
 
wxStaticText * m_PadLengthDie_Unit
 
wxStaticLine * m_staticline4
 
wxStaticLine * m_staticline5
 
wxStaticLine * m_staticline6
 
wxStaticText * m_staticText21
 
TEXT_CTRL_EVALm_ShapeDelta_Ctrl
 
wxStaticText * m_PadShapeDelta_Unit
 
wxStaticText * m_staticText23
 
wxChoice * m_trapDeltaDirChoice
 
wxStaticLine * m_staticline7
 
wxStaticLine * m_staticline8
 
wxStaticLine * m_staticline9
 
wxStaticText * m_staticTextCornerSizeRatio
 
TEXT_CTRL_EVALm_tcCornerSizeRatio
 
wxStaticText * m_staticTextCornerSizeRatioUnit
 
wxStaticText * m_staticTextCornerRadius
 
wxStaticText * m_staticTextCornerRadiusValue
 
wxStaticText * m_staticTextCornerSizeUnit
 
wxStaticText * m_staticText47
 
wxChoice * m_DrillShapeCtrl
 
wxStaticText * m_staticText51
 
wxStaticText * m_textPadDrillX
 
TEXT_CTRL_EVALm_PadDrill_X_Ctrl
 
wxStaticText * m_PadDrill_X_Unit
 
wxStaticText * m_textPadDrillY
 
TEXT_CTRL_EVALm_PadDrill_Y_Ctrl
 
wxStaticText * m_PadDrill_Y_Unit
 
wxStaticText * m_staticText511
 
wxChoice * m_rbCopperLayersSel
 
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
 
wxStaticText * m_staticTitleModuleRot
 
wxStaticText * m_staticModuleRotValue
 
wxStaticText * m_staticTitleModuleSide
 
wxStaticText * m_staticModuleSideValue
 
wxPanel * m_localSettingsPanel
 
wxStaticText * m_staticTextNetClearance
 
TEXT_CTRL_EVALm_NetClearanceValueCtrl
 
wxStaticText * m_NetClearanceUnits
 
wxStaticText * m_MaskClearanceTitle
 
TEXT_CTRL_EVALm_SolderMaskMarginCtrl
 
wxStaticText * m_SolderMaskMarginUnits
 
wxStaticText * m_staticTextSolderPaste
 
TEXT_CTRL_EVALm_SolderPasteMarginCtrl
 
wxStaticText * m_SolderPasteMarginUnits
 
wxStaticText * m_staticTextRatio
 
TEXT_CTRL_EVALm_SolderPasteMarginRatioCtrl
 
wxStaticText * m_SolderPasteRatioMarginUnits
 
wxStaticBoxSizer * m_sbSizerZonesSettings
 
wxStaticText * m_staticText40
 
wxChoice * m_ZoneConnectionChoice
 
wxStaticText * m_staticText49
 
TEXT_CTRL_EVALm_ThermalWidthCtrl
 
wxStaticText * m_ThermalWidthUnits
 
wxStaticText * m_staticText52
 
TEXT_CTRL_EVALm_ThermalGapCtrl
 
wxStaticText * m_ThermalGapUnits
 
wxStaticText * m_staticTextcps
 
wxChoice * m_ZoneCustomPadShape
 
wxStaticText * m_staticTextWarning
 
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
 
wxButton * m_buttonImport
 
wxPanel * m_panelShowPad
 
PCB_DRAW_PANEL_GALm_panelShowPadGal
 
KIGFX::GAL_DISPLAY_OPTIONS m_galOptions
 
wxStaticText * m_staticTextWarningPadFlipped
 
wxStdDialogButtonSizer * m_sdbSizer
 
wxButton * m_sdbSizerOK
 
wxButton * m_sdbSizerCancel
 
std::string m_hash_key
 
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
 
void OnPadShapeSelection (wxCommandEvent &event) override
 
void OnDrillShapeSelected (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 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 onImportPrimitives (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
 
KIGFX::ORIGIN_VIEWITEMm_axisOrigin
 
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
 
std::vector< DRAWSEGMENT * > m_highligth
 
wxFloatingPointValidator< double > m_OrientValidator
 
double m_OrientValue
 

Detailed Description

class DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder

Definition at line 57 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 108 of file dialog_pad_properties.cpp.

References DIALOG_SHIM::FinishDialogSettings(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_FRAME::GetDesignSettings(), initValues(), m_board, m_canUpdate, m_currentPad, m_dummyPad, m_OrientValidator, BOARD_DESIGN_SETTINGS::m_Pad_Master, m_padMaster, DIALOG_PAD_PROPERTIES_BASE::m_PadOrientCtrl, m_parent, DIALOG_PAD_PROPERTIES_BASE::m_sdbSizerOK, prepareCanvas(), and TransferDataToWindow().

108  :
109  DIALOG_PAD_PROPERTIES_BASE( aParent ),
111 {
112  m_canUpdate = false;
113  m_parent = aParent;
114  m_currentPad = aPad; // aPad can be NULL, if the dialog is called
115  // from the footprint editor to set default pad setup
116 
118 
119  m_OrientValidator.SetRange( -360.0, 360.0 );
120  m_PadOrientCtrl->SetValidator( m_OrientValidator );
121  m_OrientValidator.SetWindow( m_PadOrientCtrl );
122 
124  m_dummyPad = new D_PAD( (MODULE*) NULL );
125 
126  if( aPad )
127  *m_dummyPad = *aPad;
128  else // We are editing a "master" pad, i.e. a template to create new pads
130 
131  initValues();
132 
133  // Usually, TransferDataToWindow is called by OnInitDialog
134  // calling it here fixes all widgets sizes, and FinishDialogSettings can
135  // safely fix minsizes
137 
138  // Initialize canvas to be able to display the dummy pad:
139  prepareCanvas();
140 
141  m_sdbSizerOK->SetDefault();
142  m_canUpdate = true;
143 
144  // Now all widgets have the size fixed, call FinishDialogSettings
146 }
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
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
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(785, 659), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSUNKEN_BORDER)
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
DIALOG_PAD_PROPERTIES::~DIALOG_PAD_PROPERTIES ( )
inline

Definition at line 61 of file dialog_pad_properties.h.

References m_axisOrigin, and m_dummyPad.

62  {
63  delete m_dummyPad;
64  delete m_axisOrigin;
65  }
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin

Member Function Documentation

void DIALOG_PAD_PROPERTIES::displayPrimitivesList ( )
private

Definition at line 712 of file dialog_pad_properties.cpp.

References CoordinateToString(), FMT_ANGLE, Format(), 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, S_ARC, S_CIRCLE, S_POLYGON, and S_SEGMENT.

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

713 {
714  m_listCtrlPrimitives->ClearAll();
715 
716  wxListItem itemCol;
717  itemCol.SetImage(-1);
718 
719  for( int ii = 0; ii < 5; ++ii )
720  m_listCtrlPrimitives->InsertColumn(ii, itemCol);
721 
722  wxString bs_info[5];
723 
724  for( unsigned ii = 0; ii < m_primitives.size(); ++ii )
725  {
726  const PAD_CS_PRIMITIVE& primitive = m_primitives[ii];
727 
728  for( unsigned jj = 0; jj < 5; ++jj )
729  bs_info[jj].Empty();
730 
731  bs_info[4] = wxString::Format( _( "width %s" ),
732  CoordinateToString( primitive.m_Thickness, true ) );
733 
734  switch( primitive.m_Shape )
735  {
736  case S_SEGMENT: // usual segment : line with rounded ends
737  bs_info[0] = _( "Segment" );
738  bs_info[1] = _( "from " ) + formatCoord( primitive.m_Start );
739  bs_info[2] = _( "to " ) + formatCoord( primitive.m_End );
740  break;
741 
742  case S_ARC: // Arc with rounded ends
743  bs_info[0] = _( "Arc" );
744  bs_info[1] = _( "center " ) + formatCoord( primitive.m_Start ); // Center
745  bs_info[2] = _( "start " ) + formatCoord( primitive.m_End ); // Start point
746  bs_info[3] = wxString::Format( _( "angle %s" ), FMT_ANGLE( primitive.m_ArcAngle ) );
747  break;
748 
749  case S_CIRCLE: // ring or circle
750  if( primitive.m_Thickness )
751  bs_info[0] = _( "ring" );
752  else
753  bs_info[0] = _( "circle" );
754 
755  bs_info[1] = formatCoord( primitive.m_Start );
756  bs_info[2] = wxString::Format( _( "radius %s" ),
757  CoordinateToString( primitive.m_Radius, true ) );
758  break;
759 
760  case S_POLYGON: // polygon
761  bs_info[0] = "Polygon";
762  bs_info[1] = wxString::Format( _( "corners count %d" ), primitive.m_Poly.size() );
763  break;
764 
765  default:
766  bs_info[0] = "Unknown primitive";
767  break;
768  }
769 
770  long tmp = m_listCtrlPrimitives->InsertItem(ii, bs_info[0]);
771  m_listCtrlPrimitives->SetItemData(tmp, ii);
772 
773  for( int jj = 0, col = 0; jj < 5; ++jj )
774  {
775  m_listCtrlPrimitives->SetItem(tmp, col++, bs_info[jj]);
776  }
777  }
778 
779  // Now columns are filled, ensure correct width of columns
780  for( unsigned ii = 0; ii < 5; ++ii )
781  m_listCtrlPrimitives->SetColumnWidth( ii, wxLIST_AUTOSIZE );
782 }
wxString CoordinateToString(int aValue, bool aConvertToMils)
Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inche...
Definition: base_units.cpp:118
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
#define FMT_ANGLE
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
static wxString formatCoord(wxPoint aCoord)
double m_ArcAngle
radius of a circle
Definition: class_pad.h:99
void DIALOG_PAD_PROPERTIES::editPrimitive ( )
private

Definition at line 1735 of file dialog_pad_properties.cpp.

References displayPrimitivesList(), m_canUpdate, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives, 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().

1736 {
1737  long select = m_listCtrlPrimitives->GetFirstSelected();
1738 
1739  if( select < 0 )
1740  {
1741  wxMessageBox( _( "No shape selected" ) );
1742  return;
1743  }
1744 
1745  PAD_CS_PRIMITIVE& shape = m_primitives[select];
1746 
1747  if( shape.m_Shape == S_POLYGON )
1748  {
1749  DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, &shape );
1750 
1751  if( dlg.ShowModal() != wxID_OK )
1752  return;
1753 
1754  dlg.TransferDataFromWindow();
1755  }
1756 
1757  else
1758  {
1759  DIALOG_PAD_PRIMITIVES_PROPERTIES dlg( this, &shape );
1760 
1761  if( dlg.ShowModal() != wxID_OK )
1762  return;
1763 
1764  dlg.TransferDataFromWindow();
1765  }
1766 
1768 
1769  if( m_canUpdate )
1770  {
1772  redraw();
1773  }
1774 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
polygon (not yet used for tracks, but could be in microwave apps)
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h: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 184 of file dialog_shim.cpp.

Referenced by DIALOG_PRINT_USING_PRINTER::InitValues().

185 {
186  // so we can do logging of this state change:
187 
188 #if defined(DEBUG)
189  const char* type_id = typeid( *this ).name();
190  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
191 #endif
192 
193  return wxDialog::Enable( enable );
194 }
void DIALOG_PAD_PROPERTIES::enablePrimitivePage ( bool  aEnable)
private

enable (or disable) the primitive page editor

Definition at line 168 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, DIALOG_PAD_PROPERTIES_BASE::m_buttonImport, and DIALOG_PAD_PROPERTIES_BASE::m_listCtrlPrimitives.

Referenced by initValues(), and OnPadShapeSelection().

169 {
170  // Enable or disable the widgets in page managing custom shape primitives
171  m_listCtrlPrimitives->Enable( aEnable );
172  m_buttonDel->Enable( aEnable );
173  m_buttonEditShape->Enable( aEnable );
174  m_buttonAddShape->Enable( aEnable );
175  m_buttonDup->Enable( aEnable );
176  m_buttonGeometry->Enable( aEnable );
177  m_buttonImport->Enable( aEnable );
178 }
void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 542 of file dialog_shim.cpp.

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

Referenced by HK_PROMPT_DIALOG::EndFlexible(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCancelButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick(), DIALOG_EDIT_ONE_FIELD::OnCancelClick(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCloseDialog(), DIALOG_EDIT_ONE_FIELD::OnCloseDialog(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCloseDialog(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_EDIT_ONE_FIELD::OnOkClick(), DIALOG_EXCHANGE_MODULE::OnQuit(), DIALOG_CHOOSE_COMPONENT::OnSchViewDClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), and DIALOG_SHIM::~DIALOG_SHIM().

543 {
544  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
545  // handle validation in the same way as other dialogs.
546  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
547  return;
548 
549  SetReturnCode( retCode );
550 
551  if( !IsQuasiModal() )
552  {
553  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
554  return;
555  }
556 
557  m_qmodal_showing = false;
558 
559  if( m_qmodal_loop )
560  {
561  if( m_qmodal_loop->IsRunning() )
562  m_qmodal_loop->Exit( 0 );
563  else
564  m_qmodal_loop->ScheduleExit( 0 );
565 
566  m_qmodal_loop = NULL;
567  }
568 
571 
572  Show( false );
573 }
bool m_qmodal_showing
Definition: dialog_shim.h:132
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:131
bool IsQuasiModal()
Definition: dialog_shim.h:93
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:133
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 104 of file dialog_shim.cpp.

References PCAD2KICAD::Center.

Referenced by COLOR4D_PICKER_DLG::COLOR4D_PICKER_DLG(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES(), DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG(), 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_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS(), DIALOG_PAD_PROPERTIES(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_PRETTY_LIB::DIALOG_SELECT_PRETTY_LIB(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_EDIT_ONE_FIELD::init(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_LIB_EDIT_PIN::OnInitDialog(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog(), DIALOG_TRACK_VIA_PROPERTIES::OnInitDlg(), DIALOG_GRAPHIC_ITEMS_OPTIONS::OnInitDlg(), DialogEditModuleText::OnInitDlg(), DIALOG_SET_GRID::OnInitDlg(), DIALOG_PCB_TEXT_PROPERTIES::OnInitDlg(), DIALOG_PRINT_FOR_MODEDIT::OnInitDlg(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_MODULE_MODULE_EDITOR::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_MODULE_BOARD_EDITOR::OnInitDlg(), DIALOG_PRINT_USING_PRINTER::OnInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(), and DIALOG_SIGNAL_LIST::TransferDataToWindow().

105 {
106  // must be called from the constructor of derived classes,
107  // when all widgets are initialized, and therefore their size fixed
108 
109  // SetSizeHints fixes the minimal size of sizers in the dialog
110  // (SetSizeHints calls Fit(), so no need to call it)
111  GetSizer()->SetSizeHints( this );
112 
113  // the default position, when calling the first time the dlg
114  Center();
115 }
void DIALOG_SHIM::FixOSXCancelButtonIssue ( )
protectedinherited

A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms.

Definition at line 117 of file dialog_shim.cpp.

Referenced by DIALOG_SHIM::Show().

118 {
119 #ifdef __WXMAC__
120  // A ugly hack to fix an issue on OSX: ctrl+c closes the dialog instead of
121  // copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer
122  // created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority
123  // to copy text standard accelerator, and the dlg is closed when trying to copy text
124  wxButton* button = dynamic_cast< wxButton* > ( wxWindow::FindWindowById( wxID_CANCEL, this ) );
125 
126  if( button )
127  button->SetLabel( _( "Cancel" ) );
128 #endif
129 }
void DIALOG_PAD_PROPERTIES::initValues ( )
private

Definition at line 431 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, code_type, CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL, DIM, displayPrimitivesList(), Dwgs_User, Eco1_User, Eco2_User, enablePrimitivePage(), F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, FlipLayerMask(), D_PAD::FlipPrimitives(), FRAME_PCB, g_UserUnit, GetAbbreviatedUnitsLabel(), 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::GetNetname(), D_PAD::GetOffset(), MODULE::GetOrientation(), D_PAD::GetOrientation(), MODULE::GetOrientationDegrees(), D_PAD::GetPadToDieLength(), D_PAD::GetParent(), D_PAD::GetPosition(), D_PAD::GetPrimitives(), D_PAD::GetShape(), D_PAD::GetSize(), D_PAD::GetThermalGap(), D_PAD::GetThermalWidth(), D_PAD::GetZoneConnection(), D_PAD::IsFlipped(), EDA_BASE_FRAME::IsType(), m_board, m_canEditNetName, m_currentPad, DIALOG_PAD_PROPERTIES_BASE::m_DrillShapeCtrl, m_dummyPad, m_isFlipped, DIALOG_PAD_PROPERTIES_BASE::m_LengthPadToDieCtrl, DIALOG_PAD_PROPERTIES_BASE::m_NetClearanceUnits, DIALOG_PAD_PROPERTIES_BASE::m_NetClearanceValueCtrl, m_OrientValue, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_X_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_Y_Unit, 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_PadLengthDie_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadNetNameCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadOrient, DIALOG_PAD_PROPERTIES_BASE::m_PadPosition_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadPosition_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadPosX_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadPosY_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadShape, DIALOG_PAD_PROPERTIES_BASE::m_PadShapeDelta_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadShapeOffsetX_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadShapeOffsetY_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadShapeSizeX_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadShapeSizeY_Unit, DIALOG_PAD_PROPERTIES_BASE::m_PadType, m_parent, m_primitives, DIALOG_PAD_PROPERTIES_BASE::m_rbCopperLayersSel, DIALOG_PAD_PROPERTIES_BASE::m_ShapeDelta_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeSize_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeSize_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderMaskMarginCtrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderMaskMarginUnits, DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginCtrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginRatioCtrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginUnits, DIALOG_PAD_PROPERTIES_BASE::m_staticModuleRotValue, DIALOG_PAD_PROPERTIES_BASE::m_staticModuleSideValue, DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerSizeUnit, DIALOG_PAD_PROPERTIES_BASE::m_staticTextWarningPadFlipped, DIALOG_PAD_PROPERTIES_BASE::m_ThermalGapCtrl, DIALOG_PAD_PROPERTIES_BASE::m_ThermalGapUnits, DIALOG_PAD_PROPERTIES_BASE::m_ThermalWidthCtrl, DIALOG_PAD_PROPERTIES_BASE::m_ThermalWidthUnits, DIALOG_PAD_PROPERTIES_BASE::m_trapDeltaDirChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneConnectionChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneCustomPadShape, NORMALIZE_ANGLE_180(), OnDrillShapeSelected(), OnPadShapeSelection(), PAD_ATTRIB_HOLE_NOT_PLATED, 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, PutValueInLocalUnits(), D_PAD::SetDelta(), D_PAD::SetLayerSet(), D_PAD::SetOffset(), D_PAD::SetOrientation(), setPadLayersList(), updateRoundRectCornerValues(), wxPoint::x, and wxPoint::y.

Referenced by DIALOG_PAD_PROPERTIES().

432 {
433  wxString msg;
434  double angle;
435 
436  // Disable pad net name wxTextCtrl if the caller is the footprint editor
437  // because nets are living only in the board managed by the board editor
439 
440 
441  // Setup layers names from board
442  // Should be made first, before calling m_rbCopperLayersSel->SetSelection()
443  m_rbCopperLayersSel->SetString( 0, m_board->GetLayerName( F_Cu ) );
444  m_rbCopperLayersSel->SetString( 1, m_board->GetLayerName( B_Cu ) );
445 
446  m_PadLayerAdhCmp->SetLabel( m_board->GetLayerName( F_Adhes ) );
447  m_PadLayerAdhCu->SetLabel( m_board->GetLayerName( B_Adhes ) );
449  m_PadLayerPateCu->SetLabel( m_board->GetLayerName( B_Paste ) );
451  m_PadLayerSilkCu->SetLabel( m_board->GetLayerName( B_SilkS ) );
452  m_PadLayerMaskCmp->SetLabel( m_board->GetLayerName( F_Mask ) );
453  m_PadLayerMaskCu->SetLabel( m_board->GetLayerName( B_Mask ) );
454  m_PadLayerECO1->SetLabel( m_board->GetLayerName( Eco1_User ) );
455  m_PadLayerECO2->SetLabel( m_board->GetLayerName( Eco2_User ) );
457 
458  m_isFlipped = false;
459 
460  if( m_currentPad )
461  {
463 
464  if( m_isFlipped )
465  m_staticModuleSideValue->SetLabel( _( "Back side (footprint is mirrored)" ) );
466 
467  // Diplay footprint rotation ( angles are in 0.1 degree )
468  MODULE* footprint = m_currentPad->GetParent();
469 
470  if( footprint )
471  msg.Printf( "%.1f", footprint->GetOrientationDegrees() );
472  else
473  msg = _("No footprint" );
474 
475  m_staticModuleRotValue->SetLabel( msg );
476  }
477 
478  if( m_isFlipped )
479  {
480  wxPoint pt = m_dummyPad->GetOffset();
481  pt.y = -pt.y;
482  m_dummyPad->SetOffset( pt );
483 
484  wxSize sz = m_dummyPad->GetDelta();
485  sz.y = -sz.y;
486  m_dummyPad->SetDelta( sz );
487 
488  // flip pad's layers
490 
491  // flip custom pad shapes
493  }
494 
496 
498 
499  m_PadNumCtrl->SetValue( m_dummyPad->GetName() );
500  m_PadNetNameCtrl->SetValue( m_dummyPad->GetNetname() );
501 
502  // Set the unit name in dialog:
503  wxStaticText* unitTexts[] =
504  {
512  };
513 
514  for( unsigned ii = 0; ii < DIM( unitTexts ); ++ii )
515  unitTexts[ii]->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
516 
517  // Display current pad parameters units:
520 
523 
526 
529 
530  if( m_dummyPad->GetDelta().x )
531  {
533  m_trapDeltaDirChoice->SetSelection( 0 );
534  }
535  else
536  {
538  m_trapDeltaDirChoice->SetSelection( 1 );
539  }
540 
542 
547 
548  // These 2 parameters are usually < 0, so prepare entering a negative value, if current is 0
550 
552  m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->GetValue() );
553 
554  msg.Printf( wxT( "%f" ), m_dummyPad->GetLocalSolderPasteMarginRatio() * 100.0 );
555 
556  if( m_dummyPad->GetLocalSolderPasteMarginRatio() == 0.0 && msg[0] == '0' )
557  // Sometimes Printf adds a sign if the value is small
558  m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
559  else
560  m_SolderPasteMarginRatioCtrl->SetValue( msg );
561 
562  switch( m_dummyPad->GetZoneConnection() )
563  {
564  default:
566  m_ZoneConnectionChoice->SetSelection( 0 );
567  break;
568 
569  case PAD_ZONE_CONN_FULL:
570  m_ZoneConnectionChoice->SetSelection( 1 );
571  break;
572 
574  m_ZoneConnectionChoice->SetSelection( 2 );
575  break;
576 
577  case PAD_ZONE_CONN_NONE:
578  m_ZoneConnectionChoice->SetSelection( 3 );
579  break;
580  }
581 
583  m_ZoneCustomPadShape->SetSelection( 1 );
584  else
585  m_ZoneCustomPadShape->SetSelection( 0 );
586 
587  if( m_currentPad )
588  {
589  angle = m_currentPad->GetOrientation();
590  MODULE* footprint = m_currentPad->GetParent();
591 
592  if( footprint )
593  angle -= footprint->GetOrientation();
594 
595  if( m_isFlipped )
596  angle = -angle;
597 
598  m_dummyPad->SetOrientation( angle );
599  }
600 
601  angle = m_dummyPad->GetOrientation();
602 
603  NORMALIZE_ANGLE_180( angle ); // ? normalizing is in D_PAD::SetOrientation()
604 
605  // Set layers used by this pad: :
607 
608  // Pad Orient
609  switch( int( angle ) )
610  {
611  case 0:
612  m_PadOrient->SetSelection( 0 );
613  break;
614 
615  case 900:
616  m_PadOrient->SetSelection( 1 );
617  break;
618 
619  case -900:
620  m_PadOrient->SetSelection( 2 );
621  break;
622 
623  case 1800:
624  case -1800:
625  m_PadOrient->SetSelection( 3 );
626  break;
627 
628  default:
629  m_PadOrient->SetSelection( 4 );
630  break;
631  }
632 
633  switch( m_dummyPad->GetShape() )
634  {
635  default:
636  case PAD_SHAPE_CIRCLE:
637  m_PadShape->SetSelection( CHOICE_SHAPE_CIRCLE );
638  break;
639 
640  case PAD_SHAPE_OVAL:
641  m_PadShape->SetSelection( CHOICE_SHAPE_OVAL );
642  break;
643 
644  case PAD_SHAPE_RECT:
645  m_PadShape->SetSelection( CHOICE_SHAPE_RECT );
646  break;
647 
648  case PAD_SHAPE_TRAPEZOID:
649  m_PadShape->SetSelection( CHOICE_SHAPE_TRAPEZOID );
650  break;
651 
652  case PAD_SHAPE_ROUNDRECT:
653  m_PadShape->SetSelection( CHOICE_SHAPE_ROUNDRECT );
654  break;
655 
656  case PAD_SHAPE_CUSTOM:
659  else
661  break;
662  }
663 
665 
666  m_OrientValue = angle / 10.0;
667 
668  // Type of pad selection
669  m_PadType->SetSelection( 0 );
670 
671  for( unsigned ii = 0; ii < DIM( code_type ); ii++ )
672  {
673  if( code_type[ii] == m_dummyPad->GetAttribute() )
674  {
675  m_PadType->SetSelection( ii );
676  break;
677  }
678  }
679 
680  // Enable/disable Pad name,and pad length die
681  // (disable for NPTH pads (mechanical pads)
683 
684  m_PadNumCtrl->Enable( enable );
685  m_PadNetNameCtrl->Enable( m_canEditNetName && enable && m_currentPad != NULL );
686  m_LengthPadToDieCtrl->Enable( enable );
687 
689  m_DrillShapeCtrl->SetSelection( 0 );
690  else
691  m_DrillShapeCtrl->SetSelection( 1 );
692 
693  // Update some dialog widgets state (Enable/disable options):
694  wxCommandEvent cmd_event;
696  OnDrillShapeSelected( cmd_event );
697  OnPadShapeSelection( cmd_event );
699 
700  // Update basic shapes list
702 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
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:491
const std::vector< PAD_CS_PRIMITIVE > & GetPrimitives() const
Accessor to the basic shape list.
Definition: class_pad.h:336
void enablePrimitivePage(bool aEnable)
enable (or disable) the primitive page editor
void FlipPrimitives()
Flip the basic shapes, in custom pads.
Definition: class_pad.cpp:434
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:398
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
int GetPadToDieLength() const
Definition: class_pad.h:401
void setPadLayersList(LSET layer_mask)
Function setPadLayersList updates the CheckBox states in pad layers list,.
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:403
MODULE * GetParent() const
Definition: class_pad.h:162
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:381
void NORMALIZE_ANGLE_180(T &Angle)
Definition: trigo.h:314
const wxSize & GetDrillSize() const
Definition: class_pad.h:275
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
Pads are not covered.
Definition: zones.h:57
static PAD_ATTR_T code_type[]
double GetOrientationDegrees() const
Definition: class_module.h:181
double GetOrientation() const
Definition: class_module.h:180
const wxPoint & GetPosition() const override
Definition: class_pad.h:220
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:484
ZoneConnection GetZoneConnection() const
Definition: class_pad.cpp:650
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:395
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:661
void OnPadShapeSelection(wxCommandEvent &event) override
int GetThermalGap() const
Definition: class_pad.cpp:672
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:409
bool IsFlipped() const
Definition: class_pad.cpp:126
int GetLocalClearance() const
Definition: class_pad.h:406
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:412
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void PutValueInLocalUnits(wxTextCtrl &aTextCtr, int aValue)
Function PutValueInLocalUnits converts aValue from internal units to user units and append the units ...
Definition: base_units.cpp:266
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:394
std::vector< PAD_CS_PRIMITIVE > m_primitives
const wxString & GetNetname() const
Function GetNetname.
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: class_pad.h:232
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:375
const wxSize & GetDelta() const
Definition: class_pad.h:272
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:401
bool IsType(FRAME_T aType) const
Definition: wxstruct.h:229
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:277
Use thermal relief for pads.
Definition: zones.h:58
const wxPoint & GetOffset() const
Definition: class_pad.h:278
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:271
pads are covered by copper
Definition: zones.h:59
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::m_kiway.

Referenced by SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_SHIM::DIALOG_SHIM(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), SCH_EDIT_FRAME::ImportFile(), PCB_EDIT_FRAME::ImportFile(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), PCB_EDIT_FRAME::InstallModuleOptionsFrame(), KIWAY_PLAYER::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard(), 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(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::rescueProject(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_EDIT_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_MODULE::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:85
void DIALOG_PAD_PROPERTIES::onAddPrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1827 of file dialog_pad_properties.cpp.

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

1828 {
1829  // Ask user for shape type
1830  wxString shapelist[] =
1831  {
1832  _( "Segment" ), _( "Arc" ), _( "ring/circle" ), _( "polygon" )
1833  };
1834 
1835  int type = wxGetSingleChoiceIndex( wxEmptyString, _( "Select shape type:" ),
1836  DIM( shapelist ), shapelist, 0 );
1837 
1838  STROKE_T listtype[] =
1839  {
1841  };
1842 
1843  PAD_CS_PRIMITIVE primitive( listtype[type] );
1844 
1845  if( listtype[type] == S_POLYGON )
1846  {
1847  DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, &primitive );
1848 
1849  if( dlg.ShowModal() != wxID_OK )
1850  return;
1851  }
1852  else
1853  {
1854  DIALOG_PAD_PRIMITIVES_PROPERTIES dlg( this, &primitive );
1855 
1856  if( dlg.ShowModal() != wxID_OK )
1857  return;
1858  }
1859 
1860  m_primitives.push_back( primitive );
1861 
1863 
1864  if( m_canUpdate )
1865  {
1867  redraw();
1868  }
1869 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
polygon (not yet used for tracks, but could be in microwave apps)
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
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 156 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().

157 {
158  // Mandatory to avoid m_panelShowPadGal trying to draw something
159  // in a non valid context during closing process:
160  if( m_parent->IsGalCanvasActive() )
162 
163  // Now call default handler for wxID_CANCEL command event
164  event.Skip();
165 }
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:856
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...
void DIALOG_PAD_PROPERTIES::onCornerSizePercentChange ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 400 of file dialog_pad_properties.cpp.

References g_UserUnit, D_PAD::GetRoundRectCornerRadius(), D_PAD::GetShape(), m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerRadiusValue, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, PAD_SHAPE_ROUNDRECT, redraw(), StringFromValue(), and transferDataToPad().

401 {
403  return;
404 
405  wxString value = m_tcCornerSizeRatio->GetValue();
406  double rrRadiusRatioPercent;
407 
408  if( value.ToDouble( &rrRadiusRatioPercent ) )
409  {
410  // Clamp rrRadiusRatioPercent to acceptable value (0.0 to 50.0)
411  if( rrRadiusRatioPercent < 0.0 )
412  {
413  rrRadiusRatioPercent = 0.0;
414  m_tcCornerSizeRatio->ChangeValue( "0.0" );
415  }
416 
417  if( rrRadiusRatioPercent > 50.0 )
418  {
419  rrRadiusRatioPercent = 0.5;
420  m_tcCornerSizeRatio->ChangeValue( "50.0" );
421  }
422 
426  redraw();
427  }
428 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:204
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:511
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void DIALOG_PAD_PROPERTIES::onDeletePrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Event handlers of basic shapes list panel.

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1799 of file dialog_pad_properties.cpp.

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

1800 {
1801  long select = m_listCtrlPrimitives->GetFirstSelected();
1802 
1803  if( select < 0 )
1804  return;
1805 
1806  // Multiple selections are allowed. get them and remove corresponding shapes
1807  std::vector<long> indexes;
1808  indexes.push_back( select );
1809 
1810  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
1811  indexes.push_back( select );
1812 
1813  // Erase all select shapes
1814  for( unsigned ii = indexes.size(); ii > 0; --ii )
1815  m_primitives.erase( m_primitives.begin() + indexes[ii-1] );
1816 
1818 
1819  if( m_canUpdate )
1820  {
1822  redraw();
1823  }
1824 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad'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 872 of file dialog_pad_properties.cpp.

References DIALOG_PAD_PROPERTIES_BASE::m_DrillShapeCtrl, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadType, redraw(), and transferDataToPad().

Referenced by initValues(), and PadTypeSelected().

873 {
874  if( m_PadType->GetSelection() == 1 || m_PadType->GetSelection() == 2 )
875  {
876  // pad type = SMD or CONN: no hole allowed
877  m_PadDrill_X_Ctrl->Enable( false );
878  m_PadDrill_Y_Ctrl->Enable( false );
879  }
880  else
881  {
882  switch( m_DrillShapeCtrl->GetSelection() )
883  {
884  case 0: //CIRCLE:
885  m_PadDrill_X_Ctrl->Enable( true );
886  m_PadDrill_Y_Ctrl->Enable( false );
887  break;
888 
889  case 1: //OVALE:
890  m_PadDrill_X_Ctrl->Enable( true );
891  m_PadDrill_Y_Ctrl->Enable( true );
892  break;
893  }
894  }
895 
897  redraw();
898 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
void DIALOG_PAD_PROPERTIES::onDuplicatePrimitive ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1919 of file dialog_pad_properties.cpp.

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

1920 {
1921  long select = m_listCtrlPrimitives->GetFirstSelected();
1922 
1923  if( select < 0 )
1924  {
1925  wxMessageBox( _( "No shape selected" ) );
1926  return;
1927  }
1928 
1929  // Multiple selections are allowed. Build selected shapes list
1930  std::vector<long> indexes;
1931  indexes.push_back( select );
1932 
1933  std::vector<PAD_CS_PRIMITIVE*> shapeList;
1934  shapeList.push_back( &m_primitives[select] );
1935 
1936  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
1937  {
1938  indexes.push_back( select );
1939  shapeList.push_back( &m_primitives[select] );
1940  }
1941 
1942  DIALOG_PAD_PRIMITIVES_TRANSFORM dlg( this, shapeList, true );
1943 
1944  if( dlg.ShowModal() != wxID_OK )
1945  return;
1946 
1947  // Transfert new settings:
1948  dlg.Transform( &m_primitives, dlg.GetDuplicateCount() );
1949 
1951 
1952  if( m_canUpdate )
1953  {
1955  redraw();
1956  }
1957 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad'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 1793 of file dialog_pad_properties.cpp.

References editPrimitive().

1794 {
1795  editPrimitive();
1796 }
void DIALOG_PAD_PROPERTIES::onGeometryTransform ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1878 of file dialog_pad_properties.cpp.

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

1879 {
1880  long select = m_listCtrlPrimitives->GetFirstSelected();
1881 
1882  if( select < 0 )
1883  {
1884  wxMessageBox( _( "No shape selected" ) );
1885  return;
1886  }
1887 
1888  // Multiple selections are allowed. Build selected shapes list
1889  std::vector<long> indexes;
1890  indexes.push_back( select );
1891 
1892  std::vector<PAD_CS_PRIMITIVE*> shapeList;
1893  shapeList.push_back( &m_primitives[select] );
1894 
1895  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
1896  {
1897  indexes.push_back( select );
1898  shapeList.push_back( &m_primitives[select] );
1899  }
1900 
1901  DIALOG_PAD_PRIMITIVES_TRANSFORM dlg( this, shapeList, false );
1902 
1903  if( dlg.ShowModal() != wxID_OK )
1904  return;
1905 
1906  // Transfert new settings:
1907  dlg.Transform();
1908 
1910 
1911  if( m_canUpdate )
1912  {
1914  redraw();
1915  }
1916 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad'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::onImportPrimitives ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 1872 of file dialog_pad_properties.cpp.

1873 {
1874  wxMessageBox( "Not yet available" );
1875 }
void DIALOG_PAD_PROPERTIES::OnInitDialog ( wxInitDialogEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 149 of file dialog_pad_properties.cpp.

References DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl.

150 {
151  m_PadNumCtrl->SetFocus();
152  m_PadNumCtrl->SetSelection( -1, -1 );
153 }
void DIALOG_PAD_PROPERTIES::OnPadShapeSelection ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 791 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, enablePrimitivePage(), Format(), D_PAD::GetRoundRectRadiusRatio(), m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_PadShape, DIALOG_PAD_PROPERTIES_BASE::m_ShapeDelta_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeSize_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, DIALOG_PAD_PROPERTIES_BASE::m_ThermalGapCtrl, DIALOG_PAD_PROPERTIES_BASE::m_ThermalWidthCtrl, DIALOG_PAD_PROPERTIES_BASE::m_trapDeltaDirChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneConnectionChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneCustomPadShape, redraw(), transferDataToPad(), and updateRoundRectCornerValues().

Referenced by initValues().

792 {
793  bool is_custom = false;
794 
795  switch( m_PadShape->GetSelection() )
796  {
797  case CHOICE_SHAPE_CIRCLE:
798  m_ShapeDelta_Ctrl->Enable( false );
799  m_trapDeltaDirChoice->Enable( false );
800  m_ShapeSize_Y_Ctrl->Enable( false );
801  m_ShapeOffset_X_Ctrl->Enable( false );
802  m_ShapeOffset_Y_Ctrl->Enable( false );
803  break;
804 
805  case CHOICE_SHAPE_OVAL:
806  m_ShapeDelta_Ctrl->Enable( false );
807  m_trapDeltaDirChoice->Enable( false );
808  m_ShapeSize_Y_Ctrl->Enable( true );
809  m_ShapeOffset_X_Ctrl->Enable( true );
810  m_ShapeOffset_Y_Ctrl->Enable( true );
811  break;
812 
813  case CHOICE_SHAPE_RECT:
814  m_ShapeDelta_Ctrl->Enable( false );
815  m_trapDeltaDirChoice->Enable( false );
816  m_ShapeSize_Y_Ctrl->Enable( true );
817  m_ShapeOffset_X_Ctrl->Enable( true );
818  m_ShapeOffset_Y_Ctrl->Enable( true );
819  break;
820 
822  m_ShapeDelta_Ctrl->Enable( true );
823  m_trapDeltaDirChoice->Enable( true );
824  m_ShapeSize_Y_Ctrl->Enable( true );
825  m_ShapeOffset_X_Ctrl->Enable( true );
826  m_ShapeOffset_Y_Ctrl->Enable( true );
827  break;
828 
830  m_ShapeDelta_Ctrl->Enable( false );
831  m_trapDeltaDirChoice->Enable( false );
832  m_ShapeSize_Y_Ctrl->Enable( true );
833  m_ShapeOffset_X_Ctrl->Enable( true );
834  m_ShapeOffset_Y_Ctrl->Enable( true );
835  // Ensure m_tcCornerSizeRatio contains the right value:
836  m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f",
838  break;
839 
840  case CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR: // PAD_SHAPE_CUSTOM, circular anchor
841  case CHOICE_SHAPE_CUSTOM_RECT_ANCHOR: // PAD_SHAPE_CUSTOM, rect anchor
842  is_custom = true;
843  m_ShapeDelta_Ctrl->Enable( false );
844  m_trapDeltaDirChoice->Enable( false );
845  m_ShapeSize_Y_Ctrl->Enable(
846  m_PadShape->GetSelection() == CHOICE_SHAPE_CUSTOM_RECT_ANCHOR );
847  m_ShapeOffset_X_Ctrl->Enable( false );
848  m_ShapeOffset_Y_Ctrl->Enable( false );
849  break;
850  }
851 
852  enablePrimitivePage( is_custom );
853 
854  // A few widgets are enabled only for rounded rect pads:
855  m_tcCornerSizeRatio->Enable( m_PadShape->GetSelection() == CHOICE_SHAPE_ROUNDRECT );
856 
857  // PAD_SHAPE_CUSTOM type has constraints for zone connection and thermal shape:
858  // only not connected is allowed to avoid destroying the shape.
859  // Enable/disable options
860  m_ZoneConnectionChoice->Enable( !is_custom );
861  m_ThermalWidthCtrl->Enable( !is_custom );
862  m_ThermalGapCtrl->Enable( !is_custom );
863  m_ZoneCustomPadShape->Enable( is_custom );
864 
866 
868  redraw();
869 }
void enablePrimitivePage(bool aEnable)
enable (or disable) the primitive page editor
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:608
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::OnPaintShowPanel ( wxPaintEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 220 of file dialog_pad_properties.cpp.

References abs, B_Cu, BLACK, color, PCB_GENERAL_SETTINGS::Colors(), CYAN, 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(), DRAWSEGMENT::GetPolyPoints(), D_PAD::GetPosition(), D_PAD::GetShape(), D_PAD::GetSize(), DRAWSEGMENT::GetStart(), GRArc1(), GRCircle(), GRClosedPoly(), 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, PAD_CS_PRIMITIVE::m_Shape, PAD_DRAWINFO::m_ShowNotPlatedHole, 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().

221 {
222  wxPaintDC dc( m_panelShowPad );
223  PAD_DRAWINFO drawInfo;
224 
226 
227  if( m_dummyPad->GetLayerSet()[F_Cu] )
228  {
230  }
231 
232  if( m_dummyPad->GetLayerSet()[B_Cu] )
233  {
234  color = color.LegacyMix( m_parent->Settings().Colors().GetItemColor( LAYER_PAD_BK ) );
235  }
236 
237  // What could happen: the pad color is *actually* black, or no
238  // copper was selected
239  if( color == BLACK )
240  color = LIGHTGRAY;
241 
242  drawInfo.m_Color = color;
243  drawInfo.m_HoleColor = DARKGRAY;
244  drawInfo.m_Offset = m_dummyPad->GetPosition();
245  drawInfo.m_Display_padnum = true;
246  drawInfo.m_Display_netname = true;
247 
249  drawInfo.m_ShowNotPlatedHole = true;
250 
251  // Shows the local pad clearance
253 
254  wxSize dc_size = dc.GetSize();
255  dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
256 
257  // Calculate a suitable scale to fit the available draw area
258  int dim = m_dummyPad->GetBoundingRadius() *2;
259 
260  // Invalid x size. User could enter zero, or have deleted all text prior to
261  // entering a new value; this is also treated as zero. If dim is left at
262  // zero, the drawing scale is zero and we get a crash.
263  if( dim == 0 )
264  {
265  // If drill size has been set, use that. Otherwise default to 1mm.
266  dim = m_dummyPad->GetDrillSize().x;
267  if( dim == 0 )
268  dim = Millimeter2iu( 1.0 );
269  }
270 
271  if( m_dummyPad->GetLocalClearance() > 0 )
272  dim += m_dummyPad->GetLocalClearance() * 2;
273 
274  double scale = (double) dc_size.x / dim;
275 
276  // If the pad is a circle, use the x size here instead.
277  int ysize;
278 
280  ysize = m_dummyPad->GetSize().x;
281  else
282  ysize = m_dummyPad->GetSize().y;
283 
284  dim = ysize + std::abs( m_dummyPad->GetDelta().x );
285 
286  // Invalid y size. See note about x size above.
287  if( dim == 0 )
288  {
289  dim = m_dummyPad->GetDrillSize().y;
290  if( dim == 0 )
291  dim = Millimeter2iu( 0.1 );
292  }
293 
294  if( m_dummyPad->GetLocalClearance() > 0 )
295  dim += m_dummyPad->GetLocalClearance() * 2;
296 
297  double altscale = (double) dc_size.y / dim;
298  scale = std::min( scale, altscale );
299 
300  // Give a margin
301  scale *= 0.7;
302  dc.SetUserScale( scale, scale );
303 
304  GRResetPenAndBrush( &dc );
305  m_dummyPad->DrawShape( NULL, &dc, drawInfo );
306 
307  // draw selected primitives:
308  COLOR4D hcolor = CYAN;
309  long select = m_listCtrlPrimitives->GetFirstSelected();
310  wxPoint start, end, center;
311 
312  while( select >= 0 )
313  {
314  PAD_CS_PRIMITIVE& primitive = m_primitives[select];
315 
316  // The best way to calculate parameters to draw a primitive is to
317  // use a dummy DRAWSEGMENT and use its methods
318  // Note: in legacy canvas, the pad has the 0,0 position
319  DRAWSEGMENT dummySegment;
320  primitive.ExportTo( &dummySegment );
321  dummySegment.Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() );
322 
323  switch( primitive.m_Shape )
324  {
325  case S_SEGMENT: // usual segment : line with rounded ends
326  GRFilledSegment( NULL, &dc, dummySegment.GetStart(), dummySegment.GetEnd(),
327  primitive.m_Thickness, hcolor );
328  break;
329 
330  case S_ARC: // Arc with rounded ends
331  GRArc1( NULL, &dc, dummySegment.GetArcEnd(), dummySegment.GetArcStart(),
332  dummySegment.GetCenter(), primitive.m_Thickness, hcolor );
333  break;
334 
335  case S_CIRCLE: // ring or circle
336  if( primitive.m_Thickness )
337  {
338  GRCircle( NULL, &dc, dummySegment.GetCenter(), primitive.m_Radius,
339  primitive.m_Thickness, hcolor );
340  }
341  else
342  {
343  GRFilledCircle( NULL, &dc, dummySegment.GetCenter(),
344  primitive.m_Radius, hcolor );
345  }
346  break;
347 
348  case S_POLYGON: // polygon
349  {
350  std::vector<wxPoint> poly = dummySegment.GetPolyPoints();
351  GRClosedPoly( NULL, &dc, poly.size(), &poly[0], /* filled */ true,
352  primitive.m_Thickness, hcolor, hcolor );
353  }
354  break;
355 
356  default:
357  break;
358  }
359 
360  select = m_listCtrlPrimitives->GetNextSelected( select );
361  }
362 
363  // Draw X and Y axis. This is particularly useful to show the
364  // reference position of pads with offset and no hole, or custom pad shapes
365  const int linethickness = 0;
366  GRLine( NULL, &dc, -int( dc_size.x/scale ), 0, int( dc_size.x/scale ), 0,
367  linethickness, LIGHTBLUE ); // X axis
368  GRLine( NULL, &dc, 0, -int( dc_size.y/scale ), 0, int( dc_size.y/scale ),
369  linethickness, LIGHTBLUE ); // Y axis
370 
371  event.Skip();
372 }
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:196
bool m_Display_padnum
Definition: class_pad.h:75
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:398
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...
polygon (not yet used for tracks, but could be in microwave apps)
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:851
const std::vector< wxPoint > GetPolyPoints() const
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:784
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:586
PCB_GENERAL_SETTINGS & Settings()
const wxPoint & GetPosition() const override
Definition: class_pad.h:220
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:395
Definition: colors.h:59
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:358
STROKE_T m_Shape
Definition: class_pad.h:94
int m_PadClearance
Definition: class_pad.h:73
int GetLocalClearance() const
Definition: class_pad.h:406
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:599
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:828
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:375
const wxSize & GetDelta() const
Definition: class_pad.h:272
COLOR4D m_Color
Definition: class_pad.h:68
Definition: colors.h:45
bool m_Display_netname
Definition: class_pad.h:76
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:872
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 1786 of file dialog_pad_properties.cpp.

References editPrimitive().

1787 {
1788  editPrimitive();
1789 }
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 1777 of file dialog_pad_properties.cpp.

References redraw().

1778 {
1779  // Called on a double click on the basic shapes list
1780  // To Do: highligth the primitive(s) currently selected.
1781  redraw();
1782 }
void DIALOG_PAD_PROPERTIES::OnResize ( wxSizeEvent &  event)
private

Definition at line 784 of file dialog_pad_properties.cpp.

References redraw().

Referenced by prepareCanvas().

785 {
786  redraw();
787  event.Skip();
788 }
void DIALOG_PAD_PROPERTIES::OnSetLayers ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 994 of file dialog_pad_properties.cpp.

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

995 {
997  redraw();
998 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
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 1722 of file dialog_pad_properties.cpp.

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

1723 {
1724  if( m_canUpdate )
1725  {
1727  // If the pad size has changed, update the displayed values
1728  // for rounded rect pads
1730 
1731  redraw();
1732  }
1733 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
void DIALOG_PAD_PROPERTIES::PadOrientEvent ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 901 of file dialog_pad_properties.cpp.

References D_PAD::GetOrientation(), m_dummyPad, m_OrientValidator, m_OrientValue, DIALOG_PAD_PROPERTIES_BASE::m_PadOrient, redraw(), D_PAD::SetOrientation(), and transferDataToPad().

902 {
903  switch( m_PadOrient->GetSelection() )
904  {
905  case 0:
907  break;
908 
909  case 1:
910  m_dummyPad->SetOrientation( 900 );
911  break;
912 
913  case 2:
914  m_dummyPad->SetOrientation( -900 );
915  break;
916 
917  case 3:
918  m_dummyPad->SetOrientation( 1800 );
919  break;
920 
921  default:
922  break;
923  }
924 
926  m_OrientValidator.TransferToWindow();
927 
929  redraw();
930 }
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
wxFloatingPointValidator< double > m_OrientValidator
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:375
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:401
void DIALOG_PAD_PROPERTIES::PadTypeSelected ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PAD_PROPERTIES_BASE.

Definition at line 933 of file dialog_pad_properties.cpp.

References code_type, DIM, m_canEditNetName, m_currentPad, DIALOG_PAD_PROPERTIES_BASE::m_DrillShapeCtrl, DIALOG_PAD_PROPERTIES_BASE::m_LengthPadToDieCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadNetNameCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadType, OnDrillShapeSelected(), and setPadLayersList().

934 {
935  unsigned ii = m_PadType->GetSelection();
936 
937  if( ii >= DIM( code_type ) ) // catches < 0 also
938  ii = 0;
939 
940  LSET layer_mask = std_pad_layers[ii];
941  setPadLayersList( layer_mask );
942 
943  // Enable/disable drill dialog items:
944  event.SetId( m_DrillShapeCtrl->GetSelection() );
945  OnDrillShapeSelected( event );
946 
947  if( ii == 0 || ii == DIM( code_type )-1 )
948  m_DrillShapeCtrl->Enable( true );
949  else
950  m_DrillShapeCtrl->Enable( false );
951 
952  // Enable/disable Pad name,and pad length die
953  // (disable for NPTH pads (mechanical pads)
954  bool enable = ii != 3;
955  m_PadNumCtrl->Enable( enable );
956  m_PadNetNameCtrl->Enable( m_canEditNetName && enable && m_currentPad != NULL );
957  m_LengthPadToDieCtrl->Enable( enable );
958 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
void setPadLayersList(LSET layer_mask)
Function setPadLayersList updates the CheckBox states in pad layers list,.
static PAD_ATTR_T code_type[]
Class LSET is a set of PCB_LAYER_IDs.
void OnDrillShapeSelected(wxCommandEvent &event) override
static const LSET std_pad_layers[]
bool DIALOG_PAD_PROPERTIES::padValuesOK ( )
private

test if all values are acceptable for the pad

Definition at line 1002 of file dialog_pad_properties.cpp.

References abs, B_Cu, B_Paste, F_Cu, F_Paste, D_PAD::GetAttribute(), D_PAD::GetDrillSize(), D_PAD::GetLayerSet(), D_PAD::GetLocalClearance(), D_PAD::GetLocalSolderMaskMargin(), D_PAD::GetLocalSolderPasteMargin(), D_PAD::GetOffset(), D_PAD::GetShape(), D_PAD::GetSize(), LSET::InternalCuMask(), HTML_MESSAGE_BOX::ListSet(), m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, D_PAD::MergePrimitivesAsPolygon(), PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED, PAD_ATTRIB_SMD, PAD_ATTRIB_STANDARD, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_ROUNDRECT, transferDataToPad(), wxPoint::x, and wxPoint::y.

Referenced by TransferDataFromWindow().

1003 {
1004  bool error = transferDataToPad( m_dummyPad );
1005  bool skip_tstoffset = false; // the offset prm is not always tested
1006 
1007  wxArrayString error_msgs;
1008  wxString msg;
1009 
1010  // Test for incorrect values
1011  if( (m_dummyPad->GetSize().x <= 0) ||
1012  ((m_dummyPad->GetSize().y <= 0) && (m_dummyPad->GetShape() != PAD_SHAPE_CIRCLE)) )
1013  {
1014  error_msgs.Add( _( "Pad size must be greater than zero" ) );
1015  }
1016 
1017  if( (m_dummyPad->GetSize().x < m_dummyPad->GetDrillSize().x) ||
1018  (m_dummyPad->GetSize().y < m_dummyPad->GetDrillSize().y) )
1019  {
1020  error_msgs.Add( _( "Incorrect value for pad drill: pad drill bigger than pad size" ) );
1021  skip_tstoffset = true; // offset prm will be not tested because if the drill value
1022  // is incorrect the offset prm is always seen as incorrect, even if it is 0
1023  }
1024 
1025  if( m_dummyPad->GetLocalClearance() < 0 )
1026  {
1027  error_msgs.Add( _( "Pad local clearance must be zero or greater than zero" ) );
1028  }
1029 
1031  {
1032  error_msgs.Add( _( "Pad local solder mask clearance must be zero or greater than zero" ) );
1033  }
1034 
1036  {
1037  error_msgs.Add( _( "Pad local solder paste clearance must be zero or less than zero" ) );
1038  }
1039 
1040  LSET padlayers_mask = m_dummyPad->GetLayerSet();
1041 
1042  if( padlayers_mask == 0 )
1043  error_msgs.Add( _( "Error: pad has no layer" ) );
1044 
1045  if( !padlayers_mask[F_Cu] && !padlayers_mask[B_Cu] )
1046  {
1047  if( m_dummyPad->GetDrillSize().x || m_dummyPad->GetDrillSize().y )
1048  {
1049  // Note: he message is shown in an HTML window
1050  msg = _( "Error: the pad is not on a copper layer and has a hole" );
1051 
1053  {
1054  msg += wxT( "<br><br><i>" );
1055  msg += _( "For NPTH pad, set pad size value to pad drill value,"
1056  " if you do not want this pad plotted in gerber files"
1057  );
1058  }
1059 
1060  error_msgs.Add( msg );
1061  }
1062  }
1063 
1064  if( !skip_tstoffset )
1065  {
1066  wxPoint max_size;
1067  max_size.x = std::abs( m_dummyPad->GetOffset().x );
1068  max_size.y = std::abs( m_dummyPad->GetOffset().y );
1069  max_size.x += m_dummyPad->GetDrillSize().x / 2;
1070  max_size.y += m_dummyPad->GetDrillSize().y / 2;
1071 
1072  if( ( m_dummyPad->GetSize().x / 2 < max_size.x ) ||
1073  ( m_dummyPad->GetSize().y / 2 < max_size.y ) )
1074  {
1075  error_msgs.Add( _( "Incorrect value for pad offset" ) );
1076  }
1077  }
1078 
1079  if( error )
1080  {
1081  error_msgs.Add( _( "Too large value for pad delta size" ) );
1082  }
1083 
1084  switch( m_dummyPad->GetAttribute() )
1085  {
1086  case PAD_ATTRIB_HOLE_NOT_PLATED: // Not plated, but through hole, a hole is expected
1087  case PAD_ATTRIB_STANDARD : // Pad through hole, a hole is also expected
1088  if( m_dummyPad->GetDrillSize().x <= 0 )
1089  error_msgs.Add( _( "Error: Through hole pad: drill diameter set to 0" ) );
1090  break;
1091 
1092  case PAD_ATTRIB_CONN: // Connector pads are smd pads, just they do not have solder paste.
1093  if( padlayers_mask[B_Paste] || padlayers_mask[F_Paste] )
1094  error_msgs.Add( _( "Error: Connector pads are not on the solder paste layer\n"
1095  "Use SMD pads instead" ) );
1096  // Fall trough
1097  case PAD_ATTRIB_SMD: // SMD and Connector pads (One external copper layer only)
1098  {
1099  LSET innerlayers_mask = padlayers_mask & LSET::InternalCuMask();
1100 
1101  if( ( padlayers_mask[F_Cu] && padlayers_mask[B_Cu] ) ||
1102  innerlayers_mask.count() != 0 )
1103  error_msgs.Add( _( "Error: only one external copper layer allowed for SMD or Connector pads" ) );
1104  }
1105  break;
1106  }
1107 
1108 
1110  {
1111  wxString value = m_tcCornerSizeRatio->GetValue();
1112  double rrRadiusRatioPercent;
1113 
1114  if( !value.ToDouble( &rrRadiusRatioPercent ) )
1115  error_msgs.Add( _( "Incorrect corner size value" ) );
1116  else
1117  {
1118  if( rrRadiusRatioPercent < 0.0 )
1119  error_msgs.Add( _( "Incorrect (negative) corner size value" ) );
1120  else if( rrRadiusRatioPercent > 50.0 )
1121  error_msgs.Add( _( "Corner size value must be smaller than 50%" ) );
1122  }
1123  }
1124 
1126  {
1128  error_msgs.Add(
1129  _( "Incorrect pad shape: the shape must be equivalent to only one polygon" ) );
1130  }
1131 
1132 
1133  if( error_msgs.GetCount() )
1134  {
1135  HTML_MESSAGE_BOX dlg( this, _("Pad setup errors list" ) );
1136  dlg.ListSet( error_msgs );
1137  dlg.ShowModal();
1138  }
1139 
1140  return error_msgs.GetCount() == 0;
1141 }
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL, int aCircleToSegmentsCount=32)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:398
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:403
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:61
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:395
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:606
const wxSize & GetSize() const
Definition: class_pad.h:269
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:409
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:406
Usual pad.
Definition: pad_shapes.h:60
const wxPoint & GetOffset() const
Definition: class_pad.h:278
void DIALOG_PAD_PROPERTIES::prepareCanvas ( )
private

Definition at line 181 of file dialog_pad_properties.cpp.

References PCB_GENERAL_SETTINGS::Colors(), KIGFX::ORIGIN_VIEWITEM::CROSS, EDA_DRAW_PANEL_GAL::GetBackend(), KIGFX::VIEW::GetGAL(), EDA_DRAW_FRAME::GetGalCanvas(), D_PAD::GetPosition(), EDA_DRAW_PANEL_GAL::GetView(), EDA_DRAW_FRAME::IsGalCanvasActive(), LIGHTBLUE, m_axisOrigin, m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPad, DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal, m_parent, OnResize(), KIGFX::ORIGIN_VIEWITEM::SetDrawAtZero(), KIGFX::GAL::SetGridSize(), 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().

182 {
183  // Initialize the canvases (legacy or gal) to display the pad
184  // Enable the suitable canvas and make some inits
185 
186  // Show the X and Y axis. It is usefull because pad shape can have an offset
187  // or be a complex shape.
188  KIGFX::COLOR4D axis_color = LIGHTBLUE;
189 
190  m_axisOrigin = new KIGFX::ORIGIN_VIEWITEM( axis_color,
192  Millimeter2iu( 0.2 ),
194  m_axisOrigin->SetDrawAtZero( true );
195 
196  if( m_parent->IsGalCanvasActive() )
197  {
200  m_panelShowPadGal->Show();
201  m_panelShowPad->Hide();
202  auto view = m_panelShowPadGal->GetView();
203  // gives a non null grid size (0.001mm) because GAL layer does not like a 0 size grid:
204  double gridsize = 0.001 * IU_PER_MM;
205  view->GetGAL()->SetGridSize( VECTOR2D( gridsize, gridsize ) );
206  view->Add( m_dummyPad );
207  view->Add( m_axisOrigin );
208 
210  Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) );
211  }
212  else
213  {
214  m_panelShowPad->Show();
215  m_panelShowPadGal->Hide();
216  }
217 }
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin
VECTOR2< double > VECTOR2D
Definition: vector2d.h:588
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:177
PCB_GENERAL_SETTINGS & Settings()
const wxPoint & GetPosition() const override
Definition: class_pad.h:220
void SetDrawAtZero(bool aDrawFlag)
Function SetDrawAtZero() Set the draw at zero flag.
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:856
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.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:864
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 DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_MODULE_BOARD_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile(), DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint(), DIALOG_SYMBOL_LIB_TABLE::browseLibrariesHandler(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_MODULE_MODULE_EDITOR::Cfg3DPath(), DIALOG_MODULE_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FP_LIB_TABLE::DIALOG_FP_LIB_TABLE(), DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR(), DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE(), LIB_VIEW_FRAME::DisplayLibInfos(), LIB_EDIT_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), DIALOG_MODULE_MODULE_EDITOR::Edit3DShapeFileName(), DIALOG_MODULE_BOARD_EDITOR::Edit3DShapeFileName(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), FOOTPRINT_EDIT_FRAME::GetCurrentLib(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), FOOTPRINT_EDIT_FRAME::getLibPath(), LIB_EDIT_FRAME::getLibraryFileName(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DIALOG_BOM::getPluginFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), SCH_EDIT_FRAME::ImportFile(), PCB_EDIT_FRAME::ImportFile(), DIALOG_MODULE_MODULE_EDITOR::initModeditProperties(), DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_MODULE_POSITION::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), DIALOG_BOM::OnRunPlugin(), DIALOG_NETLIST::OnSaveMessagesToFile(), SCH_EDIT_FRAME::OnSaveProject(), DIALOG_CHOOSE_COMPONENT::OnSchViewPaint(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_EDITOR_CONTROL::PlaceModule(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_VIEW_FRAME::ReCreateHToolbar(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), LIB_VIEW_FRAME::RedrawActiveWindow(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SCH_EDIT_FRAME::RescueLegacyProject(), SCH_EDIT_FRAME::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibrary(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), EDA_3D_VIEWER::takeScreenshot(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), CVPCB_MAINFRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR(), and DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR().

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:144
void DIALOG_PAD_PROPERTIES::redraw ( )
private

Definition at line 1144 of file dialog_pad_properties.cpp.

References PAD_CS_PRIMITIVE::ExportTo(), F_SilkS, DRAWSEGMENT::GetCenter(), D_PAD::GetOrientation(), BOX2< Vec >::GetOrigin(), DRAWSEGMENT::GetPolyShape(), D_PAD::GetPosition(), KIGFX::VIEW::GetScale(), BOX2< Vec >::GetSize(), EDA_DRAW_PANEL_GAL::GetView(), BOX2< Vec >::Inflate(), EDA_DRAW_FRAME::IsGalCanvasActive(), SHAPE_POLY_SET::Iterate(), m_dummyPad, m_highligth, 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, 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, DRAWSEGMENT::SetEnd(), BOARD_ITEM::SetLayer(), DRAWSEGMENT::SetWidth(), EDA_DRAW_PANEL_GAL::StartDrawing(), EDA_DRAW_PANEL_GAL::StopDrawing(), D_PAD::ViewBBox(), wxPoint::x, VECTOR2< T >::x, and VECTOR2< T >::y.

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

1145 {
1146  if( m_parent->IsGalCanvasActive() )
1147  {
1148  auto view = m_panelShowPadGal->GetView();
1150 
1151  view->SetTopLayer( F_SilkS );
1152 
1153  view->Update( m_dummyPad );
1154 
1155  // delete previous items if highlight list
1156  while( m_highligth.size() )
1157  {
1158  delete m_highligth.back(); // the dtor also removes item from view
1159  m_highligth.pop_back();
1160  }
1161 
1162  // highlight selected primitives:
1163  long select = m_listCtrlPrimitives->GetFirstSelected();
1164 
1165  while( select >= 0 )
1166  {
1167  PAD_CS_PRIMITIVE& primitive = m_primitives[select];
1168 
1169  DRAWSEGMENT* dummySegment = new DRAWSEGMENT;
1170  dummySegment->SetLayer( F_SilkS );
1171  primitive.ExportTo( dummySegment );
1172  dummySegment->Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() );
1173  dummySegment->Move( m_dummyPad->GetPosition() );
1174 
1175  // Update selected primitive (highligth selected)
1176  switch( primitive.m_Shape )
1177  {
1178  case S_SEGMENT:
1179  case S_ARC:
1180  break;
1181 
1182  case S_CIRCLE: // ring or circle
1183  if( primitive.m_Thickness == 0 ) // filled circle
1184  { // the filled circle option does not exist in a DRAWSEGMENT
1185  // but it is easy to create it with a circle having the
1186  // right radius and outline width
1187  wxPoint end = dummySegment->GetCenter();
1188  end.x += primitive.m_Radius/2;
1189  dummySegment->SetEnd( end );
1190  dummySegment->SetWidth( primitive.m_Radius );
1191  }
1192  break;
1193 
1194  case S_POLYGON: // polygon
1195  {
1196  for( auto iter = dummySegment->GetPolyShape().Iterate(); iter; iter++ )
1197  {
1198  (*iter) += VECTOR2I( m_dummyPad->GetPosition() );
1199  }
1200  }
1201  break;
1202 
1203  default:
1204  delete dummySegment;
1205  dummySegment = nullptr;
1206  break;
1207  }
1208 
1209  if( dummySegment )
1210  {
1211  view->Add( dummySegment );
1212  m_highligth.push_back( dummySegment );
1213  }
1214 
1215  select = m_listCtrlPrimitives->GetNextSelected( select );
1216  }
1217 
1218  BOX2I bbox = m_dummyPad->ViewBBox();
1219 
1220  if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
1221  {
1222  // gives a size to the full drawable area
1223  BOX2I drawbox;
1224  drawbox.Move( m_dummyPad->GetPosition() );
1225  drawbox.Inflate( bbox.GetSize().x*2, bbox.GetSize().y*2 );
1226  view->SetBoundary( drawbox );
1227 
1228  // Autozoom
1229  view->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) );
1230 
1231  // Add a margin
1232  view->SetScale( m_panelShowPadGal->GetView()->GetScale() * 0.7 );
1233 
1236  }
1237  }
1238  else
1239  {
1240  m_panelShowPad->Refresh();
1241  }
1242 }
const Vec & GetOrigin() const
Definition: box2.h:181
void Move(const Vec &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
Definition: box2.h:108
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:469
usual segment : line with rounded ends
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Function Iterate returns an object to iterate through the points of the polygons between aFirst and a...
const Vec & GetSize() const
Definition: box2.h:177
VECTOR2< int > VECTOR2I
Definition: vector2d.h:589
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
Definition: class_pad.cpp:1286
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:98
const wxPoint & GetPosition() const override
Definition: class_pad.h:220
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
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:856
SHAPE_POLY_SET & GetPolyShape()
STROKE_T m_Shape
Definition: class_pad.h:94
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
virtual void Move(const wxPoint &aMoveVector) override
Function Move move this object.
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it bu 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
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:266
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:375
std::vector< DRAWSEGMENT * > m_highligth
void SetEnd(const wxPoint &aEnd)
double GetScale() const
Function GetScale()
Definition: view.h:265
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...
void SetWidth(int aWidth)
void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

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

Definition at line 41 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

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

42 {
43 #if defined(DEBUG)
44  // offer a trap point for debugging most any window
45  wxASSERT( aDest );
46  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
47  {
48  int breakhere=1;
49  (void) breakhere;
50  }
51 #endif
52 
53  (void) aDest;
54 
55  m_kiway = aKiway;
56 }
KIWAY * m_kiway
Definition: kiway_player.h:85
const char * name
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 961 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().

962 {
963  LSET cu_set = layer_mask & LSET::AllCuMask();
964 
965  if( cu_set == LSET( F_Cu ) )
966  m_rbCopperLayersSel->SetSelection( 0 );
967  else if( cu_set == LSET( B_Cu ) )
968  m_rbCopperLayersSel->SetSelection( 1 );
969  else if( cu_set.any() )
970  m_rbCopperLayersSel->SetSelection( 2 );
971  else
972  m_rbCopperLayersSel->SetSelection( 3 );
973 
974  m_PadLayerAdhCmp->SetValue( layer_mask[F_Adhes] );
975  m_PadLayerAdhCu->SetValue( layer_mask[B_Adhes] );
976 
977  m_PadLayerPateCmp->SetValue( layer_mask[F_Paste] );
978  m_PadLayerPateCu->SetValue( layer_mask[B_Paste] );
979 
980  m_PadLayerSilkCmp->SetValue( layer_mask[F_SilkS] );
981  m_PadLayerSilkCu->SetValue( layer_mask[B_SilkS] );
982 
983  m_PadLayerMaskCmp->SetValue( layer_mask[F_Mask] );
984  m_PadLayerMaskCu->SetValue( layer_mask[B_Mask] );
985 
986  m_PadLayerECO1->SetValue( layer_mask[Eco1_User] );
987  m_PadLayerECO2->SetValue( layer_mask[Eco2_User] );
988 
989  m_PadLayerDraft->SetValue( layer_mask[Dwgs_User] );
990 }
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:646
Class LSET is a set of PCB_LAYER_IDs.
bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 139 of file dialog_shim.cpp.

References class_map, DIALOG_SHIM::FixOSXCancelButtonIssue(), EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, wxPoint::x, and wxPoint::y.

Referenced by DisplayHotkeyList(), DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), DIALOG_ANNOTATE::OnApplyClick(), DIALOG_SCH_FIND::OnCancel(), DIALOG_ANNOTATE::OnCancelClick(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnPopupMenu(), DIALOG_EXCHANGE_MODULE::OnQuit(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), and DIALOG_SHIM::ShowQuasiModal().

140 {
141  bool ret;
142  const char* hash_key;
143 
144  if( m_hash_key.size() )
145  {
146  // a special case like EDA_LIST_DIALOG, which has multiple uses.
147  hash_key = m_hash_key.c_str();
148  }
149  else
150  {
151  hash_key = typeid(*this).name();
152  }
153 
154  // Show or hide the window. If hiding, save current position and size.
155  // If showing, use previous position and size.
156  if( show )
157  {
158 #ifndef __WINDOWS__
159  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
160 #endif
161  ret = wxDialog::Show( show );
162 
163  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
164  EDA_RECT r = class_map[ hash_key ];
165 
166  if( r.GetSize().x != 0 && r.GetSize().y != 0 )
167  SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 );
168  }
169  else
170  {
171  // Save the dialog's position & size before hiding, using classname as key
172  EDA_RECT r( wxDialog::GetPosition(), wxDialog::GetSize() );
173  class_map[ hash_key ] = r;
174 
175  ret = wxDialog::Show( show );
176  }
177 
179 
180  return ret;
181 }
const wxSize GetSize() const
std::string m_hash_key
Definition: dialog_shim.h:128
void FixOSXCancelButtonIssue()
A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms.
static RECT_MAP class_map
const wxPoint GetPosition() const
Class EDA_RECT handles the component boundary box.
int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 497 of file dialog_shim.cpp.

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

Referenced by SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), LIB_EDIT_FRAME::InstallFieldsEditorDialog(), SCH_EDIT_FRAME::InstallHierarchyFrame(), InvokeDialogCreateBOMEditor(), InvokeDialogUpdateFields(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), and SCH_BASE_FRAME::SelectComponentFromLibrary().

498 {
499  // This is an exception safe way to zero a pointer before returning.
500  // Yes, even though DismissModal() clears this first normally, this is
501  // here in case there's an exception before the dialog is dismissed.
502  struct NULLER
503  {
504  void*& m_what;
505  NULLER( void*& aPtr ) : m_what( aPtr ) {}
506  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
507  } clear_this( (void*&) m_qmodal_loop );
508 
509  // release the mouse if it's currently captured as the window having it
510  // will be disabled when this dialog is shown -- but will still keep the
511  // capture making it impossible to do anything in the modal dialog itself
512  wxWindow* win = wxWindow::GetCapture();
513  if( win )
514  win->ReleaseMouse();
515 
516  // Get the optimal parent
517  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
518 
519  // Show the optimal parent
520  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
521 
522  wxASSERT_MSG( !m_qmodal_parent_disabler,
523  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
524 
525  // quasi-modal: disable only my "optimal" parent
527 
528  Show( true );
529 
530  m_qmodal_showing = true;
531 
532  EVENT_LOOP event_loop;
533 
534  m_qmodal_loop = &event_loop;
535 
536  event_loop.Run();
537 
538  return GetReturnCode();
539 }
bool m_qmodal_showing
Definition: dialog_shim.h:132
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:131
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:133
Toggle a window'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 1260 of file dialog_pad_properties.cpp.

References MODULE::CalculateBoundingBox(), EDA_ITEM::ClearFlags(), D_PAD::DeletePrimitivesList(), DisplayError(), DO_NOT_DRAW, BOARD::FindNet(), 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(), NETINFO_ITEM::GetNet(), BOARD_CONNECTED_ITEM::GetNetname(), 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(), 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_PadNetNameCtrl, 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, 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(), NETINFO_LIST::UNCONNECTED, and wxPoint::y.

1261 {
1262  BOARD_COMMIT commit( m_parent );
1263 
1264  if( !wxDialog::TransferDataFromWindow() )
1265  return false;
1266 
1267  if( !m_panelGeneral->TransferDataFromWindow() )
1268  return false;
1269 
1270  if( !m_localSettingsPanel->TransferDataFromWindow() )
1271  return false;
1272 
1273  if( !padValuesOK() )
1274  return false;
1275 
1276  bool rastnestIsChanged = false;
1277  int isign = m_isFlipped ? -1 : 1;
1278 
1280  // m_padMaster is a pattern: ensure there is no net for this pad:
1282 
1283  if( !m_currentPad ) // Set current Pad parameters
1284  return true;
1285 
1286  commit.Modify( m_currentPad );
1287 
1288  // redraw the area where the pad was, without pad (delete pad on screen)
1292 
1293  // Update values
1296 
1298  {
1300  rastnestIsChanged = true;
1301  }
1302 
1303  wxSize size;
1304  MODULE* footprint = m_currentPad->GetParent();
1305 
1306  if( footprint )
1307  {
1308  footprint->SetLastEditTime();
1309 
1310  // compute the pos 0 value, i.e. pad position for footprint with orientation = 0
1311  // i.e. relative to footprint origin (footprint position)
1312  wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition();
1313  RotatePoint( &pt, -footprint->GetOrientation() );
1314  m_currentPad->SetPos0( pt );
1316  + footprint->GetOrientation() );
1317  }
1318 
1320 
1321  size = m_padMaster->GetDelta();
1322  size.y *= isign;
1323  m_currentPad->SetDelta( size );
1324 
1327 
1328  wxPoint offset = m_padMaster->GetOffset();
1329  offset.y *= isign;
1330  m_currentPad->SetOffset( offset );
1331 
1333 
1336 
1337 
1340 
1341  if( m_isFlipped )
1342  {
1345  }
1346 
1348  {
1349  rastnestIsChanged = true;
1351  }
1352 
1353  if( m_isFlipped )
1354  {
1356  }
1357 
1359 
1360  wxString padNetname;
1361 
1362  // For PAD_ATTRIB_HOLE_NOT_PLATED, ensure there is no net name selected
1364  padNetname = m_PadNetNameCtrl->GetValue();
1365 
1366  if( m_currentPad->GetNetname() != padNetname )
1367  {
1368  const NETINFO_ITEM* netinfo = m_board->FindNet( padNetname );
1369 
1370  if( !padNetname.IsEmpty() && netinfo == NULL )
1371  {
1372  DisplayError( NULL, _( "Unknown netname, netname not changed" ) );
1373  }
1374  else if( netinfo )
1375  {
1376  rastnestIsChanged = true;
1377  m_currentPad->SetNetCode( netinfo->GetNet() );
1378  }
1379  }
1380 
1389 
1390  // rounded rect pads with radius ratio = 0 are in fact rect pads.
1391  // So set the right shape (and perhaps issues with a radius = 0)
1394  {
1396  }
1397 
1398  // define the way the clearnce area is defined in zones
1400 
1401  if( footprint )
1402  footprint->CalculateBoundingBox();
1403 
1405 
1406  // redraw the area where the pad was
1408 
1409  commit.Push( _( "Modify pad" ) );
1410 
1411  if( rastnestIsChanged ) // The net ratsnest must be recalculated
1412  m_board->m_Status_Pcb = 0;
1413 
1414  return true;
1415 }
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:491
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:434
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:398
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:331
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
int GetPadToDieLength() const
Definition: class_pad.h:401
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
const wxPoint & GetPosition() const override
Definition: class_module.h:175
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:403
MODULE * GetParent() const
Definition: class_pad.h:162
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:219
void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
Definition: draw_panel.cpp:305
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:381
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:274
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
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:620
void SetLastEditTime(time_t aTime)
Definition: class_module.h:302
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
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:280
void SetZoneConnection(ZoneConnection aType)
Definition: class_pad.h:469
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Function SetMsgPanel clears the message panel and populates it with the contents of aList...
Definition: draw_frame.cpp:784
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:180
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:262
const wxPoint & GetPosition() const override
Definition: class_pad.h:220
ZoneConnection GetZoneConnection() const
Definition: class_pad.cpp:650
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:395
int GetThermalWidth() const
Definition: class_pad.cpp:661
int GetThermalGap() const
Definition: class_pad.cpp:672
void SetThermalWidth(int aWidth)
Definition: class_pad.h:472
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:409
void SetPadToDieLength(int aLength)
Definition: class_pad.h:400
int GetNet() const
Function GetNet.
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:392
int GetLocalClearance() const
Definition: class_pad.h:406
void SetLocalClearance(int aClearance)
Definition: class_pad.h:407
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:412
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:413
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:394
Class NETINFO_ITEM handles the data for a net.
Definition: class_netinfo.h:69
const wxString & GetNetname() const
Function GetNetname.
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:608
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:379
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:404
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:375
const wxSize & GetDelta() const
Definition: class_pad.h:272
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
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:401
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:281
bool padValuesOK()
test if all values are acceptable for the pad
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:410
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
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:277
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:73
void SetThermalGap(int aGap)
Definition: class_pad.h:475
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
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:199
const wxPoint & GetOffset() const
Definition: class_pad.h:278
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:139
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:271
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:237
bool DIALOG_PAD_PROPERTIES::transferDataToPad ( D_PAD aPad)
private

Copy values from dialog field to aPad's members.

Definition at line 1418 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, BOARD::FindNet(), D_PAD::GetAnchorPadShape(), D_PAD::GetAttribute(), NETINFO_ITEM::GetNet(), D_PAD::GetShape(), D_PAD::GetSize(), m_board, DIALOG_PAD_PROPERTIES_BASE::m_DrillShapeCtrl, DIALOG_PAD_PROPERTIES_BASE::m_LengthPadToDieCtrl, DIALOG_PAD_PROPERTIES_BASE::m_localSettingsPanel, DIALOG_PAD_PROPERTIES_BASE::m_NetClearanceValueCtrl, m_OrientValidator, m_OrientValue, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_Y_Ctrl, 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_PadNetNameCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadNumCtrl, DIALOG_PAD_PROPERTIES_BASE::m_PadPosition_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadPosition_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_PadShape, DIALOG_PAD_PROPERTIES_BASE::m_PadType, DIALOG_PAD_PROPERTIES_BASE::m_panelGeneral, m_primitives, DIALOG_PAD_PROPERTIES_BASE::m_rbCopperLayersSel, DIALOG_PAD_PROPERTIES_BASE::m_ShapeDelta_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeOffset_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeSize_X_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_ShapeSize_Y_Ctrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderMaskMarginCtrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginCtrl, DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginRatioCtrl, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, DIALOG_PAD_PROPERTIES_BASE::m_ThermalGapCtrl, DIALOG_PAD_PROPERTIES_BASE::m_ThermalWidthCtrl, DIALOG_PAD_PROPERTIES_BASE::m_trapDeltaDirChoice, DIALOG_PAD_PROPERTIES_BASE::m_ZoneConnectionChoice, 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 ValueFromTextCtrl().

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

1419 {
1420  wxString msg;
1421  int x, y;
1422 
1423  if( !Validate() )
1424  return true;
1425  if( !m_panelGeneral->Validate() )
1426  return true;
1427  if( !m_localSettingsPanel->Validate() )
1428  return true;
1429 
1430  m_OrientValidator.TransferFromWindow();
1431 
1432  aPad->SetAttribute( code_type[m_PadType->GetSelection()] );
1433  aPad->SetShape( code_shape[m_PadShape->GetSelection()] );
1436 
1437  if( aPad->GetShape() == PAD_SHAPE_CUSTOM )
1438  aPad->SetPrimitives( m_primitives );
1439 
1440  // Read pad clearances values:
1446  double dtmp = 0.0;
1447  msg = m_SolderPasteMarginRatioCtrl->GetValue();
1448  msg.ToDouble( &dtmp );
1449 
1450  // A -50% margin ratio means no paste on a pad, the ratio must be >= -50%
1451  if( dtmp < -50.0 )
1452  dtmp = -50.0;
1453  // A margin ratio is always <= 0
1454  // 0 means use full pad copper area
1455  if( dtmp > 0.0 )
1456  dtmp = 0.0;
1457 
1458  aPad->SetLocalSolderPasteMarginRatio( dtmp / 100 );
1459 
1460  switch( m_ZoneConnectionChoice->GetSelection() )
1461  {
1462  default:
1463  case 0:
1465  break;
1466 
1467  case 1:
1469  break;
1470 
1471  case 2:
1473  break;
1474 
1475  case 3:
1477  break;
1478  }
1479 
1480  // Read pad position:
1483 
1484  aPad->SetPosition( wxPoint( x, y ) );
1485  aPad->SetPos0( wxPoint( x, y ) );
1486 
1487  // Read pad drill:
1490 
1491  if( m_DrillShapeCtrl->GetSelection() == 0 )
1492  {
1494  y = x;
1495  }
1496  else
1498 
1499  aPad->SetDrillSize( wxSize( x, y ) );
1500 
1501  // Read pad shape size:
1504 
1505  if( aPad->GetShape() == PAD_SHAPE_CIRCLE )
1506  y = x;
1507 
1508  // for custom shped pads, the pad size is the anchor pad size:
1509  if( aPad->GetShape() == PAD_SHAPE_CUSTOM && aPad->GetAnchorPadShape() == PAD_SHAPE_CIRCLE )
1510  y = x;
1511 
1512  aPad->SetSize( wxSize( x, y ) );
1513 
1514  // Read pad length die
1516 
1517  // For a trapezoid, test delta value (be sure delta is not too large for pad size)
1518  // remember DeltaSize.x is the Y size variation
1519  bool error = false;
1520 
1521  if( aPad->GetShape() == PAD_SHAPE_TRAPEZOID )
1522  {
1523  wxSize delta;
1524 
1525  // For a trapezoid, only one of delta.x or delta.y is not 0, depending on
1526  // the direction.
1527  if( m_trapDeltaDirChoice->GetSelection() == 0 )
1528  delta.x = ValueFromTextCtrl( *m_ShapeDelta_Ctrl );
1529  else
1530  delta.y = ValueFromTextCtrl( *m_ShapeDelta_Ctrl );
1531 
1532  if( delta.x < 0 && delta.x <= -aPad->GetSize().y )
1533  {
1534  delta.x = -aPad->GetSize().y + 2;
1535  error = true;
1536  }
1537 
1538  if( delta.x > 0 && delta.x >= aPad->GetSize().y )
1539  {
1540  delta.x = aPad->GetSize().y - 2;
1541  error = true;
1542  }
1543 
1544  if( delta.y < 0 && delta.y <= -aPad->GetSize().x )
1545  {
1546  delta.y = -aPad->GetSize().x + 2;
1547  error = true;
1548  }
1549 
1550  if( delta.y > 0 && delta.y >= aPad->GetSize().x )
1551  {
1552  delta.y = aPad->GetSize().x - 2;
1553  error = true;
1554  }
1555 
1556  aPad->SetDelta( delta );
1557  }
1558 
1559  // Read pad shape offset:
1562  aPad->SetOffset( wxPoint( x, y ) );
1563 
1564  aPad->SetOrientation( m_OrientValue * 10.0 );
1565  aPad->SetName( m_PadNumCtrl->GetValue() );
1566 
1567  // Check if user has set an existing net name
1568  const NETINFO_ITEM* netinfo = m_board->FindNet( m_PadNetNameCtrl->GetValue() );
1569 
1570  if( netinfo != NULL )
1571  aPad->SetNetCode( netinfo->GetNet() );
1572  else
1574 
1575  // Clear some values, according to the pad type and shape
1576  switch( aPad->GetShape() )
1577  {
1578  case PAD_SHAPE_CIRCLE:
1579  aPad->SetOffset( wxPoint( 0, 0 ) );
1580  aPad->SetDelta( wxSize( 0, 0 ) );
1581  x = aPad->GetSize().x;
1582  aPad->SetSize( wxSize( x, x ) );
1583  break;
1584 
1585  case PAD_SHAPE_RECT:
1586  aPad->SetDelta( wxSize( 0, 0 ) );
1587  break;
1588 
1589  case PAD_SHAPE_OVAL:
1590  aPad->SetDelta( wxSize( 0, 0 ) );
1591  break;
1592 
1593  case PAD_SHAPE_TRAPEZOID:
1594  break;
1595 
1596  case PAD_SHAPE_ROUNDRECT:
1597  aPad->SetDelta( wxSize( 0, 0 ) );
1598  break;
1599 
1600  case PAD_SHAPE_CUSTOM:
1601  aPad->SetOffset( wxPoint( 0, 0 ) );
1602  aPad->SetDelta( wxSize( 0, 0 ) );
1603 
1604  // The pad custom has a "anchor pad" (a basic shape: round or rect pad)
1605  // that is the minimal area of this pad, and is usefull to ensure a hole
1606  // diameter is acceptable, and is used in Gerber files as flashed area
1607  // reference
1608  if( aPad->GetAnchorPadShape() == PAD_SHAPE_CIRCLE )
1609  {
1610  x = aPad->GetSize().x;
1611  aPad->SetSize( wxSize( x, x ) );
1612  }
1613 
1614  // define the way the clearance area is defined in zones
1615  aPad->SetCustomShapeInZoneOpt( m_ZoneCustomPadShape->GetSelection() == 0 ?
1618 
1619  break;
1620 
1621  default:
1622  ;
1623  }
1624 
1625  switch( aPad->GetAttribute() )
1626  {
1627  case PAD_ATTRIB_STANDARD:
1628  break;
1629 
1630  case PAD_ATTRIB_CONN:
1631  case PAD_ATTRIB_SMD:
1632  // SMD and PAD_ATTRIB_CONN has no hole.
1633  // basically, SMD and PAD_ATTRIB_CONN are same type of pads
1634  // PAD_ATTRIB_CONN has just a default non technical layers that differs from SMD
1635  // and are intended to be used in virtual edge board connectors
1636  // However we can accept a non null offset,
1637  // mainly to allow complex pads build from a set of basic pad shapes
1638  aPad->SetDrillSize( wxSize( 0, 0 ) );
1639  break;
1640 
1642  // Mechanical purpose only:
1643  // no offset, no net name, no pad name allowed
1644  aPad->SetOffset( wxPoint( 0, 0 ) );
1645  aPad->SetName( wxEmptyString );
1647  break;
1648 
1649  default:
1650  DisplayError( NULL, wxT( "Error: unknown pad type" ) );
1651  break;
1652  }
1653 
1654  if( aPad->GetShape() == PAD_SHAPE_ROUNDRECT )
1655  {
1656  wxString value = m_tcCornerSizeRatio->GetValue();
1657  double rrRadiusRatioPercent;
1658 
1659  if( value.ToDouble( &rrRadiusRatioPercent ) )
1660  aPad->SetRoundRectRadiusRatio( rrRadiusRatioPercent / 100.0 );
1661  }
1662 
1663  LSET padLayerMask;
1664 
1665  switch( m_rbCopperLayersSel->GetSelection() )
1666  {
1667  case 0:
1668  padLayerMask.set( F_Cu );
1669  break;
1670 
1671  case 1:
1672  padLayerMask.set( B_Cu );
1673  break;
1674 
1675  case 2:
1676  padLayerMask |= LSET::AllCuMask();
1677  break;
1678 
1679  case 3: // No copper layers
1680  break;
1681  }
1682 
1683  if( m_PadLayerAdhCmp->GetValue() )
1684  padLayerMask.set( F_Adhes );
1685 
1686  if( m_PadLayerAdhCu->GetValue() )
1687  padLayerMask.set( B_Adhes );
1688 
1689  if( m_PadLayerPateCmp->GetValue() )
1690  padLayerMask.set( F_Paste );
1691 
1692  if( m_PadLayerPateCu->GetValue() )
1693  padLayerMask.set( B_Paste );
1694 
1695  if( m_PadLayerSilkCmp->GetValue() )
1696  padLayerMask.set( F_SilkS );
1697 
1698  if( m_PadLayerSilkCu->GetValue() )
1699  padLayerMask.set( B_SilkS );
1700 
1701  if( m_PadLayerMaskCmp->GetValue() )
1702  padLayerMask.set( F_Mask );
1703 
1704  if( m_PadLayerMaskCu->GetValue() )
1705  padLayerMask.set( B_Mask );
1706 
1707  if( m_PadLayerECO1->GetValue() )
1708  padLayerMask.set( Eco1_User );
1709 
1710  if( m_PadLayerECO2->GetValue() )
1711  padLayerMask.set( Eco2_User );
1712 
1713  if( m_PadLayerDraft->GetValue() )
1714  padLayerMask.set( Dwgs_User );
1715 
1716  aPad->SetLayerSet( padLayerMask );
1717 
1718  return error;
1719 }
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:646
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:226
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:398
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:65
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
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:620
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
static const int delta[8][2]
Definition: solve.cpp:112
static PAD_SHAPE_T code_shape[]
Pads are not covered.
Definition: zones.h:57
static PAD_ATTR_T code_type[]
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:253
Class LSET is a set of PCB_LAYER_IDs.
void SetZoneConnection(ZoneConnection aType)
Definition: class_pad.h:469
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
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:262
void SetThermalWidth(int aWidth)
Definition: class_pad.h:472
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.
void SetPadToDieLength(int aLength)
Definition: class_pad.h:400
int GetNet() const
Function GetNet.
int ValueFromTextCtrl(const wxTextCtrl &aTextCtr)
Convert the number Value in a string according to the internal units and the selected unit (g_UserUni...
Definition: base_units.cpp:385
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:62
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:392
void SetLocalClearance(int aClearance)
Definition: class_pad.h:407
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:413
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:394
Class NETINFO_ITEM handles the data for a net.
Definition: class_netinfo.h:69
std::vector< PAD_CS_PRIMITIVE > m_primitives
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:379
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:404
Usual pad.
Definition: pad_shapes.h:60
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
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:401
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:410
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
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:277
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:73
void SetThermalGap(int aGap)
Definition: class_pad.h:475
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Use thermal relief for pads.
Definition: zones.h:58
bool SetPrimitives(const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
Import to the basic shape list.
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:271
pads are covered by copper
Definition: zones.h:59
bool DIALOG_PAD_PROPERTIES::TransferDataToWindow ( )
overrideprivate

Definition at line 1245 of file dialog_pad_properties.cpp.

References DIALOG_PAD_PROPERTIES_BASE::m_localSettingsPanel, and DIALOG_PAD_PROPERTIES_BASE::m_panelGeneral.

Referenced by DIALOG_PAD_PROPERTIES().

1246 {
1247  if( !wxDialog::TransferDataToWindow() )
1248  return false;
1249 
1250  if( !m_panelGeneral->TransferDataToWindow() )
1251  return false;
1252 
1253  if( !m_localSettingsPanel->TransferDataToWindow() )
1254  return false;
1255 
1256  return true;
1257 }
void DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues ( )
private

Definition at line 375 of file dialog_pad_properties.cpp.

References Format(), g_UserUnit, D_PAD::GetRoundRectCornerRadius(), D_PAD::GetRoundRectRadiusRatio(), D_PAD::GetShape(), m_dummyPad, DIALOG_PAD_PROPERTIES_BASE::m_staticTextCornerRadiusValue, DIALOG_PAD_PROPERTIES_BASE::m_tcCornerSizeRatio, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, and StringFromValue().

Referenced by initValues(), OnPadShapeSelection(), and OnValuesChanged().

376 {
377  // Note:
378  // To avoid generating a wxEVT_TEXT event from m_tcCornerSizeRatio
379  // we use ChangeValue instead of SetValue, to set the displayed string
381  {
382  m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f",
386  }
387  else if( m_dummyPad->GetShape() == PAD_SHAPE_RECT )
388  {
389  m_tcCornerSizeRatio->ChangeValue( "0" );
390  m_staticTextCornerRadiusValue->SetLabel( "0" );
391  }
392  else
393  {
394  m_tcCornerSizeRatio->ChangeValue( wxEmptyString );
395  m_staticTextCornerRadiusValue->SetLabel( wxEmptyString );
396  }
397 }
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:204
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:511
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:608
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

Member Data Documentation

KIGFX::ORIGIN_VIEWITEM* DIALOG_PAD_PROPERTIES::m_axisOrigin
private

Definition at line 69 of file dialog_pad_properties.h.

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

BOARD* DIALOG_PAD_PROPERTIES::m_board
private
wxBoxSizer* DIALOG_PAD_PROPERTIES_BASE::m_bSizerPanelPrimitives
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_buttonAddShape
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_buttonDel
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_buttonDup
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_buttonEditShape
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_buttonGeometry
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_buttonImport
protectedinherited
bool DIALOG_PAD_PROPERTIES::m_canEditNetName
private

Definition at line 82 of file dialog_pad_properties.h.

Referenced by initValues(), and PadTypeSelected().

bool DIALOG_PAD_PROPERTIES::m_canUpdate
private
D_PAD* DIALOG_PAD_PROPERTIES::m_currentPad
private
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_customOrientUnits
protectedinherited
KIGFX::GAL_DISPLAY_OPTIONS DIALOG_PAD_PROPERTIES_BASE::m_galOptions
protectedinherited
std::string DIALOG_SHIM::m_hash_key
protectedinherited
std::vector<DRAWSEGMENT*> DIALOG_PAD_PROPERTIES::m_highligth
private

Definition at line 89 of file dialog_pad_properties.h.

Referenced by redraw().

bool DIALOG_PAD_PROPERTIES::m_isFlipped
private

Definition at line 79 of file dialog_pad_properties.h.

Referenced by initValues(), and TransferDataFromWindow().

TEXT_CTRL_EVAL* DIALOG_PAD_PROPERTIES_BASE::m_LengthPadToDieCtrl
protectedinherited
wxPanel* DIALOG_PAD_PROPERTIES_BASE::m_localSettingsPanel
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_MaskClearanceTitle
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_NetClearanceUnits
protectedinherited
TEXT_CTRL_EVAL* DIALOG_PAD_PROPERTIES_BASE::m_NetClearanceValueCtrl
protectedinherited
wxNotebook* DIALOG_PAD_PROPERTIES_BASE::m_notebook
protectedinherited
wxFloatingPointValidator<double> DIALOG_PAD_PROPERTIES::m_OrientValidator
private
double DIALOG_PAD_PROPERTIES::m_OrientValue
private

Definition at line 92 of file dialog_pad_properties.h.

Referenced by initValues(), PadOrientEvent(), and transferDataToPad().

wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_X_Unit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadDrill_Y_Unit
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerAdhCmp
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerAdhCu
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerDraft
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerECO1
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerECO2
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerMaskCmp
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerMaskCu
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerPateCmp
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerPateCu
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerSilkCmp
protectedinherited
wxCheckBox* DIALOG_PAD_PROPERTIES_BASE::m_PadLayerSilkCu
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadLengthDie_Unit
protectedinherited
D_PAD* DIALOG_PAD_PROPERTIES::m_padMaster
private

Definition at line 72 of file dialog_pad_properties.h.

Referenced by DIALOG_PAD_PROPERTIES(), and TransferDataFromWindow().

wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadNameText
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadNumText
protectedinherited
wxChoice* DIALOG_PAD_PROPERTIES_BASE::m_PadOrient
protectedinherited
TEXT_CTRL_EVAL* DIALOG_PAD_PROPERTIES_BASE::m_PadOrientCtrl
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadOrientText
protectedinherited
TEXT_CTRL_EVAL* DIALOG_PAD_PROPERTIES_BASE::m_PadPosition_X_Ctrl
protectedinherited
TEXT_CTRL_EVAL* DIALOG_PAD_PROPERTIES_BASE::m_PadPosition_Y_Ctrl
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadPosX_Unit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadPosY_Unit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadShapeDelta_Unit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadShapeOffsetX_Unit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadShapeOffsetY_Unit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadShapeSizeX_Unit
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_PadShapeSizeY_Unit
protectedinherited
wxPanel* DIALOG_PAD_PROPERTIES_BASE::m_panelCustomShapePrimitives
protectedinherited
wxPanel* DIALOG_PAD_PROPERTIES_BASE::m_panelGeneral
protectedinherited
wxPanel* DIALOG_PAD_PROPERTIES_BASE::m_panelShowPad
protectedinherited
PCB_DRAW_PANEL_GAL* DIALOG_PAD_PROPERTIES_BASE::m_panelShowPadGal
protectedinherited
PCB_BASE_FRAME* DIALOG_PAD_PROPERTIES::m_parent
private
EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 131 of file dialog_shim.h.

Referenced by DIALOG_SHIM::EndQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited
bool DIALOG_SHIM::m_qmodal_showing
protectedinherited
wxChoice* DIALOG_PAD_PROPERTIES_BASE::m_rbCopperLayersSel
protectedinherited
wxStaticBoxSizer* DIALOG_PAD_PROPERTIES_BASE::m_sbSizerZonesSettings
protectedinherited
wxStdDialogButtonSizer* DIALOG_PAD_PROPERTIES_BASE::m_sdbSizer
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_sdbSizerCancel
protectedinherited
wxButton* DIALOG_PAD_PROPERTIES_BASE::m_sdbSizerOK
protectedinherited
TEXT_CTRL_EVAL* DIALOG_PAD_PROPERTIES_BASE::m_SolderMaskMarginCtrl
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_SolderMaskMarginUnits
protectedinherited
TEXT_CTRL_EVAL* DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginCtrl
protectedinherited
TEXT_CTRL_EVAL* DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginRatioCtrl
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteMarginUnits
protectedinherited
wxStaticText* DIALOG_PAD_PROPERTIES_BASE::m_SolderPasteRatioMarginUnits
protectedinherited
<
wxStaticLine* DIALOG_PAD_PROPERTIES_BASE::m_staticline4
protectedinherited