diff --git a/eeschema/dialogs/dialog_sim_model.cpp b/eeschema/dialogs/dialog_sim_model.cpp index 7a8eb3d0e1..9db5aec4f0 100644 --- a/eeschema/dialogs/dialog_sim_model.cpp +++ b/eeschema/dialogs/dialog_sim_model.cpp @@ -292,6 +292,7 @@ void DIALOG_SIM_MODEL::updateWidgets() m_overrideCheckbox->SetValue( curModel().HasNonInstanceOverrides() ); updateIbisWidgets(); + updateInstanceWidgets(); updateModelParamsTab(); updateModelCodeTab(); updatePinAssignments(); @@ -355,35 +356,40 @@ void DIALOG_SIM_MODEL::updateIbisWidgets() } +template +void DIALOG_SIM_MODEL::updateInstanceWidgets() +{ + SIM_MODEL::DEVICE_TYPE_ deviceType = SIM_MODEL::TypeInfo( curModel().GetType() ).deviceType; + + // Change the Type choice to match the current device type. + if( !m_prevModel || deviceType != m_prevModel->GetDeviceType() ) + { + m_deviceTypeChoice->SetSelection( static_cast( deviceType ) ); + + m_typeChoice->Clear(); + + for( SIM_MODEL::TYPE type : SIM_MODEL::TYPE_ITERATOR() ) + { + if( SIM_MODEL::TypeInfo( type ).deviceType == deviceType ) + { + wxString description = SIM_MODEL::TypeInfo( type ).description; + + if( !description.IsEmpty() ) + m_typeChoice->Append( description ); + + if( type == curModel().GetType() ) + m_typeChoice->SetSelection( m_typeChoice->GetCount() - 1 ); + } + } + } +} + + template void DIALOG_SIM_MODEL::updateModelParamsTab() { if( &curModel() != m_prevModel ) { - SIM_MODEL::DEVICE_TYPE_ deviceType = SIM_MODEL::TypeInfo( curModel().GetType() ).deviceType; - - // Change the Type choice to match the current device type. - if( !m_prevModel || deviceType != m_prevModel->GetDeviceType() ) - { - m_deviceTypeChoice->SetSelection( static_cast( deviceType ) ); - - m_typeChoice->Clear(); - - for( SIM_MODEL::TYPE type : SIM_MODEL::TYPE_ITERATOR() ) - { - if( SIM_MODEL::TypeInfo( type ).deviceType == deviceType ) - { - wxString description = SIM_MODEL::TypeInfo( type ).description; - - if( !description.IsEmpty() ) - m_typeChoice->Append( description ); - - if( type == curModel().GetType() ) - m_typeChoice->SetSelection( m_typeChoice->GetCount() - 1 ); - } - } - } - // This wxPropertyGridManager column and header stuff has to be here because it segfaults in // the constructor. diff --git a/eeschema/dialogs/dialog_sim_model.h b/eeschema/dialogs/dialog_sim_model.h index c851edf599..7f04f3dc8c 100644 --- a/eeschema/dialogs/dialog_sim_model.h +++ b/eeschema/dialogs/dialog_sim_model.h @@ -92,6 +92,7 @@ private: void updateWidgets(); void updateIbisWidgets(); + void updateInstanceWidgets(); void updateModelParamsTab(); void updateModelCodeTab(); void updatePinAssignments();