Don't complain about no sim model when running Sim Model Editor dialog.

Also removes some atrophied code, and makes sure changes to the parameter
grid for raw spice models gets saved.
This commit is contained in:
Jeff Young 2023-03-25 20:22:04 +00:00
parent 30b3645e60
commit 1788db53e5
3 changed files with 5 additions and 29 deletions

View File

@ -259,7 +259,8 @@ bool DIALOG_SIM_MODEL<T_symbol, T_field>::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<T_symbol, T_field>::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() ) );
}

View File

@ -387,13 +387,6 @@ TYPE SIM_MODEL::ReadTypeFromFields( const std::vector<T>& 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<T>& aFields, REPORTER* aRe
}
template <typename T>
TYPE SIM_MODEL::InferTypeFromLegacyFields( const std::vector<T>& 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<SCH_FIELD>* aFields,
const std::vector<LIB_PIN*>& aPins )

View File

@ -386,10 +386,6 @@ public:
template <typename T>
static TYPE ReadTypeFromFields( const std::vector<T>& aFields, REPORTER* aReporter );
template <typename T>
static TYPE InferTypeFromLegacyFields( const std::vector<T>& aFields );
static std::unique_ptr<SIM_MODEL> Create( TYPE aType, const std::vector<LIB_PIN*>& aPins,
REPORTER* aReporter );