From 27109bfc8ab4c9a55a29d2a3914a97dae1dc748e Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 20 Jan 2023 00:18:08 +0000 Subject: [PATCH] MRU path for simulation model libraries. Fixes https://gitlab.com/kicad/code/kicad/issues/13581 --- eeschema/dialogs/dialog_sim_model.cpp | 9 +++++++-- eeschema/symbol_editor/symbol_editor_import_export.cpp | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/eeschema/dialogs/dialog_sim_model.cpp b/eeschema/dialogs/dialog_sim_model.cpp index 2fac451437..d6144852e4 100644 --- a/eeschema/dialogs/dialog_sim_model.cpp +++ b/eeschema/dialogs/dialog_sim_model.cpp @@ -1060,14 +1060,19 @@ void DIALOG_SIM_MODEL::onLibraryPathTextKillFocus( wxFocusEve template void DIALOG_SIM_MODEL::onBrowseButtonClick( wxCommandEvent& aEvent ) { - wxFileDialog dlg( this, _( "Browse Models" ), Prj().GetProjectPath() ); + static wxString s_mruPath; + + wxString path = s_mruPath.IsEmpty() ? Prj().GetProjectPath() : s_mruPath; + wxFileDialog dlg( this, _( "Browse Models" ), path ); if( dlg.ShowModal() == wxID_CANCEL ) return; - wxString path = dlg.GetPath(); + path = dlg.GetPath(); wxFileName fn( path ); + s_mruPath = fn.GetPath(); + if( fn.MakeRelativeTo( Prj().GetProjectPath() ) && !fn.GetFullPath().StartsWith( wxS( ".." ) ) ) path = fn.GetFullPath(); diff --git a/eeschema/symbol_editor/symbol_editor_import_export.cpp b/eeschema/symbol_editor/symbol_editor_import_export.cpp index e5e9c09b6f..e017357b41 100644 --- a/eeschema/symbol_editor/symbol_editor_import_export.cpp +++ b/eeschema/symbol_editor/symbol_editor_import_export.cpp @@ -60,8 +60,10 @@ void SYMBOL_EDIT_FRAME::ImportSymbol() wxFileName fn = dlg.GetPath(); if( fn.GetExt().IsEmpty() ) - fn.SetExt( (dlg.GetFilterIndex() == 0) ? - KiCadSymbolLibFileExtension : LegacySymbolLibFileExtension ); + { + fn.SetExt( (dlg.GetFilterIndex() == 0) ? KiCadSymbolLibFileExtension + : LegacySymbolLibFileExtension ); + } m_mruPath = fn.GetPath();