Allow net to be selected with mixed track & via selection.

Fixes https://gitlab.com/kicad/code/kicad/issues/12412
This commit is contained in:
Jeff Young 2022-09-20 11:36:44 +01:00
parent 7e97dc6974
commit cf1a411a19
2 changed files with 19 additions and 5 deletions

View File

@ -292,8 +292,11 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
if( m_vias ) 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_netSelectorLabel->Disable();
m_netSelector->Disable(); m_netSelector->Disable();
} }
@ -381,6 +384,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
SetupStandardButtons(); SetupStandardButtons();
m_frame->Bind( UNITS_CHANGED, &DIALOG_TRACK_VIA_PROPERTIES::onUnitsChanged, this ); 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 // Now all widgets have the size fixed, call FinishDialogSettings
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_viaNotFree->SetValue( false );
m_netSelector->Enable( !m_viaNotFree->GetValue() ); }
void DIALOG_TRACK_VIA_PROPERTIES::onViaNotFreeClicked( wxCommandEvent& aEvent )
{
if( !m_tracks )
{
m_netSelectorLabel->Enable( !m_viaNotFree->GetValue() );
m_netSelector->Enable( !m_viaNotFree->GetValue() );
}
} }

View File

@ -43,7 +43,8 @@ public:
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
private: private:
void onViaNotFreeClicked( wxCommandEvent& event ) override; void onNetSelector( wxCommandEvent& aEvent );
void onViaNotFreeClicked( wxCommandEvent& aEvent ) override;
void onTrackNetclassCheck( wxCommandEvent& aEvent ) override; void onTrackNetclassCheck( wxCommandEvent& aEvent ) override;
void onWidthSelect( wxCommandEvent& aEvent ) override; void onWidthSelect( wxCommandEvent& aEvent ) override;
void onWidthEdit( wxCommandEvent& aEvent ) override; void onWidthEdit( wxCommandEvent& aEvent ) override;