From 265c1663f9aecb755196cba163e6c6b3386eabea Mon Sep 17 00:00:00 2001 From: Michael Kavanagh Date: Sun, 1 Mar 2020 19:29:41 +0000 Subject: [PATCH] Remove empty choice in Via type dropdown Fixes https://gitlab.com/kicad/code/kicad/issues/3968 --- .../dialogs/dialog_track_via_properties.cpp | 30 +++++++++---------- .../dialog_track_via_properties_base.cpp | 2 +- .../dialog_track_via_properties_base.fbp | 2 +- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/pcbnew/dialogs/dialog_track_via_properties.cpp b/pcbnew/dialogs/dialog_track_via_properties.cpp index e38f17782c..99686b9da4 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties.cpp @@ -237,7 +237,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen m_ViaTypeChoice->SetSelection( 2 ); break; case VIATYPE::NOT_DEFINED: - m_ViaTypeChoice->SetSelection( 3 ); + m_ViaTypeChoice->SetSelection( wxNOT_FOUND ); break; } @@ -458,22 +458,20 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow() if( !m_viaY.IsIndeterminate() ) v->SetPosition( wxPoint( v->GetPosition().x, m_viaY.GetValue() ) ); - if( m_ViaTypeChoice->GetSelection() != 3) + switch( m_ViaTypeChoice->GetSelection() ) { - switch( m_ViaTypeChoice->GetSelection() ) - { - default: - case 0: - v->SetViaType( VIATYPE::THROUGH ); - v->SanitizeLayers(); - break; - case 1: - v->SetViaType( VIATYPE::MICROVIA ); - break; - case 2: - v->SetViaType( VIATYPE::BLIND_BURIED ); - break; - } + case 0: + v->SetViaType( VIATYPE::THROUGH ); + v->SanitizeLayers(); + break; + case 1: + v->SetViaType( VIATYPE::MICROVIA ); + break; + case 2: + v->SetViaType( VIATYPE::BLIND_BURIED ); + break; + default: + break; } auto startLayer = static_cast( m_ViaStartLayer->GetLayerSelection() ); diff --git a/pcbnew/dialogs/dialog_track_via_properties_base.cpp b/pcbnew/dialogs/dialog_track_via_properties_base.cpp index 72f1717675..d29db32991 100644 --- a/pcbnew/dialogs/dialog_track_via_properties_base.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties_base.cpp @@ -241,7 +241,7 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa m_ViaTypeLabel->Wrap( -1 ); fgViaRightSizer->Add( m_ViaTypeLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); - wxString m_ViaTypeChoiceChoices[] = { _("Through"), _("Micro"), _("Blind/buried"), wxEmptyString }; + wxString m_ViaTypeChoiceChoices[] = { _("Through"), _("Micro"), _("Blind/buried") }; int m_ViaTypeChoiceNChoices = sizeof( m_ViaTypeChoiceChoices ) / sizeof( wxString ); m_ViaTypeChoice = new wxChoice( m_sbViaSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ViaTypeChoiceNChoices, m_ViaTypeChoiceChoices, 0 ); m_ViaTypeChoice->SetSelection( 0 ); diff --git a/pcbnew/dialogs/dialog_track_via_properties_base.fbp b/pcbnew/dialogs/dialog_track_via_properties_base.fbp index e12f095d8b..0ce6966eb7 100644 --- a/pcbnew/dialogs/dialog_track_via_properties_base.fbp +++ b/pcbnew/dialogs/dialog_track_via_properties_base.fbp @@ -2822,7 +2822,7 @@ 1 0 - "Through" "Micro" "Blind/buried" "" + "Through" "Micro" "Blind/buried" 1 1