From 13cfe74956982b8eb148516c7a782a53003e07eb Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 20 Aug 2016 17:25:51 +0200 Subject: [PATCH] Simulator dialogs: fix minimal sizes and best sizes. --- eeschema/dialogs/dialog_signal_list.cpp | 9 ++- eeschema/dialogs/dialog_signal_list_base.cpp | 10 ++- eeschema/dialogs/dialog_signal_list_base.fbp | 12 +-- eeschema/dialogs/dialog_signal_list_base.h | 9 ++- eeschema/dialogs/dialog_sim_settings.cpp | 2 + eeschema/dialogs/dialog_sim_settings.h | 9 +++ eeschema/dialogs/dialog_sim_settings_base.cpp | 30 ++++--- eeschema/dialogs/dialog_sim_settings_base.fbp | 80 +++++++++---------- eeschema/dialogs/dialog_sim_settings_base.h | 10 ++- eeschema/dialogs/dialog_spice_model.cpp | 2 + eeschema/dialogs/dialog_spice_model.h | 9 +++ eeschema/dialogs/dialog_spice_model_base.cpp | 24 +++--- eeschema/dialogs/dialog_spice_model_base.fbp | 38 ++++----- eeschema/dialogs/dialog_spice_model_base.h | 5 +- eeschema/files-io.cpp | 7 +- 15 files changed, 149 insertions(+), 107 deletions(-) diff --git a/eeschema/dialogs/dialog_signal_list.cpp b/eeschema/dialogs/dialog_signal_list.cpp index a0a5104b1e..fdc96ed1f3 100644 --- a/eeschema/dialogs/dialog_signal_list.cpp +++ b/eeschema/dialogs/dialog_signal_list.cpp @@ -30,6 +30,8 @@ DIALOG_SIGNAL_LIST::DIALOG_SIGNAL_LIST( SIM_PLOT_FRAME* aParent, NETLIST_EXPORTER_PSPICE_SIM* aExporter ) : DIALOG_SIGNAL_LIST_BASE( aParent ), m_plotFrame( aParent ), m_exporter( aExporter ) { + + FixOSXCancelButtonIssue(); } @@ -72,7 +74,12 @@ bool DIALOG_SIGNAL_LIST::TransferDataToWindow() } } - return DIALOG_SIGNAL_LIST_BASE::TransferDataToWindow(); + bool success = DIALOG_SIGNAL_LIST_BASE::TransferDataToWindow(); + + // Now all widgets have the size fixed, call FinishDialogSettings + FinishDialogSettings(); + + return success; } diff --git a/eeschema/dialogs/dialog_signal_list_base.cpp b/eeschema/dialogs/dialog_signal_list_base.cpp index 177f64c5ad..e65949d2c4 100644 --- a/eeschema/dialogs/dialog_signal_list_base.cpp +++ b/eeschema/dialogs/dialog_signal_list_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 24 2016) +// C++ code generated with wxFormBuilder (version Jul 31 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -9,14 +9,16 @@ /////////////////////////////////////////////////////////////////////////// -DIALOG_SIGNAL_LIST_BASE::DIALOG_SIGNAL_LIST_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +DIALOG_SIGNAL_LIST_BASE::DIALOG_SIGNAL_LIST_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( wxDefaultSize, wxDefaultSize ); + this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); wxBoxSizer* bSizer6; bSizer6 = new wxBoxSizer( wxVERTICAL ); m_signals = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED|wxLB_NEEDED_SB|wxLB_SORT ); + m_signals->SetMinSize( wxSize( 450,400 ) ); + bSizer6->Add( m_signals, 1, wxALL|wxEXPAND, 5 ); m_sdbSizer = new wxStdDialogButtonSizer(); @@ -26,7 +28,7 @@ DIALOG_SIGNAL_LIST_BASE::DIALOG_SIGNAL_LIST_BASE( wxWindow* parent, wxWindowID i m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->Realize(); - bSizer6->Add( m_sdbSizer, 0, wxEXPAND, 5 ); + bSizer6->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 ); this->SetSizer( bSizer6 ); diff --git a/eeschema/dialogs/dialog_signal_list_base.fbp b/eeschema/dialogs/dialog_signal_list_base.fbp index 7c677737bd..3169140a35 100644 --- a/eeschema/dialogs/dialog_signal_list_base.fbp +++ b/eeschema/dialogs/dialog_signal_list_base.fbp @@ -41,12 +41,12 @@ 0 wxID_ANY - + -1,-1 DIALOG_SIGNAL_LIST_BASE - 424,535 - wxDEFAULT_DIALOG_STYLE - + 599,419 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h @@ -131,7 +131,7 @@ 0 - + 450,400 1 m_signals 1 @@ -183,7 +183,7 @@ 5 - wxEXPAND + wxEXPAND|wxALL 0 0 diff --git a/eeschema/dialogs/dialog_signal_list_base.h b/eeschema/dialogs/dialog_signal_list_base.h index e36730964d..4623534420 100644 --- a/eeschema/dialogs/dialog_signal_list_base.h +++ b/eeschema/dialogs/dialog_signal_list_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 24 2016) +// C++ code generated with wxFormBuilder (version Jul 31 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,6 +11,9 @@ #include #include #include +class DIALOG_SHIM; + +#include "dialog_shim.h" #include #include #include @@ -27,7 +30,7 @@ /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_SIGNAL_LIST_BASE /////////////////////////////////////////////////////////////////////////////// -class DIALOG_SIGNAL_LIST_BASE : public wxDialog +class DIALOG_SIGNAL_LIST_BASE : public DIALOG_SHIM { private: @@ -43,7 +46,7 @@ class DIALOG_SIGNAL_LIST_BASE : public wxDialog public: - DIALOG_SIGNAL_LIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 424,535 ), long style = wxDEFAULT_DIALOG_STYLE ); + DIALOG_SIGNAL_LIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 599,419 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_SIGNAL_LIST_BASE(); }; diff --git a/eeschema/dialogs/dialog_sim_settings.cpp b/eeschema/dialogs/dialog_sim_settings.cpp index f5cbccaf5e..23a5901c6b 100644 --- a/eeschema/dialogs/dialog_sim_settings.cpp +++ b/eeschema/dialogs/dialog_sim_settings.cpp @@ -65,6 +65,8 @@ DIALOG_SIM_SETTINGS::DIALOG_SIM_SETTINGS( wxWindow* aParent ) m_sdbSizerOK->SetDefault(); updateNetlistOpts(); + + FixOSXCancelButtonIssue(); } diff --git a/eeschema/dialogs/dialog_sim_settings.h b/eeschema/dialogs/dialog_sim_settings.h index 2be181bba4..9549fe2f26 100644 --- a/eeschema/dialogs/dialog_sim_settings.h +++ b/eeschema/dialogs/dialog_sim_settings.h @@ -75,6 +75,15 @@ private: LINEAR }; + virtual void onInitDlg( wxInitDialogEvent& event ) override + { + // Call the default wxDialog handler of a wxInitDialogEvent + TransferDataToWindow(); + + // Now all widgets have the size fixed, call FinishDialogSettings + FinishDialogSettings(); + } + /** * @brief Parses a Spice directive. * @param aCommand is the directive to be parsed (e.g. ".tran 10n 1000n"). diff --git a/eeschema/dialogs/dialog_sim_settings_base.cpp b/eeschema/dialogs/dialog_sim_settings_base.cpp index bc947e3169..3f67853940 100644 --- a/eeschema/dialogs/dialog_sim_settings_base.cpp +++ b/eeschema/dialogs/dialog_sim_settings_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version May 6 2016) +// C++ code generated with wxFormBuilder (version Jul 31 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -9,7 +9,7 @@ /////////////////////////////////////////////////////////////////////////// -DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_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( wxDefaultSize, wxDefaultSize ); @@ -17,6 +17,8 @@ DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID bSizer1 = new wxBoxSizer( wxVERTICAL ); m_simPages = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_simPages->SetMinSize( wxSize( 650,-1 ) ); + m_pgAC = new wxPanel( m_simPages, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer3; bSizer3 = new wxBoxSizer( wxVERTICAL ); @@ -59,10 +61,10 @@ DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID fgSizer1->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_acFreqStop = new wxTextCtrl( m_pgAC, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer1->Add( m_acFreqStop, 0, wxALL, 5 ); + fgSizer1->Add( m_acFreqStop, 0, wxALL|wxEXPAND, 5 ); - bSizer3->Add( fgSizer1, 1, wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizer3->Add( fgSizer1, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); bSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); @@ -71,7 +73,7 @@ DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID m_pgAC->SetSizer( bSizer3 ); m_pgAC->Layout(); bSizer3->Fit( m_pgAC ); - m_simPages->AddPage( m_pgAC, _("AC"), false ); + m_simPages->AddPage( m_pgAC, _("AC"), true ); m_pgDC = new wxPanel( m_simPages, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer4; bSizer4 = new wxBoxSizer( wxVERTICAL ); @@ -119,7 +121,7 @@ DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID sbSizer21->Add( fgSizer21, 1, wxALIGN_CENTER_HORIZONTAL, 5 ); - bSizer4->Add( sbSizer21, 1, wxEXPAND, 5 ); + bSizer4->Add( sbSizer21, 0, wxEXPAND, 5 ); wxStaticBoxSizer* sbSizer2; sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( m_pgDC, wxID_ANY, _("DC sweep source 2") ), wxVERTICAL ); @@ -164,7 +166,7 @@ DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID sbSizer2->Add( fgSizer2, 1, wxALIGN_CENTER_HORIZONTAL, 5 ); - bSizer4->Add( sbSizer2, 1, wxEXPAND, 5 ); + bSizer4->Add( sbSizer2, 0, wxEXPAND, 5 ); m_pgDC->SetSizer( bSizer4 ); @@ -221,7 +223,7 @@ DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID fgSizer7->Add( 0, 0, 1, wxEXPAND, 5 ); - bSizer15->Add( fgSizer7, 1, wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizer15->Add( fgSizer7, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); bSizer15->Add( 0, 0, 1, wxEXPAND, 5 ); @@ -262,7 +264,7 @@ DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID fgSizer11->Add( m_noiseFreqStop, 0, wxALL, 5 ); - bSizer15->Add( fgSizer11, 1, wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizer15->Add( fgSizer11, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); bSizer15->Add( 0, 0, 1, wxEXPAND, 5 ); @@ -300,7 +302,7 @@ DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID m_pgSensitivity = new wxPanel( m_simPages, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_pgSensitivity->Hide(); - m_simPages->AddPage( m_pgSensitivity, _("Sensitivity"), true ); + m_simPages->AddPage( m_pgSensitivity, _("Sensitivity"), false ); m_pgTransferFunction = new wxPanel( m_simPages, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_pgTransferFunction->Hide(); @@ -325,7 +327,7 @@ DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID fgSizer6->Add( m_transStep, 0, wxALL, 5 ); - fgSizer6->Add( 0, 0, 1, wxEXPAND, 5 ); + fgSizer6->Add( 0, 0, 0, wxEXPAND, 5 ); m_staticText161 = new wxStaticText( m_pgTransient, wxID_ANY, _("Final time [s]"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText161->Wrap( -1 ); @@ -335,7 +337,7 @@ DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID fgSizer6->Add( m_transFinal, 0, wxALL, 5 ); - fgSizer6->Add( 0, 0, 1, wxEXPAND, 5 ); + fgSizer6->Add( 0, 0, 0, wxEXPAND, 5 ); m_staticText17 = new wxStaticText( m_pgTransient, wxID_ANY, _("Initial time [s]"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText17->Wrap( -1 ); @@ -349,7 +351,7 @@ DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID fgSizer6->Add( m_staticText24, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - bSizer81->Add( fgSizer6, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + bSizer81->Add( fgSizer6, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); bSizer81->Add( 0, 0, 1, wxEXPAND, 5 ); @@ -406,12 +408,14 @@ DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID this->Centre( wxBOTH ); // Connect Events + this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SIM_SETTINGS_BASE::onInitDlg ) ); m_loadDirectives->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SIM_SETTINGS_BASE::onLoadDirectives ), NULL, this ); } DIALOG_SIM_SETTINGS_BASE::~DIALOG_SIM_SETTINGS_BASE() { // Disconnect Events + this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SIM_SETTINGS_BASE::onInitDlg ) ); m_loadDirectives->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SIM_SETTINGS_BASE::onLoadDirectives ), NULL, this ); } diff --git a/eeschema/dialogs/dialog_sim_settings_base.fbp b/eeschema/dialogs/dialog_sim_settings_base.fbp index b55769e9f8..5f5c2ae6f8 100644 --- a/eeschema/dialogs/dialog_sim_settings_base.fbp +++ b/eeschema/dialogs/dialog_sim_settings_base.fbp @@ -44,9 +44,9 @@ DIALOG_SIM_SETTINGS_BASE - 692,535 + 685,518 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - ; + DIALOG_SHIM; dialog_shim.h Simulation settings @@ -67,7 +67,7 @@ - + onInitDlg @@ -131,7 +131,7 @@ 0 - + 650,-1 1 m_simPages 1 @@ -178,7 +178,7 @@ AC - 0 + 1 1 1 @@ -258,11 +258,11 @@ bSizer3 wxVERTICAL none - + 5 wxEXPAND 1 - + 0 protected 0 @@ -358,11 +358,11 @@ - + 5 wxEXPAND 1 - + 0 protected 0 @@ -371,7 +371,7 @@ 5 wxALIGN_CENTER_HORIZONTAL - 1 + 0 2 wxBOTH @@ -817,7 +817,7 @@ 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -908,11 +908,11 @@ - + 5 wxEXPAND 1 - + 0 protected 0 @@ -921,11 +921,11 @@ - + DC Transfer 0 - + 1 1 1 @@ -999,16 +999,16 @@ - + bSizer4 wxVERTICAL none - + 5 wxEXPAND - 1 - + 0 + wxID_ANY DC sweep source 1 @@ -1821,11 +1821,11 @@ - + 5 wxEXPAND - 1 - + 0 + wxID_ANY DC sweep source 2 @@ -2721,11 +2721,11 @@ - + Noise 0 - + 1 1 1 @@ -2799,7 +2799,7 @@ - + bSizer15 wxVERTICAL @@ -2817,7 +2817,7 @@ 5 wxALIGN_CENTER_HORIZONTAL - 1 + 0 3 wxBOTH @@ -3570,7 +3570,7 @@ 5 wxALIGN_CENTER_HORIZONTAL - 1 + 0 2 wxBOTH @@ -4392,7 +4392,7 @@ Sensitivity - 1 + 0 1 1 @@ -4549,11 +4549,11 @@ - + Transient 0 - + 1 1 1 @@ -4627,7 +4627,7 @@ - + bSizer81 wxVERTICAL @@ -4642,11 +4642,11 @@ 0 - + 5 - wxALIGN_CENTER_HORIZONTAL|wxALL - 1 - + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + 3 wxBOTH @@ -4835,7 +4835,7 @@ 5 wxEXPAND - 1 + 0 0 protected @@ -5019,7 +5019,7 @@ 5 wxEXPAND - 1 + 0 0 protected @@ -5298,11 +5298,11 @@ - + Custom 0 - + 1 1 1 @@ -5376,7 +5376,7 @@ - + bSizer2 wxVERTICAL diff --git a/eeschema/dialogs/dialog_sim_settings_base.h b/eeschema/dialogs/dialog_sim_settings_base.h index 0b51cd9941..64747b5617 100644 --- a/eeschema/dialogs/dialog_sim_settings_base.h +++ b/eeschema/dialogs/dialog_sim_settings_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version May 6 2016) +// C++ code generated with wxFormBuilder (version Jul 31 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,6 +11,9 @@ #include #include #include +class DIALOG_SHIM; + +#include "dialog_shim.h" #include #include #include @@ -38,7 +41,7 @@ /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_SIM_SETTINGS_BASE /////////////////////////////////////////////////////////////////////////////// -class DIALOG_SIM_SETTINGS_BASE : public wxDialog +class DIALOG_SIM_SETTINGS_BASE : public DIALOG_SHIM { private: @@ -111,12 +114,13 @@ class DIALOG_SIM_SETTINGS_BASE : public wxDialog wxButton* m_sdbSizerCancel; // Virtual event handlers, overide them in your derived class + virtual void onInitDlg( wxInitDialogEvent& event ) { event.Skip(); } virtual void onLoadDirectives( wxCommandEvent& event ) { event.Skip(); } public: - DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Simulation settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 692,535 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Simulation settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 685,518 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_SIM_SETTINGS_BASE(); }; diff --git a/eeschema/dialogs/dialog_spice_model.cpp b/eeschema/dialogs/dialog_spice_model.cpp index a15273b68d..c4c81641a1 100644 --- a/eeschema/dialogs/dialog_spice_model.cpp +++ b/eeschema/dialogs/dialog_spice_model.cpp @@ -94,6 +94,8 @@ DIALOG_SPICE_MODEL::DIALOG_SPICE_MODEL( wxWindow* aParent, SCH_COMPONENT& aCompo m_pwlValueCol = m_pwlValList->AppendColumn( "Value [V/A]", wxLIST_FORMAT_LEFT, 100 ); m_sdbSizerOK->SetDefault(); + + FixOSXCancelButtonIssue(); } diff --git a/eeschema/dialogs/dialog_spice_model.h b/eeschema/dialogs/dialog_spice_model.h index 7e2e6df438..7deda7e5b9 100644 --- a/eeschema/dialogs/dialog_spice_model.h +++ b/eeschema/dialogs/dialog_spice_model.h @@ -79,6 +79,15 @@ private: bool TransferDataFromWindow() override; bool TransferDataToWindow() override; + virtual void onInitDlg( wxInitDialogEvent& event ) override + { + // Call the default wxDialog handler of a wxInitDialogEvent + TransferDataToWindow(); + + // Now all widgets have the size fixed, call FinishDialogSettings + FinishDialogSettings(); + } + // Event handlers void onSemiSelectLib( wxCommandEvent& event ) override; void onSelectIcLib( wxCommandEvent& event ) override; diff --git a/eeschema/dialogs/dialog_spice_model_base.cpp b/eeschema/dialogs/dialog_spice_model_base.cpp index bebcb7fa41..07ac72fd16 100644 --- a/eeschema/dialogs/dialog_spice_model_base.cpp +++ b/eeschema/dialogs/dialog_spice_model_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version May 6 2016) +// C++ code generated with wxFormBuilder (version Jul 31 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,7 +11,7 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_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( wxDefaultSize, wxDefaultSize ); + this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); wxBoxSizer* bSizer1; bSizer1 = new wxBoxSizer( wxVERTICAL ); @@ -66,7 +66,7 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID i fgSizer3->Add( m_semiType, 0, wxALL|wxEXPAND, 5 ); - fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); + fgSizer3->Add( 0, 0, 0, 0, 5 ); m_staticText5 = new wxStaticText( m_semiconductor, wxID_ANY, _("Model"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText5->Wrap( -1 ); @@ -76,7 +76,7 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID i fgSizer3->Add( m_semiModel, 0, wxALL|wxEXPAND, 5 ); - fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); + fgSizer3->Add( 0, 0, 0, 0, 5 ); m_staticText7 = new wxStaticText( m_semiconductor, wxID_ANY, _("Library"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText7->Wrap( -1 ); @@ -110,7 +110,7 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID i fgSizer4->Add( m_icModel, 0, wxALL|wxEXPAND, 5 ); - fgSizer4->Add( 0, 0, 1, wxEXPAND, 5 ); + fgSizer4->Add( 0, 0, 0, 0, 5 ); m_staticText9 = new wxStaticText( m_ic, wxID_ANY, _("Library"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText9->Wrap( -1 ); @@ -128,6 +128,8 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID i fgSizer4->Fit( m_ic ); m_notebook->AddPage( m_ic, _("Integrated circuit"), false ); m_power = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_power->SetMinSize( wxSize( 650,-1 ) ); + wxBoxSizer* bSizer4; bSizer4 = new wxBoxSizer( wxVERTICAL ); @@ -178,7 +180,7 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID i sbSizer1->Add( fgSizer6, 1, wxEXPAND, 5 ); - bSizer4->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 ); + bSizer4->Add( sbSizer1, 0, wxALL|wxEXPAND, 5 ); wxStaticBoxSizer* sbSizer3; sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_power, wxID_ANY, _("Transient analysis") ), wxVERTICAL ); @@ -246,7 +248,7 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID i m_pwrPulse->SetSizer( fgSizer7 ); m_pwrPulse->Layout(); fgSizer7->Fit( m_pwrPulse ); - m_powerNotebook->AddPage( m_pwrPulse, _("Pulse"), false ); + m_powerNotebook->AddPage( m_pwrPulse, _("Pulse"), true ); m_pwrSin = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxFlexGridSizer* fgSizer8; fgSizer8 = new wxFlexGridSizer( 0, 2, 0, 0 ); @@ -351,7 +353,7 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID i m_pwrExp->SetSizer( fgSizer9 ); m_pwrExp->Layout(); fgSizer9->Fit( m_pwrExp ); - m_powerNotebook->AddPage( m_pwrExp, _("Exponential"), true ); + m_powerNotebook->AddPage( m_pwrExp, _("Exponential"), false ); m_pwrPwl = new wxPanel( m_powerNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_pwrPwl->SetToolTip( _("Piece-wise linear") ); @@ -424,10 +426,10 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID i m_powerNotebook->AddPage( m_pwrExtData, _("External data"), false ); - sbSizer3->Add( m_powerNotebook, 1, wxEXPAND | wxALL, 5 ); + sbSizer3->Add( m_powerNotebook, 0, wxEXPAND | wxALL, 5 ); - bSizer4->Add( sbSizer3, 1, wxALL|wxEXPAND, 5 ); + bSizer4->Add( sbSizer3, 0, wxALL|wxEXPAND, 5 ); wxString m_pwrTypeChoices[] = { _("Voltage"), _("Current") }; int m_pwrTypeNChoices = sizeof( m_pwrTypeChoices ) / sizeof( wxString ); @@ -476,6 +478,7 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID i this->Centre( wxBOTH ); // Connect Events + this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SPICE_MODEL_BASE::onInitDlg ) ); m_semiSelectLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onSemiSelectLib ), NULL, this ); m_icSelectLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onSelectIcLib ), NULL, this ); m_pwlAddButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onPwlAdd ), NULL, this ); @@ -485,6 +488,7 @@ DIALOG_SPICE_MODEL_BASE::DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID i DIALOG_SPICE_MODEL_BASE::~DIALOG_SPICE_MODEL_BASE() { // Disconnect Events + this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SPICE_MODEL_BASE::onInitDlg ) ); m_semiSelectLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onSemiSelectLib ), NULL, this ); m_icSelectLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onSelectIcLib ), NULL, this ); m_pwlAddButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SPICE_MODEL_BASE::onPwlAdd ), NULL, this ); diff --git a/eeschema/dialogs/dialog_spice_model_base.fbp b/eeschema/dialogs/dialog_spice_model_base.fbp index 8d9fdb34b5..3f004d58c0 100644 --- a/eeschema/dialogs/dialog_spice_model_base.fbp +++ b/eeschema/dialogs/dialog_spice_model_base.fbp @@ -41,10 +41,10 @@ 0 wxID_ANY - + -1,-1 DIALOG_SPICE_MODEL_BASE - 552,621 + 640,582 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h @@ -67,7 +67,7 @@ - + onInitDlg @@ -882,8 +882,8 @@ 5 - wxEXPAND - 1 + + 0 0 protected @@ -1066,8 +1066,8 @@ 5 - wxEXPAND - 1 + + 0 0 protected @@ -1605,8 +1605,8 @@ 5 - wxEXPAND - 1 + + 0 0 protected @@ -1915,7 +1915,7 @@ 0 - + 650,-1 1 m_power 1 @@ -1964,7 +1964,7 @@ 5 wxALL|wxEXPAND - 1 + 0 wxID_ANY DC/AC analysis @@ -2539,7 +2539,7 @@ 5 wxALL|wxEXPAND - 1 + 0 wxID_ANY Transient analysis @@ -2552,7 +2552,7 @@ 5 wxEXPAND | wxALL - 1 + 0 1 1 @@ -2634,7 +2634,7 @@ Pulse - 0 + 1 1 1 @@ -4905,11 +4905,11 @@ - + Exponential - 1 - + 0 + 1 1 1 @@ -6042,11 +6042,11 @@ - + Piece-wise Linear 0 - + 1 1 1 diff --git a/eeschema/dialogs/dialog_spice_model_base.h b/eeschema/dialogs/dialog_spice_model_base.h index 6aa956935b..6a12fb10eb 100644 --- a/eeschema/dialogs/dialog_spice_model_base.h +++ b/eeschema/dialogs/dialog_spice_model_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version May 6 2016) +// C++ code generated with wxFormBuilder (version Jul 31 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -135,6 +135,7 @@ class DIALOG_SPICE_MODEL_BASE : public DIALOG_SHIM wxButton* m_sdbSizerCancel; // Virtual event handlers, overide them in your derived class + virtual void onInitDlg( wxInitDialogEvent& event ) { event.Skip(); } virtual void onSemiSelectLib( wxCommandEvent& event ) { event.Skip(); } virtual void onSelectIcLib( wxCommandEvent& event ) { event.Skip(); } virtual void onPwlAdd( wxCommandEvent& event ) { event.Skip(); } @@ -143,7 +144,7 @@ class DIALOG_SPICE_MODEL_BASE : public DIALOG_SHIM public: - DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 552,621 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_SPICE_MODEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 640,582 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_SPICE_MODEL_BASE(); }; diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 8561a010ed..9d49a9c500 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -290,12 +290,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in SetStatusText( wxEmptyString ); ClearMsgPanel(); - wxString msg = wxString::Format( _( - "Ready\nProject dir: '%s'\n" ), - GetChars( wxPathOnly( Prj().GetProjectFullName() ) ) - ); - SetStatusText( msg ); - // PROJECT::SetProjectFullName() is an impactful function. It should only be // called under carefully considered circumstances. @@ -335,6 +329,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in } catch( const IO_ERROR& ioe ) { + wxString msg; msg.Printf( _( "Error loading schematic file '%s'.\n%s" ), GetChars( fullFileName ), GetChars( ioe.errorText ) ); DisplayError( this, msg );