Prefer MRU path to LastImportExportPath for importing footprints.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15102
This commit is contained in:
Jeff Young 2023-07-09 21:38:58 +01:00
parent 0652267d00
commit b294530716
3 changed files with 10 additions and 15 deletions

View File

@ -73,7 +73,7 @@ public:
int m_LibWidth; int m_LibWidth;
wxString m_LastImportExportPath; wxString m_LastExportPath;
wxString m_FootprintTextShownColumns; wxString m_FootprintTextShownColumns;

View File

@ -48,7 +48,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
m_Use45Limit( true ), m_Use45Limit( true ),
m_ArcEditMode( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ), m_ArcEditMode( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ),
m_LibWidth( 250 ), m_LibWidth( 250 ),
m_LastImportExportPath(), m_LastExportPath(),
m_FootprintTextShownColumns() m_FootprintTextShownColumns()
{ {
m_MagneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_ALWAYS; 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_AuiPanels.appearance_panel_tab, 0, 0, 2 ) );
m_params.emplace_back( new PARAM<wxString>( "system.last_import_export_path", m_params.emplace_back( new PARAM<wxString>( "system.last_import_export_path",
&m_LastImportExportPath, "" ) ); &m_LastExportPath, "" ) );
m_params.emplace_back( new PARAM<wxString>( "window.footprint_text_shown_columns", m_params.emplace_back( new PARAM<wxString>( "window.footprint_text_shown_columns",
&m_FootprintTextShownColumns, "0 1 2 3 4 5 6" ) ); &m_FootprintTextShownColumns, "0 1 2 3 4 5 6" ) );

View File

@ -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 ) FOOTPRINT* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName )
{ {
wxString lastOpenedPathForLoading = m_mruPath; FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings();
FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings(); wxFileName fn;
if( !cfg->m_LastImportExportPath.empty() )
lastOpenedPathForLoading = cfg->m_LastImportExportPath;
wxFileName fn;
if( aName != wxT("") ) if( aName != wxT("") )
fn = aName; fn = aName;
else else
fn = getFootprintFilenameFromUser( this, lastOpenedPathForLoading ); fn = getFootprintFilenameFromUser( this, m_mruPath );
if( !fn.IsOk() ) if( !fn.IsOk() )
return nullptr; return nullptr;
@ -259,7 +254,7 @@ FOOTPRINT* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName )
return nullptr; return nullptr;
} }
m_mruPath = cfg->m_LastImportExportPath = fn.GetPath(); m_mruPath = fn.GetPath();
wxString footprintName; wxString footprintName;
IO_MGR::PCB_FILE_T fileType = detect_file_type( fp, fn.GetFullPath(), &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 ); fn.SetExt( KiCadFootprintFileExtension );
if( !cfg->m_LastImportExportPath.empty() ) if( !cfg->m_LastExportPath.empty() )
fn.SetPath( cfg->m_LastImportExportPath ); fn.SetPath( cfg->m_LastExportPath );
else else
fn.SetPath( m_mruPath ); fn.SetPath( m_mruPath );
@ -342,7 +337,7 @@ void FOOTPRINT_EDIT_FRAME::ExportFootprint( FOOTPRINT* aFootprint )
return; return;
fn = dlg.GetPath(); fn = dlg.GetPath();
cfg->m_LastImportExportPath = fn.GetPath(); cfg->m_LastExportPath = fn.GetPath();
try try
{ {