diff --git a/eeschema/dialogs/dialog_sim_model.cpp b/eeschema/dialogs/dialog_sim_model.cpp index 5be44d8ea4..54dae6ef05 100644 --- a/eeschema/dialogs/dialog_sim_model.cpp +++ b/eeschema/dialogs/dialog_sim_model.cpp @@ -58,19 +58,20 @@ bool equivalent( SIM_MODEL::DEVICE_T a, SIM_MODEL::DEVICE_T b ) template DIALOG_SIM_MODEL::DIALOG_SIM_MODEL( wxWindow* aParent, T_symbol& aSymbol, - std::vector& aFields ) - : DIALOG_SIM_MODEL_BASE( aParent ), - m_symbol( aSymbol ), - m_fields( aFields ), - m_libraryModelsMgr( &Prj() ), - m_builtinModelsMgr( &Prj() ), - m_prevModel( nullptr ), - m_curModelType( SIM_MODEL::TYPE::NONE ), - m_scintillaTricks( nullptr ), - m_firstCategory( nullptr ), - m_prevParamGridSelection( nullptr ), - m_lastParamGridWidth( 0 ), - m_inKillFocus( false ) + std::vector& aFields ) :\ + DIALOG_SIM_MODEL_BASE( aParent ), + m_symbol( aSymbol ), + m_fields( aFields ), + m_libraryModelsMgr( &Prj() ), + m_builtinModelsMgr( &Prj() ), + m_prevModel( nullptr ), + m_curModelType( SIM_MODEL::TYPE::NONE ), + m_scintillaTricksCode( nullptr ), + m_scintillaTricksSubckt( nullptr ), + m_firstCategory( nullptr ), + m_prevParamGridSelection( nullptr ), + m_lastParamGridWidth( 0 ), + m_inKillFocus( false ) { m_browseButton->SetBitmap( KiBitmap( BITMAPS::small_folder ) ); @@ -90,7 +91,8 @@ DIALOG_SIM_MODEL::DIALOG_SIM_MODEL( wxWindow* aParent, T_symb m_typeChoice->Clear(); - m_scintillaTricks = new SCINTILLA_TRICKS( m_codePreview, wxT( "{}" ), false ); + m_scintillaTricksCode = new SCINTILLA_TRICKS( m_codePreview, wxT( "{}" ), false ); + m_scintillaTricksSubckt = new SCINTILLA_TRICKS( m_subckt, wxT( "()" ), false ); m_paramGridMgr->Bind( wxEVT_PG_SELECTED, &DIALOG_SIM_MODEL::onParamGridSelectionChange, this ); @@ -140,7 +142,8 @@ DIALOG_SIM_MODEL::~DIALOG_SIM_MODEL() // Delete the GRID_TRICKS. m_pinAssignmentsGrid->PopEventHandler( true ); - delete m_scintillaTricks; + delete m_scintillaTricksCode; + delete m_scintillaTricksSubckt; } @@ -690,6 +693,7 @@ void DIALOG_SIM_MODEL::updatePinAssignments( SIM_MODEL* aMode { SIM_MODEL_SUBCKT* subckt = static_cast( aModel ); m_subckt->SetText( subckt->GetSpiceCode() ); + m_subckt->SetEditable( false ); } else { diff --git a/eeschema/dialogs/dialog_sim_model.h b/eeschema/dialogs/dialog_sim_model.h index fef79b2f79..ef1cbb835e 100644 --- a/eeschema/dialogs/dialog_sim_model.h +++ b/eeschema/dialogs/dialog_sim_model.h @@ -130,7 +130,8 @@ private: std::map m_curModelTypeOfDeviceType; SIM_MODEL::TYPE m_curModelType; - SCINTILLA_TRICKS* m_scintillaTricks; + SCINTILLA_TRICKS* m_scintillaTricksCode; + SCINTILLA_TRICKS* m_scintillaTricksSubckt; wxPGProperty* m_firstCategory; // Used to add principal parameters to root. wxPGProperty* m_prevParamGridSelection; diff --git a/eeschema/sim/spice_grammar.h b/eeschema/sim/spice_grammar.h index c991262a11..e8b4aa5ed7 100644 --- a/eeschema/sim/spice_grammar.h +++ b/eeschema/sim/spice_grammar.h @@ -193,9 +193,10 @@ namespace SPICE_GRAMMAR spiceUnit>>> {}; - struct modelUnit : sor {}; + struct modelUnit : seq, + sor> {}; // Intentionally no if_must<>.