diff --git a/eeschema/dialogs/dialog_sim_model.cpp b/eeschema/dialogs/dialog_sim_model.cpp index bce0485452..7d9ae427a4 100644 --- a/eeschema/dialogs/dialog_sim_model.cpp +++ b/eeschema/dialogs/dialog_sim_model.cpp @@ -137,7 +137,14 @@ template bool DIALOG_SIM_MODEL::TransferDataToWindow() { wxCommandEvent dummyEvent; - wxString libraryFilename = SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY::LIBRARY_FIELD ); + + std::string ref = SIM_MODEL::GetFieldValue( &m_fields, SIM_MODEL::REFERENCE_FIELD ); + std::string libraryFilename = SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY::LIBRARY_FIELD ); + + SIM_MODEL::DEVICE_TYPE_ inferredDeviceType = SIM_MODEL::InferDeviceTypeFromRef( ref ); + + if( inferredDeviceType == SIM_MODEL::DEVICE_TYPE_::NONE ) + m_inferInstanceModelRadioButton->Enable( false ); if( libraryFilename != "" ) { @@ -196,6 +203,22 @@ bool DIALOG_SIM_MODEL::TransferDataToWindow() } } } + else if( m_inferInstanceModelRadioButton->IsEnabled() + && SIM_MODEL::GetFieldValue( &m_fields, SIM_MODEL::DEVICE_TYPE_FIELD ).empty() ) + { + m_inferInstanceModelRadioButton->SetValue( true ); + + m_inferredDevice->SetValue( SIM_MODEL::DeviceTypeInfo( inferredDeviceType ).description ); + + for( SIM_MODEL::TYPE type : SIM_MODEL::TYPE_ITERATOR() ) + { + if( SIM_MODEL::TypeInfo( type ).deviceType == inferredDeviceType ) + { + m_inferredType->SetValue( SIM_MODEL::TypeInfo( type ).description ); + break; + } + } + } else { // The model is sourced from the instance. @@ -223,11 +246,6 @@ bool DIALOG_SIM_MODEL::TransferDataToWindow() m_overrideCheckbox->SetValue( curModel().HasNonInstanceOverrides() ); m_excludeCheckbox->SetValue( !curModel().IsEnabled() ); - 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 ); onRadioButton( dummyEvent ); return DIALOG_SIM_MODEL_BASE::TransferDataToWindow(); @@ -280,6 +298,7 @@ bool DIALOG_SIM_MODEL::TransferDataFromWindow() } } + curModel().SetIsInferred( m_inferInstanceModelRadioButton->GetValue() ); curModel().WriteFields( m_fields ); return true; @@ -298,10 +317,6 @@ void DIALOG_SIM_MODEL::updateWidgets() m_excludeCheckbox->SetValue( !curModel().IsEnabled() ); - std::string ref = SIM_MODEL::GetFieldValue( &m_fields, SIM_MODEL::REFERENCE_FIELD ); - m_inferCheckbox->Enable( SIM_MODEL::InferDeviceTypeFromRef( ref ) == curModel().GetDeviceType() ); - m_inferCheckbox->SetValue( curModel().IsInferred() ); - m_modelPanel->Layout(); m_pinAssignmentsPanel->Layout(); m_parametersPanel->Layout(); @@ -316,12 +331,12 @@ void DIALOG_SIM_MODEL::updateWidgets() template void DIALOG_SIM_MODEL::updateIbisWidgets() { - SIM_MODEL_KIBIS* modelkibis = nullptr; + SIM_MODEL_KIBIS* modelkibis = isIbisLoaded() ? dynamic_cast( &curModel() ) + : nullptr; + /* if( isIbisLoaded() ) { - modelkibis = dynamic_cast( &curModel() ); - for ( wxSizerItem* item : m_sourceSizer->GetChildren() ) { if ( item->GetWindow() == m_differentialCheckbox ) @@ -342,6 +357,7 @@ void DIALOG_SIM_MODEL::updateIbisWidgets() item->SetFlag( item->GetFlag() & ~wxRESERVE_SPACE_EVEN_IF_HIDDEN ); } } + */ m_ibisModelCombobox->Show( isIbisLoaded() ); m_ibisPinCombobox->Show( isIbisLoaded() ); @@ -960,6 +976,8 @@ template void DIALOG_SIM_MODEL::onRadioButton( wxCommandEvent& aEvent ) { bool fromLibrary = m_useLibraryModelRadioButton->GetValue(); + bool inferred = m_inferInstanceModelRadioButton->GetValue(); + bool fromInstance = m_useInstanceModelRadioButton->GetValue(); m_pathLabel->Enable( fromLibrary ); m_tclibraryPathName->Enable( fromLibrary ); @@ -973,10 +991,15 @@ void DIALOG_SIM_MODEL::onRadioButton( wxCommandEvent& aEvent ) m_ibisModelLabel->Enable( fromLibrary ); m_ibisModelCombobox->Enable( fromLibrary ); - m_staticTextDevType->Enable( !fromLibrary ); - m_deviceTypeChoice->Enable( !fromLibrary ); - m_staticTextSpiceType->Enable( !fromLibrary ); - m_typeChoice->Enable( !fromLibrary ); + m_staticTextDevType->Enable( fromInstance ); + m_deviceTypeChoice->Enable( fromInstance ); + m_staticTextSpiceType->Enable( fromInstance ); + m_typeChoice->Enable( fromInstance ); + + m_inferredDeviceLabel->Enable( inferred ); + m_inferredDevice->Enable( inferred ); + m_inferredTypeLabel->Enable( inferred ); + m_inferredType->Enable( inferred ); updateWidgets(); } @@ -1237,13 +1260,6 @@ void DIALOG_SIM_MODEL::onExcludeCheckbox( wxCommandEvent& aEvent ) } -template -void DIALOG_SIM_MODEL::onInferCheckbox( wxCommandEvent& aEvent ) -{ - curModel().SetIsInferred( m_inferCheckbox->GetValue() ); -} - - template void DIALOG_SIM_MODEL::onParamGridSetFocus( wxFocusEvent& aEvent ) { diff --git a/eeschema/dialogs/dialog_sim_model.h b/eeschema/dialogs/dialog_sim_model.h index c851edf599..f0f19739c1 100644 --- a/eeschema/dialogs/dialog_sim_model.h +++ b/eeschema/dialogs/dialog_sim_model.h @@ -129,7 +129,6 @@ private: void onPinAssignmentsGridCellChange( wxGridEvent& aEvent ) override; void onPinAssignmentsGridSize( wxSizeEvent& aEvent ) override; void onExcludeCheckbox( wxCommandEvent& aEvent ) override; - void onInferCheckbox( wxCommandEvent& aEvent ) override; void onDifferentialCheckbox( wxCommandEvent& event ) override; void onParamGridSetFocus( wxFocusEvent& aEvent ); diff --git a/eeschema/dialogs/dialog_sim_model_base.cpp b/eeschema/dialogs/dialog_sim_model_base.cpp index fdd1c2abc4..50b0ef4886 100644 --- a/eeschema/dialogs/dialog_sim_model_base.cpp +++ b/eeschema/dialogs/dialog_sim_model_base.cpp @@ -29,64 +29,74 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c 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 ); + wxGridBagSizer* gbSizer1; + gbSizer1 = new wxGridBagSizer( 1, 5 ); + gbSizer1->SetFlexibleDirection( wxBOTH ); + gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); 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 ); + gbSizer1->Add( m_pathLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); + + wxBoxSizer* bSizer7; + bSizer7 = new wxBoxSizer( wxHORIZONTAL ); 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 ); + bSizer7->Add( m_tclibraryPathName, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); 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 ); + bSizer7->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + + gbSizer1->Add( bSizer7, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 ); 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|wxLEFT, 5 ); + gbSizer1->Add( m_modelNameLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 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 ); + gbSizer1->Add( m_modelNameCombobox, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 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_overrideCheckbox = new wxCheckBox( m_modelPanel, wxID_ANY, _("Allow overrides"), wxDefaultPosition, wxDefaultSize, 0 ); + gbSizer1->Add( m_overrideCheckbox, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 40 ); 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|wxEXPAND|wxLEFT, 5 ); + gbSizer1->Add( m_ibisPinLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 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 ); + gbSizer1->Add( m_ibisPinCombobox, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), 0, 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 ); + gbSizer1->Add( m_differentialCheckbox, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 40 ); 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|wxEXPAND|wxLEFT, 5 ); + gbSizer1->Add( m_ibisModelLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 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 ); + gbSizer1->Add( m_ibisModelCombobox, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), 0, 5 ); - bSizerMargins->Add( m_sourceSizer, 0, wxEXPAND|wxBOTTOM|wxLEFT, 24 ); + gbSizer1->AddGrowableCol( 1 ); + + bSizerMargins->Add( gbSizer1, 0, wxLEFT|wxEXPAND, 28 ); + + + bSizerMargins->Add( 0, 18, 0, 0, 5 ); 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 = new wxFlexGridSizer( 0, 2, 6, 5 ); 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 ); + fgSizer16->Add( m_staticTextDevType, 0, wxALIGN_CENTER_VERTICAL, 5 ); wxArrayString m_deviceTypeChoiceChoices; m_deviceTypeChoice = new wxChoice( m_modelPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_deviceTypeChoiceChoices, 0 ); @@ -95,7 +105,7 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c 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 ); + fgSizer16->Add( m_staticTextSpiceType, 0, wxALIGN_CENTER_VERTICAL, 5 ); wxArrayString m_typeChoiceChoices; m_typeChoice = new wxChoice( m_modelPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_typeChoiceChoices, 0 ); @@ -103,10 +113,39 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c fgSizer16->Add( m_typeChoice, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 10 ); - bSizerMargins->Add( fgSizer16, 0, wxEXPAND|wxLEFT, 24 ); + bSizerMargins->Add( fgSizer16, 0, wxEXPAND|wxLEFT, 28 ); - bSizerMargins->Add( 0, 10, 0, 0, 5 ); + bSizerMargins->Add( 0, 22, 0, 0, 5 ); + + m_inferInstanceModelRadioButton = new wxRadioButton( m_modelPanel, wxID_ANY, _("Infer from symbol's reference designator and value:"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerMargins->Add( m_inferInstanceModelRadioButton, 0, wxBOTTOM|wxLEFT, 5 ); + + wxFlexGridSizer* fgSizer3; + fgSizer3 = new wxFlexGridSizer( 0, 2, 5, 5 ); + fgSizer3->AddGrowableCol( 1 ); + fgSizer3->SetFlexibleDirection( wxBOTH ); + fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_inferredDeviceLabel = new wxStaticText( m_modelPanel, wxID_ANY, _("Device:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_inferredDeviceLabel->Wrap( -1 ); + fgSizer3->Add( m_inferredDeviceLabel, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_inferredDevice = new wxTextCtrl( m_modelPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); + fgSizer3->Add( m_inferredDevice, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT, 10 ); + + m_inferredTypeLabel = new wxStaticText( m_modelPanel, wxID_ANY, _("Type:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_inferredTypeLabel->Wrap( -1 ); + fgSizer3->Add( m_inferredTypeLabel, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_inferredType = new wxTextCtrl( m_modelPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); + fgSizer3->Add( m_inferredType, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 10 ); + + + bSizerMargins->Add( fgSizer3, 0, wxEXPAND|wxLEFT, 28 ); + + + bSizerMargins->Add( 0, 5, 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 ); @@ -229,20 +268,14 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c bSizer8->Add( m_notebook, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - wxGridSizer* gSizer1; - gSizer1 = new wxGridSizer( 0, 2, 0, 0 ); + wxBoxSizer* bSizerBottom; + bSizerBottom = new wxBoxSizer( wxHORIZONTAL ); m_excludeCheckbox = new wxCheckBox( this, wxID_ANY, _("Exclude from simulation"), wxDefaultPosition, wxDefaultSize, 0 ); - 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|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerBottom->Add( m_excludeCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - 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 ); + bSizerBottom->Add( 30, 0, 1, wxEXPAND, 5 ); m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); @@ -251,7 +284,10 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->Realize(); - bSizer8->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 ); + bSizerBottom->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 ); + + + bSizer8->Add( bSizerBottom, 0, wxEXPAND|wxLEFT, 5 ); this->SetSizer( bSizer8 ); @@ -290,12 +326,12 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c 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_inferInstanceModelRadioButton->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onRadioButton ), 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 ); m_pinAssignmentsGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridSize ), NULL, this ); m_excludeCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onExcludeCheckbox ), NULL, this ); - m_inferCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onInferCheckbox ), NULL, this ); } DIALOG_SIM_MODEL_BASE::~DIALOG_SIM_MODEL_BASE() @@ -330,11 +366,11 @@ DIALOG_SIM_MODEL_BASE::~DIALOG_SIM_MODEL_BASE() 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_inferInstanceModelRadioButton->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onRadioButton ), 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 ); m_pinAssignmentsGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridSize ), NULL, this ); m_excludeCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onExcludeCheckbox ), NULL, this ); - m_inferCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onInferCheckbox ), NULL, this ); } diff --git a/eeschema/dialogs/dialog_sim_model_base.fbp b/eeschema/dialogs/dialog_sim_model_base.fbp index 6ccbb4dc2b..cdb39e2040 100644 --- a/eeschema/dialogs/dialog_sim_model_base.fbp +++ b/eeschema/dialogs/dialog_sim_model_base.fbp @@ -252,27 +252,29 @@ onRadioButton - - 24 - wxEXPAND|wxBOTTOM|wxLEFT + + 28 + wxLEFT|wxEXPAND 0 - - 3 + + wxBOTH 1 - 0 - 0 + + 5 - m_sourceSizer + gbSizer1 wxFLEX_GROWMODE_SPECIFIED - protected - 0 - 2 - + none + 1 + 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL - 0 - + 1 + 0 + wxALIGN_CENTER_VERTICAL + 0 + 1 + 1 1 1 @@ -330,150 +332,167 @@ onLibraryPathLabelUpdate - + 5 - wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 + 2 + 1 + wxEXPAND + 0 + 1 + - 1 - m_tclibraryPathName - 1 - - - protected - 1 - - Resizable - 1 - - wxTE_READONLY - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - onLibraryPathUpdate + bSizer7 + wxHORIZONTAL + none + + 3 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + -1,-1 + 1 + m_tclibraryPathName + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_READONLY + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + onLibraryPathUpdate + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + MyButton + + 0 + + 0 + + + 0 + + 1 + m_browseButton + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onBrowseButtonClick + onBrowseButtonUpdate + + - + 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - MyButton - - 0 - - 0 - - - 0 - - 1 - m_browseButton - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - onBrowseButtonClick - onBrowseButtonUpdate - - - - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT - 0 + 1 + 0 + wxALIGN_CENTER_VERTICAL + 1 + 1 1 1 @@ -532,10 +551,13 @@ onModelNameLabelUpdate - + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND - 0 + 1 + 1 + wxALIGN_CENTER_VERTICAL + 1 + 1 1 1 @@ -601,10 +623,13 @@ onModelNameComboboxUpdate - - 7 + + 40 + 1 + 2 wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 + 1 + 1 1 1 @@ -634,7 +659,7 @@ 0 0 wxID_ANY - Override + Allow overrides 0 @@ -666,10 +691,13 @@ onOverrideCheckbox - + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT - 0 + 1 + 0 + wxALIGN_CENTER_VERTICAL + 2 + 1 1 1 @@ -728,10 +756,13 @@ onIbisPinLabelUpdate - + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND - 0 + 1 + 1 + + 2 + 1 1 1 @@ -797,10 +828,13 @@ onModelNameComboboxUpdate - - 7 + + 40 + 1 + 2 wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 + 2 + 1 1 1 @@ -863,10 +897,13 @@ onOverrideCheckboxUpdate - + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT - 0 + 1 + 0 + wxALIGN_CENTER_VERTICAL + 3 + 1 1 1 @@ -925,10 +962,13 @@ onIbisModelLabelUpdate - + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND - 0 + 1 + 1 + + 3 + 1 1 1 @@ -996,6 +1036,16 @@ + + 5 + + 0 + + 18 + protected + 0 + + 5 wxBOTTOM|wxLEFT @@ -1062,7 +1112,7 @@ - 24 + 28 wxEXPAND|wxLEFT 0 @@ -1070,16 +1120,16 @@ wxBOTH 1 - 0 + 5 fgSizer16 wxFLEX_GROWMODE_SPECIFIED none 0 - 8 + 6 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL 0 1 @@ -1207,7 +1257,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL 0 1 @@ -1334,12 +1384,355 @@ - + 5 0 - - 10 + + 22 + protected + 0 + + + + 5 + wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Infer from symbol's reference designator and value: + + 0 + + + 0 + + 1 + m_inferInstanceModelRadioButton + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + onRadioButton + + + + 28 + wxEXPAND|wxLEFT + 0 + + 2 + wxBOTH + 1 + + 5 + + fgSizer3 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 5 + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Device: + 0 + + 0 + + + 0 + + 1 + m_inferredDeviceLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 10 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_inferredDevice + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_READONLY + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Type: + 0 + + 0 + + + 0 + + 1 + m_inferredTypeLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 10 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_inferredType + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_READONLY + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + 5 + + 0 + + 5 protected 0 @@ -1401,11 +1794,11 @@ - + Parameters 1 - + 1 1 1 @@ -1456,7 +1849,7 @@ wxTAB_TRAVERSAL - + bSizer12 wxVERTICAL @@ -1835,20 +2228,17 @@ - 10 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 5 + wxEXPAND|wxLEFT 0 - - 2 - 0 + - gSizer1 + bSizerBottom + wxHORIZONTAL none - 0 - 0 5 - wxBOTTOM|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 0 1 @@ -1913,145 +2303,32 @@ 5 - wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Store in Reference and Value - - 0 - - - 0 - - 1 - m_inferCheckbox - 1 - - + wxEXPAND + 1 + + 0 + protected + 30 + + + + 5 + wxEXPAND|wxALL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - onInferCheckbox - - - - 5 - wxEXPAND | wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline1 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - ; ; forward_declare - 0 - - - - - - - - 5 - wxEXPAND|wxALL - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizer1 - protected diff --git a/eeschema/dialogs/dialog_sim_model_base.h b/eeschema/dialogs/dialog_sim_model_base.h index 1374727d96..607c591396 100644 --- a/eeschema/dialogs/dialog_sim_model_base.h +++ b/eeschema/dialogs/dialog_sim_model_base.h @@ -26,9 +26,10 @@ class WX_GRID; #include #include #include +#include #include #include -#include +#include #include #include #include @@ -37,7 +38,6 @@ class WX_GRID; #include #include #include -#include #include /////////////////////////////////////////////////////////////////////////// @@ -54,7 +54,6 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM wxNotebook* m_notebook; wxPanel* m_modelPanel; wxRadioButton* m_useLibraryModelRadioButton; - wxFlexGridSizer* m_sourceSizer; wxStaticText* m_pathLabel; wxTextCtrl* m_tclibraryPathName; wxBitmapButton* m_browseButton; @@ -71,6 +70,11 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM wxChoice* m_deviceTypeChoice; wxStaticText* m_staticTextSpiceType; wxChoice* m_typeChoice; + wxRadioButton* m_inferInstanceModelRadioButton; + wxStaticText* m_inferredDeviceLabel; + wxTextCtrl* m_inferredDevice; + wxStaticText* m_inferredTypeLabel; + wxTextCtrl* m_inferredType; wxNotebook* m_notebook4; wxPanel* m_parametersPanel; wxPropertyGridManager* m_paramGridMgr; @@ -80,8 +84,6 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM wxPanel* m_pinAssignmentsPanel; WX_GRID* m_pinAssignmentsGrid; wxCheckBox* m_excludeCheckbox; - wxCheckBox* m_inferCheckbox; - wxStaticLine* m_staticline1; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel; @@ -116,7 +118,6 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM virtual void onPinAssignmentsGridCellChange( wxGridEvent& event ) { event.Skip(); } virtual void onPinAssignmentsGridSize( wxSizeEvent& event ) { event.Skip(); } virtual void onExcludeCheckbox( wxCommandEvent& event ) { event.Skip(); } - virtual void onInferCheckbox( wxCommandEvent& event ) { event.Skip(); } public: