Loading eeschema/class_library.cpp +17 −11 Original line number Diff line number Diff line Loading @@ -229,14 +229,12 @@ bool CMP_LIBRARY::AddAlias( LIB_ALIAS* aAlias ) */ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent ) { wxASSERT( aComponent != NULL ); if( aComponent == NULL ) return NULL; LIB_COMPONENT* newCmp = new LIB_COMPONENT( *aComponent, this ); newCmp->ClearAliasDataDoc(); // Remove data used only in edition if( newCmp == NULL ) return NULL; // Conflict detection: See if already existing aliases exist, // and if yes, ask user for continue or abort // Special case: if the library is the library cache of the project, Loading @@ -252,13 +250,15 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent ) if( alias == NULL ) continue; LIB_COMPONENT* cparent = alias->GetComponent(); if( alias->GetComponent()->GetName().CmpNoCase( newCmp->GetName() ) != 0 ) if( cparent == NULL || // Lib error, should not occurs ( cparent->GetName().CmpNoCase( newCmp->GetName() ) != 0 ) ) { wxString msg1; msg1.Printf( _("alias <%s> already exists and has root name<%s>"), GetChars( alias->GetName() ), GetChars( alias->GetComponent()->GetName() ) ); GetChars( cparent ? cparent->GetName() : _("unknown") ) ); msg << msg1 << wxT("\n"); conflict_count++; } Loading Loading @@ -292,13 +292,19 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent ) alias = new LIB_ALIAS( aliasname, newCmp ); entries.push_back( alias ); } else if( alias->GetComponent()->GetName().CmpNoCase( newCmp->GetName() ) != 0 ) else { LIB_COMPONENT* cparent = alias->GetComponent(); if( cparent == NULL || // Lib error, should not occurs ( cparent->GetName().CmpNoCase( newCmp->GetName() ) != 0) ) { // Remove alias from library and alias list of its root component RemoveEntry( alias ); alias = new LIB_ALIAS( aliasname, newCmp ); entries.push_back( alias ); } } // Update alias data: alias->SetDescription( aComponent->GetAliasDataDoc( aliasname ) ); alias->SetKeyWords( aComponent->GetAliasDataKeyWords( aliasname ) ); Loading eeschema/libarch.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -43,12 +43,16 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName ) continue; SCH_COMPONENT* component = (SCH_COMPONENT*) SchItem; // If not already saved in the new cache, put it: if( libCache->FindEntry( component->m_ChipName) == NULL ) { Entry = CMP_LIBRARY::FindLibraryComponent( component->m_ChipName ); if( Entry ) // if NULL : component not found if( Entry ) // if NULL : component not found, cannot be stored libCache->AddComponent( Entry ); } } } if( !libCache->Save( ArchFullFileName ) ) { Loading Loading
eeschema/class_library.cpp +17 −11 Original line number Diff line number Diff line Loading @@ -229,14 +229,12 @@ bool CMP_LIBRARY::AddAlias( LIB_ALIAS* aAlias ) */ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent ) { wxASSERT( aComponent != NULL ); if( aComponent == NULL ) return NULL; LIB_COMPONENT* newCmp = new LIB_COMPONENT( *aComponent, this ); newCmp->ClearAliasDataDoc(); // Remove data used only in edition if( newCmp == NULL ) return NULL; // Conflict detection: See if already existing aliases exist, // and if yes, ask user for continue or abort // Special case: if the library is the library cache of the project, Loading @@ -252,13 +250,15 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent ) if( alias == NULL ) continue; LIB_COMPONENT* cparent = alias->GetComponent(); if( alias->GetComponent()->GetName().CmpNoCase( newCmp->GetName() ) != 0 ) if( cparent == NULL || // Lib error, should not occurs ( cparent->GetName().CmpNoCase( newCmp->GetName() ) != 0 ) ) { wxString msg1; msg1.Printf( _("alias <%s> already exists and has root name<%s>"), GetChars( alias->GetName() ), GetChars( alias->GetComponent()->GetName() ) ); GetChars( cparent ? cparent->GetName() : _("unknown") ) ); msg << msg1 << wxT("\n"); conflict_count++; } Loading Loading @@ -292,13 +292,19 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* aComponent ) alias = new LIB_ALIAS( aliasname, newCmp ); entries.push_back( alias ); } else if( alias->GetComponent()->GetName().CmpNoCase( newCmp->GetName() ) != 0 ) else { LIB_COMPONENT* cparent = alias->GetComponent(); if( cparent == NULL || // Lib error, should not occurs ( cparent->GetName().CmpNoCase( newCmp->GetName() ) != 0) ) { // Remove alias from library and alias list of its root component RemoveEntry( alias ); alias = new LIB_ALIAS( aliasname, newCmp ); entries.push_back( alias ); } } // Update alias data: alias->SetDescription( aComponent->GetAliasDataDoc( aliasname ) ); alias->SetKeyWords( aComponent->GetAliasDataKeyWords( aliasname ) ); Loading
eeschema/libarch.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -43,12 +43,16 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName ) continue; SCH_COMPONENT* component = (SCH_COMPONENT*) SchItem; // If not already saved in the new cache, put it: if( libCache->FindEntry( component->m_ChipName) == NULL ) { Entry = CMP_LIBRARY::FindLibraryComponent( component->m_ChipName ); if( Entry ) // if NULL : component not found if( Entry ) // if NULL : component not found, cannot be stored libCache->AddComponent( Entry ); } } } if( !libCache->Save( ArchFullFileName ) ) { Loading