Spice model editor by default looks for libraries in the project directory when there is no library assigned

This commit is contained in:
Maciej Suminski 2016-08-19 17:33:26 +02:00
parent e1d20dd6e3
commit 7ea120c2a1
1 changed files with 14 additions and 4 deletions

View File

@ -706,8 +706,12 @@ bool DIALOG_SPICE_MODEL::addPwlValue( const wxString& aTime, const wxString& aVa
void DIALOG_SPICE_MODEL::onSemiSelectLib( wxCommandEvent& event ) void DIALOG_SPICE_MODEL::onSemiSelectLib( wxCommandEvent& event )
{ {
wxFileDialog openDlg( this, wxT( "Select library" ), wxString searchPath = wxFileName( m_semiLib->GetValue() ).GetPath();
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|*", "Spice library file (*.lib)|*.lib;*.LIB|Any file|*",
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
@ -723,13 +727,18 @@ void DIALOG_SPICE_MODEL::onSemiSelectLib( wxCommandEvent& event )
m_semiLib->SetValue( openDlg.GetPath() ); m_semiLib->SetValue( openDlg.GetPath() );
updateFromFile( m_semiModel, openDlg.GetPath(), ".model" ); updateFromFile( m_semiModel, openDlg.GetPath(), ".model" );
m_semiModel->Popup();
} }
void DIALOG_SPICE_MODEL::onSelectIcLib( wxCommandEvent& event ) void DIALOG_SPICE_MODEL::onSelectIcLib( wxCommandEvent& event )
{ {
wxFileDialog openDlg( this, wxT( "Select library" ), wxString searchPath = wxFileName( m_icLib->GetValue() ).GetPath();
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|*", "Spice library file (*.lib)|*.lib;*.LIB|Any file|*",
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST );
@ -745,6 +754,7 @@ void DIALOG_SPICE_MODEL::onSelectIcLib( wxCommandEvent& event )
m_icLib->SetValue( openDlg.GetPath() ); m_icLib->SetValue( openDlg.GetPath() );
updateFromFile( m_icModel, openDlg.GetPath(), ".subckt" ); updateFromFile( m_icModel, openDlg.GetPath(), ".subckt" );
m_icModel->Popup();
} }