From 05336798aceab069af3bf5befd7279318c06b3bc Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 7 Nov 2022 20:26:36 +0100 Subject: [PATCH] try to fix a wx3.0/wx3.1 compatibility --- eeschema/dialogs/dialog_sim_model.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/eeschema/dialogs/dialog_sim_model.cpp b/eeschema/dialogs/dialog_sim_model.cpp index 61c58ef016..f48f614db4 100644 --- a/eeschema/dialogs/dialog_sim_model.cpp +++ b/eeschema/dialogs/dialog_sim_model.cpp @@ -298,7 +298,7 @@ void DIALOG_SIM_MODEL::updateWidgets() updateModelParamsTab(); updateModelCodeTab(); updatePinAssignments(); - + m_excludeCheckbox->SetValue( !curModel().IsEnabled() ); std::string ref = SIM_MODEL::GetFieldValue( &m_fields, SIM_MODEL::REFERENCE_FIELD ); @@ -430,7 +430,7 @@ void DIALOG_SIM_MODEL::updateModelParamsTab() for( wxPropertyGridIterator it = m_paramGrid->GetIterator(); !it.AtEnd(); ++it ) { SIM_PROPERTY* prop = dynamic_cast( *it ); - + if( !prop ) continue; @@ -475,7 +475,7 @@ void DIALOG_SIM_MODEL::updateModelCodeTab() if( dynamic_cast( &curModel() ) ) { // For raw Spice models display the whole file instead. - + wxString path = curModel().FindParam( "lib" )->value->ToString(); wxString absolutePath = Prj().AbsolutePath( path ); wxTextFile file; @@ -816,10 +816,17 @@ wxPGProperty* DIALOG_SIM_MODEL::newParamProperty( int aParamIndex ) const prop->SetAttribute( wxPG_ATTR_UNITS, wxString::FromUTF8( param.info.unit.c_str() ) ); // Legacy due to the way we extracted the parameters from Ngspice. - if( param.isOtherVariant ) - prop->SetCell( 3, wxString::FromUTF8( param.info.defaultValueOfOtherVariant ) ); - else - prop->SetCell( 3, wxString::FromUTF8( param.info.defaultValue ) ); + #if wxCHECK_VERSION( 3, 1, 0 ) + if( param.isOtherVariant ) + prop->SetCell( 3, wxString::FromUTF8( param.info.defaultValueOfOtherVariant ) ); + else + prop->SetCell( 3, wxString::FromUTF8( param.info.defaultValue ) ); + #else + if( param.isOtherVariant ) + prop->SetCell( 3, wxString::FromUTF8( param.info.defaultValueOfOtherVariant.c_str() ) ); + else + prop->SetCell( 3, wxString::FromUTF8( param.info.defaultValue.c_str() ) ); + #endif wxString typeStr;