From cf1a411a197fdf9025aa13cac2d9cfab0a5e9f04 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 20 Sep 2022 11:36:44 +0100 Subject: [PATCH] Allow net to be selected with mixed track & via selection. Fixes https://gitlab.com/kicad/code/kicad/issues/12412 --- .../dialogs/dialog_track_via_properties.cpp | 21 +++++++++++++++---- pcbnew/dialogs/dialog_track_via_properties.h | 3 ++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/pcbnew/dialogs/dialog_track_via_properties.cpp b/pcbnew/dialogs/dialog_track_via_properties.cpp index 520305301c..2ca3429cbe 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties.cpp @@ -292,8 +292,11 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen if( m_vias ) { - if( m_viaNotFree->GetValue() ) + if( m_viaNotFree->GetValue() && !m_tracks ) { + // Disable net selector to re-inforce meaning of "Automatically update via nets", + // but not when tracks are also selected as then things get harder if you want to + // update all the nets to match. m_netSelectorLabel->Disable(); m_netSelector->Disable(); } @@ -381,6 +384,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen SetupStandardButtons(); m_frame->Bind( UNITS_CHANGED, &DIALOG_TRACK_VIA_PROPERTIES::onUnitsChanged, this ); + m_netSelector->Bind( NET_SELECTED, &DIALOG_TRACK_VIA_PROPERTIES::onNetSelector, this ); // Now all widgets have the size fixed, call FinishDialogSettings finishDialogSettings(); @@ -730,10 +734,19 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow() } -void DIALOG_TRACK_VIA_PROPERTIES::onViaNotFreeClicked( wxCommandEvent& event ) +void DIALOG_TRACK_VIA_PROPERTIES::onNetSelector( wxCommandEvent& aEvent ) { - m_netSelectorLabel->Enable( !m_viaNotFree->GetValue() ); - m_netSelector->Enable( !m_viaNotFree->GetValue() ); + m_viaNotFree->SetValue( false ); +} + + +void DIALOG_TRACK_VIA_PROPERTIES::onViaNotFreeClicked( wxCommandEvent& aEvent ) +{ + if( !m_tracks ) + { + m_netSelectorLabel->Enable( !m_viaNotFree->GetValue() ); + m_netSelector->Enable( !m_viaNotFree->GetValue() ); + } } diff --git a/pcbnew/dialogs/dialog_track_via_properties.h b/pcbnew/dialogs/dialog_track_via_properties.h index f0e012fe91..6a2d38daea 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.h +++ b/pcbnew/dialogs/dialog_track_via_properties.h @@ -43,7 +43,8 @@ public: bool TransferDataFromWindow() override; private: - void onViaNotFreeClicked( wxCommandEvent& event ) override; + void onNetSelector( wxCommandEvent& aEvent ); + void onViaNotFreeClicked( wxCommandEvent& aEvent ) override; void onTrackNetclassCheck( wxCommandEvent& aEvent ) override; void onWidthSelect( wxCommandEvent& aEvent ) override; void onWidthEdit( wxCommandEvent& aEvent ) override;