From 24a9245f816ce90ab5d00968a21aeefc0e945ca8 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 21 Oct 2023 19:10:38 +0100 Subject: [PATCH] Hook up via size & drill constraints to editors. --- ...ialog_global_edit_tracks_and_vias_base.cpp | 8 +- ...ialog_global_edit_tracks_and_vias_base.fbp | 2 +- .../dialog_global_edit_tracks_and_vias_base.h | 2 +- .../dialogs/dialog_track_via_properties.cpp | 34 +++---- .../dialog_track_via_properties_base.cpp | 18 ++-- .../dialog_track_via_properties_base.fbp | 4 +- .../dialog_track_via_properties_base.h | 4 +- pcbnew/edit_track_width.cpp | 99 ++++++++----------- pcbnew/pcb_edit_frame.h | 10 +- pcbnew/pcb_track.cpp | 18 ++++ pcbnew/pcb_track.h | 2 + 11 files changed, 98 insertions(+), 103 deletions(-) diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.cpp b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.cpp index 4fbdc9b54b..32253fa56f 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.cpp +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.cpp @@ -172,8 +172,8 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE sbAction->Add( fgSizerTrackViaPopups, 0, wxBOTTOM|wxEXPAND|wxLEFT, 25 ); - m_setToNetclassValues = new wxRadioButton( sbAction->GetStaticBox(), ID_SPECIFIED_NET_TO_NETCLASS_VALUES, _("Set to net class / custom rule values"), wxDefaultPosition, wxDefaultSize, 0 ); - sbAction->Add( m_setToNetclassValues, 0, wxBOTTOM, 5 ); + m_setToDesignRuleValues = new wxRadioButton( sbAction->GetStaticBox(), ID_SPECIFIED_NET_TO_NETCLASS_VALUES, _("Set to net class / custom rule values"), wxDefaultPosition, wxDefaultSize, 0 ); + sbAction->Add( m_setToDesignRuleValues, 0, wxBOTTOM, 5 ); bMainSizer->Add( sbAction, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 ); @@ -198,7 +198,7 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE m_trackWidthFilterCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnTrackWidthText ), NULL, this ); m_viaSizeFilterCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnViaSizeText ), NULL, this ); m_setToSpecifiedValues->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this ); - m_setToNetclassValues->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this ); + m_setToDesignRuleValues->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this ); } DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE() @@ -209,6 +209,6 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BAS m_trackWidthFilterCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnTrackWidthText ), NULL, this ); m_viaSizeFilterCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnViaSizeText ), NULL, this ); m_setToSpecifiedValues->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this ); - m_setToNetclassValues->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this ); + m_setToDesignRuleValues->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onActionButtonChange ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.fbp b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.fbp index f26eacbe13..f9030a1427 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.fbp +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.fbp @@ -1658,7 +1658,7 @@ 0 1 - m_setToNetclassValues + m_setToDesignRuleValues 1 diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.h b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.h index 19ad2aca49..e12953a2b0 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.h +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.h @@ -65,7 +65,7 @@ class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE : public DIALOG_SHIM wxChoice* m_trackWidthCtrl; wxChoice* m_viaSizesCtrl; PCB_LAYER_BOX_SELECTOR* m_layerCtrl; - wxRadioButton* m_setToNetclassValues; + wxRadioButton* m_setToDesignRuleValues; wxStdDialogButtonSizer* m_sdbSizer; wxButton* m_sdbSizerOK; wxButton* m_sdbSizerCancel; diff --git a/pcbnew/dialogs/dialog_track_via_properties.cpp b/pcbnew/dialogs/dialog_track_via_properties.cpp index 8a04547c60..fcc3553332 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties.cpp @@ -151,7 +151,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen m_trackEndX.SetValue( t->GetEnd().x ); m_trackEndY.SetValue( t->GetEnd().y ); m_trackWidth.SetValue( t->GetWidth() ); - m_trackNetclass->SetValue( false ); + m_trackDesignRules->SetValue( false ); track_selection_layer = t->GetLayer(); m_tracks = true; } @@ -597,13 +597,13 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow() if( !m_trackEndY.IsIndeterminate() ) t->SetEnd( VECTOR2I( t->GetEnd().x, m_trackEndY.GetIntValue() ) ); - if( m_trackNetclass->IsChecked() ) + if( m_trackDesignRules->IsChecked() ) { MINOPTMAX constraint = t->GetWidthConstraint(); if( constraint.HasOpt() ) t->SetWidth( constraint.Opt() ); - else + else if( constraint.Min() > 0 ) t->SetWidth( constraint.Min() ); } else if( !m_trackWidth.IsIndeterminate() ) @@ -680,27 +680,21 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow() v->SanitizeLayers(); - if( m_viaNetclass->IsChecked() ) + if( m_viaDesignRules->IsChecked() ) { - NETCLASS* netclass = v->GetEffectiveNetClass(); + MINOPTMAX constraint = v->GetWidthConstraint(); - switch( v->GetViaType() ) - { - default: - wxFAIL_MSG( wxT( "Unhandled via type" ) ); - KI_FALLTHROUGH; + if( constraint.HasOpt() ) + v->SetWidth( constraint.Opt() ); + else if( constraint.Min() > 0 ) + v->SetWidth( constraint.Min() ); - case VIATYPE::THROUGH: - case VIATYPE::BLIND_BURIED: - v->SetWidth( netclass->GetViaDiameter() ); - v->SetDrill( netclass->GetViaDrill() ); - break; + constraint = v->GetDrillConstraint(); - case VIATYPE::MICROVIA: - v->SetWidth( netclass->GetuViaDiameter() ); - v->SetDrill( netclass->GetuViaDrill() ); - break; - } + if( constraint.HasOpt() ) + v->SetDrill( constraint.Opt() ); + else if( constraint.Min() > 0 ) + v->SetDrill( constraint.Min() ); } else { diff --git a/pcbnew/dialogs/dialog_track_via_properties_base.cpp b/pcbnew/dialogs/dialog_track_via_properties_base.cpp index 2aac5dac2d..eae8597d06 100644 --- a/pcbnew/dialogs/dialog_track_via_properties_base.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties_base.cpp @@ -117,9 +117,9 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa gbSizer1->SetFlexibleDirection( wxBOTH ); gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_trackNetclass = new wxCheckBox( m_sbTrackSizer->GetStaticBox(), wxID_ANY, _("Use net class / custom rule widths"), wxDefaultPosition, wxDefaultSize, 0 ); - m_trackNetclass->SetValue(true); - gbSizer1->Add( m_trackNetclass, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxTOP, 1 ); + m_trackDesignRules = new wxCheckBox( m_sbTrackSizer->GetStaticBox(), wxID_ANY, _("Use net class / custom rule widths"), wxDefaultPosition, wxDefaultSize, 0 ); + m_trackDesignRules->SetValue(true); + gbSizer1->Add( m_trackDesignRules, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxTOP, 1 ); m_DesignRuleWidths = new wxStaticText( m_sbTrackSizer->GetStaticBox(), wxID_ANY, _("Pre-defined sizes:"), wxDefaultPosition, wxDefaultSize, 0 ); m_DesignRuleWidths->Wrap( -1 ); @@ -219,8 +219,8 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa gbSizer3->SetFlexibleDirection( wxBOTH ); gbSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_viaNetclass = new wxCheckBox( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Use net class / custom rule sizes"), wxDefaultPosition, wxDefaultSize, 0 ); - gbSizer3->Add( m_viaNetclass, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxTOP, 1 ); + m_viaDesignRules = new wxCheckBox( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Use net class / custom rule sizes"), wxDefaultPosition, wxDefaultSize, 0 ); + gbSizer3->Add( m_viaDesignRules, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxTOP, 1 ); m_DesignRuleVias = new wxStaticText( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Pre-defined sizes:"), wxDefaultPosition, wxDefaultSize, 0 ); m_DesignRuleVias->Wrap( -1 ); @@ -560,10 +560,10 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa // Connect Events m_viaNotFree->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNotFreeClicked ), NULL, this ); - m_trackNetclass->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onTrackNetclassCheck ), NULL, this ); + m_trackDesignRules->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onTrackNetclassCheck ), NULL, this ); m_DesignRuleWidthsCtrl->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthSelect ), NULL, this ); m_TrackWidthCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthEdit ), NULL, this ); - m_viaNetclass->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNetclassCheck ), NULL, this ); + m_viaDesignRules->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNetclassCheck ), NULL, this ); m_DesignRuleViasCtrl->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaSelect ), NULL, this ); m_ViaDiameterCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaEdit ), NULL, this ); m_ViaDrillCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaEdit ), NULL, this ); @@ -597,10 +597,10 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::~DIALOG_TRACK_VIA_PROPERTIES_BASE() { // Disconnect Events m_viaNotFree->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNotFreeClicked ), NULL, this ); - m_trackNetclass->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onTrackNetclassCheck ), NULL, this ); + m_trackDesignRules->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onTrackNetclassCheck ), NULL, this ); m_DesignRuleWidthsCtrl->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthSelect ), NULL, this ); m_TrackWidthCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onWidthEdit ), NULL, this ); - m_viaNetclass->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNetclassCheck ), NULL, this ); + m_viaDesignRules->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNetclassCheck ), NULL, this ); m_DesignRuleViasCtrl->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaSelect ), NULL, this ); m_ViaDiameterCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaEdit ), NULL, this ); m_ViaDrillCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaEdit ), NULL, this ); diff --git a/pcbnew/dialogs/dialog_track_via_properties_base.fbp b/pcbnew/dialogs/dialog_track_via_properties_base.fbp index 470ff9d497..2bda4a23d0 100644 --- a/pcbnew/dialogs/dialog_track_via_properties_base.fbp +++ b/pcbnew/dialogs/dialog_track_via_properties_base.fbp @@ -1148,7 +1148,7 @@ 0 1 - m_trackNetclass + m_trackDesignRules 1 @@ -2152,7 +2152,7 @@ 0 1 - m_viaNetclass + m_viaDesignRules 1 diff --git a/pcbnew/dialogs/dialog_track_via_properties_base.h b/pcbnew/dialogs/dialog_track_via_properties_base.h index 4c4c6005e6..d3b60e5ef2 100644 --- a/pcbnew/dialogs/dialog_track_via_properties_base.h +++ b/pcbnew/dialogs/dialog_track_via_properties_base.h @@ -65,7 +65,7 @@ class DIALOG_TRACK_VIA_PROPERTIES_BASE : public DIALOG_SHIM wxStaticText* m_TrackEndYLabel; wxTextCtrl* m_TrackEndYCtrl; wxStaticText* m_TrackEndYUnit; - wxCheckBox* m_trackNetclass; + wxCheckBox* m_trackDesignRules; wxStaticText* m_DesignRuleWidths; wxChoice* m_DesignRuleWidthsCtrl; wxStaticText* m_DesignRuleWidthsUnits; @@ -80,7 +80,7 @@ class DIALOG_TRACK_VIA_PROPERTIES_BASE : public DIALOG_SHIM wxStaticText* m_ViaYLabel; wxTextCtrl* m_ViaYCtrl; wxStaticText* m_ViaYUnit; - wxCheckBox* m_viaNetclass; + wxCheckBox* m_viaDesignRules; wxStaticText* m_DesignRuleVias; wxChoice* m_DesignRuleViasCtrl; wxStaticText* m_DesignRuleViasUnit; diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index 42af1d8c86..b934e6ea64 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -30,82 +30,63 @@ #include #include -void PCB_EDIT_FRAME::SetTrackSegmentWidth( PCB_TRACK* aTrackItem, - PICKED_ITEMS_LIST* aItemsListPicker, - bool aUseDesignRules ) +void PCB_EDIT_FRAME::SetTrackSegmentWidth( PCB_TRACK* aItem, PICKED_ITEMS_LIST* aItemsListPicker, + bool aUseDesignRules ) { - int initial_width; - int new_width; - int initial_drill = -1; - int new_drill = -1; - - initial_width = aTrackItem->GetWidth(); + PCB_VIA* via = dynamic_cast( aItem ); + int new_width = -1; + int new_drill = -1; if( aUseDesignRules ) { - MINOPTMAX constraint = aTrackItem->GetWidthConstraint(); + MINOPTMAX constraint = aItem->GetWidthConstraint(); if( constraint.HasOpt() ) new_width = constraint.Opt(); - else + else if( constraint.Min() > 0 ) new_width = constraint.Min(); + + if( via ) + { + constraint = via->GetDrillConstraint(); + + if( constraint.HasOpt() ) + new_drill = constraint.Opt(); + else if( constraint.Min() > 0 ) + new_drill = constraint.Min(); + } + } + else if( via && via->GetViaType() == VIATYPE::MICROVIA ) + { + new_width = aItem->GetEffectiveNetClass()->GetuViaDiameter(); + new_drill = aItem->GetEffectiveNetClass()->GetuViaDrill(); + } + else if( via ) + { + new_width = GetDesignSettings().GetCurrentViaSize(); + new_drill = GetDesignSettings().GetCurrentViaDrill(); } else { new_width = GetDesignSettings().GetCurrentTrackWidth(); } - if( aTrackItem->Type() == PCB_VIA_T ) + if( new_width <= 0 ) + new_width = aItem->GetWidth(); + + if( via && new_drill <= 0 ) + new_drill = via->GetDrillValue(); + + if( aItem->GetWidth() != new_width || ( via && via->GetDrillValue() != new_drill ) ) { - const PCB_VIA *via = static_cast( aTrackItem ); + ITEM_PICKER picker( nullptr, aItem, UNDO_REDO::CHANGED ); + picker.SetLink( aItem->Clone() ); + aItemsListPicker->PushItem( picker ); - // Get the drill value, regardless it is default or specific - initial_drill = via->GetDrillValue(); + aItem->SetWidth( new_width ); - if( via->GetViaType() == VIATYPE::MICROVIA ) - { - new_width = aTrackItem->GetEffectiveNetClass()->GetuViaDiameter(); - new_drill = aTrackItem->GetEffectiveNetClass()->GetuViaDrill(); - } - else if( aUseDesignRules ) - { - new_width = aTrackItem->GetEffectiveNetClass()->GetViaDiameter(); - new_drill = aTrackItem->GetEffectiveNetClass()->GetViaDrill(); - } - else - { - new_width = GetDesignSettings().GetCurrentViaSize(); - new_drill = GetDesignSettings().GetCurrentViaDrill(); - } - - // Old versions set a drill value <= 0, when the default netclass it used but it could - // be better to set the drill value to the actual value to avoid issues for existing vias, - // if the default drill value is modified in the netclass, and not in current vias. - if( via->GetDrill() <= 0 ) // means default netclass drill value used - initial_drill = -1; // Force drill vias re-initialization - } - - if( initial_width != new_width || initial_drill != new_drill ) - { - if( aItemsListPicker ) - { - aTrackItem->SetWidth( initial_width ); - ITEM_PICKER picker( nullptr, aTrackItem, UNDO_REDO::CHANGED ); - picker.SetLink( aTrackItem->Clone() ); - aItemsListPicker->PushItem( picker ); - aTrackItem->SetWidth( new_width ); - - if( aTrackItem->Type() == PCB_VIA_T ) - { - // Set new drill value. Note: currently microvias have only a default drill value - PCB_VIA *via = static_cast( aTrackItem ); - - if( new_drill > 0 ) - via->SetDrill( new_drill ); - else - via->SetDrillDefault(); - } - } + if( via && new_drill > 0 ) + via->SetDrill( new_drill ); } } diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 19b1e77226..0eed1e1608 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -596,12 +596,12 @@ public: * Note that casting this to boolean will allow you to determine whether any action * happened. * - * @param aTrackItem the track segment or via to modify. + * @param aItem the track segment or via to modify. * @param aItemsListPicker the list picker to use for an undo command (can be NULL). - * @param aUseDesignRules true to use NetClass value, false to use current designSettings - * value. + * @param aUseDesignRules true to use design rules value, false to use current designSettings + * value. */ - void SetTrackSegmentWidth( PCB_TRACK* aTrackItem, PICKED_ITEMS_LIST* aItemsListPicker, + void SetTrackSegmentWidth( PCB_TRACK* aItem, PICKED_ITEMS_LIST* aItemsListPicker, bool aUseDesignRules ); @@ -629,7 +629,7 @@ public: * -2 if the schematic cannot be opened and 1 if OK. * If OK, opens Eeschema, and opens the schematic for this project */ - int TestStandalone( void ); + int TestStandalone(); /** * Read a netlist from a file into a #NETLIST object. diff --git a/pcbnew/pcb_track.cpp b/pcbnew/pcb_track.cpp index 571e53825e..04c98d56ef 100644 --- a/pcbnew/pcb_track.cpp +++ b/pcbnew/pcb_track.cpp @@ -320,6 +320,24 @@ MINOPTMAX PCB_TRACK::GetWidthConstraint( wxString* aSource ) const } +MINOPTMAX PCB_VIA::GetDrillConstraint( wxString* aSource ) const +{ + DRC_CONSTRAINT constraint; + + if( GetBoard() && GetBoard()->GetDesignSettings().m_DRCEngine ) + { + BOARD_DESIGN_SETTINGS& bds = GetBoard()->GetDesignSettings(); + + constraint = bds.m_DRCEngine->EvalRules( HOLE_SIZE_CONSTRAINT, this, nullptr, m_layer ); + } + + if( aSource ) + *aSource = constraint.GetName(); + + return constraint.Value(); +} + + int PCB_VIA::GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const { if( !FlashLayer( aLayer ) ) diff --git a/pcbnew/pcb_track.h b/pcbnew/pcb_track.h index a7491db6e3..1044b36031 100644 --- a/pcbnew/pcb_track.h +++ b/pcbnew/pcb_track.h @@ -417,6 +417,8 @@ public: std::shared_ptr GetEffectiveHoleShape() const override; + MINOPTMAX GetDrillConstraint( wxString* aSource = nullptr ) const; + bool IsTented() const override; int GetSolderMaskExpansion() const;