Rename SCH_COMPONENT to SCH_SYMBOL.

This commit is contained in:
Wayne Stambaugh 2021-06-10 10:10:55 -04:00
parent 1c3df973d6
commit fbc135e69f
118 changed files with 1380 additions and 1348 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2020 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
@ -280,7 +280,7 @@ static struct EDA_ITEM_DESC
.Map( SCH_GLOBAL_LABEL_T, _HKI( "Global Label" ) )
.Map( SCH_HIER_LABEL_T, _HKI( "Hierarchical Label" ) )
.Map( SCH_FIELD_T, _HKI( "Schematic Field" ) )
.Map( SCH_COMPONENT_T, _HKI( "Component" ) )
.Map( SCH_SYMBOL_T, _HKI( "Schematic Symbol" ) )
.Map( SCH_SHEET_PIN_T, _HKI( "Sheet Pin" ) )
.Map( SCH_SHEET_T, _HKI( "Sheet" ) )

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2014-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-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
@ -36,27 +36,18 @@
static const int kDataViewIndent = 20;
/**
* Convert CMP_TREE_NODE -> wxDataViewItem
*/
wxDataViewItem LIB_TREE_MODEL_ADAPTER::ToItem( LIB_TREE_NODE const* aNode )
{
return wxDataViewItem( const_cast<void*>( static_cast<void const*>( aNode ) ) );
}
/**
* Convert wxDataViewItem -> CMP_TREE_NODE
*/
LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ToNode( wxDataViewItem aItem )
{
return static_cast<LIB_TREE_NODE*>( aItem.GetID() );
}
/**
* Convert CMP_TREE_NODE's children to wxDataViewItemArray
*/
unsigned int LIB_TREE_MODEL_ADAPTER::IntoArray( LIB_TREE_NODE const& aNode,
wxDataViewItemArray& aChildren )
{
@ -77,7 +68,7 @@ unsigned int LIB_TREE_MODEL_ADAPTER::IntoArray( LIB_TREE_NODE const& aNode,
LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, wxString aPinnedKey ) :
m_parent( aParent ),
m_filter( CMP_FILTER_NONE ),
m_filter( SYM_FILTER_NONE ),
m_show_units( true ),
m_preselect_unit( 0 ),
m_freeze( 0 ),
@ -144,7 +135,7 @@ void LIB_TREE_MODEL_ADAPTER::SavePinnedItems()
}
void LIB_TREE_MODEL_ADAPTER::SetFilter( CMP_FILTER_TYPE aFilter )
void LIB_TREE_MODEL_ADAPTER::SetFilter( SYM_FILTER_TYPE aFilter )
{
m_filter = aFilter;
}
@ -548,10 +539,12 @@ LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ShowPreselect()
FindAndExpand( m_tree,
[&]( LIB_TREE_NODE const* n )
{
if( n->m_Type == LIB_TREE_NODE::LIBID && ( n->m_Children.empty() || !m_preselect_unit ) )
if( n->m_Type == LIB_TREE_NODE::LIBID && ( n->m_Children.empty() ||
!m_preselect_unit ) )
return m_preselect_lib_id == n->m_LibId;
else if( n->m_Type == LIB_TREE_NODE::UNIT && m_preselect_unit )
return m_preselect_lib_id == n->m_Parent->m_LibId && m_preselect_unit == n->m_Unit;
return m_preselect_lib_id == n->m_Parent->m_LibId &&
m_preselect_unit == n->m_Unit;
else
return false;
},

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jon Evans <jon@craftyjon.com>
*
* This program is free software: you can redistribute it and/or modify it
@ -36,12 +37,12 @@ const int projectFileSchemaVersion = 1;
PROJECT_FILE::PROJECT_FILE( const wxString& aFullPath ) :
JSON_SETTINGS( aFullPath, SETTINGS_LOC::PROJECT, projectFileSchemaVersion ),
m_sheets(),
m_boards(),
m_project( nullptr ),
m_ErcSettings( nullptr ),
m_SchematicSettings( nullptr ),
m_BoardSettings()
m_BoardSettings(),
m_sheets(),
m_boards(),
m_project( nullptr )
{
// Keep old files around
m_deleteLegacyAfterMigration = false;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2014-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-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
@ -106,7 +106,7 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, LIB_TABLE* aLibTable,
m_tree_ctrl->Bind( wxEVT_DATAVIEW_SELECTION_CHANGED, &LIB_TREE::onTreeSelect, this );
m_tree_ctrl->Bind( wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, &LIB_TREE::onContextMenu, this );
Bind( COMPONENT_PRESELECTED, &LIB_TREE::onPreselect, this );
Bind( SYMBOL_PRESELECTED, &LIB_TREE::onPreselect, this );
// If wxTextCtrl::SetHint() is called before binding wxEVT_TEXT, the event
// handler will intermittently fire.
@ -271,14 +271,14 @@ void LIB_TREE::expandIfValid( const wxDataViewItem& aTreeId )
void LIB_TREE::postPreselectEvent()
{
wxCommandEvent event( COMPONENT_PRESELECTED );
wxCommandEvent event( SYMBOL_PRESELECTED );
wxPostEvent( this, event );
}
void LIB_TREE::postSelectEvent()
{
wxCommandEvent event( COMPONENT_SELECTED );
wxCommandEvent event( SYMBOL_SELECTED );
wxPostEvent( this, event );
}
@ -367,7 +367,7 @@ void LIB_TREE::onQueryCharHook( wxKeyEvent& aKeyStroke )
toggleExpand( sel );
break;
}
// Intentionally fall through, so the selected component will be treated as the selected one
// Intentionally fall through, so the selected symbol will be treated as the selected one
KI_FALLTHROUGH;
default:
@ -448,5 +448,5 @@ void LIB_TREE::onContextMenu( wxDataViewEvent& aEvent )
}
wxDEFINE_EVENT( COMPONENT_PRESELECTED, wxCommandEvent );
wxDEFINE_EVENT( COMPONENT_SELECTED, wxCommandEvent );
wxDEFINE_EVENT( SYMBOL_PRESELECTED, wxCommandEvent );
wxDEFINE_EVENT( SYMBOL_SELECTED, wxCommandEvent );

View File

