Enhance readability of Simulation Model dialog.

This commit is contained in:
Jeff Young 2022-10-26 14:03:20 +01:00
parent 6a0db3e7e2
commit a9a2cc3e84
7 changed files with 656 additions and 621 deletions

View File

@ -78,8 +78,6 @@ DIALOG_SIM_MODEL<T>::DIALOG_SIM_MODEL( wxWindow* aParent, SCH_SYMBOL& aSymbol,
for( SIM_MODEL::DEVICE_TYPE_ deviceType : SIM_MODEL::DEVICE_TYPE__ITERATOR() )
m_deviceTypeChoice->Append( SIM_MODEL::DeviceTypeInfo( deviceType ).description );
m_scintillaTricks = std::make_unique<SCINTILLA_TRICKS>( m_codePreview, wxT( "{}" ), false );
m_paramGridMgr->Bind( wxEVT_PG_SELECTED, &DIALOG_SIM_MODEL::onParamGridSelectionChange, this );
m_paramGrid->SetValidationFailureBehavior( wxPG_VFB_STAY_IN_PROPERTY
@ -110,7 +108,9 @@ DIALOG_SIM_MODEL<T>::DIALOG_SIM_MODEL( wxWindow* aParent, SCH_SYMBOL& aSymbol,
grid->DedicateKey( WXK_DOWN );
}
else
{
wxFAIL;
}
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
@ -120,11 +120,13 @@ DIALOG_SIM_MODEL<T>::DIALOG_SIM_MODEL( wxWindow* aParent, SCH_SYMBOL& aSymbol,
template <typename T>
bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
{
wxCommandEvent dummyEvent;
wxString libraryFilename = SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY::LIBRARY_FIELD );
if( libraryFilename != "" )
{
// The model is sourced from a library, optionally with instance overrides.
m_useLibraryModelRadioButton->SetValue( true );
loadLibrary( libraryFilename );
// Must be set before curModel() is used since the latter checks the combobox value.
@ -139,7 +141,6 @@ bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
if( kibismodel )
{
wxCommandEvent dummyEvent;
onModelNameCombobox( dummyEvent ); // refresh list of pins
int i = 0;
@ -182,6 +183,7 @@ bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
else
{
// The model is sourced from the instance.
m_useInstanceModelRadioButton->SetValue( true );
SIM_MODEL::TYPE type = SIM_MODEL::ReadTypeFromFields( m_fields, m_sortedSymbolPins.size() );
try
@ -192,7 +194,11 @@ bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
}
catch( const IO_ERROR& e )
{
DisplayErrorMessage( this, e.What() );
DisplayErrorMessage( this, _( "Failed to read simulation model from fields." )
+ wxT( "\n\n" )
+ e.What() );
onRadioButton( dummyEvent );
return DIALOG_SIM_MODEL_BASE::TransferDataToWindow();
}
@ -204,11 +210,10 @@ bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
m_inferCheckbox->SetValue( curModel().IsInferred() );
std::string ref = SIM_MODEL::GetFieldValue( &m_fields, SIM_MODEL::REFERENCE_FIELD );
m_inferCheckbox->Show(
SIM_MODEL::InferDeviceTypeFromRef( ref ) != SIM_MODEL::DEVICE_TYPE_::NONE );
updateWidgets();
m_inferCheckbox->Show( SIM_MODEL::InferDeviceTypeFromRef( ref )
!= SIM_MODEL::DEVICE_TYPE_::NONE );
onRadioButton( dummyEvent );
return DIALOG_SIM_MODEL_BASE::TransferDataToWindow();
}
@ -291,6 +296,7 @@ void DIALOG_SIM_MODEL<T>::updateWidgets()
m_prevModel = &curModel();
}
template <typename T>
void DIALOG_SIM_MODEL<T>::updateIbisWidgets()
{
@ -300,30 +306,24 @@ void DIALOG_SIM_MODEL<T>::updateIbisWidgets()
{
modelkibis = dynamic_cast<SIM_MODEL_KIBIS*>( &curModel() );
for ( auto& item : m_sourceSizer->GetChildren() )
for ( wxSizerItem* item : m_sourceSizer->GetChildren() )
{
if ( item->GetWindow() == m_differentialCheckbox )
{
item->SetFlag( wxALIGN_CENTER_VERTICAL|wxALL|wxRESERVE_SPACE_EVEN_IF_HIDDEN );
}
item->SetFlag( item->GetFlag() | wxRESERVE_SPACE_EVEN_IF_HIDDEN );
if ( item->GetWindow() == m_overrideCheckbox )
{
item->SetFlag( wxALIGN_CENTER_VERTICAL|wxALL );
}
item->SetFlag( item->GetFlag() & ~wxRESERVE_SPACE_EVEN_IF_HIDDEN );
}
}
else
{
for ( auto& item : m_sourceSizer->GetChildren() )
for ( wxSizerItem* item : m_sourceSizer->GetChildren() )
{
if ( item->GetWindow() == m_differentialCheckbox )
{
item->SetFlag( wxALIGN_CENTER_VERTICAL|wxALL );
}
item->SetFlag( item->GetFlag() | wxRESERVE_SPACE_EVEN_IF_HIDDEN );
if ( item->GetWindow() == m_overrideCheckbox )
{
item->SetFlag( wxALIGN_CENTER_VERTICAL|wxALL|wxRESERVE_SPACE_EVEN_IF_HIDDEN );
}
item->SetFlag( item->GetFlag() & ~wxRESERVE_SPACE_EVEN_IF_HIDDEN );
}
}
@ -443,18 +443,20 @@ void DIALOG_SIM_MODEL<T>::updateModelParamsTab()
( *it )->GetCell( col ).SetFgCol( fgCol );
}
const SIM_MODEL::PARAM& param = prop->GetParam();
// Model values other than the currently edited value may have changed. Update them.
// This feature is called "autofill" and present only in certain models. Don't do it for
// models that don't have it for performance reasons.
if( curModel().HasAutofill() )
( *it )->SetValueFromString( prop->GetParam().value->ToString() );
( *it )->SetValueFromString( param.value->ToString() );
// Most of the values are disabled when the override checkbox is unchecked.
( *it )->Enable(
( isIbisLoaded() ) || m_useInstanceModelRadioButton->GetValue()
|| ( prop->GetParam().info.isInstanceParam
&& prop->GetParam().info.category == SIM_MODEL::PARAM::CATEGORY::PRINCIPAL )
|| m_overrideCheckbox->GetValue() );
( *it )->Enable( isIbisLoaded()
|| m_useInstanceModelRadioButton->GetValue()
|| ( param.info.isInstanceParam
&& param.info.category == SIM_MODEL::PARAM::CATEGORY::PRINCIPAL )
|| m_overrideCheckbox->GetValue() );
}
}
@ -474,10 +476,10 @@ void DIALOG_SIM_MODEL<T>::updateModelCodeTab()
{
// For raw Spice models display the whole file instead.
wxString path = curModel().FindParam( "lib" )->value->ToString();
wxString absolutePath = Prj().AbsolutePath( path );
wxString path = curModel().FindParam( "lib" )->value->ToString();
wxString absolutePath = Prj().AbsolutePath( path );
wxTextFile file;
wxString text;
wxString text;
text << curModel().SpiceGenerator().Preview( item );
text << "\n";
@ -497,7 +499,9 @@ void DIALOG_SIM_MODEL<T>::updateModelCodeTab()
}
}
else
{
m_codePreview->SetText( curModel().SpiceGenerator().Preview( item ) );
}
m_codePreview->SetEditable( false ); // ???
m_wasCodePreviewUpdated = true;
@ -603,7 +607,6 @@ void DIALOG_SIM_MODEL<T>::loadLibrary( const wxString& aFilePath )
{
wxString ibisTypeString = SIM_MODEL::GetFieldValue( &m_fields, SIM_MODEL::TYPE_FIELD );
SIM_MODEL::TYPE ibisType = SIM_MODEL::TYPE::KIBIS_DEVICE;
if( ibisTypeString == "IBISDRIVERDC" )
@ -637,8 +640,7 @@ void DIALOG_SIM_MODEL<T>::loadLibrary( const wxString& aFilePath )
{
for( auto& [baseModelName, baseModel] : m_library->GetModels() )
{
wxString expectedModelName;
expectedModelName =
wxString expectedModelName =
SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY_KIBIS::NAME_FIELD );
// Only the current model is initialized from fields. Others have default
@ -662,6 +664,7 @@ void DIALOG_SIM_MODEL<T>::loadLibrary( const wxString& aFilePath )
}
wxArrayString modelNames;
for( auto& [modelName, model] : m_library->GetModels() )
modelNames.Add( modelName );
@ -748,6 +751,7 @@ void DIALOG_SIM_MODEL<T>::addParamPropertyIfRelevant( int aParamIndex )
}
}
template <typename T>
wxPGProperty* DIALOG_SIM_MODEL<T>::newParamProperty( int aParamIndex ) const
{
@ -787,12 +791,14 @@ wxPGProperty* DIALOG_SIM_MODEL<T>::newParamProperty( int aParamIndex ) const
if( param.info.enumValues.empty() )
{
prop = new SIM_STRING_PROPERTY( paramDescription, param.info.name, m_library,
curModelSharedPtr(), aParamIndex, SIM_VALUE::TYPE_STRING );
curModelSharedPtr(), aParamIndex,
SIM_VALUE::TYPE_STRING );
}
else
{
prop = new SIM_ENUM_PROPERTY( paramDescription, param.info.name, m_library,
curModelSharedPtr(), aParamIndex, SIM_VALUE::TYPE_STRING );
curModelSharedPtr(), aParamIndex,
SIM_VALUE::TYPE_STRING );
}
break;
@ -864,9 +870,13 @@ std::shared_ptr<SIM_MODEL> DIALOG_SIM_MODEL<T>::curModelSharedPtr() const
{
if( m_useLibraryModelRadioButton->GetValue()
&& m_modelNameCombobox->GetSelection() != wxNOT_FOUND )
{
return m_libraryModels.at( m_modelNameCombobox->GetSelection() );
}
else
{
return m_models.at( static_cast<int>( m_curModelType ) );
}
}
@ -947,6 +957,25 @@ wxArrayString DIALOG_SIM_MODEL<T>::getModelPinChoices() const
template <typename T>
void DIALOG_SIM_MODEL<T>::onRadioButton( wxCommandEvent& aEvent )
{
bool fromLibrary = m_useLibraryModelRadioButton->GetValue();
m_pathLabel->Enable( fromLibrary );
m_tclibraryPathName->Enable( fromLibrary );
m_browseButton->Enable( fromLibrary );
m_modelNameLabel->Enable( fromLibrary );
m_modelNameCombobox->Enable( fromLibrary );
m_overrideCheckbox->Enable( fromLibrary );
m_ibisPinLabel->Enable( fromLibrary );
m_ibisPinCombobox->Enable( fromLibrary );
m_differentialCheckbox->Enable( fromLibrary );
m_ibisModelLabel->Enable( fromLibrary );
m_ibisModelCombobox->Enable( fromLibrary );
m_staticTextDevType->Enable( !fromLibrary );
m_deviceTypeChoice->Enable( !fromLibrary );
m_staticTextSpiceType->Enable( !fromLibrary );
m_typeChoice->Enable( !fromLibrary );
updateWidgets();
}
@ -985,15 +1014,14 @@ void DIALOG_SIM_MODEL<T>::onModelNameCombobox( wxCommandEvent& aEvent )
}
for( std::pair<wxString, wxString> strs : modelkibis->GetIbisPins() )
{
pinLabels.Add( strs.first + " - " + strs.second );
}
pinLabels.Add( strs.first + wxT( " - " ) + strs.second );
m_ibisPinCombobox->Set( pinLabels );
wxArrayString emptyArray;
m_ibisModelCombobox->Set( emptyArray );
}
updateWidgets();
}
@ -1045,6 +1073,7 @@ void DIALOG_SIM_MODEL<T>::onIbisPinCombobox( wxCommandEvent& aEvent )
m_ibisModelCombobox->Set( modelLabels );
}
updateWidgets();
}
@ -1211,48 +1240,6 @@ void DIALOG_SIM_MODEL<T>::onInferCheckbox( wxCommandEvent& aEvent )
}
template <typename T>
void DIALOG_SIM_MODEL<T>::onLibraryPathUpdate( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( m_useLibraryModelRadioButton->GetValue() );
}
template <typename T>
void DIALOG_SIM_MODEL<T>::onBrowseButtonUpdate( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( m_useLibraryModelRadioButton->GetValue() );
}
template <typename T>
void DIALOG_SIM_MODEL<T>::onModelNameComboboxUpdate( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( m_useLibraryModelRadioButton->GetValue() );
}
template <typename T>
void DIALOG_SIM_MODEL<T>::onOverrideCheckboxUpdate( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( m_useLibraryModelRadioButton->GetValue() );
}
template <typename T>
void DIALOG_SIM_MODEL<T>::onDeviceTypeChoiceUpdate( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( m_useInstanceModelRadioButton->GetValue() );
}
template <typename T>
void DIALOG_SIM_MODEL<T>::onTypeChoiceUpdate( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( m_useInstanceModelRadioButton->GetValue() || ( isIbisLoaded() ) );
}
template <typename T>
void DIALOG_SIM_MODEL<T>::onParamGridSetFocus( wxFocusEvent& aEvent )
{
@ -1260,6 +1247,7 @@ void DIALOG_SIM_MODEL<T>::onParamGridSetFocus( wxFocusEvent& aEvent )
// Tab key is pressed. This is inconvenient, so we fix that here.
wxPropertyGrid* grid = m_paramGrid->GetGrid();
if( !grid )
{
wxFAIL;
@ -1282,6 +1270,7 @@ template <typename T>
void DIALOG_SIM_MODEL<T>::onParamGridSelectionChange( wxPropertyGridEvent& aEvent )
{
wxPropertyGrid* grid = m_paramGrid->GetGrid();
if( !grid )
{
wxFAIL;

View File

@ -116,13 +116,6 @@ private:
void onPinAssignmentsGridSize( wxSizeEvent& aEvent ) override;
void onExcludeCheckbox( wxCommandEvent& aEvent ) override;
void onInferCheckbox( wxCommandEvent& aEvent ) override;
void onLibraryPathUpdate( wxUpdateUIEvent& aEvent ) override;
void onBrowseButtonUpdate( wxUpdateUIEvent& aEvent ) override;
void onModelNameComboboxUpdate( wxUpdateUIEvent& aEvent ) override;
void onOverrideCheckboxUpdate( wxUpdateUIEvent& aEvent ) override;
void onDeviceTypeChoiceUpdate( wxUpdateUIEvent& aEvent ) override;
void onTypeChoiceUpdate( wxUpdateUIEvent& aEvent ) override;
void onDifferentialCheckbox( wxCommandEvent& event ) override;
void onParamGridSetFocus( wxFocusEvent& aEvent );
@ -143,7 +136,6 @@ private:
MODEL_NAME_VALIDATOR m_modelNameValidator;
wxPGProperty* m_firstCategory; // Used to add principal parameters to root.
std::unique_ptr<SCINTILLA_TRICKS> m_scintillaTricks;
wxPGProperty* m_prevParamGridSelection;
bool m_wasCodePreviewUpdated;

View File

@ -20,107 +20,101 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_modelPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerPanel;
bSizerPanel = new wxBoxSizer( wxVERTICAL );
m_sourceStaticSizer = new wxStaticBoxSizer( new wxStaticBox( m_modelPanel, wxID_ANY, _("Source") ), wxVERTICAL );
wxBoxSizer* bSizerMargins;
bSizerMargins = new wxBoxSizer( wxVERTICAL );
m_sourceSizer = new wxFlexGridSizer( 0, 4, 0, 0 );
m_sourceSizer->AddGrowableCol( 2 );
m_useLibraryModelRadioButton = new wxRadioButton( m_modelPanel, wxID_ANY, _("From library:"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
bSizerMargins->Add( m_useLibraryModelRadioButton, 0, wxLEFT, 5 );
m_sourceSizer = new wxFlexGridSizer( 0, 3, 2, 0 );
m_sourceSizer->AddGrowableCol( 1 );
m_sourceSizer->AddGrowableRow( 0 );
m_sourceSizer->SetFlexibleDirection( wxBOTH );
m_sourceSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_useInstanceModelRadioButton = new wxRadioButton( m_sourceStaticSizer->GetStaticBox(), wxID_ANY, _("Instance"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_sourceSizer->Add( m_useInstanceModelRadioButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_pathLabel = new wxStaticText( m_modelPanel, wxID_ANY, _("Library path:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pathLabel->Wrap( -1 );
m_sourceSizer->Add( m_pathLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_useLibraryModelRadioButton = new wxRadioButton( m_sourceStaticSizer->GetStaticBox(), wxID_ANY, _("Library:"), wxDefaultPosition, wxDefaultSize, 0 );
m_sourceSizer->Add( m_useLibraryModelRadioButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_tclibraryPathName = new wxTextCtrl( m_modelPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
m_sourceSizer->Add( m_tclibraryPathName, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_tclibraryPathName = new wxTextCtrl( m_sourceStaticSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
m_sourceSizer->Add( m_tclibraryPathName, 0, wxEXPAND|wxALL, 5 );
m_browseButton = new wxBitmapButton( m_sourceStaticSizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_browseButton = new wxBitmapButton( m_modelPanel, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_sourceSizer->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_sourceSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_modelNameLabel = new wxStaticText( m_sourceStaticSizer->GetStaticBox(), wxID_ANY, _("Model:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
m_modelNameLabel = new wxStaticText( m_modelPanel, wxID_ANY, _("Model:"), wxDefaultPosition, wxDefaultSize, 0 );
m_modelNameLabel->Wrap( -1 );
m_sourceSizer->Add( m_modelNameLabel, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_sourceSizer->Add( m_modelNameLabel, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT, 5 );
m_modelNameCombobox = new wxComboBox( m_sourceStaticSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER );
m_sourceSizer->Add( m_modelNameCombobox, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
m_modelNameCombobox = new wxComboBox( m_modelPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER );
m_sourceSizer->Add( m_modelNameCombobox, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_overrideCheckbox = new wxCheckBox( m_sourceStaticSizer->GetStaticBox(), wxID_ANY, _("Override"), wxDefaultPosition, wxDefaultSize, 0 );
m_sourceSizer->Add( m_overrideCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_overrideCheckbox = new wxCheckBox( m_modelPanel, wxID_ANY, _("Override"), wxDefaultPosition, wxDefaultSize, 0 );
m_sourceSizer->Add( m_overrideCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 7 );
m_sourceSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_ibisPinLabel = new wxStaticText( m_sourceStaticSizer->GetStaticBox(), wxID_ANY, _("Pin:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
m_ibisPinLabel = new wxStaticText( m_modelPanel, wxID_ANY, _("Pin:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ibisPinLabel->Wrap( -1 );
m_sourceSizer->Add( m_ibisPinLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 );
m_sourceSizer->Add( m_ibisPinLabel, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT, 5 );
m_ibisPinCombobox = new wxComboBox( m_sourceStaticSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER );
m_sourceSizer->Add( m_ibisPinCombobox, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
m_ibisPinCombobox = new wxComboBox( m_modelPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER );
m_sourceSizer->Add( m_ibisPinCombobox, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_differentialCheckbox = new wxCheckBox( m_sourceStaticSizer->GetStaticBox(), wxID_ANY, _("Differential"), wxDefaultPosition, wxDefaultSize, 0 );
m_sourceSizer->Add( m_differentialCheckbox, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_differentialCheckbox = new wxCheckBox( m_modelPanel, wxID_ANY, _("Differential"), wxDefaultPosition, wxDefaultSize, 0 );
m_sourceSizer->Add( m_differentialCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 7 );
m_sourceSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_ibisModelLabel = new wxStaticText( m_sourceStaticSizer->GetStaticBox(), wxID_ANY, _("Model:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
m_ibisModelLabel = new wxStaticText( m_modelPanel, wxID_ANY, _("Model:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ibisModelLabel->Wrap( -1 );
m_sourceSizer->Add( m_ibisModelLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 );
m_sourceSizer->Add( m_ibisModelLabel, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT, 5 );
m_ibisModelCombobox = new wxComboBox( m_sourceStaticSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER );
m_sourceSizer->Add( m_ibisModelCombobox, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
m_ibisModelCombobox = new wxComboBox( m_modelPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER );
m_sourceSizer->Add( m_ibisModelCombobox, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_sourceStaticSizer->Add( m_sourceSizer, 0, wxEXPAND, 5 );
bSizerMargins->Add( m_sourceSizer, 0, wxEXPAND|wxBOTTOM|wxLEFT, 24 );
m_useInstanceModelRadioButton = new wxRadioButton( m_modelPanel, wxID_ANY, _("From symbol instance:"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerMargins->Add( m_useInstanceModelRadioButton, 0, wxBOTTOM|wxLEFT, 5 );
wxFlexGridSizer* fgSizer16;
fgSizer16 = new wxFlexGridSizer( 0, 2, 8, 0 );
fgSizer16->AddGrowableCol( 1 );
fgSizer16->SetFlexibleDirection( wxBOTH );
fgSizer16->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextDevType = new wxStaticText( m_modelPanel, wxID_ANY, _("Device:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDevType->Wrap( -1 );
fgSizer16->Add( m_staticTextDevType, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
wxArrayString m_deviceTypeChoiceChoices;
m_deviceTypeChoice = new wxChoice( m_modelPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_deviceTypeChoiceChoices, 0 );
m_deviceTypeChoice->SetSelection( 0 );
fgSizer16->Add( m_deviceTypeChoice, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 10 );
m_staticTextSpiceType = new wxStaticText( m_modelPanel, wxID_ANY, _("Type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSpiceType->Wrap( -1 );
fgSizer16->Add( m_staticTextSpiceType, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
wxArrayString m_typeChoiceChoices;
m_typeChoice = new wxChoice( m_modelPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_typeChoiceChoices, 0 );
m_typeChoice->SetSelection( 0 );
fgSizer16->Add( m_typeChoice, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 10 );
bSizer9->Add( m_sourceStaticSizer, 0, wxEXPAND|wxALL, 5 );
bSizerMargins->Add( fgSizer16, 0, wxEXPAND|wxLEFT, 24 );
wxStaticBoxSizer* sbSizer5;
sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( m_modelPanel, wxID_ANY, _("Model") ), wxVERTICAL );
m_notebook4 = new wxNotebook( sbSizer5->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizerMargins->Add( 0, 10, 0, 0, 5 );
m_notebook4 = new wxNotebook( m_modelPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_parametersPanel = new wxPanel( m_notebook4, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_parametersPanel->SetMinSize( wxSize( 500,-1 ) );
wxBoxSizer* bSizer12;
bSizer12 = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer16;
fgSizer16 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer16->AddGrowableCol( 1 );
fgSizer16->SetFlexibleDirection( wxBOTH );
fgSizer16->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextDevType = new wxStaticText( m_parametersPanel, wxID_ANY, _("Device:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDevType->Wrap( -1 );
fgSizer16->Add( m_staticTextDevType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxArrayString m_deviceTypeChoiceChoices;
m_deviceTypeChoice = new wxChoice( m_parametersPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_deviceTypeChoiceChoices, 0 );
m_deviceTypeChoice->SetSelection( 0 );
fgSizer16->Add( m_deviceTypeChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
m_staticTextSpiceType = new wxStaticText( m_parametersPanel, wxID_ANY, _("Type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSpiceType->Wrap( -1 );
fgSizer16->Add( m_staticTextSpiceType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxArrayString m_typeChoiceChoices;
m_typeChoice = new wxChoice( m_parametersPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_typeChoiceChoices, 0 );
m_typeChoice->SetSelection( 0 );
fgSizer16->Add( m_typeChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
bSizer12->Add( fgSizer16, 0, wxEXPAND, 5 );
m_paramGridMgr = new wxPropertyGridManager(m_parametersPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxPGMAN_DEFAULT_STYLE|wxPG_SPLITTER_AUTO_CENTER);
m_paramGridMgr->SetExtraStyle( wxPG_EX_MODE_BUTTONS|wxPG_EX_NATIVE_DOUBLE_BUFFERING );
@ -180,15 +174,18 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c
bSizer5->Fit( m_codePanel );
m_notebook4->AddPage( m_codePanel, _("Code"), false );
sbSizer5->Add( m_notebook4, 1, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
bSizerMargins->Add( m_notebook4, 1, wxEXPAND|wxTOP, 10 );
bSizer9->Add( sbSizer5, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bSizerMargins->Add( 0, 5, 0, wxEXPAND, 5 );
m_modelPanel->SetSizer( bSizer9 );
bSizerPanel->Add( bSizerMargins, 1, wxEXPAND, 5 );
m_modelPanel->SetSizer( bSizerPanel );
m_modelPanel->Layout();
bSizer9->Fit( m_modelPanel );
bSizerPanel->Fit( m_modelPanel );
m_notebook->AddPage( m_modelPanel, _("Model"), true );
m_pinAssignmentsPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer10;
@ -210,6 +207,7 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c
m_pinAssignmentsGrid->EnableDragColSize( true );
m_pinAssignmentsGrid->SetColLabelValue( 0, _("Symbol Pin") );
m_pinAssignmentsGrid->SetColLabelValue( 1, _("Model Pin") );
m_pinAssignmentsGrid->SetColLabelSize( 22 );
m_pinAssignmentsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
@ -235,13 +233,13 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c
gSizer1 = new wxGridSizer( 0, 2, 0, 0 );
m_excludeCheckbox = new wxCheckBox( this, wxID_ANY, _("Exclude from simulation"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer1->Add( m_excludeCheckbox, 0, wxALL, 5 );
gSizer1->Add( m_excludeCheckbox, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_inferCheckbox = new wxCheckBox( this, wxID_ANY, _("Store in Reference and Value"), wxDefaultPosition, wxDefaultSize, 0 );
gSizer1->Add( m_inferCheckbox, 0, wxALIGN_RIGHT|wxALL, 5 );
gSizer1->Add( m_inferCheckbox, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizer8->Add( gSizer1, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
bSizer8->Add( gSizer1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizer8->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
@ -263,31 +261,35 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c
this->Centre( wxBOTH );
// Connect Events
m_useInstanceModelRadioButton->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onRadioButton ), NULL, this );
m_useLibraryModelRadioButton->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onRadioButton ), NULL, this );
m_pathLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onLibraryPathLabelUpdate ), NULL, this );
m_tclibraryPathName->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onLibraryPathUpdate ), NULL, this );
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onBrowseButtonClick ), NULL, this );
m_browseButton->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onBrowseButtonUpdate ), NULL, this );
m_modelNameLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameLabelUpdate ), NULL, this );
m_modelNameCombobox->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameCombobox ), NULL, this );
m_modelNameCombobox->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxKillFocus ), NULL, this );
m_modelNameCombobox->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxTextEnter ), NULL, this );
m_modelNameCombobox->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxUpdate ), NULL, this );
m_overrideCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onOverrideCheckbox ), NULL, this );
m_overrideCheckbox->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onOverrideCheckboxUpdate ), NULL, this );
m_ibisPinLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onIbisPinLabelUpdate ), NULL, this );
m_ibisPinCombobox->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onIbisPinCombobox ), NULL, this );
m_ibisPinCombobox->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxKillFocus ), NULL, this );
m_ibisPinCombobox->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onIbisPinComboboxTextEnter ), NULL, this );
m_ibisPinCombobox->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxUpdate ), NULL, this );
m_differentialCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onDifferentialCheckbox ), NULL, this );
m_differentialCheckbox->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onOverrideCheckboxUpdate ), NULL, this );
m_ibisModelLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onIbisModelLabelUpdate ), NULL, this );
m_ibisModelCombobox->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onIbisModelCombobox ), NULL, this );
m_ibisModelCombobox->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxKillFocus ), NULL, this );
m_ibisModelCombobox->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onIbisModelComboboxTextEnter ), NULL, this );
m_ibisModelCombobox->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxUpdate ), NULL, this );
m_useInstanceModelRadioButton->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onRadioButton ), NULL, this );
m_staticTextDevType->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onDeviceTypeLabelUpdate ), NULL, this );
m_deviceTypeChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onDeviceTypeChoice ), NULL, this );
m_deviceTypeChoice->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onDeviceTypeChoiceUpdate ), NULL, this );
m_staticTextSpiceType->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onTypeLabelUpdate ), NULL, this );
m_typeChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onTypeChoice ), NULL, this );
m_typeChoice->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onTypeChoiceUpdate ), NULL, this );
m_paramGridMgr->Connect( wxEVT_PG_CHANGED, wxPropertyGridEventHandler( DIALOG_SIM_MODEL_BASE::onParamGridChanged ), NULL, this );
m_codePreview->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_SIM_MODEL_BASE::onCodePreviewSetFocus ), NULL, this );
m_pinAssignmentsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridCellChange ), NULL, this );
@ -299,31 +301,35 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c
DIALOG_SIM_MODEL_BASE::~DIALOG_SIM_MODEL_BASE()
{
// Disconnect Events
m_useInstanceModelRadioButton->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onRadioButton ), NULL, this );
m_useLibraryModelRadioButton->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onRadioButton ), NULL, this );
m_pathLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onLibraryPathLabelUpdate ), NULL, this );
m_tclibraryPathName->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onLibraryPathUpdate ), NULL, this );
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onBrowseButtonClick ), NULL, this );
m_browseButton->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onBrowseButtonUpdate ), NULL, this );
m_modelNameLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameLabelUpdate ), NULL, this );
m_modelNameCombobox->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameCombobox ), NULL, this );
m_modelNameCombobox->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxKillFocus ), NULL, this );
m_modelNameCombobox->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxTextEnter ), NULL, this );
m_modelNameCombobox->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxUpdate ), NULL, this );
m_overrideCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onOverrideCheckbox ), NULL, this );
m_overrideCheckbox->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onOverrideCheckboxUpdate ), NULL, this );
m_ibisPinLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onIbisPinLabelUpdate ), NULL, this );
m_ibisPinCombobox->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onIbisPinCombobox ), NULL, this );
m_ibisPinCombobox->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxKillFocus ), NULL, this );
m_ibisPinCombobox->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onIbisPinComboboxTextEnter ), NULL, this );
m_ibisPinCombobox->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxUpdate ), NULL, this );
m_differentialCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onDifferentialCheckbox ), NULL, this );
m_differentialCheckbox->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onOverrideCheckboxUpdate ), NULL, this );
m_ibisModelLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onIbisModelLabelUpdate ), NULL, this );
m_ibisModelCombobox->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onIbisModelCombobox ), NULL, this );
m_ibisModelCombobox->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxKillFocus ), NULL, this );
m_ibisModelCombobox->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onIbisModelComboboxTextEnter ), NULL, this );
m_ibisModelCombobox->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameComboboxUpdate ), NULL, this );
m_useInstanceModelRadioButton->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onRadioButton ), NULL, this );
m_staticTextDevType->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onDeviceTypeLabelUpdate ), NULL, this );
m_deviceTypeChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onDeviceTypeChoice ), NULL, this );
m_deviceTypeChoice->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onDeviceTypeChoiceUpdate ), NULL, this );
m_staticTextSpiceType->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onTypeLabelUpdate ), NULL, this );
m_typeChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onTypeChoice ), NULL, this );
m_typeChoice->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onTypeChoiceUpdate ), NULL, this );
m_paramGridMgr->Disconnect( wxEVT_PG_CHANGED, wxPropertyGridEventHandler( DIALOG_SIM_MODEL_BASE::onParamGridChanged ), NULL, this );
m_codePreview->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_SIM_MODEL_BASE::onCodePreviewSetFocus ), NULL, this );
m_pinAssignmentsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridCellChange ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -19,17 +19,16 @@ class WX_GRID;
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/combobox.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/choice.h>
#include <wx/propgrid/propgrid.h>
#include <wx/propgrid/manager.h>
@ -54,10 +53,9 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM
protected:
wxNotebook* m_notebook;
wxPanel* m_modelPanel;
wxStaticBoxSizer* m_sourceStaticSizer;
wxFlexGridSizer* m_sourceSizer;
wxRadioButton* m_useInstanceModelRadioButton;
wxRadioButton* m_useLibraryModelRadioButton;
wxFlexGridSizer* m_sourceSizer;
wxStaticText* m_pathLabel;
wxTextCtrl* m_tclibraryPathName;
wxBitmapButton* m_browseButton;
wxStaticText* m_modelNameLabel;
@ -68,12 +66,13 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM
wxCheckBox* m_differentialCheckbox;
wxStaticText* m_ibisModelLabel;
wxComboBox* m_ibisModelCombobox;
wxNotebook* m_notebook4;
wxPanel* m_parametersPanel;
wxRadioButton* m_useInstanceModelRadioButton;
wxStaticText* m_staticTextDevType;
wxChoice* m_deviceTypeChoice;
wxStaticText* m_staticTextSpiceType;
wxChoice* m_typeChoice;
wxNotebook* m_notebook4;
wxPanel* m_parametersPanel;
wxPropertyGridManager* m_paramGridMgr;
wxPropertyGridPage* m_paramGrid;
wxPanel* m_codePanel;
@ -89,24 +88,29 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM
// Virtual event handlers, override them in your derived class
virtual void onRadioButton( wxCommandEvent& event ) { event.Skip(); }
virtual void onLibraryPathLabelUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onLibraryPathUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onBrowseButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void onBrowseButtonUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onModelNameLabelUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onModelNameCombobox( wxCommandEvent& event ) { event.Skip(); }
virtual void onModelNameComboboxKillFocus( wxFocusEvent& event ) { event.Skip(); }
virtual void onModelNameComboboxTextEnter( wxCommandEvent& event ) { event.Skip(); }
virtual void onModelNameComboboxUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onOverrideCheckbox( wxCommandEvent& event ) { event.Skip(); }
virtual void onOverrideCheckboxUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onIbisPinLabelUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onIbisPinCombobox( wxCommandEvent& event ) { event.Skip(); }
virtual void onIbisPinComboboxTextEnter( wxCommandEvent& event ) { event.Skip(); }
virtual void onDifferentialCheckbox( wxCommandEvent& event ) { event.Skip(); }
virtual void onOverrideCheckboxUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onIbisModelLabelUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onIbisModelCombobox( wxCommandEvent& event ) { event.Skip(); }
virtual void onIbisModelComboboxTextEnter( wxCommandEvent& event ) { event.Skip(); }
virtual void onDeviceTypeLabelUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onDeviceTypeChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void onDeviceTypeChoiceUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onTypeLabelUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onTypeChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void onTypeChoiceUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onParamGridChanged( wxPropertyGridEvent& event ) { event.Skip(); }
virtual void onCodePreviewSetFocus( wxFocusEvent& event ) { event.Skip(); }
virtual void onPinAssignmentsGridCellChange( wxGridEvent& event ) { event.Skip(); }

