Make footprint and symbol editors use MRU path for new libraries.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10216

(cherry picked from commit ff38853886)
This commit is contained in:
Wayne Stambaugh 2022-01-03 18:00:34 -05:00
parent 1874ad2f7e
commit 58b07efd99
1 changed files with 12 additions and 6 deletions

View File

@ -523,7 +523,7 @@ void EDA_DRAW_FRAME::AddStandardSubMenus( TOOL_MENU& aToolMenu )
gridMenu->SetTool( commonTools );
aToolMenu.AddSubMenu( gridMenu );
aMenu.AddMenu( zoomMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
aMenu.AddMenu( zoomMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
aMenu.AddMenu( gridMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
}
@ -988,18 +988,22 @@ bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" );
aFilename.SetExt( ext );
wxString dir = aGlobalPath;
wxString dir;
if( GetMruPath().IsEmpty() )
dir = aGlobalPath;
else
dir = GetMruPath();
if( isDirectory && doOpen )
{
if( !aIsGlobal )
if( !aIsGlobal && GetMruPath().IsEmpty() )
{
dir = Prj().GetProjectPath();
}
wxDirDialog dlg( this, prompt, dir,
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
wxDirDialog dlg( this, prompt, dir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return false;
@ -1013,7 +1017,7 @@ bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
if( aFilename.GetName().empty() )
aFilename.SetName( "Library" );
if( !aIsGlobal )
if( !aIsGlobal && GetMruPath().IsEmpty() )
{
dir = Prj().IsNullProject() ? aFilename.GetFullPath() : Prj().GetProjectPath();
}
@ -1029,6 +1033,8 @@ bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
aFilename.SetExt( ext );
}
SetMruPath( aFilename.GetPath() );
return true;
}