@ -43,7 +43,7 @@ void SCH_EDIT_FRAME::mapExistingAnnotation( std::map<wxString, wxString>& aMap )
for( size_t i = 0; i < references.GetCount(); i++ )
{
SCH_COMPONENT* symbol = references[ i ].GetSymbol();
SCH_SYMBOL* symbol = references[ i ].GetSymbol();
SCH_SHEET_PATH* curr_sheetpath = &references[ i ].GetSheetPath();
KIID_PATH curr_full_uuid = curr_sheetpath->Path();
@ -65,7 +65,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool* aA
auto clearSymbolAnnotation =
[&]( EDA_ITEM* aItem, SCH_SCREEN* aScreen, SCH_SHEET_PATH* aSheet )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( aItem );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aItem );
SaveCopyInUndoList( aScreen, symbol, UNDO_REDO::CHANGED, *aAppendUndo );
*aAppendUndo = true;
@ -75,7 +75,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool* aA
auto clearSheetAnnotation =
[&]( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aSheet )
{
for( SCH_ITEM* item : aScreen->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : aScreen->Items().OfType( SCH_SYMBOL_T ) )
clearSymbolAnnotation( item, aScreen, aSheet );
};
@ -104,7 +104,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( ANNOTATE_SCOPE_T aAnnotateScope, bool* aA
for( EDA_ITEM* item : selection.Items() )
{
if( item->Type() == SCH_COMPONENT_T )
if( item->Type() == SCH_SYMBOL_T )
clearSymbolAnnotation( item, screen, &currentSheet );
}
break;
@ -256,7 +256,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
for( size_t i = 0; i < references.GetCount(); i++ )
{
SCH_REFERENCE& ref = references[i];
SCH_COMPONENT* symbol = ref.GetSymbol();
SCH_SYMBOL* symbol = ref.GetSymbol();
SCH_SHEET_PATH* sheet = &ref.GetSheetPath();
SaveCopyInUndoList( sheet->LastScreen(), symbol, UNDO_REDO::CHANGED, appendUndo );

View File

@ -111,7 +111,7 @@ public:
COLLISION collision;
};
AUTOPLACER( SCH_COMPONENT* aSymbol, SCH_SCREEN* aScreen ) :
AUTOPLACER( SCH_SYMBOL* aSymbol, SCH_SCREEN* aScreen ) :
m_screen( aScreen ),
m_symbol( aSymbol )
{
@ -265,7 +265,7 @@ protected:
for( SCH_ITEM* item : m_screen->Items().Overlapping( m_symbol->GetBoundingBox() ) )
{
if( SCH_COMPONENT* candidate = dynamic_cast<SCH_COMPONENT*>( item ) )
if( SCH_SYMBOL* candidate = dynamic_cast<SCH_SYMBOL*>( item ) )
{
if( candidate == m_symbol )
continue;
@ -293,7 +293,7 @@ protected:
{
EDA_RECT item_box;
if( SCH_COMPONENT* item_comp = dynamic_cast<SCH_COMPONENT*>( item ) )
if( SCH_SYMBOL* item_comp = dynamic_cast<SCH_SYMBOL*>( item ) )
item_box = item_comp->GetBodyBoundingBox();
else
item_box = item->GetBoundingBox();
@ -320,8 +320,8 @@ protected:
int orient = m_symbol->GetOrientation();
int orient_angle = orient & 0xff; // enum is a bitmask
bool h_mirrored = ( ( orient & CMP_MIRROR_X )
&& ( orient_angle == CMP_ORIENT_0 || orient_angle == CMP_ORIENT_180 ) );
bool h_mirrored = ( ( orient & SYM_MIRROR_X )
&& ( orient_angle == SYM_ORIENT_0 || orient_angle == SYM_ORIENT_180 ) );
double w = double( m_symbol_bbox.GetWidth() );
double h = double( m_symbol_bbox.GetHeight() );
@ -333,21 +333,21 @@ protected:
// For power symbols, we generally want the label at the top first.
switch( orient_angle )
{
case CMP_ORIENT_0:
case SYM_ORIENT_0:
std::swap( sides[0], sides[1] );
std::swap( sides[1], sides[3] );
// TOP, BOTTOM, RIGHT, LEFT
break;
case CMP_ORIENT_90:
case SYM_ORIENT_90:
std::swap( sides[0], sides[2] );
std::swap( sides[1], sides[2] );
// LEFT, RIGHT, TOP, BOTTOM
break;
case CMP_ORIENT_180:
case SYM_ORIENT_180:
std::swap( sides[0], sides[3] );
// BOTTOM, TOP, LEFT, RIGHT
break;
case CMP_ORIENT_270:
case SYM_ORIENT_270:
std::swap( sides[1], sides[2] );
// RIGHT, LEFT, TOP, BOTTOM
break;
@ -657,7 +657,7 @@ protected:
private:
SCH_SCREEN* m_screen;
SCH_COMPONENT* m_symbol;
SCH_SYMBOL* m_symbol;
std::vector<SCH_FIELD*> m_fields;
std::vector<SCH_ITEM*> m_colliders;
EDA_RECT m_symbol_bbox;
@ -674,7 +674,7 @@ const AUTOPLACER::SIDE AUTOPLACER::SIDE_LEFT( -1, 0 );
const AUTOPLACER::SIDE AUTOPLACER::SIDE_RIGHT( 1, 0 );
void SCH_COMPONENT::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
void SCH_SYMBOL::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
{
if( aManual )
wxASSERT_MSG( aScreen, "A SCH_SCREEN pointer must be given for manual autoplacement" );

View File

@ -25,7 +25,7 @@
/**
* @file component_references_lister.cpp
* @brief functions to create a component flat list and to annotate schematic.
* @brief functions to create a symbol flat list and to annotate schematic.
*/
#include <sch_reference_list.h>
@ -211,7 +211,7 @@ void SCH_REFERENCE_LIST::GetRefsInUse( int aIndex, std::vector< int >& aIdList,
sort( aIdList.begin(), aIdList.end() );
// Ensure each reference number appears only once. If there are components with
// Ensure each reference number appears only once. If there are symbols with
// multiple parts per package the same number will be stored for each part.
std::vector< int >::iterator it = unique( aIdList.begin(), aIdList.end() );
@ -342,8 +342,8 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
size_t originalSize = GetCount();
// For multi units components, store the list of already used full references.
// The algorithm tries to allocate the new reference to components having the same
// For multi units symbols, store the list of already used full references.
// The algorithm tries to allocate the new reference to symbols having the same
// old reference.
// This algo works fine as long as the previous annotation has no duplicates.
// But when a hierarchy is reannotated with this option, the previous anotation can
@ -371,8 +371,8 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
int LastReferenceNumber = 0;
int NumberOfUnits, Unit;
/* calculate index of the first component with the same reference prefix
* than the current component. All components having the same reference
/* calculate index of the first symbol with the same reference prefix
* than the current symbol. All symbols having the same reference
* prefix will receive a reference number with consecutive values:
* IC .. will be set to IC4, IC4, IC5 ...
*/
@ -399,7 +399,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
if( ref_unit.m_flag )
continue;
// Check whether this component is in aLockedUnitMap.
// Check whether this symbol is in aLockedUnitMap.
SCH_REFERENCE_LIST* lockedList = NULL;
for( SCH_MULTI_UNIT_REFERENCE_MAP::value_type& pair : aLockedUnitMap )
{
@ -440,7 +440,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
GetRefsInUse( first, idList, minRefId );
}
// Annotation of one part per package components (trivial case).
// Annotation of one part per package symbols (trivial case).
if( ref_unit.GetLibPart()->GetUnitCount() <= 1 )
{
if( ref_unit.m_isNew )
@ -465,8 +465,8 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
ref_unit.m_flag = 1;
}
// If this component is in aLockedUnitMap, copy the annotation to all
// components that are not it
// If this symbol is in aLockedUnitMap, copy the annotation to all
// symbols that are not it
if( lockedList != NULL )
{
unsigned n_refs = lockedList->GetCount();
@ -477,7 +477,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
if( thisRef.IsSameInstance( ref_unit ) )
{
// This is the component we're currently annotating. Hold the unit!
// This is the symbol we're currently annotating. Hold the unit!
ref_unit.m_unit = thisRef.m_unit;
// lock this new full reference
inUseRefs.insert( buildFullReference( ref_unit ) );
@ -489,7 +489,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
if( thisRef.CompareLibName( ref_unit ) != 0 )
continue;
// Find the matching component
// Find the matching symbol
for( unsigned jj = ii + 1; jj < flatList.size(); jj++ )
{
if( ! thisRef.IsSameInstance( flatList[jj] ) )
@ -497,9 +497,9 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
wxString ref_candidate = buildFullReference( ref_unit, thisRef.m_unit );
// propagate the new reference and unit selection to the "old" component,
// propagate the new reference and unit selection to the "old" symbol,
// if this new full reference is not already used (can happens when initial
// multiunits components have duplicate references)
// multiunits symbols have duplicate references)
if( inUseRefs.find( ref_candidate ) == inUseRefs.end() )
{
flatList[jj].m_numRef = ref_unit.m_numRef;
@ -514,7 +514,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
}
else
{
/* search for others units of this component.
/* search for others units of this symbol.
* we search for others parts that have the same value and the same
* reference prefix (ref without ref number)
*/
@ -528,7 +528,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
if( found >= 0 )
continue; // this unit exists for this reference (unit already annotated)
// Search a component to annotate ( same prefix, same value, not annotated)
// Search a symbol to annotate ( same prefix, same value, not annotated)
for( unsigned jj = ii + 1; jj < flatList.size(); jj++ )
{
auto& cmp_unit = flatList[jj];
@ -552,7 +552,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
if( !cmp_unit.m_isNew )
continue;
// Component without reference number found, annotate it if possible
// Symbol without reference number found, annotate it if possible.
if( cmp_unit.m_unit == Unit )
{
cmp_unit.m_numRef = ref_unit.m_numRef;
@ -617,7 +617,7 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
}
// Error if unit number selected does not exist (greater than the number of units in
// the component). This can happen if a component has changed in a library after a
// the symbol). This can happen if a symbol has changed in a library after a
// previous annotation.
if( std::max( flatList[ii].GetLibPart()->GetUnitCount(), 1 ) < flatList[ii].m_unit )
{
@ -733,13 +733,13 @@ int SCH_REFERENCE_LIST::CheckAnnotation( ANNOTATION_ERROR_HANDLER aHandler )
}
SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aSymbol, LIB_PART* aLibPart,
SCH_REFERENCE::SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_PART* aLibPart,
const SCH_SHEET_PATH& aSheetPath )
{
wxASSERT( aSymbol != NULL );
m_rootSymbol = aSymbol;
m_libPart = aLibPart; // Warning: can be nullptr for orphan components
m_libPart = aLibPart; // 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 );

View File

@ -517,9 +517,9 @@ void CONNECTION_GRAPH::updateItemConnectivity( const SCH_SHEET_PATH& aSheet,
m_items.emplace_back( pin );
}
}
else if( item->Type() == SCH_COMPONENT_T )
else if( item->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
for( SCH_PIN* pin : symbol->GetPins( &aSheet ) )
{

View File

@ -337,7 +337,7 @@ private:
*
* Any item that is stored in the list of items that have a connection point
* at a given (x, y) location will eventually be electrically connected.
* This means that we can't store SCH_COMPONENTs in this map -- we must store
* This means that we can't store SCH_SYMBOLs in this map -- we must store
* a structure that links a specific pin on a symbol back to that symbol: a
* SCH_PIN_CONNECTION. This wrapper class is a convenience for linking a pin
* and symbol to a specific (x, y) point.

View File

@ -46,7 +46,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString& aReference,
const wxString& aSearchText )
{
SCH_SHEET_PATH* sheetWithComponentFound = nullptr;
SCH_COMPONENT* component = nullptr;
SCH_SYMBOL* symbol = nullptr;
wxPoint pos;
SCH_PIN* pin = nullptr;
SCH_SHEET_LIST sheetList;
@ -61,27 +61,27 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString& aReference,
{
SCH_SCREEN* screen = sheet.LastScreen();
for( auto item : screen->Items().OfType( SCH_COMPONENT_T ) )
for( auto item : screen->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* candidate = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* candidate = static_cast<SCH_SYMBOL*>( item );
if( aReference.CmpNoCase( candidate->GetRef( &sheet ) ) == 0 )
{
component = candidate;
symbol = candidate;
sheetWithComponentFound = &sheet;
if( aSearchType == HIGHLIGHT_PIN )
{
// temporary: will be changed if the pin is found.
pos = component->GetPosition();
pin = component->GetPin( aSearchText );
pos = symbol->GetPosition();
pin = symbol->GetPin( aSearchText );
// Ensure we have found the right unit in case of multi-units symbol
if( pin )
{
int unit = pin->GetLibPin()->GetUnit();
if( unit != 0 && unit != component->GetUnit() )
if( unit != 0 && unit != symbol->GetUnit() )
{
pin = nullptr;
continue;
@ -95,8 +95,8 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString& aReference,
}
else
{
pos = component->GetPosition();
foundItem = component;
pos = symbol->GetPosition();
foundItem = symbol;
break;
}
}
@ -109,7 +109,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString& aReference,
CROSS_PROBING_SETTINGS& crossProbingSettings = m_frame->eeconfig()->m_CrossProbing;
if( component )
if( symbol )
{
if( *sheetWithComponentFound != m_frame->GetCurrentSheet() )
{
@ -127,7 +127,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString& aReference,
//#define COMP_1_TO_1_RATIO // Un-comment for normal KiCad full screen zoom cross-probe
#ifdef COMP_1_TO_1_RATIO
// Pass "false" to only include visible fields of component in bbox calculations
EDA_RECT bbox = component->GetBoundingBox( false );
EDA_RECT bbox = symbol->GetBoundingBox( false );
wxSize bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
VECTOR2D screenSize = getView()->GetViewport().GetSize();
@ -145,7 +145,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString& aReference,
#ifndef COMP_1_TO_1_RATIO // Do the scaled zoom
// Pass "false" to only include visible fields of component in bbox calculations
EDA_RECT bbox = component->GetBoundingBox( false );
EDA_RECT bbox = symbol->GetBoundingBox( false );
wxSize bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
VECTOR2D screenSize = getView()->GetViewport().GetSize();
@ -257,7 +257,7 @@ SCH_ITEM* SCH_EDITOR_CONTROL::FindSymbolAndItem( const wxString& aReference,
/* Print diag */
wxString msg;
if( component )
if( symbol )
{
if( aSearchType == HIGHLIGHT_PIN )
{
@ -350,7 +350,7 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( idcmd == nullptr ) // Highlight component only (from CvPcb or Pcbnew)
{
// Highlight component part_ref, or clear Highlight, if part_ref is not existing
editor->FindSymbolAndItem( part_ref, true, HIGHLIGHT_COMPONENT, wxEmptyString );
editor->FindSymbolAndItem( part_ref, true, HIGHLIGHT_SYMBOL, wxEmptyString );
return;
}
@ -365,13 +365,13 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
{
// Highlighting the reference itself isn't actually that useful, and it's harder to
// see. Highlight the parent and display the message.
editor->FindSymbolAndItem( part_ref, true, HIGHLIGHT_COMPONENT, msg );
editor->FindSymbolAndItem( part_ref, true, HIGHLIGHT_SYMBOL, msg );
}
else if( strcmp( idcmd, "$VAL:" ) == 0 )
{
// Highlighting the value itself isn't actually that useful, and it's harder to see.
// Highlight the parent and display the message.
editor->FindSymbolAndItem( part_ref, true, HIGHLIGHT_COMPONENT, msg );
editor->FindSymbolAndItem( part_ref, true, HIGHLIGHT_SYMBOL, msg );
}
else if( strcmp( idcmd, "$PAD:" ) == 0 )
{
@ -379,12 +379,12 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
}
else
{
editor->FindSymbolAndItem( part_ref, true, HIGHLIGHT_COMPONENT, wxEmptyString );
editor->FindSymbolAndItem( part_ref, true, HIGHLIGHT_SYMBOL, wxEmptyString );
}
}
std::string FormatProbeItem( EDA_ITEM* aItem, SCH_COMPONENT* aSymbol )
std::string FormatProbeItem( EDA_ITEM* aItem, SCH_SYMBOL* aSymbol )
{
// This is a keyword followed by a quoted string.
@ -399,8 +399,8 @@ std::string FormatProbeItem( EDA_ITEM* aItem, SCH_COMPONENT* aSymbol )
}
break;
case SCH_COMPONENT_T:
aSymbol = (SCH_COMPONENT*) aItem;
case SCH_SYMBOL_T:
aSymbol = (SCH_SYMBOL*) aItem;
return StrPrintf( "$PART: \"%s\"",
TO_UTF8( aSymbol->GetField( REFERENCE_FIELD )->GetText() ) );
@ -452,7 +452,7 @@ std::string FormatProbeItem( EDA_ITEM* aItem, SCH_COMPONENT* aSymbol )
}
void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* aObjectToSync, SCH_COMPONENT* aLibItem )
void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* aObjectToSync, SCH_SYMBOL* aLibItem )
{
wxASSERT( aObjectToSync ); // fix the caller

View File

@ -49,7 +49,7 @@ bool g_resetFieldPositions[2] = { true, false };
bool g_resetAttributes[2] = { true, false };
DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_COMPONENT* aSymbol,
DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBOL* aSymbol,
MODE aMode ) :
DIALOG_CHANGE_SYMBOLS_BASE( aParent ),
m_symbol( aSymbol),
@ -272,9 +272,9 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
wxCHECK2( screen, continue );
for( SCH_ITEM* item : screen->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : screen->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item );
wxCHECK2( symbol, continue );
@ -379,7 +379,7 @@ void DIALOG_CHANGE_SYMBOLS::onOkButtonClicked( wxCommandEvent& aEvent )
}
bool DIALOG_CHANGE_SYMBOLS::isMatch( SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aInstance )
bool DIALOG_CHANGE_SYMBOLS::isMatch( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aInstance )
{
LIB_ID id;
@ -442,12 +442,12 @@ bool DIALOG_CHANGE_SYMBOLS::processMatchingSymbols()
wxCHECK2( screen, continue );
std::vector<SCH_COMPONENT*> symbols;
std::vector<SCH_SYMBOL*> symbols;
for( SCH_ITEM* item : screen->Items().OfType( SCH_COMPONENT_T ) )
symbols.push_back( static_cast<SCH_COMPONENT*>( item ) );
for( SCH_ITEM* item : screen->Items().OfType( SCH_SYMBOL_T ) )
symbols.push_back( static_cast<SCH_SYMBOL*>( item ) );
for( SCH_COMPONENT* symbol : symbols )
for( SCH_SYMBOL* symbol : symbols )
{
if( !isMatch( symbol, &instance ) )
continue;
@ -474,7 +474,7 @@ bool DIALOG_CHANGE_SYMBOLS::processMatchingSymbols()
}
bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_COMPONENT* aSymbol, const SCH_SHEET_PATH* aInstance,
bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_PATH* aInstance,
const LIB_ID& aNewId, bool aAppendToUndo )
{
wxCHECK( aSymbol, false );

View File

@ -26,7 +26,7 @@
#include <dialog_change_symbols_base.h>
class LIB_ID;
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_EDIT_FRAME;
class SCH_SCREEN;
class SCH_SHEET_PATH;
@ -39,7 +39,7 @@ class DIALOG_CHANGE_SYMBOLS : public DIALOG_CHANGE_SYMBOLS_BASE
public:
enum class MODE { CHANGE = 0, UPDATE };
DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_COMPONENT* aSymbol,
DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBOL* aSymbol,
MODE aMode = MODE::UPDATE );
~DIALOG_CHANGE_SYMBOLS() override;
@ -70,13 +70,13 @@ protected:
private:
void updateFieldsList();
bool isMatch( SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aInstance );
bool isMatch( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aInstance );
bool processMatchingSymbols();
bool processSymbol( SCH_COMPONENT* aSymbol, const SCH_SHEET_PATH* aInstance,
bool processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_PATH* aInstance,
const LIB_ID& aNewId, bool aAppendToUndo );
SCH_COMPONENT* m_symbol;
MODE m_mode;
SCH_SYMBOL* m_symbol;
MODE m_mode;
///< Set of field names that should have values updated
std::set<wxString> m_updateFields;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-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
@ -71,7 +71,7 @@ DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL( SCH_BASE_FRAME* aParent, const wxStr
m_external_browser_requested( false )
{
// Never show footprints in power symbol mode
if( aAdapter->GetFilter() == SYMBOL_TREE_MODEL_ADAPTER::CMP_FILTER_POWER )
if( aAdapter->GetFilter() == SYMBOL_TREE_MODEL_ADAPTER::SYM_FILTER_POWER )
m_show_footprints = false;
wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
@ -201,8 +201,8 @@ DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL( SCH_BASE_FRAME* aParent, const wxStr
Bind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_SYMBOL::OnInitDialog, this );
Bind( wxEVT_TIMER, &DIALOG_CHOOSE_SYMBOL::OnCloseTimer, this, m_dbl_click_timer->GetId() );
Bind( COMPONENT_PRESELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentPreselected, this );
Bind( COMPONENT_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentSelected, this );
Bind( SYMBOL_PRESELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentPreselected, this );
Bind( SYMBOL_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentSelected, this );
if( m_browser_button )
{
@ -228,8 +228,8 @@ DIALOG_CHOOSE_SYMBOL::~DIALOG_CHOOSE_SYMBOL()
{
Unbind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_SYMBOL::OnInitDialog, this );
Unbind( wxEVT_TIMER, &DIALOG_CHOOSE_SYMBOL::OnCloseTimer, this );
Unbind( COMPONENT_PRESELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentPreselected, this );
Unbind( COMPONENT_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentSelected, this );
Unbind( SYMBOL_PRESELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentPreselected, this );
Unbind( SYMBOL_SELECTED, &DIALOG_CHOOSE_SYMBOL::OnComponentSelected, this );
if( m_browser_button )
{
@ -368,7 +368,7 @@ void DIALOG_CHOOSE_SYMBOL::OnUseBrowser( wxCommandEvent& aEvent )
void DIALOG_CHOOSE_SYMBOL::OnCloseTimer( wxTimerEvent& aEvent )
{
// Hack handler because of eaten MouseUp event. See
// DIALOG_CHOOSE_COMPONENT::OnComponentSelected for the beginning
// DIALOG_CHOOSE_SYMBOL::OnComponentSelected for the beginning
// of this spaghetti noodle.
auto state = wxGetMouseState();
@ -549,7 +549,7 @@ void DIALOG_CHOOSE_SYMBOL::OnComponentSelected( wxCommandEvent& aEvent )
// possible (docs are vague). To get around this, we use a one-shot
// timer to schedule the dialog close.
//
// See DIALOG_CHOOSE_COMPONENT::OnCloseTimer for the other end of this
// See DIALOG_CHOOSE_SYMBOL::OnCloseTimer for the other end of this
// spaghetti noodle.
m_dbl_click_timer->StartOnce( DIALOG_CHOOSE_SYMBOL::DblClickDelay );
}
@ -565,4 +565,4 @@ bool DIALOG_CHOOSE_SYMBOL::GetUseAllUnits() const
bool DIALOG_CHOOSE_SYMBOL::GetKeepSymbol() const
{
return m_keepSymbol->GetValue();
}
}

View File

@ -21,8 +21,8 @@
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef DIALOG_CHOOSE_COMPONENT_H
#define DIALOG_CHOOSE_COMPONENT_H
#ifndef DIALOG_CHOOSE_SYMBOL_H
#define DIALOG_CHOOSE_SYMBOL_H
#include "dialog_shim.h"
#include <symbol_tree_model_adapter.h>
@ -55,8 +55,8 @@ class SCH_DRAW_PANEL;
* Dialog class to select a symbol from the libraries. This is the master View class in a
* Model-View-Adapter (mediated MVC) architecture. The other pieces are in:
*
* - Adapter: CMP_TREE_MODEL_ADAPTER in common/cmp_tree_model_adapter.h
* - Model: CMP_TREE_NODE and descendants in common/cmp_tree_model.h
* - Adapter: SYM_TREE_MODEL_ADAPTER in common/cmp_tree_model_adapter.h
* - Model: SYM_TREE_NODE and descendants in common/cmp_tree_model.h
*
* Because everything is tied together in the adapter class, see that file
* for thorough documentation. A simple example usage follows:
@ -94,7 +94,7 @@ public:
*
* @param aParent a SCH_BASE_FRAME parent window.
* @param aTitle Dialog title.
* @param aAdapter SYMBOL_TREE_MODEL_ADAPTER::PTR. See CMP_TREE_MODEL_ADAPTER
* @param aAdapter SYMBOL_TREE_MODEL_ADAPTER::PTR. See SYM_TREE_MODEL_ADAPTER
* for documentation.
* @param aDeMorganConvert preferred deMorgan conversion.
* (TODO: should happen in dialog)
@ -227,4 +227,4 @@ protected:
std::vector<std::pair<int, wxString>> m_field_edits;
};
#endif /* DIALOG_CHOOSE_COMPONENT_H */
#endif /* DIALOG_CHOOSE_SYMBOL_H */

View File

@ -242,33 +242,33 @@ int GRIDCELL_AUTOWRAP_STRINGRENDERER::GetHeight( wxDC& aDC, wxGrid* aGrid, int a
/**
* A helper to handle symbols to edit.
*/
class CMP_CANDIDATE
class SYM_CANDIDATE
{
public:
CMP_CANDIDATE( SCH_COMPONENT* aComponent )
SYM_CANDIDATE( SCH_SYMBOL* aSymbol )
{
m_Component = aComponent;
m_InitialLibId = m_Component->GetLibId().Format();
m_Symbol = aSymbol;
m_InitialLibId = m_Symbol->GetLibId().Format();
m_Row = -1;
m_IsOrphan = false;
m_Screen = nullptr;
}
// Return a string like mylib:symbol_name from the #LIB_ID of the component.
// Return a string like mylib:symbol_name from the #LIB_ID of the symbol.
wxString GetStringLibId()
{
return m_Component->GetLibId().GetUniStringLibId();
return m_Symbol->GetLibId().GetUniStringLibId();
}
// Return a string containing the reference of the component.
// Return a string containing the reference of the symbol.
wxString GetSchematicReference()
{
return m_Reference;
}
SCH_COMPONENT* m_Component; // the schematic component
SCH_SYMBOL* m_Symbol; // the schematic symbol
int m_Row; // the row index in m_grid
SCH_SCREEN* m_Screen; // the screen where m_Component lives
SCH_SCREEN* m_Screen; // the screen where m_Symbol lives
wxString m_Reference; // the schematic reference, only to display it in list
wxString m_InitialLibId; // the Lib Id of the component before any change
bool m_IsOrphan; // true if a component has no corresponding symbol found in libs
@ -344,7 +344,7 @@ private:
bool m_isModified; // set to true if the schematic is modified
std::vector<int> m_OrphansRowIndexes; // list of rows containing orphan lib_id
std::vector<CMP_CANDIDATE> m_components;
std::vector<SYM_CANDIDATE> m_symbols;
GRIDCELL_AUTOWRAP_STRINGRENDERER* m_autoWrapRenderer;
};
@ -373,12 +373,12 @@ DIALOG_EDIT_COMPONENTS_LIBID::~DIALOG_EDIT_COMPONENTS_LIBID()
// A sort compare function to sort components list by LIB_ID and then reference
static bool sort_by_libid( const CMP_CANDIDATE& cmp1, const CMP_CANDIDATE& cmp2 )
static bool sort_by_libid( const SYM_CANDIDATE& cmp1, const SYM_CANDIDATE& cmp2 )
{
if( cmp1.m_Component->GetLibId() == cmp2.m_Component->GetLibId() )
if( cmp1.m_Symbol->GetLibId() == cmp2.m_Symbol->GetLibId() )
return cmp1.m_Reference.Cmp( cmp2.m_Reference ) < 0;
return cmp1.m_Component->GetLibId() < cmp2.m_Component->GetLibId();
return cmp1.m_Symbol->GetLibId() < cmp2.m_Symbol->GetLibId();
}
@ -404,29 +404,29 @@ void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
for( unsigned ii = 0; ii < references.GetCount(); ii++ )
{
SCH_REFERENCE& item = references[ii];
CMP_CANDIDATE candidate( item.GetSymbol() );
SYM_CANDIDATE candidate( item.GetSymbol() );
candidate.m_Screen = item.GetSheetPath().LastScreen();
SCH_SHEET_PATH sheetpath = item.GetSheetPath();
candidate.m_Reference = candidate.m_Component->GetRef( &sheetpath );
int unitcount = candidate.m_Component->GetUnitCount();
candidate.m_Reference = candidate.m_Symbol->GetRef( &sheetpath );
int unitcount = candidate.m_Symbol->GetUnitCount();
candidate.m_IsOrphan = ( unitcount == 0 );
m_components.push_back( candidate );
m_symbols.push_back( candidate );
}
if( m_components.size() == 0 )
if( m_symbols.size() == 0 )
return;
// now sort by lib id to create groups of items having the same lib id
std::sort( m_components.begin(), m_components.end(), sort_by_libid );
std::sort( m_symbols.begin(), m_symbols.end(), sort_by_libid );
// Now, fill m_grid
wxString last_str_libid = m_components.front().GetStringLibId();
wxString last_str_libid = m_symbols.front().GetStringLibId();
int row = 0;
wxString refs;
wxString last_ref;
bool mark_cell = m_components.front().m_IsOrphan;
bool mark_cell = m_symbols.front().m_IsOrphan;
for( auto& cmp : m_components )
for( auto& cmp : m_symbols )
{
wxString str_libid = cmp.GetStringLibId();
@ -709,7 +709,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow()
LIB_ID id;
id.Parse( new_libid, true );
for( CMP_CANDIDATE& cmp : m_components )
for( SYM_CANDIDATE& cmp : m_symbols )
{
if( cmp.m_Row != row )
continue;
@ -735,30 +735,30 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow()
if( symbol == nullptr )
continue;
GetParent()->SaveCopyInUndoList( cmp.m_Screen, cmp.m_Component, UNDO_REDO::CHANGED,
GetParent()->SaveCopyInUndoList( cmp.m_Screen, cmp.m_Symbol, UNDO_REDO::CHANGED,
m_isModified );
m_isModified = true;
cmp.m_Screen->Remove( cmp.m_Component );
SCH_FIELD* value = cmp.m_Component->GetField( VALUE_FIELD );
cmp.m_Screen->Remove( cmp.m_Symbol );
SCH_FIELD* value = cmp.m_Symbol->GetField( VALUE_FIELD );
// If value is a proxy for the itemName then make sure it gets updated
if( cmp.m_Component->GetLibId().GetLibItemName().wx_str() == value->GetText() )
cmp.m_Component->SetValue( id.GetLibItemName().wx_str() );
if( cmp.m_Symbol->GetLibId().GetLibItemName().wx_str() == value->GetText() )
cmp.m_Symbol->SetValue( id.GetLibItemName().wx_str() );
cmp.m_Component->SetLibId( id );
cmp.m_Component->SetLibSymbol( symbol->Flatten().release() );
cmp.m_Screen->Append( cmp.m_Component );
cmp.m_Symbol->SetLibId( id );
cmp.m_Symbol->SetLibSymbol( symbol->Flatten().release() );
cmp.m_Screen->Append( cmp.m_Symbol );
cmp.m_Screen->SetContentModified();
if ( m_checkBoxUpdateFields->IsChecked() )
{
cmp.m_Component->UpdateFields( nullptr,
false, /* update style */
false, /* update ref */
false, /* update other fields */
false, /* reset ref */
true /* reset other fields */ );
cmp.m_Symbol->UpdateFields( nullptr,
false, /* update style */
false, /* update ref */
false, /* update other fields */
false, /* reset ref */
true /* reset other fields */ );
}
}
}

View File

@ -275,7 +275,7 @@ void DIALOG_LABEL_EDITOR::onScintillaCharAdded( wxStyledTextEvent &aEvent )
wxString ref = te->GetRange( refStart, start-1 );
SCH_SHEET_LIST sheets = m_Parent->Schematic().GetSheets();
SCH_REFERENCE_LIST refs;
SCH_COMPONENT* refSymbol = nullptr;
SCH_SYMBOL* refSymbol = nullptr;
sheets.GetSymbols( refs );

View File

@ -230,7 +230,7 @@ bool DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow()
if( m_fieldId == REFERENCE_FIELD )
{
// Test if the reference string is valid:
if( !SCH_COMPONENT::IsReferenceStringValid( m_text ) )
if( !SCH_SYMBOL::IsReferenceStringValid( m_text ) )
{
DisplayError( this, _( "Illegal reference designator value!" ) );
return false;
@ -290,7 +290,7 @@ DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
DIALOG_EDIT_ONE_FIELD( aParent, aTitle, aField ),
m_field( aField )
{
if( aField->GetParent() && aField->GetParent()->Type() == SCH_COMPONENT_T )
if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
{
m_fieldId = aField->GetId();
}
@ -311,14 +311,14 @@ 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_COMPONENT::GetPartRef() here
// The library symbol may have been removed so using SCH_SYMBOL::GetPartRef() 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.
if( aField->GetParent() && aField->GetParent()->Type() == SCH_COMPONENT_T )
if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
{
const SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
const LIB_PART* part = GetParent()->GetLibPart( component->GetLibId(), true );
const SCH_SYMBOL* symbol = (SCH_SYMBOL*) aField->GetParent();
const LIB_PART* part = GetParent()->GetLibPart( symbol->GetLibId(), true );
if( part && part->IsPower() )
m_isPower = true;
@ -375,7 +375,7 @@ void DIALOG_SCH_EDIT_ONE_FIELD::onScintillaCharAdded( wxStyledTextEvent &aEvent
wxString ref = m_StyledTextCtrl->GetRange( refStart, start - 1 );
SCH_SHEET_LIST sheets = editFrame->Schematic().GetSheets();
SCH_REFERENCE_LIST refs;
SCH_COMPONENT* refSymbol = nullptr;
SCH_SYMBOL* refSymbol = nullptr;
sheets.GetSymbols( refs );
@ -396,8 +396,8 @@ void DIALOG_SCH_EDIT_ONE_FIELD::onScintillaCharAdded( wxStyledTextEvent &aEvent
{
partial = m_StyledTextCtrl->GetTextRange( start, pos );
SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( m_field->GetParent() );
SCH_SHEET* sheet = dynamic_cast<SCH_SHEET*>( m_field->GetParent() );
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( m_field->GetParent() );
SCH_SHEET* sheet = dynamic_cast<SCH_SHEET*>( m_field->GetParent() );
if( symbol )
{
@ -427,9 +427,9 @@ void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH*
SCH_ITEM* parent = dynamic_cast<SCH_ITEM*>( aField->GetParent() );
int fieldType = aField->GetId();
if( parent && parent->Type() == SCH_COMPONENT_T )
if( parent && parent->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( parent );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( parent );
if( fieldType == REFERENCE_FIELD )
symbol->SetRef( aSheetPath, m_text );
@ -461,9 +461,9 @@ void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH*
// The value, footprint and datasheet fields should be kept in sync in multi-unit parts.
// Of course the component must be annotated to collect other units.
if( editFrame && parent && parent->Type() == SCH_COMPONENT_T )
if( editFrame && parent && parent->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( parent );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( parent );
if( symbol->IsAnnotated( aSheetPath ) && ( fieldType == VALUE_FIELD
|| fieldType == FOOTPRINT_FIELD
@ -475,13 +475,13 @@ void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH*
for( SCH_SHEET_PATH& sheet : editFrame->Schematic().GetSheets() )
{
SCH_SCREEN* screen = sheet.LastScreen();
std::vector<SCH_COMPONENT*> otherUnits;
constexpr bool appendUndo = true;
SCH_SCREEN* screen = sheet.LastScreen();
std::vector<SCH_SYMBOL*> otherUnits;
constexpr bool appendUndo = true;
CollectOtherUnits( ref, unit, libId, sheet, &otherUnits );
for( SCH_COMPONENT* otherUnit : otherUnits )
for( SCH_SYMBOL* otherUnit : otherUnits )
{
editFrame->SaveCopyInUndoList( screen, otherUnit, UNDO_REDO::CHANGED,
appendUndo );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Oliver Walters
* Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-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
@ -205,8 +205,9 @@ public:
for( unsigned i = 0; i < m_symbolsList.GetCount(); ++i )
{
SCH_COMPONENT* symbol = m_symbolsList[ i ].GetSymbol();
m_dataStore[ symbol->m_Uuid ][ aFieldName ] = symbol->GetFieldText( aFieldName, m_frame );
SCH_SYMBOL* symbol = m_symbolsList[ i ].GetSymbol();
m_dataStore[ symbol->m_Uuid ][ aFieldName ] = symbol->GetFieldText( aFieldName,
m_frame );
}
}
@ -589,8 +590,8 @@ public:
{
for( unsigned i = 0; i < m_symbolsList.GetCount(); ++i )
{
SCH_COMPONENT& symbol = *m_symbolsList[ i ].GetSymbol();
SCH_SCREEN* screen = m_symbolsList[i].GetSheetPath().LastScreen();
SCH_SYMBOL& symbol = *m_symbolsList[ i ].GetSymbol();
SCH_SCREEN* screen = m_symbolsList[i].GetSheetPath().LastScreen();
m_frame->SaveCopyInUndoList( screen, &symbol, UNDO_REDO::CHANGED, true );
@ -840,16 +841,16 @@ bool DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataToWindow()
TOOL_MANAGER* toolMgr = m_parent->GetToolManager();
EE_SELECTION_TOOL* selectionTool = toolMgr->GetTool<EE_SELECTION_TOOL>();
EE_SELECTION& selection = selectionTool->GetSelection();
SCH_COMPONENT* symbol = nullptr;
SCH_SYMBOL* symbol = nullptr;
if( selection.GetSize() == 1 )
{
EDA_ITEM* item = selection.Front();
if( item->Type() == SCH_COMPONENT_T )
symbol = (SCH_COMPONENT*) item;
else if( item->GetParent() && item->GetParent()->Type() == SCH_COMPONENT_T )
symbol = (SCH_COMPONENT*) item->GetParent();
if( item->Type() == SCH_SYMBOL_T )
symbol = (SCH_SYMBOL*) item;
else if( item->GetParent() && item->GetParent()->Type() == SCH_SYMBOL_T )
symbol = (SCH_SYMBOL*) item->GetParent();
}
if( symbol )
@ -943,7 +944,7 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::LoadFieldNames()
for( unsigned i = 0; i < m_symbolsList.GetCount(); ++i )
{
SCH_COMPONENT* symbol = m_symbolsList[ i ].GetSymbol();
SCH_SYMBOL* symbol = m_symbolsList[ i ].GetSymbol();
for( int j = MANDATORY_FIELDS; j < symbol->GetFieldCount(); ++j )
userFieldNames.insert( symbol->GetFields()[j].GetName() );
@ -1148,7 +1149,7 @@ void DIALOG_FIELDS_EDITOR_GLOBAL::OnTableCellClick( wxGridEvent& event )
SCH_EDITOR_CONTROL* editor = m_parent->GetToolManager()->GetTool<SCH_EDITOR_CONTROL>();
editor->FindSymbolAndItem( refs[ 0 ].GetRef() + refs[ 0 ].GetRefNumber(), true,
HIGHLIGHT_COMPONENT, wxEmptyString );
HIGHLIGHT_SYMBOL, wxEmptyString );
}
}
else

View File

@ -302,9 +302,9 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
if( m_referenceFilterOpt->GetValue() && !m_referenceFilter->GetValue().IsEmpty() )
{
if( aItem->Type() == SCH_COMPONENT_T )
if( aItem->Type() == SCH_SYMBOL_T )
{
wxString ref = static_cast<SCH_COMPONENT*>( aItem )->GetRef( &aSheetPath );
wxString ref = static_cast<SCH_SYMBOL*>( aItem )->GetRef( &aSheetPath );
if( !WildCompareString( m_referenceFilter->GetValue(), ref, false ) )
return;
@ -313,9 +313,9 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
if( m_symbolFilterOpt->GetValue() && !m_symbolFilter->GetValue().IsEmpty() )
{
if( aItem->Type() == SCH_COMPONENT_T )
if( aItem->Type() == SCH_SYMBOL_T )
{
wxString id = static_cast<SCH_COMPONENT*>( aItem )->GetLibId().Format();
wxString id = static_cast<SCH_SYMBOL*>( aItem )->GetLibId().Format();
if( !WildCompareString( m_symbolFilter->GetValue(), id, false ) )
return;
@ -324,9 +324,9 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
if( m_typeFilterOpt->GetValue() )
{
if( aItem->Type() == SCH_COMPONENT_T )
if( aItem->Type() == SCH_SYMBOL_T )
{
bool isPower = static_cast<SCH_COMPONENT*>( aItem )->GetPartRef()->IsPower();
bool isPower = static_cast<SCH_SYMBOL*>( aItem )->GetPartRef()->IsPower();
if( isPower != ( m_typeFilter->GetSelection() == 1 ) )
return;
@ -337,9 +337,9 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
static KICAD_T busTypes[] = { SCH_LINE_LOCATE_BUS_T, SCH_LABEL_LOCATE_BUS_T, EOT };
static KICAD_T schTextAndGraphics[] = { SCH_TEXT_T, SCH_LINE_LOCATE_GRAPHIC_LINE_T, EOT };
if( aItem->Type() == SCH_COMPONENT_T )
if( aItem->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* symbol = (SCH_COMPONENT*) aItem;
SCH_SYMBOL* symbol = (SCH_SYMBOL*) aItem;
if( m_references->GetValue() )
processItem( aSheetPath, symbol->GetField( REFERENCE_FIELD ), aItem );

View File

@ -222,7 +222,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::Validate()
// Alias symbol reference can be empty because it inherits from the parent symbol.
if( m_libEntry->IsRoot() &&
!SCH_COMPONENT::IsReferenceStringValid( m_fields->at( REFERENCE_FIELD ).GetText() ) )
!SCH_SYMBOL::IsReferenceStringValid( m_fields->at( REFERENCE_FIELD ).GetText() ) )
{
if( m_NoteBook->GetSelection() != 0 )
m_NoteBook->SetSelection( 0 );
@ -564,9 +564,9 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnEditSpiceModel( wxCommandEvent& event )
{
#ifdef KICAD_SPICE
int diff = m_fields->size();
auto cmp = SCH_COMPONENT( *m_libEntry, m_libEntry->GetLibId(), nullptr );
auto symbol = SCH_SYMBOL( *m_libEntry, m_libEntry->GetLibId(), nullptr );
DIALOG_SPICE_MODEL dialog( this, cmp, m_fields );
DIALOG_SPICE_MODEL dialog( this, symbol, m_fields );
if( dialog.ShowModal() != wxID_OK )
return;

View File

@ -214,15 +214,15 @@ void DIALOG_RESCUE_EACH::PopulateInstanceList()
wxVector<wxVariant> data;
int count = 0;
for( SCH_COMPONENT* each_component : *m_Rescuer->GetComponents() )
for( SCH_SYMBOL* eachSymbol : *m_Rescuer->GetSymbols() )
{
if( each_component->GetLibId().Format() != UTF8( selected_part.GetRequestedName() ) )
if( eachSymbol->GetLibId().Format() != UTF8( selected_part.GetRequestedName() ) )
continue;
SCH_FIELD* valueField = each_component->GetField( VALUE_FIELD );
SCH_FIELD* valueField = eachSymbol->GetField( VALUE_FIELD );
data.clear();
data.push_back( each_component->GetRef( m_currentSheet ) );
data.push_back( eachSymbol->GetRef( m_currentSheet ) );
data.push_back( valueField ? valueField->GetText() : wxT( "" ) );
m_ListOfInstances->AppendItem( data );
count++;

View File

@ -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.
* Copyright (C) 2016-2017 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
@ -47,7 +47,8 @@ static bool empty( const wxTextCtrl* aCtrl )
// Function to sort PWL values list
static int wxCALLBACK comparePwlValues( wxIntPtr aItem1, wxIntPtr aItem2, wxIntPtr WXUNUSED( aSortData ) )
static int wxCALLBACK comparePwlValues( wxIntPtr aItem1, wxIntPtr aItem2,
wxIntPtr WXUNUSED( aSortData ) )
{
float* t1 = reinterpret_cast<float*>( &aItem1 );
float* t2 = reinterpret_cast<float*>( &aItem2 );
@ -106,8 +107,9 @@ static int getModelTypeIdx( char aPrimitive )
}
DIALOG_SPICE_MODEL::DIALOG_SPICE_MODEL( wxWindow* aParent, SCH_COMPONENT& aComponent, SCH_FIELDS* aFields )
: DIALOG_SPICE_MODEL_BASE( aParent ), m_component( aComponent ), m_schfields( aFields ),
DIALOG_SPICE_MODEL::DIALOG_SPICE_MODEL( wxWindow* aParent, SCH_SYMBOL& aSymbol,
SCH_FIELDS* aFields )
: DIALOG_SPICE_MODEL_BASE( aParent ), m_symbol( aSymbol ), m_schfields( aFields ),
m_libfields( nullptr ), m_useSchFields( true ),
m_spiceEmptyValidator( true ), m_notEmptyValidator( wxFILTER_EMPTY )
{
@ -115,10 +117,10 @@ DIALOG_SPICE_MODEL::DIALOG_SPICE_MODEL( wxWindow* aParent, SCH_COMPONENT& aCompo
}
DIALOG_SPICE_MODEL::DIALOG_SPICE_MODEL( wxWindow* aParent, SCH_COMPONENT& aComponent,
DIALOG_SPICE_MODEL::DIALOG_SPICE_MODEL( wxWindow* aParent, SCH_SYMBOL& aSymbol,
std::vector<LIB_FIELD>* aFields ) :
DIALOG_SPICE_MODEL_BASE( aParent ),
m_component( aComponent ),
m_symbol( aSymbol ),
m_schfields( nullptr ),
m_libfields( aFields ),
m_useSchFields( false ),
@ -257,7 +259,6 @@ bool DIALOG_SPICE_MODEL::TransferDataFromWindow()
m_fieldsTmp[SF_MODEL] = m_pasValue->GetValue();
}
// Model
else if( page == m_model )
{
@ -274,9 +275,7 @@ bool DIALOG_SPICE_MODEL::TransferDataFromWindow()
if( !empty( m_modelLibrary ) )
m_fieldsTmp[SF_LIB_FILE] = m_modelLibrary->GetValue();
}
// Power source
else if( page == m_power )
else if( page == m_power ) // Power source
{
wxString model;
@ -286,8 +285,6 @@ bool DIALOG_SPICE_MODEL::TransferDataFromWindow()
m_fieldsTmp[SF_PRIMITIVE] = (char)( m_pwrType->GetSelection() ? SP_ISOURCE : SP_VSOURCE );
m_fieldsTmp[SF_MODEL] = model;
}
else
{
wxASSERT_MSG( false, "Unhandled model type" );
@ -310,7 +307,8 @@ bool DIALOG_SPICE_MODEL::TransferDataFromWindow()
else
{
// Erase empty fields (having empty fields causes a warning in the properties dialog)
const wxString& spiceField = NETLIST_EXPORTER_PSPICE::GetSpiceFieldName( (SPICE_FIELD) i );
const wxString& spiceField =
NETLIST_EXPORTER_PSPICE::GetSpiceFieldName( (SPICE_FIELD ) i );
if( m_useSchFields )
{
@ -346,8 +344,9 @@ bool DIALOG_SPICE_MODEL::TransferDataToWindow()
{
const wxString& spiceField = spiceFields[idx];
m_fieldsTmp[idx] = NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( (SPICE_FIELD) idx, &m_component,
NET_ADJUST_INCLUDE_PATHS | NET_ADJUST_PASSIVE_VALS );
m_fieldsTmp[idx] = NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal(
(SPICE_FIELD ) idx, &m_symbol,
NET_ADJUST_INCLUDE_PATHS | NET_ADJUST_PASSIVE_VALS );
// Do not modify the existing value, just add missing fields with default values
if( m_useSchFields && m_schfields )
@ -361,7 +360,7 @@ bool DIALOG_SPICE_MODEL::TransferDataToWindow()
}
}
}
else if( m_libfields)
else if( m_libfields )
{
// TODO: There must be a good way to template out these repetitive calls
for( const LIB_FIELD& field : *m_libfields )
@ -427,7 +426,7 @@ bool DIALOG_SPICE_MODEL::TransferDataToWindow()
// Check if node sequence is different than the default one
if( m_fieldsTmp[SF_NODE_SEQUENCE]
!= NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SF_NODE_SEQUENCE, &m_component, 0 ) )
!= NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SF_NODE_SEQUENCE, &m_symbol, 0 ) )
{
m_nodeSeqCheck->SetValue( true );
m_nodeSeqVal->SetValue( m_fieldsTmp[SF_NODE_SEQUENCE] );
@ -540,15 +539,14 @@ bool DIALOG_SPICE_MODEL::parsePowerSource( const wxString& aModel )
genericControls = { m_pulseInit, m_pulseNominal, m_pulseDelay,
m_pulseRise, m_pulseFall, m_pulseWidth, m_pulsePeriod };
}
else if( tkn == "sin" )
{
m_powerNotebook->SetSelection( m_powerNotebook->FindPage( m_pwrSin ) );
genericProcessing = true;
genericReqParamsCount = 2;
genericControls = { m_sinOffset, m_sinAmplitude, m_sinFreq, m_sinDelay, m_sinDampFactor };
genericControls = { m_sinOffset, m_sinAmplitude, m_sinFreq, m_sinDelay,
m_sinDampFactor };
}
else if( tkn == "exp" )
{
@ -673,7 +671,8 @@ bool DIALOG_SPICE_MODEL::generatePowerSource( wxString& aTarget ) const
try
{
if( !empty( m_genDc ) )
acdc += wxString::Format( "dc %s ", SPICE_VALUE( m_genDc->GetValue() ).ToSpiceString() );
acdc += wxString::Format( "dc %s ",
SPICE_VALUE( m_genDc->GetValue() ).ToSpiceString() );
}
catch( ... )
{
@ -685,10 +684,12 @@ bool DIALOG_SPICE_MODEL::generatePowerSource( wxString& aTarget ) const
{
if( !empty( m_genAcMag ) )
{
acdc += wxString::Format( "ac %s ", SPICE_VALUE( m_genAcMag->GetValue() ).ToSpiceString() );
acdc += wxString::Format( "ac %s ",
SPICE_VALUE( m_genAcMag->GetValue() ).ToSpiceString() );
if( !empty( m_genAcPhase ) )
acdc += wxString::Format( "%s ", SPICE_VALUE( m_genAcPhase->GetValue() ).ToSpiceString() );
acdc += wxString::Format( "%s ",
SPICE_VALUE( m_genAcPhase->GetValue() ).ToSpiceString() );
}
}
catch( ... )
@ -792,26 +793,26 @@ bool DIALOG_SPICE_MODEL::generatePowerSource( wxString& aTarget ) const
// all empty
useTrans = false;
}
else if( std::distance( genericControls.begin(), first_empty ) < (int)genericReqParamsCount )
else if( std::distance( genericControls.begin(),
first_empty ) < (int)genericReqParamsCount )
{
DisplayError( nullptr,
wxString::Format( wxT( "You need to specify at least the "
"first %d parameters for the transient source" ),
genericReqParamsCount ) );
wxString::Format( _( "You need to specify at least the "
"first %d parameters for the transient source" ),
genericReqParamsCount ) );
return false;
}
else if( std::find_if_not( first_empty, genericControls.end(),
empty ) != genericControls.end() )
empty ) != genericControls.end() )
{
DisplayError( nullptr, wxT( "You cannot leave interleaved empty fields "
"when defining a transient source" ) );
DisplayError( nullptr, _( "You cannot leave interleaved empty fields "
"when defining a transient source" ) );
return false;
}
else
{
std::for_each( genericControls.begin(), first_empty,
[&trans] ( wxTextCtrl* ctrl ) {
std::for_each( genericControls.begin(), first_empty, [&trans] ( wxTextCtrl* ctrl ) {
trans += wxString::Format( "%s ", ctrl->GetValue() );
} );
}
@ -939,9 +940,11 @@ void DIALOG_SPICE_MODEL::loadLibrary( const wxString& aFilePath )
SCH_FIELD& DIALOG_SPICE_MODEL::getSchField( int aFieldType )
{
const wxString& spiceField = NETLIST_EXPORTER_PSPICE::GetSpiceFieldName( (SPICE_FIELD) aFieldType );
const wxString& spiceField =
NETLIST_EXPORTER_PSPICE::GetSpiceFieldName( (SPICE_FIELD) aFieldType );
auto fieldIt = std::find_if( m_schfields->begin(), m_schfields->end(), [&]( const SCH_FIELD& f ) {
auto fieldIt = std::find_if( m_schfields->begin(), m_schfields->end(),
[&]( const SCH_FIELD& f ) {
return f.GetName() == spiceField;
} );
@ -950,14 +953,15 @@ SCH_FIELD& DIALOG_SPICE_MODEL::getSchField( int aFieldType )
return *fieldIt;
// Create a new field with requested name
m_schfields->emplace_back( wxPoint(), m_schfields->size(), &m_component, spiceField );
m_schfields->emplace_back( wxPoint(), m_schfields->size(), &m_symbol, spiceField );
return m_schfields->back();
}
LIB_FIELD& DIALOG_SPICE_MODEL::getLibField( int aFieldType )
{
const wxString& spiceField = NETLIST_EXPORTER_PSPICE::GetSpiceFieldName( (SPICE_FIELD) aFieldType );
const wxString& spiceField =
NETLIST_EXPORTER_PSPICE::GetSpiceFieldName( ( SPICE_FIELD ) aFieldType );
auto fieldIt = std::find_if( m_libfields->begin(), m_libfields->end(),
[&]( const LIB_FIELD& f )
@ -1023,7 +1027,8 @@ void DIALOG_SPICE_MODEL::onSelectLibrary( wxCommandEvent& event )
wxFileName libPath( openDlg.GetPath() );
// Try to convert the path to relative to project
if( libPath.MakeRelativeTo( Prj().GetProjectPath() ) && !libPath.GetFullPath().StartsWith( ".." ) )
if( libPath.MakeRelativeTo( Prj().GetProjectPath() )
&& !libPath.GetFullPath().StartsWith( ".." ) )
m_modelLibrary->SetValue( libPath.GetFullPath() );
else
m_modelLibrary->SetValue( openDlg.GetPath() );

View File

@ -40,9 +40,9 @@
class DIALOG_SPICE_MODEL : public DIALOG_SPICE_MODEL_BASE
{
public:
DIALOG_SPICE_MODEL( wxWindow* aParent, SCH_COMPONENT& aComponent,
DIALOG_SPICE_MODEL( wxWindow* aParent, SCH_SYMBOL& aSymbol,
std::vector<SCH_FIELD>* aSchFields );
DIALOG_SPICE_MODEL( wxWindow* aParent, SCH_COMPONENT& aComponent,
DIALOG_SPICE_MODEL( wxWindow* aParent, SCH_SYMBOL& aSymbol,
std::vector<LIB_FIELD>* aLibFields );
private:
@ -131,7 +131,7 @@ private:
void onTypeSelected( wxCommandEvent& event ) override;
///< Edited component
SCH_COMPONENT& m_component;
SCH_SYMBOL& m_symbol;
///< Fields from the component properties dialog
std::vector<SCH_FIELD>* m_schfields;

View File

@ -274,15 +274,15 @@ public:
DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES( SCH_EDIT_FRAME* aParent,
SCH_COMPONENT* aComponent ) :
SCH_SYMBOL* aSymbol ) :
DIALOG_SYMBOL_PROPERTIES_BASE( aParent ),
m_comp( nullptr ),
m_symbol( nullptr ),
m_part( nullptr ),
m_fields( nullptr ),
m_dataModel( nullptr )
{
m_comp = aComponent;
m_part = m_comp->GetPartRef().get();
m_symbol = aSymbol;
m_part = m_symbol->GetPartRef().get();
// GetPartRef() 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
@ -301,7 +301,7 @@ DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES( SCH_EDIT_FRAME* aParent,
#endif /* not KICAD_SPICE */
// disable some options inside the edit dialog which can cause problems while dragging
if( m_comp->IsDragging() )
if( m_symbol->IsDragging() )
{
m_orientationLabel->Disable();
m_orientationCtrl->Disable();
@ -332,14 +332,14 @@ DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES( SCH_EDIT_FRAME* aParent,
// back and forth when the conversion is changed.)
m_pinTablePage->Disable();
m_pinTablePage->SetToolTip(
_( "Alternate pin assignments are not available for DeMorgan components." ) );
_( "Alternate pin assignments are not available for DeMorgan symbols." ) );
}
else
{
m_dataModel = new SCH_PIN_TABLE_DATA_MODEL();
// Make a copy of the pins for editing
for( const std::unique_ptr<SCH_PIN>& pin : m_comp->GetRawPins() )
for( const std::unique_ptr<SCH_PIN>& pin : m_symbol->GetRawPins() )
m_dataModel->push_back( *pin );
m_dataModel->SortRows( COL_NUMBER, true );
@ -413,12 +413,12 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow()
std::set<wxString> defined;
// Push a copy of each field into m_updateFields
for( int i = 0; i < m_comp->GetFieldCount(); ++i )
for( int i = 0; i < m_symbol->GetFieldCount(); ++i )
{
SCH_FIELD field( m_comp->GetFields()[i] );
SCH_FIELD field( m_symbol->GetFields()[i] );
// change offset to be symbol-relative
field.Offset( -m_comp->GetPosition() );
field.Offset( -m_symbol->GetPosition() );
defined.insert( field.GetName() );
m_fields->push_back( field );
@ -430,7 +430,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow()
{
if( defined.count( templateFieldname.m_Name ) <= 0 )
{
SCH_FIELD field( wxPoint( 0, 0 ), -1, m_comp, templateFieldname.m_Name );
SCH_FIELD field( wxPoint( 0, 0 ), -1, m_symbol, templateFieldname.m_Name );
field.SetVisible( templateFieldname.m_Visible );
m_fields->push_back( field );
}
@ -441,14 +441,14 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow()
m_fieldsGrid->ProcessTableMessage( msg );
AdjustGridColumns( m_fieldsGrid->GetRect().GetWidth() );
// If a multi-unit component, set up the unit selector and interchangeable checkbox.
if( m_comp->GetUnitCount() > 1 )
// If a multi-unit symbol, set up the unit selector and interchangeable checkbox.
if( m_symbol->GetUnitCount() > 1 )
{
for( int ii = 1; ii <= m_comp->GetUnitCount(); ii++ )
for( int ii = 1; ii <= m_symbol->GetUnitCount(); ii++ )
m_unitChoice->Append( LIB_PART::SubReference( ii, false ) );
if( m_comp->GetUnit() <= ( int )m_unitChoice->GetCount() )
m_unitChoice->SetSelection( m_comp->GetUnit() - 1 );
if( m_symbol->GetUnit() <= ( int )m_unitChoice->GetCount() )
m_unitChoice->SetSelection( m_symbol->GetUnit() - 1 );
}
else
{
@ -458,7 +458,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow()
if( m_part && m_part->HasConversion() )
{
if( m_comp->GetConvert() > LIB_ITEM::LIB_CONVERT::BASE )
if( m_symbol->GetConvert() > LIB_ITEM::LIB_CONVERT::BASE )
m_cbAlternateSymbol->SetValue( true );
}
else
@ -467,28 +467,28 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow()
}
// Set the symbol orientation and mirroring.
int orientation = m_comp->GetOrientation() & ~( CMP_MIRROR_X | CMP_MIRROR_Y );
int orientation = m_symbol->GetOrientation() & ~( SYM_MIRROR_X | SYM_MIRROR_Y );
switch( orientation )
{
default:
case CMP_ORIENT_0: m_orientationCtrl->SetSelection( 0 ); break;
case CMP_ORIENT_90: m_orientationCtrl->SetSelection( 1 ); break;
case CMP_ORIENT_270: m_orientationCtrl->SetSelection( 2 ); break;
case CMP_ORIENT_180: m_orientationCtrl->SetSelection( 3 ); break;
case SYM_ORIENT_0: m_orientationCtrl->SetSelection( 0 ); break;
case SYM_ORIENT_90: m_orientationCtrl->SetSelection( 1 ); break;
case SYM_ORIENT_270: m_orientationCtrl->SetSelection( 2 ); break;
case SYM_ORIENT_180: m_orientationCtrl->SetSelection( 3 ); break;
}
int mirror = m_comp->GetOrientation() & ( CMP_MIRROR_X | CMP_MIRROR_Y );
int mirror = m_symbol->GetOrientation() & ( SYM_MIRROR_X | SYM_MIRROR_Y );
switch( mirror )
{
default: m_mirrorCtrl->SetSelection( 0 ) ; break;
case CMP_MIRROR_X: m_mirrorCtrl->SetSelection( 1 ); break;
case CMP_MIRROR_Y: m_mirrorCtrl->SetSelection( 2 ); break;
case SYM_MIRROR_X: m_mirrorCtrl->SetSelection( 1 ); break;
case SYM_MIRROR_Y: m_mirrorCtrl->SetSelection( 2 ); break;
}
m_cbExcludeFromBom->SetValue( !m_comp->GetIncludeInBom() );
m_cbExcludeFromBoard->SetValue( !m_comp->GetIncludeOnBoard() );
m_cbExcludeFromBom->SetValue( !m_symbol->GetIncludeInBom() );
m_cbExcludeFromBoard->SetValue( !m_symbol->GetIncludeOnBoard() );
if( m_part )
{
@ -496,8 +496,8 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow()
m_ShowPinNameButt->SetValue( m_part->ShowPinNames() );
}
// Set the component's library name.
m_tcLibraryID->SetLabelText( m_comp->GetLibId().Format() );
// Set the symbol's library name.
m_tcLibraryID->SetLabelText( m_symbol->GetLibId().Format() );
Layout();
@ -518,7 +518,7 @@ void DIALOG_SYMBOL_PROPERTIES::OnEditSpiceModel( wxCommandEvent& event )
#ifdef KICAD_SPICE
int diff = m_fields->size();
DIALOG_SPICE_MODEL dialog( this, *m_comp, m_fields );
DIALOG_SPICE_MODEL dialog( this, *m_symbol, m_fields );
if( dialog.ShowModal() != wxID_OK )
return;
@ -557,7 +557,7 @@ bool DIALOG_SYMBOL_PROPERTIES::Validate()
if( !m_fieldsGrid->CommitPendingChanges() || !m_fieldsGrid->Validate() )
return false;
if( !SCH_COMPONENT::IsReferenceStringValid( m_fields->at( REFERENCE_FIELD ).GetText() ) )
if( !SCH_SYMBOL::IsReferenceStringValid( m_fields->at( REFERENCE_FIELD ).GetText() ) )
{
DisplayErrorMessage( this, _( "References must start with a letter." ) );
@ -608,41 +608,41 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
// This needs to be done before the LIB_ID is changed to prevent stale library symbols in
// the schematic file.
currentScreen->Remove( m_comp );
currentScreen->Remove( m_symbol );
wxString msg;
// save old cmp in undo list if not already in edit, or moving ...
if( m_comp->GetEditFlags() == 0 )
GetParent()->SaveCopyInUndoList( currentScreen, m_comp, UNDO_REDO::CHANGED, false );
if( m_symbol->GetEditFlags() == 0 )
GetParent()->SaveCopyInUndoList( currentScreen, m_symbol, UNDO_REDO::CHANGED, false );
// Save current flags which could be modified by next change settings
EDA_ITEM_FLAGS flags = m_comp->GetFlags();
EDA_ITEM_FLAGS flags = m_symbol->GetFlags();
// For symbols with multiple shapes (De Morgan representation) Set the selected shape:
if( m_cbAlternateSymbol->IsEnabled() && m_cbAlternateSymbol->GetValue() )
m_comp->SetConvert( LIB_ITEM::LIB_CONVERT::DEMORGAN );
m_symbol->SetConvert( LIB_ITEM::LIB_CONVERT::DEMORGAN );
else
m_comp->SetConvert( LIB_ITEM::LIB_CONVERT::BASE );
m_symbol->SetConvert( LIB_ITEM::LIB_CONVERT::BASE );
//Set the part selection in multiple part per package
int unit_selection = m_unitChoice->IsEnabled() ? m_unitChoice->GetSelection() + 1 : 1;
m_comp->SetUnitSelection( &GetParent()->GetCurrentSheet(), unit_selection );
m_comp->SetUnit( unit_selection );
m_symbol->SetUnitSelection( &GetParent()->GetCurrentSheet(), unit_selection );
m_symbol->SetUnit( unit_selection );
switch( m_orientationCtrl->GetSelection() )
{
case 0: m_comp->SetOrientation( CMP_ORIENT_0 ); break;
case 1: m_comp->SetOrientation( CMP_ORIENT_90 ); break;
case 2: m_comp->SetOrientation( CMP_ORIENT_270 ); break;
case 3: m_comp->SetOrientation( CMP_ORIENT_180 ); break;
case 0: m_symbol->SetOrientation( SYM_ORIENT_0 ); break;
case 1: m_symbol->SetOrientation( SYM_ORIENT_90 ); break;
case 2: m_symbol->SetOrientation( SYM_ORIENT_270 ); break;
case 3: m_symbol->SetOrientation( SYM_ORIENT_180 ); break;
}
switch( m_mirrorCtrl->GetSelection() )
{
case 0: break;
case 1: m_comp->SetOrientation( CMP_MIRROR_X ); break;
case 2: m_comp->SetOrientation( CMP_MIRROR_Y ); break;
case 1: m_symbol->SetOrientation( SYM_MIRROR_X ); break;
case 2: m_symbol->SetOrientation( SYM_MIRROR_Y ); break;
}
if( m_part )
@ -652,21 +652,21 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
}
// Restore m_Flag modified by SetUnit() and other change settings
m_comp->ClearFlags();
m_comp->SetFlags( flags );
m_symbol->ClearFlags();
m_symbol->SetFlags( flags );
// change all field positions from relative to absolute
for( unsigned i = 0; i < m_fields->size(); ++i )
m_fields->at( i ).Offset( m_comp->GetPosition() );
m_fields->at( i ).Offset( m_symbol->GetPosition() );
LIB_PART* entry = GetParent()->GetLibPart( m_comp->GetLibId() );
LIB_PART* entry = GetParent()->GetLibPart( m_symbol->GetLibId() );
if( entry && entry->IsPower() )
m_fields->at( VALUE_FIELD ).SetText( m_comp->GetLibId().GetLibItemName() );
m_fields->at( VALUE_FIELD ).SetText( m_symbol->GetLibId().GetLibItemName() );
// Push all fields to the component -except- for those which are TEMPLATE_FIELDNAMES
// Push all fields to the symbol -except- for those which are TEMPLATE_FIELDNAMES
// with empty values.
SCH_FIELDS& fields = m_comp->GetFields();
SCH_FIELDS& fields = m_symbol->GetFields();
fields.clear();
@ -693,35 +693,35 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
}
// Reference has a specific initialization, depending on the current active sheet
// because for a given component, in a complex hierarchy, there are more than one
// because for a given symbol, in a complex hierarchy, there are more than one
// reference.
m_comp->SetRef( &GetParent()->GetCurrentSheet(), m_fields->at( REFERENCE_FIELD ).GetText() );
m_symbol->SetRef( &GetParent()->GetCurrentSheet(), m_fields->at( REFERENCE_FIELD ).GetText() );
// Similar for Value and Footprint, except that the GUI behaviour is that they are kept
// in sync between multiple instances.
m_comp->SetValue( m_fields->at( VALUE_FIELD ).GetText() );
m_comp->SetFootprint( m_fields->at( FOOTPRINT_FIELD ).GetText() );
m_symbol->SetValue( m_fields->at( VALUE_FIELD ).GetText() );
m_symbol->SetFootprint( m_fields->at( FOOTPRINT_FIELD ).GetText() );
m_comp->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
m_comp->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() );
m_symbol->SetIncludeInBom( !m_cbExcludeFromBom->IsChecked() );
m_symbol->SetIncludeOnBoard( !m_cbExcludeFromBoard->IsChecked() );
// The value, footprint and datasheet fields and exclude from bill of materials setting
// should be kept in sync in multi-unit parts.
if( m_comp->GetUnitCount() > 1 && m_comp->IsAnnotated( &GetParent()->GetCurrentSheet() ) )
if( m_symbol->GetUnitCount() > 1 && m_symbol->IsAnnotated( &GetParent()->GetCurrentSheet() ) )
{
wxString ref = m_comp->GetRef( &GetParent()->GetCurrentSheet() );
int unit = m_comp->GetUnit();
LIB_ID libId = m_comp->GetLibId();
wxString ref = m_symbol->GetRef( &GetParent()->GetCurrentSheet() );
int unit = m_symbol->GetUnit();
LIB_ID libId = m_symbol->GetLibId();
for( SCH_SHEET_PATH& sheet : GetParent()->Schematic().GetSheets() )
{
SCH_SCREEN* screen = sheet.LastScreen();
std::vector<SCH_COMPONENT*> otherUnits;
constexpr bool appendUndo = true;
SCH_SCREEN* screen = sheet.LastScreen();
std::vector<SCH_SYMBOL*> otherUnits;
constexpr bool appendUndo = true;
CollectOtherUnits( ref, unit, libId, sheet, &otherUnits );
for( SCH_COMPONENT* otherUnit : otherUnits )
for( SCH_SYMBOL* otherUnit : otherUnits )
{
GetParent()->SaveCopyInUndoList( screen, otherUnit, UNDO_REDO::CHANGED,
appendUndo );
@ -740,15 +740,15 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
{
for( const SCH_PIN& model_pin : *m_dataModel )
{
// map from the edited copy back to the "real" pin in the component
SCH_PIN* src_pin = m_comp->GetPin( model_pin.GetLibPin() );
// map from the edited copy back to the "real" pin in the symbol.
SCH_PIN* src_pin = m_symbol->GetPin( model_pin.GetLibPin() );
src_pin->SetAlt( model_pin.GetAlt() );
}
}
currentScreen->Append( m_comp );
currentScreen->Append( m_symbol );
GetParent()->TestDanglingEnds();
GetParent()->UpdateItem( m_comp );
GetParent()->UpdateItem( m_symbol );
GetParent()->OnModify();
// This must go after OnModify() so that the connectivity graph will have been updated.
@ -807,9 +807,9 @@ void DIALOG_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event )
if( !m_fieldsGrid->CommitPendingChanges() )
return;
SCHEMATIC_SETTINGS& settings = m_comp->Schematic()->Settings();
SCHEMATIC_SETTINGS& settings = m_symbol->Schematic()->Settings();
int fieldID = m_fields->size();
SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_comp,
SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_symbol,
TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID ) );
newField.SetTextAngle( m_fields->at( REFERENCE_FIELD ).GetTextAngle() );

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2019 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
@ -47,7 +47,7 @@ enum SYMBOL_PROPS_RETVALUE
/**
* Dialog used to edit #SCH_COMPONENT objects in a schematic.
* Dialog used to edit #SCH_SYMBOL objects in a schematic.
*
* This is derived from DIALOG_SYMBOL_PROPERTIES_BASE which is maintained by
* wxFormBuilder.
@ -55,7 +55,7 @@ enum SYMBOL_PROPS_RETVALUE
class DIALOG_SYMBOL_PROPERTIES : public DIALOG_SYMBOL_PROPERTIES_BASE
{
public:
DIALOG_SYMBOL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_COMPONENT* aComponent );
DIALOG_SYMBOL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_SYMBOL* aSymbol );
~DIALOG_SYMBOL_PROPERTIES() override;
SCH_EDIT_FRAME* GetParent();
@ -89,7 +89,7 @@ private:
void AdjustGridColumns( int aWidth );
private:
SCH_COMPONENT* m_comp;
SCH_SYMBOL* m_symbol;
LIB_PART* m_part;
int m_width;

View File

@ -238,7 +238,8 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter )
aReporter.ReportTail( msg, RPT_SEVERITY_ERROR );
}
aReporter.ReportTail( _( "Created project symbol library table.\n" ), RPT_SEVERITY_INFO );
aReporter.ReportTail( _( "Created project symbol library table.\n" ),
RPT_SEVERITY_INFO );
}
}
}
@ -248,14 +249,14 @@ void DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable( REPORTER& aReporter )
{
wxString msg;
SCH_SCREENS schematic( m_frame->Schematic().Root() );
SCH_COMPONENT* symbol;
SCH_SYMBOL* symbol;
SCH_SCREEN* screen;
for( screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
{
for( auto item : screen->Items().OfType( SCH_COMPONENT_T ) )
for( auto item : screen->Items().OfType( SCH_SYMBOL_T ) )
{
symbol = dynamic_cast<SCH_COMPONENT*>( item );
symbol = dynamic_cast<SCH_SYMBOL*>( item );
if( !remapSymbolToLibTable( symbol ) )
{
@ -279,7 +280,7 @@ void DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable( REPORTER& aReporter )
}
bool DIALOG_SYMBOL_REMAP::remapSymbolToLibTable( SCH_COMPONENT* aSymbol )
bool DIALOG_SYMBOL_REMAP::remapSymbolToLibTable( SCH_SYMBOL* aSymbol )
{
wxCHECK_MSG( aSymbol != NULL, false, "Null pointer passed to remapSymbolToLibTable." );
wxCHECK_MSG( aSymbol->GetLibId().GetLibNickname().empty(), false,

View File

@ -6,7 +6,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-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
@ -30,7 +30,7 @@
class PART_LIB;
class SCH_COMPONENT;
class SCH_SYMBOL;
class REPORTER;
@ -65,7 +65,7 @@ private:
void remapSymbolsToLibTable( REPORTER& aReporter );
bool remapSymbolToLibTable( SCH_COMPONENT* aSymbol );
bool remapSymbolToLibTable( SCH_SYMBOL* aSymbol );
/**
* Backup all of the files that could be modified by the remapping with a time stamp

View File

@ -48,7 +48,7 @@ const KICAD_T EE_COLLECTOR::EditableItems[] = {
SCH_GLOBAL_LABEL_T,
SCH_HIER_LABEL_T,
SCH_FIELD_T,
SCH_COMPONENT_T,
SCH_SYMBOL_T,
SCH_SHEET_PIN_T,
SCH_SHEET_T,
SCH_BITMAP_T,
@ -60,7 +60,7 @@ const KICAD_T EE_COLLECTOR::EditableItems[] = {
const KICAD_T EE_COLLECTOR::ComponentsOnly[] = {
SCH_COMPONENT_T,
SCH_SYMBOL_T,
EOT
};
@ -85,7 +85,7 @@ const KICAD_T EE_COLLECTOR::MovableItems[] =
SCH_GLOBAL_LABEL_T,
SCH_HIER_LABEL_T,
SCH_FIELD_T,
SCH_COMPONENT_T,
SCH_SYMBOL_T,
SCH_SHEET_PIN_T,
SCH_SHEET_T,
EOT
@ -99,7 +99,7 @@ const KICAD_T EE_COLLECTOR::WiresOnly[] = {
const KICAD_T EE_COLLECTOR::FieldOwners[] = {
SCH_COMPONENT_T,
SCH_SYMBOL_T,
SCH_SHEET_T,
SCH_GLOBAL_LABEL_T,
EOT
@ -156,7 +156,7 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co
{
for( SCH_ITEM* item : aScreen->Items().OfType( *filter ) )
{
if( *filter == SCH_COMPONENT_T || *filter == SCH_LOCATE_ANY_T )
if( *filter == SCH_SYMBOL_T || *filter == SCH_LOCATE_ANY_T )
symbolsVisited = true;
if( *filter == SCH_SHEET_T || *filter == SCH_LOCATE_ANY_T )
@ -171,7 +171,7 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co
if( !symbolsVisited )
{
for( SCH_ITEM* item : aScreen->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : aScreen->Items().OfType( SCH_SYMBOL_T ) )
item->Visit( m_inspector, nullptr, m_scanTypes );
}
@ -232,7 +232,7 @@ bool EE_COLLECTOR::IsCorner() const
void CollectOtherUnits( const wxString& aRef, int aUnit, const LIB_ID& aLibId,
SCH_SHEET_PATH& aSheet, std::vector<SCH_COMPONENT*>* otherUnits )
SCH_SHEET_PATH& aSheet, std::vector<SCH_SYMBOL*>* otherUnits )
{
SCH_REFERENCE_LIST symbols;
aSheet.GetSymbols( symbols );

View File

@ -33,7 +33,7 @@
class SCH_SHEET_PATH;
class SCH_COMPONENT;
class SCH_SYMBOL;
/**
@ -115,6 +115,6 @@ public:
void CollectOtherUnits( const wxString& thisRef, int thisUnit, const LIB_ID& aLibId,
SCH_SHEET_PATH& aSheet, std::vector<SCH_COMPONENT*>* otherUnits );
SCH_SHEET_PATH& aSheet, std::vector<SCH_SYMBOL*>* otherUnits );
#endif // EE_COLLECTORS_H

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2008-2019 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2008-2021 KiCad Developers, see change_log.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
@ -65,7 +65,7 @@ enum id_eeschema_frm
ID_LIBVIEW_PREVIOUS,
ID_LIBVIEW_SELECT_PART_NUMBER,
ID_LIBVIEW_LIB_LIST,
ID_LIBVIEW_CMP_LIST,
ID_LIBVIEW_SYM_LIST,
ID_SIM_RUN,
ID_SIM_TUNE,
@ -87,7 +87,7 @@ enum id_eeschema_frm
ID_POPUP_SCH_SELECT_UNIT1,
// ... leave room for MAX_UNIT_COUNT_PER_PACKAGE IDs ,
// to select one unit among MAX_UNIT_COUNT_PER_PACKAGE in popup menu
ID_POPUP_SCH_SELECT_UNIT_CMP_MAX = ID_POPUP_SCH_SELECT_UNIT1 + MAX_UNIT_COUNT_PER_PACKAGE
ID_POPUP_SCH_SELECT_UNIT_SYM_MAX = ID_POPUP_SCH_SELECT_UNIT1 + MAX_UNIT_COUNT_PER_PACKAGE
};

View File

@ -193,9 +193,9 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
for( SCH_ITEM* item : screen->Items().OfType( SCH_LOCATE_ANY_T ) )
{
if( item->Type() == SCH_COMPONENT_T )
if( item->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
for( SCH_FIELD& field : symbol->GetFields() )
{
@ -205,7 +205,8 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
pos = symbol->GetTransform().TransformCoordinate( pos );
pos += symbol->GetPosition();
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
std::shared_ptr<ERC_ITEM> ercItem =
ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
ercItem->SetItems( &field );
SCH_MARKER* marker = new SCH_MARKER( ercItem, pos );
@ -221,7 +222,8 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
{
if( unresolved( field.GetShownText() ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
std::shared_ptr<ERC_ITEM> ercItem =
ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
ercItem->SetItems( &field );
SCH_MARKER* marker = new SCH_MARKER( ercItem, field.GetPosition() );
@ -233,7 +235,8 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
{
if( pin->GetShownText().Matches( wxT( "*${*}*" ) ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
std::shared_ptr<ERC_ITEM> ercItem =
ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
ercItem->SetItems( pin );
SCH_MARKER* marker = new SCH_MARKER( ercItem, pin->GetPosition() );
@ -245,7 +248,8 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
{
if( text->GetShownText().Matches( wxT( "*${*}*" ) ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
std::shared_ptr<ERC_ITEM> ercItem =
ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
ercItem->SetItems( text );
SCH_MARKER* marker = new SCH_MARKER( ercItem, text->GetPosition() );
@ -260,7 +264,8 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
{
if( text->GetShownText().Matches( wxT( "*${*}*" ) ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
std::shared_ptr<ERC_ITEM> ercItem =
ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
ercItem->SetErrorMessage( _( "Unresolved text variable in drawing sheet." ) );
SCH_MARKER* marker = new SCH_MARKER( ercItem, text->GetPosition() );
@ -335,9 +340,9 @@ int ERC_TESTER::TestMultiunitFootprints()
}
// Reference footprint
SCH_COMPONENT* unit = nullptr;
wxString unitName;
wxString unitFP;
SCH_SYMBOL* unit = nullptr;
wxString unitName;
wxString unitFP;
for( unsigned i = 0; i < refList.GetCount(); ++i )
{
@ -355,7 +360,7 @@ int ERC_TESTER::TestMultiunitFootprints()
for( unsigned i = 0; i < refList.GetCount(); ++i )
{
SCH_REFERENCE& secondRef = refList.GetItem( i );
SCH_COMPONENT* secondUnit = secondRef.GetSymbol();
SCH_SYMBOL* secondUnit = secondRef.GetSymbol();
wxString secondName = secondUnit->GetRef( &secondRef.GetSheetPath(), true );
const wxString secondFp = secondRef.GetFootprint();
wxString msg;
@ -389,9 +394,9 @@ int ERC_TESTER::TestNoConnectPins()
{
std::map<wxPoint, std::vector<SCH_PIN*>> pinMap;
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
for( SCH_PIN* pin : symbol->GetPins( &sheet ) )
{
@ -679,9 +684,9 @@ int ERC_TESTER::TestLibSymbolIssues()
{
std::vector<SCH_MARKER*> markers;
for( SCH_ITEM* item : screen->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : screen->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item );
wxCHECK2( symbol, continue );

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -51,7 +51,7 @@ FIELDS_GRID_TABLE<T>::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* a
m_frame( aFrame ),
m_userUnits( aDialog->GetUserUnits() ),
m_grid( aGrid ),
m_parentType( SCH_COMPONENT_T ),
m_parentType( SCH_SYMBOL_T ),
m_mandatoryFieldCount( MANDATORY_FIELDS ),
m_part( aPart ),
m_fieldNameValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_NAME ),
@ -264,12 +264,12 @@ wxGridCellAttr* FIELDS_GRID_TABLE<T>::GetAttr( int aRow, int aCol, wxGridCellAtt
}
case FDC_VALUE:
if( m_parentType == SCH_COMPONENT_T && aRow == REFERENCE_FIELD )
if( m_parentType == SCH_SYMBOL_T && aRow == REFERENCE_FIELD )
{
m_referenceAttr->IncRef();
return m_referenceAttr;
}
else if( m_parentType == SCH_COMPONENT_T && aRow == VALUE_FIELD )
else if( m_parentType == SCH_SYMBOL_T && aRow == VALUE_FIELD )
{
// For power symbols, the value is not editable, because value and pin name must
// be the same and can be edited only in library editor.
@ -286,12 +286,12 @@ wxGridCellAttr* FIELDS_GRID_TABLE<T>::GetAttr( int aRow, int aCol, wxGridCellAtt
return m_valueAttr;
}
}
else if( m_parentType == SCH_COMPONENT_T && aRow == FOOTPRINT_FIELD )
else if( m_parentType == SCH_SYMBOL_T && aRow == FOOTPRINT_FIELD )
{
m_footprintAttr->IncRef();
return m_footprintAttr;
}
else if( m_parentType == SCH_COMPONENT_T && aRow == DATASHEET_FIELD )
else if( m_parentType == SCH_SYMBOL_T && aRow == DATASHEET_FIELD )
{
m_urlAttr->IncRef();
return m_urlAttr;
@ -372,7 +372,7 @@ wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol )
// according to the current locale
if( aRow < m_mandatoryFieldCount )
{
if( m_parentType == SCH_COMPONENT_T )
if( m_parentType == SCH_SYMBOL_T )
return TEMPLATE_FIELDNAME::GetDefaultFieldName( aRow );
else if( m_parentType == SCH_SHEET_T )
return SCH_SHEET::GetDefaultFieldName( aRow );

View File

@ -117,7 +117,7 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte
adapter->AssignIntrinsicRanks();
if( aFilter->GetFilterPowerParts() )
adapter->SetFilter( SYMBOL_TREE_MODEL_ADAPTER::CMP_FILTER_POWER );
adapter->SetFilter( SYMBOL_TREE_MODEL_ADAPTER::SYM_FILTER_POWER );
}
std::vector< LIB_TREE_ITEM* > history_list;
@ -147,7 +147,7 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte
wxString dialogTitle;
if( adapter->GetFilter() == SYMBOL_TREE_MODEL_ADAPTER::CMP_FILTER_POWER )
if( adapter->GetFilter() == SYMBOL_TREE_MODEL_ADAPTER::SYM_FILTER_POWER )
dialogTitle.Printf( _( "Choose Power Symbol (%d items loaded)" ), adapter->GetItemCount() );
else
dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ), adapter->GetItemCount() );
@ -194,7 +194,7 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte
}
void SCH_EDIT_FRAME::SelectUnit( SCH_COMPONENT* aSymbol, int aUnit )
void SCH_EDIT_FRAME::SelectUnit( SCH_SYMBOL* aSymbol, int aUnit )
{
LIB_PART* part = GetLibPart( aSymbol->GetLibId() );
@ -233,7 +233,7 @@ void SCH_EDIT_FRAME::SelectUnit( SCH_COMPONENT* aSymbol, int aUnit )
}
void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* aSymbol )
void SCH_EDIT_FRAME::ConvertPart( SCH_SYMBOL* aSymbol )
{
if( !aSymbol || !aSymbol->GetPartRef() )
return;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013-2019 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2013-2021 KiCad Developers, see change_log.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
@ -48,7 +48,7 @@ class wxFrame;
class wxDialog;
class LIB_PART;
class PART_LIBS;
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_TEXT;
class SCH_SHEET_PATH;
class RESCUER;

View File

@ -27,8 +27,6 @@
#ifndef CLASS_PIN_H
#define CLASS_PIN_H
class SCH_COMPONENT;
#include <eda_rect.h>
#include <lib_item.h>
#include <pin_type.h>

View File

@ -83,10 +83,10 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
{
for( auto aItem : screen->Items().OfType( SCH_COMPONENT_T ) )
for( auto aItem : screen->Items().OfType( SCH_SYMBOL_T ) )
{
LIB_PART* part = nullptr;
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( aItem );
LIB_PART* part = nullptr;
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aItem );
try
{

View File

@ -70,15 +70,15 @@ wxString NETLIST_EXPORTER_BASE::MakeCommandLine( const wxString& aFormatString,
}
SCH_COMPONENT* NETLIST_EXPORTER_BASE::findNextSymbol( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheetPath )
SCH_SYMBOL* NETLIST_EXPORTER_BASE::findNextSymbol( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheetPath )
{
wxString ref;
if( aItem->Type() != SCH_COMPONENT_T )
if( aItem->Type() != SCH_SYMBOL_T )
return nullptr;
// found next component
SCH_COMPONENT* symbol = (SCH_COMPONENT*) aItem;
SCH_SYMBOL* symbol = (SCH_SYMBOL*) aItem;
// Power symbols and other symbols which have the reference starting with "#" are not
// included in netlist (pseudo or virtual symbols)
@ -118,7 +118,7 @@ static bool sortPinsByNum( PIN_INFO& aPin1, PIN_INFO& aPin2 )
}
void NETLIST_EXPORTER_BASE::CreatePinList( SCH_COMPONENT* aSymbol,
void NETLIST_EXPORTER_BASE::CreatePinList( SCH_SYMBOL* aSymbol,
SCH_SHEET_PATH* aSheetPath,
bool aKeepUnconnectedPins )
{
@ -217,7 +217,7 @@ void NETLIST_EXPORTER_BASE::eraseDuplicatePins()
}
void NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol( SCH_COMPONENT* aSymbol,
void NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol( SCH_SYMBOL* aSymbol,
LIB_PART* aPart, SCH_SHEET_PATH* aSheetPath,
bool aKeepUnconnectedPins )
{
@ -231,9 +231,9 @@ void NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol( SCH_COMPONENT* aSymbol,
{
SCH_SHEET_PATH& sheet = sheetList[i];
for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* comp2 = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* comp2 = static_cast<SCH_SYMBOL*>( item );
ref2 = comp2->GetRef( &sheet );

View File

@ -118,7 +118,8 @@ protected:
* if aKeepUnconnectedPins = false, unconnected pins will be removed from list
* but usually we need all pins in netlists.
*/
void CreatePinList( SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aSheetPath, bool aKeepUnconnectedPins );
void CreatePinList( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPath,
bool aKeepUnconnectedPins );
/**
* Check if the given symbol should be processed for netlisting.
@ -129,7 +130,7 @@ protected:
* @param aSheetPath is the sheet to check the symbol for
* @return the symbol if it should be processed, or nullptr
*/
SCH_COMPONENT* findNextSymbol( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheetPath );
SCH_SYMBOL* findNextSymbol( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheetPath );
/**
* Erase duplicate pins from m_sortedSymbolPinList (i.e. set pointer in this list to NULL).
@ -152,7 +153,7 @@ protected:
* if aKeepUnconnectedPins = false, unconnected pins will be removed from list
* but usually we need all pins in netlists.
*/
void findAllUnitsOfSymbol( SCH_COMPONENT* aSymbol, LIB_PART* aPart,
void findAllUnitsOfSymbol( SCH_SYMBOL* aSymbol, LIB_PART* aPart,
SCH_SHEET_PATH* aSheetPath, bool aKeepUnconnectedPins );
public:

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 1992-2018 jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2020 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
@ -36,7 +36,8 @@
/* Generate CADSTAR net list. */
static wxString StartLine( wxT( "." ) );
bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions )
bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName,
unsigned aNetlistOptions )
{
(void)aNetlistOptions; //unused
int ret = 0;
@ -53,7 +54,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, unsig
wxString StartCmpDesc = StartLine + wxT( "ADD_COM" );
wxString msg;
wxString footprint;
SCH_COMPONENT* symbol;
SCH_SYMBOL* symbol;
wxString title = wxT( "Eeschema " ) + GetBuildVersion();
ret |= fprintf( f, "%sHEA\n", TO_UTF8( StartLine ) );
@ -69,7 +70,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, unsig
for( unsigned i = 0; i < sheetList.size(); i++ )
{
for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
symbol = findNextSymbol( item, &sheetList[ i ] );

View File

@ -70,9 +70,9 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
SCH_SHEET_PATH sheet = sheetList[i];
// Process component attributes
for( auto item : sheet.LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
for( auto item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = findNextSymbol( item, &sheet );
SCH_SYMBOL* symbol = findNextSymbol( item, &sheet );
if( !symbol )
continue;

View File

@ -67,6 +67,7 @@ bool NETLIST_EXPORTER_PSPICE::WriteNetlist( const wxString& aOutFileName, unsign
return Format( &outputFile, aNetlistOptions );
}
void NETLIST_EXPORTER_PSPICE::ReplaceForbiddenChars( wxString &aNetName )
{
// some chars are not accepted in netnames in spice netlists, because they are separators
@ -104,7 +105,8 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* aFormatter, unsigned aCtl
if( full_path.IsEmpty() )
{
DisplayError( NULL, wxString::Format( _( "Could not find library file %s." ), lib ) );
DisplayError( nullptr, wxString::Format( _( "Could not find library file %s." ),
lib ) );
full_path = lib;
}
}
@ -126,12 +128,15 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* aFormatter, unsigned aCtl
wxString device = GetSpiceDevice( item.m_refName );
aFormatter->Print( 0, "%s ", TO_UTF8( device ) );
size_t pspiceNodes = item.m_pinSequence.empty() ? item.m_pins.size() : item.m_pinSequence.size();
size_t pspiceNodes =
item.m_pinSequence.empty() ? item.m_pins.size() : item.m_pinSequence.size();
for( size_t ii = 0; ii < pspiceNodes; ii++ )
{
// Use the custom order if defined, otherwise use the standard pin order as defined in the compon
// Use the custom order if defined, otherwise use the standard pin order as defined
// in the symbol.
size_t activePinIndex = item.m_pinSequence.empty() ? ii : item.m_pinSequence[ii];
// Valid used Node Indexes are in the set
// {0,1,2,...m_item.m_pin.size()-1}
if( activePinIndex >= item.m_pins.size() )
@ -176,7 +181,7 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* aFormatter, unsigned aCtl
}
wxString NETLIST_EXPORTER_PSPICE::GetSpiceField( SPICE_FIELD aField, SCH_COMPONENT* aSymbol,
wxString NETLIST_EXPORTER_PSPICE::GetSpiceField( SPICE_FIELD aField, SCH_SYMBOL* aSymbol,
unsigned aCtl )
{
SCH_FIELD* field = aSymbol->FindField( GetSpiceFieldName( aField ) );
@ -184,7 +189,7 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceField( SPICE_FIELD aField, SCH_COMPONE
}
wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_FIELD aField, SCH_COMPONENT* aSymbol,
wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_FIELD aField, SCH_SYMBOL* aSymbol,
unsigned aCtl )
{
switch( aField )
@ -205,7 +210,8 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_FIELD aField, SCH_C
{
// Regular expression to match common formats used for passive parts description
// (e.g. 100k, 2k3, 1 uF)
wxRegEx passiveVal( "^([0-9\\. ]+)([fFpPnNuUmMkKgGtT]|M(e|E)(g|G))?([fFhH]|ohm)?([-1-9 ]*)$" );
wxRegEx passiveVal(
"^([0-9\\. ]+)([fFpPnNuUmMkKgGtT]|M(e|E)(g|G))?([fFhH]|ohm)?([-1-9 ]*)$" );
if( passiveVal.Matches( value ) )
{
@ -263,7 +269,7 @@ bool NETLIST_EXPORTER_PSPICE::ProcessNetlist( unsigned aCtl )
const wxString delimiters( "{:,; }" );
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
// Set of reference names, to check for duplications
// Set of reference names, to check for duplication
std::set<wxString> refNames;
m_netMap.clear();
@ -281,9 +287,9 @@ bool NETLIST_EXPORTER_PSPICE::ProcessNetlist( unsigned aCtl )
SCH_SHEET_PATH sheet = sheetList[sheet_idx];
// Process component attributes to find Spice directives
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = findNextSymbol( item, &sheet );
SCH_SYMBOL* symbol = findNextSymbol( item, &sheet );
if( !symbol )
continue;
@ -303,8 +309,8 @@ bool NETLIST_EXPORTER_PSPICE::ProcessNetlist( unsigned aCtl )
// Duplicate references will result in simulation errors
if( refNames.count( spiceItem.m_refName ) )
{
DisplayError( NULL, wxT( "Multiple symbols have the same reference designator.\n"
"Annotation must be corrected before simulating." ) );
DisplayError( nullptr, _( "Multiple symbols have the same reference designator.\n"
"Annotation must be corrected before simulating." ) );
return false;
}
@ -424,16 +430,15 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
m_title = line.AfterFirst( ' ' );
}
else if( line.StartsWith( '.' ) // one-line directives
|| controlBlock // .control .. .endc block
|| circuitBlock // .subckt .. .ends block
|| couplingK.Matches( line ) // K## L## L## coupling constant
else if( line.StartsWith( '.' ) // one-line directives
|| controlBlock // .control .. .endc block
|| circuitBlock // .subckt .. .ends block
|| couplingK.Matches( line ) // K## L## L## coupling constant
|| ( directiveStarted && line.StartsWith( '+' ) ) ) // multiline directives
{
m_directives.push_back( line );
}
// Handle .control .. .endc blocks
if( lowercaseline.IsSameAs( ".control" ) && ( !controlBlock ) )
controlBlock = true;

View File

@ -72,7 +72,7 @@ enum SPICE_PRIMITIVE {
struct SPICE_ITEM
{
///< Schematic component represented by this SPICE_ITEM.
SCH_COMPONENT* m_parent;
SCH_SYMBOL* m_parent;
///< Spice primitive type (@see SPICE_PRIMITIVE).
wxChar m_primitive;
@ -185,13 +185,12 @@ public:
/**
* Retrieve either the requested field value or the default value.
*/
static wxString GetSpiceField( SPICE_FIELD aField, SCH_COMPONENT* aSymbol, unsigned aCtl );
static wxString GetSpiceField( SPICE_FIELD aField, SCH_SYMBOL* aSymbol, unsigned aCtl );
/**
* Retrieve the default value for a given field.
*/
static wxString GetSpiceFieldDefVal( SPICE_FIELD aField, SCH_COMPONENT* aSymbol,
unsigned aCtl );
static wxString GetSpiceFieldDefVal( SPICE_FIELD aField, SCH_SYMBOL* aSymbol, unsigned aCtl );
/**
* Update the vector of Spice directives placed in the schematics.

View File

@ -69,7 +69,7 @@ XNODE* NETLIST_EXPORTER_XML::makeRoot( unsigned aCtl )
// add the "design" header
xroot->AddChild( makeDesignHeader() );
if( aCtl & GNL_COMPONENTS )
if( aCtl & GNL_SYMBOLS )
xroot->AddChild( makeSymbols( aCtl ) );
if( aCtl & GNL_PARTS )
@ -86,7 +86,7 @@ XNODE* NETLIST_EXPORTER_XML::makeRoot( unsigned aCtl )
}
/// Holder for multi-unit component fields
/// Holder for multi-unit symbol fields
struct COMP_FIELDS
{
wxString value;
@ -97,14 +97,14 @@ struct COMP_FIELDS
};
void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_COMPONENT* aSymbol,
void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol,
SCH_SHEET_PATH* aSheet )
{
COMP_FIELDS fields;
if( aSymbol->GetUnitCount() > 1 )
{
// Sadly, each unit of a component can have its own unique fields. This
// Sadly, each unit of a symbol can have its own unique fields. This
// block finds the unit with the lowest number having a non blank field
// value and records it. Therefore user is best off setting fields
// into only the first unit. But this scavenger algorithm will find
@ -118,44 +118,44 @@ void NETLIST_EXPORTER_XML::addSymbolFields( XNODE* aNode, SCH_COMPONENT* aSymbol
for( unsigned i = 0; i < sheetList.size(); i++ )
{
for( auto item : sheetList[i].LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
for( auto item : sheetList[i].LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* comp2 = (SCH_COMPONENT*) item;
SCH_SYMBOL* symbol2 = (SCH_SYMBOL*) item;
wxString ref2 = comp2->GetRef( &sheetList[i] );
wxString ref2 = symbol2->GetRef( &sheetList[i] );
if( ref2.CmpNoCase( ref ) != 0 )
continue;
int unit = comp2->GetUnit();
int unit = symbol2->GetUnit();
// The lowest unit number wins. User should only set fields in any one unit.
// remark: IsVoid() returns true for empty strings or the "~" string (empty
// field value)
if( !comp2->GetValue( &sheetList[i], m_resolveTextVars ).IsEmpty()
if( !symbol2->GetValue( &sheetList[i], m_resolveTextVars ).IsEmpty()
&& ( unit < minUnit || fields.value.IsEmpty() ) )
{
fields.value = comp2->GetValue( &sheetList[i], m_resolveTextVars );
fields.value = symbol2->GetValue( &sheetList[i], m_resolveTextVars );
}
if( !comp2->GetFootprint( &sheetList[i], m_resolveTextVars ).IsEmpty()
if( !symbol2->GetFootprint( &sheetList[i], m_resolveTextVars ).IsEmpty()
&& ( unit < minUnit || fields.footprint.IsEmpty() ) )
{
fields.footprint = comp2->GetFootprint( &sheetList[i], m_resolveTextVars );
fields.footprint = symbol2->GetFootprint( &sheetList[i], m_resolveTextVars );
}
if( !comp2->GetField( DATASHEET_FIELD )->IsVoid()
if( !symbol2->GetField( DATASHEET_FIELD )->IsVoid()
&& ( unit < minUnit || fields.datasheet.IsEmpty() ) )
{
if( m_resolveTextVars )
fields.datasheet = comp2->GetField( DATASHEET_FIELD )->GetShownText();
fields.datasheet = symbol2->GetField( DATASHEET_FIELD )->GetShownText();
else
fields.datasheet = comp2->GetField( DATASHEET_FIELD )->GetText();
fields.datasheet = symbol2->GetField( DATASHEET_FIELD )->GetText();
}
for( int ii = MANDATORY_FIELDS; ii < comp2->GetFieldCount(); ++ii )
for( int ii = MANDATORY_FIELDS; ii < symbol2->GetFieldCount(); ++ii )
{
const SCH_FIELD& f = comp2->GetFields()[ ii ];
const SCH_FIELD& f = symbol2->GetFields()[ ii ];
if( f.GetText().size()
&& ( unit < minUnit || fields.f.count( f.GetName() ) == 0 ) )
@ -241,19 +241,19 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
SCH_SHEET_PATH sheet = sheetList[ii];
m_schematic->SetCurrentSheet( sheet );
auto cmp = [sheet]( SCH_COMPONENT* a, SCH_COMPONENT* b )
auto cmp = [sheet]( SCH_SYMBOL* a, SCH_SYMBOL* b )
{
return ( UTIL::RefDesStringCompare( a->GetRef( &sheet ),
b->GetRef( &sheet ) ) < 0 );
};
std::set<SCH_COMPONENT*, decltype( cmp )> ordered_symbols( cmp );
std::multiset<SCH_COMPONENT*, decltype( cmp )> extra_units( cmp );
std::set<SCH_SYMBOL*, decltype( cmp )> ordered_symbols( cmp );
std::multiset<SCH_SYMBOL*, decltype( cmp )> extra_units( cmp );
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
auto test = ordered_symbols.insert( symbol );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
auto test = ordered_symbols.insert( symbol );
if( !test.second )
{
@ -272,7 +272,7 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
for( EDA_ITEM* item : ordered_symbols )
{
SCH_COMPONENT* symbol = findNextSymbol( item, &sheet );
SCH_SYMBOL* symbol = findNextSymbol( item, &sheet );
if( !symbol
|| ( ( aCtl & GNL_OPT_BOM ) && !symbol->GetIncludeInBom() )
@ -285,7 +285,7 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
// not always look best, but it will allow faster execution under XSL processing
// systems which do sequential searching within an element.
XNODE* xcomp; // current component being constructed
XNODE* xcomp; // current symbol being constructed
xcomps->AddChild( xcomp = node( "comp" ) );
xcomp->AddAttribute( "ref", symbol->GetRef( &sheet ) );
@ -298,7 +298,8 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
// for parts based on "logical_lib.part" and where logical_lib is merely the library
// name minus path and extension.
if( symbol->GetPartRef() )
xlibsource->AddAttribute( "lib", symbol->GetPartRef()->GetLibId().GetLibNickname() );
xlibsource->AddAttribute( "lib",
symbol->GetPartRef()->GetLibId().GetLibNickname() );
// We only want the symbol name, not the full LIB_ID.
xlibsource->AddAttribute( "part", symbol->GetLibId().GetLibItemName() );
@ -351,8 +352,8 @@ XNODE* NETLIST_EXPORTER_XML::makeSymbols( unsigned aCtl )
{
wxString uuid = ( *it )->m_Uuid.AsString();
// Add a space between UUIDs, if not in KICAD mode (i.e. using wxXmlDocument::Save()).
// KICAD MODE has its own XNODE::Format function.
// Add a space between UUIDs, if not in KICAD mode (i.e.
// using wxXmlDocument::Save()). KICAD MODE has its own XNODE::Format function.
if( !( aCtl & GNL_OPT_KICAD ) ) // i.e. for .xml format
uuid += ' ';
@ -509,7 +510,7 @@ XNODE* NETLIST_EXPORTER_XML::makeLibParts()
// The library nickname will be empty if the cache library is used.
if( !libNickname.IsEmpty() )
m_libraries.insert( libNickname ); // inserts component's library if unique
m_libraries.insert( libNickname ); // inserts symbol's library if unique
XNODE* xlibpart;
xlibparts->AddChild( xlibpart = node( "libpart" ) );
@ -556,7 +557,7 @@ XNODE* NETLIST_EXPORTER_XML::makeLibParts()
/* we must erase redundant Pins references in pinList
* These redundant pins exist because some pins
* are found more than one time when a component has
* are found more than one time when a symbol has
* multiple parts per package or has 2 representations (DeMorgan conversion)
* For instance, a 74ls00 has DeMorgan conversion, with different pin shapes,
* and therefore each pin appears 2 times in the list.
@ -657,8 +658,8 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
{
if( item->Type() == SCH_PIN_T )
{
SCH_PIN* pin = static_cast<SCH_PIN*>( item );
SCH_COMPONENT* symbol = pin->GetParentSymbol();
SCH_PIN* pin = static_cast<SCH_PIN*>( item );
SCH_SYMBOL* symbol = pin->GetParentSymbol();
if( !symbol
|| ( ( aCtl & GNL_OPT_BOM ) && !symbol->GetIncludeInBom() )
@ -718,7 +719,7 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
wxString refText = netNode.m_Pin->GetParentSymbol()->GetRef( &netNode.m_Sheet );
wxString pinText = netNode.m_Pin->GetNumber();
// Skip power symbols and virtual components
// Skip power symbols and virtual symbols
if( refText[0] == wxChar( '#' ) )
continue;

View File

@ -44,7 +44,7 @@ class XNODE;
enum GNL_T
{
GNL_LIBRARIES = 1 << 0,
GNL_COMPONENTS = 1 << 1,
GNL_SYMBOLS = 1 << 1,
GNL_PARTS = 1 << 2,
GNL_HEADER = 1 << 3,
GNL_NETS = 1 << 4,
@ -77,7 +77,7 @@ public:
*/
bool WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions ) override;
#define GNL_ALL ( GNL_LIBRARIES | GNL_COMPONENTS | GNL_PARTS | GNL_HEADER | GNL_NETS )
#define GNL_ALL ( GNL_LIBRARIES | GNL_SYMBOLS | GNL_PARTS | GNL_HEADER | GNL_NETS )
protected:
/**
@ -100,7 +100,7 @@ protected:
XNODE* makeRoot( unsigned aCtl = GNL_ALL );
/**
* @return a sub-tree holding all the schematic components.
* @return a sub-tree holding all the schematic symbols.
*/
XNODE* makeSymbols( unsigned aCtl );
@ -129,7 +129,7 @@ protected:
*/
XNODE* makeLibraries();
void addSymbolFields( XNODE* aNode, SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aSheet );
void addSymbolFields( XNODE* aNode, SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheet );
bool m_resolveTextVars; // Export textVar references resolved

View File

@ -41,11 +41,11 @@
#include <map>
typedef std::pair<SCH_COMPONENT*, wxString> COMPONENT_NAME_PAIR;
typedef std::pair<SCH_SYMBOL*, wxString> SYMBOL_NAME_PAIR;
// Helper sort function, used in get_components, to sort a component list by lib_id
static bool sort_by_libid( const SCH_COMPONENT* ref, SCH_COMPONENT* cmp )
// Helper sort function, used in getSymbols, to sort a symbol list by lib_id
static bool sort_by_libid( const SCH_SYMBOL* ref, SCH_SYMBOL* cmp )
{
return ref->GetLibId() < cmp->GetLibId();
}
@ -54,39 +54,39 @@ static bool sort_by_libid( const SCH_COMPONENT* ref, SCH_COMPONENT* cmp )
/**
* Fill a vector with all of the project's symbols, to ease iterating over them.
*
* The list is sorted by #LIB_ID, therefore components using the same library
* The list is sorted by #LIB_ID, therefore symbols using the same library
* symbol are grouped, allowing later faster calculations (one library search by group
* of symbols)
*
* @param aComponents - a vector that will take the symbols
* @param aSymbols is a vector that will take the symbols.
*/
static void get_components( SCHEMATIC* aSchematic, std::vector<SCH_COMPONENT*>& aComponents )
static void getSymbols( SCHEMATIC* aSchematic, std::vector<SCH_SYMBOL*>& aSymbols )
{
SCH_SCREENS screens( aSchematic->Root() );
// Get the full list
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
{
for( auto aItem : screen->Items().OfType( SCH_COMPONENT_T ) )
aComponents.push_back( static_cast<SCH_COMPONENT*>( aItem ) );
for( auto aItem : screen->Items().OfType( SCH_SYMBOL_T ) )
aSymbols.push_back( static_cast<SCH_SYMBOL*>( aItem ) );
}
if( aComponents.empty() )
if( aSymbols.empty() )
return;
// sort aComponents by lib part. Components will be grouped by same lib part.
std::sort( aComponents.begin(), aComponents.end(), sort_by_libid );
// sort aSymbols by lib part. symbols will be grouped by same lib part.
std::sort( aSymbols.begin(), aSymbols.end(), sort_by_libid );
}
/**
* Search the libraries for the first component with a given name.
* Search the libraries for the first symbol with a given name.
*
* @param aName - name to search for
* @param aLibs - the loaded PART_LIBS
* @param aCached - whether we are looking for the cached part
*/
static LIB_PART* find_component( const wxString& aName, PART_LIBS* aLibs, bool aCached )
static LIB_PART* findSymbol( const wxString& aName, PART_LIBS* aLibs, bool aCached )
{
LIB_PART *part = NULL;
wxString new_name = LIB_ID::FixIllegalChars( aName );
@ -137,7 +137,8 @@ void RESCUE_CASE_CANDIDATE::FindRescues( RESCUER& aRescuer,
{
typedef std::map<wxString, RESCUE_CASE_CANDIDATE> candidate_map_t;
candidate_map_t candidate_map;
// Remember the list of components is sorted by part name.
// Remember the list of symbols is sorted by part name.
// So a search in libraries is made only once by group
LIB_PART* case_sensitive_match = nullptr;
std::vector<LIB_PART*> case_insensitive_matches;
@ -146,9 +147,9 @@ void RESCUE_CASE_CANDIDATE::FindRescues( RESCUER& aRescuer,
wxString search_name;
wxString last_part_name;
for( SCH_COMPONENT* each_component : *( aRescuer.GetComponents() ) )
for( SCH_SYMBOL* eachSymbol : *( aRescuer.GetSymbols() ) )
{
part_name = each_component->GetLibId().GetLibItemName();
part_name = eachSymbol->GetLibId().GetLibItemName();
search_name = LIB_ID::FixIllegalChars( part_name );
if( last_part_name != part_name )
@ -173,8 +174,8 @@ void RESCUE_CASE_CANDIDATE::FindRescues( RESCUER& aRescuer,
RESCUE_CASE_CANDIDATE candidate( part_name, case_insensitive_matches[0]->GetName(),
case_insensitive_matches[0],
each_component->GetUnit(),
each_component->GetConvert() );
eachSymbol->GetUnit(),
eachSymbol->GetConvert() );
candidate_map[part_name] = candidate;
}
@ -197,17 +198,17 @@ wxString RESCUE_CASE_CANDIDATE::GetActionDescription() const
bool RESCUE_CASE_CANDIDATE::PerformAction( RESCUER* aRescuer )
{
for( SCH_COMPONENT* each_component : *aRescuer->GetComponents() )
for( SCH_SYMBOL* eachSymbol : *aRescuer->GetSymbols() )
{
if( each_component->GetLibId().GetLibItemName() != UTF8( m_requested_name ) )
if( eachSymbol->GetLibId().GetLibItemName() != UTF8( m_requested_name ) )
continue;
LIB_ID libId;
libId.SetLibItemName( m_new_name, false );
each_component->SetLibId( libId );
each_component->ClearFlags();
aRescuer->LogRescue( each_component, m_requested_name, m_new_name );
eachSymbol->SetLibId( libId );
eachSymbol->ClearFlags();
aRescuer->LogRescue( eachSymbol, m_requested_name, m_new_name );
}
return true;
@ -243,7 +244,7 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer,
typedef std::map<wxString, RESCUE_CACHE_CANDIDATE> candidate_map_t;
candidate_map_t candidate_map;
// Remember the list of components is sorted by part name.
// Remember the list of symbols is sorted by part name.
// So a search in libraries is made only once by group
LIB_PART* cache_match = nullptr;
LIB_PART* lib_match = nullptr;
@ -251,9 +252,9 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer,
wxString search_name;
wxString old_part_name;
for( SCH_COMPONENT* each_component : *( aRescuer.GetComponents() ) )
for( SCH_SYMBOL* eachSymbol : *( aRescuer.GetSymbols() ) )
{
part_name = each_component->GetLibId().GetLibItemName();
part_name = eachSymbol->GetLibId().GetLibItemName();
search_name = LIB_ID::FixIllegalChars( part_name );
if( old_part_name != part_name )
@ -261,8 +262,8 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer,
// A new part name is found (a new group starts here).
// Search the symbol names candidates only once for this group:
old_part_name = part_name;
cache_match = find_component( search_name, aRescuer.GetPrj()->SchLibs(), true );
lib_match = find_component( search_name, aRescuer.GetPrj()->SchLibs(), false );
cache_match = findSymbol( search_name, aRescuer.GetPrj()->SchLibs(), true );
lib_match = findSymbol( search_name, aRescuer.GetPrj()->SchLibs(), false );
if( !cache_match && !lib_match )
continue;
@ -278,8 +279,8 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer,
// Check if the symbol has already been rescued.
RESCUE_CACHE_CANDIDATE candidate( part_name, search_name, cache_match, lib_match,
each_component->GetUnit(),
each_component->GetConvert() );
eachSymbol->GetUnit(),
eachSymbol->GetConvert() );
candidate_map[part_name] = candidate;
}
@ -321,17 +322,17 @@ bool RESCUE_CACHE_CANDIDATE::PerformAction( RESCUER* aRescuer )
new_part->SetName( m_new_name );
aRescuer->AddPart( new_part.get() );
for( SCH_COMPONENT* each_component : *aRescuer->GetComponents() )
for( SCH_SYMBOL* eachSymbol : *aRescuer->GetSymbols() )
{
if( each_component->GetLibId().GetLibItemName() != UTF8( m_requested_name ) )
if( eachSymbol->GetLibId().GetLibItemName() != UTF8( m_requested_name ) )
continue;
LIB_ID libId;
libId.SetLibItemName( m_new_name, false );
each_component->SetLibId( libId );
each_component->ClearFlags();
aRescuer->LogRescue( each_component, m_requested_name, m_new_name );
eachSymbol->SetLibId( libId );
eachSymbol->ClearFlags();
aRescuer->LogRescue( eachSymbol, m_requested_name, m_new_name );
}
return true;
@ -371,15 +372,15 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
candidate_map_t candidate_map;
// Remember the list of components is sorted by LIB_ID.
// Remember the list of symbols is sorted by LIB_ID.
// So a search in libraries is made only once by group
LIB_PART* cache_match = nullptr;
LIB_PART* lib_match = nullptr;
LIB_ID old_part_id;
for( SCH_COMPONENT* each_component : *( aRescuer.GetComponents() ) )
for( SCH_SYMBOL* eachSymbol : *( aRescuer.GetSymbols() ) )
{
const LIB_ID& part_id = each_component->GetLibId();
const LIB_ID& part_id = eachSymbol->GetLibId();
if( old_part_id != part_id )
{
@ -389,8 +390,8 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
// Get the library symbol from the cache library. It will be a flattened
// symbol by default (no inheritance).
cache_match = find_component( part_id.Format().wx_str(), aRescuer.GetPrj()->SchLibs(),
true );
cache_match = findSymbol( part_id.Format().wx_str(), aRescuer.GetPrj()->SchLibs(),
true );
// Get the library symbol from the symbol library table.
lib_match = SchGetLibPart( part_id, aRescuer.GetPrj()->SchSymbolLibTable() );
@ -439,8 +440,8 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
LIB_ID new_id( libNickname, new_name + "-" + part_id.GetLibNickname().wx_str() );
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE candidate( part_id, new_id, cache_match, lib_match,
each_component->GetUnit(),
each_component->GetConvert() );
eachSymbol->GetUnit(),
eachSymbol->GetConvert() );
candidate_map[part_id] = candidate;
}
@ -483,14 +484,14 @@ bool RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::PerformAction( RESCUER* aRescuer )
new_part->SetName( m_new_id.GetLibItemName() );
aRescuer->AddPart( new_part.get() );
for( SCH_COMPONENT* each_component : *aRescuer->GetComponents() )
for( SCH_SYMBOL* eachSymbol : *aRescuer->GetSymbols() )
{
if( each_component->GetLibId() != m_requested_id )
if( eachSymbol->GetLibId() != m_requested_id )
continue;
each_component->SetLibId( m_new_id );
each_component->ClearFlags();
aRescuer->LogRescue( each_component, m_requested_id.Format(), m_new_id.Format() );
eachSymbol->SetLibId( m_new_id );
eachSymbol->ClearFlags();
aRescuer->LogRescue( eachSymbol, m_requested_id.Format(), m_new_id.Format() );
}
return true;
@ -505,7 +506,7 @@ RESCUER::RESCUER( PROJECT& aProject, SCHEMATIC* aSchematic, SCH_SHEET_PATH* aCur
wxASSERT( m_schematic );
if( m_schematic )
get_components( m_schematic, m_components );
getSymbols( m_schematic, m_symbols );
m_prj = &aProject;
m_currentSheet = aCurrentSheet;
@ -513,11 +514,11 @@ RESCUER::RESCUER( PROJECT& aProject, SCHEMATIC* aSchematic, SCH_SHEET_PATH* aCur
}
void RESCUER::LogRescue( SCH_COMPONENT *aComponent, const wxString &aOldName,
void RESCUER::LogRescue( SCH_SYMBOL* aSymbol, const wxString &aOldName,
const wxString &aNewName )
{
RESCUE_LOG logitem;
logitem.component = aComponent;
logitem.symbol = aSymbol;
logitem.old_name = aOldName;
logitem.new_name = aNewName;
m_rescue_log.push_back( logitem );
@ -543,8 +544,8 @@ void RESCUER::UndoRescues()
LIB_ID libId;
libId.SetLibItemName( each_logitem.old_name, false );
each_logitem.component->SetLibId( libId );
each_logitem.component->ClearFlags();
each_logitem.symbol->SetLibId( libId );
each_logitem.symbol->ClearFlags();
}
}

View File

@ -32,7 +32,7 @@
*
* bool SCH_EDIT_FRAME::RescueProject( bool aSilentIfNone );
*
* When this is called, a list of problematic components is compiled. If
* When this is called, a list of problematic symbols is compiled. If
* this list is empty, then the function displays a notification and returns
* (if aSilentIfNone is true, the notification is silenced).
*/
@ -48,7 +48,7 @@
class LIB_PART;
class SCH_COMPONENT;
class SCH_SYMBOL;
class RESCUER;
class SCH_EDIT_FRAME;
class SCH_LEGACY_PLUGIN;
@ -226,9 +226,9 @@ private:
class RESCUE_LOG
{
public:
SCH_COMPONENT* component;
wxString old_name;
wxString new_name;
SCH_SYMBOL* symbol;
wxString old_name;
wxString new_name;
};
@ -285,7 +285,7 @@ public:
/**
* Get the list of symbols that need rescued.
*/
std::vector<SCH_COMPONENT*>* GetComponents() { return &m_components; }
std::vector<SCH_SYMBOL*>* GetSymbols() { return &m_symbols; }
/**
* Return the #SCH_PROJECT object for access to the symbol libraries.
@ -297,8 +297,7 @@ public:
/**
* Used by individual #RESCUE_CANDIDATE objects to log a rescue for undoing.
*/
void LogRescue( SCH_COMPONENT *aComponent, const wxString& aOldName,
const wxString& aNewName );
void LogRescue( SCH_SYMBOL *aSymbol, const wxString& aOldName, const wxString& aNewName );
/**
* Perform all chosen rescue actions, logging them to be undone if necessary.
@ -317,7 +316,7 @@ public:
protected:
friend class DIALOG_RESCUE_EACH;
std::vector<SCH_COMPONENT*> m_components;
std::vector<SCH_SYMBOL*> m_symbols;
PROJECT* m_prj;
SCHEMATIC* m_schematic;
EDA_DRAW_PANEL_GAL::GAL_TYPE m_galBackEndType;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015-2020 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015-2021 KiCad Developers, see change_log.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
@ -314,7 +314,7 @@ void SCH_BASE_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete )
GetCanvas()->GetView()->Update( aItem );
// Some children are drawn from their parents. Mark them for re-paint.
static KICAD_T parentTypes[] = { SCH_COMPONENT_T, SCH_SHEET_T, SCH_GLOBAL_LABEL_T, EOT };
static KICAD_T parentTypes[] = { SCH_SYMBOL_T, SCH_SHEET_T, SCH_GLOBAL_LABEL_T, EOT };
if( parent && parent->IsType( parentTypes ) )
GetCanvas()->GetView()->Update( parent, KIGFX::REPAINT );
@ -350,8 +350,8 @@ void SCH_BASE_FRAME::RefreshSelection()
{
view->Update( item, KIGFX::REPAINT );
// Component children are drawn from their parents. Mark them for re-paint.
if( parent && parent->Type() == SCH_COMPONENT_T )
// Symbol children are drawn from their parents. Mark them for re-paint.
if( parent && parent->Type() == SCH_SYMBOL_T )
GetCanvas()->GetView()->Update( parent, KIGFX::REPAINT );
}
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2020 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
@ -1158,9 +1158,9 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM*
{
wxCHECK_RET( aItem != NULL, wxT( "Cannot add null item to list." ) );
SCH_SHEET* parentSheet = nullptr;
SCH_COMPONENT* parentSymbol = nullptr;
SCH_ITEM* undoItem = aItem;
SCH_SHEET* parentSheet = nullptr;
SCH_SYMBOL* parentSymbol = nullptr;
SCH_ITEM* undoItem = aItem;
if( aItem->Type() == SCH_SHEET_PIN_T )
{
@ -1174,9 +1174,9 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM*
else if( aItem->Type() == SCH_FIELD_T )
{
parentSymbol = (SCH_COMPONENT*) aItem->GetParent();
parentSymbol = (SCH_SYMBOL*) aItem->GetParent();
wxCHECK_RET( parentSymbol && parentSymbol->Type() == SCH_COMPONENT_T,
wxCHECK_RET( parentSymbol && parentSymbol->Type() == SCH_SYMBOL_T,
wxT( "Cannot place field in invalid schematic symbol." ) );
undoItem = parentSymbol;
@ -1483,10 +1483,10 @@ const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
{
if( item != dsAsItem ) // Ignore the drawing-sheet itself
{
if( item->Type() == SCH_COMPONENT_T )
if( item->Type() == SCH_SYMBOL_T )
{
// For symbols we need to get the bounding box without invisible text
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
bBoxItems.Merge( symbol->GetBoundingBox( false ) );
}
else
@ -1630,7 +1630,7 @@ void SCH_EDIT_FRAME::SaveSymbolToSchematic( const LIB_PART& aSymbol )
// only works for a single symbol selection.
for( EDA_ITEM* item : selection )
{
SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item );
wxCHECK( symbol, /* void */ );

View File

@ -53,7 +53,7 @@ class SCH_BITMAP;
class SCH_SHEET;
class SCH_SHEET_PATH;
class SCH_SHEET_PIN;
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_FIELD;
class SCH_JUNCTION;
class SCHEMATIC;
@ -64,17 +64,17 @@ class HIERARCHY_NAVIG_DLG;
// @todo Move this to transform alone with all of the transform manipulation code.
/// enum used in RotationMiroir()
enum COMPONENT_ORIENTATION_T
enum SYMBOL_ORIENTATION_T
{
CMP_NORMAL, // Normal orientation, no rotation or mirror
CMP_ROTATE_CLOCKWISE, // Rotate -90
CMP_ROTATE_COUNTERCLOCKWISE, // Rotate +90
CMP_ORIENT_0, // No rotation and no mirror id CMP_NORMAL
CMP_ORIENT_90, // Rotate 90, no mirror
CMP_ORIENT_180, // Rotate 180, no mirror
CMP_ORIENT_270, // Rotate -90, no mirror
CMP_MIRROR_X = 0x100, // Mirror around X axis
CMP_MIRROR_Y = 0x200 // Mirror around Y axis
SYM_NORMAL, // Normal orientation, no rotation or mirror
SYM_ROTATE_CLOCKWISE, // Rotate -90
SYM_ROTATE_COUNTERCLOCKWISE, // Rotate +90
SYM_ORIENT_0, // No rotation and no mirror id SYM_NORMAL
SYM_ORIENT_90, // Rotate 90, no mirror
SYM_ORIENT_180, // Rotate 180, no mirror
SYM_ORIENT_270, // Rotate -90, no mirror
SYM_MIRROR_X = 0x100, // Mirror around X axis
SYM_MIRROR_Y = 0x200 // Mirror around Y axis
};
@ -92,7 +92,7 @@ enum ANNOTATE_ORDER_T
{
SORT_BY_X_POSITION, ///< Annotate by X position from left to right.
SORT_BY_Y_POSITION, ///< Annotate by Y position from top to bottom.
UNSORTED, ///< Annotate by position of component in the schematic sheet
UNSORTED, ///< Annotate by position of symbol in the schematic sheet
///< object list.
};
@ -112,7 +112,7 @@ enum ANNOTATE_ALGO_T
enum SCH_SEARCH_T
{
HIGHLIGHT_PIN,
HIGHLIGHT_COMPONENT
HIGHLIGHT_SYMBOL
};
@ -199,18 +199,18 @@ public:
/**
* Execute a remote command sent by Pcbnew via a socket connection.
* <p>
*
* When user selects a footprint or pin in Pcbnew, Eeschema shows that same
* component or pin and moves cursor on the item. The socket port used
* symbol or pin and moves cursor on the item. The socket port used
* is #KICAD_SCH_PORT_SERVICE_NUMBER which defaults to 4243.
*
* Valid commands are:
* \li \c \$PART: \c "reference" Put cursor on component.
* \li \c \$PART: \c "reference" \c \$REF: \c "ref" Put cursor on component reference.
* \li \c \$PART: \c "reference" \c \$VAL: \c "value" Put cursor on component value.
* \li \c \$PART: \c "reference" \c \$PAD: \c "pin name" Put cursor on the component pin.
* \li \c \$PART: \c "reference" Put cursor on symbol.
* \li \c \$PART: \c "reference" \c \$REF: \c "ref" Put cursor on symbol reference.
* \li \c \$PART: \c "reference" \c \$VAL: \c "value" Put cursor on symbol value.
* \li \c \$PART: \c "reference" \c \$PAD: \c "pin name" Put cursor on the symbol pin.
* \li \c \$NET: \c "netname" Highlight a specified net
* \li \c \$CLEAR: \c "HIGHLIGHTED" Clear components highlight
* \li \c \$CLEAR: \c "HIGHLIGHTED" Clear symbols highlight
* <p>
* They are a keyword followed by a quoted string.
* @param cmdline is the command received from Pcbnew.
@ -304,12 +304,12 @@ public:
* Commands are:
* - $PART: reference put cursor on footprint anchor
* - $PIN: number $PART: reference put cursor on the footprint pad
* - $SHEET: time_stamp select all footprints of components is the schematic sheet path
* - $SHEET: time_stamp select all footprints of symbols is the schematic sheet path
*
* @param aObjectToSync is the item to be located on board.
* @param aPart is the symbol if \a aObjectToSync is a sub item of a symbol (like a pin).
*/
void SendMessageToPCBNEW( EDA_ITEM* aObjectToSync, SCH_COMPONENT* aPart );
void SendMessageToPCBNEW( EDA_ITEM* aObjectToSync, SCH_SYMBOL* aPart );
/**
* Sends a net name to Pcbnew for highlighting
@ -369,7 +369,7 @@ public:
REPORTER* aReporter = nullptr );
/**
* Clear the current component annotation.
* Clear the current symbol annotation.
*
* @param aCurrentSheetOnly Where to clear the annotation. See #ANNOTATE_SCOPE_T
* @param appendUndo true to add the action to the previous undo list
@ -378,7 +378,7 @@ public:
/**
* Annotate the symbols in the schematic that are not currently annotated. Multi-unit symbols
* are annotated together. E.g. if two components were R8A and R8B, they may become R3A and
* are annotated together. E.g. if two symbols were R8A and R8B, they may become R3A and
* R3B, but not R3A and R3C or R3C and R4D.
*
* @param aAnnotateScope See #ANNOTATE_SCOPE_T
@ -386,7 +386,7 @@ public:
* @param aAlgoOption Define the annotation style. See #ANNOTATE_ALGO_T.
* @param aStartNumber The start number for non-sheet-based annotation styles.
* @param aResetAnnotation Clear any previous annotation if true. Otherwise, keep the
* existing component annotation.
* existing symbol annotation.
* @param aRepairTimestamps Test for and repair any duplicate time stamps if true.
* Otherwise, keep the existing time stamps. This option
* could change previous annotation because time stamps are
@ -662,9 +662,9 @@ public:
*/
void DeleteJunction( SCH_ITEM* aItem, bool aAppend = false );
void ConvertPart( SCH_COMPONENT* aSymbol );
void ConvertPart( SCH_SYMBOL* aSymbol );
void SelectUnit( SCH_COMPONENT* aSymbol, int aUnit );
void SelectUnit( SCH_SYMBOL* aSymbol, int aUnit );
/* Undo - redo */
@ -744,7 +744,7 @@ public:
/**
* Create a symbol library file with the name of the root document plus the '-cache' suffix,
*
* This file will contain all components used in the current schematic.
* This file will contain all symbols used in the current schematic.
*
* @param aUseCurrentSheetFilename set to false to use the root sheet filename
* (default) or true to use the currently opened sheet.
@ -753,7 +753,7 @@ public:
bool CreateArchiveLibraryCacheFile( bool aUseCurrentSheetFilename = false );
/**
* Create a library \a aFileName that contains all components used in the current schematic.
* Create a library \a aFileName that contains all symbols used in the current schematic.
*
* @param aFileName The full path and file name of the archive library.
* @return True if \a aFileName was written successfully.

View File

@ -115,7 +115,7 @@ wxString SCH_FIELD::GetShownText( int aDepth ) const
}
else
{
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
if( parentSymbol->ResolveTextVar( token, aDepth + 1 ) )
return true;
@ -155,7 +155,7 @@ wxString SCH_FIELD::GetShownText( int aDepth ) const
if( aDepth < 10 )
{
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
text = ExpandTextVars( text, &symbolResolver, nullptr, project );
else if( m_parent && m_parent->Type() == SCH_SHEET_T )
text = ExpandTextVars( text, &sheetResolver, nullptr, project );
@ -169,9 +169,9 @@ wxString SCH_FIELD::GetShownText( int aDepth ) const
// WARNING: the IDs of FIELDS and SHEETS overlap, so one must check *both* the
// id and the parent's type.
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
if( m_id == REFERENCE_FIELD )
{
@ -211,9 +211,9 @@ void SCH_FIELD::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset
// Calculate the text orientation according to the symbol orientation.
orient = GetTextAngle();
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
if( parentSymbol && parentSymbol->GetTransform().y1 ) // Rotate symbol 90 degrees.
{
@ -277,9 +277,9 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const
// Now, apply the symbol transform (mirror/rot)
TRANSFORM transform;
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
// Due to the Y axis direction, we must mirror the bounding box,
// relative to the text position:
@ -340,12 +340,12 @@ bool SCH_FIELD::Matches( const wxFindReplaceData& aSearchData, void* aAuxData )
if( !IsVisible() && !searchHiddenFields )
return false;
if( m_parent && m_parent->Type() == SCH_COMPONENT_T && m_id == REFERENCE_FIELD )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T && m_id == REFERENCE_FIELD )
{
if( searchAndReplace && !replaceReferences )
return false;
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
wxASSERT( aAuxData );
// Take sheet path into account which effects the reference field and the unit for
@ -368,9 +368,9 @@ bool SCH_FIELD::Matches( const wxFindReplaceData& aSearchData, void* aAuxData )
bool SCH_FIELD::IsReplaceable() const
{
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
if( m_id == VALUE_FIELD )
{
@ -399,9 +399,9 @@ bool SCH_FIELD::Replace( const wxFindReplaceData& aSearchData, void* aAuxData )
bool resolve = false; // Replace in source text, not shown text
bool isReplaced = false;
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
switch( m_id )
{
@ -547,7 +547,7 @@ wxString SCH_FIELD::GetName( bool aUseDefaultName ) const
return m_name;
else if( aUseDefaultName )
{
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
return TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id );
else if( m_parent && m_parent->Type() == SCH_SHEET_T )
return SCH_SHEET::GetDefaultFieldName( m_id );
@ -561,7 +561,7 @@ wxString SCH_FIELD::GetName( bool aUseDefaultName ) const
wxString SCH_FIELD::GetCanonicalName() const
{
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
{
switch( m_id )
{
@ -590,7 +590,7 @@ wxString SCH_FIELD::GetCanonicalName() const
BITMAPS SCH_FIELD::GetMenuImage() const
{
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
{
switch( m_id )
{
@ -653,9 +653,9 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter ) const
// Calculate the text orientation, according to the symbol orientation/mirror
int orient = GetTextAngle();
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
if( parentSymbol->GetTransform().y1 ) // Rotate symbol 90 deg.
{
@ -691,10 +691,10 @@ void SCH_FIELD::SetPosition( const wxPoint& aPosition )
// Actual positions are calculated by the rotation/mirror transform of the parent symbol
// of the field. The inverse transform is used to calculate the position relative to the
// parent symbol.
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
wxPoint relPos = aPosition - parentSymbol->GetPosition();
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
wxPoint relPos = aPosition - parentSymbol->GetPosition();
relPos = parentSymbol->GetTransform().InverseTransform().TransformCoordinate( relPos );
@ -708,10 +708,10 @@ void SCH_FIELD::SetPosition( const wxPoint& aPosition )
wxPoint SCH_FIELD::GetPosition() const
{
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
wxPoint relativePos = GetTextPos() - parentSymbol->GetPosition();
SCH_SYMBOL* parentSymbol = static_cast<SCH_SYMBOL*>( m_parent );
wxPoint relativePos = GetTextPos() - parentSymbol->GetPosition();
relativePos = parentSymbol->GetTransform().TransformCoordinate( relativePos );

View File

@ -32,7 +32,6 @@
#include <general.h>
class SCH_EDIT_FRAME;
class SCH_COMPONENT;
class LIB_FIELD;

View File

@ -79,7 +79,7 @@ public:
{
return ( aItem->Type() == SCH_LINE_T &&
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS ) ) ||
aItem->Type() == SCH_COMPONENT_T;
aItem->Type() == SCH_SYMBOL_T;
}
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override

View File

@ -661,7 +661,7 @@ bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
case SCH_BUS_WIRE_ENTRY_T:
case SCH_COMPONENT_T:
case SCH_SYMBOL_T:
case SCH_SHEET_T:
case SCH_SHEET_PIN_T:
return true;

View File

@ -87,7 +87,7 @@ public:
bool CanConnect( const SCH_ITEM* aItem ) const override
{
return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
aItem->Type() == SCH_COMPONENT_T;
aItem->Type() == SCH_SYMBOL_T;
}
std::vector<wxPoint> GetConnectionPoints() const override;

View File

@ -198,8 +198,8 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
{
BOX2I box = item->GetBoundingBox();
if( item->Type() == SCH_COMPONENT_T )
box = static_cast<const SCH_COMPONENT*>( item )->GetBodyBoundingBox();
if( item->Type() == SCH_SYMBOL_T )
box = static_cast<const SCH_SYMBOL*>( item )->GetBodyBoundingBox();
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
@ -220,7 +220,7 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
HANDLE_ITEM( LIB_FIELD_T, LIB_FIELD );
HANDLE_ITEM( LIB_TEXT_T, LIB_TEXT );
HANDLE_ITEM( LIB_BEZIER_T, LIB_BEZIER );
HANDLE_ITEM( SCH_COMPONENT_T, SCH_COMPONENT );
HANDLE_ITEM( SCH_SYMBOL_T, SCH_SYMBOL );
HANDLE_ITEM( SCH_JUNCTION_T, SCH_JUNCTION );
HANDLE_ITEM( SCH_LINE_T, SCH_LINE );
HANDLE_ITEM( SCH_TEXT_T, SCH_TEXT );
@ -1399,18 +1399,18 @@ static void orientPart( LIB_PART* part, int orientation )
}
orientations[] =
{
{ CMP_ORIENT_0, 0, 0, 0 },
{ CMP_ORIENT_90, 1, 0, 0 },
{ CMP_ORIENT_180, 2, 0, 0 },
{ CMP_ORIENT_270, 3, 0, 0 },
{ CMP_MIRROR_X + CMP_ORIENT_0, 0, 1, 0 },
{ CMP_MIRROR_X + CMP_ORIENT_90, 1, 1, 0 },
{ CMP_MIRROR_Y, 0, 0, 1 },
{ CMP_MIRROR_X + CMP_ORIENT_270, 3, 1, 0 },
{ CMP_MIRROR_Y + CMP_ORIENT_0, 0, 0, 1 },
{ CMP_MIRROR_Y + CMP_ORIENT_90, 1, 0, 1 },
{ CMP_MIRROR_Y + CMP_ORIENT_180, 2, 0, 1 },
{ CMP_MIRROR_Y + CMP_ORIENT_270, 3, 0, 1 }
{ SYM_ORIENT_0, 0, 0, 0 },
{ SYM_ORIENT_90, 1, 0, 0 },
{ SYM_ORIENT_180, 2, 0, 0 },
{ SYM_ORIENT_270, 3, 0, 0 },
{ SYM_MIRROR_X + SYM_ORIENT_0, 0, 1, 0 },
{ SYM_MIRROR_X + SYM_ORIENT_90, 1, 1, 0 },
{ SYM_MIRROR_Y, 0, 0, 1 },
{ SYM_MIRROR_X + SYM_ORIENT_270, 3, 1, 0 },
{ SYM_MIRROR_Y + SYM_ORIENT_0, 0, 0, 1 },
{ SYM_MIRROR_Y + SYM_ORIENT_90, 1, 0, 1 },
{ SYM_MIRROR_Y + SYM_ORIENT_180, 2, 0, 1 },
{ SYM_MIRROR_Y + SYM_ORIENT_270, 3, 0, 1 }
};
ORIENT o = orientations[ 0 ];
@ -1438,7 +1438,7 @@ static void orientPart( LIB_PART* part, int orientation )
}
void SCH_PAINTER::draw( SCH_COMPONENT *aSymbol, int aLayer )
void SCH_PAINTER::draw( SCH_SYMBOL* aSymbol, int aLayer )
{
int unit = aSymbol->GetUnitSelection( &m_schematic->CurrentSheet() );
int convert = aSymbol->GetConvert();
@ -1482,7 +1482,7 @@ void SCH_PAINTER::draw( SCH_COMPONENT *aSymbol, int aLayer )
draw( &tempPart, aLayer, false, aSymbol->GetUnit(), aSymbol->GetConvert() );
// The fields are SCH_COMPONENT-specific so don't need to be copied/oriented/translated
// The fields are SCH_SYMBOL-specific so don't need to be copied/oriented/translated
for( const SCH_FIELD& field : aSymbol->GetFields() )
draw( &field, aLayer );
}
@ -1528,9 +1528,9 @@ void SCH_PAINTER::draw( const SCH_FIELD *aField, int aLayer )
// Calculate the text orientation according to the parent orientation.
int orient = (int) aField->GetTextAngle();
if( aField->GetParent() && aField->GetParent()->Type() == SCH_COMPONENT_T )
if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
{
if( static_cast<SCH_COMPONENT*>( aField->GetParent() )->GetTransform().y1 )
if( static_cast<SCH_SYMBOL*>( aField->GetParent() )->GetTransform().y1 )
{
// Rotate symbol 90 degrees.
if( orient == TEXT_ANGLE_HORIZ )

View File

@ -42,7 +42,7 @@ class LIB_ARC;
class LIB_FIELD;
class LIB_TEXT;
class LIB_BEZIER;
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_FIELD;
class SCH_JUNCTION;
class SCH_LABEL;
@ -160,7 +160,7 @@ private:
void draw( const LIB_FIELD* aField, int aLayer );
void draw( const LIB_TEXT* aText, int aLayer );
void draw( const LIB_BEZIER* aCurve, int aLayer );
void draw( SCH_COMPONENT* aSymbol, int aLayer );
void draw( SCH_SYMBOL* aSymbol, int aLayer );
void draw( const SCH_JUNCTION* aJct, int aLayer );
void draw( const SCH_FIELD* aField, int aLayer );
void draw( const SCH_TEXT* aText, int aLayer );

View File

@ -26,7 +26,7 @@
#include <sch_edit_frame.h>
SCH_PIN::SCH_PIN( LIB_PIN* aLibPin, SCH_COMPONENT* aParentSymbol ) :
SCH_PIN::SCH_PIN( LIB_PIN* aLibPin, SCH_SYMBOL* aParentSymbol ) :
SCH_ITEM( aParentSymbol, SCH_PIN_T )
{
m_alt = wxEmptyString;
@ -39,9 +39,9 @@ SCH_PIN::SCH_PIN( LIB_PIN* aLibPin, SCH_COMPONENT* aParentSymbol ) :
/**
* Create a proxy pin from an alternate pin designation.
* The LIB_PIN data will be filled in when the pin is resolved (see SCH_COMPONENT::UpdatePins).
* The LIB_PIN data will be filled in when the pin is resolved (see SCH_SYMBOL::UpdatePins).
*/
SCH_PIN::SCH_PIN( SCH_COMPONENT* aParentSymbol, const wxString& aNumber, const wxString& aAlt ) :
SCH_PIN::SCH_PIN( SCH_SYMBOL* aParentSymbol, const wxString& aNumber, const wxString& aAlt ) :
SCH_ITEM( aParentSymbol, SCH_PIN_T )
{
m_alt = aAlt;
@ -138,9 +138,9 @@ bool SCH_PIN::Replace( const wxFindReplaceData& aSearchData, void* aAuxData )
}
SCH_COMPONENT* SCH_PIN::GetParentSymbol() const
SCH_SYMBOL* SCH_PIN::GetParentSymbol() const
{
return static_cast<SCH_COMPONENT*>( GetParent() );
return static_cast<SCH_SYMBOL*>( GetParent() );
}
@ -200,7 +200,7 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( aFrame );
SCH_SHEET_PATH* currentSheet = schframe ? &schframe->GetCurrentSheet() : nullptr;
SCH_COMPONENT* symbol = GetParentSymbol();
SCH_SYMBOL* symbol = GetParentSymbol();
aList.emplace_back( symbol->GetRef( currentSheet ), symbol->GetValue( currentSheet, true ) );

View File

@ -30,14 +30,14 @@
#include <mutex>
#include <map>
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_PIN : public SCH_ITEM
{
public:
SCH_PIN( LIB_PIN* aLibPin, SCH_COMPONENT* aParentSymbol );
SCH_PIN( LIB_PIN* aLibPin, SCH_SYMBOL* aParentSymbol );
SCH_PIN( SCH_COMPONENT* aParentSymbol, const wxString& aNumber, const wxString& aAlt );
SCH_PIN( SCH_SYMBOL* aParentSymbol, const wxString& aNumber, const wxString& aAlt );
SCH_PIN( const SCH_PIN& aPin );
@ -53,7 +53,7 @@ public:
return wxT( "SCH_PIN" );
}
SCH_COMPONENT* GetParentSymbol() const;
SCH_SYMBOL* GetParentSymbol() const;
LIB_PIN* GetLibPin() const { return m_libPin; }

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
* Copyright (C) 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
@ -93,7 +94,7 @@ ASCH_STORAGE_FILE::ASCH_STORAGE_FILE( ALTIUM_PARSER& aReader )
}
ASCH_COMPONENT::ASCH_COMPONENT( const std::map<wxString, wxString>& aProperties )
ASCH_SYMBOL::ASCH_SYMBOL( const std::map<wxString, wxString>& aProperties )
{
wxASSERT( PropertiesReadRecord( aProperties ) == ALTIUM_SCH_RECORD::COMPONENT );
@ -746,4 +747,4 @@ ASCH_PARAMETER::ASCH_PARAMETER( const std::map<wxString, wxString>& aProperties
isHidden = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISHIDDEN", false );
isMirrored = ALTIUM_PARSER::PropertiesReadBool( aProperties, "ISMIRRORED", false );
isShowName = ALTIUM_PARSER::PropertiesReadBool( aProperties, "SHOWNAME", false );
}
}

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
* Copyright (C) 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
@ -105,7 +106,7 @@ enum class ASCH_RECORD_ORIENTATION
};
struct ASCH_COMPONENT
struct ASCH_SYMBOL
{
int currentpartid;
wxString libreference;
@ -120,7 +121,7 @@ struct ASCH_COMPONENT
int displaymodecount;
int displaymode;
explicit ASCH_COMPONENT( const std::map<wxString, wxString>& aProperties );
explicit ASCH_SYMBOL( const std::map<wxString, wxString>& aProperties );
};
@ -701,4 +702,4 @@ struct ASCH_PARAMETER
explicit ASCH_PARAMETER( const std::map<wxString, wxString>& aProperties );
};
#endif //ALTIUM_PARSER_SCH_H
#endif //ALTIUM_PARSER_SCH_H

View File

@ -64,10 +64,10 @@
#include <wx/wfstream.h>
const wxPoint GetRelativePosition( const wxPoint& aPosition, const SCH_COMPONENT* aComponent )
const wxPoint GetRelativePosition( const wxPoint& aPosition, const SCH_SYMBOL* aSymbol )
{
TRANSFORM t = aComponent->GetTransform().InverseTransform();
return t.TransformCoordinate( aPosition - aComponent->GetPosition() );
TRANSFORM t = aSymbol->GetTransform().InverseTransform();
return t.TransformCoordinate( aPosition - aSymbol->GetPosition() );
}
@ -553,8 +553,8 @@ const ASCH_STORAGE_FILE* SCH_ALTIUM_PLUGIN::GetFileFromStorage( const wxString&
void SCH_ALTIUM_PLUGIN::ParseComponent( int aIndex,
const std::map<wxString, wxString>& aProperties )
{
auto pair = m_altiumComponents.insert( { aIndex, ASCH_COMPONENT( aProperties ) } );
const ASCH_COMPONENT& elem = pair.first->second;
auto pair = m_altiumComponents.insert( { aIndex, ASCH_SYMBOL( aProperties ) } );
const ASCH_SYMBOL& elem = pair.first->second;
// TODO: this is a hack until we correctly apply all transformations to every element
wxString name = wxString::Format( "%d%s_%s",
@ -570,18 +570,18 @@ void SCH_ALTIUM_PLUGIN::ParseComponent( int aIndex,
m_symbols.insert( { aIndex, kpart } );
// each component has its own symbol for now
SCH_COMPONENT* component = new SCH_COMPONENT();
SCH_SYMBOL* symbol = new SCH_SYMBOL();
component->SetPosition( elem.location + m_sheetOffset );
symbol->SetPosition( elem.location + m_sheetOffset );
//component->SetOrientation( elem.orientation ); // TODO: keep it simple for now, and only set position
component->SetLibId( libId );
symbol->SetLibId( libId );
//component->SetLibSymbol( kpart ); // this has to be done after parsing the LIB_PART!
component->SetUnit( elem.currentpartid );
symbol->SetUnit( elem.currentpartid );
m_currentSheet->GetScreen()->Append( component );
m_currentSheet->GetScreen()->Append( symbol );
m_components.insert( { aIndex, component } );
m_components.insert( { aIndex, symbol } );
}
@ -1683,7 +1683,7 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map<wxString, wxString>& aPro
m_rootSheet->LocatePathOfScreen( m_currentSheet->GetScreen(), &sheetpath );
// each component has its own symbol for now
SCH_COMPONENT* component = new SCH_COMPONENT();
SCH_SYMBOL* component = new SCH_SYMBOL();
component->SetRef( &sheetpath, "#PWR?" );
component->SetValue( elem.text );
component->SetLibId( libId );
@ -1700,22 +1700,22 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map<wxString, wxString>& aPro
switch( elem.orientation )
{
case ASCH_RECORD_ORIENTATION::RIGHTWARDS:
component->SetOrientation( COMPONENT_ORIENTATION_T::CMP_ORIENT_90 );
component->SetOrientation( SYMBOL_ORIENTATION_T::SYM_ORIENT_90 );
valueField->SetTextAngle( -900. );
valueField->SetHorizJustify( EDA_TEXT_HJUSTIFY_T::GR_TEXT_HJUSTIFY_LEFT );
break;
case ASCH_RECORD_ORIENTATION::UPWARDS:
component->SetOrientation( COMPONENT_ORIENTATION_T::CMP_ORIENT_180 );
component->SetOrientation( SYMBOL_ORIENTATION_T::SYM_ORIENT_180 );
valueField->SetTextAngle( -1800. );
valueField->SetHorizJustify( EDA_TEXT_HJUSTIFY_T::GR_TEXT_HJUSTIFY_CENTER );
break;
case ASCH_RECORD_ORIENTATION::LEFTWARDS:
component->SetOrientation( COMPONENT_ORIENTATION_T::CMP_ORIENT_270 );
component->SetOrientation( SYMBOL_ORIENTATION_T::SYM_ORIENT_270 );
valueField->SetTextAngle( -2700. );
valueField->SetHorizJustify( EDA_TEXT_HJUSTIFY_T::GR_TEXT_HJUSTIFY_RIGHT );
break;
case ASCH_RECORD_ORIENTATION::DOWNWARDS:
component->SetOrientation( COMPONENT_ORIENTATION_T::CMP_ORIENT_0 );
component->SetOrientation( SYMBOL_ORIENTATION_T::SYM_ORIENT_0 );
valueField->SetTextAngle( 0. );
valueField->SetHorizJustify( EDA_TEXT_HJUSTIFY_T::GR_TEXT_HJUSTIFY_CENTER );
break;

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
* Copyright (C) 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
@ -32,7 +33,7 @@
#include "altium_parser_sch.h"
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_SHEET;
class TITLE_BLOCK;
@ -154,14 +155,14 @@ private:
wxPoint m_sheetOffset;
std::unique_ptr<ASCH_SHEET> m_altiumSheet;
std::map<int, SCH_COMPONENT*> m_components;
std::map<int, SCH_SYMBOL*> m_components;
std::map<int, SCH_SHEET*> m_sheets;
std::map<int, LIB_PART*> m_symbols; // every component has its unique symbol
std::map<wxString, LIB_PART*> m_powerSymbols;
std::vector<ASCH_STORAGE_FILE> m_altiumStorage;
std::map<int, ASCH_COMPONENT> m_altiumComponents;
std::map<int, ASCH_SYMBOL> m_altiumComponents;
std::vector<ASCH_PORT> m_altiumPortsCurrentSheet; // we require all connections first
};

View File

@ -34,7 +34,7 @@
#include <macros.h>
#include <kicad_string.h>
#include <sch_bus_entry.h>
#include <sch_edit_frame.h> //COMPONENT_ORIENTATION_T
#include <sch_edit_frame.h> //SYMBOL_ORIENTATION_T
#include <sch_io_mgr.h>
#include <sch_junction.h>
#include <sch_line.h>
@ -136,11 +136,11 @@ void CADSTAR_SCH_ARCHIVE_LOADER::Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSh
{
EDA_RECT bbox;
// Only use the visible fields of the components to calculate their bounding box
// Only use the visible fields of the symbols to calculate their bounding box
// (hidden fields could be very long and artificially enlarge the sheet bounding box)
if( item->Type() == SCH_COMPONENT_T )
if( item->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* comp = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* comp = static_cast<SCH_SYMBOL*>( item );
bbox = comp->GetBodyBoundingBox();
for( const SCH_FIELD& field : comp->GetFields() )
@ -430,15 +430,15 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
LIB_PART* scaledPart = getScaledLibPart( kiPart, sym.ScaleRatioNumerator,
sym.ScaleRatioDenominator );
double symOrientDeciDeg = 0.0;
SCH_COMPONENT* component = loadSchematicSymbol( sym, *scaledPart, symOrientDeciDeg );
double symOrientDeciDeg = 0.0;
SCH_SYMBOL* symbol = loadSchematicSymbol( sym, *scaledPart, symOrientDeciDeg );
delete scaledPart;
if( copy )
delete kiPart;
SCH_FIELD* refField = component->GetField( REFERENCE_FIELD );
SCH_FIELD* refField = symbol->GetField( REFERENCE_FIELD );
sym.ComponentRef.Designator.Replace( wxT( "\n" ), wxT( "\\n" ) );
sym.ComponentRef.Designator.Replace( wxT( "\r" ), wxT( "\\r" ) );
@ -451,13 +451,13 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
if( sym.HasPartRef )
{
SCH_FIELD* partField = component->FindField( PartNameFieldName );
SCH_FIELD* partField = symbol->FindField( PartNameFieldName );
if( !partField )
{
int fieldID = component->GetFieldCount();
partField = component->AddField( SCH_FIELD( wxPoint(), fieldID, component,
PartNameFieldName ) );
int fieldID = symbol->GetFieldCount();
partField = symbol->AddField( SCH_FIELD( wxPoint(), fieldID, symbol,
PartNameFieldName ) );
}
wxASSERT( partField->GetName() == PartNameFieldName );
@ -481,13 +481,13 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
if( attrVal.HasLocation )
{
wxString attrName = getAttributeName( attrVal.AttributeID );
SCH_FIELD* attrField = component->FindField( attrName );
SCH_FIELD* attrField = symbol->FindField( attrName );
if( !attrField )
{
int fieldID = component->GetFieldCount();
attrField = component->AddField( SCH_FIELD( wxPoint(), fieldID,
component, attrName ) );
int fieldID = symbol->GetFieldCount();
attrField = symbol->AddField( SCH_FIELD( wxPoint(), fieldID,
symbol, attrName ) );
}
wxASSERT( attrField->GetName() == attrName );
@ -593,8 +593,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
sym.ScaleRatioDenominator );
double returnedOrient = 0.0;
SCH_COMPONENT* component = loadSchematicSymbol( sym, *scaledPart, returnedOrient );
m_powerSymMap.insert( { sym.ID, component } );
SCH_SYMBOL* symbol = loadSchematicSymbol( sym, *scaledPart, returnedOrient );
m_powerSymMap.insert( { sym.ID, symbol } );
delete scaledPart;
}
@ -636,7 +636,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
else
{
m_reporter->Report( wxString::Format( _( "Symbol ID '%s' is of an unknown type. It is "
"neither a component or a net power / symbol. "
"neither a symbol or a net power / symbol. "
"The symbol was not loaded." ),
sym.ID ),
RPT_SEVERITY_ERROR );
@ -879,7 +879,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
if( start.x == UNDEFINED_VALUE || end.x == UNDEFINED_VALUE )
continue;
// Connections in CADSTAR are always implied between components even if the route
// Connections in CADSTAR are always implied between symbols even if the route
// doesn't start and end exactly at the connection points
if( conn.Path.size() < 1 || conn.Path.front() != start )
conn.Path.insert( conn.Path.begin(), start );
@ -1582,8 +1582,9 @@ void CADSTAR_SCH_ARCHIVE_LOADER::applyToLibraryFieldAttribute(
}
SCH_COMPONENT* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(
const SYMBOL& aCadstarSymbol, const LIB_PART& aKiCadPart, double& aComponentOrientationDeciDeg )
SCH_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol( const SYMBOL& aCadstarSymbol,
const LIB_PART& aKiCadPart,
double& aComponentOrientationDeciDeg )
{
LIB_ID libId( m_libraryFileName.GetName(), aKiCadPart.GetName() );
int unit = getKiCadUnitNumberFromGate( aCadstarSymbol.GateID );
@ -1592,14 +1593,14 @@ SCH_COMPONENT* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(
SCH_SHEET* kiSheet = m_sheetMap.at( aCadstarSymbol.LayerID );
m_rootSheet->LocatePathOfScreen( kiSheet->GetScreen(), &sheetpath );
SCH_COMPONENT* component = new SCH_COMPONENT( aKiCadPart, libId, &sheetpath, unit );
SCH_SYMBOL* symbol = new SCH_SYMBOL( aKiCadPart, libId, &sheetpath, unit );
if( aCadstarSymbol.IsComponent )
{
component->SetRef( &sheetpath, aCadstarSymbol.ComponentRef.Designator );
symbol->SetRef( &sheetpath, aCadstarSymbol.ComponentRef.Designator );
}
component->SetPosition( getKiCadPoint( aCadstarSymbol.Origin ) );
symbol->SetPosition( getKiCadPoint( aCadstarSymbol.Origin ) );
double compAngleDeciDeg = getAngleTenthDegree( aCadstarSymbol.OrientAngle );
int compOrientation = 0;
@ -1607,7 +1608,7 @@ SCH_COMPONENT* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(
if( aCadstarSymbol.Mirror )
{
compAngleDeciDeg = -compAngleDeciDeg;
compOrientation += COMPONENT_ORIENTATION_T::CMP_MIRROR_Y;
compOrientation += SYMBOL_ORIENTATION_T::SYM_MIRROR_Y;
}
compOrientation += getComponentOrientation( compAngleDeciDeg, aComponentOrientationDeciDeg );
@ -1624,7 +1625,7 @@ SCH_COMPONENT* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(
RPT_SEVERITY_ERROR);
}
component->SetOrientation( compOrientation );
symbol->SetOrientation( compOrientation );
if( m_sheetMap.find( aCadstarSymbol.LayerID ) == m_sheetMap.end() )
{
@ -1635,7 +1636,7 @@ SCH_COMPONENT* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(
aCadstarSymbol.LayerID ),
RPT_SEVERITY_ERROR );
delete component;
delete symbol;
return nullptr;
}
@ -1652,7 +1653,7 @@ SCH_COMPONENT* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(
for( auto& term : termNumMap )
{
wxString pinNum = term.second;
pinNumToLibPinMap.insert( { pinNum, component->GetPartRef()->GetPin( term.second ) } );
pinNumToLibPinMap.insert( { pinNum, symbol->GetPartRef()->GetPin( term.second ) } );
}
auto replacePinNumber = [&]( wxString aOldPinNum, wxString aNewPinNum )
@ -1680,12 +1681,12 @@ SCH_COMPONENT* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol(
replacePinNumber( termNumMap.at( pin.TerminalID ), pin.NameOrLabel );
}
component->UpdatePins();
symbol->UpdatePins();
}
kiSheet->GetScreen()->Append( component );
kiSheet->GetScreen()->Append( symbol );
return component;
return symbol;
}
@ -1703,8 +1704,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute(
if( aIsMirrored )
{
// In KiCad, the angle of the symbol instance affects the position of the symbol fields because
// there is a distinction on x-axis and y-axis mirroring
// In KiCad, the angle of the symbol instance affects the position of the symbol
// fields because there is a distinction on x-axis and y-axis mirroring
double angleDeciDeg = NormalizeAnglePos( aComponentOrientationDeciDeg );
int quadrant = KiROUND( angleDeciDeg / 900.0 );
quadrant %= 4;
@ -1731,28 +1732,28 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolFieldAttribute(
int CADSTAR_SCH_ARCHIVE_LOADER::getComponentOrientation(
double aOrientAngleDeciDeg, double& aReturnedOrientationDeciDeg )
{
int compOrientation = COMPONENT_ORIENTATION_T::CMP_ORIENT_0;
int compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_0;
int oDeg = (int) NormalizeAngle180( aOrientAngleDeciDeg );
if( oDeg >= -450 && oDeg <= 450 )
{
compOrientation = COMPONENT_ORIENTATION_T::CMP_ORIENT_0;
compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_0;
aReturnedOrientationDeciDeg = 0.0;
}
else if( oDeg >= 450 && oDeg <= 1350 )
{
compOrientation = COMPONENT_ORIENTATION_T::CMP_ORIENT_90;
compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_90;
aReturnedOrientationDeciDeg = 900.0;
}
else if( oDeg >= 1350 || oDeg <= -1350 )
{
compOrientation = COMPONENT_ORIENTATION_T::CMP_ORIENT_180;
compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_180;
aReturnedOrientationDeciDeg = 1800.0;
}
else
{
compOrientation = COMPONENT_ORIENTATION_T::CMP_ORIENT_270;
compOrientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_270;
aReturnedOrientationDeciDeg = 2700.0;
}

View File

@ -39,7 +39,7 @@ class EDA_TEXT;
class LABEL_SPIN_STYLE;
class LIB_FIELD;
class LIB_PART;
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_ITEM;
class SCH_FIELD;
class SCH_GLOBALLABEL;
@ -103,7 +103,7 @@ private:
/// for a particular PART_ID and GATE_ID
std::map<PART_ID, TERMINAL_TO_PINNUM_MAP> m_pinNumsMap; ///< Map of pin numbers in CADSTAR parts
std::map<wxString, LIB_PART*> m_powerSymLibMap; ///< Map of KiCad Power Symbol Library items
std::map<SYMBOL_ID, SCH_COMPONENT*>
std::map<SYMBOL_ID, SCH_SYMBOL*>
m_powerSymMap; ///< Map between Cadstar and KiCad Power Symbols
std::map<SYMBOL_ID, SCH_GLOBALLABEL*>
m_globalLabelsMap; ///< Map between Cadstar and KiCad Global Labels
@ -143,7 +143,7 @@ private:
wxPoint aSymbolOrigin, LIB_FIELD* aKiCadField );
//Helper Functions for loading symbols in schematic
SCH_COMPONENT* loadSchematicSymbol( const SYMBOL& aCadstarSymbol, const LIB_PART& aKiCadPart,
SCH_SYMBOL* loadSchematicSymbol( const SYMBOL& aCadstarSymbol, const LIB_PART& aKiCadPart,
double& aComponentOrientationDeciDeg );
void loadSymbolFieldAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,

View File

@ -220,8 +220,8 @@ SCH_LAYER_ID SCH_EAGLE_PLUGIN::kiCadLayer( int aEagleLayer )
}
// Return the KiCad component orientation based on eagle rotation degrees.
static COMPONENT_ORIENTATION_T kiCadComponentRotation( float eagleDegrees )
// Return the KiCad symbol orientation based on eagle rotation degrees.
static SYMBOL_ORIENTATION_T kiCadComponentRotation( float eagleDegrees )
{
int roti = int( eagleDegrees );
@ -232,25 +232,25 @@ static COMPONENT_ORIENTATION_T kiCadComponentRotation( float eagleDegrees )
KI_FALLTHROUGH;
case 0:
return CMP_ORIENT_0;
return SYM_ORIENT_0;
case 90:
return CMP_ORIENT_90;
return SYM_ORIENT_90;
case 180:
return CMP_ORIENT_180;
return SYM_ORIENT_180;
case 270:
return CMP_ORIENT_270;
return SYM_ORIENT_270;
}
return CMP_ORIENT_0;
return SYM_ORIENT_0;
}
// Calculate text alignment based on the given Eagle text alignment parameters.
static void eagleToKicadAlignment( EDA_TEXT* aText, int aEagleAlignment, int aRelDegress,
bool aMirror, bool aSpin, int aAbsDegress )
bool aMirror, bool aSpin, int aAbsDegress )
{
int align = aEagleAlignment;
@ -637,11 +637,11 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
}
}
// Handle the missing component units that need to be instantiated
// Handle the missing symbol units that need to be instantiated
// to create the missing implicit connections
// Calculate the already placed items bounding box and the page size to determine
// placement for the new components
// placement for the new symbols
wxSize pageSizeIU = m_rootSheet->GetScreen()->GetPageSettings().GetSizeIU();
EDA_RECT sheetBbox = getSheetBbox( m_rootSheet );
wxPoint newCmpPosition( sheetBbox.GetLeft(), sheetBbox.GetBottom() );
@ -652,27 +652,27 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
for( auto& cmp : m_missingCmps )
{
const SCH_COMPONENT* origCmp = cmp.second.cmp;
const SCH_SYMBOL* origSymbol = cmp.second.cmp;
for( auto unitEntry : cmp.second.units )
{
if( unitEntry.second == false )
continue; // unit has been already processed
// Instantiate the missing component unit
// Instantiate the missing symbol unit
int unit = unitEntry.first;
const wxString reference = origCmp->GetField( REFERENCE_FIELD )->GetText();
std::unique_ptr<SCH_COMPONENT> component( (SCH_COMPONENT*) origCmp->Duplicate() );
const wxString reference = origSymbol->GetField( REFERENCE_FIELD )->GetText();
std::unique_ptr<SCH_SYMBOL> symbol( (SCH_SYMBOL*) origSymbol->Duplicate() );
component->SetUnitSelection( &sheetpath, unit );
component->SetUnit( unit );
component->SetOrientation( 0 );
component->AddHierarchicalReference( sheetpath.Path(), reference, unit );
symbol->SetUnitSelection( &sheetpath, unit );
symbol->SetUnit( unit );
symbol->SetOrientation( 0 );
symbol->AddHierarchicalReference( sheetpath.Path(), reference, unit );
// Calculate the placement position
EDA_RECT cmpBbox = component->GetBoundingBox();
EDA_RECT cmpBbox = symbol->GetBoundingBox();
int posY = newCmpPosition.y + cmpBbox.GetHeight();
component->SetPosition( wxPoint( newCmpPosition.x, posY ) );
symbol->SetPosition( wxPoint( newCmpPosition.x, posY ) );
newCmpPosition.x += cmpBbox.GetWidth();
maxY = std::max( maxY, posY );
@ -680,8 +680,8 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
newCmpPosition = wxPoint( sheetBbox.GetLeft(), maxY ); // then start a new row
// Add the global net labels to recreate the implicit connections
addImplicitConnections( component.get(), m_rootSheet->GetScreen(), false );
m_rootSheet->GetScreen()->Append( component.release() );
addImplicitConnections( symbol.get(), m_rootSheet->GetScreen(), false );
m_rootSheet->GetScreen()->Append( symbol.release() );
}
}
@ -840,9 +840,9 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
translation.y = translation.y - translation.y % Mils2iu( 100 );
// Add global net labels for the named power input pins in this sheet
for( auto item : m_currentSheet->GetScreen()->Items().OfType( SCH_COMPONENT_T ) )
addImplicitConnections(
static_cast<SCH_COMPONENT*>( item ), m_currentSheet->GetScreen(), true );
for( auto item : m_currentSheet->GetScreen()->Items().OfType( SCH_SYMBOL_T ) )
addImplicitConnections( static_cast<SCH_SYMBOL*>( item ), m_currentSheet->GetScreen(),
true );
m_connPoints.clear();
@ -1153,7 +1153,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
SCH_SCREEN* screen = m_currentSheet->GetScreen();
// Find the part in the list for the sheet.
// Assign the component its value from the part entry
// Assign the symbol its value from the part entry
// Calculate the unit number from the gate entry of the instance
// Assign the LIB_ID from device set and device names
@ -1198,19 +1198,19 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
return;
}
LIB_ID libId( getLibName(), kisymbolname );
std::unique_ptr<SCH_COMPONENT> component = std::make_unique<SCH_COMPONENT>();
component->SetLibId( libId );
component->SetUnit( unit );
component->SetPosition( wxPoint( einstance.x.ToSchUnits(), -einstance.y.ToSchUnits() ) );
component->GetField( FOOTPRINT_FIELD )->SetText( package );
LIB_ID libId( getLibName(), kisymbolname );
std::unique_ptr<SCH_SYMBOL> symbol = std::make_unique<SCH_SYMBOL>();
symbol->SetLibId( libId );
symbol->SetUnit( unit );
symbol->SetPosition( wxPoint( einstance.x.ToSchUnits(), -einstance.y.ToSchUnits() ) );
symbol->GetField( FOOTPRINT_FIELD )->SetText( package );
if( einstance.rot )
{
component->SetOrientation( kiCadComponentRotation( einstance.rot->degrees ) );
symbol->SetOrientation( kiCadComponentRotation( einstance.rot->degrees ) );
if( einstance.rot->mirror )
component->MirrorHorizontally( einstance.x.ToSchUnits() );
symbol->MirrorHorizontally( einstance.x.ToSchUnits() );
}
std::vector<LIB_FIELD*> partFields;
@ -1218,9 +1218,9 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
for( const LIB_FIELD* field : partFields )
{
component->GetFieldById( field->GetId() )->ImportValues( *field );
component->GetFieldById( field->GetId() )->SetTextPos( component->GetPosition()
+ field->GetTextPos() );
symbol->GetFieldById( field->GetId() )->ImportValues( *field );
symbol->GetFieldById( field->GetId() )->SetTextPos( symbol->GetPosition()
+ field->GetTextPos() );
}
// If there is no footprint assigned, then prepend the reference value
@ -1235,23 +1235,24 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
SCH_SHEET_PATH sheetpath;
m_rootSheet->LocatePathOfScreen( screen, &sheetpath );
wxString current_sheetpath = sheetpath.PathAsString() + component->m_Uuid.AsString();
wxString current_sheetpath = sheetpath.PathAsString() + symbol->m_Uuid.AsString();
component->GetField( REFERENCE_FIELD )->SetText( reference );
component->AddHierarchicalReference( current_sheetpath, reference, unit );
symbol->GetField( REFERENCE_FIELD )->SetText( reference );
symbol->AddHierarchicalReference( current_sheetpath, reference, unit );
if( epart->value )
component->GetField( VALUE_FIELD )->SetText( *epart->value );
symbol->GetField( VALUE_FIELD )->SetText( *epart->value );
else
component->GetField( VALUE_FIELD )->SetText( kisymbolname );
symbol->GetField( VALUE_FIELD )->SetText( kisymbolname );
// Set the visibility of fields.
component->GetField( REFERENCE_FIELD )->SetVisible( part->GetFieldById( REFERENCE_FIELD )->IsVisible() );
component->GetField( VALUE_FIELD )->SetVisible( part->GetFieldById( VALUE_FIELD )->IsVisible() );
symbol->GetField( REFERENCE_FIELD )->SetVisible(
part->GetFieldById( REFERENCE_FIELD )->IsVisible() );
symbol->GetField( VALUE_FIELD )->SetVisible( part->GetFieldById( VALUE_FIELD )->IsVisible() );
for( const auto& a : epart->attribute )
{
auto field = component->AddField( *component->GetField( VALUE_FIELD ) );
auto field = symbol->AddField( *symbol->GetField( VALUE_FIELD ) );
field->SetName( a.first );
field->SetText( a.second );
field->SetVisible( false );
@ -1259,7 +1260,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
for( const auto& a : epart->variant )
{
auto field = component->AddField( *component->GetField( VALUE_FIELD ) );
auto field = symbol->AddField( *symbol->GetField( VALUE_FIELD ) );
field->SetName( "VARIANT_" + a.first );
field->SetText( a.second );
field->SetVisible( false );
@ -1280,17 +1281,17 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
if( attr.name.Lower() == "name" )
{
field = component->GetField( REFERENCE_FIELD );
field = symbol->GetField( REFERENCE_FIELD );
nameAttributeFound = true;
}
else if( attr.name.Lower() == "value" )
{
field = component->GetField( VALUE_FIELD );
field = symbol->GetField( VALUE_FIELD );
valueAttributeFound = true;
}
else
{
field = component->FindField( attr.name );
field = symbol->FindField( attr.name );
if( field )
field->SetVisible( false );
@ -1327,7 +1328,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
if( attributeNode->GetAttribute( "name", &variant )
&& attributeNode->GetAttribute( "value", &value ) )
{
auto field = component->AddField( *component->GetField( VALUE_FIELD ) );
auto field = symbol->AddField( *symbol->GetField( VALUE_FIELD ) );
field->SetName( "VARIANT_" + variant );
field->SetText( value );
field->SetVisible( false );
@ -1340,29 +1341,29 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
if( einstance.smashed && einstance.smashed.Get() )
{
if( !valueAttributeFound )
component->GetField( VALUE_FIELD )->SetVisible( false );
symbol->GetField( VALUE_FIELD )->SetVisible( false );
if( !nameAttributeFound )
component->GetField( REFERENCE_FIELD )->SetVisible( false );
symbol->GetField( REFERENCE_FIELD )->SetVisible( false );
}
// Save the pin positions
SYMBOL_LIB_TABLE& schLibTable = *m_schematic->Prj().SchSymbolLibTable();
LIB_PART* libSymbol = schLibTable.LoadSymbol( component->GetLibId() );
LIB_PART* libSymbol = schLibTable.LoadSymbol( symbol->GetLibId() );
wxCHECK( libSymbol, /*void*/ );
component->SetLibSymbol( new LIB_PART( *libSymbol ) );
symbol->SetLibSymbol( new LIB_PART( *libSymbol ) );
std::vector<LIB_PIN*> pins;
component->GetLibPins( pins );
symbol->GetLibPins( pins );
for( const auto& pin : pins )
m_connPoints[component->GetPinPhysicalPosition( pin )].emplace( pin );
m_connPoints[symbol->GetPinPhysicalPosition( pin )].emplace( pin );
component->ClearFlags();
symbol->ClearFlags();
screen->Append( component.release() );
screen->Append( symbol.release() );
}
@ -2781,10 +2782,9 @@ const SEG* SCH_EAGLE_PLUGIN::SEG_DESC::LabelAttached( const SCH_TEXT* aLabel ) c
// TODO could be used to place junctions, instead of IsJunctionNeeded()
// (see SCH_EDIT_FRAME::importFile())
bool SCH_EAGLE_PLUGIN::checkConnections(
const SCH_COMPONENT* aComponent, const LIB_PIN* aPin ) const
bool SCH_EAGLE_PLUGIN::checkConnections( const SCH_SYMBOL* aSymbol, const LIB_PIN* aPin ) const
{
wxPoint pinPosition = aComponent->GetPinPhysicalPosition( aPin );
wxPoint pinPosition = aSymbol->GetPinPhysicalPosition( aPin );
auto pointIt = m_connPoints.find( pinPosition );
if( pointIt == m_connPoints.end() )
@ -2796,20 +2796,20 @@ bool SCH_EAGLE_PLUGIN::checkConnections(
}
void SCH_EAGLE_PLUGIN::addImplicitConnections(
SCH_COMPONENT* aComponent, SCH_SCREEN* aScreen, bool aUpdateSet )
void SCH_EAGLE_PLUGIN::addImplicitConnections( SCH_SYMBOL* aSymbol, SCH_SCREEN* aScreen,
bool aUpdateSet )
{
wxCHECK( aComponent->GetPartRef(), /*void*/ );
wxCHECK( aSymbol->GetPartRef(), /*void*/ );
// Normally power parts also have power input pins,
// but they already force net names on the attached wires
if( aComponent->GetPartRef()->IsPower() )
if( aSymbol->GetPartRef()->IsPower() )
return;
int unit = aComponent->GetUnit();
const wxString reference = aComponent->GetField( REFERENCE_FIELD )->GetText();
int unit = aSymbol->GetUnit();
const wxString reference = aSymbol->GetField( REFERENCE_FIELD )->GetText();
std::vector<LIB_PIN*> pins;
aComponent->GetPartRef()->GetPins( pins );
aSymbol->GetPartRef()->GetPins( pins );
std::set<int> missingUnits;
// Search all units for pins creating implicit connections
@ -2822,11 +2822,11 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections(
// Create a global net label only if there are no other wires/pins attached
if( pinInUnit )
{
if( !checkConnections( aComponent, pin ) )
if( !checkConnections( aSymbol, pin ) )
{
// Create a net label to force the net name on the pin
SCH_GLOBALLABEL* netLabel = new SCH_GLOBALLABEL;
netLabel->SetPosition( aComponent->GetPinPhysicalPosition( pin ) );
netLabel->SetPosition( aSymbol->GetPinPhysicalPosition( pin ) );
netLabel->SetText( extractNetName( pin->GetName() ) );
netLabel->SetTextSize( wxSize( Mils2iu( 40 ), Mils2iu( 40 ) ) );
netLabel->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT );
@ -2844,7 +2844,7 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections(
}
}
if( aUpdateSet && aComponent->GetPartRef()->GetUnitCount() > 1 )
if( aUpdateSet && aSymbol->GetPartRef()->GetUnitCount() > 1 )
{
auto cmpIt = m_missingCmps.find( reference );
@ -2852,7 +2852,7 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections(
if( cmpIt == m_missingCmps.end() )
{
EAGLE_MISSING_CMP& entry = m_missingCmps[reference];
entry.cmp = aComponent;
entry.cmp = aSymbol;
entry.units.emplace( unit, false );
}
else
@ -2864,7 +2864,7 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections(
if( !missingUnits.empty() ) // Save the units that need later processing
{
EAGLE_MISSING_CMP& entry = m_missingCmps[reference];
entry.cmp = aComponent;
entry.cmp = aSymbol;
// Add units that haven't already been processed.
for( int i : missingUnits )

View File

@ -45,7 +45,7 @@ class SCH_LINE;
class SCH_BUS_ENTRY_BASE;
class SCH_TEXT;
class SCH_GLOBALLABEL;
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_FIELD;
class PROPERTIES;
class SCH_EAGLE_PLUGIN_CACHE;
@ -166,7 +166,7 @@ private:
wxFileName getLibFileName();
///< Checks if there are other wires or pins at the position of the tested pin
bool checkConnections( const SCH_COMPONENT* aComponent, const LIB_PIN* aPin ) const;
bool checkConnections( const SCH_SYMBOL* aSymbol, const LIB_PIN* aPin ) const;
/**
* Create net labels to emulate implicit connections in Eagle.
@ -176,11 +176,11 @@ private:
* units that are not instantiated in the schematics, therefore such units need to be stored
* in order to create them at later stage.
*
* @param aComponent is the component to process.
* @param aSymbol is the symbol to process.
* @param aScreen is the screen where net labels should be added.
* @param aUpdateSet decides whether the missing units data should be updated.
*/
void addImplicitConnections( SCH_COMPONENT* aComponent, SCH_SCREEN* aScreen, bool aUpdateSet );
void addImplicitConnections( SCH_SYMBOL* aSymbol, SCH_SCREEN* aScreen, bool aUpdateSet );
bool netHasPowerDriver( SCH_LINE* aLine, const wxString& aNetName ) const;
@ -198,15 +198,15 @@ private:
// (named power pins in Eagle).
struct EAGLE_MISSING_CMP
{
EAGLE_MISSING_CMP( const SCH_COMPONENT* aComponent = nullptr )
: cmp( aComponent )
EAGLE_MISSING_CMP( const SCH_SYMBOL* aSymbol = nullptr )
: cmp( aSymbol )
{
}
///< Link to the parent component
const SCH_COMPONENT* cmp;
///< Link to the parent symbol
const SCH_SYMBOL* cmp;
/* Map of the component units: for each unit there is a flag saying
/* Map of the symbol units: for each unit there is a flag saying
* whether the unit needs to be instantiated with appropriate net labels to
* emulate implicit connections as is done in Eagle.
*/
@ -215,7 +215,7 @@ private:
REPORTER* m_reporter; ///< Reporter for warnings/errors
///< Map references to missing component units data
///< Map references to missing symbol units data
std::map<wxString, EAGLE_MISSING_CMP> m_missingCmps;
SCH_SHEET* m_rootSheet; ///< The root sheet of the schematic being loaded

View File

@ -44,7 +44,7 @@
#include <sch_bitmap.h>
#include <sch_bus_entry.h>
#include <sch_symbol.h>
#include <sch_edit_frame.h> // CMP_ORIENT_XXX
#include <sch_edit_frame.h> // SYM_ORIENT_XXX
#include <sch_field.h>
#include <sch_line.h>
#include <sch_junction.h>
@ -2224,7 +2224,7 @@ void SCH_SEXPR_PARSER::ParseSchematic( SCH_SHEET* aSheet, bool aIsCopyableOnly,
}
SCH_COMPONENT* SCH_SEXPR_PARSER::parseSchematicSymbol()
SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol()
{
wxCHECK_MSG( CurTok() == T_symbol, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a symbol." ) );
@ -2234,7 +2234,7 @@ SCH_COMPONENT* SCH_SEXPR_PARSER::parseSchematicSymbol()
wxString error;
wxString libName;
SCH_FIELD* field;
std::unique_ptr<SCH_COMPONENT> symbol = std::make_unique<SCH_COMPONENT>();
std::unique_ptr<SCH_SYMBOL> symbol = std::make_unique<SCH_SYMBOL>();
TRANSFORM transform;
std::set<int> fieldIDsRead;
@ -2313,9 +2313,9 @@ SCH_COMPONENT* SCH_SEXPR_PARSER::parseSchematicSymbol()
token = NextTok();
if( token == T_x )
symbol->SetOrientation( CMP_MIRROR_X );
symbol->SetOrientation( SYM_MIRROR_X );
else if( token == T_y )
symbol->SetOrientation( CMP_MIRROR_Y );
symbol->SetOrientation( SYM_MIRROR_Y );
else
Expecting( "x or y" );

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Wayne Stambaugh <stambaughw@gmail.com>
*
@ -49,7 +50,7 @@ class LIB_TEXT;
class PAGE_INFO;
class SCH_BITMAP;
class SCH_BUS_WIRE_ENTRY;
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_FIELD;
class SCH_JUNCTION;
class SCH_LINE;
@ -172,7 +173,7 @@ class SCH_SEXPR_PARSER : public SCHEMATIC_LEXER
SCH_SHEET_PIN* parseSchSheetPin( SCH_SHEET* aSheet );
SCH_FIELD* parseSchField( SCH_ITEM* aParent );
SCH_COMPONENT* parseSchematicSymbol();
SCH_SYMBOL* parseSchematicSymbol();
SCH_BITMAP* parseImage();
SCH_SHEET* parseSheet();
SCH_JUNCTION* parseJunction();

View File

@ -34,7 +34,7 @@
#include <sch_bitmap.h>
#include <sch_bus_entry.h>
#include <sch_symbol.h>
#include <sch_edit_frame.h> // COMPONENT_ORIENTATION_T
#include <sch_edit_frame.h> // SYMBOL_ORIENTATION_T
#include <sch_junction.h>
#include <sch_line.h>
#include <sch_no_connect.h>
@ -299,7 +299,7 @@ class SCH_SEXPR_PLUGIN_CACHE
bool m_isWritable;
bool m_isModified;
int m_versionMajor;
SCH_LIB_TYPE m_libType; // Is this cache a component or symbol library.
SCH_LIB_TYPE m_libType; // Is this cache a symbol or symbol library.
LIB_PART* removeSymbol( LIB_PART* aAlias );
@ -630,7 +630,7 @@ void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
{
itemType = item->Type();
if( itemType != SCH_COMPONENT_T
if( itemType != SCH_SYMBOL_T
&& itemType != SCH_JUNCTION_T
&& itemType != SCH_SHEET_T )
m_out->Print( 0, "\n" );
@ -638,9 +638,9 @@ void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
switch( item->Type() )
{
case SCH_COMPONENT_T:
case SCH_SYMBOL_T:
m_out->Print( 0, "\n" );
saveSymbol( static_cast<SCH_COMPONENT*>( item ), nullptr, 1 );
saveSymbol( static_cast<SCH_SYMBOL*>( item ), nullptr, 1 );
break;
case SCH_BITMAP_T:
@ -741,10 +741,10 @@ void SCH_SEXPR_PLUGIN::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSelect
wxCHECK2( item, continue );
if( item->Type() != SCH_COMPONENT_T )
if( item->Type() != SCH_SYMBOL_T )
continue;
SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item );
wxCHECK2( symbol, continue );
@ -781,10 +781,10 @@ void SCH_SEXPR_PLUGIN::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSelect
switch( item->Type() )
{
case SCH_COMPONENT_T:
saveSymbol( static_cast<SCH_COMPONENT*>( item ), aSelectionPath, 0 );
case SCH_SYMBOL_T:
saveSymbol( static_cast<SCH_SYMBOL*>( item ), aSelectionPath, 0 );
aSelectionPath->AppendSymbol( selectedSymbols, static_cast<SCH_COMPONENT*>( item ),
aSelectionPath->AppendSymbol( selectedSymbols, static_cast<SCH_SYMBOL*>( item ),
true, true );
break;
@ -861,7 +861,7 @@ void SCH_SEXPR_PLUGIN::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSelect
}
void SCH_SEXPR_PLUGIN::saveSymbol( SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aSheetPath,
void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPath,
int aNestLevel )
{
wxCHECK_RET( aSymbol != nullptr && m_out != nullptr, "" );
@ -883,13 +883,13 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aShee
}
double angle;
int orientation = aSymbol->GetOrientation() & ~( CMP_MIRROR_X | CMP_MIRROR_Y );
int orientation = aSymbol->GetOrientation() & ~( SYM_MIRROR_X | SYM_MIRROR_Y );
if( orientation == CMP_ORIENT_90 )
if( orientation == SYM_ORIENT_90 )
angle = 90.0;
else if( orientation == CMP_ORIENT_180 )
else if( orientation == SYM_ORIENT_180 )
angle = 180.0;
else if( orientation == CMP_ORIENT_270 )
else if( orientation == SYM_ORIENT_270 )
angle = 270.0;
else
angle = 0.0;
@ -908,8 +908,8 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_COMPONENT* aSymbol, SCH_SHEET_PATH* aShee
FormatInternalUnits( aSymbol->GetPosition().y ).c_str(),
FormatAngle( angle * 10.0 ).c_str() );
bool mirrorX = aSymbol->GetOrientation() & CMP_MIRROR_X;
bool mirrorY = aSymbol->GetOrientation() & CMP_MIRROR_Y;
bool mirrorX = aSymbol->GetOrientation() & SYM_MIRROR_X;
bool mirrorY = aSymbol->GetOrientation() & SYM_MIRROR_Y;
if( mirrorX || mirrorY )
{
@ -984,7 +984,7 @@ void SCH_SEXPR_PLUGIN::saveField( SCH_FIELD* aField, int aNestLevel )
// For some reason (bug in legacy parser?) the field ID for non-mandatory fields is -1 so
// check for this in order to correctly use the field name.
if( aField->GetParent()->Type() == SCH_COMPONENT_T )
if( aField->GetParent()->Type() == SCH_SYMBOL_T )
{
if( aField->GetId() >= 0 && aField->GetId() < MANDATORY_FIELDS )
fieldName = TEMPLATE_FIELDNAME::GetDefaultFieldName( aField->GetId(), false );
@ -2110,7 +2110,7 @@ void SCH_SEXPR_PLUGIN::cacheLib( const wxString& aLibraryFileName, const PROPERT
m_cache = new SCH_SEXPR_PLUGIN_CACHE( aLibraryFileName );
// Because m_cache is rebuilt, increment PART_LIBS::s_modify_generation
// to modify the hash value that indicate component to symbol links
// to modify the hash value that indicate symbol to symbol links
// must be updated.
PART_LIBS::IncrementModifyGeneration();

View File

@ -5,6 +5,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Wayne Stambaugh <stambaughw@gmail.com>
*
@ -40,7 +41,7 @@ class SCH_NO_CONNECT;
class SCH_LINE;
class SCH_BUS_ENTRY_BASE;
class SCH_TEXT;
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_FIELD;
struct SYMBOL_INSTANCE_REFERENCE;
class PROPERTIES;
@ -134,7 +135,7 @@ private:
void loadHierarchy( SCH_SHEET* aSheet );
void loadFile( const wxString& aFileName, SCH_SHEET* aSheet );
void saveSymbol( SCH_COMPONENT* aComponent, SCH_SHEET_PATH* aSheetPath, int aNestLevel );
void saveSymbol( SCH_SYMBOL* aComponent, SCH_SHEET_PATH* aSheetPath, int aNestLevel );
void saveField( SCH_FIELD* aField, int aNestLevel );
void saveBitmap( SCH_BITMAP* aBitmap, int aNestLevel );
void saveSheet( SCH_SHEET* aSheet, int aNestLevel );

View File

@ -433,7 +433,7 @@ static void parseQuotedString( wxString& aString, LINE_READER& aReader,
// Do not copy the escape byte if it is followed by \ or "
if( *tmp != '"' && *tmp != '\\' )
utf8 += '\\';
utf8 += '\\';
utf8 += *tmp;
}
@ -488,7 +488,7 @@ class SCH_LEGACY_PLUGIN_CACHE
bool m_isModified;
int m_versionMajor;
int m_versionMinor;
SCH_LIB_TYPE m_libType; // Is this cache a component or symbol library.
SCH_LIB_TYPE m_libType; // Is this cache a symbol or symbol library.
void loadHeader( FILE_LINE_READER& aReader );
static void loadAliases( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader,
@ -1492,13 +1492,13 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader )
}
SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
{
const char* line = aReader.Line();
wxCHECK( strCompare( "$Comp", line, &line ), NULL );
std::unique_ptr<SCH_COMPONENT> symbol = std::make_unique<SCH_COMPONENT>();
std::unique_ptr<SCH_SYMBOL> symbol = std::make_unique<SCH_SYMBOL>();
line = aReader.ReadLine();
@ -1672,7 +1672,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
if( index >= symbol->GetFieldCount() )
{
// The first MANDATOR_FIELDS _must_ be constructed within the SCH_COMPONENT
// The first MANDATOR_FIELDS _must_ be constructed within the SCH_SYMBOL
// constructor. This assert is simply here to guard against a change in that
// constructor.
wxASSERT( symbol->GetFieldCount() >= MANDATORY_FIELDS );
@ -1920,8 +1920,8 @@ void SCH_LEGACY_PLUGIN::Format( SCH_SHEET* aSheet )
{
switch( item->Type() )
{
case SCH_COMPONENT_T:
saveComponent( static_cast<SCH_COMPONENT*>( item ) );
case SCH_SYMBOL_T:
saveSymbol( static_cast<SCH_SYMBOL*>( item ) );
break;
case SCH_BITMAP_T:
saveBitmap( static_cast<SCH_BITMAP*>( item ) );
@ -1967,8 +1967,8 @@ void SCH_LEGACY_PLUGIN::Format( SELECTION* aSelection, OUTPUTFORMATTER* aFormatt
switch( item->Type() )
{
case SCH_COMPONENT_T:
saveComponent( static_cast< SCH_COMPONENT* >( item ) );
case SCH_SYMBOL_T:
saveSymbol( static_cast< SCH_SYMBOL* >( item ) );
break;
case SCH_BITMAP_T:
saveBitmap( static_cast< SCH_BITMAP* >( item ) );
@ -2002,7 +2002,7 @@ void SCH_LEGACY_PLUGIN::Format( SELECTION* aSelection, OUTPUTFORMATTER* aFormatt
}
void SCH_LEGACY_PLUGIN::saveComponent( SCH_COMPONENT* aComponent )
void SCH_LEGACY_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol )
{
std::string name1;
std::string name2;
@ -2010,20 +2010,20 @@ void SCH_LEGACY_PLUGIN::saveComponent( SCH_COMPONENT* aComponent )
static wxString delimiters( wxT( " " ) );
// This is redundant with the AR entries below, but it makes the files backwards-compatible.
if( aComponent->GetInstanceReferences().size() > 0 )
if( aSymbol->GetInstanceReferences().size() > 0 )
{
const SYMBOL_INSTANCE_REFERENCE& instance = aComponent->GetInstanceReferences()[0];
const SYMBOL_INSTANCE_REFERENCE& instance = aSymbol->GetInstanceReferences()[0];
name1 = toUTFTildaText( instance.m_Reference );
}
else
{
if( aComponent->GetField( REFERENCE_FIELD )->GetText().IsEmpty() )
name1 = toUTFTildaText( aComponent->GetPrefix() );
if( aSymbol->GetField( REFERENCE_FIELD )->GetText().IsEmpty() )
name1 = toUTFTildaText( aSymbol->GetPrefix() );
else
name1 = toUTFTildaText( aComponent->GetField( REFERENCE_FIELD )->GetText() );
name1 = toUTFTildaText( aSymbol->GetField( REFERENCE_FIELD )->GetText() );
}
wxString part_name = aComponent->GetLibId().Format();
wxString part_name = aSymbol->GetLibId().Format();
if( part_name.size() )
{
@ -2039,23 +2039,23 @@ void SCH_LEGACY_PLUGIN::saveComponent( SCH_COMPONENT* aComponent )
// Generate unit number, conversion and timestamp
m_out->Print( 0, "U %d %d %8.8X\n",
aComponent->GetUnit(),
aComponent->GetConvert(),
aComponent->m_Uuid.AsLegacyTimestamp() );
aSymbol->GetUnit(),
aSymbol->GetConvert(),
aSymbol->m_Uuid.AsLegacyTimestamp() );
// Save the position
m_out->Print( 0, "P %d %d\n",
Iu2Mils( aComponent->GetPosition().x ),
Iu2Mils( aComponent->GetPosition().y ) );
Iu2Mils( aSymbol->GetPosition().x ),
Iu2Mils( aSymbol->GetPosition().y ) );
/* If this is a complex hierarchy; save hierarchical references.
* but for simple hierarchies it is not necessary.
* the reference inf is already saved
* this is useful for old Eeschema version compatibility
*/
if( aComponent->GetInstanceReferences().size() > 1 )
if( aSymbol->GetInstanceReferences().size() > 1 )
{
for( const SYMBOL_INSTANCE_REFERENCE& instance : aComponent->GetInstanceReferences() )
for( const SYMBOL_INSTANCE_REFERENCE& instance : aSymbol->GetInstanceReferences() )
{
/*format:
* AR Path="/140/2" Ref="C99" Part="1"
@ -2071,36 +2071,36 @@ void SCH_LEGACY_PLUGIN::saveComponent( SCH_COMPONENT* aComponent )
path += instance.m_Path[i].AsLegacyTimestampString() + "/";
m_out->Print( 0, "AR Path=\"%s\" Ref=\"%s\" Part=\"%d\" \n",
TO_UTF8( path + aComponent->m_Uuid.AsLegacyTimestampString() ),
TO_UTF8( path + aSymbol->m_Uuid.AsLegacyTimestampString() ),
TO_UTF8( instance.m_Reference ),
instance.m_Unit );
}
}
// update the ugly field id, which I would like to see go away someday soon.
for( int i = 0; i < aComponent->GetFieldCount(); ++i )
aComponent->GetFields()[i].SetId( i );
for( int i = 0; i < aSymbol->GetFieldCount(); ++i )
aSymbol->GetFields()[i].SetId( i );
// Fixed fields:
// Save mandatory fields even if they are blank,
// because the visibility, size and orientation are set from library editor.
for( unsigned i = 0; i < MANDATORY_FIELDS; ++i )
saveField( &aComponent->GetFields()[i] );
saveField( &aSymbol->GetFields()[i] );
// User defined fields:
// The *policy* about which user defined fields are part of a symbol is now
// only in the dialog editors. No policy should be enforced here, simply
// save all the user defined fields, they are present because a dialog editor
// thought they should be. If you disagree, go fix the dialog editors.
for( int i = MANDATORY_FIELDS; i < aComponent->GetFieldCount(); ++i )
saveField( &aComponent->GetFields()[i] );
for( int i = MANDATORY_FIELDS; i < aSymbol->GetFieldCount(); ++i )
saveField( &aSymbol->GetFields()[i] );
// Unit number, position, box ( old standard )
m_out->Print( 0, "\t%-4d %-4d %-4d\n", aComponent->GetUnit(),
Iu2Mils( aComponent->GetPosition().x ),
Iu2Mils( aComponent->GetPosition().y ) );
m_out->Print( 0, "\t%-4d %-4d %-4d\n", aSymbol->GetUnit(),
Iu2Mils( aSymbol->GetPosition().x ),
Iu2Mils( aSymbol->GetPosition().y ) );
TRANSFORM transform = aComponent->GetTransform();
TRANSFORM transform = aSymbol->GetTransform();
m_out->Print( 0, "\t%-4d %-4d %-4d %-4d\n",
transform.x1, transform.y1, transform.x2, transform.y2 );
@ -2581,7 +2581,7 @@ void SCH_LEGACY_PLUGIN_CACHE::Load()
// Old .sym files (which are libraries with only one symbol, used to store and reuse shapes)
// EESchema-LIB Version x.x SYMBOL. They are valid files.
if( !strCompare( "EESchema-LIB Version", line, &line ) )
SCH_PARSE_ERROR( "file is not a valid component or symbol library file", reader, line );
SCH_PARSE_ERROR( "file is not a valid symbol or symbol library file", reader, line );
}
m_versionMajor = parseInt( reader, line, &line );
@ -2596,7 +2596,7 @@ void SCH_LEGACY_PLUGIN_CACHE::Load()
if( m_versionMajor < 1 || m_versionMinor < 0 || m_versionMinor > 99 )
SCH_PARSE_ERROR( "invalid file version in header", reader, line );
// Check if this is a symbol library which is the same as a component library but without
// Check if this is a symbol library which is the same as a symbol library but without
// any alias, documentation, footprint filters, etc.
if( strCompare( "SYMBOL", line, &line ) )
{
@ -2895,7 +2895,7 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::LoadPart( LINE_READER& aReader, int aMajorVer
pos += tmp.size() + 1;
}
// There is the optional power component flag.
// There is the optional power symbol flag.
if( tokens.HasMoreTokens() )
{
tmp = tokens.GetNextToken();
@ -3008,7 +3008,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField( std::unique_ptr<LIB_PART>& aPart,
field = aPart->GetFieldById( id );
// this will fire only if somebody broke a constructor or editor.
// MANDATORY_FIELDS are always present in ram resident components, no
// MANDATORY_FIELDS are always present in ram resident symbols, no
// exceptions, and they always have their names set, even fixed fields.
wxASSERT( field );
}
@ -3198,7 +3198,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadDrawEntries( std::unique_ptr<LIB_PART>& aPart,
line = aReader.ReadLine();
}
SCH_PARSE_ERROR( "file ended prematurely loading component draw element", aReader, line );
SCH_PARSE_ERROR( "file ended prematurely loading symbol draw element", aReader, line );
}
@ -3362,7 +3362,7 @@ LIB_TEXT* SCH_LEGACY_PLUGIN_CACHE::loadText( std::unique_ptr<LIB_PART>& aPart,
// Here things are murky and not well defined. At some point it appears the format
// was changed to add text properties. However rather than add the token to the end of
// the text definition, it was added after the string and no mention if the file
// verion was bumped or not so this code make break on very old component libraries.
// verion was bumped or not so this code make break on very old symbol libraries.
//
// Update: apparently even in the latest version this can be different so added a test
// for end of line before checking for the text properties.
@ -3771,7 +3771,7 @@ void SCH_LEGACY_PLUGIN_CACHE::SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aF
LIB_FIELD& value = aSymbol->GetValueField();
// First line: it s a comment (component name for readers)
// First line: it s a comment (symbol name for readers)
aFormatter.Print( 0, "#\n# %s\n#\n", TO_UTF8( value.GetText() ) );
// Save data
@ -4212,7 +4212,7 @@ void SCH_LEGACY_PLUGIN::cacheLib( const wxString& aLibraryFileName, const PROPER
m_cache = new SCH_LEGACY_PLUGIN_CACHE( aLibraryFileName );
// Because m_cache is rebuilt, increment PART_LIBS::s_modify_generation
// to modify the hash value that indicate component to symbol links
// to modify the hash value that indicate symbol to symbol links
// must be updated.
PART_LIBS::IncrementModifyGeneration();

View File

@ -5,7 +5,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 CERN
* Copyright (C) 2016-2019 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2016-2021 KiCad Developers, see change_log.txt for contributors.
*
* @author Wayne Stambaugh <stambaughw@gmail.com>
*
@ -39,7 +39,7 @@ class SCH_NO_CONNECT;
class SCH_LINE;
class SCH_BUS_ENTRY_BASE;
class SCH_TEXT;
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_FIELD;
class PROPERTIES;
class SELECTION;
@ -150,10 +150,10 @@ private:
SCH_LINE* loadWire( LINE_READER& aReader );
SCH_BUS_ENTRY_BASE* loadBusEntry( LINE_READER& aReader );
SCH_TEXT* loadText( LINE_READER& aReader );
SCH_COMPONENT* loadSymbol( LINE_READER& aReader );
SCH_SYMBOL* loadSymbol( LINE_READER& aReader );
std::shared_ptr<BUS_ALIAS> loadBusAlias( LINE_READER& aReader, SCH_SCREEN* aScreen );
void saveComponent( SCH_COMPONENT* aComponent );
void saveSymbol( SCH_SYMBOL* aSymbol );
void saveField( SCH_FIELD* aField );
void saveBitmap( SCH_BITMAP* aBitmap );
void saveSheet( SCH_SHEET* aSheet );

View File

@ -57,11 +57,11 @@ public:
m_sheetNum = 0;
}
SCH_REFERENCE( SCH_COMPONENT* aSymbol, LIB_PART* aLibPart, const SCH_SHEET_PATH& aSheetPath );
SCH_REFERENCE( SCH_SYMBOL* aSymbol, LIB_PART* aLibPart, const SCH_SHEET_PATH& aSheetPath );
SCH_COMPONENT* GetSymbol() const { return m_rootSymbol; }
SCH_SYMBOL* GetSymbol() const { return m_rootSymbol; }
LIB_PART* GetLibPart() const { return m_libPart; }
LIB_PART* GetLibPart() const { return m_libPart; }
const SCH_SHEET_PATH& GetSheetPath() const { return m_sheetPath; }
@ -169,7 +169,7 @@ private:
/// Symbol reference prefix, without number (for IC1, this is IC) )
UTF8 m_ref; // it's private, use the accessors please
SCH_COMPONENT* m_rootSymbol; ///< The symbol associated the reference object.
SCH_SYMBOL* m_rootSymbol; ///< The symbol associated the reference object.
LIB_PART* m_libPart; ///< The source symbol from a library.
wxPoint m_symbolPos; ///< The physical position of the symbol in schematic
///< used to annotate by X or Y position

View File

@ -171,7 +171,7 @@ public:
* The #EE_TYPE struct provides a type-specific auto-range iterator to the RTree. Using
* this struct, one can write lines like:
*
* for( auto item : rtree.OfType( SCH_COMPONENT_T ) )
* for( auto item : rtree.OfType( SCH_SYMBOL_T ) )
*
* and iterate over the RTree items that are symbols only
*/

View File

@ -148,9 +148,9 @@ void SCH_SCREEN::Append( SCH_ITEM* aItem )
// Ensure the item can reach the SCHEMATIC through this screen
aItem->SetParent( this );
if( aItem->Type() == SCH_COMPONENT_T )
if( aItem->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( aItem );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aItem );
if( symbol->GetPartRef() )
{
@ -262,15 +262,15 @@ bool SCH_SCREEN::Remove( SCH_ITEM* aItem )
bool retv = m_rtree.remove( aItem );
// Check if the library symbol for the removed schematic symbol is still required.
if( retv && aItem->Type() == SCH_COMPONENT_T )
if( retv && aItem->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* removedSymbol = static_cast<SCH_COMPONENT*>( aItem );
SCH_SYMBOL* removedSymbol = static_cast<SCH_SYMBOL*>( aItem );
bool removeUnusedLibSymbol = true;
for( SCH_ITEM* item : Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
if( removedSymbol->GetSchSymbolLibraryName() == symbol->GetSchSymbolLibraryName() )
{
@ -439,7 +439,7 @@ bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew ) const
break;
case SCH_BUS_WIRE_ENTRY_T:
case SCH_COMPONENT_T:
case SCH_SYMBOL_T:
case SCH_SHEET_T:
if( item->IsConnected( aPosition ) )
{
@ -541,14 +541,14 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter )
wxString msg;
std::unique_ptr< LIB_PART > libSymbol;
std::vector<SCH_COMPONENT*> symbols;
std::vector<SCH_SYMBOL*> symbols;
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();
for( auto item : Items().OfType( SCH_COMPONENT_T ) )
symbols.push_back( static_cast<SCH_COMPONENT*>( item ) );
for( auto item : Items().OfType( SCH_SYMBOL_T ) )
symbols.push_back( static_cast<SCH_SYMBOL*>( item ) );
// Remove them from the R tree. There bounding box size may change.
for( auto symbol : symbols )
@ -692,12 +692,12 @@ void SCH_SCREEN::UpdateSymbolLinks( REPORTER* aReporter )
void SCH_SCREEN::UpdateLocalLibSymbolLinks()
{
std::vector<SCH_COMPONENT*> symbols;
std::vector<SCH_SYMBOL*> symbols;
for( SCH_ITEM* item : Items().OfType( SCH_COMPONENT_T ) )
symbols.push_back( static_cast<SCH_COMPONENT*>( item ) );
for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
symbols.push_back( static_cast<SCH_SYMBOL*>( item ) );
for( SCH_COMPONENT* symbol : symbols )
for( SCH_SYMBOL* symbol : symbols )
{
// Changing the symbol may adjust the bbox of the symbol; remove and reinsert it afterwards.
m_rtree.remove( symbol );
@ -716,8 +716,7 @@ void SCH_SCREEN::UpdateLocalLibSymbolLinks()
}
void SCH_SCREEN::SwapSymbolLinks( const SCH_COMPONENT* aOriginalSymbol,
const SCH_COMPONENT* aNewSymbol )
void SCH_SCREEN::SwapSymbolLinks( const SCH_SYMBOL* aOriginalSymbol, const SCH_SYMBOL* aNewSymbol )
{
wxCHECK( aOriginalSymbol && aNewSymbol /* && m_rtree.contains( aOriginalSymbol, true ) */,
/* void */ );
@ -830,15 +829,15 @@ void SCH_SCREEN::ClearDrawingState()
}
LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aSymbol,
LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_SYMBOL** aSymbol,
bool aEndPointOnly ) const
{
SCH_COMPONENT* candidate = NULL;
LIB_PIN* pin = NULL;
SCH_SYMBOL* candidate = NULL;
LIB_PIN* pin = NULL;
for( SCH_ITEM* item : Items().Overlapping( SCH_COMPONENT_T, aPosition ) )
for( SCH_ITEM* item : Items().Overlapping( SCH_SYMBOL_T, aPosition ) )
{
candidate = static_cast<SCH_COMPONENT*>( item );
candidate = static_cast<SCH_SYMBOL*>( item );
if( aEndPointOnly )
{
@ -917,9 +916,9 @@ size_t SCH_SCREEN::CountConnectedItems( const wxPoint& aPos, bool aTestJunctions
void SCH_SCREEN::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
{
for( SCH_ITEM* item : Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
symbol->ClearAnnotation( aSheetPath );
}
@ -931,9 +930,9 @@ void SCH_SCREEN::EnsureAlternateReferencesExist()
if( GetClientSheetPaths().size() <= 1 ) // No need for alternate reference
return;
for( SCH_ITEM* item : Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
// Add (when not existing) all sheet path entries
for( const SCH_SHEET_PATH& sheet : GetClientSheetPaths() )
@ -944,7 +943,7 @@ void SCH_SCREEN::EnsureAlternateReferencesExist()
void SCH_SCREEN::GetHierarchicalItems( std::vector<SCH_ITEM*>* aItems ) const
{
static KICAD_T hierarchicalTypes[] = { SCH_COMPONENT_T, SCH_SHEET_T, SCH_GLOBAL_LABEL_T, EOT };
static KICAD_T hierarchicalTypes[] = { SCH_SYMBOL_T, SCH_SHEET_T, SCH_GLOBAL_LABEL_T, EOT };
for( SCH_ITEM* item : Items() )
{
@ -1326,10 +1325,10 @@ bool SCH_SCREENS::HasNoFullyDefinedLibIds()
for( screen = GetFirst(); screen; screen = GetNext() )
{
for( auto item : screen->Items().OfType( SCH_COMPONENT_T ) )
for( auto item : screen->Items().OfType( SCH_SYMBOL_T ) )
{
cnt++;
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
if( !symbol->GetLibId().GetLibNickname().empty() )
return false;
@ -1344,10 +1343,10 @@ size_t SCH_SCREENS::GetLibNicknames( wxArrayString& aLibNicknames )
{
for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
{
for( auto item : screen->Items().OfType( SCH_COMPONENT_T ) )
for( auto item : screen->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
const UTF8& nickname = symbol->GetLibId().GetLibNickname();
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
const UTF8& nickname = symbol->GetLibId().GetLibNickname();
if( !nickname.empty() && ( aLibNicknames.Index( nickname ) == wxNOT_FOUND ) )
aLibNicknames.Add( nickname );
@ -1365,9 +1364,9 @@ int SCH_SCREENS::ChangeSymbolLibNickname( const wxString& aFrom, const wxString&
for( screen = GetFirst(); screen; screen = GetNext() )
{
for( auto item : screen->Items().OfType( SCH_COMPONENT_T ) )
for( auto item : screen->Items().OfType( SCH_SYMBOL_T ) )
{
auto symbol = static_cast<SCH_COMPONENT*>( item );
auto symbol = static_cast<SCH_SYMBOL*>( item );
if( symbol->GetLibId().GetLibNickname() != aFrom )
continue;

View File

@ -45,7 +45,7 @@
#include <title_block.h>
#include <lib_id.h>
#include <sch_symbol.h> // COMPONENT_INSTANCE_REFERENCE
#include <sch_symbol.h> // SYMBOL_INSTANCE_REFERENCE
#include <sch_reference_list.h>
#include <sch_rtree.h>
#include <sch_sheet.h>
@ -55,7 +55,7 @@ class BUS_ALIAS;
class EDA_ITEM;
class LIB_PART;
class LIB_PIN;
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_LINE;
class SCH_TEXT;
class PLOTTER;
@ -203,7 +203,7 @@ public:
KICAD_T aType = SCH_LOCATE_ANY_T ) const;
/**
* Initialize the #LIB_PART reference for each #SCH_COMPONENT found in this schematic
* Initialize the #LIB_PART reference for each #SCH_SYMBOL found in this schematic
* from the project #SYMBOL_LIB_TABLE.
*
* Symbol library links are set using the symbol library table and will fall back to
@ -220,12 +220,12 @@ public:
void UpdateSymbolLinks( REPORTER* aReporter = nullptr );
/**
* Initialize the #LIB_PART reference for each #SCH_COMPONENT found in this schematic
* Initialize the #LIB_PART reference for each #SCH_SYMBOL found in this schematic
* with the local project library symbols.
*/
void UpdateLocalLibSymbolLinks();
void SwapSymbolLinks( const SCH_COMPONENT* aOriginalSymbol, const SCH_COMPONENT* aNewSymbol );
void SwapSymbolLinks( const SCH_SYMBOL* aOriginalSymbol, const SCH_SYMBOL* aNewSymbol );
/**
* Print all the items in the screen to \a aDC.
@ -284,7 +284,7 @@ public:
/**
* Return all wires and junctions connected to \a aSegment which are not connected any
* component pin.
* symbol pin.
*
* @param aSegment The segment to test for connections.
*/
@ -303,8 +303,8 @@ public:
* A junction is required at \a aPosition if one of the following criteria is satisfied:
* - One wire midpoint and one or more wire endpoints.
* - Three or more wire endpoints.
* - One wire midpoint and a component pin.
* - Two or more wire endpoints and a component pin.
* - One wire midpoint and a symbol pin.
* - Two or more wire endpoints and a symbol pin.
*
* @param[in] aPosition The position to test.
* @param aNew Checks if a _new_ junction is needed, i.e. there isn't one already
@ -323,15 +323,15 @@ public:
bool IsTerminalPoint( const wxPoint& aPosition, int aLayer ) const;
/**
* Test the screen for a component pin item at \a aPosition.
* Test the screen for a symbol pin item at \a aPosition.
*
* @param[in] aPosition Position to test.
* @param[out] aSymbol The component if a pin was found, otherwise NULL.
* @param[out] aSymbol The symbol if a pin was found, otherwise NULL.
* @param aEndPointOnly Set to true to test if \a aPosition is the connection
* point of the pin.
* @return The pin item if found, otherwise NULL.
*/
LIB_PIN* GetPin( const wxPoint& aPosition, SCH_COMPONENT** aSymbol = NULL,
LIB_PIN* GetPin( const wxPoint& aPosition, SCH_SYMBOL** aSymbol = nullptr,
bool aEndPointOnly = false ) const;
/**
@ -343,9 +343,9 @@ public:
SCH_SHEET_PIN* GetSheetPin( const wxPoint& aPosition ) const;
/**
* Clear the annotation for the components in \a aSheetPath on the screen.
* Clear the annotation for the symbols in \a aSheetPath on the screen.
*
* @param[in] aSheetPath The sheet path of the component annotation to clear. If NULL then
* @param[in] aSheetPath The sheet path of the symbol annotation to clear. If NULL then
* the entire hierarchy is cleared.
*/
void ClearAnnotation( SCH_SHEET_PATH* aSheetPath );
@ -353,7 +353,7 @@ public:
/**
* For screens shared by many sheetpaths (complex hierarchies):
* to be able to clear or modify any reference related sharing this screen
* (i.e. the list of components), an entry for each screen path must exist.
* (i.e. the list of symbols), an entry for each screen path must exist.
* This function creates missing entries, using as default reference the current
* reference field and unit number
* Note: m_clientSheetPathList must be up to date
@ -362,7 +362,7 @@ public:
void EnsureAlternateReferencesExist();
/**
* Add all schematic sheet and component objects in the screen to \a aItems.
* Add all schematic sheet and symbol objects in the screen to \a aItems.
*
* @param[out] aItems Hierarchical item list to fill.
*/
@ -411,7 +411,7 @@ public:
/**
* Fetch a list of unique #LIB_PART object pointers required to properly render each
* #SCH_COMPONENT in this schematic.
* #SCH_SYMBOL in this schematic.
*
* @return The list of unique #LIB_PART object pointers.
*/
@ -517,7 +517,7 @@ private:
*
* This list is only used to as temporary storage when the schematic file is loaded.
* If the screen is the root sheet, then this information is used to update the
* #SCH_COMPONENT instance reference and unit information after the entire schematic
* #SCH_SYMBOL instance reference and unit information after the entire schematic
* is loaded and is never used again. If this screen is not the root sheet, then the
* schematic file is the root sheet of another project and this information is saved
* unchanged back to the schematic file.
@ -561,7 +561,7 @@ public:
SCH_SHEET* GetSheet( unsigned int aIndex ) const;
/**
* Clear the annotation for the components inside new sheetpaths
* Clear the annotation for the symbols inside new sheetpaths
* when a complex hierarchy is modified and new sheetpaths added
* when a screen shares more than one sheet path, missing alternate references are added
* and alternate references of new sheet paths are cleared
@ -571,10 +571,10 @@ public:
void ClearAnnotationOfNewSheetPaths( SCH_SHEET_LIST& aInitialSheetPathList );
/**
* Test all sheet and component objects in the schematic for duplicate time stamps
* Test all sheet and symbol objects in the schematic for duplicate time stamps
* and replaces them as necessary.
*
* Time stamps must be unique in order for complex hierarchies know which components go
* Time stamps must be unique in order for complex hierarchies know which symbols go
* to which sheets.
*
* @return The number of duplicate time stamps replaced.
@ -601,7 +601,7 @@ public:
void DeleteMarker( SCH_MARKER* aMarker );
/**
* Initialize the #LIB_PART reference for each #SCH_COMPONENT found in the full schematic.
* Initialize the #LIB_PART reference for each #SCH_SYMBOL found in the full schematic.
*
* @note This should only be called when the user specifically requests all library symbol
* links to be update or when the legacy schematic is opened for the last time. All

View File

@ -611,9 +611,9 @@ int SCH_SHEET::SymbolCount() const
if( m_screen )
{
for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = (SCH_COMPONENT*) aItem;
SCH_SYMBOL* symbol = (SCH_SYMBOL*) aItem;
if( symbol->GetField( VALUE_FIELD )->GetText().GetChar( 0 ) != '#' )
n++;

View File

@ -357,7 +357,7 @@ public:
return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE )
|| ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_BUS )
|| ( aItem->Type() == SCH_NO_CONNECT_T )
|| ( aItem->Type() == SCH_COMPONENT_T );
|| ( aItem->Type() == SCH_SYMBOL_T );
}
std::vector<wxPoint> GetConnectionPoints() const override;

View File

@ -286,9 +286,9 @@ wxString SCH_SHEET_PATH::PathHumanReadable( bool aUseShortRootName ) const
void SCH_SHEET_PATH::UpdateAllScreenReferences()
{
for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
symbol->GetField( REFERENCE_FIELD )->SetText( symbol->GetRef( this ) );
symbol->GetField( VALUE_FIELD )->SetText( symbol->GetValue( this, false ) );
symbol->GetField( FOOTPRINT_FIELD )->SetText( symbol->GetFootprint( this, false ) );
@ -301,15 +301,15 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences()
void SCH_SHEET_PATH::GetSymbols( SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols,
bool aForceIncludeOrphanSymbols ) const
{
for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
AppendSymbol( aReferences, symbol, aIncludePowerSymbols, aForceIncludeOrphanSymbols );
}
}
void SCH_SHEET_PATH::AppendSymbol( SCH_REFERENCE_LIST& aReferences, SCH_COMPONENT* aSymbol,
void SCH_SHEET_PATH::AppendSymbol( SCH_REFERENCE_LIST& aReferences, SCH_SYMBOL* aSymbol,
bool aIncludePowerSymbols,
bool aForceIncludeOrphanSymbols ) const
{
@ -333,16 +333,16 @@ void SCH_SHEET_PATH::AppendSymbol( SCH_REFERENCE_LIST& aReferences, SCH_COMPONEN
void SCH_SHEET_PATH::GetMultiUnitSymbols( SCH_MULTI_UNIT_REFERENCE_MAP& aRefList,
bool aIncludePowerSymbols ) const
{
for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
AppendMultiUnitSymbol( aRefList, symbol, aIncludePowerSymbols );
}
}
void SCH_SHEET_PATH::AppendMultiUnitSymbol( SCH_MULTI_UNIT_REFERENCE_MAP& aRefList,
SCH_COMPONENT* aSymbol,
SCH_SYMBOL* aSymbol,
bool aIncludePowerSymbols ) const
{
// Skip pseudo-symbols, which have a reference starting with #. This mainly
@ -713,10 +713,10 @@ void SCH_SHEET_LIST::AnnotatePowerSymbols()
// Build the list of power symbols:
for( SCH_SHEET_PATH& sheet : *this )
{
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
for( SCH_ITEM* item : sheet.LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
{
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
LIB_PART* part = symbol->GetPartRef().get();
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
LIB_PART* part = symbol->GetPartRef().get();
if( part && part->IsPower() )
{
@ -899,7 +899,7 @@ void SCH_SHEET_LIST::UpdateSymbolInstances(
std::map<KIID_PATH, wxString> pathNameCache;
// Calculating the name of a path is somewhat expensive; on large designs with many components
// Calculating the name of a path is somewhat expensive; on large designs with many symbols
// this can blow up to a serious amount of time when loading the schematic
auto getName = [&pathNameCache]( const KIID_PATH& aPath ) -> const wxString&
{
@ -928,7 +928,7 @@ void SCH_SHEET_LIST::UpdateSymbolInstances(
continue;
}
SCH_COMPONENT* symbol = symbolInstances[ i ].GetSymbol();
SCH_SYMBOL* symbol = symbolInstances[ i ].GetSymbol();
wxCHECK2( symbol, continue );

View File

@ -107,7 +107,7 @@ class SCH_SHEET;
class SCH_SCREEN;
class SCH_MARKER;
class SCH_ITEM;
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_REFERENCE_LIST;
@ -293,7 +293,7 @@ public:
* in lib. The normal option is false, and set to true
* only to build the full list of symbols.
*/
void AppendSymbol( SCH_REFERENCE_LIST& aReferences, SCH_COMPONENT* aSymbol,
void AppendSymbol( SCH_REFERENCE_LIST& aReferences, SCH_SYMBOL* aSymbol,
bool aIncludePowerSymbols = true,
bool aForceIncludeOrphanSymbols = false ) const;
@ -319,7 +319,7 @@ public:
* @param aSymbol A symbol to add to aRefList
* @param aIncludePowerSymbols Set to false to only get normal symbols.
*/
void AppendMultiUnitSymbol( SCH_MULTI_UNIT_REFERENCE_MAP& aRefList, SCH_COMPONENT* aSymbol,
void AppendMultiUnitSymbol( SCH_MULTI_UNIT_REFERENCE_MAP& aRefList, SCH_SYMBOL* aSymbol,
bool aIncludePowerSymbols = true ) const;
/**

View File

@ -93,17 +93,16 @@ static LIB_PART* dummy()
}
SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
SCH_ITEM( aParent, SCH_COMPONENT_T )
SCH_SYMBOL::SCH_SYMBOL( const wxPoint& aPos, SCH_ITEM* aParent ) :
SCH_ITEM( aParent, SCH_SYMBOL_T )
{
Init( aPos );
}
SCH_COMPONENT::SCH_COMPONENT( const LIB_PART& aPart, const LIB_ID& aLibId,
const SCH_SHEET_PATH* aSheet,
int unit, int convert, const wxPoint& pos ) :
SCH_ITEM( NULL, SCH_COMPONENT_T )
SCH_SYMBOL::SCH_SYMBOL( const LIB_PART& aPart, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
int unit, int convert, const wxPoint& pos ) :
SCH_ITEM( NULL, SCH_SYMBOL_T )
{
Init( pos );
@ -119,11 +118,11 @@ SCH_COMPONENT::SCH_COMPONENT( const LIB_PART& aPart, const LIB_ID& aLibId,
// Copy fields from the library symbol
UpdateFields( aSheet,
true, /* update style */
false, /* update ref */
false, /* update other fields */
true, /* reset ref */
true /* reset other fields */ );
true, /* update style */
false, /* update ref */
false, /* update other fields */
true, /* reset ref */
true /* reset other fields */ );
m_prefix = UTIL::GetRefDesPrefix( m_part->GetReferenceField().GetText() );
@ -136,9 +135,9 @@ SCH_COMPONENT::SCH_COMPONENT( const LIB_PART& aPart, const LIB_ID& aLibId,
}
SCH_COMPONENT::SCH_COMPONENT( const LIB_PART& aPart, const SCH_SHEET_PATH* aSheet,
const PICKED_SYMBOL& aSel, const wxPoint& pos ) :
SCH_COMPONENT( aPart, aSel.LibId, aSheet, aSel.Unit, aSel.Convert, pos )
SCH_SYMBOL::SCH_SYMBOL( const LIB_PART& aPart, const SCH_SHEET_PATH* aSheet,
const PICKED_SYMBOL& aSel, const wxPoint& pos ) :
SCH_SYMBOL( aPart, aSel.LibId, aSheet, aSel.Unit, aSel.Convert, pos )
{
// Set any fields that were modified as part of the symbol selection
for( const std::pair<int, wxString>& i : aSel.Fields )
@ -151,7 +150,7 @@ SCH_COMPONENT::SCH_COMPONENT( const LIB_PART& aPart, const SCH_SHEET_PATH* aShee
}
SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aSymbol ) :
SCH_SYMBOL::SCH_SYMBOL( const SCH_SYMBOL& aSymbol ) :
SCH_ITEM( aSymbol )
{
m_parent = aSymbol.m_parent;
@ -182,7 +181,7 @@ SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aSymbol ) :
}
void SCH_COMPONENT::Init( const wxPoint& pos )
void SCH_SYMBOL::Init( const wxPoint& pos )
{
m_pos = pos;
m_unit = 1; // In multi unit chip - which unit to draw.
@ -211,13 +210,13 @@ void SCH_COMPONENT::Init( const wxPoint& pos )
}
EDA_ITEM* SCH_COMPONENT::Clone() const
EDA_ITEM* SCH_SYMBOL::Clone() const
{
return new SCH_COMPONENT( *this );
return new SCH_SYMBOL( *this );
}
void SCH_COMPONENT::ViewGetLayers( int aLayers[], int& aCount ) const
void SCH_SYMBOL::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 3;
aLayers[0] = LAYER_DEVICE;
@ -226,7 +225,7 @@ void SCH_COMPONENT::ViewGetLayers( int aLayers[], int& aCount ) const
}
void SCH_COMPONENT::SetLibId( const LIB_ID& aLibId )
void SCH_SYMBOL::SetLibId( const LIB_ID& aLibId )
{
if( m_lib_id != aLibId )
{
@ -236,7 +235,7 @@ void SCH_COMPONENT::SetLibId( const LIB_ID& aLibId )
}
wxString SCH_COMPONENT::GetSchSymbolLibraryName() const
wxString SCH_SYMBOL::GetSchSymbolLibraryName() const
{
if( !m_schLibSymbolName.IsEmpty() )
return m_schLibSymbolName;
@ -245,7 +244,7 @@ wxString SCH_COMPONENT::GetSchSymbolLibraryName() const
}
void SCH_COMPONENT::SetLibSymbol( LIB_PART* aLibSymbol )
void SCH_SYMBOL::SetLibSymbol( LIB_PART* aLibSymbol )
{
wxCHECK2( ( aLibSymbol == nullptr ) || ( aLibSymbol->IsRoot() ), aLibSymbol = nullptr );
@ -254,7 +253,7 @@ void SCH_COMPONENT::SetLibSymbol( LIB_PART* aLibSymbol )
}
wxString SCH_COMPONENT::GetDescription() const
wxString SCH_SYMBOL::GetDescription() const
{
if( m_part )
return m_part->GetDescription();
@ -263,7 +262,7 @@ wxString SCH_COMPONENT::GetDescription() const
}
wxString SCH_COMPONENT::GetDatasheet() const
wxString SCH_SYMBOL::GetDatasheet() const
{
if( m_part )
return m_part->GetDatasheetField().GetText();
@ -272,7 +271,7 @@ wxString SCH_COMPONENT::GetDatasheet() const
}
void SCH_COMPONENT::UpdatePins()
void SCH_SYMBOL::UpdatePins()
{
std::map<wxString, wxString> altPinMap;
std::map<wxString, KIID> pinUuidMap;
@ -319,7 +318,7 @@ void SCH_COMPONENT::UpdatePins()
}
void SCH_COMPONENT::SetUnit( int aUnit )
void SCH_SYMBOL::SetUnit( int aUnit )
{
if( m_unit != aUnit )
{
@ -329,13 +328,13 @@ void SCH_COMPONENT::SetUnit( int aUnit )
}
void SCH_COMPONENT::UpdateUnit( int aUnit )
void SCH_SYMBOL::UpdateUnit( int aUnit )
{
m_unit = aUnit;
}
void SCH_COMPONENT::SetConvert( int aConvert )
void SCH_SYMBOL::SetConvert( int aConvert )
{
if( m_convert != aConvert )
{
@ -348,7 +347,7 @@ void SCH_COMPONENT::SetConvert( int aConvert )
}
void SCH_COMPONENT::SetTransform( const TRANSFORM& aTransform )
void SCH_SYMBOL::SetTransform( const TRANSFORM& aTransform )
{
if( m_transform != aTransform )
{
@ -358,7 +357,7 @@ void SCH_COMPONENT::SetTransform( const TRANSFORM& aTransform )
}
int SCH_COMPONENT::GetUnitCount() const
int SCH_SYMBOL::GetUnitCount() const
{
if( m_part )
return m_part->GetUnitCount();
@ -367,7 +366,7 @@ int SCH_COMPONENT::GetUnitCount() const
}
void SCH_COMPONENT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
PART_DRAW_OPTIONS opts;
opts.transform = m_transform;
@ -388,9 +387,9 @@ void SCH_COMPONENT::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOff
}
void SCH_COMPONENT::AddHierarchicalReference( const KIID_PATH& aPath, const wxString& aRef,
int aUnit, const wxString& aValue,
const wxString& aFootprint )
void SCH_SYMBOL::AddHierarchicalReference( const KIID_PATH& aPath, const wxString& aRef,
int aUnit, const wxString& aValue,
const wxString& aFootprint )
{
// Search for an existing path and remove it if found (should not occur)
for( unsigned ii = 0; ii < m_instanceReferences.size(); ii++ )
@ -429,7 +428,7 @@ void SCH_COMPONENT::AddHierarchicalReference( const KIID_PATH& aPath, const wxSt
}
const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet, bool aIncludeUnit ) const
const wxString SCH_SYMBOL::GetRef( const SCH_SHEET_PATH* sheet, bool aIncludeUnit ) const
{
KIID_PATH path = sheet->Path();
wxString ref;
@ -449,7 +448,7 @@ const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet, bool aInclude
// the same symbol references, but perhaps this is best.
if( ref.IsEmpty() && !GetField( REFERENCE_FIELD )->GetText().IsEmpty() )
{
const_cast<SCH_COMPONENT*>( this )->SetRef( sheet, GetField( REFERENCE_FIELD )->GetText() );
const_cast<SCH_SYMBOL*>( this )->SetRef( sheet, GetField( REFERENCE_FIELD )->GetText() );
ref = GetField( REFERENCE_FIELD )->GetText();
}
@ -463,13 +462,13 @@ const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet, bool aInclude
}
bool SCH_COMPONENT::IsReferenceStringValid( const wxString& aReferenceString )
bool SCH_SYMBOL::IsReferenceStringValid( const wxString& aReferenceString )
{
return !UTIL::GetRefDesPrefix( aReferenceString ).IsEmpty();
}
void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
void SCH_SYMBOL::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
{
KIID_PATH path = sheet->Path();
bool notInArray = true;
@ -505,7 +504,7 @@ void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
}
bool SCH_COMPONENT::IsAnnotated( const SCH_SHEET_PATH* aSheet )
bool SCH_SYMBOL::IsAnnotated( const SCH_SHEET_PATH* aSheet )
{
KIID_PATH path = aSheet->Path();
@ -519,7 +518,7 @@ bool SCH_COMPONENT::IsAnnotated( const SCH_SHEET_PATH* aSheet )
}
int SCH_COMPONENT::GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const
int SCH_SYMBOL::GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const
{
KIID_PATH path = aSheet->Path();
@ -535,7 +534,7 @@ int SCH_COMPONENT::GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const
}
void SCH_COMPONENT::SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSelection )
void SCH_SYMBOL::SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSelection )
{
KIID_PATH path = aSheet->Path();
@ -554,14 +553,14 @@ void SCH_COMPONENT::SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSel
}
void SCH_COMPONENT::SetUnitSelection( int aUnitSelection )
void SCH_SYMBOL::SetUnitSelection( int aUnitSelection )
{
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
instance.m_Unit = aUnitSelection;
}
const wxString SCH_COMPONENT::GetValue( const SCH_SHEET_PATH* sheet, bool aResolve ) const
const wxString SCH_SYMBOL::GetValue( const SCH_SHEET_PATH* sheet, bool aResolve ) const
{
KIID_PATH path = sheet->Path();
@ -582,7 +581,7 @@ const wxString SCH_COMPONENT::GetValue( const SCH_SHEET_PATH* sheet, bool aResol
}
void SCH_COMPONENT::SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValue )
void SCH_SYMBOL::SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValue )
{
if( sheet == nullptr )
{
@ -612,7 +611,7 @@ void SCH_COMPONENT::SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValu
}
const wxString SCH_COMPONENT::GetFootprint( const SCH_SHEET_PATH* sheet, bool aResolve ) const
const wxString SCH_SYMBOL::GetFootprint( const SCH_SHEET_PATH* sheet, bool aResolve ) const
{
KIID_PATH path = sheet->Path();
@ -633,7 +632,7 @@ const wxString SCH_COMPONENT::GetFootprint( const SCH_SHEET_PATH* sheet, bool aR
}
void SCH_COMPONENT::SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& aFootprint )
void SCH_SYMBOL::SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& aFootprint )
{
if( sheet == nullptr )
{
@ -663,19 +662,19 @@ void SCH_COMPONENT::SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& a
}
SCH_FIELD* SCH_COMPONENT::GetField( MANDATORY_FIELD_T aFieldType )
SCH_FIELD* SCH_SYMBOL::GetField( MANDATORY_FIELD_T aFieldType )
{
return &m_fields[aFieldType];
}
const SCH_FIELD* SCH_COMPONENT::GetField( MANDATORY_FIELD_T aFieldType ) const
const SCH_FIELD* SCH_SYMBOL::GetField( MANDATORY_FIELD_T aFieldType ) const
{
return &m_fields[aFieldType];
}
SCH_FIELD* SCH_COMPONENT::GetFieldById( int aFieldId )
SCH_FIELD* SCH_SYMBOL::GetFieldById( int aFieldId )
{
for( size_t ii = 0; ii < m_fields.size(); ++ii )
{
@ -687,7 +686,7 @@ SCH_FIELD* SCH_COMPONENT::GetFieldById( int aFieldId )
}
wxString SCH_COMPONENT::GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME* aFrame ) const
wxString SCH_SYMBOL::GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME* aFrame ) const
{
for( const SCH_FIELD& field : m_fields )
{
@ -699,7 +698,7 @@ wxString SCH_COMPONENT::GetFieldText( const wxString& aFieldName, SCH_EDIT_FRAME
}
void SCH_COMPONENT::GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly )
void SCH_SYMBOL::GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOnly )
{
for( SCH_FIELD& field : m_fields )
{
@ -709,7 +708,7 @@ void SCH_COMPONENT::GetFields( std::vector<SCH_FIELD*>& aVector, bool aVisibleOn
}
SCH_FIELD* SCH_COMPONENT::AddField( const SCH_FIELD& aField )
SCH_FIELD* SCH_SYMBOL::AddField( const SCH_FIELD& aField )
{
int newNdx = m_fields.size();
@ -718,7 +717,7 @@ SCH_FIELD* SCH_COMPONENT::AddField( const SCH_FIELD& aField )
}
void SCH_COMPONENT::RemoveField( const wxString& aFieldName )
void SCH_SYMBOL::RemoveField( const wxString& aFieldName )
{
for( unsigned i = MANDATORY_FIELDS; i < m_fields.size(); ++i )
{
@ -731,7 +730,7 @@ void SCH_COMPONENT::RemoveField( const wxString& aFieldName )
}
SCH_FIELD* SCH_COMPONENT::FindField( const wxString& aFieldName, bool aIncludeDefaultFields )
SCH_FIELD* SCH_SYMBOL::FindField( const wxString& aFieldName, bool aIncludeDefaultFields )
{
unsigned start = aIncludeDefaultFields ? 0 : MANDATORY_FIELDS;
@ -745,8 +744,8 @@ SCH_FIELD* SCH_COMPONENT::FindField( const wxString& aFieldName, bool aIncludeDe
}
void SCH_COMPONENT::UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, bool aUpdateRef,
bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields )
void SCH_SYMBOL::UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle, bool aUpdateRef,
bool aUpdateOtherFields, bool aResetRef, bool aResetOtherFields )
{
if( m_part )
{
@ -818,7 +817,7 @@ void SCH_COMPONENT::UpdateFields( const SCH_SHEET_PATH* aPath, bool aUpdateStyle
}
void SCH_COMPONENT::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction )
void SCH_SYMBOL::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction )
{
for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
aFunction( pin.get() );
@ -828,7 +827,7 @@ void SCH_COMPONENT::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunc
}
SCH_PIN* SCH_COMPONENT::GetPin( const wxString& aNumber ) const
SCH_PIN* SCH_SYMBOL::GetPin( const wxString& aNumber ) const
{
for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
{
@ -840,21 +839,21 @@ SCH_PIN* SCH_COMPONENT::GetPin( const wxString& aNumber ) const
}
void SCH_COMPONENT::GetLibPins( std::vector<LIB_PIN*>& aPinsList ) const
void SCH_SYMBOL::GetLibPins( std::vector<LIB_PIN*>& aPinsList ) const
{
if( m_part )
m_part->GetPins( aPinsList, m_unit, m_convert );
}
SCH_PIN* SCH_COMPONENT::GetPin( LIB_PIN* aLibPin )
SCH_PIN* SCH_SYMBOL::GetPin( LIB_PIN* aLibPin )
{
wxASSERT( m_pinMap.count( aLibPin ) );
return m_pins[ m_pinMap.at( aLibPin ) ].get();
}
std::vector<SCH_PIN*> SCH_COMPONENT::GetPins( const SCH_SHEET_PATH* aSheet ) const
std::vector<SCH_PIN*> SCH_SYMBOL::GetPins( const SCH_SHEET_PATH* aSheet ) const
{
std::vector<SCH_PIN*> pins;
@ -879,12 +878,12 @@ std::vector<SCH_PIN*> SCH_COMPONENT::GetPins( const SCH_SHEET_PATH* aSheet ) con
}
void SCH_COMPONENT::SwapData( SCH_ITEM* aItem )
void SCH_SYMBOL::SwapData( SCH_ITEM* aItem )
{
wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_COMPONENT_T),
wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_SYMBOL_T),
wxT( "Cannot swap data with invalid symbol." ) );
SCH_COMPONENT* symbol = (SCH_COMPONENT*) aItem;
SCH_SYMBOL* symbol = (SCH_SYMBOL*) aItem;
std::swap( m_lib_id, symbol->m_lib_id );
@ -916,7 +915,7 @@ void SCH_COMPONENT::SwapData( SCH_ITEM* aItem )
}
void SCH_COMPONENT::GetContextualTextVars( wxArrayString* aVars ) const
void SCH_SYMBOL::GetContextualTextVars( wxArrayString* aVars ) const
{
for( int i = 0; i < MANDATORY_FIELDS; ++i )
aVars->push_back( m_fields[i].GetCanonicalName().Upper() );
@ -930,7 +929,7 @@ void SCH_COMPONENT::GetContextualTextVars( wxArrayString* aVars ) const
}
bool SCH_COMPONENT::ResolveTextVar( wxString* token, int aDepth ) const
bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth ) const
{
SCHEMATIC* schematic = Schematic();
@ -1006,7 +1005,7 @@ bool SCH_COMPONENT::ResolveTextVar( wxString* token, int aDepth ) const
}
void SCH_COMPONENT::ClearAnnotation( const SCH_SHEET_PATH* aSheetPath )
void SCH_SYMBOL::ClearAnnotation( const SCH_SHEET_PATH* aSheetPath )
{
// Build a reference with no annotation, i.e. a reference ending with a single '?'
wxString defRef = UTIL::GetRefDesUnannotated( m_prefix );
@ -1038,7 +1037,7 @@ void SCH_COMPONENT::ClearAnnotation( const SCH_SHEET_PATH* aSheetPath )
}
bool SCH_COMPONENT::AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheetPath )
bool SCH_SYMBOL::AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheetPath )
{
// a empty sheet path is illegal:
wxCHECK( aSheetPath.size() > 0, false );
@ -1058,8 +1057,8 @@ bool SCH_COMPONENT::AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheet
}
bool SCH_COMPONENT::ReplaceInstanceSheetPath( const KIID_PATH& aOldSheetPath,
const KIID_PATH& aNewSheetPath )
bool SCH_SYMBOL::ReplaceInstanceSheetPath( const KIID_PATH& aOldSheetPath,
const KIID_PATH& aNewSheetPath )
{
auto it = std::find_if( m_instanceReferences.begin(), m_instanceReferences.end(),
[ aOldSheetPath ]( SYMBOL_INSTANCE_REFERENCE& r )->bool
@ -1086,102 +1085,102 @@ bool SCH_COMPONENT::ReplaceInstanceSheetPath( const KIID_PATH& aOldSheetPath,
}
void SCH_COMPONENT::SetOrientation( int aOrientation )
void SCH_SYMBOL::SetOrientation( int aOrientation )
{
TRANSFORM temp = TRANSFORM();
bool transform = false;
switch( aOrientation )
{
case CMP_ORIENT_0:
case CMP_NORMAL: // default transform matrix
case SYM_ORIENT_0:
case SYM_NORMAL: // default transform matrix
m_transform.x1 = 1;
m_transform.y2 = -1;
m_transform.x2 = m_transform.y1 = 0;
break;
case CMP_ROTATE_COUNTERCLOCKWISE: // Rotate + (incremental rotation)
case SYM_ROTATE_COUNTERCLOCKWISE: // Rotate + (incremental rotation)
temp.x1 = temp.y2 = 0;
temp.y1 = 1;
temp.x2 = -1;
transform = true;
break;
case CMP_ROTATE_CLOCKWISE: // Rotate - (incremental rotation)
case SYM_ROTATE_CLOCKWISE: // Rotate - (incremental rotation)
temp.x1 = temp.y2 = 0;
temp.y1 = -1;
temp.x2 = 1;
transform = true;
break;
case CMP_MIRROR_Y: // Mirror Y (incremental rotation)
case SYM_MIRROR_Y: // Mirror Y (incremental rotation)
temp.x1 = -1;
temp.y2 = 1;
temp.y1 = temp.x2 = 0;
transform = true;
break;
case CMP_MIRROR_X: // Mirror X (incremental rotation)
case SYM_MIRROR_X: // Mirror X (incremental rotation)
temp.x1 = 1;
temp.y2 = -1;
temp.y1 = temp.x2 = 0;
transform = true;
break;
case CMP_ORIENT_90:
SetOrientation( CMP_ORIENT_0 );
SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
case SYM_ORIENT_90:
SetOrientation( SYM_ORIENT_0 );
SetOrientation( SYM_ROTATE_COUNTERCLOCKWISE );
break;
case CMP_ORIENT_180:
SetOrientation( CMP_ORIENT_0 );
SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
case SYM_ORIENT_180:
SetOrientation( SYM_ORIENT_0 );
SetOrientation( SYM_ROTATE_COUNTERCLOCKWISE );
SetOrientation( SYM_ROTATE_COUNTERCLOCKWISE );
break;
case CMP_ORIENT_270:
SetOrientation( CMP_ORIENT_0 );
SetOrientation( CMP_ROTATE_CLOCKWISE );
case SYM_ORIENT_270:
SetOrientation( SYM_ORIENT_0 );
SetOrientation( SYM_ROTATE_CLOCKWISE );
break;
case ( CMP_ORIENT_0 + CMP_MIRROR_X ):
SetOrientation( CMP_ORIENT_0 );
SetOrientation( CMP_MIRROR_X );
case ( SYM_ORIENT_0 + SYM_MIRROR_X ):
SetOrientation( SYM_ORIENT_0 );
SetOrientation( SYM_MIRROR_X );
break;
case ( CMP_ORIENT_0 + CMP_MIRROR_Y ):
SetOrientation( CMP_ORIENT_0 );
SetOrientation( CMP_MIRROR_Y );
case ( SYM_ORIENT_0 + SYM_MIRROR_Y ):
SetOrientation( SYM_ORIENT_0 );
SetOrientation( SYM_MIRROR_Y );
break;
case ( CMP_ORIENT_90 + CMP_MIRROR_X ):
SetOrientation( CMP_ORIENT_90 );
SetOrientation( CMP_MIRROR_X );
case ( SYM_ORIENT_90 + SYM_MIRROR_X ):
SetOrientation( SYM_ORIENT_90 );
SetOrientation( SYM_MIRROR_X );
break;
case ( CMP_ORIENT_90 + CMP_MIRROR_Y ):
SetOrientation( CMP_ORIENT_90 );
SetOrientation( CMP_MIRROR_Y );
case ( SYM_ORIENT_90 + SYM_MIRROR_Y ):
SetOrientation( SYM_ORIENT_90 );
SetOrientation( SYM_MIRROR_Y );
break;
case ( CMP_ORIENT_180 + CMP_MIRROR_X ):
SetOrientation( CMP_ORIENT_180 );
SetOrientation( CMP_MIRROR_X );
case ( SYM_ORIENT_180 + SYM_MIRROR_X ):
SetOrientation( SYM_ORIENT_180 );
SetOrientation( SYM_MIRROR_X );
break;
case ( CMP_ORIENT_180 + CMP_MIRROR_Y ):
SetOrientation( CMP_ORIENT_180 );
SetOrientation( CMP_MIRROR_Y );
case ( SYM_ORIENT_180 + SYM_MIRROR_Y ):
SetOrientation( SYM_ORIENT_180 );
SetOrientation( SYM_MIRROR_Y );
break;
case ( CMP_ORIENT_270 + CMP_MIRROR_X ):
SetOrientation( CMP_ORIENT_270 );
SetOrientation( CMP_MIRROR_X );
case ( SYM_ORIENT_270 + SYM_MIRROR_X ):
SetOrientation( SYM_ORIENT_270 );
SetOrientation( SYM_MIRROR_X );
break;
case ( CMP_ORIENT_270 + CMP_MIRROR_Y ):
SetOrientation( CMP_ORIENT_270 );
SetOrientation( CMP_MIRROR_Y );
case ( SYM_ORIENT_270 + SYM_MIRROR_Y ):
SetOrientation( SYM_ORIENT_270 );
SetOrientation( SYM_MIRROR_Y );
break;
default:
@ -1213,22 +1212,22 @@ void SCH_COMPONENT::SetOrientation( int aOrientation )
}
int SCH_COMPONENT::GetOrientation()
int SCH_SYMBOL::GetOrientation()
{
int rotate_values[] =
{
CMP_ORIENT_0,
CMP_ORIENT_90,
CMP_ORIENT_180,
CMP_ORIENT_270,
CMP_MIRROR_X + CMP_ORIENT_0,
CMP_MIRROR_X + CMP_ORIENT_90,
CMP_MIRROR_X + CMP_ORIENT_270,
CMP_MIRROR_Y,
CMP_MIRROR_Y + CMP_ORIENT_0,
CMP_MIRROR_Y + CMP_ORIENT_90,
CMP_MIRROR_Y + CMP_ORIENT_180,
CMP_MIRROR_Y + CMP_ORIENT_270
SYM_ORIENT_0,
SYM_ORIENT_90,
SYM_ORIENT_180,
SYM_ORIENT_270,
SYM_MIRROR_X + SYM_ORIENT_0,
SYM_MIRROR_X + SYM_ORIENT_90,
SYM_MIRROR_X + SYM_ORIENT_270,
SYM_MIRROR_Y,
SYM_MIRROR_Y + SYM_ORIENT_0,
SYM_MIRROR_Y + SYM_ORIENT_90,
SYM_MIRROR_Y + SYM_ORIENT_180,
SYM_MIRROR_Y + SYM_ORIENT_270
};
// Try to find the current transform option:
@ -1246,13 +1245,13 @@ int SCH_COMPONENT::GetOrientation()
wxFAIL_MSG( "Schematic symbol orientation matrix internal error." );
m_transform = transform;
return CMP_NORMAL;
return SYM_NORMAL;
}
#if defined(DEBUG)
void SCH_COMPONENT::Show( int nestLevel, std::ostream& os ) const
void SCH_SYMBOL::Show( int nestLevel, std::ostream& os ) const
{
// for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
@ -1282,7 +1281,7 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os ) const
#endif
EDA_RECT SCH_COMPONENT::GetBodyBoundingBox() const
EDA_RECT SCH_SYMBOL::GetBodyBoundingBox() const
{
EDA_RECT bBox;
@ -1317,7 +1316,7 @@ EDA_RECT SCH_COMPONENT::GetBodyBoundingBox() const
}
const EDA_RECT SCH_COMPONENT::GetBoundingBox() const
const EDA_RECT SCH_SYMBOL::GetBoundingBox() const
{
EDA_RECT bbox = GetBodyBoundingBox();
@ -1328,7 +1327,7 @@ const EDA_RECT SCH_COMPONENT::GetBoundingBox() const
}
const EDA_RECT SCH_COMPONENT::GetBoundingBox( bool aIncludeInvisibleText ) const
const EDA_RECT SCH_SYMBOL::GetBoundingBox( bool aIncludeInvisibleText ) const
{
EDA_RECT bbox = GetBodyBoundingBox();
@ -1342,7 +1341,7 @@ const EDA_RECT SCH_COMPONENT::GetBoundingBox( bool aIncludeInvisibleText ) const
}
void SCH_COMPONENT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
void SCH_SYMBOL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList )
{
wxString msg;
@ -1424,17 +1423,17 @@ void SCH_COMPONENT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aL
}
BITMAPS SCH_COMPONENT::GetMenuImage() const
BITMAPS SCH_SYMBOL::GetMenuImage() const
{
return BITMAPS::add_component;
}
void SCH_COMPONENT::MirrorHorizontally( int aCenter )
void SCH_SYMBOL::MirrorHorizontally( int aCenter )
{
int dx = m_pos.x;
SetOrientation( CMP_MIRROR_Y );
SetOrientation( SYM_MIRROR_Y );
MIRROR( m_pos.x, aCenter );
dx -= m_pos.x; // dx,0 is the move vector for this transform
@ -1448,11 +1447,11 @@ void SCH_COMPONENT::MirrorHorizontally( int aCenter )
}
void SCH_COMPONENT::MirrorVertically( int aCenter )
void SCH_SYMBOL::MirrorVertically( int aCenter )
{
int dy = m_pos.y;
SetOrientation( CMP_MIRROR_X );
SetOrientation( SYM_MIRROR_X );
MIRROR( m_pos.y, aCenter );
dy -= m_pos.y; // dy,0 is the move vector for this transform
@ -1466,13 +1465,13 @@ void SCH_COMPONENT::MirrorVertically( int aCenter )
}
void SCH_COMPONENT::Rotate( const wxPoint& aCenter )
void SCH_SYMBOL::Rotate( const wxPoint& aCenter )
{
wxPoint prev = m_pos;
RotatePoint( &m_pos, aCenter, 900 );
SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
SetOrientation( SYM_ROTATE_COUNTERCLOCKWISE );
for( SCH_FIELD& field : m_fields )
{
@ -1485,7 +1484,7 @@ void SCH_COMPONENT::Rotate( const wxPoint& aCenter )
}
bool SCH_COMPONENT::Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const
bool SCH_SYMBOL::Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const
{
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
@ -1494,7 +1493,7 @@ bool SCH_COMPONENT::Matches( const wxFindReplaceData& aSearchData, void* aAuxDat
}
void SCH_COMPONENT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
void SCH_SYMBOL::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
{
for( auto& pin : m_pins )
{
@ -1509,8 +1508,8 @@ void SCH_COMPONENT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
}
bool SCH_COMPONENT::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
const SCH_SHEET_PATH* aPath )
bool SCH_SYMBOL::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
const SCH_SHEET_PATH* aPath )
{
bool changed = false;
@ -1560,7 +1559,7 @@ bool SCH_COMPONENT::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemLi
}
wxPoint SCH_COMPONENT::GetPinPhysicalPosition( const LIB_PIN* Pin ) const
wxPoint SCH_SYMBOL::GetPinPhysicalPosition( const LIB_PIN* Pin ) const
{
wxCHECK_MSG( Pin != NULL && Pin->Type() == LIB_PIN_T, wxPoint( 0, 0 ),
wxT( "Cannot get physical position of pin." ) );
@ -1569,7 +1568,7 @@ wxPoint SCH_COMPONENT::GetPinPhysicalPosition( const LIB_PIN* Pin ) const
}
std::vector<wxPoint> SCH_COMPONENT::GetConnectionPoints() const
std::vector<wxPoint> SCH_SYMBOL::GetConnectionPoints() const
{
std::vector<wxPoint> retval;
@ -1593,7 +1592,7 @@ std::vector<wxPoint> SCH_COMPONENT::GetConnectionPoints() const
}
LIB_ITEM* SCH_COMPONENT::GetDrawItem( const wxPoint& aPosition, KICAD_T aType )
LIB_ITEM* SCH_SYMBOL::GetDrawItem( const wxPoint& aPosition, KICAD_T aType )
{
if( m_part )
{
@ -1607,7 +1606,7 @@ LIB_ITEM* SCH_COMPONENT::GetDrawItem( const wxPoint& aPosition, KICAD_T aType )
}
wxString SCH_COMPONENT::GetSelectMenuText( EDA_UNITS aUnits ) const
wxString SCH_SYMBOL::GetSelectMenuText( EDA_UNITS aUnits ) const
{
return wxString::Format( _( "Symbol %s [%s]" ),
GetField( REFERENCE_FIELD )->GetShownText(),
@ -1615,16 +1614,16 @@ wxString SCH_COMPONENT::GetSelectMenuText( EDA_UNITS aUnits ) const
}
SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData,
const KICAD_T aFilterTypes[] )
SEARCH_RESULT SCH_SYMBOL::Visit( INSPECTOR aInspector, void* aTestData,
const KICAD_T aFilterTypes[] )
{
KICAD_T stype;
for( const KICAD_T* p = aFilterTypes; (stype = *p) != EOT; ++p )
{
if( stype == SCH_LOCATE_ANY_T
|| ( stype == SCH_COMPONENT_T )
|| ( stype == SCH_COMPONENT_LOCATE_POWER_T && m_part && m_part->IsPower() ) )
|| ( stype == SCH_SYMBOL_T )
|| ( stype == SCH_SYMBOL_LOCATE_POWER_T && m_part && m_part->IsPower() ) )
{
if( SEARCH_RESULT::QUIT == aInspector( this, aTestData ) )
return SEARCH_RESULT::QUIT;
@ -1646,7 +1645,7 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData,
}
if( stype == SCH_FIELD_LOCATE_VALUE_T
|| ( stype == SCH_COMPONENT_LOCATE_POWER_T && m_part && m_part->IsPower() ) )
|| ( stype == SCH_SYMBOL_LOCATE_POWER_T && m_part && m_part->IsPower() ) )
{
if( SEARCH_RESULT::QUIT == aInspector( GetField( VALUE_FIELD ), (void*) this ) )
return SEARCH_RESULT::QUIT;
@ -1689,29 +1688,29 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData,
}
bool SCH_COMPONENT::operator <( const SCH_ITEM& aItem ) const
bool SCH_SYMBOL::operator <( const SCH_ITEM& aItem ) const
{
if( Type() != aItem.Type() )
return Type() < aItem.Type();
auto component = static_cast<const SCH_COMPONENT*>( &aItem );
auto symbol = static_cast<const SCH_SYMBOL*>( &aItem );
EDA_RECT rect = GetBodyBoundingBox();
if( rect.GetArea() != component->GetBodyBoundingBox().GetArea() )
return rect.GetArea() < component->GetBodyBoundingBox().GetArea();
if( rect.GetArea() != symbol->GetBodyBoundingBox().GetArea() )
return rect.GetArea() < symbol->GetBodyBoundingBox().GetArea();
if( m_pos.x != component->m_pos.x )
return m_pos.x < component->m_pos.x;
if( m_pos.x != symbol->m_pos.x )
return m_pos.x < symbol->m_pos.x;
if( m_pos.y != component->m_pos.y )
return m_pos.y < component->m_pos.y;
if( m_pos.y != symbol->m_pos.y )
return m_pos.y < symbol->m_pos.y;
return m_Uuid < aItem.m_Uuid; // Ensure deterministic sort
}
bool SCH_COMPONENT::operator==( const SCH_COMPONENT& aSymbol ) const
bool SCH_SYMBOL::operator==( const SCH_SYMBOL& aSymbol ) const
{
if( GetFieldCount() != aSymbol.GetFieldCount() )
return false;
@ -1726,13 +1725,13 @@ bool SCH_COMPONENT::operator==( const SCH_COMPONENT& aSymbol ) const
}
bool SCH_COMPONENT::operator!=( const SCH_COMPONENT& aSymbol ) const
bool SCH_SYMBOL::operator!=( const SCH_SYMBOL& aSymbol ) const
{
return !( *this == aSymbol );
}
SCH_COMPONENT& SCH_COMPONENT::operator=( const SCH_ITEM& aItem )
SCH_SYMBOL& SCH_SYMBOL::operator=( const SCH_ITEM& aItem )
{
wxCHECK_MSG( Type() == aItem.Type(), *this,
wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
@ -1742,7 +1741,7 @@ SCH_COMPONENT& SCH_COMPONENT::operator=( const SCH_ITEM& aItem )
{
SCH_ITEM::operator=( aItem );
SCH_COMPONENT* c = (SCH_COMPONENT*) &aItem;
SCH_SYMBOL* c = (SCH_SYMBOL*) &aItem;
m_lib_id = c->m_lib_id;
@ -1769,7 +1768,7 @@ SCH_COMPONENT& SCH_COMPONENT::operator=( const SCH_ITEM& aItem )
}
bool SCH_COMPONENT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
bool SCH_SYMBOL::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
EDA_RECT bBox = GetBodyBoundingBox();
bBox.Inflate( aAccuracy );
@ -1781,7 +1780,7 @@ bool SCH_COMPONENT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
}
bool SCH_COMPONENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
bool SCH_SYMBOL::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
if( m_flags & STRUCT_DELETED || m_flags & SKIP_STRUCT )
return false;
@ -1797,7 +1796,7 @@ bool SCH_COMPONENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccura
}
bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const
bool SCH_SYMBOL::doIsConnected( const wxPoint& aPosition ) const
{
wxPoint new_pos = m_transform.InverseTransform().TransformCoordinate( aPosition - m_pos );
@ -1825,13 +1824,13 @@ bool SCH_COMPONENT::doIsConnected( const wxPoint& aPosition ) const
}
bool SCH_COMPONENT::IsInNetlist() const
bool SCH_SYMBOL::IsInNetlist() const
{
return m_isInNetlist;
}
void SCH_COMPONENT::Plot( PLOTTER* aPlotter ) const
void SCH_SYMBOL::Plot( PLOTTER* aPlotter ) const
{
if( m_part )
{
@ -1848,7 +1847,7 @@ void SCH_COMPONENT::Plot( PLOTTER* aPlotter ) const
}
bool SCH_COMPONENT::HasBrightenedPins()
bool SCH_SYMBOL::HasBrightenedPins()
{
for( const auto& pin : m_pins )
{
@ -1860,14 +1859,14 @@ bool SCH_COMPONENT::HasBrightenedPins()
}
void SCH_COMPONENT::ClearBrightenedPins()
void SCH_SYMBOL::ClearBrightenedPins()
{
for( auto& pin : m_pins )
pin->ClearBrightened();
}
bool SCH_COMPONENT::IsPointClickableAnchor( const wxPoint& aPos ) const
bool SCH_SYMBOL::IsPointClickableAnchor( const wxPoint& aPos ) const
{
for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
{

View File

@ -24,8 +24,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef COMPONENT_CLASS_H
#define COMPONENT_CLASS_H
#ifndef __SYMBOL_H__
#define __SYMBOL_H__
#include <eda_item.h>
#include <core/typeinfo.h>
@ -46,7 +46,7 @@
#include <sch_field.h>
#include <sch_item.h>
#include <sch_pin.h>
#include <sch_sheet_path.h> // COMPONENT_INSTANCE_REFERENCE
#include <sch_sheet_path.h> // SYMBOL_INSTANCE_REFERENCE
#include <symbol_lib_table.h>
#include <transform.h>
@ -75,10 +75,10 @@ extern std::string toUTFTildaText( const wxString& txt );
/**
* Schematic symbol object.
*/
class SCH_COMPONENT : public SCH_ITEM
class SCH_SYMBOL : public SCH_ITEM
{
public:
SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = NULL );
SCH_SYMBOL( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = NULL );
/**
* Create schematic symbol from library symbol object.
@ -91,12 +91,12 @@ public:
* @param pos is the position of the symbol.
* @param setNewItemFlag is used to set the symbol #IS_NEW and #IS_MOVING flags.
*/
SCH_COMPONENT( const LIB_PART& aPart, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
int unit = 0, int convert = 0,
const wxPoint& pos = wxPoint( 0, 0 ) );
SCH_SYMBOL( const LIB_PART& aPart, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
int unit = 0, int convert = 0, const wxPoint& pos = wxPoint( 0, 0 ) );
SCH_SYMBOL( const LIB_PART& aPart, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
const wxPoint& pos = wxPoint( 0, 0 ) );
SCH_COMPONENT( const LIB_PART& aPart, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
const wxPoint& pos = wxPoint( 0, 0 ) );
/**
* Clone \a aSymbol into a new schematic symbol object.
*
@ -106,18 +106,18 @@ public:
*
* @param aSymbol is the schematic symbol to clone.
*/
SCH_COMPONENT( const SCH_COMPONENT& aSymbol );
SCH_SYMBOL( const SCH_SYMBOL& aSymbol );
~SCH_COMPONENT() { }
~SCH_SYMBOL() { }
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && SCH_COMPONENT_T == aItem->Type();
return aItem && SCH_SYMBOL_T == aItem->Type();
}
wxString GetClass() const override
{
return wxT( "SCH_COMPONENT" );
return wxT( "SCH_SYMBOL" );
}
const std::vector<SYMBOL_INSTANCE_REFERENCE>& GetInstanceReferences()
@ -254,12 +254,12 @@ public:
* Because there are different ways to have a given orientation/mirror,
* the orientation/mirror is not necessary what the user does. For example:
* a mirrorV then a mirrorH returns no mirror but a rotate. This function finds
* a rotation and a mirror value #CMP_MIRROR_X because this is the first mirror
* a rotation and a mirror value #SYM_MIRROR_X because this is the first mirror
* option tested. This can differs from the orientation made by an user. A
* #CMP_MIRROR_Y is returned as a #CMP_MIRROR_X with an orientation 180 because
* #SYM_MIRROR_Y is returned as a #SYM_MIRROR_X with an orientation 180 because
* they are equivalent.
*
* @sa COMPONENT_ORIENTATION_T
* @sa SYMBOL_ORIENTATION_T
*
* @return the orientation and mirror of the symbol.
*/
@ -601,7 +601,7 @@ public:
return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
( aItem->Type() == SCH_NO_CONNECT_T ) ||
( aItem->Type() == SCH_JUNCTION_T ) ||
( aItem->Type() == SCH_COMPONENT_T ) ||
( aItem->Type() == SCH_SYMBOL_T ) ||
( aItem->Type() == SCH_LABEL_T ) ||
( aItem->Type() == SCH_HIER_LABEL_T ) ||
( aItem->Type() == SCH_GLOBAL_LABEL_T );
@ -631,10 +631,10 @@ public:
bool operator <( const SCH_ITEM& aItem ) const override;
bool operator==( const SCH_COMPONENT& aSymbol) const;
bool operator!=( const SCH_COMPONENT& aSymbol) const;
bool operator==( const SCH_SYMBOL& aSymbol) const;
bool operator!=( const SCH_SYMBOL& aSymbol) const;
SCH_COMPONENT& operator=( const SCH_ITEM& aItem );
SCH_SYMBOL& operator=( const SCH_ITEM& aItem );
bool IsReplaceable() const override { return true; }
@ -706,4 +706,4 @@ private:
std::vector<SYMBOL_INSTANCE_REFERENCE> m_instanceReferences;
};
#endif /* COMPONENT_CLASS_H */
#endif /* __SYMBOL_H__ */

View File

@ -219,11 +219,11 @@ bool SCHEMATIC::ResolveCrossReference( wxString* token, int aDepth ) const
SCH_SHEET_PATH dummy;
SCH_ITEM* refItem = sheetList.GetItem( KIID( ref ), &dummy );
if( refItem && refItem->Type() == SCH_COMPONENT_T )
if( refItem && refItem->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* refComponent = static_cast<SCH_COMPONENT*>( refItem );
SCH_SYMBOL* refSymbol = static_cast<SCH_SYMBOL*>( refItem );
if( refComponent->ResolveTextVar( &remainder, aDepth + 1 ) )
if( refSymbol->ResolveTextVar( &remainder, aDepth + 1 ) )
{
*token = remainder;
return true;
@ -278,7 +278,7 @@ wxString SCHEMATIC::ConvertRefsToKIIDs( const wxString& aSource ) const
for( size_t jj = 0; jj < references.GetCount(); jj++ )
{
SCH_COMPONENT* refSymbol = references[ jj ].GetSymbol();
SCH_SYMBOL* refSymbol = references[ jj ].GetSymbol();
if( ref == refSymbol->GetRef( &references[ jj ].GetSheetPath(), true ) )
{
@ -336,10 +336,10 @@ wxString SCHEMATIC::ConvertKIIDsToRefs( const wxString& aSource ) const
SCH_SHEET_PATH refSheetPath;
SCH_ITEM* refItem = sheetList.GetItem( KIID( ref ), &refSheetPath );
if( refItem && refItem->Type() == SCH_COMPONENT_T )
if( refItem && refItem->Type() == SCH_SYMBOL_T )
{
SCH_COMPONENT* refComponent = static_cast<SCH_COMPONENT*>( refItem );
token = refComponent->GetRef( &refSheetPath, true ) + ":" + remainder;
SCH_SYMBOL* refSymbol = static_cast<SCH_SYMBOL*>( refItem );
token = refSymbol->GetRef( &refSheetPath, true ) + ":" + remainder;
}
}

View File

@ -316,11 +316,11 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
switch( status )
{
case UNDO_REDO::CHANGED:
if( item->Type() == SCH_COMPONENT_T )
if( item->Type() == SCH_SYMBOL_T )
{
// Update the schematic library cache in case that was the change.
SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( item );
SCH_COMPONENT* altSymbol = dynamic_cast<SCH_COMPONENT*>( alt_item );
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item );
SCH_SYMBOL* altSymbol = dynamic_cast<SCH_SYMBOL*>( alt_item );
wxCHECK( symbol && altSymbol, /* void */ );
@ -329,8 +329,8 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
item->SwapData( alt_item );
if( item->Type() == SCH_COMPONENT_T )
static_cast<SCH_COMPONENT*>( item )->UpdatePins();
if( item->Type() == SCH_SYMBOL_T )
static_cast<SCH_SYMBOL*>( item )->UpdatePins();
break;

View File

@ -545,7 +545,7 @@ void SIM_PLOT_FRAME::AddCurrentPlot( const wxString& aDeviceName, const wxString
}
void SIM_PLOT_FRAME::AddTuner( SCH_COMPONENT* aComponent )
void SIM_PLOT_FRAME::AddTuner( SCH_SYMBOL* aSymbol )
{
SIM_PANEL_BASE* plotPanel = currentPlotWindow();
@ -553,13 +553,13 @@ void SIM_PLOT_FRAME::AddTuner( SCH_COMPONENT* aComponent )
return;
// For now limit the tuner tool to RLC components
char primitiveType = NETLIST_EXPORTER_PSPICE::GetSpiceField( SF_PRIMITIVE, aComponent, 0 )[0];
char primitiveType = NETLIST_EXPORTER_PSPICE::GetSpiceField( SF_PRIMITIVE, aSymbol, 0 )[0];
if( primitiveType != SP_RESISTOR && primitiveType != SP_CAPACITOR
&& primitiveType != SP_INDUCTOR )
return;
const wxString componentName = aComponent->GetField( REFERENCE_FIELD )->GetText();
const wxString componentName = aSymbol->GetField( REFERENCE_FIELD )->GetText();
// Do not add multiple instances for the same component
auto tunerIt = std::find_if( m_tuners.begin(), m_tuners.end(), [&]( const TUNER_SLIDER* t )
@ -573,7 +573,7 @@ void SIM_PLOT_FRAME::AddTuner( SCH_COMPONENT* aComponent )
try
{
TUNER_SLIDER* tuner = new TUNER_SLIDER( this, m_tunePanel, aComponent );
TUNER_SLIDER* tuner = new TUNER_SLIDER( this, m_tunePanel, aSymbol );
m_tuneSizer->Add( tuner );
m_tuners.push_back( tuner );
m_tunePanel->Layout();

View File

@ -47,7 +47,7 @@
#include <map>
class SCH_EDIT_FRAME;
class SCH_COMPONENT;
class SCH_SYMBOL;
class SPICE_SIMULATOR;
class SPICE_SIMULATOR_SETTINGS;
@ -97,9 +97,9 @@ public:
void AddCurrentPlot( const wxString& aDeviceName, const wxString& aParam );
/**
* Add a tuner for a component.
* Add a tuner for a symbol.
*/
void AddTuner( SCH_COMPONENT* aComponent );
void AddTuner( SCH_SYMBOL* aSymbol );
/**
* Remove an existing tuner.

View File

@ -683,7 +683,7 @@ void SYMBOL_EDIT_FRAME::SetCurPart( LIB_PART* aPart, bool aUpdateZoom )
m_my_part = aPart;
// select the current component in the tree widget
// select the current symbol in the tree widget
if( !IsSymbolFromSchematic() && m_my_part )
m_treePane->GetLibTree()->SelectLibId( m_my_part->GetLibId() );
else
@ -1272,7 +1272,7 @@ SELECTION& SYMBOL_EDIT_FRAME::GetCurrentSelection()
}
void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_COMPONENT* aSymbol )
void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
{
std::unique_ptr<LIB_PART> part = aSymbol->GetPartRef()->Flatten();
wxCHECK( part, /* void */ );

View File

@ -338,7 +338,7 @@ public:
*
* @param aSymbol the symbol to edit.
*/
void LoadSymbolFromSchematic( SCH_COMPONENT* aSymbol );
void LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol );
/**
* Test if a symbol is loaded and can be edited.
@ -531,7 +531,7 @@ private:
// copy could be.
wxComboBox* m_unitSelectBox; // a ComboBox to select a unit to edit (if the
// part has multiple units)
SYMBOL_TREE_PANE* m_treePane; // component search tree widget
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

View File

@ -409,7 +409,7 @@ void SYMBOL_EDIT_FRAME::CreateNewPart()
// Currently, symbol names cannot include a space, that breaks libraries:
name.Replace( " ", "_" );
// Test if there is a component with this name already.
// Test if there is a symbol with this name already.
if( !lib.empty() && m_libMgr->PartExists( name, lib ) )
{
wxString msg = wxString::Format( _( "Symbol \"%s\" already exists in library \"%s\"" ),
@ -660,7 +660,7 @@ void SYMBOL_EDIT_FRAME::savePartAs()
return;
}
// Test if there is a component with this name already.
// Test if there is a symbol with this name already.
if( m_libMgr->PartExists( new_name, new_lib ) )
{
wxString msg = wxString::Format( _( "Symbol '%s' already exists in library '%s'" ),

View File

@ -74,7 +74,7 @@ void SYMBOL_TREE_MODEL_ADAPTER::AddLibraries( const std::vector<wxString>& aNick
std::unordered_map<wxString, std::vector<LIB_PART*>> loadedSymbols;
SYMBOL_ASYNC_LOADER loader( aNicknames, m_libs,
GetFilter() == LIB_TREE_MODEL_ADAPTER::CMP_FILTER_POWER,
GetFilter() == LIB_TREE_MODEL_ADAPTER::SYM_FILTER_POWER,
&loadedSymbols, prg.get() );
LOCALE_IO toggle;
@ -140,7 +140,7 @@ void SYMBOL_TREE_MODEL_ADAPTER::AddLibraries( const std::vector<wxString>& aNick
void SYMBOL_TREE_MODEL_ADAPTER::AddLibrary( wxString const& aLibNickname )
{
bool onlyPowerSymbols = ( GetFilter() == CMP_FILTER_POWER );
bool onlyPowerSymbols = ( GetFilter() == SYM_FILTER_POWER );
std::vector<LIB_PART*> symbols;
std::vector<LIB_TREE_ITEM*> comp_list;

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2014-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-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

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -56,7 +56,7 @@
#include <default_values.h>
// Save previous component library viewer state.
// Save previous symbol library viewer state.
wxString SYMBOL_VIEWER_FRAME::m_libraryName;
wxString SYMBOL_VIEWER_FRAME::m_entryName;
@ -77,8 +77,8 @@ BEGIN_EVENT_TABLE( SYMBOL_VIEWER_FRAME, EDA_DRAW_FRAME )
// listbox events
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, SYMBOL_VIEWER_FRAME::ClickOnLibList )
EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, SYMBOL_VIEWER_FRAME::ClickOnCmpList )
EVT_LISTBOX_DCLICK( ID_LIBVIEW_CMP_LIST, SYMBOL_VIEWER_FRAME::DClickOnCmpList )
EVT_LISTBOX( ID_LIBVIEW_SYM_LIST, SYMBOL_VIEWER_FRAME::ClickOnCmpList )
EVT_LISTBOX_DCLICK( ID_LIBVIEW_SYM_LIST, SYMBOL_VIEWER_FRAME::DClickOnCmpList )
// Menu (and/or hotkey) events
EVT_MENU( wxID_CLOSE, SYMBOL_VIEWER_FRAME::CloseLibraryViewer )
@ -155,7 +155,7 @@ SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAM
m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize,
0, NULL, wxLB_HSCROLL | wxNO_BORDER );
m_symbolList = new wxListBox( this, ID_LIBVIEW_CMP_LIST, wxDefaultPosition, wxDefaultSize,
m_symbolList = new wxListBox( this, ID_LIBVIEW_SYM_LIST, wxDefaultPosition, wxDefaultSize,
0, NULL, wxLB_HSCROLL | wxNO_BORDER );
if( aLibraryName.empty() )
@ -490,7 +490,7 @@ bool SYMBOL_VIEWER_FRAME::ReCreateLibList()
}
}
// Remove libs which have no power components, if this filter is activated
// Remove libs which have no power symbols, if this filter is activated
if( m_listPowerCmpOnly )
{
for( unsigned ii = 0; ii < libs.size(); )
@ -584,7 +584,7 @@ bool SYMBOL_VIEWER_FRAME::ReCreateSymbolList()
m_symbolList->SetSelection( index, true );
wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_SYM_LIST );
ProcessEvent( evt );
return changed;
@ -813,13 +813,14 @@ void SYMBOL_VIEWER_FRAME::OnSelectSymbol( wxCommandEvent& aEvent )
{
std::unique_lock<std::mutex> dialogLock( DIALOG_CHOOSE_SYMBOL::g_Mutex, std::defer_lock );
// One CHOOSE_COMPONENT dialog at a time. User probably can't handle more anyway.
// One CHOOSE_SYMBOL dialog at a time. User probably can't handle more anyway.
if( !dialogLock.try_lock() )
return;
// Container doing search-as-you-type.
SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable();
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> adapter = SYMBOL_TREE_MODEL_ADAPTER::Create( this, libs );
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> adapter =
SYMBOL_TREE_MODEL_ADAPTER::Create( this, libs );
const auto libNicknames = libs->GetLogicalLibs();
static_cast<SYMBOL_TREE_MODEL_ADAPTER*>( adapter.get() )->AddLibraries( libNicknames, this );
@ -855,7 +856,7 @@ void SYMBOL_VIEWER_FRAME::OnSelectSymbol( wxCommandEvent& aEvent )
void SYMBOL_VIEWER_FRAME::onSelectNextSymbol( wxCommandEvent& aEvent )
{
wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_SYM_LIST );
int ii = m_symbolList->GetSelection();
// Select the next symbol or stop at the end of the list.
@ -869,7 +870,7 @@ void SYMBOL_VIEWER_FRAME::onSelectNextSymbol( wxCommandEvent& aEvent )
void SYMBOL_VIEWER_FRAME::onSelectPreviousSymbol( wxCommandEvent& aEvent )
{
wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_CMP_LIST );
wxCommandEvent evt( wxEVT_COMMAND_LISTBOX_SELECTED, ID_LIBVIEW_SYM_LIST );
int ii = m_symbolList->GetSelection();
// Select the previous symbol or stop at the beginning of list.

View File

@ -43,7 +43,7 @@
void SCH_EDITOR_CONTROL::AssignFootprints( const std::string& aChangedSetOfReferences )
{
// Build a flat list of components in schematic:
// Build a flat list of symbols in schematic:
SCH_REFERENCE_LIST refs;
SCH_SHEET_LIST sheets = m_frame->Schematic().GetSheets();
bool isChanged = false;
@ -75,7 +75,7 @@ void SCH_EDITOR_CONTROL::AssignFootprints( const std::string& aChangedSetOfRefer
else
footprint.Empty();
// Search the component in the flat list
// Search the symbol in the flat list
for( unsigned ii = 0; ii < refs.GetCount(); ++ii )
{
if( reference == refs[ii].GetRef() )
@ -83,19 +83,20 @@ void SCH_EDITOR_CONTROL::AssignFootprints( const std::string& aChangedSetOfRefer
// We have found a candidate.
// Note: it can be not unique (multiple parts per package)
// So we *do not* stop the search here
SCH_COMPONENT* component = refs[ ii ].GetSymbol();
SCH_SYMBOL* symbol = refs[ ii ].GetSymbol();
// For backwards-compatibility CvPcb currently updates all instances of a
// component (even though it lists these instances separately).
// symbol (even though it lists these instances separately).
SCH_SHEET_PATH* sheetPath = nullptr; // &refs[ii].GetSheetPath();
wxString oldfp = refs[ii].GetFootprint();
if( oldfp.IsEmpty() && component->GetField( FOOTPRINT_FIELD )->IsVisible() )
component->GetField( FOOTPRINT_FIELD )->SetVisible( false );
if( oldfp.IsEmpty() && symbol->GetField( FOOTPRINT_FIELD )->IsVisible() )
symbol->GetField( FOOTPRINT_FIELD )->SetVisible( false );
if( oldfp != footprint )
{
isChanged = true;
component->SetFootprint( sheetPath, footprint );
symbol->SetFootprint( sheetPath, footprint );
}
}
}
@ -120,7 +121,7 @@ bool SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile( const wxString& aFullFil
bool aForceVisibilityState,
bool aVisibilityState )
{
// Build a flat list of components in schematic:
// Build a flat list of symbols in schematic:
SCH_REFERENCE_LIST referencesList;
SCH_SHEET_LIST sheetList = m_frame->Schematic().GetSheets();
@ -134,7 +135,7 @@ bool SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile( const wxString& aFullFil
// cmpFileReader dtor will close cmpFile
FILE_LINE_READER cmpFileReader( cmpFile, aFullFilename );
// Now, for each component found in file,
// Now, for each symbol found in file,
// replace footprint field value by the new value:
wxString reference;
wxString footprint;
@ -148,7 +149,7 @@ bool SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile( const wxString& aFullFil
if( !buffer.StartsWith( wxT( "BeginCmp" ) ) )
continue;
// Begin component description.
// Begin symbol description.
reference.Empty();
footprint.Empty();
@ -171,12 +172,12 @@ bool SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile( const wxString& aFullFil
footprint = value;
}
// A block is read: initialize the footprint field of the corresponding component
// A block is read: initialize the footprint field of the corresponding symbol
// if the footprint name is not empty
if( reference.IsEmpty() )
continue;
// Search the component in the flat list
// Search the symbol in the flat list
for( unsigned ii = 0; ii < referencesList.GetCount(); ii++ )
{
if( reference == referencesList[ii].GetRef() )
@ -184,7 +185,7 @@ bool SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile( const wxString& aFullFil
// We have found a candidate.
// Note: it can be not unique (multiple units per part)
// So we *do not* stop the search here
SCH_COMPONENT* symbol = referencesList[ ii ].GetSymbol();
SCH_SYMBOL* symbol = referencesList[ ii ].GetSymbol();
SCH_SHEET_PATH* sheetPath = &referencesList[ii].GetSheetPath();
symbol->SetFootprint( sheetPath, footprint );
@ -229,7 +230,7 @@ int SCH_EDITOR_CONTROL::ImportFPAssignments( const TOOL_EVENT& aEvent )
if( !processCmpToFootprintLinkFile( filename, forceVisibility, visibilityState ) )
{
wxString msg = wxString::Format( _( "Failed to open component-footprint link file \"%s\"" ),
wxString msg = wxString::Format( _( "Failed to open symbol-footprint link file \"%s\"" ),
filename.GetData() );
DisplayError( m_frame, msg );

View File

@ -317,7 +317,7 @@ void BACK_ANNOTATE::applyChangelist()
{
SCH_REFERENCE& ref = item.first;
PCB_FP_DATA& fpData = *item.second;
SCH_COMPONENT* symbol = ref.GetSymbol();
SCH_SYMBOL* symbol = ref.GetSymbol();
SCH_SCREEN* screen = ref.GetSheetPath().LastScreen();
wxString oldFootprint = ref.GetFootprint();
wxString oldValue = ref.GetValue();
@ -438,23 +438,23 @@ static LABEL_SPIN_STYLE orientLabel( SCH_PIN* aPin )
}
orientations[] =
{
{ CMP_ORIENT_0, 0, 0, 0 },
{ CMP_ORIENT_90, 1, 0, 0 },
{ CMP_ORIENT_180, 2, 0, 0 },
{ CMP_ORIENT_270, 3, 0, 0 },
{ CMP_MIRROR_X + CMP_ORIENT_0, 0, 1, 0 },
{ CMP_MIRROR_X + CMP_ORIENT_90, 1, 1, 0 },
{ CMP_MIRROR_Y, 0, 0, 1 },
{ CMP_MIRROR_X + CMP_ORIENT_270, 3, 1, 0 },
{ CMP_MIRROR_Y + CMP_ORIENT_0, 0, 0, 1 },
{ CMP_MIRROR_Y + CMP_ORIENT_90, 1, 0, 1 },
{ CMP_MIRROR_Y + CMP_ORIENT_180, 2, 0, 1 },
{ CMP_MIRROR_Y + CMP_ORIENT_270, 3, 0, 1 }
{ SYM_ORIENT_0, 0, 0, 0 },
{ SYM_ORIENT_90, 1, 0, 0 },
{ SYM_ORIENT_180, 2, 0, 0 },
{ SYM_ORIENT_270, 3, 0, 0 },
{ SYM_MIRROR_X + SYM_ORIENT_0, 0, 1, 0 },
{ SYM_MIRROR_X + SYM_ORIENT_90, 1, 1, 0 },
{ SYM_MIRROR_Y, 0, 0, 1 },
{ SYM_MIRROR_X + SYM_ORIENT_270, 3, 1, 0 },
{ SYM_MIRROR_Y + SYM_ORIENT_0, 0, 0, 1 },
{ SYM_MIRROR_Y + SYM_ORIENT_90, 1, 0, 1 },
{ SYM_MIRROR_Y + SYM_ORIENT_180, 2, 0, 1 },
{ SYM_MIRROR_Y + SYM_ORIENT_270, 3, 0, 1 }
};
ORIENT o = orientations[ 0 ];
SCH_COMPONENT* parentSymbol = aPin->GetParentSymbol();
SCH_SYMBOL* parentSymbol = aPin->GetParentSymbol();
if( !parentSymbol )
return spin;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 CERN
* Copyright (C) 2018-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -266,7 +266,7 @@ void EE_GRID_HELPER::computeAnchors( SCH_ITEM *aItem, const VECTOR2I &aRefPos, b
{
switch ( aItem->Type() )
{
case SCH_COMPONENT_T:
case SCH_SYMBOL_T:
case SCH_SHEET_T:
addAnchor( aItem->GetPosition(), ORIGIN, aItem );
KI_FALLTHROUGH;

View File

@ -485,9 +485,9 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
if( selection.Empty() )
return 0;
SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front();
SCH_SYMBOL* symbol = (SCH_SYMBOL*) selection.Front();
datasheet = component->GetField( DATASHEET_FIELD )->GetText();
datasheet = symbol->GetField( DATASHEET_FIELD )->GetText();
}
if( datasheet.IsEmpty() || datasheet == wxT( "~" ) )

View File

@ -67,8 +67,8 @@ EDA_RECT EE_SELECTION::GetBoundingBox() const
for( EDA_ITEM* item : m_items )
{
if( item->Type() == SCH_COMPONENT_T )
bbox.Merge( static_cast<SCH_COMPONENT*>( item )->GetBoundingBox( false ) );
if( item->Type() == SCH_SYMBOL_T )
bbox.Merge( static_cast<SCH_SYMBOL*>( item )->GetBoundingBox( false ) );
else if( item->Type() == SCH_SHEET_T )
bbox.Merge( static_cast<SCH_SHEET*>( item )->GetBodyBoundingBox() );
else
@ -86,10 +86,10 @@ void EE_SELECTION::GetSymbols( SCH_REFERENCE_LIST& aReferences,
{
for( EDA_ITEM* item : Items() )
{
if( item->Type() != SCH_COMPONENT_T )
if( item->Type() != SCH_SYMBOL_T )
continue;
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
aSelectionPath.AppendSymbol( aReferences, symbol, aIncludePowerSymbols,
aForceIncludeOrphanSymbols );
}
@ -102,10 +102,10 @@ void EE_SELECTION::GetMultiUnitSymbols( SCH_MULTI_UNIT_REFERENCE_MAP& aRefList,
{
for( EDA_ITEM* item : Items() )
{
if( item->Type() != SCH_COMPONENT_T )
if( item->Type() != SCH_SYMBOL_T )
continue;
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
aSelectionPath.AppendMultiUnitSymbol( aRefList, symbol, aIncludePowerSymbols );
}
}

View File

@ -57,7 +57,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleSymbol = []( const SELECTION& aSel )
{
if( aSel.GetSize() == 1 )
{
SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( aSel.Front() );
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aSel.Front() );
if( symbol )
return !symbol->GetPartRef() || !symbol->GetPartRef()->IsPower();
@ -69,7 +69,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleSymbol = []( const SELECTION& aSel )
SELECTION_CONDITION EE_CONDITIONS::SingleSymbolOrPower = []( const SELECTION& aSel )
{
return aSel.GetSize() == 1 && aSel.Front()->Type() == SCH_COMPONENT_T;
return aSel.GetSize() == 1 && aSel.Front()->Type() == SCH_SYMBOL_T;
};
@ -77,7 +77,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleDeMorganSymbol = []( const SELECTION& a
{
if( aSel.GetSize() == 1 )
{
SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( aSel.Front() );
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aSel.Front() );
if( symbol )
return symbol->GetPartRef() && symbol->GetPartRef()->HasConversion();
@ -91,7 +91,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleMultiUnitSymbol = []( const SELECTION&
{
if( aSel.GetSize() == 1 )
{
SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( aSel.Front() );
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aSel.Front() );
if( symbol )
return symbol->GetPartRef() && symbol->GetPartRef()->GetUnitCount() >= 2;
@ -291,7 +291,7 @@ const KICAD_T movableSchematicItems[] =
SCH_GLOBAL_LABEL_T,
SCH_HIER_LABEL_T,
SCH_FIELD_T,
SCH_COMPONENT_T,
SCH_SYMBOL_T,
SCH_SHEET_PIN_T,
SCH_SHEET_T,
EOT
@ -411,7 +411,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
SCH_CONNECTION* connection = collector[0]->Connection();
if( ( connection && ( connection->IsNet() || connection->IsUnconnected() ) )
|| collector[0]->Type() == SCH_COMPONENT_T )
|| collector[0]->Type() == SCH_SYMBOL_T )
{
newEvt = EE_ACTIONS::drawWire.MakeEvent();
}
@ -584,13 +584,13 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
// context sub-menu selection? Handle unit selection or bus unfolding
if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
&& evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_CMP_MAX )
&& evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_SYM_MAX )
{
SCH_COMPONENT* component = dynamic_cast<SCH_COMPONENT*>( m_selection.Front() );
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( m_selection.Front() );
int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;
if( component )
static_cast<SCH_EDIT_FRAME*>( m_frame )->SelectUnit( component, unit );
if( symbol )
static_cast<SCH_EDIT_FRAME*>( m_frame )->SelectUnit( symbol, unit );
}
else if( evt->GetCommandId().get() >= ID_POPUP_SCH_UNFOLD_BUS
&& evt->GetCommandId().get() <= ID_POPUP_SCH_UNFOLD_BUS_END )
@ -636,7 +636,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
SCH_CONNECTION* connection = collector[0]->Connection();
if( ( connection && ( connection->IsNet() || connection->IsUnconnected() ) )
|| collector[0]->Type() == SCH_COMPONENT_T )
|| collector[0]->Type() == SCH_SYMBOL_T )
{
displayWireCursor = true;
}
@ -1003,7 +1003,7 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
SCH_ITEM* item = collector[i];
SCH_ITEM* other = collector[( i + 1 ) % 2];
if( item->Type() == SCH_COMPONENT_T && other->Type() == SCH_PIN_T )
if( item->Type() == SCH_SYMBOL_T && other->Type() == SCH_PIN_T )
{
// Make sure we aren't clicking on the pin anchor itself, only the rest of the
// pin should select the symbol with this setting
@ -1041,7 +1041,7 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
EDA_ITEM* item = collector[ i ];
EDA_ITEM* other = collector[ ( i + 1 ) % 2 ];
if( preferred.count( item->Type() ) && other->Type() == SCH_COMPONENT_T )
if( preferred.count( item->Type() ) && other->Type() == SCH_SYMBOL_T )
collector.Transfer( other );
}
@ -1230,7 +1230,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
children.emplace_back( KIGFX::VIEW::LAYER_ITEM_PAIR( pin, layer ) );
}
SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( pair.first );
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( pair.first );
if( symbol )
{
@ -1311,7 +1311,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
static KICAD_T nodeTypes[] =
{
SCH_COMPONENT_LOCATE_POWER_T,
SCH_SYMBOL_LOCATE_POWER_T,
SCH_PIN_T,
SCH_LINE_LOCATE_WIRE_T,
SCH_LINE_LOCATE_BUS_T,
@ -1520,7 +1520,7 @@ void EE_SELECTION_TOOL::RebuildSelection()
{
for( SCH_ITEM* item : m_frame->GetScreen()->Items() )
{
// If the field and component are selected, only use the component
// If the field and symbol are selected, only use the symbol
if( item->IsSelected() )
{
select( item );
@ -1804,8 +1804,8 @@ void EE_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, EE_SELECTION* aGr
if( aGroup )
aGroup->Add( aItem );
// Highlight pins and fields. (All the other component children are currently only
// represented in the LIB_PART and will inherit the settings of the parent component.)
// Highlight pins and fields. (All the other symbol children are currently only
// represented in the LIB_PART and will inherit the settings of the parent symbol.)
if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
{
sch_item->RunOnChildren(
@ -1837,7 +1837,7 @@ void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, EE_SELECTION* a
if( aGroup )
aGroup->Remove( aItem );
// Unhighlight pins and fields. (All the other component children are currently only
// Unhighlight pins and fields. (All the other symbol children are currently only
// represented in the LIB_PART.)
if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
{

View File

@ -108,7 +108,7 @@ EDA_RECT SCH_DRAWING_TOOLS::GetCanvasFreeAreaPixels()
int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
{
SCH_COMPONENT* symbol = aEvent.Parameter<SCH_COMPONENT*>();
SCH_SYMBOL* symbol = aEvent.Parameter<SCH_SYMBOL*>();
SCHLIB_FILTER filter;
std::vector<PICKED_SYMBOL>* historyList = nullptr;
@ -138,7 +138,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
Activate();
auto addSymbol =
[&]( SCH_COMPONENT* aSymbol )
[&]( SCH_SYMBOL* aSymbol )
{
m_frame->SaveCopyForRepeatItem( aSymbol );
@ -265,7 +265,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
continue;
wxPoint pos( cursorPos );
symbol = new SCH_COMPONENT( *part, &m_frame->GetCurrentSheet(), sel, pos );
symbol = new SCH_SYMBOL( *part, &m_frame->GetCurrentSheet(), sel, pos );
addSymbol( symbol );
// Update cursor now that we have a symbol
@ -285,7 +285,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
m_frame->GetScreen()->Update( symbol );
m_frame->OnModify();
SCH_COMPONENT* nextSymbol = nullptr;
SCH_SYMBOL* nextSymbol = nullptr;
if( m_frame->eeconfig()->m_SymChooserPanel.place_all_units
|| m_frame->eeconfig()->m_SymChooserPanel.keep_symbol )
@ -305,7 +305,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
// We are either stepping to the next unit or next symbol
if( m_frame->eeconfig()->m_SymChooserPanel.keep_symbol || new_unit > 1 )
{
nextSymbol = static_cast<SCH_COMPONENT*>( symbol->Duplicate() );
nextSymbol = static_cast<SCH_SYMBOL*>( symbol->Duplicate() );
nextSymbol->SetUnit( new_unit );
nextSymbol->SetUnitSelection( new_unit );
@ -327,7 +327,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
{
if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
&& evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_CMP_MAX )
&& evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_SYM_MAX )
{
int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;

View File

@ -29,7 +29,7 @@
#include <sch_base_frame.h>
#include <status_popup.h>
class SCH_COMPONENT;
class SCH_SYMBOL;
class SCH_BUS_WIRE_ENTRY;
class SCH_LABEL;
class SCHLIB_FILTER;

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