KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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, [email protected]
6 * Copyright (C) 2008-2013 Wayne Stambaugh <[email protected]>
7 * Copyright The 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, see <https://www.gnu.org/licenses/>.
21 */
22
23#include "kiway_holder.h"
24#include "mail_type.h"
25#include "padstack.h"
26#include <base_units.h>
27#include <bitmaps.h>
28#include <board_commit.h>
29#include <board.h>
31#include <footprint.h>
32#include <confirm.h>
33#include <core/arraydim.h>
34#include <convert_basic_shapes_to_polygon.h> // for enum RECT_CHAMFER_POSITIONS definition
39#include <drc/drc_item.h>
40#include <macros.h>
41#include <pad.h>
42#include <pad_utils.h>
43#include <pcb_base_frame.h>
45#include <pcb_painter.h>
46#include <pcbnew_settings.h>
48#include <view/view_controls.h>
51#include <tool/tool_manager.h>
52#include <tools/pad_tool.h>
53#include <advanced_config.h> // for pad property feature management
54#include <algorithm>
55#include <frame_type.h>
56#include <lseq.h>
57#include <kiway.h>
58#include <kiway_player.h>
59#include <pth_hole_size.h>
60#include <wx/choicdlg.h>
61#include <wx/msgdlg.h>
62
63
64int DIALOG_PAD_PROPERTIES::m_page = 0; // remember the last open page during session
65
66
67// list of pad shapes, ordered like the pad shape wxChoice in dialog.
69{
76 PAD_SHAPE::CHAMFERED_RECT, // choice = CHOICE_SHAPE_CHAMFERED_ROUNDED_RECT
77 PAD_SHAPE::CUSTOM, // choice = CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR
78 PAD_SHAPE::CUSTOM // choice = PAD_SHAPE::CUSTOM_RECT_ANCHOR
79};
80
81
82// the ordered index of the pad shape wxChoice in dialog.
83// keep it consistent with code_shape[] and dialog strings
96
97
99{
104 PAD_ATTRIB::SMD, // Aperture pad :type SMD with no copper layers,
105 // only on tech layers (usually only on paste layer
107};
108
109
110// These define have the same value as the m_PadType wxChoice GetSelected() return value
111#define PTH_DLG_TYPE 0
112#define SMD_DLG_TYPE 1
113#define CONN_DLG_TYPE 2
114#define NPTH_DLG_TYPE 3
115#define APERTURE_DLG_TYPE 4
116#define NON_COMPONENT_DLG_TYPE 5
117
118
120{
121 DIALOG_PAD_PROPERTIES dlg( this, aPad );
122
123 // QuasiModal required for NET_SELECTOR
124 dlg.ShowQuasiModal();
125}
126
127
130 m_parent( aParent ),
131 m_currentPad( &aPad ),
132 m_previewPad( new PAD( (FOOTPRINT*) nullptr ) ),
133 m_initialized( false ),
134 m_editLayer( F_Cu ),
166{
167 SetName( PAD_PROPERTIES_DLG_NAME );
169
170 m_board = m_parent->GetBoard();
171
172 // Configure display origin transforms
175
176 m_padNetSelector->SetNetInfo( &m_board->GetNetInfo() );
177
179
184 m_launchCalculatorBtn->SetToolTip( _( "Open the through-hole size calculator" ) );
185
186 SetTitle( _( "Pad Properties" ) );
187
188 *m_previewPad = aPad;
189 m_previewPad->GetTeardropParams() = aPad.GetTeardropParams();
190 m_previewPad->ClearFlags( SELECTED|BRIGHTENED );
191
192 // Pads have a hardcoded internal rounding ratio which is 0.25 by default, even if
193 // they're not a rounded shape. This makes it hard to detect an intentional 0.25
194 // ratio, or one that's only there because it's the PAD default.
195 // Zero it out here to mark that we should recompute a better ratio if the user
196 // selects a pad shape which would need a default rounding ratio computed for it
197 m_previewPad->Padstack().ForEachUniqueLayer(
198 [&]( PCB_LAYER_ID aLayer )
199 {
201 m_previewPad->SetRoundRectRadiusRatio( aLayer, 0.0 );
202 } );
203
204 if( m_isFpEditor )
205 {
206 m_padNetLabel->Show( false );
207 m_padNetSelector->Show( false );
208 }
209
210 m_FlippedWarningSizer->Show( false );
211
212 // Pad needs to have a parent for painting; use the parent board for its design settings
213 if( !m_previewPad->GetParent() )
214 m_previewPad->SetParent( m_board );
215
221 m_pad_orientation.SetPrecision( 3 );
222
224 m_spokeAngle.SetPrecision( 3 );
225
226 // Update label text and tooltip for combined offset + ratio field
227 m_pasteMarginLabel->SetLabel( _( "Solder paste clearance:" ) );
228 m_pasteMarginLabel->SetToolTip( _( "Local solder paste clearance for this pad.\n"
229 "Enter an absolute value (e.g., -0.1mm), a percentage (e.g., -5%), "
230 "or both (e.g., -0.1mm - 5%).\n"
231 "If blank, the footprint or global value is used." ) );
232
233 m_padToDieDelay.SetUnits( EDA_UNITS::PS );
235
236 m_backDrillTopLayer->SetLayersHotkeys( false );
237 m_backDrillTopLayer->SetNotAllowedLayerSet( LSET::AllNonCuMask() );
238 m_backDrillTopLayer->SetBoardFrame( m_parent );
239 m_backDrillTopLayer->SetUndefinedLayerName( _( "None" ) );
240 m_backDrillTopLayer->Resync();
241
242 m_backDrillBottomLayer->SetLayersHotkeys( false );
243 m_backDrillBottomLayer->SetNotAllowedLayerSet( LSET::AllNonCuMask() );
244 m_backDrillBottomLayer->SetBoardFrame( m_parent );
245 m_backDrillBottomLayer->SetUndefinedLayerName( _( "None" ) );
246 m_backDrillBottomLayer->Resync();
247
248 initValues();
249
250 m_techLayersLabel->SetFont( KIUI::GetStatusFont( this ) );
251 m_parentInfo->SetFont( KIUI::GetSmallInfoFont( this ) );
252 m_teardropShapeLabel->SetFont( KIUI::GetStatusFont( this ) );
253
254 wxFont infoFont = KIUI::GetSmallInfoFont( this ).Italic();
255 m_nonCopperNote->SetFont( infoFont );
256 m_staticTextInfoPaste->SetFont( infoFont );
257
260
261 // Usually, TransferDataToWindow is called by OnInitDialog
262 // calling it here fixes all widget sizes so FinishDialogSettings can safely fix minsizes
264
265 // Initialize canvas to be able to display the dummy pad:
267
268 m_notebook->SetSelection( m_page );
269
270 switch( m_page )
271 {
272 default:
273 case 0: SetInitialFocus( m_padNumCtrl ); break;
274 case 1: SetInitialFocus( m_thermalGapCtrl ); break;
275 case 2: SetInitialFocus( m_clearanceCtrl ); break;
276 }
277
279 m_initialized = true;
280
281 m_padNetSelector->Connect( FILTERED_ITEM_SELECTED,
282 wxCommandEventHandler( DIALOG_PAD_PROPERTIES::OnValuesChanged ),
283 nullptr, this );
284
285 if( m_padType->GetSelection() != PTH_DLG_TYPE && m_padType->GetSelection() != NPTH_DLG_TYPE )
286 {
287 m_gbSizerHole->Show( false );
288 m_staticline71->Show( false );
289 }
290
291 // Now all widgets have the size fixed, call FinishDialogSettings
293
294 // Update widgets
295 wxUpdateUIEvent dummyUI;
296 OnUpdateUI( dummyUI );
297
298 // Post a dummy size event to force the pad preview panel to update the
299 // view: actual size, best zoom ... after the frame is shown
300 PostSizeEvent();
301}
302
303
305{
306 m_padNetSelector->Disconnect( FILTERED_ITEM_SELECTED,
307 wxCommandEventHandler( DIALOG_PAD_PROPERTIES::OnValuesChanged ),
308 nullptr, this );
309
310 m_page = m_notebook->GetSelection();
311
312 delete m_previewPad;
313 delete m_axisOrigin;
314}
315
316
317// Store the pad draw option during a session.
319
320
321void DIALOG_PAD_PROPERTIES::OnInitDialog( wxInitDialogEvent& event )
322{
323 m_selectedColor = COLOR4D( 1.0, 1.0, 1.0, 0.7 );
324
325 // Needed on some WM to be sure the pad is redrawn according to the final size
326 // of the canvas, with the right zoom factor
327 redraw();
328}
329
330
331void DIALOG_PAD_PROPERTIES::OnCancel( wxCommandEvent& event )
332{
333 // Mandatory to avoid m_panelShowPadGal trying to draw something
334 // in a non valid context during closing process:
335 m_padPreviewGAL->StopDrawing();
336
337 // Now call default handler for wxID_CANCEL command event
338 event.Skip();
339}
340
341
342static void showCalculatorPage( KIWAY_PLAYER& aHolder, std::string& aPayload )
343{
344 KIWAY& kiway = aHolder.Kiway();
345 KIWAY_PLAYER* calcFrame = kiway.Player( FRAME_CALC, true );
346
347 if( !calcFrame )
348 return;
349
350 kiway.ExpressMail( FRAME_CALC, MAIL_CALC_SHOW, aPayload, &aHolder );
351
352 if( !calcFrame->IsVisible() )
353 calcFrame->Show( true );
354
355 if( calcFrame->IsIconized() )
356 calcFrame->Iconize( false );
357
358 calcFrame->Raise();
359}
360
361
363{
364 nlohmann::json payload;
365 payload["page"] = "pth_size";
366
367 std::string payloadStr = payload.dump();
368
369 showCalculatorPage( *m_parent, payloadStr );
370}
371
372
374{
375 COLOR_SETTINGS* colorSettings = m_parent->GetColorSettings();
376
377 // Warning: the opts data life time must be at least the dialog life time
378 static GAL_DISPLAY_OPTIONS_IMPL opts = m_parent->GetGalDisplayOptions();
379 opts.m_forceDisplayCursor = false;
380
381 // Initialize the canvas to display the pad
382 m_padPreviewGAL = new PCB_DRAW_PANEL_GAL( m_boardViewPanel, -1, wxDefaultPosition, wxDefaultSize, opts,
383 m_parent->GetCanvas()->GetBackend() );
384
385 m_padPreviewSizer->Add( m_padPreviewGAL, 12, wxEXPAND | wxALL, 5 );
386
387 // Show the X and Y axis. It is useful because pad shape can have an offset
388 // or be a complex shape.
390 100000, VECTOR2D( m_previewPad->GetPosition() ) );
391 m_axisOrigin->SetDrawAtZero( true );
392
393 m_padPreviewGAL->UpdateColors();
394 m_padPreviewGAL->SetStealsFocus( false );
395 m_padPreviewGAL->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
396
397 KIGFX::VIEW_CONTROLS* parentViewControls = m_parent->GetCanvas()->GetViewControls();
398 m_padPreviewGAL->GetViewControls()->ApplySettings( parentViewControls->GetSettings() );
399
400 m_padPreviewGAL->Show();
401
402 KIGFX::VIEW* view = m_padPreviewGAL->GetView();
403
404 // fix the pad render mode (filled/not filled)
405 auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
406
407 settings->m_ForcePadSketchModeOn = m_cbShowPadOutline->IsChecked();
408 settings->SetHighContrast( false );
409 settings->m_ContrastModeDisplay = HIGH_CONTRAST_MODE::NORMAL;
410
411 // don't show the locked item shadow in pad preview
413
414 // gives a non null grid size (0.001mm) because GAL layer does not like a 0 size grid:
415 double gridsize = 0.001 * pcbIUScale.IU_PER_MM;
416 view->GetGAL()->SetGridSize( VECTOR2D( gridsize, gridsize ) );
417
418 // And do not show the grid:
419 view->GetGAL()->SetGridVisibility( false );
420 view->GetGAL()->SetAxesEnabled( false );
421 view->Add( m_previewPad );
422 view->Add( m_axisOrigin );
423
424 m_padPreviewGAL->StartDrawing();
425 Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PAD_PROPERTIES::OnResize ) );
426}
427
428
433
434
441
442
443void DIALOG_PAD_PROPERTIES::OnEditLayerChanged( wxCommandEvent& aEvent )
444{
445 // Save data from the previous layer
447
448 switch( m_previewPad->Padstack().Mode() )
449 {
450 default:
453 break;
454
456 switch( m_cbEditLayer->GetSelection() )
457 {
458 default:
459 case 0: m_editLayer = F_Cu; break;
460 case 1: m_editLayer = PADSTACK::INNER_LAYERS; break;
461 case 2: m_editLayer = B_Cu; break;
462 }
463 break;
464
466 {
467 int layer = m_cbEditLayer->GetSelection();
468
469 if( layer < 0 )
470 layer = 0;
471
472 if( m_editLayerCtrlMap.contains( layer ) )
473 m_editLayer = m_editLayerCtrlMap.at( layer );
474 else
476 }
477 }
478
479 // Load controls with the current layer
481
482 wxCommandEvent cmd_event;
483 onPadShapeSelection( false );
484 OnOffsetCheckbox( cmd_event );
485
486 redraw();
487}
488
489
491{
492 // Note: use ChangeValue() to avoid generating a wxEVT_TEXT event
493 m_cornerRadius.ChangeValue( m_previewPad->GetRoundRectCornerRadius( m_editLayer ) );
494
495 m_cornerRatio.ChangeDoubleValue( m_previewPad->GetRoundRectRadiusRatio( m_editLayer ) * 100.0 );
496 m_mixedCornerRatio.ChangeDoubleValue( m_previewPad->GetRoundRectRadiusRatio( m_editLayer ) * 100.0 );
497
498 m_chamferRatio.ChangeDoubleValue( m_previewPad->GetChamferRectRatio( m_editLayer ) * 100.0 );
499 m_mixedChamferRatio.ChangeDoubleValue( m_previewPad->GetChamferRectRatio( m_editLayer ) * 100.0 );
500}
501
502
504{
507 {
508 return;
509 }
510
511 if( m_cornerRadius.GetValue() < 0 )
512 m_cornerRadiusCtrl->ChangeValue( "0" );
513
515 {
516 m_previewPad->SetRoundRectCornerRadius( m_editLayer, m_cornerRadius.GetValue() );
517
518 m_cornerRatio.ChangeDoubleValue( m_previewPad->GetRoundRectRadiusRatio( m_editLayer ) * 100.0 );
519 m_mixedCornerRatio.ChangeDoubleValue( m_previewPad->GetRoundRectRadiusRatio( m_editLayer ) * 100.0 );
520
521 redraw();
522 }
523
524 if( m_initialized )
525 OnModify();
526}
527
528
530{
531 // The maximum chamfer ratio is 50% of the smallest pad side if adjacent sides
532 // are selected, or 100% of the smallest pad side if only one side is selected.
533 double baseline = 1.0;
534
535 auto considerCheckboxes = [&]( const std::vector<wxCheckBox*>& checkBoxes )
536 {
537 for( size_t ii : { 0, 1, 2, 3 } )
538 {
539 if( !checkBoxes[ii]->IsChecked() )
540 continue;
541
542 if( checkBoxes[( ii + 1 ) % 4]->IsChecked() || checkBoxes[( ii - 1 ) % 4]->IsChecked() )
543 {
544 // If two adjacent corners are selected, the maximum chamfer ratio is 50%
545 baseline = std::max( baseline, 0.5 );
546 break;
547 }
548 }
549 };
550
551
552 baseline = 1.0 - m_previewPad->GetRoundRectRadiusRatio( m_editLayer );
553 considerCheckboxes( { m_cbTopLeft1, m_cbTopRight1, m_cbBottomRight1, m_cbBottomLeft1 } );
554 considerCheckboxes( { m_cbTopLeft, m_cbTopRight, m_cbBottomRight, m_cbBottomLeft } );
555
556 // If only one corner is selected, the maximum chamfer ratio is 100%
557 return baseline;
558}
559
560
562{
563 return 1.0 - m_previewPad->GetChamferRectRatio( m_editLayer );
564}
565
566
568{
569 auto updateCheckBoxes = []( const std::vector<wxCheckBox*>& aCheckBoxes )
570 {
571 for( size_t ii : { 0, 1, 2, 3 } )
572 {
573 bool disable = aCheckBoxes[( ii + 1 ) % 4]->IsChecked()
574 || aCheckBoxes[( ii + 3 ) % 4]->IsChecked();
575
576 aCheckBoxes[ii]->Enable( !disable );
577
578 if( disable )
579 aCheckBoxes[ii]->SetValue( false );
580 }
581 };
582
583 if( m_mixedChamferRatio.GetDoubleValue() > 50.0 )
585
586 if( m_chamferRatio.GetDoubleValue() > 50.0 )
587 updateCheckBoxes( { m_cbTopLeft, m_cbTopRight, m_cbBottomRight, m_cbBottomLeft } );
588}
589
590
592{
595 {
596 return;
597 }
598
599 wxObject* ctrl = event.GetEventObject();
600 wxString value = event.GetString();
601 bool changed = false;
602
603 if( ctrl == m_cornerRatioCtrl || ctrl == m_mixedCornerRatioCtrl )
604 {
605 double ratioPercent;
606
607 if( value.ToDouble( &ratioPercent ) )
608 {
609 // Clamp ratioPercent to acceptable value (0.0 to 50.0)
610 double maxRatio = getMaxCornerRadius();
611
612 if( ratioPercent < 0.0 )
613 {
614 m_cornerRatio.SetDoubleValue( 0.0 );
615 m_mixedCornerRatio.SetDoubleValue( 0.0 );
616 }
617 else if( ratioPercent > maxRatio * 100.0 )
618 {
619 m_cornerRatio.SetDoubleValue( maxRatio * 100.0 );
620 m_mixedCornerRatio.SetDoubleValue( maxRatio * 100.0 );
621 }
622
623 if( ctrl == m_cornerRatioCtrl )
624 m_mixedCornerRatioCtrl->ChangeValue( value );
625 else
626 m_cornerRatioCtrl->ChangeValue( value );
627
628 changed = true;
629 }
630 }
631 else if( ctrl == m_chamferRatioCtrl || ctrl == m_mixedChamferRatioCtrl )
632 {
633 double ratioPercent;
634
635 if( value.ToDouble( &ratioPercent ) )
636 {
637 double maxRatio = getMaxChamferRatio();
638 // Clamp ratioPercent to acceptable value (0.0 to maxRatio)
639 if( ratioPercent < 0.0 )
640 {
641 m_chamferRatio.SetDoubleValue( 0.0 );
642 m_mixedChamferRatio.SetDoubleValue( 0.0 );
643 }
644 else if( ratioPercent > maxRatio * 100.0 )
645 {
646 m_chamferRatio.SetDoubleValue( maxRatio * 100.0 );
647 m_mixedChamferRatio.SetDoubleValue( maxRatio * 100.0 );
648 }
649
650 if( ctrl == m_chamferRatioCtrl )
651 m_mixedChamferRatioCtrl->ChangeValue( value );
652 else
653 m_chamferRatioCtrl->ChangeValue( value );
654
656
657 changed = true;
658 }
659 }
660
661 if( changed && transferDataToPad( m_previewPad ) )
662 m_cornerRadius.ChangeValue( m_previewPad->GetRoundRectCornerRadius( m_editLayer ) );
663
664 redraw();
665
666 if( m_initialized )
667 OnModify();
668}
669
670
672{
673 wxString msg;
674
675 // Disable pad net name wxTextCtrl if the caller is the footprint editor
676 // because nets are living only in the board managed by the board editor
678
679 m_layerFrontAdhesive->SetLabel( m_board->GetLayerName( F_Adhes ) );
680 m_layerBackAdhesive->SetLabel( m_board->GetLayerName( B_Adhes ) );
681 m_layerFrontPaste->SetLabel( m_board->GetLayerName( F_Paste ) );
682 m_layerBackPaste->SetLabel( m_board->GetLayerName( B_Paste ) );
683 m_layerFrontSilk->SetLabel( m_board->GetLayerName( F_SilkS ) );
684 m_layerBackSilk->SetLabel( m_board->GetLayerName( B_SilkS ) );
685 m_layerFrontMask->SetLabel( m_board->GetLayerName( F_Mask ) );
686 m_layerBackMask->SetLabel( m_board->GetLayerName( B_Mask ) );
687 m_layerECO1->SetLabel( m_board->GetLayerName( Eco1_User ) );
688 m_layerECO2->SetLabel( m_board->GetLayerName( Eco2_User ) );
689 m_layerUserDwgs->SetLabel( m_board->GetLayerName( Dwgs_User ) );
690
691 VECTOR2I absPos;
692
693 if( m_currentPad )
694 {
695 absPos = m_currentPad->GetPosition();
696
697 if( FOOTPRINT* footprint = m_currentPad->GetParentFootprint() )
698 {
699 VECTOR2I relPos = m_currentPad->GetFPRelativePosition();
700
701 if( footprint->IsFlipped() )
702 {
703 // flip pad (up/down) around its position
705 relPos.y = - relPos.y;
706 }
707
708 m_previewPad->SetPosition( relPos );
709 m_previewPad->SetOrientation( m_currentPad->GetFPRelativeOrientation() );
710
711 // Display parent footprint info
712 msg.Printf( _("Footprint %s (%s), %s, rotated %g deg"),
713 footprint->Reference().GetShownText( FOR_GUI ),
714 footprint->Value().GetShownText( FOR_GUI ),
715 footprint->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" ),
716 footprint->GetOrientation().AsDegrees() );
717
718 m_FlippedWarningSizer->Show( footprint->IsFlipped() );
719 m_parentInfo->SetLabel( msg );
720 }
721
722 m_padNumCtrl->SetValue( m_previewPad->GetNumber() );
723 }
724 else
725 {
726 PAD_TOOL* padTool = m_parent->GetToolManager()->GetTool<PAD_TOOL>();
727 m_padNumCtrl->SetValue( padTool->GetLastPadNumber() );
728 }
729
731
732 m_padNetSelector->SetSelectedNetcode( m_previewPad->GetNetCode() );
733
734 // Display current pad parameters units:
735 m_posX.ChangeValue( absPos.x );
736 m_posY.ChangeValue( absPos.y );
737
738 m_holeX.ChangeValue( m_previewPad->GetDrillSize().x );
739 m_holeY.ChangeValue( m_previewPad->GetDrillSize().y );
740
742
743 m_padToDieOpt->SetValue( m_previewPad->GetPadToDieLength() != 0 );
744 m_padToDie.ChangeValue( m_previewPad->GetPadToDieLength() );
745
746 m_padToDieDelayOpt->SetValue( m_previewPad->GetPadToDieDelay() != 0 );
747 m_padToDieDelay.ChangeValue( m_previewPad->GetPadToDieDelay() );
748
749 if( m_previewPad->GetLocalClearance().has_value() )
750 m_clearance.ChangeValue( m_previewPad->GetLocalClearance().value() );
751 else
752 m_clearance.ChangeValue( wxEmptyString );
753
754 if( m_previewPad->GetLocalSolderMaskMargin().has_value() )
755 m_maskMargin.ChangeValue( m_previewPad->GetLocalSolderMaskMargin().value() );
756 else
757 m_maskMargin.ChangeValue( wxEmptyString );
758
759 m_pasteMargin.SetOffsetValue( m_previewPad->GetLocalSolderPasteMargin() );
760 m_pasteMargin.SetRatioValue( m_previewPad->GetLocalSolderPasteMarginRatio() );
761
762 if( m_previewPad->GetLocalThermalSpokeWidthOverride().has_value() )
763 m_spokeWidth.ChangeValue( m_previewPad->GetLocalThermalSpokeWidthOverride().value() );
764 else
765 m_spokeWidth.SetNull();
766
767 if( m_previewPad->GetLocalThermalGapOverride().has_value() )
768 m_thermalGap.ChangeValue( m_previewPad->GetLocalThermalGapOverride().value() );
769 else
770 m_thermalGap.SetNull();
771
772 m_spokeAngle.ChangeAngleValue( m_previewPad->GetThermalSpokeAngle() );
773 m_pad_orientation.ChangeAngleValue( m_previewPad->GetOrientation() );
774
775 m_cbTeardrops->SetValue( m_previewPad->GetTeardropParams().m_Enabled );
776 m_cbTeardropsUseNextTrack->SetValue( m_previewPad->GetTeardropParams().m_AllowUseTwoTracks );
777 m_cbPreferZoneConnection->SetValue( !m_previewPad->GetTeardropParams().m_TdOnPadsInZones );
778 m_teardropMaxLenSetting.SetValue( m_previewPad->GetTeardropParams().m_TdMaxLen );
779 m_teardropMaxHeightSetting.SetValue( m_previewPad->GetTeardropParams().m_TdMaxWidth );
780 m_spTeardropLenPercent->SetValue( m_previewPad->GetTeardropParams().m_BestLengthRatio *100 );
781 m_spTeardropSizePercent->SetValue( m_previewPad->GetTeardropParams().m_BestWidthRatio *100 );
782 m_spTeardropHDPercent->SetValue( m_previewPad->GetTeardropParams().m_WidthtoSizeFilterRatio*100 );
783 m_curvedEdges->SetValue( m_previewPad->GetTeardropParams().m_CurvedEdges );
784
785 switch( m_previewPad->GetLocalZoneConnection() )
786 {
787 default:
788 case ZONE_CONNECTION::INHERITED: m_ZoneConnectionChoice->SetSelection( 0 ); break;
789 case ZONE_CONNECTION::FULL: m_ZoneConnectionChoice->SetSelection( 1 ); break;
790 case ZONE_CONNECTION::THERMAL: m_ZoneConnectionChoice->SetSelection( 2 ); break;
791 case ZONE_CONNECTION::NONE: m_ZoneConnectionChoice->SetSelection( 3 ); break;
792 }
793
794 if( m_previewPad->GetCustomShapeInZoneOpt() == CUSTOM_SHAPE_ZONE_MODE::CONVEXHULL )
795 m_ZoneCustomPadShape->SetSelection( 1 );
796 else
797 m_ZoneCustomPadShape->SetSelection( 0 );
798
799 // Type of pad selection
800 bool aperture = m_previewPad->GetAttribute() == PAD_ATTRIB::SMD && m_previewPad->IsAperturePad();
801
802 if( aperture )
803 {
804 m_padType->SetSelection( APERTURE_DLG_TYPE );
805 }
806 else
807 {
808 switch( m_previewPad->GetAttribute() )
809 {
810 case PAD_ATTRIB::PTH: m_padType->SetSelection( PTH_DLG_TYPE ); break;
811 case PAD_ATTRIB::SMD: m_padType->SetSelection( SMD_DLG_TYPE ); break;
812 case PAD_ATTRIB::CONN: m_padType->SetSelection( CONN_DLG_TYPE ); break;
813 case PAD_ATTRIB::NPTH: m_padType->SetSelection( NPTH_DLG_TYPE ); break;
814 case PAD_ATTRIB::NON_COMPONENT: m_padType->SetSelection( NON_COMPONENT_DLG_TYPE ); break;
815 }
816 }
817
818 switch( m_previewPad->GetProperty() )
819 {
820 case PAD_PROP::NONE: m_choiceFabProperty->SetSelection( 0 ); break;
821 case PAD_PROP::BGA: m_choiceFabProperty->SetSelection( 1 ); break;
822 case PAD_PROP::FIDUCIAL_LOCAL: m_choiceFabProperty->SetSelection( 2 ); break;
823 case PAD_PROP::FIDUCIAL_GLBL: m_choiceFabProperty->SetSelection( 3 ); break;
824 case PAD_PROP::TESTPOINT: m_choiceFabProperty->SetSelection( 4 ); break;
825 case PAD_PROP::HEATSINK: m_choiceFabProperty->SetSelection( 5 ); break;
826 case PAD_PROP::MECHANICAL: m_choiceFabProperty->SetSelection( 6 ); break;
827 case PAD_PROP::CASTELLATED: m_choiceFabProperty->SetSelection( 7 ); break;
828 case PAD_PROP::PRESSFIT: m_choiceFabProperty->SetSelection( 8 ); break;
829 }
830
831 if( m_previewPad->GetDrillShape() != PAD_DRILL_SHAPE::OBLONG )
832 m_holeShapeCtrl->SetSelection( 0 );
833 else
834 m_holeShapeCtrl->SetSelection( 1 );
835
836 // Backdrills are read through the PADSTACK accessors, which key the top/bottom side on the
837 // drill's start layer, so a pad written by KiCad 10.0 (top backdrill in the tertiary slot)
838 // loads correctly.
839 const PADSTACK& padstack = m_previewPad->Padstack();
840 std::optional<int> topBackdrillSize = padstack.GetBackdrillSize( true );
841 std::optional<int> bottomBackdrillSize = padstack.GetBackdrillSize( false );
842
843 m_backDrillChoice->SetSelection( topBackdrillSize ? ( bottomBackdrillSize ? 3 : 1 )
844 : ( bottomBackdrillSize ? 2 : 0 ) );
845
846 auto loadBackdrill =
847 [&]( const std::optional<int>& aSize, PCB_LAYER_ID aEndLayer, UNIT_BINDER& aSizeBinder,
848 PCB_LAYER_BOX_SELECTOR* aLayerCtrl )
849 {
850 if( !aSize )
851 {
852 aSizeBinder.SetValue( 0 );
853 return;
854 }
855
856 aSizeBinder.SetValue( *aSize );
857 aLayerCtrl->SetLayerSelection( aEndLayer );
858 };
859
860 loadBackdrill( topBackdrillSize, padstack.GetBackdrillEndLayer( true ), m_backDrillTopSizeBinder,
862 loadBackdrill( bottomBackdrillSize, padstack.GetBackdrillEndLayer( false ), m_backDrillBottomSizeBinder,
864
865 // Post machining
866 const PADSTACK::POST_MACHINING_PROPS& frontPostMachining = m_previewPad->Padstack().FrontPostMachining();
867
868 if( frontPostMachining.mode == PAD_DRILL_POST_MACHINING_MODE::COUNTERBORE )
869 m_topPostMachining->SetSelection( 2 );
870 else if( frontPostMachining.mode == PAD_DRILL_POST_MACHINING_MODE::COUNTERSINK )
871 m_topPostMachining->SetSelection( 1 );
872 else
873 m_topPostMachining->SetSelection( 0 );
874
875 m_topPostMachineSize1Binder.SetValue( frontPostMachining.size );
876
877 if( frontPostMachining.mode == PAD_DRILL_POST_MACHINING_MODE::COUNTERSINK )
878 {
880 m_topPostMachineSize2Binder.SetDoubleValue( frontPostMachining.angle / 10.0 );
881 }
882 else
883 {
884 m_topPostMachineSize2Binder.SetValue( frontPostMachining.depth );
885 }
886
887 const PADSTACK::POST_MACHINING_PROPS& backPostMachining = m_previewPad->Padstack().BackPostMachining();
888
889 if( backPostMachining.mode == PAD_DRILL_POST_MACHINING_MODE::COUNTERBORE )
890 m_bottomPostMachining->SetSelection( 2 );
891 else if( backPostMachining.mode == PAD_DRILL_POST_MACHINING_MODE::COUNTERSINK )
892 m_bottomPostMachining->SetSelection( 1 );
893 else
894 m_bottomPostMachining->SetSelection( 0 );
895
896 m_bottomPostMachineSize1Binder.SetValue( backPostMachining.size );
897
898 if( backPostMachining.mode == PAD_DRILL_POST_MACHINING_MODE::COUNTERSINK )
899 {
901 m_bottomPostMachineSize2Binder.SetDoubleValue( backPostMachining.angle / 10.0 );
902 }
903 else
904 {
905 m_bottomPostMachineSize2Binder.SetValue( backPostMachining.depth );
906 }
907
908 switch( m_previewPad->GetSimElectricalType() )
909 {
910 case PAD_SIM_ELECTRICAL_TYPE::NONE: m_simElectricalTypeCtrl->SetSelection( 0 ); break;
911 case PAD_SIM_ELECTRICAL_TYPE::SOURCE: m_simElectricalTypeCtrl->SetSelection( 1 ); break;
912 case PAD_SIM_ELECTRICAL_TYPE::SINK: m_simElectricalTypeCtrl->SetSelection( 2 ); break;
913 }
914
915 updatePadLayersList( m_previewPad->GetLayerSet(), m_previewPad->GetRemoveUnconnected(),
916 m_previewPad->GetKeepTopBottom() );
917
918 // Update some dialog widgets state (Enable/disable options):
919 wxCommandEvent cmd_event;
920 onPadShapeSelection( false );
921 OnOffsetCheckbox( cmd_event );
923}
924
925
927{
928 m_primitives = m_previewPad->GetPrimitives( m_editLayer );
929
930 m_sizeX.ChangeValue( m_previewPad->GetSize( m_editLayer ).x );
931 m_sizeY.ChangeValue( m_previewPad->GetSize( m_editLayer ).y );
932
933 m_offsetShapeOpt->SetValue( m_previewPad->GetOffset( m_editLayer ) != VECTOR2I() );
934 m_offsetX.ChangeValue( m_previewPad->GetOffset( m_editLayer ).x );
935 m_offsetY.ChangeValue( m_previewPad->GetOffset( m_editLayer ).y );
936
937 if( m_previewPad->GetDelta( m_editLayer ).x )
938 {
939 m_trapDelta.ChangeValue( m_previewPad->GetDelta( m_editLayer ).x );
940 m_trapAxisCtrl->SetSelection( 0 );
941 }
942 else
943 {
944 m_trapDelta.ChangeValue( m_previewPad->GetDelta( m_editLayer ).y );
945 m_trapAxisCtrl->SetSelection( 1 );
946 }
947
948 switch( m_previewPad->GetShape( m_editLayer ) )
949 {
950 default:
951 case PAD_SHAPE::CIRCLE: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_CIRCLE ); break;
952 case PAD_SHAPE::OVAL: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_OVAL ); break;
953 case PAD_SHAPE::RECTANGLE: m_PadShapeSelector->SetSelection( CHOICE_SHAPE_RECT ); break;
956
958 if( m_previewPad->GetRoundRectRadiusRatio( m_editLayer ) > 0.0 )
960 else
962 break;
963
965 if( m_previewPad->GetAnchorPadShape( m_editLayer ) == PAD_SHAPE::RECTANGLE )
967 else
969 break;
970 }
971
972 int chamferPositions = m_previewPad->GetChamferPositions( m_editLayer );
973
974 m_cbTopLeft->SetValue( chamferPositions & RECT_CHAMFER_TOP_LEFT );
975 m_cbTopLeft1->SetValue( chamferPositions & RECT_CHAMFER_TOP_LEFT );
976 m_cbTopRight->SetValue( chamferPositions & RECT_CHAMFER_TOP_RIGHT );
977 m_cbTopRight1->SetValue( chamferPositions & RECT_CHAMFER_TOP_RIGHT );
978 m_cbBottomLeft->SetValue( chamferPositions & RECT_CHAMFER_BOTTOM_LEFT );
979 m_cbBottomLeft1->SetValue( chamferPositions & RECT_CHAMFER_BOTTOM_LEFT );
980 m_cbBottomRight->SetValue( chamferPositions & RECT_CHAMFER_BOTTOM_RIGHT );
981 m_cbBottomRight1->SetValue( chamferPositions & RECT_CHAMFER_BOTTOM_RIGHT );
982
984}
985
986
988{
989 // NOTE: synchronize changes here with DIALOG_TRACK_VIA_PROPERTIES::afterPadstackModeChanged
990
991 wxCHECK_MSG( m_board, /* void */, "Expected valid board in afterPadstackModeChanged" );
992 m_cbEditLayer->Clear();
993
994 switch( m_previewPad->Padstack().Mode() )
995 {
997 m_cbPadstackMode->SetSelection( 0 );
998 m_cbEditLayer->Append( m_board->GetLayerName( F_Cu ) );
999 m_cbEditLayer->Disable();
1000 m_editLayer = F_Cu;
1001 m_editLayerCtrlMap = { { 0, F_Cu } };
1002 break;
1003
1005 {
1006 m_cbPadstackMode->SetSelection( 1 );
1007 m_cbEditLayer->Enable();
1008
1009 std::vector choices = {
1010 m_board->GetLayerName( F_Cu ),
1011 _( "Inner Layers" ),
1012 m_board->GetLayerName( B_Cu )
1013 };
1014
1015 m_cbEditLayer->Append( choices );
1016
1018 { 0, F_Cu },
1020 { 2, B_Cu }
1021 };
1022
1023 if( m_editLayer != F_Cu && m_editLayer != B_Cu )
1025
1026 break;
1027 }
1028
1030 {
1031 m_cbPadstackMode->SetSelection( 2 );
1032 m_cbEditLayer->Enable();
1033 LSET layers = LSET::AllCuMask() & m_board->GetEnabledLayers();
1034
1035 for( PCB_LAYER_ID layer : layers.UIOrder() )
1036 {
1037 int idx = m_cbEditLayer->Append( m_board->GetLayerName( layer ) );
1038 m_editLayerCtrlMap[idx] = layer;
1039 }
1040
1041 break;
1042 }
1043 }
1044
1045 for( const auto& [idx, layer] : m_editLayerCtrlMap )
1046 {
1047 if( layer == m_editLayer )
1048 {
1049 m_cbEditLayer->SetSelection( idx );
1050 break;
1051 }
1052 }
1053}
1054
1055
1056void DIALOG_PAD_PROPERTIES::OnResize( wxSizeEvent& event )
1057{
1058 redraw();
1059 event.Skip();
1060}
1061
1062
1064{
1065 m_sketchPreview = m_cbShowPadOutline->GetValue();
1066
1067 KIGFX::VIEW* view = m_padPreviewGAL->GetView();
1068
1069 // fix the pad render mode (filled/not filled)
1070 auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
1071
1072 settings->m_ForcePadSketchModeOn = m_cbShowPadOutline->IsChecked();
1073 settings->SetHighContrast( false );
1074 settings->m_ContrastModeDisplay = HIGH_CONTRAST_MODE::NORMAL;
1075
1076 redraw();
1077}
1078
1079
1081{
1082 onPadShapeSelection( true );
1083}
1084
1085
1087{
1088 switch( m_PadShapeSelector->GetSelection() )
1089 {
1091 case CHOICE_SHAPE_OVAL:
1092 case CHOICE_SHAPE_RECT:
1093 m_shapePropsBook->SetSelection( 0 );
1094 break;
1095
1097 m_shapePropsBook->SetSelection( 1 );
1098 break;
1099
1101 {
1102 m_shapePropsBook->SetSelection( 2 );
1103
1104 // Reasonable defaults
1105 if( m_previewPad->GetRoundRectRadiusRatio( m_editLayer ) == 0.0 )
1106 {
1107 const double ipcRadiusRatio =
1109 m_cornerRatio.ChangeDoubleValue( ipcRadiusRatio * 100 );
1110 }
1111
1112 break;
1113 }
1114
1116 m_shapePropsBook->SetSelection( 3 );
1117
1118 // Reasonable default
1119 if( m_previewPad->GetChamferRectRatio( m_editLayer ) == 0.0 )
1120 m_previewPad->SetChamferRectRatio( m_editLayer, 0.2 );
1121
1122 // Ensure the displayed value is up to date:
1123 m_chamferRatio.ChangeDoubleValue( m_previewPad->GetChamferRectRatio( m_editLayer ) * 100.0 );
1124
1125 // A reasonable default is one corner chamfered (usual for some SMD pads).
1126 if( !m_cbTopLeft->GetValue() && !m_cbTopRight->GetValue()
1127 && !m_cbBottomLeft->GetValue() && !m_cbBottomRight->GetValue() )
1128 {
1129 m_cbTopLeft->SetValue( true );
1130 m_cbTopRight->SetValue( false );
1131 m_cbBottomLeft->SetValue( false );
1132 m_cbBottomRight->SetValue( false );
1133 }
1134
1135 break;
1136
1138 m_shapePropsBook->SetSelection( 4 );
1139
1140 // Reasonable defaults
1141 if( m_previewPad->GetRoundRectRadiusRatio( m_editLayer ) == 0.0
1142 && m_previewPad->GetChamferRectRatio( m_editLayer ) == 0.0 )
1143 {
1144 const double ipcRadiusRatio =
1146 m_previewPad->SetRoundRectRadiusRatio( m_editLayer, ipcRadiusRatio );
1147 m_previewPad->SetChamferRectRatio( m_editLayer, 0.2 );
1148 }
1149
1150 // Ensure the displayed values are up to date:
1151 m_mixedChamferRatio.ChangeDoubleValue( m_previewPad->GetChamferRectRatio( m_editLayer ) * 100.0 );
1152 m_mixedCornerRatio.ChangeDoubleValue( m_previewPad->GetRoundRectRadiusRatio( m_editLayer ) * 100.0 );
1153 break;
1154
1155 case CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR: // PAD_SHAPE::CUSTOM, circular anchor
1156 case CHOICE_SHAPE_CUSTOM_RECT_ANCHOR: // PAD_SHAPE::CUSTOM, rect anchor
1157 m_shapePropsBook->SetSelection( 0 );
1158 break;
1159 }
1160
1161 if( aUpdateSpokeAngle )
1162 {
1163 // Note: must do this before enabling/disabling m_sizeY as we're using that as a flag to see
1164 // what the last shape was.
1165 if( m_PadShapeSelector->GetSelection() == CHOICE_SHAPE_CIRCLE )
1166 {
1167 if( m_sizeYCtrl->IsEnabled() && m_spokeAngle.GetAngleValue() == ANGLE_90 )
1168 m_spokeAngle.SetAngleValue( ANGLE_45 );
1169 }
1170 else
1171 {
1172 if( !m_sizeYCtrl->IsEnabled() && m_spokeAngle.GetAngleValue() == ANGLE_45 )
1173 m_spokeAngle.SetAngleValue( ANGLE_90 );
1174 }
1175 }
1176
1177 // Readjust props book size
1178 wxSize size = m_shapePropsBook->GetSize();
1179 size.y = m_shapePropsBook->GetPage( m_shapePropsBook->GetSelection() )->GetBestSize().y;
1180 m_shapePropsBook->SetMaxSize( size );
1181
1182 m_sizeY.Enable( m_PadShapeSelector->GetSelection() != CHOICE_SHAPE_CIRCLE
1184
1185 m_offsetShapeOpt->Enable( m_PadShapeSelector->GetSelection() != CHOICE_SHAPE_CIRCLE );
1186
1187 if( !m_offsetShapeOpt->IsEnabled() )
1188 m_offsetShapeOpt->SetValue( false );
1189
1190 // Show/hide controls depending on m_offsetShapeOpt being enabled
1191 m_offsetCtrls->Show( m_offsetShapeOpt->GetValue() );
1192 m_offsetShapeOptLabel->Show( m_offsetShapeOpt->GetValue() );
1193
1196
1197 for( size_t i = 0; i < m_notebook->GetPageCount(); ++i )
1198 m_notebook->GetPage( i )->Layout();
1199
1200 // Resize the dialog if its height is too small to show all widgets:
1201 if( m_MainSizer->GetSize().y < m_MainSizer->GetMinSize().y )
1202 m_MainSizer->SetSizeHints( this );
1203
1205 redraw();
1206
1207 if( m_initialized )
1208 OnModify();
1209}
1210
1211
1213{
1214 if( m_holeShapeCtrl->GetSelection() != CHOICE_SHAPE_CIRCLE )
1215 {
1216 bool hasBackdrill = ( m_backDrillChoice->GetSelection() != 0 );
1217 bool hasTopPost = ( m_topPostMachining->GetSelection() != 0 );
1218 bool hasBottomPost = ( m_bottomPostMachining->GetSelection() != 0 );
1219
1220 if( hasBackdrill || hasTopPost || hasBottomPost )
1221 {
1222 if( wxMessageBox( _( "Switching to non-circular hole will disable backdrills and post-machining. Continue?" ),
1223 _( "Warning" ), wxOK | wxCANCEL | wxICON_WARNING, this ) != wxOK )
1224 {
1225 m_holeShapeCtrl->SetSelection( CHOICE_SHAPE_CIRCLE );
1226 return;
1227 }
1228 }
1229 }
1230
1233 redraw();
1234
1235 if( m_initialized )
1236 OnModify();
1237}
1238
1239
1240void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
1241{
1243 redraw();
1244
1245 if( m_initialized )
1246 OnModify();
1247}
1248
1249
1251{
1252 m_rbCopperLayersSel->Clear();
1253
1254 switch( m_padType->GetSelection() )
1255 {
1256 case PTH_DLG_TYPE:
1257 m_rbCopperLayersSel->Append( _( "All copper layers" ) );
1258 m_rbCopperLayersSel->Append( wxString::Format( _( "%s, %s and connected layers" ),
1259 m_board->GetLayerName( F_Cu ),
1260 m_board->GetLayerName( B_Cu ) ) );
1261 m_rbCopperLayersSel->Append( _( "Connected layers only" ) );
1262 m_rbCopperLayersSel->Append( _( "None" ) );
1263 break;
1264
1265 case NPTH_DLG_TYPE:
1266 m_rbCopperLayersSel->Append( wxString::Format( _( "%s and %s" ),
1267 m_board->GetLayerName( F_Cu ),
1268 m_board->GetLayerName( B_Cu ) ) );
1269 m_rbCopperLayersSel->Append( m_board->GetLayerName( F_Cu ) );
1270 m_rbCopperLayersSel->Append( m_board->GetLayerName( B_Cu ) );
1271 m_rbCopperLayersSel->Append( _( "None" ) );
1272 break;
1273
1274 case SMD_DLG_TYPE:
1275 case CONN_DLG_TYPE:
1276 m_rbCopperLayersSel->Append( m_board->GetLayerName( F_Cu ) );
1277 m_rbCopperLayersSel->Append( m_board->GetLayerName( B_Cu ) );
1278 break;
1279
1280 case APERTURE_DLG_TYPE:
1281 m_rbCopperLayersSel->Append( _( "None" ) );
1282 break;
1284 m_nonComponentLayers.clear();
1285
1286 for( PCB_LAYER_ID layer : m_board->GetEnabledLayers().CuStack() )
1287 {
1288 m_nonComponentLayers.push_back( layer );
1289 m_rbCopperLayersSel->Append( m_board->GetLayerName( layer ) );
1290 }
1291
1292 break;
1293 }
1294}
1295
1296
1297void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
1298{
1299 bool hasHole = true;
1300 bool hasConnection = true;
1301
1302 switch( m_padType->GetSelection() )
1303 {
1304 case PTH_DLG_TYPE: hasHole = true; hasConnection = true; break;
1305 case SMD_DLG_TYPE: hasHole = false; hasConnection = true; break;
1306 case CONN_DLG_TYPE: hasHole = false; hasConnection = true; break;
1307 case NON_COMPONENT_DLG_TYPE: hasHole = false; hasConnection = true; break;
1308 case NPTH_DLG_TYPE: hasHole = true; hasConnection = false; break;
1309 case APERTURE_DLG_TYPE: hasHole = false; hasConnection = false; break;
1310 }
1311
1312 // Pad type just changed, so the old pad's layer set is no longer meaningful. Pass nullopt
1313 // to populate the defaults for the new type.
1314 updatePadLayersList( std::nullopt, m_previewPad->GetRemoveUnconnected(), m_previewPad->GetKeepTopBottom() );
1315
1316 m_gbSizerHole->Show( hasHole );
1317 m_staticline71->Show( hasHole );
1318
1319 if( !hasHole )
1320 {
1321 m_holeX.ChangeValue( 0 );
1322 m_holeY.ChangeValue( 0 );
1323 }
1324 else if( m_holeX.GetValue() == 0 )
1325 {
1326 if( m_currentPad )
1327 {
1328 m_holeX.ChangeValue( m_currentPad->GetDrillSize().x );
1329 m_holeY.ChangeValue( m_currentPad->GetDrillSize().y );
1330 }
1331 else
1332 {
1333 m_holeX.ChangeValue( pcbIUScale.mmToIU( DEFAULT_PAD_DRILL_DIAMETER_MM ) );
1334 }
1335 }
1336
1337 if( !hasConnection )
1338 {
1339 m_padNumCtrl->ChangeValue( wxEmptyString );
1340 m_padNetSelector->SetSelectedNetcode( 0 );
1341 m_padToDieOpt->SetValue( false );
1342 m_padToDieDelayOpt->SetValue( false );
1343 }
1344 else if( m_padNumCtrl->GetValue().IsEmpty() && m_currentPad )
1345 {
1346 m_padNumCtrl->ChangeValue( m_currentPad->GetNumber() );
1347 m_padNetSelector->SetSelectedNetcode( m_currentPad->GetNetCode() );
1348 }
1349
1351
1352 // For now, padstack controls only enabled for PTH pads
1353 bool enablePadstack = m_padType->GetSelection() == PTH_DLG_TYPE;
1354 m_padstackControls->Show( enablePadstack );
1355
1356 if( !enablePadstack )
1357 {
1358 m_editLayer = F_Cu;
1360 }
1361
1362 // Layout adjustment is needed if the hole details got shown/hidden
1363 m_LeftBoxSizer->Layout();
1364 redraw();
1365
1366 if( m_initialized )
1367 OnModify();
1368}
1369
1370
1371void DIALOG_PAD_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
1372{
1373 bool hasHole = true;
1374 bool hasConnection = true;
1375
1376 switch( m_padType->GetSelection() )
1377 {
1378 case PTH_DLG_TYPE: /* PTH */ hasHole = true; hasConnection = true; break;
1379 case SMD_DLG_TYPE: /* SMD */ hasHole = false; hasConnection = true; break;
1380 case CONN_DLG_TYPE: /* CONN */ hasHole = false; hasConnection = true; break;
1381 case NON_COMPONENT_DLG_TYPE: /* Non-component */ hasHole = false; hasConnection = true; break;
1382 case NPTH_DLG_TYPE: /* NPTH */ hasHole = true; hasConnection = false; break;
1383 case APERTURE_DLG_TYPE: /* Aperture */ hasHole = false; hasConnection = false; break;
1384 }
1385
1386 // Enable/disable hole controls
1387 m_holeShapeLabel->Enable( hasHole );
1388 m_holeShapeCtrl->Enable( hasHole );
1389 m_holeX.Enable( hasHole );
1390 m_holeY.Enable( hasHole && m_holeShapeCtrl->GetSelection() == CHOICE_SHAPE_OVAL );
1391
1392 // Enable/disable number and net
1393 m_padNumLabel->Enable( hasConnection );
1394 m_padNumCtrl->Enable( hasConnection );
1395
1396 if( m_padNetLabel->IsShown() )
1397 {
1398 m_padNetLabel->Enable( hasConnection && m_canEditNetName && m_currentPad );
1399 m_padNetSelector->Enable( hasConnection && m_canEditNetName && m_currentPad );
1400 }
1401
1402 // Enable/disable pad length-to-die
1403 m_padToDieOpt->Enable( hasConnection );
1404 m_padToDieDelayOpt->Enable( hasConnection );
1405
1406 if( !m_padToDieOpt->IsEnabled() )
1407 m_padToDieOpt->SetValue( false );
1408
1409 if( !m_padToDieDelayOpt->IsEnabled() )
1410 m_padToDieDelayOpt->SetValue( false );
1411
1412 // We can show/hide this here because it doesn't require the layout to be refreshed.
1413 // All the others have to be done in their event handlers because doing a layout here
1414 // causes infinite looping on MSW.
1415 m_padToDie.Show( m_padToDieOpt->GetValue() );
1416 m_padToDieDelay.Show( m_padToDieDelayOpt->GetValue() );
1417
1418 // Enable/disable Copper Layers control
1419 m_rbCopperLayersSel->Enable( m_padType->GetSelection() != APERTURE_DLG_TYPE );
1420
1421 LSET cu_set = m_previewPad->GetLayerSet() & LSET::AllCuMask();
1422
1423 switch( m_padType->GetSelection() )
1424 {
1425 case PTH_DLG_TYPE:
1426 if( !cu_set.any() )
1427 m_stackupImagesBook->SetSelection( 3 );
1428 else if( !m_previewPad->GetRemoveUnconnected() )
1429 m_stackupImagesBook->SetSelection( 0 );
1430 else if( m_previewPad->GetKeepTopBottom() )
1431 m_stackupImagesBook->SetSelection( 1 );
1432 else
1433 m_stackupImagesBook->SetSelection( 2 );
1434
1435 break;
1436
1437 case NPTH_DLG_TYPE:
1438 if( cu_set.test( F_Cu ) && cu_set.test( B_Cu ) )
1439 m_stackupImagesBook->SetSelection( 4 );
1440 else if( cu_set.test( F_Cu ) )
1441 m_stackupImagesBook->SetSelection( 5 );
1442 else if( cu_set.test( B_Cu ) )
1443 m_stackupImagesBook->SetSelection( 6 );
1444 else
1445 m_stackupImagesBook->SetSelection( 7 );
1446
1447 break;
1448
1449 case SMD_DLG_TYPE:
1450 case CONN_DLG_TYPE:
1452 case APERTURE_DLG_TYPE:
1453 m_stackupImagesBook->ChangeSelection( 3 );
1454 break;
1455 }
1456
1457 m_legacyTeardropsWarning->Show( m_board->LegacyTeardrops() );
1458}
1459
1460
1462{
1463 event.Enable( !m_board->LegacyTeardrops() );
1464}
1465
1466
1468{
1469 bool isOnCopperLayer = ( m_previewPad->GetLayerSet() & LSET::AllCuMask() ).any();
1470 m_nonCopperWarningBook->ChangeSelection( isOnCopperLayer ? 0 : 1 );
1471}
1472
1473
1474void DIALOG_PAD_PROPERTIES::updatePadLayersList( std::optional<LSET> layer_mask,
1475 bool remove_unconnected, bool keep_top_bottom )
1476{
1478
1479 // An empty LSET supplied by the caller is a valid user choice (a pad with no layers);
1480 // std::nullopt is the signal that defaults for the current pad type should be used instead.
1481 LSET effective_mask;
1482
1483 switch( m_padType->GetSelection() )
1484 {
1485 case PTH_DLG_TYPE:
1486 effective_mask = layer_mask.value_or( PAD::PTHMask() );
1487
1488 if( !( effective_mask & LSET::AllCuMask() ).any() )
1489 m_rbCopperLayersSel->SetSelection( 3 );
1490 else if( !remove_unconnected )
1491 m_rbCopperLayersSel->SetSelection( 0 );
1492 else if( keep_top_bottom )
1493 m_rbCopperLayersSel->SetSelection( 1 );
1494 else
1495 m_rbCopperLayersSel->SetSelection( 2 );
1496
1497 break;
1498
1499 case SMD_DLG_TYPE:
1500 // The SMD/CONN UI has no "no copper" radio choice, so fall back to defaults if the
1501 // stored mask has no copper layers. Otherwise saving would silently force B_Cu.
1502 effective_mask = layer_mask.value_or( PAD::SMDMask() );
1503
1504 if( !( effective_mask & LSET::AllCuMask() ).any() )
1505 effective_mask = PAD::SMDMask();
1506
1507 if( effective_mask.test( F_Cu ) )
1508 m_rbCopperLayersSel->SetSelection( 0 );
1509 else
1510 m_rbCopperLayersSel->SetSelection( 1 );
1511
1512 break;
1513
1514 case CONN_DLG_TYPE:
1515 effective_mask = layer_mask.value_or( PAD::ConnSMDMask() );
1516
1517 if( !( effective_mask & LSET::AllCuMask() ).any() )
1518 effective_mask = PAD::ConnSMDMask();
1519
1520 if( effective_mask.test( F_Cu ) )
1521 m_rbCopperLayersSel->SetSelection( 0 );
1522 else
1523 m_rbCopperLayersSel->SetSelection( 1 );
1524
1525 break;
1526
1528 {
1529 // Choose the first copper layer only
1530 effective_mask = layer_mask.value_or( LSET( { F_Cu } ) );
1531
1532 LSEQ cuLayers = effective_mask.CuStack();
1533
1534 if( cuLayers.empty() )
1535 cuLayers.push_back( F_Cu );
1536
1537 auto it = std::find( m_nonComponentLayers.begin(), m_nonComponentLayers.end(), cuLayers.front() );
1538
1539 if( it != m_nonComponentLayers.end() )
1540 {
1541 m_rbCopperLayersSel->SetSelection(
1542 static_cast<int>( std::distance( m_nonComponentLayers.begin(), it ) ) );
1543 }
1544 else
1545 {
1546 m_rbCopperLayersSel->SetSelection( 0 );
1547 }
1548
1549 break;
1550 }
1551 case NPTH_DLG_TYPE:
1552 effective_mask = layer_mask.value_or( PAD::UnplatedHoleMask() );
1553
1554 if( effective_mask.test( F_Cu ) && effective_mask.test( B_Cu ) )
1555 m_rbCopperLayersSel->SetSelection( 0 );
1556 else if( effective_mask.test( F_Cu ) )
1557 m_rbCopperLayersSel->SetSelection( 1 );
1558 else if( effective_mask.test( B_Cu ) )
1559 m_rbCopperLayersSel->SetSelection( 2 );
1560 else
1561 m_rbCopperLayersSel->SetSelection( 3 );
1562
1563 break;
1564
1565 case APERTURE_DLG_TYPE:
1566 effective_mask = layer_mask.value_or( PAD::ApertureMask() );
1567
1568 m_rbCopperLayersSel->SetSelection( 0 );
1569 break;
1570 }
1571
1572 m_layerFrontAdhesive->SetValue( effective_mask[F_Adhes] );
1573 m_layerBackAdhesive->SetValue( effective_mask[B_Adhes] );
1574
1575 m_layerFrontPaste->SetValue( effective_mask[F_Paste] );
1576 m_layerBackPaste->SetValue( effective_mask[B_Paste] );
1577
1578 m_layerFrontSilk->SetValue( effective_mask[F_SilkS] );
1579 m_layerBackSilk->SetValue( effective_mask[B_SilkS] );
1580
1581 m_layerFrontMask->SetValue( effective_mask[F_Mask] );
1582 m_layerBackMask->SetValue( effective_mask[B_Mask] );
1583
1584 m_layerECO1->SetValue( effective_mask[Eco1_User] );
1585 m_layerECO2->SetValue( effective_mask[Eco2_User] );
1586
1587 m_layerUserDwgs->SetValue( effective_mask[Dwgs_User] );
1588}
1589
1590
1592{
1593 bool retVal = DIALOG_SHIM::Show( aShow );
1594
1595 if( aShow )
1596 {
1597 // It *should* work to set the stackup bitmap in the constructor, but it doesn't.
1598 // wxWidgets needs to have these set when the panel is visible for some reason.
1599 // https://gitlab.com/kicad/code/kicad/-/issues/5534
1607
1608 Layout();
1609 }
1610
1611 return retVal;
1612}
1613
1614
1615void DIALOG_PAD_PROPERTIES::OnSetCopperLayers( wxCommandEvent& event )
1616{
1618 redraw();
1619
1620 if( m_initialized )
1621 OnModify();
1622}
1623
1624
1625void DIALOG_PAD_PROPERTIES::OnSetLayers( wxCommandEvent& event )
1626{
1628 redraw();
1629
1630 if( m_initialized )
1631 OnModify();
1632}
1633
1634
1636{
1638
1639 wxArrayString error_msgs;
1640 wxArrayString warning_msgs;
1641
1643 [&]( const PAD_UTILS::PAD_CHECK_RESULT& aResult )
1644 {
1645 int drcCode = ConvertPadCheckToDrcCode( aResult.code );
1646
1647 if( drcCode == DRCE_PADSTACK_INVALID )
1648 {
1649 error_msgs.Add( wxString::Format( wxT( "Error: %s" ), aResult.message ) );
1650 }
1651 else if( drcCode == DRCE_PADSTACK )
1652 {
1653 warning_msgs.Add( wxString::Format( wxT( "Warning: %s" ), aResult.message ) );
1654 }
1655 else if( drcCode == DRCE_PAD_TH_WITH_NO_HOLE )
1656 {
1657 error_msgs.Add( _( "Error: Through hole pad has no hole." ) );
1658 }
1659 } );
1660
1661 if( error_msgs.GetCount() || warning_msgs.GetCount() )
1662 {
1663 wxString title = error_msgs.GetCount() ? _( "Pad Properties Errors" )
1664 : _( "Pad Properties Warnings" );
1665 HTML_MESSAGE_BOX dlg( this, title );
1666
1667 wxArrayString msgs = error_msgs;
1668
1669 for( const wxString& msg : warning_msgs )
1670 msgs.Add( msg );
1671
1672 dlg.ListSet( msgs );
1673
1674 dlg.ShowModal();
1675 }
1676
1677 return error_msgs.GetCount() == 0;
1678}
1679
1680
1682{
1683 if( !m_initialized )
1684 return;
1685
1686 KIGFX::VIEW* view = m_padPreviewGAL->GetView();
1687 KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
1688 KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
1689
1690 m_padPreviewGAL->StopDrawing();
1691
1692 // The layer used to place primitive items selected when editing custom pad shapes
1693 // we use here a layer never used in a pad:
1694 #define SELECTED_ITEMS_LAYER Dwgs_User
1695
1696 view->ClearTopLayers();
1698 view->SetTopLayer( m_editLayer );
1700
1701 static const std::vector<int> topLayers = {
1706 };
1707
1708 for( int layer : topLayers )
1709 view->SetTopLayer( layer );
1710
1711 m_axisOrigin->SetPosition( m_previewPad->GetPosition() );
1712
1713 view->Update( m_previewPad );
1714
1715 // delete previous items if highlight list
1716 while( m_highlight.size() )
1717 {
1718 delete m_highlight.back(); // the dtor also removes item from view
1719 m_highlight.pop_back();
1720 }
1721
1722 BOX2I bbox = m_previewPad->ViewBBox();
1723
1724 if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
1725 {
1726 // The origin always goes in the middle of the canvas; we want offsetting the pad
1727 // shape to move the pad, not the hole
1728 bbox.Move( -m_previewPad->GetPosition() );
1729 int maxXExtent = std::max( abs( bbox.GetLeft() ), abs( bbox.GetRight() ) );
1730 int maxYExtent = std::max( abs( bbox.GetTop() ), abs( bbox.GetBottom() ) );
1731
1732 // Don't blow up the GAL on too-large numbers
1733 if( maxXExtent > INT_MAX / 4 )
1734 maxXExtent = INT_MAX / 4;
1735
1736 if( maxYExtent > INT_MAX / 4 )
1737 maxYExtent = INT_MAX / 4;
1738
1739 BOX2D viewBox( m_previewPad->GetPosition(), {0, 0} );
1740 BOX2D canvasBox( m_previewPad->GetPosition(), {0, 0} );
1741 viewBox.Inflate( maxXExtent * 1.4, maxYExtent * 1.4 ); // add a margin
1742 canvasBox.Inflate( maxXExtent * 2.0, maxYExtent * 2.0 );
1743
1744 view->SetBoundary( canvasBox );
1745
1746 // Autozoom
1747 view->SetViewport( viewBox );
1748
1749 m_padPreviewGAL->StartDrawing();
1750 m_padPreviewGAL->Refresh();
1751 }
1752}
1753
1754
1756{
1757 if( !wxDialog::TransferDataToWindow() )
1758 return false;
1759
1760 if( !m_panelGeneral->TransferDataToWindow() )
1761 return false;
1762
1763 if( !m_localSettingsPanel->TransferDataToWindow() )
1764 return false;
1765
1766 return true;
1767}
1768
1769
1771{
1772 BOARD_COMMIT commit( m_parent );
1773
1774 if( !wxDialog::TransferDataFromWindow() )
1775 return false;
1776
1777 if( !m_panelGeneral->TransferDataFromWindow() )
1778 return false;
1779
1780 if( !m_localSettingsPanel->TransferDataFromWindow() )
1781 return false;
1782
1783 if( wxString error = m_pasteMargin.Validate(); !error.IsEmpty() )
1784 {
1786 wxSafeYield( this );
1787 DisplayError( nullptr, error );
1788 return false;
1789 }
1790
1791 if( !padValuesOK() )
1792 return false;
1793
1794 m_padPreviewGAL->StopDrawing();
1795
1796 commit.Modify( m_currentPad );
1797
1798 // Build the final settings on the preview pad, then copy them onto the real pad below.
1799 // Note that the preview inherits the real pad's parent footprint, so transferDataToPad()
1800 // stores its position in the footprint's frame rather than in board coordinates.
1802 return false;
1803
1804 PAD_TOOL* padTool = m_parent->GetToolManager()->GetTool<PAD_TOOL>();
1805 padTool->SetLastPadNumber( m_previewPad->GetNumber() );
1806
1807 // Update values
1808
1809 // transferDataToPad() only handles the current edit layer, so use the preview padstack,
1810 // which includes the edits made on all layers
1811 // TODO(JE) this could be cleaner
1812 m_currentPad->SetPadstack( m_previewPad->Padstack() );
1813
1814 m_currentPad->SetAttribute( m_previewPad->GetAttribute() );
1815 m_currentPad->SetSimElectricalType( m_previewPad->GetSimElectricalType() );
1816 m_currentPad->SetFPRelativeOrientation( m_previewPad->GetOrientation() );
1817 m_currentPad->SetPadToDieLength( m_previewPad->GetPadToDieLength() );
1818 m_currentPad->SetPadToDieDelay( m_previewPad->GetPadToDieDelay() );
1819 m_currentPad->SetLayerSet( m_previewPad->GetLayerSet() );
1820 m_currentPad->SetNumber( m_previewPad->GetNumber() );
1821
1822 int padNetcode = NETINFO_LIST::UNCONNECTED;
1823
1824 // For PAD_ATTRIB::NPTH, ensure there is no net name selected
1825 if( m_previewPad->GetAttribute() != PAD_ATTRIB::NPTH )
1826 padNetcode = m_padNetSelector->GetSelectedNetcode();
1827
1828 m_currentPad->SetNetCode( padNetcode );
1829
1830 m_currentPad->GetTeardropParams() = m_previewPad->GetTeardropParams();
1831
1832 // Set the fabrication property:
1833 m_currentPad->SetProperty( getSelectedProperty() );
1834
1835 // define the way the clearance area is defined in zones
1836 m_currentPad->SetCustomShapeInZoneOpt( m_previewPad->GetCustomShapeInZoneOpt() );
1837
1838 if( m_currentPad->GetParentFootprint() && m_currentPad->GetParentFootprint()->IsFlipped() )
1839 {
1840 // flip pad (up/down) around its position
1841 m_currentPad->Flip( m_currentPad->GetPosition(), FLIP_DIRECTION::TOP_BOTTOM );
1842 }
1843
1844 // Use the position from the dialog fields, which is the absolute position (which is
1845 // only equal to the position in the FP in the FP editor). The preview pad's position is in
1846 // frame-absolute coordinates, and we may be in the PCB frame.
1847 m_currentPad->SetPosition( VECTOR2I( m_posX.GetIntValue(), m_posY.GetIntValue() ) );
1848
1849 m_parent->SetMsgPanel( m_currentPad );
1850
1851 // redraw the area where the pad was
1852 m_parent->GetCanvas()->Refresh();
1853
1854 commit.Push( _( "Edit Pad Properties" ) );
1855
1856 return true;
1857}
1858
1859
1861{
1862 PAD_PROP prop = PAD_PROP::NONE;
1863
1864 switch( m_choiceFabProperty->GetSelection() )
1865 {
1866 case 0: prop = PAD_PROP::NONE; break;
1867 case 1: prop = PAD_PROP::BGA; break;
1868 case 2: prop = PAD_PROP::FIDUCIAL_LOCAL; break;
1869 case 3: prop = PAD_PROP::FIDUCIAL_GLBL; break;
1870 case 4: prop = PAD_PROP::TESTPOINT; break;
1871 case 5: prop = PAD_PROP::HEATSINK; break;
1872 case 6: prop = PAD_PROP::MECHANICAL; break;
1873 case 7: prop = PAD_PROP::CASTELLATED; break;
1874 case 8: prop = PAD_PROP::PRESSFIT; break;
1875 }
1876
1877 return prop;
1878}
1879
1880
1882{
1883 bool isRound = ( m_holeShapeCtrl->GetSelection() == CHOICE_SHAPE_CIRCLE );
1884
1885 if( isRound )
1886 {
1887 m_holeXLabel->SetLabel( _( "Diameter:" ) );
1888 m_holeY.Show( false );
1889 }
1890 else
1891 {
1892 m_holeXLabel->SetLabel( _( "Hole size X:" ) );
1893 m_holeY.Show( true );
1894 }
1895
1896 m_holeXLabel->GetParent()->Layout();
1897
1898 if( !isRound )
1899 {
1900 // Disable all
1901 m_backDrillChoice->Enable( false );
1902 m_backDrillTopLayer->Enable( false );
1903 m_backDrillTopLayerLabel->Enable( false );
1904 m_backDrillBottomLayer->Enable( false );
1905 m_backDrillBottomLayerLabel->Enable( false );
1906
1907 m_topPostMachining->Enable( false );
1908 m_topPostMachineSize1Binder.Enable( false );
1909 m_topPostMachineSize2Binder.Enable( false );
1910 m_topPostMachineSize1Label->Enable( false );
1911 m_topPostMachineSize2Label->Enable( false );
1912
1913 m_bottomPostMachining->Enable( false );
1914 m_bottomPostMachineSize1Binder.Enable( false );
1915 m_bottomPostMachineSize2Binder.Enable( false );
1916 m_bottomPostMachineSize1Label->Enable( false );
1917 m_bottomPostMachineSize2Label->Enable( false );
1918 }
1919 else
1920 {
1921 // Enable main choices
1922 m_backDrillChoice->Enable( true );
1923 m_topPostMachining->Enable( true );
1924 m_bottomPostMachining->Enable( true );
1925
1926 // Update sub-controls based on selection
1927 syncBackdrillControls( false );
1928
1929 wxCommandEvent dummy;
1932 }
1933}
1934
1935
1937{
1938 if( m_PadShapeSelector->GetSelection() == CHOICE_SHAPE_CIRCLE
1940 {
1941 m_sizeXLabel->SetLabel( _( "Diameter:" ) );
1942 m_sizeY.Show( false );
1944 m_minTrackWidthHint->SetLabel( _( "d" ) );
1945 m_stLenPercentHint->SetLabel( _( "d" ) );
1946 m_stWidthPercentHint->SetLabel( _( "d" ) );
1947 }
1948 else
1949 {
1950 m_sizeXLabel->SetLabel( _( "Pad size X:" ) );
1951 m_sizeY.Show( true );
1953 m_minTrackWidthHint->SetLabel( _( "w" ) );
1954 m_stLenPercentHint->SetLabel( _( "w" ) );
1955 m_stWidthPercentHint->SetLabel( _( "w" ) );
1956 }
1957
1958 m_sizeXLabel->GetParent()->Layout();
1959 resetSize();
1960 Layout();
1961 m_MainSizer->Fit( this );
1962}
1963
1964
1966{
1967 std::map<PCB_LAYER_ID, PCB_LAYER_ID> newLayerMap; // Map of new-layerss to init-from-layers
1968
1969 auto setMode =
1970 [&]( PADSTACK::MODE mode )
1971 {
1972 PADSTACK oldStack = aPad->Padstack();
1973
1974 aPad->Padstack().SetMode( mode );
1975
1977 [&]( PCB_LAYER_ID layer )
1978 {
1979 if( !oldStack.HasExplicitDefinitionForLayer( layer ) )
1980 {
1981 if( IsInnerCopperLayer( layer ) && layer != PADSTACK::INNER_LAYERS )
1982 newLayerMap[layer] = PADSTACK::INNER_LAYERS;
1983 else
1984 newLayerMap[layer] = F_Cu;
1985 }
1986 } );
1987 };
1988
1989 if( !Validate() )
1990 return false;
1991
1992 if( !m_panelGeneral->Validate() )
1993 return false;
1994
1995 if( !m_localSettingsPanel->Validate() )
1996 return false;
1997
1998 if( !m_spokeWidth.Validate( 0, INT_MAX ) )
1999 return false;
2000
2001 switch( m_cbPadstackMode->GetSelection() )
2002 {
2003 default:
2004 case 0: setMode( PADSTACK::MODE::NORMAL ); break;
2005 case 1: setMode( PADSTACK::MODE::FRONT_INNER_BACK ); break;
2006 case 2: setMode( PADSTACK::MODE::CUSTOM ); break;
2007 }
2008
2009 aPad->SetAttribute( code_type[m_padType->GetSelection()] );
2010 aPad->SetShape( m_editLayer, code_shape[m_PadShapeSelector->GetSelection()] );
2011
2014 else
2016
2017 if( aPad->GetShape( m_editLayer ) == PAD_SHAPE::CUSTOM )
2019
2020 aPad->GetTeardropParams().m_Enabled = m_cbTeardrops->GetValue();
2027 aPad->GetTeardropParams().m_CurvedEdges = m_curvedEdges->GetValue();
2029
2030 // Read pad clearances values:
2031 if( m_clearance.IsNull() )
2032 aPad->SetLocalClearance( {} );
2033 else
2034 aPad->SetLocalClearance( m_clearance.GetIntValue() );
2035
2036 if( m_maskMargin.IsNull() )
2037 aPad->SetLocalSolderMaskMargin( {} );
2038 else
2039 aPad->SetLocalSolderMaskMargin( m_maskMargin.GetIntValue() );
2040
2041 aPad->SetLocalSolderPasteMargin( m_pasteMargin.GetOffsetValue() );
2042 aPad->SetLocalSolderPasteMarginRatio( m_pasteMargin.GetRatioValue() );
2043
2044 if( m_spokeWidth.IsNull() )
2046 else
2047 aPad->SetLocalThermalSpokeWidthOverride( m_spokeWidth.GetIntValue() );
2048
2049 if( m_thermalGap.IsNull() )
2050 aPad->SetLocalThermalGapOverride( {} );
2051 else
2052 aPad->SetLocalThermalGapOverride( m_thermalGap.GetIntValue() );
2053
2054 aPad->SetThermalSpokeAngle( m_spokeAngle.GetAngleValue() );
2055
2056 // And rotation
2057 aPad->SetOrientation( m_pad_orientation.GetAngleValue() );
2058
2059 switch( m_ZoneConnectionChoice->GetSelection() )
2060 {
2061 default:
2062 case 0: aPad->SetLocalZoneConnection( ZONE_CONNECTION::INHERITED ); break;
2063 case 1: aPad->SetLocalZoneConnection( ZONE_CONNECTION::FULL ); break;
2064 case 2: aPad->SetLocalZoneConnection( ZONE_CONNECTION::THERMAL ); break;
2065 case 3: aPad->SetLocalZoneConnection( ZONE_CONNECTION::NONE ); break;
2066 }
2067
2068 VECTOR2I pos( m_posX.GetIntValue(), m_posY.GetIntValue() );
2069
2070 if( FOOTPRINT* fp = aPad->GetParentFootprint() )
2071 {
2072 pos -= fp->GetPosition();
2073 RotatePoint( pos, -fp->GetOrientation() );
2074 }
2075
2076 aPad->SetPosition( pos );
2077
2078 if( m_holeShapeCtrl->GetSelection() == CHOICE_SHAPE_CIRCLE )
2079 {
2081 aPad->SetDrillSize( VECTOR2I( m_holeX.GetIntValue(), m_holeX.GetIntValue() ) );
2082 }
2083 else
2084 {
2086 aPad->SetDrillSize( VECTOR2I( m_holeX.GetIntValue(), m_holeY.GetIntValue() ) );
2087 }
2088
2089 if( aPad->GetShape( m_editLayer ) == PAD_SHAPE::CIRCLE )
2090 aPad->SetSize( m_editLayer, VECTOR2I( m_sizeX.GetIntValue(), m_sizeX.GetIntValue() ) );
2091 else
2092 aPad->SetSize( m_editLayer, VECTOR2I( m_sizeX.GetIntValue(), m_sizeY.GetIntValue() ) );
2093
2094 // For a trapezoid, test delta value (be sure delta is not too large for pad size)
2095 // remember DeltaSize.x is the Y size variation
2096 bool error = false;
2097 VECTOR2I delta( 0, 0 );
2098
2099 if( aPad->GetShape( m_editLayer ) == PAD_SHAPE::TRAPEZOID )
2100 {
2101 // For a trapezoid, only one of delta.x or delta.y is not 0, depending on axis.
2102 if( m_trapAxisCtrl->GetSelection() == 0 )
2103 delta.x = m_trapDelta.GetIntValue();
2104 else
2105 delta.y = m_trapDelta.GetIntValue();
2106
2107 if( delta.x < 0 && delta.x < -aPad->GetSize( m_editLayer ).y )
2108 {
2109 delta.x = -aPad->GetSize( m_editLayer ).y + 2;
2110 error = true;
2111 }
2112
2113 if( delta.x > 0 && delta.x > aPad->GetSize( m_editLayer ).y )
2114 {
2115 delta.x = aPad->GetSize( m_editLayer ).y - 2;
2116 error = true;
2117 }
2118
2119 if( delta.y < 0 && delta.y < -aPad->GetSize( m_editLayer ).x )
2120 {
2121 delta.y = -aPad->GetSize( m_editLayer ).x + 2;
2122 error = true;
2123 }
2124
2125 if( delta.y > 0 && delta.y > aPad->GetSize( m_editLayer ).x )
2126 {
2127 delta.y = aPad->GetSize( m_editLayer ).x - 2;
2128 error = true;
2129 }
2130 }
2131
2132 switch( m_simElectricalTypeCtrl->GetSelection() )
2133 {
2137 default: aPad->SetSimElectricalType( PAD_SIM_ELECTRICAL_TYPE::NONE ); break;
2138 }
2139
2140 aPad->SetDelta( m_editLayer, delta );
2141
2142 if( m_offsetShapeOpt->GetValue() )
2143 aPad->SetOffset( m_editLayer, VECTOR2I( m_offsetX.GetIntValue(), m_offsetY.GetIntValue() ) );
2144 else
2145 aPad->SetOffset( m_editLayer, VECTOR2I() );
2146
2147 // Read pad length die
2148 if( m_padToDieOpt->GetValue() )
2149 aPad->SetPadToDieLength( m_padToDie.GetIntValue() );
2150 else
2151 aPad->SetPadToDieLength( 0 );
2152
2153 if( m_padToDieDelayOpt->GetValue() )
2154 aPad->SetPadToDieDelay( m_padToDieDelay.GetIntValue() );
2155 else
2156 aPad->SetPadToDieDelay( 0 );
2157
2158 aPad->SetNumber( m_padNumCtrl->GetValue() );
2159 aPad->SetNetCode( m_padNetSelector->GetSelectedNetcode() );
2160
2161 int chamfers = 0;
2162
2163 if( m_PadShapeSelector->GetSelection() == CHOICE_SHAPE_CHAMFERED_RECT )
2164 {
2165 if( m_cbTopLeft->GetValue() )
2166 chamfers |= RECT_CHAMFER_TOP_LEFT;
2167
2168 if( m_cbTopRight->GetValue() )
2169 chamfers |= RECT_CHAMFER_TOP_RIGHT;
2170
2171 if( m_cbBottomLeft->GetValue() )
2172 chamfers |= RECT_CHAMFER_BOTTOM_LEFT;
2173
2174 if( m_cbBottomRight->GetValue() )
2175 chamfers |= RECT_CHAMFER_BOTTOM_RIGHT;
2176 }
2177 else if( m_PadShapeSelector->GetSelection() == CHOICE_SHAPE_CHAMFERED_ROUNDED_RECT )
2178 {
2179 if( m_cbTopLeft1->GetValue() )
2180 chamfers |= RECT_CHAMFER_TOP_LEFT;
2181
2182 if( m_cbTopRight1->GetValue() )
2183 chamfers |= RECT_CHAMFER_TOP_RIGHT;
2184
2185 if( m_cbBottomLeft1->GetValue() )
2186 chamfers |= RECT_CHAMFER_BOTTOM_LEFT;
2187
2188 if( m_cbBottomRight1->GetValue() )
2189 chamfers |= RECT_CHAMFER_BOTTOM_RIGHT;
2190 }
2191
2192 aPad->SetChamferPositions( m_editLayer, chamfers );
2193
2194 if( aPad->GetShape( m_editLayer ) == PAD_SHAPE::CUSTOM )
2195 {
2196 // The pad custom has a "anchor pad" (a basic shape: round or rect pad)
2197 // that is the minimal area of this pad, and is useful to ensure a hole
2198 // diameter is acceptable, and is used in Gerber files as flashed area
2199 // reference
2201 aPad->SetSize( m_editLayer, VECTOR2I( m_sizeX.GetIntValue(), m_sizeX.GetIntValue() ) );
2202 }
2203
2204 // Define the way the clearance area is defined in zones. Since all non-custom pad
2205 // shapes are convex to begin with, this really only makes any difference for custom
2206 // pad shapes.
2209
2210 switch( aPad->GetAttribute() )
2211 {
2212 case PAD_ATTRIB::PTH:
2213 case PAD_ATTRIB::CONN:
2214 case PAD_ATTRIB::SMD:
2216 break;
2217
2218 case PAD_ATTRIB::NPTH:
2219 // Mechanical purpose only:
2220 // no net name, no pad name allowed
2221 aPad->SetNumber( wxEmptyString );
2223 break;
2224
2225 default:
2226 wxFAIL_MSG( wxT( "DIALOG_PAD_PROPERTIES::transferDataToPad: unknown pad type" ) );
2227 break;
2228 }
2229
2230 if( aPad->GetShape( m_editLayer ) == PAD_SHAPE::ROUNDRECT )
2231 {
2232 aPad->SetRoundRectRadiusRatio( m_editLayer, m_cornerRatio.GetDoubleValue() / 100.0 );
2233 }
2234 else if( aPad->GetShape( m_editLayer ) == PAD_SHAPE::CHAMFERED_RECT )
2235 {
2237 {
2238 aPad->SetChamferRectRatio( m_editLayer, m_mixedChamferRatio.GetDoubleValue() / 100.0 );
2239 aPad->SetRoundRectRadiusRatio( m_editLayer, m_mixedCornerRatio.GetDoubleValue() / 100.0 );
2240 }
2241 else // Choice is CHOICE_SHAPE_CHAMFERED_RECT, no rounded corner
2242 {
2243 aPad->SetChamferRectRatio( m_editLayer, m_chamferRatio.GetDoubleValue() / 100.0 );
2245 }
2246 }
2247
2249
2250 LSET padLayerMask = LSET();
2251 int copperLayersChoice = m_rbCopperLayersSel->GetSelection();
2252
2254
2255 switch( m_padType->GetSelection() )
2256 {
2257 case PTH_DLG_TYPE:
2258 switch( copperLayersChoice )
2259 {
2260 case 0:
2261 // All copper layers
2262 padLayerMask |= LSET::AllCuMask();
2263 break;
2264
2265 case 1:
2266 // Front, back and connected
2267 padLayerMask |= LSET::AllCuMask();
2269 break;
2270
2271 case 2:
2272 // Connected only
2273 padLayerMask |= LSET::AllCuMask();
2275 break;
2276
2277 case 3:
2278 // No copper layers
2279 break;
2280 }
2281
2282 break;
2283
2284 case NPTH_DLG_TYPE:
2285 switch( copperLayersChoice )
2286 {
2287 case 0: padLayerMask.set( F_Cu ).set( B_Cu ); break;
2288 case 1: padLayerMask.set( F_Cu ); break;
2289 case 2: padLayerMask.set( B_Cu ); break;
2290 default: break;
2291 }
2292
2293 break;
2294
2295 case SMD_DLG_TYPE:
2296 case CONN_DLG_TYPE:
2297 switch( copperLayersChoice )
2298 {
2299 case 0: padLayerMask.set( F_Cu ); break;
2300 case 1: padLayerMask.set( B_Cu ); break;
2301 }
2302
2303 break;
2304
2306 if( copperLayersChoice >= 0 && copperLayersChoice < static_cast<int>( m_nonComponentLayers.size() ) )
2307 {
2308 padLayerMask.set( m_nonComponentLayers[copperLayersChoice] );
2309 }
2310 else
2311 {
2312 padLayerMask.set( F_Cu );
2313 }
2314
2315 break;
2316
2317 case APERTURE_DLG_TYPE:
2318 // no copper layers
2319 break;
2320 }
2321
2322 if( m_layerFrontAdhesive->GetValue() )
2323 padLayerMask.set( F_Adhes );
2324
2325 if( m_layerBackAdhesive->GetValue() )
2326 padLayerMask.set( B_Adhes );
2327
2328 if( m_layerFrontPaste->GetValue() )
2329 padLayerMask.set( F_Paste );
2330
2331 if( m_layerBackPaste->GetValue() )
2332 padLayerMask.set( B_Paste );
2333
2334 if( m_layerFrontSilk->GetValue() )
2335 padLayerMask.set( F_SilkS );
2336
2337 if( m_layerBackSilk->GetValue() )
2338 padLayerMask.set( B_SilkS );
2339
2340 if( m_layerFrontMask->GetValue() )
2341 padLayerMask.set( F_Mask );
2342
2343 if( m_layerBackMask->GetValue() )
2344 padLayerMask.set( B_Mask );
2345
2346 if( m_layerECO1->GetValue() )
2347 padLayerMask.set( Eco1_User );
2348
2349 if( m_layerECO2->GetValue() )
2350 padLayerMask.set( Eco2_User );
2351
2352 if( m_layerUserDwgs->GetValue() )
2353 padLayerMask.set( Dwgs_User );
2354
2355 aPad->SetLayerSet( padLayerMask );
2356
2357 PADSTACK& padstack = aPad->Padstack();
2358 const bool canHaveDrills = aPad->GetAttribute() == PAD_ATTRIB::PTH || aPad->GetAttribute() == PAD_ATTRIB::NPTH;
2359
2360 if( !canHaveDrills )
2361 {
2362 // The drill, backdrill and post-machining controls are disabled for this pad type, but
2363 // may still hold content from an earlier type. Clear the whole padstack drilling
2364 // rather than trusting them.
2366 }
2367 else
2368 {
2369 // Backdrills are written through the PADSTACK accessors, which stamp each side's start
2370 // layer (top = F_Cu, bottom = B_Cu) so the result is read back correctly by older KiCad.
2371 int backDrillSel = m_backDrillChoice->GetSelection();
2372 bool wantTop = ( backDrillSel == 1 || backDrillSel == 3 ); // 1: Top, 3: Top & bottom
2373 bool wantBottom = ( backDrillSel == 2 || backDrillSel == 3 ); // 2: Bottom
2374
2375 if( wantTop )
2376 {
2377 padstack.SetBackdrillSize( true, m_backDrillTopSizeBinder.GetIntValue() );
2378
2379 if( m_backDrillTopLayer->GetLayerSelection() != UNDEFINED_LAYER )
2380 padstack.SetBackdrillEndLayer( true, ToLAYER_ID( m_backDrillTopLayer->GetLayerSelection() ) );
2381 }
2382 else
2383 {
2384 padstack.SetBackdrillSize( true, std::nullopt );
2385 }
2386
2387 if( wantBottom )
2388 {
2389 padstack.SetBackdrillSize( false, m_backDrillBottomSizeBinder.GetIntValue() );
2390
2391 if( m_backDrillBottomLayer->GetLayerSelection() != UNDEFINED_LAYER )
2392 padstack.SetBackdrillEndLayer( false, ToLAYER_ID( m_backDrillBottomLayer->GetLayerSelection() ) );
2393 }
2394 else
2395 {
2396 padstack.SetBackdrillSize( false, std::nullopt );
2397 }
2398
2399 // Front Post Machining
2400 PADSTACK::POST_MACHINING_PROPS frontPostMachining;
2401
2402 switch( m_topPostMachining->GetSelection() )
2403 {
2404 case 1: frontPostMachining.mode = PAD_DRILL_POST_MACHINING_MODE::COUNTERSINK; break;
2405 case 2: frontPostMachining.mode = PAD_DRILL_POST_MACHINING_MODE::COUNTERBORE; break;
2406 default: frontPostMachining.mode = PAD_DRILL_POST_MACHINING_MODE::NOT_POST_MACHINED; break;
2407 }
2408
2409 frontPostMachining.size = m_topPostMachineSize1Binder.GetIntValue();
2410
2411 if( frontPostMachining.mode == PAD_DRILL_POST_MACHINING_MODE::COUNTERSINK )
2412 frontPostMachining.angle = KiROUND( m_topPostMachineSize2Binder.GetDoubleValue() * 10.0 );
2413 else
2414 frontPostMachining.depth = m_topPostMachineSize2Binder.GetIntValue();
2415
2416 aPad->Padstack().FrontPostMachining() = frontPostMachining;
2417
2418 // Back Post Machining
2419 PADSTACK::POST_MACHINING_PROPS backPostMachining;
2420
2421 switch( m_bottomPostMachining->GetSelection() )
2422 {
2423 case 1: backPostMachining.mode = PAD_DRILL_POST_MACHINING_MODE::COUNTERSINK; break;
2424 case 2: backPostMachining.mode = PAD_DRILL_POST_MACHINING_MODE::COUNTERBORE; break;
2425 default: backPostMachining.mode = PAD_DRILL_POST_MACHINING_MODE::NOT_POST_MACHINED; break;
2426 }
2427
2428 backPostMachining.size = m_bottomPostMachineSize1Binder.GetIntValue();
2429
2430 if( backPostMachining.mode == PAD_DRILL_POST_MACHINING_MODE::COUNTERSINK )
2431 backPostMachining.angle = KiROUND( m_bottomPostMachineSize2Binder.GetDoubleValue() * 10.0 );
2432 else
2433 backPostMachining.depth = m_bottomPostMachineSize2Binder.GetIntValue();
2434
2435 aPad->Padstack().BackPostMachining() = backPostMachining;
2436 }
2437
2438 // If we created new layers, initialize them
2439 for( const auto& [newLayer, initFromLayer] : newLayerMap )
2440 {
2441 if( newLayer != m_editLayer && newLayer != initFromLayer )
2442 aPad->Padstack().CopperLayer( newLayer ) = aPad->Padstack().CopperLayer( initFromLayer );
2443 }
2444
2445 return !error;
2446}
2447
2448
2449void DIALOG_PAD_PROPERTIES::onBackDrillChoice( wxCommandEvent& aEvent )
2450{
2451 syncBackdrillControls( true );
2452 OnValuesChanged( aEvent );
2453}
2454
2455
2457{
2458 int selection = m_backDrillChoice->GetSelection();
2459 // 0: None, 1: Top, 2: Bottom, 3: Both
2460
2461 bool enableTop = ( selection == 1 || selection == 3 );
2462 bool enableBottom = ( selection == 2 || selection == 3 );
2463
2464 m_backDrillTopSizeBinder.Enable( enableTop );
2465 m_backDrillTopLayer->Enable( enableTop );
2466 m_backDrillTopLayerLabel->Enable( enableTop );
2467
2468 m_backDrillBottomSizeBinder.Enable( enableBottom );
2469 m_backDrillBottomLayer->Enable( enableBottom );
2470 m_backDrillBottomLayerLabel->Enable( enableBottom );
2471
2472 // Initialize values if this was a user event that turned on backdrills
2473 if( aFromUserEvent )
2474 {
2475 if( enableTop )
2476 {
2477 if( m_backDrillTopLayer->GetLayerSelection() == UNDEFINED_LAYER )
2478 m_backDrillTopLayer->SetLayerSelection( F_Cu );
2479
2480 if( m_backDrillTopSizeBinder.GetIntValue() == 0 )
2481 {
2482 // Initialize backdrill slightly larger than main drill (see PADSTACK::SetBackdrillMode())
2483 int drill = std::max( m_holeX.GetIntValue(), m_holeY.GetIntValue() );
2484 m_backDrillTopSizeBinder.SetValue( KiROUND( drill * 1.1 ) );
2485 }
2486 }
2487
2488 if( enableBottom )
2489 {
2490 if( m_backDrillBottomLayer->GetLayerSelection() == UNDEFINED_LAYER )
2491 m_backDrillBottomLayer->SetLayerSelection( B_Cu );
2492
2493 if( m_backDrillBottomSizeBinder.GetIntValue() == 0 )
2494 {
2495 // Initialize backdrill slightly larger than main drill (see PADSTACK::SetBackdrillMode())
2496 int drill = std::max( m_holeX.GetIntValue(), m_holeY.GetIntValue() );
2497 m_backDrillBottomSizeBinder.SetValue( KiROUND( drill * 1.1 ) );
2498 }
2499 }
2500 }
2501}
2502
2503
2505{
2506 int selection = m_topPostMachining->GetSelection();
2507 // 0: None, 1: Countersink, 2: Counterbore
2508
2509 bool enable = ( selection != 0 );
2510 m_topPostMachineSize1Binder.Enable( enable );
2511 m_topPostMachineSize2Binder.Enable( enable );
2512 m_topPostMachineSize1Label->Enable( enable );
2513 m_topPostMachineSize2Label->Enable( enable );
2514
2515 if( selection == 1 ) // Countersink
2516 {
2517 m_topPostMachineSize2Label->SetLabel( _( "Angle:" ) );
2518 m_topPostMachineSize2Units->SetLabel( _( "deg" ) );
2520
2521 if( m_topPostMachineSize2Binder.IsIndeterminate() || m_topPostMachineSize2Binder.GetDoubleValue() == 0 )
2522 m_topPostMachineSize2Binder.SetDoubleValue( 82.0 );
2523 }
2524 else if( selection == 2 ) // Counterbore
2525 {
2526 m_topPostMachineSize2Label->SetLabel( _( "Depth:" ) );
2527 m_topPostMachineSize2Units->SetLabel( EDA_UNIT_UTILS::GetLabel( m_parent->GetUserUnits() ) );
2528 m_topPostMachineSize2Binder.SetUnits( m_parent->GetUserUnits() );
2529 }
2530}
2531
2532
2534{
2535 int selection = m_bottomPostMachining->GetSelection();
2536 // 0: None, 1: Countersink, 2: Counterbore
2537
2538 bool enable = ( selection != 0 );
2539 m_bottomPostMachineSize1Binder.Enable( enable );
2540 m_bottomPostMachineSize2Binder.Enable( enable );
2541 m_bottomPostMachineSize1Label->Enable( enable );
2542 m_bottomPostMachineSize2Label->Enable( enable );
2543
2544 if( selection == 1 ) // Countersink
2545 {
2546 m_bottomPostMachineSize2Label->SetLabel( _( "Angle:" ) );
2547 m_bottomPostMachineSize2Units->SetLabel( _( "deg" ) );
2549
2550 if( m_bottomPostMachineSize2Binder.IsIndeterminate() || m_bottomPostMachineSize2Binder.GetDoubleValue() == 0 )
2551 m_bottomPostMachineSize2Binder.SetDoubleValue( 82.0 );
2552 }
2553 else if( selection == 2 ) // Counterbore
2554 {
2555 m_bottomPostMachineSize2Label->SetLabel( _( "Depth:" ) );
2556 m_bottomPostMachineSize2Units->SetLabel( EDA_UNIT_UTILS::GetLabel( m_parent->GetUserUnits() ) );
2557 m_bottomPostMachineSize2Binder.SetUnits( m_parent->GetUserUnits() );
2558 }
2559}
2560
2561
2562void DIALOG_PAD_PROPERTIES::OnOffsetCheckbox( wxCommandEvent& event )
2563{
2564 if( m_offsetShapeOpt->GetValue() )
2565 {
2566 m_offsetX.SetValue( m_previewPad->GetOffset( m_editLayer ).x );
2567 m_offsetY.SetValue( m_previewPad->GetOffset( m_editLayer ).y );
2568 }
2569
2570 // Show/hide controls depending on m_offsetShapeOpt being enabled
2571 m_offsetCtrls->Show( m_offsetShapeOpt->GetValue() );
2572 m_offsetShapeOptLabel->Show( m_offsetShapeOpt->GetValue() );
2573
2574 for( size_t i = 0; i < m_notebook->GetPageCount(); ++i )
2575 m_notebook->GetPage( i )->Layout();
2576
2577 OnValuesChanged( event );
2578}
2579
2580
2582{
2583 if( m_padToDieOpt->GetValue() && m_currentPad )
2584 m_padToDie.SetValue( m_currentPad->GetPadToDieLength() );
2585
2586 OnValuesChanged( event );
2587}
2588
2589
2591{
2592 if( m_padToDieDelayOpt->GetValue() && m_currentPad )
2593 m_padToDieDelay.SetValue( m_currentPad->GetPadToDieDelay() );
2594
2595 OnValuesChanged( event );
2596}
2597
2598
2599void DIALOG_PAD_PROPERTIES::onModify( wxSpinDoubleEvent& aEvent )
2600{
2601 if( m_initialized )
2602 OnModify();
2603}
2604
2605
2606void DIALOG_PAD_PROPERTIES::onModify( wxCommandEvent& aEvent )
2607{
2608 if( m_initialized )
2609 OnModify();
2610}
2611
2612
2613void DIALOG_PAD_PROPERTIES::OnValuesChanged( wxCommandEvent& event )
2614{
2615 if( m_initialized )
2616 {
2618 return;
2619
2620 // If the pad size has changed, update the displayed values for rounded rect pads.
2623
2624 redraw();
2625 OnModify();
2626 }
2627}
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:128
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:106
@ teardrop_rect_sizes
@ pads_reset_unused
@ pads_remove_unused
@ pads_npth_bottom
@ pads_npth_top_bottom
@ pads_remove_unused_keep_bottom
#define DEFAULT_PAD_DRILL_DIAMETER_MM
static bool hasBackdrill(const PADSTACK &aPadstack)
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
BOX2< VECTOR2I > BOX2I
Definition box2.h:917
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:985
BOX2< VECTOR2D > BOX2D
Definition box2.h:918
BASE_SET & set(size_t pos)
Definition base_set.h:126
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
virtual bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
TEARDROP_PARAMETERS & GetTeardropParams()
FOOTPRINT * GetParentFootprint() const
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition box2.h:556
constexpr coord_type GetLeft() const
Definition box2.h:231
constexpr void Move(const Vec &aMoveVector)
Move the rectangle by the aMoveVector.
Definition box2.h:141
constexpr coord_type GetRight() const
Definition box2.h:220
constexpr const SizeVec & GetSize() const
Definition box2.h:209
constexpr coord_type GetTop() const
Definition box2.h:232
constexpr coord_type GetBottom() const
Definition box2.h:225
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Definition commit.h:102
PCB_LAYER_BOX_SELECTOR * m_backDrillBottomLayer
PCB_LAYER_BOX_SELECTOR * m_backDrillTopLayer
DIALOG_PAD_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_DIALOG_EDIT_PAD, const wxString &title=_("Pad Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
void OnUpdateUINonCopperWarning(wxUpdateUIEvent &event) override
void OnInitDialog(wxInitDialogEvent &event) override
void PadTypeSelected(wxCommandEvent &event) override
void OnPadToDieDelayCheckbox(wxCommandEvent &event) override
void OnPadShapeSelection(wxCommandEvent &event) override
bool transferDataToPad(PAD *aPad)
Copy values from dialog field to aPad's members.
bool TransferDataFromWindow() override
Updates the different parameters for the component being edited.
std::map< int, PCB_LAYER_ID > m_editLayerCtrlMap
bool Show(bool aShow) override
void OnHoleSizeCalculator(wxCommandEvent &event) override
void OnEditLayerChanged(wxCommandEvent &event) override
std::vector< std::shared_ptr< PCB_SHAPE > > m_primitives
bool padValuesOK()
test if all values are acceptable for the pad
void PadOrientEvent(wxCommandEvent &event) override
void OnResize(wxSizeEvent &event)
void OnElectricalTypeChaged(wxCommandEvent &event) override
void onPadShapeSelection(bool aUpdateSpokeAngle)
void OnOffsetCheckbox(wxCommandEvent &event) override
PCB_DRAW_PANEL_GAL * m_padPreviewGAL
void OnValuesChanged(wxCommandEvent &event) override
Called when a dimension has changed.
void updatePadLayersList(std::optional< LSET > layer_mask, bool remove_unconnected, bool keep_top_bottom)
Updates the CheckBox states in pad layers list.
void onBottomPostMachining(wxCommandEvent &event) override
void onTeardropsUpdateUi(wxUpdateUIEvent &event) override
std::vector< PCB_SHAPE * > m_highlight
std::vector< PCB_LAYER_ID > m_nonComponentLayers
Enabled copper layers offered for NON_COMPONENT pads.
void syncBackdrillControls(bool aFromUserEvent)
void OnPadstackModeChanged(wxCommandEvent &event) override
void onChangePadDrawMode(wxCommandEvent &event) override
KIGFX::ORIGIN_VIEWITEM * m_axisOrigin
void OnSetCopperLayers(wxCommandEvent &event) override
void onBackDrillChoice(wxCommandEvent &event) override
void OnCancel(wxCommandEvent &event) override
void onCornerRadiusChange(wxCommandEvent &event) override
PAD_PROP getSelectedProperty()
Return the pad property currently selected.
void OnSetLayers(wxCommandEvent &event) override
void onCornerSizePercentChange(wxCommandEvent &event) override
MARGIN_OFFSET_BINDER m_pasteMargin
void OnPadToDieCheckbox(wxCommandEvent &event) override
void onTopPostMachining(wxCommandEvent &event) override
void OnDrillShapeSelected(wxCommandEvent &event) override
DIALOG_PAD_PROPERTIES(PCB_BASE_FRAME *aParent, PAD &aPad)
void OnUpdateUI(wxUpdateUIEvent &event) override
void onModify(wxCommandEvent &aEvent) override
bool Show(bool show) override
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition dialog_shim.h:95
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void resetSize()
Clear the existing dialog size and position.
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
EDA_BASE_FRAME * m_parentFrame
int ShowModal() override
FRAME_T GetFrameType() const
void ListSet(const wxString &aList)
Add a list of items.
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
bool m_forceDisplayCursor
Force cursor display.
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
void SetGridSize(const VECTOR2D &aGridSize)
Set the grid size.
void SetGridVisibility(bool aVisibility)
Set the visibility setting of the grid.
Contains methods for drawing PCB-specific items.
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
PCB specific render settings.
Definition pcb_painter.h:94
void SetLayerColor(int aLayer, const COLOR4D &aColor)
Change the color used to draw a layer.
An interface for classes handling user events controlling the view behavior such as zooming,...
const VC_SETTINGS & GetSettings() const
Return the current VIEW_CONTROLS settings.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:68
void SetViewport(const BOX2D &aViewport)
Set the visible area of the VIEW.
Definition view.cpp:872
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition view.cpp:365
void SetBoundary(const BOX2D &aBoundary)
Set limits for view area.
Definition view.h:317
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition view.cpp:2630
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition view.h:431
GAL * GetGAL() const
Return the GAL this view is using to draw graphical primitives.
Definition view.h:224
void ClearTopLayers()
Remove all layers from the on-the-top set (they are no longer displayed over the rest of layers).
Definition view.cpp:1299
virtual void SetTopLayer(int aLayer, bool aEnabled=true)
Set given layer to be displayed on the top or sets back the default order of layers.
Definition view.cpp:1247
PAINTER * GetPainter() const
Return the painter object used by the view for drawing VIEW_ITEM objects.
Definition view.h:242
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:348
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition kiway.cpp:407
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr, bool aFromOtherThread=false)
Send aPayload to aDestination from aSource.
Definition kiway.cpp:511
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
Definition lseq.h:47
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
Definition lset.cpp:604
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
Definition lset.cpp:739
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
Definition lset.cpp:259
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
Definition lset.cpp:623
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition lset.cpp:595
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition netinfo.h:281
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
Definition padstack.h:161
void SetBackdrillSize(bool aTop, std::optional< int > aSize)
Definition padstack.cpp:595
void ForEachUniqueLayer(const std::function< void(PCB_LAYER_ID)> &aMethod) const
Runs the given callable for each active unique copper layer in this padstack, meaning F_Cu for MODE::...
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
Definition padstack.h:405
bool HasExplicitDefinitionForLayer(PCB_LAYER_ID aLayer) const
Check if the padstack has an explicit definition for the given layer.
void SetMode(MODE aMode)
COPPER_LAYER_PROPS & CopperLayer(PCB_LAYER_ID aLayer)
POST_MACHINING_PROPS & FrontPostMachining()
Definition padstack.h:372
void SetBackdrillEndLayer(bool aTop, PCB_LAYER_ID aLayer)
Definition padstack.cpp:620
std::optional< int > GetBackdrillSize(bool aTop) const
Definition padstack.cpp:586
MODE
! Copper geometry mode: controls how many unique copper layer shapes this padstack has
Definition padstack.h:174
@ NORMAL
Shape is the same on all layers.
Definition padstack.h:175
@ CUSTOM
Shapes can be defined on arbitrary layers.
Definition padstack.h:177
@ FRONT_INNER_BACK
Up to three shapes can be defined (F_Cu, inner copper layers, B_Cu)
Definition padstack.h:176
PCB_LAYER_ID GetBackdrillEndLayer(bool aTop) const
Definition padstack.cpp:611
POST_MACHINING_PROPS & BackPostMachining()
Definition padstack.h:375
static constexpr PCB_LAYER_ID INNER_LAYERS
! The layer identifier to use for "inner layers" on top/inner/bottom padstacks
Definition padstack.h:187
void SetLastPadNumber(const wxString &aPadNumber)
Definition pad_tool.h:67
wxString GetLastPadNumber() const
Definition pad_tool.h:66
Definition pad.h:61
void SetAnchorPadShape(PCB_LAYER_ID aLayer, PAD_SHAPE aShape)
Set the shape of the anchor pad for custom shaped pads.
Definition pad.h:249
void SetAttribute(PAD_ATTRIB aAttribute)
Definition pad.cpp:1563
void SetLocalThermalGapOverride(const std::optional< int > &aOverride)
Definition pad.h:803
PAD_ATTRIB GetAttribute() const
Definition pad.h:582
static LSET PTHMask()
layer set for a through hole pad
Definition pad.cpp:620
void SetThermalSpokeAngle(const EDA_ANGLE &aAngle)
The orientation of the thermal spokes.
Definition pad.h:775
void SetSimElectricalType(PAD_SIM_ELECTRICAL_TYPE aType)
Definition pad.h:594
void SetLocalSolderPasteMarginRatio(std::optional< double > aRatio)
Definition pad.h:626
void SetLocalThermalSpokeWidthOverride(std::optional< int > aWidth)
Set the width of the thermal spokes connecting the pad to a zone.
Definition pad.h:759
void SetShape(PCB_LAYER_ID aLayer, PAD_SHAPE aShape)
Set the new shape of this pad.
Definition pad.h:196
void SetProperty(PAD_PROP aProperty)
Definition pad.cpp:1639
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition pad.cpp:641
void SetDelta(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
Definition pad.h:301
void SetPadToDieDelay(int aDelay)
Definition pad.h:602
PAD_SHAPE GetShape(PCB_LAYER_ID aLayer) const
Definition pad.h:205
void SetNumber(const wxString &aNumber)
Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
Definition pad.h:142
void SetDrillShape(PAD_DRILL_SHAPE aShape)
Definition pad.h:437
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition pad.h:609
void SetOffset(PCB_LAYER_ID aLayer, const VECTOR2I &aOffset)
Definition pad.cpp:837
void SetCustomShapeInZoneOpt(CUSTOM_SHAPE_ZONE_MODE aOption)
Set the option for the custom pad shape to use as clearance area in copper zones.
Definition pad.h:237
void SetLocalZoneConnection(ZONE_CONNECTION aType)
Definition pad.h:632
void SetChamferRectRatio(PCB_LAYER_ID aLayer, double aChamferScale)
Has meaning only for chamfered rectangular pads.
Definition pad.cpp:1103
VECTOR2I GetSize(PCB_LAYER_ID aLayer) const
Definition pad.cpp:297
void SetPosition(const VECTOR2I &aPos) override
Definition pad.cpp:244
const PADSTACK & Padstack() const
Definition pad.h:331
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
Definition pad.cpp:634
void SetDrillSize(const VECTOR2I &aSize)
Definition pad.h:319
void SetSize(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
Definition pad.cpp:264
void ReplacePrimitives(PCB_LAYER_ID aLayer, const std::vector< std::shared_ptr< PCB_SHAPE > > &aPrimitivesList)
Clear the current custom shape primitives list and import a new list.
Definition pad.cpp:3408
static LSET ApertureMask()
layer set for an aperture pad
Definition pad.cpp:648
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition pad.cpp:627
void SetChamferPositions(PCB_LAYER_ID aLayer, int aPositions)
Has meaning only for chamfered rectangular pads.
Definition pad.h:873
void SetLocalSolderPasteMargin(std::optional< int > aMargin)
Definition pad.h:616
void SetOrientation(const EDA_ANGLE &aAngle)
Set the rotation angle of the pad.
Definition pad.cpp:1647
void SetLocalClearance(std::optional< int > aClearance)
Definition pad.h:606
void SetLayerSet(const LSET &aLayers) override
Definition pad.cpp:1930
PAD_SHAPE GetAnchorPadShape(PCB_LAYER_ID aLayer) const
Definition pad.h:219
void SetRoundRectRadiusRatio(PCB_LAYER_ID aLayer, double aRadiusScale)
Has meaning only for rounded rectangle pads.
Definition pad.cpp:1065
void SetPadToDieLength(int aLength)
Definition pad.h:599
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void ShowPadPropertiesDialog(PAD &aPad)
Class to display a pcb layer list in a wxBitmapComboBox.
double m_BestWidthRatio
The height of a teardrop as ratio between height and size of pad/via.
int m_TdMaxLen
max allowed length for teardrops in IU. <= 0 to disable
bool m_AllowUseTwoTracks
True to create teardrops using 2 track segments if the first in too small.
int m_TdMaxWidth
max allowed height for teardrops in IU. <= 0 to disable
double m_BestLengthRatio
The length of a teardrop as ratio between length and size of pad/via.
double m_WidthtoSizeFilterRatio
The ratio (H/D) between the via/pad size and the track width max value to create a teardrop 1....
bool m_TdOnPadsInZones
A filter to exclude pads inside zone fills.
bool m_Enabled
Flag to enable teardrops.
bool m_CurvedEdges
True if the teardrop should be curved.
A type-safe container of any type.
Definition ki_any.h:92
@ FOR_GUI
Definition common.h:93
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:192
This file is part of the common library.
#define APERTURE_DLG_TYPE
#define CONN_DLG_TYPE
static PAD_ATTRIB code_type[]
#define SELECTED_ITEMS_LAYER
static PAD_SHAPE code_shape[]
static void showCalculatorPage(KIWAY_PLAYER &aHolder, std::string &aPayload)
#define NON_COMPONENT_DLG_TYPE
#define SMD_DLG_TYPE
@ CHOICE_SHAPE_CIRCLE
@ CHOICE_SHAPE_ROUNDRECT
@ CHOICE_SHAPE_CUSTOM_RECT_ANCHOR
@ CHOICE_SHAPE_CHAMFERED_RECT
@ CHOICE_SHAPE_CUSTOM_CIRC_ANCHOR
@ CHOICE_SHAPE_RECT
@ CHOICE_SHAPE_OVAL
@ CHOICE_SHAPE_TRAPEZOID
@ CHOICE_SHAPE_CHAMFERED_ROUNDED_RECT
#define NPTH_DLG_TYPE
#define PTH_DLG_TYPE
#define PAD_PROPERTIES_DLG_NAME
DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder.
int ConvertPadCheckToDrcCode(PAD_UTILS::PAD_CHECK_CODE aCode)
Map a granular PAD_UTILS::PAD_CHECK_CODE to the DRC error code used to report it at the DRC level (in...
Definition drc_item.cpp:32
@ DRCE_PADSTACK
Definition drc_item.h:71
@ DRCE_PADSTACK_INVALID
Definition drc_item.h:72
@ DRCE_PAD_TH_WITH_NO_HOLE
Definition drc_item.h:99
#define _(s)
static constexpr EDA_ANGLE ANGLE_90
Definition eda_angle.h:474
static constexpr EDA_ANGLE ANGLE_45
Definition eda_angle.h:473
#define BRIGHTENED
item is drawn with a bright contour
#define SELECTED
Item was manually selected by the user.
@ FRAME_PCB_EDITOR
Definition frame_type.h:38
@ FRAME_CALC
Definition frame_type.h:57
@ FRAME_FOOTPRINT_EDITOR
Definition frame_type.h:39
@ LAYER_PAD_NETNAMES
Definition layer_ids.h:198
@ LAYER_GRID
Definition layer_ids.h:250
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
Definition layer_ids.h:303
@ LAYER_NON_PLATEDHOLES
Draw usual through hole vias.
Definition layer_ids.h:235
@ LAYER_PAD_PLATEDHOLES
to draw pad holes (plated)
Definition layer_ids.h:267
@ LAYER_PAD_HOLEWALLS
Definition layer_ids.h:293
bool IsInnerCopperLayer(int aLayerId)
Test whether a layer is an inner (In1_Cu to In30_Cu) copper layer.
Definition layer_ids.h:766
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ B_Adhes
Definition layer_ids.h:99
@ Dwgs_User
Definition layer_ids.h:103
@ F_Paste
Definition layer_ids.h:100
@ F_Adhes
Definition layer_ids.h:98
@ B_Mask
Definition layer_ids.h:94
@ B_Cu
Definition layer_ids.h:61
@ Eco1_User
Definition layer_ids.h:105
@ F_Mask
Definition layer_ids.h:93
@ B_Paste
Definition layer_ids.h:101
@ F_SilkS
Definition layer_ids.h:96
@ UNDEFINED_LAYER
Definition layer_ids.h:57
@ Eco2_User
Definition layer_ids.h:106
@ B_SilkS
Definition layer_ids.h:97
@ F_Cu
Definition layer_ids.h:60
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition lset.cpp:750
This file contains miscellaneous commonly used macros and functions.
@ MAIL_CALC_SHOW
Definition mail_type.h:60
@ TOP_BOTTOM
Flip top to bottom (around the X axis)
Definition mirror.h:28
KICOMMON_API wxString GetLabel(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
KICOMMON_API wxFont GetStatusFont(wxWindow *aWindow)
KICOMMON_API wxFont GetSmallInfoFont(wxWindow *aWindow)
bool PadHasMeaningfulRoundingRadius(const PAD &aPad, PCB_LAYER_ID aLayer)
Returns true if the pad's rounding ratio is valid (i.e.
Definition pad_utils.cpp:51
void RemoveAllDrillsFromPadstack(PADSTACK &aPadstack)
Remove the primary drill, the secondary and tertiary drills, and any post-machining operations from a...
Definition pad_utils.cpp:58
double GetDefaultIpcRoundingRatio(const PAD &aPad, PCB_LAYER_ID aLayer)
Get a sensible default for a rounded rectangle pad's rounding ratio.
Definition pad_utils.cpp:37
void CheckPad(const PAD &aPad, const UNITS_PROVIDER &aUnitsProvider, bool aForPadProperties, const PAD_CHECK_HANDLER &aErrorHandler)
Run non-board-specific checks on a pad.
PAD_ATTRIB
The set of pad shapes, used with PAD::{Set,Get}Attribute().
Definition padstack.h:98
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
Definition padstack.h:104
@ NON_COMPONENT
Pad with no hole that does not connect to a physical component, but rather provides a connection poin...
Definition padstack.h:106
@ SMD
Smd pad, appears on the solder paste layer (default)
Definition padstack.h:100
@ PTH
Plated through hole pad.
Definition padstack.h:99
@ CONN
Like smd, does not appear on the solder paste layer (default) Note: also has a special attribute in G...
Definition padstack.h:101
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape()
Definition padstack.h:53
@ CHAMFERED_RECT
Definition padstack.h:61
@ ROUNDRECT
Definition padstack.h:58
@ TRAPEZOID
Definition padstack.h:57
@ RECTANGLE
Definition padstack.h:55
PAD_PROP
The set of pad properties used in Gerber files (Draw files, and P&P files) to define some properties ...
Definition padstack.h:118
@ FIDUCIAL_LOCAL
a fiducial (usually a smd) local to the parent footprint
Definition padstack.h:122
@ FIDUCIAL_GLBL
a fiducial (usually a smd) for the full board
Definition padstack.h:121
@ MECHANICAL
a pad used for mechanical support
Definition padstack.h:126
@ PRESSFIT
a PTH with a hole diameter with tight tolerances for press fit pin
Definition padstack.h:127
@ HEATSINK
a pad used as heat sink, usually in SMD footprints
Definition padstack.h:124
@ NONE
no special fabrication property
Definition padstack.h:119
@ TESTPOINT
a test point pad
Definition padstack.h:123
@ CASTELLATED
a pad with a castellated through hole
Definition padstack.h:125
@ BGA
Smd pad, used in BGA footprints.
Definition padstack.h:120
std::vector< FAB_LAYER_COLOR > dummy
std::optional< PAD_DRILL_POST_MACHINING_MODE > mode
Definition padstack.h:292
A single finding from CheckPad().
Definition pad_utils.h:122
int delta
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
Definition trigo.cpp:227
int FindNotebookPage(wxNotebook *aNotebook, wxWindow *aChildWindow)
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708
VECTOR2< double > VECTOR2D
Definition vector2d.h:707
@ THERMAL
Use thermal relief for pads.
Definition zones.h:46
@ NONE
Pads are not covered.
Definition zones.h:45
@ FULL
pads are covered by copper
Definition zones.h:47