View File

@ -551,6 +551,9 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow()
void DIALOG_SYMBOL_PROPERTIES::OnEditSpiceModel( wxCommandEvent& event )
{
#ifdef KICAD_SPICE
if( !m_fieldsGrid->CommitPendingChanges() )
return;
int diff = m_fields->size();
DIALOG_SIM_MODEL dialog( this, *m_symbol, *m_fields );

View File

@ -419,6 +419,7 @@ TYPE SIM_MODEL::ReadTypeFromFields( const std::vector<T>& aFields, int aSymbolPi
// No type information. Look for legacy (pre-V7) fields.
TYPE typeFromLegacyFields = InferTypeFromLegacyFields( aFields );
if( typeFromLegacyFields != TYPE::NONE )
return typeFromLegacyFields;
@ -500,7 +501,9 @@ TYPE SIM_MODEL::InferTypeFromLegacyFields( const std::vector<T>& aFields )
return TYPE::RAWSPICE;
}
else
{
return TYPE::NONE;
}
}
@ -617,7 +620,7 @@ std::unique_ptr<SIM_MODEL> SIM_MODEL::Create( unsigned aSymbolPinCount,
TYPE type = ReadTypeFromFields( aFields, aSymbolPinCount );
if( type == TYPE::NONE )
THROW_IO_ERROR( wxString::Format( _( "Failed to read simulation model from fields" ) ) );
THROW_IO_ERROR( wxString::Format( _( "Failed to read simulation model from fields." ) ) );
std::unique_ptr<SIM_MODEL> model = SIM_MODEL::Create( type );