Use the new nudge path for the symbol lib table, save global and project mru differently

This commit is contained in:
Marek Roszko 2021-01-31 18:59:47 -05:00
parent 991c8fbf8f
commit 31fd49d444
2 changed files with 21 additions and 5 deletions

View File

@ -38,6 +38,7 @@
#include <symbol_viewer_frame.h>
#include <sch_edit_frame.h>
#include <kiway.h>
#include <paths.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <widgets/grid_readonly_text_helpers.h>
@ -197,9 +198,9 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
if( cfg->m_lastSymbolLibDir.IsEmpty() )
{
cfg->m_lastSymbolLibDir = m_project->GetProjectPath();
}
cfg->m_lastSymbolLibDir = PATHS::GetDefaultUserSymbolsPath();
m_lastProjectLibDir = m_project->GetProjectPath();
auto setupGrid =
[&]( WX_GRID* aGrid )
@ -447,8 +448,15 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
+ "|" + LegacySymbolLibFileWildcard();
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
wxString openDir = cfg->m_lastSymbolLibDir;
if( m_cur_grid == m_project_grid )
{
openDir = m_lastProjectLibDir;
}
wxFileDialog dlg( this, _( "Select Library" ),
cfg->m_lastSymbolLibDir, wxEmptyString, wildcards,
openDir, wxEmptyString, wildcards,
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE );
auto result = dlg.ShowModal();
@ -456,7 +464,14 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
if( result == wxID_CANCEL )
return;
cfg->m_lastSymbolLibDir = dlg.GetDirectory();
if( m_cur_grid == m_global_grid )
{
cfg->m_lastSymbolLibDir = dlg.GetPath();
}
else
{
m_lastProjectLibDir = dlg.GetPath();
}
const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
bool addDuplicates = false;

View File

@ -84,6 +84,7 @@ private:
WX_GRID* m_cur_grid; ///< changed based on tab choice
static size_t m_pageNdx; ///< Remember the last notebook page selected
wxString m_lastProjectLibDir; //< Transient (unsaved) last browsed folder when adding a project level library
};