diff --git a/eeschema/dialogs/dialog_sim_model.cpp b/eeschema/dialogs/dialog_sim_model.cpp index cee576e71b..09ba1593a9 100644 --- a/eeschema/dialogs/dialog_sim_model.cpp +++ b/eeschema/dialogs/dialog_sim_model.cpp @@ -259,7 +259,8 @@ bool DIALOG_SIM_MODEL::TransferDataToWindow() } } } - else + else if( !SIM_MODEL::GetFieldValue( &m_fields, SIM_DEVICE_TYPE_FIELD ).empty() + || !SIM_MODEL::GetFieldValue( &m_fields, SIM_TYPE_FIELD ).empty() ) { // The model is sourced from the instance. m_useInstanceModelRadioButton->SetValue( true ); @@ -360,6 +361,9 @@ bool DIALOG_SIM_MODEL::TransferDataFromWindow() if( curModel().GetType() == SIM_MODEL::TYPE::RAWSPICE ) { + if( m_modelNotebook->GetSelection() == 0 ) + updateModelCodeTab( &curModel() ); + wxString code = m_codePreview->GetText().Trim( true ).Trim( false ); curModel().SetParamValue( "model", std::string( code.ToUTF8() ) ); } diff --git a/eeschema/sim/sim_model.cpp b/eeschema/sim/sim_model.cpp index b1016f6e7e..09368d622d 100644 --- a/eeschema/sim/sim_model.cpp +++ b/eeschema/sim/sim_model.cpp @@ -387,13 +387,6 @@ TYPE SIM_MODEL::ReadTypeFromFields( const std::vector& aFields, REPORTER* aRe if( typeFieldValue != "" ) return TYPE::NONE; - // No type information. Look for legacy (pre-V7) fields. - - TYPE typeFromLegacyFields = InferTypeFromLegacyFields( aFields ); - - if( typeFromLegacyFields != TYPE::NONE ) - return typeFromLegacyFields; - if( aReporter ) { if( aFields.size() > REFERENCE_FIELD ) @@ -414,23 +407,6 @@ TYPE SIM_MODEL::ReadTypeFromFields( const std::vector& aFields, REPORTER* aRe } -template -TYPE SIM_MODEL::InferTypeFromLegacyFields( const std::vector& aFields ) -{ - if( GetFieldValue( &aFields, SIM_MODEL_RAW_SPICE::LEGACY_TYPE_FIELD ) != "" - || GetFieldValue( &aFields, SIM_MODEL_RAW_SPICE::LEGACY_MODEL_FIELD ) != "" - || GetFieldValue( &aFields, SIM_MODEL_RAW_SPICE::LEGACY_ENABLED_FIELD ) != "" - || GetFieldValue( &aFields, SIM_MODEL_RAW_SPICE::LEGACY_LIB_FIELD ) != "" ) - { - return TYPE::RAWSPICE; - } - else - { - return TYPE::NONE; - } -} - - template <> void SIM_MODEL::ReadDataFields( const std::vector* aFields, const std::vector& aPins ) diff --git a/eeschema/sim/sim_model.h b/eeschema/sim/sim_model.h index 8b299981e8..0e6e1b507f 100644 --- a/eeschema/sim/sim_model.h +++ b/eeschema/sim/sim_model.h @@ -386,10 +386,6 @@ public: template static TYPE ReadTypeFromFields( const std::vector& aFields, REPORTER* aReporter ); - template - static TYPE InferTypeFromLegacyFields( const std::vector& aFields ); - - static std::unique_ptr Create( TYPE aType, const std::vector& aPins, REPORTER* aReporter );