From c815847b1efb6f35afd64099bde60d3b2c138bff Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 2 Aug 2022 12:52:22 +0200 Subject: [PATCH] DIALOG_SIM_MODEL: fix some issues (not all) * internationalize * fix min size * show lib filename in a not editable wxTextCtrl instead of a wxStatic Text --- eeschema/dialogs/dialog_sim_model.cpp | 5 +- eeschema/dialogs/dialog_sim_model_base.cpp | 56 +++++++++++----------- eeschema/dialogs/dialog_sim_model_base.fbp | 33 +++++++------ eeschema/dialogs/dialog_sim_model_base.h | 10 ++-- 4 files changed, 55 insertions(+), 49 deletions(-) diff --git a/eeschema/dialogs/dialog_sim_model.cpp b/eeschema/dialogs/dialog_sim_model.cpp index 04efca8c21..319bcf78cb 100644 --- a/eeschema/dialogs/dialog_sim_model.cpp +++ b/eeschema/dialogs/dialog_sim_model.cpp @@ -99,7 +99,8 @@ DIALOG_SIM_MODEL::DIALOG_SIM_MODEL( wxWindow* aParent, SCH_SYMBOL& aSymbol, else wxFAIL; - Layout(); + // Now all widgets have the size fixed, call FinishDialogSettings + finishDialogSettings(); } @@ -401,7 +402,7 @@ void DIALOG_SIM_MODEL::loadLibrary( const wxString& aFilePath ) return; } - m_libraryPathLabel->SetLabel( aFilePath ); + m_tclibraryPathName->ChangeValue( aFilePath ); m_libraryModels.clear(); diff --git a/eeschema/dialogs/dialog_sim_model_base.cpp b/eeschema/dialogs/dialog_sim_model_base.cpp index 2715ee8b34..d44ebda2bd 100644 --- a/eeschema/dialogs/dialog_sim_model_base.cpp +++ b/eeschema/dialogs/dialog_sim_model_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5) +// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -13,7 +13,7 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxSize( 600,800 ), wxDefaultSize ); + this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); wxBoxSizer* bSizer8; bSizer8 = new wxBoxSizer( wxVERTICAL ); @@ -24,7 +24,7 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c bSizer9 = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer* sbSizer4; - sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_modelPanel, wxID_ANY, wxT("Source") ), wxVERTICAL ); + sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_modelPanel, wxID_ANY, _("Source") ), wxVERTICAL ); wxFlexGridSizer* fgSizer15; fgSizer15 = new wxFlexGridSizer( 0, 4, 0, 0 ); @@ -32,30 +32,29 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c fgSizer15->SetFlexibleDirection( wxBOTH ); fgSizer15->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_useInstanceModelRadioButton = new wxRadioButton( sbSizer4->GetStaticBox(), wxID_ANY, wxT("Instance"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - fgSizer15->Add( m_useInstanceModelRadioButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_useInstanceModelRadioButton = new wxRadioButton( sbSizer4->GetStaticBox(), wxID_ANY, _("Instance"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + fgSizer15->Add( m_useInstanceModelRadioButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - m_useLibraryModelRadioButton = new wxRadioButton( sbSizer4->GetStaticBox(), wxID_ANY, wxT("Library:"), wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer15->Add( m_useLibraryModelRadioButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_useLibraryModelRadioButton = new wxRadioButton( sbSizer4->GetStaticBox(), wxID_ANY, _("Library:"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer15->Add( m_useLibraryModelRadioButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - m_libraryPathLabel = new wxStaticText( sbSizer4->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_libraryPathLabel->Wrap( -1 ); - fgSizer15->Add( m_libraryPathLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_tclibraryPathName = new wxTextCtrl( sbSizer4->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); + fgSizer15->Add( m_tclibraryPathName, 0, wxEXPAND|wxALL, 5 ); m_browseButton = new wxBitmapButton( sbSizer4->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); - fgSizer15->Add( m_browseButton, 0, wxALL, 5 ); + fgSizer15->Add( m_browseButton, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); fgSizer15->Add( 0, 0, 1, wxEXPAND, 5 ); - m_modelNameLabel = new wxStaticText( sbSizer4->GetStaticBox(), wxID_ANY, wxT("Model:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + m_modelNameLabel = new wxStaticText( sbSizer4->GetStaticBox(), wxID_ANY, _("Model:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); m_modelNameLabel->Wrap( -1 ); - fgSizer15->Add( m_modelNameLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + fgSizer15->Add( m_modelNameLabel, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); m_modelNameCombobox = new wxComboBox( sbSizer4->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); fgSizer15->Add( m_modelNameCombobox, 0, wxALL|wxEXPAND, 5 ); - m_overrideCheckbox = new wxCheckBox( sbSizer4->GetStaticBox(), wxID_ANY, wxT("Override"), wxDefaultPosition, wxDefaultSize, 0 ); + m_overrideCheckbox = new wxCheckBox( sbSizer4->GetStaticBox(), wxID_ANY, _("Override"), wxDefaultPosition, wxDefaultSize, 0 ); fgSizer15->Add( m_overrideCheckbox, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); @@ -65,10 +64,12 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c bSizer9->Add( sbSizer4, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 ); wxStaticBoxSizer* sbSizer5; - sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( m_modelPanel, wxID_ANY, wxT("Model") ), wxVERTICAL ); + sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( m_modelPanel, wxID_ANY, _("Model") ), wxVERTICAL ); m_notebook4 = new wxNotebook( sbSizer5->GetStaticBox(), 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 ); @@ -78,7 +79,7 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c fgSizer16->SetFlexibleDirection( wxBOTH ); fgSizer16->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_staticText127 = new wxStaticText( m_parametersPanel, wxID_ANY, wxT("Device:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText127 = new wxStaticText( m_parametersPanel, wxID_ANY, _("Device:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText127->Wrap( -1 ); fgSizer16->Add( m_staticText127, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); @@ -87,7 +88,7 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c m_deviceTypeChoice->SetSelection( 0 ); fgSizer16->Add( m_deviceTypeChoice, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); - m_staticText8 = new wxStaticText( m_parametersPanel, wxID_ANY, wxT("Type:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText8 = new wxStaticText( m_parametersPanel, wxID_ANY, _("Type:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText8->Wrap( -1 ); fgSizer16->Add( m_staticText8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); @@ -102,14 +103,14 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c 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 ); - m_paramGrid = m_paramGridMgr->AddPage( wxT("Page"), wxNullBitmap ); + m_paramGrid = m_paramGridMgr->AddPage( _("Page"), wxNullBitmap ); bSizer12->Add( m_paramGridMgr, 1, wxALL|wxEXPAND, 5 ); m_parametersPanel->SetSizer( bSizer12 ); m_parametersPanel->Layout(); bSizer12->Fit( m_parametersPanel ); - m_notebook4->AddPage( m_parametersPanel, wxT("Parameters"), true ); + m_notebook4->AddPage( m_parametersPanel, _("Parameters"), true ); m_codePanel = new wxPanel( m_notebook4, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer5; bSizer5 = new wxBoxSizer( wxVERTICAL ); @@ -156,7 +157,7 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c m_codePanel->SetSizer( bSizer5 ); m_codePanel->Layout(); bSizer5->Fit( m_codePanel ); - m_notebook4->AddPage( m_codePanel, wxT("Code"), false ); + m_notebook4->AddPage( m_codePanel, _("Code"), false ); sbSizer5->Add( m_notebook4, 1, wxEXPAND | wxALL, 5 ); @@ -167,7 +168,7 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c m_modelPanel->SetSizer( bSizer9 ); m_modelPanel->Layout(); bSizer9->Fit( m_modelPanel ); - m_notebook->AddPage( m_modelPanel, wxT("Model"), true ); + m_notebook->AddPage( m_modelPanel, _("Model"), true ); m_pinAssignmentsPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer10; bSizer10 = new wxBoxSizer( wxVERTICAL ); @@ -186,8 +187,8 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c m_pinAssignmentsGrid->SetColSize( 1, 160 ); m_pinAssignmentsGrid->EnableDragColMove( false ); m_pinAssignmentsGrid->EnableDragColSize( true ); - m_pinAssignmentsGrid->SetColLabelValue( 0, wxT("Symbol Pin") ); - m_pinAssignmentsGrid->SetColLabelValue( 1, wxT("Model Pin") ); + m_pinAssignmentsGrid->SetColLabelValue( 0, _("Symbol Pin") ); + m_pinAssignmentsGrid->SetColLabelValue( 1, _("Model Pin") ); m_pinAssignmentsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); // Rows @@ -205,14 +206,14 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c m_pinAssignmentsPanel->SetSizer( bSizer10 ); m_pinAssignmentsPanel->Layout(); bSizer10->Fit( m_pinAssignmentsPanel ); - m_notebook->AddPage( m_pinAssignmentsPanel, wxT("Pin Assignments"), false ); + m_notebook->AddPage( m_pinAssignmentsPanel, _("Pin Assignments"), false ); bSizer8->Add( m_notebook, 1, wxALL|wxEXPAND, 5 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bSizer8->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); - m_excludeSymbolCheckbox = new wxCheckBox( this, wxID_ANY, wxT("Exclude symbol from simulation"), wxDefaultPosition, wxDefaultSize, 0 ); + m_excludeSymbolCheckbox = new wxCheckBox( this, wxID_ANY, _("Exclude symbol from simulation"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer8->Add( m_excludeSymbolCheckbox, 0, wxALL, 5 ); m_sdbSizer1 = new wxStdDialogButtonSizer(); @@ -227,14 +228,13 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c this->SetSizer( bSizer8 ); this->Layout(); - bSizer8->Fit( this ); 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_libraryPathLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onLibraryPathUpdate ), 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_modelNameCombobox->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameCombobox ), NULL, this ); @@ -259,7 +259,7 @@ 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_libraryPathLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onLibraryPathUpdate ), 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_modelNameCombobox->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onModelNameCombobox ), NULL, this ); diff --git a/eeschema/dialogs/dialog_sim_model_base.fbp b/eeschema/dialogs/dialog_sim_model_base.fbp index 5535bc1eb5..9480b5409b 100644 --- a/eeschema/dialogs/dialog_sim_model_base.fbp +++ b/eeschema/dialogs/dialog_sim_model_base.fbp @@ -16,7 +16,7 @@ none - 0 + 1 DIALOG_SIM_MODEL_BASE . @@ -44,10 +44,10 @@ 0 wxID_ANY - 600,800 + -1,-1 DIALOG_SIM_MODEL_BASE - -1,-1 + 454,515 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h; forward_declare Spice Model Editor @@ -208,7 +208,7 @@ 0 5 - wxALIGN_CENTER_VERTICAL|wxALL + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 0 1 @@ -273,7 +273,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALL + wxALIGN_CENTER_VERTICAL|wxLEFT 0 1 @@ -338,9 +338,9 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALL + wxEXPAND|wxALL 0 - + 1 1 1 @@ -368,16 +368,15 @@ 0 0 wxID_ANY - - 0 0 + 0 1 - m_libraryPathLabel + m_tclibraryPathName 1 @@ -387,20 +386,24 @@ Resizable 1 - + wxTE_READONLY ; ; forward_declare 0 + + wxFILTER_NONE + wxDefaultValidator + + - -1 onLibraryPathUpdate 5 - wxALL + wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL 0 1 @@ -485,7 +488,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM|wxLEFT 0 1 @@ -789,7 +792,7 @@ 0 - + 500,-1 1 m_parametersPanel 1 diff --git a/eeschema/dialogs/dialog_sim_model_base.h b/eeschema/dialogs/dialog_sim_model_base.h index 9ca090358e..f8742fc86c 100644 --- a/eeschema/dialogs/dialog_sim_model_base.h +++ b/eeschema/dialogs/dialog_sim_model_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5) +// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -9,6 +9,7 @@ #include #include +#include class WX_GRID; #include "dialog_shim.h" @@ -18,12 +19,13 @@ class WX_GRID; #include #include #include -#include +#include #include #include #include #include #include +#include #include #include #include @@ -54,7 +56,7 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM wxPanel* m_modelPanel; wxRadioButton* m_useInstanceModelRadioButton; wxRadioButton* m_useLibraryModelRadioButton; - wxStaticText* m_libraryPathLabel; + wxTextCtrl* m_tclibraryPathName; wxBitmapButton* m_browseButton; wxStaticText* m_modelNameLabel; wxComboBox* m_modelNameCombobox; @@ -101,7 +103,7 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM public: - DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Spice Model Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Spice Model Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 454,515 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_SIM_MODEL_BASE();