Expunge the use of the word part from Eeschema code.
This commit is contained in:
parent
4418707e5e
commit
ee3eac325d
|
@ -54,11 +54,11 @@
|
|||
"This may cause some unexpected behavior when loading symbols into a schematic." )
|
||||
|
||||
|
||||
PART_LIB::PART_LIB( SCH_LIB_TYPE aType, const wxString& aFileName,
|
||||
SYMBOL_LIB::SYMBOL_LIB( SCH_LIB_TYPE aType, const wxString& aFileName,
|
||||
SCH_IO_MGR::SCH_FILE_T aPluginType ) :
|
||||
// start @ != 0 so each additional library added
|
||||
// is immediately detectable, zero would not be.
|
||||
m_mod_hash( PART_LIBS::GetModifyGeneration() ),
|
||||
m_mod_hash( SYMBOL_LIBS::GetModifyGeneration() ),
|
||||
m_pluginType( aPluginType )
|
||||
{
|
||||
type = aType;
|
||||
|
@ -78,12 +78,12 @@ PART_LIB::PART_LIB( SCH_LIB_TYPE aType, const wxString& aFileName,
|
|||
}
|
||||
|
||||
|
||||
PART_LIB::~PART_LIB()
|
||||
SYMBOL_LIB::~SYMBOL_LIB()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void PART_LIB::Save( bool aSaveDocFile )
|
||||
void SYMBOL_LIB::Save( bool aSaveDocFile )
|
||||
{
|
||||
wxCHECK_RET( m_plugin != nullptr, wxString::Format( "no plugin defined for library `%s`.",
|
||||
fileName.GetFullPath() ) );
|
||||
|
@ -98,7 +98,7 @@ void PART_LIB::Save( bool aSaveDocFile )
|
|||
}
|
||||
|
||||
|
||||
void PART_LIB::Create( const wxString& aFileName )
|
||||
void SYMBOL_LIB::Create( const wxString& aFileName )
|
||||
{
|
||||
wxString tmpFileName = fileName.GetFullPath();
|
||||
|
||||
|
@ -109,7 +109,7 @@ void PART_LIB::Create( const wxString& aFileName )
|
|||
}
|
||||
|
||||
|
||||
void PART_LIB::SetPluginType( SCH_IO_MGR::SCH_FILE_T aPluginType )
|
||||
void SYMBOL_LIB::SetPluginType( SCH_IO_MGR::SCH_FILE_T aPluginType )
|
||||
{
|
||||
if( m_pluginType != aPluginType )
|
||||
{
|
||||
|
@ -119,25 +119,25 @@ void PART_LIB::SetPluginType( SCH_IO_MGR::SCH_FILE_T aPluginType )
|
|||
}
|
||||
|
||||
|
||||
bool PART_LIB::IsCache() const
|
||||
bool SYMBOL_LIB::IsCache() const
|
||||
{
|
||||
return m_properties->Exists( SCH_LEGACY_PLUGIN::PropNoDocFile );
|
||||
}
|
||||
|
||||
|
||||
void PART_LIB::SetCache()
|
||||
void SYMBOL_LIB::SetCache()
|
||||
{
|
||||
(*m_properties)[ SCH_LEGACY_PLUGIN::PropNoDocFile ] = "";
|
||||
}
|
||||
|
||||
|
||||
bool PART_LIB::IsBuffering() const
|
||||
bool SYMBOL_LIB::IsBuffering() const
|
||||
{
|
||||
return m_properties->Exists( SCH_LEGACY_PLUGIN::PropBuffering );
|
||||
}
|
||||
|
||||
|
||||
void PART_LIB::EnableBuffering( bool aEnable )
|
||||
void SYMBOL_LIB::EnableBuffering( bool aEnable )
|
||||
{
|
||||
if( aEnable )
|
||||
(*m_properties)[ SCH_LEGACY_PLUGIN::PropBuffering ] = "";
|
||||
|
@ -146,7 +146,7 @@ void PART_LIB::EnableBuffering( bool aEnable )
|
|||
}
|
||||
|
||||
|
||||
void PART_LIB::GetPartNames( wxArrayString& aNames ) const
|
||||
void SYMBOL_LIB::GetSymbolNames( wxArrayString& aNames ) const
|
||||
{
|
||||
m_plugin->EnumerateSymbolLib( aNames, fileName.GetFullPath(), m_properties.get() );
|
||||
|
||||
|
@ -154,7 +154,7 @@ void PART_LIB::GetPartNames( wxArrayString& aNames ) const
|
|||
}
|
||||
|
||||
|
||||
void PART_LIB::GetParts( std::vector<LIB_SYMBOL*>& aSymbols ) const
|
||||
void SYMBOL_LIB::GetSymbols( std::vector<LIB_SYMBOL*>& aSymbols ) const
|
||||
{
|
||||
m_plugin->EnumerateSymbolLib( aSymbols, fileName.GetFullPath(), m_properties.get() );
|
||||
|
||||
|
@ -164,7 +164,7 @@ void PART_LIB::GetParts( std::vector<LIB_SYMBOL*>& aSymbols ) const
|
|||
}
|
||||
|
||||
|
||||
LIB_SYMBOL* PART_LIB::FindPart( const wxString& aName ) const
|
||||
LIB_SYMBOL* SYMBOL_LIB::FindSymbol( const wxString& aName ) const
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_plugin->LoadSymbol( fileName.GetFullPath(), aName, m_properties.get() );
|
||||
|
||||
|
@ -172,19 +172,19 @@ LIB_SYMBOL* PART_LIB::FindPart( const wxString& aName ) const
|
|||
// symbols. This allows the symbol library table conversion tool to determine the
|
||||
// correct library where the symbol was found.
|
||||
if( symbol && !symbol->GetLib() )
|
||||
symbol->SetLib( const_cast<PART_LIB*>( this ) );
|
||||
symbol->SetLib( const_cast<SYMBOL_LIB*>( this ) );
|
||||
|
||||
return symbol;
|
||||
}
|
||||
|
||||
|
||||
LIB_SYMBOL* PART_LIB::FindPart( const LIB_ID& aLibId ) const
|
||||
LIB_SYMBOL* SYMBOL_LIB::FindSymbol( const LIB_ID& aLibId ) const
|
||||
{
|
||||
return FindPart( aLibId.Format().wx_str() );
|
||||
return FindSymbol( aLibId.Format().wx_str() );
|
||||
}
|
||||
|
||||
|
||||
void PART_LIB::AddPart( LIB_SYMBOL* aSymbol )
|
||||
void SYMBOL_LIB::AddSymbol( LIB_SYMBOL* aSymbol )
|
||||
{
|
||||
// add a clone, not the caller's copy, the plugin take ownership of the new symbol.
|
||||
m_plugin->SaveSymbol( fileName.GetFullPath(),
|
||||
|
@ -200,7 +200,7 @@ void PART_LIB::AddPart( LIB_SYMBOL* aSymbol )
|
|||
}
|
||||
|
||||
|
||||
LIB_SYMBOL* PART_LIB::RemovePart( LIB_SYMBOL* aEntry )
|
||||
LIB_SYMBOL* SYMBOL_LIB::RemoveSymbol( LIB_SYMBOL* aEntry )
|
||||
{
|
||||
wxCHECK_MSG( aEntry != nullptr, nullptr, "NULL pointer cannot be removed from library." );
|
||||
|
||||
|
@ -216,14 +216,14 @@ LIB_SYMBOL* PART_LIB::RemovePart( LIB_SYMBOL* aEntry )
|
|||
}
|
||||
|
||||
|
||||
LIB_SYMBOL* PART_LIB::ReplacePart( LIB_SYMBOL* aOldPart, LIB_SYMBOL* aNewPart )
|
||||
LIB_SYMBOL* SYMBOL_LIB::ReplaceSymbol( LIB_SYMBOL* aOldSymbol, LIB_SYMBOL* aNewSymbol )
|
||||
{
|
||||
wxASSERT( aOldPart != nullptr );
|
||||
wxASSERT( aNewPart != nullptr );
|
||||
wxASSERT( aOldSymbol != nullptr );
|
||||
wxASSERT( aNewSymbol != nullptr );
|
||||
|
||||
m_plugin->DeleteSymbol( fileName.GetFullPath(), aOldPart->GetName(), m_properties.get() );
|
||||
m_plugin->DeleteSymbol( fileName.GetFullPath(), aOldSymbol->GetName(), m_properties.get() );
|
||||
|
||||
LIB_SYMBOL* my_part = new LIB_SYMBOL( *aNewPart, this );
|
||||
LIB_SYMBOL* my_part = new LIB_SYMBOL( *aNewSymbol, this );
|
||||
|
||||
m_plugin->SaveSymbol( fileName.GetFullPath(), my_part, m_properties.get() );
|
||||
|
||||
|
@ -237,13 +237,14 @@ LIB_SYMBOL* PART_LIB::ReplacePart( LIB_SYMBOL* aOldPart, LIB_SYMBOL* aNewPart )
|
|||
}
|
||||
|
||||
|
||||
PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName )
|
||||
SYMBOL_LIB* SYMBOL_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<SYMBOL_LIB> lib = std::make_unique<SYMBOL_LIB>( SCH_LIB_TYPE::LT_EESCHEMA,
|
||||
aFileName );
|
||||
|
||||
std::vector<LIB_SYMBOL*> parts;
|
||||
// This loads the library.
|
||||
lib->GetParts( parts );
|
||||
lib->GetSymbols( parts );
|
||||
|
||||
// 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
|
||||
|
@ -255,14 +256,14 @@ PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName )
|
|||
part->SetLib( lib.get() );
|
||||
}
|
||||
|
||||
PART_LIB* ret = lib.release();
|
||||
SYMBOL_LIB* ret = lib.release();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
PART_LIB* PART_LIBS::AddLibrary( const wxString& aFileName )
|
||||
SYMBOL_LIB* SYMBOL_LIBS::AddLibrary( const wxString& aFileName )
|
||||
{
|
||||
PART_LIB* lib;
|
||||
SYMBOL_LIB* lib;
|
||||
|
||||
wxFileName fn = aFileName;
|
||||
// Don't reload the library if it is already loaded.
|
||||
|
@ -273,7 +274,7 @@ PART_LIB* PART_LIBS::AddLibrary( const wxString& aFileName )
|
|||
|
||||
try
|
||||
{
|
||||
lib = PART_LIB::LoadLibrary( aFileName );
|
||||
lib = SYMBOL_LIB::LoadLibrary( aFileName );
|
||||
push_back( lib );
|
||||
|
||||
return lib;
|
||||
|
@ -285,18 +286,18 @@ PART_LIB* PART_LIBS::AddLibrary( const wxString& aFileName )
|
|||
}
|
||||
|
||||
|
||||
PART_LIB* PART_LIBS::AddLibrary( const wxString& aFileName, PART_LIBS::iterator& aIterator )
|
||||
SYMBOL_LIB* SYMBOL_LIBS::AddLibrary( const wxString& aFileName, SYMBOL_LIBS::iterator& aIterator )
|
||||
{
|
||||
// Don't reload the library if it is already loaded.
|
||||
wxFileName fn( aFileName );
|
||||
PART_LIB* lib = FindLibrary( fn.GetName() );
|
||||
SYMBOL_LIB* lib = FindLibrary( fn.GetName() );
|
||||
|
||||
if( lib )
|
||||
return lib;
|
||||
|
||||
try
|
||||
{
|
||||
lib = PART_LIB::LoadLibrary( aFileName );
|
||||
lib = SYMBOL_LIB::LoadLibrary( aFileName );
|
||||
|
||||
if( aIterator >= begin() && aIterator < end() )
|
||||
insert( aIterator, lib );
|
||||
|
@ -312,9 +313,9 @@ PART_LIB* PART_LIBS::AddLibrary( const wxString& aFileName, PART_LIBS::iterator&
|
|||
}
|
||||
|
||||
|
||||
PART_LIB* PART_LIBS::FindLibrary( const wxString& aName )
|
||||
SYMBOL_LIB* SYMBOL_LIBS::FindLibrary( const wxString& aName )
|
||||
{
|
||||
for( PART_LIBS::iterator it = begin(); it!=end(); ++it )
|
||||
for( SYMBOL_LIBS::iterator it = begin(); it!=end(); ++it )
|
||||
{
|
||||
if( it->GetName() == aName )
|
||||
return &*it;
|
||||
|
@ -324,9 +325,9 @@ PART_LIB* PART_LIBS::FindLibrary( const wxString& aName )
|
|||
}
|
||||
|
||||
|
||||
PART_LIB* PART_LIBS::GetCacheLibrary()
|
||||
SYMBOL_LIB* SYMBOL_LIBS::GetCacheLibrary()
|
||||
{
|
||||
for( PART_LIBS::iterator it = begin(); it!=end(); ++it )
|
||||
for( SYMBOL_LIBS::iterator it = begin(); it!=end(); ++it )
|
||||
{
|
||||
if( it->IsCache() )
|
||||
return &*it;
|
||||
|
@ -336,9 +337,9 @@ PART_LIB* PART_LIBS::GetCacheLibrary()
|
|||
}
|
||||
|
||||
|
||||
PART_LIB* PART_LIBS::FindLibraryByFullFileName( const wxString& aFullFileName )
|
||||
SYMBOL_LIB* SYMBOL_LIBS::FindLibraryByFullFileName( const wxString& aFullFileName )
|
||||
{
|
||||
for( PART_LIBS::iterator it = begin(); it!=end(); ++it )
|
||||
for( SYMBOL_LIBS::iterator it = begin(); it!=end(); ++it )
|
||||
{
|
||||
if( it->GetFullFileName() == aFullFileName )
|
||||
return &*it;
|
||||
|
@ -348,12 +349,12 @@ PART_LIB* PART_LIBS::FindLibraryByFullFileName( const wxString& aFullFileName )
|
|||
}
|
||||
|
||||
|
||||
wxArrayString PART_LIBS::GetLibraryNames( bool aSorted )
|
||||
wxArrayString SYMBOL_LIBS::GetLibraryNames( bool aSorted )
|
||||
{
|
||||
wxArrayString cacheNames;
|
||||
wxArrayString names;
|
||||
|
||||
for( PART_LIB& lib : *this )
|
||||
for( SYMBOL_LIB& lib : *this )
|
||||
{
|
||||
if( lib.IsCache() && aSorted )
|
||||
cacheNames.Add( lib.GetName() );
|
||||
|
@ -372,16 +373,16 @@ wxArrayString PART_LIBS::GetLibraryNames( bool aSorted )
|
|||
}
|
||||
|
||||
|
||||
LIB_SYMBOL* PART_LIBS::FindLibPart( const LIB_ID& aLibId, const wxString& aLibraryName )
|
||||
LIB_SYMBOL* SYMBOL_LIBS::FindLibSymbol( const LIB_ID& aLibId, const wxString& aLibraryName )
|
||||
{
|
||||
LIB_SYMBOL* part = nullptr;
|
||||
|
||||
for( PART_LIB& lib : *this )
|
||||
for( SYMBOL_LIB& lib : *this )
|
||||
{
|
||||
if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName )
|
||||
continue;
|
||||
|
||||
part = lib.FindPart( aLibId.GetLibItemName().wx_str() );
|
||||
part = lib.FindSymbol( aLibId.GetLibItemName().wx_str() );
|
||||
|
||||
if( part )
|
||||
break;
|
||||
|
@ -391,18 +392,18 @@ LIB_SYMBOL* PART_LIBS::FindLibPart( const LIB_ID& aLibId, const wxString& aLibra
|
|||
}
|
||||
|
||||
|
||||
void PART_LIBS::FindLibraryNearEntries( std::vector<LIB_SYMBOL*>& aCandidates,
|
||||
void SYMBOL_LIBS::FindLibraryNearEntries( std::vector<LIB_SYMBOL*>& aCandidates,
|
||||
const wxString& aEntryName,
|
||||
const wxString& aLibraryName )
|
||||
{
|
||||
for( PART_LIB& lib : *this )
|
||||
for( SYMBOL_LIB& lib : *this )
|
||||
{
|
||||
if( !aLibraryName.IsEmpty() && lib.GetName() != aLibraryName )
|
||||
continue;
|
||||
|
||||
wxArrayString partNames;
|
||||
|
||||
lib.GetPartNames( partNames );
|
||||
lib.GetSymbolNames( partNames );
|
||||
|
||||
if( partNames.IsEmpty() )
|
||||
continue;
|
||||
|
@ -410,35 +411,35 @@ void PART_LIBS::FindLibraryNearEntries( std::vector<LIB_SYMBOL*>& aCandidates,
|
|||
for( size_t i = 0; i < partNames.size(); i++ )
|
||||
{
|
||||
if( partNames[i].CmpNoCase( aEntryName ) == 0 )
|
||||
aCandidates.push_back( lib.FindPart( partNames[i] ) );
|
||||
aCandidates.push_back( lib.FindSymbol( partNames[i] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int PART_LIBS::s_modify_generation = 1; // starts at 1 and goes up
|
||||
std::mutex PART_LIBS::s_generationMutex;
|
||||
int SYMBOL_LIBS::s_modify_generation = 1; // starts at 1 and goes up
|
||||
std::mutex SYMBOL_LIBS::s_generationMutex;
|
||||
|
||||
|
||||
int PART_LIBS::GetModifyHash()
|
||||
int SYMBOL_LIBS::GetModifyHash()
|
||||
{
|
||||
int hash = 0;
|
||||
|
||||
for( PART_LIBS::const_iterator it = begin(); it != end(); ++it )
|
||||
for( SYMBOL_LIBS::const_iterator it = begin(); it != end(); ++it )
|
||||
{
|
||||
hash += it->GetModHash();
|
||||
}
|
||||
|
||||
// Rebuilding the cache (m_cache) does not change the GetModHash() value,
|
||||
// but changes PART_LIBS::s_modify_generation.
|
||||
// but changes SYMBOL_LIBS::s_modify_generation.
|
||||
// Take this change in account:
|
||||
hash += PART_LIBS::GetModifyGeneration();
|
||||
hash += SYMBOL_LIBS::GetModifyGeneration();
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
void PART_LIBS::LibNamesAndPaths( PROJECT* aProject, bool doSave,
|
||||
void SYMBOL_LIBS::LibNamesAndPaths( PROJECT* aProject, bool doSave,
|
||||
wxString* aPaths, wxArrayString* aNames )
|
||||
{
|
||||
wxCHECK_RET( aProject, "Null PROJECT in LibNamesAndPaths" );
|
||||
|
@ -464,7 +465,7 @@ void PART_LIBS::LibNamesAndPaths( PROJECT* aProject, bool doSave,
|
|||
}
|
||||
|
||||
|
||||
const wxString PART_LIBS::CacheName( const wxString& aFullProjectFilename )
|
||||
const wxString SYMBOL_LIBS::CacheName( const wxString& aFullProjectFilename )
|
||||
{
|
||||
wxFileName name = aFullProjectFilename;
|
||||
|
||||
|
@ -478,7 +479,7 @@ const wxString PART_LIBS::CacheName( const wxString& aFullProjectFilename )
|
|||
}
|
||||
|
||||
|
||||
void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
|
||||
void SYMBOL_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
|
||||
{
|
||||
wxString filename;
|
||||
wxString libs_not_found;
|
||||
|
@ -566,7 +567,7 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
|
|||
|
||||
// add the special cache library.
|
||||
wxString cache_name = CacheName( aProject->GetProjectFullName() );
|
||||
PART_LIB* cache_lib;
|
||||
SYMBOL_LIB* cache_lib;
|
||||
|
||||
if( !aProject->IsNullProject() && !cache_name.IsEmpty() )
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
/**
|
||||
* @file class_library.h
|
||||
* @brief Definition for part library class.
|
||||
* @brief Definition for symbol library class.
|
||||
*/
|
||||
|
||||
#ifndef CLASS_LIBRARY_H
|
||||
|
@ -50,12 +50,12 @@ class SCH_PLUGIN;
|
|||
#define DOC_EXT "dcm"
|
||||
|
||||
/*
|
||||
* Part Library version and file header macros.
|
||||
* Symbol Library version and file header macros.
|
||||
*/
|
||||
#define LIB_VERSION_MAJOR 2
|
||||
#define LIB_VERSION_MINOR 4
|
||||
|
||||
/* Must be the first line of part library (.lib) files. */
|
||||
/* Must be the first line of symbol library (.lib) files. */
|
||||
#define LIBFILE_IDENT "EESchema-LIBRARY Version"
|
||||
|
||||
#define LIB_VERSION( major, minor ) ( major * 100 + minor )
|
||||
|
@ -68,7 +68,7 @@ class SCH_PLUGIN;
|
|||
|
||||
/*
|
||||
* Library versions 2.4 and lower use the old separate library (.lib) and
|
||||
* document (.dcm) files. Part libraries after 2.4 merged the library
|
||||
* document (.dcm) files. Symbol libraries after 2.4 merged the library
|
||||
* and document files into a single library file. This macro checks if the
|
||||
* library version supports the old format
|
||||
*/
|
||||
|
@ -81,14 +81,14 @@ enum class SCH_LIB_TYPE
|
|||
LT_SYMBOL
|
||||
};
|
||||
|
||||
// Helper class to filter a list of libraries, and/or a list of PART_LIB
|
||||
// Helper class to filter a list of libraries, and/or a list of SYMBOL_LIB
|
||||
// in dialogs
|
||||
class SCHLIB_FILTER
|
||||
{
|
||||
public:
|
||||
SCHLIB_FILTER()
|
||||
{
|
||||
m_filterPowerParts = false;
|
||||
m_filterPowerSymbols = false;
|
||||
m_forceLoad = false;
|
||||
}
|
||||
|
||||
|
@ -122,19 +122,19 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* set the filtering of power parts
|
||||
* Set the filtering of power symbols
|
||||
*/
|
||||
void FilterPowerParts( bool aFilterEnable )
|
||||
void FilterPowerSymbols( bool aFilterEnable )
|
||||
{
|
||||
m_filterPowerParts = aFilterEnable;
|
||||
m_filterPowerSymbols = aFilterEnable;
|
||||
}
|
||||
|
||||
// Accessors
|
||||
|
||||
/**
|
||||
* @return true if the filtering of power parts is on
|
||||
* @return true if the filtering of power symbols is on
|
||||
*/
|
||||
bool GetFilterPowerParts() const { return m_filterPowerParts; }
|
||||
bool GetFilterPowerSymbols() const { return m_filterPowerSymbols; }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -143,8 +143,8 @@ public:
|
|||
const wxArrayString& GetAllowedLibList() const { return m_allowedLibs; }
|
||||
|
||||
/**
|
||||
* @return the name of the lib to use to load a part, or an a empty string
|
||||
* Useful to load (in lib editor or lib viewer) a part from a given library
|
||||
* @return the name of the lib to use to load a symbol, or an a empty string
|
||||
* Useful to load (in lib editor or lib viewer) a symbol from a given library
|
||||
*/
|
||||
const wxString& GetLibSource() const
|
||||
{
|
||||
|
@ -159,20 +159,20 @@ public:
|
|||
private:
|
||||
wxArrayString m_allowedLibs; ///< a list of lib names to list some libraries
|
||||
///< if empty: no filter
|
||||
bool m_filterPowerParts; ///< true to filter (show only) power parts
|
||||
bool m_forceLoad; // When true, load a part lib from the lib
|
||||
bool m_filterPowerSymbols; ///< true to filter (show only) power symbols
|
||||
bool m_forceLoad; // When true, load a symbol lib from the lib
|
||||
// which is given in m_allowedLibs[0]
|
||||
};
|
||||
|
||||
|
||||
/* Helpers for creating a list of part libraries. */
|
||||
class PART_LIB;
|
||||
/* Helpers for creating a list of symbol libraries. */
|
||||
class SYMBOL_LIB;
|
||||
class wxRegEx;
|
||||
|
||||
/**
|
||||
* LIB_SYMBOL map sorting.
|
||||
*/
|
||||
struct LibPartMapSort
|
||||
struct LibSymbolMapSort
|
||||
{
|
||||
bool operator() ( const wxString& aItem1, const wxString& aItem2 ) const
|
||||
{
|
||||
|
@ -180,42 +180,42 @@ struct LibPartMapSort
|
|||
}
|
||||
};
|
||||
|
||||
/// Part map used by part library object.
|
||||
/// Symbol map used by symbol library object.
|
||||
|
||||
typedef std::map< wxString, LIB_SYMBOL*, LibPartMapSort > LIB_SYMBOL_MAP;
|
||||
typedef std::map< wxString, LIB_SYMBOL*, LibSymbolMapSort > LIB_SYMBOL_MAP;
|
||||
typedef std::vector< LIB_SYMBOL* > LIB_SYMBOLS;
|
||||
typedef boost::ptr_vector< PART_LIB > PART_LIBS_BASE;
|
||||
typedef boost::ptr_vector< SYMBOL_LIB > SYMBOL_LIBS_BASE;
|
||||
|
||||
|
||||
/**
|
||||
* A collection of #PART_LIB objects.
|
||||
* A collection of #SYMBOL_LIB objects.
|
||||
*
|
||||
* It extends from PROJECT::_ELEM so it can be hung in the PROJECT. It does not use any
|
||||
* UI calls, but rather simply throws an IO_ERROR when there is a problem.
|
||||
*/
|
||||
class PART_LIBS : public PART_LIBS_BASE, public PROJECT::_ELEM
|
||||
class SYMBOL_LIBS : public SYMBOL_LIBS_BASE, public PROJECT::_ELEM
|
||||
{
|
||||
public:
|
||||
KICAD_T Type() override { return PART_LIBS_T; }
|
||||
KICAD_T Type() override { return SYMBOL_LIBS_T; }
|
||||
|
||||
static int s_modify_generation; ///< helper for GetModifyHash()
|
||||
static std::mutex s_generationMutex;
|
||||
|
||||
PART_LIBS()
|
||||
SYMBOL_LIBS()
|
||||
{
|
||||
IncrementModifyGeneration();
|
||||
}
|
||||
|
||||
static void IncrementModifyGeneration()
|
||||
{
|
||||
std::lock_guard<std::mutex> mut( PART_LIBS::s_generationMutex );
|
||||
++PART_LIBS::s_modify_generation;
|
||||
std::lock_guard<std::mutex> mut( SYMBOL_LIBS::s_generationMutex );
|
||||
++SYMBOL_LIBS::s_modify_generation;
|
||||
}
|
||||
|
||||
static int GetModifyGeneration()
|
||||
{
|
||||
std::lock_guard<std::mutex> mut( PART_LIBS::s_generationMutex );
|
||||
return PART_LIBS::s_modify_generation;
|
||||
std::lock_guard<std::mutex> mut( SYMBOL_LIBS::s_generationMutex );
|
||||
return SYMBOL_LIBS::s_modify_generation;
|
||||
}
|
||||
|
||||
/// Return the modification hash for all libraries. The value returned
|
||||
|
@ -223,22 +223,22 @@ public:
|
|||
int GetModifyHash();
|
||||
|
||||
/**
|
||||
* Allocate and adds a part library to the library list.
|
||||
* Allocate and adds a symbol library to the library list.
|
||||
*
|
||||
* @param aFileName - File name object of part library.
|
||||
* @param aFileName is the file name object of symbol library.
|
||||
* @throw IO_ERROR if there's any problem loading.
|
||||
*/
|
||||
PART_LIB* AddLibrary( const wxString& aFileName );
|
||||
SYMBOL_LIB* AddLibrary( const wxString& aFileName );
|
||||
|
||||
/**
|
||||
* Insert a part library into the library list.
|
||||
* Insert a symbol library into the library list.
|
||||
*
|
||||
* @param aFileName - File name object of part library.
|
||||
* @param aIterator - Iterator to insert library in front of.
|
||||
* @return PART_LIB* - the new PART_LIB, which remains owned by this PART_LIBS container.
|
||||
* @param aFileName is the file name object of symbol library.
|
||||
* @param aIterator is an iterator to insert library in front of.
|
||||
* @return the new SYMBOL_LIB, which remains owned by this SYMBOL_LIBS container.
|
||||
* @throw IO_ERROR if there's any problem loading.
|
||||
*/
|
||||
PART_LIB* AddLibrary( const wxString& aFileName, PART_LIBS::iterator& aIterator );
|
||||
SYMBOL_LIB* AddLibrary( const wxString& aFileName, SYMBOL_LIBS::iterator& aIterator );
|
||||
|
||||
/**
|
||||
* Load all of the project's libraries into this container, which should
|
||||
|
@ -250,7 +250,7 @@ public:
|
|||
void LoadAllLibraries( PROJECT* aProject, bool aShowProgress=true );
|
||||
|
||||
/**
|
||||
* Save or load the names of the currently configured part libraries (without paths).
|
||||
* Save or load the names of the currently configured symbol libraries (without paths).
|
||||
*/
|
||||
static void LibNamesAndPaths( PROJECT* aProject, bool doSave,
|
||||
wxString* aPaths, wxArrayString* aNames=NULL );
|
||||
|
@ -259,41 +259,41 @@ public:
|
|||
* Return the name of the cache library after potentially fixing it from
|
||||
* an older naming scheme. That is, the old file is renamed if needed.
|
||||
*
|
||||
* @param aFullProjectFilename - the *.pro filename with absolute path.
|
||||
* @param aFullProjectFilename is the *.pro filename with absolute path.
|
||||
*/
|
||||
static const wxString CacheName( const wxString& aFullProjectFilename );
|
||||
|
||||
/**
|
||||
* Find a part library by \a aName.
|
||||
* Find a symbol library by \a aName.
|
||||
*
|
||||
* @param aName - Library file name without path or extension to find.
|
||||
* @return Part library if found, otherwise NULL.
|
||||
* @param aName is the library file name without path or extension to find.
|
||||
* @return the symbol library if found, otherwise NULL.
|
||||
*/
|
||||
PART_LIB* FindLibrary( const wxString& aName );
|
||||
SYMBOL_LIB* FindLibrary( const wxString& aName );
|
||||
|
||||
PART_LIB* FindLibraryByFullFileName( const wxString& aFullFileName );
|
||||
SYMBOL_LIB* FindLibraryByFullFileName( const wxString& aFullFileName );
|
||||
|
||||
PART_LIB* GetCacheLibrary();
|
||||
SYMBOL_LIB* GetCacheLibrary();
|
||||
|
||||
/**
|
||||
* Return the list of part library file names without path and extension.
|
||||
* Return the list of symbol library file names without path and extension.
|
||||
*
|
||||
* @param aSorted - Sort the list of name if true. Otherwise use the library load order.
|
||||
* @return The list of library names.
|
||||
* @param aSorted sort the list of name if true. Otherwise use the library load order.
|
||||
* @return the list of library names.
|
||||
*/
|
||||
wxArrayString GetLibraryNames( bool aSorted = true );
|
||||
|
||||
/**
|
||||
* Search all libraries in the list for a part.
|
||||
* Search all libraries in the list for a symbol.
|
||||
*
|
||||
* A part object will always be returned. If the entry found
|
||||
* is an alias. The root part will be found and returned.
|
||||
* A symbol object will always be returned. If the entry found
|
||||
* is an alias. The root symbol will be found and returned.
|
||||
*
|
||||
* @param aLibId - The #LIB_ID of the symbol to search for.
|
||||
* @param aLibraryName - Name of the library to search for part.
|
||||
* @return LIB_SYMBOL* - The part object if found, otherwise NULL.
|
||||
* @param aLibId is the #LIB_ID of the symbol to search for.
|
||||
* @param aLibraryName is the name of the library to search for symbol.
|
||||
* @return the symbol object if found, otherwise NULL.
|
||||
*/
|
||||
LIB_SYMBOL* FindLibPart( const LIB_ID& aLibId, const wxString& aLibraryName = wxEmptyString );
|
||||
LIB_SYMBOL* FindLibSymbol( const LIB_ID& aLibId, const wxString& aLibraryName = wxEmptyString );
|
||||
|
||||
/**
|
||||
* Search all libraries in the list for a #LIB_SYMBOL using a case insensitive comparison.
|
||||
|
@ -304,9 +304,9 @@ public:
|
|||
* the chip name (name of alias in lib) can be broken.
|
||||
* This function can be used to display a list of candidates, in symbol properties dialog.
|
||||
*
|
||||
* @param aEntryName - Name of entries to search for (case insensitive).
|
||||
* @param aLibraryName - Name of the library to search.
|
||||
* @param aCandidates - a std::vector to store candidates
|
||||
* @param aEntryName is the name of entries to search for (case insensitive).
|
||||
* @param aLibraryName is the name of the library to search.
|
||||
* @param aCandidates is a std::vector to store candidates.
|
||||
*/
|
||||
void FindLibraryNearEntries( std::vector<LIB_SYMBOL*>& aCandidates, const wxString& aEntryName,
|
||||
const wxString& aLibraryName = wxEmptyString );
|
||||
|
@ -321,12 +321,12 @@ public:
|
|||
* @warning This code is obsolete with the exception of the cache library. All other
|
||||
* symbol library I/O is managed by the #SCH_IO_MGR object.
|
||||
*/
|
||||
class PART_LIB
|
||||
class SYMBOL_LIB
|
||||
{
|
||||
public:
|
||||
PART_LIB( SCH_LIB_TYPE aType, const wxString& aFileName,
|
||||
SYMBOL_LIB( SCH_LIB_TYPE aType, const wxString& aFileName,
|
||||
SCH_IO_MGR::SCH_FILE_T aPluginType = SCH_IO_MGR::SCH_LEGACY );
|
||||
~PART_LIB();
|
||||
~SYMBOL_LIB();
|
||||
|
||||
/**
|
||||
* @return a magic number that changes if the library has changed
|
||||
|
@ -364,26 +364,26 @@ public:
|
|||
/**
|
||||
* Load a string array with the names of all the entries in this library.
|
||||
*
|
||||
* @param aNames - String array to place entry names into.
|
||||
* @param aNames is the array to place entry names into.
|
||||
*/
|
||||
void GetPartNames( wxArrayString& aNames ) const;
|
||||
void GetSymbolNames( wxArrayString& aNames ) const;
|
||||
|
||||
/**
|
||||
* Load a vector with all the entries in this library.
|
||||
*
|
||||
* @param aSymbols is a vector to receive the aliases.
|
||||
*/
|
||||
void GetParts( std::vector<LIB_SYMBOL*>& aSymbols ) const;
|
||||
void GetSymbols( std::vector<LIB_SYMBOL*>& aSymbols ) const;
|
||||
|
||||
/**
|
||||
* Find #LIB_SYMBOL by \a aName.
|
||||
*
|
||||
* @param aName - Name of part, case sensitive.
|
||||
* @return LIB_SYMBOL pointer part if found, else NULL.
|
||||
* @param aName is the name of the symbol, case sensitive.
|
||||
* @return LIB_SYMBOL pointer symbol if found, else NULL.
|
||||
*/
|
||||
LIB_SYMBOL* FindPart( const wxString& aName ) const;
|
||||
LIB_SYMBOL* FindSymbol( const wxString& aName ) const;
|
||||
|
||||
LIB_SYMBOL* FindPart( const LIB_ID& aLibId ) const;
|
||||
LIB_SYMBOL* FindSymbol( const LIB_ID& aLibId ) const;
|
||||
|
||||
/**
|
||||
* Add \a aSymbol entry to library.
|
||||
|
@ -391,51 +391,52 @@ public:
|
|||
* @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.
|
||||
*
|
||||
* @param aSymbol - Part to add, caller retains ownership, a clone is added.
|
||||
* @param aSymbol is the symbol to add, caller retains ownership, a clone is added.
|
||||
*/
|
||||
void AddPart( LIB_SYMBOL* aSymbol );
|
||||
void AddSymbol( LIB_SYMBOL* aSymbol );
|
||||
|
||||
/**
|
||||
* Safely remove \a aEntry from the library and return the next entry.
|
||||
*
|
||||
* The next entry returned depends on the entry being removed. If the entry being
|
||||
* remove also removes the part, then the next entry from the list is returned.
|
||||
* If the entry being used only removes an alias from a part, then the next alias
|
||||
* of the part is returned.
|
||||
* remove also removes the symbol, then the next entry from the list is returned.
|
||||
* If the entry being used only removes an alias from a symbol, then the next alias
|
||||
* of the symbol is returned.
|
||||
*
|
||||
* @param aEntry - Entry to remove from library.
|
||||
* @param aEntry is the entry to remove from library.
|
||||
* @return The next entry in the library or NULL if the library is empty.
|
||||
*/
|
||||
LIB_SYMBOL* RemovePart( LIB_SYMBOL* aEntry );
|
||||
LIB_SYMBOL* RemoveSymbol( LIB_SYMBOL* aEntry );
|
||||
|
||||
/**
|
||||
* Replace an existing part entry in the library.
|
||||
* Replace an existing symbol entry in the library.
|
||||
*
|
||||
* Note a part can have an alias list,
|
||||
* so these alias will be added in library (and previously existing alias removed)
|
||||
* @param aOldPart - The part to replace.
|
||||
* @param aNewPart - The new part.
|
||||
* @note A symbol can have an alias list so these aliases will be added in library and
|
||||
* previously existing alias removed.
|
||||
*
|
||||
* @param aOldSymbol is the symbol to replace.
|
||||
* @param aNewSymbol is the new symbol.
|
||||
*/
|
||||
LIB_SYMBOL* ReplacePart( LIB_SYMBOL* aOldSymbol, LIB_SYMBOL* aNewSymbol );
|
||||
LIB_SYMBOL* ReplaceSymbol( LIB_SYMBOL* aOldSymbol, LIB_SYMBOL* aNewSymbol );
|
||||
|
||||
/**
|
||||
* Return the file name without path or extension.
|
||||
*
|
||||
* @return Name of library file.
|
||||
* @return the name of library file.
|
||||
*/
|
||||
const wxString GetName() const { return fileName.GetName(); }
|
||||
|
||||
/**
|
||||
* Return the full file library name with path and extension.
|
||||
*
|
||||
* @return wxString - Full library file name with path and extension.
|
||||
* @return the full library file name with path and extension.
|
||||
*/
|
||||
wxString GetFullFileName() const { return fileName.GetFullPath(); }
|
||||
|
||||
/**
|
||||
* Return the logical name of the library.
|
||||
*
|
||||
* @return wxString - The logical name of this library.
|
||||
* @return The logical name of this library.
|
||||
*/
|
||||
const wxString GetLogicalName() const
|
||||
{
|
||||
|
@ -454,11 +455,11 @@ public:
|
|||
/**
|
||||
* Allocate and load a symbol library file.
|
||||
*
|
||||
* @param aFileName - File name of the part library to load.
|
||||
* @return PART_LIB* - the allocated and loaded PART_LIB, which is owned by the caller.
|
||||
* @param aFileName is the file name of the symbol library to load.
|
||||
* @return SYMBOL_LIB* is the allocated and loaded SYMBOL_LIB, which is owned by the caller.
|
||||
* @throw IO_ERROR if there's any problem loading the library.
|
||||
*/
|
||||
static PART_LIB* LoadLibrary( const wxString& aFileName );
|
||||
static SYMBOL_LIB* LoadLibrary( const wxString& aFileName );
|
||||
|
||||
private:
|
||||
SCH_LIB_TYPE type; ///< Library type indicator.
|
||||
|
@ -479,7 +480,7 @@ private:
|
|||
/**
|
||||
* Case insensitive library name comparison.
|
||||
*/
|
||||
bool operator==( const PART_LIB& aLibrary, const wxString& aName );
|
||||
bool operator!=( const PART_LIB& aLibrary, const wxString& aName );
|
||||
bool operator==( const SYMBOL_LIB& aLibrary, const wxString& aName );
|
||||
bool operator!=( const SYMBOL_LIB& aLibrary, const wxString& aName );
|
||||
|
||||
#endif // CLASS_LIBRARY_H
|
||||
|
|
|
@ -311,7 +311,7 @@ DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
|
|||
|
||||
m_textLabel->SetLabel( m_field->GetName() + ":" );
|
||||
|
||||
// The library symbol may have been removed so using SCH_SYMBOL::GetPartRef() here
|
||||
// The library symbol may have been removed so using SCH_SYMBOL::GetLibSymbolRef() here
|
||||
// could result in a segfault. If the library symbol is no longer available, the
|
||||
// schematic fields can still edit so set the power symbol flag to false. This may not
|
||||
// be entirely accurate if the power library is missing but it's better then a segfault.
|
||||
|
|
|
@ -326,7 +326,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
|
|||
{
|
||||
if( aItem->Type() == SCH_SYMBOL_T )
|
||||
{
|
||||
bool isPower = static_cast<SCH_SYMBOL*>( aItem )->GetPartRef()->IsPower();
|
||||
bool isPower = static_cast<SCH_SYMBOL*>( aItem )->GetLibSymbolRef()->IsPower();
|
||||
|
||||
if( isPower != ( m_typeFilter->GetSelection() == 1 ) )
|
||||
return;
|
||||
|
|
|
@ -196,11 +196,11 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow()
|
|||
m_Parent->GetLibManager().GetRootSymbolNames( libName, rootSymbolNames );
|
||||
m_inheritanceSelectCombo->Append( rootSymbolNames );
|
||||
|
||||
PART_SPTR rootPart = m_libEntry->GetParent().lock();
|
||||
LIB_SYMBOL_SPTR rootSymbol = m_libEntry->GetParent().lock();
|
||||
|
||||
wxCHECK( rootPart, false );
|
||||
wxCHECK( rootSymbol, false );
|
||||
|
||||
wxString parentName = rootPart->GetName();
|
||||
wxString parentName = rootSymbol->GetName();
|
||||
int selection = m_inheritanceSelectCombo->FindString( parentName );
|
||||
|
||||
wxCHECK( selection != wxNOT_FOUND, false );
|
||||
|
@ -307,7 +307,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
|||
{
|
||||
wxString libName = m_Parent->GetCurLib();
|
||||
|
||||
if( m_Parent->GetLibManager().PartExists( newName, libName ) )
|
||||
if( m_Parent->GetLibManager().SymbolExists( newName, libName ) )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
|||
dc.SetUserScale( scale, scale );
|
||||
GRResetPenAndBrush( &dc );
|
||||
|
||||
PART_DRAW_OPTIONS opts;
|
||||
LIB_SYMBOL_OPTIONS opts;
|
||||
opts.draw_hidden_fields = true;
|
||||
opts.show_connect_point = true;
|
||||
|
||||
|
|
|
@ -282,9 +282,9 @@ DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES( SCH_EDIT_FRAME* aParent,
|
|||
m_dataModel( nullptr )
|
||||
{
|
||||
m_symbol = aSymbol;
|
||||
m_part = m_symbol->GetPartRef().get();
|
||||
m_part = m_symbol->GetLibSymbolRef().get();
|
||||
|
||||
// GetPartRef() now points to the cached part in the schematic, which should always be
|
||||
// GetLibSymbolRef() now points to the cached part in the schematic, which should always be
|
||||
// there for usual cases, but can be null when opening old schematics not storing the part
|
||||
// so we need to handle m_part == nullptr
|
||||
wxASSERT( m_part );
|
||||
|
|
|
@ -130,10 +130,10 @@ void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
|
|||
wxString paths;
|
||||
wxArrayString libNames;
|
||||
|
||||
PART_LIBS::LibNamesAndPaths( &Prj(), true, &paths, &libNames );
|
||||
SYMBOL_LIBS::LibNamesAndPaths( &Prj(), true, &paths, &libNames );
|
||||
|
||||
// Reload the cache symbol library.
|
||||
Prj().SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL );
|
||||
Prj().SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, NULL );
|
||||
Prj().SchLibs();
|
||||
|
||||
Raise();
|
||||
|
@ -141,11 +141,11 @@ void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
size_t DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable( std::vector< PART_LIB* >& aLibs )
|
||||
size_t DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable( std::vector< SYMBOL_LIB* >& aLibs )
|
||||
{
|
||||
PART_LIBS* libs = Prj().SchLibs();
|
||||
SYMBOL_LIBS* libs = Prj().SchLibs();
|
||||
|
||||
for( PART_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
|
||||
for( SYMBOL_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
|
||||
{
|
||||
// Ignore the cache library.
|
||||
if( it->IsCache() )
|
||||
|
@ -165,7 +165,7 @@ size_t DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable( std::vector< PART_
|
|||
void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter )
|
||||
{
|
||||
wxString msg;
|
||||
std::vector< PART_LIB* > libs;
|
||||
std::vector< SYMBOL_LIB* > libs;
|
||||
|
||||
if( getLibsNotInGlobalSymbolLibTable( libs ) )
|
||||
{
|
||||
|
@ -288,15 +288,15 @@ bool DIALOG_SYMBOL_REMAP::remapSymbolToLibTable( SCH_SYMBOL* aSymbol )
|
|||
wxCHECK_MSG( !aSymbol->GetLibId().GetLibItemName().empty(), false,
|
||||
"The symbol LIB_ID name is empty." );
|
||||
|
||||
PART_LIBS* libs = Prj().SchLibs();
|
||||
SYMBOL_LIBS* libs = Prj().SchLibs();
|
||||
|
||||
for( PART_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
|
||||
for( SYMBOL_LIBS_BASE::iterator it = libs->begin(); it != libs->end(); ++it )
|
||||
{
|
||||
// Ignore the cache library.
|
||||
if( it->IsCache() )
|
||||
continue;
|
||||
|
||||
LIB_SYMBOL* alias = it->FindPart( aSymbol->GetLibId().GetLibItemName().wx_str() );
|
||||
LIB_SYMBOL* alias = it->FindSymbol( aSymbol->GetLibId().GetLibItemName().wx_str() );
|
||||
|
||||
// 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
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#define _DIALOG_SYMBOL_REMAP_H_
|
||||
|
||||
|
||||
class PART_LIB;
|
||||
class SYMBOL_LIB;
|
||||
class SCH_SYMBOL;
|
||||
class REPORTER;
|
||||
|
||||
|
@ -59,7 +59,7 @@ private:
|
|||
* list.
|
||||
* @return the number of libraries found.
|
||||
*/
|
||||
size_t getLibsNotInGlobalSymbolLibTable( std::vector< PART_LIB* >& aLibs );
|
||||
size_t getLibsNotInGlobalSymbolLibTable( std::vector< SYMBOL_LIB* >& aLibs );
|
||||
|
||||
void createProjectSymbolLibTable( REPORTER& aReporter );
|
||||
|
||||
|
|
|
@ -57,13 +57,13 @@ enum id_eeschema_frm
|
|||
ID_IMPORT_NON_KICAD_SCH = ID_END_LIST,
|
||||
|
||||
/* Library editor horizontal toolbar IDs. */
|
||||
ID_LIBEDIT_SELECT_PART_NUMBER,
|
||||
ID_LIBEDIT_SELECT_UNIT_NUMBER,
|
||||
|
||||
/* Library viewer horizontal toolbar IDs */
|
||||
ID_LIBVIEW_SELECT_PART,
|
||||
ID_LIBVIEW_NEXT,
|
||||
ID_LIBVIEW_PREVIOUS,
|
||||
ID_LIBVIEW_SELECT_PART_NUMBER,
|
||||
ID_LIBVIEW_SELECT_UNIT_NUMBER,
|
||||
ID_LIBVIEW_LIB_LIST,
|
||||
ID_LIBVIEW_SYM_LIST,
|
||||
|
||||
|
|
|
@ -690,7 +690,7 @@ int ERC_TESTER::TestLibSymbolIssues()
|
|||
|
||||
wxCHECK2( symbol, continue );
|
||||
|
||||
LIB_SYMBOL* libSymbolInSchematic = symbol->GetPartRef().get();
|
||||
LIB_SYMBOL* libSymbolInSchematic = symbol->GetLibSymbolRef().get();
|
||||
|
||||
wxCHECK2( libSymbolInSchematic, continue );
|
||||
|
||||
|
|
|
@ -344,21 +344,21 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
{
|
||||
// Don't reload the symbol libraries if we are just launching Eeschema from KiCad again.
|
||||
// They are already saved in the kiface project object.
|
||||
if( differentProject || !Prj().GetElem( PROJECT::ELEM_SCH_PART_LIBS ) )
|
||||
if( differentProject || !Prj().GetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS ) )
|
||||
{
|
||||
// load the libraries here, not in SCH_SCREEN::Draw() which is a context
|
||||
// that will not tolerate DisplayError() dialog since we're already in an
|
||||
// event handler in there.
|
||||
// And when a schematic file is loaded, we need these libs to initialize
|
||||
// some parameters (links to PART LIB, dangling ends ...)
|
||||
Prj().SetElem( PROJECT::ELEM_SCH_PART_LIBS, nullptr );
|
||||
Prj().SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, nullptr );
|
||||
Prj().SchLibs();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No legacy symbol libraries including the cache are loaded with the new file format.
|
||||
Prj().SetElem( PROJECT::ELEM_SCH_PART_LIBS, nullptr );
|
||||
Prj().SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, nullptr );
|
||||
}
|
||||
|
||||
// Load the symbol library table, this will be used forever more.
|
||||
|
@ -475,7 +475,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
wxString paths;
|
||||
wxArrayString libNames;
|
||||
|
||||
PART_LIBS::LibNamesAndPaths( &Prj(), false, &paths, &libNames );
|
||||
SYMBOL_LIBS::LibNamesAndPaths( &Prj(), false, &paths, &libNames );
|
||||
|
||||
if( !libNames.IsEmpty() )
|
||||
{
|
||||
|
@ -499,7 +499,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
|
||||
libNames.Clear();
|
||||
paths.Clear();
|
||||
PART_LIBS::LibNamesAndPaths( &Prj(), true, &paths, &libNames );
|
||||
SYMBOL_LIBS::LibNamesAndPaths( &Prj(), true, &paths, &libNames );
|
||||
}
|
||||
|
||||
if( !cfg || !cfg->m_RescueNeverShow )
|
||||
|
@ -510,7 +510,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
}
|
||||
|
||||
// Ensure there is only one legacy library loaded and that it is the cache library.
|
||||
PART_LIBS* legacyLibs = Schematic().Prj().SchLibs();
|
||||
SYMBOL_LIBS* legacyLibs = Schematic().Prj().SchLibs();
|
||||
|
||||
if( legacyLibs->GetLibraryCount() == 0 )
|
||||
{
|
||||
|
|
|
@ -116,7 +116,7 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte
|
|||
|
||||
adapter->AssignIntrinsicRanks();
|
||||
|
||||
if( aFilter->GetFilterPowerParts() )
|
||||
if( aFilter->GetFilterPowerSymbols() )
|
||||
adapter->SetFilter( SYMBOL_TREE_MODEL_ADAPTER::SYM_FILTER_POWER );
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,8 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte
|
|||
history_list.push_back( symbol );
|
||||
}
|
||||
|
||||
adapter->DoAddLibrary( "-- " + _( "Recently Used" ) + " --", wxEmptyString, history_list, true );
|
||||
adapter->DoAddLibrary( "-- " + _( "Recently Used" ) + " --", wxEmptyString, history_list,
|
||||
true );
|
||||
|
||||
if( !aHistoryList.empty() )
|
||||
adapter->SetPreselectNode( aHistoryList[0].LibId, aHistoryList[0].Unit );
|
||||
|
@ -235,14 +236,14 @@ void SCH_EDIT_FRAME::SelectUnit( SCH_SYMBOL* aSymbol, int aUnit )
|
|||
|
||||
void SCH_EDIT_FRAME::ConvertPart( SCH_SYMBOL* aSymbol )
|
||||
{
|
||||
if( !aSymbol || !aSymbol->GetPartRef() )
|
||||
if( !aSymbol || !aSymbol->GetLibSymbolRef() )
|
||||
return;
|
||||
|
||||
wxString msg;
|
||||
|
||||
if( !aSymbol->GetPartRef()->HasConversion() )
|
||||
if( !aSymbol->GetLibSymbolRef()->HasConversion() )
|
||||
{
|
||||
LIB_ID id = aSymbol->GetPartRef()->GetLibId();
|
||||
LIB_ID id = aSymbol->GetLibSymbolRef()->GetLibId();
|
||||
|
||||
msg.Printf( _( "No alternate body style found for symbol \"%s\" in library \"%s\"." ),
|
||||
id.GetLibItemName().wx_str(), id.GetLibNickname().wx_str() );
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
class wxFrame;
|
||||
class wxDialog;
|
||||
class PART_LIBS;
|
||||
class SYMBOL_LIBS;
|
||||
class SCH_SYMBOL;
|
||||
class SCH_TEXT;
|
||||
class SCH_SHEET_PATH;
|
||||
|
|
|
@ -180,7 +180,7 @@ wxString LIB_PIN::GetShownName() const
|
|||
void LIB_PIN::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||
const TRANSFORM& aTransform )
|
||||
{
|
||||
PART_DRAW_OPTIONS* opts = (PART_DRAW_OPTIONS*) aData;
|
||||
LIB_SYMBOL_OPTIONS* opts = (LIB_SYMBOL_OPTIONS*) aData;
|
||||
bool drawHiddenFields = opts ? opts->draw_hidden_fields : false;
|
||||
bool showPinType = opts ? opts->show_elec_type : false;
|
||||
bool show_connect_point = opts ? opts->show_connect_point : false;
|
||||
|
|
|
@ -79,7 +79,7 @@ struct null_deleter
|
|||
};
|
||||
|
||||
|
||||
LIB_SYMBOL::LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent, PART_LIB* aLibrary ) :
|
||||
LIB_SYMBOL::LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent, SYMBOL_LIB* aLibrary ) :
|
||||
EDA_ITEM( LIB_SYMBOL_T ),
|
||||
m_me( this, null_deleter() ),
|
||||
m_includeInBom( true ),
|
||||
|
@ -110,7 +110,7 @@ LIB_SYMBOL::LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent, PART_LIB* aL
|
|||
}
|
||||
|
||||
|
||||
LIB_SYMBOL::LIB_SYMBOL( const LIB_SYMBOL& aSymbol, PART_LIB* aLibrary ) :
|
||||
LIB_SYMBOL::LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary ) :
|
||||
EDA_ITEM( aSymbol ),
|
||||
m_me( this, null_deleter() )
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ LIB_SYMBOL::LIB_SYMBOL( const LIB_SYMBOL& aSymbol, PART_LIB* aLibrary ) :
|
|||
}
|
||||
}
|
||||
|
||||
PART_SPTR parent = aSymbol.m_parent.lock();
|
||||
LIB_SYMBOL_SPTR parent = aSymbol.m_parent.lock();
|
||||
|
||||
if( parent )
|
||||
SetParent( parent.get() );
|
||||
|
@ -201,7 +201,7 @@ const LIB_SYMBOL& LIB_SYMBOL::operator=( const LIB_SYMBOL& aSymbol )
|
|||
|
||||
m_drawings.sort();
|
||||
|
||||
PART_SPTR parent = aSymbol.m_parent.lock();
|
||||
LIB_SYMBOL_SPTR parent = aSymbol.m_parent.lock();
|
||||
|
||||
if( parent )
|
||||
SetParent( parent.get() );
|
||||
|
@ -337,7 +337,7 @@ std::unique_ptr< LIB_SYMBOL > LIB_SYMBOL::Flatten() const
|
|||
|
||||
if( IsAlias() )
|
||||
{
|
||||
PART_SPTR parent = m_parent.lock();
|
||||
LIB_SYMBOL_SPTR parent = m_parent.lock();
|
||||
|
||||
wxCHECK_MSG( parent, retv,
|
||||
wxString::Format( "Parent of derived symbol '%s' undefined", m_name ) );
|
||||
|
@ -410,7 +410,7 @@ const wxString LIB_SYMBOL::GetLibraryName() const
|
|||
|
||||
bool LIB_SYMBOL::IsPower() const
|
||||
{
|
||||
if( PART_SPTR parent = m_parent.lock() )
|
||||
if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
|
||||
return parent->m_options == ENTRY_POWER;
|
||||
|
||||
return m_options == ENTRY_POWER;
|
||||
|
@ -419,7 +419,7 @@ bool LIB_SYMBOL::IsPower() const
|
|||
|
||||
void LIB_SYMBOL::SetPower()
|
||||
{
|
||||
if( PART_SPTR parent = m_parent.lock() )
|
||||
if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
|
||||
parent->m_options = ENTRY_POWER;
|
||||
|
||||
m_options = ENTRY_POWER;
|
||||
|
@ -428,7 +428,7 @@ void LIB_SYMBOL::SetPower()
|
|||
|
||||
bool LIB_SYMBOL::IsNormal() const
|
||||
{
|
||||
if( PART_SPTR parent = m_parent.lock() )
|
||||
if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
|
||||
return parent->m_options == ENTRY_NORMAL;
|
||||
|
||||
return m_options == ENTRY_NORMAL;
|
||||
|
@ -437,7 +437,7 @@ bool LIB_SYMBOL::IsNormal() const
|
|||
|
||||
void LIB_SYMBOL::SetNormal()
|
||||
{
|
||||
if( PART_SPTR parent = m_parent.lock() )
|
||||
if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
|
||||
parent->m_options = ENTRY_NORMAL;
|
||||
|
||||
m_options = ENTRY_NORMAL;
|
||||
|
@ -477,7 +477,7 @@ wxString LIB_SYMBOL::SubReference( int aUnit, bool aAddSeparator )
|
|||
|
||||
|
||||
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 LIB_SYMBOL_OPTIONS& aOpts )
|
||||
{
|
||||
/* draw background for filled items using background option
|
||||
* Solid lines will be drawn after the background
|
||||
|
@ -701,7 +701,7 @@ void LIB_SYMBOL::GetPins( LIB_PINS& aList, int aUnit, int aConvert ) const
|
|||
* when m_convert == 0, the body item is common to shapes
|
||||
*/
|
||||
|
||||
PART_SPTR parent = m_parent.lock();
|
||||
LIB_SYMBOL_SPTR parent = m_parent.lock();
|
||||
const LIB_ITEMS_CONTAINER& drawItems = parent ? parent->m_drawings : m_drawings;
|
||||
|
||||
for( const LIB_ITEM& item : drawItems[LIB_PIN_T] )
|
||||
|
@ -1029,7 +1029,7 @@ bool LIB_SYMBOL::HasConversion() const
|
|||
return true;
|
||||
}
|
||||
|
||||
if( PART_SPTR parent = m_parent.lock() )
|
||||
if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
|
||||
{
|
||||
for( const LIB_ITEM& item : parent->GetDrawItems() )
|
||||
{
|
||||
|
@ -1164,7 +1164,7 @@ void LIB_SYMBOL::SetUnitCount( int aCount, bool aDuplicateDrawItems )
|
|||
|
||||
int LIB_SYMBOL::GetUnitCount() const
|
||||
{
|
||||
if( PART_SPTR parent = m_parent.lock() )
|
||||
if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
|
||||
return parent->GetUnitCount();
|
||||
|
||||
return m_unitCount;
|
||||
|
@ -1253,9 +1253,9 @@ std::vector<LIB_ITEM*> LIB_SYMBOL::GetUnitItems( int aUnit, int aConvert )
|
|||
}
|
||||
|
||||
|
||||
std::vector<struct PART_UNITS> LIB_SYMBOL::GetUnitDrawItems()
|
||||
std::vector<struct LIB_SYMBOL_UNITS> LIB_SYMBOL::GetUnitDrawItems()
|
||||
{
|
||||
std::vector<struct PART_UNITS> units;
|
||||
std::vector<struct LIB_SYMBOL_UNITS> units;
|
||||
|
||||
for( LIB_ITEM& item : m_drawings )
|
||||
{
|
||||
|
@ -1272,7 +1272,7 @@ std::vector<struct PART_UNITS> LIB_SYMBOL::GetUnitDrawItems()
|
|||
|
||||
if( it == units.end() )
|
||||
{
|
||||
struct PART_UNITS newUnit;
|
||||
struct LIB_SYMBOL_UNITS newUnit;
|
||||
newUnit.m_unit = item.GetUnit();
|
||||
newUnit.m_convert = item.GetConvert();
|
||||
newUnit.m_items.push_back( &item );
|
||||
|
@ -1288,14 +1288,14 @@ std::vector<struct PART_UNITS> LIB_SYMBOL::GetUnitDrawItems()
|
|||
}
|
||||
|
||||
|
||||
std::vector<struct PART_UNITS> LIB_SYMBOL::GetUniqueUnits()
|
||||
std::vector<struct LIB_SYMBOL_UNITS> LIB_SYMBOL::GetUniqueUnits()
|
||||
{
|
||||
int unitNum;
|
||||
size_t i;
|
||||
struct PART_UNITS unit;
|
||||
struct LIB_SYMBOL_UNITS unit;
|
||||
std::vector<LIB_ITEM*> compareDrawItems;
|
||||
std::vector<LIB_ITEM*> currentDrawItems;
|
||||
std::vector<struct PART_UNITS> uniqueUnits;
|
||||
std::vector<struct LIB_SYMBOL_UNITS> uniqueUnits;
|
||||
|
||||
// The first unit is guaranteed to be unique so always include it.
|
||||
unit.m_unit = 1;
|
||||
|
|
|
@ -36,14 +36,14 @@
|
|||
class EDA_RECT;
|
||||
class LINE_READER;
|
||||
class OUTPUTFORMATTER;
|
||||
class PART_LIB;
|
||||
class SYMBOL_LIB;
|
||||
class LIB_SYMBOL;
|
||||
class LIB_FIELD;
|
||||
class TEST_LIB_SYMBOL_FIXTURE;
|
||||
|
||||
|
||||
typedef std::shared_ptr<LIB_SYMBOL> PART_SPTR; ///< shared pointer to LIB_SYMBOL
|
||||
typedef std::weak_ptr<LIB_SYMBOL> PART_REF; ///< weak pointer to LIB_SYMBOL
|
||||
typedef std::shared_ptr<LIB_SYMBOL> LIB_SYMBOL_SPTR; ///< shared pointer to LIB_SYMBOL
|
||||
typedef std::weak_ptr<LIB_SYMBOL> LIB_SYMBOL_REF; ///< weak pointer to LIB_SYMBOL
|
||||
typedef MULTIVECTOR<LIB_ITEM, LIB_ARC_T, LIB_FIELD_T> LIB_ITEMS_CONTAINER;
|
||||
typedef LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS;
|
||||
|
||||
|
@ -59,7 +59,7 @@ enum LIBRENTRYOPTIONS
|
|||
extern bool operator<( const LIB_SYMBOL& aItem1, const LIB_SYMBOL& aItem2 );
|
||||
|
||||
|
||||
struct PART_DRAW_OPTIONS
|
||||
struct LIB_SYMBOL_OPTIONS
|
||||
{
|
||||
TRANSFORM transform; // Coordinate adjustment settings
|
||||
bool draw_visible_fields; // Whether to draw "visible" fields
|
||||
|
@ -68,7 +68,7 @@ struct PART_DRAW_OPTIONS
|
|||
bool show_connect_point; // Whether to show the pin connect point marker (small circle)
|
||||
// useful in dialog pin properties
|
||||
|
||||
PART_DRAW_OPTIONS()
|
||||
LIB_SYMBOL_OPTIONS()
|
||||
{
|
||||
transform = DefaultTransform;
|
||||
draw_visible_fields = true;
|
||||
|
@ -79,7 +79,7 @@ struct PART_DRAW_OPTIONS
|
|||
};
|
||||
|
||||
|
||||
struct PART_UNITS
|
||||
struct LIB_SYMBOL_UNITS
|
||||
{
|
||||
int m_unit; ///< The unit number.
|
||||
int m_convert; ///< The alternate body style of the unit.
|
||||
|
@ -97,14 +97,14 @@ class LIB_SYMBOL : public EDA_ITEM, public LIB_TREE_ITEM
|
|||
{
|
||||
public:
|
||||
LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent = nullptr,
|
||||
PART_LIB* aLibrary = nullptr );
|
||||
SYMBOL_LIB* aLibrary = nullptr );
|
||||
|
||||
LIB_SYMBOL( const LIB_SYMBOL& aSymbol, PART_LIB* aLibrary = NULL );
|
||||
LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary = NULL );
|
||||
|
||||
virtual ~LIB_SYMBOL();
|
||||
|
||||
///< 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; }
|
||||
LIB_SYMBOL_SPTR SharedPtr() const { return m_me; }
|
||||
|
||||
/**
|
||||
* Create a copy of a LIB_SYMBOL and assigns unique KIIDs to the copy and its children.
|
||||
|
@ -121,8 +121,8 @@ public:
|
|||
}
|
||||
|
||||
void SetParent( LIB_SYMBOL* aParent = nullptr );
|
||||
PART_REF& GetParent() { return m_parent; }
|
||||
const PART_REF& GetParent() const { return m_parent; }
|
||||
LIB_SYMBOL_REF& GetParent() { return m_parent; }
|
||||
const LIB_SYMBOL_REF& GetParent() const { return m_parent; }
|
||||
|
||||
virtual wxString GetClass() const override
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ public:
|
|||
{
|
||||
if( m_description.IsEmpty() && IsAlias() )
|
||||
{
|
||||
if( PART_SPTR parent = m_parent.lock() )
|
||||
if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
|
||||
return parent->GetDescription();
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ public:
|
|||
{
|
||||
if( m_keyWords.IsEmpty() && IsAlias() )
|
||||
{
|
||||
if( PART_SPTR parent = m_parent.lock() )
|
||||
if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
|
||||
return parent->GetKeyWords();
|
||||
}
|
||||
|
||||
|
@ -173,8 +173,8 @@ public:
|
|||
|
||||
const wxString GetLibraryName() const;
|
||||
|
||||
PART_LIB* GetLib() const { return m_library; }
|
||||
void SetLib( PART_LIB* aLibrary ) { m_library = aLibrary; }
|
||||
SYMBOL_LIB* GetLib() const { return m_library; }
|
||||
void SetLib( SYMBOL_LIB* aLibrary ) { m_library = aLibrary; }
|
||||
|
||||
timestamp_t GetLastModDate() const { return m_lastModDate; }
|
||||
|
||||
|
@ -184,7 +184,7 @@ public:
|
|||
{
|
||||
if( m_fpFilters.IsEmpty() && IsAlias() )
|
||||
{
|
||||
if( PART_SPTR parent = m_parent.lock() )
|
||||
if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
|
||||
return parent->GetFPFilters();
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ public:
|
|||
* @param aOpts - Drawing options
|
||||
*/
|
||||
void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||
int aMulti, int aConvert, const PART_DRAW_OPTIONS& aOpts );
|
||||
int aMulti, int aConvert, const LIB_SYMBOL_OPTIONS& aOpts );
|
||||
|
||||
/**
|
||||
* Plot lib symbol to plotter.
|
||||
|
@ -624,7 +624,7 @@ public:
|
|||
* @note This does not include LIB_FIELD objects since they are not associated with
|
||||
* unit and/or convert numbers.
|
||||
*/
|
||||
std::vector<struct PART_UNITS> GetUnitDrawItems();
|
||||
std::vector<struct LIB_SYMBOL_UNITS> GetUnitDrawItems();
|
||||
|
||||
/**
|
||||
* Return a list of unit numbers that are unique to this symbol.
|
||||
|
@ -634,7 +634,7 @@ public:
|
|||
*
|
||||
* @return a list of unique unit numbers and their associated draw items.
|
||||
*/
|
||||
std::vector<struct PART_UNITS> GetUniqueUnits();
|
||||
std::vector<struct LIB_SYMBOL_UNITS> GetUniqueUnits();
|
||||
|
||||
/**
|
||||
* Return a list of item pointers for \a aUnit and \a aConvert for this symbol.
|
||||
|
@ -659,8 +659,8 @@ private:
|
|||
void deleteAllFields();
|
||||
|
||||
private:
|
||||
PART_SPTR m_me;
|
||||
PART_REF m_parent; ///< Use for inherited symbols.
|
||||
LIB_SYMBOL_SPTR m_me;
|
||||
LIB_SYMBOL_REF m_parent; ///< Use for inherited symbols.
|
||||
LIB_ID m_libId;
|
||||
timestamp_t m_lastModDate;
|
||||
|
||||
|
@ -679,7 +679,7 @@ private:
|
|||
|
||||
LIB_ITEMS_CONTAINER m_drawings;
|
||||
|
||||
PART_LIB* m_library;
|
||||
SYMBOL_LIB* m_library;
|
||||
wxString m_name;
|
||||
wxString m_description;
|
||||
wxString m_keyWords; ///< Search keywords
|
||||
|
|
|
@ -69,7 +69,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
|
|||
SCH_SCREENS screens( Schematic().Root() );
|
||||
|
||||
// Create a new empty library to archive symbols:
|
||||
std::unique_ptr<PART_LIB> archLib = std::make_unique<PART_LIB>( SCH_LIB_TYPE::LT_EESCHEMA,
|
||||
std::unique_ptr<SYMBOL_LIB> archLib = std::make_unique<SYMBOL_LIB>( SCH_LIB_TYPE::LT_EESCHEMA,
|
||||
aFileName );
|
||||
|
||||
// Save symbols to file only when the library will be fully filled
|
||||
|
@ -90,7 +90,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
|
|||
|
||||
try
|
||||
{
|
||||
if( archLib->FindPart( symbol->GetLibId() ) )
|
||||
if( archLib->FindSymbol( symbol->GetLibId() ) )
|
||||
continue;
|
||||
|
||||
libSymbol = GetLibPart( symbol->GetLibId(), true );
|
||||
|
@ -116,8 +116,8 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
|
|||
// Use the full LIB_ID as the symbol name to prevent symbol name collisions.
|
||||
flattenedSymbol->SetName( symbol->GetLibId().GetUniStringLibId() );
|
||||
|
||||
// AddPart() does first clone the symbol before adding.
|
||||
archLib->AddPart( flattenedSymbol.get() );
|
||||
// AddSymbol() does first clone the symbol before adding.
|
||||
archLib->AddSymbol( flattenedSymbol.get() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2017 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013-2017 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -92,11 +92,11 @@ SCH_SYMBOL* NETLIST_EXPORTER_BASE::findNextSymbol( EDA_ITEM* aItem, SCH_SHEET_PA
|
|||
// removed because with multiple instances of one schematic (several sheets pointing to
|
||||
// 1 screen), this will be erroneously be toggled.
|
||||
|
||||
if( !symbol->GetPartRef() )
|
||||
if( !symbol->GetLibSymbolRef() )
|
||||
return nullptr;
|
||||
|
||||
// If symbol is a "multi parts per package" type
|
||||
if( symbol->GetPartRef()->GetUnitCount() > 1 )
|
||||
if( symbol->GetLibSymbolRef()->GetUnitCount() > 1 )
|
||||
{
|
||||
// test if this reference has already been processed, and if so skip
|
||||
if( m_referencesAlreadyFound.Lookup( ref ) )
|
||||
|
@ -104,7 +104,7 @@ SCH_SYMBOL* NETLIST_EXPORTER_BASE::findNextSymbol( EDA_ITEM* aItem, SCH_SHEET_PA
|
|||
}
|
||||
|
||||
// record the usage of this library symbol entry.
|
||||
m_libParts.insert( symbol->GetPartRef().get() ); // rejects non-unique pointers
|
||||
m_libParts.insert( symbol->GetLibSymbolRef().get() ); // rejects non-unique pointers
|
||||
|
||||
return symbol;
|
||||
}
|
||||
|
@ -135,18 +135,18 @@ void NETLIST_EXPORTER_BASE::CreatePinList( SCH_SYMBOL* aSymbol,
|
|||
// removed because with multiple instances of one schematic (several sheets pointing to
|
||||
// 1 screen), this will be erroneously be toggled.
|
||||
|
||||
if( !aSymbol->GetPartRef() )
|
||||
if( !aSymbol->GetLibSymbolRef() )
|
||||
return;
|
||||
|
||||
m_sortedSymbolPinList.clear();
|
||||
|
||||
// If symbol is a "multi parts per package" type
|
||||
if( aSymbol->GetPartRef()->GetUnitCount() > 1 )
|
||||
if( aSymbol->GetLibSymbolRef()->GetUnitCount() > 1 )
|
||||
{
|
||||
// Collect all pins for this reference designator by searching the entire design for
|
||||
// other parts with the same reference designator.
|
||||
// This is only done once, it would be too expensive otherwise.
|
||||
findAllUnitsOfSymbol( aSymbol, aSymbol->GetPartRef().get(),
|
||||
findAllUnitsOfSymbol( aSymbol, aSymbol->GetLibSymbolRef().get(),
|
||||
aSheetPath, aKeepUnconnectedPins );
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ void NETLIST_EXPORTER_BASE::CreatePinList( SCH_SYMBOL* aSymbol,
|
|||
eraseDuplicatePins();
|
||||
|
||||
// record the usage of this library symbol
|
||||
m_libParts.insert( aSymbol->GetPartRef().get() ); // rejects non-unique pointers
|
||||
m_libParts.insert( aSymbol->GetLibSymbolRef().get() ); // rejects non-unique pointers
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -79,8 +79,10 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||
|
||||
CreatePinList( symbol, &sheet, true );
|
||||
|
||||
if( symbol->GetPartRef() && symbol->GetPartRef()->GetFPFilters().GetCount() != 0 )
|
||||
cmpList.push_back( SCH_REFERENCE( symbol, symbol->GetPartRef().get(), sheet ) );
|
||||
if( symbol->GetLibSymbolRef()
|
||||
&& symbol->GetLibSymbolRef()->GetFPFilters().GetCount() != 0 )
|
||||
cmpList.push_back( SCH_REFERENCE( symbol, symbol->GetLibSymbolRef().get(),
|
||||
sheet ) );
|
||||
|
||||
footprint = symbol->GetFootprint( &sheet, true );
|
||||
footprint.Replace( wxT( " " ), wxT( "_" ) );
|
||||
|
|
|
@ -242,8 +242,8 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_FIELD aField, SCH_S
|
|||
wxString nodeSeq;
|
||||
std::vector<LIB_PIN*> pins;
|
||||
|
||||
wxCHECK( aSymbol->GetPartRef(), wxString() );
|
||||
aSymbol->GetPartRef()->GetPins( pins );
|
||||
wxCHECK( aSymbol->GetLibSymbolRef(), wxString() );
|
||||
aSymbol->GetLibSymbolRef()->GetPins( pins );
|
||||
|
||||
for( LIB_PIN* pin : pins )
|
||||
nodeSeq += pin->GetNumber() + " ";
|
||||
|
|
|
@ -297,9 +297,9 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
|
|||
// "logical" library name, which is in anticipation of a better search algorithm
|
||||
// for parts based on "logical_lib.part" and where logical_lib is merely the library
|
||||
// name minus path and extension.
|
||||
if( symbol->GetPartRef() )
|
||||
if( symbol->GetLibSymbolRef() )
|
||||
xlibsource->AddAttribute( "lib",
|
||||
symbol->GetPartRef()->GetLibId().GetLibNickname() );
|
||||
symbol->GetLibSymbolRef()->GetLibId().GetLibNickname() );
|
||||
|
||||
// We only want the symbol name, not the full LIB_ID.
|
||||
xlibsource->AddAttribute( "part", symbol->GetLibId().GetLibItemName() );
|
||||
|
|
|
@ -83,15 +83,15 @@ static void getSymbols( SCHEMATIC* aSchematic, std::vector<SCH_SYMBOL*>& aSymbol
|
|||
* Search the libraries for the first symbol with a given name.
|
||||
*
|
||||
* @param aName - name to search for
|
||||
* @param aLibs - the loaded PART_LIBS
|
||||
* @param aLibs - the loaded SYMBOL_LIBS
|
||||
* @param aCached - whether we are looking for the cached symbol
|
||||
*/
|
||||
static LIB_SYMBOL* findSymbol( const wxString& aName, PART_LIBS* aLibs, bool aCached )
|
||||
static LIB_SYMBOL* findSymbol( const wxString& aName, SYMBOL_LIBS* aLibs, bool aCached )
|
||||
{
|
||||
LIB_SYMBOL *symbol = NULL;
|
||||
wxString new_name = LIB_ID::FixIllegalChars( aName );
|
||||
|
||||
for( PART_LIB& each_lib : *aLibs )
|
||||
for( SYMBOL_LIB& each_lib : *aLibs )
|
||||
{
|
||||
if( aCached && !each_lib.IsCache() )
|
||||
continue;
|
||||
|
@ -99,7 +99,7 @@ static LIB_SYMBOL* findSymbol( const wxString& aName, PART_LIBS* aLibs, bool aCa
|
|||
if( !aCached && each_lib.IsCache() )
|
||||
continue;
|
||||
|
||||
symbol = each_lib.FindPart( new_name );
|
||||
symbol = each_lib.FindSymbol( new_name );
|
||||
|
||||
if( symbol )
|
||||
break;
|
||||
|
@ -161,7 +161,7 @@ void RESCUE_CASE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
|||
|
||||
LIB_ID id( wxEmptyString, search_name );
|
||||
|
||||
case_sensitive_match = aRescuer.GetPrj()->SchLibs()->FindLibPart( id );
|
||||
case_sensitive_match = aRescuer.GetPrj()->SchLibs()->FindLibSymbol( id );
|
||||
|
||||
// If the case sensitive match failed, try a case insensitive match.
|
||||
if( !case_sensitive_match )
|
||||
|
@ -320,7 +320,7 @@ bool RESCUE_CACHE_CANDIDATE::PerformAction( RESCUER* aRescuer )
|
|||
|
||||
std::unique_ptr<LIB_SYMBOL> new_symbol = tmp->Flatten();
|
||||
new_symbol->SetName( m_new_name );
|
||||
aRescuer->AddPart( new_symbol.get() );
|
||||
aRescuer->AddSymbol( new_symbol.get() );
|
||||
|
||||
for( SCH_SYMBOL* eachSymbol : *aRescuer->GetSymbols() )
|
||||
{
|
||||
|
@ -399,7 +399,7 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
|
|||
if( !cache_match && !lib_match )
|
||||
continue;
|
||||
|
||||
PART_SPTR lib_match_parent;
|
||||
LIB_SYMBOL_SPTR lib_match_parent;
|
||||
|
||||
// If it's a derive symbol, use the parent symbol to perform the pin test.
|
||||
if( lib_match && lib_match->IsAlias() )
|
||||
|
@ -482,7 +482,7 @@ bool RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::PerformAction( RESCUER* aRescuer )
|
|||
std::unique_ptr<LIB_SYMBOL> new_symbol = tmp->Flatten();
|
||||
new_symbol->SetLibId( m_new_id );
|
||||
new_symbol->SetName( m_new_id.GetLibItemName() );
|
||||
aRescuer->AddPart( new_symbol.get() );
|
||||
aRescuer->AddSymbol( new_symbol.get() );
|
||||
|
||||
for( SCH_SYMBOL* eachSymbol : *aRescuer->GetSymbols() )
|
||||
{
|
||||
|
@ -645,7 +645,7 @@ void LEGACY_RESCUER::OpenRescueLibrary()
|
|||
{
|
||||
wxFileName fn = GetRescueLibraryFileName( m_schematic );
|
||||
|
||||
std::unique_ptr<PART_LIB> rescue_lib = std::make_unique<PART_LIB>( SCH_LIB_TYPE::LT_EESCHEMA,
|
||||
std::unique_ptr<SYMBOL_LIB> rescue_lib = std::make_unique<SYMBOL_LIB>( SCH_LIB_TYPE::LT_EESCHEMA,
|
||||
fn.GetFullPath() );
|
||||
|
||||
m_rescue_lib = std::move( rescue_lib );
|
||||
|
@ -653,19 +653,19 @@ void LEGACY_RESCUER::OpenRescueLibrary()
|
|||
|
||||
// If a rescue library already exists copy the contents of that library so we do not
|
||||
// lose an previous rescues.
|
||||
PART_LIB* rescueLib = m_prj->SchLibs()->FindLibrary( fn.GetName() );
|
||||
SYMBOL_LIB* rescueLib = m_prj->SchLibs()->FindLibrary( fn.GetName() );
|
||||
|
||||
if( rescueLib )
|
||||
{
|
||||
// For items in the rescue library, aliases are the root symbol.
|
||||
std::vector< LIB_SYMBOL* > symbols;
|
||||
|
||||
rescueLib->GetParts( symbols );
|
||||
rescueLib->GetSymbols( symbols );
|
||||
|
||||
for( auto symbol : symbols )
|
||||
{
|
||||
// The LIB_SYMBOL copy constructor flattens derived symbols (formerly known as aliases).
|
||||
m_rescue_lib->AddPart( new LIB_SYMBOL( *symbol, m_rescue_lib.get() ) );
|
||||
m_rescue_lib->AddSymbol( new LIB_SYMBOL( *symbol, m_rescue_lib.get() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -691,17 +691,17 @@ bool LEGACY_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
|||
wxString libPaths;
|
||||
|
||||
wxString libName = m_rescue_lib->GetName();
|
||||
PART_LIBS *libs = dynamic_cast<PART_LIBS*>( m_prj->GetElem( PROJECT::ELEM_SCH_PART_LIBS ) );
|
||||
SYMBOL_LIBS *libs = dynamic_cast<SYMBOL_LIBS*>( m_prj->GetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS ) );
|
||||
|
||||
if( !libs )
|
||||
{
|
||||
libs = new PART_LIBS();
|
||||
m_prj->SetElem( PROJECT::ELEM_SCH_PART_LIBS, libs );
|
||||
libs = new SYMBOL_LIBS();
|
||||
m_prj->SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, libs );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
PART_LIBS::LibNamesAndPaths( m_prj, false, &libPaths, &libNames );
|
||||
SYMBOL_LIBS::LibNamesAndPaths( m_prj, false, &libPaths, &libNames );
|
||||
|
||||
// Make sure the library is not already in the list
|
||||
while( libNames.Index( libName ) != wxNOT_FOUND )
|
||||
|
@ -709,7 +709,7 @@ bool LEGACY_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
|||
|
||||
// Add the library to the top of the list and save.
|
||||
libNames.Insert( libName, 0 );
|
||||
PART_LIBS::LibNamesAndPaths( m_prj, true, &libPaths, &libNames );
|
||||
SYMBOL_LIBS::LibNamesAndPaths( m_prj, true, &libPaths, &libNames );
|
||||
}
|
||||
catch( const IO_ERROR& )
|
||||
{
|
||||
|
@ -719,12 +719,12 @@ bool LEGACY_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
|||
|
||||
// Save the old libraries in case there is a problem after clear(). We'll
|
||||
// put them back in.
|
||||
boost::ptr_vector<PART_LIB> libsSave;
|
||||
boost::ptr_vector<SYMBOL_LIB> libsSave;
|
||||
libsSave.transfer( libsSave.end(), libs->begin(), libs->end(), *libs );
|
||||
|
||||
m_prj->SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL );
|
||||
m_prj->SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, NULL );
|
||||
|
||||
libs = new PART_LIBS();
|
||||
libs = new SYMBOL_LIBS();
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -743,7 +743,7 @@ bool LEGACY_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
|||
return false;
|
||||
}
|
||||
|
||||
m_prj->SetElem( PROJECT::ELEM_SCH_PART_LIBS, libs );
|
||||
m_prj->SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, libs );
|
||||
|
||||
// Update the schematic symbol library links since the library list has changed.
|
||||
SCH_SCREENS schematic( m_schematic->Root() );
|
||||
|
@ -752,12 +752,12 @@ bool LEGACY_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
|||
}
|
||||
|
||||
|
||||
void LEGACY_RESCUER::AddPart( LIB_SYMBOL* aNewSymbol )
|
||||
void LEGACY_RESCUER::AddSymbol( LIB_SYMBOL* aNewSymbol )
|
||||
{
|
||||
wxCHECK_RET( aNewSymbol, "Invalid LIB_SYMBOL pointer." );
|
||||
|
||||
aNewSymbol->SetLib( m_rescue_lib.get() );
|
||||
m_rescue_lib->AddPart( aNewSymbol );
|
||||
m_rescue_lib->AddSymbol( aNewSymbol );
|
||||
}
|
||||
|
||||
|
||||
|
@ -849,7 +849,7 @@ bool SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
|||
}
|
||||
|
||||
|
||||
void SYMBOL_LIB_TABLE_RESCUER::AddPart( LIB_SYMBOL* aNewSymbol )
|
||||
void SYMBOL_LIB_TABLE_RESCUER::AddSymbol( LIB_SYMBOL* aNewSymbol )
|
||||
{
|
||||
wxCHECK_RET( aNewSymbol, "Invalid LIB_SYMBOL pointer." );
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ public:
|
|||
*/
|
||||
virtual void FindCandidates() = 0;
|
||||
|
||||
virtual void AddPart( LIB_SYMBOL* aNewSymbol ) = 0;
|
||||
virtual void AddSymbol( LIB_SYMBOL* aNewSymbol ) = 0;
|
||||
|
||||
/**
|
||||
* Display a dialog to allow the user to select rescues.
|
||||
|
@ -350,10 +350,10 @@ public:
|
|||
|
||||
virtual bool WriteRescueLibrary( wxWindow *aParent ) override;
|
||||
|
||||
virtual void AddPart( LIB_SYMBOL* aNewSymbol ) override;
|
||||
virtual void AddSymbol( LIB_SYMBOL* aNewSymbol ) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<PART_LIB> m_rescue_lib;
|
||||
std::unique_ptr<SYMBOL_LIB> m_rescue_lib;
|
||||
};
|
||||
|
||||
|
||||
|
@ -376,7 +376,7 @@ public:
|
|||
|
||||
virtual bool WriteRescueLibrary( wxWindow* aParent ) override;
|
||||
|
||||
virtual void AddPart( LIB_SYMBOL* aNewSymbol ) override;
|
||||
virtual void AddSymbol( LIB_SYMBOL* aNewSymbol ) override;
|
||||
|
||||
private:
|
||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER m_pi;
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include <tools/ee_selection_tool.h>
|
||||
|
||||
|
||||
LIB_SYMBOL* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, PART_LIB* aCacheLib,
|
||||
LIB_SYMBOL* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, SYMBOL_LIB* aCacheLib,
|
||||
wxWindow* aParent, bool aShowErrorMsg )
|
||||
{
|
||||
wxCHECK_MSG( aLibTable, nullptr, "Invalid symbol library table." );
|
||||
|
@ -60,7 +60,7 @@ LIB_SYMBOL* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, PA
|
|||
|
||||
wxString cacheName = aLibId.GetLibNickname().wx_str();
|
||||
cacheName += "_" + aLibId.GetLibItemName();
|
||||
symbol = aCacheLib->FindPart( cacheName );
|
||||
symbol = aCacheLib->FindSymbol( cacheName );
|
||||
}
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
|
@ -195,7 +195,7 @@ void SCH_BASE_FRAME::UpdateStatusBar()
|
|||
LIB_SYMBOL* SCH_BASE_FRAME::GetLibPart( const LIB_ID& aLibId, bool aUseCacheLib,
|
||||
bool aShowErrorMsg )
|
||||
{
|
||||
PART_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
|
||||
SYMBOL_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
|
||||
|
||||
return SchGetLibPart( aLibId, Prj().SchSymbolLibTable(), cache, this, aShowErrorMsg );
|
||||
}
|
||||
|
@ -231,7 +231,8 @@ bool SCH_BASE_FRAME::saveSymbolLibTables( bool aGlobal, bool aProject )
|
|||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
success = false;
|
||||
msg.Printf( _( "Error saving project-specific symbol library table:\n%s" ), ioe.What() );
|
||||
msg.Printf( _( "Error saving project-specific symbol library table:\n%s" ),
|
||||
ioe.What() );
|
||||
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class TITLE_BLOCK;
|
|||
class SYMBOL_VIEWER_FRAME;
|
||||
class SYMBOL_EDIT_FRAME;
|
||||
class LIB_SYMBOL;
|
||||
class PART_LIB;
|
||||
class SYMBOL_LIB;
|
||||
class SCHLIB_FILTER;
|
||||
class LIB_ID;
|
||||
class SYMBOL_LIB_TABLE;
|
||||
|
@ -73,7 +73,7 @@ class SYMBOL_EDITOR_SETTINGS;
|
|||
* @return The symbol found in the library or NULL if the symbol was not found.
|
||||
*/
|
||||
LIB_SYMBOL* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
|
||||
PART_LIB* aCacheLib = NULL, wxWindow* aParent = NULL,
|
||||
SYMBOL_LIB* aCacheLib = NULL, wxWindow* aParent = NULL,
|
||||
bool aShowErrorMsg = false );
|
||||
|
||||
/**
|
||||
|
|
|
@ -117,7 +117,7 @@ SEARCH_STACK* PROJECT::SchSearchS()
|
|||
|
||||
try
|
||||
{
|
||||
PART_LIBS::LibNamesAndPaths( this, false, &libDir );
|
||||
SYMBOL_LIBS::LibNamesAndPaths( this, false, &libDir );
|
||||
}
|
||||
catch( const IO_ERROR& )
|
||||
{
|
||||
|
@ -145,18 +145,18 @@ SEARCH_STACK* PROJECT::SchSearchS()
|
|||
}
|
||||
|
||||
|
||||
PART_LIBS* PROJECT::SchLibs()
|
||||
SYMBOL_LIBS* PROJECT::SchLibs()
|
||||
{
|
||||
PART_LIBS* libs = (PART_LIBS*) GetElem( PROJECT::ELEM_SCH_PART_LIBS );
|
||||
SYMBOL_LIBS* libs = (SYMBOL_LIBS*) GetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS );
|
||||
|
||||
wxASSERT( !libs || libs->Type() == PART_LIBS_T );
|
||||
wxASSERT( !libs || libs->Type() == SYMBOL_LIBS_T );
|
||||
|
||||
if( !libs )
|
||||
{
|
||||
libs = new PART_LIBS();
|
||||
libs = new SYMBOL_LIBS();
|
||||
|
||||
// Make PROJECT the new PART_LIBS owner.
|
||||
SetElem( PROJECT::ELEM_SCH_PART_LIBS, libs );
|
||||
// Make PROJECT the new SYMBOL_LIBS owner.
|
||||
SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, libs );
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -378,7 +378,7 @@ bool SCH_FIELD::IsReplaceable() const
|
|||
|
||||
if( m_id == VALUE_FIELD )
|
||||
{
|
||||
if( parentSymbol->GetPartRef() && parentSymbol->GetPartRef()->IsPower() )
|
||||
if( parentSymbol->GetLibSymbolRef() && parentSymbol->GetLibSymbolRef()->IsPower() )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class SCH_PLUGIN;
|
|||
class SCHEMATIC;
|
||||
class KIWAY;
|
||||
class LIB_SYMBOL;
|
||||
class PART_LIB;
|
||||
class SYMBOL_LIB;
|
||||
class PROPERTIES;
|
||||
|
||||
|
||||
|
|
|
@ -1445,7 +1445,8 @@ void SCH_PAINTER::draw( SCH_SYMBOL* aSymbol, int aLayer )
|
|||
int convert = aSymbol->GetConvert();
|
||||
|
||||
// Use dummy symbol if the actual couldn't be found (or couldn't be locked).
|
||||
LIB_SYMBOL* originalSymbol = aSymbol->GetPartRef() ? aSymbol->GetPartRef().get() : dummy();
|
||||
LIB_SYMBOL* originalSymbol = aSymbol->GetLibSymbolRef() ?
|
||||
aSymbol->GetLibSymbolRef().get() : dummy();
|
||||
LIB_PINS originalPins;
|
||||
originalSymbol->GetPins( originalPins, unit, convert );
|
||||
|
||||
|
|
|
@ -1655,7 +1655,8 @@ SCH_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol( const SYMBOL& aCads
|
|||
for( auto& term : termNumMap )
|
||||
{
|
||||
wxString pinNum = term.second;
|
||||
pinNumToLibPinMap.insert( { pinNum, symbol->GetPartRef()->GetPin( term.second ) } );
|
||||
pinNumToLibPinMap.insert( { pinNum,
|
||||
symbol->GetLibSymbolRef()->GetPin( term.second ) } );
|
||||
}
|
||||
|
||||
auto replacePinNumber = [&]( wxString aOldPinNum, wxString aNewPinNum )
|
||||
|
|
|
@ -2799,17 +2799,17 @@ bool SCH_EAGLE_PLUGIN::checkConnections( const SCH_SYMBOL* aSymbol, const LIB_PI
|
|||
void SCH_EAGLE_PLUGIN::addImplicitConnections( SCH_SYMBOL* aSymbol, SCH_SCREEN* aScreen,
|
||||
bool aUpdateSet )
|
||||
{
|
||||
wxCHECK( aSymbol->GetPartRef(), /*void*/ );
|
||||
wxCHECK( aSymbol->GetLibSymbolRef(), /*void*/ );
|
||||
|
||||
// Normally power parts also have power input pins,
|
||||
// but they already force net names on the attached wires
|
||||
if( aSymbol->GetPartRef()->IsPower() )
|
||||
if( aSymbol->GetLibSymbolRef()->IsPower() )
|
||||
return;
|
||||
|
||||
int unit = aSymbol->GetUnit();
|
||||
const wxString reference = aSymbol->GetField( REFERENCE_FIELD )->GetText();
|
||||
std::vector<LIB_PIN*> pins;
|
||||
aSymbol->GetPartRef()->GetPins( pins );
|
||||
aSymbol->GetLibSymbolRef()->GetPins( pins );
|
||||
std::set<int> missingUnits;
|
||||
|
||||
// Search all units for pins creating implicit connections
|
||||
|
@ -2844,7 +2844,7 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections( SCH_SYMBOL* aSymbol, SCH_SCREEN*
|
|||
}
|
||||
}
|
||||
|
||||
if( aUpdateSet && aSymbol->GetPartRef()->GetUnitCount() > 1 )
|
||||
if( aUpdateSet && aSymbol->GetLibSymbolRef()->GetUnitCount() > 1 )
|
||||
{
|
||||
auto cmpIt = m_missingCmps.find( reference );
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class SCH_FIELD;
|
|||
class PROPERTIES;
|
||||
class SCH_EAGLE_PLUGIN_CACHE;
|
||||
class LIB_SYMBOL;
|
||||
class PART_LIB;
|
||||
class SYMBOL_LIB;
|
||||
class LIB_CIRCLE;
|
||||
class LIB_FIELD;
|
||||
class LIB_RECTANGLE;
|
||||
|
|
|
@ -1481,7 +1481,7 @@ LIB_SYMBOL* SCH_SEXPR_PLUGIN_CACHE::removeSymbol( LIB_SYMBOL* aSymbol )
|
|||
|
||||
void SCH_SEXPR_PLUGIN_CACHE::AddSymbol( const LIB_SYMBOL* aSymbol )
|
||||
{
|
||||
// aSymbol is cloned in PART_LIB::AddPart(). The cache takes ownership of aSymbol.
|
||||
// aSymbol is cloned in SYMBOL_LIB::AddSymbol(). The cache takes ownership of aSymbol.
|
||||
wxString name = aSymbol->GetName();
|
||||
LIB_SYMBOL_MAP::iterator it = m_symbols.find( name );
|
||||
|
||||
|
@ -1656,9 +1656,9 @@ void SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMATTER& a
|
|||
saveDcmInfoAsFields( aSymbol, aFormatter, nextFreeFieldId, aNestLevel );
|
||||
|
||||
// Save the draw items grouped by units.
|
||||
std::vector<PART_UNITS> units = aSymbol->GetUnitDrawItems();
|
||||
std::vector<LIB_SYMBOL_UNITS> units = aSymbol->GetUnitDrawItems();
|
||||
std::sort( units.begin(), units.end(),
|
||||
[]( const PART_UNITS& a, const PART_UNITS& b )
|
||||
[]( const LIB_SYMBOL_UNITS& a, const LIB_SYMBOL_UNITS& b )
|
||||
{
|
||||
if( a.m_unit == b.m_unit )
|
||||
return a.m_convert < b.m_convert;
|
||||
|
@ -2110,10 +2110,10 @@ void SCH_SEXPR_PLUGIN::cacheLib( const wxString& aLibraryFileName, const PROPERT
|
|||
delete m_cache;
|
||||
m_cache = new SCH_SEXPR_PLUGIN_CACHE( aLibraryFileName );
|
||||
|
||||
// Because m_cache is rebuilt, increment PART_LIBS::s_modify_generation
|
||||
// Because m_cache is rebuilt, increment SYMBOL_LIBS::s_modify_generation
|
||||
// to modify the hash value that indicate symbol to symbol links
|
||||
// must be updated.
|
||||
PART_LIBS::IncrementModifyGeneration();
|
||||
SYMBOL_LIBS::IncrementModifyGeneration();
|
||||
|
||||
if( !isBuffering( aProperties ) )
|
||||
m_cache->Load();
|
||||
|
@ -2311,7 +2311,7 @@ bool SCH_SEXPR_PLUGIN::IsSymbolLibWritable( const wxString& aLibraryPath )
|
|||
}
|
||||
|
||||
|
||||
LIB_SYMBOL* SCH_SEXPR_PLUGIN::ParsePart( LINE_READER& aReader, int aFileVersion )
|
||||
LIB_SYMBOL* SCH_SEXPR_PLUGIN::ParseLibSymbol( LINE_READER& aReader, int aFileVersion )
|
||||
{
|
||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||
LIB_SYMBOL_MAP map;
|
||||
|
@ -2324,7 +2324,7 @@ LIB_SYMBOL* SCH_SEXPR_PLUGIN::ParsePart( LINE_READER& aReader, int aFileVersion
|
|||
}
|
||||
|
||||
|
||||
void SCH_SEXPR_PLUGIN::FormatPart( LIB_SYMBOL* symbol, OUTPUTFORMATTER & formatter )
|
||||
void SCH_SEXPR_PLUGIN::FormatLibSymbol( LIB_SYMBOL* symbol, OUTPUTFORMATTER & formatter )
|
||||
{
|
||||
|
||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||
|
|
|
@ -48,7 +48,7 @@ class PROPERTIES;
|
|||
class EE_SELECTION;
|
||||
class SCH_SEXPR_PLUGIN_CACHE;
|
||||
class LIB_SYMBOL;
|
||||
class PART_LIB;
|
||||
class SYMBOL_LIB;
|
||||
class BUS_ALIAS;
|
||||
|
||||
/**
|
||||
|
@ -127,9 +127,9 @@ public:
|
|||
|
||||
const wxString& GetError() const override { return m_error; }
|
||||
|
||||
static LIB_SYMBOL* ParsePart( LINE_READER& aReader,
|
||||
static LIB_SYMBOL* ParseLibSymbol( LINE_READER& aReader,
|
||||
int aVersion = SEXPR_SCHEMATIC_FILE_VERSION );
|
||||
static void FormatPart( LIB_SYMBOL* aPart, OUTPUTFORMATTER& aFormatter );
|
||||
static void FormatLibSymbol( LIB_SYMBOL* aPart, OUTPUTFORMATTER& aFormatter );
|
||||
|
||||
private:
|
||||
void loadHierarchy( SCH_SHEET* aSheet );
|
||||
|
|
|
@ -2541,7 +2541,7 @@ LIB_SYMBOL* SCH_LEGACY_PLUGIN_CACHE::removeSymbol( LIB_SYMBOL* aSymbol )
|
|||
|
||||
void SCH_LEGACY_PLUGIN_CACHE::AddSymbol( const LIB_SYMBOL* aSymbol )
|
||||
{
|
||||
// aSymbol is cloned in PART_LIB::AddPart(). The cache takes ownership of aSymbol.
|
||||
// aSymbol is cloned in SYMBOL_LIB::AddSymbol(). The cache takes ownership of aSymbol.
|
||||
wxString name = aSymbol->GetName();
|
||||
LIB_SYMBOL_MAP::iterator it = m_symbols.find( name );
|
||||
|
||||
|
@ -3911,7 +3911,8 @@ void SCH_LEGACY_PLUGIN_CACHE::saveArc( LIB_ARC* aArc, OUTPUTFORMATTER& aFormatte
|
|||
aFormatter.Print( 0, "A %d %d %d %d %d %d %d %d %c %d %d %d %d\n",
|
||||
Iu2Mils( aArc->GetPosition().x ), Iu2Mils( aArc->GetPosition().y ),
|
||||
Iu2Mils( aArc->GetRadius() ), x1, x2, aArc->GetUnit(), aArc->GetConvert(),
|
||||
Iu2Mils( aArc->GetWidth() ), fill_tab[ static_cast<int>( aArc->GetFillMode() ) ],
|
||||
Iu2Mils( aArc->GetWidth() ),
|
||||
fill_tab[ static_cast<int>( aArc->GetFillMode() ) ],
|
||||
Iu2Mils( aArc->GetStart().x ), Iu2Mils( aArc->GetStart().y ),
|
||||
Iu2Mils( aArc->GetEnd().x ), Iu2Mils( aArc->GetEnd().y ) );
|
||||
}
|
||||
|
@ -3940,7 +3941,8 @@ void SCH_LEGACY_PLUGIN_CACHE::saveCircle( LIB_CIRCLE* aCircle,
|
|||
aFormatter.Print( 0, "C %d %d %d %d %d %d %c\n",
|
||||
Iu2Mils( aCircle->GetPosition().x ), Iu2Mils( aCircle->GetPosition().y ),
|
||||
Iu2Mils( aCircle->GetRadius() ), aCircle->GetUnit(), aCircle->GetConvert(),
|
||||
Iu2Mils( aCircle->GetWidth() ), fill_tab[static_cast<int>( aCircle->GetFillMode() )] );
|
||||
Iu2Mils( aCircle->GetWidth() ),
|
||||
fill_tab[static_cast<int>( aCircle->GetFillMode() )] );
|
||||
}
|
||||
|
||||
|
||||
|
@ -4215,10 +4217,10 @@ void SCH_LEGACY_PLUGIN::cacheLib( const wxString& aLibraryFileName, const PROPER
|
|||
delete m_cache;
|
||||
m_cache = new SCH_LEGACY_PLUGIN_CACHE( aLibraryFileName );
|
||||
|
||||
// Because m_cache is rebuilt, increment PART_LIBS::s_modify_generation
|
||||
// Because m_cache is rebuilt, increment SYMBOL_LIBS::s_modify_generation
|
||||
// to modify the hash value that indicate symbol to symbol links
|
||||
// must be updated.
|
||||
PART_LIBS::IncrementModifyGeneration();
|
||||
SYMBOL_LIBS::IncrementModifyGeneration();
|
||||
|
||||
if( !isBuffering( aProperties ) )
|
||||
m_cache->Load();
|
||||
|
|
|
@ -45,7 +45,7 @@ class PROPERTIES;
|
|||
class SELECTION;
|
||||
class SCH_LEGACY_PLUGIN_CACHE;
|
||||
class LIB_SYMBOL;
|
||||
class PART_LIB;
|
||||
class SYMBOL_LIB;
|
||||
class BUS_ALIAS;
|
||||
|
||||
|
||||
|
|
|
@ -152,16 +152,16 @@ void SCH_SCREEN::Append( SCH_ITEM* aItem )
|
|||
{
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aItem );
|
||||
|
||||
if( symbol->GetPartRef() )
|
||||
if( symbol->GetLibSymbolRef() )
|
||||
{
|
||||
symbol->GetPartRef()->GetDrawItems().sort();
|
||||
symbol->GetLibSymbolRef()->GetDrawItems().sort();
|
||||
|
||||
auto it = m_libSymbols.find( symbol->GetSchSymbolLibraryName() );
|
||||
|
||||
if( it == m_libSymbols.end() || !it->second )
|
||||
{
|
||||
m_libSymbols[symbol->GetSchSymbolLibraryName()] =
|
||||
new LIB_SYMBOL( *symbol->GetPartRef() );
|
||||
new LIB_SYMBOL( *symbol->GetLibSymbolRef() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -173,7 +173,7 @@ void SCH_SCREEN::Append( SCH_ITEM* aItem )
|
|||
|
||||
foundSymbol->GetDrawItems().sort();
|
||||
|
||||
if( *foundSymbol != *symbol->GetPartRef() )
|
||||
if( *foundSymbol != *symbol->GetLibSymbolRef() )
|
||||
{
|
||||
int cnt = 1;
|
||||
wxString newName;
|
||||
|
@ -187,7 +187,7 @@ void SCH_SCREEN::Append( SCH_ITEM* aItem )
|
|||
}
|
||||
|
||||
symbol->SetSchSymbolLibraryName( newName );
|
||||
m_libSymbols[newName] = new LIB_SYMBOL( *symbol->GetPartRef() );
|
||||
m_libSymbols[newName] = new LIB_SYMBOL( *symbol->GetLibSymbolRef() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -545,7 +545,7 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter )
|
|||
SYMBOL_LIB_TABLE* libs = Schematic()->Prj().SchSymbolLibTable();
|
||||
|
||||
// This will be a nullptr if an s-expression schematic is loaded.
|
||||
PART_LIBS* legacyLibs = Schematic()->Prj().SchLibs();
|
||||
SYMBOL_LIBS* legacyLibs = Schematic()->Prj().SchLibs();
|
||||
|
||||
for( auto item : Items().OfType( SCH_SYMBOL_T ) )
|
||||
symbols.push_back( static_cast<SCH_SYMBOL*>( item ) );
|
||||
|
@ -630,7 +630,7 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter )
|
|||
|
||||
if( !tmp && legacyLibs && legacyLibs->GetLibraryCount() )
|
||||
{
|
||||
PART_LIB& legacyCacheLib = legacyLibs->at( 0 );
|
||||
SYMBOL_LIB& legacyCacheLib = legacyLibs->at( 0 );
|
||||
|
||||
// It better be the cache library.
|
||||
wxCHECK2( legacyCacheLib.IsCache(), continue );
|
||||
|
@ -648,7 +648,7 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter )
|
|||
aReporter->ReportTail( msg, RPT_SEVERITY_WARNING );
|
||||
}
|
||||
|
||||
tmp = legacyCacheLib.FindPart( id );
|
||||
tmp = legacyCacheLib.FindSymbol( id );
|
||||
}
|
||||
|
||||
if( tmp )
|
||||
|
@ -843,11 +843,11 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_SYMBOL** aSymbol,
|
|||
{
|
||||
pin = NULL;
|
||||
|
||||
if( !candidate->GetPartRef() )
|
||||
if( !candidate->GetLibSymbolRef() )
|
||||
continue;
|
||||
|
||||
for( pin = candidate->GetPartRef()->GetNextPin(); pin;
|
||||
pin = candidate->GetPartRef()->GetNextPin( pin ) )
|
||||
for( pin = candidate->GetLibSymbolRef()->GetNextPin(); pin;
|
||||
pin = candidate->GetLibSymbolRef()->GetNextPin( pin ) )
|
||||
{
|
||||
// Skip items not used for this part.
|
||||
if( candidate->GetUnit() && pin->GetUnit() &&
|
||||
|
|
|
@ -500,7 +500,7 @@ private:
|
|||
wxPoint m_aux_origin; // Origin used for drill & place files by Pcbnew.
|
||||
EE_RTREE m_rtree;
|
||||
|
||||
int m_modification_sync; // Inequality with PART_LIBS::GetModificationHash()
|
||||
int m_modification_sync; // Inequality with SYMBOL_LIBS::GetModificationHash()
|
||||
// will trigger ResolveAll().
|
||||
|
||||
bool m_zoomInitialized; // Set to true once the zoom value is initialized with
|
||||
|
|
|
@ -317,7 +317,7 @@ void SCH_SHEET_PATH::AppendSymbol( SCH_REFERENCE_LIST& aReferences, SCH_SYMBOL*
|
|||
// affects power symbols.
|
||||
if( aIncludePowerSymbols || aSymbol->GetRef( this )[0] != wxT( '#' ) )
|
||||
{
|
||||
LIB_SYMBOL* symbol = aSymbol->GetPartRef().get();
|
||||
LIB_SYMBOL* symbol = aSymbol->GetLibSymbolRef().get();
|
||||
|
||||
if( symbol || aForceIncludeOrphanSymbols )
|
||||
{
|
||||
|
@ -350,7 +350,7 @@ void SCH_SHEET_PATH::AppendMultiUnitSymbol( SCH_MULTI_UNIT_REFERENCE_MAP& aRefLi
|
|||
if( !aIncludePowerSymbols && aSymbol->GetRef( this )[0] == wxT( '#' ) )
|
||||
return;
|
||||
|
||||
LIB_SYMBOL* symbol = aSymbol->GetPartRef().get();
|
||||
LIB_SYMBOL* symbol = aSymbol->GetLibSymbolRef().get();
|
||||
|
||||
if( symbol && symbol->GetUnitCount() > 1 )
|
||||
{
|
||||
|
@ -716,7 +716,7 @@ void SCH_SHEET_LIST::AnnotatePowerSymbols()
|
|||
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||
LIB_SYMBOL* libSymbol = symbol->GetPartRef().get();
|
||||
LIB_SYMBOL* libSymbol = symbol->GetLibSymbolRef().get();
|
||||
|
||||
if( libSymbol && libSymbol->IsPower() )
|
||||
{
|
||||
|
|
|
@ -368,7 +368,7 @@ int SCH_SYMBOL::GetUnitCount() const
|
|||
|
||||
void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||
{
|
||||
PART_DRAW_OPTIONS opts;
|
||||
LIB_SYMBOL_OPTIONS opts;
|
||||
opts.transform = m_transform;
|
||||
opts.draw_visible_fields = false;
|
||||
opts.draw_hidden_fields = false;
|
||||
|
|
|
@ -56,8 +56,8 @@ class LIB_ITEM;
|
|||
class LIB_PIN;
|
||||
class LIB_SYMBOL;
|
||||
class NETLIST_OBJECT_LIST;
|
||||
class PART_LIB;
|
||||
class PART_LIBS;
|
||||
class SYMBOL_LIB;
|
||||
class SYMBOL_LIBS;
|
||||
class EE_COLLECTOR;
|
||||
class SCH_SCREEN;
|
||||
class SYMBOL_LIB_TABLE;
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
/**
|
||||
* Create schematic symbol from library symbol object.
|
||||
*
|
||||
* @param aPart is the library part to create schematic symbol from.
|
||||
* @param aSymbol is the library symbol to create schematic symbol from.
|
||||
* @param aLibId is the #LIB_ID of alias to create.
|
||||
* @param aSheet is the schematic sheet the symbol is place into.
|
||||
* @param unit is unit for symbols that have multiple parts per package.
|
||||
|
@ -161,8 +161,8 @@ public:
|
|||
wxString GetSchSymbolLibraryName() const;
|
||||
bool UseLibIdLookup() const { return m_schLibSymbolName.IsEmpty(); }
|
||||
|
||||
std::unique_ptr< LIB_SYMBOL >& GetPartRef() { return m_part; }
|
||||
const std::unique_ptr< LIB_SYMBOL >& GetPartRef() const { return m_part; }
|
||||
std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() { return m_part; }
|
||||
const std::unique_ptr< LIB_SYMBOL >& GetLibSymbolRef() const { return m_part; }
|
||||
|
||||
/**
|
||||
* Set this schematic symbol library symbol reference to \a aLibSymbol
|
||||
|
|
|
@ -80,7 +80,7 @@ bool SYMBOL_EDIT_FRAME::m_showDeMorgan = false;
|
|||
BEGIN_EVENT_TABLE( SYMBOL_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||
EVT_SIZE( SYMBOL_EDIT_FRAME::OnSize )
|
||||
|
||||
EVT_COMBOBOX( ID_LIBEDIT_SELECT_PART_NUMBER, SYMBOL_EDIT_FRAME::OnSelectUnit )
|
||||
EVT_COMBOBOX( ID_LIBEDIT_SELECT_UNIT_NUMBER, SYMBOL_EDIT_FRAME::OnSelectUnit )
|
||||
|
||||
// menubar commands
|
||||
EVT_MENU( wxID_EXIT, SYMBOL_EDIT_FRAME::OnExitKiCad )
|
||||
|
@ -88,7 +88,7 @@ BEGIN_EVENT_TABLE( SYMBOL_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings )
|
||||
|
||||
// Update user interface elements.
|
||||
EVT_UPDATE_UI( ID_LIBEDIT_SELECT_PART_NUMBER, SYMBOL_EDIT_FRAME::OnUpdatePartNumber )
|
||||
EVT_UPDATE_UI( ID_LIBEDIT_SELECT_UNIT_NUMBER, SYMBOL_EDIT_FRAME::OnUpdateUnitNumber )
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
@ -103,7 +103,7 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
SetShowDeMorgan( false );
|
||||
m_SyncPinEdit = false;
|
||||
|
||||
m_my_part = nullptr;
|
||||
m_symbol = nullptr;
|
||||
m_treePane = nullptr;
|
||||
m_libMgr = nullptr;
|
||||
m_unit = 1;
|
||||
|
@ -241,8 +241,8 @@ SYMBOL_EDIT_FRAME::~SYMBOL_EDIT_FRAME()
|
|||
|
||||
if( IsSymbolFromSchematic() )
|
||||
{
|
||||
delete m_my_part;
|
||||
m_my_part = nullptr;
|
||||
delete m_symbol;
|
||||
m_symbol = nullptr;
|
||||
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
delete screen;
|
||||
|
@ -349,7 +349,7 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
|
|||
auto haveSymbolCond =
|
||||
[this] ( const SELECTION& )
|
||||
{
|
||||
return m_my_part;
|
||||
return m_symbol;
|
||||
};
|
||||
|
||||
auto isEditableCond =
|
||||
|
@ -375,7 +375,7 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
|
|||
auto canEditProperties =
|
||||
[this] ( const SELECTION& sel )
|
||||
{
|
||||
return m_my_part && ( !IsSymbolFromLegacyLibrary() || IsSymbolFromSchematic() );
|
||||
return m_symbol && ( !IsSymbolFromLegacyLibrary() || IsSymbolFromSchematic() );
|
||||
};
|
||||
|
||||
auto saveSymbolAsCondition =
|
||||
|
@ -453,7 +453,7 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
|
|||
auto multiUnitModeCond =
|
||||
[this] ( const SELECTION& )
|
||||
{
|
||||
return m_my_part && m_my_part->IsMulti() && !m_my_part->UnitsLocked();
|
||||
return m_symbol && m_symbol->IsMulti() && !m_symbol->UnitsLocked();
|
||||
};
|
||||
|
||||
auto syncedPinsModeCond =
|
||||
|
@ -465,7 +465,7 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
|
|||
auto haveDatasheetCond =
|
||||
[this] ( const SELECTION& )
|
||||
{
|
||||
return m_my_part && !m_my_part->GetDatasheetField().GetText().IsEmpty();
|
||||
return m_symbol && !m_symbol->GetDatasheetField().GetText().IsEmpty();
|
||||
};
|
||||
|
||||
mgr->SetConditions( EE_ACTIONS::showDatasheet, ENABLE( haveDatasheetCond ) );
|
||||
|
@ -480,7 +480,7 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
|
|||
mgr->SetConditions( EE_ACTIONS::toggleSyncedPinsMode,
|
||||
ACTION_CONDITIONS().Enable( multiUnitModeCond ).Check( syncedPinsModeCond ) );
|
||||
|
||||
// Only enable a tool if the part is edtable
|
||||
// Only enable a tool if the symbol is edtable
|
||||
#define EDIT_TOOL( tool ) ACTION_CONDITIONS().Enable( isEditableCond ).Check( cond.CurrentTool( tool ) )
|
||||
|
||||
mgr->SetConditions( ACTIONS::deleteTool, EDIT_TOOL( ACTIONS::deleteTool ) );
|
||||
|
@ -516,8 +516,8 @@ bool SYMBOL_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
|
|||
nullptr ) )
|
||||
{
|
||||
case wxID_YES:
|
||||
if( schframe && GetCurPart() ) // Should be always the case
|
||||
schframe->SaveSymbolToSchematic( *GetCurPart());
|
||||
if( schframe && GetCurSymbol() ) // Should be always the case
|
||||
schframe->SaveSymbolToSchematic( *GetCurSymbol());
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -551,14 +551,14 @@ void SYMBOL_EDIT_FRAME::RebuildSymbolUnitsList()
|
|||
if( m_unitSelectBox->GetCount() != 0 )
|
||||
m_unitSelectBox->Clear();
|
||||
|
||||
if( !m_my_part || m_my_part->GetUnitCount() <= 1 )
|
||||
if( !m_symbol || m_symbol->GetUnitCount() <= 1 )
|
||||
{
|
||||
m_unit = 1;
|
||||
m_unitSelectBox->Append( wxEmptyString );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( int i = 0; i < m_my_part->GetUnitCount(); i++ )
|
||||
for( int i = 0; i < m_symbol->GetUnitCount(); i++ )
|
||||
{
|
||||
wxString sub = LIB_SYMBOL::SubReference( i+1, false );
|
||||
wxString unit = wxString::Format( _( "Unit %s" ), sub );
|
||||
|
@ -566,8 +566,8 @@ void SYMBOL_EDIT_FRAME::RebuildSymbolUnitsList()
|
|||
}
|
||||
}
|
||||
|
||||
// Ensure the selected unit is compatible with the number of units of the current part:
|
||||
if( m_my_part && m_my_part->GetUnitCount() < m_unit )
|
||||
// Ensure the selected unit is compatible with the number of units of the current symbol:
|
||||
if( m_symbol && m_symbol->GetUnitCount() < m_unit )
|
||||
m_unit = 1;
|
||||
|
||||
m_unitSelectBox->SetSelection(( m_unit > 0 ) ? m_unit - 1 : 0 );
|
||||
|
@ -608,9 +608,9 @@ void SYMBOL_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::OnUpdatePartNumber( wxUpdateUIEvent& event )
|
||||
void SYMBOL_EDIT_FRAME::OnUpdateUnitNumber( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Enable( m_my_part && m_my_part->GetUnitCount() > 1 );
|
||||
event.Enable( m_symbol && m_symbol->GetUnitCount() > 1 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -633,9 +633,9 @@ void SYMBOL_EDIT_FRAME::OnSelectUnit( wxCommandEvent& event )
|
|||
|
||||
bool SYMBOL_EDIT_FRAME::IsSymbolFromLegacyLibrary() const
|
||||
{
|
||||
if( m_my_part )
|
||||
if( m_symbol )
|
||||
{
|
||||
SYMBOL_LIB_TABLE_ROW* row = m_libMgr->GetLibrary( m_my_part->GetLibNickname() );
|
||||
SYMBOL_LIB_TABLE_ROW* row = m_libMgr->GetLibrary( m_symbol->GetLibNickname() );
|
||||
|
||||
if( row && row->GetType() == SCH_IO_MGR::ShowType( SCH_IO_MGR::SCH_LEGACY ) )
|
||||
return true;
|
||||
|
@ -675,24 +675,24 @@ wxString SYMBOL_EDIT_FRAME::SetCurLib( const wxString& aLibNickname )
|
|||
}
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::SetCurPart( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
|
||||
void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
|
||||
{
|
||||
m_toolManager->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
GetCanvas()->GetView()->Clear();
|
||||
delete m_my_part;
|
||||
delete m_symbol;
|
||||
|
||||
m_my_part = aSymbol;
|
||||
m_symbol = aSymbol;
|
||||
|
||||
// select the current symbol in the tree widget
|
||||
if( !IsSymbolFromSchematic() && m_my_part )
|
||||
m_treePane->GetLibTree()->SelectLibId( m_my_part->GetLibId() );
|
||||
if( !IsSymbolFromSchematic() && m_symbol )
|
||||
m_treePane->GetLibTree()->SelectLibId( m_symbol->GetLibId() );
|
||||
else
|
||||
m_treePane->GetLibTree()->Unselect();
|
||||
|
||||
wxString partName = m_my_part ? m_my_part->GetName() : wxString();
|
||||
wxString symbolName = m_symbol ? m_symbol->GetName() : wxString();
|
||||
|
||||
// retain in case this wxFrame is re-opened later on the same PROJECT
|
||||
Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_PART, partName );
|
||||
Prj().SetRString( PROJECT::SCH_LIBEDIT_CUR_SYMBOL, symbolName );
|
||||
|
||||
// Ensure synchronized pin edit can be enabled only symbols with interchangeable units
|
||||
m_SyncPinEdit = aSymbol && aSymbol->IsRoot() && aSymbol->IsMulti() && !aSymbol->UnitsLocked();
|
||||
|
@ -703,7 +703,7 @@ void SYMBOL_EDIT_FRAME::SetCurPart( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
|
|||
GetRenderSettings()->m_ShowConvert = m_convert;
|
||||
GetRenderSettings()->m_ShowDisabled = IsSymbolFromLegacyLibrary() && !IsSymbolFromSchematic();
|
||||
GetRenderSettings()->m_ShowGraphicsDisabled = IsSymbolAlias() && !IsSymbolFromSchematic();
|
||||
GetCanvas()->DisplaySymbol( m_my_part );
|
||||
GetCanvas()->DisplaySymbol( m_symbol );
|
||||
GetCanvas()->GetView()->HideDrawingSheet();
|
||||
GetCanvas()->GetView()->ClearHiddenFlags();
|
||||
|
||||
|
@ -743,21 +743,21 @@ void SYMBOL_EDIT_FRAME::SetCurPart( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
|
|||
}
|
||||
else if( IsSymbolAlias() )
|
||||
{
|
||||
wxString parentPartName = m_my_part->GetParent().lock()->GetName();
|
||||
wxString parentSymbolName = m_symbol->GetParent().lock()->GetName();
|
||||
wxString msg;
|
||||
wxString link;
|
||||
|
||||
msg.Printf( _( "Symbol %s is derived from %s. Symbol graphics will not be editable." ),
|
||||
partName,
|
||||
parentPartName );
|
||||
symbolName,
|
||||
parentSymbolName );
|
||||
|
||||
link.Printf( _( "Open %s" ), parentPartName );
|
||||
link.Printf( _( "Open %s" ), parentSymbolName );
|
||||
|
||||
wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, link, wxEmptyString );
|
||||
button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
|
||||
[&]( wxHyperlinkEvent& aEvent )
|
||||
{
|
||||
LoadSymbolFromCurrentLib( m_my_part->GetParent().lock()->GetName(),
|
||||
LoadSymbolFromCurrentLib( m_symbol->GetParent().lock()->GetName(),
|
||||
GetUnit(), GetConvert() );
|
||||
} ) );
|
||||
|
||||
|
@ -782,7 +782,7 @@ SYMBOL_LIBRARY_MANAGER& SYMBOL_EDIT_FRAME::GetLibManager()
|
|||
void SYMBOL_EDIT_FRAME::OnModify()
|
||||
{
|
||||
GetScreen()->SetContentModified();
|
||||
storeCurrentPart();
|
||||
storeCurrentSymbol();
|
||||
|
||||
m_treePane->GetLibTree()->RefreshLibTree();
|
||||
|
||||
|
@ -793,7 +793,7 @@ void SYMBOL_EDIT_FRAME::OnModify()
|
|||
|
||||
bool SYMBOL_EDIT_FRAME::SynchronizePins()
|
||||
{
|
||||
return m_SyncPinEdit && m_my_part && m_my_part->IsMulti() && !m_my_part->UnitsLocked();
|
||||
return m_SyncPinEdit && m_symbol && m_symbol->IsMulti() && !m_symbol->UnitsLocked();
|
||||
}
|
||||
|
||||
|
||||
|
@ -858,7 +858,7 @@ LIB_ID SYMBOL_EDIT_FRAME::GetTreeLIBID( int* aUnit ) const
|
|||
}
|
||||
|
||||
|
||||
LIB_SYMBOL* SYMBOL_EDIT_FRAME::getTargetPart() const
|
||||
LIB_SYMBOL* SYMBOL_EDIT_FRAME::getTargetSymbol() const
|
||||
{
|
||||
LIB_ID libId = GetTreeLIBID();
|
||||
|
||||
|
@ -868,7 +868,7 @@ LIB_SYMBOL* SYMBOL_EDIT_FRAME::getTargetPart() const
|
|||
return alias;
|
||||
}
|
||||
|
||||
return m_my_part;
|
||||
return m_symbol;
|
||||
}
|
||||
|
||||
|
||||
|
@ -876,8 +876,8 @@ LIB_ID SYMBOL_EDIT_FRAME::GetTargetLibId() const
|
|||
{
|
||||
LIB_ID id = GetTreeLIBID();
|
||||
|
||||
if( id.GetLibNickname().empty() && m_my_part )
|
||||
id = m_my_part->GetLibId();
|
||||
if( id.GetLibNickname().empty() && m_symbol )
|
||||
id = m_symbol->GetLibId();
|
||||
|
||||
return id;
|
||||
}
|
||||
|
@ -938,7 +938,7 @@ void SYMBOL_EDIT_FRAME::SyncLibraries( bool aShowProgress, const wxString& aForc
|
|||
|
||||
m_treePane->GetLibTree()->Regenerate( true );
|
||||
|
||||
// Try to select the parent library, in case the part is not found
|
||||
// Try to select the parent library, in case the symbol is not found
|
||||
if( !found && selected.IsValid() )
|
||||
{
|
||||
selected.SetLibItemName( "" );
|
||||
|
@ -948,10 +948,10 @@ void SYMBOL_EDIT_FRAME::SyncLibraries( bool aShowProgress, const wxString& aForc
|
|||
m_treePane->GetLibTree()->SelectLibId( selected );
|
||||
}
|
||||
|
||||
// If no selection, see if there's a current part to centre
|
||||
if( !selected.IsValid() && m_my_part )
|
||||
// If no selection, see if there's a current symbol to centre
|
||||
if( !selected.IsValid() && m_symbol )
|
||||
{
|
||||
LIB_ID current( GetCurLib(), m_my_part->GetName() );
|
||||
LIB_ID current( GetCurLib(), m_symbol->GetName() );
|
||||
m_treePane->GetLibTree()->CenterLibId( current );
|
||||
}
|
||||
}
|
||||
|
@ -1041,21 +1041,21 @@ bool SYMBOL_EDIT_FRAME::backupFile( const wxFileName& aOriginalFile, const wxStr
|
|||
}
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::storeCurrentPart()
|
||||
void SYMBOL_EDIT_FRAME::storeCurrentSymbol()
|
||||
{
|
||||
if( m_my_part && !GetCurLib().IsEmpty() && GetScreen()->IsContentModified() )
|
||||
m_libMgr->UpdatePart( m_my_part, GetCurLib() ); // UpdatePart() makes a copy
|
||||
if( m_symbol && !GetCurLib().IsEmpty() && GetScreen()->IsContentModified() )
|
||||
m_libMgr->UpdateSymbol( m_symbol, GetCurLib() ); // UpdateSymbol() makes a copy
|
||||
}
|
||||
|
||||
|
||||
bool SYMBOL_EDIT_FRAME::isCurrentPart( const LIB_ID& aLibId ) const
|
||||
bool SYMBOL_EDIT_FRAME::isCurrentSymbol( const LIB_ID& aLibId ) const
|
||||
{
|
||||
// This will return the root part of any alias
|
||||
LIB_SYMBOL* symbol = m_libMgr->GetBufferedPart( aLibId.GetLibItemName(),
|
||||
// This will return the root symbol of any alias
|
||||
LIB_SYMBOL* symbol = m_libMgr->GetBufferedSymbol( aLibId.GetLibItemName(),
|
||||
aLibId.GetLibNickname() );
|
||||
|
||||
// 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() );
|
||||
return ( symbol && m_symbol && symbol->GetLibId() == m_symbol->GetLibId() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1063,7 +1063,7 @@ void SYMBOL_EDIT_FRAME::emptyScreen()
|
|||
{
|
||||
m_treePane->GetLibTree()->Unselect();
|
||||
SetCurLib( wxEmptyString );
|
||||
SetCurPart( nullptr, false );
|
||||
SetCurSymbol( nullptr, false );
|
||||
SetScreen( m_dummyScreen );
|
||||
ClearUndoRedoList();
|
||||
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
|
||||
|
@ -1113,7 +1113,7 @@ void SYMBOL_EDIT_FRAME::RebuildView()
|
|||
GetRenderSettings()->m_ShowConvert = m_convert;
|
||||
GetRenderSettings()->m_ShowDisabled = IsSymbolFromLegacyLibrary() && !IsSymbolFromSchematic();
|
||||
GetRenderSettings()->m_ShowGraphicsDisabled = IsSymbolAlias() && !IsSymbolFromSchematic();
|
||||
GetCanvas()->DisplaySymbol( m_my_part );
|
||||
GetCanvas()->DisplaySymbol( m_symbol );
|
||||
GetCanvas()->GetView()->HideDrawingSheet();
|
||||
GetCanvas()->GetView()->ClearHiddenFlags();
|
||||
|
||||
|
@ -1125,12 +1125,12 @@ void SYMBOL_EDIT_FRAME::HardRedraw()
|
|||
{
|
||||
SyncLibraries( true );
|
||||
|
||||
if( m_my_part )
|
||||
if( m_symbol )
|
||||
{
|
||||
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
|
||||
EE_SELECTION& selection = selectionTool->GetSelection();
|
||||
|
||||
for( LIB_ITEM& item : m_my_part->GetDrawItems() )
|
||||
for( LIB_ITEM& item : m_symbol->GetDrawItems() )
|
||||
{
|
||||
if( !alg::contains( selection, &item ) )
|
||||
item.ClearSelected();
|
||||
|
@ -1145,14 +1145,14 @@ void SYMBOL_EDIT_FRAME::HardRedraw()
|
|||
|
||||
const BOX2I SYMBOL_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
|
||||
{
|
||||
if( !m_my_part )
|
||||
if( !m_symbol )
|
||||
{
|
||||
return BOX2I( VECTOR2I( Mils2iu( -100 ), Mils2iu( -100 ) ),
|
||||
VECTOR2I( Mils2iu( 200 ), Mils2iu( 200 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
EDA_RECT boundingBox = m_my_part->Flatten()->GetUnitBoundingBox( m_unit, m_convert );
|
||||
EDA_RECT boundingBox = m_symbol->Flatten()->GetUnitBoundingBox( m_unit, m_convert );
|
||||
return BOX2I( boundingBox.GetOrigin(), VECTOR2I( boundingBox.GetWidth(),
|
||||
boundingBox.GetHeight() ) );
|
||||
}
|
||||
|
@ -1237,7 +1237,7 @@ bool SYMBOL_EDIT_FRAME::IsContentModified() const
|
|||
wxCHECK( m_libMgr, false );
|
||||
|
||||
// Test if the currently edited symbol is modified
|
||||
if( GetScreen() && GetScreen()->IsContentModified() && GetCurPart() )
|
||||
if( GetScreen() && GetScreen()->IsContentModified() && GetCurSymbol() )
|
||||
return true;
|
||||
|
||||
// Test if any library has been modified
|
||||
|
@ -1276,7 +1276,7 @@ SELECTION& SYMBOL_EDIT_FRAME::GetCurrentSelection()
|
|||
|
||||
void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
|
||||
{
|
||||
std::unique_ptr<LIB_SYMBOL> symbol = aSymbol->GetPartRef()->Flatten();
|
||||
std::unique_ptr<LIB_SYMBOL> symbol = aSymbol->GetLibSymbolRef()->Flatten();
|
||||
wxCHECK( symbol, /* void */ );
|
||||
|
||||
std::vector<LIB_FIELD> fullSetOfFields;
|
||||
|
@ -1299,8 +1299,8 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
|
|||
|
||||
symbol->SetFields( fullSetOfFields );
|
||||
|
||||
if( m_my_part )
|
||||
SetCurPart( nullptr, false );
|
||||
if( m_symbol )
|
||||
SetCurSymbol( nullptr, false );
|
||||
|
||||
m_isSymbolFromSchematic = true;
|
||||
m_reference = symbol->GetFieldById( REFERENCE_FIELD )->GetText();
|
||||
|
@ -1311,7 +1311,7 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
|
|||
SCH_SCREEN* tmpScreen = new SCH_SCREEN();
|
||||
|
||||
SetScreen( tmpScreen );
|
||||
SetCurPart( symbol.release(), true );
|
||||
SetCurSymbol( symbol.release(), true );
|
||||
|
||||
ReCreateMenuBar();
|
||||
ReCreateHToolbar();
|
||||
|
@ -1324,7 +1324,7 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
|
|||
|
||||
updateTitle();
|
||||
RebuildSymbolUnitsList();
|
||||
SetShowDeMorgan( GetCurPart()->HasConversion() );
|
||||
SetShowDeMorgan( GetCurSymbol()->HasConversion() );
|
||||
DisplaySymbolDatasheet();
|
||||
Refresh();
|
||||
}
|
||||
|
@ -1450,11 +1450,11 @@ bool SYMBOL_EDIT_FRAME::replaceLibTableEntry( const wxString& aLibNickname,
|
|||
|
||||
bool SYMBOL_EDIT_FRAME::IsSymbolAlias() const
|
||||
{
|
||||
return m_my_part && !m_my_part->IsRoot();
|
||||
return m_symbol && !m_symbol->IsRoot();
|
||||
}
|
||||
|
||||
|
||||
bool SYMBOL_EDIT_FRAME::IsSymbolEditable() const
|
||||
{
|
||||
return m_my_part && ( !IsSymbolFromLegacyLibrary() || IsSymbolFromSchematic() );
|
||||
return m_symbol && ( !IsSymbolFromLegacyLibrary() || IsSymbolFromSchematic() );
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
void SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) override;
|
||||
|
||||
/**
|
||||
* Get if any parts or libraries have been modified but not saved.
|
||||
* Get if any symbols or libraries have been modified but not saved.
|
||||
*
|
||||
* @return true if the any changes have not been saved
|
||||
*/
|
||||
|
@ -96,16 +96,16 @@ public:
|
|||
LIB_ID GetTreeLIBID( int* aUnit = nullptr ) const;
|
||||
|
||||
/**
|
||||
* Return the current part being edited or NULL if none selected.
|
||||
* Return the current symbol being edited or NULL if none selected.
|
||||
*
|
||||
* This is a LIB_SYMBOL that I own, it is at best a copy of one in a library.
|
||||
*/
|
||||
LIB_SYMBOL* GetCurPart() const { return m_my_part; }
|
||||
LIB_SYMBOL* GetCurSymbol() const { return m_symbol; }
|
||||
|
||||
/**
|
||||
* Take ownership of aSymbol and notes that it is the one currently being edited.
|
||||
*/
|
||||
void SetCurPart( LIB_SYMBOL* aSymbol, bool aUpdateZoom );
|
||||
void SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom );
|
||||
|
||||
SYMBOL_LIBRARY_MANAGER& GetLibManager();
|
||||
|
||||
|
@ -122,15 +122,15 @@ public:
|
|||
bool AddLibraryFile( bool aCreateNew );
|
||||
|
||||
/**
|
||||
* Create a new part in the selected library.
|
||||
* Create a new symbol in the selected library.
|
||||
*/
|
||||
void CreateNewPart();
|
||||
void CreateNewSymbol();
|
||||
|
||||
void ImportPart();
|
||||
void ExportPart();
|
||||
void ImportSymbol();
|
||||
void ExportSymbol();
|
||||
|
||||
/**
|
||||
* Save the selected part or library.
|
||||
* Save the selected symbol or library.
|
||||
*/
|
||||
void Save();
|
||||
|
||||
|
@ -145,28 +145,28 @@ public:
|
|||
void SaveLibraryAs();
|
||||
|
||||
/**
|
||||
* Save all modified parts and libraries.
|
||||
* Save all modified symbols and libraries.
|
||||
*/
|
||||
void SaveAll();
|
||||
|
||||
/**
|
||||
* Revert unsaved changes in a part, restoring to the last saved state.
|
||||
* Revert unsaved changes in a symbol, restoring to the last saved state.
|
||||
*/
|
||||
void Revert( bool aConfirm = true );
|
||||
void RevertAll();
|
||||
|
||||
void DeletePartFromLibrary();
|
||||
void DeleteSymbolFromLibrary();
|
||||
|
||||
void CopyPartToClipboard();
|
||||
void CopySymbolToClipboard();
|
||||
|
||||
void LoadPart( const wxString& aLibrary, const wxString& aSymbol, int Unit );
|
||||
void LoadSymbol( const wxString& aLibrary, const wxString& aSymbol, int Unit );
|
||||
|
||||
/**
|
||||
* Insert a duplicate part.
|
||||
* Insert a duplicate symbol.
|
||||
*
|
||||
* If \a aFromClipboard is true then action is a paste.
|
||||
*/
|
||||
void DuplicatePart( bool aFromClipboard );
|
||||
void DuplicateSymbol( bool aFromClipboard );
|
||||
|
||||
void OnSelectUnit( wxCommandEvent& event );
|
||||
|
||||
|
@ -176,7 +176,7 @@ public:
|
|||
void FreezeLibraryTree();
|
||||
void ThawLibraryTree();
|
||||
|
||||
void OnUpdatePartNumber( wxUpdateUIEvent& event );
|
||||
void OnUpdateUnitNumber( wxUpdateUIEvent& event );
|
||||
|
||||
void UpdateAfterSymbolProperties( wxString* aOldName = nullptr );
|
||||
void RebuildSymbolUnitsList();
|
||||
|
@ -354,11 +354,11 @@ public:
|
|||
|
||||
bool IsSymbolAlias() const;
|
||||
|
||||
///< Restore the empty editor screen, without any part or library selected.
|
||||
///< Restore the empty editor screen, without any symbol or library selected.
|
||||
void emptyScreen();
|
||||
|
||||
///< Return either the part selected in the symbol tree, if context menu is active or the
|
||||
///< currently modified part.
|
||||
///< Return either the symbol selected in the symbol tree, if context menu is active or the
|
||||
///< currently modified symbol.
|
||||
LIB_ID GetTargetLibId() const;
|
||||
|
||||
protected:
|
||||
|
@ -368,7 +368,7 @@ private:
|
|||
// Set up the tool framework
|
||||
void setupTools();
|
||||
|
||||
void savePartAs();
|
||||
void saveSymbolAs();
|
||||
|
||||
/**
|
||||
* Save the changes to the current library.
|
||||
|
@ -427,7 +427,7 @@ private:
|
|||
* @param aConvert the initial DeMorgan variant to show.
|
||||
* @return True if a copy of \a aLibEntry was successfully copied.
|
||||
*/
|
||||
bool LoadOneLibraryPartAux( LIB_SYMBOL* aLibEntry, const wxString& aLibrary, int aUnit,
|
||||
bool LoadOneLibrarySymbolAux( LIB_SYMBOL* aLibEntry, const wxString& aLibrary, int aUnit,
|
||||
int aConvert );
|
||||
|
||||
/**
|
||||
|
@ -441,8 +441,8 @@ private:
|
|||
///< Create a backup copy of a file with requested extension.
|
||||
bool backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt );
|
||||
|
||||
///< Return currently edited part.
|
||||
LIB_SYMBOL* getTargetPart() const;
|
||||
///< Return currently edited symbol.
|
||||
LIB_SYMBOL* getTargetSymbol() const;
|
||||
|
||||
///< Return either the library selected in the symbol tree, if context menu is active or
|
||||
///< the library that is currently modified.
|
||||
|
@ -456,14 +456,14 @@ private:
|
|||
*/
|
||||
bool saveAllLibraries( bool aRequireConfirmation );
|
||||
|
||||
///< Save the current part.
|
||||
bool saveCurrentPart();
|
||||
///< Save the current symbol.
|
||||
bool saveCurrentSymbol();
|
||||
|
||||
///< Store the currently modified part in the library manager buffer.
|
||||
void storeCurrentPart();
|
||||
///< Store the currently modified symbol in the library manager buffer.
|
||||
void storeCurrentSymbol();
|
||||
|
||||
///< Return true if \a aLibId is an alias for the editor screen part.
|
||||
bool isCurrentPart( const LIB_ID& aLibId ) const;
|
||||
///< Return true if \a aLibId is an alias for the editor screen symbol.
|
||||
bool isCurrentSymbol( const LIB_ID& aLibId ) const;
|
||||
|
||||
///< Rename LIB_SYMBOL aliases to avoid conflicts before adding a symbol to a library.
|
||||
void ensureUniqueName( LIB_SYMBOL* aSymbol, const wxString& aLibrary );
|
||||
|
@ -507,11 +507,11 @@ public:
|
|||
* When units are interchangeable, synchronizing editing of pins is usually the best way,
|
||||
* because if units are interchangeable, it implies that all similar pins are at the same
|
||||
* location.
|
||||
* When units are not interchangeable, do not synchronize editing of pins, because each part
|
||||
* When units are not interchangeable, do not synchronize editing of pins, because each symbol
|
||||
* is specific, and there are no (or few) similar pins between units.
|
||||
*
|
||||
* Setting this to false allows editing each pin per part or body style regardless other
|
||||
* pins at the same location. This requires the user to open each part or body style to make
|
||||
* Setting this to false allows editing each pin per symbol or body style regardless other
|
||||
* pins at the same location. This requires the user to open each symbol or body style to make
|
||||
* changes to the other pins at the same location.
|
||||
*
|
||||
* To know if others pins must be coupled when editing a pin, use SynchronizePins() instead
|
||||
|
@ -524,13 +524,13 @@ public:
|
|||
bool m_SyncPinEdit;
|
||||
|
||||
private:
|
||||
///< Helper screen used when no part is loaded
|
||||
///< Helper screen used when no symbol is loaded
|
||||
SCH_SCREEN* m_dummyScreen;
|
||||
|
||||
LIB_SYMBOL* m_my_part; // a part I own, it is not in any library, but a
|
||||
LIB_SYMBOL* m_symbol; // a symbol I own, it is not in any library, but a
|
||||
// copy could be.
|
||||
wxComboBox* m_unitSelectBox; // a ComboBox to select a unit to edit (if the
|
||||
// part has multiple units)
|
||||
// symbol has multiple units)
|
||||
SYMBOL_TREE_PANE* m_treePane; // symbol search tree widget
|
||||
SYMBOL_LIBRARY_MANAGER* m_libMgr; // manager taking care of temporary modifications
|
||||
SYMBOL_EDITOR_SETTINGS* m_settings; // Handle to the settings
|
||||
|
|
|
@ -145,13 +145,13 @@ void SYMBOL_EDIT_FRAME::updateTitle()
|
|||
}
|
||||
else
|
||||
{
|
||||
if( GetCurPart() )
|
||||
if( GetCurSymbol() )
|
||||
{
|
||||
bool readOnly = m_libMgr && m_libMgr->IsLibraryReadOnly( GetCurLib() );
|
||||
|
||||
title = wxString::Format( wxT( "%s%s %s\u2014 " ),
|
||||
GetScreen() && GetScreen()->IsContentModified() ? "*" : "",
|
||||
GetCurPart()->GetLibId().Format().c_str(),
|
||||
GetCurSymbol()->GetLibId().Format().c_str(),
|
||||
readOnly ? _( "[Read Only Library]" ) + wxT( " " ) : "" );
|
||||
}
|
||||
}
|
||||
|
@ -226,17 +226,17 @@ wxString SYMBOL_EDIT_FRAME::SelectLibraryFromList()
|
|||
}
|
||||
|
||||
|
||||
bool SYMBOL_EDIT_FRAME::saveCurrentPart()
|
||||
bool SYMBOL_EDIT_FRAME::saveCurrentSymbol()
|
||||
{
|
||||
if( GetCurPart() )
|
||||
if( GetCurSymbol() )
|
||||
{
|
||||
LIB_ID libId = GetCurPart()->GetLibId();
|
||||
LIB_ID libId = GetCurSymbol()->GetLibId();
|
||||
const wxString& libName = libId.GetLibNickname();
|
||||
const wxString& partName = libId.GetLibItemName();
|
||||
const wxString& symbolName = libId.GetLibItemName();
|
||||
|
||||
if( m_libMgr->FlushPart( partName, libName ) )
|
||||
if( m_libMgr->FlushSymbol( symbolName, libName ) )
|
||||
{
|
||||
m_libMgr->ClearPartModified( partName, libName );
|
||||
m_libMgr->ClearSymbolModified( symbolName, libName );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -247,17 +247,17 @@ bool SYMBOL_EDIT_FRAME::saveCurrentPart()
|
|||
|
||||
bool SYMBOL_EDIT_FRAME::LoadSymbol( const LIB_ID& aLibId, int aUnit, int aConvert )
|
||||
{
|
||||
if( GetCurPart() && GetCurPart()->GetLibId() == aLibId
|
||||
if( GetCurSymbol() && GetCurSymbol()->GetLibId() == aLibId
|
||||
&& GetUnit() == aUnit && GetConvert() == aConvert )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( GetScreen()->IsContentModified() && GetCurPart() )
|
||||
if( GetScreen()->IsContentModified() && GetCurSymbol() )
|
||||
{
|
||||
if( !HandleUnsavedChanges( this, _( "The current symbol has been modified. "
|
||||
"Save changes?" ),
|
||||
[&]()->bool { return saveCurrentPart(); } ) )
|
||||
[&]()->bool { return saveCurrentSymbol(); } ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -287,15 +287,15 @@ bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aAliasName, in
|
|||
return false;
|
||||
}
|
||||
|
||||
if( !alias || !LoadOneLibraryPartAux( alias, GetCurLib(), aUnit, aConvert ) )
|
||||
if( !alias || !LoadOneLibrarySymbolAux( alias, GetCurLib(), aUnit, aConvert ) )
|
||||
return false;
|
||||
|
||||
// Enable synchronized pin edit mode for symbols with interchangeable units
|
||||
m_SyncPinEdit = !GetCurPart()->UnitsLocked();
|
||||
m_SyncPinEdit = !GetCurSymbol()->UnitsLocked();
|
||||
|
||||
ClearUndoRedoList();
|
||||
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
|
||||
SetShowDeMorgan( GetCurPart()->Flatten()->HasConversion() );
|
||||
SetShowDeMorgan( GetCurSymbol()->Flatten()->HasConversion() );
|
||||
|
||||
if( aUnit > 0 )
|
||||
RebuildSymbolUnitsList();
|
||||
|
@ -304,7 +304,7 @@ bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aAliasName, in
|
|||
}
|
||||
|
||||
|
||||
bool SYMBOL_EDIT_FRAME::LoadOneLibraryPartAux( LIB_SYMBOL* aEntry, const wxString& aLibrary,
|
||||
bool SYMBOL_EDIT_FRAME::LoadOneLibrarySymbolAux( LIB_SYMBOL* aEntry, const wxString& aLibrary,
|
||||
int aUnit, int aConvert )
|
||||
{
|
||||
wxString msg, rootName;
|
||||
|
@ -324,8 +324,8 @@ bool SYMBOL_EDIT_FRAME::LoadOneLibraryPartAux( LIB_SYMBOL* aEntry, const wxStrin
|
|||
// Symbols from the schematic are edited in place and not managed by the library manager.
|
||||
if( IsSymbolFromSchematic() )
|
||||
{
|
||||
delete m_my_part;
|
||||
m_my_part = nullptr;
|
||||
delete m_symbol;
|
||||
m_symbol = nullptr;
|
||||
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
delete screen;
|
||||
|
@ -334,17 +334,17 @@ bool SYMBOL_EDIT_FRAME::LoadOneLibraryPartAux( LIB_SYMBOL* aEntry, const wxStrin
|
|||
rebuildMenuAndToolbar = true;
|
||||
}
|
||||
|
||||
LIB_SYMBOL* lib_symbol = m_libMgr->GetBufferedPart( aEntry->GetName(), aLibrary );
|
||||
LIB_SYMBOL* lib_symbol = m_libMgr->GetBufferedSymbol( aEntry->GetName(), aLibrary );
|
||||
wxCHECK( lib_symbol, false );
|
||||
|
||||
m_unit = aUnit > 0 ? aUnit : 1;
|
||||
m_convert = aConvert > 0 ? aConvert : 1;
|
||||
|
||||
// The buffered screen for the symbol
|
||||
SCH_SCREEN* part_screen = m_libMgr->GetScreen( lib_symbol->GetName(), aLibrary );
|
||||
SCH_SCREEN* symbol_screen = m_libMgr->GetScreen( lib_symbol->GetName(), aLibrary );
|
||||
|
||||
SetScreen( part_screen );
|
||||
SetCurPart( new LIB_SYMBOL( *lib_symbol ), true );
|
||||
SetScreen( symbol_screen );
|
||||
SetCurSymbol( new LIB_SYMBOL( *lib_symbol ), true );
|
||||
SetCurLib( aLibrary );
|
||||
|
||||
if( rebuildMenuAndToolbar )
|
||||
|
@ -356,7 +356,7 @@ bool SYMBOL_EDIT_FRAME::LoadOneLibraryPartAux( LIB_SYMBOL* aEntry, const wxStrin
|
|||
|
||||
updateTitle();
|
||||
RebuildSymbolUnitsList();
|
||||
SetShowDeMorgan( GetCurPart()->HasConversion() );
|
||||
SetShowDeMorgan( GetCurSymbol()->HasConversion() );
|
||||
|
||||
// Display the document information based on the entry selected just in
|
||||
// case the entry is an alias.
|
||||
|
@ -374,7 +374,7 @@ void SYMBOL_EDIT_FRAME::SaveAll()
|
|||
}
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::CreateNewPart()
|
||||
void SYMBOL_EDIT_FRAME::CreateNewSymbol()
|
||||
{
|
||||
m_toolManager->RunAction( ACTIONS::cancelInteractive, true );
|
||||
|
||||
|
@ -411,7 +411,7 @@ void SYMBOL_EDIT_FRAME::CreateNewPart()
|
|||
name.Replace( " ", "_" );
|
||||
|
||||
// Test if there is a symbol with this name already.
|
||||
if( !lib.empty() && m_libMgr->PartExists( name, lib ) )
|
||||
if( !lib.empty() && m_libMgr->SymbolExists( name, lib ) )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Symbol \"%s\" already exists in library \"%s\"" ),
|
||||
name, lib );
|
||||
|
@ -455,7 +455,7 @@ void SYMBOL_EDIT_FRAME::CreateNewPart()
|
|||
|
||||
new_symbol.SetConversion( dlg.GetAlternateBodyStyle() );
|
||||
|
||||
// must be called after loadPart, that calls SetShowDeMorgan, but
|
||||
// must be called after loadSymbol, that calls SetShowDeMorgan, but
|
||||
// because the symbol is empty,it looks like it has no alternate body
|
||||
SetShowDeMorgan( dlg.GetAlternateBodyStyle() );
|
||||
}
|
||||
|
@ -502,15 +502,15 @@ void SYMBOL_EDIT_FRAME::CreateNewPart()
|
|||
}
|
||||
}
|
||||
|
||||
m_libMgr->UpdatePart( &new_symbol, lib );
|
||||
m_libMgr->UpdateSymbol( &new_symbol, lib );
|
||||
SyncLibraries( false );
|
||||
LoadPart( name, lib, 1 );
|
||||
LoadSymbol( name, lib, 1 );
|
||||
}
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::Save()
|
||||
{
|
||||
if( getTargetPart() == m_my_part )
|
||||
if( getTargetSymbol() == m_symbol )
|
||||
{
|
||||
if( IsSymbolFromSchematic() )
|
||||
{
|
||||
|
@ -522,13 +522,13 @@ void SYMBOL_EDIT_FRAME::Save()
|
|||
}
|
||||
else
|
||||
{
|
||||
schframe->SaveSymbolToSchematic( *m_my_part );
|
||||
schframe->SaveSymbolToSchematic( *m_symbol );
|
||||
GetScreen()->SetContentModified( false );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
saveCurrentPart();
|
||||
saveCurrentSymbol();
|
||||
}
|
||||
}
|
||||
else if( !GetTargetLibId().GetLibNickname().empty() )
|
||||
|
@ -571,15 +571,15 @@ void SYMBOL_EDIT_FRAME::SaveSymbolAs()
|
|||
{
|
||||
wxCHECK( GetTargetLibId().IsValid(), /* void */ );
|
||||
|
||||
savePartAs();
|
||||
saveSymbolAs();
|
||||
|
||||
m_treePane->GetLibTree()->RefreshLibTree();
|
||||
}
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::savePartAs()
|
||||
void SYMBOL_EDIT_FRAME::saveSymbolAs()
|
||||
{
|
||||
LIB_SYMBOL* symbol = getTargetPart();
|
||||
LIB_SYMBOL* symbol = getTargetSymbol();
|
||||
|
||||
if( symbol )
|
||||
{
|
||||
|
@ -662,7 +662,7 @@ void SYMBOL_EDIT_FRAME::savePartAs()
|
|||
}
|
||||
|
||||
// Test if there is a symbol with this name already.
|
||||
if( m_libMgr->PartExists( new_name, new_lib ) )
|
||||
if( m_libMgr->SymbolExists( new_name, new_lib ) )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Symbol '%s' already exists in library '%s'" ),
|
||||
new_name,
|
||||
|
@ -674,44 +674,44 @@ void SYMBOL_EDIT_FRAME::savePartAs()
|
|||
LIB_SYMBOL new_symbol( *symbol );
|
||||
new_symbol.SetName( new_name );
|
||||
|
||||
m_libMgr->UpdatePart( &new_symbol, new_lib );
|
||||
m_libMgr->UpdateSymbol( &new_symbol, new_lib );
|
||||
SyncLibraries( false );
|
||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( new_lib, new_symbol.GetName() ) );
|
||||
LoadPart( new_name, new_lib, m_unit );
|
||||
LoadSymbol( new_name, new_lib, m_unit );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::UpdateAfterSymbolProperties( wxString* aOldName )
|
||||
{
|
||||
wxCHECK( m_my_part, /* void */ );
|
||||
wxCHECK( m_symbol, /* void */ );
|
||||
|
||||
wxString msg;
|
||||
wxString lib = GetCurLib();
|
||||
|
||||
if( !lib.IsEmpty() && aOldName && *aOldName != m_my_part->GetName() )
|
||||
if( !lib.IsEmpty() && aOldName && *aOldName != m_symbol->GetName() )
|
||||
{
|
||||
// Test the current library for name conflicts
|
||||
if( m_libMgr->PartExists( m_my_part->GetName(), lib ) )
|
||||
if( m_libMgr->SymbolExists( m_symbol->GetName(), lib ) )
|
||||
{
|
||||
msg.Printf( _( "The name '%s' conflicts with an existing entry in the library '%s'." ),
|
||||
m_my_part->GetName(),
|
||||
m_symbol->GetName(),
|
||||
lib );
|
||||
|
||||
DisplayErrorMessage( this, msg );
|
||||
m_my_part->SetName( *aOldName );
|
||||
m_symbol->SetName( *aOldName );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_libMgr->UpdatePartAfterRename( m_my_part, *aOldName, lib );
|
||||
m_libMgr->UpdateSymbolAfterRename( m_symbol, *aOldName, lib );
|
||||
}
|
||||
|
||||
// Reselect the renamed symbol
|
||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, m_my_part->GetName() ) );
|
||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, m_symbol->GetName() ) );
|
||||
}
|
||||
|
||||
RebuildSymbolUnitsList();
|
||||
SetShowDeMorgan( GetCurPart()->Flatten()->HasConversion() );
|
||||
SetShowDeMorgan( GetCurSymbol()->Flatten()->HasConversion() );
|
||||
updateTitle();
|
||||
DisplaySymbolDatasheet();
|
||||
|
||||
|
@ -720,11 +720,11 @@ void SYMBOL_EDIT_FRAME::UpdateAfterSymbolProperties( wxString* aOldName )
|
|||
}
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::DeletePartFromLibrary()
|
||||
void SYMBOL_EDIT_FRAME::DeleteSymbolFromLibrary()
|
||||
{
|
||||
LIB_ID libId = GetTargetLibId();
|
||||
|
||||
if( m_libMgr->IsPartModified( libId.GetLibItemName(), libId.GetLibNickname() )
|
||||
if( m_libMgr->IsSymbolModified( libId.GetLibItemName(), libId.GetLibNickname() )
|
||||
&& !IsOK( this, _( wxString::Format( "The symbol \"%s\" has been modified\n"
|
||||
"Do you want to remove it from the library?",
|
||||
libId.GetUniStringLibItemName() ) ) ) )
|
||||
|
@ -752,20 +752,20 @@ void SYMBOL_EDIT_FRAME::DeletePartFromLibrary()
|
|||
return;
|
||||
}
|
||||
|
||||
if( isCurrentPart( libId ) )
|
||||
if( isCurrentSymbol( libId ) )
|
||||
emptyScreen();
|
||||
|
||||
m_libMgr->RemovePart( libId.GetLibItemName(), libId.GetLibNickname() );
|
||||
m_libMgr->RemoveSymbol( libId.GetLibItemName(), libId.GetLibNickname() );
|
||||
|
||||
m_treePane->GetLibTree()->RefreshLibTree();
|
||||
}
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::CopyPartToClipboard()
|
||||
void SYMBOL_EDIT_FRAME::CopySymbolToClipboard()
|
||||
{
|
||||
int dummyUnit;
|
||||
LIB_ID libId = m_treePane->GetLibTree()->GetSelectedLibId( &dummyUnit );
|
||||
LIB_SYMBOL* symbol = m_libMgr->GetBufferedPart( libId.GetLibItemName(),
|
||||
LIB_SYMBOL* symbol = m_libMgr->GetBufferedSymbol( libId.GetLibItemName(),
|
||||
libId.GetLibNickname() );
|
||||
|
||||
if( !symbol )
|
||||
|
@ -773,7 +773,7 @@ void SYMBOL_EDIT_FRAME::CopyPartToClipboard()
|
|||
|
||||
std::unique_ptr< LIB_SYMBOL> tmp = symbol->Flatten();
|
||||
STRING_FORMATTER formatter;
|
||||
SCH_SEXPR_PLUGIN::FormatPart( tmp.get(), formatter );
|
||||
SCH_SEXPR_PLUGIN::FormatLibSymbol( tmp.get(), formatter );
|
||||
|
||||
wxLogNull doNotLog; // disable logging of failed clipboard actions
|
||||
|
||||
|
@ -790,7 +790,7 @@ void SYMBOL_EDIT_FRAME::CopyPartToClipboard()
|
|||
}
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::DuplicatePart( bool aFromClipboard )
|
||||
void SYMBOL_EDIT_FRAME::DuplicateSymbol( bool aFromClipboard )
|
||||
{
|
||||
int dummyUnit;
|
||||
LIB_ID libId = m_treePane->GetLibTree()->GetSelectedLibId( &dummyUnit );
|
||||
|
@ -814,13 +814,13 @@ void SYMBOL_EDIT_FRAME::DuplicatePart( bool aFromClipboard )
|
|||
|
||||
wxTextDataObject data;
|
||||
clipboard->GetData( data );
|
||||
wxString partSource = data.GetText();
|
||||
wxString symbolSource = data.GetText();
|
||||
|
||||
STRING_LINE_READER reader( TO_UTF8( partSource ), "Clipboard" );
|
||||
STRING_LINE_READER reader( TO_UTF8( symbolSource ), "Clipboard" );
|
||||
|
||||
try
|
||||
{
|
||||
newSymbol = SCH_SEXPR_PLUGIN::ParsePart( reader );
|
||||
newSymbol = SCH_SEXPR_PLUGIN::ParseLibSymbol( reader );
|
||||
}
|
||||
catch( IO_ERROR& e )
|
||||
{
|
||||
|
@ -830,7 +830,7 @@ void SYMBOL_EDIT_FRAME::DuplicatePart( bool aFromClipboard )
|
|||
}
|
||||
else
|
||||
{
|
||||
srcSymbol = m_libMgr->GetBufferedPart( libId.GetLibItemName(), lib );
|
||||
srcSymbol = m_libMgr->GetBufferedSymbol( libId.GetLibItemName(), lib );
|
||||
|
||||
wxCHECK( srcSymbol, /* void */ );
|
||||
|
||||
|
@ -851,9 +851,9 @@ void SYMBOL_EDIT_FRAME::DuplicatePart( bool aFromClipboard )
|
|||
return;
|
||||
|
||||
ensureUniqueName( newSymbol, lib );
|
||||
m_libMgr->UpdatePart( newSymbol, lib );
|
||||
m_libMgr->UpdateSymbol( newSymbol, lib );
|
||||
|
||||
LoadOneLibraryPartAux( newSymbol, lib, GetUnit(), GetConvert() );
|
||||
LoadOneLibrarySymbolAux( newSymbol, lib, GetUnit(), GetConvert() );
|
||||
|
||||
SyncLibraries( false );
|
||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, newSymbol->GetName() ) );
|
||||
|
@ -870,7 +870,7 @@ void SYMBOL_EDIT_FRAME::ensureUniqueName( LIB_SYMBOL* aSymbol, const wxString& a
|
|||
wxString newName = aSymbol->GetName();
|
||||
|
||||
// Append a number to the name until the name is unique in the library.
|
||||
while( m_libMgr->PartExists( newName, aLibrary ) )
|
||||
while( m_libMgr->SymbolExists( newName, aLibrary ) )
|
||||
newName.Printf( "%s_%d", aSymbol->GetName(), i++ );
|
||||
|
||||
aSymbol->SetName( newName );
|
||||
|
@ -883,54 +883,54 @@ void SYMBOL_EDIT_FRAME::Revert( bool aConfirm )
|
|||
const wxString& libName = libId.GetLibNickname();
|
||||
|
||||
// Empty if this is the library itself that is selected.
|
||||
const wxString& partName = libId.GetLibItemName();
|
||||
const wxString& symbolName = libId.GetLibItemName();
|
||||
|
||||
wxString msg = wxString::Format( _( "Revert \"%s\" to last version saved?" ),
|
||||
partName.IsEmpty() ? libName : partName );
|
||||
symbolName.IsEmpty() ? libName : symbolName );
|
||||
|
||||
if( aConfirm && !ConfirmRevertDialog( this, msg ) )
|
||||
return;
|
||||
|
||||
bool reload_currentPart = false;
|
||||
wxString curr_partName = partName;
|
||||
bool reload_currentSymbol = false;
|
||||
wxString curr_symbolName = symbolName;
|
||||
|
||||
if( GetCurPart() )
|
||||
if( GetCurSymbol() )
|
||||
{
|
||||
// the library itself is reverted: the current part will be reloaded only if it is
|
||||
// the library itself is reverted: the current symbol will be reloaded only if it is
|
||||
// owned by this library
|
||||
if( partName.IsEmpty() )
|
||||
if( symbolName.IsEmpty() )
|
||||
{
|
||||
LIB_ID curr_libId = GetCurPart()->GetLibId();
|
||||
reload_currentPart = libName == curr_libId.GetLibNickname();
|
||||
LIB_ID curr_libId = GetCurSymbol()->GetLibId();
|
||||
reload_currentSymbol = libName == curr_libId.GetLibNickname();
|
||||
|
||||
if( reload_currentPart )
|
||||
curr_partName = curr_libId.GetLibItemName();
|
||||
if( reload_currentSymbol )
|
||||
curr_symbolName = curr_libId.GetLibItemName();
|
||||
}
|
||||
else
|
||||
{
|
||||
reload_currentPart = isCurrentPart( libId );
|
||||
reload_currentSymbol = isCurrentSymbol( libId );
|
||||
}
|
||||
}
|
||||
|
||||
int unit = m_unit;
|
||||
|
||||
if( reload_currentPart )
|
||||
if( reload_currentSymbol )
|
||||
emptyScreen();
|
||||
|
||||
if( partName.IsEmpty() )
|
||||
if( symbolName.IsEmpty() )
|
||||
{
|
||||
m_libMgr->RevertLibrary( libName );
|
||||
}
|
||||
else
|
||||
{
|
||||
libId = m_libMgr->RevertPart( libId.GetLibItemName(), libId.GetLibNickname() );
|
||||
libId = m_libMgr->RevertSymbol( libId.GetLibItemName(), libId.GetLibNickname() );
|
||||
|
||||
m_treePane->GetLibTree()->SelectLibId( libId );
|
||||
m_libMgr->ClearPartModified( libId.GetLibItemName(), libId.GetLibNickname() );
|
||||
m_libMgr->ClearSymbolModified( libId.GetLibItemName(), libId.GetLibNickname() );
|
||||
}
|
||||
|
||||
if( reload_currentPart && m_libMgr->PartExists( curr_partName, libName ) )
|
||||
LoadPart( curr_partName, libName, unit );
|
||||
if( reload_currentSymbol && m_libMgr->SymbolExists( curr_symbolName, libName ) )
|
||||
LoadSymbol( curr_symbolName, libName, unit );
|
||||
|
||||
m_treePane->Refresh();
|
||||
}
|
||||
|
@ -945,11 +945,11 @@ void SYMBOL_EDIT_FRAME::RevertAll()
|
|||
}
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::LoadPart( const wxString& aAlias, const wxString& aLibrary, int aUnit )
|
||||
void SYMBOL_EDIT_FRAME::LoadSymbol( const wxString& aAlias, const wxString& aLibrary, int aUnit )
|
||||
{
|
||||
LIB_SYMBOL* part = m_libMgr->GetBufferedPart( aAlias, aLibrary );
|
||||
LIB_SYMBOL* symbol = m_libMgr->GetBufferedSymbol( aAlias, aLibrary );
|
||||
|
||||
if( !part )
|
||||
if( !symbol )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
|
@ -962,9 +962,9 @@ void SYMBOL_EDIT_FRAME::LoadPart( const wxString& aAlias, const wxString& aLibra
|
|||
// Usually if units are locked, graphic items are specific to each unit
|
||||
// and if units are interchangeable, graphic items are common to units
|
||||
SYMBOL_EDITOR_DRAWING_TOOLS* tools = GetToolManager()->GetTool<SYMBOL_EDITOR_DRAWING_TOOLS>();
|
||||
tools->SetDrawSpecificUnit( part->UnitsLocked() );
|
||||
tools->SetDrawSpecificUnit( symbol->UnitsLocked() );
|
||||
|
||||
LoadOneLibraryPartAux( part, aLibrary, aUnit, 0 );
|
||||
LoadOneLibrarySymbolAux( symbol, aLibrary, aUnit, 0 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1172,16 +1172,16 @@ void SYMBOL_EDIT_FRAME::DisplaySymbolDatasheet()
|
|||
{
|
||||
EDA_DRAW_FRAME::ClearMsgPanel();
|
||||
|
||||
if( !m_my_part )
|
||||
if( !m_symbol )
|
||||
return;
|
||||
|
||||
wxString msg = m_my_part->GetName();
|
||||
wxString msg = m_symbol->GetName();
|
||||
|
||||
AppendMsgPanel( _( "Name" ), msg, 8 );
|
||||
|
||||
if( m_my_part->IsAlias() )
|
||||
if( m_symbol->IsAlias() )
|
||||
{
|
||||
PART_SPTR parent = m_my_part->GetParent().lock();
|
||||
LIB_SYMBOL_SPTR parent = m_symbol->GetParent().lock();
|
||||
|
||||
msg = parent ? parent->GetName() : _( "Undefined!" );
|
||||
AppendMsgPanel( _( "Parent" ), msg, 8 );
|
||||
|
@ -1199,13 +1199,13 @@ void SYMBOL_EDIT_FRAME::DisplaySymbolDatasheet()
|
|||
|
||||
AppendMsgPanel( _( "Body" ), msg, 8 );
|
||||
|
||||
if( m_my_part->IsPower() )
|
||||
if( m_symbol->IsPower() )
|
||||
msg = _( "Power Symbol" );
|
||||
else
|
||||
msg = _( "Symbol" );
|
||||
|
||||
AppendMsgPanel( _( "Type" ), msg, 8 );
|
||||
AppendMsgPanel( _( "Description" ), m_my_part->GetDescription(), 8 );
|
||||
AppendMsgPanel( _( "Keywords" ), m_my_part->GetKeyWords() );
|
||||
AppendMsgPanel( _( "Datasheet" ), m_my_part->GetDatasheetField().GetText() );
|
||||
AppendMsgPanel( _( "Description" ), m_symbol->GetDescription(), 8 );
|
||||
AppendMsgPanel( _( "Keywords" ), m_symbol->GetKeyWords() );
|
||||
AppendMsgPanel( _( "Datasheet" ), m_symbol->GetDatasheetField().GetText() );
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <wx/filedlg.h>
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::ImportPart()
|
||||
void SYMBOL_EDIT_FRAME::ImportSymbol()
|
||||
{
|
||||
wxString msg;
|
||||
wxString libName = getTargetLib();
|
||||
|
@ -68,7 +68,7 @@ void SYMBOL_EDIT_FRAME::ImportPart()
|
|||
SCH_IO_MGR::SCH_FILE_T piType = SCH_IO_MGR::GuessPluginTypeFromLibPath( fn.GetFullPath() );
|
||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( piType ) );
|
||||
|
||||
// TODO dialog to select the part to be imported if there is more than one
|
||||
// TODO dialog to select the symbol to be imported if there is more than one
|
||||
try
|
||||
{
|
||||
pi->EnumerateSymbolLib( symbols, fn.GetFullPath() );
|
||||
|
@ -90,23 +90,23 @@ void SYMBOL_EDIT_FRAME::ImportPart()
|
|||
wxString symbolName = symbols[0];
|
||||
LIB_SYMBOL* entry = pi->LoadSymbol( fn.GetFullPath(), symbolName );
|
||||
|
||||
if( m_libMgr->PartExists( symbols[0], libName ) )
|
||||
if( m_libMgr->SymbolExists( symbols[0], libName ) )
|
||||
{
|
||||
msg.Printf( _( "Symbol \"%s\" already exists in library \"%s\"." ), symbolName, libName );
|
||||
DisplayError( this, msg );
|
||||
return;
|
||||
}
|
||||
|
||||
m_libMgr->UpdatePart( entry, libName );
|
||||
m_libMgr->UpdateSymbol( entry, libName );
|
||||
SyncLibraries( false );
|
||||
LoadPart( symbolName, libName, 1 );
|
||||
LoadSymbol( symbolName, libName, 1 );
|
||||
}
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::ExportPart()
|
||||
void SYMBOL_EDIT_FRAME::ExportSymbol()
|
||||
{
|
||||
wxString msg, title;
|
||||
LIB_SYMBOL* symbol = getTargetPart();
|
||||
LIB_SYMBOL* symbol = getTargetSymbol();
|
||||
|
||||
if( !symbol )
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName )
|
|||
|
||||
plotter->StartPlot();
|
||||
|
||||
if( m_my_part )
|
||||
if( m_symbol )
|
||||
{
|
||||
TRANSFORM temp; // Uses default transform
|
||||
wxPoint plotPos;
|
||||
|
@ -67,10 +67,10 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName )
|
|||
plotPos.x = pageInfo.GetWidthIU() / 2;
|
||||
plotPos.y = pageInfo.GetHeightIU() / 2;
|
||||
|
||||
m_my_part->Plot( plotter, GetUnit(), GetConvert(), plotPos, temp );
|
||||
m_symbol->Plot( plotter, GetUnit(), GetConvert(), plotPos, temp );
|
||||
|
||||
// Plot lib fields, not plotted by m_my_part->Plot():
|
||||
m_my_part->PlotLibFields( plotter, GetUnit(), GetConvert(), plotPos, temp );
|
||||
// Plot lib fields, not plotted by m_symbol->Plot():
|
||||
m_symbol->PlotLibFields( plotter, GetUnit(), GetConvert(), plotPos, temp );
|
||||
}
|
||||
|
||||
plotter->EndPlot();
|
||||
|
@ -80,7 +80,7 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName )
|
|||
|
||||
void SYMBOL_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
|
||||
{
|
||||
if( !m_my_part )
|
||||
if( !m_symbol )
|
||||
return;
|
||||
|
||||
wxSize pagesize = GetScreen()->GetPageSettings().GetSizeIU();
|
||||
|
@ -93,5 +93,5 @@ void SYMBOL_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
|
|||
plot_offset.x = pagesize.x / 2;
|
||||
plot_offset.y = pagesize.y / 2;
|
||||
|
||||
m_my_part->Print( aSettings, plot_offset, m_unit, m_convert, PART_DRAW_OPTIONS() );
|
||||
m_symbol->Print( aSettings, plot_offset, m_unit, m_convert, LIB_SYMBOL_OPTIONS() );
|
||||
}
|
||||
|
|
|
@ -74,22 +74,22 @@ void SYMBOL_EDIT_FRAME::GetSymbolFromRedoList()
|
|||
|
||||
// Store the current symbol in the undo buffer
|
||||
PICKED_ITEMS_LIST* undoCommand = new PICKED_ITEMS_LIST();
|
||||
LIB_SYMBOL* oldSymbol = m_my_part;
|
||||
LIB_SYMBOL* oldSymbol = m_symbol;
|
||||
oldSymbol->SetFlags( UR_TRANSIENT );
|
||||
ITEM_PICKER undoWrapper( GetScreen(), oldSymbol, undoRedoType );
|
||||
undoCommand->PushItem( undoWrapper );
|
||||
PushCommandToUndoList( undoCommand );
|
||||
|
||||
// Do not delete the previous symbol by calling SetCurPart( symbol )
|
||||
// Do not delete the previous symbol by calling SetCurSymbol( symbol )
|
||||
// which calls delete <previous symbol>.
|
||||
// <previous symbol> is now put in undo list and is owned by this list
|
||||
// Just set the current symbol to the symbol which come from the redo list
|
||||
m_my_part = symbol;
|
||||
m_symbol = symbol;
|
||||
|
||||
if( undoRedoType == UNDO_REDO::LIB_RENAME )
|
||||
{
|
||||
wxString lib = GetCurLib();
|
||||
m_libMgr->UpdatePartAfterRename( symbol, oldSymbol->GetName(), lib );
|
||||
m_libMgr->UpdateSymbolAfterRename( symbol, oldSymbol->GetName(), lib );
|
||||
|
||||
// Reselect the renamed symbol
|
||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, symbol->GetName() ) );
|
||||
|
@ -122,22 +122,22 @@ void SYMBOL_EDIT_FRAME::GetSymbolFromUndoList()
|
|||
|
||||
// Store the current symbol in the redo buffer
|
||||
PICKED_ITEMS_LIST* redoCommand = new PICKED_ITEMS_LIST();
|
||||
LIB_SYMBOL* oldSymbol = m_my_part;
|
||||
LIB_SYMBOL* oldSymbol = m_symbol;
|
||||
oldSymbol->SetFlags( UR_TRANSIENT );
|
||||
ITEM_PICKER redoWrapper( GetScreen(), oldSymbol, undoRedoType );
|
||||
redoCommand->PushItem( redoWrapper );
|
||||
PushCommandToRedoList( redoCommand );
|
||||
|
||||
// Do not delete the previous symbol by calling SetCurPart( symbol ),
|
||||
// Do not delete the previous symbol by calling SetCurSymbol( symbol ),
|
||||
// which calls delete <previous symbol>.
|
||||
// <previous symbol> is now put in redo list and is owned by this list.
|
||||
// Just set the current symbol to the symbol which come from the undo list
|
||||
m_my_part = symbol;
|
||||
m_symbol = symbol;
|
||||
|
||||
if( undoRedoType == UNDO_REDO::LIB_RENAME )
|
||||
{
|
||||
wxString lib = GetCurLib();
|
||||
m_libMgr->UpdatePartAfterRename( symbol, oldSymbol->GetName(), lib );
|
||||
m_libMgr->UpdateSymbolAfterRename( symbol, oldSymbol->GetName(), lib );
|
||||
|
||||
// Reselect the renamed symbol
|
||||
m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, symbol->GetName() ) );
|
||||
|
@ -167,7 +167,7 @@ void SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo()
|
|||
delete undoCommand;
|
||||
LIB_SYMBOL* symbol = (LIB_SYMBOL*) undoWrapper.GetItem();
|
||||
symbol->ClearFlags( UR_TRANSIENT );
|
||||
SetCurPart( symbol, false );
|
||||
SetCurSymbol( symbol, false );
|
||||
|
||||
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
|
||||
selTool->RebuildSelection();
|
||||
|
|
|
@ -199,18 +199,18 @@ bool SYMBOL_LIBRARY_MANAGER::SaveLibrary( const wxString& aLibrary, const wxStri
|
|||
// Handle buffered library
|
||||
LIB_BUFFER& libBuf = it->second;
|
||||
|
||||
const auto& partBuffers = libBuf.GetBuffers();
|
||||
const auto& symbolBuffers = libBuf.GetBuffers();
|
||||
|
||||
for( const auto& partBuf : partBuffers )
|
||||
for( const auto& symbolBuf : symbolBuffers )
|
||||
{
|
||||
if( !libBuf.SaveBuffer( partBuf, aFileName, &*pi, true ) )
|
||||
if( !libBuf.SaveBuffer( symbolBuf, aFileName, &*pi, true ) )
|
||||
{
|
||||
// Something went wrong, but try to save other libraries
|
||||
res = false;
|
||||
}
|
||||
}
|
||||
|
||||
// clear the deleted parts buffer only if data is saved to the original file
|
||||
// clear the deleted symbols buffer only if data is saved to the original file
|
||||
wxFileName original, destination( aFileName );
|
||||
auto row = GetLibrary( aLibrary );
|
||||
|
||||
|
@ -228,7 +228,7 @@ bool SYMBOL_LIBRARY_MANAGER::SaveLibrary( const wxString& aLibrary, const wxStri
|
|||
else
|
||||
{
|
||||
// Handle original library
|
||||
for( LIB_SYMBOL* symbol : getOriginalParts( aLibrary ) )
|
||||
for( LIB_SYMBOL* symbol : getOriginalSymbols( aLibrary ) )
|
||||
{
|
||||
LIB_SYMBOL* newSymbol;
|
||||
|
||||
|
@ -282,7 +282,7 @@ bool SYMBOL_LIBRARY_MANAGER::IsLibraryModified( const wxString& aLibrary ) const
|
|||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::IsPartModified( const wxString& aAlias,
|
||||
bool SYMBOL_LIBRARY_MANAGER::IsSymbolModified( const wxString& aAlias,
|
||||
const wxString& aLibrary ) const
|
||||
{
|
||||
auto libIt = m_libs.find( aLibrary );
|
||||
|
@ -315,7 +315,7 @@ bool SYMBOL_LIBRARY_MANAGER::ClearLibraryModified( const wxString& aLibrary ) co
|
|||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::ClearPartModified( const wxString& aAlias,
|
||||
bool SYMBOL_LIBRARY_MANAGER::ClearSymbolModified( const wxString& aAlias,
|
||||
const wxString& aLibrary ) const
|
||||
{
|
||||
auto libI = m_libs.find( aLibrary );
|
||||
|
@ -358,7 +358,7 @@ std::list<LIB_SYMBOL*> SYMBOL_LIBRARY_MANAGER::GetAliases( const wxString& aLibr
|
|||
{
|
||||
for( auto& symbolBuf : libIt->second.GetBuffers() )
|
||||
{
|
||||
ret.push_back( symbolBuf->GetPart() );
|
||||
ret.push_back( symbolBuf->GetSymbol() );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -381,16 +381,16 @@ std::list<LIB_SYMBOL*> SYMBOL_LIBRARY_MANAGER::GetAliases( const wxString& aLibr
|
|||
}
|
||||
|
||||
|
||||
LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetBufferedPart( const wxString& aAlias,
|
||||
LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol( const wxString& aAlias,
|
||||
const wxString& aLibrary )
|
||||
{
|
||||
wxCHECK( LibraryExists( aLibrary ), nullptr );
|
||||
|
||||
// try the library buffers first
|
||||
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
|
||||
LIB_SYMBOL* bufferedPart = libBuf.GetPart( aAlias );
|
||||
LIB_SYMBOL* bufferedSymbol = libBuf.GetSymbol( aAlias );
|
||||
|
||||
if( !bufferedPart ) // no buffer symbol found
|
||||
if( !bufferedSymbol ) // no buffer symbol found
|
||||
{
|
||||
// create a copy of the symbol
|
||||
try
|
||||
|
@ -411,7 +411,7 @@ LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetBufferedPart( const wxString& aAlias,
|
|||
symbol->GetName() ) );
|
||||
|
||||
// Check if the parent symbol buffer has already be created.
|
||||
bufferedParent = libBuf.GetPart( parent->GetName() );
|
||||
bufferedParent = libBuf.GetSymbol( parent->GetName() );
|
||||
|
||||
if( !bufferedParent )
|
||||
{
|
||||
|
@ -420,22 +420,22 @@ LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetBufferedPart( const wxString& aAlias,
|
|||
}
|
||||
}
|
||||
|
||||
bufferedPart = new LIB_SYMBOL( *symbol );
|
||||
bufferedSymbol = new LIB_SYMBOL( *symbol );
|
||||
|
||||
if( bufferedParent )
|
||||
bufferedPart->SetParent( bufferedParent );
|
||||
bufferedSymbol->SetParent( bufferedParent );
|
||||
|
||||
libBuf.CreateBuffer( bufferedPart, new SCH_SCREEN );
|
||||
libBuf.CreateBuffer( bufferedSymbol, new SCH_SCREEN );
|
||||
}
|
||||
catch( const IO_ERROR& e )
|
||||
{
|
||||
wxLogMessage( _( "Error loading symbol \"%s\" from library \"%s\". (%s)" ),
|
||||
aAlias, aLibrary, e.What() );
|
||||
bufferedPart = nullptr;
|
||||
bufferedSymbol = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return bufferedPart;
|
||||
return bufferedSymbol;
|
||||
}
|
||||
|
||||
|
||||
|
@ -452,7 +452,7 @@ SCH_SCREEN* SYMBOL_LIBRARY_MANAGER::GetScreen( const wxString& aAlias, const wxS
|
|||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::UpdatePart( LIB_SYMBOL* aSymbol, const wxString& aLibrary )
|
||||
bool SYMBOL_LIBRARY_MANAGER::UpdateSymbol( LIB_SYMBOL* aSymbol, const wxString& aLibrary )
|
||||
{
|
||||
wxCHECK( LibraryExists( aLibrary ), false );
|
||||
wxCHECK( aSymbol, false );
|
||||
|
@ -461,11 +461,11 @@ bool SYMBOL_LIBRARY_MANAGER::UpdatePart( LIB_SYMBOL* aSymbol, const wxString& aL
|
|||
|
||||
if( symbolBuf ) // Existing symbol.
|
||||
{
|
||||
LIB_SYMBOL* bufferedPart = const_cast< LIB_SYMBOL* >( symbolBuf->GetPart() );
|
||||
LIB_SYMBOL* bufferedSymbol = const_cast< LIB_SYMBOL* >( symbolBuf->GetSymbol() );
|
||||
|
||||
wxCHECK( bufferedPart, false );
|
||||
wxCHECK( bufferedSymbol, false );
|
||||
|
||||
*bufferedPart = *aSymbol;
|
||||
*bufferedSymbol = *aSymbol;
|
||||
symbolBuf->GetScreen()->SetContentModified();
|
||||
}
|
||||
else // New symbol
|
||||
|
@ -483,7 +483,7 @@ bool SYMBOL_LIBRARY_MANAGER::UpdatePart( LIB_SYMBOL* aSymbol, const wxString& aL
|
|||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::UpdatePartAfterRename( LIB_SYMBOL* aSymbol, const wxString& aOldName,
|
||||
bool SYMBOL_LIBRARY_MANAGER::UpdateSymbolAfterRename( LIB_SYMBOL* aSymbol, const wxString& aOldName,
|
||||
const wxString& aLibrary )
|
||||
{
|
||||
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
|
||||
|
@ -498,7 +498,7 @@ bool SYMBOL_LIBRARY_MANAGER::UpdatePartAfterRename( LIB_SYMBOL* aSymbol, const w
|
|||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::FlushPart( const wxString& aAlias, const wxString& aLibrary )
|
||||
bool SYMBOL_LIBRARY_MANAGER::FlushSymbol( const wxString& aAlias, const wxString& aLibrary )
|
||||
{
|
||||
auto it = m_libs.find( aLibrary );
|
||||
|
||||
|
@ -512,7 +512,7 @@ bool SYMBOL_LIBRARY_MANAGER::FlushPart( const wxString& aAlias, const wxString&
|
|||
}
|
||||
|
||||
|
||||
LIB_ID SYMBOL_LIBRARY_MANAGER::RevertPart( const wxString& aAlias, const wxString& aLibrary )
|
||||
LIB_ID SYMBOL_LIBRARY_MANAGER::RevertSymbol( const wxString& aAlias, const wxString& aLibrary )
|
||||
{
|
||||
auto it = m_libs.find( aLibrary );
|
||||
|
||||
|
@ -525,11 +525,11 @@ LIB_ID SYMBOL_LIBRARY_MANAGER::RevertPart( const wxString& aAlias, const wxStrin
|
|||
|
||||
if( original.GetName() != aAlias )
|
||||
{
|
||||
UpdatePartAfterRename( &original, aAlias, aLibrary );
|
||||
UpdateSymbolAfterRename( &original, aAlias, aLibrary );
|
||||
}
|
||||
else
|
||||
{
|
||||
symbolBuf->SetPart( new LIB_SYMBOL( original ) );
|
||||
symbolBuf->SetSymbol( new LIB_SYMBOL( original ) );
|
||||
m_frame.SyncLibraries( false );
|
||||
}
|
||||
|
||||
|
@ -569,7 +569,7 @@ bool SYMBOL_LIBRARY_MANAGER::RevertAll()
|
|||
if( !buffer->IsModified() )
|
||||
continue;
|
||||
|
||||
RevertPart( lib.first, buffer->GetOriginal()->GetName() );
|
||||
RevertSymbol( lib.first, buffer->GetOriginal()->GetName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -577,7 +577,7 @@ bool SYMBOL_LIBRARY_MANAGER::RevertAll()
|
|||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::RemovePart( const wxString& aAlias, const wxString& aLibrary )
|
||||
bool SYMBOL_LIBRARY_MANAGER::RemoveSymbol( const wxString& aAlias, const wxString& aLibrary )
|
||||
{
|
||||
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
|
||||
auto symbolBuf = libBuf.GetBuffer( aAlias );
|
||||
|
@ -600,7 +600,7 @@ LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetAlias( const wxString& aAlias,
|
|||
|
||||
if( libIt != m_libs.end() )
|
||||
{
|
||||
LIB_SYMBOL* symbol = libIt->second.GetPart( aAlias );
|
||||
LIB_SYMBOL* symbol = libIt->second.GetSymbol( aAlias );
|
||||
|
||||
if( symbol )
|
||||
return symbol;
|
||||
|
@ -623,7 +623,7 @@ LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetAlias( const wxString& aAlias,
|
|||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::PartExists( const wxString& aAlias, const wxString& aLibrary ) const
|
||||
bool SYMBOL_LIBRARY_MANAGER::SymbolExists( const wxString& aAlias, const wxString& aLibrary ) const
|
||||
{
|
||||
auto libBufIt = m_libs.find( aLibrary );
|
||||
LIB_SYMBOL* alias = nullptr;
|
||||
|
@ -752,7 +752,7 @@ SYMBOL_LIB_TABLE* SYMBOL_LIBRARY_MANAGER::symTable() const
|
|||
}
|
||||
|
||||
|
||||
std::set<LIB_SYMBOL*> SYMBOL_LIBRARY_MANAGER::getOriginalParts( const wxString& aLibrary )
|
||||
std::set<LIB_SYMBOL*> SYMBOL_LIBRARY_MANAGER::getOriginalSymbols( const wxString& aLibrary )
|
||||
{
|
||||
std::set<LIB_SYMBOL*> symbols;
|
||||
wxCHECK( LibraryExists( aLibrary ), symbols );
|
||||
|
@ -789,7 +789,7 @@ SYMBOL_LIBRARY_MANAGER::LIB_BUFFER& SYMBOL_LIBRARY_MANAGER::getLibraryBuffer(
|
|||
auto ret = m_libs.emplace( aLibrary, LIB_BUFFER( aLibrary ) );
|
||||
LIB_BUFFER& buf = ret.first->second;
|
||||
|
||||
for( auto symbol : getOriginalParts( aLibrary ) )
|
||||
for( auto symbol : getOriginalSymbols( aLibrary ) )
|
||||
{
|
||||
LIB_SYMBOL* newSymbol;
|
||||
|
||||
|
@ -801,7 +801,7 @@ SYMBOL_LIBRARY_MANAGER::LIB_BUFFER& SYMBOL_LIBRARY_MANAGER::getLibraryBuffer(
|
|||
wxString::Format( "Derived symbol '%s' found with undefined parent.",
|
||||
symbol->GetName() ) );
|
||||
|
||||
LIB_SYMBOL* libParent = buf.GetPart( oldParent->GetName() );
|
||||
LIB_SYMBOL* libParent = buf.GetSymbol( oldParent->GetName() );
|
||||
|
||||
if( !libParent )
|
||||
{
|
||||
|
@ -813,7 +813,7 @@ SYMBOL_LIBRARY_MANAGER::LIB_BUFFER& SYMBOL_LIBRARY_MANAGER::getLibraryBuffer(
|
|||
newSymbol->SetParent( libParent );
|
||||
buf.CreateBuffer( newSymbol, new SCH_SCREEN );
|
||||
}
|
||||
else if( !buf.GetPart( symbol->GetName() ) )
|
||||
else if( !buf.GetSymbol( symbol->GetName() ) )
|
||||
{
|
||||
buf.CreateBuffer( new LIB_SYMBOL( *symbol ), new SCH_SCREEN );
|
||||
}
|
||||
|
@ -823,68 +823,68 @@ SYMBOL_LIBRARY_MANAGER::LIB_BUFFER& SYMBOL_LIBRARY_MANAGER::getLibraryBuffer(
|
|||
}
|
||||
|
||||
|
||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PART_BUFFER( LIB_SYMBOL* aSymbol,
|
||||
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::SYMBOL_BUFFER( LIB_SYMBOL* aSymbol,
|
||||
std::unique_ptr<SCH_SCREEN> aScreen ) :
|
||||
m_screen( std::move( aScreen ) ),
|
||||
m_part( aSymbol )
|
||||
m_symbol( aSymbol )
|
||||
{
|
||||
m_original = new LIB_SYMBOL( *aSymbol );
|
||||
}
|
||||
|
||||
|
||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::~PART_BUFFER()
|
||||
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::~SYMBOL_BUFFER()
|
||||
{
|
||||
delete m_part;
|
||||
delete m_symbol;
|
||||
delete m_original;
|
||||
}
|
||||
|
||||
|
||||
void SYMBOL_LIBRARY_MANAGER::PART_BUFFER::SetPart( LIB_SYMBOL* aSymbol )
|
||||
void SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::SetSymbol( LIB_SYMBOL* aSymbol )
|
||||
{
|
||||
wxCHECK( m_part != aSymbol, /* void */ );
|
||||
wxCHECK( m_symbol != aSymbol, /* void */ );
|
||||
wxASSERT( aSymbol );
|
||||
delete m_part;
|
||||
m_part = aSymbol;
|
||||
delete m_symbol;
|
||||
m_symbol = aSymbol;
|
||||
|
||||
// If the part moves libraries then the original moves with it
|
||||
if( m_original->GetLibId().GetLibNickname() != m_part->GetLibId().GetLibNickname() )
|
||||
// If the symbol moves libraries then the original moves with it
|
||||
if( m_original->GetLibId().GetLibNickname() != m_symbol->GetLibId().GetLibNickname() )
|
||||
{
|
||||
m_original->SetLibId( LIB_ID( m_part->GetLibId().GetLibNickname(),
|
||||
m_original->SetLibId( LIB_ID( m_symbol->GetLibId().GetLibNickname(),
|
||||
m_original->GetLibId().GetLibItemName() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SYMBOL_LIBRARY_MANAGER::PART_BUFFER::SetOriginal( LIB_SYMBOL* aSymbol )
|
||||
void SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::SetOriginal( LIB_SYMBOL* aSymbol )
|
||||
{
|
||||
wxCHECK( m_original != aSymbol, /* void */ );
|
||||
wxASSERT( aSymbol );
|
||||
delete m_original;
|
||||
m_original = aSymbol;
|
||||
|
||||
// The original is not allowed to have a different library than its part
|
||||
if( m_original->GetLibId().GetLibNickname() != m_part->GetLibId().GetLibNickname() )
|
||||
// The original is not allowed to have a different library than its symbol
|
||||
if( m_original->GetLibId().GetLibNickname() != m_symbol->GetLibId().GetLibNickname() )
|
||||
{
|
||||
m_original->SetLibId( LIB_ID( m_part->GetLibId().GetLibNickname(),
|
||||
m_original->SetLibId( LIB_ID( m_symbol->GetLibId().GetLibNickname(),
|
||||
m_original->GetLibId().GetLibItemName() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::PART_BUFFER::IsModified() const
|
||||
bool SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::IsModified() const
|
||||
{
|
||||
return m_screen && m_screen->IsContentModified();
|
||||
}
|
||||
|
||||
|
||||
LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetPart( const wxString& aAlias ) const
|
||||
LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetSymbol( const wxString& aAlias ) const
|
||||
{
|
||||
auto buf = GetBuffer( aAlias );
|
||||
|
||||
if( !buf )
|
||||
return nullptr;
|
||||
|
||||
LIB_SYMBOL* symbol = buf->GetPart();
|
||||
LIB_SYMBOL* symbol = buf->GetSymbol();
|
||||
|
||||
wxCHECK( symbol, nullptr );
|
||||
|
||||
|
@ -897,8 +897,8 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::CreateBuffer( LIB_SYMBOL* aCopy, SCH_SC
|
|||
wxASSERT( aCopy );
|
||||
wxASSERT( aCopy->GetLib() == nullptr );
|
||||
std::unique_ptr<SCH_SCREEN> screen( aScreen );
|
||||
auto symbolBuf = std::make_shared<PART_BUFFER>( aCopy, std::move( screen ) );
|
||||
m_parts.push_back( symbolBuf );
|
||||
auto symbolBuf = std::make_shared<SYMBOL_BUFFER>( aCopy, std::move( screen ) );
|
||||
m_symbols.push_back( symbolBuf );
|
||||
|
||||
// Set the parent library name,
|
||||
// otherwise it is empty as no library has been given as the owner during object construction
|
||||
|
@ -912,15 +912,15 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::CreateBuffer( LIB_SYMBOL* aCopy, SCH_SC
|
|||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::UpdateBuffer(
|
||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aSymbolBuf, LIB_SYMBOL* aCopy )
|
||||
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::PTR aSymbolBuf, LIB_SYMBOL* aCopy )
|
||||
{
|
||||
wxCHECK( aCopy && aSymbolBuf, false );
|
||||
|
||||
LIB_SYMBOL* bufferedPart = aSymbolBuf->GetPart();
|
||||
LIB_SYMBOL* bufferedSymbol = aSymbolBuf->GetSymbol();
|
||||
|
||||
wxCHECK( bufferedPart, false );
|
||||
wxCHECK( bufferedSymbol, false );
|
||||
|
||||
*bufferedPart = *aCopy;
|
||||
*bufferedSymbol = *aCopy;
|
||||
++m_hash;
|
||||
|
||||
return true;
|
||||
|
@ -928,22 +928,22 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::UpdateBuffer(
|
|||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::DeleteBuffer(
|
||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aSymbolBuf )
|
||||
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::PTR aSymbolBuf )
|
||||
{
|
||||
auto partBufIt = std::find( m_parts.begin(), m_parts.end(), aSymbolBuf );
|
||||
wxCHECK( partBufIt != m_parts.end(), false );
|
||||
auto symbolBufIt = std::find( m_symbols.begin(), m_symbols.end(), aSymbolBuf );
|
||||
wxCHECK( symbolBufIt != m_symbols.end(), false );
|
||||
|
||||
bool retv = true;
|
||||
|
||||
// Remove all derived symbols to prevent broken inheritance.
|
||||
if( aSymbolBuf->GetPart()->IsRoot() && HasDerivedSymbols( aSymbolBuf->GetPart()->GetName() )
|
||||
if( aSymbolBuf->GetSymbol()->IsRoot() && HasDerivedSymbols( aSymbolBuf->GetSymbol()->GetName() )
|
||||
&& removeChildSymbols( aSymbolBuf ) == 0 )
|
||||
{
|
||||
retv = false;
|
||||
}
|
||||
|
||||
m_deleted.emplace_back( *partBufIt );
|
||||
m_parts.erase( partBufIt );
|
||||
m_deleted.emplace_back( *symbolBufIt );
|
||||
m_symbols.erase( symbolBufIt );
|
||||
++m_hash;
|
||||
|
||||
return retv;
|
||||
|
@ -951,27 +951,27 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::DeleteBuffer(
|
|||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aSymbolBuf, SYMBOL_LIB_TABLE* aLibTable )
|
||||
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::PTR aSymbolBuf, SYMBOL_LIB_TABLE* aLibTable )
|
||||
{
|
||||
wxCHECK( aSymbolBuf, false );
|
||||
LIB_SYMBOL* part = aSymbolBuf->GetPart();
|
||||
LIB_SYMBOL* originalPart = aSymbolBuf->GetOriginal();
|
||||
wxCHECK( part && originalPart, false );
|
||||
LIB_SYMBOL* libSymbol = aSymbolBuf->GetSymbol();
|
||||
LIB_SYMBOL* originalSymbol = aSymbolBuf->GetOriginal();
|
||||
wxCHECK( libSymbol && originalSymbol, false );
|
||||
SYMBOL_LIB_TABLE::SAVE_T result;
|
||||
PROPERTIES properties;
|
||||
properties.emplace( SCH_LEGACY_PLUGIN::PropBuffering, "" );
|
||||
|
||||
// Delete the original symbol if the symbol name has been changed.
|
||||
if( part->GetName() != originalPart->GetName() )
|
||||
if( libSymbol->GetName() != originalSymbol->GetName() )
|
||||
{
|
||||
if( aLibTable->LoadSymbol( m_libName, originalPart->GetName() ) )
|
||||
aLibTable->DeleteSymbol( m_libName, originalPart->GetName() );
|
||||
if( aLibTable->LoadSymbol( m_libName, originalSymbol->GetName() ) )
|
||||
aLibTable->DeleteSymbol( m_libName, originalSymbol->GetName() );
|
||||
}
|
||||
|
||||
if( part->IsAlias() )
|
||||
if( libSymbol->IsAlias() )
|
||||
{
|
||||
LIB_SYMBOL* newCachedPart = new LIB_SYMBOL( *part );
|
||||
std::shared_ptr< LIB_SYMBOL > bufferedParent = part->GetParent().lock();
|
||||
LIB_SYMBOL* newCachedSymbol = new LIB_SYMBOL( *libSymbol );
|
||||
std::shared_ptr< LIB_SYMBOL > bufferedParent = libSymbol->GetParent().lock();
|
||||
|
||||
wxCHECK( bufferedParent, false );
|
||||
|
||||
|
@ -980,52 +980,52 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
|||
if( !cachedParent )
|
||||
{
|
||||
cachedParent = new LIB_SYMBOL( *bufferedParent.get() );
|
||||
newCachedPart->SetParent( cachedParent );
|
||||
newCachedSymbol->SetParent( cachedParent );
|
||||
result = aLibTable->SaveSymbol( m_libName, cachedParent );
|
||||
wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false );
|
||||
result = aLibTable->SaveSymbol( m_libName, newCachedPart );
|
||||
result = aLibTable->SaveSymbol( m_libName, newCachedSymbol );
|
||||
wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false );
|
||||
|
||||
LIB_SYMBOL* originalParent = new LIB_SYMBOL( *bufferedParent.get() );
|
||||
aSymbolBuf->SetOriginal( originalParent );
|
||||
originalPart = new LIB_SYMBOL( *part );
|
||||
originalPart->SetParent( originalParent );
|
||||
aSymbolBuf->SetOriginal( originalPart );
|
||||
originalSymbol = new LIB_SYMBOL( *libSymbol );
|
||||
originalSymbol->SetParent( originalParent );
|
||||
aSymbolBuf->SetOriginal( originalSymbol );
|
||||
}
|
||||
else
|
||||
{
|
||||
newCachedPart->SetParent( cachedParent );
|
||||
result = aLibTable->SaveSymbol( m_libName, newCachedPart );
|
||||
newCachedSymbol->SetParent( cachedParent );
|
||||
result = aLibTable->SaveSymbol( m_libName, newCachedSymbol );
|
||||
wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false );
|
||||
|
||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR originalBufferedParent =
|
||||
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::PTR originalBufferedParent =
|
||||
GetBuffer( bufferedParent->GetName() );
|
||||
wxCHECK( originalBufferedParent, false );
|
||||
originalPart = new LIB_SYMBOL( *part );
|
||||
originalPart->SetParent( originalBufferedParent->GetPart() );
|
||||
aSymbolBuf->SetOriginal( originalPart );
|
||||
originalSymbol = new LIB_SYMBOL( *libSymbol );
|
||||
originalSymbol->SetParent( originalBufferedParent->GetSymbol() );
|
||||
aSymbolBuf->SetOriginal( originalSymbol );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxArrayString derivedSymbols;
|
||||
|
||||
if( GetDerivedSymbolNames( part->GetName(), derivedSymbols ) == 0 )
|
||||
if( GetDerivedSymbolNames( libSymbol->GetName(), derivedSymbols ) == 0 )
|
||||
{
|
||||
result = aLibTable->SaveSymbol( m_libName, new LIB_SYMBOL( *part ) );
|
||||
result = aLibTable->SaveSymbol( m_libName, new LIB_SYMBOL( *libSymbol ) );
|
||||
wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false );
|
||||
aSymbolBuf->SetOriginal( new LIB_SYMBOL( *part ) );
|
||||
aSymbolBuf->SetOriginal( new LIB_SYMBOL( *libSymbol ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
LIB_SYMBOL* parentSymbol = new LIB_SYMBOL( *part );
|
||||
LIB_SYMBOL* parentSymbol = new LIB_SYMBOL( *libSymbol );
|
||||
|
||||
aLibTable->SaveSymbol( m_libName, parentSymbol );
|
||||
|
||||
for( auto entry : derivedSymbols )
|
||||
{
|
||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR symbol = GetBuffer( entry );
|
||||
LIB_SYMBOL* derivedSymbol = new LIB_SYMBOL( *symbol->GetPart() );
|
||||
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::PTR symbol = GetBuffer( entry );
|
||||
LIB_SYMBOL* derivedSymbol = new LIB_SYMBOL( *symbol->GetSymbol() );
|
||||
derivedSymbol->SetParent( parentSymbol );
|
||||
result = aLibTable->SaveSymbol( m_libName, derivedSymbol );
|
||||
wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false );
|
||||
|
@ -1039,13 +1039,13 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
|||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aSymbolBuf, const wxString& aFileName,
|
||||
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::PTR aSymbolBuf, const wxString& aFileName,
|
||||
SCH_PLUGIN* aPlugin, bool aBuffer )
|
||||
{
|
||||
wxCHECK( aSymbolBuf, false );
|
||||
LIB_SYMBOL* part = aSymbolBuf->GetPart();
|
||||
LIB_SYMBOL* originalPart = aSymbolBuf->GetOriginal();
|
||||
wxCHECK( part && originalPart, false );
|
||||
LIB_SYMBOL* libSymbol = aSymbolBuf->GetSymbol();
|
||||
LIB_SYMBOL* originalSymbol = aSymbolBuf->GetOriginal();
|
||||
wxCHECK( libSymbol && originalSymbol, false );
|
||||
wxCHECK( !aFileName.IsEmpty(), false );
|
||||
|
||||
wxString errorMsg = _( "An error \"%s\" occurred saving symbol \"%s\" to library \"%s\"" );
|
||||
|
@ -1055,16 +1055,16 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
|||
properties.emplace( SCH_LEGACY_PLUGIN::PropBuffering, "" );
|
||||
|
||||
// Delete the original symbol if the symbol name has been changed.
|
||||
if( part->GetName() != originalPart->GetName() )
|
||||
if( libSymbol->GetName() != originalSymbol->GetName() )
|
||||
{
|
||||
if( aPlugin->LoadSymbol( aFileName, originalPart->GetName() ) )
|
||||
aPlugin->DeleteSymbol( aFileName, originalPart->GetName(), &properties );
|
||||
if( aPlugin->LoadSymbol( aFileName, originalSymbol->GetName() ) )
|
||||
aPlugin->DeleteSymbol( aFileName, originalSymbol->GetName(), &properties );
|
||||
}
|
||||
|
||||
if( part->IsAlias() )
|
||||
if( libSymbol->IsAlias() )
|
||||
{
|
||||
LIB_SYMBOL* newCachedPart = new LIB_SYMBOL( *part );
|
||||
std::shared_ptr< LIB_SYMBOL > bufferedParent = part->GetParent().lock();
|
||||
LIB_SYMBOL* newCachedSymbol = new LIB_SYMBOL( *libSymbol );
|
||||
std::shared_ptr< LIB_SYMBOL > bufferedParent = libSymbol->GetParent().lock();
|
||||
|
||||
wxCHECK( bufferedParent, false );
|
||||
|
||||
|
@ -1082,7 +1082,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
|||
if( !cachedParent )
|
||||
{
|
||||
cachedParent = new LIB_SYMBOL( *bufferedParent.get() );
|
||||
newCachedPart->SetParent( cachedParent );
|
||||
newCachedSymbol->SetParent( cachedParent );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1096,64 +1096,64 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
|||
|
||||
try
|
||||
{
|
||||
aPlugin->SaveSymbol( aFileName, newCachedPart, aBuffer ? &properties : nullptr );
|
||||
aPlugin->SaveSymbol( aFileName, newCachedSymbol, aBuffer ? &properties : nullptr );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxLogError( errorMsg, ioe.What(), newCachedPart->GetName() );
|
||||
wxLogError( errorMsg, ioe.What(), newCachedSymbol->GetName() );
|
||||
return false;
|
||||
}
|
||||
|
||||
LIB_SYMBOL* originalParent = new LIB_SYMBOL( *bufferedParent.get() );
|
||||
aSymbolBuf->SetOriginal( originalParent );
|
||||
originalPart = new LIB_SYMBOL( *part );
|
||||
originalPart->SetParent( originalParent );
|
||||
aSymbolBuf->SetOriginal( originalPart );
|
||||
originalSymbol = new LIB_SYMBOL( *libSymbol );
|
||||
originalSymbol->SetParent( originalParent );
|
||||
aSymbolBuf->SetOriginal( originalSymbol );
|
||||
}
|
||||
else
|
||||
{
|
||||
newCachedPart->SetParent( cachedParent );
|
||||
newCachedSymbol->SetParent( cachedParent );
|
||||
|
||||
try
|
||||
{
|
||||
aPlugin->SaveSymbol( aFileName, newCachedPart, aBuffer ? &properties : nullptr );
|
||||
aPlugin->SaveSymbol( aFileName, newCachedSymbol, aBuffer ? &properties : nullptr );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxLogError( errorMsg, ioe.What(), newCachedPart->GetName() );
|
||||
wxLogError( errorMsg, ioe.What(), newCachedSymbol->GetName() );
|
||||
return false;
|
||||
}
|
||||
|
||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR originalBufferedParent =
|
||||
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::PTR originalBufferedParent =
|
||||
GetBuffer( bufferedParent->GetName() );
|
||||
wxCHECK( originalBufferedParent, false );
|
||||
originalPart = new LIB_SYMBOL( *part );
|
||||
originalPart->SetParent( originalBufferedParent->GetPart() );
|
||||
aSymbolBuf->SetOriginal( originalPart );
|
||||
originalSymbol = new LIB_SYMBOL( *libSymbol );
|
||||
originalSymbol->SetParent( originalBufferedParent->GetSymbol() );
|
||||
aSymbolBuf->SetOriginal( originalSymbol );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxArrayString derivedSymbols;
|
||||
|
||||
if( GetDerivedSymbolNames( part->GetName(), derivedSymbols ) == 0 )
|
||||
if( GetDerivedSymbolNames( libSymbol->GetName(), derivedSymbols ) == 0 )
|
||||
{
|
||||
try
|
||||
{
|
||||
aPlugin->SaveSymbol( aFileName, new LIB_SYMBOL( *part ),
|
||||
aPlugin->SaveSymbol( aFileName, new LIB_SYMBOL( *libSymbol ),
|
||||
aBuffer ? &properties : nullptr );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxLogError( errorMsg, ioe.What(), part->GetName() );
|
||||
wxLogError( errorMsg, ioe.What(), libSymbol->GetName() );
|
||||
return false;
|
||||
}
|
||||
|
||||
aSymbolBuf->SetOriginal( new LIB_SYMBOL( *part ) );
|
||||
aSymbolBuf->SetOriginal( new LIB_SYMBOL( *libSymbol ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
LIB_SYMBOL* parentSymbol = new LIB_SYMBOL( *part );
|
||||
LIB_SYMBOL* parentSymbol = new LIB_SYMBOL( *libSymbol );
|
||||
|
||||
// Save the modified root symbol.
|
||||
try
|
||||
|
@ -1162,17 +1162,17 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
|||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxLogError( errorMsg, ioe.What(), part->GetName() );
|
||||
wxLogError( errorMsg, ioe.What(), libSymbol->GetName() );
|
||||
return false;
|
||||
}
|
||||
|
||||
aSymbolBuf->SetOriginal( new LIB_SYMBOL( *part ) );
|
||||
aSymbolBuf->SetOriginal( new LIB_SYMBOL( *libSymbol ) );
|
||||
|
||||
// Save the derived symbols.
|
||||
for( auto entry : derivedSymbols )
|
||||
{
|
||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR symbol = GetBuffer( entry );
|
||||
LIB_SYMBOL* derivedSymbol = new LIB_SYMBOL( *symbol->GetPart() );
|
||||
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::PTR symbol = GetBuffer( entry );
|
||||
LIB_SYMBOL* derivedSymbol = new LIB_SYMBOL( *symbol->GetSymbol() );
|
||||
derivedSymbol->SetParent( parentSymbol );
|
||||
|
||||
try
|
||||
|
@ -1194,28 +1194,28 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer(
|
|||
}
|
||||
|
||||
|
||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR
|
||||
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::PTR
|
||||
SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetBuffer( const wxString& aAlias ) const
|
||||
{
|
||||
for( auto entry : m_parts )
|
||||
for( auto entry : m_symbols )
|
||||
{
|
||||
if( entry->GetPart()->GetName() == aAlias )
|
||||
if( entry->GetSymbol()->GetName() == aAlias )
|
||||
return entry;
|
||||
}
|
||||
|
||||
return PART_BUFFER::PTR( nullptr );
|
||||
return SYMBOL_BUFFER::PTR( nullptr );
|
||||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::HasDerivedSymbols( const wxString& aParentName ) const
|
||||
{
|
||||
for( auto entry : m_parts )
|
||||
for( auto entry : m_symbols )
|
||||
{
|
||||
if( entry->GetPart()->IsAlias() )
|
||||
if( entry->GetSymbol()->IsAlias() )
|
||||
{
|
||||
PART_SPTR parent = entry->GetPart()->GetParent().lock();
|
||||
LIB_SYMBOL_SPTR parent = entry->GetSymbol()->GetParent().lock();
|
||||
|
||||
// Check for inherited part without a valid parent.
|
||||
// Check for inherited symbol without a valid parent.
|
||||
wxCHECK( parent, false );
|
||||
|
||||
if( parent->GetName() == aParentName )
|
||||
|
@ -1229,12 +1229,12 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::HasDerivedSymbols( const wxString& aPar
|
|||
|
||||
void SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetRootSymbolNames( wxArrayString& aRootSymbolNames )
|
||||
{
|
||||
for( auto entry : m_parts )
|
||||
for( auto entry : m_symbols )
|
||||
{
|
||||
if( entry->GetPart()->IsAlias() )
|
||||
if( entry->GetSymbol()->IsAlias() )
|
||||
continue;
|
||||
|
||||
aRootSymbolNames.Add( entry->GetPart()->GetName() );
|
||||
aRootSymbolNames.Add( entry->GetSymbol()->GetName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1244,17 +1244,17 @@ size_t SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetDerivedSymbolNames( const wxString
|
|||
{
|
||||
wxCHECK( !aSymbolName.IsEmpty(), 0 );
|
||||
|
||||
for( auto entry : m_parts )
|
||||
for( auto entry : m_symbols )
|
||||
{
|
||||
if( entry->GetPart()->IsAlias() )
|
||||
if( entry->GetSymbol()->IsAlias() )
|
||||
{
|
||||
PART_SPTR parent = entry->GetPart()->GetParent().lock();
|
||||
LIB_SYMBOL_SPTR parent = entry->GetSymbol()->GetParent().lock();
|
||||
|
||||
// Check for inherited part without a valid parent.
|
||||
// Check for inherited symbol without a valid parent.
|
||||
wxCHECK( parent, false );
|
||||
|
||||
if( parent->GetName() == aSymbolName )
|
||||
aList.Add( entry->GetPart()->GetName() );
|
||||
aList.Add( entry->GetSymbol()->GetName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1263,32 +1263,32 @@ size_t SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetDerivedSymbolNames( const wxString
|
|||
|
||||
|
||||
int SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::removeChildSymbols(
|
||||
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aSymbolBuf )
|
||||
SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::PTR aSymbolBuf )
|
||||
{
|
||||
wxCHECK( aSymbolBuf && aSymbolBuf->GetPart()->IsRoot(), 0 );
|
||||
wxCHECK( aSymbolBuf && aSymbolBuf->GetSymbol()->IsRoot(), 0 );
|
||||
|
||||
int cnt = 0;
|
||||
std::deque< SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR >::iterator it = m_parts.begin();
|
||||
std::deque< SYMBOL_LIBRARY_MANAGER::SYMBOL_BUFFER::PTR >::iterator it = m_symbols.begin();
|
||||
|
||||
while( it != m_parts.end() )
|
||||
while( it != m_symbols.end() )
|
||||
{
|
||||
|
||||
if( (*it)->GetPart()->IsRoot() )
|
||||
if( (*it)->GetSymbol()->IsRoot() )
|
||||
{
|
||||
++it;
|
||||
}
|
||||
else
|
||||
{
|
||||
PART_SPTR parent = (*it)->GetPart()->GetParent().lock();
|
||||
LIB_SYMBOL_SPTR parent = (*it)->GetSymbol()->GetParent().lock();
|
||||
|
||||
wxCHECK2( parent, ++it; continue );
|
||||
|
||||
if( parent->GetName() == aSymbolBuf->GetPart()->GetName() )
|
||||
if( parent->GetName() == aSymbolBuf->GetSymbol()->GetName() )
|
||||
{
|
||||
wxCHECK2( parent == aSymbolBuf->GetPart()->SharedPtr(), ++it; continue );
|
||||
wxCHECK2( parent == aSymbolBuf->GetSymbol()->SharedPtr(), ++it; continue );
|
||||
|
||||
m_deleted.emplace_back( *it );
|
||||
it = m_parts.erase( it );
|
||||
it = m_symbols.erase( it );
|
||||
cnt++;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
* This program source code file is symbol of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 CERN
|
||||
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A SYMBOLICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
@ -38,7 +38,7 @@
|
|||
#include <sch_screen.h>
|
||||
|
||||
class LIB_SYMBOL;
|
||||
class PART_LIB;
|
||||
class SYMBOL_LIB;
|
||||
class PROGRESS_REPORTER;
|
||||
class SCH_PLUGIN;
|
||||
class SYMBOL_EDIT_FRAME;
|
||||
|
@ -111,48 +111,48 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Update the part buffer with a new version 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.
|
||||
* Update the symbol buffer with a new version of the symbol.
|
||||
* The library buffer creates a copy of the symbol.
|
||||
* It is required to save the library to use the updated symbol in the schematic editor.
|
||||
*/
|
||||
bool UpdatePart( LIB_SYMBOL* aSymbol, const wxString& aLibrary );
|
||||
bool UpdateSymbol( LIB_SYMBOL* aSymbol, const wxString& aLibrary );
|
||||
|
||||
/**
|
||||
* Update the part buffer with a new version of the part when the name has changed.
|
||||
* Update the symbol buffer with a new version of the symbol when the name has changed.
|
||||
* The old library buffer will be deleted and a new one created with the new name.
|
||||
*/
|
||||
bool UpdatePartAfterRename( LIB_SYMBOL* aSymbol, const wxString& oldAlias,
|
||||
bool UpdateSymbolAfterRename( LIB_SYMBOL* aSymbol, const wxString& oldAlias,
|
||||
const wxString& aLibrary );
|
||||
|
||||
/**
|
||||
* Remove the part from the part buffer.
|
||||
* It is required to save the library to have the part removed in the schematic editor.
|
||||
* Remove the symbol from the symbol buffer.
|
||||
* It is required to save the library to have the symbol removed in the schematic editor.
|
||||
*/
|
||||
bool RemovePart( const wxString& aName, const wxString& aLibrary );
|
||||
bool RemoveSymbol( const wxString& aName, const wxString& aLibrary );
|
||||
|
||||
/**
|
||||
* Return either an alias of a working LIB_SYMBOL copy, or alias of the original part if there
|
||||
* Return either an alias of a working LIB_SYMBOL copy, or alias of the original symbol if there
|
||||
* is no working copy.
|
||||
*/
|
||||
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 symbol copy from the buffer. In case it does not exist yet, the copy is created.
|
||||
* #SYMBOL_LIBRARY_MANAGER retains the ownership.
|
||||
*/
|
||||
LIB_SYMBOL* GetBufferedPart( const wxString& aAlias, const wxString& aLibrary );
|
||||
LIB_SYMBOL* GetBufferedSymbol( 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 symbol. #SYMBOL_LIBRARY_MANAGER retains the
|
||||
* ownership.
|
||||
*/
|
||||
SCH_SCREEN* GetScreen( const wxString& aAlias, const wxString& aLibrary );
|
||||
|
||||
/**
|
||||
* Return true if part with a specific alias exists in library (either original one or
|
||||
* Return true if symbol with a specific alias exists in library (either original one or
|
||||
* buffered).
|
||||
*/
|
||||
bool PartExists( const wxString& aAlias, const wxString& aLibrary ) const;
|
||||
bool SymbolExists( const wxString& aAlias, const wxString& aLibrary ) const;
|
||||
|
||||
/**
|
||||
* Return true if library exists. If \a aCheckEnabled is set, then the library must
|
||||
|
@ -171,19 +171,19 @@ public:
|
|||
bool IsLibraryModified( const wxString& aLibrary ) const;
|
||||
|
||||
/**
|
||||
* Return true if part has unsaved modifications.
|
||||
* Return true if symbol has unsaved modifications.
|
||||
*/
|
||||
bool IsPartModified( const wxString& aAlias, const wxString& aLibrary ) const;
|
||||
bool IsSymbolModified( const wxString& aAlias, const wxString& aLibrary ) const;
|
||||
|
||||
/**
|
||||
* Clear the modified flag for all parts in a library.
|
||||
* Clear the modified flag for all symbols in a library.
|
||||
*/
|
||||
bool ClearLibraryModified( const wxString& aLibrary ) const;
|
||||
|
||||
/**
|
||||
* Clear the modified flag for a part.
|
||||
* Clear the modified flag for a symbol.
|
||||
*/
|
||||
bool ClearPartModified( const wxString& aAlias, const wxString& aLibrary ) const;
|
||||
bool ClearSymbolModified( const wxString& aAlias, const wxString& aLibrary ) const;
|
||||
|
||||
/**
|
||||
* Return true if the library is stored in a read-only file.
|
||||
|
@ -193,12 +193,12 @@ public:
|
|||
bool IsLibraryReadOnly( const wxString& aLibrary ) const;
|
||||
|
||||
/**
|
||||
* Save part changes to the library copy used by the schematic editor. Not it is not
|
||||
* Save symbol changes to the library copy used by the schematic editor. Not it is not
|
||||
* necessarily saved to the file.
|
||||
*
|
||||
* @return True on success, false otherwise.
|
||||
*/
|
||||
bool FlushPart( const wxString& aAlias, const wxString& aLibrary );
|
||||
bool FlushSymbol( const wxString& aAlias, const wxString& aLibrary );
|
||||
|
||||
/**
|
||||
* Save library to a file, including unsaved changes.
|
||||
|
@ -211,15 +211,15 @@ public:
|
|||
SCH_IO_MGR::SCH_FILE_T aFileType = SCH_IO_MGR::SCH_FILE_T::SCH_LEGACY );
|
||||
|
||||
/**
|
||||
* Revert unsaved changes for a particular part.
|
||||
* Revert unsaved changes for a symbolicular symbol.
|
||||
*
|
||||
* @return The LIB_ID of the reverted part (which may be different in the case
|
||||
* @return The LIB_ID of the reverted symbol (which may be different in the case
|
||||
* of a rename)
|
||||
*/
|
||||
LIB_ID RevertPart( const wxString& aAlias, const wxString& aLibrary );
|
||||
LIB_ID RevertSymbol( const wxString& aAlias, const wxString& aLibrary );
|
||||
|
||||
/**
|
||||
* Revert unsaved changes for a particular library.
|
||||
* Revert unsaved changes for a symbolicular library.
|
||||
*
|
||||
* @return True on success, false otherwise.
|
||||
*/
|
||||
|
@ -271,14 +271,15 @@ private:
|
|||
}
|
||||
|
||||
///< Class to store a working copy of a LIB_SYMBOL object and editor context.
|
||||
class PART_BUFFER
|
||||
class SYMBOL_BUFFER
|
||||
{
|
||||
public:
|
||||
PART_BUFFER( LIB_SYMBOL* aSymbol = nullptr, std::unique_ptr<SCH_SCREEN> aScreen = nullptr );
|
||||
~PART_BUFFER();
|
||||
SYMBOL_BUFFER( LIB_SYMBOL* aSymbol = nullptr,
|
||||
std::unique_ptr<SCH_SCREEN> aScreen = nullptr );
|
||||
~SYMBOL_BUFFER();
|
||||
|
||||
LIB_SYMBOL* GetPart() const { return m_part; }
|
||||
void SetPart( LIB_SYMBOL* aSymbol );
|
||||
LIB_SYMBOL* GetSymbol() const { return m_symbol; }
|
||||
void SetSymbol( LIB_SYMBOL* aSymbol );
|
||||
|
||||
LIB_SYMBOL* GetOriginal() const { return m_original; }
|
||||
void SetOriginal( LIB_SYMBOL* aSymbol );
|
||||
|
@ -299,14 +300,14 @@ private:
|
|||
return ret;
|
||||
}
|
||||
|
||||
typedef std::shared_ptr<PART_BUFFER> PTR;
|
||||
typedef std::weak_ptr<PART_BUFFER> WEAK_PTR;
|
||||
typedef std::shared_ptr<SYMBOL_BUFFER> PTR;
|
||||
typedef std::weak_ptr<SYMBOL_BUFFER> WEAK_PTR;
|
||||
|
||||
private:
|
||||
std::unique_ptr<SCH_SCREEN> m_screen;
|
||||
|
||||
LIB_SYMBOL* m_part; // Working copy
|
||||
LIB_SYMBOL* m_original; // Initial state of the part
|
||||
LIB_SYMBOL* m_symbol; // Working copy
|
||||
LIB_SYMBOL* m_original; // Initial state of the symbol
|
||||
};
|
||||
|
||||
|
||||
|
@ -324,9 +325,9 @@ private:
|
|||
if( !m_deleted.empty() )
|
||||
return true;
|
||||
|
||||
for( const auto& partBuf : m_parts )
|
||||
for( const auto& symbolBuf : m_symbols )
|
||||
{
|
||||
if( partBuf->IsModified() )
|
||||
if( symbolBuf->IsModified() )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -336,15 +337,15 @@ private:
|
|||
int GetHash() const { return m_hash; }
|
||||
|
||||
///< Return the working copy of a LIB_SYMBOL root object with specified alias.
|
||||
LIB_SYMBOL* GetPart( const wxString& aAlias ) const;
|
||||
LIB_SYMBOL* GetSymbol( 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 symbol. LIB_BUFFER takes ownership of aCopy.
|
||||
bool CreateBuffer( LIB_SYMBOL* aCopy, SCH_SCREEN* aScreen );
|
||||
|
||||
///< Update the buffered part with the contents of \a aCopy.
|
||||
bool UpdateBuffer( PART_BUFFER::PTR aSymbolBuf, LIB_SYMBOL* aCopy );
|
||||
///< Update the buffered symbol with the contents of \a aCopy.
|
||||
bool UpdateBuffer( SYMBOL_BUFFER::PTR aSymbolBuf, LIB_SYMBOL* aCopy );
|
||||
|
||||
bool DeleteBuffer( PART_BUFFER::PTR aSymbolBuf );
|
||||
bool DeleteBuffer( SYMBOL_BUFFER::PTR aSymbolBuf );
|
||||
|
||||
void ClearDeletedBuffer()
|
||||
{
|
||||
|
@ -353,21 +354,21 @@ private:
|
|||
|
||||
///< Save stored modifications to Symbol Lib Table. It may result in saving the symbol
|
||||
///< to disk as well, depending on the row properties.
|
||||
bool SaveBuffer( PART_BUFFER::PTR aSymbolBuf, SYMBOL_LIB_TABLE* aLibTable );
|
||||
bool SaveBuffer( SYMBOL_BUFFER::PTR aSymbolBuf, SYMBOL_LIB_TABLE* aLibTable );
|
||||
|
||||
///< Save stored modifications using a plugin. aBuffer decides whether the changes
|
||||
///< should be cached or stored directly to the disk (for SCH_LEGACY_PLUGIN).
|
||||
bool SaveBuffer( PART_BUFFER::PTR aSymbolBuf, const wxString& aFileName,
|
||||
bool SaveBuffer( SYMBOL_BUFFER::PTR aSymbolBuf, const wxString& aFileName,
|
||||
SCH_PLUGIN* aPlugin, bool aBuffer );
|
||||
|
||||
///< Return a part buffer with LIB_SYMBOL holding a particular alias
|
||||
PART_BUFFER::PTR GetBuffer( const wxString& aAlias ) const;
|
||||
///< Return a symbol buffer with LIB_SYMBOL holding a symbolicular alias
|
||||
SYMBOL_BUFFER::PTR GetBuffer( const wxString& aAlias ) const;
|
||||
|
||||
///< Return all buffered parts
|
||||
const std::deque<PART_BUFFER::PTR>& GetBuffers() const { return m_parts; }
|
||||
///< Return all buffered symbols
|
||||
const std::deque<SYMBOL_BUFFER::PTR>& GetBuffers() const { return m_symbols; }
|
||||
|
||||
/**
|
||||
* Check to see any parts in the buffer are derived from a parent named \a aParentName.
|
||||
* Check to see any symbols in the buffer are derived from a parent named \a aParentName.
|
||||
*
|
||||
* @param aParentName is the name of the parent to test.
|
||||
* @return true if any symbols are found derived from a symbol named \a aParent, otherwise
|
||||
|
@ -385,7 +386,7 @@ private:
|
|||
/**
|
||||
* Fetch all of the symbols derived from a \a aSymbolName into \a aList.
|
||||
*
|
||||
* @param aSymbolName is the name of the symbol to search for derived parts in this
|
||||
* @param aSymbolName is the name of the symbol to search for derived symbols in this
|
||||
* buffer.
|
||||
* @param aList is the list of symbols names derived from \a aSymbolName.
|
||||
* @return a size_t count of the number of symbols derived from \a aSymbolName.
|
||||
|
@ -396,13 +397,15 @@ private:
|
|||
/**
|
||||
* Remove all symbols derived from \a aParent from the library buffer.
|
||||
*
|
||||
* @param aParent is the #PART_BUFFER to check against.
|
||||
* @return the count of #PART_BUFFER objects removed from the library.
|
||||
* @param aParent is the #SYMBOL_BUFFER to check against.
|
||||
* @return the count of #SYMBOL_BUFFER objects removed from the library.
|
||||
*/
|
||||
int removeChildSymbols( PART_BUFFER::PTR aSymbolBuf );
|
||||
int removeChildSymbols( SYMBOL_BUFFER::PTR aSymbolBuf );
|
||||
|
||||
std::deque<PART_BUFFER::PTR> m_parts;
|
||||
std::deque<PART_BUFFER::PTR> m_deleted; // Buffer for deleted parts until library is saved
|
||||
std::deque<SYMBOL_BUFFER::PTR> m_symbols;
|
||||
|
||||
///< Buffer for deleted symbols until library is saved.
|
||||
std::deque<SYMBOL_BUFFER::PTR> m_deleted;
|
||||
const wxString m_libName; // Buffered library name
|
||||
int m_hash;
|
||||
};
|
||||
|
@ -410,7 +413,7 @@ private:
|
|||
/**
|
||||
* Return a set of #LIB_SYMBOL objects belonging to the original library.
|
||||
*/
|
||||
std::set<LIB_SYMBOL*> getOriginalParts( const wxString& aLibrary );
|
||||
std::set<LIB_SYMBOL*> getOriginalSymbols( const wxString& aLibrary );
|
||||
|
||||
/**
|
||||
* Return an existing library buffer or creates one to using Symbol Library Table to get
|
||||
|
|
|
@ -124,7 +124,7 @@ void SYMBOL_EDIT_FRAME::ReCreateHToolbar()
|
|||
m_mainToolBar->AddScaledSeparator( this );
|
||||
|
||||
if( m_unitSelectBox == nullptr )
|
||||
m_unitSelectBox = new wxComboBox( m_mainToolBar, ID_LIBEDIT_SELECT_PART_NUMBER,
|
||||
m_unitSelectBox = new wxComboBox( m_mainToolBar, ID_LIBEDIT_SELECT_UNIT_NUMBER,
|
||||
wxEmptyString, wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ), 0,
|
||||
nullptr, wxCB_READONLY );
|
||||
m_mainToolBar->AddControl( m_unitSelectBox );
|
||||
|
|
|
@ -213,8 +213,8 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataVie
|
|||
switch( aCol )
|
||||
{
|
||||
case 0:
|
||||
if( m_frame->GetCurPart() && m_frame->GetCurPart()->GetLibId() == node->m_LibId )
|
||||
node->m_Name = m_frame->GetCurPart()->GetLibId().GetLibItemName();
|
||||
if( m_frame->GetCurSymbol() && m_frame->GetCurSymbol()->GetLibId() == node->m_LibId )
|
||||
node->m_Name = m_frame->GetCurSymbol()->GetLibId().GetLibItemName();
|
||||
|
||||
if( node->m_Pinned )
|
||||
aVariant = GetPinningSymbol() + node->m_Name;
|
||||
|
@ -229,16 +229,16 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataVie
|
|||
}
|
||||
else if( node->m_Type == LIB_TREE_NODE::LIBID )
|
||||
{
|
||||
if( m_libMgr->IsPartModified( node->m_Name, node->m_Parent->m_Name ) )
|
||||
if( m_libMgr->IsSymbolModified( node->m_Name, node->m_Parent->m_Name ) )
|
||||
aVariant = aVariant.GetString() + " *";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if( m_frame->GetCurPart() && m_frame->GetCurPart()->GetLibId() == node->m_LibId )
|
||||
if( m_frame->GetCurSymbol() && m_frame->GetCurSymbol()->GetLibId() == node->m_LibId )
|
||||
{
|
||||
node->m_Desc = m_frame->GetCurPart()->GetDescription();
|
||||
node->m_Desc = m_frame->GetCurSymbol()->GetDescription();
|
||||
}
|
||||
else if( node->m_Type == LIB_TREE_NODE::LIB )
|
||||
{
|
||||
|
@ -287,7 +287,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un
|
|||
if( aCol != 0 )
|
||||
return false;
|
||||
|
||||
LIB_SYMBOL* curSymbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* curSymbol = m_frame->GetCurSymbol();
|
||||
|
||||
switch( node->m_Type )
|
||||
{
|
||||
|
@ -311,7 +311,7 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, un
|
|||
|
||||
case LIB_TREE_NODE::LIBID:
|
||||
// mark modified part with bold font
|
||||
aAttr.SetBold( m_libMgr->IsPartModified( node->m_Name, node->m_Parent->m_Name ) );
|
||||
aAttr.SetBold( m_libMgr->IsSymbolModified( node->m_Name, node->m_Parent->m_Name ) );
|
||||
|
||||
// mark aliases with italic font
|
||||
aAttr.SetItalic( !node->m_IsRoot );
|
||||
|
|
|
@ -73,7 +73,7 @@ BEGIN_EVENT_TABLE( SYMBOL_VIEWER_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_TOOL( ID_LIBVIEW_SELECT_PART, SYMBOL_VIEWER_FRAME::OnSelectSymbol )
|
||||
EVT_TOOL( ID_LIBVIEW_NEXT, SYMBOL_VIEWER_FRAME::onSelectNextSymbol )
|
||||
EVT_TOOL( ID_LIBVIEW_PREVIOUS, SYMBOL_VIEWER_FRAME::onSelectPreviousSymbol )
|
||||
EVT_CHOICE( ID_LIBVIEW_SELECT_PART_NUMBER, SYMBOL_VIEWER_FRAME::onSelectSymbolUnit )
|
||||
EVT_CHOICE( ID_LIBVIEW_SELECT_UNIT_NUMBER, SYMBOL_VIEWER_FRAME::onSelectSymbolUnit )
|
||||
|
||||
// listbox events
|
||||
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, SYMBOL_VIEWER_FRAME::ClickOnLibList )
|
||||
|
@ -84,7 +84,7 @@ BEGIN_EVENT_TABLE( SYMBOL_VIEWER_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_MENU( wxID_CLOSE, SYMBOL_VIEWER_FRAME::CloseLibraryViewer )
|
||||
EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings )
|
||||
|
||||
EVT_UPDATE_UI( ID_LIBVIEW_SELECT_PART_NUMBER, SYMBOL_VIEWER_FRAME::onUpdateUnitChoice )
|
||||
EVT_UPDATE_UI( ID_LIBVIEW_SELECT_UNIT_NUMBER, SYMBOL_VIEWER_FRAME::onUpdateUnitChoice )
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
@ -769,7 +769,7 @@ void SYMBOL_VIEWER_FRAME::SetFilter( const SCHLIB_FILTER* aFilter )
|
|||
if( aFilter )
|
||||
{
|
||||
m_allowedLibs = aFilter->GetAllowedLibList();
|
||||
m_listPowerOnly = aFilter->GetFilterPowerParts();
|
||||
m_listPowerOnly = aFilter->GetFilterPowerSymbols();
|
||||
}
|
||||
|
||||
ReCreateLibList();
|
||||
|
|
|
@ -71,7 +71,7 @@ void SYMBOL_VIEWER_FRAME::ReCreateHToolbar()
|
|||
m_mainToolBar->AddScaledSeparator( this );
|
||||
|
||||
if( m_unitChoice == nullptr )
|
||||
m_unitChoice = new wxChoice( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
|
||||
m_unitChoice = new wxChoice( m_mainToolBar, ID_LIBVIEW_SELECT_UNIT_NUMBER,
|
||||
wxDefaultPosition, wxSize( 150, -1 ) );
|
||||
m_mainToolBar->AddControl( m_unitChoice );
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst )
|
|||
|
||||
int EE_INSPECTION_TOOL::CheckSymbol( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurPart();
|
||||
LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
|
||||
|
||||
if( !symbol )
|
||||
return 0;
|
||||
|
@ -463,7 +463,7 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
|
||||
{
|
||||
LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurPart();
|
||||
LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
|
||||
|
||||
if( !symbol )
|
||||
return 0;
|
||||
|
|
|
@ -60,7 +60,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleSymbol = []( const SELECTION& aSel )
|
|||
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aSel.Front() );
|
||||
|
||||
if( symbol )
|
||||
return !symbol->GetPartRef() || !symbol->GetPartRef()->IsPower();
|
||||
return !symbol->GetLibSymbolRef() || !symbol->GetLibSymbolRef()->IsPower();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -80,7 +80,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleDeMorganSymbol = []( const SELECTION& a
|
|||
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aSel.Front() );
|
||||
|
||||
if( symbol )
|
||||
return symbol->GetPartRef() && symbol->GetPartRef()->HasConversion();
|
||||
return symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->HasConversion();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -94,7 +94,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleMultiUnitSymbol = []( const SELECTION&
|
|||
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aSel.Front() );
|
||||
|
||||
if( symbol )
|
||||
return symbol->GetPartRef() && symbol->GetPartRef()->GetUnitCount() >= 2;
|
||||
return symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->GetUnitCount() >= 2;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -184,10 +184,11 @@ bool EE_SELECTION_TOOL::Init()
|
|||
&& editFrame->GetCurrentSheet().Last() != &editFrame->Schematic().Root();
|
||||
};
|
||||
|
||||
auto havePartCondition =
|
||||
auto haveSymbolCondition =
|
||||
[&]( const SELECTION& sel )
|
||||
{
|
||||
return m_isSymbolEditor && static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurPart();
|
||||
return m_isSymbolEditor &&
|
||||
static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
|
||||
};
|
||||
|
||||
auto& menu = m_menu.GetMenu();
|
||||
|
@ -219,8 +220,10 @@ bool EE_SELECTION_TOOL::Init()
|
|||
menu.AddItem( EE_ACTIONS::editPageNumber, schEditSheetPageNumberCondition, 250 );
|
||||
|
||||
menu.AddSeparator( 400 );
|
||||
menu.AddItem( EE_ACTIONS::symbolProperties, havePartCondition && EE_CONDITIONS::Empty, 400 );
|
||||
menu.AddItem( EE_ACTIONS::pinTable, havePartCondition && EE_CONDITIONS::Empty, 400 );
|
||||
menu.AddItem( EE_ACTIONS::symbolProperties,
|
||||
haveSymbolCondition && EE_CONDITIONS::Empty, 400 );
|
||||
menu.AddItem( EE_ACTIONS::pinTable,
|
||||
haveSymbolCondition && EE_CONDITIONS::Empty, 400 );
|
||||
|
||||
menu.AddSeparator( 1000 );
|
||||
m_frame->AddStandardSubMenus( m_menu );
|
||||
|
@ -565,7 +568,8 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
SYMBOL_EDIT_FRAME* libFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
|
||||
|
||||
// Cannot move any derived symbol elements for now.
|
||||
if( libFrame && libFrame->GetCurPart() && libFrame->GetCurPart()->IsRoot() )
|
||||
if( libFrame && libFrame->GetCurSymbol()
|
||||
&& libFrame->GetCurSymbol()->IsRoot() )
|
||||
m_toolMgr->InvokeTool( "eeschema.SymbolMoveTool" );
|
||||
}
|
||||
else
|
||||
|
@ -772,7 +776,7 @@ bool EE_SELECTION_TOOL::CollectHits( EE_COLLECTOR& aCollector, const VECTOR2I& a
|
|||
|
||||
if( m_isSymbolEditor )
|
||||
{
|
||||
LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurPart();
|
||||
LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
|
||||
|
||||
if( !symbol )
|
||||
return false;
|
||||
|
@ -1508,7 +1512,7 @@ void EE_SELECTION_TOOL::RebuildSelection()
|
|||
|
||||
if( m_isSymbolEditor )
|
||||
{
|
||||
LIB_SYMBOL* start = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurPart();
|
||||
LIB_SYMBOL* start = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
|
||||
|
||||
for( LIB_ITEM& item : start->GetDrawItems() )
|
||||
{
|
||||
|
|
|
@ -124,7 +124,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
|||
else if (aEvent.IsAction( &EE_ACTIONS::placePower ) )
|
||||
{
|
||||
historyList = &m_powerHistoryList;
|
||||
filter.FilterPowerParts( true );
|
||||
filter.FilterPowerSymbols( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1176,7 +1176,8 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
{
|
||||
item->ClearFlags( IS_MOVING );
|
||||
m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), (SCH_ITEM*) item, false );
|
||||
m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), (SCH_ITEM*) item,
|
||||
false );
|
||||
item = nullptr;
|
||||
|
||||
m_view->ClearPreview();
|
||||
|
|
|
@ -105,14 +105,14 @@ private:
|
|||
|
||||
int unit = symbol->GetUnit();
|
||||
|
||||
if( !symbol->GetPartRef() || symbol->GetPartRef()->GetUnitCount() < 2 )
|
||||
if( !symbol->GetLibSymbolRef() || symbol->GetLibSymbolRef()->GetUnitCount() < 2 )
|
||||
{
|
||||
Append( ID_POPUP_SCH_UNFOLD_BUS, _( "symbol is not multi-unit" ), wxEmptyString );
|
||||
Enable( ID_POPUP_SCH_UNFOLD_BUS, false );
|
||||
return;
|
||||
}
|
||||
|
||||
for( int ii = 0; ii < symbol->GetPartRef()->GetUnitCount(); ii++ )
|
||||
for( int ii = 0; ii < symbol->GetLibSymbolRef()->GetUnitCount(); ii++ )
|
||||
{
|
||||
wxString num_unit;
|
||||
num_unit.Printf( _( "Unit %s" ), LIB_SYMBOL::SubReference( ii + 1, false ) );
|
||||
|
|
|
@ -850,7 +850,7 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
|
|||
if( item->Type() == SCH_FIELD_T )
|
||||
symbol = dynamic_cast<SCH_SYMBOL*>( item->GetParent() );
|
||||
|
||||
if( symbol && symbol->GetPartRef() && symbol->GetPartRef()->IsPower() )
|
||||
if( symbol && symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->IsPower() )
|
||||
{
|
||||
std::vector<SCH_PIN*> pins = symbol->GetPins();
|
||||
|
||||
|
@ -1016,7 +1016,7 @@ int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent )
|
|||
if( item->Type() == SCH_SYMBOL_T )
|
||||
symbol = static_cast<SCH_SYMBOL*>( item );
|
||||
|
||||
if( symbol && symbol->GetPartRef() && symbol->GetPartRef()->IsPower() )
|
||||
if( symbol && symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->IsPower() )
|
||||
itemConn = symbol->Connection();
|
||||
else
|
||||
itemConn = item->Connection();
|
||||
|
@ -1084,7 +1084,7 @@ int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
if( symbol->GetPartRef() && symbol->GetPartRef()->IsPower() )
|
||||
if( symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->IsPower() )
|
||||
{
|
||||
std::vector<SCH_FIELD>& fields = symbol->GetFields();
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ int SYMBOL_EDITOR_CONTROL::EditSymbol( const TOOL_EVENT& aEvent )
|
|||
int unit = 0;
|
||||
LIB_ID partId = editFrame->GetTreeLIBID( &unit );
|
||||
|
||||
editFrame->LoadPart( partId.GetLibItemName(), partId.GetLibNickname(), unit );
|
||||
editFrame->LoadSymbol( partId.GetLibItemName(), partId.GetLibNickname(), unit );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -173,9 +173,9 @@ int SYMBOL_EDITOR_CONTROL::AddSymbol( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
if( aEvent.IsAction( &EE_ACTIONS::newSymbol ) )
|
||||
editFrame->CreateNewPart();
|
||||
editFrame->CreateNewSymbol();
|
||||
else if( aEvent.IsAction( &EE_ACTIONS::importSymbol ) )
|
||||
editFrame->ImportPart();
|
||||
editFrame->ImportSymbol();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -214,7 +214,7 @@ int SYMBOL_EDITOR_CONTROL::Revert( const TOOL_EVENT& aEvent )
|
|||
int SYMBOL_EDITOR_CONTROL::ExportSymbol( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
|
||||
static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->ExportPart();
|
||||
static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->ExportSymbol();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ int SYMBOL_EDITOR_CONTROL::CutCopyDelete( const TOOL_EVENT& aEvt )
|
|||
SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
|
||||
|
||||
if( aEvt.IsAction( &EE_ACTIONS::cutSymbol ) || aEvt.IsAction( &EE_ACTIONS::copySymbol ) )
|
||||
editFrame->CopyPartToClipboard();
|
||||
editFrame->CopySymbolToClipboard();
|
||||
|
||||
if( aEvt.IsAction( &EE_ACTIONS::cutSymbol ) || aEvt.IsAction( &EE_ACTIONS::deleteSymbol ) )
|
||||
{
|
||||
|
@ -242,7 +242,7 @@ int SYMBOL_EDITOR_CONTROL::CutCopyDelete( const TOOL_EVENT& aEvt )
|
|||
return 0;
|
||||
}
|
||||
|
||||
editFrame->DeletePartFromLibrary();
|
||||
editFrame->DeleteSymbolFromLibrary();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ int SYMBOL_EDITOR_CONTROL::DuplicateSymbol( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
}
|
||||
|
||||
editFrame->DuplicatePart( aEvent.IsAction( &EE_ACTIONS::pasteSymbol ) );
|
||||
editFrame->DuplicateSymbol( aEvent.IsAction( &EE_ACTIONS::pasteSymbol ) );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -379,7 +379,7 @@ int SYMBOL_EDITOR_CONTROL::ExportView( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
|
||||
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
|
||||
LIB_SYMBOL* symbol = editFrame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = editFrame->GetCurSymbol();
|
||||
|
||||
if( !symbol )
|
||||
{
|
||||
|
@ -419,7 +419,7 @@ int SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
|
||||
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
|
||||
LIB_SYMBOL* symbol = editFrame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = editFrame->GetCurSymbol();
|
||||
|
||||
if( !symbol )
|
||||
{
|
||||
|
@ -468,7 +468,7 @@ int SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
|
||||
|
||||
libSymbol = editFrame->GetCurPart();
|
||||
libSymbol = editFrame->GetCurSymbol();
|
||||
unit = editFrame->GetUnit();
|
||||
convert = editFrame->GetConvert();
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
|
||||
if( !symbol )
|
||||
continue;
|
||||
|
@ -274,7 +274,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
LIB_ITEM* item = nullptr;
|
||||
|
||||
// Prime the pump
|
||||
|
@ -453,7 +453,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
|
||||
if( !symbol )
|
||||
continue;
|
||||
|
@ -489,7 +489,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
|||
int SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SYMBOL_EDITOR_PIN_TOOL* pinTool = m_toolMgr->GetTool<SYMBOL_EDITOR_PIN_TOOL>();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
LIB_PIN* sourcePin = nullptr;
|
||||
|
||||
if( !symbol )
|
||||
|
|
|
@ -58,10 +58,11 @@ bool SYMBOL_EDITOR_EDIT_TOOL::Init()
|
|||
|
||||
wxASSERT_MSG( drawingTools, "eeschema.SymbolDrawing tool is not available" );
|
||||
|
||||
auto havePartCondition =
|
||||
auto haveSymbolCondition =
|
||||
[&]( const SELECTION& sel )
|
||||
{
|
||||
return m_isSymbolEditor && static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurPart();
|
||||
return m_isSymbolEditor &&
|
||||
static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
|
||||
};
|
||||
|
||||
auto canEdit =
|
||||
|
@ -105,7 +106,7 @@ bool SYMBOL_EDITOR_EDIT_TOOL::Init()
|
|||
moveMenu.AddItem( ACTIONS::doDelete, canEdit && EE_CONDITIONS::NotEmpty, 200 );
|
||||
|
||||
moveMenu.AddSeparator( 400 );
|
||||
moveMenu.AddItem( ACTIONS::selectAll, havePartCondition, 400 );
|
||||
moveMenu.AddItem( ACTIONS::selectAll, haveSymbolCondition, 400 );
|
||||
}
|
||||
|
||||
// Add editing actions to the drawing tool menu
|
||||
|
@ -137,7 +138,7 @@ bool SYMBOL_EDITOR_EDIT_TOOL::Init()
|
|||
selToolMenu.AddItem( ACTIONS::doDelete, canEdit && EE_CONDITIONS::NotEmpty, 300 );
|
||||
|
||||
selToolMenu.AddSeparator( 400 );
|
||||
selToolMenu.AddItem( ACTIONS::selectAll, havePartCondition, 400 );
|
||||
selToolMenu.AddItem( ACTIONS::selectAll, haveSymbolCondition, 400 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -155,7 +156,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() );
|
||||
|
||||
if( !item->IsMoving() )
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
|
||||
saveCopyInUndoList( m_frame->GetCurSymbol(), UNDO_REDO::LIBEDIT );
|
||||
|
||||
if( selection.GetSize() == 1 )
|
||||
rotPoint = item->GetPosition();
|
||||
|
@ -199,7 +200,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
|||
LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() );
|
||||
|
||||
if( !item->IsMoving() )
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
|
||||
saveCopyInUndoList( m_frame->GetCurSymbol(), UNDO_REDO::LIBEDIT );
|
||||
|
||||
if( selection.GetSize() == 1 )
|
||||
mirrorPoint = item->GetPosition();
|
||||
|
@ -252,7 +253,7 @@ static KICAD_T nonFields[] =
|
|||
|
||||
int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
auto items = m_selectionTool->RequestSelection( nonFields ).GetItems();
|
||||
|
||||
if( items.empty() )
|
||||
|
@ -413,7 +414,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( selection.Empty() || aEvent.IsAction( &EE_ACTIONS::symbolProperties ) )
|
||||
{
|
||||
if( m_frame->GetCurPart() )
|
||||
if( m_frame->GetCurSymbol() )
|
||||
editSymbolProperties();
|
||||
}
|
||||
else if( selection.Size() == 1 )
|
||||
|
@ -556,7 +557,7 @@ void SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField )
|
|||
|
||||
void SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties()
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
bool partLocked = symbol->UnitsLocked();
|
||||
wxString oldName = symbol->GetName();
|
||||
|
||||
|
@ -593,7 +594,7 @@ void SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties()
|
|||
|
||||
int SYMBOL_EDITOR_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
|
||||
if( !symbol )
|
||||
return 0;
|
||||
|
@ -616,7 +617,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SYMBOL_EDITOR_EDIT_TOOL::UpdateSymbolFields( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
|
||||
if( !symbol )
|
||||
return 0;
|
||||
|
@ -672,7 +673,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Cut( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SYMBOL_EDITOR_EDIT_TOOL::Copy( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
EE_SELECTION& selection = m_selectionTool->RequestSelection( nonFields );
|
||||
|
||||
if( !symbol || !selection.GetSize() )
|
||||
|
@ -692,7 +693,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Copy( const TOOL_EVENT& aEvent )
|
|||
LIB_SYMBOL* partCopy = new LIB_SYMBOL( *symbol );
|
||||
|
||||
STRING_FORMATTER formatter;
|
||||
SCH_SEXPR_PLUGIN::FormatPart( partCopy, formatter );
|
||||
SCH_SEXPR_PLUGIN::FormatLibSymbol( partCopy, formatter );
|
||||
|
||||
delete partCopy;
|
||||
|
||||
|
@ -708,7 +709,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Copy( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
|
||||
if( !symbol || symbol->IsAlias() )
|
||||
return 0;
|
||||
|
@ -719,7 +720,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
|
|||
|
||||
try
|
||||
{
|
||||
newPart = SCH_SEXPR_PLUGIN::ParsePart( reader );
|
||||
newPart = SCH_SEXPR_PLUGIN::ParseLibSymbol( reader );
|
||||
}
|
||||
catch( IO_ERROR& )
|
||||
{
|
||||
|
@ -773,7 +774,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
|
|||
|
||||
int SYMBOL_EDITOR_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
EE_SELECTION& selection = m_selectionTool->RequestSelection( nonFields );
|
||||
|
||||
if( selection.GetSize() == 0 )
|
||||
|
@ -785,7 +786,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
|
||||
if( !selection.Front()->IsMoving() )
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
|
||||
saveCopyInUndoList( m_frame->GetCurSymbol(), UNDO_REDO::LIBEDIT );
|
||||
|
||||
EDA_ITEMS newItems;
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
VECTOR2I prevPos;
|
||||
|
||||
if( !selection.Front()->IsNew() )
|
||||
saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
|
||||
saveCopyInUndoList( m_frame->GetCurSymbol(), UNDO_REDO::LIBEDIT );
|
||||
|
||||
m_cursor = controls->GetCursorPosition();
|
||||
|
||||
|
@ -154,7 +154,7 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
if( lib_item->Type() == LIB_PIN_T )
|
||||
{
|
||||
LIB_PIN* cur_pin = static_cast<LIB_PIN*>( lib_item );
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
std::vector<bool> got_unit( symbol->GetUnitCount() );
|
||||
|
||||
got_unit[cur_pin->GetUnit()] = true;
|
||||
|
|
|
@ -214,7 +214,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
|||
|
||||
bool SYMBOL_EDITOR_PIN_TOOL::PlacePin( LIB_PIN* aPin )
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
bool ask_for_pin = true; // Test for another pin in same position in other units
|
||||
|
||||
for( LIB_PIN* test = symbol->GetNextPin(); test; test = symbol->GetNextPin( test ) )
|
||||
|
@ -371,7 +371,7 @@ void SYMBOL_EDITOR_PIN_TOOL::CreateImagePins( LIB_PIN* aPin )
|
|||
|
||||
int SYMBOL_EDITOR_PIN_TOOL::PushPinProperties( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurPart();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
EE_SELECTION& selection = m_selectionTool->GetSelection();
|
||||
LIB_PIN* sourcePin = dynamic_cast<LIB_PIN*>( selection.Front() );
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ enum KICAD_T
|
|||
*/
|
||||
SYMBOL_LIB_TABLE_T,
|
||||
FP_LIB_TABLE_T,
|
||||
PART_LIBS_T,
|
||||
SYMBOL_LIBS_T,
|
||||
SEARCH_STACK_T,
|
||||
S3D_CACHE_T,
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
class wxConfigBase;
|
||||
class PARAM_CFG;
|
||||
class FP_LIB_TABLE;
|
||||
class PART_LIBS;
|
||||
class SYMBOL_LIBS;
|
||||
class SEARCH_STACK;
|
||||
class S3D_CACHE;
|
||||
class KIWAY;
|
||||
|
@ -161,7 +161,7 @@ public:
|
|||
SCH_LIB_PATH,
|
||||
SCH_LIB_SELECT, // eeschema/selpart.cpp
|
||||
SCH_LIBEDIT_CUR_LIB,
|
||||
SCH_LIBEDIT_CUR_PART, // eeschema/libeditframe.cpp
|
||||
SCH_LIBEDIT_CUR_SYMBOL, // eeschema/libeditframe.cpp
|
||||
|
||||
VIEWER_3D_PATH,
|
||||
VIEWER_3D_FILTER_INDEX,
|
||||
|
@ -201,7 +201,7 @@ public:
|
|||
{
|
||||
ELEM_FPTBL,
|
||||
|
||||
ELEM_SCH_PART_LIBS,
|
||||
ELEM_SCH_SYMBOL_LIBS,
|
||||
ELEM_SCH_SEARCH_STACK,
|
||||
ELEM_3DCACHE,
|
||||
ELEM_SYMBOL_LIB_TABLE,
|
||||
|
@ -285,7 +285,7 @@ public:
|
|||
|
||||
#if defined( EESCHEMA )
|
||||
// These are all prefaced with "Sch"
|
||||
PART_LIBS* SchLibs();
|
||||
SYMBOL_LIBS* SchLibs();
|
||||
|
||||
/// Accessor for Eeschema search stack.
|
||||
SEARCH_STACK* SchSearchS();
|
||||
|
|
|
@ -431,7 +431,7 @@ BOOST_AUTO_TEST_CASE( GetUnitDrawItems )
|
|||
LIB_PIN* pin1 = new LIB_PIN( &m_part_no_data );
|
||||
pin1->SetNumber( "1" );
|
||||
m_part_no_data.AddDrawItem( pin1 );
|
||||
std::vector<struct PART_UNITS> units = m_part_no_data.GetUnitDrawItems();
|
||||
std::vector<struct LIB_SYMBOL_UNITS> units = m_part_no_data.GetUnitDrawItems();
|
||||
BOOST_CHECK( units.size() == 1 );
|
||||
BOOST_CHECK( units[0].m_unit == 0 );
|
||||
BOOST_CHECK( units[0].m_convert == 0 );
|
||||
|
@ -448,7 +448,7 @@ BOOST_AUTO_TEST_CASE( Inheritance )
|
|||
BOOST_CHECK( parent->IsRoot() );
|
||||
std::unique_ptr<LIB_SYMBOL> child1 = std::make_unique<LIB_SYMBOL>( "child1", parent.get() );
|
||||
BOOST_CHECK( child1->IsAlias() );
|
||||
PART_SPTR parentRef = child1->GetParent().lock();
|
||||
LIB_SYMBOL_SPTR parentRef = child1->GetParent().lock();
|
||||
BOOST_CHECK( parentRef );
|
||||
BOOST_CHECK( parentRef == parent->SharedPtr() );
|
||||
BOOST_CHECK_EQUAL( parent->SharedPtr().use_count(), 3 );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
|
@ -92,7 +92,7 @@ void TEST_NETLISTS_FIXTURE::loadSchematic( const wxString& aBaseName )
|
|||
|
||||
m_manager.LoadProject( pro.GetFullPath() );
|
||||
|
||||
m_manager.Prj().SetElem( PROJECT::ELEM_SCH_PART_LIBS, nullptr );
|
||||
m_manager.Prj().SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, nullptr );
|
||||
|
||||
m_schematic.Reset();
|
||||
m_schematic.SetProject( &m_manager.Prj() );
|
||||
|
|
|
@ -70,7 +70,7 @@ void TEST_SCH_SHEET_LIST_FIXTURE::loadSchematic( const wxString& aRelativePath )
|
|||
m_schematic.CurrentSheet().clear();
|
||||
|
||||
m_manager.LoadProject( pro.GetFullPath() );
|
||||
m_manager.Prj().SetElem( PROJECT::ELEM_SCH_PART_LIBS, nullptr );
|
||||
m_manager.Prj().SetElem( PROJECT::ELEM_SCH_SYMBOL_LIBS, nullptr );
|
||||
|
||||
m_schematic.SetProject( &m_manager.Prj() );
|
||||
|
||||
|
|
Loading…
Reference in New Issue