From 7ea120c2a16cda2be50b6d22569337a12b1f278e Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 19 Aug 2016 17:33:26 +0200 Subject: [PATCH] Spice model editor by default looks for libraries in the project directory when there is no library assigned --- eeschema/dialogs/dialog_spice_model.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/eeschema/dialogs/dialog_spice_model.cpp b/eeschema/dialogs/dialog_spice_model.cpp index 213e17e598..a15273b68d 100644 --- a/eeschema/dialogs/dialog_spice_model.cpp +++ b/eeschema/dialogs/dialog_spice_model.cpp @@ -706,8 +706,12 @@ bool DIALOG_SPICE_MODEL::addPwlValue( const wxString& aTime, const wxString& aVa void DIALOG_SPICE_MODEL::onSemiSelectLib( wxCommandEvent& event ) { - wxFileDialog openDlg( this, wxT( "Select library" ), - wxFileName( m_semiLib->GetValue() ).GetPath(), "", + wxString searchPath = wxFileName( m_semiLib->GetValue() ).GetPath(); + + if( searchPath.IsEmpty() ) + searchPath = Prj().GetProjectPath(); + + wxFileDialog openDlg( this, wxT( "Select library" ), searchPath, "", "Spice library file (*.lib)|*.lib;*.LIB|Any file|*", wxFD_OPEN | wxFD_FILE_MUST_EXIST ); @@ -723,13 +727,18 @@ void DIALOG_SPICE_MODEL::onSemiSelectLib( wxCommandEvent& event ) m_semiLib->SetValue( openDlg.GetPath() ); updateFromFile( m_semiModel, openDlg.GetPath(), ".model" ); + m_semiModel->Popup(); } void DIALOG_SPICE_MODEL::onSelectIcLib( wxCommandEvent& event ) { - wxFileDialog openDlg( this, wxT( "Select library" ), - wxFileName( m_icLib->GetValue() ).GetPath(), "", + wxString searchPath = wxFileName( m_icLib->GetValue() ).GetPath(); + + if( searchPath.IsEmpty() ) + searchPath = Prj().GetProjectPath(); + + wxFileDialog openDlg( this, wxT( "Select library" ), searchPath, "", "Spice library file (*.lib)|*.lib;*.LIB|Any file|*", wxFD_OPEN | wxFD_FILE_MUST_EXIST ); @@ -745,6 +754,7 @@ void DIALOG_SPICE_MODEL::onSelectIcLib( wxCommandEvent& event ) m_icLib->SetValue( openDlg.GetPath() ); updateFromFile( m_icModel, openDlg.GetPath(), ".subckt" ); + m_icModel->Popup(); }