KiCad PCB EDA Suite
dialog_pad_properties.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com
6  * Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
7  * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
27 #include <base_units.h>
28 #include <bitmaps.h>
29 #include <board_commit.h>
30 #include <class_board.h>
31 #include <class_module.h>
32 #include <confirm.h>
33 #include <convert_basic_shapes_to_polygon.h> // for enum RECT_CHAMFER_POSITIONS definition
34 #include <dialog_pad_properties.h>
36 #include <html_messagebox.h>
37 #include <pcb_base_frame.h>
38 #include <pcb_painter.h>
39 #include <pcbnew.h>
40 #include <pcbnew_settings.h>
42 #include <view/view_controls.h>
43 #include <widgets/net_selector.h>
44 
45 #include <advanced_config.h> // for pad property feature management
46 
47 
48 // list of pad shapes, ordered like the pad shape wxChoice in dialog.
50 {
57  PAD_SHAPE_CUSTOM, // choice = CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR
58  PAD_SHAPE_CUSTOM // choice = PAD_SHAPE_CUSTOM_RECT_ANCHOR
59 };
60 
61 // the ordered index of the pad shape wxChoice in dialog.
62 // keep it consistent with code_shape[] and dialog strings
64 {
73 };
74 
76 {
81  PAD_ATTRIB_SMD // Aperture pad :type SMD with no copper layers,
82  // only on tech layers (usually only on paste layer
83 };
84 
85 // Default mask layers setup for pads according to the pad type
86 static const LSET std_pad_layers[] =
87 {
88  D_PAD::StandardMask(), // PAD_ATTRIB_STANDARD:
89  D_PAD::SMDMask(), // PAD_ATTRIB_SMD:
90  D_PAD::ConnSMDMask(), // PAD_ATTRIB_CONN:
91  D_PAD::UnplatedHoleMask(), // PAD_ATTRIB_HOLE_NOT_PLATED:
93 };
94 
95 
97 {
98  DIALOG_PAD_PROPERTIES dlg( this, aPad );
99  dlg.ShowQuasiModal(); // QuasiModal required for NET_SELECTOR
100 }
101 
102 
104  DIALOG_PAD_PROPERTIES_BASE( aParent ),
105  m_parent( aParent ),
106  m_canUpdate( false ),
107  m_posX( aParent, m_posXLabel, m_posXCtrl, m_posXUnits ),
108  m_posY( aParent, m_posYLabel, m_posYCtrl, m_posYUnits ),
109  m_sizeX( aParent, m_sizeXLabel, m_sizeXCtrl, m_sizeXUnits, true ),
110  m_sizeY( aParent, m_sizeYLabel, m_sizeYCtrl, m_sizeYUnits, true ),
111  m_offsetX( aParent, m_offsetXLabel, m_offsetXCtrl, m_offsetXUnits, true ),
112  m_offsetY( aParent, m_offsetYLabel, m_offsetYCtrl, m_offsetYUnits, true ),
113  m_padToDie( aParent, m_padToDieLabel, m_padToDieCtrl, m_padToDieUnits, true ),
114  m_trapDelta( aParent, m_trapDeltaLabel, m_trapDeltaCtrl, m_trapDeltaUnits, true ),
115  m_cornerRadius( aParent, m_cornerRadiusLabel, m_tcCornerRadius, m_cornerRadiusUnits, true ),
116  m_holeX( aParent, m_holeXLabel, m_holeXCtrl, m_holeXUnits, true ),
117  m_holeY( aParent, m_holeYLabel, m_holeYCtrl, m_holeYUnits, true ),
118  m_OrientValidator( 1, &m_OrientValue ),
119  m_clearance( aParent, m_clearanceLabel, m_clearanceCtrl, m_clearanceUnits, true ),
120  m_maskClearance( aParent, m_maskClearanceLabel, m_maskClearanceCtrl, m_maskClearanceUnits, true ),
121  m_pasteClearance( aParent, m_pasteClearanceLabel, m_pasteClearanceCtrl, m_pasteClearanceUnits, true ),
122  m_spokeWidth( aParent, m_spokeWidthLabel, m_spokeWidthCtrl, m_spokeWidthUnits, true ),
123  m_thermalGap( aParent, m_thermalGapLabel, m_thermalGapCtrl, m_thermalGapUnits, true )
124 {
125  m_currentPad = aPad; // aPad can be NULL, if the dialog is called
126  // from the footprint editor to set default pad setup
127 
129 
130  // Disable the pad property if not allowed in advanced config
131  if( !ADVANCED_CFG::GetCfg().m_EnableUsePadProperty )
132  {
133  m_staticTextFabProperty->Show( false );
134  m_choiceFabProperty->Show( false );
135  }
136 
139 
140  m_OrientValidator.SetRange( -360.0, 360.0 );
141  m_orientation->SetValidator( m_OrientValidator );
142  m_OrientValidator.SetWindow( m_orientation );
143 
144  m_cbShowPadOutline->SetValue( m_sketchPreview );
145 
148 
150  m_dummyPad = new D_PAD( (MODULE*) NULL );
151 
152  if( aPad )
153  {
154  *m_dummyPad = *aPad;
156  }
157  else // We are editing a "master" pad, i.e. a template to create new pads
159 
160  initValues();
161 
162  wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
163  infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
164  m_techLayersLabel->SetFont( infoFont );
165  m_parentInfoLine1->SetFont( infoFont );
166  m_parentInfoLine2->SetFont( infoFont );
167 
168  infoFont.SetStyle( wxFONTSTYLE_ITALIC );
169  m_nonCopperNote->SetFont( infoFont );
170  m_staticTextInfoPaste->SetFont( infoFont );
171  m_staticTextInfoNegVal->SetFont( infoFont );
172  m_staticTextInfoPosValue->SetFont( infoFont );
173 
174  // Usually, TransferDataToWindow is called by OnInitDialog
175  // calling it here fixes all widget sizes so FinishDialogSettings can safely fix minsizes
177 
178  // Initialize canvas to be able to display the dummy pad:
179  prepareCanvas();
180 
182  m_sdbSizerOK->SetDefault();
183  m_canUpdate = true;
184 
185  m_PadNetSelector->Connect( NET_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES::OnValuesChanged ), NULL, this );
186 
187  // Now all widgets have the size fixed, call FinishDialogSettings
189 }
190 
191 
193 {
194  m_PadNetSelector->Disconnect( NET_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES::OnValuesChanged ), NULL, this );
195 
196  delete m_dummyPad;
197  delete m_axisOrigin;
198 }
199 
200 
201 bool DIALOG_PAD_PROPERTIES::m_sketchPreview = false; // Stores the pad draw option during a session
202 
203 
204 void DIALOG_PAD_PROPERTIES::OnInitDialog( wxInitDialogEvent& event )
205 {
206  m_selectedColor = COLOR4D( 1.0, 1.0, 1.0, 0.7 );
207 
208  // Needed on some WM to be sure the pad is redrawn according to the final size
209  // of the canvas, with the right zoom factor
210  redraw();
211 }
212 
213 
214 void DIALOG_PAD_PROPERTIES::OnCancel( wxCommandEvent& event )
215 {
216  // Mandatory to avoid m_panelShowPadGal trying to draw something
217  // in a non valid context during closing process:
219 
220  // Now call default handler for wxID_CANCEL command event
221  event.Skip();
222 }
223 
224 
226 {
227  // Enable or disable the widgets in page managing custom shape primitives
228  m_listCtrlPrimitives->Enable( aEnable );
229  m_buttonDel->Enable( aEnable );
230  m_buttonEditShape->Enable( aEnable );
231  m_buttonAddShape->Enable( aEnable );
232  m_buttonDup->Enable( aEnable );
233  m_buttonGeometry->Enable( aEnable );
234 }
235 
236 
238 {
239  // Initialize the canvas to display the pad
240 
241  // Show the X and Y axis. It is usefull because pad shape can have an offset
242  // or be a complex shape.
243  KIGFX::COLOR4D axis_color = LIGHTBLUE;
244 
246  Millimeter2iu( 0.2 ),
248  m_axisOrigin->SetDrawAtZero( true );
249 
253 
254  bool mousewheelPan = m_parent->GetCanvas()->GetViewControls()->IsMousewheelPanEnabled();
256 
257  m_panelShowPadGal->Show();
258  m_panelShowPad->Hide();
259 
261 
262  // fix the pad render mode (filled/not filled)
263  auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
264  bool sketchMode = m_cbShowPadOutline->IsChecked();
265  settings->SetSketchMode( LAYER_PADS_TH, sketchMode );
266  settings->SetSketchMode( LAYER_PAD_FR, sketchMode );
267  settings->SetSketchMode( LAYER_PAD_BK, sketchMode );
268  settings->SetSketchModeGraphicItems( sketchMode );
269 
270  // gives a non null grid size (0.001mm) because GAL layer does not like a 0 size grid:
271  double gridsize = 0.001 * IU_PER_MM;
272  view->GetGAL()->SetGridSize( VECTOR2D( gridsize, gridsize ) );
273  // And do not show the grid:
274  view->GetGAL()->SetGridVisibility( false );
275  view->Add( m_dummyPad );
276  view->Add( m_axisOrigin );
277 
279  Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) );
280 }
281 
282 
283 void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
284 {
285  wxPaintDC dc( m_panelShowPad );
286  PAD_DRAWINFO drawInfo;
287 
289 
290  if( m_dummyPad->GetLayerSet()[F_Cu] )
292 
293  if( m_dummyPad->GetLayerSet()[B_Cu] )
294  color = color.LegacyMix( m_parent->ColorSettings()->GetColor( LAYER_PAD_BK ) );
295 
296  // What could happen: the pad color is *actually* black, or no copper was selected
297  if( color == BLACK )
298  color = LIGHTGRAY;
299 
300  drawInfo.m_Color = color;
301  drawInfo.m_HoleColor = DARKGRAY;
302  drawInfo.m_Offset = m_dummyPad->GetPosition();
303  drawInfo.m_Display_padnum = true;
304  drawInfo.m_Display_netname = true;
305  drawInfo.m_ShowPadFilled = !m_sketchPreview;
306 
308  drawInfo.m_ShowNotPlatedHole = true;
309 
310  // Shows the local pad clearance
312 
313  wxSize dc_size = dc.GetSize();
314  dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
315 
316  // Calculate a suitable scale to fit the available draw area
317  int dim = m_dummyPad->GetBoundingRadius() *2;
318 
319  // Invalid x size. User could enter zero, or have deleted all text prior to
320  // entering a new value; this is also treated as zero. If dim is left at
321  // zero, the drawing scale is zero and we get a crash.
322  if( dim == 0 )
323  {
324  // If drill size has been set, use that. Otherwise default to 1mm.
325  dim = m_dummyPad->GetDrillSize().x;
326 
327  if( dim == 0 )
328  dim = Millimeter2iu( 1.0 );
329  }
330 
331  if( m_dummyPad->GetLocalClearance() > 0 )
332  dim += m_dummyPad->GetLocalClearance() * 2;
333 
334  double scale = (double) dc_size.x / dim;
335 
336  // If the pad is a circle, use the x size here instead.
337  int ysize;
338 
340  ysize = m_dummyPad->GetSize().x;
341  else
342  ysize = m_dummyPad->GetSize().y;
343 
344  dim = ysize + std::abs( m_dummyPad->GetDelta().x );
345 
346  // Invalid y size. See note about x size above.
347  if( dim == 0 )
348  {
349  dim = m_dummyPad->GetDrillSize().y;
350 
351  if( dim == 0 )
352  dim = Millimeter2iu( 0.1 );
353  }
354 
355  if( m_dummyPad->GetLocalClearance() > 0 )
356  dim += m_dummyPad->GetLocalClearance() * 2;
357 
358  double altscale = (double) dc_size.y / dim;
359  scale = std::min( scale, altscale );
360 
361  // Give a margin
362  scale *= 0.7;
363  dc.SetUserScale( scale, scale );
364 
365  GRResetPenAndBrush( &dc );
366  m_dummyPad->PrintShape( &dc, drawInfo );
367 
368  // draw selected primitives:
369  long select = m_listCtrlPrimitives->GetFirstSelected();
370 
371  while( select >= 0 )
372  {
373  PAD_CS_PRIMITIVE& primitive = m_primitives[select];
374 
375  // The best way to calculate parameters to draw a primitive is to
376  // use a dummy DRAWSEGMENT and use its methods
377  // Note: in legacy canvas, the pad has the 0,0 position
378  DRAWSEGMENT dummySegment;
379  primitive.ExportTo( &dummySegment );
380  dummySegment.Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() );
381 
382  switch( primitive.m_Shape )
383  {
384  case S_SEGMENT: // usual segment : line with rounded ends
385  if( !m_sketchPreview )
386  GRFilledSegment( NULL, &dc, dummySegment.GetStart(), dummySegment.GetEnd(),
387  primitive.m_Thickness, m_selectedColor );
388  else
389  GRCSegm( NULL, &dc, dummySegment.GetStart(), dummySegment.GetEnd(),
390  primitive.m_Thickness, m_selectedColor );
391  break;
392 
393  case S_ARC: // Arc with rounded ends
394  if( !m_sketchPreview )
395  GRArc1( NULL, &dc, dummySegment.GetArcEnd(), dummySegment.GetArcStart(),
396  dummySegment.GetCenter(), primitive.m_Thickness, m_selectedColor );
397  else
398  {
399  GRArc1( NULL, &dc, dummySegment.GetArcEnd(), dummySegment.GetArcStart(),
400  dummySegment.GetCenter(), 0, m_selectedColor );
401 /* GRArc1( NULL, &dc, dummySegment.GetArcEnd(), dummySegment.GetArcStart(),
402  dummySegment.GetCenter() - primitive.m_Thickness, 0, m_selectedColor );*/
403  }
404  break;
405 
406  case S_CIRCLE: // ring or circle
407  if( primitive.m_Thickness )
408  {
409  if( !m_sketchPreview )
410  GRCircle( nullptr, &dc, dummySegment.GetCenter(), primitive.m_Radius,
411  primitive.m_Thickness, m_selectedColor );
412  else
413  {
414  GRCircle( nullptr, &dc, dummySegment.GetCenter(),
415  primitive.m_Radius + primitive.m_Thickness/2, 0, m_selectedColor );
416  GRCircle( nullptr, &dc, dummySegment.GetCenter(),
417  primitive.m_Radius - primitive.m_Thickness/2, 0, m_selectedColor );
418  }
419  }
420  else
421  {
422  if( !m_sketchPreview )
423  GRFilledCircle( nullptr, &dc, dummySegment.GetCenter(), primitive.m_Radius,
424  m_selectedColor );
425  else
426  GRCircle( nullptr, &dc, dummySegment.GetCenter(), primitive.m_Radius, 0,
427  m_selectedColor );
428  }
429  break;
430 
431  case S_POLYGON: // polygon
432  {
433  std::vector<wxPoint> poly = dummySegment.BuildPolyPointsList();
434  GRClosedPoly( nullptr, &dc, poly.size(), &poly[0], !m_sketchPreview,
436  }
437  break;
438 
439  default:
440  break;
441  }
442 
443  select = m_listCtrlPrimitives->GetNextSelected( select );
444  }
445 
446  // Draw X and Y axis. This is particularly useful to show the
447  // reference position of pads with offset and no hole, or custom pad shapes
448  const int t = 0; // line thickness
449  GRLine( nullptr, &dc, -int( dc_size.x/scale ), 0, int( dc_size.x/scale ), 0, t, LIGHTBLUE );
450  GRLine( nullptr, &dc, 0, -int( dc_size.y/scale ), 0, int( dc_size.y/scale ), t, LIGHTBLUE );
451 
452  event.Skip();
453 }
454 
455 
457 {
458  // Note: use m_tcCornerSizeRatio->ChangeValue() to avoid generating a wxEVT_TEXT event
459 
462  {
463  auto ratio = wxString::Format( "%.1f", m_dummyPad->GetRoundRectRadiusRatio() * 100 );
464  m_tcCornerSizeRatio->ChangeValue( ratio );
466 
467  ratio = wxString::Format( "%.1f", m_dummyPad->GetChamferRectRatio() * 100 );
468  m_tcChamferRatio->ChangeValue( ratio );
469  }
470  else if( m_dummyPad->GetShape() == PAD_SHAPE_RECT )
471  {
472  m_tcCornerSizeRatio->ChangeValue( "0" );
474  }
475  else
476  {
477  m_tcCornerSizeRatio->ChangeValue( wxEmptyString );
478  m_cornerRadius.SetValue( wxEmptyString );
479  }
480 }
481 
482 
483 void DIALOG_PAD_PROPERTIES::onCornerRadiusChange( wxCommandEvent& event )
484 {
487  return;
488 
489  double rrRadius = m_cornerRadius.GetValue();
490 
491  if( rrRadius < 0.0 )
492  {
493  rrRadius = 0.0;
494  m_tcCornerRadius->ChangeValue( wxString::Format( "%.1f", rrRadius ) );
495  }
496 
499 
500  auto ratio = wxString::Format( "%.1f", m_dummyPad->GetRoundRectRadiusRatio() * 100 );
501  m_tcCornerSizeRatio->ChangeValue( ratio );
502  redraw();
503 }
504 
505 
507 {
510  return;
511 
512  wxString value = m_tcCornerSizeRatio->GetValue();
513  double ratioPercent;
514 
515  bool asChanged = false;
516 
517  if( value.ToDouble( &ratioPercent ) )
518  {
519  // Clamp ratioPercent to acceptable value (0.0 to 50.0)
520  if( ratioPercent < 0.0 )
521  {
522  ratioPercent = 0.0;
523  value.Printf( "%.1f", ratioPercent );
524  m_tcCornerSizeRatio->ChangeValue( value );
525  }
526 
527  if( ratioPercent > 50.0 )
528  {
529  ratioPercent = 0.5;
530  value.Printf( "%.1f", ratioPercent*100.0 );
531  m_tcCornerSizeRatio->ChangeValue( value );
532  }
533 
534  asChanged = true;
535  }
536 
537  value = m_tcChamferRatio->GetValue();
538 
539  if( value.ToDouble( &ratioPercent ) )
540  {
541  // Clamp ratioPercent to acceptable value (0.0 to 50.0)
542  if( ratioPercent < 0.0 )
543  {
544  ratioPercent = 0.0;
545  value.Printf( "%.1f", ratioPercent );
546  m_tcChamferRatio->ChangeValue( value );
547  }
548 
549  if( ratioPercent > 50.0 )
550  {
551  ratioPercent = 0.5;
552  value.Printf( "%.1f", ratioPercent*100.0 );
553  m_tcChamferRatio->ChangeValue( value );
554  }
555 
556  asChanged = true;
557  }
558 
559  if( asChanged )
560  {
563  redraw();
564  }
565 }
566 
567 
569 {
570  wxString msg;
571  double angle;
572 
573  // Disable pad net name wxTextCtrl if the caller is the footprint editor
574  // because nets are living only in the board managed by the board editor
576 
577  // Setup layers names from board
578  // Should be made first, before calling m_rbCopperLayersSel->SetSelection()
579  m_rbCopperLayersSel->SetString( 0, m_board->GetLayerName( F_Cu ) );
580  m_rbCopperLayersSel->SetString( 1, m_board->GetLayerName( B_Cu ) );
581 
582  m_PadLayerAdhCmp->SetLabel( m_board->GetLayerName( F_Adhes ) );
583  m_PadLayerAdhCu->SetLabel( m_board->GetLayerName( B_Adhes ) );
585  m_PadLayerPateCu->SetLabel( m_board->GetLayerName( B_Paste ) );
587  m_PadLayerSilkCu->SetLabel( m_board->GetLayerName( B_SilkS ) );
588  m_PadLayerMaskCmp->SetLabel( m_board->GetLayerName( F_Mask ) );
589  m_PadLayerMaskCu->SetLabel( m_board->GetLayerName( B_Mask ) );
590  m_PadLayerECO1->SetLabel( m_board->GetLayerName( Eco1_User ) );
591  m_PadLayerECO2->SetLabel( m_board->GetLayerName( Eco2_User ) );
593 
594  m_isFlipped = false;
595 
596  if( m_currentPad )
597  {
599 
600  // Diplay parent footprint info
601  MODULE* footprint = m_currentPad->GetParent();
602  wxString msg1, msg2;
603 
604  if( footprint )
605  {
606  wxString side = footprint->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" );
607  msg1.Printf( _("Footprint %s (%s),"), footprint->GetReference(), footprint->GetValue() );
608  msg2.Printf( _("%s, rotated %.1f deg"), side, footprint->GetOrientation() / 10.0 );
609  }
610 
611  m_parentInfoLine1->SetLabel( msg1 );
612  m_parentInfoLine2->SetLabel( msg2 );
613  }
614 
615  if( m_isFlipped )
616  {
617  wxPoint pt = m_dummyPad->GetOffset();
618  pt.y = -pt.y;
619  m_dummyPad->SetOffset( pt );
620 
621  wxSize sz = m_dummyPad->GetDelta();
622  sz.y = -sz.y;
623  m_dummyPad->SetDelta( sz );
624 
625  // flip pad's layers
627 
628  // flip custom pad shapes
630  }
631 
633 
635 
636  m_PadNumCtrl->SetValue( m_dummyPad->GetName() );
638 
639  // Display current pad parameters units:
642 
645 
648 
651 
652  if( m_dummyPad->GetDelta().x )
653  {
655  m_trapAxisCtrl->SetSelection( 0 );
656  }
657  else
658  {
660  m_trapAxisCtrl->SetSelection( 1 );
661  }
662 
664 
670 
671  // Prefer "-0" to "0" for normally negative values
673  m_pasteClearanceCtrl->SetValue( wxT( "-" ) + m_pasteClearanceCtrl->GetValue() );
674 
675  msg.Printf( wxT( "%f" ), m_dummyPad->GetLocalSolderPasteMarginRatio() * 100.0 );
676 
677  if( m_dummyPad->GetLocalSolderPasteMarginRatio() == 0.0 && msg[0] == '0' )
678  // Sometimes Printf adds a sign if the value is small
679  m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
680  else
682 
684  {
685  default:
687  m_ZoneConnectionChoice->SetSelection( 0 );
688  break;
690  m_ZoneConnectionChoice->SetSelection( 1 );
691  break;
693  m_ZoneConnectionChoice->SetSelection( 2 );
694  break;
696  m_ZoneConnectionChoice->SetSelection( 3 );
697  break;
698  }
699 
701  m_ZoneCustomPadShape->SetSelection( 1 );
702  else
703  m_ZoneCustomPadShape->SetSelection( 0 );
704 
705  if( m_currentPad )
706  {
708  MODULE* footprint = m_currentPad->GetParent();
709 
710  if( footprint )
711  angle -= footprint->GetOrientation();
712 
713  if( m_isFlipped )
714  angle = -angle;
715 
717  }
718 
720 
721  NORMALIZE_ANGLE_180( angle ); // ? normalizing is in D_PAD::SetOrientation()
722 
723  // Set layers used by this pad: :
725 
726  // Pad Orient
727  // Note: use ChangeValue() instead of SetValue() so that we don't generate events
729 
730  switch( m_dummyPad->GetShape() )
731  {
732  default:
733  case PAD_SHAPE_CIRCLE: m_PadShape->SetSelection( CHOICE_SHAPE_CIRCLE ); break;
734  case PAD_SHAPE_OVAL: m_PadShape->SetSelection( CHOICE_SHAPE_OVAL ); break;
735  case PAD_SHAPE_RECT: m_PadShape->SetSelection( CHOICE_SHAPE_RECT ); break;
736  case PAD_SHAPE_TRAPEZOID: m_PadShape->SetSelection( CHOICE_SHAPE_TRAPEZOID ); break;
737  case PAD_SHAPE_ROUNDRECT: m_PadShape->SetSelection( CHOICE_SHAPE_ROUNDRECT ); break;
739 
740  case PAD_SHAPE_CUSTOM:
743  else
745  break;
746  }
747 
748 
753 
755 
756  // Type of pad selection
757  bool aperture = m_dummyPad->GetAttribute() == PAD_ATTRIB_CONN && m_dummyPad->IsAperturePad();
758  bool mechanical = m_dummyPad->GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED;
759 
760  if( aperture )
761  {
762  m_PadType->SetSelection( 4 );
763  }
764  else
765  {
766  switch( m_dummyPad->GetAttribute() )
767  {
768  case PAD_ATTRIB_STANDARD: m_PadType->SetSelection( 0 ); break;
769  case PAD_ATTRIB_SMD: m_PadType->SetSelection( 1 ); break;
770  case PAD_ATTRIB_CONN: m_PadType->SetSelection( 2 ); break;
771  case PAD_ATTRIB_HOLE_NOT_PLATED: m_PadType->SetSelection( 3 ); break;
772  }
773  }
774 
775  switch( m_dummyPad->GetProperty() )
776  {
777  case PAD_PROP_NONE: m_choiceFabProperty->SetSelection( 0 ); break;
778  case PAD_PROP_BGA: m_choiceFabProperty->SetSelection( 1 ); break;
779  case PAD_PROP_FIDUCIAL_LOCAL: m_choiceFabProperty->SetSelection( 2 ); break;
780  case PAD_PROP_FIDUCIAL_GLBL: m_choiceFabProperty->SetSelection( 3 ); break;
781  case PAD_PROP_TESTPOINT: m_choiceFabProperty->SetSelection( 4 ); break;
782  case PAD_PROP_HEATSINK: m_choiceFabProperty->SetSelection( 5 ); break;
783  case PAD_PROP_CASTELLATED: m_choiceFabProperty->SetSelection( 6 ); break;
784  }
785 
786  // Ensure the pad property is compatible with the pad type
788  {
789  m_choiceFabProperty->SetSelection( 0 );
790  m_choiceFabProperty->Enable( false );
791  }
792 
793 
794  // Disable Pad name,and pad to die length for mechanical and aperture pads
795  m_PadNumText->Enable( !mechanical && !aperture );
796  m_PadNumCtrl->Enable( !mechanical && !aperture );
797  m_PadNameText->Enable( !mechanical && !aperture && m_canEditNetName && m_currentPad );
798  m_PadNetSelector->Enable( !mechanical && !aperture && m_canEditNetName && m_currentPad );
799  m_padToDie.Enable( !mechanical && !aperture );
800 
802  m_holeShapeCtrl->SetSelection( 0 );
803  else
804  m_holeShapeCtrl->SetSelection( 1 );
805 
806  // Update some dialog widgets state (Enable/disable options):
807  wxCommandEvent cmd_event;
809  OnDrillShapeSelected( cmd_event );
810  OnPadShapeSelection( cmd_event );
812 
813  // Update basic shapes list
815 }
816 
817 // A small helper function, to display coordinates:
818 static wxString formatCoord( EDA_UNITS aUnits, wxPoint aCoord )
819 {
820  return wxString::Format( "(X:%s Y:%s)",
821  MessageTextFromValue( aUnits, aCoord.x, true ),
822  MessageTextFromValue( aUnits, aCoord.y, true ) );
823 }
824 
826 {
827  m_listCtrlPrimitives->ClearAll();
828 
829  wxListItem itemCol;
830  itemCol.SetImage(-1);
831 
832  for( int ii = 0; ii < 5; ++ii )
833  m_listCtrlPrimitives->InsertColumn(ii, itemCol);
834 
835  wxString bs_info[5];
836 
837  for( unsigned ii = 0; ii < m_primitives.size(); ++ii )
838  {
839  const PAD_CS_PRIMITIVE& primitive = m_primitives[ii];
840 
841  for( unsigned jj = 0; jj < 5; ++jj )
842  bs_info[jj].Empty();
843 
844  bs_info[4] = wxString::Format( _( "width %s" ),
845  MessageTextFromValue( m_units, primitive.m_Thickness, true ) );
846 
847  switch( primitive.m_Shape )
848  {
849  case S_SEGMENT: // usual segment : line with rounded ends
850  bs_info[0] = _( "Segment" );
851  bs_info[1] = _( "from " ) + formatCoord( m_units, primitive.m_Start );
852  bs_info[2] = _( "to " ) + formatCoord( m_units, primitive.m_End );
853  break;
854 
855  case S_CURVE: // Bezier segment
856  bs_info[0] = _( "Bezier" );
857  bs_info[1] = _( "from " ) + formatCoord( m_units, primitive.m_Start );
858  bs_info[2] = _( "to " ) + formatCoord( m_units, primitive.m_End );
859  break;
860 
861  case S_ARC: // Arc with rounded ends
862  bs_info[0] = _( "Arc" );
863  bs_info[1] = _( "center " ) + formatCoord( m_units, primitive.m_Start );// Center
864  bs_info[2] = _( "start " ) + formatCoord( m_units, primitive.m_End ); // Start point
865  bs_info[3] = wxString::Format( _( "angle %s" ), FormatAngle( primitive.m_ArcAngle ) );
866  break;
867 
868  case S_CIRCLE: // ring or circle
869  if( primitive.m_Thickness )
870  bs_info[0] = _( "ring" );
871  else
872  bs_info[0] = _( "circle" );
873 
874  bs_info[1] = formatCoord( m_units, primitive.m_Start );
875  bs_info[2] = wxString::Format( _( "radius %s" ),
876  MessageTextFromValue( m_units, primitive.m_Radius, true ) );
877  break;
878 
879  case S_POLYGON: // polygon
880  bs_info[0] = "Polygon";
881  bs_info[1] = wxString::Format( _( "corners count %d" ), (int) primitive.m_Poly.size() );
882  break;
883 
884  default:
885  bs_info[0] = "Unknown primitive";
886  break;
887  }
888 
889  long tmp = m_listCtrlPrimitives->InsertItem(ii, bs_info[0]);
890  m_listCtrlPrimitives->SetItemData(tmp, ii);
891 
892  for( int jj = 0, col = 0; jj < 5; ++jj )
893  {
894  m_listCtrlPrimitives->SetItem(tmp, col++, bs_info[jj]);
895  }
896  }
897 
898  // Now columns are filled, ensure correct width of columns
899  for( unsigned ii = 0; ii < 5; ++ii )
900  m_listCtrlPrimitives->SetColumnWidth( ii, wxLIST_AUTOSIZE );
901 }
902 
903 void DIALOG_PAD_PROPERTIES::OnResize( wxSizeEvent& event )
904 {
905  redraw();
906  event.Skip();
907 }
908 
909 
910 void DIALOG_PAD_PROPERTIES::onChangePadMode( wxCommandEvent& event )
911 {
912  m_sketchPreview = m_cbShowPadOutline->GetValue();
913 
915 
916  // fix the pad render mode (filled/not filled)
917  KIGFX::PCB_RENDER_SETTINGS* settings =
918  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
919 
924 
925  redraw();
926 }
927 
928 
929 
930 void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
931 {
932  bool is_custom = false;
933 
934  switch( m_PadShape->GetSelection() )
935  {
936  case CHOICE_SHAPE_CIRCLE:
937  m_trapDelta.Enable( false );
938  m_trapAxisLabel->Enable( false );
939  m_trapAxisCtrl->Enable( false );
940  m_sizeY.Enable( false );
941  m_offsetX.Enable( false );
942  m_offsetY.Enable( false );
943  break;
944 
945  case CHOICE_SHAPE_OVAL:
946  m_trapDelta.Enable( false );
947  m_trapAxisLabel->Enable( false );
948  m_trapAxisCtrl->Enable( false );
949  m_sizeY.Enable( true );
950  m_offsetX.Enable( true );
951  m_offsetY.Enable( true );
952  break;
953 
954  case CHOICE_SHAPE_RECT:
955  m_trapDelta.Enable( false );
956  m_trapAxisLabel->Enable( false );
957  m_trapAxisCtrl->Enable( false );
958  m_sizeY.Enable( true );
959  m_offsetX.Enable( true );
960  m_offsetY.Enable( true );
961  break;
962 
964  m_trapDelta.Enable( true );
965  m_trapAxisLabel->Enable( true );
966  m_trapAxisCtrl->Enable( true );
967  m_sizeY.Enable( true );
968  m_offsetX.Enable( true );
969  m_offsetY.Enable( true );
970  break;
971 
974  m_trapDelta.Enable( false );
975  m_trapAxisLabel->Enable( false );
976  m_trapAxisCtrl->Enable( false );
977  m_sizeY.Enable( true );
978  m_offsetX.Enable( true );
979  m_offsetY.Enable( true );
980  // Ensure m_tcCornerSizeRatio contains the right value:
981  m_tcCornerSizeRatio->ChangeValue( wxString::Format( "%.1f",
983  break;
984 
985  case CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR: // PAD_SHAPE_CUSTOM, circular anchor
986  case CHOICE_SHAPE_CUSTOM_RECT_ANCHOR: // PAD_SHAPE_CUSTOM, rect anchor
987  is_custom = true;
988  m_trapDelta.Enable( false );
989  m_trapAxisLabel->Enable( false );
990  m_trapAxisCtrl->Enable( false );
992  m_offsetX.Enable( false );
993  m_offsetY.Enable( false );
994  break;
995  }
996 
997  enablePrimitivePage( is_custom );
998 
999  // A few widgets are enabled only for rounded rect and chamfered pads:
1000  bool chamfered_rect_enable = m_PadShape->GetSelection() == CHOICE_SHAPE_CHAMFERED_RECT;
1001  bool round_rect_enable = m_PadShape->GetSelection() == CHOICE_SHAPE_ROUNDRECT ||
1002  chamfered_rect_enable;
1003  m_staticTextCornerSizeRatio->Enable( round_rect_enable );
1004  m_tcCornerSizeRatio->Enable( round_rect_enable );
1005  m_staticTextCornerSizeRatioUnit->Enable( round_rect_enable );
1006  m_cornerRadius.Enable( round_rect_enable );
1007 
1008  m_cbTopLeft->Enable( chamfered_rect_enable );
1009  m_cbTopRight->Enable( chamfered_rect_enable );
1010  m_cbBottomLeft->Enable( chamfered_rect_enable );
1011  m_cbBottomRight->Enable( chamfered_rect_enable );
1012  m_tcChamferRatio->Enable( chamfered_rect_enable );
1013 
1014  m_staticTextcps->Enable( is_custom );
1015  m_ZoneCustomPadShape->Enable( is_custom );
1016 
1018 
1020  redraw();
1021 }
1022 
1023 
1024 void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected( wxCommandEvent& event )
1025 {
1027  redraw();
1028 }
1029 
1030 
1031 void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
1032 {
1034  redraw();
1035 }
1036 
1037 
1038 void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
1039 {
1040  int ii = m_PadType->GetSelection();
1041 
1042  if( (unsigned)ii >= arrayDim( code_type ) ) // catches < 0 also
1043  ii = 0;
1044 
1045  bool hasHole, hasConnection;
1046  bool hasProperty = true;
1047 
1048  switch( ii )
1049  {
1050  default:
1051  case 0: /* PTH */ hasHole = true; hasConnection = true; break;
1052  case 1: /* SMD */ hasHole = false; hasConnection = true; break;
1053  case 2: /* CONN */ hasHole = false; hasConnection = true; break;
1054  case 3: /* NPTH */
1055  hasHole = true;
1056  hasConnection = false;
1057  hasProperty = false;
1058  break;
1059 
1060  case 4: /* Aperture */ hasHole = false; hasConnection = false; break;
1061  }
1062 
1063  LSET layer_mask = std_pad_layers[ii];
1064  setPadLayersList( layer_mask );
1065 
1066  if( !hasHole )
1067  {
1068  m_holeX.SetValue( 0 );
1069  m_holeY.SetValue( 0 );
1070  }
1071  else if ( m_holeX.GetValue() == 0 && m_currentPad )
1072  {
1075  }
1076 
1077  if( !hasConnection )
1078  {
1079  m_PadNumCtrl->SetValue( wxEmptyString );
1081  m_padToDie.SetValue( 0 );
1082  }
1083  else if( m_PadNumCtrl->GetValue().IsEmpty() && m_currentPad )
1084  {
1085  m_PadNumCtrl->SetValue( m_currentPad->GetName() );
1087  }
1088 
1089  if( !hasProperty )
1090  m_choiceFabProperty->SetSelection( 0 );
1091 
1092  m_choiceFabProperty->Enable( hasProperty );
1093 
1095  redraw();
1096 }
1097 
1098 
1099 void DIALOG_PAD_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
1100 {
1101  int ii = m_PadType->GetSelection();
1102 
1103  if( (unsigned)ii >= arrayDim( code_type ) ) // catches < 0 also
1104  ii = 0;
1105 
1106  bool hasHole, hasConnection;
1107 
1108  switch( ii )
1109  {
1110  default:
1111  case 0: /* PTH */ hasHole = true; hasConnection = true; break;
1112  case 1: /* SMD */ hasHole = false; hasConnection = true; break;
1113  case 2: /* CONN */ hasHole = false; hasConnection = true; break;
1114  case 3: /* NPTH */ hasHole = true; hasConnection = false; break;
1115  case 4: /* Aperture */ hasHole = false; hasConnection = false; break;
1116  }
1117 
1118  // Enable/disable hole controls
1119  m_holeShapeLabel->Enable( hasHole );
1120  m_holeShapeCtrl->Enable( hasHole );
1121  m_holeX.Enable( hasHole );
1122  m_holeY.Enable( hasHole && m_holeShapeCtrl->GetSelection() == 1 );
1123 
1124  // Enable/disable Pad number, net and pad length-to-die
1125  m_PadNumText->Enable( hasConnection );
1126  m_PadNumCtrl->Enable( hasConnection );
1127  m_PadNameText->Enable( hasConnection );
1128  m_PadNetSelector->Enable( hasConnection && m_canEditNetName && m_currentPad );
1129  m_padToDie.Enable( hasConnection );
1130 
1131  // Enable/disable Copper Layers control
1132  m_rbCopperLayersSel->Enable( ii != 4 );
1133 }
1134 
1135 
1137 {
1138  LSET cu_set = layer_mask & LSET::AllCuMask();
1139 
1140  if( cu_set == LSET( F_Cu ) )
1141  m_rbCopperLayersSel->SetSelection( 0 );
1142  else if( cu_set == LSET( B_Cu ) )
1143  m_rbCopperLayersSel->SetSelection( 1 );
1144  else if( cu_set.any() )
1145  m_rbCopperLayersSel->SetSelection( 2 );
1146  else
1147  m_rbCopperLayersSel->SetSelection( 3 );
1148 
1149  m_PadLayerAdhCmp->SetValue( layer_mask[F_Adhes] );
1150  m_PadLayerAdhCu->SetValue( layer_mask[B_Adhes] );
1151 
1152  m_PadLayerPateCmp->SetValue( layer_mask[F_Paste] );
1153  m_PadLayerPateCu->SetValue( layer_mask[B_Paste] );
1154 
1155  m_PadLayerSilkCmp->SetValue( layer_mask[F_SilkS] );
1156  m_PadLayerSilkCu->SetValue( layer_mask[B_SilkS] );
1157 
1158  m_PadLayerMaskCmp->SetValue( layer_mask[F_Mask] );
1159  m_PadLayerMaskCu->SetValue( layer_mask[B_Mask] );
1160 
1161  m_PadLayerECO1->SetValue( layer_mask[Eco1_User] );
1162  m_PadLayerECO2->SetValue( layer_mask[Eco2_User] );
1163 
1164  m_PadLayerDraft->SetValue( layer_mask[Dwgs_User] );
1165 }
1166 
1167 
1168 // Called when select/deselect a layer.
1169 void DIALOG_PAD_PROPERTIES::OnSetLayers( wxCommandEvent& event )
1170 {
1172  redraw();
1173 }
1174 
1175 
1176 // test if all values are acceptable for the pad
1178 {
1179  bool error = transferDataToPad( m_dummyPad );
1180  bool skip_tstoffset = false; // the offset prm is not always tested
1181 
1182  wxArrayString error_msgs;
1183  wxString msg;
1184 
1185  // Test for incorrect values
1186  if( (m_dummyPad->GetSize().x <= 0) ||
1187  ((m_dummyPad->GetSize().y <= 0) && (m_dummyPad->GetShape() != PAD_SHAPE_CIRCLE)) )
1188  {
1189  error_msgs.Add( _( "Pad size must be greater than zero" ) );
1190  }
1191 
1192  if( (m_dummyPad->GetSize().x < m_dummyPad->GetDrillSize().x) ||
1193  (m_dummyPad->GetSize().y < m_dummyPad->GetDrillSize().y) )
1194  {
1195  error_msgs.Add( _( "Incorrect value for pad drill: pad drill bigger than pad size" ) );
1196  skip_tstoffset = true; // offset prm will be not tested because if the drill value
1197  // is incorrect the offset prm is always seen as incorrect, even if it is 0
1198  }
1199 
1200  if( m_dummyPad->GetLocalClearance() < 0 )
1201  {
1202  error_msgs.Add( _( "Pad local clearance must be zero or greater than zero" ) );
1203  }
1204 
1205  // Some pads need a negative solder mask clearance (mainly for BGA with small pads)
1206  // However the negative solder mask clearance must not create negative mask size
1207  // Therefore test for minimal acceptable negative value
1208  // Hovewer, a negative value can give strange result with custom shapes, so it is not
1209  // allowed for custom pad shape
1211  {
1213  error_msgs.Add( _( "Pad local solder mask clearance must be zero or greater than zero" ) );
1214  else
1215  {
1216  int min_smClearance = -std::min( m_dummyPad->GetSize().x, m_dummyPad->GetSize().y )/2;
1217 
1218  if( m_dummyPad->GetLocalSolderMaskMargin() <= min_smClearance )
1219  {
1220  error_msgs.Add( wxString::Format(
1221  _( "Pad local solder mask clearance must be greater than %s" ),
1222  StringFromValue( GetUserUnits(), min_smClearance, true, true ) ) );
1223  }
1224  }
1225  }
1226 
1227  // Some pads need a positive solder paste clearance (mainly for BGA with small pads)
1228  // Hovewer, a positive value can create issues if the resulting shape is too big.
1229  // (like a solder paste creating a solder paste area on a neighbour pad or on the solder mask)
1230  // So we could ask for user to confirm the choice
1231  // Currently there are no test
1232 
1233  LSET padlayers_mask = m_dummyPad->GetLayerSet();
1234 
1235  if( padlayers_mask == 0 )
1236  error_msgs.Add( _( "Error: pad has no layer" ) );
1237 
1238  if( !padlayers_mask[F_Cu] && !padlayers_mask[B_Cu] )
1239  {
1240  if( m_dummyPad->GetDrillSize().x || m_dummyPad->GetDrillSize().y )
1241  {
1242  // Note: he message is shown in an HTML window
1243  msg = _( "Error: the pad is not on a copper layer and has a hole" );
1244 
1246  {
1247  msg += wxT( "<br><br><i>" );
1248  msg += _( "For NPTH pad, set pad size value to pad drill value,"
1249  " if you do not want this pad plotted in gerber files" );
1250  }
1251 
1252  error_msgs.Add( msg );
1253  }
1254  }
1255 
1256  if( !skip_tstoffset )
1257  {
1258  wxPoint max_size;
1259  max_size.x = std::abs( m_dummyPad->GetOffset().x );
1260  max_size.y = std::abs( m_dummyPad->GetOffset().y );
1261  max_size.x += m_dummyPad->GetDrillSize().x / 2;
1262  max_size.y += m_dummyPad->GetDrillSize().y / 2;
1263 
1264  if( ( m_dummyPad->GetSize().x / 2 < max_size.x ) ||
1265  ( m_dummyPad->GetSize().y / 2 < max_size.y ) )
1266  {
1267  error_msgs.Add( _( "Incorrect value for pad offset" ) );
1268  }
1269  }
1270 
1271  if( error )
1272  error_msgs.Add( _( "Too large value for pad delta size" ) );
1273 
1274  switch( m_dummyPad->GetAttribute() )
1275  {
1276  case PAD_ATTRIB_HOLE_NOT_PLATED: // Not plated, but through hole, a hole is expected
1277  case PAD_ATTRIB_STANDARD : // Pad through hole, a hole is also expected
1278  if( m_dummyPad->GetDrillSize().x <= 0 ||
1280  error_msgs.Add( _( "Error: Through hole pad: drill diameter set to 0" ) );
1281  break;
1282 
1283  case PAD_ATTRIB_CONN: // Connector pads are smd pads, just they do not have solder paste.
1284  if( padlayers_mask[B_Paste] || padlayers_mask[F_Paste] )
1285  error_msgs.Add( _( "Error: Connector pads are not on the solder paste layer\n"
1286  "Use SMD pads instead" ) );
1287  // Intentionally fall through
1288  case PAD_ATTRIB_SMD: // SMD and Connector pads (One external copper layer only)
1289  {
1290  LSET innerlayers_mask = padlayers_mask & LSET::InternalCuMask();
1291 
1292  if( ( padlayers_mask[F_Cu] && padlayers_mask[B_Cu] ) ||
1293  innerlayers_mask.count() != 0 )
1294  error_msgs.Add( _( "Error: only one external copper layer allowed for SMD or Connector pads" ) );
1295  }
1296  break;
1297  }
1298 
1299  if( m_dummyPad->GetProperty() != PAD_PROP_NONE &&
1301  error_msgs.Add( _( "Property cannot be set for NPTH" ) );
1302 
1305  error_msgs.Add( _( "Castellated property can be set only for PTH" ) );
1306 
1307  if( m_dummyPad->GetProperty() == PAD_PROP_BGA &&
1309  error_msgs.Add( _( "BGA property can be set only for SMD pads" ) );
1310 
1313  {
1314  wxString value = m_tcCornerSizeRatio->GetValue();
1315  double rrRadiusRatioPercent;
1316 
1317  if( !value.ToDouble( &rrRadiusRatioPercent ) )
1318  error_msgs.Add( _( "Incorrect corner size value" ) );
1319  else
1320  {
1321  if( rrRadiusRatioPercent < 0.0 )
1322  error_msgs.Add( _( "Incorrect (negative) corner size value" ) );
1323  else if( rrRadiusRatioPercent > 50.0 )
1324  error_msgs.Add( _( "Corner size value must be smaller than 50%" ) );
1325  }
1326  }
1327 
1329  {
1331  error_msgs.Add( _( "Incorrect pad shape: the shape must be equivalent to only one polygon" ) );
1332  }
1333 
1334 
1335  if( error_msgs.GetCount() )
1336  {
1337  HTML_MESSAGE_BOX dlg( this, _("Pad setup errors list" ) );
1338  dlg.ListSet( error_msgs );
1339  dlg.ShowModal();
1340  }
1341 
1342  return error_msgs.GetCount() == 0;
1343 }
1344 
1345 
1347 {
1350 
1351  // The layer used to place primitive items selected when editing custom pad shapes
1352  // we use here a layer never used in a pad:
1353  #define SELECTED_ITEMS_LAYER Dwgs_User
1354 
1356  KIGFX::PCB_RENDER_SETTINGS* settings =
1357  static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
1359 
1360  view->Update( m_dummyPad );
1361 
1362  // delete previous items if highlight list
1363  while( m_highlight.size() )
1364  {
1365  delete m_highlight.back(); // the dtor also removes item from view
1366  m_highlight.pop_back();
1367  }
1368 
1369  // highlight selected primitives:
1370  long select = m_listCtrlPrimitives->GetFirstSelected();
1371 
1372  while( select >= 0 )
1373  {
1374  PAD_CS_PRIMITIVE& primitive = m_primitives[select];
1375 
1376  DRAWSEGMENT* dummySegment = new DRAWSEGMENT;
1377  dummySegment->SetLayer( SELECTED_ITEMS_LAYER );
1378  primitive.ExportTo( dummySegment );
1379  dummySegment->Rotate( wxPoint( 0, 0), m_dummyPad->GetOrientation() );
1380  dummySegment->Move( m_dummyPad->GetPosition() );
1381 
1382  // Update selected primitive (highlight selected)
1383  switch( primitive.m_Shape )
1384  {
1385  case S_SEGMENT:
1386  case S_ARC:
1387  case S_CURVE:
1388  break;
1389 
1390  case S_CIRCLE: // ring or circle
1391  if( primitive.m_Thickness == 0 ) // filled circle
1392  { // the filled circle option does not exist in a DRAWSEGMENT
1393  // but it is easy to create it with a circle having the
1394  // right radius and outline width
1395  wxPoint end = dummySegment->GetCenter();
1396  end.x += primitive.m_Radius / 2;
1397  dummySegment->SetEnd( end );
1398  dummySegment->SetWidth( primitive.m_Radius );
1399  }
1400  break;
1401 
1402  case S_POLYGON:
1403  break;
1404 
1405  default:
1406  delete dummySegment;
1407  dummySegment = nullptr;
1408  break;
1409  }
1410 
1411  if( dummySegment )
1412  {
1413  view->Add( dummySegment );
1414  m_highlight.push_back( dummySegment );
1415  }
1416 
1417  select = m_listCtrlPrimitives->GetNextSelected( select );
1418  }
1419 
1420  BOX2I bbox = m_dummyPad->ViewBBox();
1421 
1422  if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
1423  {
1424  // gives a size to the full drawable area
1425  BOX2I drawbox;
1426  drawbox.Move( m_dummyPad->GetPosition() );
1427  drawbox.Inflate( bbox.GetSize().x * 2, bbox.GetSize().y * 2 );
1428 
1429  view->SetBoundary( drawbox );
1430 
1431  // Autozoom
1432  view->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) );
1433 
1434  // Add a margin
1435  view->SetScale( m_panelShowPadGal->GetView()->GetScale() * 0.7 );
1436 
1439  }
1440 }
1441 
1442 
1444 {
1445  if( !wxDialog::TransferDataToWindow() )
1446  return false;
1447 
1448  if( !m_panelGeneral->TransferDataToWindow() )
1449  return false;
1450 
1451  if( !m_localSettingsPanel->TransferDataToWindow() )
1452  return false;
1453 
1454  return true;
1455 }
1456 
1457 
1459 {
1460  BOARD_COMMIT commit( m_parent );
1461 
1462  if( !wxDialog::TransferDataFromWindow() )
1463  return false;
1464 
1465  if( !m_panelGeneral->TransferDataFromWindow() )
1466  return false;
1467 
1468  if( !m_localSettingsPanel->TransferDataFromWindow() )
1469  return false;
1470 
1471  if( !padValuesOK() )
1472  return false;
1473 
1474  int isign = m_isFlipped ? -1 : 1;
1475 
1477  // m_padMaster is a pattern: ensure there is no net for this pad:
1479 
1480  if( !m_currentPad ) // Set current Pad parameters
1481  return true;
1482 
1483  commit.Modify( m_currentPad );
1484 
1485  // redraw the area where the pad was, without pad (delete pad on screen)
1487  m_parent->GetCanvas()->Refresh();
1489 
1490  // Update values
1494 
1495  wxSize size;
1496  MODULE* footprint = m_currentPad->GetParent();
1497 
1498  if( footprint )
1499  {
1500  footprint->SetLastEditTime();
1501 
1502  // compute the pos 0 value, i.e. pad position for footprint with orientation = 0
1503  // i.e. relative to footprint origin (footprint position)
1504  wxPoint pt = m_currentPad->GetPosition() - footprint->GetPosition();
1505  RotatePoint( &pt, -footprint->GetOrientation() );
1506  m_currentPad->SetPos0( pt );
1508  + footprint->GetOrientation() );
1509  }
1510 
1512 
1513  size = m_padMaster->GetDelta();
1514  size.y *= isign;
1515  m_currentPad->SetDelta( size );
1516 
1519 
1520  wxPoint offset = m_padMaster->GetOffset();
1521  offset.y *= isign;
1522  m_currentPad->SetOffset( offset );
1523 
1525 
1528 
1529 
1532 
1533  if( m_isFlipped )
1534  {
1537  }
1538 
1540 
1541  if( m_isFlipped )
1542  {
1544  }
1545 
1547 
1548  int padNetcode = NETINFO_LIST::UNCONNECTED;
1549 
1550  // For PAD_ATTRIB_HOLE_NOT_PLATED, ensure there is no net name selected
1552  padNetcode = m_PadNetSelector->GetSelectedNetcode();
1553 
1554  m_currentPad->SetNetCode( padNetcode );
1565 
1566  // rounded rect pads with radius ratio = 0 are in fact rect pads.
1567  // So set the right shape (and perhaps issues with a radius = 0)
1570  {
1572  }
1573 
1574  // Set the fabrication property:
1576 
1577  // define the way the clearance area is defined in zones
1579 
1580  if( footprint )
1581  footprint->CalculateBoundingBox();
1582 
1584 
1585  // redraw the area where the pad was
1586  m_parent->GetCanvas()->Refresh();
1587 
1588  commit.Push( _( "Modify pad" ) );
1589 
1590  return true;
1591 }
1592 
1593 
1595 {
1596  PAD_PROP_T prop = PAD_PROP_NONE;
1597 
1598  switch( m_choiceFabProperty->GetSelection() )
1599  {
1600  case 0: prop = PAD_PROP_NONE; break;
1601  case 1: prop = PAD_PROP_BGA; break;
1602  case 2: prop = PAD_PROP_FIDUCIAL_LOCAL; break;
1603  case 3: prop = PAD_PROP_FIDUCIAL_GLBL; break;
1604  case 4: prop = PAD_PROP_TESTPOINT; break;
1605  case 5: prop = PAD_PROP_HEATSINK; break;
1606  case 6: prop = PAD_PROP_CASTELLATED; break;
1607  }
1608 
1609  return prop;
1610 }
1611 
1612 
1614 {
1615  wxString msg;
1616 
1617  if( !Validate() )
1618  return true;
1619  if( !m_panelGeneral->Validate() )
1620  return true;
1621  if( !m_localSettingsPanel->Validate() )
1622  return true;
1623  if( !m_spokeWidth.Validate( 0, INT_MAX ) )
1624  return false;
1625 
1626  m_OrientValidator.TransferFromWindow();
1627 
1628  aPad->SetAttribute( code_type[m_PadType->GetSelection()] );
1629  aPad->SetShape( code_shape[m_PadShape->GetSelection()] );
1632 
1633  if( aPad->GetShape() == PAD_SHAPE_CUSTOM )
1634  aPad->SetPrimitives( m_primitives );
1635 
1636  // Read pad clearances values:
1641  aPad->SetThermalGap( m_thermalGap.GetValue() );
1642  double dtmp = 0.0;
1643  msg = m_SolderPasteMarginRatioCtrl->GetValue();
1644  msg.ToDouble( &dtmp );
1645 
1646  // A -50% margin ratio means no paste on a pad, the ratio must be >= -50%
1647  if( dtmp < -50.0 )
1648  dtmp = -50.0;
1649  // A margin ratio is always <= 0
1650  // 0 means use full pad copper area
1651  if( dtmp > 0.0 )
1652  dtmp = 0.0;
1653 
1654  aPad->SetLocalSolderPasteMarginRatio( dtmp / 100 );
1655 
1656  switch( m_ZoneConnectionChoice->GetSelection() )
1657  {
1658  default:
1659  case 0:
1661  break;
1662  case 1:
1664  break;
1665  case 2:
1667  break;
1668  case 3:
1670  break;
1671  }
1672 
1673  aPad->SetPosition( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
1674  aPad->SetPos0( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
1675 
1676  if( m_holeShapeCtrl->GetSelection() == 0 )
1677  {
1679  aPad->SetDrillSize( wxSize( m_holeX.GetValue(), m_holeX.GetValue() ) );
1680  }
1681  else
1682  {
1684  aPad->SetDrillSize( wxSize( m_holeX.GetValue(), m_holeY.GetValue() ) );
1685  }
1686 
1687  if( aPad->GetShape() == PAD_SHAPE_CIRCLE )
1688  aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeX.GetValue() ) );
1689  else
1690  aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeY.GetValue() ) );
1691 
1692  // Read pad length die
1694 
1695  // For a trapezoid, test delta value (be sure delta is not too large for pad size)
1696  // remember DeltaSize.x is the Y size variation
1697  bool error = false;
1698 
1699  if( aPad->GetShape() == PAD_SHAPE_TRAPEZOID )
1700  {
1701  wxSize delta;
1702 
1703  // For a trapezoid, only one of delta.x or delta.y is not 0, depending on
1704  // the direction.
1705  if( m_trapAxisCtrl->GetSelection() == 0 )
1706  delta.x = m_trapDelta.GetValue();
1707  else
1708  delta.y = m_trapDelta.GetValue();
1709 
1710  if( delta.x < 0 && delta.x <= -aPad->GetSize().y )
1711  {
1712  delta.x = -aPad->GetSize().y + 2;
1713  error = true;
1714  }
1715 
1716  if( delta.x > 0 && delta.x >= aPad->GetSize().y )
1717  {
1718  delta.x = aPad->GetSize().y - 2;
1719  error = true;
1720  }
1721 
1722  if( delta.y < 0 && delta.y <= -aPad->GetSize().x )
1723  {
1724  delta.y = -aPad->GetSize().x + 2;
1725  error = true;
1726  }
1727 
1728  if( delta.y > 0 && delta.y >= aPad->GetSize().x )
1729  {
1730  delta.y = aPad->GetSize().x - 2;
1731  error = true;
1732  }
1733 
1734  aPad->SetDelta( delta );
1735  }
1736 
1738  aPad->SetOrientation( m_OrientValue * 10.0 );
1739  aPad->SetName( m_PadNumCtrl->GetValue() );
1741 
1742  int chamfers = 0;
1743 
1744  if( m_cbTopLeft->GetValue() )
1745  chamfers |= RECT_CHAMFER_TOP_LEFT;
1746 
1747  if( m_cbTopRight->GetValue() )
1748  chamfers |= RECT_CHAMFER_TOP_RIGHT;
1749 
1750  if( m_cbBottomLeft->GetValue() )
1751  chamfers |= RECT_CHAMFER_BOTTOM_LEFT;
1752 
1753  if( m_cbBottomRight->GetValue() )
1754  chamfers |= RECT_CHAMFER_BOTTOM_RIGHT;
1755 
1756  aPad->SetChamferPositions( chamfers );
1757 
1758  // Clear some values, according to the pad type and shape
1759  switch( aPad->GetShape() )
1760  {
1761  case PAD_SHAPE_CIRCLE:
1762  aPad->SetOffset( wxPoint( 0, 0 ) );
1763  aPad->SetDelta( wxSize( 0, 0 ) );
1764  break;
1765 
1766  case PAD_SHAPE_RECT:
1767  aPad->SetDelta( wxSize( 0, 0 ) );
1768  break;
1769 
1770  case PAD_SHAPE_OVAL:
1771  aPad->SetDelta( wxSize( 0, 0 ) );
1772  break;
1773 
1774  case PAD_SHAPE_TRAPEZOID:
1775  break;
1776 
1777  case PAD_SHAPE_ROUNDRECT:
1779  aPad->SetDelta( wxSize( 0, 0 ) );
1780  break;
1781 
1782  case PAD_SHAPE_CUSTOM:
1783  aPad->SetOffset( wxPoint( 0, 0 ) );
1784  aPad->SetDelta( wxSize( 0, 0 ) );
1785 
1786  // The pad custom has a "anchor pad" (a basic shape: round or rect pad)
1787  // that is the minimal area of this pad, and is usefull to ensure a hole
1788  // diameter is acceptable, and is used in Gerber files as flashed area
1789  // reference
1790  if( aPad->GetAnchorPadShape() == PAD_SHAPE_CIRCLE )
1791  aPad->SetSize( wxSize( m_sizeX.GetValue(), m_sizeX.GetValue() ) );
1792 
1793  // define the way the clearance area is defined in zones
1794  aPad->SetCustomShapeInZoneOpt( m_ZoneCustomPadShape->GetSelection() == 0 ?
1797  break;
1798 
1799  default:
1800  ;
1801  }
1802 
1803  switch( aPad->GetAttribute() )
1804  {
1805  case PAD_ATTRIB_STANDARD:
1806  break;
1807 
1808  case PAD_ATTRIB_CONN:
1809  case PAD_ATTRIB_SMD:
1810  // SMD and PAD_ATTRIB_CONN has no hole.
1811  // basically, SMD and PAD_ATTRIB_CONN are same type of pads
1812  // PAD_ATTRIB_CONN has just a default non technical layers that differs from SMD
1813  // and are intended to be used in virtual edge board connectors
1814  // However we can accept a non null offset,
1815  // mainly to allow complex pads build from a set of basic pad shapes
1816  aPad->SetDrillSize( wxSize( 0, 0 ) );
1817  break;
1818 
1820  // Mechanical purpose only:
1821  // no offset, no net name, no pad name allowed
1822  aPad->SetOffset( wxPoint( 0, 0 ) );
1823  aPad->SetName( wxEmptyString );
1825  break;
1826 
1827  default:
1828  DisplayError( NULL, wxT( "Error: unknown pad type" ) );
1829  break;
1830  }
1831 
1832  if( aPad->GetShape() == PAD_SHAPE_ROUNDRECT || aPad->GetShape() == PAD_SHAPE_CHAMFERED_RECT )
1833  {
1834  wxString value = m_tcCornerSizeRatio->GetValue();
1835  double ratioPercent;
1836 
1837  if( value.ToDouble( &ratioPercent ) )
1838  aPad->SetRoundRectRadiusRatio( ratioPercent / 100.0 );
1839 
1840  value = m_tcChamferRatio->GetValue();
1841 
1842  if( value.ToDouble( &ratioPercent ) )
1843  aPad->SetChamferRectRatio( ratioPercent / 100.0 );
1844  }
1845 
1846  aPad->SetProperty( getSelectedProperty() );
1847 
1848  LSET padLayerMask;
1849 
1850  switch( m_rbCopperLayersSel->GetSelection() )
1851  {
1852  case 0: padLayerMask.set( F_Cu ); break;
1853  case 1: padLayerMask.set( B_Cu ); break;
1854  case 2: padLayerMask |= LSET::AllCuMask(); break;
1855  case 3: break; // No copper layers
1856  }
1857 
1858  if( m_PadLayerAdhCmp->GetValue() )
1859  padLayerMask.set( F_Adhes );
1860 
1861  if( m_PadLayerAdhCu->GetValue() )
1862  padLayerMask.set( B_Adhes );
1863 
1864  if( m_PadLayerPateCmp->GetValue() )
1865  padLayerMask.set( F_Paste );
1866 
1867  if( m_PadLayerPateCu->GetValue() )
1868  padLayerMask.set( B_Paste );
1869 
1870  if( m_PadLayerSilkCmp->GetValue() )
1871  padLayerMask.set( F_SilkS );
1872 
1873  if( m_PadLayerSilkCu->GetValue() )
1874  padLayerMask.set( B_SilkS );
1875 
1876  if( m_PadLayerMaskCmp->GetValue() )
1877  padLayerMask.set( F_Mask );
1878 
1879  if( m_PadLayerMaskCu->GetValue() )
1880  padLayerMask.set( B_Mask );
1881 
1882  if( m_PadLayerECO1->GetValue() )
1883  padLayerMask.set( Eco1_User );
1884 
1885  if( m_PadLayerECO2->GetValue() )
1886  padLayerMask.set( Eco2_User );
1887 
1888  if( m_PadLayerDraft->GetValue() )
1889  padLayerMask.set( Dwgs_User );
1890 
1891  aPad->SetLayerSet( padLayerMask );
1892 
1893  return error;
1894 }
1895 
1896 
1897 void DIALOG_PAD_PROPERTIES::OnValuesChanged( wxCommandEvent& event )
1898 {
1899  if( m_canUpdate )
1900  {
1902  // If the pad size has changed, update the displayed values
1903  // for rounded rect pads
1905 
1906  redraw();
1907  }
1908 }
1909 
1911 {
1912  long select = m_listCtrlPrimitives->GetFirstSelected();
1913 
1914  if( select < 0 )
1915  {
1916  wxMessageBox( _( "No shape selected" ) );
1917  return;
1918  }
1919 
1920  PAD_CS_PRIMITIVE& shape = m_primitives[select];
1921 
1922  if( shape.m_Shape == S_POLYGON )
1923  {
1924  DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, m_parent, &shape );
1925 
1926  if( dlg.ShowModal() != wxID_OK )
1927  return;
1928 
1929  dlg.TransferDataFromWindow();
1930  }
1931 
1932  else
1933  {
1934  DIALOG_PAD_PRIMITIVES_PROPERTIES dlg( this, m_parent, &shape );
1935 
1936  if( dlg.ShowModal() != wxID_OK )
1937  return;
1938 
1939  dlg.TransferDataFromWindow();
1940  }
1941 
1943 
1944  if( m_canUpdate )
1945  {
1947  redraw();
1948  }
1949 }
1950 
1951 
1953 {
1954  // Called on a double click on the basic shapes list
1955  // To Do: highligth the primitive(s) currently selected.
1956  redraw();
1957 }
1958 
1959 
1961 void DIALOG_PAD_PROPERTIES::onPrimitiveDClick( wxMouseEvent& event )
1962 {
1963  editPrimitive();
1964 }
1965 
1966 
1967 // Called on a click on basic shapes list panel button
1968 void DIALOG_PAD_PROPERTIES::onEditPrimitive( wxCommandEvent& event )
1969 {
1970  editPrimitive();
1971 }
1972 
1973 // Called on a click on basic shapes list panel button
1974 void DIALOG_PAD_PROPERTIES::onDeletePrimitive( wxCommandEvent& event )
1975 {
1976  long select = m_listCtrlPrimitives->GetFirstSelected();
1977 
1978  if( select < 0 )
1979  return;
1980 
1981  // Multiple selections are allowed. get them and remove corresponding shapes
1982  std::vector<long> indexes;
1983  indexes.push_back( select );
1984 
1985  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
1986  indexes.push_back( select );
1987 
1988  // Erase all select shapes
1989  for( unsigned ii = indexes.size(); ii > 0; --ii )
1990  m_primitives.erase( m_primitives.begin() + indexes[ii-1] );
1991 
1993 
1994  if( m_canUpdate )
1995  {
1997  redraw();
1998  }
1999 }
2000 
2001 
2002 void DIALOG_PAD_PROPERTIES::onAddPrimitive( wxCommandEvent& event )
2003 {
2004  // Ask user for shape type
2005  wxString shapelist[] = { _( "Segment" ), _( "Arc" ), _( "Bezier" ),
2006  _( "Ring/Circle" ), _( "Polygon" ) };
2007 
2008  int type = wxGetSingleChoiceIndex( _( "Shape type:" ), _( "Add Primitive" ),
2009  arrayDim( shapelist ), shapelist, 0, this );
2010 
2011  // User pressed cancel
2012  if( type == -1 )
2013  return;
2014 
2015  STROKE_T listtype[] = { S_SEGMENT, S_ARC, S_CURVE, S_CIRCLE, S_POLYGON };
2016 
2017  PAD_CS_PRIMITIVE primitive( listtype[type] );
2019 
2020  if( listtype[type] == S_POLYGON )
2021  {
2022  DIALOG_PAD_PRIMITIVE_POLY_PROPS dlg( this, m_parent, &primitive );
2023 
2024  if( dlg.ShowModal() != wxID_OK )
2025  return;
2026  }
2027  else
2028  {
2029  DIALOG_PAD_PRIMITIVES_PROPERTIES dlg( this, m_parent, &primitive );
2030 
2031  if( dlg.ShowModal() != wxID_OK )
2032  return;
2033  }
2034 
2035  m_primitives.push_back( primitive );
2036 
2038 
2039  if( m_canUpdate )
2040  {
2042  redraw();
2043  }
2044 }
2045 
2046 
2047 void DIALOG_PAD_PROPERTIES::onGeometryTransform( wxCommandEvent& event )
2048 {
2049  long select = m_listCtrlPrimitives->GetFirstSelected();
2050 
2051  if( select < 0 )
2052  {
2053  wxMessageBox( _( "No shape selected" ) );
2054  return;
2055  }
2056 
2057  // Multiple selections are allowed. Build selected shapes list
2058  std::vector<PAD_CS_PRIMITIVE*> shapeList;
2059  shapeList.push_back( &m_primitives[select] );
2060 
2061  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
2062  shapeList.push_back( &m_primitives[select] );
2063 
2064  DIALOG_PAD_PRIMITIVES_TRANSFORM dlg( this, m_parent, shapeList, false );
2065 
2066  if( dlg.ShowModal() != wxID_OK )
2067  return;
2068 
2069  // Transfert new settings:
2070  dlg.Transform();
2071 
2073 
2074  if( m_canUpdate )
2075  {
2077  redraw();
2078  }
2079 }
2080 
2081 
2082 void DIALOG_PAD_PROPERTIES::onDuplicatePrimitive( wxCommandEvent& event )
2083 {
2084  long select = m_listCtrlPrimitives->GetFirstSelected();
2085 
2086  if( select < 0 )
2087  {
2088  wxMessageBox( _( "No shape selected" ) );
2089  return;
2090  }
2091 
2092  // Multiple selections are allowed. Build selected shapes list
2093  std::vector<PAD_CS_PRIMITIVE*> shapeList;
2094  shapeList.push_back( &m_primitives[select] );
2095 
2096  while( ( select = m_listCtrlPrimitives->GetNextSelected( select ) ) >= 0 )
2097  shapeList.push_back( &m_primitives[select] );
2098 
2099  DIALOG_PAD_PRIMITIVES_TRANSFORM dlg( this, m_parent, shapeList, true );
2100 
2101  if( dlg.ShowModal() != wxID_OK )
2102  return;
2103 
2104  // Transfer new settings
2105  // save duplicates to a separate vector to avoid m_primitives reallocation,
2106  // as shapeList contains pointers to its elements
2107  std::vector<PAD_CS_PRIMITIVE> duplicates;
2108  dlg.Transform( &duplicates, dlg.GetDuplicateCount() );
2109  std::move( duplicates.begin(), duplicates.end(), std::back_inserter( m_primitives ) );
2110 
2112 
2113  if( m_canUpdate )
2114  {
2116  redraw();
2117  }
2118 }
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:686
EDA_UNITS
Definition: common.h:184
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:239
void Move(const Vec &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
Definition: box2.h:119
void GRResetPenAndBrush(wxDC *DC)
Definition: gr_basic.cpp:120
int GetLocalSolderMaskMargin() const
Definition: class_pad.h:461
double GetOrientation() const
Definition: class_module.h:215
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,...
Definition: lset.cpp:531
DIALOG_PAD_PROPERTIES(PCB_BASE_FRAME *aParent, D_PAD *aPad)
int GetNetCode() const
Function GetNetCode.
void SetViewport(const BOX2D &aViewport)
Function SetViewport() Sets the visible area of the VIEW.
Definition: view.cpp:550
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
void enablePrimitivePage(bool aEnable)
enable (or disable) the primitive page editor
static LSET StandardMask()
layer set for a through hole pad
Definition: class_pad.cpp:104
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
bool m_Display_padnum
Definition: class_pad.h:73
void FlipPrimitives()
Flip the basic shapes, in custom pads.
Definition: class_pad.cpp:478
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
virtual void Move(const wxPoint &aMoveVector) override
Function Move move this object.
no special fabrication property
Definition: pad_shapes.h:78
virtual void SetTopLayer(int aLayer, bool aEnabled=true)
Function SetTopLayer() Sets given layer to be displayed on the top or sets back the default order of ...
Definition: view.cpp:860
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:66
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:59
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:292
PAD_PROP_T getSelectedProperty()
Return the pad property currently selected.
multilayer pads, usually with holes
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
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:125
This file is part of the common library.
const wxPoint GetCenter() const override
Function GetCenter()
PAD_SHAPE_T GetAnchorPadShape() const
Function GetAnchorPadShape.
Definition: class_pad.h:247
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition: class_pad.cpp:111
VIEW_CONTROLS class definition.
static wxString formatCoord(EDA_UNITS aUnits, wxPoint aCoord)
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
const wxPoint GetArcEnd() const
void SetBoard(BOARD *aBoard)
bool transferDataToPad(D_PAD *aPad)
Copy values from dialog field to aPad's members.
a fiducial (usually a smd) for the full board
Definition: pad_shapes.h:80
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void ExportTo(DRAWSEGMENT *aTarget)
Export the PAD_CS_PRIMITIVE parameters to a DRAWSEGMENT useful to draw a primitive shape.
wxPoint m_Start
angle of an arc, from its starting point, in 0.1 deg
Definition: class_pad.h:98
int color
Definition: DXF_plotter.cpp:61
polygon (not yet used for tracks, but could be in microwave apps)
void setPadLayersList(LSET layer_mask)
Function setPadLayersList updates the CheckBox states in pad layers list,.
bool IsFlipped() const
Definition: class_pad.cpp:139
int GetPadToDieLength() const
Definition: class_pad.h:459
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:62
BOX2< VECTOR2D > BOX2D
Definition: box2.h:522
wxFloatingPointValidator< double > m_OrientValidator
const wxString GetValue() const
Function GetValue.
Definition: class_module.h:461
virtual void EnableMousewheelPan(bool aEnable)
Function EnableMousewheelPan() Enables or disables mousewheel panning.
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:234
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:312
Smd pad, used in BGA footprints.
Definition: pad_shapes.h:79
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:180
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:240
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:512
int GetSelectedNetcode()
void onChangePadMode(wxCommandEvent &event) override
usual segment : line with rounded ends
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:305
void NORMALIZE_ANGLE_180(T &Angle)
Definition: trigo.h:354
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
a pad used as heat sink, usually in SMD footprints
Definition: pad_shapes.h:83
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:687
const std::vector< wxPoint > BuildPolyPointsList() const
Build and return the list of corners in a std::vector<wxPoint> It must be used only to convert the SH...
void Transform(std::vector< PAD_CS_PRIMITIVE > *aList=NULL, int aDuplicateCount=0)
Apply geometric transform (rotation, move, scale) defined in dialog aDuplicate = 1 .
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
int GetThermalGap() const
Definition: class_pad.cpp:747
void GRFilledCircle(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:619
void onCornerSizePercentChange(wxCommandEvent &event) override
int GetLocalClearance() const
Definition: class_pad.h:464
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:115
void SetSketchModeGraphicItems(bool aEnabled)
Turns on/off sketch mode for graphic items (DRAWSEGMENTs, texts).
Definition: pcb_painter.h:131
void SetValue(const wxString &aValue) override
Set a new value in evaluator buffer, and display it in the wxTextCtrl.
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
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:449
bool TransferDataFromWindow() override
Function TransferDataFromWindow Transfer data out of the GUI.
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:436
int GetChamferPositions() const
has meaning only for chamfered rect pads
Definition: class_pad.h:724
a pad with a castellated through hole
Definition: pad_shapes.h:84
ZONE_CONNECTION GetLocalZoneConnection() const
Definition: class_pad.h:537
static PAD_SHAPE_T code_shape[]
Classes used in Pcbnew, CvPcb and GerbView.
EDA_UNITS GetUserUnits() const
Definition: dialog_shim.h:132
DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder.
int GetLineThickness(PCB_LAYER_ID aLayer) const
Function GetLineThickness Returns the default graphic segment thickness from the layer class for the ...
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin
PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:60
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
#define SELECTED
Definition: base_struct.h:127
void onAddPrimitive(wxCommandEvent &event) override
static PAD_ATTR_T code_type[]
void SetAnchorPadShape(PAD_SHAPE_T aShape)
Function SetAnchorPadShape Set the shape of the anchor pad for custm shped pads.
Definition: class_pad.h:274
void OnCancel(wxCommandEvent &event) override
std::string FormatAngle(double aAngle)
Function FormatAngle converts aAngle from board units to a string appropriate for writing to file.
Definition: base_units.cpp:552
virtual const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers.
Definition: class_pad.cpp:1439
int m_Radius
thickness of segment or outline For filled S_CIRCLE shape, thickness = 0.
Definition: class_pad.h:96
LSET is a set of PCB_LAYER_IDs.
pads are covered by copper
const std::vector< PAD_CS_PRIMITIVE > & GetPrimitives() const
Accessor to the basic shape list.
Definition: class_pad.h:373
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:257
std::vector< wxPoint > m_Poly
Bezier Control point 2.
Definition: class_pad.h:102
#define NULL
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
void OnSetLayers(wxCommandEvent &event) override
bool MergePrimitivesAsPolygon(SHAPE_POLY_SET *aMergedPolygon=NULL)
Merge all basic shapes, converted to a polygon in one polygon, in m_customShapeAsPolygon.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void OnPaintShowPanel(wxPaintEvent &event) override
void SetName(const wxString &aName)
Set the pad name (sometimes called pad number, although it can be an array reference like AA12).
Definition: class_pad.h:187
const BITMAP_OPAQUE dialog_warning_xpm[1]
void SetPos0(const wxPoint &aPos)
Definition: class_pad.h:293
int ShowQuasiModal()
COLOR_SETTINGS * ColorSettings()
Helper to retrieve the current color settings.
void ListSet(const wxString &aList)
Add a list of items.
Arcs (with rounded ends)
const wxPoint & GetOffset() const
Definition: class_pad.h:309
ZONE_CONNECTION GetZoneConnection() const
Definition: class_pad.cpp:725
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:432
double GetChamferRectRatio() const
has meaning only for chamfered rect pads
Definition: class_pad.h:701
int GetThermalWidth() const
Definition: class_pad.cpp:736
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:89
void SetLastEditTime(timestamp_t aTime)
Definition: class_module.h:347
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:446
void SetSelectedNetcode(int aNetcode)
Subclass of DIALOG_DISPLAY_HTML_TEXT_BASE, which is generated by wxFormBuilder.
void onCornerRadiusChange(wxCommandEvent &event) override
Class DIALOG_PAD_PROPERTIES_BASE.
void SetDrawAtZero(bool aDrawFlag)
Function SetDrawAtZero() Set the draw at zero flag.
void SetStealsFocus(bool aStealsFocus)
Set whether focus is taken on certain events (mouseover, keys, etc).
void OnResize(wxSizeEvent &event)
void OnPadShapeSelection(wxCommandEvent &event) override
void PadTypeSelected(wxCommandEvent &event) override
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:646
void SetThermalWidth(int aWidth)
Definition: class_pad.h:542
COLOR4D m_HoleColor
Definition: class_pad.h:68
void onPrimitiveDClick(wxMouseEvent &event) override
Called on a double click on the basic shapes list.
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
const wxString & GetName() const
Definition: class_pad.h:203
void SetSize(const wxSize &aSize)
Definition: class_pad.h:299
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.h:653
STROKE_T
Enum STROKE_T is the set of shapes for segments (graphic segments and tracks) which are often in the ...
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Sets net using a net code.
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Function SetLayerColor Changes the color used to draw a layer.
Definition: painter.h:227
void SetRoundRectCornerRadius(double aRadius)
Set the rounded rectangle radius ratio based on a given radius.
Definition: class_pad.cpp:220
void OnDrillShapeSelected(wxCommandEvent &event) override
PAD_PROP_T
Enum PAD_PROP_T is the set of pad properties used in Gerber files (Draw files, and P&P files) to defi...
Definition: pad_shapes.h:76
void PrintShape(wxDC *aDC, PAD_DRAWINFO &aDrawInfo)
Function PrintShape basic function to print a pad.
const wxPoint & GetArcStart() const
bool m_ShowNotPlatedHole
Definition: class_pad.h:78
void SetZoneConnection(ZONE_CONNECTION aType)
Definition: class_pad.h:530
PAD_PROP_T GetProperty() const
Definition: class_pad.h:452
void SetNetInfo(NETINFO_LIST *aNetInfoList)
Bezier Curve.
void SetPadToDieLength(int aLength)
Definition: class_pad.h:458
HTML_MESSAGE_BOX.
const wxSize & GetDelta() const
Definition: class_pad.h:303
void onGeometryTransform(wxCommandEvent &event) override
wxPoint m_End
is also the center of the circle and arc
Definition: class_pad.h:99
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
virtual bool Validate(long long int aMin, long long int aMax, bool setFocusOnError=true)
Function Validate Validates the control against the given range, informing the user of any errors fou...
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:230
NETINFO_LIST & GetNetInfo()
Definition: class_board.h:713
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:63
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
STROKE_T m_Shape
Definition: class_pad.h:92
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
void StartDrawing()
Function StartDrawing() Begins drawing if it was stopped previously.
int m_PadClearance
Definition: class_pad.h:71
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:423
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void UpdateColors()
Updates the color settings in the painter and GAL.
void SetLocalClearance(int aClearance)
Definition: class_pad.h:465
a dialog to edit basic polygonal shape parameters
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
MODULE * GetParent() const
Definition: class_pad.h:167
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:471
bool SwitchBackend(GAL_TYPE aGalType) override
Function SwitchBackend Switches method of rendering graphics.
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Function SetScale() Sets the scaling factor, zooming around a given anchor point.
Definition: view.cpp:578
CUST_PAD_SHAPE_IN_ZONE GetCustomShapeInZoneOpt() const
Definition: class_pad.h:253
int m_Thickness
S_SEGMENT, S_ARC, S_CIRCLE, S_POLYGON only (same as DRAWSEGMENT)
Definition: class_pad.h:93
void OnPrimitiveSelection(wxListEvent &event) override
Called on selection/deselection of a basic shape.
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType)
Definition: base_units.cpp:127
EDA_UNITS m_units
Definition: dialog_shim.h:196
Use thermal relief for pads.
void onEditPrimitive(wxCommandEvent &event) override
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
COLOR4D GetColor(int aLayer) const
bool TransferDataFromWindow() override
Updates the different parameters for the component being edited.
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:445
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:301
virtual void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
void PadOrientEvent(wxCommandEvent &event) override
wxPoint m_Offset
Definition: class_pad.h:81
const int scale
smd pads, front layer
a fiducial (usually a smd) local to the parent footprint
Definition: pad_shapes.h:81
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
std::vector< PAD_CS_PRIMITIVE > m_primitives
bool IsType(FRAME_T aType) const
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:430
static const LSET std_pad_layers[]
void onDeletePrimitive(wxCommandEvent &event) override
Event handlers of basic shapes list panel.
void onDuplicatePrimitive(wxCommandEvent &event) override
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:462
#define _(s)
Definition: 3d_actions.cpp:33
virtual bool IsMousewheelPanEnabled() const
Function IsMousewheelPanEnabled()
void SetSketchMode(int aItemLayer, bool aEnabled)
Function SetSketchMode Turns on/off sketch mode for given item layer.
Definition: pcb_painter.h:111
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:426
void GRFilledSegment(EDA_RECT *aClipBox, wxDC *aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor)
Definition: gr_basic.cpp:423
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:596
const wxSize & GetDrillSize() const
Definition: class_pad.h:306
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
bool IsAperturePad() const
Definition: class_pad.h:456
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Executes the changes.
Pads are not covered.
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:238
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
#define SELECTED_ITEMS_LAYER
bool m_ShowPadFilled
Definition: class_pad.h:75
virtual long long int GetValue()
Function GetValue Returns the current value in Internal Units.
void SetEnd(const wxPoint &aEnd)
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:577
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:438
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:675
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:258
bool padValuesOK()
test if all values are acceptable for the pad
void SetChamferRectRatio(double aChamferScale)
has meaning only for chamfered rect pads Set the ratio between the smaller Y or Y size and the radius...
Definition: class_pad.h:712
COLOR4D m_Color
Definition: class_pad.h:66
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers of advanced config.
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:468
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
Definition: class_pad.cpp:118
void SetCustomShapeInZoneOpt(CUST_PAD_SHAPE_IN_ZONE aOption)
Set the option for the custom pad shape to use as clearance area in copper zones.
Definition: class_pad.h:263
void InstallPadOptionsFrame(D_PAD *pad)
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
const Vec & GetSize() const
Definition: box2.h:188
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:237
Module description (excepted pads)
Definition: colors.h:45
static LSET ApertureMask()
layer set for an aperture pad
Definition: class_pad.cpp:132
BOARD * GetBoard() const
const Vec & GetOrigin() const
Definition: box2.h:192
VIEW.
Definition: view.h:61
void SetBoundary(const BOX2D &aBoundary)
Function SetBoundary() Sets limits for view area.
Definition: view.h:267
bool m_Display_netname
Definition: class_pad.h:74
const wxSize & GetSize() const
Definition: class_pad.h:300
void SetProperty(PAD_PROP_T aProperty)
Definition: class_pad.cpp:432
const wxPoint GetPosition() const override
Definition: class_pad.h:241
double GetScale() const
Function GetScale()
Definition: view.h:257
int GetLocalSolderPasteMargin() const
Definition: class_pad.h:467
std::vector< DRAWSEGMENT * > m_highlight
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:308
a test point pad
Definition: pad_shapes.h:82
A dialog to apply geometry transforms to a shape or set of shapes (move, rotate around origin,...
void GRClosedPoly(EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, COLOR4D Color, COLOR4D BgColor)
Function GRClosedPoly draws a closed polygon onto the drawing context aDC and optionally fills and/or...
Definition: gr_basic.cpp:552
void SetThermalGap(int aGap)
Definition: class_pad.h:545
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:462
const wxPoint GetPosition() const override
Definition: class_module.h:210
bool SetPrimitives(const std::vector< PAD_CS_PRIMITIVE > &aPrimitivesList)
Import to the basic shape list.
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void DeletePrimitivesList()
clear the basic shapes list
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...
double m_ArcAngle
radius of a circle
Definition: class_pad.h:97
void Enable(bool aEnable)
Function Enable Enables/diasables the label, widget and units label.
a dialog to edit basics shapes parameters.
double GetLocalSolderPasteMarginRatio() const
Definition: class_pad.h:470
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:132
bool TransferDataFromWindow() override
Function TransferDataFromWindow Transfer data out of the GUI.
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:302
void OnUpdateUI(wxUpdateUIEvent &event) override
void SetChamferPositions(int aChamferPositions)
has meaning only for chamfered rect pads set the position of the chamfer for a 0 orientation,...
Definition: class_pad.h:732
void GRArc1(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int xc, int yc, COLOR4D Color)
Definition: gr_basic.cpp:640
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:40
virtual void ChangeValue(int aValue)
Function ChangeValue Changes the value (in Internal Units) for the text field, taking care of units c...
void SetWidth(int aWidth)