Commit ab74cfed authored by stambaughw's avatar stambaughw

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
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 */
/*******************************/
......
......@@ -10,6 +10,9 @@
#include "classes_body_items.h"
#include "class_libentry_fields.h"
#include <boost/ptr_container/ptr_vector.hpp>
/* Types for components in libraries
* components can be a true component or an alias of a true component.
*/
......@@ -52,16 +55,32 @@ public:
/**
* Writes the doc info out to a FILE in "*.dcm" format.
* Write the entry document information to a FILE in "*.dcm" format.
*
* @param aFile The FILE to write to.
*
* @return bool - true if success writing else false.
*/
bool SaveDoc( FILE* aFile );
/**
* Case insensitive comparison of the component entry name.
*/
bool operator==( const wxChar* name ) const;
bool operator!=( const wxChar* name ) const
{
return !( *this == name );
}
};
typedef boost::ptr_vector< LibCmpEntry > LIB_ENTRY_LIST;
extern bool operator<( LibCmpEntry& item1, LibCmpEntry& item2 );
extern int LibraryEntryCompare( LibCmpEntry* LE1, LibCmpEntry* LE2 );
/**
* Library component object definition.
*
......
This diff is collapsed.
/**********************************/
/* Headers fo library definition */
/**********************************/
/***********************************/
/* Headers for library definition */
/***********************************/
#ifndef CLASS_LIBRARY_H
#define CLASS_LIBRARY_H
......@@ -8,11 +8,9 @@
#include "class_libentry.h"
WX_DECLARE_LIST( EDA_LibComponentStruct, LIB_CMP_LIST );
/******************************/
/* Classe to handle a library */
/* Class to handle a library */
/******************************/
class LibraryStruct
......@@ -23,7 +21,6 @@ public:
wxString m_FullFileName; /* Full File Name (with path) of library. */
wxString m_Header; /* first line of loaded library. */
int m_NumOfParts; /* Number of parts this library has. */
PriorQue* m_Entries; /* Parts themselves are saved here. */
LibraryStruct* m_Pnext; /* Point on next lib in chain. */
int m_Modified; /* flag indicateur d'edition */
int m_Size; // Size in bytes (for statistics)
......@@ -37,25 +34,152 @@ public:
~LibraryStruct();
/**
* Function SaveLibrary
* writes the data structures for this object out to 2 file
* the library in "*.lib" format.
* the doc file in "*.dcm" format.
* creates a backup file for each file (.bak and .bck)
* @param aFullFileName The full lib filename.
* Save library to file.
*
* Two files are created. The component objects are save as component
* library (*.lib) files. The alias objects are save as document
* definition (*.dcm) files. If the component library already exists,
* it is backup up in file *.bak. If the document definition file
* already exists, it is backed up in file *.bck.
*
* @param aFullFileName - The library filename with path.
*
* @return bool - true if success writing else false.
*/
bool SaveLibrary( const wxString& aFullFileName );
bool ReadHeader( FILE* file, int* LineNum );
bool Load( wxString& errMsg );
void InsertAliases( PriorQue** PQ, EDA_LibComponentStruct* component );
private:
bool WriteHeader( FILE* file );
/* NOTE: For future expansion, do not delete. */
public:
LibraryStruct( const wxChar* fileName = NULL );
/**
* Get library entry status.
*
* @return true if there are no entries in the library.
*/
bool IsEmpty()
{
return m_Entries == NULL;
}
/**
* Load a string array with the names of all the entries in this library.
*
* @param names - String array to place entry names into.
* @param sort - Sort names if true.
*/
void GetEntryNames( wxArrayString& names, bool sort = true );
/**
* Load string array with entry names matching name and/or key word.
*
* This currently mimics the old behavior of calling KeyWordOk() and
* WildCompareString(). The names array will be populated with the
* library entry names that meat the search criteria on exit.
*
* @todo Convert the search functions to use regular expressions which
* should give better search capability.
*
* @param names - String array to place entry names into.
* @parem nameSearch - Name wild card search criteria.
* @param keySearch - Key word search criteria.
* @param sort - Sort names if true.
*/
void SearchEntryNames( wxArrayString& names,
const wxString& nameSearch = wxEmptyString,
const wxString& keySearch = wxEmptyString,
bool sort = true );
/**
* Find entry by name.
*
* @param name - Name of entry, case insensitive.
*
* @return Pointer to entry if found. NULL if not found.
*/
LibCmpEntry* FindEntry( const wxChar* name );
/**
* Find entry by name and type.
*
* If the search type is an alias, the return entry can be either an
* alias or a component object. If the search type is a component
* (root) type, the object returned will be a component. This was
* done to emulate the old search pattern.
*
* @param name - Name of entry, case insensitive.
* @param type - Type of entry, root or alias.
*
* @return Pointer to entry if found. NULL if not found.
*/
LibCmpEntry* FindEntry( const wxChar* name, LibrEntryType type );
/**
* Add component entry to library.
*
* @param cmp - Component to add.
*
* @return Pointer to added component if successful.
*/
EDA_LibComponentStruct* AddComponent( EDA_LibComponentStruct* cmp );
/**
* Remove an entry from the library.
*
* If the entry is an alias, the alias is removed from the library and from
* the alias list of the root component. If the entry is a root component
* with no aliases, it is removed from the library. If the entry is a root
* component with aliases, the root component is renamed to the name of
* the first alias and the root name for all remaining aliases are updated
* to reflect the new root name.
*
* @param entry - Entry to remove from library.
*/
void RemoveEntry( LibCmpEntry* entry );
/**
* Return the first entry in the library.
*
* @return The first entry or NULL if the library has no entries.
*/
LibCmpEntry* GetFirstEntry()
{
return (LibCmpEntry*) PQFirst( &m_Entries, false );
}
/**
* Find next library entry by name.
*
* If the name of the entry is the last entry in the library, the first
* entry in the list is returned.
*
* @param name - Name of current entry.
*
* @return LibCmpEntry - Pointer to next entry if entry name is found.
* Otherwise NULL.
*/
LibCmpEntry* GetNextEntry( const wxChar* name );
/**
* Find previous library entry by name.
*
* If the name of the entry is the first entry in the library, the last
* entry in the list is returned.
*
* @param name - Name of current entry.
*
* @return LibCmpEntry - Pointer to previous entry if entry name is found.
* Otherwise NULL.
*/
LibCmpEntry* GetPreviousEntry( const wxChar* name );
bool Save( const wxString& saveAsFile );
wxString GetName();
......@@ -64,9 +188,19 @@ protected:
wxFileName m_fileName; /* Library file name. */
wxDateTime m_DateTime; /* Library save time and date. */
wxString m_Version; /* Library save version. */
LIB_CMP_LIST m_componentList; /* List of components in this library. */
PriorQue* m_Entries; /* Parts themselves are saved here. */
friend class EDA_LibComponentStruct;
};
extern void FreeLibraryEntry( LibCmpEntry* Entry );
/**
* Case insensitive library name comparison.
*/
extern bool operator==( const LibraryStruct& lib, const wxChar* name );
extern bool operator!=( const LibraryStruct& lib, const wxChar* name );
#endif // CLASS_LIBRARY_H
......@@ -424,8 +424,7 @@ void SCH_CMP_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
m_AddExtraText = 0;
if( fieldNdx == REFERENCE )
{
Entry = FindLibPart( component->m_ChipName.GetData(), wxEmptyString,
FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( component->m_ChipName );
if( Entry != NULL )
{
if( Entry->m_UnitCount > 1 )
......
......@@ -211,8 +211,9 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int ii;
bool dummy = FALSE;
if( ( Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString,
FIND_ROOT ) ) == NULL )
Entry = ( EDA_LibComponentStruct* ) FindLibPart( m_ChipName );
if( Entry == NULL )
{
/* composant non trouve, on affiche un composant "dummy" */
dummy = TRUE;
......@@ -518,8 +519,8 @@ void SCH_COMPONENT::AddField( const SCH_CMP_FIELD& aField )
EDA_Rect SCH_COMPONENT::GetBoundaryBox() const
{
EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(),
wxEmptyString, FIND_ROOT );
EDA_LibComponentStruct* Entry =
( EDA_LibComponentStruct* ) FindLibPart( m_ChipName );
EDA_Rect BoundaryBox;
int x0, xm, y0, ym;
......@@ -634,7 +635,7 @@ void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
wxString separators( wxT( " " ) );
wxArrayString reference_fields;
Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( m_ChipName );
if( Entry && Entry->m_UnitSelectionLocked )
KeepMulti = true;
......@@ -1058,8 +1059,8 @@ EDA_Rect SCH_COMPONENT::GetBoundingBox()
void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame )
{
EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(),
wxEmptyString, FIND_ROOT );
EDA_LibComponentStruct* Entry =
( EDA_LibComponentStruct* ) FindLibPart( m_ChipName );
wxString msg;
......
......@@ -388,7 +388,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
#undef STRUCT
#define STRUCT ( (SCH_COMPONENT*) DrawItem )
EDA_LibComponentStruct* Entry;
Entry = FindLibPart( STRUCT->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( STRUCT->m_ChipName );
if( Entry == NULL )
break;
......
......@@ -19,16 +19,6 @@
#include "protos.h"
/* Routines locales */
/* Variables locales */
/********************************************************************************/
bool DataBaseGetName( WinEDA_DrawFrame* frame,
wxString& Keys, wxString& BufName )
/********************************************************************************/
/*
* Routine de selection du nom d'un composant en librairie pour chargement,
* Keys pointe la liste des mots cles de filtrage
......@@ -41,103 +31,59 @@ bool DataBaseGetName( WinEDA_DrawFrame* frame,
* place le nom du composant a charger, selectionne a partir d'une liste dans
* BufName
*/
wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys,
wxString& BufName )
{
int ii;
EDA_LibComponentStruct* LibEntry;
LibraryStruct* Lib;
WinEDAListBox* ListBox;
const wxChar** ListNames;
wxArrayString nameList;
wxString msg;
BufName.MakeUpper();
Keys.MakeUpper();
/* Examen de la liste des librairies pour comptage */
for( Lib = g_LibraryList, ii = 0; Lib != NULL; Lib = Lib->m_Pnext )
{
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Lib->m_Entries, FALSE );
while( LibEntry )
{
if( !Keys.IsEmpty() )
{
if( KeyWordOk( Keys, LibEntry->m_KeyWord ) )
ii++;
}
else
{
if( WildCompareString( BufName, LibEntry->m_Name.m_Text, FALSE ) )
ii++;
}
LibEntry = (EDA_LibComponentStruct*) PQNext( Lib->m_Entries,
LibEntry,
NULL );
}
}
if( ii == 0 )
for( Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext )
{
DisplayError( frame, _( "No Component found" ) );
return 0;
Lib->SearchEntryNames( nameList, BufName, Keys );
}
ListNames = (const wxChar**) MyZMalloc( (ii + 1) * sizeof(const wxChar*) );
for( Lib = g_LibraryList, ii = 0; Lib != NULL; Lib = Lib->m_Pnext )
if( nameList.IsEmpty() )
{
/* Examen de la liste des elements */
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Lib->m_Entries, FALSE );
while( LibEntry )
msg = _( "No components found matching " );
if( !BufName.IsEmpty() )
{
msg += _( "name search criteria <" ) + BufName + wxT( "> " );
if( !Keys.IsEmpty() )
{
if( KeyWordOk( Keys, LibEntry->m_KeyWord ) )
{
ListNames[ii] = LibEntry->m_Name.m_Text.GetData(); ii++;
}
}
else if( WildCompareString( BufName, LibEntry->m_Name.m_Text,
FALSE ) )
{
ListNames[ii] = LibEntry->m_Name.m_Text; ii++;
}
LibEntry = (EDA_LibComponentStruct*) PQNext( Lib->m_Entries,
LibEntry,
NULL );
}
msg += _( "and " );
}
ListBox = new WinEDAListBox( frame, _( "Selection" ), ListNames,
wxEmptyString, DisplayCmpDoc,
wxColour( 200, 200, 255 ) );
ListBox->MoveMouseToOrigin();
if( !Keys.IsEmpty() )
msg += _( "key search criteria <" ) + Keys + wxT( "> " );
/* Affichage de la liste selectionnee */
if( ii )
{
ii = ListBox->ShowModal(); ListBox->Destroy();
if( ii < 0 )
ii = 0;
else
{
BufName = ListNames[ii];
ii = 1;
}
DisplayError( frame, msg );
return wxEmptyString;
}
wxSingleChoiceDialog dlg( frame, wxEmptyString, _( "Select Component" ),
nameList );
if( dlg.ShowModal() == wxID_CANCEL || dlg.GetStringSelection().IsEmpty() )
return wxEmptyString;
free( ListNames );
return ii;
return dlg.GetStringSelection();
}
/**********************************/
void DisplayCmpDoc( wxString& Name )
/**********************************/
{
LibCmpEntry* CmpEntry;
CmpEntry = FindLibPart( Name.GetData(), wxEmptyString, FIND_ALIAS );
CmpEntry = FindLibPart( Name, wxEmptyString, ALIAS );
if( CmpEntry == NULL )
return;
Name = wxT( "Descr: " ) + CmpEntry->m_Doc;
Name += wxT( "\nKeyW: " ) + CmpEntry->m_KeyWord;
Name = wxT( "Description: " ) + CmpEntry->m_Doc;
Name += wxT( "\nKey Words: " ) + CmpEntry->m_KeyWord;
}
......@@ -171,7 +171,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
else if( newname.CmpNoCase( m_Cmp->m_ChipName ) )
{
if( FindLibPart( newname.GetData(), wxEmptyString, FIND_ALIAS ) == NULL )
if( FindLibPart( newname, wxEmptyString, ALIAS ) == NULL )
{
wxString message;
message.Printf( _( "Component [%s] not found!" ), newname.GetData() );
......@@ -263,8 +263,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
++i;
}
EDA_LibComponentStruct* entry = FindLibPart(
m_Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
EDA_LibComponentStruct* entry =
( EDA_LibComponentStruct* ) FindLibPart( m_Cmp->m_ChipName );
if( entry && entry->m_Options == ENTRY_POWER )
m_FieldsBuf[VALUE].m_Text = m_Cmp->m_ChipName;
......@@ -411,7 +411,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
{
m_Cmp = aComponent;
m_LibEntry = FindLibPart( m_Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
m_LibEntry = ( EDA_LibComponentStruct* ) FindLibPart( m_Cmp->m_ChipName );
#if 0 && defined(DEBUG)
for( int i = 0; i<aComponent->GetFieldCount(); ++i )
......@@ -705,7 +705,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
if( m_Cmp == NULL )
return;
entry = FindLibPart( m_Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
entry = ( EDA_LibComponentStruct* ) FindLibPart( m_Cmp->m_ChipName );
if( entry == NULL )
return;
......
......@@ -452,7 +452,7 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::ChangeNbUnitsPerPackage( int MaxUnit )
{
for( ii = OldNumUnits + 1; ii <= MaxUnit; ii++ )
{
NextDrawItem = CopyDrawEntryStruct( this, DrawItem );
NextDrawItem = CopyDrawEntryStruct( DrawItem );
NextDrawItem->SetNext( CurrentLibEntry->m_Drawings );
CurrentLibEntry->m_Drawings = NextDrawItem;
NextDrawItem->m_Unit = ii;
......@@ -499,7 +499,7 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert()
g_AsDeMorgan = 0; return FALSE;
}
}
NextDrawItem = CopyDrawEntryStruct( this, DrawItem );
NextDrawItem = CopyDrawEntryStruct( DrawItem );
NextDrawItem->SetNext( CurrentLibEntry->m_Drawings );
CurrentLibEntry->m_Drawings = NextDrawItem;
NextDrawItem->m_Convert = 2;
......
......@@ -68,7 +68,8 @@ void WinEDA_SchematicFrame::StartMoveCmpField( SCH_CMP_FIELD* aField, wxDC* DC )
m_Multiflag = 0;
if( aField->m_FieldId == REFERENCE )
{
Entry = FindLibPart( comp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( comp->m_ChipName );
if( Entry != NULL )
{
if( Entry->m_UnitCount > 1 )
......@@ -103,7 +104,8 @@ void WinEDA_SchematicFrame::EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC )
fieldNdx = Field->m_FieldId;
if( fieldNdx == VALUE )
{
Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Cmp->m_ChipName );
if( Entry && (Entry->m_Options == ENTRY_POWER) )
{
DisplayInfoMessage( this,
......@@ -117,7 +119,8 @@ void WinEDA_SchematicFrame::EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC )
flag = 0;
if( fieldNdx == REFERENCE )
{
Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Cmp->m_ChipName );
if( Entry != NULL )
{
if( Entry->m_UnitCount > 1 )
......@@ -259,8 +262,8 @@ void WinEDA_SchematicFrame::RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC )
flag = 0;
if( fieldNdx == REFERENCE )
{
Entry = FindLibPart( ( (SCH_COMPONENT*) Field->GetParent() )->m_ChipName.GetData(),
wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( ( (SCH_COMPONENT*) Field->GetParent() )->m_ChipName );
if( Entry != NULL )
{
if( Entry->m_UnitCount > 1 )
......@@ -296,7 +299,8 @@ void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC
if( Cmp == NULL )
return;
Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Cmp->m_ChipName );
if( Entry == NULL )
return;
......@@ -335,7 +339,8 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
if( Cmp == NULL )
return;
Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Cmp->m_ChipName );
if( Entry == NULL )
return;
......@@ -373,7 +378,8 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC
if( Cmp == NULL )
return;
Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Cmp->m_ChipName );
if( Entry == NULL )
return;
......
......@@ -164,23 +164,12 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
* Alias = FIND_ROOT, ou Alias = FIND_ALIAS
*/
/*****************************************************************************/
EDA_LibComponentStruct* FindLibPart( const wxChar* Name,
const wxString& LibName,
int Alias )
LibCmpEntry* FindLibPart( const wxChar* Name, const wxString& LibName,
LibrEntryType type )
{
EDA_LibComponentStruct* Entry;
/* Used only to call PQFind. */
static EDA_LibComponentStruct DummyEntry( wxEmptyString );
LibCmpEntry* Entry = NULL;
LibraryStruct* Lib = g_LibraryList;
DummyEntry.m_Drawings = NULL; /* Used only to call PQFind. */
DummyEntry.m_Name.m_Text = Name;
PQCompFunc( (PQCompFuncType) LibraryEntryCompare );
Entry = NULL;
FindLibName.Empty();
while( Lib )
......@@ -197,7 +186,8 @@ EDA_LibComponentStruct* FindLibPart( const wxChar* Name,
if( Lib == NULL )
break;
Entry = (EDA_LibComponentStruct*) PQFind( Lib->m_Entries, &DummyEntry );
Entry = Lib->FindEntry( Name, type );
if( Entry != NULL )
{
FindLibName = Lib->m_Name;
......@@ -207,15 +197,6 @@ EDA_LibComponentStruct* FindLibPart( const wxChar* Name,
Lib = Lib->m_Pnext;
}
/* Si le nom est un alias, recherche du vrai composant */
if( Entry )
{
if( (Entry->Type != ROOT ) && (Alias == FIND_ROOT) )
Entry = FindLibPart(
( (EDA_LibCmpAliasStruct*) Entry )->m_RootName.GetData(),
Lib->m_Name, FIND_ROOT );
}
return Entry;
}
......
......@@ -17,14 +17,6 @@
#include "dialog_load_error.h"
/* Local Functions */
static void InsertAlias( PriorQue** PQ, EDA_LibComponentStruct* LibEntry,
int* NumOfParts );
// If this code was written in C++ then this would not be needed.
static wxString currentLibraryName;
/****************************************************************************/
......@@ -39,40 +31,24 @@ LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame,
const wxString& FullLibName,
const wxString& LibName )
{
int NumOfParts;
FILE* f;
LibraryStruct* NewLib;
PriorQue* Entries;
wxFileName fn;
wxString errMsg;
if( ( NewLib = FindLibrary( LibName ) ) != NULL )
{
if( NewLib->m_FullFileName == FullLibName )
return NewLib;
FreeCmpLibrary( frame, LibName );
}
NewLib = NULL;
f = wxFopen( FullLibName, wxT( "rt" ) );
if( f == NULL )
{
wxString msg;
msg.Printf( _( "Library <%s> not found" ), FullLibName.GetData() );
DisplayError( frame, msg );
return NULL;
delete NewLib;
}
currentLibraryName = FullLibName;
NewLib = new LibraryStruct( LIBRARY_TYPE_EESCHEMA, LibName, FullLibName );
Entries = LoadLibraryAux( frame, NewLib, f, &NumOfParts );
if( Entries != NULL )
{
NewLib->m_Entries = Entries;
NewLib->m_NumOfParts = NumOfParts;
wxBusyCursor ShowWait;
if( NewLib->Load( errMsg ) )
{
if( g_LibraryList == NULL )
g_LibraryList = NewLib;
else
......@@ -90,9 +66,15 @@ LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame,
}
else
{
wxString msg;
msg.Printf( _( "Error <%s> occurred attempting to load component \
library <%s>" ),
( const wxChar* ) errMsg,
( const wxChar* ) FullLibName );
DisplayError( frame, msg );
SAFE_DELETE( NewLib );
}
fclose( f );
return NewLib;
}
......@@ -276,84 +258,6 @@ int LibraryEntryCompare( EDA_LibComponentStruct* LE1,
}
/**************************************************/
/* Routine to load a library from given open file */
/**************************************************/
PriorQue* LoadLibraryAux( WinEDA_DrawFrame* frame, LibraryStruct* Library,
FILE* libfile, int* NumOfParts )
{
int LineNum = 0;
char Line[1024];
PriorQue* PQ = NULL;
EDA_LibComponentStruct* LibEntry;
wxString msg;
wxBusyCursor ShowWait; // Display a Busy Cursor..
*NumOfParts = 0;
if( GetLine( libfile, Line, &LineNum, sizeof(Line) ) == NULL )
{
msg.Printf( _( "File <%s> is empty!" ),
(const wxChar*) Library->m_Name );
DisplayError( frame, msg );
return NULL;
}
if( strnicmp( Line, LIBFILE_IDENT, 10 ) != 0 )
{
msg.Printf( _( "File <%s> is NOT an EESCHEMA library!" ),
(const wxChar*) Library->m_Name );
DisplayError( frame, msg );
return NULL;
}
if( Library )
Library->m_Header = CONV_FROM_UTF8( Line );
PQInit( &PQ );
PQCompFunc( (PQCompFuncType) LibraryEntryCompare );
while( GetLine( libfile, Line, &LineNum, sizeof(Line) ) )
{
if( strnicmp( Line, "$HEADER", 7 ) == 0 )
{
if( Library && !Library->ReadHeader( libfile, &LineNum ) )
{
msg.Printf( _( "Library <%s> header read error" ),
(const wxChar*) Library->m_Name );
DisplayError( frame, msg, 30 );
}
continue;
}
if( strnicmp( Line, "DEF", 3 ) == 0 )
{
/* Read one DEF/ENDDEF part entry from library: */
LibEntry = new EDA_LibComponentStruct( NULL );
if( LibEntry->Load( libfile, Line, &LineNum, msg ) )
{
/* If we are here, this part is O.k. - put it in: */
++*NumOfParts;
PQInsert( &PQ, LibEntry );
InsertAlias( &PQ, LibEntry, NumOfParts );
}
else
{
wxLogWarning( _( "Library <%s> component load error %s." ),
(const wxChar*) Library->m_Name,
(const wxChar*) msg );
msg.Clear();
delete LibEntry;
}
}
}
return PQ;
}
/*****************************************************************************
* Routine to find the library given its name. *
*****************************************************************************/
......@@ -363,7 +267,7 @@ LibraryStruct* FindLibrary( const wxString& Name )
while( Lib )
{
if( Lib->m_Name == Name )
if( *Lib == Name )
return Lib;
Lib = Lib->m_Pnext;
}
......@@ -387,27 +291,6 @@ int NumOfLibraries()
}
/********************************************************************/
/* create in library (in list PQ) aliases of the "root" component LibEntry*/
/********************************************************************/
static void InsertAlias( PriorQue** PQ, EDA_LibComponentStruct* LibEntry,
int* NumOfParts )
{
EDA_LibCmpAliasStruct* AliasEntry;
unsigned ii;
for( ii = 0; ii < LibEntry->m_AliasList.GetCount(); ii++ )
{
AliasEntry =
new EDA_LibCmpAliasStruct( LibEntry->m_AliasList[ii],
LibEntry->m_Name.m_Text.GetData() );
++*NumOfParts;
PQInsert( PQ, AliasEntry );
}
}
/*******************************************************/
/* Routines de lecture des Documentation de composants */
/*******************************************************/
......@@ -418,7 +301,7 @@ int LoadDocLib( WinEDA_DrawFrame* frame, const wxString& FullDocLibName,
{
int LineNum = 0;
char Line[1024], * Name, * Text;
EDA_LibComponentStruct* Entry;
LibCmpEntry* Entry;
FILE* f;
wxString msg;
......@@ -455,7 +338,8 @@ int LoadDocLib( WinEDA_DrawFrame* frame, const wxString& FullDocLibName,
Name = strtok( Line + 5, "\n\r" );
wxString cmpname;
cmpname = CONV_FROM_UTF8( Name );
Entry = FindLibPart( cmpname.GetData(), Libname, FIND_ALIAS );
Entry = FindLibPart( cmpname, Libname, ALIAS );
while( GetLine( f, Line, &LineNum, sizeof(Line) ) )
{
if( strncmp( Line, "$ENDCMP", 7 ) == 0 )
......
......@@ -259,8 +259,8 @@ void DrawStructsInGhost( WinEDA_DrawPanel * aPanel, wxDC * aDC, SCH_ITEM * aItem
EDA_LibComponentStruct* LibEntry;
SCH_COMPONENT* Struct;
Struct = (SCH_COMPONENT*) aItem;
LibEntry = FindLibPart( Struct->m_ChipName.GetData(), wxEmptyString,
FIND_ROOT );
LibEntry = ( EDA_LibComponentStruct* ) FindLibPart( Struct->m_ChipName );
if( LibEntry == NULL )
break;
DrawingLibInGhost( aPanel, aDC, LibEntry, Struct, Struct->m_Pos.x + aOffset.x,
......
......@@ -624,51 +624,54 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
}
/*************************************************************/
void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event )
/*************************************************************/
/* Search for a given component.
* The serach is made in loaded libraries,
* and if not found in all libraries found in lib paths.
/*
* Search for a given component.
*
* The search is made in loaded libraries, and if not found in all libraries
* found in lib paths.
*/
void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event )
{
wxArrayString nameList;
wxString Text, FindList;
EDA_LibComponentStruct* LibEntry;
bool FoundInLib = FALSE; // True si reference trouvee ailleurs qu'en cache
bool FoundInLib = false;
Text = m_NewTextCtrl->GetValue();
if( Text.IsEmpty() )
{
Close(); return;
Close();
return;
}
s_OldStringFound = Text;
if( NumOfLibraries() == 0 )
{
DisplayError( this, _( "No libraries are loaded" ) );
Close(); return;
Close();
return;
}
int nbitemsFound = 0;
for( LibraryStruct* Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext )
{
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Lib->m_Entries, FALSE );
while( LibEntry )
{
if( WildCompareString( Text, LibEntry->m_Name.m_Text, FALSE ) )
{
nbitemsFound++;
Lib->SearchEntryNames( nameList, Text );
if( nameList.IsEmpty() )
continue;
nbitemsFound += nameList.GetCount();
if( !Lib->m_IsLibCache )
FoundInLib = TRUE;
FoundInLib = true;
for( size_t i = 0; i < nameList.GetCount(); i++ )
{
if( !FindList.IsEmpty() )
FindList += wxT( "\n" );
FindList << _( "Found " )
+ LibEntry->m_Name.m_Text
+ _( " in lib " ) + Lib->m_Name;
}
LibEntry = (EDA_LibComponentStruct*) PQNext( Lib->m_Entries, LibEntry, NULL );
FindList << _( "Found " ) + nameList[i] + _( " in library " )
+ Lib->m_Name;
}
}
......@@ -690,7 +693,9 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event )
}
}
else
{
DisplayInfoMessage( this, FindList );
}
Close();
}
......
......@@ -83,7 +83,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
Library = g_LibraryList;
while( Library )
{
if( Library->m_Name == libname )
if( Library->GetName().CmpNoCase( libname ) == 0 )
{
CmpCount = Library->m_NumOfParts;
break;
......@@ -118,7 +118,8 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
{
AllowWildSeach = FALSE;
keys = Name.AfterFirst( '=' );
if( DataBaseGetName( this, keys, Name ) == 0 )
Name = DataBaseGetName( this, keys, Name );
if( Name.IsEmpty() )
{
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema();
......@@ -138,7 +139,8 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
else if( Name.Contains( wxT( "?" ) ) || Name.Contains( wxT( "*" ) ) )
{
AllowWildSeach = FALSE;
if( DataBaseGetName( this, keys, Name ) == 0 )
Name = DataBaseGetName( this, keys, Name );
if( Name.IsEmpty() )
{
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema();
......@@ -146,14 +148,18 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
}
}
Entry = FindLibPart( Name.GetData(), libname, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Name, libname );
if( (Entry == NULL) && AllowWildSeach ) /* Attemp to search with wildcard */
{
AllowWildSeach = FALSE;
wxString wildname = wxChar( '*' ) + Name + wxChar( '*' );
Name = wildname;
if( DataBaseGetName( this, keys, Name ) )
Entry = FindLibPart( Name.GetData(), libname, FIND_ROOT );
Name = DataBaseGetName( this, keys, Name );
if( !Name.IsEmpty() )
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Name, libname );
if( Entry == NULL )
{
DrawPanel->m_IgnoreMouseEvents = FALSE;
......@@ -352,8 +358,8 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
if( DrawComponent == NULL )
return;
LibEntry = FindLibPart(
DrawComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
LibEntry = ( EDA_LibComponentStruct* ) FindLibPart( DrawComponent->m_ChipName );
if( LibEntry == NULL )
return;
......@@ -401,8 +407,8 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
if( DrawComponent == NULL )
return;
LibEntry = FindLibPart(
DrawComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
LibEntry = ( EDA_LibComponentStruct* ) FindLibPart( DrawComponent->m_ChipName );
if( LibEntry == NULL )
return;
......
......@@ -39,8 +39,8 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
{
wxFileName fn;
LibraryStruct* LibTmp;
EDA_LibComponentStruct* LibEntry;
int err = 1;
LibCmpEntry* LibEntry;
bool entryLoaded;
LibItemToRepeat = NULL;
......@@ -58,14 +58,13 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
if( g_LibraryList )
{
LibEntry = (EDA_LibComponentStruct*) PQFirst( &g_LibraryList->m_Entries,
false );
LibEntry = g_LibraryList->GetFirstEntry();
if( LibEntry )
err = LoadOneLibraryPartAux( LibEntry, g_LibraryList, 1 );
entryLoaded = LoadOneLibraryPartAux( LibEntry, g_LibraryList );
FreeCmpLibrary( this, g_LibraryList->m_Name );
if( err == 0 )
if( entryLoaded )
{
fn = dlg.GetPath();
m_LastLibImportPath = fn.GetPath();
......@@ -75,7 +74,7 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
DrawPanel->Refresh();
}
else
DisplayError( this, _( "File is empty" ), 30 );
DisplayError( this, _( "File is empty" ) );
}
g_LibraryList = LibTmp;
......
......@@ -36,19 +36,15 @@ bool BuildAliasData( LibraryStruct* Lib, EDA_LibComponentStruct* component )
LibCmpEntry* CmpEntry;
unsigned ii;
if( component == NULL )
return FALSE;
if( Lib == NULL )
return FALSE;
if( component->m_AliasList.GetCount() == 0 )
return FALSE;
if( component == NULL || Lib == NULL
|| component->m_AliasList.GetCount() == 0 )
return false;
List = component->m_AliasList;
component->m_AliasList.Clear();
for( ii = 0; ii < List.GetCount(); ii++ )
{
CmpEntry = (LibCmpEntry*) FindLibPart( List[ii].GetData(),
Lib->m_Name, FIND_ALIAS );
CmpEntry = FindLibPart( List[ii], Lib->m_Name, ALIAS );
if( CmpEntry && CmpEntry->Type != ALIAS )
{
DisplayError( NULL,
......
......@@ -52,7 +52,8 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
continue;
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) SchItem;
Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( DrawLibItem->m_ChipName );
if( Entry ) // if NULL : component not found
ListEntry.push_back( Entry );
}
......
......@@ -34,11 +34,6 @@ enum LocateDrawStructType {
#define LOCATE_ALL_DRAW_ITEM 0xFFFFFFFF
/* flags utilises dans FindLibPart() : */
#define FIND_ROOT 0 /* Used to search for a root component by its name
* if the name is an alias name, FindLibPart() returns the root component */
#define FIND_ALIAS 1 /* Used to search for a component by its name
* FindLibPart() returns the component (root or alias ) */
#include "class_library.h"
......
This diff is collapsed.
......@@ -23,7 +23,10 @@ void WinEDA_LibeditFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
EDA_LibComponentStruct* CopyItem;
PICKED_ITEMS_LIST* lastcmd;
CopyItem = CopyLibEntryStruct( this, (EDA_LibComponentStruct*) ItemToCopy );
CopyItem = CopyLibEntryStruct( (EDA_LibComponentStruct*) ItemToCopy );
if( CopyItem == NULL )
return;
lastcmd = new PICKED_ITEMS_LIST();
ITEM_PICKER wrapper(CopyItem, UR_LIBEDIT);
......
......@@ -722,7 +722,8 @@ LibDrawPin* LocatePinByNumber( const wxString& ePin_Number,
LibDrawPin* Pin;
int Unit, Convert;
Entry = FindLibPart( eComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* )FindLibPart( eComponent->m_ChipName );
if( Entry == NULL )
return NULL;
......@@ -858,7 +859,8 @@ LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
if( DrawStruct->Type() != TYPE_SCH_COMPONENT )
continue;
LibItem = (SCH_COMPONENT*) DrawStruct;
Entry = FindLibPart( LibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( LibItem->m_ChipName );
if( Entry == NULL )
continue;
Pin = (LibDrawPin*) LocatePin( RefPos, Entry, LibItem->m_Multi,
......
......@@ -130,7 +130,8 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList(
// removed because with multiple instances of one schematic
// (several sheets pointing to 1 screen), this will be erroneously be toggled.
Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Component->m_ChipName );
if( Entry == NULL )
continue;
......@@ -549,9 +550,10 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
break;
/* Get the Component FootprintFilter and put the component in CmpList if filter is not void */
EDA_LibComponentStruct* Entry;
if( ( Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString,
FIND_ROOT ) ) != NULL )
EDA_LibComponentStruct* Entry =
( EDA_LibComponentStruct* ) FindLibPart( Component->m_ChipName );
if( Entry != NULL )
{
if( Entry->m_FootprintList.GetCount() != 0 ) /* Put in list */
{
......@@ -630,7 +632,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
for( int ii = 0; ii < CmpListCount; ii++ )
{
Component = CmpList[ii].m_RootCmp;
Entry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( Component->m_ChipName );
//Line.Printf(_("%s"), CmpList[ii].m_Ref);
//Line.Replace( wxT( " " ), wxT( "_" ) );
......
......@@ -472,7 +472,8 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
case TYPE_SCH_COMPONENT:
DrawLibItem = (SCH_COMPONENT*) DrawList;
Entry = FindLibPart( DrawLibItem->m_ChipName, wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* )FindLibPart(
DrawLibItem->m_ChipName );
if( Entry == NULL )
break;
......
......@@ -251,7 +251,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
EDA_LibComponentStruct* LibEntry;
LibEntry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
LibEntry = ( EDA_LibComponentStruct* ) FindLibPart( Component->m_ChipName );
if( !Component->m_Flags )
{
......@@ -323,7 +323,8 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CMP, _( "Delete Component" ), delete_xpm );
}
LibEntry = FindLibPart( Component->m_ChipName.GetData(), wxEmptyString, FIND_ALIAS );
LibEntry = ( EDA_LibComponentStruct* ) FindLibPart( Component->m_ChipName,
wxEmptyString, ALIAS );
if( LibEntry && !LibEntry->m_DocFile.IsEmpty() )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Doc" ), datasheet_xpm );
}
......
......@@ -57,7 +57,7 @@ static void PlotLibPart( Plotter* plotter, SCH_COMPONENT* DrawLibItem )
wxPoint pos;
bool draw_bgfill = false;
Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = ( EDA_LibComponentStruct* ) FindLibPart( DrawLibItem->m_ChipName );
if( Entry == NULL )
return;;
memcpy( TransMat, DrawLibItem->m_Transform, sizeof(TransMat) );
......
This diff is collapsed.
......@@ -28,11 +28,10 @@
* A better way to duplicate a DrawLibItem is to have a virtual GenCopy() in
* LibEDA_BaseStruct class (ToDo).
*/
LibEDA_BaseStruct* CopyDrawEntryStruct( wxWindow* frame,
LibEDA_BaseStruct* DrawItem )
LibEDA_BaseStruct* CopyDrawEntryStruct( LibEDA_BaseStruct* DrawItem )
{
LibEDA_BaseStruct* NewDrawItem = NULL;
wxString msg;
LibEDA_BaseStruct* NewDrawItem = NULL;
switch( DrawItem->Type() )
{
......@@ -67,7 +66,7 @@ LibEDA_BaseStruct* CopyDrawEntryStruct( wxWindow* frame,
default:
msg.Printf( wxT( "CopyDrawLibEntryStruct: unknown Draw Type %d" ),
DrawItem->Type() );
DisplayError( frame, msg );
wxLogError( msg );
break;
}
......@@ -81,9 +80,9 @@ LibEDA_BaseStruct* CopyDrawEntryStruct( wxWindow* frame,
* Parametres de sortie: pointeur sur la structure creee
* Do not copy new items ( i.e. with m_Flag & IS_NEW)
*/
EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame,
EDA_LibComponentStruct* OldEntry )
EDA_LibComponentStruct* CopyLibEntryStruct( EDA_LibComponentStruct* OldEntry )
{
wxString msg;
EDA_LibComponentStruct* NewStruct;
LibEDA_BaseStruct* NewDrawings, * OldDrawings;
LibEDA_BaseStruct* LastItem;
......@@ -91,7 +90,9 @@ EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame,
if( OldEntry->Type != ROOT )
{
DisplayError( frame, wxT( "CopyLibEntryStruct(): Type != ROOT" ) );
msg.Printf( wxT( "Component <%s> must be root type to make copy." ),
(const wxChar*) OldEntry->m_Name.m_Text );
wxLogError( msg );
return NULL;
}
......@@ -126,10 +127,10 @@ EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame,
for( OldDrawings = OldEntry->m_Drawings; OldDrawings != NULL;
OldDrawings = OldDrawings->Next() )
{
if( ( OldDrawings->m_Flags & IS_NEW) != 0 )
if( ( OldDrawings->m_Flags & IS_NEW ) != 0 )
continue;
NewDrawings = CopyDrawEntryStruct( frame, OldDrawings );
NewDrawings = CopyDrawEntryStruct( OldDrawings );
if( NewDrawings )
{
if( LastItem == NULL )
......@@ -140,11 +141,15 @@ EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame,
LastItem = NewDrawings;
NewDrawings->SetNext( NULL );
}
else // Should nevers occurs, just in case...
else // Should never occur, just in case...
{ // CopyDrawEntryStruct() was not able to duplicate the type
// of OldDrawings
// occurs when an unexpected type is encountered
DisplayError( frame, wxT( "CopyLibEntryStruct(): error: aborted" ) );
msg.Printf( wxT( "Error attempting to copy draw item <%s> from \
component <%s>." ),
(const wxChar*) OldDrawings->GetClass(),
(const wxChar*) OldEntry->m_Name.m_Text );
wxLogError( msg );
break;
}
}
......
......@@ -620,10 +620,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
if( screen->GetCurItem() == NULL )
break;
{
EDA_LibComponentStruct* LibEntry;
LibCmpEntry* LibEntry;
LibEntry = FindLibPart(
( (SCH_COMPONENT*) screen->GetCurItem() )->m_ChipName.GetData(),
wxEmptyString, FIND_ALIAS );
( (SCH_COMPONENT*) screen->GetCurItem() )->m_ChipName,
wxEmptyString, ALIAS );
if( LibEntry && LibEntry->m_DocFile != wxEmptyString )
{
GetAssociatedDocument( this, LibEntry->m_DocFile ,
......
......@@ -72,15 +72,13 @@ LibraryStruct* SelectLibraryFromList( WinEDA_DrawFrame* frame )
}
/******************************************************************************************/
int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame,
LibraryStruct* Library, wxString& Buffer, wxString& OldName )
/******************************************************************************************/
LibraryStruct* Library,
wxString& Buffer, wxString& OldName )
{
int ii;
size_t i;
wxString msg;
EDA_LibComponentStruct* LibEntry;
WinEDAListBox* ListBox;
wxArrayString nameList;
const wxChar** ListNames;
if( Library == NULL )
......@@ -89,44 +87,32 @@ int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame,
if( Library == NULL )
return 0;
PQCompFunc( (PQCompFuncType) LibraryEntryCompare );
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Library->m_Entries, FALSE );
Library->GetEntryNames( nameList );
ii = 0;
while( LibEntry )
{
ii++;
LibEntry = (EDA_LibComponentStruct*) PQNext( Library->m_Entries, LibEntry, NULL );
}
ListNames = (const wxChar**) MyZMalloc( ( nameList.GetCount() + 1 ) *
sizeof( wxChar* ) );
ListNames = (const wxChar**) MyZMalloc( (ii + 1) * sizeof(wxChar*) );
msg.Printf( _( "Select 1 of %d components from library <%s>" ),
nameList.GetCount(), (const wxChar*) Library->m_Name );
msg.Printf( _( "Select component (%d items)" ), ii );
for( i = 0; i < nameList.GetCount(); i++ )
ListNames[i] = (const wxChar*) nameList[i];
ii = 0;
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Library->m_Entries, FALSE );
while( LibEntry )
{
ListNames[ii++] = LibEntry->m_Name.m_Text.GetData();
LibEntry = (EDA_LibComponentStruct*) PQNext( Library->m_Entries, LibEntry, NULL );
}
// Qsort(ListNames,StrNumICmp);
WinEDAListBox dlg( frame, msg, ListNames, OldName, DisplayCmpDoc,
wxColour( 255, 255, 255 ) );
ListBox = new WinEDAListBox( frame, msg,
ListNames, OldName, DisplayCmpDoc,
wxColour( 255, 255, 255 ) ); // Component background listbox color
dlg.MoveMouseToOrigin();
ListBox->MoveMouseToOrigin();
int rsp = dlg.ShowModal();
ii = ListBox->ShowModal(); ListBox->Destroy();
if( ii >= 0 )
Buffer = ListNames[ii];
if( rsp >= 0 )
Buffer = ListNames[rsp];
free( ListNames );
if( ii < 0 )
if( rsp < 0 )
return 0;
return 1;
}
......
......@@ -29,27 +29,25 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
/* Variables locales */
/***********************************************/
void WinEDA_LibeditFrame::LoadOneSymbol( void )
/***********************************************/
/* Read a component shape file (a symbol file *.sym )and add data (graphic items) to the current
* component.
* a symbol file *.sym has the same format as a library, and contains only one symbol
/*
* Read a component shape file (a symbol file *.sym )and add data (graphic
* items) to the current component.
*
* A symbol file *.sym has the same format as a library, and contains only
* one symbol
*/
void WinEDA_LibeditFrame::LoadOneSymbol( void )
{
int NumOfParts;
PriorQue* Entries;
EDA_LibComponentStruct* LibEntry = NULL;
EDA_LibComponentStruct* Component;
LibEDA_BaseStruct* DrawEntry;
wxString FullFileName, mask;
FILE* ImportFile;
wxString msg;
if( CurrentLibEntry == NULL )
return;
wxString msg, err;
LibraryStruct* Lib;
if( CurrentDrawItem && CurrentDrawItem->m_Flags ) // a command is in progress
/* Exit if no library entry is selected or a command is in progress. */
if( CurrentLibEntry == NULL
|| ( CurrentDrawItem && CurrentDrawItem->m_Flags ) )
return;
DrawPanel->m_IgnoreMouseEvents = TRUE;
......@@ -75,35 +73,48 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
return;
wxFileName fn = FullFileName;
wxGetApp().SaveLastVisitedLibraryPath(fn.GetPath() );
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
/* Load data */
ImportFile = wxFopen( FullFileName, wxT( "rt" ) );
if( ImportFile == NULL )
{
msg.Printf( _( "Failed to open Symbol File <%s>" ), FullFileName.GetData() );
DisplayError( this, msg, 20 );
msg.Printf( _( "Failed to open Symbol File <%s>" ),
(const wxChar*) FullFileName );
DisplayError( this, msg );
return;
}
Lib = new LibraryStruct( LIBRARY_TYPE_SYMBOL, fn.GetName(),
fn.GetFullPath() );
Entries = LoadLibraryAux( this, NULL, ImportFile, &NumOfParts );
if( !Lib->Load( err ) )
{
msg.Printf( _( "Error <%s> occurred loading symbol library <%s>." ),
(const wxChar*) err, (const wxChar*) fn.GetName() );
DisplayError( this, msg );
fclose( ImportFile );
if( Entries == NULL )
delete Lib;
return;
}
if( NumOfParts > 1 )
DisplayError( this, _( "Warning: more than 1 part in Symbol File" ), 20 );
fclose( ImportFile );
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Entries, FALSE );
if( Lib->IsEmpty() )
{
msg.Printf( _( "No components found in symbol library <%s>." ),
(const wxChar*) fn.GetName() );
delete Lib;
return;
}
if( LibEntry == NULL )
DisplayError( this, _( "Symbol File is void" ), 20 );
if( Lib->m_NumOfParts > 1 )
DisplayError( this, _( "Warning: more than 1 part in Symbol File" ) );
Component = (EDA_LibComponentStruct*) Lib->GetFirstEntry();
DrawEntry = Component->m_Drawings;
else /* add data to the current symbol */
{
DrawEntry = LibEntry->m_Drawings;
while( DrawEntry )
{
if( DrawEntry->m_Unit )
......@@ -113,20 +124,21 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
DrawEntry->m_Flags = IS_NEW;
DrawEntry->m_Selected = IS_SELECTED;
if( DrawEntry->Next() == NULL )
{ /* Fin de liste trouvee */
if( DrawEntry->Next() == NULL ) /* Fin de liste trouvee */
{
DrawEntry->SetNext( CurrentLibEntry->m_Drawings );
CurrentLibEntry->m_Drawings = LibEntry->m_Drawings;
LibEntry->m_Drawings = NULL;
CurrentLibEntry->m_Drawings = Component->m_Drawings;
Component->m_Drawings = NULL;
break;
}
DrawEntry = DrawEntry->Next();
}
// Remove duplicated drawings:
SuppressDuplicateDrawItem( CurrentLibEntry );
// crear flags
// Clear flags
DrawEntry = CurrentLibEntry->m_Drawings;
while( DrawEntry )
{
......@@ -136,22 +148,21 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
}
GetScreen()->SetModify();
DrawPanel->Refresh();
}
PQFreeFunc( Entries, ( void( * ) ( void* ) )FreeLibraryEntry );
delete Lib;
}
/********************************************/
void WinEDA_LibeditFrame::SaveOneSymbol()
/********************************************/
/* Save in file the current symbol
* file format is like the standard libraries, but there is only one symbol
/*
* Save in file the current symbol.
*
* The symbol file format is like the standard libraries, but there is only
* one symbol.
*
* Invisible pins are not saved
*/
void WinEDA_LibeditFrame::SaveOneSymbol()
{
EDA_LibComponentStruct* LibEntry = CurrentLibEntry;
int Unit = CurrentUnit, convert = CurrentConvert;
......@@ -179,7 +190,7 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
return;
wxFileName fn = FullFileName;
wxGetApp().SaveLastVisitedLibraryPath(fn.GetPath() );
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
ExportFile = wxFopen( FullFileName, wxT( "wt" ) );
if( ExportFile == NULL )
......@@ -203,9 +214,11 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
(const char*) LibEntry->m_Name.m_Text.GetData() );
/* Generation des lignes utiles */
fprintf( ExportFile, "DEF %s", (const char*) LibEntry->m_Name.m_Text.GetData() );
fprintf( ExportFile, "DEF %s",
(const char*) LibEntry->m_Name.m_Text.GetData() );
if( !LibEntry->m_Prefix.m_Text.IsEmpty() )
fprintf( ExportFile, " %s", (const char*) LibEntry->m_Prefix.m_Text.GetData() );
fprintf( ExportFile, " %s",
(const char*) LibEntry->m_Prefix.m_Text.GetData() );
else
fprintf( ExportFile, " ~" );
......@@ -229,11 +242,13 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
/* Elimination des elements non relatifs a l'unite */
if( Unit && DrawEntry->m_Unit && (DrawEntry->m_Unit != Unit) )
continue;
if( convert && DrawEntry->m_Convert && (DrawEntry->m_Convert != convert) )
if( convert && DrawEntry->m_Convert
&& (DrawEntry->m_Convert != convert) )
continue;
DrawEntry->Save( ExportFile );
}
fprintf( ExportFile, "ENDDRAW\n" );
}
fprintf( ExportFile, "ENDDEF\n" );
......@@ -241,14 +256,13 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
}
/*****************************************************************/
void SuppressDuplicateDrawItem( EDA_LibComponentStruct* LibEntry )
/*****************************************************************/
/* Delete redundant graphic items.
/*
* Delete redundant graphic items.
*
* Useful after loading asymbole from a file symbol, because some graphic items
* can be duplicated.
*/
void SuppressDuplicateDrawItem( EDA_LibComponentStruct* LibEntry )
{
LibEDA_BaseStruct* DEntryRef, * DEntryCompare;
bool deleted;
......@@ -282,15 +296,14 @@ void SuppressDuplicateDrawItem( EDA_LibComponentStruct* LibEntry )
}
/********************************************************************/
/*
* Compare 2 graphic items (arc, lines ...).
*
* return FALSE if different
* TRUE if they are identical, and therefore redundant
*/
static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
LibEDA_BaseStruct* DEntryCompare )
/********************************************************************/
/* Compare 2 graphic items (arc, lines ...).
* return FALSE si different
* TRUE si they are identical, and therefore redundant
*/
{
/* Comparaison des proprietes generales */
if( DEntryRef->Type() != DEntryCompare->Type() )
......@@ -393,7 +406,6 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
/* pour repositionner le point repere par le curseur souris au point */
/* d'ancrage ( coord 0,0 ). */
/***************************************************************************/
void WinEDA_LibeditFrame::PlaceAncre()
{
EDA_LibComponentStruct* LibEntry;
......@@ -456,8 +468,9 @@ void WinEDA_LibeditFrame::PlaceAncre()
case COMPONENT_POLYLINE_DRAW_TYPE:
#undef STRUCT
#define STRUCT ( (LibDrawPolyline*) DrawEntry )
for( unsigned ii = 0; ii < STRUCT->GetCornerCount(); ii ++ )
for( unsigned ii = 0; ii < STRUCT->GetCornerCount(); ii++ )
STRUCT->m_PolyPoints[ii] += offset;
break;
default:
......
......@@ -28,14 +28,16 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
if( (g_CurrentViewLibraryName != wxEmptyString)
&& (g_CurrentViewComponentName != wxEmptyString) )
{
RootLibEntry = FindLibPart( g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName.GetData(),
FIND_ROOT );
RootLibEntry =
( EDA_LibComponentStruct* ) FindLibPart( g_CurrentViewComponentName,
g_CurrentViewLibraryName );
if( RootLibEntry && LookForConvertPart( RootLibEntry ) > 1 )
asdeMorgan = TRUE;
CurrentLibEntry = FindLibPart( g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName.GetData(),
FIND_ALIAS );
CurrentLibEntry =
( EDA_LibComponentStruct* ) FindLibPart( g_CurrentViewComponentName,
g_CurrentViewLibraryName,
ALIAS );
}
if( m_HToolBar == NULL )
......
......@@ -273,8 +273,9 @@ int WinEDA_ViewlibFrame::BestZoom()
wxSize size, itemsize;
EDA_LibComponentStruct* CurrentLibEntry = NULL;
CurrentLibEntry = FindLibPart( g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName.GetData(), FIND_ROOT );
CurrentLibEntry =
( EDA_LibComponentStruct* ) FindLibPart( g_CurrentViewComponentName,
g_CurrentViewLibraryName );
if( CurrentLibEntry == NULL )
{
......@@ -358,29 +359,22 @@ void WinEDA_ViewlibFrame::ReCreateListLib()
}
/***********************************************/
void WinEDA_ViewlibFrame::ReCreateListCmp()
/***********************************************/
{
if( m_CmpList == NULL )
return;
int ii;
EDA_LibComponentStruct* LibEntry = NULL;
LibraryStruct* Library = FindLibrary( g_CurrentViewLibraryName.GetData() );
wxArrayString nameList;
m_CmpList->Clear();
ii = 0;
g_CurrentViewComponentName.Empty();
g_ViewConvert = 1; /* Select normal/"de morgan" shape */
g_ViewUnit = 1; /* Selec unit to display for multiple parts per package */
g_ViewUnit = 1; /* Select unit to display for multiple
* parts per package */
if( Library )
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Library->m_Entries, FALSE );
while( LibEntry )
{
m_CmpList->Append( LibEntry->m_Name.m_Text );
LibEntry = (EDA_LibComponentStruct*) PQNext( Library->m_Entries, LibEntry, NULL );
}
Library->GetEntryNames( nameList );
m_CmpList->Append( nameList );
}
......
......@@ -57,8 +57,10 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_LIBVIEW_VIEWDOC:
LibEntry = FindLibPart( g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName.GetData(), FIND_ALIAS );
LibEntry =
( EDA_LibComponentStruct* ) FindLibPart( g_CurrentViewComponentName,
g_CurrentViewLibraryName,
ALIAS );
if( LibEntry && ( !LibEntry->m_DocFile.IsEmpty() ) )
GetAssociatedDocument( this, LibEntry->m_DocFile,
& wxGetApp().GetLibraryPathList());
......@@ -182,10 +184,9 @@ void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option )
return;
}
EDA_LibComponentStruct* LibEntry = FindLibPart(
g_CurrentViewComponentName.GetData(),
LibCmpEntry* LibEntry = FindLibPart( g_CurrentViewComponentName,
g_CurrentViewLibraryName,
FIND_ALIAS );
ALIAS );
if( LibEntry == NULL )
return;
......@@ -204,7 +205,7 @@ void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option )
void WinEDA_ViewlibFrame::ViewOneLibraryContent( LibraryStruct* Lib, int Flag )
{
int NumOfParts = 0;
EDA_LibComponentStruct* LibEntry, * PreviousLibEntry;
LibCmpEntry* LibEntry;
wxString CmpName;
wxClientDC dc( DrawPanel );
......@@ -223,9 +224,6 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( LibraryStruct* Lib, int Flag )
if( Lib == NULL )
return;
PQCompFunc( (PQCompFuncType) LibraryEntryCompare );
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Lib->m_Entries, FALSE );
if( Flag == NEW_PART )
{
DisplayComponentsNamesInLib( this,
......@@ -236,54 +234,24 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( LibraryStruct* Lib, int Flag )
if( Flag == NEXT_PART )
{
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Lib->m_Entries, FALSE );
while( LibEntry )
{
if( LibEntry->m_Name.m_Text == g_CurrentViewComponentName )
{
LibEntry = (EDA_LibComponentStruct*)
PQNext( Lib->m_Entries, LibEntry, NULL );
break;
}
LibEntry = (EDA_LibComponentStruct*)
PQNext( Lib->m_Entries, LibEntry, NULL );
}
LibEntry = Lib->GetNextEntry( g_CurrentViewComponentName );
if( LibEntry == NULL )
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Lib->m_Entries,
FALSE );
if( LibEntry )
CmpName = LibEntry->m_Name.m_Text;
}
if( Flag == PREVIOUS_PART )
{
PreviousLibEntry = NULL;
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Lib->m_Entries, FALSE );
while( LibEntry )
{
if( LibEntry->m_Name.m_Text == g_CurrentViewComponentName )
{
if( PreviousLibEntry )
break;
LibEntry = Lib->GetPreviousEntry( g_CurrentViewComponentName );
/* else : pointage sur 1er element :
* balayage de la liste et Previous pointera dernier element */
}
PreviousLibEntry = LibEntry;
LibEntry = (EDA_LibComponentStruct*)
PQNext( Lib->m_Entries, LibEntry, NULL );
}
if( PreviousLibEntry )
CmpName = PreviousLibEntry->m_Name.m_Text;
if( LibEntry )
CmpName = LibEntry->m_Name.m_Text;
}
g_ViewUnit = 1;
g_ViewConvert = 1;
LibEntry = FindLibPart( CmpName.GetData(), Lib->m_Name, FIND_ALIAS );
LibEntry = Lib->FindEntry( CmpName );
g_CurrentViewComponentName = CmpName;
DisplayLibInfos();
Zoom_Automatique( FALSE );
......@@ -312,8 +280,10 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
ActiveScreen = GetScreen();
LibEntry = FindLibPart( g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName, FIND_ALIAS );
LibEntry =
( EDA_LibComponentStruct* ) FindLibPart( g_CurrentViewComponentName,
g_CurrentViewLibraryName,
ALIAS );
ViewCmpEntry = (LibCmpEntry*) LibEntry;
/* Forcage de la reinit de la brosse et plume courante */
......@@ -335,9 +305,10 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
( (EDA_LibCmpAliasStruct*) LibEntry )->m_RootName.GetData();
Msg.Printf( _( "Current Part: <%s> (is Alias of <%s>)" ),
CmpName, RootName );
LibEntry = FindLibPart( RootName,
LibEntry =
( EDA_LibComponentStruct* ) FindLibPart( RootName,
g_CurrentViewLibraryName,
FIND_ROOT );
ROOT );
if( LibEntry == NULL )
{
......
......@@ -20,6 +20,7 @@ class SCH_ITEM;
class DrawNoConnectStruct;
class LibraryStruct;
class EDA_LibComponentStruct;
class LibCmpEntry;
class LibEDA_BaseStruct;
class EDA_BaseStruct;
class DrawBusEntryStruct;
......@@ -507,9 +508,8 @@ private:
bool LoadOneLibraryPart();
void SaveActiveLibrary();
int LoadOneLibraryPartAux( EDA_LibComponentStruct* LibEntry,
LibraryStruct* Library,
int noMsg = 0 );
bool LoadOneLibraryPartAux( LibCmpEntry* LibEntry,
LibraryStruct* Library );
void DisplayCmpDoc( const wxString& Name );
void InstallLibeditFrame();
......@@ -560,7 +560,6 @@ public:
void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC );
void DeletePartInLib( LibraryStruct* Library, EDA_LibComponentStruct* Entry );
void PlacePin( wxDC* DC );
void InitEditOnePin();
void GlobalSetPins( wxDC* DC, LibDrawPin* MasterPin, int id );
......
......@@ -50,7 +50,8 @@ class Plotter;
enum id_librarytype {
LIBRARY_TYPE_EESCHEMA,
LIBRARY_TYPE_PCBNEW,
LIBRARY_TYPE_DOC
LIBRARY_TYPE_DOC,
LIBRARY_TYPE_SYMBOL
};
enum id_drawframe {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment