7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 14:31:41 +00:00

Rename LIB_PART to LIB_SYMBOL.

This commit is contained in:
Wayne Stambaugh 2021-06-10 14:51:46 -04:00
parent 2af06a9d60
commit 71c183d7bb
120 changed files with 1692 additions and 1662 deletions
common
eeschema
annotate.cppclass_library.cppclass_library.hcomponent_references_lister.cpp
dialogs
ee_collectors.heeschema_config.cpperc.cppfields_grid_table.cppfields_grid_table.hgenerate_alias_info.cppgetpart.cppinvoke_sch_dialog.hlib_arc.cpplib_arc.hlib_bezier.cpplib_bezier.hlib_circle.cpplib_circle.hlib_field.cpplib_field.hlib_item.cpplib_item.hlib_pin.cpplib_pin.hlib_polyline.cpplib_polyline.hlib_rectangle.cpplib_rectangle.hlib_symbol.cpplib_symbol.hlib_text.cpplib_text.hlibarch.cpp
netlist_exporters
project_rescue.cppproject_rescue.hsch_base_frame.cppsch_base_frame.hsch_draw_panel.cppsch_draw_panel.hsch_edit_frame.cppsch_edit_frame.hsch_field.cppsch_io_mgr.hsch_painter.cppsch_painter.hsch_plugin.cpp
sch_plugins
sch_reference_list.hsch_screen.cppsch_screen.hsch_sheet_path.cppsch_symbol.cppsch_symbol.hsch_view.cppsch_view.hschematic_settings.cppsymbol_async_loader.cppsymbol_async_loader.h
symbol_editor
symbol_lib_table.cppsymbol_lib_table.hsymbol_tree_model_adapter.cppsymbol_tree_synchronizing_adapter.cppsymbol_viewer_frame.cppsymbol_viewer_frame.h
tools
widgets
include/core
qa/eeschema

View File

@ -291,7 +291,7 @@ static struct EDA_ITEM_DESC
.Map( SCH_SCREEN_T, _HKI( "SCH Screen" ) )
.Map( LIB_PART_T, _HKI( "Symbol" ) )
.Map( LIB_SYMBOL_T, _HKI( "Symbol" ) )
.Map( LIB_ALIAS_T, _HKI( "Alias" ) )
.Map( LIB_ARC_T, _HKI( "Arc" ) )
.Map( LIB_CIRCLE_T, _HKI( "Circle" ) )

View File

