From 87f72c3d97032c2eb6a8c54a5aac96fe6aa6719a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 20 Jul 2018 20:26:50 +0100 Subject: [PATCH] Initialize layer comboboxes before trying to set them. Fixes: lp:1782794 * https://bugs.launchpad.net/kicad/+bug/1782794 --- .../dialogs/dialog_track_via_properties.cpp | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/pcbnew/dialogs/dialog_track_via_properties.cpp b/pcbnew/dialogs/dialog_track_via_properties.cpp index e2116dc60b..99cb1ec602 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties.cpp @@ -61,6 +61,21 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen m_NetComboBox->SetBoard( aParent->GetBoard() ); m_NetComboBox->Enable( true ); + m_TrackLayerCtrl->SetLayersHotkeys( false ); + m_TrackLayerCtrl->SetNotAllowedLayerSet( LSET::AllNonCuMask() ); + m_TrackLayerCtrl->SetBoardFrame( aParent ); + m_TrackLayerCtrl->Resync(); + + m_ViaStartLayer->SetLayersHotkeys( false ); + m_ViaStartLayer->SetNotAllowedLayerSet( LSET::AllNonCuMask() ); + m_ViaStartLayer->SetBoardFrame( aParent ); + m_ViaStartLayer->Resync(); + + m_ViaEndLayer->SetLayersHotkeys( false ); + m_ViaEndLayer->SetNotAllowedLayerSet( LSET::AllNonCuMask() ); + m_ViaEndLayer->SetBoardFrame( aParent ); + m_ViaEndLayer->Resync(); + bool hasLocked = false; bool hasUnlocked = false; @@ -217,7 +232,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen m_ViaDrillCtrl->Connect( wxEVT_TEXT, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onViaEdit ), NULL, this ); m_ViaTypeChoice->Connect( wxEVT_CHOICE, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onViaEdit ), NULL, this ); - m_ViaDiameterCtrl->SetFocus(); + SetInitialFocus( m_ViaDiameterCtrl ); m_ViaTypeChoice->Enable(); @@ -230,15 +245,6 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen else if( viaType == VIA_NOT_DEFINED ) m_ViaTypeChoice->SetSelection( 3 ); - m_ViaStartLayer->SetLayersHotkeys( false ); - m_ViaStartLayer->SetNotAllowedLayerSet( LSET::AllNonCuMask() ); - m_ViaStartLayer->SetBoardFrame( aParent ); - m_ViaStartLayer->Resync(); - m_ViaEndLayer->SetLayersHotkeys( false ); - m_ViaEndLayer->SetNotAllowedLayerSet( LSET::AllNonCuMask() ); - m_ViaEndLayer->SetBoardFrame( aParent ); - m_ViaEndLayer->Resync(); - m_ViaStartLayer->Enable( viaType != VIA_THROUGH ); m_ViaEndLayer->Enable( viaType != VIA_THROUGH ); } @@ -256,12 +262,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen m_TrackWidthCtrl->Append( msg ); } - m_TrackLayerCtrl->SetLayersHotkeys( false ); - m_TrackLayerCtrl->SetNotAllowedLayerSet( LSET::AllNonCuMask() ); - m_TrackLayerCtrl->SetBoardFrame( aParent ); - m_TrackLayerCtrl->Resync(); - - m_TrackWidthCtrl->SetFocus(); + SetInitialFocus( m_TrackWidthCtrl ); } else { @@ -304,7 +305,8 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow() return false; } - if( m_ViaStartLayer->GetLayerSelection() == m_ViaEndLayer->GetLayerSelection() ) + if( m_ViaStartLayer->GetLayerSelection() != UNDEFINED_LAYER && + m_ViaStartLayer->GetLayerSelection() == m_ViaEndLayer->GetLayerSelection() ) { DisplayError( GetParent(), _( "Via start layer and end layer cannot be the same" ) ); return false;