Commit ab74cfed authored by stambaughw's avatar stambaughw
Browse files

Component library object improvements.

Moved all library entry manipulation code scattered throughout EESchema into
the component library object itself.  Adding, removing, and searching is now
handled by the library object.  This is the precursor to replacing the current
priority queue code.
parent 4a9dffc3
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -72,10 +72,10 @@ void ReAnnotatePowerSymbolsOnly( void )
        {
            if( DrawList->Type() != TYPE_SCH_COMPONENT )
                continue;
            SCH_COMPONENT*          DrawLibItem =
                (SCH_COMPONENT*) DrawList;
            EDA_LibComponentStruct* Entry = FindLibPart(
                DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
            SCH_COMPONENT*          DrawLibItem = (SCH_COMPONENT*) DrawList;
            EDA_LibComponentStruct* Entry =
                ( EDA_LibComponentStruct* )FindLibPart( DrawLibItem->m_ChipName );

            if( (Entry == NULL) || (Entry->m_Options != ENTRY_POWER) )
                continue;

@@ -354,9 +354,7 @@ int AddComponentsInSheetToList( std::vector <OBJ_CMP_TO_LIST>& aComponentsList,
        if( DrawList->Type() == TYPE_SCH_COMPONENT )
        {
            DrawLibItem = (SCH_COMPONENT*) DrawList;
            Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(),
                                 wxEmptyString,
                                 FIND_ROOT );
            Entry = ( EDA_LibComponentStruct* )FindLibPart( DrawLibItem->m_ChipName );
            if( Entry == NULL )
                continue;

+5 −3
Original line number Diff line number Diff line
@@ -869,10 +869,12 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
    if( aDrawLibItem )
    {
        NextItem = NULL;
        if( ( Entry =
                 FindLibPart( aDrawLibItem->m_ChipName.GetData(), wxEmptyString,
                              FIND_ROOT ) ) == NULL )
        Entry =
            ( EDA_LibComponentStruct* )FindLibPart( aDrawLibItem->m_ChipName );

        if( Entry == NULL )
            return NULL;

        DEntry      = Entry->m_Drawings;
        Multi       = aDrawLibItem->m_Multi;
        convert     = aDrawLibItem->m_Convert;
+1 −1
Original line number Diff line number Diff line
@@ -512,7 +512,7 @@ void CopyMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
        if( item->m_Selected == 0 )
            continue;
        item->m_Selected = 0;
        LibEDA_BaseStruct* newitem = CopyDrawEntryStruct( NULL, item );
        LibEDA_BaseStruct* newitem = CopyDrawEntryStruct( item );
        newitem->m_Selected = IS_SELECTED;
        newitem->SetNext( LibEntry->m_Drawings );
        LibEntry->m_Drawings = newitem;
+2 −2
Original line number Diff line number Diff line
@@ -649,7 +649,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByRef(

        Multi = 0;
        Unit  = ' ';
        Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
        Entry = ( EDA_LibComponentStruct* ) FindLibPart( DrawLibItem->m_ChipName );
        if( Entry )
            Multi = Entry->m_UnitCount;

@@ -749,7 +749,7 @@ int DIALOG_BUILD_BOM::PrintComponentsListByVal(

        Multi = 0;
        Unit  = ' ';
        Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
        Entry = ( EDA_LibComponentStruct* ) FindLibPart( DrawLibItem->m_ChipName );
        if( Entry )
            Multi = Entry->m_UnitCount;

+18 −1
Original line number Diff line number Diff line
@@ -168,12 +168,29 @@ LibCmpEntry::LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName ) :
}


/******************************/
LibCmpEntry::~LibCmpEntry()
{
}


bool LibCmpEntry::operator==( const wxChar* name ) const
{
    return m_Name.m_Text.CmpNoCase( name ) == 0;
}


bool operator<( LibCmpEntry& item1, LibCmpEntry& item2 )
{
    return item1.m_Name.m_Text.CmpNoCase( item2.m_Name.m_Text ) == -1;
}


int LibraryEntryCompare( LibCmpEntry* LE1, LibCmpEntry* LE2 )
{
    return LE1->m_Name.m_Text.CmpNoCase( LE2->m_Name.m_Text );
}


/*******************************/
/* class EDA_LibCmpAliasStruct */
/*******************************/
Loading