@ -52,7 +52,7 @@ void SCH_EDIT_FRAME::mapExistingAnnotation( std::map<wxString, wxString>& aMap )
wxString ref = symbol->GetRef( curr_sheetpath );
if( symbol->GetUnitCount() > 1 )
ref << LIB_PART::SubReference( symbol->GetUnitSelection( curr_sheetpath ) );
ref << LIB_SYMBOL::SubReference( symbol->GetUnitSelection( curr_sheetpath ) );
if( symbol->IsAnnotated( curr_sheetpath ) )
aMap[ curr_full_uuid.AsString() ] = ref;
@ -270,7 +270,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
wxString newRef = symbol->GetRef( sheet );
if( symbol->GetUnitCount() > 1 )
newRef << LIB_PART::SubReference( symbol->GetUnitSelection( sheet ) );
newRef << LIB_SYMBOL::SubReference( symbol->GetUnitSelection( sheet ) );
wxString msg;
@ -282,7 +282,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
if( symbol->GetUnitCount() > 1 )
msg.Printf( _( "Updated %s (unit %s) from %s to %s" ),
symbol->GetValue( sheet, true ),
LIB_PART::SubReference( symbol->GetUnit(), false ),
LIB_SYMBOL::SubReference( symbol->GetUnit(), false ),
prevRef,
newRef );
else
@ -296,7 +296,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
if( symbol->GetUnitCount() > 1 )
msg.Printf( _( "Annotated %s (unit %s) as %s" ),
symbol->GetValue( sheet, true ),
LIB_PART::SubReference( symbol->GetUnit(), false ),
LIB_SYMBOL::SubReference( symbol->GetUnit(), false ),
newRef );
else
msg.Printf( _( "Annotated %s as %s" ),

View File

@ -84,8 +84,8 @@ PART_LIB::~PART_LIB()
void PART_LIB::Save( bool aSaveDocFile )
{
wxCHECK_RET( m_plugin != NULL, wxString::Format( "no plugin defined for library `%s`.",
fileName.GetFullPath() ) );
wxCHECK_RET( m_plugin != nullptr, wxString::Format( "no plugin defined for library `%s`.",
fileName.GetFullPath() ) );
PROPERTIES props;
@ -153,19 +153,19 @@ void PART_LIB::GetPartNames( wxArrayString& aNames ) const
}
void PART_LIB::GetParts( std::vector<LIB_PART*>& aSymbols ) const
void PART_LIB::GetParts( std::vector<LIB_SYMBOL*>& aSymbols ) const
{
m_plugin->EnumerateSymbolLib( aSymbols, fileName.GetFullPath(), m_properties.get() );
std::sort( aSymbols.begin(), aSymbols.end(),
[](LIB_PART *lhs, LIB_PART *rhs) -> bool
[](LIB_SYMBOL *lhs, LIB_SYMBOL *rhs) -> bool
{ return lhs->GetName() < rhs->GetName(); });
}
LIB_PART* PART_LIB::FindPart( const wxString& aName ) const
LIB_SYMBOL* PART_LIB::FindPart( const wxString& aName ) const
{
LIB_PART* symbol = m_plugin->LoadSymbol( fileName.GetFullPath(), aName, m_properties.get() );
LIB_SYMBOL* symbol = m_plugin->LoadSymbol( fileName.GetFullPath(), aName, m_properties.get() );
// Set the library to this even though technically the legacy cache plugin owns the
// symbols. This allows the symbol library table conversion tool to determine the
@ -177,16 +177,17 @@ LIB_PART* PART_LIB::FindPart( const wxString& aName ) const
}
LIB_PART* PART_LIB::FindPart( const LIB_ID& aLibId ) const
LIB_SYMBOL* PART_LIB::FindPart( const LIB_ID& aLibId ) const
{
return FindPart( aLibId.Format().wx_str() );
}
void PART_LIB::AddPart( LIB_PART* aPart )
void PART_LIB::AddPart( LIB_SYMBOL* aSymbol )
{
// add a clone, not the caller's copy, the plugin take ownership of the new symbol.
m_plugin->SaveSymbol( fileName.GetFullPath(), new LIB_PART( *aPart->SharedPtr().get(), this ),
m_plugin->SaveSymbol( fileName.GetFullPath(),
new LIB_SYMBOL( *aSymbol->SharedPtr().get(), this ),
m_properties.get() );
// If we are not buffering, the library file is updated immediately when the plugin
@ -198,9 +199,9 @@ void PART_LIB::AddPart( LIB_PART* aPart )
}
LIB_PART* PART_LIB::RemovePart( LIB_PART* aEntry )
LIB_SYMBOL* PART_LIB::RemovePart( LIB_SYMBOL* aEntry )
{
wxCHECK_MSG( aEntry != NULL, NULL, "NULL pointer cannot be removed from library." );
wxCHECK_MSG( aEntry != nullptr, nullptr, "NULL pointer cannot be removed from library." );
m_plugin->DeleteSymbol( fileName.GetFullPath(), aEntry->GetName(), m_properties.get() );
@ -210,18 +211,18 @@ LIB_PART* PART_LIB::RemovePart( LIB_PART* aEntry )
isModified = true;
++m_mod_hash;
return NULL;
return nullptr;
}
LIB_PART* PART_LIB::ReplacePart( LIB_PART* aOldPart, LIB_PART* aNewPart )
LIB_SYMBOL* PART_LIB::ReplacePart( LIB_SYMBOL* aOldPart, LIB_SYMBOL* aNewPart )
{
wxASSERT( aOldPart != NULL );
wxASSERT( aNewPart != NULL );
wxASSERT( aOldPart != nullptr );
wxASSERT( aNewPart != nullptr );
m_plugin->DeleteSymbol( fileName.GetFullPath(), aOldPart->GetName(), m_properties.get() );
LIB_PART* my_part = new LIB_PART( *aNewPart, this );
LIB_SYMBOL* my_part = new LIB_SYMBOL( *aNewPart, this );
m_plugin->SaveSymbol( fileName.GetFullPath(), my_part, m_properties.get() );
@ -239,16 +240,16 @@ PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName )
{
std::unique_ptr<PART_LIB> lib = std::make_unique<PART_LIB>( SCH_LIB_TYPE::LT_EESCHEMA, aFileName );
std::vector<LIB_PART*> parts;
std::vector<LIB_SYMBOL*> parts;
// This loads the library.
lib->GetParts( parts );
// Now, set the LIB_PART m_library member but it will only be used
// Now, set the LIB_SYMBOL m_library member but it will only be used
// when loading legacy libraries in the future. Once the symbols in the
// schematic have a full #LIB_ID, this will not get called.
for( size_t ii = 0; ii < parts.size(); ii++ )
{
LIB_PART* part = parts[ii];
LIB_SYMBOL* part = parts[ii];
part->SetLib( lib.get() );
}
@ -318,7 +319,7 @@ PART_LIB* PART_LIBS::FindLibrary( const wxString& aName )
return &*it;
}
return NULL;
return nullptr;
}
@ -330,7 +331,7 @@ PART_LIB* PART_LIBS::GetCacheLibrary()
return &*it;
}
return NULL;
return nullptr;
}
@ -342,7 +343,7 @@ PART_LIB* PART_LIBS::FindLibraryByFullFileName( const wxString& aFullFileName )
return &*it;
}
return NULL;
return nullptr;
}
@ -370,9 +371,9 @@ wxArrayString PART_LIBS::GetLibraryNames( bool aSorted )
}
LIB_PART* PART_LIBS::FindLibPart( const LIB_ID& aLibId, const wxString& aLibraryName )
LIB_SYMBOL* PART_LIBS::FindLibPart( const LIB_ID& aLibId, const wxString& aLibraryName )
{
LIB_PART* part = NULL;
LIB_SYMBOL* part = nullptr;
for( PART_LIB& lib : *this )
{
@ -389,7 +390,7 @@ LIB_PART* PART_LIBS::FindLibPart( const LIB_ID& aLibId, const wxString& aLibrary
}
void PART_LIBS::FindLibraryNearEntries( std::vector<LIB_PART*>& aCandidates,
void PART_LIBS::FindLibraryNearEntries( std::vector<LIB_SYMBOL*>& aCandidates,
const wxString& aEntryName,
const wxString& aLibraryName )
{
@ -488,7 +489,7 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
wxArrayString lib_names;
LibNamesAndPaths( aProject, false, NULL, &lib_names );
LibNamesAndPaths( aProject, false, nullptr, &lib_names );
// Post symbol library table, this should be empty. Only the cache library should get loaded.
if( !lib_names.empty() )
@ -496,7 +497,7 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
APP_PROGRESS_DIALOG lib_dialog( _( "Loading Symbol Libraries" ),
wxEmptyString,
lib_names.GetCount(),
NULL,
nullptr,
false,
wxPD_APP_MODAL );

View File

@ -39,7 +39,7 @@
#include <sch_io_mgr.h>
#include <project.h>
class LIB_PART;
class LIB_SYMBOL;
class LIB_ID;
class LINE_READER;
class OUTPUTFORMATTER;
@ -170,7 +170,7 @@ class PART_LIB;
class wxRegEx;
/**
* LIB_PART map sorting.
* LIB_SYMBOL map sorting.
*/
struct LibPartMapSort
{
@ -182,9 +182,9 @@ struct LibPartMapSort
/// Part map used by part library object.
typedef std::map< wxString, LIB_PART*, LibPartMapSort > LIB_PART_MAP;
typedef std::vector< LIB_PART* > LIB_PARTS;
typedef boost::ptr_vector< PART_LIB > PART_LIBS_BASE;
typedef std::map< wxString, LIB_SYMBOL*, LibPartMapSort > LIB_SYMBOL_MAP;
typedef std::vector< LIB_SYMBOL* > LIB_SYMBOLS;
typedef boost::ptr_vector< PART_LIB > PART_LIBS_BASE;
/**
@ -291,12 +291,12 @@ public:
*
* @param aLibId - The #LIB_ID of the symbol to search for.
* @param aLibraryName - Name of the library to search for part.
* @return LIB_PART* - The part object if found, otherwise NULL.
* @return LIB_SYMBOL* - The part object if found, otherwise NULL.
*/
LIB_PART* FindLibPart( const LIB_ID& aLibId, const wxString& aLibraryName = wxEmptyString );
LIB_SYMBOL* FindLibPart( const LIB_ID& aLibId, const wxString& aLibraryName = wxEmptyString );
/**
* Search all libraries in the list for a #LIB_PART using a case insensitive comparison.
* Search all libraries in the list for a #LIB_SYMBOL using a case insensitive comparison.
*
* Helper function used in dialog to find all candidates.
* During a long time, eeschema was using a case insensitive search.
@ -308,7 +308,7 @@ public:
* @param aLibraryName - Name of the library to search.
* @param aCandidates - a std::vector to store candidates
*/
void FindLibraryNearEntries( std::vector<LIB_PART*>& aCandidates, const wxString& aEntryName,
void FindLibraryNearEntries( std::vector<LIB_SYMBOL*>& aCandidates, const wxString& aEntryName,
const wxString& aLibraryName = wxEmptyString );
int GetLibraryCount() { return size(); }
@ -371,29 +371,29 @@ public:
/**
* Load a vector with all the entries in this library.
*
* @param aParts - vector to receive the aliases.
* @param aSymbols is a vector to receive the aliases.
*/
void GetParts( std::vector<LIB_PART*>& aPart) const;
void GetParts( std::vector<LIB_SYMBOL*>& aSymbols ) const;
/**
* Find #LIB_PART by \a aName.
* Find #LIB_SYMBOL by \a aName.
*
* @param aName - Name of part, case sensitive.
* @return LIB_PART pointer part if found, else NULL.
* @return LIB_SYMBOL pointer part if found, else NULL.
*/
LIB_PART* FindPart( const wxString& aName ) const;
LIB_SYMBOL* FindPart( const wxString& aName ) const;
LIB_PART* FindPart( const LIB_ID& aLibId ) const;
LIB_SYMBOL* FindPart( const LIB_ID& aLibId ) const;
/**
* Add \a aPart entry to library.
* Add \a aSymbol entry to library.
*
* @note A #LIB_PART can have an alias list so these alias will be added in library.
* @note A #LIB_SYMBOL can have an alias list so these alias will be added in library.
* and the any existing duplicate aliases will be removed from the library.
*
* @param aPart - Part to add, caller retains ownership, a clone is added.
* @param aSymbol - Part to add, caller retains ownership, a clone is added.
*/
void AddPart( LIB_PART* aPart );
void AddPart( LIB_SYMBOL* aSymbol );
/**
* Safely remove \a aEntry from the library and return the next entry.
@ -406,7 +406,7 @@ public:
* @param aEntry - Entry to remove from library.
* @return The next entry in the library or NULL if the library is empty.
*/
LIB_PART* RemovePart( LIB_PART* aEntry );
LIB_SYMBOL* RemovePart( LIB_SYMBOL* aEntry );
/**
* Replace an existing part entry in the library.
@ -416,7 +416,7 @@ public:
* @param aOldPart - The part to replace.
* @param aNewPart - The new part.
*/
LIB_PART* ReplacePart( LIB_PART* aOldPart, LIB_PART* aNewPart );
LIB_SYMBOL* ReplacePart( LIB_SYMBOL* aOldSymbol, LIB_SYMBOL* aNewSymbol );
/**
* Return the file name without path or extension.

View File

@ -629,7 +629,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
msg.Printf( _( "Error: symbol %s%s%s (unit %d) exceeds units defined (%d)\n" ),
flatList[ii].GetRef(),
tmp,
LIB_PART::SubReference( flatList[ii].m_unit ),
LIB_SYMBOL::SubReference( flatList[ii].m_unit ),
flatList[ii].m_unit,
flatList[ii].GetLibPart()->GetUnitCount() );
@ -666,7 +666,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
msg.Printf( _( "Duplicate items %s%s%s\n" ),
flatList[ii].GetRef(),
tmp,
LIB_PART::SubReference( flatList[ii].m_unit ) );
LIB_SYMBOL::SubReference( flatList[ii].m_unit ) );
}
else
{
@ -696,7 +696,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
msg.Printf( _( "Duplicate items %s%s%s\n" ),
flatList[ii].GetRef(),
tmp,
LIB_PART::SubReference( flatList[ii].m_unit ) );
LIB_SYMBOL::SubReference( flatList[ii].m_unit ) );
}
else
{
@ -717,11 +717,11 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
msg.Printf( _( "Different values for %s%d%s (%s) and %s%d%s (%s)" ),
flatList[ii].GetRef(),
flatList[ii].m_numRef,
LIB_PART::SubReference( flatList[ii].m_unit ),
LIB_SYMBOL::SubReference( flatList[ii].m_unit ),
flatList[ii].m_value,
flatList[next].GetRef(),
flatList[next].m_numRef,
LIB_PART::SubReference( flatList[next].m_unit ),
LIB_SYMBOL::SubReference( flatList[next].m_unit ),
flatList[next].m_value );
aHandler( ERCE_DIFFERENT_UNIT_VALUE, msg, &flatList[ii], &flatList[ii+1] );
@ -733,14 +733,14 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
}
SCH_REFERENCE::SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_PART* aLibPart,
SCH_REFERENCE::SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_SYMBOL* aLibSymbol,
const SCH_SHEET_PATH& aSheetPath )
{
wxASSERT( aSymbol != NULL );
m_rootSymbol = aSymbol;
m_libPart = aLibPart; // Warning: can be nullptr for orphan symbols
// (i.e. with a symbol library not found)
m_libPart = aLibSymbol; // Warning: can be nullptr for orphan symbols
// (i.e. with a symbol library not found)
m_unit = aSymbol->GetUnitSelection( &aSheetPath );
m_footprint = aSymbol->GetFootprint( &aSheetPath, true );
m_sheetPath = aSheetPath;

View File

@ -261,7 +261,7 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
SCH_SHEET_LIST hierarchy = frame->Schematic().GetSheets();
// Load non-mandatory fields from all matching symbols and their library parts
// Load non-mandatory fields from all matching symbols and their library symbols
std::vector<SCH_FIELD*> fields;
std::vector<LIB_FIELD*> libFields;
std::set<wxString> fieldNames;
@ -289,24 +289,24 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
if( m_mode == MODE::UPDATE && symbol->GetLibId().IsValid() )
{
LIB_PART* libSymbol = frame->GetLibPart( symbol->GetLibId() );
LIB_SYMBOL* libSymbol = frame->GetLibPart( symbol->GetLibId() );
if( libSymbol )
{
std::unique_ptr<LIB_PART> flattenedPart = libSymbol->Flatten();
std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->Flatten();
flattenedPart->GetFields( libFields );
flattenedSymbol->GetFields( libFields );
for( unsigned i = MANDATORY_FIELDS; i < libFields.size(); ++i )
fieldNames.insert( libFields[i]->GetName() );
libFields.clear(); // flattenedPart is about to go out of scope...
libFields.clear(); // flattenedSymbol is about to go out of scope...
}
}
}
}
// Load non-mandatory fields from the change-to library part
// Load non-mandatory fields from the change-to library symbol
if( m_mode == MODE::CHANGE )
{
LIB_ID newId;
@ -315,18 +315,18 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
if( newId.IsValid() )
{
LIB_PART* libSymbol = frame->GetLibPart( newId );
LIB_SYMBOL* libSymbol = frame->GetLibPart( newId );
if( libSymbol )
{
std::unique_ptr<LIB_PART> flattenedPart = libSymbol->Flatten();
std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->Flatten();
flattenedPart->GetFields( libFields );
flattenedSymbol->GetFields( libFields );
for( unsigned i = MANDATORY_FIELDS; i < libFields.size(); ++i )
fieldNames.insert( libFields[i]->GetName() );
libFields.clear(); // flattenedPart is about to go out of scope...
libFields.clear(); // flattenedSymbol is about to go out of scope...
}
}
}
@ -532,7 +532,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
}
}
LIB_PART* libSymbol = frame->GetLibPart( aNewId );
LIB_SYMBOL* libSymbol = frame->GetLibPart( aNewId );
if( !libSymbol )
{
@ -541,7 +541,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
return false;
}
std::unique_ptr<LIB_PART> flattenedSymbol = libSymbol->Flatten();
std::unique_ptr<LIB_SYMBOL> flattenedSymbol = libSymbol->Flatten();
if( flattenedSymbol->GetUnitCount() < aSymbol->GetUnit() )
{
@ -550,7 +550,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
return false;
}
// Removing the symbol needs to be done before the LIB_PART is changed to prevent stale
// Removing the symbol needs to be done before the LIB_SYMBOL is changed to prevent stale
// library symbols in the schematic file.
screen->Remove( aSymbol );
frame->SaveCopyInUndoList( screen, aSymbol, UNDO_REDO::CHANGED, aAppendToUndo );

View File

@ -396,7 +396,7 @@ void DIALOG_CHOOSE_SYMBOL::ShowFootprintFor( LIB_ID const& aLibId )
if( !m_fp_preview || !m_fp_preview->IsInitialized() )
return;
LIB_PART* symbol = nullptr;
LIB_SYMBOL* symbol = nullptr;
try
{
@ -453,7 +453,7 @@ void DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector( LIB_ID const& aLibId )
m_fp_sel_ctrl->ClearFilters();
LIB_PART* symbol = nullptr;
LIB_SYMBOL* symbol = nullptr;
if( aLibId.IsValid() )
{

View File

@ -46,7 +46,6 @@ class SYMBOL_PREVIEW_WIDGET;
class FOOTPRINT_PREVIEW_WIDGET;
class FOOTPRINT_SELECT_WIDGET;
class LIB_ALIAS;
class LIB_PART;
class SCH_BASE_FRAME;
class SCH_DRAW_PANEL;

View File

@ -714,7 +714,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow()
if( cmp.m_Row != row )
continue;
LIB_PART* symbol = nullptr;
LIB_SYMBOL* symbol = nullptr;
try
{

View File

@ -318,9 +318,9 @@ DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
{
const SCH_SYMBOL* symbol = (SCH_SYMBOL*) aField->GetParent();
const LIB_PART* part = GetParent()->GetLibPart( symbol->GetLibId(), true );
const LIB_SYMBOL* libSymbol = GetParent()->GetLibPart( symbol->GetLibId(), true );
if( part && part->IsPower() )
if( libSymbol && libSymbol->IsPower() )
m_isPower = true;
}

View File

@ -66,7 +66,7 @@ bool DIALOG_LIB_EDIT_DRAW_ITEM::TransferDataToWindow()
if( !wxDialog::TransferDataToWindow() )
return false;
LIB_PART* symbol = m_item->GetParent();
LIB_SYMBOL* symbol = m_item->GetParent();
m_lineWidth.SetValue( m_item->GetWidth() );
m_checkApplyToAllUnits->SetValue( m_item->GetUnit() == 0 );

View File

@ -416,10 +416,11 @@ private:
};
DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent, LIB_PART* aPart ) :
DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent,
LIB_SYMBOL* aSymbol ) :
DIALOG_LIB_EDIT_PIN_TABLE_BASE( parent ),
m_editFrame( parent ),
m_part( aPart )
m_part( aSymbol )
{
m_dataModel = new PIN_TABLE_DATA_MODEL( GetUserUnits() );

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -51,7 +51,7 @@ class SYMBOL_EDIT_FRAME;
class DIALOG_LIB_EDIT_PIN_TABLE : public DIALOG_LIB_EDIT_PIN_TABLE_BASE
{
public:
DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent, LIB_PART* aPart );
DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent, LIB_SYMBOL* aSymbol );
~DIALOG_LIB_EDIT_PIN_TABLE() override;
bool TransferDataToWindow() override;
@ -76,7 +76,7 @@ protected:
bool m_initialized = false;
int m_originalColWidths[ COL_COUNT ];
wxString m_columnsShown;
LIB_PART* m_part;
LIB_SYMBOL* m_part;
LIB_PINS m_pins; // a copy of the pins owned by me
bool m_modified; ///< true when there are unsaved changes

View File

@ -47,7 +47,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::LAST_LAYOUT
DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* aParent,
LIB_PART* aLibEntry ) :
LIB_SYMBOL* aLibEntry ) :
DIALOG_LIB_SYMBOL_PROPERTIES_BASE( aParent ),
m_Parent( aParent ),
m_libEntry( aLibEntry ),
@ -345,7 +345,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
wxString libName = m_Parent->GetCurLib();
// Get the parent from the libManager based on the name set in the inheritance combo box.
LIB_PART* newParent = m_Parent->GetLibManager().GetAlias( parentName, libName );
LIB_SYMBOL* newParent = m_Parent->GetLibManager().GetAlias( parentName, libName );
// Verify that the requested parent exists
wxCHECK( newParent, false );
@ -361,7 +361,8 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
m_libEntry->SetDescription( m_DescCtrl->GetValue() );
m_libEntry->SetKeyWords( m_KeywordCtrl->GetValue() );
m_libEntry->SetUnitCount( m_SelNumberOfUnits->GetValue() );
m_libEntry->LockUnits( m_libEntry->GetUnitCount() > 1 && !m_OptionPartsInterchangeable->GetValue() );
m_libEntry->LockUnits( m_libEntry->GetUnitCount() > 1 &&
!m_OptionPartsInterchangeable->GetValue() );
m_libEntry->SetConversion( m_AsConvertButt->GetValue() );
if( m_OptionPower->GetValue() )
@ -392,7 +393,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
m_Parent->UpdateAfterSymbolProperties( &oldName );
// It's possible that the symbol being edited has no pins, in which case there may be no
// alternate body style objects causing #LIB_PART::HasCoversion() to always return false.
// alternate body style objects causing #LIB_SYMBOL::HasCoversion() to always return false.
// This allows the user to edit the alternate body style just in case this condition occurs.
m_Parent->SetShowDeMorgan( m_AsConvertButt->GetValue() );
@ -534,7 +535,9 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnMoveUp( wxCommandEvent& event )
m_grid->MakeCellVisible( m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol() );
}
else
{
wxBell();
}
}

View File

@ -31,14 +31,14 @@
class SYMBOL_EDIT_FRAME;
class LIB_PART;
class LIB_SYMBOL;
class WX_GRID;
class DIALOG_LIB_SYMBOL_PROPERTIES: public DIALOG_LIB_SYMBOL_PROPERTIES_BASE
{
public:
DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PART* aLibEntry );
DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_SYMBOL* aLibEntry );
~DIALOG_LIB_SYMBOL_PROPERTIES();
protected:
@ -71,7 +71,7 @@ private:
public:
SYMBOL_EDIT_FRAME* m_Parent;
LIB_PART* m_libEntry;
LIB_SYMBOL* m_libEntry;
FIELDS_GRID_TABLE<LIB_FIELD>* m_fields;

View File

@ -445,7 +445,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow()
if( m_symbol->GetUnitCount() > 1 )
{
for( int ii = 1; ii <= m_symbol->GetUnitCount(); ii++ )
m_unitChoice->Append( LIB_PART::SubReference( ii, false ) );
m_unitChoice->Append( LIB_SYMBOL::SubReference( ii, false ) );
if( m_symbol->GetUnit() <= ( int )m_unitChoice->GetCount() )
m_unitChoice->SetSelection( m_symbol->GetUnit() - 1 );
@ -659,7 +659,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
for( unsigned i = 0; i < m_fields->size(); ++i )
m_fields->at( i ).Offset( m_symbol->GetPosition() );
LIB_PART* entry = GetParent()->GetLibPart( m_symbol->GetLibId() );
LIB_SYMBOL* entry = GetParent()->GetLibPart( m_symbol->GetLibId() );
if( entry && entry->IsPower() )
m_fields->at( VALUE_FIELD ).SetText( m_symbol->GetLibId().GetLibItemName() );

View File

@ -30,7 +30,7 @@
#include <sch_pin.h>
class LIB_PART;
class LIB_SYMBOL;
class SCH_PIN_TABLE_DATA_MODEL;
class SCH_EDIT_FRAME;
@ -90,7 +90,7 @@ private:
private:
SCH_SYMBOL* m_symbol;
LIB_PART* m_part;
LIB_SYMBOL* m_part;
int m_width;
int m_delayedFocusRow;

View File

@ -296,7 +296,7 @@ bool DIALOG_SYMBOL_REMAP::remapSymbolToLibTable( SCH_SYMBOL* aSymbol )
if( it->IsCache() )
continue;
LIB_PART* alias = it->FindPart( aSymbol->GetLibId().GetLibItemName().wx_str() );
LIB_SYMBOL* alias = it->FindPart( aSymbol->GetLibId().GetLibItemName().wx_str() );
// Found in the same library as the old look up method assuming the user didn't
// change the libraries or library ordering since the last time the schematic was

View File

@ -36,7 +36,7 @@ bool g_resetLibFieldPositions = true;
DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aParent,
LIB_PART* aSymbol ) :
LIB_SYMBOL* aSymbol ) :
DIALOG_UPDATE_SYMBOL_FIELDS_BASE( aParent ),
m_editFrame( aParent ),
m_symbol( aSymbol)
@ -82,9 +82,9 @@ DIALOG_UPDATE_SYMBOL_FIELDS::~DIALOG_UPDATE_SYMBOL_FIELDS()
void DIALOG_UPDATE_SYMBOL_FIELDS::updateFieldsList()
{
// Load non-mandatory fields from the parent part
std::vector<LIB_FIELD*> libFields;
std::set<wxString> fieldNames;
std::unique_ptr<LIB_PART> flattenedParent = m_symbol->GetParent().lock()->Flatten();
std::vector<LIB_FIELD*> libFields;
std::set<wxString> fieldNames;
std::unique_ptr<LIB_SYMBOL> flattenedParent = m_symbol->GetParent().lock()->Flatten();
flattenedParent->GetFields( libFields );
@ -135,7 +135,7 @@ void DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked( wxCommandEvent& aEvent )
m_updateFields.insert( m_fieldsBox->GetString( i ) );
}
std::unique_ptr<LIB_PART> flattenedParent = m_symbol->GetParent().lock()->Flatten();
std::unique_ptr<LIB_SYMBOL> flattenedParent = m_symbol->GetParent().lock()->Flatten();
bool removeExtras = m_removeExtraBox->GetValue();
bool resetVis = m_resetFieldVisibilities->GetValue();

View File

@ -24,7 +24,7 @@
#include <dialog_update_symbol_fields_base.h>
class LIB_ID;
class LIB_PART;
class LIB_SYMBOL;
class SYMBOL_EDIT_FRAME;
/**
@ -33,7 +33,7 @@ class SYMBOL_EDIT_FRAME;
class DIALOG_UPDATE_SYMBOL_FIELDS : public DIALOG_UPDATE_SYMBOL_FIELDS_BASE
{
public:
DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aParent, LIB_PART* aPart );
DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aParent, LIB_SYMBOL* aSymbol );
~DIALOG_UPDATE_SYMBOL_FIELDS() override;
protected:
@ -56,7 +56,7 @@ private:
void updateFieldsList();
SYMBOL_EDIT_FRAME* m_editFrame;
LIB_PART* m_symbol;
LIB_SYMBOL* m_symbol;
///< Set of field names that should have values updated
std::set<wxString> m_updateFields;

View File

@ -331,26 +331,26 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
t2->SetSelected();
{
LIB_PART* part = new LIB_PART( wxEmptyString );
LIB_SYMBOL* symbol = new LIB_SYMBOL( wxEmptyString );
wxPoint p( 2625, -1600 );
LIB_FIELD& ref = part->GetReferenceField();
LIB_FIELD& ref = symbol->GetReferenceField();
ref.SetText( wxT( "U1" ) );
ref.SetPosition( MILS_POINT( p.x + 30, p.y + 260 ) );
ref.SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
LIB_FIELD& value = part->GetValueField();
LIB_FIELD& value = symbol->GetValueField();
value.SetText( wxT( "OPA604" ) );
value.SetPosition( MILS_POINT( p.x + 30, p.y + 180 ) );
value.SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
part->SetShowPinNames( true );
part->SetShowPinNumbers( true );
part->SetPinNameOffset( 0 );
symbol->SetShowPinNames( true );
symbol->SetShowPinNumbers( true );
symbol->SetPinNameOffset( 0 );
LIB_POLYLINE* comp_body = new LIB_POLYLINE( part );
LIB_POLYLINE* comp_body = new LIB_POLYLINE( symbol );
comp_body->SetUnit( 0 );
comp_body->SetConvert( 0 );
@ -363,7 +363,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
addItem( comp_body );
LIB_PIN* pin = new LIB_PIN( part );
LIB_PIN* pin = new LIB_PIN( symbol );
pin->SetPosition( MILS_POINT( p.x - 200, p.y + 100 ) );
pin->SetLength( Mils2iu( 100 ) );
@ -372,9 +372,9 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
pin->SetNumber( wxT( "1" ) );
pin->SetName( wxT( "-" ) );
part->AddDrawItem( pin );
symbol->AddDrawItem( pin );
pin = new LIB_PIN( part );
pin = new LIB_PIN( symbol );
pin->SetPosition( MILS_POINT( p.x - 200, p.y - 100 ) );
pin->SetLength( Mils2iu( 100 ) );
@ -383,9 +383,9 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
pin->SetNumber( wxT( "2" ) );
pin->SetName( wxT( "+" ) );
part->AddDrawItem( pin );
symbol->AddDrawItem( pin );
pin = new LIB_PIN( part );
pin = new LIB_PIN( symbol );
pin->SetPosition( MILS_POINT( p.x + 200, p.y ) );
pin->SetLength( Mils2iu( 100 ) );
@ -394,9 +394,9 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
pin->SetNumber( wxT( "3" ) );
pin->SetName( wxT( "OUT" ) );
part->AddDrawItem( pin );
symbol->AddDrawItem( pin );
addItem( part );
addItem( symbol );
}
SCH_SHEET* s = new SCH_SHEET( nullptr, MILS_POINT( 4000, 1300 ) );

View File

@ -59,13 +59,13 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
// Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
int refStyleSelection;
switch( LIB_PART::GetSubpartIdSeparator() )
switch( LIB_SYMBOL::GetSubpartIdSeparator() )
{
default:
case 0: refStyleSelection = 0; break;
case '.': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 4 : 1; break;
case '-': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 5 : 2; break;
case '_': refStyleSelection = LIB_PART::GetSubpartFirstId() == '1' ? 6 : 3; break;
case '.': refStyleSelection = LIB_SYMBOL::GetSubpartFirstId() == '1' ? 4 : 1; break;
case '-': refStyleSelection = LIB_SYMBOL::GetSubpartFirstId() == '1' ? 5 : 2; break;
case '_': refStyleSelection = LIB_SYMBOL::GetSubpartFirstId() == '1' ? 6 : 3; break;
}
m_choiceSeparatorRefId->SetSelection( refStyleSelection );
@ -119,10 +119,10 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
case 6: firstRefId = '1'; refSeparator = '_'; break;
}
if( refSeparator != LIB_PART::GetSubpartIdSeparator() ||
firstRefId != LIB_PART::GetSubpartFirstId() )
if( refSeparator != LIB_SYMBOL::GetSubpartIdSeparator() ||
firstRefId != LIB_SYMBOL::GetSubpartFirstId() )
{
LIB_PART::SetSubpartIdNotation( refSeparator, firstRefId );
LIB_SYMBOL::SetSubpartIdNotation( refSeparator, firstRefId );
}
settings.m_DefaultTextSize = (int) m_textSize.GetValue();

View File

@ -799,11 +799,11 @@ void PANEL_SYM_LIB_TABLE::onConvertLegacyLibraries( wxCommandEvent& event )
bool PANEL_SYM_LIB_TABLE::convertLibrary( const wxString& aLibrary, const wxString& legacyFilepath,
const wxString& newFilepath )
{
SCH_PLUGIN::SCH_PLUGIN_RELEASER legacyPI( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
SCH_PLUGIN::SCH_PLUGIN_RELEASER kicadPI( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
std::vector<LIB_PART*> parts;
std::vector<LIB_PART*> newParts;
std::map<LIB_PART*, LIB_PART*> partMap;
SCH_PLUGIN::SCH_PLUGIN_RELEASER legacyPI( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
SCH_PLUGIN::SCH_PLUGIN_RELEASER kicadPI( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
std::vector<LIB_SYMBOL*> symbols;
std::vector<LIB_SYMBOL*> newSymbols;
std::map<LIB_SYMBOL*, LIB_SYMBOL*> symbolMap;
try
{
@ -816,32 +816,32 @@ bool PANEL_SYM_LIB_TABLE::convertLibrary( const wxString& aLibrary, const wxStri
// This will write the file
delete formatter;
legacyPI->EnumerateSymbolLib( parts, legacyFilepath );
legacyPI->EnumerateSymbolLib( symbols, legacyFilepath );
// Copy non-aliases first so we can build a map from parts to newParts
for( LIB_PART* part : parts )
// Copy non-aliases first so we can build a map from symbols to newSymbols
for( LIB_SYMBOL* symbol : symbols )
{
if( part->IsAlias() )
if( symbol->IsAlias() )
continue;
newParts.push_back( new LIB_PART( *part ) );
partMap[part] = newParts.back();
newSymbols.push_back( new LIB_SYMBOL( *symbol ) );
symbolMap[symbol] = newSymbols.back();
}
// Now do the aliases using the map to hook them up to their newPart parents
for( LIB_PART* part : parts )
// Now do the aliases using the map to hook them up to their newSymbol parents
for( LIB_SYMBOL* symbol : symbols )
{
if( !part->IsAlias() )
if( !symbol->IsAlias() )
continue;
newParts.push_back( new LIB_PART( *part ) );
newParts.back()->SetParent( partMap[ part->GetParent().lock().get() ] );
newSymbols.push_back( new LIB_SYMBOL( *symbol ) );
newSymbols.back()->SetParent( symbolMap[ symbol->GetParent().lock().get() ] );
}
// Finally write out newParts
for( LIB_PART* part : newParts )
// Finally write out newSymbols
for( LIB_SYMBOL* symbol : newSymbols )
{
kicadPI->SaveSymbol( newFilepath, part );
kicadPI->SaveSymbol( newFilepath, symbol );
}
}
catch( ... )

View File

@ -90,7 +90,7 @@ public:
/**
* Scan an #EDA_ITEM using this class's Inspector method which does the collection.
*
* @param aItems is a LIB_PART multivector holding the part items.
* @param aItems is a LIB_SYMBOL multivector holding the symbol items.
* @param aFilterList is a list of #KICAD_T types with a terminating #EOT, that determines
* what is to be collected and the priority order of the resulting
* collection.

View File

@ -86,8 +86,8 @@ bool SCH_EDIT_FRAME::LoadProjectSettings()
// Verify some values, because the config file can be edited by hand,
// and have bad values:
LIB_PART::SetSubpartIdNotation( LIB_PART::GetSubpartIdSeparator(),
LIB_PART::GetSubpartFirstId() );
LIB_SYMBOL::SetSubpartIdNotation( LIB_SYMBOL::GetSubpartIdSeparator(),
LIB_SYMBOL::GetSubpartFirstId() );
// Load the drawing sheet description file, from the filename stored in
// BASE_SCREEN::m_DrawingSheetFileName, read in config project file

Some files were not shown because too many files have changed in this diff Show More