From b2945307164c4e623845c314916b59f2cabddb88 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 9 Jul 2023 21:38:58 +0100 Subject: [PATCH] Prefer MRU path to LastImportExportPath for importing footprints. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15102 --- include/footprint_editor_settings.h | 2 +- pcbnew/footprint_editor_settings.cpp | 4 ++-- pcbnew/footprint_libraries_utils.cpp | 19 +++++++------------ 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/include/footprint_editor_settings.h b/include/footprint_editor_settings.h index 43d133e7be..149d4bb83c 100644 --- a/include/footprint_editor_settings.h +++ b/include/footprint_editor_settings.h @@ -73,7 +73,7 @@ public: int m_LibWidth; - wxString m_LastImportExportPath; + wxString m_LastExportPath; wxString m_FootprintTextShownColumns; diff --git a/pcbnew/footprint_editor_settings.cpp b/pcbnew/footprint_editor_settings.cpp index 9b000f0c53..0dd57b1037 100644 --- a/pcbnew/footprint_editor_settings.cpp +++ b/pcbnew/footprint_editor_settings.cpp @@ -48,7 +48,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() : m_Use45Limit( true ), m_ArcEditMode( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ), m_LibWidth( 250 ), - m_LastImportExportPath(), + m_LastExportPath(), m_FootprintTextShownColumns() { m_MagneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_ALWAYS; @@ -72,7 +72,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() : &m_AuiPanels.appearance_panel_tab, 0, 0, 2 ) ); m_params.emplace_back( new PARAM( "system.last_import_export_path", - &m_LastImportExportPath, "" ) ); + &m_LastExportPath, "" ) ); m_params.emplace_back( new PARAM( "window.footprint_text_shown_columns", &m_FootprintTextShownColumns, "0 1 2 3 4 5 6" ) ); diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index 90439f947a..1c968fc8df 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -234,18 +234,13 @@ FOOTPRINT* try_load_footprint( const wxFileName& aFileName, IO_MGR::PCB_FILE_T a FOOTPRINT* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName ) { - wxString lastOpenedPathForLoading = m_mruPath; - FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings(); - - if( !cfg->m_LastImportExportPath.empty() ) - lastOpenedPathForLoading = cfg->m_LastImportExportPath; - - wxFileName fn; + FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings(); + wxFileName fn; if( aName != wxT("") ) fn = aName; else - fn = getFootprintFilenameFromUser( this, lastOpenedPathForLoading ); + fn = getFootprintFilenameFromUser( this, m_mruPath ); if( !fn.IsOk() ) return nullptr; @@ -259,7 +254,7 @@ FOOTPRINT* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName ) return nullptr; } - m_mruPath = cfg->m_LastImportExportPath = fn.GetPath(); + m_mruPath = fn.GetPath(); wxString footprintName; IO_MGR::PCB_FILE_T fileType = detect_file_type( fp, fn.GetFullPath(), &footprintName ); @@ -330,8 +325,8 @@ void FOOTPRINT_EDIT_FRAME::ExportFootprint( FOOTPRINT* aFootprint ) fn.SetExt( KiCadFootprintFileExtension ); - if( !cfg->m_LastImportExportPath.empty() ) - fn.SetPath( cfg->m_LastImportExportPath ); + if( !cfg->m_LastExportPath.empty() ) + fn.SetPath( cfg->m_LastExportPath ); else fn.SetPath( m_mruPath ); @@ -342,7 +337,7 @@ void FOOTPRINT_EDIT_FRAME::ExportFootprint( FOOTPRINT* aFootprint ) return; fn = dlg.GetPath(); - cfg->m_LastImportExportPath = fn.GetPath(); + cfg->m_LastExportPath = fn.GetPath(); try {