Rename LIB_PART to LIB_SYMBOL.
This commit is contained in:
parent
2af06a9d60
commit
71c183d7bb
|
@ -291,7 +291,7 @@ static struct EDA_ITEM_DESC
|
||||||
|
|
||||||
.Map( SCH_SCREEN_T, _HKI( "SCH Screen" ) )
|
.Map( SCH_SCREEN_T, _HKI( "SCH Screen" ) )
|
||||||
|
|
||||||
.Map( LIB_PART_T, _HKI( "Symbol" ) )
|
.Map( LIB_SYMBOL_T, _HKI( "Symbol" ) )
|
||||||
.Map( LIB_ALIAS_T, _HKI( "Alias" ) )
|
.Map( LIB_ALIAS_T, _HKI( "Alias" ) )
|
||||||
.Map( LIB_ARC_T, _HKI( "Arc" ) )
|
.Map( LIB_ARC_T, _HKI( "Arc" ) )
|
||||||
.Map( LIB_CIRCLE_T, _HKI( "Circle" ) )
|
.Map( LIB_CIRCLE_T, _HKI( "Circle" ) )
|
||||||
|
|
|
@ -52,7 +52,7 @@ void SCH_EDIT_FRAME::mapExistingAnnotation( std::map<wxString, wxString>& aMap )
|
||||||
wxString ref = symbol->GetRef( curr_sheetpath );
|
wxString ref = symbol->GetRef( curr_sheetpath );
|
||||||
|
|
||||||
if( symbol->GetUnitCount() > 1 )
|
if( symbol->GetUnitCount() > 1 )
|
||||||
ref << LIB_PART::SubReference( symbol->GetUnitSelection( curr_sheetpath ) );
|
ref << LIB_SYMBOL::SubReference( symbol->GetUnitSelection( curr_sheetpath ) );
|
||||||
|
|
||||||
if( symbol->IsAnnotated( curr_sheetpath ) )
|
if( symbol->IsAnnotated( curr_sheetpath ) )
|
||||||
aMap[ curr_full_uuid.AsString() ] = ref;
|
aMap[ curr_full_uuid.AsString() ] = ref;
|
||||||
|
@ -270,7 +270,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
|
||||||
wxString newRef = symbol->GetRef( sheet );
|
wxString newRef = symbol->GetRef( sheet );
|
||||||
|
|
||||||
if( symbol->GetUnitCount() > 1 )
|
if( symbol->GetUnitCount() > 1 )
|
||||||
newRef << LIB_PART::SubReference( symbol->GetUnitSelection( sheet ) );
|
newRef << LIB_SYMBOL::SubReference( symbol->GetUnitSelection( sheet ) );
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
|
||||||
if( symbol->GetUnitCount() > 1 )
|
if( symbol->GetUnitCount() > 1 )
|
||||||
msg.Printf( _( "Updated %s (unit %s) from %s to %s" ),
|
msg.Printf( _( "Updated %s (unit %s) from %s to %s" ),
|
||||||
symbol->GetValue( sheet, true ),
|
symbol->GetValue( sheet, true ),
|
||||||
LIB_PART::SubReference( symbol->GetUnit(), false ),
|
LIB_SYMBOL::SubReference( symbol->GetUnit(), false ),
|
||||||
prevRef,
|
prevRef,
|
||||||
newRef );
|
newRef );
|
||||||
else
|
else
|
||||||
|
@ -296,7 +296,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
|
||||||
if( symbol->GetUnitCount() > 1 )
|
if( symbol->GetUnitCount() > 1 )
|
||||||
msg.Printf( _( "Annotated %s (unit %s) as %s" ),
|
msg.Printf( _( "Annotated %s (unit %s) as %s" ),
|
||||||
symbol->GetValue( sheet, true ),
|
symbol->GetValue( sheet, true ),
|
||||||
LIB_PART::SubReference( symbol->GetUnit(), false ),
|
LIB_SYMBOL::SubReference( symbol->GetUnit(), false ),
|
||||||
newRef );
|
newRef );
|
||||||
else
|
else
|
||||||
msg.Printf( _( "Annotated %s as %s" ),
|
msg.Printf( _( "Annotated %s as %s" ),
|
||||||
|
|
|
@ -84,8 +84,8 @@ PART_LIB::~PART_LIB()
|
||||||
|
|
||||||
void PART_LIB::Save( bool aSaveDocFile )
|
void PART_LIB::Save( bool aSaveDocFile )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_plugin != NULL, wxString::Format( "no plugin defined for library `%s`.",
|
wxCHECK_RET( m_plugin != nullptr, wxString::Format( "no plugin defined for library `%s`.",
|
||||||
fileName.GetFullPath() ) );
|
fileName.GetFullPath() ) );
|
||||||
|
|
||||||
PROPERTIES props;
|
PROPERTIES props;
|
||||||
|
|
||||||
|
@ -153,19 +153,19 @@ void PART_LIB::GetPartNames( wxArrayString& aNames ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PART_LIB::GetParts( std::vector<LIB_PART*>& aSymbols ) const
|
void PART_LIB::GetParts( std::vector<LIB_SYMBOL*>& aSymbols ) const
|
||||||
{
|
{
|
||||||
m_plugin->EnumerateSymbolLib( aSymbols, fileName.GetFullPath(), m_properties.get() );
|
m_plugin->EnumerateSymbolLib( aSymbols, fileName.GetFullPath(), m_properties.get() );
|
||||||
|
|
||||||
std::sort( aSymbols.begin(), aSymbols.end(),
|
std::sort( aSymbols.begin(), aSymbols.end(),
|
||||||
[](LIB_PART *lhs, LIB_PART *rhs) -> bool
|
[](LIB_SYMBOL *lhs, LIB_SYMBOL *rhs) -> bool
|
||||||
{ return lhs->GetName() < rhs->GetName(); });
|
{ return lhs->GetName() < rhs->GetName(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* PART_LIB::FindPart( const wxString& aName ) const
|
LIB_SYMBOL* PART_LIB::FindPart( const wxString& aName ) const
|
||||||
{
|
{
|
||||||
LIB_PART* symbol = m_plugin->LoadSymbol( fileName.GetFullPath(), aName, m_properties.get() );
|
LIB_SYMBOL* symbol = m_plugin->LoadSymbol( fileName.GetFullPath(), aName, m_properties.get() );
|
||||||
|
|
||||||
// Set the library to this even though technically the legacy cache plugin owns the
|
// Set the library to this even though technically the legacy cache plugin owns the
|
||||||
// symbols. This allows the symbol library table conversion tool to determine the
|
// symbols. This allows the symbol library table conversion tool to determine the
|
||||||
|
@ -177,16 +177,17 @@ LIB_PART* PART_LIB::FindPart( const wxString& aName ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* PART_LIB::FindPart( const LIB_ID& aLibId ) const
|
LIB_SYMBOL* PART_LIB::FindPart( const LIB_ID& aLibId ) const
|
||||||
{
|
{
|
||||||
return FindPart( aLibId.Format().wx_str() );
|
return FindPart( aLibId.Format().wx_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PART_LIB::AddPart( LIB_PART* aPart )
|
void PART_LIB::AddPart( LIB_SYMBOL* aSymbol )
|
||||||
{
|
{
|
||||||
// add a clone, not the caller's copy, the plugin take ownership of the new symbol.
|
// add a clone, not the caller's copy, the plugin take ownership of the new symbol.
|
||||||
m_plugin->SaveSymbol( fileName.GetFullPath(), new LIB_PART( *aPart->SharedPtr().get(), this ),
|
m_plugin->SaveSymbol( fileName.GetFullPath(),
|
||||||
|
new LIB_SYMBOL( *aSymbol->SharedPtr().get(), this ),
|
||||||
m_properties.get() );
|
m_properties.get() );
|
||||||
|
|
||||||
// If we are not buffering, the library file is updated immediately when the plugin
|
// If we are not buffering, the library file is updated immediately when the plugin
|
||||||
|
@ -198,9 +199,9 @@ void PART_LIB::AddPart( LIB_PART* aPart )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* PART_LIB::RemovePart( LIB_PART* aEntry )
|
LIB_SYMBOL* PART_LIB::RemovePart( LIB_SYMBOL* aEntry )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( aEntry != NULL, NULL, "NULL pointer cannot be removed from library." );
|
wxCHECK_MSG( aEntry != nullptr, nullptr, "NULL pointer cannot be removed from library." );
|
||||||
|
|
||||||
m_plugin->DeleteSymbol( fileName.GetFullPath(), aEntry->GetName(), m_properties.get() );
|
m_plugin->DeleteSymbol( fileName.GetFullPath(), aEntry->GetName(), m_properties.get() );
|
||||||
|
|
||||||
|
@ -210,18 +211,18 @@ LIB_PART* PART_LIB::RemovePart( LIB_PART* aEntry )
|
||||||
isModified = true;
|
isModified = true;
|
||||||
|
|
||||||
++m_mod_hash;
|
++m_mod_hash;
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* PART_LIB::ReplacePart( LIB_PART* aOldPart, LIB_PART* aNewPart )
|
LIB_SYMBOL* PART_LIB::ReplacePart( LIB_SYMBOL* aOldPart, LIB_SYMBOL* aNewPart )
|
||||||
{
|
{
|
||||||
wxASSERT( aOldPart != NULL );
|
wxASSERT( aOldPart != nullptr );
|
||||||
wxASSERT( aNewPart != NULL );
|
wxASSERT( aNewPart != nullptr );
|
||||||
|
|
||||||
m_plugin->DeleteSymbol( fileName.GetFullPath(), aOldPart->GetName(), m_properties.get() );
|
m_plugin->DeleteSymbol( fileName.GetFullPath(), aOldPart->GetName(), m_properties.get() );
|
||||||
|
|
||||||
LIB_PART* my_part = new LIB_PART( *aNewPart, this );
|
LIB_SYMBOL* my_part = new LIB_SYMBOL( *aNewPart, this );
|
||||||
|
|
||||||
m_plugin->SaveSymbol( fileName.GetFullPath(), my_part, m_properties.get() );
|
m_plugin->SaveSymbol( fileName.GetFullPath(), my_part, m_properties.get() );
|
||||||
|
|
||||||
|
@ -239,16 +240,16 @@ PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName )
|
||||||
{
|
{
|
||||||
std::unique_ptr<PART_LIB> lib = std::make_unique<PART_LIB>( SCH_LIB_TYPE::LT_EESCHEMA, aFileName );
|
std::unique_ptr<PART_LIB> lib = std::make_unique<PART_LIB>( SCH_LIB_TYPE::LT_EESCHEMA, aFileName );
|
||||||
|
|
||||||
std::vector<LIB_PART*> parts;
|
std::vector<LIB_SYMBOL*> parts;
|
||||||
// This loads the library.
|
// This loads the library.
|
||||||
lib->GetParts( parts );
|
lib->GetParts( parts );
|
||||||
|
|
||||||
// Now, set the LIB_PART m_library member but it will only be used
|
// Now, set the LIB_SYMBOL m_library member but it will only be used
|
||||||
// when loading legacy libraries in the future. Once the symbols in the
|
// when loading legacy libraries in the future. Once the symbols in the
|
||||||
// schematic have a full #LIB_ID, this will not get called.
|
// schematic have a full #LIB_ID, this will not get called.
|
||||||
for( size_t ii = 0; ii < parts.size(); ii++ )
|
for( size_t ii = 0; ii < parts.size(); ii++ )
|
||||||
{
|
{
|
||||||
LIB_PART* part = parts[ii];
|
LIB_SYMBOL* part = parts[ii];
|
||||||
|
|
||||||
part->SetLib( lib.get() );
|
part->SetLib( lib.get() );
|
||||||
}
|
}
|
||||||
|
@ -318,7 +319,7 @@ PART_LIB* PART_LIBS::FindLibrary( const wxString& aName )
|
||||||
return &*it;
|
return &*it;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -330,7 +331,7 @@ PART_LIB* PART_LIBS::GetCacheLibrary()
|
||||||
return &*it;
|
return &*it;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -342,7 +343,7 @@ PART_LIB* PART_LIBS::FindLibraryByFullFileName( const wxString& aFullFileName )
|
||||||
return &*it;
|
return &*it;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -370,9 +371,9 @@ wxArrayString PART_LIBS::GetLibraryNames( bool aSorted )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* PART_LIBS::FindLibPart( const LIB_ID& aLibId, const wxString& aLibraryName )
|
LIB_SYMBOL* PART_LIBS::FindLibPart( const LIB_ID& aLibId, const wxString& aLibraryName )
|
||||||
{
|
{
|
||||||
LIB_PART* part = NULL;
|
LIB_SYMBOL* part = nullptr;
|
||||||
|
|
||||||
for( PART_LIB& lib : *this )
|
for( PART_LIB& lib : *this )
|
||||||
{
|
{
|
||||||
|
@ -389,7 +390,7 @@ LIB_PART* PART_LIBS::FindLibPart( const LIB_ID& aLibId, const wxString& aLibrary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PART_LIBS::FindLibraryNearEntries( std::vector<LIB_PART*>& aCandidates,
|
void PART_LIBS::FindLibraryNearEntries( std::vector<LIB_SYMBOL*>& aCandidates,
|
||||||
const wxString& aEntryName,
|
const wxString& aEntryName,
|
||||||
const wxString& aLibraryName )
|
const wxString& aLibraryName )
|
||||||
{
|
{
|
||||||
|
@ -488,7 +489,7 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
|
||||||
|
|
||||||
wxArrayString lib_names;
|
wxArrayString lib_names;
|
||||||
|
|
||||||
LibNamesAndPaths( aProject, false, NULL, &lib_names );
|
LibNamesAndPaths( aProject, false, nullptr, &lib_names );
|
||||||
|
|
||||||
// Post symbol library table, this should be empty. Only the cache library should get loaded.
|
// Post symbol library table, this should be empty. Only the cache library should get loaded.
|
||||||
if( !lib_names.empty() )
|
if( !lib_names.empty() )
|
||||||
|
@ -496,7 +497,7 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
|
||||||
APP_PROGRESS_DIALOG lib_dialog( _( "Loading Symbol Libraries" ),
|
APP_PROGRESS_DIALOG lib_dialog( _( "Loading Symbol Libraries" ),
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
lib_names.GetCount(),
|
lib_names.GetCount(),
|
||||||
NULL,
|
nullptr,
|
||||||
false,
|
false,
|
||||||
wxPD_APP_MODAL );
|
wxPD_APP_MODAL );
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include <sch_io_mgr.h>
|
#include <sch_io_mgr.h>
|
||||||
#include <project.h>
|
#include <project.h>
|
||||||
|
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class LIB_ID;
|
class LIB_ID;
|
||||||
class LINE_READER;
|
class LINE_READER;
|
||||||
class OUTPUTFORMATTER;
|
class OUTPUTFORMATTER;
|
||||||
|
@ -170,7 +170,7 @@ class PART_LIB;
|
||||||
class wxRegEx;
|
class wxRegEx;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LIB_PART map sorting.
|
* LIB_SYMBOL map sorting.
|
||||||
*/
|
*/
|
||||||
struct LibPartMapSort
|
struct LibPartMapSort
|
||||||
{
|
{
|
||||||
|
@ -182,9 +182,9 @@ struct LibPartMapSort
|
||||||
|
|
||||||
/// Part map used by part library object.
|
/// Part map used by part library object.
|
||||||
|
|
||||||
typedef std::map< wxString, LIB_PART*, LibPartMapSort > LIB_PART_MAP;
|
typedef std::map< wxString, LIB_SYMBOL*, LibPartMapSort > LIB_SYMBOL_MAP;
|
||||||
typedef std::vector< LIB_PART* > LIB_PARTS;
|
typedef std::vector< LIB_SYMBOL* > LIB_SYMBOLS;
|
||||||
typedef boost::ptr_vector< PART_LIB > PART_LIBS_BASE;
|
typedef boost::ptr_vector< PART_LIB > PART_LIBS_BASE;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -291,12 +291,12 @@ public:
|
||||||
*
|
*
|
||||||
* @param aLibId - The #LIB_ID of the symbol to search for.
|
* @param aLibId - The #LIB_ID of the symbol to search for.
|
||||||
* @param aLibraryName - Name of the library to search for part.
|
* @param aLibraryName - Name of the library to search for part.
|
||||||
* @return LIB_PART* - The part object if found, otherwise NULL.
|
* @return LIB_SYMBOL* - The part object if found, otherwise NULL.
|
||||||
*/
|
*/
|
||||||
LIB_PART* FindLibPart( const LIB_ID& aLibId, const wxString& aLibraryName = wxEmptyString );
|
LIB_SYMBOL* FindLibPart( const LIB_ID& aLibId, const wxString& aLibraryName = wxEmptyString );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search all libraries in the list for a #LIB_PART using a case insensitive comparison.
|
* Search all libraries in the list for a #LIB_SYMBOL using a case insensitive comparison.
|
||||||
*
|
*
|
||||||
* Helper function used in dialog to find all candidates.
|
* Helper function used in dialog to find all candidates.
|
||||||
* During a long time, eeschema was using a case insensitive search.
|
* During a long time, eeschema was using a case insensitive search.
|
||||||
|
@ -308,7 +308,7 @@ public:
|
||||||
* @param aLibraryName - Name of the library to search.
|
* @param aLibraryName - Name of the library to search.
|
||||||
* @param aCandidates - a std::vector to store candidates
|
* @param aCandidates - a std::vector to store candidates
|
||||||
*/
|
*/
|
||||||
void FindLibraryNearEntries( std::vector<LIB_PART*>& aCandidates, const wxString& aEntryName,
|
void FindLibraryNearEntries( std::vector<LIB_SYMBOL*>& aCandidates, const wxString& aEntryName,
|
||||||
const wxString& aLibraryName = wxEmptyString );
|
const wxString& aLibraryName = wxEmptyString );
|
||||||
|
|
||||||
int GetLibraryCount() { return size(); }
|
int GetLibraryCount() { return size(); }
|
||||||
|
@ -371,29 +371,29 @@ public:
|
||||||
/**
|
/**
|
||||||
* Load a vector with all the entries in this library.
|
* Load a vector with all the entries in this library.
|
||||||
*
|
*
|
||||||
* @param aParts - vector to receive the aliases.
|
* @param aSymbols is a vector to receive the aliases.
|
||||||
*/
|
*/
|
||||||
void GetParts( std::vector<LIB_PART*>& aPart) const;
|
void GetParts( std::vector<LIB_SYMBOL*>& aSymbols ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find #LIB_PART by \a aName.
|
* Find #LIB_SYMBOL by \a aName.
|
||||||
*
|
*
|
||||||
* @param aName - Name of part, case sensitive.
|
* @param aName - Name of part, case sensitive.
|
||||||
* @return LIB_PART pointer part if found, else NULL.
|
* @return LIB_SYMBOL pointer part if found, else NULL.
|
||||||
*/
|
*/
|
||||||
LIB_PART* FindPart( const wxString& aName ) const;
|
LIB_SYMBOL* FindPart( const wxString& aName ) const;
|
||||||
|
|
||||||
LIB_PART* FindPart( const LIB_ID& aLibId ) const;
|
LIB_SYMBOL* FindPart( const LIB_ID& aLibId ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add \a aPart entry to library.
|
* Add \a aSymbol entry to library.
|
||||||
*
|
*
|
||||||
* @note A #LIB_PART can have an alias list so these alias will be added in library.
|
* @note A #LIB_SYMBOL can have an alias list so these alias will be added in library.
|
||||||
* and the any existing duplicate aliases will be removed from the library.
|
* and the any existing duplicate aliases will be removed from the library.
|
||||||
*
|
*
|
||||||
* @param aPart - Part to add, caller retains ownership, a clone is added.
|
* @param aSymbol - Part to add, caller retains ownership, a clone is added.
|
||||||
*/
|
*/
|
||||||
void AddPart( LIB_PART* aPart );
|
void AddPart( LIB_SYMBOL* aSymbol );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Safely remove \a aEntry from the library and return the next entry.
|
* Safely remove \a aEntry from the library and return the next entry.
|
||||||
|
@ -406,7 +406,7 @@ public:
|
||||||
* @param aEntry - Entry to remove from library.
|
* @param aEntry - Entry to remove from library.
|
||||||
* @return The next entry in the library or NULL if the library is empty.
|
* @return The next entry in the library or NULL if the library is empty.
|
||||||
*/
|
*/
|
||||||
LIB_PART* RemovePart( LIB_PART* aEntry );
|
LIB_SYMBOL* RemovePart( LIB_SYMBOL* aEntry );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace an existing part entry in the library.
|
* Replace an existing part entry in the library.
|
||||||
|
@ -416,7 +416,7 @@ public:
|
||||||
* @param aOldPart - The part to replace.
|
* @param aOldPart - The part to replace.
|
||||||
* @param aNewPart - The new part.
|
* @param aNewPart - The new part.
|
||||||
*/
|
*/
|
||||||
LIB_PART* ReplacePart( LIB_PART* aOldPart, LIB_PART* aNewPart );
|
LIB_SYMBOL* ReplacePart( LIB_SYMBOL* aOldSymbol, LIB_SYMBOL* aNewSymbol );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the file name without path or extension.
|
* Return the file name without path or extension.
|
||||||
|
|
|
@ -629,7 +629,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
|
||||||
msg.Printf( _( "Error: symbol %s%s%s (unit %d) exceeds units defined (%d)\n" ),
|
msg.Printf( _( "Error: symbol %s%s%s (unit %d) exceeds units defined (%d)\n" ),
|
||||||
flatList[ii].GetRef(),
|
flatList[ii].GetRef(),
|
||||||
tmp,
|
tmp,
|
||||||
LIB_PART::SubReference( flatList[ii].m_unit ),
|
LIB_SYMBOL::SubReference( flatList[ii].m_unit ),
|
||||||
flatList[ii].m_unit,
|
flatList[ii].m_unit,
|
||||||
flatList[ii].GetLibPart()->GetUnitCount() );
|
flatList[ii].GetLibPart()->GetUnitCount() );
|
||||||
|
|
||||||
|
@ -666,7 +666,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
|
||||||
msg.Printf( _( "Duplicate items %s%s%s\n" ),
|
msg.Printf( _( "Duplicate items %s%s%s\n" ),
|
||||||
flatList[ii].GetRef(),
|
flatList[ii].GetRef(),
|
||||||
tmp,
|
tmp,
|
||||||
LIB_PART::SubReference( flatList[ii].m_unit ) );
|
LIB_SYMBOL::SubReference( flatList[ii].m_unit ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -696,7 +696,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
|
||||||
msg.Printf( _( "Duplicate items %s%s%s\n" ),
|
msg.Printf( _( "Duplicate items %s%s%s\n" ),
|
||||||
flatList[ii].GetRef(),
|
flatList[ii].GetRef(),
|
||||||
tmp,
|
tmp,
|
||||||
LIB_PART::SubReference( flatList[ii].m_unit ) );
|
LIB_SYMBOL::SubReference( flatList[ii].m_unit ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -717,11 +717,11 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
|
||||||
msg.Printf( _( "Different values for %s%d%s (%s) and %s%d%s (%s)" ),
|
msg.Printf( _( "Different values for %s%d%s (%s) and %s%d%s (%s)" ),
|
||||||
flatList[ii].GetRef(),
|
flatList[ii].GetRef(),
|
||||||
flatList[ii].m_numRef,
|
flatList[ii].m_numRef,
|
||||||
LIB_PART::SubReference( flatList[ii].m_unit ),
|
LIB_SYMBOL::SubReference( flatList[ii].m_unit ),
|
||||||
flatList[ii].m_value,
|
flatList[ii].m_value,
|
||||||
flatList[next].GetRef(),
|
flatList[next].GetRef(),
|
||||||
flatList[next].m_numRef,
|
flatList[next].m_numRef,
|
||||||
LIB_PART::SubReference( flatList[next].m_unit ),
|
LIB_SYMBOL::SubReference( flatList[next].m_unit ),
|
||||||
flatList[next].m_value );
|
flatList[next].m_value );
|
||||||
|
|
||||||
aHandler( ERCE_DIFFERENT_UNIT_VALUE, msg, &flatList[ii], &flatList[ii+1] );
|
aHandler( ERCE_DIFFERENT_UNIT_VALUE, msg, &flatList[ii], &flatList[ii+1] );
|
||||||
|
@ -733,14 +733,14 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_REFERENCE::SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_PART* aLibPart,
|
SCH_REFERENCE::SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_SYMBOL* aLibSymbol,
|
||||||
const SCH_SHEET_PATH& aSheetPath )
|
const SCH_SHEET_PATH& aSheetPath )
|
||||||
{
|
{
|
||||||
wxASSERT( aSymbol != NULL );
|
wxASSERT( aSymbol != NULL );
|
||||||
|
|
||||||
m_rootSymbol = aSymbol;
|
m_rootSymbol = aSymbol;
|
||||||
m_libPart = aLibPart; // Warning: can be nullptr for orphan symbols
|
m_libPart = aLibSymbol; // Warning: can be nullptr for orphan symbols
|
||||||
// (i.e. with a symbol library not found)
|
// (i.e. with a symbol library not found)
|
||||||
m_unit = aSymbol->GetUnitSelection( &aSheetPath );
|
m_unit = aSymbol->GetUnitSelection( &aSheetPath );
|
||||||
m_footprint = aSymbol->GetFootprint( &aSheetPath, true );
|
m_footprint = aSymbol->GetFootprint( &aSheetPath, true );
|
||||||
m_sheetPath = aSheetPath;
|
m_sheetPath = aSheetPath;
|
||||||
|
|
|
@ -261,7 +261,7 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
|
||||||
|
|
||||||
SCH_SHEET_LIST hierarchy = frame->Schematic().GetSheets();
|
SCH_SHEET_LIST hierarchy = frame->Schematic().GetSheets();
|
||||||
|
|
||||||
// Load non-mandatory fields from all matching symbols and their library parts
|
// Load non-mandatory fields from all matching symbols and their library symbols
|
||||||
std::vector<SCH_FIELD*> fields;
|
std::vector<SCH_FIELD*> fields;
|
||||||
std::vector<LIB_FIELD*> libFields;
|
std::vector<LIB_FIELD*> libFields;
|
||||||
std::set<wxString> fieldNames;
|
std::set<wxString> fieldNames;
|
||||||
|
@ -289,24 +289,24 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
|
||||||
|
|
||||||
if( m_mode == MODE::UPDATE && symbol->GetLibId().IsValid() )
|
if( m_mode == MODE::UPDATE && symbol->GetLibId().IsValid() )
|
||||||
{
|
{
|
||||||
LIB_PART* libSymbol = frame->GetLibPart( symbol->GetLibId() );
|
LIB_SYMBOL* libSymbol = frame->GetLibPart( symbol->GetLibId() );
|
||||||
|
|
||||||
if( libSymbol )
|
if( libSymbol )
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_PART> flattenedPart = libSymbol->Flatten();
|
std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->Flatten();
|
||||||
|
|
||||||
flattenedPart->GetFields( libFields );
|
flattenedSymbol->GetFields( libFields );
|
||||||
|
|
||||||
for( unsigned i = MANDATORY_FIELDS; i < libFields.size(); ++i )
|
for( unsigned i = MANDATORY_FIELDS; i < libFields.size(); ++i )
|
||||||
fieldNames.insert( libFields[i]->GetName() );
|
fieldNames.insert( libFields[i]->GetName() );
|
||||||
|
|
||||||
libFields.clear(); // flattenedPart is about to go out of scope...
|
libFields.clear(); // flattenedSymbol is about to go out of scope...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load non-mandatory fields from the change-to library part
|
// Load non-mandatory fields from the change-to library symbol
|
||||||
if( m_mode == MODE::CHANGE )
|
if( m_mode == MODE::CHANGE )
|
||||||
{
|
{
|
||||||
LIB_ID newId;
|
LIB_ID newId;
|
||||||
|
@ -315,18 +315,18 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
|
||||||
|
|
||||||
if( newId.IsValid() )
|
if( newId.IsValid() )
|
||||||
{
|
{
|
||||||
LIB_PART* libSymbol = frame->GetLibPart( newId );
|
LIB_SYMBOL* libSymbol = frame->GetLibPart( newId );
|
||||||
|
|
||||||
if( libSymbol )
|
if( libSymbol )
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_PART> flattenedPart = libSymbol->Flatten();
|
std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->Flatten();
|
||||||
|
|
||||||
flattenedPart->GetFields( libFields );
|
flattenedSymbol->GetFields( libFields );
|
||||||
|
|
||||||
for( unsigned i = MANDATORY_FIELDS; i < libFields.size(); ++i )
|
for( unsigned i = MANDATORY_FIELDS; i < libFields.size(); ++i )
|
||||||
fieldNames.insert( libFields[i]->GetName() );
|
fieldNames.insert( libFields[i]->GetName() );
|
||||||
|
|
||||||
libFields.clear(); // flattenedPart is about to go out of scope...
|
libFields.clear(); // flattenedSymbol is about to go out of scope...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -532,7 +532,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LIB_PART* libSymbol = frame->GetLibPart( aNewId );
|
LIB_SYMBOL* libSymbol = frame->GetLibPart( aNewId );
|
||||||
|
|
||||||
if( !libSymbol )
|
if( !libSymbol )
|
||||||
{
|
{
|
||||||
|
@ -541,7 +541,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<LIB_PART> flattenedSymbol = libSymbol->Flatten();
|
std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->Flatten();
|
||||||
|
|
||||||
if( flattenedSymbol->GetUnitCount() < aSymbol->GetUnit() )
|
if( flattenedSymbol->GetUnitCount() < aSymbol->GetUnit() )
|
||||||
{
|
{
|
||||||
|
@ -550,7 +550,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removing the symbol needs to be done before the LIB_PART is changed to prevent stale
|
// Removing the symbol needs to be done before the LIB_SYMBOL is changed to prevent stale
|
||||||
// library symbols in the schematic file.
|
// library symbols in the schematic file.
|
||||||
screen->Remove( aSymbol );
|
screen->Remove( aSymbol );
|
||||||
frame->SaveCopyInUndoList( screen, aSymbol, UNDO_REDO::CHANGED, aAppendToUndo );
|
frame->SaveCopyInUndoList( screen, aSymbol, UNDO_REDO::CHANGED, aAppendToUndo );
|
||||||
|
|
|
@ -396,7 +396,7 @@ void DIALOG_CHOOSE_SYMBOL::ShowFootprintFor( LIB_ID const& aLibId )
|
||||||
if( !m_fp_preview || !m_fp_preview->IsInitialized() )
|
if( !m_fp_preview || !m_fp_preview->IsInitialized() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LIB_PART* symbol = nullptr;
|
LIB_SYMBOL* symbol = nullptr;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -453,7 +453,7 @@ void DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector( LIB_ID const& aLibId )
|
||||||
|
|
||||||
m_fp_sel_ctrl->ClearFilters();
|
m_fp_sel_ctrl->ClearFilters();
|
||||||
|
|
||||||
LIB_PART* symbol = nullptr;
|
LIB_SYMBOL* symbol = nullptr;
|
||||||
|
|
||||||
if( aLibId.IsValid() )
|
if( aLibId.IsValid() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,6 @@ class SYMBOL_PREVIEW_WIDGET;
|
||||||
class FOOTPRINT_PREVIEW_WIDGET;
|
class FOOTPRINT_PREVIEW_WIDGET;
|
||||||
class FOOTPRINT_SELECT_WIDGET;
|
class FOOTPRINT_SELECT_WIDGET;
|
||||||
class LIB_ALIAS;
|
class LIB_ALIAS;
|
||||||
class LIB_PART;
|
|
||||||
class SCH_BASE_FRAME;
|
class SCH_BASE_FRAME;
|
||||||
class SCH_DRAW_PANEL;
|
class SCH_DRAW_PANEL;
|
||||||
|
|
||||||
|
|
|
@ -714,7 +714,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow()
|
||||||
if( cmp.m_Row != row )
|
if( cmp.m_Row != row )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LIB_PART* symbol = nullptr;
|
LIB_SYMBOL* symbol = nullptr;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -318,9 +318,9 @@ DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
|
||||||
if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
|
if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
|
||||||
{
|
{
|
||||||
const SCH_SYMBOL* symbol = (SCH_SYMBOL*) aField->GetParent();
|
const SCH_SYMBOL* symbol = (SCH_SYMBOL*) aField->GetParent();
|
||||||
const LIB_PART* part = GetParent()->GetLibPart( symbol->GetLibId(), true );
|
const LIB_SYMBOL* libSymbol = GetParent()->GetLibPart( symbol->GetLibId(), true );
|
||||||
|
|
||||||
if( part && part->IsPower() )
|
if( libSymbol && libSymbol->IsPower() )
|
||||||
m_isPower = true;
|
m_isPower = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ bool DIALOG_LIB_EDIT_DRAW_ITEM::TransferDataToWindow()
|
||||||
if( !wxDialog::TransferDataToWindow() )
|
if( !wxDialog::TransferDataToWindow() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
LIB_PART* symbol = m_item->GetParent();
|
LIB_SYMBOL* symbol = m_item->GetParent();
|
||||||
|
|
||||||
m_lineWidth.SetValue( m_item->GetWidth() );
|
m_lineWidth.SetValue( m_item->GetWidth() );
|
||||||
m_checkApplyToAllUnits->SetValue( m_item->GetUnit() == 0 );
|
m_checkApplyToAllUnits->SetValue( m_item->GetUnit() == 0 );
|
||||||
|
|
|
@ -416,10 +416,11 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent, LIB_PART* aPart ) :
|
DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent,
|
||||||
|
LIB_SYMBOL* aSymbol ) :
|
||||||
DIALOG_LIB_EDIT_PIN_TABLE_BASE( parent ),
|
DIALOG_LIB_EDIT_PIN_TABLE_BASE( parent ),
|
||||||
m_editFrame( parent ),
|
m_editFrame( parent ),
|
||||||
m_part( aPart )
|
m_part( aSymbol )
|
||||||
{
|
{
|
||||||
m_dataModel = new PIN_TABLE_DATA_MODEL( GetUserUnits() );
|
m_dataModel = new PIN_TABLE_DATA_MODEL( GetUserUnits() );
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -51,7 +51,7 @@ class SYMBOL_EDIT_FRAME;
|
||||||
class DIALOG_LIB_EDIT_PIN_TABLE : public DIALOG_LIB_EDIT_PIN_TABLE_BASE
|
class DIALOG_LIB_EDIT_PIN_TABLE : public DIALOG_LIB_EDIT_PIN_TABLE_BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent, LIB_PART* aPart );
|
DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent, LIB_SYMBOL* aSymbol );
|
||||||
~DIALOG_LIB_EDIT_PIN_TABLE() override;
|
~DIALOG_LIB_EDIT_PIN_TABLE() override;
|
||||||
|
|
||||||
bool TransferDataToWindow() override;
|
bool TransferDataToWindow() override;
|
||||||
|
@ -76,7 +76,7 @@ protected:
|
||||||
bool m_initialized = false;
|
bool m_initialized = false;
|
||||||
int m_originalColWidths[ COL_COUNT ];
|
int m_originalColWidths[ COL_COUNT ];
|
||||||
wxString m_columnsShown;
|
wxString m_columnsShown;
|
||||||
LIB_PART* m_part;
|
LIB_SYMBOL* m_part;
|
||||||
LIB_PINS m_pins; // a copy of the pins owned by me
|
LIB_PINS m_pins; // a copy of the pins owned by me
|
||||||
bool m_modified; ///< true when there are unsaved changes
|
bool m_modified; ///< true when there are unsaved changes
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::LAST_LAYOUT
|
||||||
|
|
||||||
|
|
||||||
DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* aParent,
|
DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* aParent,
|
||||||
LIB_PART* aLibEntry ) :
|
LIB_SYMBOL* aLibEntry ) :
|
||||||
DIALOG_LIB_SYMBOL_PROPERTIES_BASE( aParent ),
|
DIALOG_LIB_SYMBOL_PROPERTIES_BASE( aParent ),
|
||||||
m_Parent( aParent ),
|
m_Parent( aParent ),
|
||||||
m_libEntry( aLibEntry ),
|
m_libEntry( aLibEntry ),
|
||||||
|
@ -345,7 +345,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
||||||
wxString libName = m_Parent->GetCurLib();
|
wxString libName = m_Parent->GetCurLib();
|
||||||
|
|
||||||
// Get the parent from the libManager based on the name set in the inheritance combo box.
|
// Get the parent from the libManager based on the name set in the inheritance combo box.
|
||||||
LIB_PART* newParent = m_Parent->GetLibManager().GetAlias( parentName, libName );
|
LIB_SYMBOL* newParent = m_Parent->GetLibManager().GetAlias( parentName, libName );
|
||||||
|
|
||||||
// Verify that the requested parent exists
|
// Verify that the requested parent exists
|
||||||
wxCHECK( newParent, false );
|
wxCHECK( newParent, false );
|
||||||
|
@ -361,7 +361,8 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
||||||
m_libEntry->SetDescription( m_DescCtrl->GetValue() );
|
m_libEntry->SetDescription( m_DescCtrl->GetValue() );
|
||||||
m_libEntry->SetKeyWords( m_KeywordCtrl->GetValue() );
|
m_libEntry->SetKeyWords( m_KeywordCtrl->GetValue() );
|
||||||
m_libEntry->SetUnitCount( m_SelNumberOfUnits->GetValue() );
|
m_libEntry->SetUnitCount( m_SelNumberOfUnits->GetValue() );
|
||||||
m_libEntry->LockUnits( m_libEntry->GetUnitCount() > 1 && !m_OptionPartsInterchangeable->GetValue() );
|
m_libEntry->LockUnits( m_libEntry->GetUnitCount() > 1 &&
|
||||||
|
!m_OptionPartsInterchangeable->GetValue() );
|
||||||
m_libEntry->SetConversion( m_AsConvertButt->GetValue() );
|
m_libEntry->SetConversion( m_AsConvertButt->GetValue() );
|
||||||
|
|
||||||
if( m_OptionPower->GetValue() )
|
if( m_OptionPower->GetValue() )
|
||||||
|
@ -392,7 +393,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
||||||
m_Parent->UpdateAfterSymbolProperties( &oldName );
|
m_Parent->UpdateAfterSymbolProperties( &oldName );
|
||||||
|
|
||||||
// It's possible that the symbol being edited has no pins, in which case there may be no
|
// It's possible that the symbol being edited has no pins, in which case there may be no
|
||||||
// alternate body style objects causing #LIB_PART::HasCoversion() to always return false.
|
// alternate body style objects causing #LIB_SYMBOL::HasCoversion() to always return false.
|
||||||
// This allows the user to edit the alternate body style just in case this condition occurs.
|
// This allows the user to edit the alternate body style just in case this condition occurs.
|
||||||
m_Parent->SetShowDeMorgan( m_AsConvertButt->GetValue() );
|
m_Parent->SetShowDeMorgan( m_AsConvertButt->GetValue() );
|
||||||
|
|
||||||
|
@ -534,7 +535,9 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnMoveUp( wxCommandEvent& event )
|
||||||
m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() );
|
m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
wxBell();
|
wxBell();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,14 +31,14 @@
|
||||||
|
|
||||||
|
|
||||||
class SYMBOL_EDIT_FRAME;
|
class SYMBOL_EDIT_FRAME;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class WX_GRID;
|
class WX_GRID;
|
||||||
|
|
||||||
|
|
||||||
class DIALOG_LIB_SYMBOL_PROPERTIES: public DIALOG_LIB_SYMBOL_PROPERTIES_BASE
|
class DIALOG_LIB_SYMBOL_PROPERTIES: public DIALOG_LIB_SYMBOL_PROPERTIES_BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PART* aLibEntry );
|
DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_SYMBOL* aLibEntry );
|
||||||
~DIALOG_LIB_SYMBOL_PROPERTIES();
|
~DIALOG_LIB_SYMBOL_PROPERTIES();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -71,7 +71,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SYMBOL_EDIT_FRAME* m_Parent;
|
SYMBOL_EDIT_FRAME* m_Parent;
|
||||||
LIB_PART* m_libEntry;
|
LIB_SYMBOL* m_libEntry;
|
||||||
|
|
||||||
FIELDS_GRID_TABLE<LIB_FIELD>* m_fields;
|
FIELDS_GRID_TABLE<LIB_FIELD>* m_fields;
|
||||||
|
|
||||||
|
|
|
@ -445,7 +445,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow()
|
||||||
if( m_symbol->GetUnitCount() > 1 )
|
if( m_symbol->GetUnitCount() > 1 )
|
||||||
{
|
{
|
||||||
for( int ii = 1; ii <= m_symbol->GetUnitCount(); ii++ )
|
for( int ii = 1; ii <= m_symbol->GetUnitCount(); ii++ )
|
||||||
m_unitChoice->Append( LIB_PART::SubReference( ii, false ) );
|
m_unitChoice->Append( LIB_SYMBOL::SubReference( ii, false ) );
|
||||||
|
|
||||||
if( m_symbol->GetUnit() <= ( int )m_unitChoice->GetCount() )
|
if( m_symbol->GetUnit() <= ( int )m_unitChoice->GetCount() )
|
||||||
m_unitChoice->SetSelection( m_symbol->GetUnit() - 1 );
|
m_unitChoice->SetSelection( m_symbol->GetUnit() - 1 );
|
||||||
|
@ -659,7 +659,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
||||||
for( unsigned i = 0; i < m_fields->size(); ++i )
|
for( unsigned i = 0; i < m_fields->size(); ++i )
|
||||||
m_fields->at( i ).Offset( m_symbol->GetPosition() );
|
m_fields->at( i ).Offset( m_symbol->GetPosition() );
|
||||||
|
|
||||||
LIB_PART* entry = GetParent()->GetLibPart( m_symbol->GetLibId() );
|
LIB_SYMBOL* entry = GetParent()->GetLibPart( m_symbol->GetLibId() );
|
||||||
|
|
||||||
if( entry && entry->IsPower() )
|
if( entry && entry->IsPower() )
|
||||||
m_fields->at( VALUE_FIELD ).SetText( m_symbol->GetLibId().GetLibItemName() );
|
m_fields->at( VALUE_FIELD ).SetText( m_symbol->GetLibId().GetLibItemName() );
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <sch_pin.h>
|
#include <sch_pin.h>
|
||||||
|
|
||||||
|
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class SCH_PIN_TABLE_DATA_MODEL;
|
class SCH_PIN_TABLE_DATA_MODEL;
|
||||||
class SCH_EDIT_FRAME;
|
class SCH_EDIT_FRAME;
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SCH_SYMBOL* m_symbol;
|
SCH_SYMBOL* m_symbol;
|
||||||
LIB_PART* m_part;
|
LIB_SYMBOL* m_part;
|
||||||
|
|
||||||
int m_width;
|
int m_width;
|
||||||
int m_delayedFocusRow;
|
int m_delayedFocusRow;
|
||||||
|
|
|
@ -296,7 +296,7 @@ bool DIALOG_SYMBOL_REMAP::remapSymbolToLibTable( SCH_SYMBOL* aSymbol )
|
||||||
if( it->IsCache() )
|
if( it->IsCache() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LIB_PART* alias = it->FindPart( aSymbol->GetLibId().GetLibItemName().wx_str() );
|
LIB_SYMBOL* alias = it->FindPart( aSymbol->GetLibId().GetLibItemName().wx_str() );
|
||||||
|
|
||||||
// Found in the same library as the old look up method assuming the user didn't
|
// Found in the same library as the old look up method assuming the user didn't
|
||||||
// change the libraries or library ordering since the last time the schematic was
|
// change the libraries or library ordering since the last time the schematic was
|
||||||
|
|
|
@ -36,7 +36,7 @@ bool g_resetLibFieldPositions = true;
|
||||||
|
|
||||||
|
|
||||||
DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aParent,
|
DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aParent,
|
||||||
LIB_PART* aSymbol ) :
|
LIB_SYMBOL* aSymbol ) :
|
||||||
DIALOG_UPDATE_SYMBOL_FIELDS_BASE( aParent ),
|
DIALOG_UPDATE_SYMBOL_FIELDS_BASE( aParent ),
|
||||||
m_editFrame( aParent ),
|
m_editFrame( aParent ),
|
||||||
m_symbol( aSymbol)
|
m_symbol( aSymbol)
|
||||||
|
@ -82,9 +82,9 @@ DIALOG_UPDATE_SYMBOL_FIELDS::~DIALOG_UPDATE_SYMBOL_FIELDS()
|
||||||
void DIALOG_UPDATE_SYMBOL_FIELDS::updateFieldsList()
|
void DIALOG_UPDATE_SYMBOL_FIELDS::updateFieldsList()
|
||||||
{
|
{
|
||||||
// Load non-mandatory fields from the parent part
|
// Load non-mandatory fields from the parent part
|
||||||
std::vector<LIB_FIELD*> libFields;
|
std::vector<LIB_FIELD*> libFields;
|
||||||
std::set<wxString> fieldNames;
|
std::set<wxString> fieldNames;
|
||||||
std::unique_ptr<LIB_PART> flattenedParent = m_symbol->GetParent().lock()->Flatten();
|
std::unique_ptr<LIB_SYMBOL> flattenedParent = m_symbol->GetParent().lock()->Flatten();
|
||||||
|
|
||||||
flattenedParent->GetFields( libFields );
|
flattenedParent->GetFields( libFields );
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ void DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked( wxCommandEvent& aEvent )
|
||||||
m_updateFields.insert( m_fieldsBox->GetString( i ) );
|
m_updateFields.insert( m_fieldsBox->GetString( i ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<LIB_PART> flattenedParent = m_symbol->GetParent().lock()->Flatten();
|
std::unique_ptr<LIB_SYMBOL> flattenedParent = m_symbol->GetParent().lock()->Flatten();
|
||||||
|
|
||||||
bool removeExtras = m_removeExtraBox->GetValue();
|
bool removeExtras = m_removeExtraBox->GetValue();
|
||||||
bool resetVis = m_resetFieldVisibilities->GetValue();
|
bool resetVis = m_resetFieldVisibilities->GetValue();
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <dialog_update_symbol_fields_base.h>
|
#include <dialog_update_symbol_fields_base.h>
|
||||||
|
|
||||||
class LIB_ID;
|
class LIB_ID;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class SYMBOL_EDIT_FRAME;
|
class SYMBOL_EDIT_FRAME;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +33,7 @@ class SYMBOL_EDIT_FRAME;
|
||||||
class DIALOG_UPDATE_SYMBOL_FIELDS : public DIALOG_UPDATE_SYMBOL_FIELDS_BASE
|
class DIALOG_UPDATE_SYMBOL_FIELDS : public DIALOG_UPDATE_SYMBOL_FIELDS_BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aParent, LIB_PART* aPart );
|
DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aParent, LIB_SYMBOL* aSymbol );
|
||||||
~DIALOG_UPDATE_SYMBOL_FIELDS() override;
|
~DIALOG_UPDATE_SYMBOL_FIELDS() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -56,7 +56,7 @@ private:
|
||||||
void updateFieldsList();
|
void updateFieldsList();
|
||||||
|
|
||||||
SYMBOL_EDIT_FRAME* m_editFrame;
|
SYMBOL_EDIT_FRAME* m_editFrame;
|
||||||
LIB_PART* m_symbol;
|
LIB_SYMBOL* m_symbol;
|
||||||
|
|
||||||
///< Set of field names that should have values updated
|
///< Set of field names that should have values updated
|
||||||
std::set<wxString> m_updateFields;
|
std::set<wxString> m_updateFields;
|
||||||
|
|
|
@ -331,26 +331,26 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
|
||||||
t2->SetSelected();
|
t2->SetSelected();
|
||||||
|
|
||||||
{
|
{
|
||||||
LIB_PART* part = new LIB_PART( wxEmptyString );
|
LIB_SYMBOL* symbol = new LIB_SYMBOL( wxEmptyString );
|
||||||
wxPoint p( 2625, -1600 );
|
wxPoint p( 2625, -1600 );
|
||||||
|
|
||||||
LIB_FIELD& ref = part->GetReferenceField();
|
LIB_FIELD& ref = symbol->GetReferenceField();
|
||||||
|
|
||||||
ref.SetText( wxT( "U1" ) );
|
ref.SetText( wxT( "U1" ) );
|
||||||
ref.SetPosition( MILS_POINT( p.x + 30, p.y + 260 ) );
|
ref.SetPosition( MILS_POINT( p.x + 30, p.y + 260 ) );
|
||||||
ref.SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
ref.SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||||
|
|
||||||
LIB_FIELD& value = part->GetValueField();
|
LIB_FIELD& value = symbol->GetValueField();
|
||||||
|
|
||||||
value.SetText( wxT( "OPA604" ) );
|
value.SetText( wxT( "OPA604" ) );
|
||||||
value.SetPosition( MILS_POINT( p.x + 30, p.y + 180 ) );
|
value.SetPosition( MILS_POINT( p.x + 30, p.y + 180 ) );
|
||||||
value.SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
value.SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||||
|
|
||||||
part->SetShowPinNames( true );
|
symbol->SetShowPinNames( true );
|
||||||
part->SetShowPinNumbers( true );
|
symbol->SetShowPinNumbers( true );
|
||||||
part->SetPinNameOffset( 0 );
|
symbol->SetPinNameOffset( 0 );
|
||||||
|
|
||||||
LIB_POLYLINE* comp_body = new LIB_POLYLINE( part );
|
LIB_POLYLINE* comp_body = new LIB_POLYLINE( symbol );
|
||||||
|
|
||||||
comp_body->SetUnit( 0 );
|
comp_body->SetUnit( 0 );
|
||||||
comp_body->SetConvert( 0 );
|
comp_body->SetConvert( 0 );
|
||||||
|
@ -363,7 +363,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
|
||||||
|
|
||||||
addItem( comp_body );
|
addItem( comp_body );
|
||||||
|
|
||||||
LIB_PIN* pin = new LIB_PIN( part );
|
LIB_PIN* pin = new LIB_PIN( symbol );
|
||||||
|
|
||||||
pin->SetPosition( MILS_POINT( p.x - 200, p.y + 100 ) );
|
pin->SetPosition( MILS_POINT( p.x - 200, p.y + 100 ) );
|
||||||
pin->SetLength( Mils2iu( 100 ) );
|
pin->SetLength( Mils2iu( 100 ) );
|
||||||
|
@ -372,9 +372,9 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
|
||||||
pin->SetNumber( wxT( "1" ) );
|
pin->SetNumber( wxT( "1" ) );
|
||||||
pin->SetName( wxT( "-" ) );
|
pin->SetName( wxT( "-" ) );
|
||||||
|
|
||||||
part->AddDrawItem( pin );
|
symbol->AddDrawItem( pin );
|
||||||
|
|
||||||
pin = new LIB_PIN( part );
|
pin = new LIB_PIN( symbol );
|
||||||
|
|
||||||
pin->SetPosition( MILS_POINT( p.x - 200, p.y - 100 ) );
|
pin->SetPosition( MILS_POINT( p.x - 200, p.y - 100 ) );
|
||||||
pin->SetLength( Mils2iu( 100 ) );
|
pin->SetLength( Mils2iu( 100 ) );
|
||||||
|
@ -383,9 +383,9 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
|
||||||
pin->SetNumber( wxT( "2" ) );
|
pin->SetNumber( wxT( "2" ) );
|
||||||
pin->SetName( wxT( "+" ) );
|
pin->SetName( wxT( "+" ) );
|
||||||
|
|
||||||
part->AddDrawItem( pin );
|
symbol->AddDrawItem( pin );
|
||||||
|
|
||||||
pin = new LIB_PIN( part );
|
pin = new LIB_PIN( symbol );
|
||||||
|
|
||||||
pin->SetPosition( MILS_POINT( p.x + 200, p.y ) );
|
pin->SetPosition( MILS_POINT( p.x + 200, p.y ) );
|
||||||
pin->SetLength( Mils2iu( 100 ) );
|
pin->SetLength( Mils2iu( 100 ) );
|
||||||
|
@ -394,9 +394,9 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
|
||||||
pin->SetNumber( wxT( "3" ) );
|
pin->SetNumber( wxT( "3" ) );
|
||||||
pin->SetName( wxT( "OUT" ) );
|
pin->SetName( wxT( "OUT" ) );
|
||||||
|
|
||||||
part->AddDrawItem( pin );
|
symbol->AddDrawItem( pin );
|
||||||
|
|
||||||
addItem( part );
|
addItem( symbol );
|
||||||
}
|
}
|
||||||
|
|
||||||
SCH_SHEET* s = new SCH_SHEET( nullptr, MILS_POINT( 4000, 1300 ) );
|
SCH_SHEET* s = new SCH_SHEET( nullptr, MILS_POINT( 4000, 1300 ) );
|
||||||
|
|
|
@ -59,13 +59,13 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
|
||||||
// Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
|
// Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
|
||||||
int refStyleSelection;
|
int refStyleSelection;
|
||||||
|
|
||||||
switch( LIB_PART::GetSubpartIdSeparator() )
|
switch( LIB_SYMBOL::GetSubpartIdSeparator() )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 0: refStyleSelection = 0; break;
|
case 0: refStyleSelection = 0; break;
|
||||||
case '.': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 4 : 1; break;
|
case '.': refStyleSelection = LIB_SYMBOL::GetSubpartFirstId() == '1' ? 4 : 1; break;
|
||||||
case '-': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 5 : 2; break;
|
case '-': refStyleSelection = LIB_SYMBOL::GetSubpartFirstId() == '1' ? 5 : 2; break;
|
||||||
case '_': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 6 : 3; break;
|
case '_': refStyleSelection = LIB_SYMBOL::GetSubpartFirstId() == '1' ? 6 : 3; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_choiceSeparatorRefId->SetSelection( refStyleSelection );
|
m_choiceSeparatorRefId->SetSelection( refStyleSelection );
|
||||||
|
@ -119,10 +119,10 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
|
||||||
case 6: firstRefId = '1'; refSeparator = '_'; break;
|
case 6: firstRefId = '1'; refSeparator = '_'; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( refSeparator != LIB_PART::GetSubpartIdSeparator() ||
|
if( refSeparator != LIB_SYMBOL::GetSubpartIdSeparator() ||
|
||||||
firstRefId != LIB_PART::GetSubpartFirstId() )
|
firstRefId != LIB_SYMBOL::GetSubpartFirstId() )
|
||||||
{
|
{
|
||||||
LIB_PART::SetSubpartIdNotation( refSeparator, firstRefId );
|
LIB_SYMBOL::SetSubpartIdNotation( refSeparator, firstRefId );
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.m_DefaultTextSize = (int) m_textSize.GetValue();
|
settings.m_DefaultTextSize = (int) m_textSize.GetValue();
|
||||||
|
|
|
@ -799,11 +799,11 @@ void PANEL_SYM_LIB_TABLE::onConvertLegacyLibraries( wxCommandEvent& event )
|
||||||
bool PANEL_SYM_LIB_TABLE::convertLibrary( const wxString& aLibrary, const wxString& legacyFilepath,
|
bool PANEL_SYM_LIB_TABLE::convertLibrary( const wxString& aLibrary, const wxString& legacyFilepath,
|
||||||
const wxString& newFilepath )
|
const wxString& newFilepath )
|
||||||
{
|
{
|
||||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER legacyPI( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
|
SCH_PLUGIN::SCH_PLUGIN_RELEASER legacyPI( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
|
||||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER kicadPI( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
|
SCH_PLUGIN::SCH_PLUGIN_RELEASER kicadPI( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
|
||||||
std::vector<LIB_PART*> parts;
|
std::vector<LIB_SYMBOL*> symbols;
|
||||||
std::vector<LIB_PART*> newParts;
|
std::vector<LIB_SYMBOL*> newSymbols;
|
||||||
std::map<LIB_PART*, LIB_PART*> partMap;
|
std::map<LIB_SYMBOL*, LIB_SYMBOL*> symbolMap;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -816,32 +816,32 @@ bool PANEL_SYM_LIB_TABLE::convertLibrary( const wxString& aLibrary, const wxStri
|
||||||
// This will write the file
|
// This will write the file
|
||||||
delete formatter;
|
delete formatter;
|
||||||
|
|
||||||
legacyPI->EnumerateSymbolLib( parts, legacyFilepath );
|
legacyPI->EnumerateSymbolLib( symbols, legacyFilepath );
|
||||||
|
|
||||||
// Copy non-aliases first so we can build a map from parts to newParts
|
// Copy non-aliases first so we can build a map from symbols to newSymbols
|
||||||
for( LIB_PART* part : parts )
|
for( LIB_SYMBOL* symbol : symbols )
|
||||||
{
|
{
|
||||||
if( part->IsAlias() )
|
if( symbol->IsAlias() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
newParts.push_back( new LIB_PART( *part ) );
|
newSymbols.push_back( new LIB_SYMBOL( *symbol ) );
|
||||||
partMap[part] = newParts.back();
|
symbolMap[symbol] = newSymbols.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now do the aliases using the map to hook them up to their newPart parents
|
// Now do the aliases using the map to hook them up to their newSymbol parents
|
||||||
for( LIB_PART* part : parts )
|
for( LIB_SYMBOL* symbol : symbols )
|
||||||
{
|
{
|
||||||
if( !part->IsAlias() )
|
if( !symbol->IsAlias() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
newParts.push_back( new LIB_PART( *part ) );
|
newSymbols.push_back( new LIB_SYMBOL( *symbol ) );
|
||||||
newParts.back()->SetParent( partMap[ part->GetParent().lock().get() ] );
|
newSymbols.back()->SetParent( symbolMap[ symbol->GetParent().lock().get() ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally write out newParts
|
// Finally write out newSymbols
|
||||||
for( LIB_PART* part : newParts )
|
for( LIB_SYMBOL* symbol : newSymbols )
|
||||||
{
|
{
|
||||||
kicadPI->SaveSymbol( newFilepath, part );
|
kicadPI->SaveSymbol( newFilepath, symbol );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( ... )
|
catch( ... )
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Scan an #EDA_ITEM using this class's Inspector method which does the collection.
|
* Scan an #EDA_ITEM using this class's Inspector method which does the collection.
|
||||||
*
|
*
|
||||||
* @param aItems is a LIB_PART multivector holding the part items.
|
* @param aItems is a LIB_SYMBOL multivector holding the symbol items.
|
||||||
* @param aFilterList is a list of #KICAD_T types with a terminating #EOT, that determines
|
* @param aFilterList is a list of #KICAD_T types with a terminating #EOT, that determines
|
||||||
* what is to be collected and the priority order of the resulting
|
* what is to be collected and the priority order of the resulting
|
||||||
* collection.
|
* collection.
|
||||||
|
|
|
@ -86,8 +86,8 @@ bool SCH_EDIT_FRAME::LoadProjectSettings()
|
||||||
|
|
||||||
// Verify some values, because the config file can be edited by hand,
|
// Verify some values, because the config file can be edited by hand,
|
||||||
// and have bad values:
|
// and have bad values:
|
||||||
LIB_PART::SetSubpartIdNotation( LIB_PART::GetSubpartIdSeparator(),
|
LIB_SYMBOL::SetSubpartIdNotation( LIB_SYMBOL::GetSubpartIdSeparator(),
|
||||||
LIB_PART::GetSubpartFirstId() );
|
LIB_SYMBOL::GetSubpartFirstId() );
|
||||||
|
|
||||||
// Load the drawing sheet description file, from the filename stored in
|
// Load the drawing sheet description file, from the filename stored in
|
||||||
// BASE_SCREEN::m_DrawingSheetFileName, read in config project file
|
// BASE_SCREEN::m_DrawingSheetFileName, read in config project file
|
||||||
|
|
|
@ -690,7 +690,7 @@ int ERC_TESTER::TestLibSymbolIssues()
|
||||||
|
|
||||||
wxCHECK2( symbol, continue );
|
wxCHECK2( symbol, continue );
|
||||||
|
|
||||||
LIB_PART* libSymbolInSchematic = symbol->GetPartRef().get();
|
LIB_SYMBOL* libSymbolInSchematic = symbol->GetPartRef().get();
|
||||||
|
|
||||||
wxCHECK2( libSymbolInSchematic, continue );
|
wxCHECK2( libSymbolInSchematic, continue );
|
||||||
|
|
||||||
|
@ -720,8 +720,8 @@ int ERC_TESTER::TestLibSymbolIssues()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString symbolName = symbol->GetLibId().GetLibItemName();
|
wxString symbolName = symbol->GetLibId().GetLibItemName();
|
||||||
LIB_PART* libSymbol = SchGetLibPart( symbol->GetLibId(), libTable );
|
LIB_SYMBOL* libSymbol = SchGetLibPart( symbol->GetLibId(), libTable );
|
||||||
|
|
||||||
if( libSymbol == nullptr )
|
if( libSymbol == nullptr )
|
||||||
{
|
{
|
||||||
|
@ -736,7 +736,7 @@ int ERC_TESTER::TestLibSymbolIssues()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<LIB_PART> flattenedSymbol = libSymbol->Flatten();
|
std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->Flatten();
|
||||||
|
|
||||||
if( *flattenedSymbol != *libSymbolInSchematic )
|
if( *flattenedSymbol != *libSymbolInSchematic )
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,13 +47,13 @@ enum
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* aFrame,
|
FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* aFrame,
|
||||||
WX_GRID* aGrid, LIB_PART* aPart ) :
|
WX_GRID* aGrid, LIB_SYMBOL* aSymbol ) :
|
||||||
m_frame( aFrame ),
|
m_frame( aFrame ),
|
||||||
m_userUnits( aDialog->GetUserUnits() ),
|
m_userUnits( aDialog->GetUserUnits() ),
|
||||||
m_grid( aGrid ),
|
m_grid( aGrid ),
|
||||||
m_parentType( SCH_SYMBOL_T ),
|
m_parentType( SCH_SYMBOL_T ),
|
||||||
m_mandatoryFieldCount( MANDATORY_FIELDS ),
|
m_mandatoryFieldCount( MANDATORY_FIELDS ),
|
||||||
m_part( aPart ),
|
m_part( aSymbol ),
|
||||||
m_fieldNameValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_NAME ),
|
m_fieldNameValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_NAME ),
|
||||||
m_referenceValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), REFERENCE_FIELD ),
|
m_referenceValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), REFERENCE_FIELD ),
|
||||||
m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), VALUE_FIELD ),
|
m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), VALUE_FIELD ),
|
||||||
|
|
|
@ -73,7 +73,7 @@ class FIELDS_GRID_TABLE : public wxGridTableBase, public std::vector<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* aFrame, WX_GRID* aGrid,
|
FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* aFrame, WX_GRID* aGrid,
|
||||||
LIB_PART* aPart );
|
LIB_SYMBOL* aSymbol );
|
||||||
FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* aFrame, WX_GRID* aGrid,
|
FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* aFrame, WX_GRID* aGrid,
|
||||||
SCH_SHEET* aSheet );
|
SCH_SHEET* aSheet );
|
||||||
~FIELDS_GRID_TABLE();
|
~FIELDS_GRID_TABLE();
|
||||||
|
@ -110,7 +110,7 @@ private:
|
||||||
WX_GRID* m_grid;
|
WX_GRID* m_grid;
|
||||||
KICAD_T m_parentType;
|
KICAD_T m_parentType;
|
||||||
int m_mandatoryFieldCount;
|
int m_mandatoryFieldCount;
|
||||||
LIB_PART* m_part;
|
LIB_SYMBOL* m_part;
|
||||||
wxString m_curdir;
|
wxString m_curdir;
|
||||||
|
|
||||||
SCH_FIELD_VALIDATOR m_fieldNameValidator;
|
SCH_FIELD_VALIDATOR m_fieldNameValidator;
|
||||||
|
|
|
@ -50,7 +50,7 @@ class FOOTPRINT_INFO_GENERATOR
|
||||||
wxString m_html;
|
wxString m_html;
|
||||||
SYMBOL_LIB_TABLE* m_sym_lib_table;
|
SYMBOL_LIB_TABLE* m_sym_lib_table;
|
||||||
LIB_ID const m_lib_id;
|
LIB_ID const m_lib_id;
|
||||||
LIB_PART* m_symbol;
|
LIB_SYMBOL* m_symbol;
|
||||||
int m_unit;
|
int m_unit;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -122,7 +122,7 @@ protected:
|
||||||
wxString root_name = _( "Unknown" );
|
wxString root_name = _( "Unknown" );
|
||||||
wxString root_desc = "";
|
wxString root_desc = "";
|
||||||
|
|
||||||
std::shared_ptr< LIB_PART > parent = m_symbol->GetParent().lock();
|
std::shared_ptr< LIB_SYMBOL > parent = m_symbol->GetParent().lock();
|
||||||
|
|
||||||
if( parent )
|
if( parent )
|
||||||
{
|
{
|
||||||
|
@ -212,7 +212,7 @@ protected:
|
||||||
|
|
||||||
if( m_symbol->IsAlias() )
|
if( m_symbol->IsAlias() )
|
||||||
{
|
{
|
||||||
std::shared_ptr<LIB_PART> parent = m_symbol->GetParent().lock();
|
std::shared_ptr<LIB_SYMBOL> parent = m_symbol->GetParent().lock();
|
||||||
|
|
||||||
// Append all of the unique parent fields if this is an alias.
|
// Append all of the unique parent fields if this is an alias.
|
||||||
if( parent )
|
if( parent )
|
||||||
|
|
|
@ -124,7 +124,7 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte
|
||||||
|
|
||||||
for( const PICKED_SYMBOL& i : aHistoryList )
|
for( const PICKED_SYMBOL& i : aHistoryList )
|
||||||
{
|
{
|
||||||
LIB_PART* symbol = GetLibPart( i.LibId );
|
LIB_SYMBOL* symbol = GetLibPart( i.LibId );
|
||||||
|
|
||||||
// This can be null, for example when a symbol has been deleted from a library
|
// This can be null, for example when a symbol has been deleted from a library
|
||||||
if( symbol )
|
if( symbol )
|
||||||
|
@ -196,12 +196,12 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::SelectUnit( SCH_SYMBOL* aSymbol, int aUnit )
|
void SCH_EDIT_FRAME::SelectUnit( SCH_SYMBOL* aSymbol, int aUnit )
|
||||||
{
|
{
|
||||||
LIB_PART* part = GetLibPart( aSymbol->GetLibId() );
|
LIB_SYMBOL* symbol = GetLibPart( aSymbol->GetLibId() );
|
||||||
|
|
||||||
if( !part )
|
if( !symbol )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int unitCount = part->GetUnitCount();
|
int unitCount = symbol->GetUnitCount();
|
||||||
|
|
||||||
if( unitCount <= 1 || aSymbol->GetUnit() == aUnit )
|
if( unitCount <= 1 || aSymbol->GetUnit() == aUnit )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
|
|
||||||
class wxFrame;
|
class wxFrame;
|
||||||
class wxDialog;
|
class wxDialog;
|
||||||
class LIB_PART;
|
|
||||||
class PART_LIBS;
|
class PART_LIBS;
|
||||||
class SCH_SYMBOL;
|
class SCH_SYMBOL;
|
||||||
class SCH_TEXT;
|
class SCH_TEXT;
|
||||||
|
|
|
@ -44,7 +44,7 @@ static inline wxPoint twoPointVector( const wxPoint &startPoint, const wxPoint &
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_ARC::LIB_ARC( LIB_PART* aParent ) : LIB_ITEM( LIB_ARC_T, aParent )
|
LIB_ARC::LIB_ARC( LIB_SYMBOL* aParent ) : LIB_ITEM( LIB_ARC_T, aParent )
|
||||||
{
|
{
|
||||||
m_Radius = 0;
|
m_Radius = 0;
|
||||||
m_t1 = 0;
|
m_t1 = 0;
|
||||||
|
|
|
@ -35,7 +35,7 @@ class TRANSFORM;
|
||||||
class LIB_ARC : public LIB_ITEM
|
class LIB_ARC : public LIB_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LIB_ARC( LIB_PART * aParent );
|
LIB_ARC( LIB_SYMBOL* aParent );
|
||||||
|
|
||||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <settings/color_settings.h>
|
#include <settings/color_settings.h>
|
||||||
|
|
||||||
|
|
||||||
LIB_BEZIER::LIB_BEZIER( LIB_PART* aParent ) :
|
LIB_BEZIER::LIB_BEZIER( LIB_SYMBOL* aParent ) :
|
||||||
LIB_ITEM( LIB_BEZIER_T, aParent )
|
LIB_ITEM( LIB_BEZIER_T, aParent )
|
||||||
{
|
{
|
||||||
m_fill = FILL_TYPE::NO_FILL;
|
m_fill = FILL_TYPE::NO_FILL;
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
class LIB_BEZIER : public LIB_ITEM
|
class LIB_BEZIER : public LIB_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LIB_BEZIER( LIB_PART * aParent );
|
LIB_BEZIER( LIB_SYMBOL* aParent );
|
||||||
|
|
||||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
|
|
||||||
|
|
||||||
LIB_CIRCLE::LIB_CIRCLE( LIB_PART* aParent ) :
|
LIB_CIRCLE::LIB_CIRCLE( LIB_SYMBOL* aParent ) :
|
||||||
LIB_ITEM( LIB_CIRCLE_T, aParent )
|
LIB_ITEM( LIB_CIRCLE_T, aParent )
|
||||||
{
|
{
|
||||||
m_Width = 0;
|
m_Width = 0;
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
class LIB_CIRCLE : public LIB_ITEM
|
class LIB_CIRCLE : public LIB_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LIB_CIRCLE( LIB_PART* aParent );
|
LIB_CIRCLE( LIB_SYMBOL* aParent );
|
||||||
|
|
||||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#include <settings/color_settings.h>
|
#include <settings/color_settings.h>
|
||||||
|
|
||||||
|
|
||||||
LIB_FIELD::LIB_FIELD(LIB_PART * aParent, int idfield ) :
|
LIB_FIELD::LIB_FIELD( LIB_SYMBOL* aParent, int idfield ) :
|
||||||
LIB_ITEM( LIB_FIELD_T, aParent )
|
LIB_ITEM( LIB_FIELD_T, aParent )
|
||||||
{
|
{
|
||||||
Init( idfield );
|
Init( idfield );
|
||||||
|
@ -129,7 +129,7 @@ bool LIB_FIELD::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||||
// Reference designator text has one or 2 additional character (displays U? or U?A)
|
// Reference designator text has one or 2 additional character (displays U? or U?A)
|
||||||
if( m_id == REFERENCE_FIELD )
|
if( m_id == REFERENCE_FIELD )
|
||||||
{
|
{
|
||||||
const LIB_PART* parent = dynamic_cast<const LIB_PART*>( m_parent );
|
const LIB_SYMBOL* parent = dynamic_cast<const LIB_SYMBOL*>( m_parent );
|
||||||
|
|
||||||
wxString extended_text = tmp_text.GetText();
|
wxString extended_text = tmp_text.GetText();
|
||||||
extended_text.Append('?');
|
extended_text.Append('?');
|
||||||
|
@ -303,7 +303,7 @@ wxString LIB_FIELD::GetFullText( int unit ) const
|
||||||
wxCHECK( GetParent(), text );
|
wxCHECK( GetParent(), text );
|
||||||
|
|
||||||
if( GetParent()->IsMulti() )
|
if( GetParent()->IsMulti() )
|
||||||
text << LIB_PART::SubReference( unit );
|
text << LIB_SYMBOL::SubReference( unit );
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,35 +58,12 @@ class SCH_LEGACY_PLUGIN_CACHE;
|
||||||
*/
|
*/
|
||||||
class LIB_FIELD : public LIB_ITEM, public EDA_TEXT
|
class LIB_FIELD : public LIB_ITEM, public EDA_TEXT
|
||||||
{
|
{
|
||||||
int m_id; ///< @see enum MANDATORY_FIELD_T
|
|
||||||
wxString m_name; ///< Name (not the field text value itself, that is .m_Text)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Print the field.
|
|
||||||
* <p>
|
|
||||||
* If \a aData not NULL, \a aData must point a wxString which is used instead of
|
|
||||||
* the m_Text
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
|
||||||
const TRANSFORM& aTransform ) override;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculate the new circle at \a aPosition when editing.
|
|
||||||
*
|
|
||||||
* @param aPosition - The position to edit the circle in drawing coordinates.
|
|
||||||
*/
|
|
||||||
void CalcEdit( const wxPoint& aPosition ) override;
|
|
||||||
|
|
||||||
friend class SCH_LEGACY_PLUGIN_CACHE; // Required to access m_name.
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LIB_FIELD( int idfield = 2 );
|
LIB_FIELD( int idfield = 2 );
|
||||||
|
|
||||||
LIB_FIELD( int aID, const wxString& aName );
|
LIB_FIELD( int aID, const wxString& aName );
|
||||||
|
|
||||||
LIB_FIELD( LIB_PART * aParent, int idfield = 2 );
|
LIB_FIELD( LIB_SYMBOL* aParent, int idfield = 2 );
|
||||||
|
|
||||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||||
|
|
||||||
|
@ -213,6 +190,27 @@ private:
|
||||||
*/
|
*/
|
||||||
int compare( const LIB_ITEM& aOther,
|
int compare( const LIB_ITEM& aOther,
|
||||||
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
|
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print the field.
|
||||||
|
*
|
||||||
|
* If \a aData not NULL, \a aData must point a wxString which is used instead of
|
||||||
|
* the m_Text
|
||||||
|
*/
|
||||||
|
void print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
|
const TRANSFORM& aTransform ) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the new circle at \a aPosition when editing.
|
||||||
|
*
|
||||||
|
* @param aPosition - The position to edit the circle in drawing coordinates.
|
||||||
|
*/
|
||||||
|
void CalcEdit( const wxPoint& aPosition ) override;
|
||||||
|
|
||||||
|
friend class SCH_LEGACY_PLUGIN_CACHE; // Required to access m_name.
|
||||||
|
|
||||||
|
int m_id; ///< @see enum MANDATORY_FIELD_T
|
||||||
|
wxString m_name; ///< Name (not the field text value itself, that is .m_Text)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLASS_LIBENTRY_FIELDS_H
|
#endif // CLASS_LIBENTRY_FIELDS_H
|
||||||
|
|
|
@ -33,7 +33,7 @@ const int fill_tab[3] = { 'N', 'F', 'f' };
|
||||||
|
|
||||||
|
|
||||||
LIB_ITEM::LIB_ITEM( KICAD_T aType,
|
LIB_ITEM::LIB_ITEM( KICAD_T aType,
|
||||||
LIB_PART* aComponent,
|
LIB_SYMBOL* aSymbol,
|
||||||
int aUnit,
|
int aUnit,
|
||||||
int aConvert,
|
int aConvert,
|
||||||
FILL_TYPE aFillType ) :
|
FILL_TYPE aFillType ) :
|
||||||
|
@ -42,7 +42,7 @@ LIB_ITEM::LIB_ITEM( KICAD_T aType,
|
||||||
m_unit = aUnit;
|
m_unit = aUnit;
|
||||||
m_convert = aConvert;
|
m_convert = aConvert;
|
||||||
m_fill = aFillType;
|
m_fill = aFillType;
|
||||||
m_parent = (EDA_ITEM*) aComponent;
|
m_parent = (EDA_ITEM*) aSymbol;
|
||||||
m_isFillable = false;
|
m_isFillable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
class LINE_READER;
|
class LINE_READER;
|
||||||
class OUTPUTFORMATTER;
|
class OUTPUTFORMATTER;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class PLOTTER;
|
class PLOTTER;
|
||||||
class LIB_PIN;
|
class LIB_PIN;
|
||||||
class MSG_PANEL_ITEM;
|
class MSG_PANEL_ITEM;
|
||||||
|
@ -61,7 +61,7 @@ typedef std::vector< LIB_PIN* > LIB_PINS;
|
||||||
class LIB_ITEM : public EDA_ITEM
|
class LIB_ITEM : public EDA_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LIB_ITEM( KICAD_T aType, LIB_PART* aComponent = NULL, int aUnit = 0, int aConvert = 0,
|
LIB_ITEM( KICAD_T aType, LIB_SYMBOL* aSymbol = nullptr, int aUnit = 0, int aConvert = 0,
|
||||||
FILL_TYPE aFillType = FILL_TYPE::NO_FILL );
|
FILL_TYPE aFillType = FILL_TYPE::NO_FILL );
|
||||||
|
|
||||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||||
|
@ -143,9 +143,9 @@ public:
|
||||||
|
|
||||||
virtual int GetPenWidth() const = 0;
|
virtual int GetPenWidth() const = 0;
|
||||||
|
|
||||||
LIB_PART* GetParent() const
|
LIB_SYMBOL* GetParent() const
|
||||||
{
|
{
|
||||||
return (LIB_PART*) m_parent;
|
return (LIB_SYMBOL*) m_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||||
|
@ -304,7 +304,7 @@ protected:
|
||||||
const TRANSFORM& aTransform ) = 0;
|
const TRANSFORM& aTransform ) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class LIB_PART;
|
friend class LIB_SYMBOL;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -90,7 +90,7 @@ static int externalPinDecoSize( const RENDER_SETTINGS* aSettings, const LIB_PIN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PIN::LIB_PIN( LIB_PART* aParent ) :
|
LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent ) :
|
||||||
LIB_ITEM( LIB_PIN_T, aParent ),
|
LIB_ITEM( LIB_PIN_T, aParent ),
|
||||||
m_orientation( PIN_RIGHT ),
|
m_orientation( PIN_RIGHT ),
|
||||||
m_shape( GRAPHIC_PINSHAPE::LINE ),
|
m_shape( GRAPHIC_PINSHAPE::LINE ),
|
||||||
|
@ -117,7 +117,7 @@ LIB_PIN::LIB_PIN( LIB_PART* aParent ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PIN::LIB_PIN( LIB_PART* aParent, const wxString& aName, const wxString& aNumber,
|
LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent, const wxString& aName, const wxString& aNumber,
|
||||||
int aOrientation, ELECTRICAL_PINTYPE aPinType, int aLength, int aNameTextSize,
|
int aOrientation, ELECTRICAL_PINTYPE aPinType, int aLength, int aNameTextSize,
|
||||||
int aNumTextSize, int aConvert, const wxPoint& aPos, int aUnit ) :
|
int aNumTextSize, int aConvert, const wxPoint& aPos, int aUnit ) :
|
||||||
LIB_ITEM( LIB_PIN_T, aParent ),
|
LIB_ITEM( LIB_PIN_T, aParent ),
|
||||||
|
@ -185,7 +185,7 @@ void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, v
|
||||||
bool showPinType = opts ? opts->show_elec_type : false;
|
bool showPinType = opts ? opts->show_elec_type : false;
|
||||||
bool show_connect_point = opts ? opts->show_connect_point : false;
|
bool show_connect_point = opts ? opts->show_connect_point : false;
|
||||||
|
|
||||||
LIB_PART* part = GetParent();
|
LIB_SYMBOL* part = GetParent();
|
||||||
|
|
||||||
/* Calculate pin orient taking in account the component orientation. */
|
/* Calculate pin orient taking in account the component orientation. */
|
||||||
int orient = PinDrawOrient( aTransform );
|
int orient = PinDrawOrient( aTransform );
|
||||||
|
|
|
@ -152,9 +152,9 @@ public:
|
||||||
*/
|
*/
|
||||||
int PinDrawOrient( const TRANSFORM& aTransform ) const;
|
int PinDrawOrient( const TRANSFORM& aTransform ) const;
|
||||||
|
|
||||||
LIB_PIN( LIB_PART* aParent );
|
LIB_PIN( LIB_SYMBOL* aParent );
|
||||||
|
|
||||||
LIB_PIN( LIB_PART* aParent, const wxString& aName, const wxString& aNumber, int aOrientation,
|
LIB_PIN( LIB_SYMBOL* aParent, const wxString& aName, const wxString& aNumber, int aOrientation,
|
||||||
ELECTRICAL_PINTYPE aPinType, int aLength, int aNameTextSize, int aNumTextSize,
|
ELECTRICAL_PINTYPE aPinType, int aLength, int aNameTextSize, int aNumTextSize,
|
||||||
int aConvert, const wxPoint& aPos, int aUnit );
|
int aConvert, const wxPoint& aPos, int aUnit );
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ public:
|
||||||
bool IsPowerConnection() const
|
bool IsPowerConnection() const
|
||||||
{
|
{
|
||||||
return GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN
|
return GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN
|
||||||
&& ( !IsVisible() || (LIB_PART*) GetParent()->IsPower() );
|
&& ( !IsVisible() || (LIB_SYMBOL*) GetParent()->IsPower() );
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetPenWidth() const override;
|
int GetPenWidth() const override;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
|
|
||||||
|
|
||||||
LIB_POLYLINE::LIB_POLYLINE( LIB_PART* aParent ) :
|
LIB_POLYLINE::LIB_POLYLINE( LIB_SYMBOL* aParent ) :
|
||||||
LIB_ITEM( LIB_POLYLINE_T, aParent )
|
LIB_ITEM( LIB_POLYLINE_T, aParent )
|
||||||
{
|
{
|
||||||
m_fill = FILL_TYPE::NO_FILL;
|
m_fill = FILL_TYPE::NO_FILL;
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
class LIB_POLYLINE : public LIB_ITEM
|
class LIB_POLYLINE : public LIB_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LIB_POLYLINE( LIB_PART * aParent );
|
LIB_POLYLINE( LIB_SYMBOL* aParent );
|
||||||
|
|
||||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
|
|
||||||
|
|
||||||
LIB_RECTANGLE::LIB_RECTANGLE( LIB_PART* aParent ) : LIB_ITEM( LIB_RECTANGLE_T, aParent )
|
LIB_RECTANGLE::LIB_RECTANGLE( LIB_SYMBOL* aParent ) : LIB_ITEM( LIB_RECTANGLE_T, aParent )
|
||||||
{
|
{
|
||||||
m_Width = 0;
|
m_Width = 0;
|
||||||
m_fill = FILL_TYPE::NO_FILL;
|
m_fill = FILL_TYPE::NO_FILL;
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
class LIB_RECTANGLE : public LIB_ITEM
|
class LIB_RECTANGLE : public LIB_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LIB_RECTANGLE( LIB_PART * aParent );
|
LIB_RECTANGLE( LIB_SYMBOL* aParent );
|
||||||
|
|
||||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||||
|
|
||||||
|
|
|
@ -38,15 +38,15 @@
|
||||||
|
|
||||||
// the separator char between the subpart id and the reference
|
// the separator char between the subpart id and the reference
|
||||||
// 0 (no separator) or '.' or some other character
|
// 0 (no separator) or '.' or some other character
|
||||||
int LIB_PART::m_subpartIdSeparator = 0;
|
int LIB_SYMBOL::m_subpartIdSeparator = 0;
|
||||||
|
|
||||||
// the ascii char value to calculate the subpart symbol id from the part number:
|
// the ascii char value to calculate the subpart symbol id from the part number:
|
||||||
// 'A' or '1' usually. (to print U1.A or U1.1)
|
// 'A' or '1' usually. (to print U1.A or U1.1)
|
||||||
// if this a digit, a number is used as id symbol
|
// if this a digit, a number is used as id symbol
|
||||||
int LIB_PART::m_subpartFirstId = 'A';
|
int LIB_SYMBOL::m_subpartFirstId = 'A';
|
||||||
|
|
||||||
|
|
||||||
wxString LIB_PART::GetSearchText()
|
wxString LIB_SYMBOL::GetSearchText()
|
||||||
{
|
{
|
||||||
// Matches are scored by offset from front of string, so inclusion of this spacer
|
// Matches are scored by offset from front of string, so inclusion of this spacer
|
||||||
// discounts matches found after it.
|
// discounts matches found after it.
|
||||||
|
@ -64,7 +64,7 @@ wxString LIB_PART::GetSearchText()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool operator<( const LIB_PART& aItem1, const LIB_PART& aItem2 )
|
bool operator<( const LIB_SYMBOL& aItem1, const LIB_SYMBOL& aItem2 )
|
||||||
{
|
{
|
||||||
return aItem1.GetName() < aItem2.GetName();
|
return aItem1.GetName() < aItem2.GetName();
|
||||||
}
|
}
|
||||||
|
@ -79,8 +79,8 @@ struct null_deleter
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
LIB_PART::LIB_PART( const wxString& aName, LIB_PART* aParent, PART_LIB* aLibrary ) :
|
LIB_SYMBOL::LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent, PART_LIB* aLibrary ) :
|
||||||
EDA_ITEM( LIB_PART_T ),
|
EDA_ITEM( LIB_SYMBOL_T ),
|
||||||
m_me( this, null_deleter() ),
|
m_me( this, null_deleter() ),
|
||||||
m_includeInBom( true ),
|
m_includeInBom( true ),
|
||||||
m_includeOnBoard( true )
|
m_includeOnBoard( true )
|
||||||
|
@ -110,31 +110,31 @@ LIB_PART::LIB_PART( const wxString& aName, LIB_PART* aParent, PART_LIB* aLibrary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART::LIB_PART( const LIB_PART& aPart, PART_LIB* aLibrary ) :
|
LIB_SYMBOL::LIB_SYMBOL( const LIB_SYMBOL& aSymbol, PART_LIB* aLibrary ) :
|
||||||
EDA_ITEM( aPart ),
|
EDA_ITEM( aSymbol ),
|
||||||
m_me( this, null_deleter() )
|
m_me( this, null_deleter() )
|
||||||
{
|
{
|
||||||
LIB_ITEM* newItem;
|
LIB_ITEM* newItem;
|
||||||
|
|
||||||
m_library = aLibrary;
|
m_library = aLibrary;
|
||||||
m_name = aPart.m_name;
|
m_name = aSymbol.m_name;
|
||||||
m_fpFilters = wxArrayString( aPart.m_fpFilters );
|
m_fpFilters = wxArrayString( aSymbol.m_fpFilters );
|
||||||
m_unitCount = aPart.m_unitCount;
|
m_unitCount = aSymbol.m_unitCount;
|
||||||
m_unitsLocked = aPart.m_unitsLocked;
|
m_unitsLocked = aSymbol.m_unitsLocked;
|
||||||
m_pinNameOffset = aPart.m_pinNameOffset;
|
m_pinNameOffset = aSymbol.m_pinNameOffset;
|
||||||
m_showPinNumbers = aPart.m_showPinNumbers;
|
m_showPinNumbers = aSymbol.m_showPinNumbers;
|
||||||
m_includeInBom = aPart.m_includeInBom;
|
m_includeInBom = aSymbol.m_includeInBom;
|
||||||
m_includeOnBoard = aPart.m_includeOnBoard;
|
m_includeOnBoard = aSymbol.m_includeOnBoard;
|
||||||
m_showPinNames = aPart.m_showPinNames;
|
m_showPinNames = aSymbol.m_showPinNames;
|
||||||
m_lastModDate = aPart.m_lastModDate;
|
m_lastModDate = aSymbol.m_lastModDate;
|
||||||
m_options = aPart.m_options;
|
m_options = aSymbol.m_options;
|
||||||
m_libId = aPart.m_libId;
|
m_libId = aSymbol.m_libId;
|
||||||
m_description = aPart.m_description;
|
m_description = aSymbol.m_description;
|
||||||
m_keyWords = aPart.m_keyWords;
|
m_keyWords = aSymbol.m_keyWords;
|
||||||
|
|
||||||
ClearSelected();
|
ClearSelected();
|
||||||
|
|
||||||
for( const LIB_ITEM& oldItem : aPart.m_drawings )
|
for( const LIB_ITEM& oldItem : aSymbol.m_drawings )
|
||||||
{
|
{
|
||||||
if( ( oldItem.GetFlags() & ( IS_NEW | STRUCT_DELETED ) ) != 0 )
|
if( ( oldItem.GetFlags() & ( IS_NEW | STRUCT_DELETED ) ) != 0 )
|
||||||
continue;
|
continue;
|
||||||
|
@ -152,44 +152,44 @@ LIB_PART::LIB_PART( const LIB_PART& aPart, PART_LIB* aLibrary ) :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PART_SPTR parent = aPart.m_parent.lock();
|
PART_SPTR parent = aSymbol.m_parent.lock();
|
||||||
|
|
||||||
if( parent )
|
if( parent )
|
||||||
SetParent( parent.get() );
|
SetParent( parent.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART::~LIB_PART()
|
LIB_SYMBOL::~LIB_SYMBOL()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const LIB_PART& LIB_PART::operator=( const LIB_PART& aPart )
|
const LIB_SYMBOL& LIB_SYMBOL::operator=( const LIB_SYMBOL& aSymbol )
|
||||||
{
|
{
|
||||||
if( &aPart == this )
|
if( &aSymbol == this )
|
||||||
return aPart;
|
return aSymbol;
|
||||||
|
|
||||||
LIB_ITEM* newItem;
|
LIB_ITEM* newItem;
|
||||||
|
|
||||||
m_library = aPart.m_library;
|
m_library = aSymbol.m_library;
|
||||||
m_name = aPart.m_name;
|
m_name = aSymbol.m_name;
|
||||||
m_fpFilters = wxArrayString( aPart.m_fpFilters );
|
m_fpFilters = wxArrayString( aSymbol.m_fpFilters );
|
||||||
m_unitCount = aPart.m_unitCount;
|
m_unitCount = aSymbol.m_unitCount;
|
||||||
m_unitsLocked = aPart.m_unitsLocked;
|
m_unitsLocked = aSymbol.m_unitsLocked;
|
||||||
m_pinNameOffset = aPart.m_pinNameOffset;
|
m_pinNameOffset = aSymbol.m_pinNameOffset;
|
||||||
m_showPinNumbers = aPart.m_showPinNumbers;
|
m_showPinNumbers = aSymbol.m_showPinNumbers;
|
||||||
m_showPinNames = aPart.m_showPinNames;
|
m_showPinNames = aSymbol.m_showPinNames;
|
||||||
m_includeInBom = aPart.m_includeInBom;
|
m_includeInBom = aSymbol.m_includeInBom;
|
||||||
m_includeOnBoard = aPart.m_includeOnBoard;
|
m_includeOnBoard = aSymbol.m_includeOnBoard;
|
||||||
m_lastModDate = aPart.m_lastModDate;
|
m_lastModDate = aSymbol.m_lastModDate;
|
||||||
m_options = aPart.m_options;
|
m_options = aSymbol.m_options;
|
||||||
m_libId = aPart.m_libId;
|
m_libId = aSymbol.m_libId;
|
||||||
m_description = aPart.m_description;
|
m_description = aSymbol.m_description;
|
||||||
m_keyWords = aPart.m_keyWords;
|
m_keyWords = aSymbol.m_keyWords;
|
||||||
|
|
||||||
m_drawings.clear();
|
m_drawings.clear();
|
||||||
|
|
||||||
for( const LIB_ITEM& oldItem : aPart.m_drawings )
|
for( const LIB_ITEM& oldItem : aSymbol.m_drawings )
|
||||||
{
|
{
|
||||||
if( ( oldItem.GetFlags() & ( IS_NEW | STRUCT_DELETED ) ) != 0 )
|
if( ( oldItem.GetFlags() & ( IS_NEW | STRUCT_DELETED ) ) != 0 )
|
||||||
continue;
|
continue;
|
||||||
|
@ -201,7 +201,7 @@ const LIB_PART& LIB_PART::operator=( const LIB_PART& aPart )
|
||||||
|
|
||||||
m_drawings.sort();
|
m_drawings.sort();
|
||||||
|
|
||||||
PART_SPTR parent = aPart.m_parent.lock();
|
PART_SPTR parent = aSymbol.m_parent.lock();
|
||||||
|
|
||||||
if( parent )
|
if( parent )
|
||||||
SetParent( parent.get() );
|
SetParent( parent.get() );
|
||||||
|
@ -210,7 +210,7 @@ const LIB_PART& LIB_PART::operator=( const LIB_PART& aPart )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LIB_PART::Compare( const LIB_PART& aRhs ) const
|
int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs ) const
|
||||||
{
|
{
|
||||||
if( m_me == aRhs.m_me )
|
if( m_me == aRhs.m_me )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -305,13 +305,13 @@ int LIB_PART::Compare( const LIB_PART& aRhs ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString LIB_PART::GetUnitReference( int aUnit )
|
wxString LIB_SYMBOL::GetUnitReference( int aUnit )
|
||||||
{
|
{
|
||||||
return LIB_PART::SubReference( aUnit, false );
|
return LIB_SYMBOL::SubReference( aUnit, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::SetName( const wxString& aName )
|
void LIB_SYMBOL::SetName( const wxString& aName )
|
||||||
{
|
{
|
||||||
wxString validatedName = LIB_ID::FixIllegalChars( aName );
|
wxString validatedName = LIB_ID::FixIllegalChars( aName );
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ void LIB_PART::SetName( const wxString& aName )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::SetParent( LIB_PART* aParent )
|
void LIB_SYMBOL::SetParent( LIB_SYMBOL* aParent )
|
||||||
{
|
{
|
||||||
if( aParent )
|
if( aParent )
|
||||||
m_parent = aParent->SharedPtr();
|
m_parent = aParent->SharedPtr();
|
||||||
|
@ -331,9 +331,9 @@ void LIB_PART::SetParent( LIB_PART* aParent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr< LIB_PART > LIB_PART::Flatten() const
|
std::unique_ptr< LIB_SYMBOL > LIB_SYMBOL::Flatten() const
|
||||||
{
|
{
|
||||||
std::unique_ptr< LIB_PART > retv;
|
std::unique_ptr< LIB_SYMBOL > retv;
|
||||||
|
|
||||||
if( IsAlias() )
|
if( IsAlias() )
|
||||||
{
|
{
|
||||||
|
@ -343,7 +343,7 @@ std::unique_ptr< LIB_PART > LIB_PART::Flatten() const
|
||||||
wxString::Format( "Parent of derived symbol '%s' undefined", m_name ) );
|
wxString::Format( "Parent of derived symbol '%s' undefined", m_name ) );
|
||||||
|
|
||||||
// Copy the parent.
|
// Copy the parent.
|
||||||
retv.reset( new LIB_PART( *parent.get() ) );
|
retv.reset( new LIB_SYMBOL( *parent.get() ) );
|
||||||
|
|
||||||
retv->SetName( m_name );
|
retv->SetName( m_name );
|
||||||
|
|
||||||
|
@ -392,14 +392,14 @@ std::unique_ptr< LIB_PART > LIB_PART::Flatten() const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
retv.reset( new LIB_PART( *this ) );
|
retv.reset( new LIB_SYMBOL( *this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return retv;
|
return retv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const wxString LIB_PART::GetLibraryName() const
|
const wxString LIB_SYMBOL::GetLibraryName() const
|
||||||
{
|
{
|
||||||
if( m_library )
|
if( m_library )
|
||||||
return m_library->GetName();
|
return m_library->GetName();
|
||||||
|
@ -408,7 +408,7 @@ const wxString LIB_PART::GetLibraryName() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_PART::IsPower() const
|
bool LIB_SYMBOL::IsPower() const
|
||||||
{
|
{
|
||||||
if( PART_SPTR parent = m_parent.lock() )
|
if( PART_SPTR parent = m_parent.lock() )
|
||||||
return parent->m_options == ENTRY_POWER;
|
return parent->m_options == ENTRY_POWER;
|
||||||
|
@ -417,7 +417,7 @@ bool LIB_PART::IsPower() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::SetPower()
|
void LIB_SYMBOL::SetPower()
|
||||||
{
|
{
|
||||||
if( PART_SPTR parent = m_parent.lock() )
|
if( PART_SPTR parent = m_parent.lock() )
|
||||||
parent->m_options = ENTRY_POWER;
|
parent->m_options = ENTRY_POWER;
|
||||||
|
@ -426,7 +426,7 @@ void LIB_PART::SetPower()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_PART::IsNormal() const
|
bool LIB_SYMBOL::IsNormal() const
|
||||||
{
|
{
|
||||||
if( PART_SPTR parent = m_parent.lock() )
|
if( PART_SPTR parent = m_parent.lock() )
|
||||||
return parent->m_options == ENTRY_NORMAL;
|
return parent->m_options == ENTRY_NORMAL;
|
||||||
|
@ -435,7 +435,7 @@ bool LIB_PART::IsNormal() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::SetNormal()
|
void LIB_SYMBOL::SetNormal()
|
||||||
{
|
{
|
||||||
if( PART_SPTR parent = m_parent.lock() )
|
if( PART_SPTR parent = m_parent.lock() )
|
||||||
parent->m_options = ENTRY_NORMAL;
|
parent->m_options = ENTRY_NORMAL;
|
||||||
|
@ -444,7 +444,7 @@ void LIB_PART::SetNormal()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString LIB_PART::SubReference( int aUnit, bool aAddSeparator )
|
wxString LIB_SYMBOL::SubReference( int aUnit, bool aAddSeparator )
|
||||||
{
|
{
|
||||||
wxString subRef;
|
wxString subRef;
|
||||||
|
|
||||||
|
@ -476,8 +476,8 @@ wxString LIB_PART::SubReference( int aUnit, bool aAddSeparator )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||||
int aMulti, int aConvert, const PART_DRAW_OPTIONS& aOpts )
|
int aMulti, int aConvert, const PART_DRAW_OPTIONS& aOpts )
|
||||||
{
|
{
|
||||||
/* draw background for filled items using background option
|
/* draw background for filled items using background option
|
||||||
* Solid lines will be drawn after the background
|
* Solid lines will be drawn after the background
|
||||||
|
@ -543,8 +543,8 @@ void LIB_PART::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset,
|
void LIB_SYMBOL::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset,
|
||||||
const TRANSFORM& aTransform ) const
|
const TRANSFORM& aTransform ) const
|
||||||
{
|
{
|
||||||
wxASSERT( aPlotter != NULL );
|
wxASSERT( aPlotter != NULL );
|
||||||
|
|
||||||
|
@ -589,8 +589,8 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint&
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
|
void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
|
||||||
const wxPoint& aOffset, const TRANSFORM& aTransform )
|
const wxPoint& aOffset, const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
wxASSERT( aPlotter != NULL );
|
wxASSERT( aPlotter != NULL );
|
||||||
|
|
||||||
|
@ -626,7 +626,7 @@ void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::RemoveDrawItem( LIB_ITEM* aItem )
|
void LIB_SYMBOL::RemoveDrawItem( LIB_ITEM* aItem )
|
||||||
{
|
{
|
||||||
wxASSERT( aItem != NULL );
|
wxASSERT( aItem != NULL );
|
||||||
|
|
||||||
|
@ -652,7 +652,7 @@ void LIB_PART::RemoveDrawItem( LIB_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::AddDrawItem( LIB_ITEM* aItem, bool aSort )
|
void LIB_SYMBOL::AddDrawItem( LIB_ITEM* aItem, bool aSort )
|
||||||
{
|
{
|
||||||
wxCHECK( aItem, /* void */ );
|
wxCHECK( aItem, /* void */ );
|
||||||
|
|
||||||
|
@ -663,7 +663,7 @@ void LIB_PART::AddDrawItem( LIB_ITEM* aItem, bool aSort )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_ITEM* LIB_PART::GetNextDrawItem( const LIB_ITEM* aItem, KICAD_T aType )
|
LIB_ITEM* LIB_SYMBOL::GetNextDrawItem( const LIB_ITEM* aItem, KICAD_T aType )
|
||||||
{
|
{
|
||||||
if( aItem == NULL )
|
if( aItem == NULL )
|
||||||
{
|
{
|
||||||
|
@ -692,7 +692,7 @@ LIB_ITEM* LIB_PART::GetNextDrawItem( const LIB_ITEM* aItem, KICAD_T aType )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::GetPins( LIB_PINS& aList, int aUnit, int aConvert ) const
|
void LIB_SYMBOL::GetPins( LIB_PINS& aList, int aUnit, int aConvert ) const
|
||||||
{
|
{
|
||||||
/* Notes:
|
/* Notes:
|
||||||
* when aUnit == 0: no unit filtering
|
* when aUnit == 0: no unit filtering
|
||||||
|
@ -719,7 +719,7 @@ void LIB_PART::GetPins( LIB_PINS& aList, int aUnit, int aConvert ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PIN* LIB_PART::GetPin( const wxString& aNumber, int aUnit, int aConvert ) const
|
LIB_PIN* LIB_SYMBOL::GetPin( const wxString& aNumber, int aUnit, int aConvert ) const
|
||||||
{
|
{
|
||||||
LIB_PINS pinList;
|
LIB_PINS pinList;
|
||||||
|
|
||||||
|
@ -737,8 +737,8 @@ LIB_PIN* LIB_PART::GetPin( const wxString& aNumber, int aUnit, int aConvert ) co
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_PART::PinsConflictWith( const LIB_PART& aOtherPart, bool aTestNums, bool aTestNames,
|
bool LIB_SYMBOL::PinsConflictWith( const LIB_SYMBOL& aOtherPart, bool aTestNums, bool aTestNames,
|
||||||
bool aTestType, bool aTestOrientation, bool aTestLength ) const
|
bool aTestType, bool aTestOrientation, bool aTestLength ) const
|
||||||
{
|
{
|
||||||
LIB_PINS thisPinList;
|
LIB_PINS thisPinList;
|
||||||
GetPins( thisPinList, /* aUnit */ 0, /* aConvert */ 0 );
|
GetPins( thisPinList, /* aUnit */ 0, /* aConvert */ 0 );
|
||||||
|
@ -804,7 +804,7 @@ bool LIB_PART::PinsConflictWith( const LIB_PART& aOtherPart, bool aTestNums, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const EDA_RECT LIB_PART::GetUnitBoundingBox( int aUnit, int aConvert ) const
|
const EDA_RECT LIB_SYMBOL::GetUnitBoundingBox( int aUnit, int aConvert ) const
|
||||||
{
|
{
|
||||||
EDA_RECT bBox;
|
EDA_RECT bBox;
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
|
@ -838,7 +838,7 @@ const EDA_RECT LIB_PART::GetUnitBoundingBox( int aUnit, int aConvert ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::ViewGetLayers( int aLayers[], int& aCount ) const
|
void LIB_SYMBOL::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
{
|
{
|
||||||
aCount = 6;
|
aCount = 6;
|
||||||
aLayers[0] = LAYER_DEVICE;
|
aLayers[0] = LAYER_DEVICE;
|
||||||
|
@ -850,7 +850,7 @@ void LIB_PART::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const EDA_RECT LIB_PART::GetBodyBoundingBox( int aUnit, int aConvert ) const
|
const EDA_RECT LIB_SYMBOL::GetBodyBoundingBox( int aUnit, int aConvert ) const
|
||||||
{
|
{
|
||||||
EDA_RECT bbox;
|
EDA_RECT bbox;
|
||||||
|
|
||||||
|
@ -875,19 +875,19 @@ const EDA_RECT LIB_PART::GetBodyBoundingBox( int aUnit, int aConvert ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::deleteAllFields()
|
void LIB_SYMBOL::deleteAllFields()
|
||||||
{
|
{
|
||||||
m_drawings[ LIB_FIELD_T ].clear();
|
m_drawings[ LIB_FIELD_T ].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::AddField( LIB_FIELD* aField )
|
void LIB_SYMBOL::AddField( LIB_FIELD* aField )
|
||||||
{
|
{
|
||||||
AddDrawItem( aField );
|
AddDrawItem( aField );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::SetFields( const std::vector <LIB_FIELD>& aFields )
|
void LIB_SYMBOL::SetFields( const std::vector <LIB_FIELD>& aFields )
|
||||||
{
|
{
|
||||||
deleteAllFields();
|
deleteAllFields();
|
||||||
|
|
||||||
|
@ -904,7 +904,7 @@ void LIB_PART::SetFields( const std::vector <LIB_FIELD>& aFields )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::GetFields( std::vector<LIB_FIELD*>& aList )
|
void LIB_SYMBOL::GetFields( std::vector<LIB_FIELD*>& aList )
|
||||||
{
|
{
|
||||||
// Grab the MANDATORY_FIELDS first, in expected order given by enum MANDATORY_FIELD_T
|
// Grab the MANDATORY_FIELDS first, in expected order given by enum MANDATORY_FIELD_T
|
||||||
for( int id = 0; id < MANDATORY_FIELDS; ++id )
|
for( int id = 0; id < MANDATORY_FIELDS; ++id )
|
||||||
|
@ -921,7 +921,7 @@ void LIB_PART::GetFields( std::vector<LIB_FIELD*>& aList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::GetFields( std::vector<LIB_FIELD>& aList )
|
void LIB_SYMBOL::GetFields( std::vector<LIB_FIELD>& aList )
|
||||||
{
|
{
|
||||||
// Grab the MANDATORY_FIELDS first, in expected order given by enum MANDATORY_FIELD_T
|
// Grab the MANDATORY_FIELDS first, in expected order given by enum MANDATORY_FIELD_T
|
||||||
for( int id = 0; id < MANDATORY_FIELDS; ++id )
|
for( int id = 0; id < MANDATORY_FIELDS; ++id )
|
||||||
|
@ -938,7 +938,7 @@ void LIB_PART::GetFields( std::vector<LIB_FIELD>& aList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_FIELD* LIB_PART::GetFieldById( int aId ) const
|
LIB_FIELD* LIB_SYMBOL::GetFieldById( int aId ) const
|
||||||
{
|
{
|
||||||
for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
|
for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
|
||||||
{
|
{
|
||||||
|
@ -952,7 +952,7 @@ LIB_FIELD* LIB_PART::GetFieldById( int aId ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_FIELD* LIB_PART::FindField( const wxString& aFieldName )
|
LIB_FIELD* LIB_SYMBOL::FindField( const wxString& aFieldName )
|
||||||
{
|
{
|
||||||
for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
|
for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
|
||||||
{
|
{
|
||||||
|
@ -964,7 +964,7 @@ LIB_FIELD* LIB_PART::FindField( const wxString& aFieldName )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const LIB_FIELD* LIB_PART::FindField( const wxString& aFieldName ) const
|
const LIB_FIELD* LIB_SYMBOL::FindField( const wxString& aFieldName ) const
|
||||||
{
|
{
|
||||||
for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
|
for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
|
||||||
{
|
{
|
||||||
|
@ -976,7 +976,7 @@ const LIB_FIELD* LIB_PART::FindField( const wxString& aFieldName ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_FIELD& LIB_PART::GetValueField()
|
LIB_FIELD& LIB_SYMBOL::GetValueField()
|
||||||
{
|
{
|
||||||
LIB_FIELD* field = GetFieldById( VALUE_FIELD );
|
LIB_FIELD* field = GetFieldById( VALUE_FIELD );
|
||||||
wxASSERT( field != NULL );
|
wxASSERT( field != NULL );
|
||||||
|
@ -984,7 +984,7 @@ LIB_FIELD& LIB_PART::GetValueField()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_FIELD& LIB_PART::GetReferenceField()
|
LIB_FIELD& LIB_SYMBOL::GetReferenceField()
|
||||||
{
|
{
|
||||||
LIB_FIELD* field = GetFieldById( REFERENCE_FIELD );
|
LIB_FIELD* field = GetFieldById( REFERENCE_FIELD );
|
||||||
wxASSERT( field != NULL );
|
wxASSERT( field != NULL );
|
||||||
|
@ -992,7 +992,7 @@ LIB_FIELD& LIB_PART::GetReferenceField()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_FIELD& LIB_PART::GetFootprintField()
|
LIB_FIELD& LIB_SYMBOL::GetFootprintField()
|
||||||
{
|
{
|
||||||
LIB_FIELD* field = GetFieldById( FOOTPRINT_FIELD );
|
LIB_FIELD* field = GetFieldById( FOOTPRINT_FIELD );
|
||||||
wxASSERT( field != NULL );
|
wxASSERT( field != NULL );
|
||||||
|
@ -1000,7 +1000,7 @@ LIB_FIELD& LIB_PART::GetFootprintField()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_FIELD& LIB_PART::GetDatasheetField()
|
LIB_FIELD& LIB_SYMBOL::GetDatasheetField()
|
||||||
{
|
{
|
||||||
LIB_FIELD* field = GetFieldById( DATASHEET_FIELD );
|
LIB_FIELD* field = GetFieldById( DATASHEET_FIELD );
|
||||||
wxASSERT( field != NULL );
|
wxASSERT( field != NULL );
|
||||||
|
@ -1008,20 +1008,20 @@ LIB_FIELD& LIB_PART::GetDatasheetField()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::SetOffset( const wxPoint& aOffset )
|
void LIB_SYMBOL::SetOffset( const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
for( LIB_ITEM& item : m_drawings )
|
for( LIB_ITEM& item : m_drawings )
|
||||||
item.Offset( aOffset );
|
item.Offset( aOffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::RemoveDuplicateDrawItems()
|
void LIB_SYMBOL::RemoveDuplicateDrawItems()
|
||||||
{
|
{
|
||||||
m_drawings.unique();
|
m_drawings.unique();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_PART::HasConversion() const
|
bool LIB_SYMBOL::HasConversion() const
|
||||||
{
|
{
|
||||||
for( const LIB_ITEM& item : m_drawings )
|
for( const LIB_ITEM& item : m_drawings )
|
||||||
{
|
{
|
||||||
|
@ -1042,22 +1042,22 @@ bool LIB_PART::HasConversion() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::ClearTempFlags()
|
void LIB_SYMBOL::ClearTempFlags()
|
||||||
{
|
{
|
||||||
for( LIB_ITEM& item : m_drawings )
|
for( LIB_ITEM& item : m_drawings )
|
||||||
item.ClearTempFlags();
|
item.ClearTempFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::ClearEditFlags()
|
void LIB_SYMBOL::ClearEditFlags()
|
||||||
{
|
{
|
||||||
for( LIB_ITEM& item : m_drawings )
|
for( LIB_ITEM& item : m_drawings )
|
||||||
item.ClearEditFlags();
|
item.ClearEditFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert,
|
LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert,
|
||||||
KICAD_T aType, const wxPoint& aPoint )
|
KICAD_T aType, const wxPoint& aPoint )
|
||||||
{
|
{
|
||||||
for( LIB_ITEM& item : m_drawings )
|
for( LIB_ITEM& item : m_drawings )
|
||||||
{
|
{
|
||||||
|
@ -1076,8 +1076,8 @@ LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
|
LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
|
||||||
const wxPoint& aPoint, const TRANSFORM& aTransform )
|
const wxPoint& aPoint, const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
/* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const
|
/* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const
|
||||||
* wxPoint& pt ) to search items.
|
* wxPoint& pt ) to search items.
|
||||||
|
@ -1097,7 +1097,8 @@ LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SEARCH_RESULT LIB_PART::Visit( INSPECTOR aInspector, void* aTestData, const KICAD_T aFilterTypes[] )
|
SEARCH_RESULT LIB_SYMBOL::Visit( INSPECTOR aInspector, void* aTestData,
|
||||||
|
const KICAD_T aFilterTypes[] )
|
||||||
{
|
{
|
||||||
// The part itself is never inspected, only its children
|
// The part itself is never inspected, only its children
|
||||||
for( LIB_ITEM& item : m_drawings )
|
for( LIB_ITEM& item : m_drawings )
|
||||||
|
@ -1113,7 +1114,7 @@ SEARCH_RESULT LIB_PART::Visit( INSPECTOR aInspector, void* aTestData, const KICA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::SetUnitCount( int aCount, bool aDuplicateDrawItems )
|
void LIB_SYMBOL::SetUnitCount( int aCount, bool aDuplicateDrawItems )
|
||||||
{
|
{
|
||||||
if( m_unitCount == aCount )
|
if( m_unitCount == aCount )
|
||||||
return;
|
return;
|
||||||
|
@ -1161,7 +1162,7 @@ void LIB_PART::SetUnitCount( int aCount, bool aDuplicateDrawItems )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LIB_PART::GetUnitCount() const
|
int LIB_SYMBOL::GetUnitCount() const
|
||||||
{
|
{
|
||||||
if( PART_SPTR parent = m_parent.lock() )
|
if( PART_SPTR parent = m_parent.lock() )
|
||||||
return parent->GetUnitCount();
|
return parent->GetUnitCount();
|
||||||
|
@ -1170,7 +1171,7 @@ int LIB_PART::GetUnitCount() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::SetConversion( bool aSetConvert, bool aDuplicatePins )
|
void LIB_SYMBOL::SetConversion( bool aSetConvert, bool aDuplicatePins )
|
||||||
{
|
{
|
||||||
if( aSetConvert == HasConversion() )
|
if( aSetConvert == HasConversion() )
|
||||||
return;
|
return;
|
||||||
|
@ -1196,7 +1197,7 @@ void LIB_PART::SetConversion( bool aSetConvert, bool aDuplicatePins )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transfer the new pins to the LIB_PART.
|
// Transfer the new pins to the LIB_SYMBOL.
|
||||||
for( unsigned i = 0; i < tmp.size(); i++ )
|
for( unsigned i = 0; i < tmp.size(); i++ )
|
||||||
m_drawings.push_back( tmp[i] );
|
m_drawings.push_back( tmp[i] );
|
||||||
}
|
}
|
||||||
|
@ -1220,7 +1221,7 @@ void LIB_PART::SetConversion( bool aSetConvert, bool aDuplicatePins )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::SetSubpartIdNotation( int aSep, int aFirstId )
|
void LIB_SYMBOL::SetSubpartIdNotation( int aSep, int aFirstId )
|
||||||
{
|
{
|
||||||
m_subpartFirstId = 'A';
|
m_subpartFirstId = 'A';
|
||||||
m_subpartIdSeparator = 0;
|
m_subpartIdSeparator = 0;
|
||||||
|
@ -1233,7 +1234,7 @@ void LIB_PART::SetSubpartIdNotation( int aSep, int aFirstId )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<LIB_ITEM*> LIB_PART::GetUnitItems( int aUnit, int aConvert )
|
std::vector<LIB_ITEM*> LIB_SYMBOL::GetUnitItems( int aUnit, int aConvert )
|
||||||
{
|
{
|
||||||
std::vector<LIB_ITEM*> unitItems;
|
std::vector<LIB_ITEM*> unitItems;
|
||||||
|
|
||||||
|
@ -1252,7 +1253,7 @@ std::vector<LIB_ITEM*> LIB_PART::GetUnitItems( int aUnit, int aConvert )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<struct PART_UNITS> LIB_PART::GetUnitDrawItems()
|
std::vector<struct PART_UNITS> LIB_SYMBOL::GetUnitDrawItems()
|
||||||
{
|
{
|
||||||
std::vector<struct PART_UNITS> units;
|
std::vector<struct PART_UNITS> units;
|
||||||
|
|
||||||
|
@ -1287,7 +1288,7 @@ std::vector<struct PART_UNITS> LIB_PART::GetUnitDrawItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<struct PART_UNITS> LIB_PART::GetUniqueUnits()
|
std::vector<struct PART_UNITS> LIB_SYMBOL::GetUniqueUnits()
|
||||||
{
|
{
|
||||||
int unitNum;
|
int unitNum;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
|
@ -37,13 +37,13 @@ class EDA_RECT;
|
||||||
class LINE_READER;
|
class LINE_READER;
|
||||||
class OUTPUTFORMATTER;
|
class OUTPUTFORMATTER;
|
||||||
class PART_LIB;
|
class PART_LIB;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class LIB_FIELD;
|
class LIB_FIELD;
|
||||||
class TEST_LIB_PART_FIXTURE;
|
class TEST_LIB_SYMBOL_FIXTURE;
|
||||||
|
|
||||||
|
|
||||||
typedef std::shared_ptr<LIB_PART> PART_SPTR; ///< shared pointer to LIB_PART
|
typedef std::shared_ptr<LIB_SYMBOL> PART_SPTR; ///< shared pointer to LIB_SYMBOL
|
||||||
typedef std::weak_ptr<LIB_PART> PART_REF; ///< weak pointer to LIB_PART
|
typedef std::weak_ptr<LIB_SYMBOL> PART_REF; ///< weak pointer to LIB_SYMBOL
|
||||||
typedef MULTIVECTOR<LIB_ITEM, LIB_ARC_T, LIB_FIELD_T> LIB_ITEMS_CONTAINER;
|
typedef MULTIVECTOR<LIB_ITEM, LIB_ARC_T, LIB_FIELD_T> LIB_ITEMS_CONTAINER;
|
||||||
typedef LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS;
|
typedef LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS;
|
||||||
|
|
||||||
|
@ -51,12 +51,12 @@ typedef LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS;
|
||||||
/* values for member .m_options */
|
/* values for member .m_options */
|
||||||
enum LIBRENTRYOPTIONS
|
enum LIBRENTRYOPTIONS
|
||||||
{
|
{
|
||||||
ENTRY_NORMAL, // Libentry is a standard part (real or alias)
|
ENTRY_NORMAL, // Libentry is a standard symbol (real or alias)
|
||||||
ENTRY_POWER // Libentry is a power symbol
|
ENTRY_POWER // Libentry is a power symbol
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern bool operator<( const LIB_PART& aItem1, const LIB_PART& aItem2 );
|
extern bool operator<( const LIB_SYMBOL& aItem1, const LIB_SYMBOL& aItem2 );
|
||||||
|
|
||||||
|
|
||||||
struct PART_DRAW_OPTIONS
|
struct PART_DRAW_OPTIONS
|
||||||
|
@ -90,27 +90,28 @@ struct PART_UNITS
|
||||||
/**
|
/**
|
||||||
* Define a library symbol object.
|
* Define a library symbol object.
|
||||||
*
|
*
|
||||||
* A library symbol object is typically saved and loaded in a part library file (.lib).
|
* A library symbol object is typically saved and loaded in a symbol library file (.lib).
|
||||||
* Library symbols are different from schematic symbols.
|
* Library symbols are different from schematic symbols.
|
||||||
*/
|
*/
|
||||||
class LIB_PART : public EDA_ITEM, public LIB_TREE_ITEM
|
class LIB_SYMBOL : public EDA_ITEM, public LIB_TREE_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LIB_PART( const wxString& aName, LIB_PART* aParent = nullptr, PART_LIB* aLibrary = nullptr );
|
LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent = nullptr,
|
||||||
|
PART_LIB* aLibrary = nullptr );
|
||||||
|
|
||||||
LIB_PART( const LIB_PART& aPart, PART_LIB* aLibrary = NULL );
|
LIB_SYMBOL( const LIB_SYMBOL& aSymbol, PART_LIB* aLibrary = NULL );
|
||||||
|
|
||||||
virtual ~LIB_PART();
|
virtual ~LIB_SYMBOL();
|
||||||
|
|
||||||
///< http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
|
///< http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
|
||||||
PART_SPTR SharedPtr() const { return m_me; }
|
PART_SPTR SharedPtr() const { return m_me; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a copy of a LIB_PART and assigns unique KIIDs to the copy and its children.
|
* Create a copy of a LIB_SYMBOL and assigns unique KIIDs to the copy and its children.
|
||||||
*/
|
*/
|
||||||
virtual LIB_PART* Duplicate() const
|
virtual LIB_SYMBOL* Duplicate() const
|
||||||
{
|
{
|
||||||
LIB_PART* dupe = new LIB_PART( *this, m_library );
|
LIB_SYMBOL* dupe = new LIB_SYMBOL( *this, m_library );
|
||||||
const_cast<KIID&>( dupe->m_Uuid ) = KIID();
|
const_cast<KIID&>( dupe->m_Uuid ) = KIID();
|
||||||
|
|
||||||
for( LIB_ITEM& item : dupe->m_drawings )
|
for( LIB_ITEM& item : dupe->m_drawings )
|
||||||
|
@ -119,13 +120,13 @@ public:
|
||||||
return dupe;
|
return dupe;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetParent( LIB_PART* aParent = nullptr );
|
void SetParent( LIB_SYMBOL* aParent = nullptr );
|
||||||
PART_REF& GetParent() { return m_parent; }
|
PART_REF& GetParent() { return m_parent; }
|
||||||
const PART_REF& GetParent() const { return m_parent; }
|
const PART_REF& GetParent() const { return m_parent; }
|
||||||
|
|
||||||
virtual wxString GetClass() const override
|
virtual wxString GetClass() const override
|
||||||
{
|
{
|
||||||
return wxT( "LIB_PART" );
|
return wxT( "LIB_SYMBOL" );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetName( const wxString& aName );
|
virtual void SetName( const wxString& aName );
|
||||||
|
@ -195,7 +196,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Get the bounding box for the symbol.
|
* Get the bounding box for the symbol.
|
||||||
*
|
*
|
||||||
* @return the part bounding box ( in user coordinates )
|
* @return the symbol bounding box ( in user coordinates )
|
||||||
* @param aUnit = unit selection = 0, or 1..n
|
* @param aUnit = unit selection = 0, or 1..n
|
||||||
* @param aConvert = 0, 1 or 2
|
* @param aConvert = 0, 1 or 2
|
||||||
* If aUnit == 0, unit is not used
|
* If aUnit == 0, unit is not used
|
||||||
|
@ -207,7 +208,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Get the symbol bounding box excluding fields.
|
* Get the symbol bounding box excluding fields.
|
||||||
*
|
*
|
||||||
* @return the part bounding box ( in user coordinates ) without fields
|
* @return the symbol bounding box ( in user coordinates ) without fields
|
||||||
* @param aUnit = unit selection = 0, or 1..n
|
* @param aUnit = unit selection = 0, or 1..n
|
||||||
* @param aConvert = 0, 1 or 2
|
* @param aConvert = 0, 1 or 2
|
||||||
* If aUnit == 0, unit is not used
|
* If aUnit == 0, unit is not used
|
||||||
|
@ -228,13 +229,13 @@ public:
|
||||||
void SetNormal();
|
void SetNormal();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set interchangeable the property for part units.
|
* Set interchangeable the property for symbol units.
|
||||||
* @param aLockUnits when true then units are set as not interchangeable.
|
* @param aLockUnits when true then units are set as not interchangeable.
|
||||||
*/
|
*/
|
||||||
void LockUnits( bool aLockUnits ) { m_unitsLocked = aLockUnits; }
|
void LockUnits( bool aLockUnits ) { m_unitsLocked = aLockUnits; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether part units are interchangeable.
|
* Check whether symbol units are interchangeable.
|
||||||
* @return False when interchangeable, true otherwise.
|
* @return False when interchangeable, true otherwise.
|
||||||
*/
|
*/
|
||||||
bool UnitsLocked() const { return m_unitsLocked; }
|
bool UnitsLocked() const { return m_unitsLocked; }
|
||||||
|
@ -243,7 +244,7 @@ public:
|
||||||
* Overwrite all the existing fields in this symbol with fields supplied
|
* Overwrite all the existing fields in this symbol with fields supplied
|
||||||
* in \a aFieldsList.
|
* in \a aFieldsList.
|
||||||
*
|
*
|
||||||
* The only known caller of this function is the library part field editor, and it
|
* The only known caller of this function is the library symbol field editor, and it
|
||||||
* establishes needed behavior.
|
* establishes needed behavior.
|
||||||
*
|
*
|
||||||
* @param aFieldsList is a set of fields to import, removing all previous fields.
|
* @param aFieldsList is a set of fields to import, removing all previous fields.
|
||||||
|
@ -251,7 +252,7 @@ public:
|
||||||
void SetFields( const std::vector <LIB_FIELD>& aFieldsList );
|
void SetFields( const std::vector <LIB_FIELD>& aFieldsList );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list of fields within this part.
|
* Return a list of fields within this symbol.
|
||||||
*
|
*
|
||||||
* @param aList - List to add fields to
|
* @param aList - List to add fields to
|
||||||
*/
|
*/
|
||||||
|
@ -264,7 +265,7 @@ public:
|
||||||
void AddField( LIB_FIELD* aField );
|
void AddField( LIB_FIELD* aField );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a field within this part matching \a aFieldName and returns it
|
* Find a field within this symbol matching \a aFieldName and returns it
|
||||||
* or NULL if not found.
|
* or NULL if not found.
|
||||||
*/
|
*/
|
||||||
LIB_FIELD* FindField( const wxString& aFieldName );
|
LIB_FIELD* FindField( const wxString& aFieldName );
|
||||||
|
@ -292,10 +293,10 @@ public:
|
||||||
LIB_FIELD& GetDatasheetField();
|
LIB_FIELD& GetDatasheetField();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print part.
|
* Print symbol.
|
||||||
*
|
*
|
||||||
* @param aOffset - Position of part.
|
* @param aOffset - Position of symbol.
|
||||||
* @param aMulti - unit if multiple units per part.
|
* @param aMulti - unit if multiple units per symbol.
|
||||||
* @param aConvert - Component conversion (DeMorgan) if available.
|
* @param aConvert - Component conversion (DeMorgan) if available.
|
||||||
* @param aOpts - Drawing options
|
* @param aOpts - Drawing options
|
||||||
*/
|
*/
|
||||||
|
@ -303,12 +304,12 @@ public:
|
||||||
int aMulti, int aConvert, const PART_DRAW_OPTIONS& aOpts );
|
int aMulti, int aConvert, const PART_DRAW_OPTIONS& aOpts );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plot lib part to plotter.
|
* Plot lib symbol to plotter.
|
||||||
* Lib Fields not are plotted here, because this plot function
|
* Lib Fields not are plotted here, because this plot function
|
||||||
* is used to plot schematic items, which have they own fields
|
* is used to plot schematic items, which have they own fields
|
||||||
*
|
*
|
||||||
* @param aPlotter - Plotter object to plot to.
|
* @param aPlotter - Plotter object to plot to.
|
||||||
* @param aUnit - Component part to plot.
|
* @param aUnit - Component symbol to plot.
|
||||||
* @param aConvert - Component alternate body style to plot.
|
* @param aConvert - Component alternate body style to plot.
|
||||||
* @param aOffset - Distance to shift the plot coordinates.
|
* @param aOffset - Distance to shift the plot coordinates.
|
||||||
* @param aTransform - Component plot transform matrix.
|
* @param aTransform - Component plot transform matrix.
|
||||||
|
@ -317,11 +318,11 @@ public:
|
||||||
const TRANSFORM& aTransform ) const;
|
const TRANSFORM& aTransform ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plot Lib Fields only of the part to plotter.
|
* Plot Lib Fields only of the symbol to plotter.
|
||||||
* is used to plot the full lib part, outside the schematic
|
* is used to plot the full lib symbol, outside the schematic
|
||||||
*
|
*
|
||||||
* @param aPlotter - Plotter object to plot to.
|
* @param aPlotter - Plotter object to plot to.
|
||||||
* @param aUnit - Component part to plot.
|
* @param aUnit - Component symbol to plot.
|
||||||
* @param aConvert - Component alternate body style to plot.
|
* @param aConvert - Component alternate body style to plot.
|
||||||
* @param aOffset - Distance to shift the plot coordinates.
|
* @param aOffset - Distance to shift the plot coordinates.
|
||||||
* @param aTransform - Component plot transform matrix.
|
* @param aTransform - Component plot transform matrix.
|
||||||
|
@ -376,15 +377,15 @@ public:
|
||||||
/**
|
/**
|
||||||
* Return a list of pin object pointers from the draw item list.
|
* Return a list of pin object pointers from the draw item list.
|
||||||
*
|
*
|
||||||
* Note pin objects are owned by the draw list of the part.
|
* Note pin objects are owned by the draw list of the symbol.
|
||||||
* Deleting any of the objects will leave list in a unstable state
|
* Deleting any of the objects will leave list in a unstable state
|
||||||
* and will likely segfault when the list is destroyed.
|
* and will likely segfault when the list is destroyed.
|
||||||
*
|
*
|
||||||
* @param aList - Pin list to place pin object pointers into.
|
* @param aList - Pin list to place pin object pointers into.
|
||||||
* @param aUnit - Unit number of pin to add to list. Set to 0 to
|
* @param aUnit - Unit number of pin to add to list. Set to 0 to
|
||||||
* get pins from any part unit.
|
* get pins from any symbol unit.
|
||||||
* @param aConvert - Convert number of pin to add to list. Set to 0 to
|
* @param aConvert - Convert number of pin to add to list. Set to 0 to
|
||||||
* get pins from any convert of part.
|
* get pins from any convert of symbol.
|
||||||
*/
|
*/
|
||||||
void GetPins( LIB_PINS& aList, int aUnit = 0, int aConvert = 0 ) const;
|
void GetPins( LIB_PINS& aList, int aUnit = 0, int aConvert = 0 ) const;
|
||||||
|
|
||||||
|
@ -392,7 +393,7 @@ public:
|
||||||
* Return pin object with the requested pin \a aNumber.
|
* Return pin object with the requested pin \a aNumber.
|
||||||
*
|
*
|
||||||
* @param aNumber - Number of the pin to find.
|
* @param aNumber - Number of the pin to find.
|
||||||
* @param aUnit - Unit of the part to find. Set to 0 if a specific
|
* @param aUnit - Unit of the symbol to find. Set to 0 if a specific
|
||||||
* unit number is not required.
|
* unit number is not required.
|
||||||
* @param aConvert - Alternate body style filter (DeMorgan). Set to 0 if
|
* @param aConvert - Alternate body style filter (DeMorgan). Set to 0 if
|
||||||
* no alternate body style is required.
|
* no alternate body style is required.
|
||||||
|
@ -401,22 +402,22 @@ public:
|
||||||
LIB_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aConvert = 0 ) const;
|
LIB_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aConvert = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if this part's pins do not match another part's pins. This
|
* Return true if this symbol's pins do not match another symbol's pins. This
|
||||||
* is used to detect whether the project cache is out of sync with the
|
* is used to detect whether the project cache is out of sync with the
|
||||||
* system libs.
|
* system libs.
|
||||||
*
|
*
|
||||||
* @param aOtherPart - The other library part to test
|
* @param aOtherSymbol - The other library symbol to test
|
||||||
* @param aTestNums - Whether two pins at the same point must have the same number.
|
* @param aTestNums - Whether two pins at the same point must have the same number.
|
||||||
* @param aTestNames - Whether two pins at the same point must have the same name.
|
* @param aTestNames - Whether two pins at the same point must have the same name.
|
||||||
* @param aTestType - Whether two pins at the same point must have the same electrical type.
|
* @param aTestType - Whether two pins at the same point must have the same electrical type.
|
||||||
* @param aTestOrientation - Whether two pins at the same point must have the same orientation.
|
* @param aTestOrientation - Whether two pins at the same point must have the same orientation.
|
||||||
* @param aTestLength - Whether two pins at the same point must have the same length.
|
* @param aTestLength - Whether two pins at the same point must have the same length.
|
||||||
*/
|
*/
|
||||||
bool PinsConflictWith( const LIB_PART& aOtherPart, bool aTestNums, bool aTestNames,
|
bool PinsConflictWith( const LIB_SYMBOL& aOtherSymbol, bool aTestNums, bool aTestNames,
|
||||||
bool aTestType, bool aTestOrientation, bool aTestLength ) const;
|
bool aTestType, bool aTestOrientation, bool aTestLength ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the part \a aOffset.
|
* Move the symbol \a aOffset.
|
||||||
*
|
*
|
||||||
* @param aOffset - Offset displacement.
|
* @param aOffset - Offset displacement.
|
||||||
*/
|
*/
|
||||||
|
@ -428,14 +429,14 @@ public:
|
||||||
void RemoveDuplicateDrawItems();
|
void RemoveDuplicateDrawItems();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if part has more than one body conversion type (DeMorgan).
|
* Test if symbol has more than one body conversion type (DeMorgan).
|
||||||
*
|
*
|
||||||
* @return True if part has more than one conversion.
|
* @return True if symbol has more than one conversion.
|
||||||
*/
|
*/
|
||||||
bool HasConversion() const;
|
bool HasConversion() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the status flag all draw objects in this part.
|
* Clears the status flag all draw objects in this symbol.
|
||||||
*/
|
*/
|
||||||
void ClearTempFlags();
|
void ClearTempFlags();
|
||||||
void ClearEditFlags();
|
void ClearEditFlags();
|
||||||
|
@ -475,12 +476,12 @@ public:
|
||||||
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
|
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the units per part count.
|
* Set the units per symbol count.
|
||||||
*
|
*
|
||||||
* If the count is greater than the current count, then the all of the
|
* If the count is greater than the current count, then the all of the
|
||||||
* current draw items are duplicated for each additional part. If the
|
* current draw items are duplicated for each additional symbol. If the
|
||||||
* count is less than the current count, all draw objects for units
|
* count is less than the current count, all draw objects for units
|
||||||
* greater that count are removed from the part.
|
* greater that count are removed from the symbol.
|
||||||
*
|
*
|
||||||
* @param aCount - Number of units per package.
|
* @param aCount - Number of units per package.
|
||||||
* @param aDuplicateDrawItems Create duplicate draw items of unit 1 for each additionl unit.
|
* @param aDuplicateDrawItems Create duplicate draw items of unit 1 for each additionl unit.
|
||||||
|
@ -494,15 +495,15 @@ public:
|
||||||
wxString GetUnitReference( int aUnit ) override;
|
wxString GetUnitReference( int aUnit ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the part has multiple units per part.
|
* @return true if the symbol has multiple units per symbol.
|
||||||
* When true, the reference has a sub reference to identify part.
|
* When true, the reference has a sub reference to identify symbol.
|
||||||
*/
|
*/
|
||||||
bool IsMulti() const { return m_unitCount > 1; }
|
bool IsMulti() const { return m_unitCount > 1; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the sub reference for part having multiple units per part.
|
* @return the sub reference for symbol having multiple units per symbol.
|
||||||
* The sub reference identify the part (or unit)
|
* The sub reference identify the symbol (or unit)
|
||||||
* @param aUnit = the part identifier ( 1 to max count)
|
* @param aUnit = the symbol identifier ( 1 to max count)
|
||||||
* @param aAddSeparator = true (default) to prepend the sub ref
|
* @param aAddSeparator = true (default) to prepend the sub ref
|
||||||
* by the separator symbol (if any)
|
* by the separator symbol (if any)
|
||||||
* Note: this is a static function.
|
* Note: this is a static function.
|
||||||
|
@ -526,25 +527,25 @@ public:
|
||||||
/**
|
/**
|
||||||
* Set the separator char between the subpart id and the reference
|
* Set the separator char between the subpart id and the reference
|
||||||
* 0 (no separator) or '.' , '-' and '_'
|
* 0 (no separator) or '.' , '-' and '_'
|
||||||
* and the ascii char value to calculate the subpart symbol id from the part number:
|
* and the ascii char value to calculate the subpart symbol id from the symbol number:
|
||||||
* 'A' or '1' only are allowed. (to print U1.A or U1.1)
|
* 'A' or '1' only are allowed. (to print U1.A or U1.1)
|
||||||
* if this is a digit, a number is used as id symbol
|
* if this is a digit, a number is used as id symbol
|
||||||
* Note also if the subpart symbol is a digit, the separator cannot be null.
|
* Note also if the subpart symbol is a digit, the separator cannot be null.
|
||||||
* @param aSep = the separator symbol (0 (no separator) or '.' , '-' and '_')
|
* @param aSep = the separator symbol (0 (no separator) or '.' , '-' and '_')
|
||||||
* @param aFirstId = the Id of the first part ('A' or '1')
|
* @param aFirstId = the Id of the first symbol ('A' or '1')
|
||||||
*/
|
*/
|
||||||
static void SetSubpartIdNotation( int aSep, int aFirstId );
|
static void SetSubpartIdNotation( int aSep, int aFirstId );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set or clear the alternate body style (DeMorgan) for the part.
|
* Set or clear the alternate body style (DeMorgan) for the symbol.
|
||||||
*
|
*
|
||||||
* If the part already has an alternate body style set and a
|
* If the symbol already has an alternate body style set and a
|
||||||
* asConvert if false, all of the existing draw items for the alternate
|
* asConvert if false, all of the existing draw items for the alternate
|
||||||
* body style are remove. If the alternate body style is not set and
|
* body style are remove. If the alternate body style is not set and
|
||||||
* asConvert is true, than the base draw items are duplicated and
|
* asConvert is true, than the base draw items are duplicated and
|
||||||
* added to the part.
|
* added to the symbol.
|
||||||
*
|
*
|
||||||
* @param aSetConvert - Set or clear the part alternate body style.
|
* @param aSetConvert - Set or clear the symbol alternate body style.
|
||||||
* @param aDuplicatePins - Duplicate all pins from original body style if true.
|
* @param aDuplicatePins - Duplicate all pins from original body style if true.
|
||||||
*/
|
*/
|
||||||
void SetConversion( bool aSetConvert, bool aDuplicatePins = true );
|
void SetConversion( bool aSetConvert, bool aDuplicatePins = true );
|
||||||
|
@ -562,7 +563,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Set or clear the pin name visibility flag.
|
* Set or clear the pin name visibility flag.
|
||||||
*
|
*
|
||||||
* @param aShow - True to make the part pin names visible.
|
* @param aShow - True to make the symbol pin names visible.
|
||||||
*/
|
*/
|
||||||
void SetShowPinNames( bool aShow ) { m_showPinNames = aShow; }
|
void SetShowPinNames( bool aShow ) { m_showPinNames = aShow; }
|
||||||
bool ShowPinNames() const { return m_showPinNames; }
|
bool ShowPinNames() const { return m_showPinNames; }
|
||||||
|
@ -570,7 +571,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Set or clear the pin number visibility flag.
|
* Set or clear the pin number visibility flag.
|
||||||
*
|
*
|
||||||
* @param aShow - True to make the part pin numbers visible.
|
* @param aShow - True to make the symbol pin numbers visible.
|
||||||
*/
|
*/
|
||||||
void SetShowPinNumbers( bool aShow ) { m_showPinNumbers = aShow; }
|
void SetShowPinNumbers( bool aShow ) { m_showPinNumbers = aShow; }
|
||||||
bool ShowPinNumbers() const { return m_showPinNumbers; }
|
bool ShowPinNumbers() const { return m_showPinNumbers; }
|
||||||
|
@ -600,13 +601,13 @@ public:
|
||||||
* 1 if this symbol is greater than \a aRhs
|
* 1 if this symbol is greater than \a aRhs
|
||||||
* 0 if this symbol is the same as \a aRhs
|
* 0 if this symbol is the same as \a aRhs
|
||||||
*/
|
*/
|
||||||
int Compare( const LIB_PART& aRhs ) const;
|
int Compare( const LIB_SYMBOL& aRhs ) const;
|
||||||
|
|
||||||
bool operator==( const LIB_PART* aPart ) const { return this == aPart; }
|
bool operator==( const LIB_SYMBOL* aSymbol ) const { return this == aSymbol; }
|
||||||
bool operator==( const LIB_PART& aPart ) const { return Compare( aPart ) == 0; }
|
bool operator==( const LIB_SYMBOL& aSymbol ) const { return Compare( aSymbol ) == 0; }
|
||||||
bool operator!=( const LIB_PART& aPart ) const { return Compare( aPart ) != 0; }
|
bool operator!=( const LIB_SYMBOL& aSymbol ) const { return Compare( aSymbol ) != 0; }
|
||||||
|
|
||||||
const LIB_PART& operator=( const LIB_PART& aPart );
|
const LIB_SYMBOL& operator=( const LIB_SYMBOL& aSymbol );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a flattened symbol inheritance to the caller.
|
* Return a flattened symbol inheritance to the caller.
|
||||||
|
@ -615,7 +616,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return a flattened symbol on the heap
|
* @return a flattened symbol on the heap
|
||||||
*/
|
*/
|
||||||
std::unique_ptr< LIB_PART > Flatten() const;
|
std::unique_ptr< LIB_SYMBOL > Flatten() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list of LIB_ITEM objects separated by unit and convert number.
|
* Return a list of LIB_ITEM objects separated by unit and convert number.
|
||||||
|
@ -664,7 +665,7 @@ private:
|
||||||
timestamp_t m_lastModDate;
|
timestamp_t m_lastModDate;
|
||||||
|
|
||||||
int m_unitCount; ///< Number of units (parts) per package.
|
int m_unitCount; ///< Number of units (parts) per package.
|
||||||
bool m_unitsLocked; ///< True if part has multiple units and changing one
|
bool m_unitsLocked; ///< True if symbol has multiple units and changing one
|
||||||
///< unit does not automatically change another unit.
|
///< unit does not automatically change another unit.
|
||||||
|
|
||||||
int m_pinNameOffset; ///< The offset in mils to draw the pin name. Set to
|
int m_pinNameOffset; ///< The offset in mils to draw the pin name. Set to
|
||||||
|
@ -674,7 +675,7 @@ private:
|
||||||
|
|
||||||
bool m_includeInBom;
|
bool m_includeInBom;
|
||||||
bool m_includeOnBoard;
|
bool m_includeOnBoard;
|
||||||
LIBRENTRYOPTIONS m_options; ///< Special part features such as POWER or NORMAL.)
|
LIBRENTRYOPTIONS m_options; ///< Special symbol features such as POWER or NORMAL.)
|
||||||
|
|
||||||
LIB_ITEMS_CONTAINER m_drawings;
|
LIB_ITEMS_CONTAINER m_drawings;
|
||||||
|
|
||||||
|
@ -683,13 +684,13 @@ private:
|
||||||
wxString m_description;
|
wxString m_description;
|
||||||
wxString m_keyWords; ///< Search keywords
|
wxString m_keyWords; ///< Search keywords
|
||||||
wxArrayString m_fpFilters; ///< List of suitable footprint names for the
|
wxArrayString m_fpFilters; ///< List of suitable footprint names for the
|
||||||
///< part (wild card names accepted).
|
///< symbol (wild card names accepted).
|
||||||
|
|
||||||
static int m_subpartIdSeparator; ///< the separator char between
|
static int m_subpartIdSeparator; ///< the separator char between
|
||||||
///< the subpart id and the reference like U1A
|
///< the subpart id and the reference like U1A
|
||||||
///< ( m_subpartIdSeparator = 0 ) or U1.A or U1-A
|
///< ( m_subpartIdSeparator = 0 ) or U1.A or U1-A
|
||||||
static int m_subpartFirstId; ///< the ASCII char value to calculate the subpart
|
static int m_subpartFirstId; ///< the ASCII char value to calculate the subpart
|
||||||
///< symbol id from the part number: only 'A', 'a'
|
///< symbol id from the symbol number: only 'A', 'a'
|
||||||
///< or '1' can be used, other values have no sense.
|
///< or '1' can be used, other values have no sense.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
#include <default_values.h> // For some default values
|
#include <default_values.h> // For some default values
|
||||||
|
|
||||||
|
|
||||||
LIB_TEXT::LIB_TEXT( LIB_PART* aParent ) :
|
LIB_TEXT::LIB_TEXT( LIB_SYMBOL* aParent ) :
|
||||||
LIB_ITEM( LIB_TEXT_T, aParent ),
|
LIB_ITEM( LIB_TEXT_T, aParent ),
|
||||||
EDA_TEXT( wxEmptyString )
|
EDA_TEXT( wxEmptyString )
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
class LIB_TEXT : public LIB_ITEM, public EDA_TEXT
|
class LIB_TEXT : public LIB_ITEM, public EDA_TEXT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LIB_TEXT( LIB_PART* aParent );
|
LIB_TEXT( LIB_SYMBOL* aParent );
|
||||||
|
|
||||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
|
||||||
|
|
||||||
for( auto aItem : screen->Items().OfType( SCH_SYMBOL_T ) )
|
for( auto aItem : screen->Items().OfType( SCH_SYMBOL_T ) )
|
||||||
{
|
{
|
||||||
LIB_PART* part = nullptr;
|
LIB_SYMBOL* libSymbol = nullptr;
|
||||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aItem );
|
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aItem );
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -93,7 +93,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
|
||||||
if( archLib->FindPart( symbol->GetLibId() ) )
|
if( archLib->FindPart( symbol->GetLibId() ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
part = GetLibPart( symbol->GetLibId(), true );
|
libSymbol = GetLibPart( symbol->GetLibId(), true );
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& )
|
catch( const IO_ERROR& )
|
||||||
{
|
{
|
||||||
|
@ -109,15 +109,15 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
|
||||||
tmp = _( "Unexpected exception occurred." );
|
tmp = _( "Unexpected exception occurred." );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( part )
|
if( libSymbol )
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_PART> flattenedPart = part->Flatten();
|
std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->Flatten();
|
||||||
|
|
||||||
// Use the full LIB_ID as the symbol name to prevent symbol name collisions.
|
// Use the full LIB_ID as the symbol name to prevent symbol name collisions.
|
||||||
flattenedPart->SetName( symbol->GetLibId().GetUniStringLibId() );
|
flattenedSymbol->SetName( symbol->GetLibId().GetUniStringLibId() );
|
||||||
|
|
||||||
// AddPart() does first clone the part before adding.
|
// AddPart() does first clone the symbol before adding.
|
||||||
archLib->AddPart( flattenedPart.get() );
|
archLib->AddPart( flattenedSymbol.get() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -217,11 +217,11 @@ void NETLIST_EXPORTER_BASE::eraseDuplicatePins()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol( SCH_SYMBOL* aSymbol,
|
void NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol( SCH_SYMBOL* aSchSymbol, LIB_SYMBOL* aLibSymbol,
|
||||||
LIB_PART* aPart, SCH_SHEET_PATH* aSheetPath,
|
SCH_SHEET_PATH* aSheetPath,
|
||||||
bool aKeepUnconnectedPins )
|
bool aKeepUnconnectedPins )
|
||||||
{
|
{
|
||||||
wxString ref = aSymbol->GetRef( aSheetPath );
|
wxString ref = aSchSymbol->GetRef( aSheetPath );
|
||||||
wxString ref2;
|
wxString ref2;
|
||||||
|
|
||||||
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
|
||||||
|
|
|
@ -60,15 +60,15 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by std:set<LIB_PART*> instantiation which uses #LIB_PART name as its key.
|
* Used by std:set<LIB_SYMBOL*> instantiation which uses #LIB_SYMBOL name as its key.
|
||||||
*/
|
*/
|
||||||
struct LIB_PART_LESS_THAN
|
struct LIB_SYMBOL_LESS_THAN
|
||||||
{
|
{
|
||||||
// a "less than" test on two LIB_PARTs (.m_name wxStrings)
|
// a "less than" test on two LIB_SYMBOLs (.m_name wxStrings)
|
||||||
bool operator()( LIB_PART* const& libpart1, LIB_PART* const& libpart2 ) const
|
bool operator()( LIB_SYMBOL* const& libsymbol1, LIB_SYMBOL* const& libsymbol2 ) const
|
||||||
{
|
{
|
||||||
// Use case specific GetName() wxString compare
|
// Use case specific GetName() wxString compare
|
||||||
return libpart1->GetLibId() < libpart2->GetLibId();
|
return libsymbol1->GetLibId() < libsymbol2->GetLibId();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -96,12 +96,12 @@ protected:
|
||||||
/// TODO(snh): Descope this object
|
/// TODO(snh): Descope this object
|
||||||
std::vector<PIN_INFO> m_sortedSymbolPinList;
|
std::vector<PIN_INFO> m_sortedSymbolPinList;
|
||||||
|
|
||||||
/// Used for "multiple parts per package" symbols to avoid processing a lib part more than
|
/// Used for "multiple symbols per package" symbols to avoid processing a lib symbol more than
|
||||||
/// once
|
/// once
|
||||||
UNIQUE_STRINGS m_referencesAlreadyFound;
|
UNIQUE_STRINGS m_referencesAlreadyFound;
|
||||||
|
|
||||||
/// unique library parts used. LIB_PART items are sorted by names
|
/// unique library symbols used. LIB_SYMBOL items are sorted by names
|
||||||
std::set<LIB_PART*, LIB_PART_LESS_THAN> m_libParts;
|
std::set<LIB_SYMBOL*, LIB_SYMBOL_LESS_THAN> m_libParts;
|
||||||
|
|
||||||
/// The schematic we're generating a netlist for
|
/// The schematic we're generating a netlist for
|
||||||
SCHEMATIC_IFACE* m_schematic;
|
SCHEMATIC_IFACE* m_schematic;
|
||||||
|
@ -137,7 +137,7 @@ protected:
|
||||||
*
|
*
|
||||||
* (This is a list of pins found in the whole schematic, for a single symbol.) These
|
* (This is a list of pins found in the whole schematic, for a single symbol.) These
|
||||||
* duplicate pins were put in list because some pins (power pins...) are found more than
|
* duplicate pins were put in list because some pins (power pins...) are found more than
|
||||||
* once when in "multiple parts per package" symbols. For instance, a 74ls00 has 4 parts,
|
* once when in "multiple symbols per package" symbols. For instance, a 74ls00 has 4 symbols,
|
||||||
* and therefore the VCC pin and GND pin appears 4 times in the list.
|
* and therefore the VCC pin and GND pin appears 4 times in the list.
|
||||||
* Note: this list *MUST* be sorted by pin number (.m_PinNum member value)
|
* Note: this list *MUST* be sorted by pin number (.m_PinNum member value)
|
||||||
* Also set the m_Flag member of "removed" NETLIST_OBJECT pin item to 1
|
* Also set the m_Flag member of "removed" NETLIST_OBJECT pin item to 1
|
||||||
|
@ -145,7 +145,7 @@ protected:
|
||||||
void eraseDuplicatePins();
|
void eraseDuplicatePins();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find all units for symbols with multiple parts per package.
|
* Find all units for symbols with multiple symbols per package.
|
||||||
*
|
*
|
||||||
* Search the entire design for all units of \a aSymbol based on matching reference
|
* Search the entire design for all units of \a aSymbol based on matching reference
|
||||||
* designator, and for each unit, add all its pins to the temporary sorted pin list,
|
* designator, and for each unit, add all its pins to the temporary sorted pin list,
|
||||||
|
@ -153,7 +153,7 @@ protected:
|
||||||
* if aKeepUnconnectedPins = false, unconnected pins will be removed from list
|
* if aKeepUnconnectedPins = false, unconnected pins will be removed from list
|
||||||
* but usually we need all pins in netlists.
|
* but usually we need all pins in netlists.
|
||||||
*/
|
*/
|
||||||
void findAllUnitsOfSymbol( SCH_SYMBOL* aSymbol, LIB_PART* aPart,
|
void findAllUnitsOfSymbol( SCH_SYMBOL* aSchSymbol, LIB_SYMBOL* aLibSymbol,
|
||||||
SCH_SHEET_PATH* aSheetPath, bool aKeepUnconnectedPins );
|
SCH_SHEET_PATH* aSheetPath, bool aKeepUnconnectedPins );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -74,7 +74,7 @@ static void getSymbols( SCHEMATIC* aSchematic, std::vector<SCH_SYMBOL*>& aSymbol
|
||||||
if( aSymbols.empty() )
|
if( aSymbols.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// sort aSymbols by lib part. symbols will be grouped by same lib part.
|
// sort aSymbols by lib symbol. symbols will be grouped by same lib symbol.
|
||||||
std::sort( aSymbols.begin(), aSymbols.end(), sort_by_libid );
|
std::sort( aSymbols.begin(), aSymbols.end(), sort_by_libid );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,11 +84,11 @@ static void getSymbols( SCHEMATIC* aSchematic, std::vector<SCH_SYMBOL*>& aSymbol
|
||||||
*
|
*
|
||||||
* @param aName - name to search for
|
* @param aName - name to search for
|
||||||
* @param aLibs - the loaded PART_LIBS
|
* @param aLibs - the loaded PART_LIBS
|
||||||
* @param aCached - whether we are looking for the cached part
|
* @param aCached - whether we are looking for the cached symbol
|
||||||
*/
|
*/
|
||||||
static LIB_PART* findSymbol( const wxString& aName, PART_LIBS* aLibs, bool aCached )
|
static LIB_SYMBOL* findSymbol( const wxString& aName, PART_LIBS* aLibs, bool aCached )
|
||||||
{
|
{
|
||||||
LIB_PART *part = NULL;
|
LIB_SYMBOL *symbol = NULL;
|
||||||
wxString new_name = LIB_ID::FixIllegalChars( aName );
|
wxString new_name = LIB_ID::FixIllegalChars( aName );
|
||||||
|
|
||||||
for( PART_LIB& each_lib : *aLibs )
|
for( PART_LIB& each_lib : *aLibs )
|
||||||
|
@ -99,13 +99,13 @@ static LIB_PART* findSymbol( const wxString& aName, PART_LIBS* aLibs, bool aCach
|
||||||
if( !aCached && each_lib.IsCache() )
|
if( !aCached && each_lib.IsCache() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
part = each_lib.FindPart( new_name );
|
symbol = each_lib.FindPart( new_name );
|
||||||
|
|
||||||
if( part )
|
if( symbol )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return part;
|
return symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ static wxFileName GetRescueLibraryFileName( SCHEMATIC* aSchematic )
|
||||||
|
|
||||||
RESCUE_CASE_CANDIDATE::RESCUE_CASE_CANDIDATE( const wxString& aRequestedName,
|
RESCUE_CASE_CANDIDATE::RESCUE_CASE_CANDIDATE( const wxString& aRequestedName,
|
||||||
const wxString& aNewName,
|
const wxString& aNewName,
|
||||||
LIB_PART* aLibCandidate,
|
LIB_SYMBOL* aLibCandidate,
|
||||||
int aUnit,
|
int aUnit,
|
||||||
int aConvert )
|
int aConvert )
|
||||||
{
|
{
|
||||||
|
@ -138,25 +138,25 @@ void RESCUE_CASE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
||||||
typedef std::map<wxString, RESCUE_CASE_CANDIDATE> candidate_map_t;
|
typedef std::map<wxString, RESCUE_CASE_CANDIDATE> candidate_map_t;
|
||||||
candidate_map_t candidate_map;
|
candidate_map_t candidate_map;
|
||||||
|
|
||||||
// Remember the list of symbols is sorted by part name.
|
// Remember the list of symbols is sorted by symbol name.
|
||||||
// So a search in libraries is made only once by group
|
// So a search in libraries is made only once by group
|
||||||
LIB_PART* case_sensitive_match = nullptr;
|
LIB_SYMBOL* case_sensitive_match = nullptr;
|
||||||
std::vector<LIB_PART*> case_insensitive_matches;
|
std::vector<LIB_SYMBOL*> case_insensitive_matches;
|
||||||
|
|
||||||
wxString part_name;
|
wxString symbol_name;
|
||||||
wxString search_name;
|
wxString search_name;
|
||||||
wxString last_part_name;
|
wxString last_symbol_name;
|
||||||
|
|
||||||
for( SCH_SYMBOL* eachSymbol : *( aRescuer.GetSymbols() ) )
|
for( SCH_SYMBOL* eachSymbol : *( aRescuer.GetSymbols() ) )
|
||||||
{
|
{
|
||||||
part_name = eachSymbol->GetLibId().GetLibItemName();
|
symbol_name = eachSymbol->GetLibId().GetLibItemName();
|
||||||
search_name = LIB_ID::FixIllegalChars( part_name );
|
search_name = LIB_ID::FixIllegalChars( symbol_name );
|
||||||
|
|
||||||
if( last_part_name != part_name )
|
if( last_symbol_name != symbol_name )
|
||||||
{
|
{
|
||||||
// A new part name is found (a new group starts here).
|
// A new symbol name is found (a new group starts here).
|
||||||
// Search the symbol names candidates only once for this group:
|
// Search the symbol names candidates only once for this group:
|
||||||
last_part_name = part_name;
|
last_symbol_name = symbol_name;
|
||||||
case_insensitive_matches.clear();
|
case_insensitive_matches.clear();
|
||||||
|
|
||||||
LIB_ID id( wxEmptyString, search_name );
|
LIB_ID id( wxEmptyString, search_name );
|
||||||
|
@ -172,12 +172,12 @@ void RESCUE_CASE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
||||||
if( case_sensitive_match || !( case_insensitive_matches.size() ) )
|
if( case_sensitive_match || !( case_insensitive_matches.size() ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
RESCUE_CASE_CANDIDATE candidate( part_name, case_insensitive_matches[0]->GetName(),
|
RESCUE_CASE_CANDIDATE candidate( symbol_name, case_insensitive_matches[0]->GetName(),
|
||||||
case_insensitive_matches[0],
|
case_insensitive_matches[0],
|
||||||
eachSymbol->GetUnit(),
|
eachSymbol->GetUnit(),
|
||||||
eachSymbol->GetConvert() );
|
eachSymbol->GetConvert() );
|
||||||
|
|
||||||
candidate_map[part_name] = candidate;
|
candidate_map[symbol_name] = candidate;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, dump the map into aCandidates
|
// Now, dump the map into aCandidates
|
||||||
|
@ -217,8 +217,8 @@ bool RESCUE_CASE_CANDIDATE::PerformAction( RESCUER* aRescuer )
|
||||||
|
|
||||||
RESCUE_CACHE_CANDIDATE::RESCUE_CACHE_CANDIDATE( const wxString& aRequestedName,
|
RESCUE_CACHE_CANDIDATE::RESCUE_CACHE_CANDIDATE( const wxString& aRequestedName,
|
||||||
const wxString& aNewName,
|
const wxString& aNewName,
|
||||||
LIB_PART* aCacheCandidate,
|
LIB_SYMBOL* aCacheCandidate,
|
||||||
LIB_PART* aLibCandidate,
|
LIB_SYMBOL* aLibCandidate,
|
||||||
int aUnit,
|
int aUnit,
|
||||||
int aConvert )
|
int aConvert )
|
||||||
{
|
{
|
||||||
|
@ -244,24 +244,24 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
||||||
typedef std::map<wxString, RESCUE_CACHE_CANDIDATE> candidate_map_t;
|
typedef std::map<wxString, RESCUE_CACHE_CANDIDATE> candidate_map_t;
|
||||||
candidate_map_t candidate_map;
|
candidate_map_t candidate_map;
|
||||||
|
|
||||||
// Remember the list of symbols is sorted by part name.
|
// Remember the list of symbols is sorted by symbol name.
|
||||||
// So a search in libraries is made only once by group
|
// So a search in libraries is made only once by group
|
||||||
LIB_PART* cache_match = nullptr;
|
LIB_SYMBOL* cache_match = nullptr;
|
||||||
LIB_PART* lib_match = nullptr;
|
LIB_SYMBOL* lib_match = nullptr;
|
||||||
wxString part_name;
|
wxString symbol_name;
|
||||||
wxString search_name;
|
wxString search_name;
|
||||||
wxString old_part_name;
|
wxString old_symbol_name;
|
||||||
|
|
||||||
for( SCH_SYMBOL* eachSymbol : *( aRescuer.GetSymbols() ) )
|
for( SCH_SYMBOL* eachSymbol : *( aRescuer.GetSymbols() ) )
|
||||||
{
|
{
|
||||||
part_name = eachSymbol->GetLibId().GetLibItemName();
|
symbol_name = eachSymbol->GetLibId().GetLibItemName();
|
||||||
search_name = LIB_ID::FixIllegalChars( part_name );
|
search_name = LIB_ID::FixIllegalChars( symbol_name );
|
||||||
|
|
||||||
if( old_part_name != part_name )
|
if( old_symbol_name != symbol_name )
|
||||||
{
|
{
|
||||||
// A new part name is found (a new group starts here).
|
// A new symbol name is found (a new group starts here).
|
||||||
// Search the symbol names candidates only once for this group:
|
// Search the symbol names candidates only once for this group:
|
||||||
old_part_name = part_name;
|
old_symbol_name = symbol_name;
|
||||||
cache_match = findSymbol( search_name, aRescuer.GetPrj()->SchLibs(), true );
|
cache_match = findSymbol( search_name, aRescuer.GetPrj()->SchLibs(), true );
|
||||||
lib_match = findSymbol( search_name, aRescuer.GetPrj()->SchLibs(), false );
|
lib_match = findSymbol( search_name, aRescuer.GetPrj()->SchLibs(), false );
|
||||||
|
|
||||||
|
@ -278,11 +278,11 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Check if the symbol has already been rescued.
|
// Check if the symbol has already been rescued.
|
||||||
RESCUE_CACHE_CANDIDATE candidate( part_name, search_name, cache_match, lib_match,
|
RESCUE_CACHE_CANDIDATE candidate( symbol_name, search_name, cache_match, lib_match,
|
||||||
eachSymbol->GetUnit(),
|
eachSymbol->GetUnit(),
|
||||||
eachSymbol->GetConvert() );
|
eachSymbol->GetConvert() );
|
||||||
|
|
||||||
candidate_map[part_name] = candidate;
|
candidate_map[symbol_name] = candidate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,13 +314,13 @@ wxString RESCUE_CACHE_CANDIDATE::GetActionDescription() const
|
||||||
|
|
||||||
bool RESCUE_CACHE_CANDIDATE::PerformAction( RESCUER* aRescuer )
|
bool RESCUE_CACHE_CANDIDATE::PerformAction( RESCUER* aRescuer )
|
||||||
{
|
{
|
||||||
LIB_PART* tmp = ( m_cache_candidate ) ? m_cache_candidate : m_lib_candidate;
|
LIB_SYMBOL* tmp = ( m_cache_candidate ) ? m_cache_candidate : m_lib_candidate;
|
||||||
|
|
||||||
wxCHECK_MSG( tmp, false, "Both cache and library symbols undefined." );
|
wxCHECK_MSG( tmp, false, "Both cache and library symbols undefined." );
|
||||||
|
|
||||||
std::unique_ptr<LIB_PART> new_part = tmp->Flatten();
|
std::unique_ptr<LIB_SYMBOL> new_symbol = tmp->Flatten();
|
||||||
new_part->SetName( m_new_name );
|
new_symbol->SetName( m_new_name );
|
||||||
aRescuer->AddPart( new_part.get() );
|
aRescuer->AddPart( new_symbol.get() );
|
||||||
|
|
||||||
for( SCH_SYMBOL* eachSymbol : *aRescuer->GetSymbols() )
|
for( SCH_SYMBOL* eachSymbol : *aRescuer->GetSymbols() )
|
||||||
{
|
{
|
||||||
|
@ -342,8 +342,8 @@ bool RESCUE_CACHE_CANDIDATE::PerformAction( RESCUER* aRescuer )
|
||||||
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::RESCUE_SYMBOL_LIB_TABLE_CANDIDATE(
|
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::RESCUE_SYMBOL_LIB_TABLE_CANDIDATE(
|
||||||
const LIB_ID& aRequestedId,
|
const LIB_ID& aRequestedId,
|
||||||
const LIB_ID& aNewId,
|
const LIB_ID& aNewId,
|
||||||
LIB_PART* aCacheCandidate,
|
LIB_SYMBOL* aCacheCandidate,
|
||||||
LIB_PART* aLibCandidate,
|
LIB_SYMBOL* aLibCandidate,
|
||||||
int aUnit,
|
int aUnit,
|
||||||
int aConvert ) : RESCUE_CANDIDATE()
|
int aConvert ) : RESCUE_CANDIDATE()
|
||||||
{
|
{
|
||||||
|
@ -374,27 +374,27 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
|
||||||
|
|
||||||
// Remember the list of symbols is sorted by LIB_ID.
|
// Remember the list of symbols is sorted by LIB_ID.
|
||||||
// So a search in libraries is made only once by group
|
// So a search in libraries is made only once by group
|
||||||
LIB_PART* cache_match = nullptr;
|
LIB_SYMBOL* cache_match = nullptr;
|
||||||
LIB_PART* lib_match = nullptr;
|
LIB_SYMBOL* lib_match = nullptr;
|
||||||
LIB_ID old_part_id;
|
LIB_ID old_symbol_id;
|
||||||
|
|
||||||
for( SCH_SYMBOL* eachSymbol : *( aRescuer.GetSymbols() ) )
|
for( SCH_SYMBOL* eachSymbol : *( aRescuer.GetSymbols() ) )
|
||||||
{
|
{
|
||||||
const LIB_ID& part_id = eachSymbol->GetLibId();
|
const LIB_ID& symbol_id = eachSymbol->GetLibId();
|
||||||
|
|
||||||
if( old_part_id != part_id )
|
if( old_symbol_id != symbol_id )
|
||||||
{
|
{
|
||||||
// A new part name is found (a new group starts here).
|
// A new symbol name is found (a new group starts here).
|
||||||
// Search the symbol names candidates only once for this group:
|
// Search the symbol names candidates only once for this group:
|
||||||
old_part_id = part_id;
|
old_symbol_id = symbol_id;
|
||||||
|
|
||||||
// Get the library symbol from the cache library. It will be a flattened
|
// Get the library symbol from the cache library. It will be a flattened
|
||||||
// symbol by default (no inheritance).
|
// symbol by default (no inheritance).
|
||||||
cache_match = findSymbol( part_id.Format().wx_str(), aRescuer.GetPrj()->SchLibs(),
|
cache_match = findSymbol( symbol_id.Format().wx_str(), aRescuer.GetPrj()->SchLibs(),
|
||||||
true );
|
true );
|
||||||
|
|
||||||
// Get the library symbol from the symbol library table.
|
// Get the library symbol from the symbol library table.
|
||||||
lib_match = SchGetLibPart( part_id, aRescuer.GetPrj()->SchSymbolLibTable() );
|
lib_match = SchGetLibPart( symbol_id, aRescuer.GetPrj()->SchSymbolLibTable() );
|
||||||
|
|
||||||
if( !cache_match && !lib_match )
|
if( !cache_match && !lib_match )
|
||||||
continue;
|
continue;
|
||||||
|
@ -417,7 +417,7 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test whether there is a conflict or if the symbol can only be found in the cache.
|
// Test whether there is a conflict or if the symbol can only be found in the cache.
|
||||||
if( LIB_ID::HasIllegalChars( part_id.GetLibItemName() ) == -1 )
|
if( LIB_ID::HasIllegalChars( symbol_id.GetLibItemName() ) == -1 )
|
||||||
{
|
{
|
||||||
if( cache_match && lib_match &&
|
if( cache_match && lib_match &&
|
||||||
!cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
|
!cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
|
||||||
|
@ -428,7 +428,7 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix illegal LIB_ID name characters.
|
// Fix illegal LIB_ID name characters.
|
||||||
wxString new_name = LIB_ID::FixIllegalChars( part_id.GetLibItemName() );
|
wxString new_name = LIB_ID::FixIllegalChars( symbol_id.GetLibItemName() );
|
||||||
|
|
||||||
// Differentiate symbol name in the rescue library by appending the symbol library
|
// Differentiate symbol name in the rescue library by appending the symbol library
|
||||||
// table nickname to the symbol name to prevent name clashes in the rescue library.
|
// table nickname to the symbol name to prevent name clashes in the rescue library.
|
||||||
|
@ -437,13 +437,13 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
|
||||||
// Spaces in the file name will break the symbol name because they are not
|
// Spaces in the file name will break the symbol name because they are not
|
||||||
// quoted in the symbol library file format.
|
// quoted in the symbol library file format.
|
||||||
libNickname.Replace( " ", "-" );
|
libNickname.Replace( " ", "-" );
|
||||||
LIB_ID new_id( libNickname, new_name + "-" + part_id.GetLibNickname().wx_str() );
|
LIB_ID new_id( libNickname, new_name + "-" + symbol_id.GetLibNickname().wx_str() );
|
||||||
|
|
||||||
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE candidate( part_id, new_id, cache_match, lib_match,
|
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE candidate( symbol_id, new_id, cache_match, lib_match,
|
||||||
eachSymbol->GetUnit(),
|
eachSymbol->GetUnit(),
|
||||||
eachSymbol->GetConvert() );
|
eachSymbol->GetConvert() );
|
||||||
|
|
||||||
candidate_map[part_id] = candidate;
|
candidate_map[symbol_id] = candidate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,14 +475,14 @@ wxString RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::GetActionDescription() const
|
||||||
|
|
||||||
bool RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::PerformAction( RESCUER* aRescuer )
|
bool RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::PerformAction( RESCUER* aRescuer )
|
||||||
{
|
{
|
||||||
LIB_PART* tmp = ( m_cache_candidate ) ? m_cache_candidate : m_lib_candidate;
|
LIB_SYMBOL* tmp = ( m_cache_candidate ) ? m_cache_candidate : m_lib_candidate;
|
||||||
|
|
||||||
wxCHECK_MSG( tmp, false, "Both cache and library symbols undefined." );
|
wxCHECK_MSG( tmp, false, "Both cache and library symbols undefined." );
|
||||||
|
|
||||||
std::unique_ptr<LIB_PART> new_part = tmp->Flatten();
|
std::unique_ptr<LIB_SYMBOL> new_symbol = tmp->Flatten();
|
||||||
new_part->SetLibId( m_new_id );
|
new_symbol->SetLibId( m_new_id );
|
||||||
new_part->SetName( m_new_id.GetLibItemName() );
|
new_symbol->SetName( m_new_id.GetLibItemName() );
|
||||||
aRescuer->AddPart( new_part.get() );
|
aRescuer->AddPart( new_symbol.get() );
|
||||||
|
|
||||||
for( SCH_SYMBOL* eachSymbol : *aRescuer->GetSymbols() )
|
for( SCH_SYMBOL* eachSymbol : *aRescuer->GetSymbols() )
|
||||||
{
|
{
|
||||||
|
@ -658,14 +658,14 @@ void LEGACY_RESCUER::OpenRescueLibrary()
|
||||||
if( rescueLib )
|
if( rescueLib )
|
||||||
{
|
{
|
||||||
// For items in the rescue library, aliases are the root symbol.
|
// For items in the rescue library, aliases are the root symbol.
|
||||||
std::vector< LIB_PART* > symbols;
|
std::vector< LIB_SYMBOL* > symbols;
|
||||||
|
|
||||||
rescueLib->GetParts( symbols );
|
rescueLib->GetParts( symbols );
|
||||||
|
|
||||||
for( auto symbol : symbols )
|
for( auto symbol : symbols )
|
||||||
{
|
{
|
||||||
// The LIB_PART copy constructor flattens derived symbols (formerly known as aliases).
|
// The LIB_SYMBOL copy constructor flattens derived symbols (formerly known as aliases).
|
||||||
m_rescue_lib->AddPart( new LIB_PART( *symbol, m_rescue_lib.get() ) );
|
m_rescue_lib->AddPart( new LIB_SYMBOL( *symbol, m_rescue_lib.get() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -752,12 +752,12 @@ bool LEGACY_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LEGACY_RESCUER::AddPart( LIB_PART* aNewPart )
|
void LEGACY_RESCUER::AddPart( LIB_SYMBOL* aNewSymbol )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aNewPart, "Invalid LIB_PART pointer." );
|
wxCHECK_RET( aNewSymbol, "Invalid LIB_SYMBOL pointer." );
|
||||||
|
|
||||||
aNewPart->SetLib( m_rescue_lib.get() );
|
aNewSymbol->SetLib( m_rescue_lib.get() );
|
||||||
m_rescue_lib->AddPart( aNewPart );
|
m_rescue_lib->AddPart( aNewSymbol );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -849,18 +849,18 @@ bool SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SYMBOL_LIB_TABLE_RESCUER::AddPart( LIB_PART* aNewPart )
|
void SYMBOL_LIB_TABLE_RESCUER::AddPart( LIB_SYMBOL* aNewSymbol )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aNewPart, "Invalid LIB_PART pointer." );
|
wxCHECK_RET( aNewSymbol, "Invalid LIB_SYMBOL pointer." );
|
||||||
|
|
||||||
wxFileName fn = GetRescueLibraryFileName( m_schematic );
|
wxFileName fn = GetRescueLibraryFileName( m_schematic );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( !m_prj->SchSymbolLibTable()->HasLibrary( fn.GetName() ) )
|
if( !m_prj->SchSymbolLibTable()->HasLibrary( fn.GetName() ) )
|
||||||
m_pi->SaveSymbol( fn.GetFullPath(), new LIB_PART( *aNewPart ), m_properties.get() );
|
m_pi->SaveSymbol( fn.GetFullPath(), new LIB_SYMBOL( *aNewSymbol ), m_properties.get() );
|
||||||
else
|
else
|
||||||
m_prj->SchSymbolLibTable()->SaveSymbol( fn.GetName(), new LIB_PART( *aNewPart ) );
|
m_prj->SchSymbolLibTable()->SaveSymbol( fn.GetName(), new LIB_SYMBOL( *aNewSymbol ) );
|
||||||
}
|
}
|
||||||
catch( ... /* IO_ERROR */ )
|
catch( ... /* IO_ERROR */ )
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#include <class_draw_panel_gal.h>
|
#include <class_draw_panel_gal.h>
|
||||||
|
|
||||||
|
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class SCH_SYMBOL;
|
class SCH_SYMBOL;
|
||||||
class RESCUER;
|
class RESCUER;
|
||||||
class SCH_EDIT_FRAME;
|
class SCH_EDIT_FRAME;
|
||||||
|
@ -82,13 +82,13 @@ public:
|
||||||
* Get the part that can be loaded from the project cache, if possible, or
|
* Get the part that can be loaded from the project cache, if possible, or
|
||||||
* else NULL.
|
* else NULL.
|
||||||
*/
|
*/
|
||||||
virtual LIB_PART* GetCacheCandidate() const { return NULL; }
|
virtual LIB_SYMBOL* GetCacheCandidate() const { return NULL; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the part the would be loaded from the libraries, if possible, or else
|
* Get the part the would be loaded from the libraries, if possible, or else
|
||||||
* NULL.
|
* NULL.
|
||||||
*/
|
*/
|
||||||
virtual LIB_PART* GetLibCandidate() const { return m_lib_candidate; }
|
virtual LIB_SYMBOL* GetLibCandidate() const { return m_lib_candidate; }
|
||||||
|
|
||||||
int GetUnit() const { return m_unit; }
|
int GetUnit() const { return m_unit; }
|
||||||
|
|
||||||
|
@ -107,11 +107,11 @@ public:
|
||||||
virtual bool PerformAction( RESCUER* aRescuer ) = 0;
|
virtual bool PerformAction( RESCUER* aRescuer ) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxString m_requested_name;
|
wxString m_requested_name;
|
||||||
wxString m_new_name;
|
wxString m_new_name;
|
||||||
LIB_PART* m_lib_candidate;
|
LIB_SYMBOL* m_lib_candidate;
|
||||||
int m_unit;
|
int m_unit;
|
||||||
int m_convert;
|
int m_convert;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ public:
|
||||||
* @param aConvert is the body style of the rescued symbol.
|
* @param aConvert is the body style of the rescued symbol.
|
||||||
*/
|
*/
|
||||||
RESCUE_CASE_CANDIDATE( const wxString& aRequestedName, const wxString& aNewName,
|
RESCUE_CASE_CANDIDATE( const wxString& aRequestedName, const wxString& aNewName,
|
||||||
LIB_PART* aLibCandidate, int aUnit = 0, int aConvert = 0 );
|
LIB_SYMBOL* aLibCandidate, int aUnit = 0, int aConvert = 0 );
|
||||||
|
|
||||||
RESCUE_CASE_CANDIDATE() { m_lib_candidate = NULL; }
|
RESCUE_CASE_CANDIDATE() { m_lib_candidate = NULL; }
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ public:
|
||||||
|
|
||||||
class RESCUE_CACHE_CANDIDATE: public RESCUE_CANDIDATE
|
class RESCUE_CACHE_CANDIDATE: public RESCUE_CANDIDATE
|
||||||
{
|
{
|
||||||
LIB_PART* m_cache_candidate;
|
LIB_SYMBOL* m_cache_candidate;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -170,12 +170,12 @@ public:
|
||||||
* @param aConvert is the body style of the rescued symbol.
|
* @param aConvert is the body style of the rescued symbol.
|
||||||
*/
|
*/
|
||||||
RESCUE_CACHE_CANDIDATE( const wxString& aRequestedName, const wxString& aNewName,
|
RESCUE_CACHE_CANDIDATE( const wxString& aRequestedName, const wxString& aNewName,
|
||||||
LIB_PART* aCacheCandidate, LIB_PART* aLibCandidate,
|
LIB_SYMBOL* aCacheCandidate, LIB_SYMBOL* aLibCandidate,
|
||||||
int aUnit = 0, int aConvert = 0 );
|
int aUnit = 0, int aConvert = 0 );
|
||||||
|
|
||||||
RESCUE_CACHE_CANDIDATE();
|
RESCUE_CACHE_CANDIDATE();
|
||||||
|
|
||||||
virtual LIB_PART* GetCacheCandidate() const override { return m_cache_candidate; }
|
virtual LIB_SYMBOL* GetCacheCandidate() const override { return m_cache_candidate; }
|
||||||
|
|
||||||
virtual wxString GetActionDescription() const override;
|
virtual wxString GetActionDescription() const override;
|
||||||
|
|
||||||
|
@ -205,12 +205,12 @@ public:
|
||||||
* @param aConvert is the body style of the rescued symbol.
|
* @param aConvert is the body style of the rescued symbol.
|
||||||
*/
|
*/
|
||||||
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE( const LIB_ID& aRequestedId, const LIB_ID& aNewId,
|
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE( const LIB_ID& aRequestedId, const LIB_ID& aNewId,
|
||||||
LIB_PART* aCacheCandidate, LIB_PART* aLibCandidate,
|
LIB_SYMBOL* aCacheCandidate, LIB_SYMBOL* aLibCandidate,
|
||||||
int aUnit = 0, int aConvert = 0 );
|
int aUnit = 0, int aConvert = 0 );
|
||||||
|
|
||||||
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE();
|
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE();
|
||||||
|
|
||||||
virtual LIB_PART* GetCacheCandidate() const override { return m_cache_candidate; }
|
virtual LIB_SYMBOL* GetCacheCandidate() const override { return m_cache_candidate; }
|
||||||
|
|
||||||
virtual wxString GetActionDescription() const override;
|
virtual wxString GetActionDescription() const override;
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ public:
|
||||||
private:
|
private:
|
||||||
LIB_ID m_requested_id;
|
LIB_ID m_requested_id;
|
||||||
LIB_ID m_new_id;
|
LIB_ID m_new_id;
|
||||||
LIB_PART* m_cache_candidate;
|
LIB_SYMBOL* m_cache_candidate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void FindCandidates() = 0;
|
virtual void FindCandidates() = 0;
|
||||||
|
|
||||||
virtual void AddPart( LIB_PART* aNewPart ) = 0;
|
virtual void AddPart( LIB_SYMBOL* aNewSymbol ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a dialog to allow the user to select rescues.
|
* Display a dialog to allow the user to select rescues.
|
||||||
|
@ -350,7 +350,7 @@ public:
|
||||||
|
|
||||||
virtual bool WriteRescueLibrary( wxWindow *aParent ) override;
|
virtual bool WriteRescueLibrary( wxWindow *aParent ) override;
|
||||||
|
|
||||||
virtual void AddPart( LIB_PART* aNewPart ) override;
|
virtual void AddPart( LIB_SYMBOL* aNewSymbol ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<PART_LIB> m_rescue_lib;
|
std::unique_ptr<PART_LIB> m_rescue_lib;
|
||||||
|
@ -376,7 +376,7 @@ public:
|
||||||
|
|
||||||
virtual bool WriteRescueLibrary( wxWindow* aParent ) override;
|
virtual bool WriteRescueLibrary( wxWindow* aParent ) override;
|
||||||
|
|
||||||
virtual void AddPart( LIB_PART* aNewPart ) override;
|
virtual void AddPart( LIB_SYMBOL* aNewSymbol ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER m_pi;
|
SCH_PLUGIN::SCH_PLUGIN_RELEASER m_pi;
|
||||||
|
|
|
@ -43,12 +43,12 @@
|
||||||
#include <tools/ee_selection_tool.h>
|
#include <tools/ee_selection_tool.h>
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, PART_LIB* aCacheLib,
|
LIB_SYMBOL* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, PART_LIB* aCacheLib,
|
||||||
wxWindow* aParent, bool aShowErrorMsg )
|
wxWindow* aParent, bool aShowErrorMsg )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( aLibTable, nullptr, "Invalid symbol library table." );
|
wxCHECK_MSG( aLibTable, nullptr, "Invalid symbol library table." );
|
||||||
|
|
||||||
LIB_PART* symbol = nullptr;
|
LIB_SYMBOL* symbol = nullptr;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -192,7 +192,8 @@ void SCH_BASE_FRAME::UpdateStatusBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SCH_BASE_FRAME::GetLibPart( const LIB_ID& aLibId, bool aUseCacheLib, bool aShowErrorMsg )
|
LIB_SYMBOL* SCH_BASE_FRAME::GetLibPart( const LIB_ID& aLibId, bool aUseCacheLib,
|
||||||
|
bool aShowErrorMsg )
|
||||||
{
|
{
|
||||||
PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
|
PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ class PAGE_INFO;
|
||||||
class TITLE_BLOCK;
|
class TITLE_BLOCK;
|
||||||
class SYMBOL_VIEWER_FRAME;
|
class SYMBOL_VIEWER_FRAME;
|
||||||
class SYMBOL_EDIT_FRAME;
|
class SYMBOL_EDIT_FRAME;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class PART_LIB;
|
class PART_LIB;
|
||||||
class SCHLIB_FILTER;
|
class SCHLIB_FILTER;
|
||||||
class LIB_ID;
|
class LIB_ID;
|
||||||
|
@ -72,8 +72,8 @@ class SYMBOL_EDITOR_SETTINGS;
|
||||||
*
|
*
|
||||||
* @return The symbol found in the library or NULL if the symbol was not found.
|
* @return The symbol found in the library or NULL if the symbol was not found.
|
||||||
*/
|
*/
|
||||||
LIB_PART* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
|
LIB_SYMBOL* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
|
||||||
PART_LIB* aCacheLib = NULL, wxWindow* aParent = NULL,
|
PART_LIB* aCacheLib = NULL, wxWindow* aParent = NULL,
|
||||||
bool aShowErrorMsg = false );
|
bool aShowErrorMsg = false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -177,10 +177,10 @@ public:
|
||||||
* @param aShowErrorMessage set to true to show any error messages.
|
* @param aShowErrorMessage set to true to show any error messages.
|
||||||
* @return The symbol found in the library or NULL if the symbol was not found.
|
* @return The symbol found in the library or NULL if the symbol was not found.
|
||||||
*/
|
*/
|
||||||
LIB_PART* GetLibPart( const LIB_ID& aLibId, bool aUseCacheLib = false,
|
LIB_SYMBOL* GetLibPart( const LIB_ID& aLibId, bool aUseCacheLib = false,
|
||||||
bool aShowErrorMsg = false );
|
bool aShowErrorMsg = false );
|
||||||
|
|
||||||
LIB_PART* GetFlattenedLibPart( const LIB_ID& aLibId, bool aShowErrorMsg = false );
|
LIB_SYMBOL* GetFlattenedLibPart( const LIB_ID& aLibId, bool aShowErrorMsg = false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call the library viewer to select symbol to import into schematic.
|
* Call the library viewer to select symbol to import into schematic.
|
||||||
|
|
|
@ -105,10 +105,10 @@ SCH_DRAW_PANEL::~SCH_DRAW_PANEL()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_DRAW_PANEL::DisplayComponent( LIB_PART* aComponent )
|
void SCH_DRAW_PANEL::DisplayComponent( LIB_SYMBOL* aSymbol )
|
||||||
{
|
{
|
||||||
GetView()->Clear();
|
GetView()->Clear();
|
||||||
GetView()->DisplayComponent( aComponent );
|
GetView()->DisplayComponent( aSymbol );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include <sch_view.h>
|
#include <sch_view.h>
|
||||||
|
|
||||||
|
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class SCH_SCREEN;
|
class SCH_SCREEN;
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public:
|
||||||
|
|
||||||
~SCH_DRAW_PANEL();
|
~SCH_DRAW_PANEL();
|
||||||
|
|
||||||
void DisplayComponent( LIB_PART *aComponent );
|
void DisplayComponent( LIB_SYMBOL *aSymbol );
|
||||||
void DisplaySheet( SCH_SCREEN *aScreen );
|
void DisplaySheet( SCH_SCREEN *aScreen );
|
||||||
|
|
||||||
bool SwitchBackend( GAL_TYPE aGalType ) override;
|
bool SwitchBackend( GAL_TYPE aGalType ) override;
|
||||||
|
|
|
@ -1606,7 +1606,7 @@ void SCH_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::SaveSymbolToSchematic( const LIB_PART& aSymbol )
|
void SCH_EDIT_FRAME::SaveSymbolToSchematic( const LIB_SYMBOL& aSymbol )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
bool appendToUndo = false;
|
bool appendToUndo = false;
|
||||||
|
@ -1634,8 +1634,8 @@ void SCH_EDIT_FRAME::SaveSymbolToSchematic( const LIB_PART& aSymbol )
|
||||||
|
|
||||||
wxCHECK( symbol, /* void */ );
|
wxCHECK( symbol, /* void */ );
|
||||||
|
|
||||||
// This needs to be done before the LIB_PART is changed to prevent stale library symbols in
|
// This needs to be done before the LIB_SYMBOL is changed to prevent stale library
|
||||||
// the schematic file.
|
// symbols in the schematic file.
|
||||||
currentScreen->Remove( symbol );
|
currentScreen->Remove( symbol );
|
||||||
|
|
||||||
if( !symbol->IsNew() )
|
if( !symbol->IsNew() )
|
||||||
|
|
|
@ -817,13 +817,13 @@ public:
|
||||||
void FocusOnItem( SCH_ITEM* aItem );
|
void FocusOnItem( SCH_ITEM* aItem );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the #LIB_PART of the currently selected symbol.
|
* Update the #LIB_SYMBOL of the currently selected symbol.
|
||||||
*
|
*
|
||||||
* This is typically called from the symbol editor when editing symbols in place.
|
* This is typically called from the symbol editor when editing symbols in place.
|
||||||
*
|
*
|
||||||
* @param aSymbol is the #LIB_PART to update.
|
* @param aSymbol is the #LIB_SYMBOL to update.
|
||||||
*/
|
*/
|
||||||
void SaveSymbolToSchematic( const LIB_PART& aSymbol );
|
void SaveSymbolToSchematic( const LIB_SYMBOL& aSymbol );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the schematic's page reference map for all global labels, and refresh the labels
|
* Update the schematic's page reference map for all global labels, and refresh the labels
|
||||||
|
|
|
@ -182,7 +182,7 @@ wxString SCH_FIELD::GetShownText( int aDepth ) const
|
||||||
// For more than one part per package, we must add the part selection
|
// For more than one part per package, we must add the part selection
|
||||||
// A, B, ... or 1, 2, .. to the reference.
|
// A, B, ... or 1, 2, .. to the reference.
|
||||||
if( parentSymbol->GetUnitCount() > 1 )
|
if( parentSymbol->GetUnitCount() > 1 )
|
||||||
text << LIB_PART::SubReference( parentSymbol->GetUnit() );
|
text << LIB_SYMBOL::SubReference( parentSymbol->GetUnit() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( m_parent && m_parent->Type() == SCH_SHEET_T )
|
else if( m_parent && m_parent->Type() == SCH_SHEET_T )
|
||||||
|
@ -362,7 +362,7 @@ bool SCH_FIELD::Matches( const wxFindReplaceData& aSearchData, void* aAuxData )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if( parentSymbol->GetUnitCount() > 1 )
|
if( parentSymbol->GetUnitCount() > 1 )
|
||||||
text << LIB_PART::SubReference( parentSymbol->GetUnit() );
|
text << LIB_SYMBOL::SubReference( parentSymbol->GetUnit() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ class SCH_SCREEN;
|
||||||
class SCH_PLUGIN;
|
class SCH_PLUGIN;
|
||||||
class SCHEMATIC;
|
class SCHEMATIC;
|
||||||
class KIWAY;
|
class KIWAY;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class PART_LIB;
|
class PART_LIB;
|
||||||
class PROPERTIES;
|
class PROPERTIES;
|
||||||
|
|
||||||
|
@ -248,13 +248,13 @@ public:
|
||||||
const PROPERTIES* aProperties = nullptr );
|
const PROPERTIES* aProperties = nullptr );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate a list of #LIB_PART alias names contained within the library \a aLibraryPath.
|
* Populate a list of #LIB_SYMBOL alias names contained within the library \a aLibraryPath.
|
||||||
*
|
*
|
||||||
* @param aSymbolNameList is an array to populate with the #LIB_PART names associated with
|
* @param aSymbolNameList is an array to populate with the #LIB_SYMBOL names associated with
|
||||||
* the library.
|
* the library.
|
||||||
*
|
*
|
||||||
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
||||||
* or URL containing one or more #LIB_PART objects.
|
* or URL containing one or more #LIB_SYMBOL objects.
|
||||||
*
|
*
|
||||||
* @param aProperties is an associative array that can be used to tell the plugin anything
|
* @param aProperties is an associative array that can be used to tell the plugin anything
|
||||||
* needed about how to perform with respect to \a aLibraryPath. The
|
* needed about how to perform with respect to \a aLibraryPath. The
|
||||||
|
@ -267,16 +267,16 @@ public:
|
||||||
const PROPERTIES* aProperties = nullptr );
|
const PROPERTIES* aProperties = nullptr );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populate a list of #LIB_PART aliases contained within the library \a aLibraryPath.
|
* Populate a list of #LIB_SYMBOL aliases contained within the library \a aLibraryPath.
|
||||||
*
|
*
|
||||||
* @note It is the responsibility of the caller to delete the returned object from the heap.
|
* @note It is the responsibility of the caller to delete the returned object from the heap.
|
||||||
* Failure to do this will result in memory leaks.
|
* Failure to do this will result in memory leaks.
|
||||||
*
|
*
|
||||||
* @param aSymbolList is an array to populate with the #LIB_PART pointers associated with
|
* @param aSymbolList is an array to populate with the #LIB_SYMBOL pointers associated with
|
||||||
* the library.
|
* the library.
|
||||||
*
|
*
|
||||||
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
||||||
* or URL containing one or more #LIB_PART objects.
|
* or URL containing one or more #LIB_SYMBOL objects.
|
||||||
*
|
*
|
||||||
* @param aProperties is an associative array that can be used to tell the plugin anything
|
* @param aProperties is an associative array that can be used to tell the plugin anything
|
||||||
* needed about how to perform with respect to \a aLibraryPath. The
|
* needed about how to perform with respect to \a aLibraryPath. The
|
||||||
|
@ -285,18 +285,18 @@ public:
|
||||||
*
|
*
|
||||||
* @throw IO_ERROR if the library cannot be found, the part library cannot be loaded.
|
* @throw IO_ERROR if the library cannot be found, the part library cannot be loaded.
|
||||||
*/
|
*/
|
||||||
virtual void EnumerateSymbolLib( std::vector<LIB_PART*>& aSymbolList,
|
virtual void EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
|
||||||
const wxString& aLibraryPath,
|
const wxString& aLibraryPath,
|
||||||
const PROPERTIES* aProperties = nullptr );
|
const PROPERTIES* aProperties = nullptr );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a #LIB_PART object having \a aPartName from the \a aLibraryPath containing
|
* Load a #LIB_SYMBOL object having \a aPartName from the \a aLibraryPath containing
|
||||||
* a library format that this #SCH_PLUGIN knows about.
|
* a library format that this #SCH_PLUGIN knows about.
|
||||||
*
|
*
|
||||||
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
||||||
* or URL containing several symbols.
|
* or URL containing several symbols.
|
||||||
*
|
*
|
||||||
* @param aPartName is the name of the #LIB_PART to load.
|
* @param aPartName is the name of the #LIB_SYMBOL to load.
|
||||||
*
|
*
|
||||||
* @param aProperties is an associative array that can be used to tell the loader
|
* @param aProperties is an associative array that can be used to tell the loader
|
||||||
* implementation to do something special, because it can take
|
* implementation to do something special, because it can take
|
||||||
|
@ -310,13 +310,13 @@ public:
|
||||||
* @throw IO_ERROR if the library cannot be found or read. No exception
|
* @throw IO_ERROR if the library cannot be found or read. No exception
|
||||||
* is thrown in the case where aAliasName cannot be found.
|
* is thrown in the case where aAliasName cannot be found.
|
||||||
*/
|
*/
|
||||||
virtual LIB_PART* LoadSymbol( const wxString& aLibraryPath, const wxString& aPartName,
|
virtual LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aPartName,
|
||||||
const PROPERTIES* aProperties = nullptr );
|
const PROPERTIES* aProperties = nullptr );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write \a aSymbol to an existing library located at \a aLibraryPath. If a #LIB_PART
|
* Write \a aSymbol to an existing library located at \a aLibraryPath. If a #LIB_SYMBOL
|
||||||
* by the same name already exists or there are any conflicting alias names, the new
|
* by the same name already exists or there are any conflicting alias names, the new
|
||||||
* #LIB_PART will silently overwrite any existing aliases and/or part because libraries
|
* #LIB_SYMBOL will silently overwrite any existing aliases and/or part because libraries
|
||||||
* cannot have duplicate alias names. It is the responsibility of the caller to check
|
* cannot have duplicate alias names. It is the responsibility of the caller to check
|
||||||
* the library for conflicts before saving.
|
* the library for conflicts before saving.
|
||||||
*
|
*
|
||||||
|
@ -324,7 +324,7 @@ public:
|
||||||
* or URL containing several symbols.
|
* or URL containing several symbols.
|
||||||
*
|
*
|
||||||
* @param aSymbol is what to store in the library. The library is refreshed and the
|
* @param aSymbol is what to store in the library. The library is refreshed and the
|
||||||
* caller must update any #LIB_PART pointers that may have changed.
|
* caller must update any #LIB_SYMBOL pointers that may have changed.
|
||||||
*
|
*
|
||||||
* @param aProperties is an associative array that can be used to tell the
|
* @param aProperties is an associative array that can be used to tell the
|
||||||
* saver how to save the symbol, because it can take any number of
|
* saver how to save the symbol, because it can take any number of
|
||||||
|
@ -334,17 +334,17 @@ public:
|
||||||
*
|
*
|
||||||
* @throw IO_ERROR if there is a problem saving.
|
* @throw IO_ERROR if there is a problem saving.
|
||||||
*/
|
*/
|
||||||
virtual void SaveSymbol( const wxString& aLibraryPath, const LIB_PART* aSymbol,
|
virtual void SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
||||||
const PROPERTIES* aProperties = nullptr );
|
const PROPERTIES* aProperties = nullptr );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the entire #LIB_PART associated with \a aAliasName from the library
|
* Delete the entire #LIB_SYMBOL associated with \a aAliasName from the library
|
||||||
* \a aLibraryPath.
|
* \a aLibraryPath.
|
||||||
*
|
*
|
||||||
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
||||||
* or URL containing several symbols.
|
* or URL containing several symbols.
|
||||||
*
|
*
|
||||||
* @param aSymbolName is the name of a #LIB_PART associated with it's root #LIB_PART
|
* @param aSymbolName is the name of a #LIB_SYMBOL associated with it's root #LIB_SYMBOL
|
||||||
* object to delete from the specified library.
|
* object to delete from the specified library.
|
||||||
*
|
*
|
||||||
* @param aProperties is an associative array that can be used to tell the library
|
* @param aProperties is an associative array that can be used to tell the library
|
||||||
|
|
|
@ -119,7 +119,7 @@ EESCHEMA_SETTINGS* eeconfig()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used when a LIB_PART is not found in library to draw a dummy shape.
|
* Used when a LIB_SYMBOL is not found in library to draw a dummy shape.
|
||||||
* This symbol is a 400 mils square with the text "??"
|
* This symbol is a 400 mils square with the text "??"
|
||||||
*
|
*
|
||||||
* DEF DUMMY U 0 40 Y Y 1 0 N
|
* DEF DUMMY U 0 40 Y Y 1 0 N
|
||||||
|
@ -131,29 +131,29 @@ EESCHEMA_SETTINGS* eeconfig()
|
||||||
* ENDDRAW
|
* ENDDRAW
|
||||||
* ENDDEF
|
* ENDDEF
|
||||||
*/
|
*/
|
||||||
static LIB_PART* dummy()
|
static LIB_SYMBOL* dummy()
|
||||||
{
|
{
|
||||||
static LIB_PART* part;
|
static LIB_SYMBOL* symbol;
|
||||||
|
|
||||||
if( !part )
|
if( !symbol )
|
||||||
{
|
{
|
||||||
part = new LIB_PART( wxEmptyString );
|
symbol = new LIB_SYMBOL( wxEmptyString );
|
||||||
|
|
||||||
LIB_RECTANGLE* square = new LIB_RECTANGLE( part );
|
LIB_RECTANGLE* square = new LIB_RECTANGLE( symbol );
|
||||||
|
|
||||||
square->MoveTo( wxPoint( Mils2iu( -200 ), Mils2iu( 200 ) ) );
|
square->MoveTo( wxPoint( Mils2iu( -200 ), Mils2iu( 200 ) ) );
|
||||||
square->SetEndPosition( wxPoint( Mils2iu( 200 ), Mils2iu( -200 ) ) );
|
square->SetEndPosition( wxPoint( Mils2iu( 200 ), Mils2iu( -200 ) ) );
|
||||||
|
|
||||||
LIB_TEXT* text = new LIB_TEXT( part );
|
LIB_TEXT* text = new LIB_TEXT( symbol );
|
||||||
|
|
||||||
text->SetTextSize( wxSize( Mils2iu( 150 ), Mils2iu( 150 ) ) );
|
text->SetTextSize( wxSize( Mils2iu( 150 ), Mils2iu( 150 ) ) );
|
||||||
text->SetText( wxString( wxT( "??" ) ) );
|
text->SetText( wxString( wxT( "??" ) ) );
|
||||||
|
|
||||||
part->AddDrawItem( square );
|
symbol->AddDrawItem( square );
|
||||||
part->AddDrawItem( text );
|
symbol->AddDrawItem( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
return part;
|
return symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
HANDLE_ITEM( LIB_PART_T, LIB_PART );
|
HANDLE_ITEM( LIB_SYMBOL_T, LIB_SYMBOL );
|
||||||
HANDLE_ITEM( LIB_RECTANGLE_T, LIB_RECTANGLE );
|
HANDLE_ITEM( LIB_RECTANGLE_T, LIB_RECTANGLE );
|
||||||
HANDLE_ITEM( LIB_POLYLINE_T, LIB_POLYLINE );
|
HANDLE_ITEM( LIB_POLYLINE_T, LIB_POLYLINE );
|
||||||
HANDLE_ITEM( LIB_CIRCLE_T, LIB_CIRCLE );
|
HANDLE_ITEM( LIB_CIRCLE_T, LIB_CIRCLE );
|
||||||
|
@ -269,7 +269,8 @@ float SCH_PAINTER::getShadowWidth() const
|
||||||
|
|
||||||
// For best visuals the selection width must be a cross between the zoom level and the
|
// For best visuals the selection width must be a cross between the zoom level and the
|
||||||
// default line width.
|
// default line width.
|
||||||
return (float) std::fabs( matrix.GetScale().x * 2.75 ) + Mils2iu( eeconfig()->m_Selection.thickness );
|
return (float) std::fabs( matrix.GetScale().x * 2.75 ) +
|
||||||
|
Mils2iu( eeconfig()->m_Selection.thickness );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -412,7 +413,7 @@ void SCH_PAINTER::strokeText( const wxString& aText, const VECTOR2D& aPosition,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_PAINTER::draw( const LIB_PART *aPart, int aLayer, bool aDrawFields, int aUnit, int aConvert )
|
void SCH_PAINTER::draw( const LIB_SYMBOL *aSymbol, int aLayer, bool aDrawFields, int aUnit, int aConvert )
|
||||||
{
|
{
|
||||||
if( !aUnit )
|
if( !aUnit )
|
||||||
aUnit = m_schSettings.m_ShowUnit;
|
aUnit = m_schSettings.m_ShowUnit;
|
||||||
|
@ -420,16 +421,16 @@ void SCH_PAINTER::draw( const LIB_PART *aPart, int aLayer, bool aDrawFields, int
|
||||||
if( !aConvert )
|
if( !aConvert )
|
||||||
aConvert = m_schSettings.m_ShowConvert;
|
aConvert = m_schSettings.m_ShowConvert;
|
||||||
|
|
||||||
std::unique_ptr< LIB_PART > tmpPart;
|
std::unique_ptr< LIB_SYMBOL > tmpSymbol;
|
||||||
const LIB_PART* drawnPart = aPart;
|
const LIB_SYMBOL* drawnSymbol = aSymbol;
|
||||||
|
|
||||||
if( aPart->IsAlias() )
|
if( aSymbol->IsAlias() )
|
||||||
{
|
{
|
||||||
tmpPart = aPart->Flatten();
|
tmpSymbol = aSymbol->Flatten();
|
||||||
drawnPart = tmpPart.get();
|
drawnSymbol = tmpSymbol.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
for( const LIB_ITEM& item : drawnPart->GetDrawItems() )
|
for( const LIB_ITEM& item : drawnSymbol->GetDrawItems() )
|
||||||
{
|
{
|
||||||
if( !aDrawFields && item.Type() == LIB_FIELD_T )
|
if( !aDrawFields && item.Type() == LIB_FIELD_T )
|
||||||
continue;
|
continue;
|
||||||
|
@ -948,11 +949,11 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
||||||
if( dangling )
|
if( dangling )
|
||||||
drawPinDanglingSymbol( pos, drawingShadows );
|
drawPinDanglingSymbol( pos, drawingShadows );
|
||||||
|
|
||||||
LIB_PART* libEntry = aPin->GetParent();
|
LIB_SYMBOL* libEntry = aPin->GetParent();
|
||||||
|
|
||||||
// Draw the labels
|
// Draw the labels
|
||||||
if( drawingShadows
|
if( drawingShadows
|
||||||
&& ( libEntry->Type() == LIB_PART_T || libEntry->IsSelected() )
|
&& ( libEntry->Type() == LIB_SYMBOL_T || libEntry->IsSelected() )
|
||||||
&& !eeconfig()->m_Selection.draw_selected_children )
|
&& !eeconfig()->m_Selection.draw_selected_children )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -1388,7 +1389,7 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void orientPart( LIB_PART* part, int orientation )
|
static void orientSymbol( LIB_SYMBOL* symbol, int orientation )
|
||||||
{
|
{
|
||||||
struct ORIENT
|
struct ORIENT
|
||||||
{
|
{
|
||||||
|
@ -1424,7 +1425,7 @@ static void orientPart( LIB_PART* part, int orientation )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( auto& item : part->GetDrawItems() )
|
for( auto& item : symbol->GetDrawItems() )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < o.n_rots; i++ )
|
for( int i = 0; i < o.n_rots; i++ )
|
||||||
item.Rotate( wxPoint(0, 0 ), true );
|
item.Rotate( wxPoint(0, 0 ), true );
|
||||||
|
@ -1443,21 +1444,21 @@ void SCH_PAINTER::draw( SCH_SYMBOL* aSymbol, int aLayer )
|
||||||
int unit = aSymbol->GetUnitSelection( &m_schematic->CurrentSheet() );
|
int unit = aSymbol->GetUnitSelection( &m_schematic->CurrentSheet() );
|
||||||
int convert = aSymbol->GetConvert();
|
int convert = aSymbol->GetConvert();
|
||||||
|
|
||||||
// Use dummy part if the actual couldn't be found (or couldn't be locked).
|
// Use dummy symbol if the actual couldn't be found (or couldn't be locked).
|
||||||
LIB_PART* originalPart = aSymbol->GetPartRef() ? aSymbol->GetPartRef().get() : dummy();
|
LIB_SYMBOL* originalSymbol = aSymbol->GetPartRef() ? aSymbol->GetPartRef().get() : dummy();
|
||||||
LIB_PINS originalPins;
|
LIB_PINS originalPins;
|
||||||
originalPart->GetPins( originalPins, unit, convert );
|
originalSymbol->GetPins( originalPins, unit, convert );
|
||||||
|
|
||||||
// Copy the source so we can re-orient and translate it.
|
// Copy the source so we can re-orient and translate it.
|
||||||
LIB_PART tempPart( *originalPart );
|
LIB_SYMBOL tempSymbol( *originalSymbol );
|
||||||
LIB_PINS tempPins;
|
LIB_PINS tempPins;
|
||||||
tempPart.GetPins( tempPins, unit, convert );
|
tempSymbol.GetPins( tempPins, unit, convert );
|
||||||
|
|
||||||
tempPart.SetFlags( aSymbol->GetFlags() );
|
tempSymbol.SetFlags( aSymbol->GetFlags() );
|
||||||
|
|
||||||
orientPart( &tempPart, aSymbol->GetOrientation() );
|
orientSymbol( &tempSymbol, aSymbol->GetOrientation() );
|
||||||
|
|
||||||
for( auto& tempItem : tempPart.GetDrawItems() )
|
for( auto& tempItem : tempSymbol.GetDrawItems() )
|
||||||
{
|
{
|
||||||
tempItem.SetFlags( aSymbol->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
|
tempItem.SetFlags( aSymbol->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
|
||||||
tempItem.MoveTo( tempItem.GetPosition() + (wxPoint) mapCoords( aSymbol->GetPosition() ) );
|
tempItem.MoveTo( tempItem.GetPosition() + (wxPoint) mapCoords( aSymbol->GetPosition() ) );
|
||||||
|
@ -1480,7 +1481,7 @@ void SCH_PAINTER::draw( SCH_SYMBOL* aSymbol, int aLayer )
|
||||||
tempPin->SetFlags( IS_DANGLING );
|
tempPin->SetFlags( IS_DANGLING );
|
||||||
}
|
}
|
||||||
|
|
||||||
draw( &tempPart, aLayer, false, aSymbol->GetUnit(), aSymbol->GetConvert() );
|
draw( &tempSymbol, aLayer, false, aSymbol->GetUnit(), aSymbol->GetConvert() );
|
||||||
|
|
||||||
// The fields are SCH_SYMBOL-specific so don't need to be copied/oriented/translated
|
// The fields are SCH_SYMBOL-specific so don't need to be copied/oriented/translated
|
||||||
for( const SCH_FIELD& field : aSymbol->GetFields() )
|
for( const SCH_FIELD& field : aSymbol->GetFields() )
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LIB_RECTANGLE;
|
||||||
class LIB_PIN;
|
class LIB_PIN;
|
||||||
class LIB_CIRCLE;
|
class LIB_CIRCLE;
|
||||||
class LIB_ITEM;
|
class LIB_ITEM;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class LIB_POLYLINE;
|
class LIB_POLYLINE;
|
||||||
class LIB_ARC;
|
class LIB_ARC;
|
||||||
class LIB_FIELD;
|
class LIB_FIELD;
|
||||||
|
@ -153,7 +153,7 @@ private:
|
||||||
void draw( const LIB_RECTANGLE* aRect, int aLayer );
|
void draw( const LIB_RECTANGLE* aRect, int aLayer );
|
||||||
void draw( LIB_PIN* aPin, int aLayer );
|
void draw( LIB_PIN* aPin, int aLayer );
|
||||||
void draw( const LIB_CIRCLE* aCircle, int aLayer );
|
void draw( const LIB_CIRCLE* aCircle, int aLayer );
|
||||||
void draw( const LIB_PART* aPart, int, bool aDrawFields = true, int aUnit = 0,
|
void draw( const LIB_SYMBOL* aSymbol, int, bool aDrawFields = true, int aUnit = 0,
|
||||||
int aConvert = 0 );
|
int aConvert = 0 );
|
||||||
void draw( const LIB_ARC* aArc, int aLayer );
|
void draw( const LIB_ARC* aArc, int aLayer );
|
||||||
void draw( const LIB_POLYLINE* aLine, int aLayer );
|
void draw( const LIB_POLYLINE* aLine, int aLayer );
|
||||||
|
|
|
@ -73,7 +73,7 @@ void SCH_PLUGIN::EnumerateSymbolLib( wxArrayString& aAliasNameList,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_PLUGIN::EnumerateSymbolLib( std::vector<LIB_PART*>& aSymbolList,
|
void SCH_PLUGIN::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
|
||||||
const wxString& aLibraryPath,
|
const wxString& aLibraryPath,
|
||||||
const PROPERTIES* aProperties )
|
const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ void SCH_PLUGIN::EnumerateSymbolLib( std::vector<LIB_PART*>& aSymbolList,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SCH_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
LIB_SYMBOL* SCH_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
||||||
const PROPERTIES* aProperties )
|
const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
||||||
|
@ -91,7 +91,7 @@ LIB_PART* SCH_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wxString&
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_PLUGIN::SaveSymbol( const wxString& aLibraryPath, const LIB_PART* aSymbol,
|
void SCH_PLUGIN::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
||||||
const PROPERTIES* aProperties )
|
const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
||||||
|
|
|
@ -308,7 +308,8 @@ void SCH_ALTIUM_PLUGIN::ParseStorage( const CFB::CompoundFileReader& aReader )
|
||||||
if( reader.HasParsingError() )
|
if( reader.HasParsingError() )
|
||||||
THROW_IO_ERROR( "stream was not parsed correctly!" );
|
THROW_IO_ERROR( "stream was not parsed correctly!" );
|
||||||
|
|
||||||
// TODO pointhi: is it possible to have multiple headers in one Storage file? Otherwise throw IO Error.
|
// TODO pointhi: is it possible to have multiple headers in one Storage file? Otherwise
|
||||||
|
// throw IO Error.
|
||||||
if( reader.GetRemainingBytes() != 0 )
|
if( reader.GetRemainingBytes() != 0 )
|
||||||
wxLogError(
|
wxLogError(
|
||||||
wxString::Format( "Storage file was not fully parsed as %d bytes are remaining.",
|
wxString::Format( "Storage file was not fully parsed as %d bytes are remaining.",
|
||||||
|
@ -486,18 +487,18 @@ void SCH_ALTIUM_PLUGIN::ParseFileHeader( const CFB::CompoundFileReader& aReader
|
||||||
if( reader.GetRemainingBytes() != 0 )
|
if( reader.GetRemainingBytes() != 0 )
|
||||||
THROW_IO_ERROR( "stream is not fully parsed" );
|
THROW_IO_ERROR( "stream is not fully parsed" );
|
||||||
|
|
||||||
// assign LIB_PART -> COMPONENT
|
// assign LIB_SYMBOL -> COMPONENT
|
||||||
for( auto component : m_components )
|
for( auto component : m_components )
|
||||||
{
|
{
|
||||||
auto kpart = m_symbols.find( component.first );
|
auto ksymbol = m_symbols.find( component.first );
|
||||||
|
|
||||||
if( kpart == m_symbols.end() )
|
if( ksymbol == m_symbols.end() )
|
||||||
THROW_IO_ERROR( "every component should have a symbol attached" );
|
THROW_IO_ERROR( "every component should have a symbol attached" );
|
||||||
|
|
||||||
m_pi->SaveSymbol( getLibFileName().GetFullPath(), new LIB_PART( *( kpart->second ) ),
|
m_pi->SaveSymbol( getLibFileName().GetFullPath(), new LIB_SYMBOL( *( ksymbol->second ) ),
|
||||||
m_properties.get() );
|
m_properties.get() );
|
||||||
|
|
||||||
component.second->SetLibSymbol( kpart->second );
|
component.second->SetLibSymbol( ksymbol->second );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle title blocks
|
// Handle title blocks
|
||||||
|
@ -563,11 +564,11 @@ void SCH_ALTIUM_PLUGIN::ParseComponent( int aIndex,
|
||||||
elem.libreference );
|
elem.libreference );
|
||||||
LIB_ID libId = AltiumToKiCadLibID( getLibName(), name );
|
LIB_ID libId = AltiumToKiCadLibID( getLibName(), name );
|
||||||
|
|
||||||
LIB_PART* kpart = new LIB_PART( wxEmptyString );
|
LIB_SYMBOL* ksymbol = new LIB_SYMBOL( wxEmptyString );
|
||||||
kpart->SetName( name );
|
ksymbol->SetName( name );
|
||||||
kpart->SetDescription( elem.componentdescription );
|
ksymbol->SetDescription( elem.componentdescription );
|
||||||
kpart->SetLibId( libId );
|
ksymbol->SetLibId( libId );
|
||||||
m_symbols.insert( { aIndex, kpart } );
|
m_symbols.insert( { aIndex, ksymbol } );
|
||||||
|
|
||||||
// each component has its own symbol for now
|
// each component has its own symbol for now
|
||||||
SCH_SYMBOL* symbol = new SCH_SYMBOL();
|
SCH_SYMBOL* symbol = new SCH_SYMBOL();
|
||||||
|
@ -575,7 +576,7 @@ void SCH_ALTIUM_PLUGIN::ParseComponent( int aIndex,
|
||||||
symbol->SetPosition( elem.location + m_sheetOffset );
|
symbol->SetPosition( elem.location + m_sheetOffset );
|
||||||
//component->SetOrientation( elem.orientation ); // TODO: keep it simple for now, and only set position
|
//component->SetOrientation( elem.orientation ); // TODO: keep it simple for now, and only set position
|
||||||
symbol->SetLibId( libId );
|
symbol->SetLibId( libId );
|
||||||
//component->SetLibSymbol( kpart ); // this has to be done after parsing the LIB_PART!
|
//component->SetLibSymbol( ksymbol ); // this has to be done after parsing the LIB_SYMBOL!
|
||||||
|
|
||||||
symbol->SetUnit( elem.currentpartid );
|
symbol->SetUnit( elem.currentpartid );
|
||||||
|
|
||||||
|
@ -1426,29 +1427,29 @@ void SCH_ALTIUM_PLUGIN::ParseSheetEntry( const std::map<wxString, wxString>& aPr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint HelperGeneratePowerPortGraphics( LIB_PART* aKPart, ASCH_POWER_PORT_STYLE aStyle,
|
wxPoint HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_STYLE aStyle,
|
||||||
REPORTER* aReporter )
|
REPORTER* aReporter )
|
||||||
{
|
{
|
||||||
if( aStyle == ASCH_POWER_PORT_STYLE::CIRCLE || aStyle == ASCH_POWER_PORT_STYLE::ARROW )
|
if( aStyle == ASCH_POWER_PORT_STYLE::CIRCLE || aStyle == ASCH_POWER_PORT_STYLE::ARROW )
|
||||||
{
|
{
|
||||||
LIB_POLYLINE* line1 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line1 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line1 );
|
aKsymbol->AddDrawItem( line1 );
|
||||||
line1->SetWidth( Mils2iu( 10 ) );
|
line1->SetWidth( Mils2iu( 10 ) );
|
||||||
line1->AddPoint( { 0, 0 } );
|
line1->AddPoint( { 0, 0 } );
|
||||||
line1->AddPoint( { 0, Mils2iu( -50 ) } );
|
line1->AddPoint( { 0, Mils2iu( -50 ) } );
|
||||||
|
|
||||||
if( aStyle == ASCH_POWER_PORT_STYLE::CIRCLE )
|
if( aStyle == ASCH_POWER_PORT_STYLE::CIRCLE )
|
||||||
{
|
{
|
||||||
LIB_CIRCLE* circle = new LIB_CIRCLE( aKPart );
|
LIB_CIRCLE* circle = new LIB_CIRCLE( aKsymbol );
|
||||||
aKPart->AddDrawItem( circle );
|
aKsymbol->AddDrawItem( circle );
|
||||||
circle->SetWidth( Mils2iu( 5 ) );
|
circle->SetWidth( Mils2iu( 5 ) );
|
||||||
circle->SetRadius( Mils2iu( 25 ) );
|
circle->SetRadius( Mils2iu( 25 ) );
|
||||||
circle->SetPosition( { Mils2iu( 0 ), Mils2iu( -75 ) } );
|
circle->SetPosition( { Mils2iu( 0 ), Mils2iu( -75 ) } );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line2 );
|
aKsymbol->AddDrawItem( line2 );
|
||||||
line2->SetWidth( Mils2iu( 10 ) );
|
line2->SetWidth( Mils2iu( 10 ) );
|
||||||
line2->AddPoint( { Mils2iu( -25 ), Mils2iu( -50 ) } );
|
line2->AddPoint( { Mils2iu( -25 ), Mils2iu( -50 ) } );
|
||||||
line2->AddPoint( { Mils2iu( 25 ), Mils2iu( -50 ) } );
|
line2->AddPoint( { Mils2iu( 25 ), Mils2iu( -50 ) } );
|
||||||
|
@ -1460,14 +1461,14 @@ wxPoint HelperGeneratePowerPortGraphics( LIB_PART* aKPart, ASCH_POWER_PORT_STYLE
|
||||||
}
|
}
|
||||||
else if( aStyle == ASCH_POWER_PORT_STYLE::WAVE )
|
else if( aStyle == ASCH_POWER_PORT_STYLE::WAVE )
|
||||||
{
|
{
|
||||||
LIB_POLYLINE* line = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line );
|
aKsymbol->AddDrawItem( line );
|
||||||
line->SetWidth( Mils2iu( 10 ) );
|
line->SetWidth( Mils2iu( 10 ) );
|
||||||
line->AddPoint( { 0, 0 } );
|
line->AddPoint( { 0, 0 } );
|
||||||
line->AddPoint( { 0, Mils2iu( -72 ) } );
|
line->AddPoint( { 0, Mils2iu( -72 ) } );
|
||||||
|
|
||||||
LIB_BEZIER* bezier = new LIB_BEZIER( aKPart );
|
LIB_BEZIER* bezier = new LIB_BEZIER( aKsymbol );
|
||||||
aKPart->AddDrawItem( bezier );
|
aKsymbol->AddDrawItem( bezier );
|
||||||
bezier->SetWidth( Mils2iu( 5 ) );
|
bezier->SetWidth( Mils2iu( 5 ) );
|
||||||
bezier->AddPoint( { Mils2iu( 30 ), Mils2iu( -50 ) } );
|
bezier->AddPoint( { Mils2iu( 30 ), Mils2iu( -50 ) } );
|
||||||
bezier->AddPoint( { Mils2iu( 30 ), Mils2iu( -87 ) } );
|
bezier->AddPoint( { Mils2iu( 30 ), Mils2iu( -87 ) } );
|
||||||
|
@ -1481,42 +1482,42 @@ wxPoint HelperGeneratePowerPortGraphics( LIB_PART* aKPart, ASCH_POWER_PORT_STYLE
|
||||||
|| aStyle == ASCH_POWER_PORT_STYLE::EARTH
|
|| aStyle == ASCH_POWER_PORT_STYLE::EARTH
|
||||||
|| aStyle == ASCH_POWER_PORT_STYLE::GOST_ARROW )
|
|| aStyle == ASCH_POWER_PORT_STYLE::GOST_ARROW )
|
||||||
{
|
{
|
||||||
LIB_POLYLINE* line1 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line1 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line1 );
|
aKsymbol->AddDrawItem( line1 );
|
||||||
line1->SetWidth( Mils2iu( 10 ) );
|
line1->SetWidth( Mils2iu( 10 ) );
|
||||||
line1->AddPoint( { 0, 0 } );
|
line1->AddPoint( { 0, 0 } );
|
||||||
line1->AddPoint( { 0, Mils2iu( -100 ) } );
|
line1->AddPoint( { 0, Mils2iu( -100 ) } );
|
||||||
|
|
||||||
if( aStyle == ASCH_POWER_PORT_STYLE::POWER_GROUND )
|
if( aStyle == ASCH_POWER_PORT_STYLE::POWER_GROUND )
|
||||||
{
|
{
|
||||||
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line2 );
|
aKsymbol->AddDrawItem( line2 );
|
||||||
line2->SetWidth( Mils2iu( 10 ) );
|
line2->SetWidth( Mils2iu( 10 ) );
|
||||||
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -100 ) } );
|
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -100 ) } );
|
||||||
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -100 ) } );
|
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -100 ) } );
|
||||||
|
|
||||||
LIB_POLYLINE* line3 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line3 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line3 );
|
aKsymbol->AddDrawItem( line3 );
|
||||||
line3->SetWidth( Mils2iu( 10 ) );
|
line3->SetWidth( Mils2iu( 10 ) );
|
||||||
line3->AddPoint( { Mils2iu( -70 ), Mils2iu( -130 ) } );
|
line3->AddPoint( { Mils2iu( -70 ), Mils2iu( -130 ) } );
|
||||||
line3->AddPoint( { Mils2iu( 70 ), Mils2iu( -130 ) } );
|
line3->AddPoint( { Mils2iu( 70 ), Mils2iu( -130 ) } );
|
||||||
|
|
||||||
LIB_POLYLINE* line4 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line4 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line4 );
|
aKsymbol->AddDrawItem( line4 );
|
||||||
line4->SetWidth( Mils2iu( 10 ) );
|
line4->SetWidth( Mils2iu( 10 ) );
|
||||||
line4->AddPoint( { Mils2iu( -40 ), Mils2iu( -160 ) } );
|
line4->AddPoint( { Mils2iu( -40 ), Mils2iu( -160 ) } );
|
||||||
line4->AddPoint( { Mils2iu( 40 ), Mils2iu( -160 ) } );
|
line4->AddPoint( { Mils2iu( 40 ), Mils2iu( -160 ) } );
|
||||||
|
|
||||||
LIB_POLYLINE* line5 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line5 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line5 );
|
aKsymbol->AddDrawItem( line5 );
|
||||||
line5->SetWidth( Mils2iu( 10 ) );
|
line5->SetWidth( Mils2iu( 10 ) );
|
||||||
line5->AddPoint( { Mils2iu( -10 ), Mils2iu( -190 ) } );
|
line5->AddPoint( { Mils2iu( -10 ), Mils2iu( -190 ) } );
|
||||||
line5->AddPoint( { Mils2iu( 10 ), Mils2iu( -190 ) } );
|
line5->AddPoint( { Mils2iu( 10 ), Mils2iu( -190 ) } );
|
||||||
}
|
}
|
||||||
else if( aStyle == ASCH_POWER_PORT_STYLE::SIGNAL_GROUND )
|
else if( aStyle == ASCH_POWER_PORT_STYLE::SIGNAL_GROUND )
|
||||||
{
|
{
|
||||||
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line2 );
|
aKsymbol->AddDrawItem( line2 );
|
||||||
line2->SetWidth( Mils2iu( 10 ) );
|
line2->SetWidth( Mils2iu( 10 ) );
|
||||||
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -100 ) } );
|
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -100 ) } );
|
||||||
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -100 ) } );
|
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -100 ) } );
|
||||||
|
@ -1525,24 +1526,24 @@ wxPoint HelperGeneratePowerPortGraphics( LIB_PART* aKPart, ASCH_POWER_PORT_STYLE
|
||||||
}
|
}
|
||||||
else if( aStyle == ASCH_POWER_PORT_STYLE::EARTH )
|
else if( aStyle == ASCH_POWER_PORT_STYLE::EARTH )
|
||||||
{
|
{
|
||||||
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line2 );
|
aKsymbol->AddDrawItem( line2 );
|
||||||
line2->SetWidth( Mils2iu( 10 ) );
|
line2->SetWidth( Mils2iu( 10 ) );
|
||||||
line2->AddPoint( { Mils2iu( -150 ), Mils2iu( -200 ) } );
|
line2->AddPoint( { Mils2iu( -150 ), Mils2iu( -200 ) } );
|
||||||
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -100 ) } );
|
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -100 ) } );
|
||||||
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -100 ) } );
|
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -100 ) } );
|
||||||
line2->AddPoint( { Mils2iu( 50 ), Mils2iu( -200 ) } );
|
line2->AddPoint( { Mils2iu( 50 ), Mils2iu( -200 ) } );
|
||||||
|
|
||||||
LIB_POLYLINE* line3 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line3 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line3 );
|
aKsymbol->AddDrawItem( line3 );
|
||||||
line3->SetWidth( Mils2iu( 10 ) );
|
line3->SetWidth( Mils2iu( 10 ) );
|
||||||
line3->AddPoint( { Mils2iu( 0 ), Mils2iu( -100 ) } );
|
line3->AddPoint( { Mils2iu( 0 ), Mils2iu( -100 ) } );
|
||||||
line3->AddPoint( { Mils2iu( -50 ), Mils2iu( -200 ) } );
|
line3->AddPoint( { Mils2iu( -50 ), Mils2iu( -200 ) } );
|
||||||
}
|
}
|
||||||
else // ASCH_POWER_PORT_STYLE::GOST_ARROW
|
else // ASCH_POWER_PORT_STYLE::GOST_ARROW
|
||||||
{
|
{
|
||||||
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line2 );
|
aKsymbol->AddDrawItem( line2 );
|
||||||
line2->SetWidth( Mils2iu( 10 ) );
|
line2->SetWidth( Mils2iu( 10 ) );
|
||||||
line2->AddPoint( { Mils2iu( -25 ), Mils2iu( -50 ) } );
|
line2->AddPoint( { Mils2iu( -25 ), Mils2iu( -50 ) } );
|
||||||
line2->AddPoint( { Mils2iu( 0 ), Mils2iu( -100 ) } );
|
line2->AddPoint( { Mils2iu( 0 ), Mils2iu( -100 ) } );
|
||||||
|
@ -1556,26 +1557,26 @@ wxPoint HelperGeneratePowerPortGraphics( LIB_PART* aKPart, ASCH_POWER_PORT_STYLE
|
||||||
else if( aStyle == ASCH_POWER_PORT_STYLE::GOST_POWER_GROUND
|
else if( aStyle == ASCH_POWER_PORT_STYLE::GOST_POWER_GROUND
|
||||||
|| aStyle == ASCH_POWER_PORT_STYLE::GOST_EARTH )
|
|| aStyle == ASCH_POWER_PORT_STYLE::GOST_EARTH )
|
||||||
{
|
{
|
||||||
LIB_POLYLINE* line1 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line1 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line1 );
|
aKsymbol->AddDrawItem( line1 );
|
||||||
line1->SetWidth( Mils2iu( 10 ) );
|
line1->SetWidth( Mils2iu( 10 ) );
|
||||||
line1->AddPoint( { 0, 0 } );
|
line1->AddPoint( { 0, 0 } );
|
||||||
line1->AddPoint( { 0, Mils2iu( -160 ) } );
|
line1->AddPoint( { 0, Mils2iu( -160 ) } );
|
||||||
|
|
||||||
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line2 );
|
aKsymbol->AddDrawItem( line2 );
|
||||||
line2->SetWidth( Mils2iu( 10 ) );
|
line2->SetWidth( Mils2iu( 10 ) );
|
||||||
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -160 ) } );
|
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -160 ) } );
|
||||||
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -160 ) } );
|
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -160 ) } );
|
||||||
|
|
||||||
LIB_POLYLINE* line3 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line3 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line3 );
|
aKsymbol->AddDrawItem( line3 );
|
||||||
line3->SetWidth( Mils2iu( 10 ) );
|
line3->SetWidth( Mils2iu( 10 ) );
|
||||||
line3->AddPoint( { Mils2iu( -60 ), Mils2iu( -200 ) } );
|
line3->AddPoint( { Mils2iu( -60 ), Mils2iu( -200 ) } );
|
||||||
line3->AddPoint( { Mils2iu( 60 ), Mils2iu( -200 ) } );
|
line3->AddPoint( { Mils2iu( 60 ), Mils2iu( -200 ) } );
|
||||||
|
|
||||||
LIB_POLYLINE* line4 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line4 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line4 );
|
aKsymbol->AddDrawItem( line4 );
|
||||||
line4->SetWidth( Mils2iu( 10 ) );
|
line4->SetWidth( Mils2iu( 10 ) );
|
||||||
line4->AddPoint( { Mils2iu( -20 ), Mils2iu( -240 ) } );
|
line4->AddPoint( { Mils2iu( -20 ), Mils2iu( -240 ) } );
|
||||||
line4->AddPoint( { Mils2iu( 20 ), Mils2iu( -240 ) } );
|
line4->AddPoint( { Mils2iu( 20 ), Mils2iu( -240 ) } );
|
||||||
|
@ -1583,8 +1584,8 @@ wxPoint HelperGeneratePowerPortGraphics( LIB_PART* aKPart, ASCH_POWER_PORT_STYLE
|
||||||
if( aStyle == ASCH_POWER_PORT_STYLE::GOST_POWER_GROUND )
|
if( aStyle == ASCH_POWER_PORT_STYLE::GOST_POWER_GROUND )
|
||||||
return { 0, Mils2iu( 300 ) };
|
return { 0, Mils2iu( 300 ) };
|
||||||
|
|
||||||
LIB_CIRCLE* circle = new LIB_CIRCLE( aKPart );
|
LIB_CIRCLE* circle = new LIB_CIRCLE( aKsymbol );
|
||||||
aKPart->AddDrawItem( circle );
|
aKsymbol->AddDrawItem( circle );
|
||||||
circle->SetWidth( Mils2iu( 10 ) );
|
circle->SetWidth( Mils2iu( 10 ) );
|
||||||
circle->SetRadius( Mils2iu( 120 ) );
|
circle->SetRadius( Mils2iu( 120 ) );
|
||||||
circle->SetPosition( { Mils2iu( 0 ), Mils2iu( -160 ) } );
|
circle->SetPosition( { Mils2iu( 0 ), Mils2iu( -160 ) } );
|
||||||
|
@ -1593,14 +1594,14 @@ wxPoint HelperGeneratePowerPortGraphics( LIB_PART* aKPart, ASCH_POWER_PORT_STYLE
|
||||||
}
|
}
|
||||||
else if( aStyle == ASCH_POWER_PORT_STYLE::GOST_BAR )
|
else if( aStyle == ASCH_POWER_PORT_STYLE::GOST_BAR )
|
||||||
{
|
{
|
||||||
LIB_POLYLINE* line1 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line1 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line1 );
|
aKsymbol->AddDrawItem( line1 );
|
||||||
line1->SetWidth( Mils2iu( 10 ) );
|
line1->SetWidth( Mils2iu( 10 ) );
|
||||||
line1->AddPoint( { 0, 0 } );
|
line1->AddPoint( { 0, 0 } );
|
||||||
line1->AddPoint( { 0, Mils2iu( -200 ) } );
|
line1->AddPoint( { 0, Mils2iu( -200 ) } );
|
||||||
|
|
||||||
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line2 );
|
aKsymbol->AddDrawItem( line2 );
|
||||||
line2->SetWidth( Mils2iu( 10 ) );
|
line2->SetWidth( Mils2iu( 10 ) );
|
||||||
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -200 ) } );
|
line2->AddPoint( { Mils2iu( -100 ), Mils2iu( -200 ) } );
|
||||||
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -200 ) } );
|
line2->AddPoint( { Mils2iu( 100 ), Mils2iu( -200 ) } );
|
||||||
|
@ -1615,14 +1616,14 @@ wxPoint HelperGeneratePowerPortGraphics( LIB_PART* aKPart, ASCH_POWER_PORT_STYLE
|
||||||
RPT_SEVERITY_WARNING );
|
RPT_SEVERITY_WARNING );
|
||||||
}
|
}
|
||||||
|
|
||||||
LIB_POLYLINE* line1 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line1 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line1 );
|
aKsymbol->AddDrawItem( line1 );
|
||||||
line1->SetWidth( Mils2iu( 10 ) );
|
line1->SetWidth( Mils2iu( 10 ) );
|
||||||
line1->AddPoint( { 0, 0 } );
|
line1->AddPoint( { 0, 0 } );
|
||||||
line1->AddPoint( { 0, Mils2iu( -100 ) } );
|
line1->AddPoint( { 0, Mils2iu( -100 ) } );
|
||||||
|
|
||||||
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKPart );
|
LIB_POLYLINE* line2 = new LIB_POLYLINE( aKsymbol );
|
||||||
aKPart->AddDrawItem( line2 );
|
aKsymbol->AddDrawItem( line2 );
|
||||||
line2->SetWidth( Mils2iu( 10 ) );
|
line2->SetWidth( Mils2iu( 10 ) );
|
||||||
line2->AddPoint( { Mils2iu( -50 ), Mils2iu( -100 ) } );
|
line2->AddPoint( { Mils2iu( -50 ), Mils2iu( -100 ) } );
|
||||||
line2->AddPoint( { Mils2iu( 50 ), Mils2iu( -100 ) } );
|
line2->AddPoint( { Mils2iu( 50 ), Mils2iu( -100 ) } );
|
||||||
|
@ -1638,29 +1639,30 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map<wxString, wxString>& aPro
|
||||||
|
|
||||||
LIB_ID libId = AltiumToKiCadLibID( getLibName(), elem.text );
|
LIB_ID libId = AltiumToKiCadLibID( getLibName(), elem.text );
|
||||||
|
|
||||||
LIB_PART* kpart = nullptr;
|
LIB_SYMBOL* ksymbol = nullptr;
|
||||||
|
|
||||||
const auto& symbol = m_powerSymbols.find( elem.text );
|
const auto& symbol = m_powerSymbols.find( elem.text );
|
||||||
if( symbol != m_powerSymbols.end() )
|
if( symbol != m_powerSymbols.end() )
|
||||||
{
|
{
|
||||||
kpart = symbol->second; // cache hit
|
ksymbol = symbol->second; // cache hit
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
kpart = new LIB_PART( wxEmptyString );
|
ksymbol = new LIB_SYMBOL( wxEmptyString );
|
||||||
kpart->SetPower();
|
ksymbol->SetPower();
|
||||||
kpart->SetName( elem.text );
|
ksymbol->SetName( elem.text );
|
||||||
kpart->GetReferenceField().SetText( "#PWR" );
|
ksymbol->GetReferenceField().SetText( "#PWR" );
|
||||||
kpart->GetValueField().SetText( elem.text );
|
ksymbol->GetValueField().SetText( elem.text );
|
||||||
kpart->GetValueField().SetVisible( true ); // TODO: why does this not work?
|
ksymbol->GetValueField().SetVisible( true ); // TODO: why does this not work?
|
||||||
kpart->SetDescription( wxString::Format( _( "Power symbol creates a global label with name '%s'" ),
|
ksymbol->SetDescription(
|
||||||
elem.text ) );
|
wxString::Format( _( "Power symbol creates a global label with name '%s'" ),
|
||||||
kpart->SetKeyWords( "power-flag" );
|
elem.text ) );
|
||||||
kpart->SetLibId( libId );
|
ksymbol->SetKeyWords( "power-flag" );
|
||||||
|
ksymbol->SetLibId( libId );
|
||||||
|
|
||||||
// generate graphic
|
// generate graphic
|
||||||
LIB_PIN* pin = new LIB_PIN( kpart );
|
LIB_PIN* pin = new LIB_PIN( ksymbol );
|
||||||
kpart->AddDrawItem( pin );
|
ksymbol->AddDrawItem( pin );
|
||||||
|
|
||||||
pin->SetName( elem.text );
|
pin->SetName( elem.text );
|
||||||
pin->SetPosition( { 0, 0 } );
|
pin->SetPosition( { 0, 0 } );
|
||||||
|
@ -1670,13 +1672,13 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map<wxString, wxString>& aPro
|
||||||
pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
|
pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
|
||||||
pin->SetVisible( false );
|
pin->SetVisible( false );
|
||||||
|
|
||||||
wxPoint valueFieldPos = HelperGeneratePowerPortGraphics( kpart, elem.style, m_reporter );
|
wxPoint valueFieldPos = HelperGeneratePowerPortGraphics( ksymbol, elem.style, m_reporter );
|
||||||
|
|
||||||
kpart->GetValueField().SetPosition( valueFieldPos );
|
ksymbol->GetValueField().SetPosition( valueFieldPos );
|
||||||
|
|
||||||
// this has to be done after parsing the LIB_PART!
|
// this has to be done after parsing the LIB_SYMBOL!
|
||||||
m_pi->SaveSymbol( getLibFileName().GetFullPath(), kpart, m_properties.get() );
|
m_pi->SaveSymbol( getLibFileName().GetFullPath(), ksymbol, m_properties.get() );
|
||||||
m_powerSymbols.insert( { elem.text, kpart } );
|
m_powerSymbols.insert( { elem.text, ksymbol } );
|
||||||
}
|
}
|
||||||
|
|
||||||
SCH_SHEET_PATH sheetpath;
|
SCH_SHEET_PATH sheetpath;
|
||||||
|
@ -1687,13 +1689,13 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map<wxString, wxString>& aPro
|
||||||
component->SetRef( &sheetpath, "#PWR?" );
|
component->SetRef( &sheetpath, "#PWR?" );
|
||||||
component->SetValue( elem.text );
|
component->SetValue( elem.text );
|
||||||
component->SetLibId( libId );
|
component->SetLibId( libId );
|
||||||
component->SetLibSymbol( new LIB_PART( *kpart ) );
|
component->SetLibSymbol( new LIB_SYMBOL( *ksymbol ) );
|
||||||
|
|
||||||
SCH_FIELD* valueField = component->GetField( VALUE_FIELD );
|
SCH_FIELD* valueField = component->GetField( VALUE_FIELD );
|
||||||
|
|
||||||
// TODO: Why do I need to set those a second time?
|
// TODO: Why do I need to set those a second time?
|
||||||
valueField->SetVisible( true );
|
valueField->SetVisible( true );
|
||||||
valueField->SetPosition( kpart->GetValueField().GetPosition() );
|
valueField->SetPosition( ksymbol->GetValueField().GetPosition() );
|
||||||
|
|
||||||
component->SetPosition( elem.location + m_sheetOffset );
|
component->SetPosition( elem.location + m_sheetOffset );
|
||||||
|
|
||||||
|
|
|
@ -79,10 +79,10 @@ public:
|
||||||
//void EnumerateSymbolLib( wxArrayString& aAliasNameList, const wxString& aLibraryPath,
|
//void EnumerateSymbolLib( wxArrayString& aAliasNameList, const wxString& aLibraryPath,
|
||||||
// const PROPERTIES* aProperties = NULL ) override;
|
// const PROPERTIES* aProperties = NULL ) override;
|
||||||
|
|
||||||
//LIB_PART* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
//LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||||
// const PROPERTIES* aProperties = NULL ) override;
|
// const PROPERTIES* aProperties = NULL ) override;
|
||||||
|
|
||||||
//void SaveSymbol( const wxString& aLibraryPath, const LIB_PART* aSymbol,
|
//void SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
||||||
// const PROPERTIES* aProperties = NULL ) override;
|
// const PROPERTIES* aProperties = NULL ) override;
|
||||||
|
|
||||||
//void DeleteAlias( const wxString& aLibraryPath, const wxString& aAliasName,
|
//void DeleteAlias( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||||
|
@ -157,9 +157,9 @@ private:
|
||||||
std::unique_ptr<ASCH_SHEET> m_altiumSheet;
|
std::unique_ptr<ASCH_SHEET> m_altiumSheet;
|
||||||
std::map<int, SCH_SYMBOL*> m_components;
|
std::map<int, SCH_SYMBOL*> m_components;
|
||||||
std::map<int, SCH_SHEET*> m_sheets;
|
std::map<int, SCH_SHEET*> m_sheets;
|
||||||
std::map<int, LIB_PART*> m_symbols; // every component has its unique symbol
|
std::map<int, LIB_SYMBOL*> m_symbols; // every component has its unique symbol
|
||||||
|
|
||||||
std::map<wxString, LIB_PART*> m_powerSymbols;
|
std::map<wxString, LIB_SYMBOL*> m_powerSymbols;
|
||||||
std::vector<ASCH_STORAGE_FILE> m_altiumStorage;
|
std::vector<ASCH_STORAGE_FILE> m_altiumStorage;
|
||||||
|
|
||||||
std::map<int, ASCH_SYMBOL> m_altiumComponents;
|
std::map<int, ASCH_SYMBOL> m_altiumComponents;
|
||||||
|
|
|
@ -337,7 +337,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary()
|
||||||
if( part.Definition.GateSymbols.size() == 0 )
|
if( part.Definition.GateSymbols.size() == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LIB_PART* kiPart = new LIB_PART( part.Name );
|
LIB_SYMBOL* kiPart = new LIB_SYMBOL( part.Name );
|
||||||
|
|
||||||
kiPart->SetUnitCount( part.Definition.GateSymbols.size() );
|
kiPart->SetUnitCount( part.Definition.GateSymbols.size() );
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
@ -371,7 +371,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadPartsLibrary()
|
||||||
{
|
{
|
||||||
( *m_plugin )->SaveSymbol( m_libraryFileName.GetFullPath(), kiPart );
|
( *m_plugin )->SaveSymbol( m_libraryFileName.GetFullPath(), kiPart );
|
||||||
|
|
||||||
LIB_PART* loadedPart =
|
LIB_SYMBOL* loadedPart =
|
||||||
( *m_plugin )->LoadSymbol( m_libraryFileName.GetFullPath(), kiPart->GetName() );
|
( *m_plugin )->LoadSymbol( m_libraryFileName.GetFullPath(), kiPart->GetName() );
|
||||||
|
|
||||||
m_partMap.insert( { partID, loadedPart } );
|
m_partMap.insert( { partID, loadedPart } );
|
||||||
|
@ -413,7 +413,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
|
||||||
sym.GateID = wxT( "A" ); // Assume Gate "A" if unspecified
|
sym.GateID = wxT( "A" ); // Assume Gate "A" if unspecified
|
||||||
|
|
||||||
PART_GATE_ID partSymbolID = { sym.PartRef.RefID, sym.GateID };
|
PART_GATE_ID partSymbolID = { sym.PartRef.RefID, sym.GateID };
|
||||||
LIB_PART* kiPart = m_partMap.at( sym.PartRef.RefID );
|
LIB_SYMBOL* kiPart = m_partMap.at( sym.PartRef.RefID );
|
||||||
bool copy = false;
|
bool copy = false;
|
||||||
|
|
||||||
// The symbol definition in the part either does not exist for this gate number
|
// The symbol definition in the part either does not exist for this gate number
|
||||||
|
@ -421,13 +421,13 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
|
||||||
if( m_partSymbolsMap.find( partSymbolID ) == m_partSymbolsMap.end()
|
if( m_partSymbolsMap.find( partSymbolID ) == m_partSymbolsMap.end()
|
||||||
|| m_partSymbolsMap.at( partSymbolID ) != sym.SymdefID )
|
|| m_partSymbolsMap.at( partSymbolID ) != sym.SymdefID )
|
||||||
{
|
{
|
||||||
kiPart = new LIB_PART( *kiPart ); // Make a copy
|
kiPart = new LIB_SYMBOL( *kiPart ); // Make a copy
|
||||||
copy = true;
|
copy = true;
|
||||||
const PART& part = Parts.PartDefinitions.at( sym.PartRef.RefID );
|
const PART& part = Parts.PartDefinitions.at( sym.PartRef.RefID );
|
||||||
loadSymDefIntoLibrary( sym.SymdefID, &part, sym.GateID, kiPart );
|
loadSymDefIntoLibrary( sym.SymdefID, &part, sym.GateID, kiPart );
|
||||||
}
|
}
|
||||||
|
|
||||||
LIB_PART* scaledPart = getScaledLibPart( kiPart, sym.ScaleRatioNumerator,
|
LIB_SYMBOL* scaledPart = getScaledLibPart( kiPart, sym.ScaleRatioNumerator,
|
||||||
sym.ScaleRatioDenominator );
|
sym.ScaleRatioDenominator );
|
||||||
|
|
||||||
double symOrientDeciDeg = 0.0;
|
double symOrientDeciDeg = 0.0;
|
||||||
|
@ -526,7 +526,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
|
||||||
if( sym.SymbolVariant.Type == SYMBOLVARIANT::TYPE::GLOBALSIGNAL )
|
if( sym.SymbolVariant.Type == SYMBOLVARIANT::TYPE::GLOBALSIGNAL )
|
||||||
{
|
{
|
||||||
SYMDEF_ID symID = sym.SymdefID;
|
SYMDEF_ID symID = sym.SymdefID;
|
||||||
LIB_PART* kiPart = nullptr;
|
LIB_SYMBOL* kiPart = nullptr;
|
||||||
|
|
||||||
// In CADSTAR "GlobalSignal" is a special type of symbol which defines
|
// In CADSTAR "GlobalSignal" is a special type of symbol which defines
|
||||||
// a Power Symbol. The "Alternate" name defines the default net name of
|
// a Power Symbol. The "Alternate" name defines the default net name of
|
||||||
|
@ -556,7 +556,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
|
||||||
{
|
{
|
||||||
SYMDEF_SCM symbolDef = Library.SymbolDefinitions.at( symID );
|
SYMDEF_SCM symbolDef = Library.SymbolDefinitions.at( symID );
|
||||||
|
|
||||||
kiPart = new LIB_PART( libPartName );
|
kiPart = new LIB_SYMBOL( libPartName );
|
||||||
kiPart->SetPower();
|
kiPart->SetPower();
|
||||||
loadSymDefIntoLibrary( symID, nullptr, "A", kiPart );
|
loadSymDefIntoLibrary( symID, nullptr, "A", kiPart );
|
||||||
|
|
||||||
|
@ -589,8 +589,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
|
||||||
wxASSERT( kiPart->GetValueField().GetText() == symbolInstanceNetName );
|
wxASSERT( kiPart->GetValueField().GetText() == symbolInstanceNetName );
|
||||||
}
|
}
|
||||||
|
|
||||||
LIB_PART* scaledPart = getScaledLibPart( kiPart, sym.ScaleRatioNumerator,
|
LIB_SYMBOL* scaledPart = getScaledLibPart( kiPart, sym.ScaleRatioNumerator,
|
||||||
sym.ScaleRatioDenominator );
|
sym.ScaleRatioDenominator );
|
||||||
|
|
||||||
double returnedOrient = 0.0;
|
double returnedOrient = 0.0;
|
||||||
SCH_SYMBOL* symbol = loadSchematicSymbol( sym, *scaledPart, returnedOrient );
|
SCH_SYMBOL* symbol = loadSchematicSymbol( sym, *scaledPart, returnedOrient );
|
||||||
|
@ -788,7 +788,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
|
||||||
if( aNode.Contains( "BLKT" ) )
|
if( aNode.Contains( "BLKT" ) )
|
||||||
{
|
{
|
||||||
NET_SCH::BLOCK_TERM blockTerm = net.BlockTerminals.at( aNode );
|
NET_SCH::BLOCK_TERM blockTerm = net.BlockTerminals.at( aNode );
|
||||||
BLOCK_PIN_ID blockPinID = std::make_pair( blockTerm.BlockID, blockTerm.TerminalID );
|
BLOCK_PIN_ID blockPinID = std::make_pair( blockTerm.BlockID,
|
||||||
|
blockTerm.TerminalID );
|
||||||
|
|
||||||
if( m_sheetPinMap.find( blockPinID )
|
if( m_sheetPinMap.find( blockPinID )
|
||||||
!= m_sheetPinMap.end() )
|
!= m_sheetPinMap.end() )
|
||||||
|
@ -1203,7 +1204,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadTextVariables()
|
||||||
|
|
||||||
|
|
||||||
void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdefID,
|
void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdefID,
|
||||||
const PART* aCadstarPart, const GATE_ID& aGateID, LIB_PART* aPart )
|
const PART* aCadstarPart, const GATE_ID& aGateID, LIB_SYMBOL* aSymbol )
|
||||||
{
|
{
|
||||||
wxCHECK( Library.SymbolDefinitions.find( aSymdefID ) != Library.SymbolDefinitions.end(), );
|
wxCHECK( Library.SymbolDefinitions.find( aSymdefID ) != Library.SymbolDefinitions.end(), );
|
||||||
|
|
||||||
|
@ -1214,11 +1215,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
||||||
{
|
{
|
||||||
FIGURE fig = figPair.second;
|
FIGURE fig = figPair.second;
|
||||||
|
|
||||||
loadLibrarySymbolShapeVertices( fig.Shape.Vertices, symbol.Origin, aPart, gateNumber );
|
loadLibrarySymbolShapeVertices( fig.Shape.Vertices, symbol.Origin, aSymbol, gateNumber );
|
||||||
|
|
||||||
for( CUTOUT c : fig.Shape.Cutouts )
|
for( CUTOUT c : fig.Shape.Cutouts )
|
||||||
{
|
{
|
||||||
loadLibrarySymbolShapeVertices( c.Vertices, symbol.Origin, aPart, gateNumber );
|
loadLibrarySymbolShapeVertices( c.Vertices, symbol.Origin, aSymbol, gateNumber );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1229,7 +1230,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
||||||
TERMINAL term = termPair.second;
|
TERMINAL term = termPair.second;
|
||||||
wxString pinNum = wxString::Format( "%ld", term.ID );
|
wxString pinNum = wxString::Format( "%ld", term.ID );
|
||||||
wxString pinName = wxEmptyString;
|
wxString pinName = wxEmptyString;
|
||||||
LIB_PIN* pin = new LIB_PIN( aPart );
|
LIB_PIN* pin = new LIB_PIN( aSymbol );
|
||||||
|
|
||||||
if( aCadstarPart )
|
if( aCadstarPart )
|
||||||
{
|
{
|
||||||
|
@ -1265,17 +1266,17 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
||||||
pin->SetNumber( pinNum );
|
pin->SetNumber( pinNum );
|
||||||
pin->SetName( pinName );
|
pin->SetName( pinName );
|
||||||
|
|
||||||
if( aPart->IsPower() )
|
if( aSymbol->IsPower() )
|
||||||
{
|
{
|
||||||
pin->SetVisible( false );
|
pin->SetVisible( false );
|
||||||
pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
|
pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
|
||||||
pin->SetName( aPart->GetName() );
|
pin->SetName( aSymbol->GetName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
aPart->AddDrawItem( pin );
|
aSymbol->AddDrawItem( pin );
|
||||||
}
|
}
|
||||||
|
|
||||||
fixUpLibraryPins( aPart, gateNumber );
|
fixUpLibraryPins( aSymbol, gateNumber );
|
||||||
|
|
||||||
if(aCadstarPart)
|
if(aCadstarPart)
|
||||||
m_pinNumsMap.insert( { aCadstarPart->ID + aGateID, pinNumMap } );
|
m_pinNumsMap.insert( { aCadstarPart->ID + aGateID, pinNumMap } );
|
||||||
|
@ -1284,7 +1285,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
||||||
{
|
{
|
||||||
TEXT csText = textPair.second;
|
TEXT csText = textPair.second;
|
||||||
|
|
||||||
LIB_TEXT* libtext = new LIB_TEXT( aPart );
|
LIB_TEXT* libtext = new LIB_TEXT( aSymbol );
|
||||||
libtext->SetText( csText.Text );
|
libtext->SetText( csText.Text );
|
||||||
libtext->SetUnit( gateNumber );
|
libtext->SetUnit( gateNumber );
|
||||||
libtext->SetPosition( getKiCadLibraryPoint( csText.Position, symbol.Origin ) );
|
libtext->SetPosition( getKiCadLibraryPoint( csText.Position, symbol.Origin ) );
|
||||||
|
@ -1319,7 +1320,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
||||||
|
|
||||||
// Multiline text not allowed in LIB_TEXT
|
// Multiline text not allowed in LIB_TEXT
|
||||||
line->SetMultilineAllowed( false );
|
line->SetMultilineAllowed( false );
|
||||||
aPart->AddDrawItem( line );
|
aSymbol->AddDrawItem( line );
|
||||||
}
|
}
|
||||||
|
|
||||||
delete libtext;
|
delete libtext;
|
||||||
|
@ -1328,33 +1329,33 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
||||||
{
|
{
|
||||||
// Multiline text not allowed in LIB_TEXT
|
// Multiline text not allowed in LIB_TEXT
|
||||||
libtext->SetMultilineAllowed( false );
|
libtext->SetMultilineAllowed( false );
|
||||||
aPart->AddDrawItem( libtext );
|
aSymbol->AddDrawItem( libtext );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( symbol.TextLocations.find( SYMBOL_NAME_ATTRID ) != symbol.TextLocations.end() )
|
if( symbol.TextLocations.find( SYMBOL_NAME_ATTRID ) != symbol.TextLocations.end() )
|
||||||
{
|
{
|
||||||
TEXT_LOCATION textLoc = symbol.TextLocations.at( SYMBOL_NAME_ATTRID );
|
TEXT_LOCATION textLoc = symbol.TextLocations.at( SYMBOL_NAME_ATTRID );
|
||||||
LIB_FIELD* field = &aPart->GetReferenceField();
|
LIB_FIELD* field = &aSymbol->GetReferenceField();
|
||||||
applyToLibraryFieldAttribute( textLoc, symbol.Origin, field );
|
applyToLibraryFieldAttribute( textLoc, symbol.Origin, field );
|
||||||
field->SetUnit( gateNumber );
|
field->SetUnit( gateNumber );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide the value field for now (it might get unhidden if an attribute exists in the cadstar
|
// Hide the value field for now (it might get unhidden if an attribute exists in the cadstar
|
||||||
// design with the text "Value"
|
// design with the text "Value"
|
||||||
aPart->GetValueField().SetVisible( false );
|
aSymbol->GetValueField().SetVisible( false );
|
||||||
|
|
||||||
if( symbol.TextLocations.find( PART_NAME_ATTRID ) != symbol.TextLocations.end() )
|
if( symbol.TextLocations.find( PART_NAME_ATTRID ) != symbol.TextLocations.end() )
|
||||||
{
|
{
|
||||||
TEXT_LOCATION textLoc = symbol.TextLocations.at( PART_NAME_ATTRID );
|
TEXT_LOCATION textLoc = symbol.TextLocations.at( PART_NAME_ATTRID );
|
||||||
LIB_FIELD* field = aPart->FindField( PartNameFieldName );
|
LIB_FIELD* field = aSymbol->FindField( PartNameFieldName );
|
||||||
|
|
||||||
if( !field )
|
if( !field )
|
||||||
{
|
{
|
||||||
int fieldID = aPart->GetFieldCount();
|
int fieldID = aSymbol->GetFieldCount();
|
||||||
field = new LIB_FIELD( aPart, fieldID );
|
field = new LIB_FIELD( aSymbol, fieldID );
|
||||||
field->SetName( PartNameFieldName );
|
field->SetName( PartNameFieldName );
|
||||||
aPart->AddField( field );
|
aSymbol->AddField( field );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxASSERT( field->GetName() == PartNameFieldName );
|
wxASSERT( field->GetName() == PartNameFieldName );
|
||||||
|
@ -1383,24 +1384,25 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
||||||
{
|
{
|
||||||
wxString attrName = getAttributeName( aAttributeVal.AttributeID );
|
wxString attrName = getAttributeName( aAttributeVal.AttributeID );
|
||||||
|
|
||||||
//Remove invalid field characters
|
// Remove invalid field characters
|
||||||
aAttributeVal.Value.Replace( wxT( "\n" ), wxT( "\\n" ) );
|
aAttributeVal.Value.Replace( wxT( "\n" ), wxT( "\\n" ) );
|
||||||
aAttributeVal.Value.Replace( wxT( "\r" ), wxT( "\\r" ) );
|
aAttributeVal.Value.Replace( wxT( "\r" ), wxT( "\\r" ) );
|
||||||
aAttributeVal.Value.Replace( wxT( "\t" ), wxT( "\\t" ) );
|
aAttributeVal.Value.Replace( wxT( "\t" ), wxT( "\\t" ) );
|
||||||
|
|
||||||
//TODO: Handle "links": In cadstar a field can be a "link" if its name starts with the
|
//TODO: Handle "links": In cadstar a field can be a "link" if its name starts
|
||||||
//characters "Link ". Need to figure out how to convert them to equivalent in KiCad
|
// with the characters "Link ". Need to figure out how to convert them to
|
||||||
|
// equivalent in KiCad.
|
||||||
|
|
||||||
if( attrName == wxT( "(PartDefinitionNameStem)" ) )
|
if( attrName == wxT( "(PartDefinitionNameStem)" ) )
|
||||||
{
|
{
|
||||||
//Space not allowed in Reference field
|
//Space not allowed in Reference field
|
||||||
aAttributeVal.Value.Replace( wxT( " " ), "_" );
|
aAttributeVal.Value.Replace( wxT( " " ), "_" );
|
||||||
aPart->GetReferenceField().SetText( aAttributeVal.Value );
|
aSymbol->GetReferenceField().SetText( aAttributeVal.Value );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if( attrName == wxT( "(PartDescription)" ) )
|
else if( attrName == wxT( "(PartDescription)" ) )
|
||||||
{
|
{
|
||||||
aPart->SetDescription( aAttributeVal.Value );
|
aSymbol->SetDescription( aAttributeVal.Value );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if( attrName == wxT( "(PartDefinitionReferenceName)" ) )
|
else if( attrName == wxT( "(PartDefinitionReferenceName)" ) )
|
||||||
|
@ -1414,14 +1416,14 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LIB_FIELD* attrField = aPart->FindField( attrName );
|
LIB_FIELD* attrField = aSymbol->FindField( attrName );
|
||||||
|
|
||||||
if( !attrField )
|
if( !attrField )
|
||||||
{
|
{
|
||||||
int fieldID = aPart->GetFieldCount();
|
int fieldID = aSymbol->GetFieldCount();
|
||||||
attrField = new LIB_FIELD( aPart, fieldID );
|
attrField = new LIB_FIELD( aSymbol, fieldID );
|
||||||
attrField->SetName( attrName );
|
attrField->SetName( attrName );
|
||||||
aPart->AddField( attrField );
|
aSymbol->AddField( attrField );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxASSERT( attrField->GetName() == attrName );
|
wxASSERT( attrField->GetName() == attrName );
|
||||||
|
@ -1478,25 +1480,25 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary( const SYMDEF_ID& aSymdef
|
||||||
wxArrayString fpFilters;
|
wxArrayString fpFilters;
|
||||||
fpFilters.Add( fpNameInLibrary );
|
fpFilters.Add( fpNameInLibrary );
|
||||||
|
|
||||||
aPart->SetFPFilters( fpFilters );
|
aSymbol->SetFPFilters( fpFilters );
|
||||||
|
|
||||||
// Assume that the PCB footprint library name will be the same as the schematic filename
|
// Assume that the PCB footprint library name will be the same as the schematic filename
|
||||||
wxFileName schFilename( Filename );
|
wxFileName schFilename( Filename );
|
||||||
wxString libName = schFilename.GetName();
|
wxString libName = schFilename.GetName();
|
||||||
|
|
||||||
aPart->GetFootprintField().SetText( libName + wxT( ":" ) + fpNameInLibrary );
|
aSymbol->GetFootprintField().SetText( libName + wxT( ":" ) + fpNameInLibrary );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aCadstarPart && aCadstarPart->Definition.HidePinNames )
|
if( aCadstarPart && aCadstarPart->Definition.HidePinNames )
|
||||||
{
|
{
|
||||||
aPart->SetShowPinNames( false );
|
aSymbol->SetShowPinNames( false );
|
||||||
aPart->SetShowPinNumbers( false );
|
aSymbol->SetShowPinNumbers( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CADSTAR_SCH_ARCHIVE_LOADER::loadLibrarySymbolShapeVertices(
|
void CADSTAR_SCH_ARCHIVE_LOADER::loadLibrarySymbolShapeVertices(
|
||||||
const std::vector<VERTEX>& aCadstarVertices, wxPoint aSymbolOrigin, LIB_PART* aPart,
|
const std::vector<VERTEX>& aCadstarVertices, wxPoint aSymbolOrigin, LIB_SYMBOL* aSymbol,
|
||||||
int aGateNumber )
|
int aGateNumber )
|
||||||
{
|
{
|
||||||
const VERTEX* prev = &aCadstarVertices.at( 0 );
|
const VERTEX* prev = &aCadstarVertices.at( 0 );
|
||||||
|
@ -1529,7 +1531,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadLibrarySymbolShapeVertices(
|
||||||
switch( cur->Type )
|
switch( cur->Type )
|
||||||
{
|
{
|
||||||
case VERTEX_TYPE::POINT:
|
case VERTEX_TYPE::POINT:
|
||||||
segment = new LIB_POLYLINE( aPart );
|
segment = new LIB_POLYLINE( aSymbol );
|
||||||
( (LIB_POLYLINE*) segment )->AddPoint( startPoint );
|
( (LIB_POLYLINE*) segment )->AddPoint( startPoint );
|
||||||
( (LIB_POLYLINE*) segment )->AddPoint( endPoint );
|
( (LIB_POLYLINE*) segment )->AddPoint( endPoint );
|
||||||
break;
|
break;
|
||||||
|
@ -1541,7 +1543,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadLibrarySymbolShapeVertices(
|
||||||
|
|
||||||
case VERTEX_TYPE::ANTICLOCKWISE_SEMICIRCLE:
|
case VERTEX_TYPE::ANTICLOCKWISE_SEMICIRCLE:
|
||||||
case VERTEX_TYPE::ANTICLOCKWISE_ARC:
|
case VERTEX_TYPE::ANTICLOCKWISE_ARC:
|
||||||
segment = new LIB_ARC( aPart );
|
segment = new LIB_ARC( aSymbol );
|
||||||
|
|
||||||
( (LIB_ARC*) segment )->SetPosition( centerPoint );
|
( (LIB_ARC*) segment )->SetPosition( centerPoint );
|
||||||
|
|
||||||
|
@ -1561,7 +1563,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadLibrarySymbolShapeVertices(
|
||||||
}
|
}
|
||||||
|
|
||||||
segment->SetUnit( aGateNumber );
|
segment->SetUnit( aGateNumber );
|
||||||
aPart->AddDrawItem( segment );
|
aSymbol->AddDrawItem( segment );
|
||||||
|
|
||||||
prev = cur;
|
prev = cur;
|
||||||
}
|
}
|
||||||
|
@ -1583,7 +1585,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::applyToLibraryFieldAttribute(
|
||||||
|
|
||||||
|
|
||||||
SCH_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol( const SYMBOL& aCadstarSymbol,
|
SCH_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol( const SYMBOL& aCadstarSymbol,
|
||||||
const LIB_PART& aKiCadPart,
|
const LIB_SYMBOL& aKiCadPart,
|
||||||
double& aComponentOrientationDeciDeg )
|
double& aComponentOrientationDeciDeg )
|
||||||
{
|
{
|
||||||
LIB_ID libId( m_libraryFileName.GetName(), aKiCadPart.GetName() );
|
LIB_ID libId( m_libraryFileName.GetName(), aKiCadPart.GetName() );
|
||||||
|
@ -1890,10 +1892,10 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadGraphicStaightSegment( const wxPoint& aStar
|
||||||
segment->SetLineStyle( getLineStyle( aCadstarLineCodeID ) );
|
segment->SetLineStyle( getLineStyle( aCadstarLineCodeID ) );
|
||||||
|
|
||||||
//Apply transforms
|
//Apply transforms
|
||||||
wxPoint startPoint = applyTransform( aStartPoint, aMoveVector, aRotationAngleDeciDeg, aScalingFactor,
|
wxPoint startPoint = applyTransform( aStartPoint, aMoveVector, aRotationAngleDeciDeg,
|
||||||
aTransformCentre, aMirrorInvert );
|
aScalingFactor, aTransformCentre, aMirrorInvert );
|
||||||
wxPoint endPoint = applyTransform( aEndPoint, aMoveVector, aRotationAngleDeciDeg, aScalingFactor,
|
wxPoint endPoint = applyTransform( aEndPoint, aMoveVector, aRotationAngleDeciDeg,
|
||||||
aTransformCentre, aMirrorInvert );
|
aScalingFactor, aTransformCentre, aMirrorInvert );
|
||||||
|
|
||||||
segment->SetStartPoint( startPoint );
|
segment->SetStartPoint( startPoint );
|
||||||
segment->SetEndPoint( endPoint );
|
segment->SetEndPoint( endPoint );
|
||||||
|
@ -1998,9 +2000,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadFigure( const FIGURE& aCadstarFigure,
|
||||||
|
|
||||||
|
|
||||||
void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(
|
void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(
|
||||||
LAYER_ID aCadstarSheetID, wxPoint aPosition, wxSize aSheetSize, const SCH_SHEET_PATH& aParentSheet )
|
LAYER_ID aCadstarSheetID, wxPoint aPosition, wxSize aSheetSize,
|
||||||
|
const SCH_SHEET_PATH& aParentSheet )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_sheetMap.find( aCadstarSheetID ) == m_sheetMap.end(), , "Sheet already loaded!" );
|
wxCHECK_MSG( m_sheetMap.find( aCadstarSheetID ) == m_sheetMap.end(), ,
|
||||||
|
"Sheet already loaded!" );
|
||||||
|
|
||||||
SCH_SHEET* sheet = new SCH_SHEET( aParentSheet.Last(), aPosition );
|
SCH_SHEET* sheet = new SCH_SHEET( aParentSheet.Last(), aPosition );
|
||||||
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
|
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
|
||||||
|
@ -2089,7 +2093,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(
|
||||||
block.ID ) );
|
block.ID ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSheetAndChildSheets( block.AssocLayerID, blockExtents.first, blockExtents.second, aSheet );
|
loadSheetAndChildSheets( block.AssocLayerID, blockExtents.first, blockExtents.second,
|
||||||
|
aSheet );
|
||||||
|
|
||||||
if( block.HasBlockLabel )
|
if( block.HasBlockLabel )
|
||||||
{
|
{
|
||||||
|
@ -2626,11 +2631,11 @@ SCH_TEXT* CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText( const TEXT& aCadstarTextE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart( const LIB_PART* aPart,
|
LIB_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart( const LIB_SYMBOL* aSymbol,
|
||||||
long long aScalingFactorNumerator,
|
long long aScalingFactorNumerator,
|
||||||
long long aScalingFactorDenominator )
|
long long aScalingFactorDenominator )
|
||||||
{
|
{
|
||||||
LIB_PART* retval = new LIB_PART( *aPart );
|
LIB_SYMBOL* retval = new LIB_SYMBOL( *aSymbol );
|
||||||
|
|
||||||
if( aScalingFactorNumerator == aScalingFactorDenominator )
|
if( aScalingFactorNumerator == aScalingFactorDenominator )
|
||||||
return retval; // 1:1 scale, nothing to do
|
return retval; // 1:1 scale, nothing to do
|
||||||
|
@ -2708,14 +2713,16 @@ LIB_PART* CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart( const LIB_PART* aPart,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins( LIB_PART* aPartToFix, int aGateNumber )
|
void CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int aGateNumber )
|
||||||
{
|
{
|
||||||
// Store a list of segments that are not connected to other segments and are vertical or horizontal
|
// Store a list of segments that are not connected to other segments and are vertical or
|
||||||
|
// horizontal.
|
||||||
std::map<wxPoint, LIB_POLYLINE*> twoPointUniqueSegments;
|
std::map<wxPoint, LIB_POLYLINE*> twoPointUniqueSegments;
|
||||||
|
|
||||||
LIB_ITEMS_CONTAINER::ITERATOR polylineiter = aPartToFix->GetDrawItems().begin( LIB_POLYLINE_T );
|
LIB_ITEMS_CONTAINER::ITERATOR polylineiter =
|
||||||
|
aSymbolToFix->GetDrawItems().begin( LIB_POLYLINE_T );
|
||||||
|
|
||||||
for( ; polylineiter != aPartToFix->GetDrawItems().end( LIB_POLYLINE_T ); ++polylineiter )
|
for( ; polylineiter != aSymbolToFix->GetDrawItems().end( LIB_POLYLINE_T ); ++polylineiter )
|
||||||
{
|
{
|
||||||
LIB_POLYLINE& polyline = static_cast<LIB_POLYLINE&>( *polylineiter );
|
LIB_POLYLINE& polyline = static_cast<LIB_POLYLINE&>( *polylineiter );
|
||||||
|
|
||||||
|
@ -2757,8 +2764,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins( LIB_PART* aPartToFix, int aGa
|
||||||
}
|
}
|
||||||
|
|
||||||
LIB_PINS pins;
|
LIB_PINS pins;
|
||||||
aPartToFix->GetPins( pins, aGateNumber );
|
aSymbolToFix->GetPins( pins, aGateNumber );
|
||||||
|
|
||||||
|
|
||||||
for( auto& pin : pins )
|
for( auto& pin : pins )
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,7 @@ class BUS_ALIAS;
|
||||||
class EDA_TEXT;
|
class EDA_TEXT;
|
||||||
class LABEL_SPIN_STYLE;
|
class LABEL_SPIN_STYLE;
|
||||||
class LIB_FIELD;
|
class LIB_FIELD;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class SCH_SYMBOL;
|
class SCH_SYMBOL;
|
||||||
class SCH_ITEM;
|
class SCH_ITEM;
|
||||||
class SCH_FIELD;
|
class SCH_FIELD;
|
||||||
|
@ -98,11 +98,11 @@ private:
|
||||||
std::map<LAYER_ID, SCH_SHEET*> m_sheetMap; ///< Map between Cadstar and KiCad Sheets
|
std::map<LAYER_ID, SCH_SHEET*> m_sheetMap; ///< Map between Cadstar and KiCad Sheets
|
||||||
std::map<BLOCK_PIN_ID, SCH_HIERLABEL*>
|
std::map<BLOCK_PIN_ID, SCH_HIERLABEL*>
|
||||||
m_sheetPinMap; ///< Map between Cadstar and KiCad Sheets Pins
|
m_sheetPinMap; ///< Map between Cadstar and KiCad Sheets Pins
|
||||||
std::map<PART_ID, LIB_PART*> m_partMap; ///< Map between Cadstar and KiCad Parts
|
std::map<PART_ID, LIB_SYMBOL*> m_partMap; ///< Map between Cadstar and KiCad Parts
|
||||||
std::map<PART_GATE_ID, SYMDEF_ID> m_partSymbolsMap; ///< Map holding the symbols loaded so far
|
std::map<PART_GATE_ID, SYMDEF_ID> m_partSymbolsMap; ///< Map holding the symbols loaded so far
|
||||||
/// for a particular PART_ID and GATE_ID
|
/// for a particular PART_ID and GATE_ID
|
||||||
std::map<PART_ID, TERMINAL_TO_PINNUM_MAP> m_pinNumsMap; ///< Map of pin numbers in CADSTAR parts
|
std::map<PART_ID, TERMINAL_TO_PINNUM_MAP> m_pinNumsMap; ///< Map of pin numbers in CADSTAR parts
|
||||||
std::map<wxString, LIB_PART*> m_powerSymLibMap; ///< Map of KiCad Power Symbol Library items
|
std::map<wxString, LIB_SYMBOL*> m_powerSymLibMap; ///< Map of KiCad Power Symbol Library items
|
||||||
std::map<SYMBOL_ID, SCH_SYMBOL*>
|
std::map<SYMBOL_ID, SCH_SYMBOL*>
|
||||||
m_powerSymMap; ///< Map between Cadstar and KiCad Power Symbols
|
m_powerSymMap; ///< Map between Cadstar and KiCad Power Symbols
|
||||||
std::map<SYMBOL_ID, SCH_GLOBALLABEL*>
|
std::map<SYMBOL_ID, SCH_GLOBALLABEL*>
|
||||||
|
@ -134,16 +134,16 @@ private:
|
||||||
|
|
||||||
//Helper Functions for loading library items
|
//Helper Functions for loading library items
|
||||||
void loadSymDefIntoLibrary( const SYMDEF_ID& aSymdefID, const PART* aCadstarPart,
|
void loadSymDefIntoLibrary( const SYMDEF_ID& aSymdefID, const PART* aCadstarPart,
|
||||||
const GATE_ID& aGateID, LIB_PART* aPart );
|
const GATE_ID& aGateID, LIB_SYMBOL* aSymbol );
|
||||||
|
|
||||||
void loadLibrarySymbolShapeVertices( const std::vector<VERTEX>& aCadstarVertices,
|
void loadLibrarySymbolShapeVertices( const std::vector<VERTEX>& aCadstarVertices,
|
||||||
wxPoint aSymbolOrigin, LIB_PART* aPart, int aGateNumber );
|
wxPoint aSymbolOrigin, LIB_SYMBOL* aSymbol, int aGateNumber );
|
||||||
|
|
||||||
void applyToLibraryFieldAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
|
void applyToLibraryFieldAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
|
||||||
wxPoint aSymbolOrigin, LIB_FIELD* aKiCadField );
|
wxPoint aSymbolOrigin, LIB_FIELD* aKiCadField );
|
||||||
|
|
||||||
//Helper Functions for loading symbols in schematic
|
//Helper Functions for loading symbols in schematic
|
||||||
SCH_SYMBOL* loadSchematicSymbol( const SYMBOL& aCadstarSymbol, const LIB_PART& aKiCadPart,
|
SCH_SYMBOL* loadSchematicSymbol( const SYMBOL& aCadstarSymbol, const LIB_SYMBOL& aKiCadPart,
|
||||||
double& aComponentOrientationDeciDeg );
|
double& aComponentOrientationDeciDeg );
|
||||||
|
|
||||||
void loadSymbolFieldAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
|
void loadSymbolFieldAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
|
||||||
|
@ -211,10 +211,10 @@ private:
|
||||||
|
|
||||||
//General Graphical manipulation functions
|
//General Graphical manipulation functions
|
||||||
|
|
||||||
LIB_PART* getScaledLibPart( const LIB_PART* aPart, long long aScalingFactorNumerator,
|
LIB_SYMBOL* getScaledLibPart( const LIB_SYMBOL* aSymbol, long long aScalingFactorNumerator,
|
||||||
long long aScalingFactorDenominator );
|
long long aScalingFactorDenominator );
|
||||||
|
|
||||||
void fixUpLibraryPins( LIB_PART* aPartToFix, int aGateNumber );
|
void fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int aGateNumber );
|
||||||
|
|
||||||
std::pair<wxPoint, wxSize> getFigureExtentsKiCad( const FIGURE& aCadstarFigure );
|
std::pair<wxPoint, wxSize> getFigureExtentsKiCad( const FIGURE& aCadstarFigure );
|
||||||
|
|
||||||
|
|
|
@ -65,10 +65,10 @@ public:
|
||||||
//void EnumerateSymbolLib( wxArrayString& aAliasNameList, const wxString& aLibraryPath,
|
//void EnumerateSymbolLib( wxArrayString& aAliasNameList, const wxString& aLibraryPath,
|
||||||
// const PROPERTIES* aProperties = NULL ) override;
|
// const PROPERTIES* aProperties = NULL ) override;
|
||||||
|
|
||||||
//LIB_PART* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
//LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||||
// const PROPERTIES* aProperties = NULL ) override;
|
// const PROPERTIES* aProperties = NULL ) override;
|
||||||
|
|
||||||
//void SaveSymbol( const wxString& aLibraryPath, const LIB_PART* aSymbol,
|
//void SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
||||||
// const PROPERTIES* aProperties = NULL ) override;
|
// const PROPERTIES* aProperties = NULL ) override;
|
||||||
|
|
||||||
//void DeleteAlias( const wxString& aLibraryPath, const wxString& aAliasName,
|
//void DeleteAlias( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||||
|
|
|
@ -1187,7 +1187,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
||||||
if( p != elib->package.end() )
|
if( p != elib->package.end() )
|
||||||
package = p->second;
|
package = p->second;
|
||||||
|
|
||||||
LIB_PART* part =
|
LIB_SYMBOL* part =
|
||||||
m_pi->LoadSymbol( getLibFileName().GetFullPath(), kisymbolname, m_properties.get() );
|
m_pi->LoadSymbol( getLibFileName().GetFullPath(), kisymbolname, m_properties.get() );
|
||||||
|
|
||||||
if( !part )
|
if( !part )
|
||||||
|
@ -1349,11 +1349,11 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
||||||
|
|
||||||
// Save the pin positions
|
// Save the pin positions
|
||||||
SYMBOL_LIB_TABLE& schLibTable = *m_schematic->Prj().SchSymbolLibTable();
|
SYMBOL_LIB_TABLE& schLibTable = *m_schematic->Prj().SchSymbolLibTable();
|
||||||
LIB_PART* libSymbol = schLibTable.LoadSymbol( symbol->GetLibId() );
|
LIB_SYMBOL* libSymbol = schLibTable.LoadSymbol( symbol->GetLibId() );
|
||||||
|
|
||||||
wxCHECK( libSymbol, /*void*/ );
|
wxCHECK( libSymbol, /*void*/ );
|
||||||
|
|
||||||
symbol->SetLibSymbol( new LIB_PART( *libSymbol ) );
|
symbol->SetLibSymbol( new LIB_SYMBOL( *libSymbol ) );
|
||||||
|
|
||||||
std::vector<LIB_PIN*> pins;
|
std::vector<LIB_PIN*> pins;
|
||||||
symbol->GetLibPins( pins );
|
symbol->GetLibPins( pins );
|
||||||
|
@ -1411,7 +1411,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary(
|
||||||
aEagleLibrary->package[symbolName] = edevice.package.Get();
|
aEagleLibrary->package[symbolName] = edevice.package.Get();
|
||||||
|
|
||||||
// Create KiCad symbol.
|
// Create KiCad symbol.
|
||||||
unique_ptr<LIB_PART> kpart( new LIB_PART( symbolName ) );
|
unique_ptr<LIB_SYMBOL> kpart( new LIB_SYMBOL( symbolName ) );
|
||||||
|
|
||||||
// Process each gate in the deviceset for this device.
|
// Process each gate in the deviceset for this device.
|
||||||
wxXmlNode* gateNode = getChildrenNodes( aDeviceSetChildren, "gates" );
|
wxXmlNode* gateNode = getChildrenNodes( aDeviceSetChildren, "gates" );
|
||||||
|
@ -1451,7 +1451,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary(
|
||||||
|
|
||||||
wxString name = fixSymbolName( kpart->GetName() );
|
wxString name = fixSymbolName( kpart->GetName() );
|
||||||
kpart->SetName( name );
|
kpart->SetName( name );
|
||||||
m_pi->SaveSymbol( getLibFileName().GetFullPath(), new LIB_PART( *kpart.get() ),
|
m_pi->SaveSymbol( getLibFileName().GetFullPath(), new LIB_SYMBOL( *kpart.get() ),
|
||||||
m_properties.get() );
|
m_properties.get() );
|
||||||
aEagleLibrary->KiCadSymbols.insert( name, kpart.release() );
|
aEagleLibrary->KiCadSymbols.insert( name, kpart.release() );
|
||||||
|
|
||||||
|
@ -1465,7 +1465,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_PART>& aPart,
|
bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
EDEVICE* aDevice, int aGateNumber, const wxString& aGateName )
|
EDEVICE* aDevice, int aGateNumber, const wxString& aGateName )
|
||||||
{
|
{
|
||||||
wxString symbolName = aSymbolNode->GetAttribute( "name" );
|
wxString symbolName = aSymbolNode->GetAttribute( "name" );
|
||||||
|
@ -1484,12 +1484,12 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
||||||
|
|
||||||
if( nodeName == "circle" )
|
if( nodeName == "circle" )
|
||||||
{
|
{
|
||||||
aPart->AddDrawItem( loadSymbolCircle( aPart, currentNode, aGateNumber ) );
|
aSymbol->AddDrawItem( loadSymbolCircle( aSymbol, currentNode, aGateNumber ) );
|
||||||
}
|
}
|
||||||
else if( nodeName == "pin" )
|
else if( nodeName == "pin" )
|
||||||
{
|
{
|
||||||
EPIN ePin = EPIN( currentNode );
|
EPIN ePin = EPIN( currentNode );
|
||||||
std::unique_ptr<LIB_PIN> pin( loadPin( aPart, currentNode, &ePin, aGateNumber ) );
|
std::unique_ptr<LIB_PIN> pin( loadPin( aSymbol, currentNode, &ePin, aGateNumber ) );
|
||||||
pincount++;
|
pincount++;
|
||||||
|
|
||||||
pin->SetType( ELECTRICAL_PINTYPE::PT_BIDI );
|
pin->SetType( ELECTRICAL_PINTYPE::PT_BIDI );
|
||||||
|
@ -1533,7 +1533,7 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
||||||
|
|
||||||
wxString padname( pads[i] );
|
wxString padname( pads[i] );
|
||||||
apin->SetNumber( padname );
|
apin->SetNumber( padname );
|
||||||
aPart->AddDrawItem( apin );
|
aSymbol->AddDrawItem( apin );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1544,41 +1544,41 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
||||||
{
|
{
|
||||||
pin->SetUnit( aGateNumber );
|
pin->SetUnit( aGateNumber );
|
||||||
pin->SetNumber( wxString::Format( "%i", pincount ) );
|
pin->SetNumber( wxString::Format( "%i", pincount ) );
|
||||||
aPart->AddDrawItem( pin.release() );
|
aSymbol->AddDrawItem( pin.release() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( nodeName == "polygon" )
|
else if( nodeName == "polygon" )
|
||||||
{
|
{
|
||||||
aPart->AddDrawItem( loadSymbolPolyLine( aPart, currentNode, aGateNumber ) );
|
aSymbol->AddDrawItem( loadSymbolPolyLine( aSymbol, currentNode, aGateNumber ) );
|
||||||
}
|
}
|
||||||
else if( nodeName == "rectangle" )
|
else if( nodeName == "rectangle" )
|
||||||
{
|
{
|
||||||
aPart->AddDrawItem( loadSymbolRectangle( aPart, currentNode, aGateNumber ) );
|
aSymbol->AddDrawItem( loadSymbolRectangle( aSymbol, currentNode, aGateNumber ) );
|
||||||
}
|
}
|
||||||
else if( nodeName == "text" )
|
else if( nodeName == "text" )
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_TEXT> libtext( loadSymbolText( aPart, currentNode, aGateNumber ) );
|
std::unique_ptr<LIB_TEXT> libtext( loadSymbolText( aSymbol, currentNode, aGateNumber ) );
|
||||||
|
|
||||||
if( libtext->GetText().Upper() == ">NAME" )
|
if( libtext->GetText().Upper() == ">NAME" )
|
||||||
{
|
{
|
||||||
LIB_FIELD* field = aPart->GetFieldById( REFERENCE_FIELD );
|
LIB_FIELD* field = aSymbol->GetFieldById( REFERENCE_FIELD );
|
||||||
loadFieldAttributes( field, libtext.get() );
|
loadFieldAttributes( field, libtext.get() );
|
||||||
foundName = true;
|
foundName = true;
|
||||||
}
|
}
|
||||||
else if( libtext->GetText().Upper() == ">VALUE" )
|
else if( libtext->GetText().Upper() == ">VALUE" )
|
||||||
{
|
{
|
||||||
LIB_FIELD* field = aPart->GetFieldById( VALUE_FIELD );
|
LIB_FIELD* field = aSymbol->GetFieldById( VALUE_FIELD );
|
||||||
loadFieldAttributes( field, libtext.get() );
|
loadFieldAttributes( field, libtext.get() );
|
||||||
foundValue = true;
|
foundValue = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aPart->AddDrawItem( libtext.release() );
|
aSymbol->AddDrawItem( libtext.release() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( nodeName == "wire" )
|
else if( nodeName == "wire" )
|
||||||
{
|
{
|
||||||
aPart->AddDrawItem( loadSymbolWire( aPart, currentNode, aGateNumber ) );
|
aSymbol->AddDrawItem( loadSymbolWire( aSymbol, currentNode, aGateNumber ) );
|
||||||
}
|
}
|
||||||
else if( nodeName == "frame" )
|
else if( nodeName == "frame" )
|
||||||
{
|
{
|
||||||
|
@ -1588,8 +1588,8 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
||||||
|
|
||||||
for( LIB_ITEM* item : frameItems )
|
for( LIB_ITEM* item : frameItems )
|
||||||
{
|
{
|
||||||
item->SetParent( aPart.get() );
|
item->SetParent( aSymbol.get() );
|
||||||
aPart->AddDrawItem( item );
|
aSymbol->AddDrawItem( item );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1606,22 +1606,22 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
|
||||||
}
|
}
|
||||||
|
|
||||||
if( foundName == false )
|
if( foundName == false )
|
||||||
aPart->GetFieldById( REFERENCE_FIELD )->SetVisible( false );
|
aSymbol->GetFieldById( REFERENCE_FIELD )->SetVisible( false );
|
||||||
|
|
||||||
if( foundValue == false )
|
if( foundValue == false )
|
||||||
aPart->GetFieldById( VALUE_FIELD )->SetVisible( false );
|
aSymbol->GetFieldById( VALUE_FIELD )->SetVisible( false );
|
||||||
|
|
||||||
return pincount == 1 ? ispower : false;
|
return pincount == 1 ? ispower : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_CIRCLE* SCH_EAGLE_PLUGIN::loadSymbolCircle(
|
LIB_CIRCLE* SCH_EAGLE_PLUGIN::loadSymbolCircle(
|
||||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aCircleNode, int aGateNumber )
|
std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode* aCircleNode, int aGateNumber )
|
||||||
{
|
{
|
||||||
// Parse the circle properties
|
// Parse the circle properties
|
||||||
ECIRCLE c( aCircleNode );
|
ECIRCLE c( aCircleNode );
|
||||||
|
|
||||||
unique_ptr<LIB_CIRCLE> circle( new LIB_CIRCLE( aPart.get() ) );
|
unique_ptr<LIB_CIRCLE> circle( new LIB_CIRCLE( aSymbol.get() ) );
|
||||||
|
|
||||||
circle->SetPosition( wxPoint( c.x.ToSchUnits(), c.y.ToSchUnits() ) );
|
circle->SetPosition( wxPoint( c.x.ToSchUnits(), c.y.ToSchUnits() ) );
|
||||||
circle->SetRadius( c.radius.ToSchUnits() );
|
circle->SetRadius( c.radius.ToSchUnits() );
|
||||||
|
@ -1633,11 +1633,11 @@ LIB_CIRCLE* SCH_EAGLE_PLUGIN::loadSymbolCircle(
|
||||||
|
|
||||||
|
|
||||||
LIB_RECTANGLE* SCH_EAGLE_PLUGIN::loadSymbolRectangle(
|
LIB_RECTANGLE* SCH_EAGLE_PLUGIN::loadSymbolRectangle(
|
||||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aRectNode, int aGateNumber )
|
std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode* aRectNode, int aGateNumber )
|
||||||
{
|
{
|
||||||
ERECT rect( aRectNode );
|
ERECT rect( aRectNode );
|
||||||
|
|
||||||
unique_ptr<LIB_RECTANGLE> rectangle( new LIB_RECTANGLE( aPart.get() ) );
|
unique_ptr<LIB_RECTANGLE> rectangle( new LIB_RECTANGLE( aSymbol.get() ) );
|
||||||
|
|
||||||
rectangle->SetPosition( wxPoint( rect.x1.ToSchUnits(), rect.y1.ToSchUnits() ) );
|
rectangle->SetPosition( wxPoint( rect.x1.ToSchUnits(), rect.y1.ToSchUnits() ) );
|
||||||
rectangle->SetEnd( wxPoint( rect.x2.ToSchUnits(), rect.y2.ToSchUnits() ) );
|
rectangle->SetEnd( wxPoint( rect.x2.ToSchUnits(), rect.y2.ToSchUnits() ) );
|
||||||
|
@ -1652,7 +1652,7 @@ LIB_RECTANGLE* SCH_EAGLE_PLUGIN::loadSymbolRectangle(
|
||||||
|
|
||||||
|
|
||||||
LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire(
|
LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire(
|
||||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aWireNode, int aGateNumber )
|
std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode* aWireNode, int aGateNumber )
|
||||||
{
|
{
|
||||||
auto ewire = EWIRE( aWireNode );
|
auto ewire = EWIRE( aWireNode );
|
||||||
|
|
||||||
|
@ -1669,7 +1669,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire(
|
||||||
// if the wire is an arc
|
// if the wire is an arc
|
||||||
if( ewire.curve )
|
if( ewire.curve )
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_ARC> arc = std::make_unique<LIB_ARC>( aPart.get() );
|
std::unique_ptr<LIB_ARC> arc = std::make_unique<LIB_ARC>( aSymbol.get() );
|
||||||
wxPoint center = ConvertArcCenter( begin, end, *ewire.curve * -1 );
|
wxPoint center = ConvertArcCenter( begin, end, *ewire.curve * -1 );
|
||||||
|
|
||||||
double radius = sqrt( abs( ( ( center.x - begin.x ) * ( center.x - begin.x ) )
|
double radius = sqrt( abs( ( ( center.x - begin.x ) * ( center.x - begin.x ) )
|
||||||
|
@ -1724,7 +1724,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_POLYLINE> polyLine = std::make_unique<LIB_POLYLINE>( aPart.get() );
|
std::unique_ptr<LIB_POLYLINE> polyLine = std::make_unique<LIB_POLYLINE>( aSymbol.get() );
|
||||||
|
|
||||||
polyLine->AddPoint( begin );
|
polyLine->AddPoint( begin );
|
||||||
polyLine->AddPoint( end );
|
polyLine->AddPoint( end );
|
||||||
|
@ -1737,9 +1737,9 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire(
|
||||||
|
|
||||||
|
|
||||||
LIB_POLYLINE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine(
|
LIB_POLYLINE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine(
|
||||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aPolygonNode, int aGateNumber )
|
std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode* aPolygonNode, int aGateNumber )
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_POLYLINE> polyLine = std::make_unique<LIB_POLYLINE>( aPart.get() );
|
std::unique_ptr<LIB_POLYLINE> polyLine = std::make_unique<LIB_POLYLINE>( aSymbol.get() );
|
||||||
|
|
||||||
EPOLYGON epoly( aPolygonNode );
|
EPOLYGON epoly( aPolygonNode );
|
||||||
wxXmlNode* vertex = aPolygonNode->GetChildren();
|
wxXmlNode* vertex = aPolygonNode->GetChildren();
|
||||||
|
@ -1765,9 +1765,9 @@ LIB_POLYLINE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine(
|
||||||
|
|
||||||
|
|
||||||
LIB_PIN* SCH_EAGLE_PLUGIN::loadPin(
|
LIB_PIN* SCH_EAGLE_PLUGIN::loadPin(
|
||||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aPin, EPIN* aEPin, int aGateNumber )
|
std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode* aPin, EPIN* aEPin, int aGateNumber )
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( aPart.get() );
|
std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( aSymbol.get() );
|
||||||
pin->SetPosition( wxPoint( aEPin->x.ToSchUnits(), aEPin->y.ToSchUnits() ) );
|
pin->SetPosition( wxPoint( aEPin->x.ToSchUnits(), aEPin->y.ToSchUnits() ) );
|
||||||
pin->SetName( aEPin->name );
|
pin->SetName( aEPin->name );
|
||||||
pin->SetUnit( aGateNumber );
|
pin->SetUnit( aGateNumber );
|
||||||
|
@ -1862,9 +1862,9 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin(
|
||||||
|
|
||||||
|
|
||||||
LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymbolText(
|
LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymbolText(
|
||||||
std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aLibText, int aGateNumber )
|
std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode* aLibText, int aGateNumber )
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_TEXT> libtext = std::make_unique<LIB_TEXT>( aPart.get() );
|
std::unique_ptr<LIB_TEXT> libtext = std::make_unique<LIB_TEXT>( aSymbol.get() );
|
||||||
ETEXT etext( aLibText );
|
ETEXT etext( aLibText );
|
||||||
|
|
||||||
libtext->SetUnit( aGateNumber );
|
libtext->SetUnit( aGateNumber );
|
||||||
|
|
|
@ -49,7 +49,7 @@ class SCH_SYMBOL;
|
||||||
class SCH_FIELD;
|
class SCH_FIELD;
|
||||||
class PROPERTIES;
|
class PROPERTIES;
|
||||||
class SCH_EAGLE_PLUGIN_CACHE;
|
class SCH_EAGLE_PLUGIN_CACHE;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class PART_LIB;
|
class PART_LIB;
|
||||||
class LIB_CIRCLE;
|
class LIB_CIRCLE;
|
||||||
class LIB_FIELD;
|
class LIB_FIELD;
|
||||||
|
@ -63,7 +63,7 @@ class wxXmlNode;
|
||||||
typedef struct EAGLE_LIBRARY
|
typedef struct EAGLE_LIBRARY
|
||||||
{
|
{
|
||||||
wxString name;
|
wxString name;
|
||||||
boost::ptr_map<wxString, LIB_PART> KiCadSymbols;
|
boost::ptr_map<wxString, LIB_SYMBOL> KiCadSymbols;
|
||||||
std::unordered_map<wxString, wxXmlNode*> SymbolNodes;
|
std::unordered_map<wxString, wxXmlNode*> SymbolNodes;
|
||||||
std::unordered_map<wxString, int> GateUnit;
|
std::unordered_map<wxString, int> GateUnit;
|
||||||
std::unordered_map<wxString, wxString> package;
|
std::unordered_map<wxString, wxString> package;
|
||||||
|
@ -130,19 +130,19 @@ private:
|
||||||
SCH_TEXT* loadPlainText( wxXmlNode* aSchText );
|
SCH_TEXT* loadPlainText( wxXmlNode* aSchText );
|
||||||
void loadFrame( wxXmlNode* aFrameNode, std::vector<SCH_LINE*>& aLines );
|
void loadFrame( wxXmlNode* aFrameNode, std::vector<SCH_LINE*>& aLines );
|
||||||
|
|
||||||
bool loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_PART>& aPart,
|
bool loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
EDEVICE* aDevice, int aGateNumber, const wxString& aGateName );
|
EDEVICE* aDevice, int aGateNumber, const wxString& aGateName );
|
||||||
LIB_CIRCLE* loadSymbolCircle( std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aCircleNode,
|
LIB_CIRCLE* loadSymbolCircle( std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode* aCircleNode,
|
||||||
int aGateNumber );
|
int aGateNumber );
|
||||||
LIB_RECTANGLE* loadSymbolRectangle( std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aRectNode,
|
LIB_RECTANGLE* loadSymbolRectangle( std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode* aRectNode,
|
||||||
int aGateNumber );
|
int aGateNumber );
|
||||||
LIB_POLYLINE* loadSymbolPolyLine( std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aPolygonNode,
|
LIB_POLYLINE* loadSymbolPolyLine( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
int aGateNumber );
|
wxXmlNode* aPolygonNode, int aGateNumber );
|
||||||
LIB_ITEM* loadSymbolWire( std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aWireNode,
|
LIB_ITEM* loadSymbolWire( std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode* aWireNode,
|
||||||
int aGateNumber );
|
int aGateNumber );
|
||||||
LIB_PIN* loadPin( std::unique_ptr<LIB_PART>& aPart, wxXmlNode*, EPIN* epin,
|
LIB_PIN* loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode*, EPIN* epin,
|
||||||
int aGateNumber );
|
int aGateNumber );
|
||||||
LIB_TEXT* loadSymbolText( std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aLibText,
|
LIB_TEXT* loadSymbolText( std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode* aLibText,
|
||||||
int aGateNumber );
|
int aGateNumber );
|
||||||
void loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>& aLines );
|
void loadFrame( wxXmlNode* aFrameNode, std::vector<LIB_ITEM*>& aLines );
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ bool SCH_SEXPR_PARSER::IsTooRecent() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SEXPR_PARSER::ParseLib( LIB_PART_MAP& aSymbolLibMap )
|
void SCH_SEXPR_PARSER::ParseLib( LIB_SYMBOL_MAP& aSymbolLibMap )
|
||||||
{
|
{
|
||||||
T token;
|
T token;
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ void SCH_SEXPR_PARSER::ParseLib( LIB_PART_MAP& aSymbolLibMap )
|
||||||
{
|
{
|
||||||
m_unit = 1;
|
m_unit = 1;
|
||||||
m_convert = 1;
|
m_convert = 1;
|
||||||
LIB_PART* symbol = ParseSymbol( aSymbolLibMap, m_requiredVersion );
|
LIB_SYMBOL* symbol = ParseSymbol( aSymbolLibMap, m_requiredVersion );
|
||||||
aSymbolLibMap[symbol->GetName()] = symbol;
|
aSymbolLibMap[symbol->GetName()] = symbol;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -121,7 +121,7 @@ void SCH_SEXPR_PARSER::ParseLib( LIB_PART_MAP& aSymbolLibMap )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SCH_SEXPR_PARSER::ParseSymbol( LIB_PART_MAP& aSymbolLibMap, int aFileVersion )
|
LIB_SYMBOL* SCH_SEXPR_PARSER::ParseSymbol( LIB_SYMBOL_MAP& aSymbolLibMap, int aFileVersion )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( CurTok() == T_symbol, nullptr,
|
wxCHECK_MSG( CurTok() == T_symbol, nullptr,
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a symbol." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a symbol." ) );
|
||||||
|
@ -132,7 +132,7 @@ LIB_PART* SCH_SEXPR_PARSER::ParseSymbol( LIB_PART_MAP& aSymbolLibMap, int aFileV
|
||||||
wxString error;
|
wxString error;
|
||||||
LIB_ITEM* item;
|
LIB_ITEM* item;
|
||||||
LIB_FIELD* field;
|
LIB_FIELD* field;
|
||||||
std::unique_ptr<LIB_PART> symbol = std::make_unique<LIB_PART>( wxEmptyString );
|
std::unique_ptr<LIB_SYMBOL> symbol = std::make_unique<LIB_SYMBOL>( wxEmptyString );
|
||||||
std::set<int> fieldIDsRead;
|
std::set<int> fieldIDsRead;
|
||||||
|
|
||||||
m_requiredVersion = aFileVersion;
|
m_requiredVersion = aFileVersion;
|
||||||
|
@ -717,7 +717,7 @@ void SCH_SEXPR_PARSER::parseHeader( TSCHEMATIC_T::T aHeaderType, int aFileVersio
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SEXPR_PARSER::parsePinNames( std::unique_ptr<LIB_PART>& aSymbol )
|
void SCH_SEXPR_PARSER::parsePinNames( std::unique_ptr<LIB_SYMBOL>& aSymbol )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( CurTok() == T_pin_names,
|
wxCHECK_RET( CurTok() == T_pin_names,
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) +
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) +
|
||||||
|
@ -755,7 +755,7 @@ void SCH_SEXPR_PARSER::parsePinNames( std::unique_ptr<LIB_PART>& aSymbol )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_FIELD* SCH_SEXPR_PARSER::parseProperty( std::unique_ptr<LIB_PART>& aSymbol )
|
LIB_FIELD* SCH_SEXPR_PARSER::parseProperty( std::unique_ptr<LIB_SYMBOL>& aSymbol )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( CurTok() == T_property, nullptr,
|
wxCHECK_MSG( CurTok() == T_property, nullptr,
|
||||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a property." ) );
|
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a property." ) );
|
||||||
|
@ -764,7 +764,8 @@ LIB_FIELD* SCH_SEXPR_PARSER::parseProperty( std::unique_ptr<LIB_PART>& aSymbol )
|
||||||
wxString error;
|
wxString error;
|
||||||
wxString name;
|
wxString name;
|
||||||
wxString value;
|
wxString value;
|
||||||
std::unique_ptr<LIB_FIELD> field = std::make_unique<LIB_FIELD>( aSymbol.get(), MANDATORY_FIELDS );
|
std::unique_ptr<LIB_FIELD> field = std::make_unique<LIB_FIELD>( aSymbol.get(),
|
||||||
|
MANDATORY_FIELDS );
|
||||||
|
|
||||||
T token = NextTok();
|
T token = NextTok();
|
||||||
|
|
||||||
|
@ -2134,7 +2135,7 @@ void SCH_SEXPR_PARSER::ParseSchematic( SCH_SHEET* aSheet, bool aIsCopyableOnly,
|
||||||
case T_lib_symbols:
|
case T_lib_symbols:
|
||||||
{
|
{
|
||||||
// Dummy map. No derived symbols are allowed in the library cache.
|
// Dummy map. No derived symbols are allowed in the library cache.
|
||||||
LIB_PART_MAP symbolLibMap;
|
LIB_SYMBOL_MAP symbolLibMap;
|
||||||
|
|
||||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -154,9 +154,9 @@ class SCH_SEXPR_PARSER : public SCHEMATIC_LEXER
|
||||||
void parseFill( FILL_PARAMS& aFill );
|
void parseFill( FILL_PARAMS& aFill );
|
||||||
|
|
||||||
void parseEDA_TEXT( EDA_TEXT* aText );
|
void parseEDA_TEXT( EDA_TEXT* aText );
|
||||||
void parsePinNames( std::unique_ptr<LIB_PART>& aSymbol );
|
void parsePinNames( std::unique_ptr<LIB_SYMBOL>& aSymbol );
|
||||||
|
|
||||||
LIB_FIELD* parseProperty( std::unique_ptr<LIB_PART>& aSymbol );
|
LIB_FIELD* parseProperty( std::unique_ptr<LIB_SYMBOL>& aSymbol );
|
||||||
|
|
||||||
LIB_ARC* parseArc();
|
LIB_ARC* parseArc();
|
||||||
LIB_BEZIER* parseBezier();
|
LIB_BEZIER* parseBezier();
|
||||||
|
@ -186,10 +186,10 @@ class SCH_SEXPR_PARSER : public SCHEMATIC_LEXER
|
||||||
public:
|
public:
|
||||||
SCH_SEXPR_PARSER( LINE_READER* aLineReader = nullptr );
|
SCH_SEXPR_PARSER( LINE_READER* aLineReader = nullptr );
|
||||||
|
|
||||||
void ParseLib( LIB_PART_MAP& aSymbolLibMap );
|
void ParseLib( LIB_SYMBOL_MAP& aSymbolLibMap );
|
||||||
|
|
||||||
LIB_PART* ParseSymbol( LIB_PART_MAP& aSymbolLibMap,
|
LIB_SYMBOL* ParseSymbol( LIB_SYMBOL_MAP& aSymbolLibMap,
|
||||||
int aFileVersion = SEXPR_SYMBOL_LIB_FILE_VERSION );
|
int aFileVersion = SEXPR_SYMBOL_LIB_FILE_VERSION );
|
||||||
|
|
||||||
LIB_ITEM* ParseDrawItem();
|
LIB_ITEM* ParseDrawItem();
|
||||||
|
|
||||||
|
|
|
@ -284,7 +284,7 @@ static void formatStroke( OUTPUTFORMATTER* aFormatter, int aNestLevel,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A cache assistant for the part library portion of the #SCH_PLUGIN API, and only for the
|
* A cache assistant for the symbol library portion of the #SCH_PLUGIN API, and only for the
|
||||||
* #SCH_SEXPR_PLUGIN, so therefore is private to this implementation file, i.e. not placed
|
* #SCH_SEXPR_PLUGIN, so therefore is private to this implementation file, i.e. not placed
|
||||||
* into a header.
|
* into a header.
|
||||||
*/
|
*/
|
||||||
|
@ -295,13 +295,13 @@ class SCH_SEXPR_PLUGIN_CACHE
|
||||||
wxString m_fileName; // Absolute path and file name.
|
wxString m_fileName; // Absolute path and file name.
|
||||||
wxFileName m_libFileName; // Absolute path and file name is required here.
|
wxFileName m_libFileName; // Absolute path and file name is required here.
|
||||||
wxDateTime m_fileModTime;
|
wxDateTime m_fileModTime;
|
||||||
LIB_PART_MAP m_symbols; // Map of names of #LIB_PART pointers.
|
LIB_SYMBOL_MAP m_symbols; // Map of names of #LIB_SYMBOL pointers.
|
||||||
bool m_isWritable;
|
bool m_isWritable;
|
||||||
bool m_isModified;
|
bool m_isModified;
|
||||||
int m_versionMajor;
|
int m_versionMajor;
|
||||||
SCH_LIB_TYPE m_libType; // Is this cache a symbol or symbol library.
|
SCH_LIB_TYPE m_libType; // Is this cache a symbol or symbol library.
|
||||||
|
|
||||||
LIB_PART* removeSymbol( LIB_PART* aAlias );
|
LIB_SYMBOL* removeSymbol( LIB_SYMBOL* aAlias );
|
||||||
|
|
||||||
static void saveSymbolDrawItem( LIB_ITEM* aItem, OUTPUTFORMATTER& aFormatter,
|
static void saveSymbolDrawItem( LIB_ITEM* aItem, OUTPUTFORMATTER& aFormatter,
|
||||||
int aNestLevel );
|
int aNestLevel );
|
||||||
|
@ -319,7 +319,7 @@ class SCH_SEXPR_PLUGIN_CACHE
|
||||||
int aNestLevel = 0 );
|
int aNestLevel = 0 );
|
||||||
static void saveText( LIB_TEXT* aText, OUTPUTFORMATTER& aFormatter, int aNestLevel = 0 );
|
static void saveText( LIB_TEXT* aText, OUTPUTFORMATTER& aFormatter, int aNestLevel = 0 );
|
||||||
|
|
||||||
static void saveDcmInfoAsFields( LIB_PART* aSymbol, OUTPUTFORMATTER& aFormatter,
|
static void saveDcmInfoAsFields( LIB_SYMBOL* aSymbol, OUTPUTFORMATTER& aFormatter,
|
||||||
int& aNextFreeFieldId, int aNestLevel );
|
int& aNextFreeFieldId, int aNestLevel );
|
||||||
|
|
||||||
friend SCH_SEXPR_PLUGIN;
|
friend SCH_SEXPR_PLUGIN;
|
||||||
|
@ -339,7 +339,7 @@ public:
|
||||||
|
|
||||||
void Load();
|
void Load();
|
||||||
|
|
||||||
void AddSymbol( const LIB_PART* aPart );
|
void AddSymbol( const LIB_SYMBOL* aSymbol );
|
||||||
|
|
||||||
void DeleteSymbol( const wxString& aName );
|
void DeleteSymbol( const wxString& aName );
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ public:
|
||||||
|
|
||||||
wxString GetFileName() const { return m_libFileName.GetFullPath(); }
|
wxString GetFileName() const { return m_libFileName.GetFullPath(); }
|
||||||
|
|
||||||
static void SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aFormatter,
|
static void SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMATTER& aFormatter,
|
||||||
int aNestLevel = 0, const wxString& aLibName = wxEmptyString );
|
int aNestLevel = 0, const wxString& aLibName = wxEmptyString );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ void SCH_SEXPR_PLUGIN::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSelect
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
SCH_ITEM* item;
|
SCH_ITEM* item;
|
||||||
std::map<wxString, LIB_PART*> libSymbols;
|
std::map<wxString, LIB_SYMBOL*> libSymbols;
|
||||||
SCH_SCREEN* screen = aSelection->GetScreen();
|
SCH_SCREEN* screen = aSelection->GetScreen();
|
||||||
|
|
||||||
for( i = 0; i < aSelection->GetSize(); ++i )
|
for( i = 0; i < aSelection->GetSize(); ++i )
|
||||||
|
@ -871,11 +871,11 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPa
|
||||||
|
|
||||||
static wxString delimiters( wxT( " " ) );
|
static wxString delimiters( wxT( " " ) );
|
||||||
|
|
||||||
wxString part_name = aSymbol->GetLibId().Format();
|
wxString symbol_name = aSymbol->GetLibId().Format();
|
||||||
|
|
||||||
if( part_name.size() )
|
if( symbol_name.size() )
|
||||||
{
|
{
|
||||||
libName = toUTFTildaText( part_name );
|
libName = toUTFTildaText( symbol_name );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1369,7 +1369,7 @@ SCH_SEXPR_PLUGIN_CACHE::SCH_SEXPR_PLUGIN_CACHE( const wxString& aFullPathAndFile
|
||||||
SCH_SEXPR_PLUGIN_CACHE::~SCH_SEXPR_PLUGIN_CACHE()
|
SCH_SEXPR_PLUGIN_CACHE::~SCH_SEXPR_PLUGIN_CACHE()
|
||||||
{
|
{
|
||||||
// When the cache is destroyed, all of the alias objects on the heap should be deleted.
|
// When the cache is destroyed, all of the alias objects on the heap should be deleted.
|
||||||
for( LIB_PART_MAP::iterator it = m_symbols.begin(); it != m_symbols.end(); ++it )
|
for( LIB_SYMBOL_MAP::iterator it = m_symbols.begin(); it != m_symbols.end(); ++it )
|
||||||
delete it->second;
|
delete it->second;
|
||||||
|
|
||||||
m_symbols.clear();
|
m_symbols.clear();
|
||||||
|
@ -1414,30 +1414,30 @@ bool SCH_SEXPR_PLUGIN_CACHE::IsFileChanged() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SCH_SEXPR_PLUGIN_CACHE::removeSymbol( LIB_PART* aPart )
|
LIB_SYMBOL* SCH_SEXPR_PLUGIN_CACHE::removeSymbol( LIB_SYMBOL* aSymbol )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( aPart != NULL, NULL, "NULL pointer cannot be removed from library." );
|
wxCHECK_MSG( aSymbol != NULL, NULL, "NULL pointer cannot be removed from library." );
|
||||||
|
|
||||||
LIB_PART* firstChild = NULL;
|
LIB_SYMBOL* firstChild = NULL;
|
||||||
LIB_PART_MAP::iterator it = m_symbols.find( aPart->GetName() );
|
LIB_SYMBOL_MAP::iterator it = m_symbols.find( aSymbol->GetName() );
|
||||||
|
|
||||||
if( it == m_symbols.end() )
|
if( it == m_symbols.end() )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// If the entry pointer doesn't match the name it is mapped to in the library, we
|
// If the entry pointer doesn't match the name it is mapped to in the library, we
|
||||||
// have done something terribly wrong.
|
// have done something terribly wrong.
|
||||||
wxCHECK_MSG( *it->second == aPart, NULL,
|
wxCHECK_MSG( *it->second == aSymbol, NULL,
|
||||||
"Pointer mismatch while attempting to remove alias entry <" + aPart->GetName() +
|
"Pointer mismatch while attempting to remove alias entry <" + aSymbol->GetName() +
|
||||||
"> from library cache <" + m_libFileName.GetName() + ">." );
|
"> from library cache <" + m_libFileName.GetName() + ">." );
|
||||||
|
|
||||||
// If the symbol is a root symbol used by other symbols find the first alias that uses
|
// If the symbol is a root symbol used by other symbols find the first alias that uses
|
||||||
// the root part and make it the new root.
|
// the root symbol and make it the new root.
|
||||||
if( aPart->IsRoot() )
|
if( aSymbol->IsRoot() )
|
||||||
{
|
{
|
||||||
for( auto entry : m_symbols )
|
for( auto entry : m_symbols )
|
||||||
{
|
{
|
||||||
if( entry.second->IsAlias()
|
if( entry.second->IsAlias()
|
||||||
&& entry.second->GetParent().lock() == aPart->SharedPtr() )
|
&& entry.second->GetParent().lock() == aSymbol->SharedPtr() )
|
||||||
{
|
{
|
||||||
firstChild = entry.second;
|
firstChild = entry.second;
|
||||||
break;
|
break;
|
||||||
|
@ -1446,7 +1446,7 @@ LIB_PART* SCH_SEXPR_PLUGIN_CACHE::removeSymbol( LIB_PART* aPart )
|
||||||
|
|
||||||
if( firstChild )
|
if( firstChild )
|
||||||
{
|
{
|
||||||
for( LIB_ITEM& drawItem : aPart->GetDrawItems() )
|
for( LIB_ITEM& drawItem : aSymbol->GetDrawItems() )
|
||||||
{
|
{
|
||||||
if( drawItem.Type() == LIB_FIELD_T )
|
if( drawItem.Type() == LIB_FIELD_T )
|
||||||
{
|
{
|
||||||
|
@ -1465,32 +1465,32 @@ LIB_PART* SCH_SEXPR_PLUGIN_CACHE::removeSymbol( LIB_PART* aPart )
|
||||||
for( auto entry : m_symbols )
|
for( auto entry : m_symbols )
|
||||||
{
|
{
|
||||||
if( entry.second->IsAlias()
|
if( entry.second->IsAlias()
|
||||||
&& entry.second->GetParent().lock() == aPart->SharedPtr() )
|
&& entry.second->GetParent().lock() == aSymbol->SharedPtr() )
|
||||||
entry.second->SetParent( firstChild );
|
entry.second->SetParent( firstChild );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_symbols.erase( it );
|
m_symbols.erase( it );
|
||||||
delete aPart;
|
delete aSymbol;
|
||||||
m_isModified = true;
|
m_isModified = true;
|
||||||
++m_modHash;
|
++m_modHash;
|
||||||
return firstChild;
|
return firstChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SEXPR_PLUGIN_CACHE::AddSymbol( const LIB_PART* aPart )
|
void SCH_SEXPR_PLUGIN_CACHE::AddSymbol( const LIB_SYMBOL* aSymbol )
|
||||||
{
|
{
|
||||||
// aPart is cloned in PART_LIB::AddPart(). The cache takes ownership of aPart.
|
// aSymbol is cloned in PART_LIB::AddPart(). The cache takes ownership of aSymbol.
|
||||||
wxString name = aPart->GetName();
|
wxString name = aSymbol->GetName();
|
||||||
LIB_PART_MAP::iterator it = m_symbols.find( name );
|
LIB_SYMBOL_MAP::iterator it = m_symbols.find( name );
|
||||||
|
|
||||||
if( it != m_symbols.end() )
|
if( it != m_symbols.end() )
|
||||||
{
|
{
|
||||||
removeSymbol( it->second );
|
removeSymbol( it->second );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_symbols[ name ] = const_cast< LIB_PART* >( aPart );
|
m_symbols[ name ] = const_cast< LIB_SYMBOL* >( aSymbol );
|
||||||
m_isModified = true;
|
m_isModified = true;
|
||||||
++m_modHash;
|
++m_modHash;
|
||||||
}
|
}
|
||||||
|
@ -1557,7 +1557,7 @@ void SCH_SEXPR_PLUGIN_CACHE::Save()
|
||||||
if( !alias.second->IsAlias() )
|
if( !alias.second->IsAlias() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::shared_ptr<LIB_PART> aliasParent = alias.second->GetParent().lock();
|
std::shared_ptr<LIB_SYMBOL> aliasParent = alias.second->GetParent().lock();
|
||||||
|
|
||||||
if( aliasParent.get() != parent.second )
|
if( aliasParent.get() != parent.second )
|
||||||
continue;
|
continue;
|
||||||
|
@ -1576,10 +1576,10 @@ void SCH_SEXPR_PLUGIN_CACHE::Save()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aFormatter,
|
void SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMATTER& aFormatter,
|
||||||
int aNestLevel, const wxString& aLibName )
|
int aNestLevel, const wxString& aLibName )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aSymbol, "Invalid LIB_PART pointer." );
|
wxCHECK_RET( aSymbol, "Invalid LIB_SYMBOL pointer." );
|
||||||
|
|
||||||
// The current locale must use period as the decimal point.
|
// The current locale must use period as the decimal point.
|
||||||
wxCHECK2( wxLocale::GetInfo( wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER ) == ".",
|
wxCHECK2( wxLocale::GetInfo( wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER ) == ".",
|
||||||
|
@ -1683,7 +1683,7 @@ void SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aFo
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::shared_ptr<LIB_PART> parent = aSymbol->GetParent().lock();
|
std::shared_ptr<LIB_SYMBOL> parent = aSymbol->GetParent().lock();
|
||||||
|
|
||||||
wxASSERT( parent );
|
wxASSERT( parent );
|
||||||
|
|
||||||
|
@ -1703,10 +1703,10 @@ void SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aFo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields( LIB_PART* aSymbol, OUTPUTFORMATTER& aFormatter,
|
void SCH_SEXPR_PLUGIN_CACHE::saveDcmInfoAsFields( LIB_SYMBOL* aSymbol, OUTPUTFORMATTER& aFormatter,
|
||||||
int& aNextFreeFieldId, int aNestLevel )
|
int& aNextFreeFieldId, int aNestLevel )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aSymbol, "Invalid LIB_PART pointer." );
|
wxCHECK_RET( aSymbol, "Invalid LIB_SYMBOL pointer." );
|
||||||
|
|
||||||
if( !aSymbol->GetKeyWords().IsEmpty() )
|
if( !aSymbol->GetKeyWords().IsEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -2057,26 +2057,27 @@ void SCH_SEXPR_PLUGIN_CACHE::saveText( LIB_TEXT* aText, OUTPUTFORMATTER& aFormat
|
||||||
|
|
||||||
void SCH_SEXPR_PLUGIN_CACHE::DeleteSymbol( const wxString& aSymbolName )
|
void SCH_SEXPR_PLUGIN_CACHE::DeleteSymbol( const wxString& aSymbolName )
|
||||||
{
|
{
|
||||||
LIB_PART_MAP::iterator it = m_symbols.find( aSymbolName );
|
LIB_SYMBOL_MAP::iterator it = m_symbols.find( aSymbolName );
|
||||||
|
|
||||||
if( it == m_symbols.end() )
|
if( it == m_symbols.end() )
|
||||||
THROW_IO_ERROR( wxString::Format( _( "library %s does not contain a symbol named %s" ),
|
THROW_IO_ERROR( wxString::Format( _( "library %s does not contain a symbol named %s" ),
|
||||||
m_libFileName.GetFullName(), aSymbolName ) );
|
m_libFileName.GetFullName(), aSymbolName ) );
|
||||||
|
|
||||||
LIB_PART* part = it->second;
|
LIB_SYMBOL* symbol = it->second;
|
||||||
|
|
||||||
if( part->IsRoot() )
|
if( symbol->IsRoot() )
|
||||||
{
|
{
|
||||||
LIB_PART* rootPart = part;
|
LIB_SYMBOL* rootSymbol = symbol;
|
||||||
|
|
||||||
// Remove the root symbol and all it's children.
|
// Remove the root symbol and all it's children.
|
||||||
m_symbols.erase( it );
|
m_symbols.erase( it );
|
||||||
|
|
||||||
LIB_PART_MAP::iterator it1 = m_symbols.begin();
|
LIB_SYMBOL_MAP::iterator it1 = m_symbols.begin();
|
||||||
|
|
||||||
while( it1 != m_symbols.end() )
|
while( it1 != m_symbols.end() )
|
||||||
{
|
{
|
||||||
if( it1->second->IsAlias() && it1->second->GetParent().lock() == rootPart->SharedPtr() )
|
if( it1->second->IsAlias()
|
||||||
|
&& it1->second->GetParent().lock() == rootSymbol->SharedPtr() )
|
||||||
{
|
{
|
||||||
delete it1->second;
|
delete it1->second;
|
||||||
it1 = m_symbols.erase( it1 );
|
it1 = m_symbols.erase( it1 );
|
||||||
|
@ -2087,13 +2088,13 @@ void SCH_SEXPR_PLUGIN_CACHE::DeleteSymbol( const wxString& aSymbolName )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete rootPart;
|
delete rootSymbol;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Just remove the alias.
|
// Just remove the alias.
|
||||||
m_symbols.erase( it );
|
m_symbols.erase( it );
|
||||||
delete part;
|
delete symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
++m_modHash;
|
++m_modHash;
|
||||||
|
@ -2147,9 +2148,9 @@ void SCH_SEXPR_PLUGIN::EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
||||||
|
|
||||||
cacheLib( aLibraryPath, aProperties );
|
cacheLib( aLibraryPath, aProperties );
|
||||||
|
|
||||||
const LIB_PART_MAP& symbols = m_cache->m_symbols;
|
const LIB_SYMBOL_MAP& symbols = m_cache->m_symbols;
|
||||||
|
|
||||||
for( LIB_PART_MAP::const_iterator it = symbols.begin(); it != symbols.end(); ++it )
|
for( LIB_SYMBOL_MAP::const_iterator it = symbols.begin(); it != symbols.end(); ++it )
|
||||||
{
|
{
|
||||||
if( !powerSymbolsOnly || it->second->IsPower() )
|
if( !powerSymbolsOnly || it->second->IsPower() )
|
||||||
aSymbolNameList.Add( it->first );
|
aSymbolNameList.Add( it->first );
|
||||||
|
@ -2157,7 +2158,7 @@ void SCH_SEXPR_PLUGIN::EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SEXPR_PLUGIN::EnumerateSymbolLib( std::vector<LIB_PART*>& aSymbolList,
|
void SCH_SEXPR_PLUGIN::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
|
||||||
const wxString& aLibraryPath,
|
const wxString& aLibraryPath,
|
||||||
const PROPERTIES* aProperties )
|
const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
|
@ -2168,9 +2169,9 @@ void SCH_SEXPR_PLUGIN::EnumerateSymbolLib( std::vector<LIB_PART*>& aSymbolList,
|
||||||
|
|
||||||
cacheLib( aLibraryPath, aProperties );
|
cacheLib( aLibraryPath, aProperties );
|
||||||
|
|
||||||
const LIB_PART_MAP& symbols = m_cache->m_symbols;
|
const LIB_SYMBOL_MAP& symbols = m_cache->m_symbols;
|
||||||
|
|
||||||
for( LIB_PART_MAP::const_iterator it = symbols.begin(); it != symbols.end(); ++it )
|
for( LIB_SYMBOL_MAP::const_iterator it = symbols.begin(); it != symbols.end(); ++it )
|
||||||
{
|
{
|
||||||
if( !powerSymbolsOnly || it->second->IsPower() )
|
if( !powerSymbolsOnly || it->second->IsPower() )
|
||||||
aSymbolList.push_back( it->second );
|
aSymbolList.push_back( it->second );
|
||||||
|
@ -2178,14 +2179,14 @@ void SCH_SEXPR_PLUGIN::EnumerateSymbolLib( std::vector<LIB_PART*>& aSymbolList,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SCH_SEXPR_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
LIB_SYMBOL* SCH_SEXPR_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
||||||
const PROPERTIES* aProperties )
|
const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
cacheLib( aLibraryPath, aProperties );
|
cacheLib( aLibraryPath, aProperties );
|
||||||
|
|
||||||
LIB_PART_MAP::const_iterator it = m_cache->m_symbols.find( aSymbolName );
|
LIB_SYMBOL_MAP::const_iterator it = m_cache->m_symbols.find( aSymbolName );
|
||||||
|
|
||||||
if( it == m_cache->m_symbols.end() )
|
if( it == m_cache->m_symbols.end() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -2194,7 +2195,7 @@ LIB_PART* SCH_SEXPR_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wxSt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SEXPR_PLUGIN::SaveSymbol( const wxString& aLibraryPath, const LIB_PART* aSymbol,
|
void SCH_SEXPR_PLUGIN::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
||||||
const PROPERTIES* aProperties )
|
const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
@ -2310,10 +2311,10 @@ bool SCH_SEXPR_PLUGIN::IsSymbolLibWritable( const wxString& aLibraryPath )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SCH_SEXPR_PLUGIN::ParsePart( LINE_READER& aReader, int aFileVersion )
|
LIB_SYMBOL* SCH_SEXPR_PLUGIN::ParsePart( LINE_READER& aReader, int aFileVersion )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
LIB_PART_MAP map;
|
LIB_SYMBOL_MAP map;
|
||||||
SCH_SEXPR_PARSER parser( &aReader );
|
SCH_SEXPR_PARSER parser( &aReader );
|
||||||
|
|
||||||
parser.NeedLEFT();
|
parser.NeedLEFT();
|
||||||
|
@ -2323,11 +2324,11 @@ LIB_PART* SCH_SEXPR_PLUGIN::ParsePart( LINE_READER& aReader, int aFileVersion )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SEXPR_PLUGIN::FormatPart( LIB_PART* part, OUTPUTFORMATTER & formatter )
|
void SCH_SEXPR_PLUGIN::FormatPart( LIB_SYMBOL* symbol, OUTPUTFORMATTER & formatter )
|
||||||
{
|
{
|
||||||
|
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( part, formatter );
|
SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( symbol, formatter );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct SYMBOL_INSTANCE_REFERENCE;
|
||||||
class PROPERTIES;
|
class PROPERTIES;
|
||||||
class EE_SELECTION;
|
class EE_SELECTION;
|
||||||
class SCH_SEXPR_PLUGIN_CACHE;
|
class SCH_SEXPR_PLUGIN_CACHE;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class PART_LIB;
|
class PART_LIB;
|
||||||
class BUS_ALIAS;
|
class BUS_ALIAS;
|
||||||
|
|
||||||
|
@ -106,12 +106,12 @@ public:
|
||||||
void EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
void EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
||||||
const wxString& aLibraryPath,
|
const wxString& aLibraryPath,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
void EnumerateSymbolLib( std::vector<LIB_PART*>& aSymbolList,
|
void EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
|
||||||
const wxString& aLibraryPath,
|
const wxString& aLibraryPath,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
LIB_PART* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
void SaveSymbol( const wxString& aLibraryPath, const LIB_PART* aSymbol,
|
void SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
void DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
void DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
|
@ -127,9 +127,9 @@ public:
|
||||||
|
|
||||||
const wxString& GetError() const override { return m_error; }
|
const wxString& GetError() const override { return m_error; }
|
||||||
|
|
||||||
static LIB_PART* ParsePart( LINE_READER& aReader,
|
static LIB_SYMBOL* ParsePart( LINE_READER& aReader,
|
||||||
int aVersion = SEXPR_SCHEMATIC_FILE_VERSION );
|
int aVersion = SEXPR_SCHEMATIC_FILE_VERSION );
|
||||||
static void FormatPart( LIB_PART* aPart, OUTPUTFORMATTER& aFormatter );
|
static void FormatPart( LIB_SYMBOL* aPart, OUTPUTFORMATTER& aFormatter );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadHierarchy( SCH_SHEET* aSheet );
|
void loadHierarchy( SCH_SHEET* aSheet );
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
#define Mils2Iu( x ) Mils2iu( x )
|
#define Mils2Iu( x ) Mils2iu( x )
|
||||||
|
|
||||||
|
|
||||||
// Must be the first line of part library document (.dcm) files.
|
// Must be the first line of symbol library document (.dcm) files.
|
||||||
#define DOCFILE_IDENT "EESchema-DOCLIB Version 2.0"
|
#define DOCFILE_IDENT "EESchema-DOCLIB Version 2.0"
|
||||||
|
|
||||||
#define SCH_PARSE_ERROR( text, reader, pos ) \
|
#define SCH_PARSE_ERROR( text, reader, pos ) \
|
||||||
|
@ -473,7 +473,7 @@ static void parseQuotedString( wxString& aString, LINE_READER& aReader,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A cache assistant for the part library portion of the #SCH_PLUGIN API, and only for the
|
* A cache assistant for the symbol library portion of the #SCH_PLUGIN API, and only for the
|
||||||
* #SCH_LEGACY_PLUGIN, so therefore is private to this implementation file, i.e. not placed
|
* #SCH_LEGACY_PLUGIN, so therefore is private to this implementation file, i.e. not placed
|
||||||
* into a header.
|
* into a header.
|
||||||
*/
|
*/
|
||||||
|
@ -483,7 +483,7 @@ class SCH_LEGACY_PLUGIN_CACHE
|
||||||
wxString m_fileName; // Absolute path and file name.
|
wxString m_fileName; // Absolute path and file name.
|
||||||
wxFileName m_libFileName; // Absolute path and file name is required here.
|
wxFileName m_libFileName; // Absolute path and file name is required here.
|
||||||
wxDateTime m_fileModTime;
|
wxDateTime m_fileModTime;
|
||||||
LIB_PART_MAP m_symbols; // Map of names of #LIB_PART pointers.
|
LIB_SYMBOL_MAP m_symbols; // Map of names of #LIB_SYMBOL pointers.
|
||||||
bool m_isWritable;
|
bool m_isWritable;
|
||||||
bool m_isModified;
|
bool m_isModified;
|
||||||
int m_versionMajor;
|
int m_versionMajor;
|
||||||
|
@ -491,27 +491,29 @@ class SCH_LEGACY_PLUGIN_CACHE
|
||||||
SCH_LIB_TYPE m_libType; // Is this cache a symbol or symbol library.
|
SCH_LIB_TYPE m_libType; // Is this cache a symbol or symbol library.
|
||||||
|
|
||||||
void loadHeader( FILE_LINE_READER& aReader );
|
void loadHeader( FILE_LINE_READER& aReader );
|
||||||
static void loadAliases( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader,
|
static void loadAliases( std::unique_ptr<LIB_SYMBOL>& aSymbol, LINE_READER& aReader,
|
||||||
LIB_PART_MAP* aMap = nullptr );
|
LIB_SYMBOL_MAP* aMap = nullptr );
|
||||||
static void loadField( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader );
|
static void loadField( std::unique_ptr<LIB_SYMBOL>& aSymbol, LINE_READER& aReader );
|
||||||
static void loadDrawEntries( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader,
|
static void loadDrawEntries( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
|
LINE_READER& aReader,
|
||||||
int aMajorVersion, int aMinorVersion );
|
int aMajorVersion, int aMinorVersion );
|
||||||
static void loadFootprintFilters( std::unique_ptr<LIB_PART>& aPart,
|
static void loadFootprintFilters( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
LINE_READER& aReader );
|
LINE_READER& aReader );
|
||||||
void loadDocs();
|
void loadDocs();
|
||||||
static LIB_ARC* loadArc( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader );
|
static LIB_ARC* loadArc( std::unique_ptr<LIB_SYMBOL>& aSymbol, LINE_READER& aReader );
|
||||||
static LIB_CIRCLE* loadCircle( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader );
|
static LIB_CIRCLE* loadCircle( std::unique_ptr<LIB_SYMBOL>& aSymbol, LINE_READER& aReader );
|
||||||
static LIB_TEXT* loadText( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader,
|
static LIB_TEXT* loadText( std::unique_ptr<LIB_SYMBOL>& aSymbol, LINE_READER& aReader,
|
||||||
int aMajorVersion, int aMinorVersion );
|
int aMajorVersion, int aMinorVersion );
|
||||||
static LIB_RECTANGLE* loadRectangle( std::unique_ptr<LIB_PART>& aPart,
|
static LIB_RECTANGLE* loadRectangle( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
LINE_READER& aReader );
|
LINE_READER& aReader );
|
||||||
static LIB_PIN* loadPin( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader );
|
static LIB_PIN* loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol, LINE_READER& aReader );
|
||||||
static LIB_POLYLINE* loadPolyLine( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader );
|
static LIB_POLYLINE* loadPolyLine( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
static LIB_BEZIER* loadBezier( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader );
|
LINE_READER& aReader );
|
||||||
|
static LIB_BEZIER* loadBezier( std::unique_ptr<LIB_SYMBOL>& aSymbol, LINE_READER& aReader );
|
||||||
|
|
||||||
static FILL_TYPE parseFillMode( LINE_READER& aReader, const char* aLine,
|
static FILL_TYPE parseFillMode( LINE_READER& aReader, const char* aLine,
|
||||||
const char** aOutput );
|
const char** aOutput );
|
||||||
LIB_PART* removeSymbol( LIB_PART* aAlias );
|
LIB_SYMBOL* removeSymbol( LIB_SYMBOL* aAlias );
|
||||||
|
|
||||||
void saveDocFile();
|
void saveDocFile();
|
||||||
static void saveArc( LIB_ARC* aArc, OUTPUTFORMATTER& aFormatter );
|
static void saveArc( LIB_ARC* aArc, OUTPUTFORMATTER& aFormatter );
|
||||||
|
@ -552,7 +554,7 @@ public:
|
||||||
|
|
||||||
void Load();
|
void Load();
|
||||||
|
|
||||||
void AddSymbol( const LIB_PART* aPart );
|
void AddSymbol( const LIB_SYMBOL* aSymbol );
|
||||||
|
|
||||||
void DeleteSymbol( const wxString& aName );
|
void DeleteSymbol( const wxString& aName );
|
||||||
|
|
||||||
|
@ -573,10 +575,10 @@ public:
|
||||||
|
|
||||||
wxString GetFileName() const { return m_libFileName.GetFullPath(); }
|
wxString GetFileName() const { return m_libFileName.GetFullPath(); }
|
||||||
|
|
||||||
static LIB_PART* LoadPart( LINE_READER& aReader, int aMajorVersion, int aMinorVersion,
|
static LIB_SYMBOL* LoadPart( LINE_READER& aReader, int aMajorVersion, int aMinorVersion,
|
||||||
LIB_PART_MAP* aMap = nullptr );
|
LIB_SYMBOL_MAP* aMap = nullptr );
|
||||||
static void SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aFormatter,
|
static void SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMATTER& aFormatter,
|
||||||
LIB_PART_MAP* aMap = nullptr );
|
LIB_SYMBOL_MAP* aMap = nullptr );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -2023,11 +2025,11 @@ void SCH_LEGACY_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol )
|
||||||
name1 = toUTFTildaText( aSymbol->GetField( REFERENCE_FIELD )->GetText() );
|
name1 = toUTFTildaText( aSymbol->GetField( REFERENCE_FIELD )->GetText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString part_name = aSymbol->GetLibId().Format();
|
wxString symbol_name = aSymbol->GetLibId().Format();
|
||||||
|
|
||||||
if( part_name.size() )
|
if( symbol_name.size() )
|
||||||
{
|
{
|
||||||
name2 = toUTFTildaText( part_name );
|
name2 = toUTFTildaText( symbol_name );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2088,7 +2090,7 @@ void SCH_LEGACY_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol )
|
||||||
saveField( &aSymbol->GetFields()[i] );
|
saveField( &aSymbol->GetFields()[i] );
|
||||||
|
|
||||||
// User defined fields:
|
// User defined fields:
|
||||||
// The *policy* about which user defined fields are part of a symbol is now
|
// The *policy* about which user defined fields are symbol of a symbol is now
|
||||||
// only in the dialog editors. No policy should be enforced here, simply
|
// only in the dialog editors. No policy should be enforced here, simply
|
||||||
// save all the user defined fields, they are present because a dialog editor
|
// save all the user defined fields, they are present because a dialog editor
|
||||||
// thought they should be. If you disagree, go fix the dialog editors.
|
// thought they should be. If you disagree, go fix the dialog editors.
|
||||||
|
@ -2472,30 +2474,30 @@ bool SCH_LEGACY_PLUGIN_CACHE::IsFileChanged() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SCH_LEGACY_PLUGIN_CACHE::removeSymbol( LIB_PART* aPart )
|
LIB_SYMBOL* SCH_LEGACY_PLUGIN_CACHE::removeSymbol( LIB_SYMBOL* aSymbol )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( aPart != NULL, NULL, "NULL pointer cannot be removed from library." );
|
wxCHECK_MSG( aSymbol != NULL, NULL, "NULL pointer cannot be removed from library." );
|
||||||
|
|
||||||
LIB_PART* firstChild = NULL;
|
LIB_SYMBOL* firstChild = NULL;
|
||||||
LIB_PART_MAP::iterator it = m_symbols.find( aPart->GetName() );
|
LIB_SYMBOL_MAP::iterator it = m_symbols.find( aSymbol->GetName() );
|
||||||
|
|
||||||
if( it == m_symbols.end() )
|
if( it == m_symbols.end() )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// If the entry pointer doesn't match the name it is mapped to in the library, we
|
// If the entry pointer doesn't match the name it is mapped to in the library, we
|
||||||
// have done something terribly wrong.
|
// have done something terribly wrong.
|
||||||
wxCHECK_MSG( *it->second == aPart, NULL,
|
wxCHECK_MSG( *it->second == aSymbol, NULL,
|
||||||
"Pointer mismatch while attempting to remove alias entry <" + aPart->GetName() +
|
"Pointer mismatch while attempting to remove alias entry <" + aSymbol->GetName() +
|
||||||
"> from library cache <" + m_libFileName.GetName() + ">." );
|
"> from library cache <" + m_libFileName.GetName() + ">." );
|
||||||
|
|
||||||
// If the symbol is a root symbol used by other symbols find the first alias that uses
|
// If the symbol is a root symbol used by other symbols find the first alias that uses
|
||||||
// the root part and make it the new root.
|
// the root symbol and make it the new root.
|
||||||
if( aPart->IsRoot() )
|
if( aSymbol->IsRoot() )
|
||||||
{
|
{
|
||||||
for( auto entry : m_symbols )
|
for( auto entry : m_symbols )
|
||||||
{
|
{
|
||||||
if( entry.second->IsAlias()
|
if( entry.second->IsAlias()
|
||||||
&& entry.second->GetParent().lock() == aPart->SharedPtr() )
|
&& entry.second->GetParent().lock() == aSymbol->SharedPtr() )
|
||||||
{
|
{
|
||||||
firstChild = entry.second;
|
firstChild = entry.second;
|
||||||
break;
|
break;
|
||||||
|
@ -2504,7 +2506,7 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::removeSymbol( LIB_PART* aPart )
|
||||||
|
|
||||||
if( firstChild )
|
if( firstChild )
|
||||||
{
|
{
|
||||||
for( LIB_ITEM& drawItem : aPart->GetDrawItems() )
|
for( LIB_ITEM& drawItem : aSymbol->GetDrawItems() )
|
||||||
{
|
{
|
||||||
if( drawItem.Type() == LIB_FIELD_T )
|
if( drawItem.Type() == LIB_FIELD_T )
|
||||||
{
|
{
|
||||||
|
@ -2523,32 +2525,32 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::removeSymbol( LIB_PART* aPart )
|
||||||
for( auto entry : m_symbols )
|
for( auto entry : m_symbols )
|
||||||
{
|
{
|
||||||
if( entry.second->IsAlias()
|
if( entry.second->IsAlias()
|
||||||
&& entry.second->GetParent().lock() == aPart->SharedPtr() )
|
&& entry.second->GetParent().lock() == aSymbol->SharedPtr() )
|
||||||
entry.second->SetParent( firstChild );
|
entry.second->SetParent( firstChild );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_symbols.erase( it );
|
m_symbols.erase( it );
|
||||||
delete aPart;
|
delete aSymbol;
|
||||||
m_isModified = true;
|
m_isModified = true;
|
||||||
SCH_LEGACY_PLUGIN_CACHE::IncrementModifyHash();
|
SCH_LEGACY_PLUGIN_CACHE::IncrementModifyHash();
|
||||||
return firstChild;
|
return firstChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LEGACY_PLUGIN_CACHE::AddSymbol( const LIB_PART* aPart )
|
void SCH_LEGACY_PLUGIN_CACHE::AddSymbol( const LIB_SYMBOL* aSymbol )
|
||||||
{
|
{
|
||||||
// aPart is cloned in PART_LIB::AddPart(). The cache takes ownership of aPart.
|
// aSymbol is cloned in PART_LIB::AddPart(). The cache takes ownership of aSymbol.
|
||||||
wxString name = aPart->GetName();
|
wxString name = aSymbol->GetName();
|
||||||
LIB_PART_MAP::iterator it = m_symbols.find( name );
|
LIB_SYMBOL_MAP::iterator it = m_symbols.find( name );
|
||||||
|
|
||||||
if( it != m_symbols.end() )
|
if( it != m_symbols.end() )
|
||||||
{
|
{
|
||||||
removeSymbol( it->second );
|
removeSymbol( it->second );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_symbols[ name ] = const_cast< LIB_PART* >( aPart );
|
m_symbols[ name ] = const_cast< LIB_SYMBOL* >( aSymbol );
|
||||||
m_isModified = true;
|
m_isModified = true;
|
||||||
SCH_LEGACY_PLUGIN_CACHE::IncrementModifyHash();
|
SCH_LEGACY_PLUGIN_CACHE::IncrementModifyHash();
|
||||||
}
|
}
|
||||||
|
@ -2623,10 +2625,10 @@ void SCH_LEGACY_PLUGIN_CACHE::Load()
|
||||||
|
|
||||||
if( strCompare( "DEF", line ) )
|
if( strCompare( "DEF", line ) )
|
||||||
{
|
{
|
||||||
// Read one DEF/ENDDEF part entry from library:
|
// Read one DEF/ENDDEF symbol entry from library:
|
||||||
LIB_PART* part = LoadPart( reader, m_versionMajor, m_versionMinor, &m_symbols );
|
LIB_SYMBOL* symbol = LoadPart( reader, m_versionMajor, m_versionMinor, &m_symbols );
|
||||||
|
|
||||||
m_symbols[ part->GetName() ] = part;
|
m_symbols[ symbol->GetName() ] = symbol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2648,7 +2650,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadDocs()
|
||||||
wxString text;
|
wxString text;
|
||||||
wxString aliasName;
|
wxString aliasName;
|
||||||
wxFileName fn = m_libFileName;
|
wxFileName fn = m_libFileName;
|
||||||
LIB_PART* symbol = NULL;;
|
LIB_SYMBOL* symbol = NULL;;
|
||||||
|
|
||||||
fn.SetExt( DOC_EXT );
|
fn.SetExt( DOC_EXT );
|
||||||
|
|
||||||
|
@ -2685,7 +2687,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadDocs()
|
||||||
aliasName.Trim();
|
aliasName.Trim();
|
||||||
aliasName = LIB_ID::FixIllegalChars( aliasName );
|
aliasName = LIB_ID::FixIllegalChars( aliasName );
|
||||||
|
|
||||||
LIB_PART_MAP::iterator it = m_symbols.find( aliasName );
|
LIB_SYMBOL_MAP::iterator it = m_symbols.find( aliasName );
|
||||||
|
|
||||||
if( it == m_symbols.end() )
|
if( it == m_symbols.end() )
|
||||||
wxLogWarning( "Symbol '%s' not found in library:\n\n"
|
wxLogWarning( "Symbol '%s' not found in library:\n\n"
|
||||||
|
@ -2765,8 +2767,8 @@ void SCH_LEGACY_PLUGIN_CACHE::loadHeader( FILE_LINE_READER& aReader )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVersion,
|
LIB_SYMBOL* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVersion,
|
||||||
int aMinorVersion, LIB_PART_MAP* aMap )
|
int aMinorVersion, LIB_SYMBOL_MAP* aMap )
|
||||||
{
|
{
|
||||||
const char* line = aReader.Line();
|
const char* line = aReader.Line();
|
||||||
|
|
||||||
|
@ -2785,7 +2787,7 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVer
|
||||||
SCH_PARSE_ERROR( "invalid symbol definition", aReader, line );
|
SCH_PARSE_ERROR( "invalid symbol definition", aReader, line );
|
||||||
|
|
||||||
// Read DEF line:
|
// Read DEF line:
|
||||||
std::unique_ptr<LIB_PART> part = std::make_unique<LIB_PART>( wxEmptyString );
|
std::unique_ptr<LIB_SYMBOL> symbol = std::make_unique<LIB_SYMBOL>( wxEmptyString );
|
||||||
|
|
||||||
wxString name, prefix, tmp;
|
wxString name, prefix, tmp;
|
||||||
|
|
||||||
|
@ -2805,7 +2807,7 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVer
|
||||||
aReader.LineNumber(), pos );
|
aReader.LineNumber(), pos );
|
||||||
|
|
||||||
pos += tmp.size() + 1;
|
pos += tmp.size() + 1;
|
||||||
part->SetPinNameOffset( Mils2Iu( (int)num ) );
|
symbol->SetPinNameOffset( Mils2Iu( (int)num ) );
|
||||||
|
|
||||||
tmp = tokens.GetNextToken(); // Show pin numbers.
|
tmp = tokens.GetNextToken(); // Show pin numbers.
|
||||||
|
|
||||||
|
@ -2814,7 +2816,7 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVer
|
||||||
aReader.LineNumber(), pos );
|
aReader.LineNumber(), pos );
|
||||||
|
|
||||||
pos += tmp.size() + 1;
|
pos += tmp.size() + 1;
|
||||||
part->SetShowPinNumbers( ( tmp == "N" ) ? false : true );
|
symbol->SetShowPinNumbers( ( tmp == "N" ) ? false : true );
|
||||||
|
|
||||||
tmp = tokens.GetNextToken(); // Show pin names.
|
tmp = tokens.GetNextToken(); // Show pin names.
|
||||||
|
|
||||||
|
@ -2823,7 +2825,7 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVer
|
||||||
aReader.LineNumber(), pos );
|
aReader.LineNumber(), pos );
|
||||||
|
|
||||||
pos += tmp.size() + 1;
|
pos += tmp.size() + 1;
|
||||||
part->SetShowPinNames( ( tmp == "N" ) ? false : true );
|
symbol->SetShowPinNames( ( tmp == "N" ) ? false : true );
|
||||||
|
|
||||||
tmp = tokens.GetNextToken(); // Number of units.
|
tmp = tokens.GetNextToken(); // Number of units.
|
||||||
|
|
||||||
|
@ -2832,33 +2834,33 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVer
|
||||||
aReader.LineNumber(), pos );
|
aReader.LineNumber(), pos );
|
||||||
|
|
||||||
pos += tmp.size() + 1;
|
pos += tmp.size() + 1;
|
||||||
part->SetUnitCount( (int)num );
|
symbol->SetUnitCount( (int)num );
|
||||||
|
|
||||||
// Ensure m_unitCount is >= 1. Could be read as 0 in old libraries.
|
// Ensure m_unitCount is >= 1. Could be read as 0 in old libraries.
|
||||||
if( part->GetUnitCount() < 1 )
|
if( symbol->GetUnitCount() < 1 )
|
||||||
part->SetUnitCount( 1 );
|
symbol->SetUnitCount( 1 );
|
||||||
|
|
||||||
// Copy part name and prefix.
|
// Copy symbol name and prefix.
|
||||||
|
|
||||||
// The root alias is added to the alias list by SetName() which is called by SetText().
|
// The root alias is added to the alias list by SetName() which is called by SetText().
|
||||||
if( name.IsEmpty() )
|
if( name.IsEmpty() )
|
||||||
{
|
{
|
||||||
part->SetName( "~" );
|
symbol->SetName( "~" );
|
||||||
}
|
}
|
||||||
else if( name[0] != '~' )
|
else if( name[0] != '~' )
|
||||||
{
|
{
|
||||||
part->SetName( name );
|
symbol->SetName( name );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
part->SetName( name.Right( name.Length() - 1 ) );
|
symbol->SetName( name.Right( name.Length() - 1 ) );
|
||||||
part->GetValueField().SetVisible( false );
|
symbol->GetValueField().SetVisible( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't set the library alias, this is determined by the symbol library table.
|
// Don't set the library alias, this is determined by the symbol library table.
|
||||||
part->SetLibId( LIB_ID( wxEmptyString, part->GetName() ) );
|
symbol->SetLibId( LIB_ID( wxEmptyString, symbol->GetName() ) );
|
||||||
|
|
||||||
LIB_FIELD& reference = part->GetReferenceField();
|
LIB_FIELD& reference = symbol->GetReferenceField();
|
||||||
|
|
||||||
if( prefix == "~" )
|
if( prefix == "~" )
|
||||||
{
|
{
|
||||||
|
@ -2885,9 +2887,9 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVer
|
||||||
tmp = tokens.GetNextToken();
|
tmp = tokens.GetNextToken();
|
||||||
|
|
||||||
if( tmp == "L" )
|
if( tmp == "L" )
|
||||||
part->LockUnits( true );
|
symbol->LockUnits( true );
|
||||||
else if( tmp == "F" || tmp == "0" )
|
else if( tmp == "F" || tmp == "0" )
|
||||||
part->LockUnits( false );
|
symbol->LockUnits( false );
|
||||||
else
|
else
|
||||||
THROW_PARSE_ERROR( "expected L, F, or 0", aReader.GetSource(), aReader.Line(),
|
THROW_PARSE_ERROR( "expected L, F, or 0", aReader.GetSource(), aReader.Line(),
|
||||||
aReader.LineNumber(), pos );
|
aReader.LineNumber(), pos );
|
||||||
|
@ -2901,9 +2903,9 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVer
|
||||||
tmp = tokens.GetNextToken();
|
tmp = tokens.GetNextToken();
|
||||||
|
|
||||||
if( tmp == "P" )
|
if( tmp == "P" )
|
||||||
part->SetPower();
|
symbol->SetPower();
|
||||||
else if( tmp == "N" )
|
else if( tmp == "N" )
|
||||||
part->SetNormal();
|
symbol->SetNormal();
|
||||||
else
|
else
|
||||||
THROW_PARSE_ERROR( "expected P or N", aReader.GetSource(), aReader.Line(),
|
THROW_PARSE_ERROR( "expected P or N", aReader.GetSource(), aReader.Line(),
|
||||||
aReader.LineNumber(), pos );
|
aReader.LineNumber(), pos );
|
||||||
|
@ -2919,16 +2921,16 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVer
|
||||||
else if( strCompare( "Ti", line, &line ) ) // Modification date is ignored.
|
else if( strCompare( "Ti", line, &line ) ) // Modification date is ignored.
|
||||||
continue;
|
continue;
|
||||||
else if( strCompare( "ALIAS", line, &line ) ) // Aliases
|
else if( strCompare( "ALIAS", line, &line ) ) // Aliases
|
||||||
loadAliases( part, aReader, aMap );
|
loadAliases( symbol, aReader, aMap );
|
||||||
else if( *line == 'F' ) // Fields
|
else if( *line == 'F' ) // Fields
|
||||||
loadField( part, aReader );
|
loadField( symbol, aReader );
|
||||||
else if( strCompare( "DRAW", line, &line ) ) // Drawing objects.
|
else if( strCompare( "DRAW", line, &line ) ) // Drawing objects.
|
||||||
loadDrawEntries( part, aReader, aMajorVersion, aMinorVersion );
|
loadDrawEntries( symbol, aReader, aMajorVersion, aMinorVersion );
|
||||||
else if( strCompare( "$FPLIST", line, &line ) ) // Footprint filter list
|
else if( strCompare( "$FPLIST", line, &line ) ) // Footprint filter list
|
||||||
loadFootprintFilters( part, aReader );
|
loadFootprintFilters( symbol, aReader );
|
||||||
else if( strCompare( "ENDDEF", line, &line ) ) // End of part description
|
else if( strCompare( "ENDDEF", line, &line ) ) // End of symbol description
|
||||||
{
|
{
|
||||||
return part.release();
|
return symbol.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
line = aReader.ReadLine();
|
line = aReader.ReadLine();
|
||||||
|
@ -2938,9 +2940,9 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LEGACY_PLUGIN_CACHE::loadAliases( std::unique_ptr<LIB_PART>& aPart,
|
void SCH_LEGACY_PLUGIN_CACHE::loadAliases( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
LINE_READER& aReader,
|
LINE_READER& aReader,
|
||||||
LIB_PART_MAP* aMap )
|
LIB_SYMBOL_MAP* aMap )
|
||||||
{
|
{
|
||||||
wxString newAliasName;
|
wxString newAliasName;
|
||||||
const char* line = aReader.Line();
|
const char* line = aReader.Line();
|
||||||
|
@ -2957,17 +2959,17 @@ void SCH_LEGACY_PLUGIN_CACHE::loadAliases( std::unique_ptr<LIB_PART>& aPart,
|
||||||
|
|
||||||
if( aMap )
|
if( aMap )
|
||||||
{
|
{
|
||||||
LIB_PART* newPart = new LIB_PART( newAliasName );
|
LIB_SYMBOL* newSymbol = new LIB_SYMBOL( newAliasName );
|
||||||
|
|
||||||
// Inherit the parent mandatory field attributes.
|
// Inherit the parent mandatory field attributes.
|
||||||
for( int id = 0; id < MANDATORY_FIELDS; ++id )
|
for( int id = 0; id < MANDATORY_FIELDS; ++id )
|
||||||
{
|
{
|
||||||
LIB_FIELD* field = newPart->GetFieldById( id );
|
LIB_FIELD* field = newSymbol->GetFieldById( id );
|
||||||
|
|
||||||
// the MANDATORY_FIELDS are exactly that in RAM.
|
// the MANDATORY_FIELDS are exactly that in RAM.
|
||||||
wxASSERT( field );
|
wxASSERT( field );
|
||||||
|
|
||||||
LIB_FIELD* parentField = aPart->GetFieldById( id );
|
LIB_FIELD* parentField = aSymbol->GetFieldById( id );
|
||||||
|
|
||||||
wxASSERT( parentField );
|
wxASSERT( parentField );
|
||||||
|
|
||||||
|
@ -2976,20 +2978,20 @@ void SCH_LEGACY_PLUGIN_CACHE::loadAliases( std::unique_ptr<LIB_PART>& aPart,
|
||||||
if( id == VALUE_FIELD )
|
if( id == VALUE_FIELD )
|
||||||
field->SetText( newAliasName );
|
field->SetText( newAliasName );
|
||||||
|
|
||||||
field->SetParent( newPart );
|
field->SetParent( newSymbol );
|
||||||
}
|
}
|
||||||
|
|
||||||
newPart->SetParent( aPart.get() );
|
newSymbol->SetParent( aSymbol.get() );
|
||||||
|
|
||||||
// This will prevent duplicate aliases.
|
// This will prevent duplicate aliases.
|
||||||
(*aMap)[ newPart->GetName() ] = newPart;
|
(*aMap)[ newSymbol->GetName() ] = newSymbol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr<LIB_PART>& aPart,
|
void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
LINE_READER& aReader )
|
LINE_READER& aReader )
|
||||||
{
|
{
|
||||||
const char* line = aReader.Line();
|
const char* line = aReader.Line();
|
||||||
|
|
||||||
|
@ -3005,7 +3007,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr<LIB_PART>& aPart,
|
||||||
|
|
||||||
if( id >= 0 && id < MANDATORY_FIELDS )
|
if( id >= 0 && id < MANDATORY_FIELDS )
|
||||||
{
|
{
|
||||||
field = aPart->GetFieldById( id );
|
field = aSymbol->GetFieldById( id );
|
||||||
|
|
||||||
// this will fire only if somebody broke a constructor or editor.
|
// this will fire only if somebody broke a constructor or editor.
|
||||||
// MANDATORY_FIELDS are always present in ram resident symbols, no
|
// MANDATORY_FIELDS are always present in ram resident symbols, no
|
||||||
|
@ -3014,8 +3016,8 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr<LIB_PART>& aPart,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
field = new LIB_FIELD( aPart.get(), id );
|
field = new LIB_FIELD( aSymbol.get(), id );
|
||||||
aPart->AddDrawItem( field, false );
|
aSymbol->AddDrawItem( field, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip to the first double quote.
|
// Skip to the first double quote.
|
||||||
|
@ -3124,10 +3126,10 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr<LIB_PART>& aPart,
|
||||||
// Plus assumptions are made in the field editors.
|
// Plus assumptions are made in the field editors.
|
||||||
field->m_name = TEMPLATE_FIELDNAME::GetDefaultFieldName( id );
|
field->m_name = TEMPLATE_FIELDNAME::GetDefaultFieldName( id );
|
||||||
|
|
||||||
// Ensure the VALUE field = the part name (can be not the case
|
// Ensure the VALUE field = the symbol name (can be not the case
|
||||||
// with malformed libraries: edited by hand, or converted from other tools)
|
// with malformed libraries: edited by hand, or converted from other tools)
|
||||||
if( id == VALUE_FIELD )
|
if( id == VALUE_FIELD )
|
||||||
field->SetText( aPart->GetName() );
|
field->SetText( aSymbol->GetName() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3136,10 +3138,10 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr<LIB_PART>& aPart,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LEGACY_PLUGIN_CACHE::loadDrawEntries( std::unique_ptr<LIB_PART>& aPart,
|
void SCH_LEGACY_PLUGIN_CACHE::loadDrawEntries( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
LINE_READER& aReader,
|
LINE_READER& aReader,
|
||||||
int aMajorVersion,
|
int aMajorVersion,
|
||||||
int aMinorVersion )
|
int aMinorVersion )
|
||||||
{
|
{
|
||||||
const char* line = aReader.Line();
|
const char* line = aReader.Line();
|
||||||
|
|
||||||
|
@ -3151,38 +3153,39 @@ void SCH_LEGACY_PLUGIN_CACHE::loadDrawEntries( std::unique_ptr<LIB_PART>& aPart,
|
||||||
{
|
{
|
||||||
if( strCompare( "ENDDRAW", line, &line ) )
|
if( strCompare( "ENDDRAW", line, &line ) )
|
||||||
{
|
{
|
||||||
aPart->GetDrawItems().sort();
|
aSymbol->GetDrawItems().sort();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( line[0] )
|
switch( line[0] )
|
||||||
{
|
{
|
||||||
case 'A': // Arc
|
case 'A': // Arc
|
||||||
aPart->AddDrawItem( loadArc( aPart, aReader ), false );
|
aSymbol->AddDrawItem( loadArc( aSymbol, aReader ), false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C': // Circle
|
case 'C': // Circle
|
||||||
aPart->AddDrawItem( loadCircle( aPart, aReader ), false );
|
aSymbol->AddDrawItem( loadCircle( aSymbol, aReader ), false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'T': // Text
|
case 'T': // Text
|
||||||
aPart->AddDrawItem( loadText( aPart, aReader, aMajorVersion, aMinorVersion ), false );
|
aSymbol->AddDrawItem( loadText( aSymbol, aReader, aMajorVersion,
|
||||||
|
aMinorVersion ), false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'S': // Square
|
case 'S': // Square
|
||||||
aPart->AddDrawItem( loadRectangle( aPart, aReader ), false );
|
aSymbol->AddDrawItem( loadRectangle( aSymbol, aReader ), false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'X': // Pin Description
|
case 'X': // Pin Description
|
||||||
aPart->AddDrawItem( loadPin( aPart, aReader ), false );
|
aSymbol->AddDrawItem( loadPin( aSymbol, aReader ), false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P': // Polyline
|
case 'P': // Polyline
|
||||||
aPart->AddDrawItem( loadPolyLine( aPart, aReader ), false );
|
aSymbol->AddDrawItem( loadPolyLine( aSymbol, aReader ), false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'B': // Bezier Curves
|
case 'B': // Bezier Curves
|
||||||
aPart->AddDrawItem( loadBezier( aPart, aReader ), false );
|
aSymbol->AddDrawItem( loadBezier( aSymbol, aReader ), false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '#': // Comment
|
case '#': // Comment
|
||||||
|
@ -3218,14 +3221,14 @@ FILL_TYPE SCH_LEGACY_PLUGIN_CACHE::parseFillMode( LINE_READER& aReader, const ch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_ARC* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr<LIB_PART>& aPart,
|
LIB_ARC* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
LINE_READER& aReader )
|
LINE_READER& aReader )
|
||||||
{
|
{
|
||||||
const char* line = aReader.Line();
|
const char* line = aReader.Line();
|
||||||
|
|
||||||
wxCHECK_MSG( strCompare( "A", line, &line ), NULL, "Invalid LIB_ARC definition" );
|
wxCHECK_MSG( strCompare( "A", line, &line ), NULL, "Invalid LIB_ARC definition" );
|
||||||
|
|
||||||
LIB_ARC* arc = new LIB_ARC( aPart.get() );
|
LIB_ARC* arc = new LIB_ARC( aSymbol.get() );
|
||||||
|
|
||||||
wxPoint center;
|
wxPoint center;
|
||||||
|
|
||||||
|
@ -3284,14 +3287,14 @@ LIB_ARC* SCH_LEGACY_PLUGIN_CACHE::loadArc( std::unique_ptr<LIB_PART>& aPart,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_CIRCLE* SCH_LEGACY_PLUGIN_CACHE::loadCircle( std::unique_ptr<LIB_PART>& aPart,
|
LIB_CIRCLE* SCH_LEGACY_PLUGIN_CACHE::loadCircle( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
LINE_READER& aReader )
|
LINE_READER& aReader )
|
||||||
{
|
{
|
||||||
const char* line = aReader.Line();
|
const char* line = aReader.Line();
|
||||||
|
|
||||||
wxCHECK_MSG( strCompare( "C", line, &line ), NULL, "Invalid LIB_CIRCLE definition" );
|
wxCHECK_MSG( strCompare( "C", line, &line ), NULL, "Invalid LIB_CIRCLE definition" );
|
||||||
|
|
||||||
LIB_CIRCLE* circle = new LIB_CIRCLE( aPart.get() );
|
LIB_CIRCLE* circle = new LIB_CIRCLE( aSymbol.get() );
|
||||||
|
|
||||||
wxPoint center;
|
wxPoint center;
|
||||||
|
|
||||||
|
@ -3311,16 +3314,16 @@ LIB_CIRCLE* SCH_LEGACY_PLUGIN_CACHE::loadCircle( std::unique_ptr<LIB_PART>& aPar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_TEXT* SCH_LEGACY_PLUGIN_CACHE::loadText( std::unique_ptr<LIB_PART>& aPart,
|
LIB_TEXT* SCH_LEGACY_PLUGIN_CACHE::loadText( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
LINE_READER& aReader,
|
LINE_READER& aReader,
|
||||||
int aMajorVersion,
|
int aMajorVersion,
|
||||||
int aMinorVersion )
|
int aMinorVersion )
|
||||||
{
|
{
|
||||||
const char* line = aReader.Line();
|
const char* line = aReader.Line();
|
||||||
|
|
||||||
wxCHECK_MSG( strCompare( "T", line, &line ), NULL, "Invalid LIB_TEXT definition" );
|
wxCHECK_MSG( strCompare( "T", line, &line ), NULL, "Invalid LIB_TEXT definition" );
|
||||||
|
|
||||||
LIB_TEXT* text = new LIB_TEXT( aPart.get() );
|
LIB_TEXT* text = new LIB_TEXT( aSymbol.get() );
|
||||||
|
|
||||||
text->SetTextAngle( (double) parseInt( aReader, line, &line ) );
|
text->SetTextAngle( (double) parseInt( aReader, line, &line ) );
|
||||||
|
|
||||||
|
@ -3404,14 +3407,14 @@ LIB_TEXT* SCH_LEGACY_PLUGIN_CACHE::loadText( std::unique_ptr<LIB_PART>& aPart,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_RECTANGLE* SCH_LEGACY_PLUGIN_CACHE::loadRectangle( std::unique_ptr<LIB_PART>& aPart,
|
LIB_RECTANGLE* SCH_LEGACY_PLUGIN_CACHE::loadRectangle( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
LINE_READER& aReader )
|
LINE_READER& aReader )
|
||||||
{
|
{
|
||||||
const char* line = aReader.Line();
|
const char* line = aReader.Line();
|
||||||
|
|
||||||
wxCHECK_MSG( strCompare( "S", line, &line ), NULL, "Invalid LIB_RECTANGLE definition" );
|
wxCHECK_MSG( strCompare( "S", line, &line ), NULL, "Invalid LIB_RECTANGLE definition" );
|
||||||
|
|
||||||
LIB_RECTANGLE* rectangle = new LIB_RECTANGLE( aPart.get() );
|
LIB_RECTANGLE* rectangle = new LIB_RECTANGLE( aSymbol.get() );
|
||||||
|
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
|
||||||
|
@ -3436,8 +3439,8 @@ LIB_RECTANGLE* SCH_LEGACY_PLUGIN_CACHE::loadRectangle( std::unique_ptr<LIB_PART>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
LINE_READER& aReader )
|
LINE_READER& aReader )
|
||||||
{
|
{
|
||||||
const char* line = aReader.Line();
|
const char* line = aReader.Line();
|
||||||
|
|
||||||
|
@ -3567,7 +3570,7 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PIN* pin = new LIB_PIN( aPart.get(), name, number, orientation, pinType, length,
|
LIB_PIN* pin = new LIB_PIN( aSymbol.get(), name, number, orientation, pinType, length,
|
||||||
nameTextSize, numberTextSize, convert, position, unit );
|
nameTextSize, numberTextSize, convert, position, unit );
|
||||||
|
|
||||||
// Optional
|
// Optional
|
||||||
|
@ -3626,14 +3629,14 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_POLYLINE* SCH_LEGACY_PLUGIN_CACHE::loadPolyLine( std::unique_ptr<LIB_PART>& aPart,
|
LIB_POLYLINE* SCH_LEGACY_PLUGIN_CACHE::loadPolyLine( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
LINE_READER& aReader )
|
LINE_READER& aReader )
|
||||||
{
|
{
|
||||||
const char* line = aReader.Line();
|
const char* line = aReader.Line();
|
||||||
|
|
||||||
wxCHECK_MSG( strCompare( "P", line, &line ), NULL, "Invalid LIB_POLYLINE definition" );
|
wxCHECK_MSG( strCompare( "P", line, &line ), NULL, "Invalid LIB_POLYLINE definition" );
|
||||||
|
|
||||||
LIB_POLYLINE* polyLine = new LIB_POLYLINE( aPart.get() );
|
LIB_POLYLINE* polyLine = new LIB_POLYLINE( aSymbol.get() );
|
||||||
|
|
||||||
int points = parseInt( aReader, line, &line );
|
int points = parseInt( aReader, line, &line );
|
||||||
polyLine->SetUnit( parseInt( aReader, line, &line ) );
|
polyLine->SetUnit( parseInt( aReader, line, &line ) );
|
||||||
|
@ -3657,14 +3660,14 @@ LIB_POLYLINE* SCH_LEGACY_PLUGIN_CACHE::loadPolyLine( std::unique_ptr<LIB_PART>&
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_BEZIER* SCH_LEGACY_PLUGIN_CACHE::loadBezier( std::unique_ptr<LIB_PART>& aPart,
|
LIB_BEZIER* SCH_LEGACY_PLUGIN_CACHE::loadBezier( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
LINE_READER& aReader )
|
LINE_READER& aReader )
|
||||||
{
|
{
|
||||||
const char* line = aReader.Line();
|
const char* line = aReader.Line();
|
||||||
|
|
||||||
wxCHECK_MSG( strCompare( "B", line, &line ), NULL, "Invalid LIB_BEZIER definition" );
|
wxCHECK_MSG( strCompare( "B", line, &line ), NULL, "Invalid LIB_BEZIER definition" );
|
||||||
|
|
||||||
LIB_BEZIER* bezier = new LIB_BEZIER( aPart.get() );
|
LIB_BEZIER* bezier = new LIB_BEZIER( aSymbol.get() );
|
||||||
|
|
||||||
int points = parseInt( aReader, line, &line );
|
int points = parseInt( aReader, line, &line );
|
||||||
bezier->SetUnit( parseInt( aReader, line, &line ) );
|
bezier->SetUnit( parseInt( aReader, line, &line ) );
|
||||||
|
@ -3688,8 +3691,8 @@ LIB_BEZIER* SCH_LEGACY_PLUGIN_CACHE::loadBezier( std::unique_ptr<LIB_PART>& aPar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LEGACY_PLUGIN_CACHE::loadFootprintFilters( std::unique_ptr<LIB_PART>& aPart,
|
void SCH_LEGACY_PLUGIN_CACHE::loadFootprintFilters( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||||
LINE_READER& aReader )
|
LINE_READER& aReader )
|
||||||
{
|
{
|
||||||
const char* line = aReader.Line();
|
const char* line = aReader.Line();
|
||||||
|
|
||||||
|
@ -3703,7 +3706,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadFootprintFilters( std::unique_ptr<LIB_PART>& a
|
||||||
{
|
{
|
||||||
if( strCompare( "$ENDFPLIST", line, &line ) )
|
if( strCompare( "$ENDFPLIST", line, &line ) )
|
||||||
{
|
{
|
||||||
aPart->SetFPFilters( footprintFilters );
|
aSymbol->SetFPFilters( footprintFilters );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3730,7 +3733,7 @@ void SCH_LEGACY_PLUGIN_CACHE::Save( bool aSaveDocFile )
|
||||||
formatter->Print( 0, "%s %d.%d\n", LIBFILE_IDENT, LIB_VERSION_MAJOR, LIB_VERSION_MINOR );
|
formatter->Print( 0, "%s %d.%d\n", LIBFILE_IDENT, LIB_VERSION_MAJOR, LIB_VERSION_MINOR );
|
||||||
formatter->Print( 0, "#encoding utf-8\n");
|
formatter->Print( 0, "#encoding utf-8\n");
|
||||||
|
|
||||||
for( LIB_PART_MAP::iterator it = m_symbols.begin(); it != m_symbols.end(); it++ )
|
for( LIB_SYMBOL_MAP::iterator it = m_symbols.begin(); it != m_symbols.end(); it++ )
|
||||||
{
|
{
|
||||||
if( !it->second->IsRoot() )
|
if( !it->second->IsRoot() )
|
||||||
continue;
|
continue;
|
||||||
|
@ -3749,10 +3752,10 @@ void SCH_LEGACY_PLUGIN_CACHE::Save( bool aSaveDocFile )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LEGACY_PLUGIN_CACHE::SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aFormatter,
|
void SCH_LEGACY_PLUGIN_CACHE::SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMATTER& aFormatter,
|
||||||
LIB_PART_MAP* aMap )
|
LIB_SYMBOL_MAP* aMap )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aSymbol && aSymbol->IsRoot(), "Invalid LIB_PART pointer." );
|
wxCHECK_RET( aSymbol && aSymbol->IsRoot(), "Invalid LIB_SYMBOL pointer." );
|
||||||
|
|
||||||
// LIB_ALIAS objects are deprecated but we still need to gather up the derived symbols
|
// LIB_ALIAS objects are deprecated but we still need to gather up the derived symbols
|
||||||
// and save their names for the old file format.
|
// and save their names for the old file format.
|
||||||
|
@ -3762,10 +3765,10 @@ void SCH_LEGACY_PLUGIN_CACHE::SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aF
|
||||||
{
|
{
|
||||||
for( auto entry : *aMap )
|
for( auto entry : *aMap )
|
||||||
{
|
{
|
||||||
LIB_PART* part = entry.second;
|
LIB_SYMBOL* symbol = entry.second;
|
||||||
|
|
||||||
if( part->IsAlias() && part->GetParent().lock() == aSymbol->SharedPtr() )
|
if( symbol->IsAlias() && symbol->GetParent().lock() == aSymbol->SharedPtr() )
|
||||||
aliasNames.Add( part->GetName() );
|
aliasNames.Add( symbol->GetName() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3822,7 +3825,6 @@ void SCH_LEGACY_PLUGIN_CACHE::SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aF
|
||||||
|
|
||||||
// User defined fields:
|
// User defined fields:
|
||||||
// may have their own save policy so there is a separate loop for them.
|
// may have their own save policy so there is a separate loop for them.
|
||||||
|
|
||||||
int fieldId = MANDATORY_FIELDS; // really wish this would go away.
|
int fieldId = MANDATORY_FIELDS; // really wish this would go away.
|
||||||
|
|
||||||
for( unsigned i = MANDATORY_FIELDS; i < fields.size(); ++i )
|
for( unsigned i = MANDATORY_FIELDS; i < fields.size(); ++i )
|
||||||
|
@ -4079,7 +4081,8 @@ void SCH_LEGACY_PLUGIN_CACHE::saveRectangle( LIB_RECTANGLE* aRectangle,
|
||||||
Iu2Mils( aRectangle->GetPosition().y ),
|
Iu2Mils( aRectangle->GetPosition().y ),
|
||||||
Iu2Mils( aRectangle->GetEnd().x ), Iu2Mils( aRectangle->GetEnd().y ),
|
Iu2Mils( aRectangle->GetEnd().x ), Iu2Mils( aRectangle->GetEnd().y ),
|
||||||
aRectangle->GetUnit(), aRectangle->GetConvert(),
|
aRectangle->GetUnit(), aRectangle->GetConvert(),
|
||||||
Iu2Mils( aRectangle->GetWidth() ), fill_tab[static_cast<int>( aRectangle->GetFillMode() )] );
|
Iu2Mils( aRectangle->GetWidth() ),
|
||||||
|
fill_tab[static_cast<int>( aRectangle->GetFillMode() )] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4130,7 +4133,7 @@ void SCH_LEGACY_PLUGIN_CACHE::saveDocFile()
|
||||||
|
|
||||||
formatter.Print( 0, "%s\n", DOCFILE_IDENT );
|
formatter.Print( 0, "%s\n", DOCFILE_IDENT );
|
||||||
|
|
||||||
for( LIB_PART_MAP::iterator it = m_symbols.begin(); it != m_symbols.end(); ++it )
|
for( LIB_SYMBOL_MAP::iterator it = m_symbols.begin(); it != m_symbols.end(); ++it )
|
||||||
{
|
{
|
||||||
wxString description = it->second->GetDescription();
|
wxString description = it->second->GetDescription();
|
||||||
wxString keyWords = it->second->GetKeyWords();
|
wxString keyWords = it->second->GetKeyWords();
|
||||||
|
@ -4159,26 +4162,27 @@ void SCH_LEGACY_PLUGIN_CACHE::saveDocFile()
|
||||||
|
|
||||||
void SCH_LEGACY_PLUGIN_CACHE::DeleteSymbol( const wxString& aSymbolName )
|
void SCH_LEGACY_PLUGIN_CACHE::DeleteSymbol( const wxString& aSymbolName )
|
||||||
{
|
{
|
||||||
LIB_PART_MAP::iterator it = m_symbols.find( aSymbolName );
|
LIB_SYMBOL_MAP::iterator it = m_symbols.find( aSymbolName );
|
||||||
|
|
||||||
if( it == m_symbols.end() )
|
if( it == m_symbols.end() )
|
||||||
THROW_IO_ERROR( wxString::Format( _( "library %s does not contain a symbol named %s" ),
|
THROW_IO_ERROR( wxString::Format( _( "library %s does not contain a symbol named %s" ),
|
||||||
m_libFileName.GetFullName(), aSymbolName ) );
|
m_libFileName.GetFullName(), aSymbolName ) );
|
||||||
|
|
||||||
LIB_PART* part = it->second;
|
LIB_SYMBOL* symbol = it->second;
|
||||||
|
|
||||||
if( part->IsRoot() )
|
if( symbol->IsRoot() )
|
||||||
{
|
{
|
||||||
LIB_PART* rootPart = part;
|
LIB_SYMBOL* rootSymbol = symbol;
|
||||||
|
|
||||||
// Remove the root symbol and all it's children.
|
// Remove the root symbol and all it's children.
|
||||||
m_symbols.erase( it );
|
m_symbols.erase( it );
|
||||||
|
|
||||||
LIB_PART_MAP::iterator it1 = m_symbols.begin();
|
LIB_SYMBOL_MAP::iterator it1 = m_symbols.begin();
|
||||||
|
|
||||||
while( it1 != m_symbols.end() )
|
while( it1 != m_symbols.end() )
|
||||||
{
|
{
|
||||||
if( it1->second->IsAlias() && it1->second->GetParent().lock() == rootPart->SharedPtr() )
|
if( it1->second->IsAlias()
|
||||||
|
&& it1->second->GetParent().lock() == rootSymbol->SharedPtr() )
|
||||||
{
|
{
|
||||||
delete it1->second;
|
delete it1->second;
|
||||||
it1 = m_symbols.erase( it1 );
|
it1 = m_symbols.erase( it1 );
|
||||||
|
@ -4189,13 +4193,13 @@ void SCH_LEGACY_PLUGIN_CACHE::DeleteSymbol( const wxString& aSymbolName )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete rootPart;
|
delete rootSymbol;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Just remove the alias.
|
// Just remove the alias.
|
||||||
m_symbols.erase( it );
|
m_symbols.erase( it );
|
||||||
delete part;
|
delete symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCH_LEGACY_PLUGIN_CACHE::IncrementModifyHash();
|
SCH_LEGACY_PLUGIN_CACHE::IncrementModifyHash();
|
||||||
|
@ -4260,9 +4264,9 @@ void SCH_LEGACY_PLUGIN::EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
||||||
|
|
||||||
cacheLib( aLibraryPath, aProperties );
|
cacheLib( aLibraryPath, aProperties );
|
||||||
|
|
||||||
const LIB_PART_MAP& symbols = m_cache->m_symbols;
|
const LIB_SYMBOL_MAP& symbols = m_cache->m_symbols;
|
||||||
|
|
||||||
for( LIB_PART_MAP::const_iterator it = symbols.begin(); it != symbols.end(); ++it )
|
for( LIB_SYMBOL_MAP::const_iterator it = symbols.begin(); it != symbols.end(); ++it )
|
||||||
{
|
{
|
||||||
if( !powerSymbolsOnly || it->second->IsPower() )
|
if( !powerSymbolsOnly || it->second->IsPower() )
|
||||||
aSymbolNameList.Add( it->first );
|
aSymbolNameList.Add( it->first );
|
||||||
|
@ -4270,7 +4274,7 @@ void SCH_LEGACY_PLUGIN::EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LEGACY_PLUGIN::EnumerateSymbolLib( std::vector<LIB_PART*>& aSymbolList,
|
void SCH_LEGACY_PLUGIN::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
|
||||||
const wxString& aLibraryPath,
|
const wxString& aLibraryPath,
|
||||||
const PROPERTIES* aProperties )
|
const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
|
@ -4281,9 +4285,9 @@ void SCH_LEGACY_PLUGIN::EnumerateSymbolLib( std::vector<LIB_PART*>& aSymbolList,
|
||||||
|
|
||||||
cacheLib( aLibraryPath, aProperties );
|
cacheLib( aLibraryPath, aProperties );
|
||||||
|
|
||||||
const LIB_PART_MAP& symbols = m_cache->m_symbols;
|
const LIB_SYMBOL_MAP& symbols = m_cache->m_symbols;
|
||||||
|
|
||||||
for( LIB_PART_MAP::const_iterator it = symbols.begin(); it != symbols.end(); ++it )
|
for( LIB_SYMBOL_MAP::const_iterator it = symbols.begin(); it != symbols.end(); ++it )
|
||||||
{
|
{
|
||||||
if( !powerSymbolsOnly || it->second->IsPower() )
|
if( !powerSymbolsOnly || it->second->IsPower() )
|
||||||
aSymbolList.push_back( it->second );
|
aSymbolList.push_back( it->second );
|
||||||
|
@ -4291,14 +4295,15 @@ void SCH_LEGACY_PLUGIN::EnumerateSymbolLib( std::vector<LIB_PART*>& aSymbolList,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SCH_LEGACY_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
LIB_SYMBOL* SCH_LEGACY_PLUGIN::LoadSymbol( const wxString& aLibraryPath,
|
||||||
const PROPERTIES* aProperties )
|
const wxString& aSymbolName,
|
||||||
|
const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
cacheLib( aLibraryPath, aProperties );
|
cacheLib( aLibraryPath, aProperties );
|
||||||
|
|
||||||
LIB_PART_MAP::const_iterator it = m_cache->m_symbols.find( aSymbolName );
|
LIB_SYMBOL_MAP::const_iterator it = m_cache->m_symbols.find( aSymbolName );
|
||||||
|
|
||||||
if( it == m_cache->m_symbols.end() )
|
if( it == m_cache->m_symbols.end() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -4307,7 +4312,7 @@ LIB_PART* SCH_LEGACY_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wxS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LEGACY_PLUGIN::SaveSymbol( const wxString& aLibraryPath, const LIB_PART* aSymbol,
|
void SCH_LEGACY_PLUGIN::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
||||||
const PROPERTIES* aProperties )
|
const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
@ -4422,16 +4427,16 @@ bool SCH_LEGACY_PLUGIN::IsSymbolLibWritable( const wxString& aLibraryPath )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SCH_LEGACY_PLUGIN::ParsePart( LINE_READER& reader, int aMajorVersion,
|
LIB_SYMBOL* SCH_LEGACY_PLUGIN::ParsePart( LINE_READER& reader, int aMajorVersion,
|
||||||
int aMinorVersion )
|
int aMinorVersion )
|
||||||
{
|
{
|
||||||
return SCH_LEGACY_PLUGIN_CACHE::LoadPart( reader, aMajorVersion, aMinorVersion );
|
return SCH_LEGACY_PLUGIN_CACHE::LoadPart( reader, aMajorVersion, aMinorVersion );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LEGACY_PLUGIN::FormatPart( LIB_PART* part, OUTPUTFORMATTER & formatter )
|
void SCH_LEGACY_PLUGIN::FormatPart( LIB_SYMBOL* symbol, OUTPUTFORMATTER & formatter )
|
||||||
{
|
{
|
||||||
SCH_LEGACY_PLUGIN_CACHE::SaveSymbol( part, formatter );
|
SCH_LEGACY_PLUGIN_CACHE::SaveSymbol( symbol, formatter );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class SCH_FIELD;
|
||||||
class PROPERTIES;
|
class PROPERTIES;
|
||||||
class SELECTION;
|
class SELECTION;
|
||||||
class SCH_LEGACY_PLUGIN_CACHE;
|
class SCH_LEGACY_PLUGIN_CACHE;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class PART_LIB;
|
class PART_LIB;
|
||||||
class BUS_ALIAS;
|
class BUS_ALIAS;
|
||||||
|
|
||||||
|
@ -114,12 +114,12 @@ public:
|
||||||
void EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
void EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
||||||
const wxString& aLibraryPath,
|
const wxString& aLibraryPath,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
void EnumerateSymbolLib( std::vector<LIB_PART*>& aSymbolList,
|
void EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
|
||||||
const wxString& aLibraryPath,
|
const wxString& aLibraryPath,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
LIB_PART* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
LIB_SYMBOL* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
void SaveSymbol( const wxString& aLibraryPath, const LIB_PART* aSymbol,
|
void SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
void DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
void DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
||||||
const PROPERTIES* aProperties = nullptr ) override;
|
const PROPERTIES* aProperties = nullptr ) override;
|
||||||
|
@ -135,8 +135,9 @@ public:
|
||||||
|
|
||||||
const wxString& GetError() const override { return m_error; }
|
const wxString& GetError() const override { return m_error; }
|
||||||
|
|
||||||
static LIB_PART* ParsePart( LINE_READER& aReader, int majorVersion = 0, int minorVersion = 0 );
|
static LIB_SYMBOL* ParsePart( LINE_READER& aReader, int majorVersion = 0,
|
||||||
static void FormatPart( LIB_PART* aPart, OUTPUTFORMATTER& aFormatter );
|
int minorVersion = 0 );
|
||||||
|
static void FormatPart( LIB_SYMBOL* aSymbol, OUTPUTFORMATTER& aFormatter );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadHierarchy( SCH_SHEET* aSheet );
|
void loadHierarchy( SCH_SHEET* aSheet );
|
||||||
|
|
|
@ -57,11 +57,11 @@ public:
|
||||||
m_sheetNum = 0;
|
m_sheetNum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_PART* aLibPart, const SCH_SHEET_PATH& aSheetPath );
|
SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_SYMBOL* aLibSymbol, const SCH_SHEET_PATH& aSheetPath );
|
||||||
|
|
||||||
SCH_SYMBOL* GetSymbol() const { return m_rootSymbol; }
|
SCH_SYMBOL* GetSymbol() const { return m_rootSymbol; }
|
||||||
|
|
||||||
LIB_PART* GetLibPart() const { return m_libPart; }
|
LIB_SYMBOL* GetLibPart() const { return m_libPart; }
|
||||||
|
|
||||||
const SCH_SHEET_PATH& GetSheetPath() const { return m_sheetPath; }
|
const SCH_SHEET_PATH& GetSheetPath() const { return m_sheetPath; }
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ public:
|
||||||
wxString GetFullRef()
|
wxString GetFullRef()
|
||||||
{
|
{
|
||||||
if( GetSymbol()->GetUnitCount() > 1 )
|
if( GetSymbol()->GetUnitCount() > 1 )
|
||||||
return GetRef() + LIB_PART::SubReference( GetUnit() );
|
return GetRef() + LIB_SYMBOL::SubReference( GetUnit() );
|
||||||
else
|
else
|
||||||
return GetRef();
|
return GetRef();
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ private:
|
||||||
/// Symbol reference prefix, without number (for IC1, this is IC) )
|
/// Symbol reference prefix, without number (for IC1, this is IC) )
|
||||||
UTF8 m_ref; // it's private, use the accessors please
|
UTF8 m_ref; // it's private, use the accessors please
|
||||||
SCH_SYMBOL* m_rootSymbol; ///< The symbol associated the reference object.
|
SCH_SYMBOL* m_rootSymbol; ///< The symbol associated the reference object.
|
||||||
LIB_PART* m_libPart; ///< The source symbol from a library.
|
LIB_SYMBOL* m_libPart; ///< The source symbol from a library.
|
||||||
wxPoint m_symbolPos; ///< The physical position of the symbol in schematic
|
wxPoint m_symbolPos; ///< The physical position of the symbol in schematic
|
||||||
///< used to annotate by X or Y position
|
///< used to annotate by X or Y position
|
||||||
int m_unit; ///< The unit number for symbol with multiple parts
|
int m_unit; ///< The unit number for symbol with multiple parts
|
||||||
|
|
|
@ -161,7 +161,7 @@ void SCH_SCREEN::Append( SCH_ITEM* aItem )
|
||||||
if( it == m_libSymbols.end() || !it->second )
|
if( it == m_libSymbols.end() || !it->second )
|
||||||
{
|
{
|
||||||
m_libSymbols[symbol->GetSchSymbolLibraryName()] =
|
m_libSymbols[symbol->GetSchSymbolLibraryName()] =
|
||||||
new LIB_PART( *symbol->GetPartRef() );
|
new LIB_SYMBOL( *symbol->GetPartRef() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -169,7 +169,7 @@ void SCH_SCREEN::Append( SCH_ITEM* aItem )
|
||||||
// it was added to the schematic. If it has changed, then a new name
|
// it was added to the schematic. If it has changed, then a new name
|
||||||
// must be created for the library symbol list to prevent all of the
|
// must be created for the library symbol list to prevent all of the
|
||||||
// other schematic symbols referencing that library symbol from changing.
|
// other schematic symbols referencing that library symbol from changing.
|
||||||
LIB_PART* foundSymbol = it->second;
|
LIB_SYMBOL* foundSymbol = it->second;
|
||||||
|
|
||||||
foundSymbol->GetDrawItems().sort();
|
foundSymbol->GetDrawItems().sort();
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ void SCH_SCREEN::Append( SCH_ITEM* aItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
symbol->SetSchSymbolLibraryName( newName );
|
symbol->SetSchSymbolLibraryName( newName );
|
||||||
m_libSymbols[newName] = new LIB_PART( *symbol->GetPartRef() );
|
m_libSymbols[newName] = new LIB_SYMBOL( *symbol->GetPartRef() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -540,7 +540,7 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter )
|
||||||
wxCHECK_RET( Schematic(), "Cannot call SCH_SCREEN::UpdateSymbolLinks with no SCHEMATIC" );
|
wxCHECK_RET( Schematic(), "Cannot call SCH_SCREEN::UpdateSymbolLinks with no SCHEMATIC" );
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
std::unique_ptr< LIB_PART > libSymbol;
|
std::unique_ptr< LIB_SYMBOL > libSymbol;
|
||||||
std::vector<SCH_SYMBOL*> symbols;
|
std::vector<SCH_SYMBOL*> symbols;
|
||||||
SYMBOL_LIB_TABLE* libs = Schematic()->Prj().SchSymbolLibTable();
|
SYMBOL_LIB_TABLE* libs = Schematic()->Prj().SchSymbolLibTable();
|
||||||
|
|
||||||
|
@ -559,7 +559,7 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter )
|
||||||
|
|
||||||
for( auto symbol : symbols )
|
for( auto symbol : symbols )
|
||||||
{
|
{
|
||||||
LIB_PART* tmp = nullptr;
|
LIB_SYMBOL* tmp = nullptr;
|
||||||
libSymbol.reset();
|
libSymbol.reset();
|
||||||
|
|
||||||
// If the symbol is already in the internal library, map the symbol to it.
|
// If the symbol is already in the internal library, map the symbol to it.
|
||||||
|
@ -578,7 +578,7 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal library symbols are already flattened so just make a copy.
|
// Internal library symbols are already flattened so just make a copy.
|
||||||
symbol->SetLibSymbol( new LIB_PART( *it->second ) );
|
symbol->SetLibSymbol( new LIB_SYMBOL( *it->second ) );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,7 +658,7 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter )
|
||||||
libSymbol->SetParent();
|
libSymbol->SetParent();
|
||||||
|
|
||||||
m_libSymbols.insert( { symbol->GetSchSymbolLibraryName(),
|
m_libSymbols.insert( { symbol->GetSchSymbolLibraryName(),
|
||||||
new LIB_PART( *libSymbol.get() ) } );
|
new LIB_SYMBOL( *libSymbol.get() ) } );
|
||||||
|
|
||||||
if( aReporter )
|
if( aReporter )
|
||||||
{
|
{
|
||||||
|
@ -704,10 +704,10 @@ void SCH_SCREEN::UpdateLocalLibSymbolLinks()
|
||||||
|
|
||||||
auto it = m_libSymbols.find( symbol->GetSchSymbolLibraryName() );
|
auto it = m_libSymbols.find( symbol->GetSchSymbolLibraryName() );
|
||||||
|
|
||||||
LIB_PART* libSymbol = nullptr;
|
LIB_SYMBOL* libSymbol = nullptr;
|
||||||
|
|
||||||
if( it != m_libSymbols.end() )
|
if( it != m_libSymbols.end() )
|
||||||
libSymbol = new LIB_PART( *it->second );
|
libSymbol = new LIB_SYMBOL( *it->second );
|
||||||
|
|
||||||
symbol->SetLibSymbol( libSymbol );
|
symbol->SetLibSymbol( libSymbol );
|
||||||
|
|
||||||
|
@ -1048,7 +1048,7 @@ SCH_TEXT* SCH_SCREEN::GetLabel( const wxPoint& aPosition, int aAccuracy ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SCREEN::AddLibSymbol( LIB_PART* aLibSymbol )
|
void SCH_SCREEN::AddLibSymbol( LIB_SYMBOL* aLibSymbol )
|
||||||
{
|
{
|
||||||
wxCHECK( aLibSymbol, /* void */ );
|
wxCHECK( aLibSymbol, /* void */ );
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
|
|
||||||
class BUS_ALIAS;
|
class BUS_ALIAS;
|
||||||
class EDA_ITEM;
|
class EDA_ITEM;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class LIB_PIN;
|
class LIB_PIN;
|
||||||
class SCH_SYMBOL;
|
class SCH_SYMBOL;
|
||||||
class SCH_LINE;
|
class SCH_LINE;
|
||||||
|
@ -203,7 +203,7 @@ public:
|
||||||
KICAD_T aType = SCH_LOCATE_ANY_T ) const;
|
KICAD_T aType = SCH_LOCATE_ANY_T ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the #LIB_PART reference for each #SCH_SYMBOL found in this schematic
|
* Initialize the #LIB_SYMBOL reference for each #SCH_SYMBOL found in this schematic
|
||||||
* from the project #SYMBOL_LIB_TABLE.
|
* from the project #SYMBOL_LIB_TABLE.
|
||||||
*
|
*
|
||||||
* Symbol library links are set using the symbol library table and will fall back to
|
* Symbol library links are set using the symbol library table and will fall back to
|
||||||
|
@ -220,7 +220,7 @@ public:
|
||||||
void UpdateSymbolLinks( REPORTER* aReporter = nullptr );
|
void UpdateSymbolLinks( REPORTER* aReporter = nullptr );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the #LIB_PART reference for each #SCH_SYMBOL found in this schematic
|
* Initialize the #LIB_SYMBOL reference for each #SCH_SYMBOL found in this schematic
|
||||||
* with the local project library symbols.
|
* with the local project library symbols.
|
||||||
*/
|
*/
|
||||||
void UpdateLocalLibSymbolLinks();
|
void UpdateLocalLibSymbolLinks();
|
||||||
|
@ -410,13 +410,13 @@ public:
|
||||||
SCH_TEXT* GetLabel( const wxPoint& aPosition, int aAccuracy = 0 ) const;
|
SCH_TEXT* GetLabel( const wxPoint& aPosition, int aAccuracy = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch a list of unique #LIB_PART object pointers required to properly render each
|
* Fetch a list of unique #LIB_SYMBOL object pointers required to properly render each
|
||||||
* #SCH_SYMBOL in this schematic.
|
* #SCH_SYMBOL in this schematic.
|
||||||
*
|
*
|
||||||
* @return The list of unique #LIB_PART object pointers.
|
* @return The list of unique #LIB_SYMBOL object pointers.
|
||||||
*/
|
*/
|
||||||
std::map<wxString, LIB_PART*>& GetLibSymbols() { return m_libSymbols; }
|
std::map<wxString, LIB_SYMBOL*>& GetLibSymbols() { return m_libSymbols; }
|
||||||
const std::map<wxString, LIB_PART*>& GetLibSymbols() const { return m_libSymbols; }
|
const std::map<wxString, LIB_SYMBOL*>& GetLibSymbols() const { return m_libSymbols; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add \a aLibSymbol to the library symbol map.
|
* Add \a aLibSymbol to the library symbol map.
|
||||||
|
@ -425,9 +425,9 @@ public:
|
||||||
* mapped, the existing symbol is replaced with \a aLibSymbol. The screen object takes
|
* mapped, the existing symbol is replaced with \a aLibSymbol. The screen object takes
|
||||||
* ownership of the pointer.
|
* ownership of the pointer.
|
||||||
*
|
*
|
||||||
* @param aLibSymbol A pointer the #LIB_PART to be added to the symbol map.
|
* @param aLibSymbol A pointer the #LIB_SYMBOL to be added to the symbol map.
|
||||||
*/
|
*/
|
||||||
void AddLibSymbol( LIB_PART* aLibSymbol );
|
void AddLibSymbol( LIB_SYMBOL* aLibSymbol );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a bus alias definition (and transfers ownership of the pointer).
|
* Add a bus alias definition (and transfers ownership of the pointer).
|
||||||
|
@ -510,7 +510,7 @@ private:
|
||||||
std::unordered_set< std::shared_ptr< BUS_ALIAS > > m_aliases;
|
std::unordered_set< std::shared_ptr< BUS_ALIAS > > m_aliases;
|
||||||
|
|
||||||
/// Library symbols required for this schematic.
|
/// Library symbols required for this schematic.
|
||||||
std::map<wxString, LIB_PART*> m_libSymbols;
|
std::map<wxString, LIB_SYMBOL*> m_libSymbols;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of symbol instances loaded from the schematic file.
|
* The list of symbol instances loaded from the schematic file.
|
||||||
|
@ -601,7 +601,7 @@ public:
|
||||||
void DeleteMarker( SCH_MARKER* aMarker );
|
void DeleteMarker( SCH_MARKER* aMarker );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the #LIB_PART reference for each #SCH_SYMBOL found in the full schematic.
|
* Initialize the #LIB_SYMBOL reference for each #SCH_SYMBOL found in the full schematic.
|
||||||
*
|
*
|
||||||
* @note This should only be called when the user specifically requests all library symbol
|
* @note This should only be called when the user specifically requests all library symbol
|
||||||
* links to be update or when the legacy schematic is opened for the last time. All
|
* links to be update or when the legacy schematic is opened for the last time. All
|
||||||
|
|
|
@ -317,11 +317,11 @@ void SCH_SHEET_PATH::AppendSymbol( SCH_REFERENCE_LIST& aReferences, SCH_SYMBOL*
|
||||||
// affects power symbols.
|
// affects power symbols.
|
||||||
if( aIncludePowerSymbols || aSymbol->GetRef( this )[0] != wxT( '#' ) )
|
if( aIncludePowerSymbols || aSymbol->GetRef( this )[0] != wxT( '#' ) )
|
||||||
{
|
{
|
||||||
LIB_PART* part = aSymbol->GetPartRef().get();
|
LIB_SYMBOL* symbol = aSymbol->GetPartRef().get();
|
||||||
|
|
||||||
if( part || aForceIncludeOrphanSymbols )
|
if( symbol || aForceIncludeOrphanSymbols )
|
||||||
{
|
{
|
||||||
SCH_REFERENCE schReference( aSymbol, part, *this );
|
SCH_REFERENCE schReference( aSymbol, symbol, *this );
|
||||||
|
|
||||||
schReference.SetSheetNumber( m_virtualPageNumber );
|
schReference.SetSheetNumber( m_virtualPageNumber );
|
||||||
aReferences.AddItem( schReference );
|
aReferences.AddItem( schReference );
|
||||||
|
@ -350,11 +350,11 @@ void SCH_SHEET_PATH::AppendMultiUnitSymbol( SCH_MULTI_UNIT_REFERENCE_MAP& aRefLi
|
||||||
if( !aIncludePowerSymbols && aSymbol->GetRef( this )[0] == wxT( '#' ) )
|
if( !aIncludePowerSymbols && aSymbol->GetRef( this )[0] == wxT( '#' ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LIB_PART* part = aSymbol->GetPartRef().get();
|
LIB_SYMBOL* symbol = aSymbol->GetPartRef().get();
|
||||||
|
|
||||||
if( part && part->GetUnitCount() > 1 )
|
if( symbol && symbol->GetUnitCount() > 1 )
|
||||||
{
|
{
|
||||||
SCH_REFERENCE schReference = SCH_REFERENCE( aSymbol, part, *this );
|
SCH_REFERENCE schReference = SCH_REFERENCE( aSymbol, symbol, *this );
|
||||||
schReference.SetSheetNumber( m_virtualPageNumber );
|
schReference.SetSheetNumber( m_virtualPageNumber );
|
||||||
wxString reference_str = schReference.GetRef();
|
wxString reference_str = schReference.GetRef();
|
||||||
|
|
||||||
|
@ -716,11 +716,11 @@ void SCH_SHEET_LIST::AnnotatePowerSymbols()
|
||||||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||||
{
|
{
|
||||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||||
LIB_PART* part = symbol->GetPartRef().get();
|
LIB_SYMBOL* libSymbol = symbol->GetPartRef().get();
|
||||||
|
|
||||||
if( part && part->IsPower() )
|
if( libSymbol && libSymbol->IsPower() )
|
||||||
{
|
{
|
||||||
SCH_REFERENCE schReference( symbol, part, sheet );
|
SCH_REFERENCE schReference( symbol, libSymbol, sheet );
|
||||||
references.AddItem( schReference );
|
references.AddItem( schReference );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -750,7 +750,6 @@ void SCH_SHEET_LIST::AnnotatePowerSymbols()
|
||||||
references[ii].SetRef( curr_ref );
|
references[ii].SetRef( curr_ref );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Break full symbol reference into name (prefix) and number:
|
// Break full symbol reference into name (prefix) and number:
|
||||||
// example: IC1 become IC, and 1
|
// example: IC1 become IC, and 1
|
||||||
references.SplitReferences();
|
references.SplitReferences();
|
||||||
|
|
|
@ -55,7 +55,7 @@ std::string toUTFTildaText( const wxString& txt )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to draw a dummy shape when a LIB_PART is not found in library
|
* Used to draw a dummy shape when a LIB_SYMBOL is not found in library
|
||||||
*
|
*
|
||||||
* This symbol is a 400 mils square with the text "??"
|
* This symbol is a 400 mils square with the text "??"
|
||||||
* DEF DUMMY U 0 40 Y Y 1 0 N
|
* DEF DUMMY U 0 40 Y Y 1 0 N
|
||||||
|
@ -67,29 +67,29 @@ std::string toUTFTildaText( const wxString& txt )
|
||||||
* ENDDRAW
|
* ENDDRAW
|
||||||
* ENDDEF
|
* ENDDEF
|
||||||
*/
|
*/
|
||||||
static LIB_PART* dummy()
|
static LIB_SYMBOL* dummy()
|
||||||
{
|
{
|
||||||
static LIB_PART* part;
|
static LIB_SYMBOL* symbol;
|
||||||
|
|
||||||
if( !part )
|
if( !symbol )
|
||||||
{
|
{
|
||||||
part = new LIB_PART( wxEmptyString );
|
symbol = new LIB_SYMBOL( wxEmptyString );
|
||||||
|
|
||||||
LIB_RECTANGLE* square = new LIB_RECTANGLE( part );
|
LIB_RECTANGLE* square = new LIB_RECTANGLE( symbol );
|
||||||
|
|
||||||
square->MoveTo( wxPoint( Mils2iu( -200 ), Mils2iu( 200 ) ) );
|
square->MoveTo( wxPoint( Mils2iu( -200 ), Mils2iu( 200 ) ) );
|
||||||
square->SetEndPosition( wxPoint( Mils2iu( 200 ), Mils2iu( -200 ) ) );
|
square->SetEndPosition( wxPoint( Mils2iu( 200 ), Mils2iu( -200 ) ) );
|
||||||
|
|
||||||
LIB_TEXT* text = new LIB_TEXT( part );
|
LIB_TEXT* text = new LIB_TEXT( symbol );
|
||||||
|
|
||||||
text->SetTextSize( wxSize( Mils2iu( 150 ), Mils2iu( 150 ) ) );
|
text->SetTextSize( wxSize( Mils2iu( 150 ), Mils2iu( 150 ) ) );
|
||||||
text->SetText( wxString( wxT( "??" ) ) );
|
text->SetText( wxString( wxT( "??" ) ) );
|
||||||
|
|
||||||
part->AddDrawItem( square );
|
symbol->AddDrawItem( square );
|
||||||
part->AddDrawItem( text );
|
symbol->AddDrawItem( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
return part;
|
return symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,8 +100,8 @@ SCH_SYMBOL::SCH_SYMBOL( const wxPoint& aPos, SCH_ITEM* aParent ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SYMBOL::SCH_SYMBOL( const LIB_PART& aPart, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
|
SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId,
|
||||||
int unit, int convert, const wxPoint& pos ) :
|
const SCH_SHEET_PATH* aSheet, int unit, int convert, const wxPoint& pos ) :
|
||||||
SCH_ITEM( NULL, SCH_SYMBOL_T )
|
SCH_ITEM( NULL, SCH_SYMBOL_T )
|
||||||
{
|
{
|
||||||
Init( pos );
|
Init( pos );
|
||||||
|
@ -110,9 +110,9 @@ SCH_SYMBOL::SCH_SYMBOL( const LIB_PART& aPart, const LIB_ID& aLibId, const SCH_S
|
||||||
m_convert = convert;
|
m_convert = convert;
|
||||||
m_lib_id = aLibId;
|
m_lib_id = aLibId;
|
||||||
|
|
||||||
std::unique_ptr< LIB_PART > part;
|
std::unique_ptr< LIB_SYMBOL > part;
|
||||||
|
|
||||||
part = aPart.Flatten();
|
part = aSymbol.Flatten();
|
||||||
part->SetParent();
|
part->SetParent();
|
||||||
SetLibSymbol( part.release() );
|
SetLibSymbol( part.release() );
|
||||||
|
|
||||||
|
@ -130,14 +130,14 @@ SCH_SYMBOL::SCH_SYMBOL( const LIB_PART& aPart, const LIB_ID& aLibId, const SCH_S
|
||||||
SetRef( aSheet, UTIL::GetRefDesUnannotated( m_prefix ) );
|
SetRef( aSheet, UTIL::GetRefDesUnannotated( m_prefix ) );
|
||||||
|
|
||||||
// Inherit the include in bill of materials and board netlist settings from library symbol.
|
// Inherit the include in bill of materials and board netlist settings from library symbol.
|
||||||
m_inBom = aPart.GetIncludeInBom();
|
m_inBom = aSymbol.GetIncludeInBom();
|
||||||
m_onBoard = aPart.GetIncludeOnBoard();
|
m_onBoard = aSymbol.GetIncludeOnBoard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SYMBOL::SCH_SYMBOL( const LIB_PART& aPart, const SCH_SHEET_PATH* aSheet,
|
SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet,
|
||||||
const PICKED_SYMBOL& aSel, const wxPoint& pos ) :
|
const PICKED_SYMBOL& aSel, const wxPoint& pos ) :
|
||||||
SCH_SYMBOL( aPart, aSel.LibId, aSheet, aSel.Unit, aSel.Convert, pos )
|
SCH_SYMBOL( aSymbol, aSel.LibId, aSheet, aSel.Unit, aSel.Convert, pos )
|
||||||
{
|
{
|
||||||
// Set any fields that were modified as part of the symbol selection
|
// Set any fields that were modified as part of the symbol selection
|
||||||
for( const std::pair<int, wxString>& i : aSel.Fields )
|
for( const std::pair<int, wxString>& i : aSel.Fields )
|
||||||
|
@ -163,7 +163,7 @@ SCH_SYMBOL::SCH_SYMBOL( const SCH_SYMBOL& aSymbol ) :
|
||||||
m_onBoard = aSymbol.m_onBoard;
|
m_onBoard = aSymbol.m_onBoard;
|
||||||
|
|
||||||
if( aSymbol.m_part )
|
if( aSymbol.m_part )
|
||||||
SetLibSymbol( new LIB_PART( *aSymbol.m_part.get() ) );
|
SetLibSymbol( new LIB_SYMBOL( *aSymbol.m_part.get() ) );
|
||||||
|
|
||||||
const_cast<KIID&>( m_Uuid ) = aSymbol.m_Uuid;
|
const_cast<KIID&>( m_Uuid ) = aSymbol.m_Uuid;
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ wxString SCH_SYMBOL::GetSchSymbolLibraryName() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SYMBOL::SetLibSymbol( LIB_PART* aLibSymbol )
|
void SCH_SYMBOL::SetLibSymbol( LIB_SYMBOL* aLibSymbol )
|
||||||
{
|
{
|
||||||
wxCHECK2( ( aLibSymbol == nullptr ) || ( aLibSymbol->IsRoot() ), aLibSymbol = nullptr );
|
wxCHECK2( ( aLibSymbol == nullptr ) || ( aLibSymbol->IsRoot() ), aLibSymbol = nullptr );
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@ const wxString SCH_SYMBOL::GetRef( const SCH_SHEET_PATH* sheet, bool aIncludeUni
|
||||||
ref = UTIL::GetRefDesUnannotated( m_prefix );
|
ref = UTIL::GetRefDesUnannotated( m_prefix );
|
||||||
|
|
||||||
if( aIncludeUnit && GetUnitCount() > 1 )
|
if( aIncludeUnit && GetUnitCount() > 1 )
|
||||||
ref += LIB_PART::SubReference( GetUnit() );
|
ref += LIB_SYMBOL::SubReference( GetUnit() );
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
@ -887,10 +887,10 @@ void SCH_SYMBOL::SwapData( SCH_ITEM* aItem )
|
||||||
|
|
||||||
std::swap( m_lib_id, symbol->m_lib_id );
|
std::swap( m_lib_id, symbol->m_lib_id );
|
||||||
|
|
||||||
LIB_PART* part = symbol->m_part.release();
|
LIB_SYMBOL* libSymbol = symbol->m_part.release();
|
||||||
symbol->m_part.reset( m_part.release() );
|
symbol->m_part.reset( m_part.release() );
|
||||||
symbol->UpdatePins();
|
symbol->UpdatePins();
|
||||||
m_part.reset( part );
|
m_part.reset( libSymbol );
|
||||||
UpdatePins();
|
UpdatePins();
|
||||||
|
|
||||||
std::swap( m_pos, symbol->m_pos );
|
std::swap( m_pos, symbol->m_pos );
|
||||||
|
@ -997,7 +997,7 @@ bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth ) const
|
||||||
else
|
else
|
||||||
unit = GetUnit();
|
unit = GetUnit();
|
||||||
|
|
||||||
*token = LIB_PART::SubReference( unit );
|
*token = LIB_SYMBOL::SubReference( unit );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1371,7 +1371,7 @@ void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList
|
||||||
{
|
{
|
||||||
msg = _( "Missing parent" );
|
msg = _( "Missing parent" );
|
||||||
|
|
||||||
std::shared_ptr< LIB_PART > parent = m_part->GetParent().lock();
|
std::shared_ptr< LIB_SYMBOL > parent = m_part->GetParent().lock();
|
||||||
|
|
||||||
if( parent )
|
if( parent )
|
||||||
msg = parent->GetName();
|
msg = parent->GetName();
|
||||||
|
@ -1745,7 +1745,7 @@ SCH_SYMBOL& SCH_SYMBOL::operator=( const SCH_ITEM& aItem )
|
||||||
|
|
||||||
m_lib_id = c->m_lib_id;
|
m_lib_id = c->m_lib_id;
|
||||||
|
|
||||||
LIB_PART* libSymbol = c->m_part ? new LIB_PART( *c->m_part.get() ) : nullptr;
|
LIB_SYMBOL* libSymbol = c->m_part ? new LIB_SYMBOL( *c->m_part.get() ) : nullptr;
|
||||||
|
|
||||||
m_part.reset( libSymbol );
|
m_part.reset( libSymbol );
|
||||||
m_pos = c->m_pos;
|
m_pos = c->m_pos;
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct PICKED_SYMBOL;
|
||||||
class SCH_SCREEN;
|
class SCH_SCREEN;
|
||||||
class LIB_ITEM;
|
class LIB_ITEM;
|
||||||
class LIB_PIN;
|
class LIB_PIN;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class NETLIST_OBJECT_LIST;
|
class NETLIST_OBJECT_LIST;
|
||||||
class PART_LIB;
|
class PART_LIB;
|
||||||
class PART_LIBS;
|
class PART_LIBS;
|
||||||
|
@ -66,7 +66,7 @@ class SYMBOL_LIB_TABLE;
|
||||||
/// A container for several SCH_FIELD items
|
/// A container for several SCH_FIELD items
|
||||||
typedef std::vector<SCH_FIELD> SCH_FIELDS;
|
typedef std::vector<SCH_FIELD> SCH_FIELDS;
|
||||||
|
|
||||||
typedef std::weak_ptr<LIB_PART> PART_REF;
|
typedef std::weak_ptr<LIB_SYMBOL> PART_REF;
|
||||||
|
|
||||||
|
|
||||||
extern std::string toUTFTildaText( const wxString& txt );
|
extern std::string toUTFTildaText( const wxString& txt );
|
||||||
|
@ -91,10 +91,10 @@ public:
|
||||||
* @param pos is the position of the symbol.
|
* @param pos is the position of the symbol.
|
||||||
* @param setNewItemFlag is used to set the symbol #IS_NEW and #IS_MOVING flags.
|
* @param setNewItemFlag is used to set the symbol #IS_NEW and #IS_MOVING flags.
|
||||||
*/
|
*/
|
||||||
SCH_SYMBOL( const LIB_PART& aPart, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
|
SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
|
||||||
int unit = 0, int convert = 0, const wxPoint& pos = wxPoint( 0, 0 ) );
|
int unit = 0, int convert = 0, const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
SCH_SYMBOL( const LIB_PART& aPart, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
|
SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
|
||||||
const wxPoint& pos = wxPoint( 0, 0 ) );
|
const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,26 +161,26 @@ public:
|
||||||
wxString GetSchSymbolLibraryName() const;
|
wxString GetSchSymbolLibraryName() const;
|
||||||
bool UseLibIdLookup() const { return m_schLibSymbolName.IsEmpty(); }
|
bool UseLibIdLookup() const { return m_schLibSymbolName.IsEmpty(); }
|
||||||
|
|
||||||
std::unique_ptr< LIB_PART >& GetPartRef() { return m_part; }
|
std::unique_ptr< LIB_SYMBOL >& GetPartRef() { return m_part; }
|
||||||
const std::unique_ptr< LIB_PART >& GetPartRef() const { return m_part; }
|
const std::unique_ptr< LIB_SYMBOL >& GetPartRef() const { return m_part; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set this schematic symbol library symbol reference to \a aLibSymbol
|
* Set this schematic symbol library symbol reference to \a aLibSymbol
|
||||||
*
|
*
|
||||||
* The schematic symbol object owns \a aLibSymbol and the pin list will be updated
|
* The schematic symbol object owns \a aLibSymbol and the pin list will be updated
|
||||||
* accordingly. The #LIB_PART object can be null to clear the library symbol link
|
* accordingly. The #LIB_SYMBOL object can be null to clear the library symbol link
|
||||||
* as well as the pin map. If the #LIB_PART object is not null, it must be a root
|
* as well as the pin map. If the #LIB_SYMBOL object is not null, it must be a root
|
||||||
* symbol. Otherwise an assertion will be raised in debug builds and the library
|
* symbol. Otherwise an assertion will be raised in debug builds and the library
|
||||||
* symbol will be cleared. The new file format will no longer require a cache
|
* symbol will be cleared. The new file format will no longer require a cache
|
||||||
* library so all library symbols must be valid.
|
* library so all library symbols must be valid.
|
||||||
*
|
*
|
||||||
* @note This is the only way to publicly set the library symbol for a schematic
|
* @note This is the only way to publicly set the library symbol for a schematic
|
||||||
* symbol except for the ctors that take a LIB_PART reference. All previous
|
* symbol except for the ctors that take a LIB_SYMBOL reference. All previous
|
||||||
* public resolvers have been deprecated.
|
* public resolvers have been deprecated.
|
||||||
*
|
*
|
||||||
* @param aLibSymbol is the library symbol to associate with this schematic symbol.
|
* @param aLibSymbol is the library symbol to associate with this schematic symbol.
|
||||||
*/
|
*/
|
||||||
void SetLibSymbol( LIB_PART* aLibSymbol );
|
void SetLibSymbol( LIB_SYMBOL* aLibSymbol );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return information about the aliased parts
|
* Return information about the aliased parts
|
||||||
|
@ -692,7 +692,7 @@ private:
|
||||||
TRANSFORM m_transform; ///< The rotation/mirror transformation matrix.
|
TRANSFORM m_transform; ///< The rotation/mirror transformation matrix.
|
||||||
SCH_FIELDS m_fields; ///< Variable length list of fields.
|
SCH_FIELDS m_fields; ///< Variable length list of fields.
|
||||||
|
|
||||||
std::unique_ptr< LIB_PART > m_part; // a flattened copy of the LIB_PART from
|
std::unique_ptr< LIB_SYMBOL > m_part; // a flattened copy of the LIB_SYMBOL from
|
||||||
// the PROJECT's libraries.
|
// the PROJECT's libraries.
|
||||||
std::vector<std::unique_ptr<SCH_PIN>> m_pins; // a SCH_PIN for every LIB_PIN (all units)
|
std::vector<std::unique_ptr<SCH_PIN>> m_pins; // a SCH_PIN for every LIB_PIN (all units)
|
||||||
std::unordered_map<LIB_PIN*, unsigned> m_pinMap; // library pin pointer to SCH_PIN's index
|
std::unordered_map<LIB_PIN*, unsigned> m_pinMap; // library pin pointer to SCH_PIN's index
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2018 CERN
|
* Copyright (C) 2013-2018 CERN
|
||||||
* Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
|
@ -118,18 +118,18 @@ void SCH_VIEW::DisplaySheet( const SCH_SCREEN *aScreen )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_VIEW::DisplayComponent( LIB_PART* aPart )
|
void SCH_VIEW::DisplayComponent( LIB_SYMBOL* aSymbol )
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
if( !aPart )
|
if( !aSymbol )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::shared_ptr< LIB_PART > parent;
|
std::shared_ptr< LIB_SYMBOL > parent;
|
||||||
LIB_PART* drawnPart = aPart;
|
LIB_SYMBOL* drawnSymbol = aSymbol;
|
||||||
|
|
||||||
// Draw the mandatory fields for aliases and parent symbols.
|
// Draw the mandatory fields for aliases and parent symbols.
|
||||||
for( LIB_ITEM& item : aPart->GetDrawItems() )
|
for( LIB_ITEM& item : aSymbol->GetDrawItems() )
|
||||||
{
|
{
|
||||||
if( item.Type() != LIB_FIELD_T )
|
if( item.Type() != LIB_FIELD_T )
|
||||||
continue;
|
continue;
|
||||||
|
@ -145,20 +145,20 @@ void SCH_VIEW::DisplayComponent( LIB_PART* aPart )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the parent items if the symbol is inherited from another symbol.
|
// Draw the parent items if the symbol is inherited from another symbol.
|
||||||
if( aPart->IsAlias() )
|
if( aSymbol->IsAlias() )
|
||||||
{
|
{
|
||||||
parent = aPart->GetParent().lock();
|
parent = aSymbol->GetParent().lock();
|
||||||
|
|
||||||
wxCHECK( parent, /* void */ );
|
wxCHECK( parent, /* void */ );
|
||||||
|
|
||||||
drawnPart = parent.get();
|
drawnSymbol = parent.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
for( LIB_ITEM& item : drawnPart->GetDrawItems() )
|
for( LIB_ITEM& item : drawnSymbol->GetDrawItems() )
|
||||||
{
|
{
|
||||||
// Don't show parent symbol fields. Users may be confused by shown fields that can not
|
// Don't show parent symbol fields. Users may be confused by shown fields that can not
|
||||||
// be edited.
|
// be edited.
|
||||||
if( aPart->IsAlias() && item.Type() == LIB_FIELD_T )
|
if( aSymbol->IsAlias() && item.Type() == LIB_FIELD_T )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Add( &item );
|
Add( &item );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
class SCH_SHEET;
|
class SCH_SHEET;
|
||||||
class SCH_SCREEN;
|
class SCH_SCREEN;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class LIB_PIN;
|
class LIB_PIN;
|
||||||
class SCH_BASE_FRAME;
|
class SCH_BASE_FRAME;
|
||||||
class DS_PROXY_VIEW_ITEM;
|
class DS_PROXY_VIEW_ITEM;
|
||||||
|
@ -80,7 +80,7 @@ public:
|
||||||
void Cleanup();
|
void Cleanup();
|
||||||
|
|
||||||
void DisplaySheet( const SCH_SCREEN* aScreen );
|
void DisplaySheet( const SCH_SCREEN* aScreen );
|
||||||
void DisplayComponent( LIB_PART* aPart );
|
void DisplayComponent( LIB_SYMBOL* aSymbol );
|
||||||
|
|
||||||
// Call it to set new draw area limits (max working and draw area size)
|
// Call it to set new draw area limits (max working and draw area size)
|
||||||
void ResizeSheetWorkingArea( const SCH_SCREEN *aScreen );
|
void ResizeSheetWorkingArea( const SCH_SCREEN *aScreen );
|
||||||
|
|
|
@ -205,12 +205,12 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
|
||||||
m_params.emplace_back( new PARAM<wxString>( "spice_external_command",
|
m_params.emplace_back( new PARAM<wxString>( "spice_external_command",
|
||||||
&m_SpiceCommandString, "spice \"%I\"" ) );
|
&m_SpiceCommandString, "spice \"%I\"" ) );
|
||||||
|
|
||||||
// TODO(JE) should we keep these LIB_PART:: things around?
|
// TODO(JE) should we keep these LIB_SYMBOL:: things around?
|
||||||
m_params.emplace_back( new PARAM<int>( "subpart_id_separator",
|
m_params.emplace_back( new PARAM<int>( "subpart_id_separator",
|
||||||
LIB_PART::SubpartIdSeparatorPtr(), 0, 0, 126 ) );
|
LIB_SYMBOL::SubpartIdSeparatorPtr(), 0, 0, 126 ) );
|
||||||
|
|
||||||
m_params.emplace_back( new PARAM<int>( "subpart_first_id",
|
m_params.emplace_back( new PARAM<int>( "subpart_first_id",
|
||||||
LIB_PART::SubpartFirstIdPtr(), 'A', '1', 'z' ) );
|
LIB_SYMBOL::SubpartFirstIdPtr(), 'A', '1', 'z' ) );
|
||||||
|
|
||||||
m_NgspiceSimulatorSettings =
|
m_NgspiceSimulatorSettings =
|
||||||
std::make_shared<NGSPICE_SIMULATOR_SETTINGS>( this, "ngspice" );
|
std::make_shared<NGSPICE_SIMULATOR_SETTINGS>( this, "ngspice" );
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
SYMBOL_ASYNC_LOADER::SYMBOL_ASYNC_LOADER( const std::vector<wxString>& aNicknames,
|
SYMBOL_ASYNC_LOADER::SYMBOL_ASYNC_LOADER( const std::vector<wxString>& aNicknames,
|
||||||
SYMBOL_LIB_TABLE* aTable, bool aOnlyPowerSymbols,
|
SYMBOL_LIB_TABLE* aTable, bool aOnlyPowerSymbols,
|
||||||
std::unordered_map<wxString, std::vector<LIB_PART*>>* aOutput,
|
std::unordered_map<wxString, std::vector<LIB_SYMBOL*>>* aOutput,
|
||||||
PROGRESS_REPORTER* aReporter ) :
|
PROGRESS_REPORTER* aReporter ) :
|
||||||
m_nicknames( aNicknames ),
|
m_nicknames( aNicknames ),
|
||||||
m_table( aTable ),
|
m_table( aTable ),
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
|
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class PROGRESS_REPORTER;
|
class PROGRESS_REPORTER;
|
||||||
class SYMBOL_LIB_TABLE;
|
class SYMBOL_LIB_TABLE;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public:
|
||||||
*/
|
*/
|
||||||
SYMBOL_ASYNC_LOADER( const std::vector<wxString>& aNicknames,
|
SYMBOL_ASYNC_LOADER( const std::vector<wxString>& aNicknames,
|
||||||
SYMBOL_LIB_TABLE* aTable, bool aOnlyPowerSymbols = false,
|
SYMBOL_LIB_TABLE* aTable, bool aOnlyPowerSymbols = false,
|
||||||
std::unordered_map<wxString, std::vector<LIB_PART*>>* aOutput = nullptr,
|
std::unordered_map<wxString, std::vector<LIB_SYMBOL*>>* aOutput = nullptr,
|
||||||
PROGRESS_REPORTER* aReporter = nullptr );
|
PROGRESS_REPORTER* aReporter = nullptr );
|
||||||
|
|
||||||
~SYMBOL_ASYNC_LOADER();
|
~SYMBOL_ASYNC_LOADER();
|
||||||
|
@ -74,7 +74,7 @@ public:
|
||||||
const wxString& GetErrors() const { return m_errors; }
|
const wxString& GetErrors() const { return m_errors; }
|
||||||
|
|
||||||
///< Represents a pair of <nickname, loaded parts list>
|
///< Represents a pair of <nickname, loaded parts list>
|
||||||
typedef std::pair<wxString, std::vector<LIB_PART*>> LOADED_PAIR;
|
typedef std::pair<wxString, std::vector<LIB_SYMBOL*>> LOADED_PAIR;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///< Worker job that loads libraries and returns a list of pairs of <nickname, loaded parts>
|
///< Worker job that loads libraries and returns a list of pairs of <nickname, loaded parts>
|
||||||
|
@ -90,7 +90,7 @@ private:
|
||||||
bool m_onlyPowerSymbols;
|
bool m_onlyPowerSymbols;
|
||||||
|
|
||||||
///< Handle to map that will be filled with the loaded parts per library
|
///< Handle to map that will be filled with the loaded parts per library
|
||||||
std::unordered_map<wxString, std::vector<LIB_PART*>>* m_output;
|
std::unordered_map<wxString, std::vector<LIB_SYMBOL*>>* m_output;
|
||||||
|
|
||||||
///< Progress reporter (may be null)
|
///< Progress reporter (may be null)
|
||||||
PROGRESS_REPORTER* m_reporter;
|
PROGRESS_REPORTER* m_reporter;
|
||||||
|
|
|
@ -560,7 +560,7 @@ void SYMBOL_EDIT_FRAME::RebuildSymbolUnitsList()
|
||||||
{
|
{
|
||||||
for( int i = 0; i < m_my_part->GetUnitCount(); i++ )
|
for( int i = 0; i < m_my_part->GetUnitCount(); i++ )
|
||||||
{
|
{
|
||||||
wxString sub = LIB_PART::SubReference( i+1, false );
|
wxString sub = LIB_SYMBOL::SubReference( i+1, false );
|
||||||
wxString unit = wxString::Format( _( "Unit %s" ), sub );
|
wxString unit = wxString::Format( _( "Unit %s" ), sub );
|
||||||
m_unitSelectBox->Append( unit );
|
m_unitSelectBox->Append( unit );
|
||||||
}
|
}
|
||||||
|
@ -675,13 +675,13 @@ wxString SYMBOL_EDIT_FRAME::SetCurLib( const wxString& aLibNickname )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SYMBOL_EDIT_FRAME::SetCurPart( LIB_PART* aPart, bool aUpdateZoom )
|
void SYMBOL_EDIT_FRAME::SetCurPart( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
|
||||||
{
|
{
|
||||||
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
GetCanvas()->GetView()->Clear();
|
GetCanvas()->GetView()->Clear();
|
||||||
delete m_my_part;
|
delete m_my_part;
|
||||||
|
|
||||||
m_my_part = aPart;
|
m_my_part = aSymbol;
|
||||||
|
|
||||||
// select the current symbol in the tree widget
|
// select the current symbol in the tree widget
|
||||||
if( !IsSymbolFromSchematic() && m_my_part )
|
if( !IsSymbolFromSchematic() && m_my_part )
|
||||||
|
@ -695,7 +695,7 @@ void SYMBOL_EDIT_FRAME::SetCurPart( LIB_PART* aPart, bool aUpdateZoom )
|
||||||
Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_PART, partName );
|
Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_PART, partName );
|
||||||
|
|
||||||
// Ensure synchronized pin edit can be enabled only symbols with interchangeable units
|
// Ensure synchronized pin edit can be enabled only symbols with interchangeable units
|
||||||
m_SyncPinEdit = aPart && aPart->IsRoot() && aPart->IsMulti() && !aPart->UnitsLocked();
|
m_SyncPinEdit = aSymbol && aSymbol->IsRoot() && aSymbol->IsMulti() && !aSymbol->UnitsLocked();
|
||||||
|
|
||||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||||
|
|
||||||
|
@ -858,13 +858,13 @@ LIB_ID SYMBOL_EDIT_FRAME::GetTreeLIBID( int* aUnit ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SYMBOL_EDIT_FRAME::getTargetPart() const
|
LIB_SYMBOL* SYMBOL_EDIT_FRAME::getTargetPart() const
|
||||||
{
|
{
|
||||||
LIB_ID libId = GetTreeLIBID();
|
LIB_ID libId = GetTreeLIBID();
|
||||||
|
|
||||||
if( libId.IsValid() )
|
if( libId.IsValid() )
|
||||||
{
|
{
|
||||||
LIB_PART* alias = m_libMgr->GetAlias( libId.GetLibItemName(), libId.GetLibNickname() );
|
LIB_SYMBOL* alias = m_libMgr->GetAlias( libId.GetLibItemName(), libId.GetLibNickname() );
|
||||||
return alias;
|
return alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1051,9 +1051,11 @@ void SYMBOL_EDIT_FRAME::storeCurrentPart()
|
||||||
bool SYMBOL_EDIT_FRAME::isCurrentPart( const LIB_ID& aLibId ) const
|
bool SYMBOL_EDIT_FRAME::isCurrentPart( const LIB_ID& aLibId ) const
|
||||||
{
|
{
|
||||||
// This will return the root part of any alias
|
// This will return the root part of any alias
|
||||||
LIB_PART* part = m_libMgr->GetBufferedPart( aLibId.GetLibItemName(), aLibId.GetLibNickname() );
|
LIB_SYMBOL* symbol = m_libMgr->GetBufferedPart( aLibId.GetLibItemName(),
|
||||||
// Now we can compare the libId of the current part and the root part
|
aLibId.GetLibNickname() );
|
||||||
return ( part && m_my_part && part->GetLibId() == m_my_part->GetLibId() );
|
|
||||||
|
// Now we can compare the libId of the current symbol and the root symbol
|
||||||
|
return ( symbol && m_my_part && symbol->GetLibId() == m_my_part->GetLibId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1234,7 +1236,7 @@ bool SYMBOL_EDIT_FRAME::IsContentModified() const
|
||||||
{
|
{
|
||||||
wxCHECK( m_libMgr, false );
|
wxCHECK( m_libMgr, false );
|
||||||
|
|
||||||
// Test if the currently edited part is modified
|
// Test if the currently edited symbol is modified
|
||||||
if( GetScreen() && GetScreen()->IsContentModified() && GetCurPart() )
|
if( GetScreen() && GetScreen()->IsContentModified() && GetCurPart() )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1274,8 +1276,8 @@ SELECTION& SYMBOL_EDIT_FRAME::GetCurrentSelection()
|
||||||
|
|
||||||
void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
|
void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_PART> part = aSymbol->GetPartRef()->Flatten();
|
std::unique_ptr<LIB_SYMBOL> symbol = aSymbol->GetPartRef()->Flatten();
|
||||||
wxCHECK( part, /* void */ );
|
wxCHECK( symbol, /* void */ );
|
||||||
|
|
||||||
std::vector<LIB_FIELD> fullSetOfFields;
|
std::vector<LIB_FIELD> fullSetOfFields;
|
||||||
|
|
||||||
|
@ -1283,7 +1285,7 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
|
||||||
{
|
{
|
||||||
const SCH_FIELD& field = aSymbol->GetFields()[i];
|
const SCH_FIELD& field = aSymbol->GetFields()[i];
|
||||||
wxPoint pos = field.GetPosition() - aSymbol->GetPosition();
|
wxPoint pos = field.GetPosition() - aSymbol->GetPosition();
|
||||||
LIB_FIELD libField( part.get(), field.GetId() );
|
LIB_FIELD libField( symbol.get(), field.GetId() );
|
||||||
|
|
||||||
if( i >= MANDATORY_FIELDS && !field.GetName( false ).IsEmpty() )
|
if( i >= MANDATORY_FIELDS && !field.GetName( false ).IsEmpty() )
|
||||||
libField.SetName( field.GetName( false ) );
|
libField.SetName( field.GetName( false ) );
|
||||||
|
@ -1295,21 +1297,21 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
|
||||||
fullSetOfFields.emplace_back( std::move( libField ) );
|
fullSetOfFields.emplace_back( std::move( libField ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
part->SetFields( fullSetOfFields );
|
symbol->SetFields( fullSetOfFields );
|
||||||
|
|
||||||
if( m_my_part )
|
if( m_my_part )
|
||||||
SetCurPart( nullptr, false );
|
SetCurPart( nullptr, false );
|
||||||
|
|
||||||
m_isSymbolFromSchematic = true;
|
m_isSymbolFromSchematic = true;
|
||||||
m_reference = part->GetFieldById( REFERENCE_FIELD )->GetText();
|
m_reference = symbol->GetFieldById( REFERENCE_FIELD )->GetText();
|
||||||
m_unit = std::max( 1, aSymbol->GetUnit() );
|
m_unit = std::max( 1, aSymbol->GetUnit() );
|
||||||
m_convert = std::max( 1, aSymbol->GetConvert() );
|
m_convert = std::max( 1, aSymbol->GetConvert() );
|
||||||
|
|
||||||
// The buffered screen for the part
|
// The buffered screen for the symbol
|
||||||
SCH_SCREEN* tmpScreen = new SCH_SCREEN();
|
SCH_SCREEN* tmpScreen = new SCH_SCREEN();
|
||||||
|
|
||||||
SetScreen( tmpScreen );
|
SetScreen( tmpScreen );
|
||||||
SetCurPart( part.release(), true );
|
SetCurPart( symbol.release(), true );
|
||||||
|
|
||||||
ReCreateMenuBar();
|
ReCreateMenuBar();
|
||||||
ReCreateHToolbar();
|
ReCreateHToolbar();
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
class SCH_EDIT_FRAME;
|
class SCH_EDIT_FRAME;
|
||||||
class SYMBOL_LIB_TABLE;
|
class SYMBOL_LIB_TABLE;
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class LIB_FIELD;
|
class LIB_FIELD;
|
||||||
class DIALOG_LIB_EDIT_TEXT;
|
class DIALOG_LIB_EDIT_TEXT;
|
||||||
class SYMBOL_TREE_PANE;
|
class SYMBOL_TREE_PANE;
|
||||||
|
@ -98,14 +98,14 @@ public:
|
||||||
/**
|
/**
|
||||||
* Return the current part being edited or NULL if none selected.
|
* Return the current part being edited or NULL if none selected.
|
||||||
*
|
*
|
||||||
* This is a LIB_PART that I own, it is at best a copy of one in a library.
|
* This is a LIB_SYMBOL that I own, it is at best a copy of one in a library.
|
||||||
*/
|
*/
|
||||||
LIB_PART* GetCurPart() const { return m_my_part; }
|
LIB_SYMBOL* GetCurPart() const { return m_my_part; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take ownership of aPart and notes that it is the one currently being edited.
|
* Take ownership of aSymbol and notes that it is the one currently being edited.
|
||||||
*/
|
*/
|
||||||
void SetCurPart( LIB_PART* aPart, bool aUpdateZoom );
|
void SetCurPart( LIB_SYMBOL* aSymbol, bool aUpdateZoom );
|
||||||
|
|
||||||
SYMBOL_LIBRARY_MANAGER& GetLibManager();
|
SYMBOL_LIBRARY_MANAGER& GetLibManager();
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
|
|
||||||
void CopyPartToClipboard();
|
void CopyPartToClipboard();
|
||||||
|
|
||||||
void LoadPart( const wxString& aLibrary, const wxString& aPart, int Unit );
|
void LoadPart( const wxString& aLibrary, const wxString& aSymbol, int Unit );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a duplicate part.
|
* Insert a duplicate part.
|
||||||
|
@ -420,14 +420,14 @@ private:
|
||||||
/**
|
/**
|
||||||
* Create a copy of \a aLibEntry into memory.
|
* Create a copy of \a aLibEntry into memory.
|
||||||
*
|
*
|
||||||
* @param aLibEntry A pointer to the LIB_PART object to an already loaded symbol.
|
* @param aLibEntry A pointer to the LIB_SYMBOL object to an already loaded symbol.
|
||||||
* @param aLibrary the path to the library file that \a aLibEntry was loaded from. This is
|
* @param aLibrary the path to the library file that \a aLibEntry was loaded from. This is
|
||||||
* for error messaging purposes only.
|
* for error messaging purposes only.
|
||||||
* @param aUnit the initial unit to show.
|
* @param aUnit the initial unit to show.
|
||||||
* @param aConvert the initial DeMorgan variant to show.
|
* @param aConvert the initial DeMorgan variant to show.
|
||||||
* @return True if a copy of \a aLibEntry was successfully copied.
|
* @return True if a copy of \a aLibEntry was successfully copied.
|
||||||
*/
|
*/
|
||||||
bool LoadOneLibraryPartAux( LIB_PART* aLibEntry, const wxString& aLibrary, int aUnit,
|
bool LoadOneLibraryPartAux( LIB_SYMBOL* aLibEntry, const wxString& aLibrary, int aUnit,
|
||||||
int aConvert );
|
int aConvert );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -442,7 +442,7 @@ private:
|
||||||
bool backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt );
|
bool backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt );
|
||||||
|
|
||||||
///< Return currently edited part.
|
///< Return currently edited part.
|
||||||
LIB_PART* getTargetPart() const;
|
LIB_SYMBOL* getTargetPart() const;
|
||||||
|
|
||||||
///< Return either the library selected in the symbol tree, if context menu is active or
|
///< Return either the library selected in the symbol tree, if context menu is active or
|
||||||
///< the library that is currently modified.
|
///< the library that is currently modified.
|
||||||
|
@ -465,8 +465,8 @@ private:
|
||||||
///< Return true if \a aLibId is an alias for the editor screen part.
|
///< Return true if \a aLibId is an alias for the editor screen part.
|
||||||
bool isCurrentPart( const LIB_ID& aLibId ) const;
|
bool isCurrentPart( const LIB_ID& aLibId ) const;
|
||||||
|
|
||||||
///< Rename LIB_PART aliases to avoid conflicts before adding a symbol to a library.
|
///< Rename LIB_SYMBOL aliases to avoid conflicts before adding a symbol to a library.
|
||||||
void ensureUniqueName( LIB_PART* aPart, const wxString& aLibrary );
|
void ensureUniqueName( LIB_SYMBOL* aSymbol, const wxString& aLibrary );
|
||||||
|
|
||||||
enum TABLE_SCOPE
|
enum TABLE_SCOPE
|
||||||
{
|
{
|
||||||
|
@ -527,7 +527,7 @@ private:
|
||||||
///< Helper screen used when no part is loaded
|
///< Helper screen used when no part is loaded
|
||||||
SCH_SCREEN* m_dummyScreen;
|
SCH_SCREEN* m_dummyScreen;
|
||||||
|
|
||||||
LIB_PART* m_my_part; // a part I own, it is not in any library, but a
|
LIB_SYMBOL* m_my_part; // a part I own, it is not in any library, but a
|
||||||
// copy could be.
|
// copy could be.
|
||||||
wxComboBox* m_unitSelectBox; // a ComboBox to select a unit to edit (if the
|
wxComboBox* m_unitSelectBox; // a ComboBox to select a unit to edit (if the
|
||||||
// part has multiple units)
|
// part has multiple units)
|
||||||
|
|
|
@ -271,7 +271,7 @@ bool SYMBOL_EDIT_FRAME::LoadSymbol( const LIB_ID& aLibId, int aUnit, int aConver
|
||||||
bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aAliasName, int aUnit,
|
bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aAliasName, int aUnit,
|
||||||
int aConvert )
|
int aConvert )
|
||||||
{
|
{
|
||||||
LIB_PART* alias = nullptr;
|
LIB_SYMBOL* alias = nullptr;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -304,7 +304,7 @@ bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aAliasName, in
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SYMBOL_EDIT_FRAME::LoadOneLibraryPartAux( LIB_PART* aEntry, const wxString& aLibrary,
|
bool SYMBOL_EDIT_FRAME::LoadOneLibraryPartAux( LIB_SYMBOL* aEntry, const wxString& aLibrary,
|
||||||
int aUnit, int aConvert )
|
int aUnit, int aConvert )
|
||||||
{
|
{
|
||||||
wxString msg, rootName;
|
wxString msg, rootName;
|
||||||
|
@ -334,17 +334,17 @@ bool SYMBOL_EDIT_FRAME::LoadOneLibraryPartAux( LIB_PART* aEntry, const wxString&
|
||||||
rebuildMenuAndToolbar = true;
|
rebuildMenuAndToolbar = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LIB_PART* lib_part = m_libMgr->GetBufferedPart( aEntry->GetName(), aLibrary );
|
LIB_SYMBOL* lib_symbol = m_libMgr->GetBufferedPart( aEntry->GetName(), aLibrary );
|
||||||
wxCHECK( lib_part, false );
|
wxCHECK( lib_symbol, false );
|
||||||
|
|
||||||
m_unit = aUnit > 0 ? aUnit : 1;
|
m_unit = aUnit > 0 ? aUnit : 1;
|
||||||
m_convert = aConvert > 0 ? aConvert : 1;
|
m_convert = aConvert > 0 ? aConvert : 1;
|
||||||
|
|
||||||
// The buffered screen for the part
|
// The buffered screen for the symbol
|
||||||
SCH_SCREEN* part_screen = m_libMgr->GetScreen( lib_part->GetName(), aLibrary );
|
SCH_SCREEN* part_screen = m_libMgr->GetScreen( lib_symbol->GetName(), aLibrary );
|
||||||
|
|
||||||
SetScreen( part_screen );
|
SetScreen( part_screen );
|
||||||
SetCurPart( new LIB_PART( *lib_part ), true );
|
SetCurPart( new LIB_SYMBOL( *lib_symbol ), true );
|
||||||
SetCurLib( aLibrary );
|
SetCurLib( aLibrary );
|
||||||
|
|
||||||
if( rebuildMenuAndToolbar )
|
if( rebuildMenuAndToolbar )
|
||||||
|
@ -406,6 +406,7 @@ void SYMBOL_EDIT_FRAME::CreateNewPart()
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString name = dlg.GetName();
|
wxString name = dlg.GetName();
|
||||||
|
|
||||||
// Currently, symbol names cannot include a space, that breaks libraries:
|
// Currently, symbol names cannot include a space, that breaks libraries:
|
||||||
name.Replace( " ", "_" );
|
name.Replace( " ", "_" );
|
||||||
|
|
||||||
|
@ -418,56 +419,56 @@ void SYMBOL_EDIT_FRAME::CreateNewPart()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LIB_PART new_part( name ); // do not create part on the heap, it will be buffered soon
|
LIB_SYMBOL new_symbol( name ); // do not create symbol on the heap, it will be buffered soon
|
||||||
|
|
||||||
wxString parentSymbolName = dlg.GetParentSymbolName();
|
wxString parentSymbolName = dlg.GetParentSymbolName();
|
||||||
|
|
||||||
if( parentSymbolName.IsEmpty() )
|
if( parentSymbolName.IsEmpty() )
|
||||||
{
|
{
|
||||||
new_part.GetReferenceField().SetText( dlg.GetReference() );
|
new_symbol.GetReferenceField().SetText( dlg.GetReference() );
|
||||||
new_part.SetUnitCount( dlg.GetUnitCount() );
|
new_symbol.SetUnitCount( dlg.GetUnitCount() );
|
||||||
|
|
||||||
// Initialize new_part.m_TextInside member:
|
// Initialize new_symbol.m_TextInside member:
|
||||||
// if 0, pin text is outside the body (on the pin)
|
// if 0, pin text is outside the body (on the pin)
|
||||||
// if > 0, pin text is inside the body
|
// if > 0, pin text is inside the body
|
||||||
|
|
||||||
if( dlg.GetPinNameInside() )
|
if( dlg.GetPinNameInside() )
|
||||||
{
|
{
|
||||||
new_part.SetPinNameOffset( dlg.GetPinTextPosition() );
|
new_symbol.SetPinNameOffset( dlg.GetPinTextPosition() );
|
||||||
|
|
||||||
if( new_part.GetPinNameOffset() == 0 )
|
if( new_symbol.GetPinNameOffset() == 0 )
|
||||||
new_part.SetPinNameOffset( 1 );
|
new_symbol.SetPinNameOffset( 1 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new_part.SetPinNameOffset( 0 );
|
new_symbol.SetPinNameOffset( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
( dlg.GetPowerSymbol() ) ? new_part.SetPower() : new_part.SetNormal();
|
( dlg.GetPowerSymbol() ) ? new_symbol.SetPower() : new_symbol.SetNormal();
|
||||||
new_part.SetShowPinNumbers( dlg.GetShowPinNumber() );
|
new_symbol.SetShowPinNumbers( dlg.GetShowPinNumber() );
|
||||||
new_part.SetShowPinNames( dlg.GetShowPinName() );
|
new_symbol.SetShowPinNames( dlg.GetShowPinName() );
|
||||||
new_part.LockUnits( dlg.GetLockItems() );
|
new_symbol.LockUnits( dlg.GetLockItems() );
|
||||||
new_part.SetIncludeInBom( dlg.GetIncludeInBom() );
|
new_symbol.SetIncludeInBom( dlg.GetIncludeInBom() );
|
||||||
new_part.SetIncludeOnBoard( dlg.GetIncludeOnBoard() );
|
new_symbol.SetIncludeOnBoard( dlg.GetIncludeOnBoard() );
|
||||||
|
|
||||||
if( dlg.GetUnitCount() < 2 )
|
if( dlg.GetUnitCount() < 2 )
|
||||||
new_part.LockUnits( false );
|
new_symbol.LockUnits( false );
|
||||||
|
|
||||||
|
new_symbol.SetConversion( dlg.GetAlternateBodyStyle() );
|
||||||
|
|
||||||
new_part.SetConversion( dlg.GetAlternateBodyStyle() );
|
|
||||||
// must be called after loadPart, that calls SetShowDeMorgan, but
|
// must be called after loadPart, that calls SetShowDeMorgan, but
|
||||||
// because the symbol is empty,it looks like it has no alternate body
|
// because the symbol is empty,it looks like it has no alternate body
|
||||||
SetShowDeMorgan( dlg.GetAlternateBodyStyle() );
|
SetShowDeMorgan( dlg.GetAlternateBodyStyle() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LIB_PART* parent = m_libMgr->GetAlias( parentSymbolName, lib );
|
LIB_SYMBOL* parent = m_libMgr->GetAlias( parentSymbolName, lib );
|
||||||
wxCHECK( parent, /* void */ );
|
wxCHECK( parent, /* void */ );
|
||||||
new_part.SetParent( parent );
|
new_symbol.SetParent( parent );
|
||||||
|
|
||||||
// Inherit the parent mandatory field attributes.
|
// Inherit the parent mandatory field attributes.
|
||||||
for( int id = 0; id < MANDATORY_FIELDS; ++id )
|
for( int id = 0; id < MANDATORY_FIELDS; ++id )
|
||||||
{
|
{
|
||||||
LIB_FIELD* field = new_part.GetFieldById( id );
|
LIB_FIELD* field = new_symbol.GetFieldById( id );
|
||||||
|
|
||||||
// the MANDATORY_FIELDS are exactly that in RAM.
|
// the MANDATORY_FIELDS are exactly that in RAM.
|
||||||
wxCHECK( field, /* void */ );
|
wxCHECK( field, /* void */ );
|
||||||
|
@ -497,11 +498,11 @@ void SYMBOL_EDIT_FRAME::CreateNewPart()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
field->SetParent( &new_part );
|
field->SetParent( &new_symbol );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_libMgr->UpdatePart( &new_part, lib );
|
m_libMgr->UpdatePart( &new_symbol, lib );
|
||||||
SyncLibraries( false );
|
SyncLibraries( false );
|
||||||
LoadPart( name, lib, 1 );
|
LoadPart( name, lib, 1 );
|
||||||
}
|
}
|
||||||
|
@ -578,11 +579,11 @@ void SYMBOL_EDIT_FRAME::SaveSymbolAs()
|
||||||
|
|
||||||
void SYMBOL_EDIT_FRAME::savePartAs()
|
void SYMBOL_EDIT_FRAME::savePartAs()
|
||||||
{
|
{
|
||||||
LIB_PART* part = getTargetPart();
|
LIB_SYMBOL* symbol = getTargetPart();
|
||||||
|
|
||||||
if( part )
|
if( symbol )
|
||||||
{
|
{
|
||||||
LIB_ID old_lib_id = part->GetLibId();
|
LIB_ID old_lib_id = symbol->GetLibId();
|
||||||
wxString old_name = old_lib_id.GetLibItemName();
|
wxString old_name = old_lib_id.GetLibItemName();
|
||||||
wxString old_lib = old_lib_id.GetLibNickname();
|
wxString old_lib = old_lib_id.GetLibNickname();
|
||||||
|
|
||||||
|
@ -641,8 +642,8 @@ void SYMBOL_EDIT_FRAME::savePartAs()
|
||||||
|
|
||||||
// @todo Either check the selecteced library to see if the parent symbol name is in
|
// @todo Either check the selecteced library to see if the parent symbol name is in
|
||||||
// the new library and/or copy the parent symbol as well. This is the lazy
|
// the new library and/or copy the parent symbol as well. This is the lazy
|
||||||
// solution to ensure derived parts do not get orphaned.
|
// solution to ensure derived symbols do not get orphaned.
|
||||||
if( part->IsAlias() && new_lib != old_lib )
|
if( symbol->IsAlias() && new_lib != old_lib )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Derived symbols must be saved in the same library as their "
|
DisplayError( this, _( "Derived symbols must be saved in the same library as their "
|
||||||
"parent symbol." ) );
|
"parent symbol." ) );
|
||||||
|
@ -670,12 +671,12 @@ void SYMBOL_EDIT_FRAME::savePartAs()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LIB_PART new_part( *part );
|
LIB_SYMBOL new_symbol( *symbol );
|
||||||
new_part.SetName( new_name );
|
new_symbol.SetName( new_name );
|
||||||
|
|
||||||
m_libMgr->UpdatePart( &new_part, new_lib );
|
m_libMgr->UpdatePart( &new_symbol, new_lib );
|
||||||
SyncLibraries( false );
|
SyncLibraries( false );
|
||||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( new_lib, new_part.GetName() ) );
|
m_treePane->GetLibTree()->SelectLibId( LIB_ID( new_lib, new_symbol.GetName() ) );
|
||||||
LoadPart( new_name, new_lib, m_unit );
|
LoadPart( new_name, new_lib, m_unit );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -705,7 +706,7 @@ void SYMBOL_EDIT_FRAME::UpdateAfterSymbolProperties( wxString* aOldName )
|
||||||
m_libMgr->UpdatePartAfterRename( m_my_part, *aOldName, lib );
|
m_libMgr->UpdatePartAfterRename( m_my_part, *aOldName, lib );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reselect the renamed part
|
// Reselect the renamed symbol
|
||||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, m_my_part->GetName() ) );
|
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, m_my_part->GetName() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,12 +765,13 @@ void SYMBOL_EDIT_FRAME::CopyPartToClipboard()
|
||||||
{
|
{
|
||||||
int dummyUnit;
|
int dummyUnit;
|
||||||
LIB_ID libId = m_treePane->GetLibTree()->GetSelectedLibId( &dummyUnit );
|
LIB_ID libId = m_treePane->GetLibTree()->GetSelectedLibId( &dummyUnit );
|
||||||
LIB_PART* part = m_libMgr->GetBufferedPart( libId.GetLibItemName(), libId.GetLibNickname() );
|
LIB_SYMBOL* symbol = m_libMgr->GetBufferedPart( libId.GetLibItemName(),
|
||||||
|
libId.GetLibNickname() );
|
||||||
|
|
||||||
if( !part )
|
if( !symbol )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::unique_ptr< LIB_PART> tmp = part->Flatten();
|
std::unique_ptr< LIB_SYMBOL> tmp = symbol->Flatten();
|
||||||
STRING_FORMATTER formatter;
|
STRING_FORMATTER formatter;
|
||||||
SCH_SEXPR_PLUGIN::FormatPart( tmp.get(), formatter );
|
SCH_SEXPR_PLUGIN::FormatPart( tmp.get(), formatter );
|
||||||
|
|
||||||
|
@ -797,8 +799,8 @@ void SYMBOL_EDIT_FRAME::DuplicatePart( bool aFromClipboard )
|
||||||
if( !m_libMgr->LibraryExists( lib ) )
|
if( !m_libMgr->LibraryExists( lib ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LIB_PART* srcPart = nullptr;
|
LIB_SYMBOL* srcSymbol = nullptr;
|
||||||
LIB_PART* newPart = nullptr;
|
LIB_SYMBOL* newSymbol = nullptr;
|
||||||
|
|
||||||
if( aFromClipboard )
|
if( aFromClipboard )
|
||||||
{
|
{
|
||||||
|
@ -818,7 +820,7 @@ void SYMBOL_EDIT_FRAME::DuplicatePart( bool aFromClipboard )
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
newPart = SCH_SEXPR_PLUGIN::ParsePart( reader );
|
newSymbol = SCH_SEXPR_PLUGIN::ParsePart( reader );
|
||||||
}
|
}
|
||||||
catch( IO_ERROR& e )
|
catch( IO_ERROR& e )
|
||||||
{
|
{
|
||||||
|
@ -828,50 +830,50 @@ void SYMBOL_EDIT_FRAME::DuplicatePart( bool aFromClipboard )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
srcPart = m_libMgr->GetBufferedPart( libId.GetLibItemName(), lib );
|
srcSymbol = m_libMgr->GetBufferedPart( libId.GetLibItemName(), lib );
|
||||||
|
|
||||||
wxCHECK( srcPart, /* void */ );
|
wxCHECK( srcSymbol, /* void */ );
|
||||||
|
|
||||||
newPart = new LIB_PART( *srcPart );
|
newSymbol = new LIB_SYMBOL( *srcSymbol );
|
||||||
|
|
||||||
// Derive from same parent.
|
// Derive from same parent.
|
||||||
if( srcPart->IsAlias() )
|
if( srcSymbol->IsAlias() )
|
||||||
{
|
{
|
||||||
std::shared_ptr< LIB_PART > srcParent = srcPart->GetParent().lock();
|
std::shared_ptr< LIB_SYMBOL > srcParent = srcSymbol->GetParent().lock();
|
||||||
|
|
||||||
wxCHECK( srcParent, /* void */ );
|
wxCHECK( srcParent, /* void */ );
|
||||||
|
|
||||||
newPart->SetParent( srcParent.get() );
|
newSymbol->SetParent( srcParent.get() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !newPart )
|
if( !newSymbol )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ensureUniqueName( newPart, lib );
|
ensureUniqueName( newSymbol, lib );
|
||||||
m_libMgr->UpdatePart( newPart, lib );
|
m_libMgr->UpdatePart( newSymbol, lib );
|
||||||
|
|
||||||
LoadOneLibraryPartAux( newPart, lib, GetUnit(), GetConvert() );
|
LoadOneLibraryPartAux( newSymbol, lib, GetUnit(), GetConvert() );
|
||||||
|
|
||||||
SyncLibraries( false );
|
SyncLibraries( false );
|
||||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, newPart->GetName() ) );
|
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, newSymbol->GetName() ) );
|
||||||
|
|
||||||
delete newPart;
|
delete newSymbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SYMBOL_EDIT_FRAME::ensureUniqueName( LIB_PART* aPart, const wxString& aLibrary )
|
void SYMBOL_EDIT_FRAME::ensureUniqueName( LIB_SYMBOL* aSymbol, const wxString& aLibrary )
|
||||||
{
|
{
|
||||||
wxCHECK( aPart, /* void */ );
|
wxCHECK( aSymbol, /* void */ );
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
wxString newName = aPart->GetName();
|
wxString newName = aSymbol->GetName();
|
||||||
|
|
||||||
// Append a number to the name until the name is unique in the library.
|
// Append a number to the name until the name is unique in the library.
|
||||||
while( m_libMgr->PartExists( newName, aLibrary ) )
|
while( m_libMgr->PartExists( newName, aLibrary ) )
|
||||||
newName.Printf( "%s_%d", aPart->GetName(), i++ );
|
newName.Printf( "%s_%d", aSymbol->GetName(), i++ );
|
||||||
|
|
||||||
aPart->SetName( newName );
|
aSymbol->SetName( newName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -945,7 +947,7 @@ void SYMBOL_EDIT_FRAME::RevertAll()
|
||||||
|
|
||||||
void SYMBOL_EDIT_FRAME::LoadPart( const wxString& aAlias, const wxString& aLibrary, int aUnit )
|
void SYMBOL_EDIT_FRAME::LoadPart( const wxString& aAlias, const wxString& aLibrary, int aUnit )
|
||||||
{
|
{
|
||||||
LIB_PART* part = m_libMgr->GetBufferedPart( aAlias, aLibrary );
|
LIB_SYMBOL* part = m_libMgr->GetBufferedPart( aAlias, aLibrary );
|
||||||
|
|
||||||
if( !part )
|
if( !part )
|
||||||
{
|
{
|
||||||
|
@ -1123,7 +1125,6 @@ bool SYMBOL_EDIT_FRAME::saveAllLibraries( bool aRequireConfirmation )
|
||||||
{
|
{
|
||||||
// If saving under existing name fails then do a Save As..., and if that
|
// If saving under existing name fails then do a Save As..., and if that
|
||||||
// fails then cancel close action.
|
// fails then cancel close action.
|
||||||
|
|
||||||
if( !m_libMgr->IsLibraryReadOnly( libNickname ) )
|
if( !m_libMgr->IsLibraryReadOnly( libNickname ) )
|
||||||
{
|
{
|
||||||
if( saveLibrary( libNickname, false ) )
|
if( saveLibrary( libNickname, false ) )
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -88,7 +88,7 @@ void SYMBOL_EDIT_FRAME::ImportPart()
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString symbolName = symbols[0];
|
wxString symbolName = symbols[0];
|
||||||
LIB_PART* entry = pi->LoadSymbol( fn.GetFullPath(), symbolName );
|
LIB_SYMBOL* entry = pi->LoadSymbol( fn.GetFullPath(), symbolName );
|
||||||
|
|
||||||
if( m_libMgr->PartExists( symbols[0], libName ) )
|
if( m_libMgr->PartExists( symbols[0], libName ) )
|
||||||
{
|
{
|
||||||
|
@ -106,9 +106,9 @@ void SYMBOL_EDIT_FRAME::ImportPart()
|
||||||
void SYMBOL_EDIT_FRAME::ExportPart()
|
void SYMBOL_EDIT_FRAME::ExportPart()
|
||||||
{
|
{
|
||||||
wxString msg, title;
|
wxString msg, title;
|
||||||
LIB_PART* part = getTargetPart();
|
LIB_SYMBOL* symbol = getTargetPart();
|
||||||
|
|
||||||
if( !part )
|
if( !symbol )
|
||||||
{
|
{
|
||||||
ShowInfoBarError( _( "There is no symbol selected to save." ) );
|
ShowInfoBarError( _( "There is no symbol selected to save." ) );
|
||||||
return;
|
return;
|
||||||
|
@ -116,7 +116,7 @@ void SYMBOL_EDIT_FRAME::ExportPart()
|
||||||
|
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
|
|
||||||
fn.SetName( part->GetName().Lower() );
|
fn.SetName( symbol->GetName().Lower() );
|
||||||
fn.SetExt( KiCadSymbolLibFileExtension );
|
fn.SetExt( KiCadSymbolLibFileExtension );
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Export Symbol" ), m_mruPath, fn.GetFullName(),
|
wxFileDialog dlg( this, _( "Export Symbol" ), m_mruPath, fn.GetFullName(),
|
||||||
|
@ -128,7 +128,7 @@ void SYMBOL_EDIT_FRAME::ExportPart()
|
||||||
fn = dlg.GetPath();
|
fn = dlg.GetPath();
|
||||||
fn.MakeAbsolute();
|
fn.MakeAbsolute();
|
||||||
|
|
||||||
LIB_PART* old_part = NULL;
|
LIB_SYMBOL* old_symbol = NULL;
|
||||||
SCH_IO_MGR::SCH_FILE_T pluginType = SCH_IO_MGR::GuessPluginTypeFromLibPath( fn.GetFullPath() );
|
SCH_IO_MGR::SCH_FILE_T pluginType = SCH_IO_MGR::GuessPluginTypeFromLibPath( fn.GetFullPath() );
|
||||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( pluginType ) );
|
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( pluginType ) );
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ void SYMBOL_EDIT_FRAME::ExportPart()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
old_part = pi->LoadSymbol( fn.GetFullPath(), part->GetName() );
|
old_symbol = pi->LoadSymbol( fn.GetFullPath(), symbol->GetName() );
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
{
|
{
|
||||||
|
@ -146,10 +146,10 @@ void SYMBOL_EDIT_FRAME::ExportPart()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( old_part )
|
if( old_symbol )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Symbol \"%s\" already exists in \"%s\"." ),
|
msg.Printf( _( "Symbol \"%s\" already exists in \"%s\"." ),
|
||||||
part->GetName(),
|
symbol->GetName(),
|
||||||
fn.GetFullName() );
|
fn.GetFullName() );
|
||||||
|
|
||||||
KIDIALOG errorDlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
KIDIALOG errorDlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
|
@ -176,8 +176,8 @@ void SYMBOL_EDIT_FRAME::ExportPart()
|
||||||
|
|
||||||
// The flattened symbol is most likely what the user would want. As some point in
|
// The flattened symbol is most likely what the user would want. As some point in
|
||||||
// the future as more of the symbol library inheritance is implemented, this may have
|
// the future as more of the symbol library inheritance is implemented, this may have
|
||||||
// to be changes to save parts of inherited symbols.
|
// to be changes to save symbols of inherited symbols.
|
||||||
pi->SaveSymbol( fn.GetFullPath(), part->Flatten().release() );
|
pi->SaveSymbol( fn.GetFullPath(), symbol->Flatten().release() );
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
{
|
{
|
||||||
|
@ -190,7 +190,7 @@ void SYMBOL_EDIT_FRAME::ExportPart()
|
||||||
|
|
||||||
m_mruPath = fn.GetPath();
|
m_mruPath = fn.GetPath();
|
||||||
|
|
||||||
msg.Printf( _( "Symbol \"%s\" saved in library \"%s\"" ), part->GetName(), fn.GetFullPath() );
|
msg.Printf( _( "Symbol \"%s\" saved in library \"%s\"" ), symbol->GetName(), fn.GetFullPath() );
|
||||||
SetStatusText( msg );
|
SetStatusText( msg );
|
||||||
|
|
||||||
// See if the user wants it added to a library table (global or project)
|
// See if the user wants it added to a library table (global or project)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2014-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
* Copyright (C) 2014-2021 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -37,10 +37,10 @@ void SYMBOL_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aUndoType
|
||||||
if( !aItem )
|
if( !aItem )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LIB_PART* copyItem;
|
LIB_SYMBOL* copyItem;
|
||||||
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
|
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
|
||||||
|
|
||||||
copyItem = new LIB_PART( * (LIB_PART*) aItem );
|
copyItem = new LIB_SYMBOL( * (LIB_SYMBOL*) aItem );
|
||||||
|
|
||||||
// Clear current flags (which can be temporary set by a current edit command).
|
// Clear current flags (which can be temporary set by a current edit command).
|
||||||
copyItem->ClearTempFlags();
|
copyItem->ClearTempFlags();
|
||||||
|
@ -67,36 +67,36 @@ void SYMBOL_EDIT_FRAME::GetSymbolFromRedoList()
|
||||||
PICKED_ITEMS_LIST* redoCommand = PopCommandFromRedoList();
|
PICKED_ITEMS_LIST* redoCommand = PopCommandFromRedoList();
|
||||||
ITEM_PICKER redoWrapper = redoCommand->PopItem();
|
ITEM_PICKER redoWrapper = redoCommand->PopItem();
|
||||||
delete redoCommand;
|
delete redoCommand;
|
||||||
LIB_PART* part = (LIB_PART*) redoWrapper.GetItem();
|
LIB_SYMBOL* symbol = (LIB_SYMBOL*) redoWrapper.GetItem();
|
||||||
wxCHECK( part, /* void */ );
|
wxCHECK( symbol, /* void */ );
|
||||||
part->ClearFlags( UR_TRANSIENT );
|
symbol->ClearFlags( UR_TRANSIENT );
|
||||||
UNDO_REDO undoRedoType = redoWrapper.GetStatus();
|
UNDO_REDO undoRedoType = redoWrapper.GetStatus();
|
||||||
|
|
||||||
// Store the current part in the undo buffer
|
// Store the current symbol in the undo buffer
|
||||||
PICKED_ITEMS_LIST* undoCommand = new PICKED_ITEMS_LIST();
|
PICKED_ITEMS_LIST* undoCommand = new PICKED_ITEMS_LIST();
|
||||||
LIB_PART* oldPart = m_my_part;
|
LIB_SYMBOL* oldSymbol = m_my_part;
|
||||||
oldPart->SetFlags( UR_TRANSIENT );
|
oldSymbol->SetFlags( UR_TRANSIENT );
|
||||||
ITEM_PICKER undoWrapper( GetScreen(), oldPart, undoRedoType );
|
ITEM_PICKER undoWrapper( GetScreen(), oldSymbol, undoRedoType );
|
||||||
undoCommand->PushItem( undoWrapper );
|
undoCommand->PushItem( undoWrapper );
|
||||||
PushCommandToUndoList( undoCommand );
|
PushCommandToUndoList( undoCommand );
|
||||||
|
|
||||||
// Do not delete the previous part by calling SetCurPart( part )
|
// Do not delete the previous symbol by calling SetCurPart( symbol )
|
||||||
// which calls delete <previous part>.
|
// which calls delete <previous symbol>.
|
||||||
// <previous part> is now put in undo list and is owned by this list
|
// <previous symbol> is now put in undo list and is owned by this list
|
||||||
// Just set the current part to the part which come from the redo list
|
// Just set the current symbol to the symbol which come from the redo list
|
||||||
m_my_part = part;
|
m_my_part = symbol;
|
||||||
|
|
||||||
if( undoRedoType == UNDO_REDO::LIB_RENAME )
|
if( undoRedoType == UNDO_REDO::LIB_RENAME )
|
||||||
{
|
{
|
||||||
wxString lib = GetCurLib();
|
wxString lib = GetCurLib();
|
||||||
m_libMgr->UpdatePartAfterRename( part, oldPart->GetName(), lib );
|
m_libMgr->UpdatePartAfterRename( symbol, oldSymbol->GetName(), lib );
|
||||||
|
|
||||||
// Reselect the renamed part
|
// Reselect the renamed symbol
|
||||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, part->GetName() ) );
|
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, symbol->GetName() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
RebuildSymbolUnitsList();
|
RebuildSymbolUnitsList();
|
||||||
SetShowDeMorgan( part->HasConversion() );
|
SetShowDeMorgan( symbol->HasConversion() );
|
||||||
updateTitle();
|
updateTitle();
|
||||||
|
|
||||||
RebuildView();
|
RebuildView();
|
||||||
|
@ -115,36 +115,36 @@ void SYMBOL_EDIT_FRAME::GetSymbolFromUndoList()
|
||||||
PICKED_ITEMS_LIST* undoCommand = PopCommandFromUndoList();
|
PICKED_ITEMS_LIST* undoCommand = PopCommandFromUndoList();
|
||||||
ITEM_PICKER undoWrapper = undoCommand->PopItem();
|
ITEM_PICKER undoWrapper = undoCommand->PopItem();
|
||||||
delete undoCommand;
|
delete undoCommand;
|
||||||
LIB_PART* part = (LIB_PART*) undoWrapper.GetItem();
|
LIB_SYMBOL* symbol = (LIB_SYMBOL*) undoWrapper.GetItem();
|
||||||
wxCHECK( part, /* void */ );
|
wxCHECK( symbol, /* void */ );
|
||||||
part->ClearFlags( UR_TRANSIENT );
|
symbol->ClearFlags( UR_TRANSIENT );
|
||||||
UNDO_REDO undoRedoType = undoWrapper.GetStatus();
|
UNDO_REDO undoRedoType = undoWrapper.GetStatus();
|
||||||
|
|
||||||
// Store the current part in the redo buffer
|
// Store the current symbol in the redo buffer
|
||||||
PICKED_ITEMS_LIST* redoCommand = new PICKED_ITEMS_LIST();
|
PICKED_ITEMS_LIST* redoCommand = new PICKED_ITEMS_LIST();
|
||||||
LIB_PART* oldPart = m_my_part;
|
LIB_SYMBOL* oldSymbol = m_my_part;
|
||||||
oldPart->SetFlags( UR_TRANSIENT );
|
oldSymbol->SetFlags( UR_TRANSIENT );
|
||||||
ITEM_PICKER redoWrapper( GetScreen(), oldPart, undoRedoType );
|
ITEM_PICKER redoWrapper( GetScreen(), oldSymbol, undoRedoType );
|
||||||
redoCommand->PushItem( redoWrapper );
|
redoCommand->PushItem( redoWrapper );
|
||||||
PushCommandToRedoList( redoCommand );
|
PushCommandToRedoList( redoCommand );
|
||||||
|
|
||||||
// Do not delete the previous part by calling SetCurPart( part ),
|
// Do not delete the previous symbol by calling SetCurPart( symbol ),
|
||||||
// which calls delete <previous part>.
|
// which calls delete <previous symbol>.
|
||||||
// <previous part> is now put in redo list and is owned by this list.
|
// <previous symbol> is now put in redo list and is owned by this list.
|
||||||
// Just set the current part to the part which come from the undo list
|
// Just set the current symbol to the symbol which come from the undo list
|
||||||
m_my_part = part;
|
m_my_part = symbol;
|
||||||
|
|
||||||
if( undoRedoType == UNDO_REDO::LIB_RENAME )
|
if( undoRedoType == UNDO_REDO::LIB_RENAME )
|
||||||
{
|
{
|
||||||
wxString lib = GetCurLib();
|
wxString lib = GetCurLib();
|
||||||
m_libMgr->UpdatePartAfterRename( part, oldPart->GetName(), lib );
|
m_libMgr->UpdatePartAfterRename( symbol, oldSymbol->GetName(), lib );
|
||||||
|
|
||||||
// Reselect the renamed part
|
// Reselect the renamed symbol
|
||||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, part->GetName() ) );
|
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, symbol->GetName() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
RebuildSymbolUnitsList();
|
RebuildSymbolUnitsList();
|
||||||
SetShowDeMorgan( part->HasConversion() );
|
SetShowDeMorgan( symbol->HasConversion() );
|
||||||
updateTitle();
|
updateTitle();
|
||||||
|
|
||||||
RebuildView();
|
RebuildView();
|
||||||
|
@ -165,15 +165,15 @@ void SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo()
|
||||||
|
|
||||||
ITEM_PICKER undoWrapper = undoCommand->PopItem();
|
ITEM_PICKER undoWrapper = undoCommand->PopItem();
|
||||||
delete undoCommand;
|
delete undoCommand;
|
||||||
LIB_PART* part = (LIB_PART*) undoWrapper.GetItem();
|
LIB_SYMBOL* symbol = (LIB_SYMBOL*) undoWrapper.GetItem();
|
||||||
part->ClearFlags( UR_TRANSIENT );
|
symbol->ClearFlags( UR_TRANSIENT );
|
||||||
SetCurPart( part, false );
|
SetCurPart( symbol, false );
|
||||||
|
|
||||||
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
|
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
|
||||||
selTool->RebuildSelection();
|
selTool->RebuildSelection();
|
||||||
|
|
||||||
RebuildSymbolUnitsList();
|
RebuildSymbolUnitsList();
|
||||||
SetShowDeMorgan( part->HasConversion() );
|
SetShowDeMorgan( symbol->HasConversion() );
|
||||||
|
|
||||||
RebuildView();
|
RebuildView();
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,33 +228,34 @@ bool SYMBOL_LIBRARY_MANAGER::SaveLibrary( const wxString& aLibrary, const wxStri
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Handle original library
|
// Handle original library
|
||||||
for( LIB_PART* part : getOriginalParts( aLibrary ) )
|
for( LIB_SYMBOL* symbol : getOriginalParts( aLibrary ) )
|
||||||
{
|
{
|
||||||
LIB_PART* newSymbol;
|
LIB_SYMBOL* newSymbol;
|
||||||
|
|
||||||
if( part->IsAlias() )
|
if( symbol->IsAlias() )
|
||||||
{
|
{
|
||||||
std::shared_ptr< LIB_PART > oldParent = part->GetParent().lock();
|
std::shared_ptr< LIB_SYMBOL > oldParent = symbol->GetParent().lock();
|
||||||
|
|
||||||
wxCHECK_MSG( oldParent, false,
|
wxCHECK_MSG( oldParent, false,
|
||||||
wxString::Format( "Derived symbol '%s' found with undefined parent.",
|
wxString::Format( "Derived symbol '%s' found with undefined parent.",
|
||||||
part->GetName() ) );
|
symbol->GetName() ) );
|
||||||
|
|
||||||
LIB_PART* libParent = pi->LoadSymbol( aLibrary, oldParent->GetName(), &properties );
|
LIB_SYMBOL* libParent = pi->LoadSymbol( aLibrary, oldParent->GetName(),
|
||||||
|
&properties );
|
||||||
|
|
||||||
if( !libParent )
|
if( !libParent )
|
||||||
{
|
{
|
||||||
libParent = new LIB_PART( *oldParent.get() );
|
libParent = new LIB_SYMBOL( *oldParent.get() );
|
||||||
pi->SaveSymbol( aLibrary, libParent, &properties );
|
pi->SaveSymbol( aLibrary, libParent, &properties );
|
||||||
}
|
}
|
||||||
|
|
||||||
newSymbol = new LIB_PART( *part );
|
newSymbol = new LIB_SYMBOL( *symbol );
|
||||||
newSymbol->SetParent( libParent );
|
newSymbol->SetParent( libParent );
|
||||||
pi->SaveSymbol( aLibrary, newSymbol, &properties );
|
pi->SaveSymbol( aLibrary, newSymbol, &properties );
|
||||||
}
|
}
|
||||||
else if( !pi->LoadSymbol( aLibrary, part->GetName(), &properties ) )
|
else if( !pi->LoadSymbol( aLibrary, symbol->GetName(), &properties ) )
|
||||||
{
|
{
|
||||||
pi->SaveSymbol( aLibrary, new LIB_PART( *part ), &properties );
|
pi->SaveSymbol( aLibrary, new LIB_SYMBOL( *symbol ), &properties );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,8 +291,8 @@ bool SYMBOL_LIBRARY_MANAGER::IsPartModified( const wxString& aAlias,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const LIB_BUFFER& buf = libIt->second;
|
const LIB_BUFFER& buf = libIt->second;
|
||||||
auto partBuf = buf.GetBuffer( aAlias );
|
auto symbolBuf = buf.GetBuffer( aAlias );
|
||||||
return partBuf ? partBuf->IsModified() : false;
|
return symbolBuf ? symbolBuf->IsModified() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -302,9 +303,9 @@ bool SYMBOL_LIBRARY_MANAGER::ClearLibraryModified( const wxString& aLibrary ) co
|
||||||
if( libIt == m_libs.end() )
|
if( libIt == m_libs.end() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for( auto& partBuf : libIt->second.GetBuffers() )
|
for( auto& symbolBuf : libIt->second.GetBuffers() )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = partBuf->GetScreen();
|
SCH_SCREEN* screen = symbolBuf->GetScreen();
|
||||||
|
|
||||||
if( screen )
|
if( screen )
|
||||||
screen->SetContentModified( false );
|
screen->SetContentModified( false );
|
||||||
|
@ -322,10 +323,10 @@ bool SYMBOL_LIBRARY_MANAGER::ClearPartModified( const wxString& aAlias,
|
||||||
if( libI == m_libs.end() )
|
if( libI == m_libs.end() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto partBuf = libI->second.GetBuffer( aAlias );
|
auto symbolBuf = libI->second.GetBuffer( aAlias );
|
||||||
wxCHECK( partBuf, false );
|
wxCHECK( symbolBuf, false );
|
||||||
|
|
||||||
partBuf->GetScreen()->SetContentModified( false );
|
symbolBuf->GetScreen()->SetContentModified( false );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,23 +347,23 @@ bool SYMBOL_LIBRARY_MANAGER::IsLibraryLoaded( const wxString& aLibrary ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::list<LIB_PART*> SYMBOL_LIBRARY_MANAGER::GetAliases( const wxString& aLibrary ) const
|
std::list<LIB_SYMBOL*> SYMBOL_LIBRARY_MANAGER::GetAliases( const wxString& aLibrary ) const
|
||||||
{
|
{
|
||||||
std::list<LIB_PART*> ret;
|
std::list<LIB_SYMBOL*> ret;
|
||||||
wxCHECK( LibraryExists( aLibrary ), ret );
|
wxCHECK( LibraryExists( aLibrary ), ret );
|
||||||
|
|
||||||
auto libIt = m_libs.find( aLibrary );
|
auto libIt = m_libs.find( aLibrary );
|
||||||
|
|
||||||
if( libIt != m_libs.end() )
|
if( libIt != m_libs.end() )
|
||||||
{
|
{
|
||||||
for( auto& partBuf : libIt->second.GetBuffers() )
|
for( auto& symbolBuf : libIt->second.GetBuffers() )
|
||||||
{
|
{
|
||||||
ret.push_back( partBuf->GetPart() );
|
ret.push_back( symbolBuf->GetPart() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::vector<LIB_PART*> aliases;
|
std::vector<LIB_SYMBOL*> aliases;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -380,46 +381,46 @@ std::list<LIB_PART*> SYMBOL_LIBRARY_MANAGER::GetAliases( const wxString& aLibrar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SYMBOL_LIBRARY_MANAGER::GetBufferedPart( const wxString& aAlias,
|
LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetBufferedPart( const wxString& aAlias,
|
||||||
const wxString& aLibrary )
|
const wxString& aLibrary )
|
||||||
{
|
{
|
||||||
wxCHECK( LibraryExists( aLibrary ), nullptr );
|
wxCHECK( LibraryExists( aLibrary ), nullptr );
|
||||||
|
|
||||||
// try the library buffers first
|
// try the library buffers first
|
||||||
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
|
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
|
||||||
LIB_PART* bufferedPart = libBuf.GetPart( aAlias );
|
LIB_SYMBOL* bufferedPart = libBuf.GetPart( aAlias );
|
||||||
|
|
||||||
if( !bufferedPart ) // no buffer part found
|
if( !bufferedPart ) // no buffer symbol found
|
||||||
{
|
{
|
||||||
// create a copy of the part
|
// create a copy of the symbol
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LIB_PART* part = symTable()->LoadSymbol( aLibrary, aAlias );
|
LIB_SYMBOL* symbol = symTable()->LoadSymbol( aLibrary, aAlias );
|
||||||
|
|
||||||
if( part == nullptr )
|
if( symbol == nullptr )
|
||||||
THROW_IO_ERROR( _( "Symbol not found." ) );
|
THROW_IO_ERROR( _( "Symbol not found." ) );
|
||||||
|
|
||||||
LIB_PART* bufferedParent = nullptr;
|
LIB_SYMBOL* bufferedParent = nullptr;
|
||||||
|
|
||||||
// Create parent symbols on demand so parent symbol can be set.
|
// Create parent symbols on demand so parent symbol can be set.
|
||||||
if( part->IsAlias() )
|
if( symbol->IsAlias() )
|
||||||
{
|
{
|
||||||
std::shared_ptr< LIB_PART > parent = part->GetParent().lock();
|
std::shared_ptr< LIB_SYMBOL > parent = symbol->GetParent().lock();
|
||||||
wxCHECK_MSG( parent, nullptr,
|
wxCHECK_MSG( parent, nullptr,
|
||||||
wxString::Format( "Derived symbol '%s' found with undefined parent.",
|
wxString::Format( "Derived symbol '%s' found with undefined parent.",
|
||||||
part->GetName() ) );
|
symbol->GetName() ) );
|
||||||
|
|
||||||
// Check if the parent symbol buffer has already be created.
|
// Check if the parent symbol buffer has already be created.
|
||||||
bufferedParent = libBuf.GetPart( parent->GetName() );
|
bufferedParent = libBuf.GetPart( parent->GetName() );
|
||||||
|
|
||||||
if( !bufferedParent )
|
if( !bufferedParent )
|
||||||
{
|
{
|
||||||
bufferedParent = new LIB_PART( *parent.get() );
|
bufferedParent = new LIB_SYMBOL( *parent.get() );
|
||||||
libBuf.CreateBuffer( bufferedParent, new SCH_SCREEN );
|
libBuf.CreateBuffer( bufferedParent, new SCH_SCREEN );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bufferedPart = new LIB_PART( *part );
|
bufferedPart = new LIB_SYMBOL( *symbol );
|
||||||
|
|
||||||
if( bufferedParent )
|
if( bufferedParent )
|
||||||
bufferedPart->SetParent( bufferedParent );
|
bufferedPart->SetParent( bufferedParent );
|
||||||
|
@ -446,35 +447,35 @@ SCH_SCREEN* SYMBOL_LIBRARY_MANAGER::GetScreen( const wxString& aAlias, const wxS
|
||||||
wxCHECK( it != m_libs.end(), nullptr );
|
wxCHECK( it != m_libs.end(), nullptr );
|
||||||
|
|
||||||
LIB_BUFFER& buf = it->second;
|
LIB_BUFFER& buf = it->second;
|
||||||
auto partBuf = buf.GetBuffer( aAlias );
|
auto symbolBuf = buf.GetBuffer( aAlias );
|
||||||
return partBuf ? partBuf->GetScreen() : nullptr;
|
return symbolBuf ? symbolBuf->GetScreen() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SYMBOL_LIBRARY_MANAGER::UpdatePart( LIB_PART* aPart, const wxString& aLibrary )
|
bool SYMBOL_LIBRARY_MANAGER::UpdatePart( LIB_SYMBOL* aSymbol, const wxString& aLibrary )
|
||||||
{
|
{
|
||||||
wxCHECK( LibraryExists( aLibrary ), false );
|
wxCHECK( LibraryExists( aLibrary ), false );
|
||||||
wxCHECK( aPart, false );
|
wxCHECK( aSymbol, false );
|
||||||
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
|
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
|
||||||
auto partBuf = libBuf.GetBuffer( aPart->GetName() );
|
auto symbolBuf = libBuf.GetBuffer( aSymbol->GetName() );
|
||||||
|
|
||||||
if( partBuf ) // Existing symbol.
|
if( symbolBuf ) // Existing symbol.
|
||||||
{
|
{
|
||||||
LIB_PART* bufferedPart = const_cast< LIB_PART* >( partBuf->GetPart() );
|
LIB_SYMBOL* bufferedPart = const_cast< LIB_SYMBOL* >( symbolBuf->GetPart() );
|
||||||
|
|
||||||
wxCHECK( bufferedPart, false );
|
wxCHECK( bufferedPart, false );
|
||||||
|
|
||||||
*bufferedPart = *aPart;
|
*bufferedPart = *aSymbol;
|
||||||
partBuf->GetScreen()->SetContentModified();
|
symbolBuf->GetScreen()->SetContentModified();
|
||||||
}
|
}
|
||||||
else // New symbol
|
else // New symbol
|
||||||
{
|
{
|
||||||
LIB_PART* partCopy = new LIB_PART( *aPart, nullptr );
|
LIB_SYMBOL* symbolCopy = new LIB_SYMBOL( *aSymbol, nullptr );
|
||||||
|
|
||||||
partCopy->SetLibId( LIB_ID( aLibrary, aPart->GetLibId().GetLibItemName() ) );
|
symbolCopy->SetLibId( LIB_ID( aLibrary, aSymbol->GetLibId().GetLibItemName() ) );
|
||||||
|
|
||||||
SCH_SCREEN* screen = new SCH_SCREEN;
|
SCH_SCREEN* screen = new SCH_SCREEN;
|
||||||
libBuf.CreateBuffer( partCopy, screen );
|
libBuf.CreateBuffer( symbolCopy, screen );
|
||||||
screen->SetContentModified();
|
screen->SetContentModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,15 +483,15 @@ bool SYMBOL_LIBRARY_MANAGER::UpdatePart( LIB_PART* aPart, const wxString& aLibra
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SYMBOL_LIBRARY_MANAGER::UpdatePartAfterRename( LIB_PART* aPart, const wxString& aOldName,
|
bool SYMBOL_LIBRARY_MANAGER::UpdatePartAfterRename( LIB_SYMBOL* aSymbol, const wxString& aOldName,
|
||||||
const wxString& aLibrary )
|
const wxString& aLibrary )
|
||||||
{
|
{
|
||||||
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
|
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
|
||||||
auto partBuf = libBuf.GetBuffer( aOldName );
|
auto symbolBuf = libBuf.GetBuffer( aOldName );
|
||||||
|
|
||||||
wxCHECK( partBuf, false );
|
wxCHECK( symbolBuf, false );
|
||||||
|
|
||||||
libBuf.UpdateBuffer( partBuf, aPart );
|
libBuf.UpdateBuffer( symbolBuf, aSymbol );
|
||||||
m_frame.SyncLibraries( false );
|
m_frame.SyncLibraries( false );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -504,10 +505,10 @@ bool SYMBOL_LIBRARY_MANAGER::FlushPart( const wxString& aAlias, const wxString&
|
||||||
if( it == m_libs.end() ) // no items to flush
|
if( it == m_libs.end() ) // no items to flush
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto partBuf = it->second.GetBuffer( aAlias );
|
auto symbolBuf = it->second.GetBuffer( aAlias );
|
||||||
wxCHECK( partBuf, false );
|
wxCHECK( symbolBuf, false );
|
||||||
|
|
||||||
return it->second.SaveBuffer( partBuf, symTable() );
|
return it->second.SaveBuffer( symbolBuf, symTable() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -518,9 +519,9 @@ LIB_ID SYMBOL_LIBRARY_MANAGER::RevertPart( const wxString& aAlias, const wxStrin
|
||||||
if( it == m_libs.end() ) // no items to flush
|
if( it == m_libs.end() ) // no items to flush
|
||||||
return LIB_ID( aLibrary, aAlias );
|
return LIB_ID( aLibrary, aAlias );
|
||||||
|
|
||||||
auto partBuf = it->second.GetBuffer( aAlias );
|
auto symbolBuf = it->second.GetBuffer( aAlias );
|
||||||
wxCHECK( partBuf, LIB_ID( aLibrary, aAlias ) );
|
wxCHECK( symbolBuf, LIB_ID( aLibrary, aAlias ) );
|
||||||
LIB_PART original( *partBuf->GetOriginal() );
|
LIB_SYMBOL original( *symbolBuf->GetOriginal() );
|
||||||
|
|
||||||
if( original.GetName() != aAlias )
|
if( original.GetName() != aAlias )
|
||||||
{
|
{
|
||||||
|
@ -528,7 +529,7 @@ LIB_ID SYMBOL_LIBRARY_MANAGER::RevertPart( const wxString& aAlias, const wxStrin
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
partBuf->SetPart( new LIB_PART( original ) );
|
symbolBuf->SetPart( new LIB_SYMBOL( original ) );
|
||||||
m_frame.SyncLibraries( false );
|
m_frame.SyncLibraries( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,19 +580,19 @@ bool SYMBOL_LIBRARY_MANAGER::RevertAll()
|
||||||
bool SYMBOL_LIBRARY_MANAGER::RemovePart( const wxString& aAlias, const wxString& aLibrary )
|
bool SYMBOL_LIBRARY_MANAGER::RemovePart( const wxString& aAlias, const wxString& aLibrary )
|
||||||
{
|
{
|
||||||
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
|
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
|
||||||
auto partBuf = libBuf.GetBuffer( aAlias );
|
auto symbolBuf = libBuf.GetBuffer( aAlias );
|
||||||
wxCHECK( partBuf, false );
|
wxCHECK( symbolBuf, false );
|
||||||
|
|
||||||
bool retv = true;
|
bool retv = true;
|
||||||
|
|
||||||
retv &= libBuf.DeleteBuffer( partBuf );
|
retv &= libBuf.DeleteBuffer( symbolBuf );
|
||||||
m_frame.SyncLibraries( false );
|
m_frame.SyncLibraries( false );
|
||||||
|
|
||||||
return retv;
|
return retv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SYMBOL_LIBRARY_MANAGER::GetAlias( const wxString& aAlias,
|
LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetAlias( const wxString& aAlias,
|
||||||
const wxString& aLibrary ) const
|
const wxString& aLibrary ) const
|
||||||
{
|
{
|
||||||
// Try the library buffers first
|
// Try the library buffers first
|
||||||
|
@ -599,14 +600,14 @@ LIB_PART* SYMBOL_LIBRARY_MANAGER::GetAlias( const wxString& aAlias,
|
||||||
|
|
||||||
if( libIt != m_libs.end() )
|
if( libIt != m_libs.end() )
|
||||||
{
|
{
|
||||||
LIB_PART* part = libIt->second.GetPart( aAlias );
|
LIB_SYMBOL* symbol = libIt->second.GetPart( aAlias );
|
||||||
|
|
||||||
if( part )
|
if( symbol )
|
||||||
return part;
|
return symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the original part
|
// Get the original symbol
|
||||||
LIB_PART* alias = nullptr;
|
LIB_SYMBOL* alias = nullptr;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -625,7 +626,7 @@ LIB_PART* SYMBOL_LIBRARY_MANAGER::GetAlias( const wxString& aAlias,
|
||||||
bool SYMBOL_LIBRARY_MANAGER::PartExists( const wxString& aAlias, const wxString& aLibrary ) const
|
bool SYMBOL_LIBRARY_MANAGER::PartExists( const wxString& aAlias, const wxString& aLibrary ) const
|
||||||
{
|
{
|
||||||
auto libBufIt = m_libs.find( aLibrary );
|
auto libBufIt = m_libs.find( aLibrary );
|
||||||
LIB_PART* alias = nullptr;
|
LIB_SYMBOL* alias = nullptr;
|
||||||
|
|
||||||
if( libBufIt != m_libs.end() )
|
if( libBufIt != m_libs.end() )
|
||||||
return !!libBufIt->second.GetBuffer( aAlias );
|
return !!libBufIt->second.GetBuffer( aAlias );
|
||||||
|
@ -751,10 +752,10 @@ SYMBOL_LIB_TABLE* SYMBOL_LIBRARY_MANAGER::symTable() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::set<LIB_PART*> SYMBOL_LIBRARY_MANAGER::getOriginalParts( const wxString& aLibrary )
|
std::set<LIB_SYMBOL*> SYMBOL_LIBRARY_MANAGER::getOriginalParts( const wxString& aLibrary )
|
||||||
{
|
{
|
||||||
std::set<LIB_PART*> parts;
|
std::set<LIB_SYMBOL*> symbols;
|
||||||
wxCHECK( LibraryExists( aLibrary ), parts );
|
wxCHECK( LibraryExists( aLibrary ), symbols );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -763,8 +764,8 @@ std::set<LIB_PART*> SYMBOL_LIBRARY_MANAGER::getOriginalParts( const wxString& aL
|
||||||
|
|
||||||
for( const auto& aliasName : aliases )
|
for( const auto& aliasName : aliases )
|
||||||
{
|
{
|
||||||
LIB_PART* alias = symTable()->LoadSymbol( aLibrary, aliasName );
|
LIB_SYMBOL* alias = symTable()->LoadSymbol( aLibrary, aliasName );
|
||||||
parts.insert( alias );
|
symbols.insert( alias );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& e )
|
catch( const IO_ERROR& e )
|
||||||
|
@ -772,7 +773,7 @@ std::set<LIB_PART*> SYMBOL_LIBRARY_MANAGER::getOriginalParts( const wxString& aL
|
||||||
wxLogMessage( _( "Cannot enumerate library \"%s\" (%s)" ), aLibrary, e.What() );
|
wxLogMessage( _( "Cannot enumerate library \"%s\" (%s)" ), aLibrary, e.What() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return parts;
|
return symbols;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -788,33 +789,33 @@ SYMBOL_LIBRARY_MANAGER::LIB_BUFFER& SYMBOL_LIBRARY_MANAGER::getLibraryBuffer(
|
||||||
auto ret = m_libs.emplace( aLibrary, LIB_BUFFER( aLibrary ) );
|
auto ret = m_libs.emplace( aLibrary, LIB_BUFFER( aLibrary ) );
|
||||||
LIB_BUFFER& buf = ret.first->second;
|
LIB_BUFFER& buf = ret.first->second;
|
||||||
|
|
||||||
for( auto part : getOriginalParts( aLibrary ) )
|
for( auto symbol : getOriginalParts( aLibrary ) )
|
||||||
{
|
{
|
||||||
LIB_PART* newSymbol;
|
LIB_SYMBOL* newSymbol;
|
||||||
|
|
||||||
if( part->IsAlias() )
|
if( symbol->IsAlias() )
|
||||||
{
|
{
|
||||||
std::shared_ptr< LIB_PART > oldParent = part->GetParent().lock();
|
std::shared_ptr< LIB_SYMBOL > oldParent = symbol->GetParent().lock();
|
||||||
|
|
||||||
wxCHECK_MSG( oldParent, buf,
|
wxCHECK_MSG( oldParent, buf,
|
||||||
wxString::Format( "Derived symbol '%s' found with undefined parent.",
|
wxString::Format( "Derived symbol '%s' found with undefined parent.",
|
||||||
part->GetName() ) );
|
symbol->GetName() ) );
|
||||||
|
|
||||||
LIB_PART* libParent = buf.GetPart( oldParent->GetName() );
|
LIB_SYMBOL* libParent = buf.GetPart( oldParent->GetName() );
|
||||||
|
|
||||||
if( !libParent )
|
if( !libParent )
|
||||||
{
|
{
|
||||||
libParent = new LIB_PART( *oldParent.get() );
|
libParent = new LIB_SYMBOL( *oldParent.get() );
|
||||||
buf.CreateBuffer( libParent, new SCH_SCREEN );
|
buf.CreateBuffer( libParent, new SCH_SCREEN );
|
||||||
}
|
}
|
||||||
|
|
||||||
newSymbol = new LIB_PART( *part );
|
newSymbol = new LIB_SYMBOL( *symbol );
|
||||||
newSymbol->SetParent( libParent );
|
newSymbol->SetParent( libParent );
|
||||||
buf.CreateBuffer( newSymbol, new SCH_SCREEN );
|
buf.CreateBuffer( newSymbol, new SCH_SCREEN );
|
||||||
}
|
}
|
||||||
else if( !buf.GetPart( part->GetName() ) )
|
else if( !buf.GetPart( symbol->GetName() ) )
|
||||||
{
|
{
|
||||||
buf.CreateBuffer( new LIB_PART( *part ), new SCH_SCREEN );
|
buf.CreateBuffer( new LIB_SYMBOL( *symbol ), new SCH_SCREEN );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,12 +823,12 @@ SYMBOL_LIBRARY_MANAGER::LIB_BUFFER& SYMBOL_LIBRARY_MANAGER::getLibraryBuffer(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PART_BUFFER( LIB_PART* aPart,
|
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PART_BUFFER( LIB_SYMBOL* aSymbol,
|
||||||
std::unique_ptr<SCH_SCREEN> aScreen ) :
|
std::unique_ptr<SCH_SCREEN> aScreen ) :
|
||||||
m_screen( std::move( aScreen ) ),
|
m_screen( std::move( aScreen ) ),
|
||||||
m_part( aPart )
|
m_part( aSymbol )
|
||||||
{
|
{
|
||||||
m_original = new LIB_PART( *aPart );
|
m_original = new LIB_SYMBOL( *aSymbol );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -838,12 +839,12 @@ SYMBOL_LIBRARY_MANAGER::PART_BUFFER::~PART_BUFFER()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SYMBOL_LIBRARY_MANAGER::PART_BUFFER::SetPart( LIB_PART* aPart )
|
void SYMBOL_LIBRARY_MANAGER::PART_BUFFER::SetPart( LIB_SYMBOL* aSymbol )
|
||||||
{
|
{
|
||||||
wxCHECK( m_part != aPart, /* void */ );
|
wxCHECK( m_part != aSymbol, /* void */ );
|
||||||
wxASSERT( aPart );
|
wxASSERT( aSymbol );
|
||||||
delete m_part;
|
delete m_part;
|
||||||
m_part = aPart;
|
m_part = aSymbol;
|
||||||
|
|
||||||
// If the part moves libraries then the original moves with it
|
// If the part moves libraries then the original moves with it
|
||||||
if( m_original->GetLibId().GetLibNickname() != m_part->GetLibId().GetLibNickname() )
|
if( m_original->GetLibId().GetLibNickname() != m_part->GetLibId().GetLibNickname() )
|
||||||
|
@ -854,12 +855,12 @@ void SYMBOL_LIBRARY_MANAGER::PART_BUFFER::SetPart( LIB_PART* aPart )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SYMBOL_LIBRARY_MANAGER::PART_BUFFER::SetOriginal( LIB_PART* aPart )
|
void SYMBOL_LIBRARY_MANAGER::PART_BUFFER::SetOriginal( LIB_SYMBOL* aSymbol )
|
||||||
{
|
{
|
||||||
wxCHECK( m_original != aPart, /* void */ );
|
wxCHECK( m_original != aSymbol, /* void */ );
|
||||||
wxASSERT( aPart );
|
wxASSERT( aSymbol );
|
||||||
delete m_original;
|
delete m_original;
|
||||||
m_original = aPart;
|
m_original = aSymbol;
|
||||||
|
|
||||||
// The original is not allowed to have a different library than its part
|
// The original is not allowed to have a different library than its part
|
||||||
if( m_original->GetLibId().GetLibNickname() != m_part->GetLibId().GetLibNickname() )
|
if( m_original->GetLibId().GetLibNickname() != m_part->GetLibId().GetLibNickname() )
|
||||||
|
@ -876,28 +877,28 @@ bool SYMBOL_LIBRARY_MANAGER::PART_BUFFER::IsModified() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetPart( const wxString& aAlias ) const
|
LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetPart( const wxString& aAlias ) const
|
||||||
{
|
{
|
||||||
auto buf = GetBuffer( aAlias );
|
auto buf = GetBuffer( aAlias );
|
||||||
|
|
||||||
if( !buf )
|
if( !buf )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
LIB_PART* part = buf->GetPart();
|
LIB_SYMBOL* symbol = buf->GetPart();
|
||||||
|
|
||||||
wxCHECK( part, nullptr );
|
wxCHECK( symbol, nullptr );
|
||||||
|
|
||||||
return part;
|
return symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::CreateBuffer( LIB_PART* aCopy, SCH_SCREEN* aScreen )
|
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::CreateBuffer( LIB_SYMBOL* aCopy, SCH_SCREEN* aScreen )
|
||||||
{
|
{
|
||||||
wxASSERT( aCopy );
|
wxASSERT( aCopy );
|
||||||
wxASSERT( aCopy->GetLib() == nullptr );
|
wxASSERT( aCopy->GetLib() == nullptr );
|
||||||
std::unique_ptr<SCH_SCREEN> screen( aScreen );
|
std::unique_ptr<SCH_SCREEN> screen( aScreen );
|
||||||
auto partBuf = std::make_shared<PART_BUFFER>( aCopy, std::move( screen ) );
|
auto symbolBuf = std::make_shared<PART_BUFFER>( aCopy, std::move( screen ) );
|
||||||
m_parts.push_back( partBuf );
|
m_parts.push_back( symbolBuf );
|
||||||
|
|
||||||
// Set the parent library name,
|
// Set the parent library name,
|
||||||
// otherwise it is empty as no library has been given as the owner during object construction
|
// otherwise it is empty as no library has been given as the owner during object construction
|
||||||
|
@ -911,11 +912,11 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::CreateBuffer( LIB_PART* aCopy, SCH_SCRE
|
||||||
|
|
||||||
|
|
||||||
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::UpdateBuffer(
|
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::UpdateBuffer(
|
||||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aPartBuf, LIB_PART* aCopy )
|
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aSymbolBuf, LIB_SYMBOL* aCopy )
|
||||||
{
|
{
|
||||||
wxCHECK( aCopy && aPartBuf, false );
|
wxCHECK( aCopy && aSymbolBuf, false );
|
||||||
|
|
||||||
LIB_PART* bufferedPart = aPartBuf->GetPart();
|
LIB_SYMBOL* bufferedPart = aSymbolBuf->GetPart();
|
||||||
|
|
||||||
wxCHECK( bufferedPart, false );
|
wxCHECK( bufferedPart, false );
|
||||||
|
|
||||||
|
@ -927,16 +928,16 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::UpdateBuffer(
|
||||||
|
|
||||||
|
|
||||||
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::DeleteBuffer(
|
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::DeleteBuffer(
|
||||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aPartBuf )
|
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aSymbolBuf )
|
||||||
{
|
{
|
||||||
auto partBufIt = std::find( m_parts.begin(), m_parts.end(), aPartBuf );
|
auto partBufIt = std::find( m_parts.begin(), m_parts.end(), aSymbolBuf );
|
||||||
wxCHECK( partBufIt != m_parts.end(), false );
|
wxCHECK( partBufIt != m_parts.end(), false );
|
||||||
|
|
||||||
bool retv = true;
|
bool retv = true;
|
||||||
|
|
||||||
// Remove all derived symbols to prevent broken inheritance.
|
// Remove all derived symbols to prevent broken inheritance.
|
||||||
if( aPartBuf->GetPart()->IsRoot() && HasDerivedSymbols( aPartBuf->GetPart()->GetName() )
|
if( aSymbolBuf->GetPart()->IsRoot() && HasDerivedSymbols( aSymbolBuf->GetPart()->GetName() )
|
||||||
&& removeChildSymbols( aPartBuf ) == 0 )
|
&& removeChildSymbols( aSymbolBuf ) == 0 )
|
||||||
{
|
{
|
||||||
retv = false;
|
retv = false;
|
||||||
}
|
}
|
||||||
|
@ -950,11 +951,11 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::DeleteBuffer(
|
||||||
|
|
||||||
|
|
||||||
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aPartBuf, SYMBOL_LIB_TABLE* aLibTable )
|
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aSymbolBuf, SYMBOL_LIB_TABLE* aLibTable )
|
||||||
{
|
{
|
||||||
wxCHECK( aPartBuf, false );
|
wxCHECK( aSymbolBuf, false );
|
||||||
LIB_PART* part = aPartBuf->GetPart();
|
LIB_SYMBOL* part = aSymbolBuf->GetPart();
|
||||||
LIB_PART* originalPart = aPartBuf->GetOriginal();
|
LIB_SYMBOL* originalPart = aSymbolBuf->GetOriginal();
|
||||||
wxCHECK( part && originalPart, false );
|
wxCHECK( part && originalPart, false );
|
||||||
SYMBOL_LIB_TABLE::SAVE_T result;
|
SYMBOL_LIB_TABLE::SAVE_T result;
|
||||||
PROPERTIES properties;
|
PROPERTIES properties;
|
||||||
|
@ -969,27 +970,27 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||||
|
|
||||||
if( part->IsAlias() )
|
if( part->IsAlias() )
|
||||||
{
|
{
|
||||||
LIB_PART* newCachedPart = new LIB_PART( *part );
|
LIB_SYMBOL* newCachedPart = new LIB_SYMBOL( *part );
|
||||||
std::shared_ptr< LIB_PART > bufferedParent = part->GetParent().lock();
|
std::shared_ptr< LIB_SYMBOL > bufferedParent = part->GetParent().lock();
|
||||||
|
|
||||||
wxCHECK( bufferedParent, false );
|
wxCHECK( bufferedParent, false );
|
||||||
|
|
||||||
LIB_PART* cachedParent = aLibTable->LoadSymbol( m_libName, bufferedParent->GetName() );
|
LIB_SYMBOL* cachedParent = aLibTable->LoadSymbol( m_libName, bufferedParent->GetName() );
|
||||||
|
|
||||||
if( !cachedParent )
|
if( !cachedParent )
|
||||||
{
|
{
|
||||||
cachedParent = new LIB_PART( *bufferedParent.get() );
|
cachedParent = new LIB_SYMBOL( *bufferedParent.get() );
|
||||||
newCachedPart->SetParent( cachedParent );
|
newCachedPart->SetParent( cachedParent );
|
||||||
result = aLibTable->SaveSymbol( m_libName, cachedParent );
|
result = aLibTable->SaveSymbol( m_libName, cachedParent );
|
||||||
wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false );
|
wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false );
|
||||||
result = aLibTable->SaveSymbol( m_libName, newCachedPart );
|
result = aLibTable->SaveSymbol( m_libName, newCachedPart );
|
||||||
wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false );
|
wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false );
|
||||||
|
|
||||||
LIB_PART* originalParent = new LIB_PART( *bufferedParent.get() );
|
LIB_SYMBOL* originalParent = new LIB_SYMBOL( *bufferedParent.get() );
|
||||||
aPartBuf->SetOriginal( originalParent );
|
aSymbolBuf->SetOriginal( originalParent );
|
||||||
originalPart = new LIB_PART( *part );
|
originalPart = new LIB_SYMBOL( *part );
|
||||||
originalPart->SetParent( originalParent );
|
originalPart->SetParent( originalParent );
|
||||||
aPartBuf->SetOriginal( originalPart );
|
aSymbolBuf->SetOriginal( originalPart );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1000,9 +1001,9 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR originalBufferedParent =
|
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR originalBufferedParent =
|
||||||
GetBuffer( bufferedParent->GetName() );
|
GetBuffer( bufferedParent->GetName() );
|
||||||
wxCHECK( originalBufferedParent, false );
|
wxCHECK( originalBufferedParent, false );
|
||||||
originalPart = new LIB_PART( *part );
|
originalPart = new LIB_SYMBOL( *part );
|
||||||
originalPart->SetParent( originalBufferedParent->GetPart() );
|
originalPart->SetParent( originalBufferedParent->GetPart() );
|
||||||
aPartBuf->SetOriginal( originalPart );
|
aSymbolBuf->SetOriginal( originalPart );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1011,20 +1012,20 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||||
|
|
||||||
if( GetDerivedSymbolNames( part->GetName(), derivedSymbols ) == 0 )
|
if( GetDerivedSymbolNames( part->GetName(), derivedSymbols ) == 0 )
|
||||||
{
|
{
|
||||||
result = aLibTable->SaveSymbol( m_libName, new LIB_PART( *part ) );
|
result = aLibTable->SaveSymbol( m_libName, new LIB_SYMBOL( *part ) );
|
||||||
wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false );
|
wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false );
|
||||||
aPartBuf->SetOriginal( new LIB_PART( *part ) );
|
aSymbolBuf->SetOriginal( new LIB_SYMBOL( *part ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LIB_PART* parentSymbol = new LIB_PART( *part );
|
LIB_SYMBOL* parentSymbol = new LIB_SYMBOL( *part );
|
||||||
|
|
||||||
aLibTable->SaveSymbol( m_libName, parentSymbol );
|
aLibTable->SaveSymbol( m_libName, parentSymbol );
|
||||||
|
|
||||||
for( auto entry : derivedSymbols )
|
for( auto entry : derivedSymbols )
|
||||||
{
|
{
|
||||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR symbol = GetBuffer( entry );
|
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR symbol = GetBuffer( entry );
|
||||||
LIB_PART* derivedSymbol = new LIB_PART( *symbol->GetPart() );
|
LIB_SYMBOL* derivedSymbol = new LIB_SYMBOL( *symbol->GetPart() );
|
||||||
derivedSymbol->SetParent( parentSymbol );
|
derivedSymbol->SetParent( parentSymbol );
|
||||||
result = aLibTable->SaveSymbol( m_libName, derivedSymbol );
|
result = aLibTable->SaveSymbol( m_libName, derivedSymbol );
|
||||||
wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false );
|
wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false );
|
||||||
|
@ -1038,12 +1039,12 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||||
|
|
||||||
|
|
||||||
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aPartBuf, const wxString& aFileName,
|
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aSymbolBuf, const wxString& aFileName,
|
||||||
SCH_PLUGIN* aPlugin, bool aBuffer )
|
SCH_PLUGIN* aPlugin, bool aBuffer )
|
||||||
{
|
{
|
||||||
wxCHECK( aPartBuf, false );
|
wxCHECK( aSymbolBuf, false );
|
||||||
LIB_PART* part = aPartBuf->GetPart();
|
LIB_SYMBOL* part = aSymbolBuf->GetPart();
|
||||||
LIB_PART* originalPart = aPartBuf->GetOriginal();
|
LIB_SYMBOL* originalPart = aSymbolBuf->GetOriginal();
|
||||||
wxCHECK( part && originalPart, false );
|
wxCHECK( part && originalPart, false );
|
||||||
wxCHECK( !aFileName.IsEmpty(), false );
|
wxCHECK( !aFileName.IsEmpty(), false );
|
||||||
|
|
||||||
|
@ -1062,12 +1063,12 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||||
|
|
||||||
if( part->IsAlias() )
|
if( part->IsAlias() )
|
||||||
{
|
{
|
||||||
LIB_PART* newCachedPart = new LIB_PART( *part );
|
LIB_SYMBOL* newCachedPart = new LIB_SYMBOL( *part );
|
||||||
std::shared_ptr< LIB_PART > bufferedParent = part->GetParent().lock();
|
std::shared_ptr< LIB_SYMBOL > bufferedParent = part->GetParent().lock();
|
||||||
|
|
||||||
wxCHECK( bufferedParent, false );
|
wxCHECK( bufferedParent, false );
|
||||||
|
|
||||||
LIB_PART* cachedParent = nullptr;
|
LIB_SYMBOL* cachedParent = nullptr;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1080,7 +1081,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||||
|
|
||||||
if( !cachedParent )
|
if( !cachedParent )
|
||||||
{
|
{
|
||||||
cachedParent = new LIB_PART( *bufferedParent.get() );
|
cachedParent = new LIB_SYMBOL( *bufferedParent.get() );
|
||||||
newCachedPart->SetParent( cachedParent );
|
newCachedPart->SetParent( cachedParent );
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -1103,11 +1104,11 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LIB_PART* originalParent = new LIB_PART( *bufferedParent.get() );
|
LIB_SYMBOL* originalParent = new LIB_SYMBOL( *bufferedParent.get() );
|
||||||
aPartBuf->SetOriginal( originalParent );
|
aSymbolBuf->SetOriginal( originalParent );
|
||||||
originalPart = new LIB_PART( *part );
|
originalPart = new LIB_SYMBOL( *part );
|
||||||
originalPart->SetParent( originalParent );
|
originalPart->SetParent( originalParent );
|
||||||
aPartBuf->SetOriginal( originalPart );
|
aSymbolBuf->SetOriginal( originalPart );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1126,9 +1127,9 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR originalBufferedParent =
|
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR originalBufferedParent =
|
||||||
GetBuffer( bufferedParent->GetName() );
|
GetBuffer( bufferedParent->GetName() );
|
||||||
wxCHECK( originalBufferedParent, false );
|
wxCHECK( originalBufferedParent, false );
|
||||||
originalPart = new LIB_PART( *part );
|
originalPart = new LIB_SYMBOL( *part );
|
||||||
originalPart->SetParent( originalBufferedParent->GetPart() );
|
originalPart->SetParent( originalBufferedParent->GetPart() );
|
||||||
aPartBuf->SetOriginal( originalPart );
|
aSymbolBuf->SetOriginal( originalPart );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1139,7 +1140,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
aPlugin->SaveSymbol( aFileName, new LIB_PART( *part ),
|
aPlugin->SaveSymbol( aFileName, new LIB_SYMBOL( *part ),
|
||||||
aBuffer ? &properties : nullptr );
|
aBuffer ? &properties : nullptr );
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
|
@ -1148,11 +1149,11 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
aPartBuf->SetOriginal( new LIB_PART( *part ) );
|
aSymbolBuf->SetOriginal( new LIB_SYMBOL( *part ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LIB_PART* parentSymbol = new LIB_PART( *part );
|
LIB_SYMBOL* parentSymbol = new LIB_SYMBOL( *part );
|
||||||
|
|
||||||
// Save the modified root symbol.
|
// Save the modified root symbol.
|
||||||
try
|
try
|
||||||
|
@ -1165,18 +1166,18 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
aPartBuf->SetOriginal( new LIB_PART( *part ) );
|
aSymbolBuf->SetOriginal( new LIB_SYMBOL( *part ) );
|
||||||
|
|
||||||
// Save the derived symbols.
|
// Save the derived symbols.
|
||||||
for( auto entry : derivedSymbols )
|
for( auto entry : derivedSymbols )
|
||||||
{
|
{
|
||||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR symbol = GetBuffer( entry );
|
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR symbol = GetBuffer( entry );
|
||||||
LIB_PART* derivedSymbol = new LIB_PART( *symbol->GetPart() );
|
LIB_SYMBOL* derivedSymbol = new LIB_SYMBOL( *symbol->GetPart() );
|
||||||
derivedSymbol->SetParent( parentSymbol );
|
derivedSymbol->SetParent( parentSymbol );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
aPlugin->SaveSymbol( aFileName, new LIB_PART( *derivedSymbol ),
|
aPlugin->SaveSymbol( aFileName, new LIB_SYMBOL( *derivedSymbol ),
|
||||||
aBuffer ? &properties : nullptr );
|
aBuffer ? &properties : nullptr );
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& ioe )
|
catch( const IO_ERROR& ioe )
|
||||||
|
@ -1262,9 +1263,9 @@ size_t SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetDerivedSymbolNames( const wxString
|
||||||
|
|
||||||
|
|
||||||
int SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::removeChildSymbols(
|
int SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::removeChildSymbols(
|
||||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aPartBuf )
|
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aSymbolBuf )
|
||||||
{
|
{
|
||||||
wxCHECK( aPartBuf && aPartBuf->GetPart()->IsRoot(), 0 );
|
wxCHECK( aSymbolBuf && aSymbolBuf->GetPart()->IsRoot(), 0 );
|
||||||
|
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
std::deque< SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR >::iterator it = m_parts.begin();
|
std::deque< SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR >::iterator it = m_parts.begin();
|
||||||
|
@ -1282,9 +1283,9 @@ int SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::removeChildSymbols(
|
||||||
|
|
||||||
wxCHECK2( parent, ++it; continue );
|
wxCHECK2( parent, ++it; continue );
|
||||||
|
|
||||||
if( parent->GetName() == aPartBuf->GetPart()->GetName() )
|
if( parent->GetName() == aSymbolBuf->GetPart()->GetName() )
|
||||||
{
|
{
|
||||||
wxCHECK2( parent == aPartBuf->GetPart()->SharedPtr(), ++it; continue );
|
wxCHECK2( parent == aSymbolBuf->GetPart()->SharedPtr(), ++it; continue );
|
||||||
|
|
||||||
m_deleted.emplace_back( *it );
|
m_deleted.emplace_back( *it );
|
||||||
it = m_parts.erase( it );
|
it = m_parts.erase( it );
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include <sch_io_mgr.h>
|
#include <sch_io_mgr.h>
|
||||||
#include <sch_screen.h>
|
#include <sch_screen.h>
|
||||||
|
|
||||||
class LIB_PART;
|
class LIB_SYMBOL;
|
||||||
class PART_LIB;
|
class PART_LIB;
|
||||||
class PROGRESS_REPORTER;
|
class PROGRESS_REPORTER;
|
||||||
class SCH_PLUGIN;
|
class SCH_PLUGIN;
|
||||||
|
@ -92,7 +92,7 @@ public:
|
||||||
*/
|
*/
|
||||||
SYMBOL_LIB_TABLE_ROW* GetLibrary( const wxString& aLibrary ) const;
|
SYMBOL_LIB_TABLE_ROW* GetLibrary( const wxString& aLibrary ) const;
|
||||||
|
|
||||||
std::list<LIB_PART*> GetAliases( const wxString& aLibrary ) const;
|
std::list<LIB_SYMBOL*> GetAliases( const wxString& aLibrary ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an empty library and adds it to the library table. The library file is created.
|
* Create an empty library and adds it to the library table. The library file is created.
|
||||||
|
@ -115,13 +115,13 @@ public:
|
||||||
* The library buffer creates a copy of the part.
|
* The library buffer creates a copy of the part.
|
||||||
* It is required to save the library to use the updated part in the schematic editor.
|
* It is required to save the library to use the updated part in the schematic editor.
|
||||||
*/
|
*/
|
||||||
bool UpdatePart( LIB_PART* aPart, const wxString& aLibrary );
|
bool UpdatePart( LIB_SYMBOL* aSymbol, const wxString& aLibrary );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the part buffer with a new version of the part when the name has changed.
|
* Update the part buffer with a new version of the part when the name has changed.
|
||||||
* The old library buffer will be deleted and a new one created with the new name.
|
* The old library buffer will be deleted and a new one created with the new name.
|
||||||
*/
|
*/
|
||||||
bool UpdatePartAfterRename( LIB_PART* aPart, const wxString& oldAlias,
|
bool UpdatePartAfterRename( LIB_SYMBOL* aSymbol, const wxString& oldAlias,
|
||||||
const wxString& aLibrary );
|
const wxString& aLibrary );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,16 +131,16 @@ public:
|
||||||
bool RemovePart( const wxString& aName, const wxString& aLibrary );
|
bool RemovePart( const wxString& aName, const wxString& aLibrary );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return either an alias of a working LIB_PART copy, or alias of the original part if there
|
* Return either an alias of a working LIB_SYMBOL copy, or alias of the original part if there
|
||||||
* is no working copy.
|
* is no working copy.
|
||||||
*/
|
*/
|
||||||
LIB_PART* GetAlias( const wxString& aAlias, const wxString& aLibrary ) const;
|
LIB_SYMBOL* GetAlias( const wxString& aAlias, const wxString& aLibrary ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the part copy from the buffer. In case it does not exist yet, the copy is created.
|
* Return the part copy from the buffer. In case it does not exist yet, the copy is created.
|
||||||
* #SYMBOL_LIBRARY_MANAGER retains the ownership.
|
* #SYMBOL_LIBRARY_MANAGER retains the ownership.
|
||||||
*/
|
*/
|
||||||
LIB_PART* GetBufferedPart( const wxString& aAlias, const wxString& aLibrary );
|
LIB_SYMBOL* GetBufferedPart( const wxString& aAlias, const wxString& aLibrary );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the screen used to edit a specific part. #SYMBOL_LIBRARY_MANAGER retains the
|
* Return the screen used to edit a specific part. #SYMBOL_LIBRARY_MANAGER retains the
|
||||||
|
@ -270,18 +270,18 @@ private:
|
||||||
return static_cast<SYMBOL_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
|
return static_cast<SYMBOL_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
///< Class to store a working copy of a LIB_PART object and editor context.
|
///< Class to store a working copy of a LIB_SYMBOL object and editor context.
|
||||||
class PART_BUFFER
|
class PART_BUFFER
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PART_BUFFER( LIB_PART* aPart = nullptr, std::unique_ptr<SCH_SCREEN> aScreen = nullptr );
|
PART_BUFFER( LIB_SYMBOL* aSymbol = nullptr, std::unique_ptr<SCH_SCREEN> aScreen = nullptr );
|
||||||
~PART_BUFFER();
|
~PART_BUFFER();
|
||||||
|
|
||||||
LIB_PART* GetPart() const { return m_part; }
|
LIB_SYMBOL* GetPart() const { return m_part; }
|
||||||
void SetPart( LIB_PART* aPart );
|
void SetPart( LIB_SYMBOL* aSymbol );
|
||||||
|
|
||||||
LIB_PART* GetOriginal() const { return m_original; }
|
LIB_SYMBOL* GetOriginal() const { return m_original; }
|
||||||
void SetOriginal( LIB_PART* aPart );
|
void SetOriginal( LIB_SYMBOL* aSymbol );
|
||||||
|
|
||||||
bool IsModified() const;
|
bool IsModified() const;
|
||||||
SCH_SCREEN* GetScreen() const { return m_screen.get(); }
|
SCH_SCREEN* GetScreen() const { return m_screen.get(); }
|
||||||
|
@ -305,8 +305,8 @@ private:
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<SCH_SCREEN> m_screen;
|
std::unique_ptr<SCH_SCREEN> m_screen;
|
||||||
|
|
||||||
LIB_PART* m_part; // Working copy
|
LIB_SYMBOL* m_part; // Working copy
|
||||||
LIB_PART* m_original; // Initial state of the part
|
LIB_SYMBOL* m_original; // Initial state of the part
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -335,16 +335,16 @@ private:
|
||||||
|
|
||||||
int GetHash() const { return m_hash; }
|
int GetHash() const { return m_hash; }
|
||||||
|
|
||||||
///< Return the working copy of a LIB_PART root object with specified alias.
|
///< Return the working copy of a LIB_SYMBOL root object with specified alias.
|
||||||
LIB_PART* GetPart( const wxString& aAlias ) const;
|
LIB_SYMBOL* GetPart( const wxString& aAlias ) const;
|
||||||
|
|
||||||
///< Create a new buffer to store a part. LIB_BUFFER takes ownership of aCopy.
|
///< Create a new buffer to store a part. LIB_BUFFER takes ownership of aCopy.
|
||||||
bool CreateBuffer( LIB_PART* aCopy, SCH_SCREEN* aScreen );
|
bool CreateBuffer( LIB_SYMBOL* aCopy, SCH_SCREEN* aScreen );
|
||||||
|
|
||||||
///< Update the buffered part with the contents of \a aCopy.
|
///< Update the buffered part with the contents of \a aCopy.
|
||||||
bool UpdateBuffer( PART_BUFFER::PTR aPartBuf, LIB_PART* aCopy );
|
bool UpdateBuffer( PART_BUFFER::PTR aSymbolBuf, LIB_SYMBOL* aCopy );
|
||||||
|
|
||||||
bool DeleteBuffer( PART_BUFFER::PTR aPartBuf );
|
bool DeleteBuffer( PART_BUFFER::PTR aSymbolBuf );
|
||||||
|
|
||||||
void ClearDeletedBuffer()
|
void ClearDeletedBuffer()
|
||||||
{
|
{
|
||||||
|
@ -353,14 +353,14 @@ private:
|
||||||
|
|
||||||
///< Save stored modifications to Symbol Lib Table. It may result in saving the symbol
|
///< Save stored modifications to Symbol Lib Table. It may result in saving the symbol
|
||||||
///< to disk as well, depending on the row properties.
|
///< to disk as well, depending on the row properties.
|
||||||
bool SaveBuffer( PART_BUFFER::PTR aPartBuf, SYMBOL_LIB_TABLE* aLibTable );
|
bool SaveBuffer( PART_BUFFER::PTR aSymbolBuf, SYMBOL_LIB_TABLE* aLibTable );
|
||||||
|
|
||||||
///< Save stored modifications using a plugin. aBuffer decides whether the changes
|
///< Save stored modifications using a plugin. aBuffer decides whether the changes
|
||||||
///< should be cached or stored directly to the disk (for SCH_LEGACY_PLUGIN).
|
///< should be cached or stored directly to the disk (for SCH_LEGACY_PLUGIN).
|
||||||
bool SaveBuffer( PART_BUFFER::PTR aPartBuf, const wxString& aFileName,
|
bool SaveBuffer( PART_BUFFER::PTR aSymbolBuf, const wxString& aFileName,
|
||||||
SCH_PLUGIN* aPlugin, bool aBuffer );
|
SCH_PLUGIN* aPlugin, bool aBuffer );
|
||||||
|
|
||||||
///< Return a part buffer with LIB_PART holding a particular alias
|
///< Return a part buffer with LIB_SYMBOL holding a particular alias
|
||||||
PART_BUFFER::PTR GetBuffer( const wxString& aAlias ) const;
|
PART_BUFFER::PTR GetBuffer( const wxString& aAlias ) const;
|
||||||
|
|
||||||
///< Return all buffered parts
|
///< Return all buffered parts
|
||||||
|
@ -399,7 +399,7 @@ private:
|
||||||
* @param aParent is the #PART_BUFFER to check against.
|
* @param aParent is the #PART_BUFFER to check against.
|
||||||
* @return the count of #PART_BUFFER objects removed from the library.
|
* @return the count of #PART_BUFFER objects removed from the library.
|
||||||
*/
|
*/
|
||||||
int removeChildSymbols( PART_BUFFER::PTR aPartBuf );
|
int removeChildSymbols( PART_BUFFER::PTR aSymbolBuf );
|
||||||
|
|
||||||
std::deque<PART_BUFFER::PTR> m_parts;
|
std::deque<PART_BUFFER::PTR> m_parts;
|
||||||
std::deque<PART_BUFFER::PTR> m_deleted; // Buffer for deleted parts until library is saved
|
std::deque<PART_BUFFER::PTR> m_deleted; // Buffer for deleted parts until library is saved
|
||||||
|
@ -408,9 +408,9 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a set of #LIB_PART objects belonging to the original library.
|
* Return a set of #LIB_SYMBOL objects belonging to the original library.
|
||||||
*/
|
*/
|
||||||
std::set<LIB_PART*> getOriginalParts( const wxString& aLibrary );
|
std::set<LIB_SYMBOL*> getOriginalParts( const wxString& aLibrary );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an existing library buffer or creates one to using Symbol Library Table to get
|
* Return an existing library buffer or creates one to using Symbol Library Table to get
|
||||||
|
|
|
@ -109,6 +109,7 @@ void SYMBOL_LIB_TABLE::Parse( LIB_TABLE_LEXER* in )
|
||||||
if( in->CurTok() != T_sym_lib_table )
|
if( in->CurTok() != T_sym_lib_table )
|
||||||
{
|
{
|
||||||
in->NeedLEFT();
|
in->NeedLEFT();
|
||||||
|
|
||||||
if( ( tok = in->NextTok() ) != T_sym_lib_table )
|
if( ( tok = in->NextTok() ) != T_sym_lib_table )
|
||||||
in->Expecting( T_sym_lib_table );
|
in->Expecting( T_sym_lib_table );
|
||||||
}
|
}
|
||||||
|
@ -317,7 +318,7 @@ SYMBOL_LIB_TABLE_ROW* SYMBOL_LIB_TABLE::FindRow( const wxString& aNickname, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SYMBOL_LIB_TABLE::LoadSymbolLib( std::vector<LIB_PART*>& aSymbolList,
|
void SYMBOL_LIB_TABLE::LoadSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
|
||||||
const wxString& aNickname, bool aPowerSymbolsOnly )
|
const wxString& aNickname, bool aPowerSymbolsOnly )
|
||||||
{
|
{
|
||||||
SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
||||||
|
@ -339,47 +340,47 @@ void SYMBOL_LIB_TABLE::LoadSymbolLib( std::vector<LIB_PART*>& aSymbolList,
|
||||||
// Therefore footprints cannot know their own library nickname when residing in
|
// Therefore footprints cannot know their own library nickname when residing in
|
||||||
// a symbol library.
|
// a symbol library.
|
||||||
// Only at this API layer can we tell the symbol about its actual library nickname.
|
// Only at this API layer can we tell the symbol about its actual library nickname.
|
||||||
for( LIB_PART* part : aSymbolList )
|
for( LIB_SYMBOL* symbol : aSymbolList )
|
||||||
{
|
{
|
||||||
LIB_ID id = part->GetLibId();
|
LIB_ID id = symbol->GetLibId();
|
||||||
|
|
||||||
id.SetLibNickname( row->GetNickName() );
|
id.SetLibNickname( row->GetNickName() );
|
||||||
part->SetLibId( id );
|
symbol->SetLibId( id );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SYMBOL_LIB_TABLE::LoadSymbol( const wxString& aNickname, const wxString& aSymbolName )
|
LIB_SYMBOL* SYMBOL_LIB_TABLE::LoadSymbol( const wxString& aNickname, const wxString& aSymbolName )
|
||||||
{
|
{
|
||||||
SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
||||||
|
|
||||||
if( !row || !row->plugin )
|
if( !row || !row->plugin )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
LIB_PART* part = row->plugin->LoadSymbol( row->GetFullURI( true ), aSymbolName,
|
LIB_SYMBOL* symbol = row->plugin->LoadSymbol( row->GetFullURI( true ), aSymbolName,
|
||||||
row->GetProperties() );
|
row->GetProperties() );
|
||||||
|
|
||||||
if( part == nullptr )
|
if( symbol == nullptr )
|
||||||
return part;
|
return symbol;
|
||||||
|
|
||||||
// The library cannot know its own name, because it might have been renamed or moved.
|
// The library cannot know its own name, because it might have been renamed or moved.
|
||||||
// Therefore footprints cannot know their own library nickname when residing in
|
// Therefore footprints cannot know their own library nickname when residing in
|
||||||
// a symbol library.
|
// a symbol library.
|
||||||
// Only at this API layer can we tell the symbol about its actual library nickname.
|
// Only at this API layer can we tell the symbol about its actual library nickname.
|
||||||
if( part )
|
if( symbol )
|
||||||
{
|
{
|
||||||
LIB_ID id = part->GetLibId();
|
LIB_ID id = symbol->GetLibId();
|
||||||
|
|
||||||
id.SetLibNickname( row->GetNickName() );
|
id.SetLibNickname( row->GetNickName() );
|
||||||
part->SetLibId( id );
|
symbol->SetLibId( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
return part;
|
return symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SYMBOL_LIB_TABLE::SAVE_T SYMBOL_LIB_TABLE::SaveSymbol( const wxString& aNickname,
|
SYMBOL_LIB_TABLE::SAVE_T SYMBOL_LIB_TABLE::SaveSymbol( const wxString& aNickname,
|
||||||
const LIB_PART* aSymbol, bool aOverwrite )
|
const LIB_SYMBOL* aSymbol, bool aOverwrite )
|
||||||
{
|
{
|
||||||
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
||||||
wxCHECK( row && row->plugin, SAVE_SKIPPED );
|
wxCHECK( row && row->plugin, SAVE_SKIPPED );
|
||||||
|
@ -394,9 +395,9 @@ SYMBOL_LIB_TABLE::SAVE_T SYMBOL_LIB_TABLE::SaveSymbol( const wxString& aNickname
|
||||||
|
|
||||||
wxString name = aSymbol->GetLibId().GetLibItemName();
|
wxString name = aSymbol->GetLibId().GetLibItemName();
|
||||||
|
|
||||||
std::unique_ptr< LIB_PART > symbol( row->plugin->LoadSymbol( row->GetFullURI( true ),
|
std::unique_ptr< LIB_SYMBOL > symbol( row->plugin->LoadSymbol( row->GetFullURI( true ),
|
||||||
name,
|
name,
|
||||||
row->GetProperties() ) );
|
row->GetProperties() ) );
|
||||||
|
|
||||||
if( symbol.get() )
|
if( symbol.get() )
|
||||||
return SAVE_SKIPPED;
|
return SAVE_SKIPPED;
|
||||||
|
@ -455,7 +456,7 @@ void SYMBOL_LIB_TABLE::CreateSymbolLib( const wxString& aNickname )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PART* SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname( const LIB_ID& aLibId )
|
LIB_SYMBOL* SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname( const LIB_ID& aLibId )
|
||||||
{
|
{
|
||||||
wxString nickname = aLibId.GetLibNickname();
|
wxString nickname = aLibId.GetLibNickname();
|
||||||
wxString name = aLibId.GetLibItemName();
|
wxString name = aLibId.GetLibItemName();
|
||||||
|
@ -475,7 +476,7 @@ LIB_PART* SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname( const LIB_ID& aLibId
|
||||||
{
|
{
|
||||||
// FootprintLoad() returns NULL on not found, does not throw exception
|
// FootprintLoad() returns NULL on not found, does not throw exception
|
||||||
// unless there's an IO_ERROR.
|
// unless there's an IO_ERROR.
|
||||||
LIB_PART* ret = LoadSymbol( nicks[i], name );
|
LIB_SYMBOL* ret = LoadSymbol( nicks[i], name );
|
||||||
|
|
||||||
if( ret )
|
if( ret )
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <sch_io_mgr.h>
|
#include <sch_io_mgr.h>
|
||||||
#include <lib_id.h>
|
#include <lib_id.h>
|
||||||
|
|
||||||
//class LIB_PART;
|
//class LIB_SYMBOL;
|
||||||
class SYMBOL_LIB_TABLE_GRID;
|
class SYMBOL_LIB_TABLE_GRID;
|
||||||
class DIALOG_SYMBOL_LIB_TABLE;
|
class DIALOG_SYMBOL_LIB_TABLE;
|
||||||
|
|
||||||
|
@ -156,22 +156,22 @@ public:
|
||||||
void EnumerateSymbolLib( const wxString& aNickname, wxArrayString& aAliasNames,
|
void EnumerateSymbolLib( const wxString& aNickname, wxArrayString& aAliasNames,
|
||||||
bool aPowerSymbolsOnly = false );
|
bool aPowerSymbolsOnly = false );
|
||||||
|
|
||||||
void LoadSymbolLib( std::vector<LIB_PART*>& aAliasList, const wxString& aNickname,
|
void LoadSymbolLib( std::vector<LIB_SYMBOL*>& aAliasList, const wxString& aNickname,
|
||||||
bool aPowerSymbolsOnly = false );
|
bool aPowerSymbolsOnly = false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a #LIB_PART having @a aName from the library given by @a aNickname.
|
* Load a #LIB_SYMBOL having @a aName from the library given by @a aNickname.
|
||||||
*
|
*
|
||||||
* @param aNickname is a locator for the "library", it is a "name" in #LIB_TABLE_ROW
|
* @param aNickname is a locator for the "library", it is a "name" in #LIB_TABLE_ROW
|
||||||
* @param aName is the name of the #LIB_PART to load.
|
* @param aName is the name of the #LIB_SYMBOL to load.
|
||||||
* @param aFlatten set to true to flatten derived parts.
|
* @param aFlatten set to true to flatten derived parts.
|
||||||
* @return the symbol alias if found or NULL if not found.
|
* @return the symbol alias if found or NULL if not found.
|
||||||
* @throw IO_ERROR if the library cannot be found or read. No exception
|
* @throw IO_ERROR if the library cannot be found or read. No exception
|
||||||
* is thrown in the case where \a aNickname cannot be found.
|
* is thrown in the case where \a aNickname cannot be found.
|
||||||
*/
|
*/
|
||||||
LIB_PART* LoadSymbol( const wxString& aNickname, const wxString& aName );
|
LIB_SYMBOL* LoadSymbol( const wxString& aNickname, const wxString& aName );
|
||||||
|
|
||||||
LIB_PART* LoadSymbol( const LIB_ID& aLibId )
|
LIB_SYMBOL* LoadSymbol( const LIB_ID& aLibId )
|
||||||
{
|
{
|
||||||
return LoadSymbol( aLibId.GetLibNickname(), aLibId.GetLibItemName() );
|
return LoadSymbol( aLibId.GetLibNickname(), aLibId.GetLibItemName() );
|
||||||
}
|
}
|
||||||
|
@ -188,8 +188,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* Write @a aSymbol to an existing library given by @a aNickname.
|
* Write @a aSymbol to an existing library given by @a aNickname.
|
||||||
*
|
*
|
||||||
* If a #LIB_PART by the same name already exists or there are any conflicting alias
|
* If a #LIB_SYMBOL by the same name already exists or there are any conflicting alias
|
||||||
* names, the new #LIB_PART will silently overwrite any existing aliases and/or part
|
* names, the new #LIB_SYMBOL will silently overwrite any existing aliases and/or part
|
||||||
* because libraries cannot have duplicate alias names. It is the responsibility of
|
* because libraries cannot have duplicate alias names. It is the responsibility of
|
||||||
* the caller to check the library for conflicts before saving.
|
* the caller to check the library for conflicts before saving.
|
||||||
*
|
*
|
||||||
|
@ -201,7 +201,7 @@ public:
|
||||||
* @return SAVE_T - SAVE_OK or SAVE_SKIPPED. If error saving, then IO_ERROR is thrown.
|
* @return SAVE_T - SAVE_OK or SAVE_SKIPPED. If error saving, then IO_ERROR is thrown.
|
||||||
* @throw IO_ERROR if there is a problem saving the symbol.
|
* @throw IO_ERROR if there is a problem saving the symbol.
|
||||||
*/
|
*/
|
||||||
SAVE_T SaveSymbol( const wxString& aNickname, const LIB_PART* aSymbol,
|
SAVE_T SaveSymbol( const wxString& aNickname, const LIB_SYMBOL* aSymbol,
|
||||||
bool aOverwrite = true );
|
bool aOverwrite = true );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -239,7 +239,7 @@ public:
|
||||||
//-----</PLUGIN API SUBSET, REBASED ON aNickname>---------------------------
|
//-----</PLUGIN API SUBSET, REBASED ON aNickname>---------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a #LIB_PART having @a aFootprintId with possibly an empty library nickname.
|
* Load a #LIB_SYMBOL having @a aFootprintId with possibly an empty library nickname.
|
||||||
*
|
*
|
||||||
* @param aId the library nickname and name of the symbol to load.
|
* @param aId the library nickname and name of the symbol to load.
|
||||||
* @return the library symbol if found (the library owns it) or NULL if not found.
|
* @return the library symbol if found (the library owns it) or NULL if not found.
|
||||||
|
@ -247,7 +247,7 @@ public:
|
||||||
* is thrown in the case where aId cannot be found.
|
* is thrown in the case where aId cannot be found.
|
||||||
* @throw PARSE_ERROR if @a aId is not parsed OK.
|
* @throw PARSE_ERROR if @a aId is not parsed OK.
|
||||||
*/
|
*/
|
||||||
LIB_PART* LoadSymbolWithOptionalNickname( const LIB_ID& aId );
|
LIB_SYMBOL* LoadSymbolWithOptionalNickname( const LIB_ID& aId );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the global symbol library table into \a aTable.
|
* Load the global symbol library table into \a aTable.
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue