diff --git a/eeschema/dialogs/dialog_sim_model.cpp b/eeschema/dialogs/dialog_sim_model.cpp index 48c205a923..300a51994f 100644 --- a/eeschema/dialogs/dialog_sim_model.cpp +++ b/eeschema/dialogs/dialog_sim_model.cpp @@ -319,32 +319,8 @@ void DIALOG_SIM_MODEL::updateWidgets() template void DIALOG_SIM_MODEL::updateIbisWidgets() { - SIM_MODEL_KIBIS* modelkibis = nullptr; - - if( isIbisLoaded() ) - { - modelkibis = dynamic_cast( &curModel() ); - - for ( wxSizerItem* item : m_sourceSizer->GetChildren() ) - { - if ( item->GetWindow() == m_differentialCheckbox ) - item->SetFlag( item->GetFlag() | wxRESERVE_SPACE_EVEN_IF_HIDDEN ); - - if ( item->GetWindow() == m_overrideCheckbox ) - item->SetFlag( item->GetFlag() & ~wxRESERVE_SPACE_EVEN_IF_HIDDEN ); - } - } - else - { - for ( wxSizerItem* item : m_sourceSizer->GetChildren() ) - { - if ( item->GetWindow() == m_differentialCheckbox ) - item->SetFlag( item->GetFlag() | wxRESERVE_SPACE_EVEN_IF_HIDDEN ); - - if ( item->GetWindow() == m_overrideCheckbox ) - item->SetFlag( item->GetFlag() & ~wxRESERVE_SPACE_EVEN_IF_HIDDEN ); - } - } + SIM_MODEL_KIBIS* modelkibis = isIbisLoaded() ? dynamic_cast( &curModel() ) + : nullptr; m_ibisModelCombobox->Show( isIbisLoaded() ); m_ibisPinCombobox->Show( isIbisLoaded() ); diff --git a/eeschema/dialogs/dialog_sim_model_base.cpp b/eeschema/dialogs/dialog_sim_model_base.cpp index fdd1c2abc4..8518eeddce 100644 --- a/eeschema/dialogs/dialog_sim_model_base.cpp +++ b/eeschema/dialogs/dialog_sim_model_base.cpp @@ -26,56 +26,66 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c wxBoxSizer* bSizerMargins; bSizerMargins = new wxBoxSizer( wxVERTICAL ); - m_useLibraryModelRadioButton = new wxRadioButton( m_modelPanel, wxID_ANY, _("From library:"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + m_useLibraryModelRadioButton = new wxRadioButton( m_modelPanel, wxID_ANY, _("SPICE model from file (*.lib or *.sub)"), 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( 3, 5 ); + gbSizer1->SetFlexibleDirection( wxBOTH ); + gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_pathLabel = new wxStaticText( m_modelPanel, wxID_ANY, _("Library path:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_pathLabel = new wxStaticText( m_modelPanel, wxID_ANY, _("File:"), 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 ); + gbSizer1->Add( m_overrideCheckbox, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 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 ); - m_useInstanceModelRadioButton = new wxRadioButton( m_modelPanel, wxID_ANY, _("From symbol instance:"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerMargins->Add( gbSizer1, 0, wxEXPAND|wxLEFT, 28 ); + + + bSizerMargins->Add( 0, 18, 0, wxEXPAND, 5 ); + + m_useInstanceModelRadioButton = new wxRadioButton( m_modelPanel, wxID_ANY, _("Built-in SPICE model"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerMargins->Add( m_useInstanceModelRadioButton, 0, wxBOTTOM|wxLEFT, 5 ); wxFlexGridSizer* fgSizer16; diff --git a/eeschema/dialogs/dialog_sim_model_base.fbp b/eeschema/dialogs/dialog_sim_model_base.fbp index 6ccbb4dc2b..1e8beaf426 100644 --- a/eeschema/dialogs/dialog_sim_model_base.fbp +++ b/eeschema/dialogs/dialog_sim_model_base.fbp @@ -187,11 +187,11 @@ bSizerMargins wxVERTICAL none - + 5 wxLEFT 0 - + 1 1 1 @@ -219,7 +219,7 @@ 0 0 wxID_ANY - From library: + SPICE model from file (*.lib or *.sub) 0 @@ -253,25 +253,27 @@ - 24 - wxEXPAND|wxBOTTOM|wxLEFT + 28 + wxEXPAND|wxLEFT 0 - - 3 + + wxBOTH 1 - 0 - 0 + + 5 - m_sourceSizer + gbSizer1 wxFLEX_GROWMODE_SPECIFIED - protected - 0 - 2 - + none + 3 + 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL - 0 + 1 + 0 + wxALIGN_CENTER_VERTICAL + 0 + 1 1 1 @@ -300,7 +302,7 @@ 0 0 wxID_ANY - Library path: + File: 0 0 @@ -330,151 +332,168 @@ 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 1 @@ -532,11 +551,14 @@ onModelNameLabelUpdate - + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND - 0 - + 1 + 1 + wxALIGN_CENTER_VERTICAL + 1 + 1 + 1 1 1 @@ -601,11 +623,14 @@ onModelNameComboboxUpdate - - 7 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 - + + 40 + 1 + 2 + wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + 1 + 1 + 1 1 1 @@ -666,11 +691,14 @@ onOverrideCheckbox - + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT - 0 - + 1 + 0 + wxALIGN_CENTER_VERTICAL + 2 + 1 + 1 1 1 @@ -728,11 +756,14 @@ onIbisPinLabelUpdate - + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND - 0 - + 1 + 1 + + 2 + 1 + 1 1 1 @@ -797,11 +828,14 @@ onModelNameComboboxUpdate - - 7 + + 40 + 1 + 2 wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 - + 2 + 1 + 1 1 1 @@ -863,11 +897,14 @@ onOverrideCheckboxUpdate - + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT - 0 - + 1 + 0 + wxALIGN_CENTER_VERTICAL + 3 + 1 + 1 1 1 @@ -925,11 +962,14 @@ onIbisModelLabelUpdate - + 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND - 0 - + 1 + 1 + + 3 + 1 + 1 1 1 @@ -996,11 +1036,21 @@ - + + 5 + wxEXPAND + 0 + + 18 + protected + 0 + + + 5 wxBOTTOM|wxLEFT 0 - + 1 1 1 @@ -1028,7 +1078,7 @@ 0 0 wxID_ANY - From symbol instance: + Built-in SPICE model 0 @@ -1061,11 +1111,11 @@ onRadioButton - + 24 wxEXPAND|wxLEFT 0 - + 2 wxBOTH 1 diff --git a/eeschema/dialogs/dialog_sim_model_base.h b/eeschema/dialogs/dialog_sim_model_base.h index 1374727d96..7962a6d758 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 @@ -54,7 +55,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;