KiCad PCB EDA Suite
dialog_pad_properties.cpp
Go to the documentation of this file.
1 
6 /*
7  * This program source code file is part of KiCad, a free EDA CAD application.
8  *
9  * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
10  * Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com
11  * Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
12  * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, you may find one here:
26  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
27  * or you may search the http://www.gnu.org website for the version 2 license,
28  * or you may write to the Free Software Foundation, Inc.,
29  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
30  */
31 
32 #include <fctsys.h>
33 #include <common.h>
34 #include <gr_basic.h>
35 #include <class_drawpanel.h>
36 #include <confirm.h>
37 #include <pcbnew.h>
38 #include <wxBasePcbFrame.h>
39 #include <base_units.h>
40 #include <board_commit.h>
41 
42 #include <class_board.h>
43 #include <class_module.h>
44 
45 #include <dialog_pad_properties.h>
46 #include <html_messagebox.h>
47 
48 
49 // list of pad shapes, ordered like the pad shape wxChoice in dialog.
50 static PAD_SHAPE_T code_shape[] = {
56 };
57 
58 // the ordered index of the pad shape wxChoice in dialog.
59 // keep it consistent with code_shape[] and dialog strings
66 };
67 
68 
69 
70 static PAD_ATTR_T code_type[] = {
75 };
76 
77 
78 // Default mask layers setup for pads according to the pad type
79 static const LSET std_pad_layers[] = {
80  // PAD_ATTRIB_STANDARD:
82 
83  // PAD_ATTRIB_SMD:
85 
86  // PAD_ATTRIB_CONN:
88 
89  // PAD_ATTRIB_HOLE_NOT_PLATED:
91 };
92 
93 
95 {
96  DIALOG_PAD_PROPERTIES dlg( this, aPad );
97  dlg.ShowModal();
98 }
99 
100 
102  DIALOG_PAD_PROPERTIES_BASE( aParent ),
103  m_OrientValidator( 1, &m_OrientValue )
104 {
105  m_canUpdate = false;
106  m_parent = aParent;
107  m_currentPad = aPad; // aPad can be NULL, if the dialog is called
108  // from the footprint editor to set default pad setup
109 
111 
112  m_OrientValidator.SetRange( -360.0, 360.0 );
113  m_PadOrientCtrl->SetValidator( m_OrientValidator );
114  m_OrientValidator.SetWindow( m_PadOrientCtrl );
115 
117  m_dummyPad = new D_PAD( (MODULE*) NULL );
118 
119  if( aPad )
120  *m_dummyPad = *aPad;
121  else // We are editing a "master" pad, i.e. a template to create new pads
123 
124  // Show the X and Y axis. It is usefull because pad shape can have an offset
125  // or be a complex shape.
126  m_axisOrigin = new KIGFX::ORIGIN_VIEWITEM( KIGFX::COLOR4D(0.0, 0.0, 0.8, 1.0),
128  Millimeter2iu( 0.2 ),
130  m_axisOrigin->SetDrawAtZero( true );
131 
132  if( m_parent->IsGalCanvasActive() )
133  {
134 
137  m_panelShowPadGal->Show();
138  m_panelShowPad->Hide();
142  Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) );
143  }
144  else
145  {
146  m_panelShowPad->Show();
147  m_panelShowPadGal->Hide();
148  }
149 
150  initValues();
152 
153  m_sdbSizerOK->SetDefault();
154  m_canUpdate = true;
155 
156  // Now all widgets have the size fixed, call FinishDialogSettings
158 }
159 
160 void DIALOG_PAD_PROPERTIES::OnInitDialog( wxInitDialogEvent& event )
161 {
162  m_PadNumCtrl->SetFocus();
163  m_PadNumCtrl->SetSelection( -1, -1 );
164 }
165 
166 void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
167 {
168  wxPaintDC dc( m_panelShowPad );
169  PAD_DRAWINFO drawInfo;
170 
172 
173  if( m_dummyPad->GetLayerSet()[F_Cu] )
174  {
176  }
177 
178  if( m_dummyPad->GetLayerSet()[B_Cu] )
179  {
180  color = color.LegacyMix( m_parent->Settings().Colors().GetItemColor( LAYER_PAD_BK ) );
181  }
182 
183  // What could happen: the pad color is *actually* black, or no
184  // copper was selected
185  if( color == BLACK )
186  color = LIGHTGRAY;
187 
188  drawInfo.m_Color = color;
189  drawInfo.m_HoleColor = DARKGRAY;
190  drawInfo.m_Offset = m_dummyPad->GetPosition();
191  drawInfo.m_Display_padnum = true;
192  drawInfo.m_Display_netname = true;
193 
195  drawInfo.m_ShowNotPlatedHole = true;
196 
197  // Shows the local pad clearance
199 
200  wxSize dc_size = dc.GetSize();
201  dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
202 
203  // Calculate a suitable scale to fit the available draw area
204  int dim = m_dummyPad->GetBoundingRadius() *2;
205 
206  // Invalid x size. User could enter zero, or have deleted all text prior to
207  // entering a new value; this is also treated as zero. If dim is left at
208  // zero, the drawing scale is zero and we get a crash.
209  if( dim == 0 )
210  {
211  // If drill size has been set, use that. Otherwise default to 1mm.
212  dim = m_dummyPad->GetDrillSize().x;
213  if( dim == 0 )
214  dim = Millimeter2iu( 1.0 );
215  }
216 
217  if( m_dummyPad->GetLocalClearance() > 0 )
218  dim += m_dummyPad->GetLocalClearance() * 2;
219 
220  double scale = (double) dc_size.x / dim;
221 
222  // If the pad is a circle, use the x size here instead.
223  int ysize;
225  ysize = m_dummyPad->GetSize().x;
226  else
227  ysize = m_dummyPad->GetSize().y;
228 
229  dim = ysize + std::abs( m_dummyPad->GetDelta().x );
230 
231  // Invalid y size. See note about x size above.
232  if( dim == 0 )
233  {
234  dim = m_dummyPad->GetDrillSize().y;
235  if( dim == 0 )
236  dim = Millimeter2iu( 0.1 );
237  }
238 
239  if( m_dummyPad->GetLocalClearance() > 0 )
240  dim += m_dummyPad->GetLocalClearance() * 2;
241 
242  double altscale = (double) dc_size.y / dim;
243  scale = std::min( scale, altscale );
244 
245  // Give a margin
246  scale *= 0.7;
247  dc.SetUserScale( scale, scale );
248 
249  GRResetPenAndBrush( &dc );
250  m_dummyPad->DrawShape( NULL, &dc, drawInfo );
251 
252  // Draw X and Y axis. Hhis is particularly useful to show the
253  // reference position of pads with offset and no hole, or custom pad shapes
254  const int linethickness = 0;
255  GRLine( NULL, &dc, -int( dc_size.x/scale ), 0, int( dc_size.x/scale ), 0,
256  linethickness, LIGHTBLUE ); // X axis
257  GRLine( NULL, &dc, 0, -int( dc_size.y/scale ), 0, int( dc_size.y/scale ),
258  linethickness, LIGHTBLUE ); // Y axis
259 
260  event.Skip();
261 }
262 
263 
265 {
266  // Note:
267  // To avoid generating a wxEVT_TEXT event from m_tcCornerSizeRatio
268  // we use ChangeValue instead of SetValue, to set the displayed string
270  {
271  m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f",
275  }
276  else if( m_dummyPad->GetShape() == PAD_SHAPE_RECT )
277  {
278  m_tcCornerSizeRatio->ChangeValue( "0" );
279  m_staticTextCornerRadiusValue->SetLabel( "0" );
280  }
281  else
282  {
283  m_tcCornerSizeRatio->ChangeValue( wxEmptyString );
284  m_staticTextCornerRadiusValue->SetLabel( wxEmptyString );
285  }
286 }
287 
288 
290 {
292  return;
293 
294  wxString value = m_tcCornerSizeRatio->GetValue();
295  double rrRadiusRatioPercent;
296 
297  if( value.ToDouble( &rrRadiusRatioPercent ) )
298  {
299  // Clamp rrRadiusRatioPercent to acceptable value (0.0 to 50.0)
300  if( rrRadiusRatioPercent < 0.0 )
301  {
302  rrRadiusRatioPercent = 0.0;
303  m_tcCornerSizeRatio->ChangeValue( "0.0" );
304  }
305 
306  if( rrRadiusRatioPercent > 50.0 )
307  {
308  rrRadiusRatioPercent = 0.5;
309  m_tcCornerSizeRatio->ChangeValue( "50.0" );
310  }
311 
315  redraw();
316  }
317 }
318 
319 
321 {
322  wxString msg;
323  double angle;
324 
325  // Disable pad net name wxTextCtrl if the caller is the footprint editor
326  // because nets are living only in the board managed by the board editor
328 
329 
330  // Setup layers names from board
331  // Should be made first, before calling m_rbCopperLayersSel->SetSelection()
332  m_rbCopperLayersSel->SetString( 0, m_board->GetLayerName( F_Cu ) );
333  m_rbCopperLayersSel->SetString( 1, m_board->GetLayerName( B_Cu ) );
334 
335  m_PadLayerAdhCmp->SetLabel( m_board->GetLayerName( F_Adhes ) );
336  m_PadLayerAdhCu->SetLabel( m_board->GetLayerName( B_Adhes ) );
338  m_PadLayerPateCu->SetLabel( m_board->GetLayerName( B_Paste ) );
340  m_PadLayerSilkCu->SetLabel( m_board->GetLayerName( B_SilkS ) );
341  m_PadLayerMaskCmp->SetLabel( m_board->GetLayerName( F_Mask ) );
342  m_PadLayerMaskCu->SetLabel( m_board->GetLayerName( B_Mask ) );
343  m_PadLayerECO1->SetLabel( m_board->GetLayerName( Eco1_User ) );
344  m_PadLayerECO2->SetLabel( m_board->GetLayerName( Eco2_User ) );
346 
347  m_isFlipped = false;
348 
349  if( m_currentPad )
350  {
352 
353  if( m_isFlipped )
354  m_staticModuleSideValue->SetLabel( _( "Back side (footprint is mirrored)" ) );
355 
356  // Diplay footprint rotation ( angles are in 0.1 degree )
357  MODULE* footprint = m_currentPad->GetParent();
358 
359  if( footprint )
360  msg.Printf( "%.1f", footprint->GetOrientationDegrees() );
361  else
362  msg = _("No footprint" );
363 
364  m_staticModuleRotValue->SetLabel( msg );
365  }
366 
367  if( m_isFlipped )
368  {
369  wxPoint pt = m_dummyPad->GetOffset();
370  pt.y = -pt.y;
371  m_dummyPad->SetOffset( pt );
372 
373  wxSize sz = m_dummyPad->GetDelta();
374  sz.y = -sz.y;
375  m_dummyPad->SetDelta( sz );
376 
377  // flip pad's layers
379  }
380 
382 
383  m_PadNumCtrl->SetValue( m_dummyPad->GetPadName() );
384  m_PadNetNameCtrl->SetValue( m_dummyPad->GetNetname() );
385 
386  // Set the unit name in dialog:
387  wxStaticText* unitTexts[] =
388  {
396  };
397 
398  for( unsigned ii = 0; ii < DIM( unitTexts ); ++ii )
399  unitTexts[ii]->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
400 
401  // Display current pad parameters units:
404 
407 
410 
413 
414  if( m_dummyPad->GetDelta().x )
415  {
417  m_trapDeltaDirChoice->SetSelection( 0 );
418  }
419  else
420  {
422  m_trapDeltaDirChoice->SetSelection( 1 );
423  }
424 
426 
431 
432  // These 2 parameters are usually < 0, so prepare entering a negative value, if current is 0
434 
436  m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->GetValue() );
437 
438  msg.Printf( wxT( "%f" ), m_dummyPad->GetLocalSolderPasteMarginRatio() * 100.0 );
439 
440  if( m_dummyPad->GetLocalSolderPasteMarginRatio() == 0.0 && msg[0] == '0' )
441  // Sometimes Printf adds a sign if the value is small
442  m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
443  else
444  m_SolderPasteMarginRatioCtrl->SetValue( msg );
445 
446  switch( m_dummyPad->GetZoneConnection() )
447  {
448  default:
450  m_ZoneConnectionChoice->SetSelection( 0 );
451  break;
452 
453  case PAD_ZONE_CONN_FULL:
454  m_ZoneConnectionChoice->SetSelection( 1 );
455  break;
456 
458  m_ZoneConnectionChoice->SetSelection( 2 );
459  break;
460 
461  case PAD_ZONE_CONN_NONE:
462  m_ZoneConnectionChoice->SetSelection( 3 );
463  break;
464  }
465 
466  if( m_currentPad )
467  {
468  angle = m_currentPad->GetOrientation();
469  MODULE* footprint = m_currentPad->GetParent();
470 
471  if( footprint )
472  angle -= footprint->GetOrientation();
473 
474  if( m_isFlipped )
475  angle = -angle;
476 
477  m_dummyPad->SetOrientation( angle );
478  }
479 
480  angle = m_dummyPad->GetOrientation();
481 
482  NORMALIZE_ANGLE_180( angle ); // ? normalizing is in D_PAD::SetOrientation()
483 
484  // Set layers used by this pad: :
486 
487  // Pad Orient
488  switch( int( angle ) )
489  {
490  case 0:
491  m_PadOrient->SetSelection( 0 );
492  break;
493 
494  case 900:
495  m_PadOrient->SetSelection( 1 );
496  break;
497 
498  case -900:
499  m_PadOrient->SetSelection( 2 );
500  break;
501 
502  case 1800:
503  case -1800:
504  m_PadOrient->SetSelection( 3 );
505  break;
506 
507  default:
508  m_PadOrient->SetSelection( 4 );
509  break;
510  }
511 
512  switch( m_dummyPad->GetShape() )
513  {
514  default:
515  case PAD_SHAPE_CIRCLE:
516  m_PadShape->SetSelection( CHOICE_SHAPE_CIRCLE );
517  break;
518 
519  case PAD_SHAPE_OVAL:
520  m_PadShape->SetSelection( CHOICE_SHAPE_OVAL );
521  break;
522 
523  case PAD_SHAPE_RECT:
524  m_PadShape->SetSelection( CHOICE_SHAPE_RECT );
525  break;
526 
527  case PAD_SHAPE_TRAPEZOID:
528  m_PadShape->SetSelection( CHOICE_SHAPE_TRAPEZOID );
529  break;
530 
531  case PAD_SHAPE_ROUNDRECT:
532  m_PadShape->SetSelection( CHOICE_SHAPE_ROUNDRECT );
533  break;
534  }
535 
536  m_OrientValue = angle / 10.0;
537 
538  // Type of pad selection
539  m_PadType->SetSelection( 0 );
540 
541  for( unsigned ii = 0; ii < DIM( code_type ); ii++ )
542  {
543  if( code_type[ii] == m_dummyPad->GetAttribute() )
544  {
545  m_PadType->SetSelection( ii );
546  break;
547  }
548  }
549 
550  // Enable/disable Pad name,and pad length die
551  // (disable for NPTH pads (mechanical pads)
553 
554  m_PadNumCtrl->Enable( enable );
555  m_PadNetNameCtrl->Enable( m_canEditNetName && enable && m_currentPad != NULL );
556  m_LengthPadToDieCtrl->Enable( enable );
557 
559  m_DrillShapeCtrl->SetSelection( 0 );
560  else
561  m_DrillShapeCtrl->SetSelection( 1 );
562 
563  // Update some dialog widgets state (Enable/disable options):
564  wxCommandEvent cmd_event;
566  OnDrillShapeSelected( cmd_event );
567  OnPadShapeSelection( cmd_event );
569 }
570 
571 
572 void DIALOG_PAD_PROPERTIES::OnResize( wxSizeEvent& event )
573 {
574  redraw();
575  event.Skip();
576 }
577 
578 
579 void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
580 {
581  switch( m_PadShape->GetSelection() )
582  {
583  case CHOICE_SHAPE_CIRCLE:
584  m_ShapeDelta_Ctrl->Enable( false );
585  m_trapDeltaDirChoice->Enable( false );
586  m_ShapeSize_Y_Ctrl->Enable( false );
587  m_ShapeOffset_X_Ctrl->Enable( false );
588  m_ShapeOffset_Y_Ctrl->Enable( false );
589  break;
590 
591  case CHOICE_SHAPE_OVAL:
592  m_ShapeDelta_Ctrl->Enable( false );
593  m_trapDeltaDirChoice->Enable( false );
594  m_ShapeSize_Y_Ctrl->Enable( true );
595  m_ShapeOffset_X_Ctrl->Enable( true );
596  m_ShapeOffset_Y_Ctrl->Enable( true );
597  break;
598 
599  case CHOICE_SHAPE_RECT:
600  m_ShapeDelta_Ctrl->Enable( false );
601  m_trapDeltaDirChoice->Enable( false );
602  m_ShapeSize_Y_Ctrl->Enable( true );
603  m_ShapeOffset_X_Ctrl->Enable( true );
604  m_ShapeOffset_Y_Ctrl->Enable( true );
605  break;
606 
608  m_ShapeDelta_Ctrl->Enable( true );
609  m_trapDeltaDirChoice->Enable( true );
610  m_ShapeSize_Y_Ctrl->Enable( true );
611  m_ShapeOffset_X_Ctrl->Enable( true );
612  m_ShapeOffset_Y_Ctrl->Enable( true );
613  break;
614 
616  m_ShapeDelta_Ctrl->Enable( false );
617  m_trapDeltaDirChoice->Enable( false );
618  m_ShapeSize_Y_Ctrl->Enable( true );
619  m_ShapeOffset_X_Ctrl->Enable( true );
620  m_ShapeOffset_Y_Ctrl->Enable( true );
621  // Ensure m_tcCornerSizeRatio contains the right value:
622  m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f",
624  break;
625  }
626 
627  // A few widgets are enabled only for rounded rect pads:
628  m_tcCornerSizeRatio->Enable( m_PadShape->GetSelection() == CHOICE_SHAPE_ROUNDRECT );
629 
631 
633  redraw();
634 }
635 
636 
637 void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected( wxCommandEvent& event )
638 {
639  if( m_PadType->GetSelection() == 1 || m_PadType->GetSelection() == 2 )
640  {
641  // pad type = SMD or CONN: no hole allowed
642  m_PadDrill_X_Ctrl->Enable( false );
643  m_PadDrill_Y_Ctrl->Enable( false );
644  }
645  else
646  {
647  switch( m_DrillShapeCtrl->GetSelection() )
648  {
649  case 0: //CIRCLE:
650  m_PadDrill_X_Ctrl->Enable( true );
651  m_PadDrill_Y_Ctrl->Enable( false );
652  break;
653 
654  case 1: //OVALE:
655  m_PadDrill_X_Ctrl->Enable( true );
656  m_PadDrill_Y_Ctrl->Enable( true );
657  break;
658  }
659  }
660 
662  redraw();
663 }
664 
665 
666 void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
667 {
668  switch( m_PadOrient->GetSelection() )
669  {
670  case 0:
672  break;
673 
674  case 1:
675  m_dummyPad->SetOrientation( 900 );
676  break;
677 
678  case 2:
679  m_dummyPad->SetOrientation( -900 );
680  break;
681 
682  case 3:
683  m_dummyPad->SetOrientation( 1800 );
684  break;
685 
686  default:
687  break;
688  }
689 
691  m_OrientValidator.TransferToWindow();
692 
694  redraw();
695 }
696 
697 
698 void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
699 {
700  unsigned ii = m_PadType->GetSelection();
701 
702  if( ii >= DIM( code_type ) ) // catches < 0 also
703  ii = 0;
704 
705  LSET layer_mask = std_pad_layers[ii];
706  setPadLayersList( layer_mask );
707 
708  // Enable/disable drill dialog items:
709  event.SetId( m_DrillShapeCtrl->GetSelection() );
710  OnDrillShapeSelected( event );
711 
712  if( ii == 0 || ii == DIM( code_type )-1 )
713  m_DrillShapeCtrl->Enable( true );
714  else
715  m_DrillShapeCtrl->Enable( false );
716 
717  // Enable/disable Pad name,and pad length die
718  // (disable for NPTH pads (mechanical pads)
719  bool enable = ii != 3;
720  m_PadNumCtrl->Enable( enable );
721  m_PadNetNameCtrl->Enable( m_canEditNetName && enable && m_currentPad != NULL );
722  m_LengthPadToDieCtrl->Enable( enable );
723 }
724 
725 
727 {
728  LSET cu_set = layer_mask & LSET::AllCuMask();
729 
730  if( cu_set == LSET( F_Cu ) )
731  m_rbCopperLayersSel->SetSelection( 0 );
732  else if( cu_set == LSET( B_Cu ) )
733  m_rbCopperLayersSel->SetSelection( 1 );
734  else if( cu_set.any() )
735  m_rbCopperLayersSel->SetSelection( 2 );
736  else
737  m_rbCopperLayersSel->SetSelection( 3 );
738 
739  m_PadLayerAdhCmp->SetValue( layer_mask[F_Adhes] );
740  m_PadLayerAdhCu->SetValue( layer_mask[B_Adhes] );
741 
742  m_PadLayerPateCmp->SetValue( layer_mask[F_Paste] );
743  m_PadLayerPateCu->SetValue( layer_mask[B_Paste] );
744 
745  m_PadLayerSilkCmp->SetValue( layer_mask[F_SilkS] );
746  m_PadLayerSilkCu->SetValue( layer_mask[B_SilkS] );
747 
748  m_PadLayerMaskCmp->SetValue( layer_mask[F_Mask] );
749  m_PadLayerMaskCu->SetValue( layer_mask[B_Mask] );
750 
751  m_PadLayerECO1->SetValue( layer_mask[Eco1_User] );
752  m_PadLayerECO2->SetValue( layer_mask[Eco2_User] );
753 
754  m_PadLayerDraft->SetValue( layer_mask[Dwgs_User] );
755 }
756 
757 
758 // Called when select/deselect a layer.
759 void DIALOG_PAD_PROPERTIES::OnSetLayers( wxCommandEvent& event )
760 {
762  redraw();
763 }
764 
765 
766 // test if all values are acceptable for the pad
768 {
769  bool error = transferDataToPad( m_dummyPad );
770  bool skip_tstoffset = false; // the offset prm is not always tested
771 
772  wxArrayString error_msgs;
773  wxString msg;
774 
775  // Test for incorrect values
776  if( (m_dummyPad->GetSize().x <= 0) ||
777  ((m_dummyPad->GetSize().y <= 0) && (m_dummyPad->GetShape() != PAD_SHAPE_CIRCLE)) )
778  {
779  error_msgs.Add( _( "Pad size must be greater than zero" ) );
780  }
781 
782  if( (m_dummyPad->GetSize().x < m_dummyPad->GetDrillSize().x) ||
783  (m_dummyPad->GetSize().y < m_dummyPad->GetDrillSize().y) )
784  {
785  error_msgs.Add( _( "Incorrect value for pad drill: pad drill bigger than pad size" ) );
786  skip_tstoffset = true; // offset prm will be not tested because if the drill value
787  // is incorrect the offset prm is always seen as incorrect, even if it is 0
788  }
789 
790  LSET padlayers_mask = m_dummyPad->GetLayerSet();
791 
792  if( padlayers_mask == 0 )
793  error_msgs.Add( _( "Error: pad has no layer" ) );
794 
795  if( !padlayers_mask[F_Cu] && !padlayers_mask[B_Cu] )
796  {
798  {
799  // Note: he message is shown in an HTML window
800  msg = _( "Error: the pad is not on a copper layer and has a hole" );
801 
803  {
804  msg += wxT( "<br><br><i>" );
805  msg += _( "For NPTH pad, set pad size value to pad drill value,"
806  " if you do not want this pad plotted in gerber files"
807  );
808  }
809 
810  error_msgs.Add( msg );
811  }
812  }
813 
814  if( !skip_tstoffset )
815  {
816  wxPoint max_size;
817  max_size.x = std::abs( m_dummyPad->GetOffset().x );
818  max_size.y = std::abs( m_dummyPad->GetOffset().y );
819  max_size.x += m_dummyPad->GetDrillSize().x / 2;
820  max_size.y += m_dummyPad->GetDrillSize().y / 2;
821 
822  if( ( m_dummyPad->GetSize().x / 2 < max_size.x ) ||
823  ( m_dummyPad->GetSize().y / 2 < max_size.y ) )
824  {
825  error_msgs.Add( _( "Incorrect value for pad offset" ) );
826  }
827  }
828 
829  if( error )
830  {
831  error_msgs.Add( _( "Too large value for pad delta size" ) );
832  }
833 
834  switch( m_dummyPad->GetAttribute() )
835  {
836  case PAD_ATTRIB_HOLE_NOT_PLATED: // Not plated, but through hole, a hole is expected
837  case PAD_ATTRIB_STANDARD : // Pad through hole, a hole is also expected
838  if( m_dummyPad->GetDrillSize().x <= 0 )
839  error_msgs.Add( _( "Error: Through hole pad: drill diameter set to 0" ) );
840  break;
841 
842  case PAD_ATTRIB_CONN: // Connector pads are smd pads, just they do not have solder paste.
843  if( padlayers_mask[B_Paste] || padlayers_mask[F_Paste] )
844  error_msgs.Add( _( "Error: Connector pads are not on the solder paste layer\n"
845  "Use SMD pads instead" ) );
846  // Fall trough
847  case PAD_ATTRIB_SMD: // SMD and Connector pads (One external copper layer only)
848  {
849  LSET innerlayers_mask = padlayers_mask & LSET::InternalCuMask();
850 
851  if( ( padlayers_mask[F_Cu] && padlayers_mask[B_Cu] ) ||
852  innerlayers_mask.count() != 0 )
853  error_msgs.Add( _( "Error: only one external copper layer allowed for SMD or Connector pads" ) );
854  }
855  break;
856  }
857 
858 
860  {
861  wxString value = m_tcCornerSizeRatio->GetValue();
862  double rrRadiusRatioPercent;
863 
864  if( !value.ToDouble( &rrRadiusRatioPercent ) )
865  error_msgs.Add( _( "Incorrect corner size value" ) );
866  else
867  {
868  if( rrRadiusRatioPercent < 0.0 )
869  error_msgs.Add( _( "Incorrect (negative) corner size value" ) );
870  else if( rrRadiusRatioPercent > 50.0 )
871  error_msgs.Add( _( "Corner size value must be smaller than 50%" ) );
872  }
873  }
874 
875  if( error_msgs.GetCount() )
876  {
877  HTML_MESSAGE_BOX dlg( this, _("Pad setup errors list" ) );
878  dlg.ListSet( error_msgs );
879  dlg.ShowModal();
880  }
881 
882  return error_msgs.GetCount() == 0;
883 }
884 
885 
887 {
888  if( m_parent->IsGalCanvasActive() )
889  {
891 
892  BOX2I bbox = m_dummyPad->ViewBBox();
893 
894  if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
895  {
896  // gives a size to the full drawable area
897  BOX2I drawbox;
898  drawbox.Move( m_dummyPad->GetPosition() );
899  drawbox.Inflate( bbox.GetSize().x*2, bbox.GetSize().y*2 );
900  m_panelShowPadGal->GetView()->SetBoundary( drawbox );
901 
902  // Autozoom
903  m_panelShowPadGal->GetView()->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) );
904 
905  // Add a margin
907 
909  }
910  }
911  else
912  {
913  m_panelShowPad->Refresh();
914  }
915 }
916 
917 
919 {
920  if( !wxDialog::TransferDataToWindow() )
921  return false;
922 
923  if( !m_panelGeneral->TransferDataToWindow() )
924  return false;
925 
926  if( !m_localSettingsPanel->TransferDataToWindow() )
927  return false;
928 
929  return true;
930 }
931 
932 
934 {
935  BOARD_COMMIT commit( m_parent );
936 
937  if( !wxDialog::TransferDataFromWindow() )
938  return false;
939 
940  if( !m_panelGeneral->TransferDataFromWindow() )
941  return false;
942 
943  if( !m_localSettingsPanel->TransferDataFromWindow() )
944  return false;
945 
946  if( !padValuesOK() )
947  return false;
948 
949  bool rastnestIsChanged = false;
950  int isign = m_isFlipped ? -1 : 1;
951 
953  // m_padMaster is a pattern: ensure there is no net for this pad:
955 
956  if( !m_currentPad ) // Set current Pad parameters
957  return true;
958 
959  commit.Modify( m_currentPad );
960 
961  // redraw the area where the pad was, without pad (delete pad on screen)
965 
966  // Update values
969 
971  {
973  rastnestIsChanged = true;
974  }
975 
976  wxSize size;
977  MODULE* footprint = m_currentPad->GetParent();
978 
979  if( footprint )
980  {
981  footprint->SetLastEditTime();
982 
983  // compute the pos 0 value, i.e. pad position for footprint with orientation = 0
984  // i.e. relative to footprint origin (footprint position)
985  wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition();
986  RotatePoint( &pt, -footprint->GetOrientation() );
987  m_currentPad->SetPos0( pt );
989  + footprint->GetOrientation() );
990  }
991 
993 
994  size = m_padMaster->GetDelta();
995  size.y *= isign;
996  m_currentPad->SetDelta( size );
997 
1000 
1001  wxPoint offset = m_padMaster->GetOffset();
1002  offset.y *= isign;
1003  m_currentPad->SetOffset( offset );
1004 
1006 
1008  {
1009  rastnestIsChanged = true;
1011  }
1012 
1013  if( m_isFlipped )
1014  {
1016  }
1017 
1019 
1020  wxString padNetname;
1021 
1022  // For PAD_ATTRIB_HOLE_NOT_PLATED, ensure there is no net name selected
1024  padNetname = m_PadNetNameCtrl->GetValue();
1025 
1026  if( m_currentPad->GetNetname() != padNetname )
1027  {
1028  const NETINFO_ITEM* netinfo = m_board->FindNet( padNetname );
1029 
1030  if( !padNetname.IsEmpty() && netinfo == NULL )
1031  {
1032  DisplayError( NULL, _( "Unknown netname, netname not changed" ) );
1033  }
1034  else if( netinfo )
1035  {
1036  rastnestIsChanged = true;
1037  m_currentPad->SetNetCode( netinfo->GetNet() );
1038  }
1039  }
1040 
1049 
1050  // rounded rect pads with radius ratio = 0 are in fact rect pads.
1051  // So set the right shape (and perhaps issues with a radius = 0)
1054  {
1056  }
1057 
1058  if( footprint )
1059  footprint->CalculateBoundingBox();
1060 
1062 
1063  // redraw the area where the pad was
1065 
1066  commit.Push( _( "Modify pad" ) );
1067 
1068  if( rastnestIsChanged ) // The net ratsnest must be recalculated
1069  m_board->m_Status_Pcb = 0;
1070 
1071  return true;
1072 }
1073 
1074 
1076 {
1077  wxString msg;
1078  int x, y;
1079 
1080  if( !Validate() )
1081  return true;
1082  if( !m_panelGeneral->Validate() )
1083  return true;
1084  if( !m_localSettingsPanel->Validate() )
1085  return true;
1086 
1087  m_OrientValidator.TransferFromWindow();
1088 
1089  aPad->SetAttribute( code_type[m_PadType->GetSelection()] );
1090  aPad->SetShape( code_shape[m_PadShape->GetSelection()] );
1091 
1092 
1093  // Read pad clearances values:
1099  double dtmp = 0.0;
1100  msg = m_SolderPasteMarginRatioCtrl->GetValue();
1101  msg.ToDouble( &dtmp );
1102 
1103  // A -50% margin ratio means no paste on a pad, the ratio must be >= -50%
1104  if( dtmp < -50.0 )
1105  dtmp = -50.0;
1106  // A margin ratio is always <= 0
1107  // 0 means use full pad copper area
1108  if( dtmp > 0.0 )
1109  dtmp = 0.0;
1110 
1111  aPad->SetLocalSolderPasteMarginRatio( dtmp / 100 );
1112 
1113  switch( m_ZoneConnectionChoice->GetSelection() )
1114  {
1115  default:
1116  case 0:
1118  break;
1119 
1120  case 1:
1122  break;
1123 
1124  case 2:
1126  break;
1127 
1128  case 3:
1130  break;
1131  }
1132 
1133  // Read pad position:
1136 
1137  aPad->SetPosition( wxPoint( x, y ) );
1138  aPad->SetPos0( wxPoint( x, y ) );
1139 
1140  // Read pad drill:
1143 
1144  if( m_DrillShapeCtrl->GetSelection() == 0 )
1145  {
1147  y = x;
1148  }
1149  else
1151 
1152  aPad->SetDrillSize( wxSize( x, y ) );
1153 
1154  // Read pad shape size:
1157 
1158  if( aPad->GetShape() == PAD_SHAPE_CIRCLE )
1159  y = x;
1160 
1161  aPad->SetSize( wxSize( x, y ) );
1162 
1163  // Read pad length die
1165 
1166  // For a trapezoid, test delta value (be sure delta is not too large for pad size)
1167  // remember DeltaSize.x is the Y size variation
1168  bool error = false;
1169 
1170  if( aPad->GetShape() == PAD_SHAPE_TRAPEZOID )
1171  {
1172  wxSize delta;
1173 
1174  // For a trapezoid, only one of delta.x or delta.y is not 0, depending on
1175  // the direction.
1176  if( m_trapDeltaDirChoice->GetSelection() == 0 )
1177  delta.x = ValueFromTextCtrl( *m_ShapeDelta_Ctrl );
1178  else
1179  delta.y = ValueFromTextCtrl( *m_ShapeDelta_Ctrl );
1180 
1181  if( delta.x < 0 && delta.x <= -aPad->GetSize().y )
1182  {
1183  delta.x = -aPad->GetSize().y + 2;
1184  error = true;
1185  }
1186 
1187  if( delta.x > 0 && delta.x >= aPad->GetSize().y )
1188  {
1189  delta.x = aPad->GetSize().y - 2;
1190  error = true;
1191  }
1192 
1193  if( delta.y < 0 && delta.y <= -aPad->GetSize().x )
1194  {
1195  delta.y = -aPad->GetSize().x + 2;
1196  error = true;
1197  }
1198 
1199  if( delta.y > 0 && delta.y >= aPad->GetSize().x )
1200  {
1201  delta.y = aPad->GetSize().x - 2;
1202  error = true;
1203  }
1204 
1205  aPad->SetDelta( delta );
1206  }
1207 
1208  // Read pad shape offset:
1211  aPad->SetOffset( wxPoint( x, y ) );
1212 
1213  aPad->SetOrientation( m_OrientValue * 10.0 );
1214 
1215  msg = m_PadNumCtrl->GetValue().Left( 4 );
1216  aPad->SetPadName( msg );
1217 
1218  // Check if user has set an existing net name
1219  const NETINFO_ITEM* netinfo = m_board->FindNet( m_PadNetNameCtrl->GetValue() );
1220 
1221  if( netinfo != NULL )
1222  aPad->SetNetCode( netinfo->GetNet() );
1223  else
1225 
1226  // Clear some values, according to the pad type and shape
1227  switch( aPad->GetShape() )
1228  {
1229  case PAD_SHAPE_CIRCLE:
1230  aPad->SetOffset( wxPoint( 0, 0 ) );
1231  aPad->SetDelta( wxSize( 0, 0 ) );
1232  x = aPad->GetSize().x;
1233  aPad->SetSize( wxSize( x, x ) );
1234  break;
1235 
1236  case PAD_SHAPE_RECT:
1237  aPad->SetDelta( wxSize( 0, 0 ) );
1238  break;
1239 
1240  case PAD_SHAPE_OVAL:
1241  aPad->SetDelta( wxSize( 0, 0 ) );
1242  break;
1243 
1244  case PAD_SHAPE_TRAPEZOID:
1245  break;
1246 
1247  case PAD_SHAPE_ROUNDRECT:
1248  aPad->SetDelta( wxSize( 0, 0 ) );
1249  break;
1250 
1251  default:
1252  ;
1253  }
1254 
1255  switch( aPad->GetAttribute() )
1256  {
1257  case PAD_ATTRIB_STANDARD:
1258  break;
1259 
1260  case PAD_ATTRIB_CONN:
1261  case PAD_ATTRIB_SMD:
1262  // SMD and PAD_ATTRIB_CONN has no hole.
1263  // basically, SMD and PAD_ATTRIB_CONN are same type of pads
1264  // PAD_ATTRIB_CONN has just a default non technical layers that differs from SMD
1265  // and are intended to be used in virtual edge board connectors
1266  // However we can accept a non null offset,
1267  // mainly to allow complex pads build from a set of basic pad shapes
1268  aPad->SetDrillSize( wxSize( 0, 0 ) );
1269  break;
1270 
1272  // Mechanical purpose only:
1273  // no offset, no net name, no pad name allowed
1274  aPad->SetOffset( wxPoint( 0, 0 ) );
1275  aPad->SetPadName( wxEmptyString );
1277  break;
1278 
1279  default:
1280  DisplayError( NULL, wxT( "Error: unknown pad type" ) );
1281  break;
1282  }
1283 
1284  if( aPad->GetShape() == PAD_SHAPE_ROUNDRECT )
1285  {
1286  wxString value = m_tcCornerSizeRatio->GetValue();
1287  double rrRadiusRatioPercent;
1288 
1289  if( value.ToDouble( &rrRadiusRatioPercent ) )
1290  aPad->SetRoundRectRadiusRatio( rrRadiusRatioPercent / 100.0 );
1291  }
1292 
1293  LSET padLayerMask;
1294 
1295  switch( m_rbCopperLayersSel->GetSelection() )
1296  {
1297  case 0:
1298  padLayerMask.set( F_Cu );
1299  break;
1300 
1301  case 1:
1302  padLayerMask.set( B_Cu );
1303  break;
1304 
1305  case 2:
1306  padLayerMask |= LSET::AllCuMask();
1307  break;
1308 
1309  case 3: // No copper layers
1310  break;
1311  }
1312 
1313  if( m_PadLayerAdhCmp->GetValue() )
1314  padLayerMask.set( F_Adhes );
1315 
1316  if( m_PadLayerAdhCu->GetValue() )
1317  padLayerMask.set( B_Adhes );
1318 
1319  if( m_PadLayerPateCmp->GetValue() )
1320  padLayerMask.set( F_Paste );
1321 
1322  if( m_PadLayerPateCu->GetValue() )
1323  padLayerMask.set( B_Paste );
1324 
1325  if( m_PadLayerSilkCmp->GetValue() )
1326  padLayerMask.set( F_SilkS );
1327 
1328  if( m_PadLayerSilkCu->GetValue() )
1329  padLayerMask.set( B_SilkS );
1330 
1331  if( m_PadLayerMaskCmp->GetValue() )
1332  padLayerMask.set( F_Mask );
1333 
1334  if( m_PadLayerMaskCu->GetValue() )
1335  padLayerMask.set( B_Mask );
1336 
1337  if( m_PadLayerECO1->GetValue() )
1338  padLayerMask.set( Eco1_User );
1339 
1340  if( m_PadLayerECO2->GetValue() )
1341  padLayerMask.set( Eco2_User );
1342 
1343  if( m_PadLayerDraft->GetValue() )
1344  padLayerMask.set( Dwgs_User );
1345 
1346  aPad->SetLayerSet( padLayerMask );
1347 
1348  return error;
1349 }
1350 
1351 
1352 void DIALOG_PAD_PROPERTIES::OnValuesChanged( wxCommandEvent& event )
1353 {
1354  if( m_canUpdate )
1355  {
1357  // If the pad size has changed, update the displayed values
1358  // for rounded rect pads
1360 
1361  redraw();
1362  }
1363 }
void OnInitDialog(wxInitDialogEvent &event) override
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:639
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
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
#define DIM(x)
of elements in an array
Definition: macros.h:98
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:196
COMMIT & Modify(EDA_ITEM *aItem)
Modifies a given item in the model.
Definition: commit.h:103
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
DIALOG_PAD_PROPERTIES(PCB_BASE_FRAME *aParent, D_PAD *aPad)
void SetViewport(const BOX2D &aViewport)
Function SetViewport() Sets the visible area of the VIEW.
Definition: view.cpp:513
static LSET StandardMask()
layer set for a through hole pad
Definition: class_pad.cpp:97
bool m_Display_padnum
Definition: class_pad.h:66
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:238
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:63
PAD_ATTR_T
Enum PAD_ATTR_T is the set of pad shapes, used with D_PAD::{Set,Get}Attribute() The double name is fo...
Definition: pad_shapes.h:56
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
Implementation of conversion functions that require both schematic and board internal units...
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition: class_pad.cpp:118
This file is part of the common library.
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition: class_pad.cpp:104
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:352
int GetPadToDieLength() const
Definition: class_pad.h:241
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
Class BOARD to handle a board.
const wxPoint & GetPosition() const override
Definition: class_module.h:155
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:203
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:351
void setPadLayersList(LSET layer_mask)
Function setPadLayersList updates the CheckBox states in pad layers list,.
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:243
MODULE * GetParent() const
Definition: class_pad.h:108
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:59
BOX2< VECTOR2D > BOX2D
Definition: box2.h:469
wxFloatingPointValidator< double > m_OrientValidator
BOARD * GetBoard() const
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:169
void RefreshDrawingRect(const EDA_RECT &aRect, bool aEraseBackground=true)
Function RefreshDrawingRect redraws the contents of aRect in drawing units.
Definition: draw_panel.cpp:306
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:221
bool TransferDataToWindow() override
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:187
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
void NORMALIZE_ANGLE_180(T &Angle)
Definition: trigo.h:292
const wxSize & GetDrillSize() const
Definition: class_pad.h:188
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:462
void SetLastEditTime(time_t aTime)
Definition: class_module.h:282
const Vec & GetSize() const
Definition: box2.h:177
void onCornerSizePercentChange(wxCommandEvent &event) override
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:166
#define abs(a)
Definition: auxiliary.h:84
void SetScale(double aScale)
Function SetScale() Sets the scaling factor.
Definition: view.h:247
smd pads, back layer
static const int delta[8][2]
Definition: solve.cpp:112
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true) override
Executes the changes.
PAD_SHAPE_T
Enum PAD_SHAPE_T is the set of pad shapes, used with D_PAD::{Set,Get}Shape()
Definition: pad_shapes.h:31
void SetBoundary(const BOX2I &aBoundary)
Function SetBoundary() Sets limits for view area.
Definition: view.h:275
static PAD_SHAPE_T code_shape[]
class DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder ...
Pads are not covered.
Definition: zones.h:57
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
dialog pad properties editor.
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin
static PAD_ATTR_T code_type[]
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers. ...
Definition: class_pad.cpp:1231
Class LSET is a set of PCB_LAYER_IDs.
Classes used in Pcbnew, CvPcb and GerbView.
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
double GetOrientationDegrees() const
Definition: class_module.h:161
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589
void OnSetLayers(wxCommandEvent &event) override
void SetZoneConnection(ZoneConnection aType)
Definition: class_pad.h:309
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:773
void OnPaintShowPanel(wxPaintEvent &event) override
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.h:428
double GetOrientation() const
Definition: class_module.h:160
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:175
PCB_GENERAL_SETTINGS & Settings()
void ListSet(const wxString &aList)
Function ListSet Add a list of items.
const wxPoint & GetPosition() const override
Definition: class_pad.h:170
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:479
ZoneConnection GetZoneConnection() const
Definition: class_pad.cpp:610
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:235
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder.
Class DIALOG_PAD_PROPERTIES_BASE.
void SetDrawAtZero(bool aDrawFlag)
Function SetDrawAtZero() Set the draw at zero flag.
int GetThermalWidth() const
Definition: class_pad.cpp:621
void OnResize(wxSizeEvent &event)
void OnPadShapeSelection(wxCommandEvent &event) override
void PadTypeSelected(wxCommandEvent &event) override
int GetThermalGap() const
Definition: class_pad.cpp:632
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:599
void SetThermalWidth(int aWidth)
Definition: class_pad.h:312
COLOR4D m_HoleColor
Definition: class_pad.h:62
const wxSize & GetSize() const
Definition: class_pad.h:182
void SetSize(const wxSize &aSize)
Definition: class_pad.h:181
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
void OnDrillShapeSelected(wxCommandEvent &event) override
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:809
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
bool m_ShowNotPlatedHole
Definition: class_pad.h:71
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:249
void SetPadToDieLength(int aLength)
Definition: class_pad.h:240
Class HTML_MESSAGE_BOX.
int GetNet() const
Function GetNet.
void DrawShape(EDA_RECT *aClipBox, wxDC *aDC, PAD_DRAWINFO &aDrawInfo)
Function DrawShape basic function to draw a pad.
void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1389
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:384
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:60
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
int m_PadClearance
Definition: class_pad.h:64
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:348
bool IsFlipped() const
Definition: class_pad.cpp:124
void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
void UseColorScheme(const COLORS_DESIGN_SETTINGS *aSettings)
Function UseColorScheme Applies layer color settings.
int GetLocalClearance() const
Definition: class_pad.h:246
COLORS_DESIGN_SETTINGS & Colors()
void SetLocalClearance(int aClearance)
Definition: class_pad.h:247
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:252
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:253
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
bool SwitchBackend(GAL_TYPE aGalType) override
Function SwitchBackend Switches method of rendering graphics.
void PutValueInLocalUnits(wxTextCtrl &aTextCtr, int aValue)
Function PutValueInLocalUnits converts aValue from internal units to user units and append the units ...
Definition: base_units.cpp:265
bool TransferDataFromWindow() override
Updates the different parameters for the component being edited.
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:234
Class NETINFO_ITEM handles the data for a net.
Definition: class_netinfo.h:69
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
void PadOrientEvent(wxCommandEvent &event) override
wxPoint m_Offset
Definition: class_pad.h:74
const int scale
smd pads, front layer
const wxString & GetNetname() const
Function GetNetname.
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:450
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 SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:218
static const LSET std_pad_layers[]
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:244
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:214
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
const wxSize & GetDelta() const
Definition: class_pad.h:185
Usual pad.
Definition: pad_shapes.h:58
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
The common library.
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:167
void SetPadName(const wxString &name)
Set the pad name (sometimes called pad number, although it can be an array ref like AA12 the pad name...
Definition: class_pad.cpp:455
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:357
double GetScale() const
Function GetScale()
Definition: view.h:265
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
bool padValuesOK()
test if all values are acceptable for the pad
COLOR4D m_Color
Definition: class_pad.h:60
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:817
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:250
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
Definition: class_pad.cpp:111
wxString GetPadName() const
Definition: class_pad.cpp:433
void InstallPadOptionsFrame(D_PAD *pad)
void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:311
bool IsType(FRAME_T aType) const
Definition: wxstruct.h:217
Module description (excepted pads)
Definition: colors.h:45
bool m_Display_netname
Definition: class_pad.h:67
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:190
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:71
void SetThermalGap(int aGap)
Definition: class_pad.h:315
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
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: class_pad.cpp:181
const wxPoint & GetOffset() const
Definition: class_pad.h:191
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:125
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:184
#define min(a, b)
Definition: auxiliary.h:85
pads are covered by copper
Definition: zones.h:59
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:237
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39