Code clarity.

This commit is contained in:
Jeff Young 2022-10-11 11:22:09 +01:00
parent 3967435f94
commit 8206283a20
5 changed files with 28 additions and 28 deletions

View File

@ -347,7 +347,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
wxString paths;
wxArrayString libNames;
SYMBOL_LIBS::LibNamesAndPaths( &Prj(), false, &paths, &libNames );
SYMBOL_LIBS::GetLibNamesAndPaths( &Prj(), &paths, &libNames );
if( !libNames.IsEmpty() )
{
@ -371,7 +371,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
libNames.Clear();
paths.Clear();
SYMBOL_LIBS::LibNamesAndPaths( &Prj(), true, &paths, &libNames );
SYMBOL_LIBS::SetLibNamesAndPaths( &Prj(), paths, libNames );
}
if( !cfg || !cfg->m_RescueNeverShow )

View File

@ -724,7 +724,7 @@ bool LEGACY_RESCUER::WriteRescueLibrary( wxWindow *aParent )
try
{
SYMBOL_LIBS::LibNamesAndPaths( m_prj, false, &libPaths, &libNames );
SYMBOL_LIBS::GetLibNamesAndPaths( m_prj, &libPaths, &libNames );
// Make sure the library is not already in the list
while( libNames.Index( libName ) != wxNOT_FOUND )
@ -732,7 +732,7 @@ bool LEGACY_RESCUER::WriteRescueLibrary( wxWindow *aParent )
// Add the library to the top of the list and save.
libNames.Insert( libName, 0 );
SYMBOL_LIBS::LibNamesAndPaths( m_prj, true, &libPaths, &libNames );
SYMBOL_LIBS::SetLibNamesAndPaths( m_prj, libPaths, libNames );
}
catch( const IO_ERROR& )
{

View File

@ -55,7 +55,7 @@ SEARCH_STACK* PROJECT::SchSearchS()
try
{
SYMBOL_LIBS::LibNamesAndPaths( this, false, &libDir );
SYMBOL_LIBS::GetLibNamesAndPaths( this, &libDir );
}
catch( const IO_ERROR& )
{

View File

@ -408,29 +408,29 @@ void SYMBOL_LIBS::FindLibraryNearEntries( std::vector<LIB_SYMBOL*>& aCandidates,
}
void SYMBOL_LIBS::LibNamesAndPaths( PROJECT* aProject, bool doSave,
wxString* aPaths, wxArrayString* aNames )
void SYMBOL_LIBS::GetLibNamesAndPaths( PROJECT* aProject, wxString* aPaths, wxArrayString* aNames )
{
wxCHECK_RET( aProject, "Null PROJECT in LibNamesAndPaths" );
wxCHECK_RET( aProject, "Null PROJECT in GetLibNamesAndPaths" );
PROJECT_FILE& project = aProject->GetProjectFile();
if( doSave )
{
if( aPaths )
project.m_LegacyLibDir = *aPaths;
if( aPaths )
*aPaths = project.m_LegacyLibDir;
if( aNames )
project.m_LegacyLibNames = *aNames;
}
else
{
if( aPaths )
*aPaths = project.m_LegacyLibDir;
if( aNames )
*aNames = project.m_LegacyLibNames;
}
if( aNames )
*aNames = project.m_LegacyLibNames;
}
void SYMBOL_LIBS::SetLibNamesAndPaths( PROJECT* aProject, const wxString& aPaths,
const wxArrayString& aNames )
{
wxCHECK_RET( aProject, "Null PROJECT in SetLibNamesAndPaths" );
PROJECT_FILE& project = aProject->GetProjectFile();
project.m_LegacyLibDir = aPaths;
project.m_LegacyLibNames = aNames;
}
@ -460,7 +460,7 @@ void SYMBOL_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
wxArrayString lib_names;
LibNamesAndPaths( aProject, false, nullptr, &lib_names );
GetLibNamesAndPaths( aProject, nullptr, &lib_names );
// Post symbol library table, this should be empty. Only the cache library should get loaded.
if( !lib_names.empty() )

View File

@ -93,11 +93,11 @@ public:
*/
void LoadAllLibraries( PROJECT* aProject, bool aShowProgress=true );
/**
* Save or load the names of the currently configured symbol libraries (without paths).
*/
static void LibNamesAndPaths( PROJECT* aProject, bool doSave,
wxString* aPaths, wxArrayString* aNames = nullptr );
static void GetLibNamesAndPaths( PROJECT* aProject, wxString* aPaths,
wxArrayString* aNames = nullptr );
static void SetLibNamesAndPaths( PROJECT* aProject, const wxString& aPaths,
const wxArrayString& aNames );
/**
* Return the name of the cache library after potentially fixing it from