Eeschema: PART_LIB object clean up.

* Rename redundant function PART_LIB::GetEntry() to PART_LIB::GetAlias() which
  is more descriptive and move the GetAlias() function which was nothing more
  than a call to GetEntry().
This commit is contained in:
Wayne Stambaugh 2016-09-02 19:40:18 -04:00
parent 38e7debdec
commit f477cc958c
8 changed files with 19 additions and 30 deletions

View File

@ -138,7 +138,7 @@ bool PART_LIB::Conflicts( LIB_PART* aPart )
}
LIB_ALIAS* PART_LIB::FindEntry( const wxString& aName )
LIB_ALIAS* PART_LIB::FindAlias( const wxString& aName )
{
LIB_ALIAS_MAP::iterator it = m_amap.find( aName );
@ -168,7 +168,7 @@ LIB_PART* PART_LIB::FindPart( const wxString& aName )
}
#endif
if( LIB_ALIAS* alias = FindEntry( aName ) )
if( LIB_ALIAS* alias = FindAlias( aName ) )
{
return alias->GetPart();
}
@ -481,7 +481,7 @@ bool PART_LIB::Load( wxString& aErrorMsg )
{
// Check for duplicate entry names and warn the user about
// the potential conflict.
if( FindEntry( part->GetName() ) != NULL )
if( FindAlias( part->GetName() ) != NULL )
{
wxLogWarning( DUPLICATE_NAME_MSG,
GetChars( fileName.GetName() ),
@ -513,7 +513,7 @@ void PART_LIB::LoadAliases( LIB_PART* aPart )
for( size_t i = 0; i < aPart->m_aliases.size(); i++ )
{
if( FindEntry( aPart->m_aliases[i]->GetName() ) != NULL )
if( FindAlias( aPart->m_aliases[i]->GetName() ) != NULL )
{
wxLogError( DUPLICATE_NAME_MSG,
GetChars( fileName.GetName() ),
@ -597,7 +597,7 @@ bool PART_LIB::LoadDocs( wxString& aErrorMsg )
wxString cmpname = FROM_UTF8( name );
entry = FindEntry( cmpname );
entry = FindAlias( cmpname );
while( GetLine( file, line, &lineNumber, sizeof(line) ) )
{
@ -868,7 +868,7 @@ LIB_ALIAS* PART_LIBS::FindLibraryEntry( const wxString& aEntryName, const wxStri
if( !!aLibraryName && lib.GetName() != aLibraryName )
continue;
entry = lib.FindEntry( aEntryName );
entry = lib.FindAlias( aEntryName );
if( entry )
break;

View File

@ -454,12 +454,12 @@ public:
bool Conflicts( LIB_PART* aPart );
/**
* Find entry by name.
* Find #LIB_ALIAS by \a aName.
*
* @param aName - Name of entry, case sensitive.
* @return Entry if found. NULL if not found.
* @return #LIB_ALIAS* if found. NULL if not found.
*/
LIB_ALIAS* FindEntry( const wxString& aName );
LIB_ALIAS* FindAlias( const wxString& aName );
/**
* Find part by \a aName.
@ -472,17 +472,6 @@ public:
*/
LIB_PART* FindPart( const wxString& aName );
/**
* Find alias by \a nName.
*
* @param aName - Name of alias, case sensitive.
* @return Alias if found. NULL if not found.
*/
LIB_ALIAS* FindAlias( const wxString& aName )
{
return (LIB_ALIAS*) FindEntry( aName );
}
/**
* Add a new \a aAlias entry to the library.
*

View File

@ -346,7 +346,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& event )
return;
}
if( library && library->FindEntry( aliasname ) != NULL )
if( library && library->FindAlias( aliasname ) != NULL )
{
wxString msg;
msg.Printf( _( "Alias or component name <%s> already exists in library <%s>." ),

View File

@ -80,7 +80,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
// If not already saved in the new cache, put it:
if( !libCache->FindEntry( component->GetPartName() ) )
if( !libCache->FindAlias( component->GetPartName() ) )
{
if( LIB_PART* part = libs->FindLibPart( component->GetPartName() ) )
{

View File

@ -150,7 +150,7 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event )
m_aliasName.Empty();
// Load the new library component
libEntry = lib->FindEntry( cmp_name );
libEntry = lib->FindAlias( cmp_name );
PART_LIB* searchLib = lib;
if( !libEntry )
@ -555,7 +555,7 @@ void LIB_EDIT_FRAME::DeleteOnePart( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL || dlg.GetStringSelection().IsEmpty() )
return;
libEntry = lib->FindEntry( dlg.GetStringSelection() );
libEntry = lib->FindAlias( dlg.GetStringSelection() );
if( !libEntry )
{
@ -643,7 +643,7 @@ void LIB_EDIT_FRAME::CreateNewLibraryPart( wxCommandEvent& event )
PART_LIB* lib = GetCurLib();
// Test if there a component with this name already.
if( lib && lib->FindEntry( name ) )
if( lib && lib->FindAlias( name ) )
{
wxString msg = wxString::Format( _(
"Part '%s' already exists in library '%s'" ),

View File

@ -85,7 +85,7 @@ void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
PART_LIB* lib = GetCurLib();
// Test the current library for name conflicts.
if( lib && lib->FindEntry( newFieldValue ) )
if( lib && lib->FindAlias( newFieldValue ) )
{
msg.Printf( _(
"The name '%s' conflicts with an existing entry in the component library '%s'.\n\n"
@ -140,7 +140,7 @@ void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
for( size_t i = 0; i < aliases.GetCount(); i++ )
{
if( lib->FindEntry( aliases[ i ] ) != NULL )
if( lib->FindAlias( aliases[ i ] ) != NULL )
parent->RemoveAlias( aliases[ i ] );
}
}

View File

@ -138,7 +138,7 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
if( part && part->HasConversion() )
asdeMorgan = true;
entry = lib->FindEntry( m_entryName );
entry = lib->FindAlias( m_entryName );
}
}

View File

@ -192,7 +192,7 @@ void LIB_VIEW_FRAME::SelectAndViewLibraryPart( int option )
return;
}
if( lib->FindEntry( m_entryName ) )
if( lib->FindAlias( m_entryName ) )
{
if( option == NEXT_PART )
ViewOneLibraryContent( lib, NEXT_PART );
@ -243,7 +243,7 @@ void LIB_VIEW_FRAME::ViewOneLibraryContent( PART_LIB* Lib, int Flag )
m_unit = 1;
m_convert = 1;
entry = Lib->FindEntry( CmpName );
entry = Lib->FindAlias( CmpName );
m_entryName = CmpName;
DisplayLibInfos();
Zoom_Automatique( false );