Remove empty choice in Via type dropdown

Fixes https://gitlab.com/kicad/code/kicad/issues/3968

(cherry picked from commit 265c1663f9)
This commit is contained in:
Michael Kavanagh 2020-03-01 19:29:41 +00:00 committed by Seth Hillbrand
parent fd81f70355
commit ce2c5d6528
3 changed files with 28 additions and 15 deletions

View File

@ -233,10 +233,18 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
switch( viaType )
{
case VIA_THROUGH: m_ViaTypeChoice->SetSelection( 0 ); break;
case VIA_MICROVIA: m_ViaTypeChoice->SetSelection( 1 ); break;
case VIA_BLIND_BURIED: m_ViaTypeChoice->SetSelection( 2 ); break;
case VIA_NOT_DEFINED: m_ViaTypeChoice->SetSelection( 3 ); break;
case VIA_THROUGH:
m_ViaTypeChoice->SetSelection( 0 );
break;
case VIA_MICROVIA:
m_ViaTypeChoice->SetSelection( 1 );
break;
case VIA_BLIND_BURIED:
m_ViaTypeChoice->SetSelection( 2 );
break;
case VIA_NOT_DEFINED:
m_ViaTypeChoice->SetSelection( wxNOT_FOUND );
break;
}
m_ViaStartLayer->Enable( viaType != VIA_THROUGH );
@ -458,15 +466,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( VIA_THROUGH ); v->SanitizeLayers(); break;
case 1: v->SetViaType( VIA_MICROVIA ); break;
case 2: v->SetViaType( VIA_BLIND_BURIED ); break;
}
case 0:
v->SetViaType( VIA_THROUGH );
v->SanitizeLayers();
break;
case 1:
v->SetViaType( VIA_MICROVIA );
break;
case 2:
v->SetViaType( VIA_BLIND_BURIED );
break;
default:
break;
}
auto startLayer = static_cast<PCB_LAYER_ID>( m_ViaStartLayer->GetLayerSelection() );

View File

@ -240,8 +240,8 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
m_ViaTypeLabel = new wxStaticText( m_sbViaSizer->GetStaticBox(), wxID_ANY, _("Via type:"), wxDefaultPosition, wxDefaultSize, 0 );
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 );

View File

@ -4141,7 +4141,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Through&quot; &quot;Micro&quot; &quot;Blind/buried&quot; &quot;&quot;</property>
<property name="choices">&quot;Through&quot; &quot;Micro&quot; &quot;Blind/buried&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>