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  {
136  m_panelShowPadGal->Show();
137  m_panelShowPad->Hide();
141  Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) );
142  }
143  else
144  {
145  m_panelShowPad->Show();
146  m_panelShowPadGal->Hide();
147  }
148 
149  initValues();
151 
152  m_sdbSizerOK->SetDefault();
153  m_canUpdate = true;
154 
155  // Now all widgets have the size fixed, call FinishDialogSettings
157 }
158 
159 void DIALOG_PAD_PROPERTIES::OnInitDialog( wxInitDialogEvent& event )
160 {
161  m_PadNumCtrl->SetFocus();
162  m_PadNumCtrl->SetSelection( -1, -1 );
163 }
164 
165 void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
166 {
167  wxPaintDC dc( m_panelShowPad );
168  PAD_DRAWINFO drawInfo;
169 
170  COLOR4D color = COLOR4D::BLACK;
171 
172  if( m_dummyPad->GetLayerSet()[F_Cu] )
173  {
175  }
176 
177  if( m_dummyPad->GetLayerSet()[B_Cu] )
178  {
179  color = color.LegacyMix( m_board->GetVisibleElementColor( PAD_BK_VISIBLE ) );
180  }
181 
182  // What could happen: the pad color is *actually* black, or no
183  // copper was selected
184  if( color == BLACK )
185  color = LIGHTGRAY;
186 
187  drawInfo.m_Color = color;
188  drawInfo.m_HoleColor = DARKGRAY;
189  drawInfo.m_Offset = m_dummyPad->GetPosition();
190  drawInfo.m_Display_padnum = true;
191  drawInfo.m_Display_netname = true;
192 
194  drawInfo.m_ShowNotPlatedHole = true;
195 
196  // Shows the local pad clearance
198 
199  wxSize dc_size = dc.GetSize();
200  dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
201 
202  // Calculate a suitable scale to fit the available draw area
203  int dim = m_dummyPad->GetBoundingRadius() *2;
204 
205  // Invalid x size. User could enter zero, or have deleted all text prior to
206  // entering a new value; this is also treated as zero. If dim is left at
207  // zero, the drawing scale is zero and we get a crash.
208  if( dim == 0 )
209  {
210  // If drill size has been set, use that. Otherwise default to 1mm.
211  dim = m_dummyPad->GetDrillSize().x;
212  if( dim == 0 )
213  dim = Millimeter2iu( 1.0 );
214  }
215 
216  if( m_dummyPad->GetLocalClearance() > 0 )
217  dim += m_dummyPad->GetLocalClearance() * 2;
218 
219  double scale = (double) dc_size.x / dim;
220 
221  // If the pad is a circle, use the x size here instead.
222  int ysize;
224  ysize = m_dummyPad->GetSize().x;
225  else
226  ysize = m_dummyPad->GetSize().y;
227 
228  dim = ysize + std::abs( m_dummyPad->GetDelta().x );
229 
230  // Invalid y size. See note about x size above.
231  if( dim == 0 )
232  {
233  dim = m_dummyPad->GetDrillSize().y;
234  if( dim == 0 )
235  dim = Millimeter2iu( 0.1 );
236  }
237 
238  if( m_dummyPad->GetLocalClearance() > 0 )
239  dim += m_dummyPad->GetLocalClearance() * 2;
240 
241  double altscale = (double) dc_size.y / dim;
242  scale = std::min( scale, altscale );
243 
244  // Give a margin
245  scale *= 0.7;
246  dc.SetUserScale( scale, scale );
247 
248  GRResetPenAndBrush( &dc );
249  m_dummyPad->DrawShape( NULL, &dc, drawInfo );
250 
251  // Draw X and Y axis. Hhis is particularly useful to show the
252  // reference position of pads with offset and no hole, or custom pad shapes
253  const int linethickness = 0;
254  GRLine( NULL, &dc, -int( dc_size.x/scale ), 0, int( dc_size.x/scale ), 0,
255  linethickness, LIGHTBLUE ); // X axis
256  GRLine( NULL, &dc, 0, -int( dc_size.y/scale ), 0, int( dc_size.y/scale ),
257  linethickness, LIGHTBLUE ); // Y axis
258 
259  event.Skip();
260 }
261 
262 
264 {
265  // Note:
266  // To avoid generating a wxEVT_TEXT event from m_tcCornerSizeRatio
267  // we use ChangeValue instead of SetValue, to set the displayed string
269  {
270  m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f",
274  }
275  else if( m_dummyPad->GetShape() == PAD_SHAPE_RECT )
276  {
277  m_tcCornerSizeRatio->ChangeValue( "0" );
278  m_staticTextCornerRadiusValue->SetLabel( "0" );
279  }
280  else
281  {
282  m_tcCornerSizeRatio->ChangeValue( wxEmptyString );
283  m_staticTextCornerRadiusValue->SetLabel( wxEmptyString );
284  }
285 }
286 
287 
289 {
291  return;
292 
293  wxString value = m_tcCornerSizeRatio->GetValue();
294  double rrRadiusRatioPercent;
295 
296  if( value.ToDouble( &rrRadiusRatioPercent ) )
297  {
298  // Clamp rrRadiusRatioPercent to acceptable value (0.0 to 50.0)
299  if( rrRadiusRatioPercent < 0.0 )
300  {
301  rrRadiusRatioPercent = 0.0;
302  m_tcCornerSizeRatio->ChangeValue( "0.0" );
303  }
304 
305  if( rrRadiusRatioPercent > 50.0 )
306  {
307  rrRadiusRatioPercent = 0.5;
308  m_tcCornerSizeRatio->ChangeValue( "50.0" );
309  }
310 
314  redraw();
315  }
316 }
317 
318 
320 {
321  wxString msg;
322  double angle;
323 
324  // Disable pad net name wxTextCtrl if the caller is the footprint editor
325  // because nets are living only in the board managed by the board editor
327 
328 
329  // Setup layers names from board
330  // Should be made first, before calling m_rbCopperLayersSel->SetSelection()
331  m_rbCopperLayersSel->SetString( 0, m_board->GetLayerName( F_Cu ) );
332  m_rbCopperLayersSel->SetString( 1, m_board->GetLayerName( B_Cu ) );
333 
334  m_PadLayerAdhCmp->SetLabel( m_board->GetLayerName( F_Adhes ) );
335  m_PadLayerAdhCu->SetLabel( m_board->GetLayerName( B_Adhes ) );
337  m_PadLayerPateCu->SetLabel( m_board->GetLayerName( B_Paste ) );
339  m_PadLayerSilkCu->SetLabel( m_board->GetLayerName( B_SilkS ) );
340  m_PadLayerMaskCmp->SetLabel( m_board->GetLayerName( F_Mask ) );
341  m_PadLayerMaskCu->SetLabel( m_board->GetLayerName( B_Mask ) );
342  m_PadLayerECO1->SetLabel( m_board->GetLayerName( Eco1_User ) );
343  m_PadLayerECO2->SetLabel( m_board->GetLayerName( Eco2_User ) );
345 
346  m_isFlipped = false;
347 
348  if( m_currentPad )
349  {
351 
352  if( m_isFlipped )
353  m_staticModuleSideValue->SetLabel( _( "Back side (footprint is mirrored)" ) );
354 
355  // Diplay footprint rotation ( angles are in 0.1 degree )
356  MODULE* footprint = m_currentPad->GetParent();
357 
358  if( footprint )
359  msg.Printf( "%.1f", footprint->GetOrientationDegrees() );
360  else
361  msg = _("No footprint" );
362 
363  m_staticModuleRotValue->SetLabel( msg );
364  }
365 
366  if( m_isFlipped )
367  {
368  wxPoint pt = m_dummyPad->GetOffset();
369  pt.y = -pt.y;
370  m_dummyPad->SetOffset( pt );
371 
372  wxSize sz = m_dummyPad->GetDelta();
373  sz.y = -sz.y;
374  m_dummyPad->SetDelta( sz );
375 
376  // flip pad's layers
378  }
379 
381 
382  m_PadNumCtrl->SetValue( m_dummyPad->GetPadName() );
383  m_PadNetNameCtrl->SetValue( m_dummyPad->GetNetname() );
384 
385  // Set the unit name in dialog:
386  wxStaticText* unitTexts[] =
387  {
395  };
396 
397  for( unsigned ii = 0; ii < DIM( unitTexts ); ++ii )
398  unitTexts[ii]->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
399 
400  // Display current pad parameters units:
403 
406 
409 
412 
413  if( m_dummyPad->GetDelta().x )
414  {
416  m_trapDeltaDirChoice->SetSelection( 0 );
417  }
418  else
419  {
421  m_trapDeltaDirChoice->SetSelection( 1 );
422  }
423 
425 
430 
431  // These 2 parameters are usually < 0, so prepare entering a negative value, if current is 0
433 
435  m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->GetValue() );
436 
437  msg.Printf( wxT( "%f" ), m_dummyPad->GetLocalSolderPasteMarginRatio() * 100.0 );
438 
439  if( m_dummyPad->GetLocalSolderPasteMarginRatio() == 0.0 && msg[0] == '0' )
440  // Sometimes Printf adds a sign if the value is small
441  m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
442  else
443  m_SolderPasteMarginRatioCtrl->SetValue( msg );
444 
445  switch( m_dummyPad->GetZoneConnection() )
446  {
447  default:
449  m_ZoneConnectionChoice->SetSelection( 0 );
450  break;
451 
452  case PAD_ZONE_CONN_FULL:
453  m_ZoneConnectionChoice->SetSelection( 1 );
454  break;
455 
457  m_ZoneConnectionChoice->SetSelection( 2 );
458  break;
459 
460  case PAD_ZONE_CONN_NONE:
461  m_ZoneConnectionChoice->SetSelection( 3 );
462  break;
463  }
464 
465  if( m_currentPad )
466  {
467  angle = m_currentPad->GetOrientation();
468  MODULE* footprint = m_currentPad->GetParent();
469 
470  if( footprint )
471  angle -= footprint->GetOrientation();
472 
473  if( m_isFlipped )
474  angle = -angle;
475 
476  m_dummyPad->SetOrientation( angle );
477  }
478 
479  angle = m_dummyPad->GetOrientation();
480 
481  NORMALIZE_ANGLE_180( angle ); // ? normalizing is in D_PAD::SetOrientation()
482 
483  // Set layers used by this pad: :
485 
486  // Pad Orient
487  switch( int( angle ) )
488  {
489  case 0:
490  m_PadOrient->SetSelection( 0 );
491  break;
492 
493  case 900:
494  m_PadOrient->SetSelection( 1 );
495  break;
496 
497  case -900:
498  m_PadOrient->SetSelection( 2 );
499  break;
500 
501  case 1800:
502  case -1800:
503  m_PadOrient->SetSelection( 3 );
504  break;
505 
506  default:
507  m_PadOrient->SetSelection( 4 );
508  break;
509  }
510 
511  switch( m_dummyPad->GetShape() )
512  {
513  default:
514  case PAD_SHAPE_CIRCLE:
515  m_PadShape->SetSelection( CHOICE_SHAPE_CIRCLE );
516  break;
517 
518  case PAD_SHAPE_OVAL:
519  m_PadShape->SetSelection( CHOICE_SHAPE_OVAL );
520  break;
521 
522  case PAD_SHAPE_RECT:
523  m_PadShape->SetSelection( CHOICE_SHAPE_RECT );
524  break;
525 
526  case PAD_SHAPE_TRAPEZOID:
527  m_PadShape->SetSelection( CHOICE_SHAPE_TRAPEZOID );
528  break;
529 
530  case PAD_SHAPE_ROUNDRECT:
531  m_PadShape->SetSelection( CHOICE_SHAPE_ROUNDRECT );
532  break;
533  }
534 
535  m_OrientValue = angle / 10.0;
536 
537  // Type of pad selection
538  m_PadType->SetSelection( 0 );
539 
540  for( unsigned ii = 0; ii < DIM( code_type ); ii++ )
541  {
542  if( code_type[ii] == m_dummyPad->GetAttribute() )
543  {
544  m_PadType->SetSelection( ii );
545  break;
546  }
547  }
548 
549  // Enable/disable Pad name,and pad length die
550  // (disable for NPTH pads (mechanical pads)
552 
553  m_PadNumCtrl->Enable( enable );
554  m_PadNetNameCtrl->Enable( m_canEditNetName && enable && m_currentPad != NULL );
555  m_LengthPadToDieCtrl->Enable( enable );
556 
558  m_DrillShapeCtrl->SetSelection( 0 );
559  else
560  m_DrillShapeCtrl->SetSelection( 1 );
561 
562  // Update some dialog widgets state (Enable/disable options):
563  wxCommandEvent cmd_event;
565  OnDrillShapeSelected( cmd_event );
566  OnPadShapeSelection( cmd_event );
568 }
569 
570 
571 void DIALOG_PAD_PROPERTIES::OnResize( wxSizeEvent& event )
572 {
573  redraw();
574  event.Skip();
575 }
576 
577 
578 void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
579 {
580  switch( m_PadShape->GetSelection() )
581  {
582  case CHOICE_SHAPE_CIRCLE:
583  m_ShapeDelta_Ctrl->Enable( false );
584  m_trapDeltaDirChoice->Enable( false );
585  m_ShapeSize_Y_Ctrl->Enable( false );
586  m_ShapeOffset_X_Ctrl->Enable( false );
587  m_ShapeOffset_Y_Ctrl->Enable( false );
588  break;
589 
590  case CHOICE_SHAPE_OVAL:
591  m_ShapeDelta_Ctrl->Enable( false );
592  m_trapDeltaDirChoice->Enable( false );
593  m_ShapeSize_Y_Ctrl->Enable( true );
594  m_ShapeOffset_X_Ctrl->Enable( true );
595  m_ShapeOffset_Y_Ctrl->Enable( true );
596  break;
597 
598  case CHOICE_SHAPE_RECT:
599  m_ShapeDelta_Ctrl->Enable( false );
600  m_trapDeltaDirChoice->Enable( false );
601  m_ShapeSize_Y_Ctrl->Enable( true );
602  m_ShapeOffset_X_Ctrl->Enable( true );
603  m_ShapeOffset_Y_Ctrl->Enable( true );
604  break;
605 
607  m_ShapeDelta_Ctrl->Enable( true );
608  m_trapDeltaDirChoice->Enable( true );
609  m_ShapeSize_Y_Ctrl->Enable( true );
610  m_ShapeOffset_X_Ctrl->Enable( true );
611  m_ShapeOffset_Y_Ctrl->Enable( true );
612  break;
613 
615  m_ShapeDelta_Ctrl->Enable( false );
616  m_trapDeltaDirChoice->Enable( false );
617  m_ShapeSize_Y_Ctrl->Enable( true );
618  m_ShapeOffset_X_Ctrl->Enable( true );
619  m_ShapeOffset_Y_Ctrl->Enable( true );
620  // Ensure m_tcCornerSizeRatio contains the right value:
621  m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f",
623  break;
624  }
625 
626  // A few widgets are enabled only for rounded rect pads:
627  m_tcCornerSizeRatio->Enable( m_PadShape->GetSelection() == CHOICE_SHAPE_ROUNDRECT );
628 
630 
632  redraw();
633 }
634 
635 
636 void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected( wxCommandEvent& event )
637 {
638  if( m_PadType->GetSelection() == 1 || m_PadType->GetSelection() == 2 )
639  {
640  // pad type = SMD or CONN: no hole allowed
641  m_PadDrill_X_Ctrl->Enable( false );
642  m_PadDrill_Y_Ctrl->Enable( false );
643  }
644  else
645  {
646  switch( m_DrillShapeCtrl->GetSelection() )
647  {
648  case 0: //CIRCLE:
649  m_PadDrill_X_Ctrl->Enable( true );
650  m_PadDrill_Y_Ctrl->Enable( false );
651  break;
652 
653  case 1: //OVALE:
654  m_PadDrill_X_Ctrl->Enable( true );
655  m_PadDrill_Y_Ctrl->Enable( true );
656  break;
657  }
658  }
659 
661  redraw();
662 }
663 
664 
665 void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
666 {
667  switch( m_PadOrient->GetSelection() )
668  {
669  case 0:
671  break;
672 
673  case 1:
674  m_dummyPad->SetOrientation( 900 );
675  break;
676 
677  case 2:
678  m_dummyPad->SetOrientation( -900 );
679  break;
680 
681  case 3:
682  m_dummyPad->SetOrientation( 1800 );
683  break;
684 
685  default:
686  break;
687  }
688 
690  m_OrientValidator.TransferToWindow();
691 
693  redraw();
694 }
695 
696 
697 void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
698 {
699  unsigned ii = m_PadType->GetSelection();
700 
701  if( ii >= DIM( code_type ) ) // catches < 0 also
702  ii = 0;
703 
704  LSET layer_mask = std_pad_layers[ii];
705  setPadLayersList( layer_mask );
706 
707  // Enable/disable drill dialog items:
708  event.SetId( m_DrillShapeCtrl->GetSelection() );
709  OnDrillShapeSelected( event );
710 
711  if( ii == 0 || ii == DIM( code_type )-1 )
712  m_DrillShapeCtrl->Enable( true );
713  else
714  m_DrillShapeCtrl->Enable( false );
715 
716  // Enable/disable Pad name,and pad length die
717  // (disable for NPTH pads (mechanical pads)
718  bool enable = ii != 3;
719  m_PadNumCtrl->Enable( enable );
720  m_PadNetNameCtrl->Enable( m_canEditNetName && enable && m_currentPad != NULL );
721  m_LengthPadToDieCtrl->Enable( enable );
722 }
723 
724 
726 {
727  LSET cu_set = layer_mask & LSET::AllCuMask();
728 
729  if( cu_set == LSET( F_Cu ) )
730  m_rbCopperLayersSel->SetSelection( 0 );
731  else if( cu_set == LSET( B_Cu ) )
732  m_rbCopperLayersSel->SetSelection( 1 );
733  else if( cu_set.any() )
734  m_rbCopperLayersSel->SetSelection( 2 );
735  else
736  m_rbCopperLayersSel->SetSelection( 3 );
737 
738  m_PadLayerAdhCmp->SetValue( layer_mask[F_Adhes] );
739  m_PadLayerAdhCu->SetValue( layer_mask[B_Adhes] );
740 
741  m_PadLayerPateCmp->SetValue( layer_mask[F_Paste] );
742  m_PadLayerPateCu->SetValue( layer_mask[B_Paste] );
743 
744  m_PadLayerSilkCmp->SetValue( layer_mask[F_SilkS] );
745  m_PadLayerSilkCu->SetValue( layer_mask[B_SilkS] );
746 
747  m_PadLayerMaskCmp->SetValue( layer_mask[F_Mask] );
748  m_PadLayerMaskCu->SetValue( layer_mask[B_Mask] );
749 
750  m_PadLayerECO1->SetValue( layer_mask[Eco1_User] );
751  m_PadLayerECO2->SetValue( layer_mask[Eco2_User] );
752 
753  m_PadLayerDraft->SetValue( layer_mask[Dwgs_User] );
754 }
755 
756 
757 // Called when select/deselect a layer.
758 void DIALOG_PAD_PROPERTIES::OnSetLayers( wxCommandEvent& event )
759 {
761  redraw();
762 }
763 
764 
765 // test if all values are acceptable for the pad
767 {
768  bool error = transferDataToPad( m_dummyPad );
769  bool skip_tstoffset = false; // the offset prm is not always tested
770 
771  wxArrayString error_msgs;
772  wxString msg;
773 
774  // Test for incorrect values
775  if( (m_dummyPad->GetSize().x <= 0) ||
776  ((m_dummyPad->GetSize().y <= 0) && (m_dummyPad->GetShape() != PAD_SHAPE_CIRCLE)) )
777  {
778  error_msgs.Add( _( "Pad size must be greater than zero" ) );
779  }
780 
781  if( (m_dummyPad->GetSize().x < m_dummyPad->GetDrillSize().x) ||
782  (m_dummyPad->GetSize().y < m_dummyPad->GetDrillSize().y) )
783  {
784  error_msgs.Add( _( "Incorrect value for pad drill: pad drill bigger than pad size" ) );
785  skip_tstoffset = true; // offset prm will be not tested because if the drill value
786  // is incorrect the offset prm is always seen as incorrect, even if it is 0
787  }
788 
789  LSET padlayers_mask = m_dummyPad->GetLayerSet();
790 
791  if( padlayers_mask == 0 )
792  error_msgs.Add( _( "Error: pad has no layer" ) );
793 
794  if( !padlayers_mask[F_Cu] && !padlayers_mask[B_Cu] )
795  {
797  {
798  // Note: he message is shown in an HTML window
799  msg = _( "Error: the pad is not on a copper layer and has a hole" );
800 
802  {
803  msg += wxT( "<br><br><i>" );
804  msg += _( "For NPTH pad, set pad size value to pad drill value,"
805  " if you do not want this pad plotted in gerber files"
806  );
807  }
808 
809  error_msgs.Add( msg );
810  }
811  }
812 
813  if( !skip_tstoffset )
814  {
815  wxPoint max_size;
816  max_size.x = std::abs( m_dummyPad->GetOffset().x );
817  max_size.y = std::abs( m_dummyPad->GetOffset().y );
818  max_size.x += m_dummyPad->GetDrillSize().x / 2;
819  max_size.y += m_dummyPad->GetDrillSize().y / 2;
820 
821  if( ( m_dummyPad->GetSize().x / 2 < max_size.x ) ||
822  ( m_dummyPad->GetSize().y / 2 < max_size.y ) )
823  {
824  error_msgs.Add( _( "Incorrect value for pad offset" ) );
825  }
826  }
827 
828  if( error )
829  {
830  error_msgs.Add( _( "Too large value for pad delta size" ) );
831  }
832 
833  switch( m_dummyPad->GetAttribute() )
834  {
835  case PAD_ATTRIB_HOLE_NOT_PLATED: // Not plated, but through hole, a hole is expected
836  case PAD_ATTRIB_STANDARD : // Pad through hole, a hole is also expected
837  if( m_dummyPad->GetDrillSize().x <= 0 )
838  error_msgs.Add( _( "Error: Through hole pad: drill diameter set to 0" ) );
839  break;
840 
841  case PAD_ATTRIB_CONN: // Connector pads are smd pads, just they do not have solder paste.
842  if( padlayers_mask[B_Paste] || padlayers_mask[F_Paste] )
843  error_msgs.Add( _( "Error: Connector pads are not on the solder paste layer\n"
844  "Use SMD pads instead" ) );
845  // Fall trough
846  case PAD_ATTRIB_SMD: // SMD and Connector pads (One external copper layer only)
847  {
848  LSET innerlayers_mask = padlayers_mask & LSET::InternalCuMask();
849 
850  if( ( padlayers_mask[F_Cu] && padlayers_mask[B_Cu] ) ||
851  innerlayers_mask.count() != 0 )
852  error_msgs.Add( _( "Error: only one external copper layer allowed for SMD or Connector pads" ) );
853  }
854  break;
855  }
856 
857 
859  {
860  wxString value = m_tcCornerSizeRatio->GetValue();
861  double rrRadiusRatioPercent;
862 
863  if( !value.ToDouble( &rrRadiusRatioPercent ) )
864  error_msgs.Add( _( "Incorrect corner size value" ) );
865  else
866  {
867  if( rrRadiusRatioPercent < 0.0 )
868  error_msgs.Add( _( "Incorrect (negative) corner size value" ) );
869  else if( rrRadiusRatioPercent > 50.0 )
870  error_msgs.Add( _( "Corner size value must be smaller than 50%" ) );
871  }
872  }
873 
874  if( error_msgs.GetCount() )
875  {
876  HTML_MESSAGE_BOX dlg( this, _("Pad setup errors list" ) );
877  dlg.ListSet( error_msgs );
878  dlg.ShowModal();
879  }
880 
881  return error_msgs.GetCount() == 0;
882 }
883 
884 
886 {
887  if( m_parent->IsGalCanvasActive() )
888  {
890 
891  BOX2I bbox = m_dummyPad->ViewBBox();
892 
893  if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
894  {
895  // gives a size to the full drawable area
896  BOX2I drawbox;
897  drawbox.Move( m_dummyPad->GetPosition() );
898  drawbox.Inflate( bbox.GetSize().x*2, bbox.GetSize().y*2 );
899  m_panelShowPadGal->GetView()->SetBoundary( drawbox );
900 
901  // Autozoom
902  m_panelShowPadGal->GetView()->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) );
903 
904  // Add a margin
906 
908  }
909  }
910  else
911  {
912  m_panelShowPad->Refresh();
913  }
914 }
915 
916 
918 {
919  if( !wxDialog::TransferDataToWindow() )
920  return false;
921 
922  if( !m_panelGeneral->TransferDataToWindow() )
923  return false;
924 
925  if( !m_localSettingsPanel->TransferDataToWindow() )
926  return false;
927 
928  return true;
929 }
930 
931 
933 {
934  BOARD_COMMIT commit( m_parent );
935 
936  if( !wxDialog::TransferDataFromWindow() )
937  return false;
938 
939  if( !m_panelGeneral->TransferDataFromWindow() )
940  return false;
941 
942  if( !m_localSettingsPanel->TransferDataFromWindow() )
943  return false;
944 
945  if( !padValuesOK() )
946  return false;
947 
948  bool rastnestIsChanged = false;
949  int isign = m_isFlipped ? -1 : 1;
950 
952  // m_padMaster is a pattern: ensure there is no net for this pad:
954 
955  if( !m_currentPad ) // Set current Pad parameters
956  return true;
957 
958  commit.Modify( m_currentPad );
959 
960  // redraw the area where the pad was, without pad (delete pad on screen)
964 
965  // Update values
968 
970  {
972  rastnestIsChanged = true;
973  }
974 
975  wxSize size;
976  MODULE* footprint = m_currentPad->GetParent();
977 
978  if( footprint )
979  {
980  footprint->SetLastEditTime();
981 
982  // compute the pos 0 value, i.e. pad position for footprint with orientation = 0
983  // i.e. relative to footprint origin (footprint position)
984  wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition();
985  RotatePoint( &pt, -footprint->GetOrientation() );
986  m_currentPad->SetPos0( pt );
988  + footprint->GetOrientation() );
989  }
990 
992 
993  size = m_padMaster->GetDelta();
994  size.y *= isign;
995  m_currentPad->SetDelta( size );
996 
999 
1000  wxPoint offset = m_padMaster->GetOffset();
1001  offset.y *= isign;
1002  m_currentPad->SetOffset( offset );
1003 
1005 
1007  {
1008  rastnestIsChanged = true;
1010  }
1011 
1012  if( m_isFlipped )
1013  {
1015  }
1016 
1018 
1019  wxString padNetname;
1020 
1021  // For PAD_ATTRIB_HOLE_NOT_PLATED, ensure there is no net name selected
1023  padNetname = m_PadNetNameCtrl->GetValue();
1024 
1025  if( m_currentPad->GetNetname() != padNetname )
1026  {
1027  const NETINFO_ITEM* netinfo = m_board->FindNet( padNetname );
1028 
1029  if( !padNetname.IsEmpty() && netinfo == NULL )
1030  {
1031  DisplayError( NULL, _( "Unknown netname, netname not changed" ) );
1032  }
1033  else if( netinfo )
1034  {
1035  rastnestIsChanged = true;
1036  m_currentPad->SetNetCode( netinfo->GetNet() );
1037  }
1038  }
1039 
1048 
1049  // rounded rect pads with radius ratio = 0 are in fact rect pads.
1050  // So set the right shape (and perhaps issues with a radius = 0)
1053  {
1055  }
1056 
1057  footprint->CalculateBoundingBox();
1059 
1060  // redraw the area where the pad was
1062 
1063  commit.Push( _( "Modify pad" ) );
1064 
1065  if( rastnestIsChanged ) // The net ratsnest must be recalculated
1066  m_board->m_Status_Pcb = 0;
1067 
1068  return true;
1069 }
1070 
1071 
1073 {
1074  wxString msg;
1075  int x, y;
1076 
1077  if( !Validate() )
1078  return true;
1079  if( !m_panelGeneral->Validate() )
1080  return true;
1081  if( !m_localSettingsPanel->Validate() )
1082  return true;
1083 
1084  m_OrientValidator.TransferFromWindow();
1085 
1086  aPad->SetAttribute( code_type[m_PadType->GetSelection()] );
1087  aPad->SetShape( code_shape[m_PadShape->GetSelection()] );
1088 
1089 
1090  // Read pad clearances values:
1096  double dtmp = 0.0;
1097  msg = m_SolderPasteMarginRatioCtrl->GetValue();
1098  msg.ToDouble( &dtmp );
1099 
1100  // A -50% margin ratio means no paste on a pad, the ratio must be >= -50%
1101  if( dtmp < -50.0 )
1102  dtmp = -50.0;
1103  // A margin ratio is always <= 0
1104  // 0 means use full pad copper area
1105  if( dtmp > 0.0 )
1106  dtmp = 0.0;
1107 
1108  aPad->SetLocalSolderPasteMarginRatio( dtmp / 100 );
1109 
1110  switch( m_ZoneConnectionChoice->GetSelection() )
1111  {
1112  default:
1113  case 0:
1115  break;
1116 
1117  case 1:
1119  break;
1120 
1121  case 2:
1123  break;
1124 
1125  case 3:
1127  break;
1128  }
1129 
1130  // Read pad position:
1133 
1134  aPad->SetPosition( wxPoint( x, y ) );
1135  aPad->SetPos0( wxPoint( x, y ) );
1136 
1137  // Read pad drill:
1140 
1141  if( m_DrillShapeCtrl->GetSelection() == 0 )
1142  {
1144  y = x;
1145  }
1146  else
1148 
1149  aPad->SetDrillSize( wxSize( x, y ) );
1150 
1151  // Read pad shape size:
1154 
1155  if( aPad->GetShape() == PAD_SHAPE_CIRCLE )
1156  y = x;
1157 
1158  aPad->SetSize( wxSize( x, y ) );
1159 
1160  // Read pad length die
1162 
1163  // For a trapezoid, test delta value (be sure delta is not too large for pad size)
1164  // remember DeltaSize.x is the Y size variation
1165  bool error = false;
1166 
1167  if( aPad->GetShape() == PAD_SHAPE_TRAPEZOID )
1168  {
1169  wxSize delta;
1170 
1171  // For a trapezoid, only one of delta.x or delta.y is not 0, depending on
1172  // the direction.
1173  if( m_trapDeltaDirChoice->GetSelection() == 0 )
1174  delta.x = ValueFromTextCtrl( *m_ShapeDelta_Ctrl );
1175  else
1176  delta.y = ValueFromTextCtrl( *m_ShapeDelta_Ctrl );
1177 
1178  if( delta.x < 0 && delta.x <= -aPad->GetSize().y )
1179  {
1180  delta.x = -aPad->GetSize().y + 2;
1181  error = true;
1182  }
1183 
1184  if( delta.x > 0 && delta.x >= aPad->GetSize().y )
1185  {
1186  delta.x = aPad->GetSize().y - 2;
1187  error = true;
1188  }
1189 
1190  if( delta.y < 0 && delta.y <= -aPad->GetSize().x )
1191  {
1192  delta.y = -aPad->GetSize().x + 2;
1193  error = true;
1194  }
1195 
1196  if( delta.y > 0 && delta.y >= aPad->GetSize().x )
1197  {
1198  delta.y = aPad->GetSize().x - 2;
1199  error = true;
1200  }
1201 
1202  aPad->SetDelta( delta );
1203  }
1204 
1205  // Read pad shape offset:
1208  aPad->SetOffset( wxPoint( x, y ) );
1209 
1210  aPad->SetOrientation( m_OrientValue * 10.0 );
1211 
1212  msg = m_PadNumCtrl->GetValue().Left( 4 );
1213  aPad->SetPadName( msg );
1214 
1215  // Check if user has set an existing net name
1216  const NETINFO_ITEM* netinfo = m_board->FindNet( m_PadNetNameCtrl->GetValue() );
1217 
1218  if( netinfo != NULL )
1219  aPad->SetNetCode( netinfo->GetNet() );
1220  else
1222 
1223  // Clear some values, according to the pad type and shape
1224  switch( aPad->GetShape() )
1225  {
1226  case PAD_SHAPE_CIRCLE:
1227  aPad->SetOffset( wxPoint( 0, 0 ) );
1228  aPad->SetDelta( wxSize( 0, 0 ) );
1229  x = aPad->GetSize().x;
1230  aPad->SetSize( wxSize( x, x ) );
1231  break;
1232 
1233  case PAD_SHAPE_RECT:
1234  aPad->SetDelta( wxSize( 0, 0 ) );
1235  break;
1236 
1237  case PAD_SHAPE_OVAL:
1238  aPad->SetDelta( wxSize( 0, 0 ) );
1239  break;
1240 
1241  case PAD_SHAPE_TRAPEZOID:
1242  break;
1243 
1244  case PAD_SHAPE_ROUNDRECT:
1245  aPad->SetDelta( wxSize( 0, 0 ) );
1246  break;
1247 
1248  default:
1249  ;
1250  }
1251 
1252  switch( aPad->GetAttribute() )
1253  {
1254  case PAD_ATTRIB_STANDARD:
1255  break;
1256 
1257  case PAD_ATTRIB_CONN:
1258  case PAD_ATTRIB_SMD:
1259  // SMD and PAD_ATTRIB_CONN has no hole.
1260  // basically, SMD and PAD_ATTRIB_CONN are same type of pads
1261  // PAD_ATTRIB_CONN has just a default non technical layers that differs from SMD
1262  // and are intended to be used in virtual edge board connectors
1263  // However we can accept a non null offset,
1264  // mainly to allow complex pads build from a set of basic pad shapes
1265  aPad->SetDrillSize( wxSize( 0, 0 ) );
1266  break;
1267 
1269  // Mechanical purpose only:
1270  // no offset, no net name, no pad name allowed
1271  aPad->SetOffset( wxPoint( 0, 0 ) );
1272  aPad->SetPadName( wxEmptyString );
1274  break;
1275 
1276  default:
1277  DisplayError( NULL, wxT( "Error: unknown pad type" ) );
1278  break;
1279  }
1280 
1281  if( aPad->GetShape() == PAD_SHAPE_ROUNDRECT )
1282  {
1283  wxString value = m_tcCornerSizeRatio->GetValue();
1284  double rrRadiusRatioPercent;
1285 
1286  if( value.ToDouble( &rrRadiusRatioPercent ) )
1287  aPad->SetRoundRectRadiusRatio( rrRadiusRatioPercent / 100.0 );
1288  }
1289 
1290  LSET padLayerMask;
1291 
1292  switch( m_rbCopperLayersSel->GetSelection() )
1293  {
1294  case 0:
1295  padLayerMask.set( F_Cu );
1296  break;
1297 
1298  case 1:
1299  padLayerMask.set( B_Cu );
1300  break;
1301 
1302  case 2:
1303  padLayerMask |= LSET::AllCuMask();
1304  break;
1305 
1306  case 3: // No copper layers
1307  break;
1308  }
1309 
1310  if( m_PadLayerAdhCmp->GetValue() )
1311  padLayerMask.set( F_Adhes );
1312 
1313  if( m_PadLayerAdhCu->GetValue() )
1314  padLayerMask.set( B_Adhes );
1315 
1316  if( m_PadLayerPateCmp->GetValue() )
1317  padLayerMask.set( F_Paste );
1318 
1319  if( m_PadLayerPateCu->GetValue() )
1320  padLayerMask.set( B_Paste );
1321 
1322  if( m_PadLayerSilkCmp->GetValue() )
1323  padLayerMask.set( F_SilkS );
1324 
1325  if( m_PadLayerSilkCu->GetValue() )
1326  padLayerMask.set( B_SilkS );
1327 
1328  if( m_PadLayerMaskCmp->GetValue() )
1329  padLayerMask.set( F_Mask );
1330 
1331  if( m_PadLayerMaskCu->GetValue() )
1332  padLayerMask.set( B_Mask );
1333 
1334  if( m_PadLayerECO1->GetValue() )
1335  padLayerMask.set( Eco1_User );
1336 
1337  if( m_PadLayerECO2->GetValue() )
1338  padLayerMask.set( Eco2_User );
1339 
1340  if( m_PadLayerDraft->GetValue() )
1341  padLayerMask.set( Dwgs_User );
1342 
1343  aPad->SetLayerSet( padLayerMask );
1344 
1345  return error;
1346 }
1347 
1348 
1349 void DIALOG_PAD_PROPERTIES::OnValuesChanged( wxCommandEvent& event )
1350 {
1351  if( m_canUpdate )
1352  {
1354  // If the pad size has changed, update the displayed values
1355  // for rounded rect pads
1357 
1358  redraw();
1359  }
1360 }
void OnInitDialog(wxInitDialogEvent &event) override
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu LAYER_IDs.
Definition: lset.cpp:638
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:490
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:512
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:143
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:269
const wxString GetLayerName(LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
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
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
dialog pad properties editor.
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin
static PAD_ATTR_T code_type[]
virtual const BOX2I ViewBBox() const override
Definition: class_pad.cpp:997
Class LSET is a set of 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:148
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:751
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:147
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:175
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:559
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
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.
COLORS_DESIGN_SETTINGS * GetColorsSettings() const
Function GetColorSettings.
Definition: class_board.h:561
int GetThermalWidth() const
Definition: class_pad.cpp:570
void OnResize(wxSizeEvent &event)
void OnPadShapeSelection(wxCommandEvent &event) override
void PadTypeSelected(wxCommandEvent &event) override
int GetThermalGap() const
Definition: class_pad.cpp:581
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:598
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:795
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.
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 Update(VIEW_ITEM *aItem)
Function Update() For dynamic VIEWs, informs the associated VIEW that the graphical representation of...
Definition: view.cpp:1378
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:297
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
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.
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
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
COLOR4D GetVisibleElementColor(int aPCB_VISIBLE)
Function GetVisibleElementColor returns the color of a pcb visible element.
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:404
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:306
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:803
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:382
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:310
bool IsType(FRAME_T aType) const
Definition: wxstruct.h:216
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:69
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:240
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39