Slight fixup to previous library browse change

This commit is contained in:
Marek Roszko 2021-01-28 07:30:59 -05:00
parent f0aa6aa442
commit 78dbcdcdb7
3 changed files with 8 additions and 6 deletions

View File

@ -888,12 +888,12 @@ wxString EDA_DRAW_FRAME::GetScreenDesc() const
bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename, bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
const wxString& wildcard, const wxString& ext, const wxString& wildcard, const wxString& ext,
bool isDirectory, bool aIsGlobal ) bool isDirectory, bool aIsGlobal, const wxString& aGlobalPath )
{ {
wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" ); wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" );
aFilename.SetExt( ext ); aFilename.SetExt( ext );
wxString dir = PATHS::GetDefaultUserSymbolsPath(); wxString dir = aGlobalPath;
if( isDirectory && doOpen ) if( isDirectory && doOpen )
@ -903,7 +903,7 @@ bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
dir = Prj().GetProjectPath(); dir = Prj().GetProjectPath();
} }
wxDirDialog dlg( this, prompt, Prj().GetProjectPath(), wxDirDialog dlg( this, prompt, dir,
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST ); wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )

View File

@ -38,6 +38,7 @@
#include <symbol_library_manager.h> #include <symbol_library_manager.h>
#include <lib_text.h> #include <lib_text.h>
#include <symbol_editor_settings.h> #include <symbol_editor_settings.h>
#include <paths.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <sch_draw_panel.h> #include <sch_draw_panel.h>
#include <sch_painter.h> #include <sch_painter.h>
@ -803,7 +804,8 @@ bool SYMBOL_EDIT_FRAME::AddLibraryFile( bool aCreateNew )
if( !LibraryFileBrowser( !aCreateNew, fn, KiCadSymbolLibFileWildcard(), if( !LibraryFileBrowser( !aCreateNew, fn, KiCadSymbolLibFileWildcard(),
KiCadSymbolLibFileExtension, false, KiCadSymbolLibFileExtension, false,
( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() ) ) ) ( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() ),
PATHS::GetDefaultUserSymbolsPath() ) )
{ {
return false; return false;
} }

View File

@ -166,8 +166,8 @@ public:
* @return true for OK; false for Cancel. * @return true for OK; false for Cancel.
*/ */
bool LibraryFileBrowser( bool doOpen, wxFileName& aFilename, const wxString& wildcard, bool LibraryFileBrowser( bool doOpen, wxFileName& aFilename, const wxString& wildcard,
const wxString& ext, bool isDirectory = false, const wxString& ext, bool isDirectory = false, bool aIsGlobal = false,
bool aIsGlobal = false ); const wxString& aGlobalPath = wxEmptyString );
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override; void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;