More component -> symbol.
This commit is contained in:
parent
6e6e0aa644
commit
b227d2b910
|
@ -451,7 +451,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_COMPONENT* aSymbol, SCH_SCREEN* a
|
|||
wxString msg;
|
||||
wxString references;
|
||||
|
||||
for( COMPONENT_INSTANCE_REFERENCE instance : aSymbol->GetInstanceReferences() )
|
||||
for( SYMBOL_INSTANCE_REFERENCE instance : aSymbol->GetInstanceReferences() )
|
||||
{
|
||||
if( references.IsEmpty() )
|
||||
references = instance.m_Reference;
|
||||
|
|
|
@ -272,8 +272,8 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
|
|||
bBox.RevertYAxis();
|
||||
wxPoint txtpos = bBox.Centre();
|
||||
|
||||
/* The text orientation may need to be flipped if the
|
||||
* transformation matrix causes xy axes to be flipped. */
|
||||
// The text orientation may need to be flipped if the transformation matrix causes xy
|
||||
// axes to be flipped.
|
||||
int t1 = ( aTransform.x1 != 0 ) ^ ( GetTextAngle() != 0 );
|
||||
wxPoint pos = aTransform.TransformCoordinate( txtpos ) + offset;
|
||||
|
||||
|
@ -308,12 +308,11 @@ void LIB_TEXT::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void*
|
|||
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
|
||||
int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||
|
||||
/* Calculate the text orientation, according to the component
|
||||
* orientation/mirror (needed when draw text in schematic)
|
||||
*/
|
||||
// Calculate the text orientation, according to the symbol orientation/mirror (needed when
|
||||
// draw text in schematic)
|
||||
int orient = (int) GetTextAngle();
|
||||
|
||||
if( aTransform.y1 ) // Rotate component 90 degrees.
|
||||
if( aTransform.y1 ) // Rotate symbol 90 degrees.
|
||||
{
|
||||
if( orient == TEXT_ANGLE_HORIZ )
|
||||
orient = TEXT_ANGLE_VERT;
|
||||
|
@ -321,16 +320,15 @@ void LIB_TEXT::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void*
|
|||
orient = TEXT_ANGLE_HORIZ;
|
||||
}
|
||||
|
||||
/* Calculate the text justification, according to the component
|
||||
* orientation/mirror this is a bit complicated due to cumulative
|
||||
* calculations:
|
||||
/*
|
||||
* Calculate the text justification, according to the symbol orientation/mirror.
|
||||
* This is a bit complicated due to cumulative calculations:
|
||||
* - numerous cases (mirrored or not, rotation)
|
||||
* - the DrawGraphicText function recalculate also H and H justifications
|
||||
* according to the text orientation.
|
||||
* - When a component is mirrored, the text is not mirrored and
|
||||
* justifications are complicated to calculate
|
||||
* so the more easily way is to use no justifications ( Centered text )
|
||||
* and use GetBoundaryBox to know the text coordinate considered as centered
|
||||
* - the GRText function will also recalculate H and V justifications according to the text
|
||||
* orientation.
|
||||
* - When a symbol is mirrored, the text is not mirrored and justifications are complicated
|
||||
* to calculate so the more easily way is to use no justifications (centered text) and
|
||||
* use GetBoundingBox to know the text coordinate considered as centered
|
||||
*/
|
||||
EDA_RECT bBox = GetBoundingBox();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
namespace {
|
||||
|
||||
wxString GetNextComponent( const wxString& str, wxString::size_type& cursor )
|
||||
wxString GetNextSymbol( const wxString& str, wxString::size_type& cursor )
|
||||
{
|
||||
if( str.size() <= cursor )
|
||||
return wxEmptyString;
|
||||
|
@ -113,44 +113,44 @@ int PinNumbers::Compare( const PinNumber& lhs, const PinNumber& rhs )
|
|||
wxString::size_type cursor1 = 0;
|
||||
wxString::size_type cursor2 = 0;
|
||||
|
||||
wxString comp1, comp2;
|
||||
wxString symbol1, symbol2;
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
comp1 = GetNextComponent( lhs, cursor1 );
|
||||
comp2 = GetNextComponent( rhs, cursor2 );
|
||||
symbol1 = GetNextSymbol( lhs, cursor1 );
|
||||
symbol2 = GetNextSymbol( rhs, cursor2 );
|
||||
|
||||
if( comp1.empty() && comp2.empty() )
|
||||
if( symbol1.empty() && symbol2.empty() )
|
||||
return 0;
|
||||
|
||||
if( comp1.empty() )
|
||||
if( symbol1.empty() )
|
||||
return -2;
|
||||
|
||||
if( comp2.empty() )
|
||||
if( symbol2.empty() )
|
||||
return 2;
|
||||
|
||||
wxChar c1 = comp1[0];
|
||||
wxChar c2 = comp2[0];
|
||||
wxChar c1 = symbol1[0];
|
||||
wxChar c2 = symbol2[0];
|
||||
|
||||
if( wxIsdigit( c1 ) || c1 == '-' || c1 == '+' )
|
||||
{
|
||||
if( wxIsdigit( c2 ) || c2 == '-' || c2 == '+' )
|
||||
{
|
||||
// numeric comparison
|
||||
wxString::size_type v1 = comp1.find_first_of( "vV" );
|
||||
wxString::size_type v1 = symbol1.find_first_of( "vV" );
|
||||
|
||||
if( v1 != wxString::npos )
|
||||
comp1[v1] = '.';
|
||||
symbol1[v1] = '.';
|
||||
|
||||
wxString::size_type v2 = comp2.find_first_of( "vV" );
|
||||
wxString::size_type v2 = symbol2.find_first_of( "vV" );
|
||||
|
||||
if( v2 != wxString::npos )
|
||||
comp2[v2] = '.';
|
||||
symbol2[v2] = '.';
|
||||
|
||||
double val1, val2;
|
||||
|
||||
comp1.ToCDouble( &val1 );
|
||||
comp2.ToCDouble( &val2 );
|
||||
symbol1.ToCDouble( &val1 );
|
||||
symbol2.ToCDouble( &val2 );
|
||||
|
||||
if( val1 < val2 )
|
||||
{
|
||||
|
@ -176,7 +176,7 @@ int PinNumbers::Compare( const PinNumber& lhs, const PinNumber& rhs )
|
|||
if( wxIsdigit( c2 ) || c2 == '-' || c2 == '+' )
|
||||
return 2;
|
||||
|
||||
int res = comp1.Cmp( comp2 );
|
||||
int res = symbol1.Cmp( symbol2 );
|
||||
|
||||
if( res != 0 )
|
||||
return res;
|
||||
|
|
|
@ -394,7 +394,7 @@ void SCH_COMPONENT::AddHierarchicalReference( const KIID_PATH& aPath, const wxSt
|
|||
}
|
||||
}
|
||||
|
||||
COMPONENT_INSTANCE_REFERENCE instance;
|
||||
SYMBOL_INSTANCE_REFERENCE instance;
|
||||
instance.m_Path = aPath;
|
||||
instance.m_Reference = aRef;
|
||||
instance.m_Unit = aUnit;
|
||||
|
@ -418,7 +418,7 @@ const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet, bool aInclude
|
|||
KIID_PATH path = sheet->Path();
|
||||
wxString ref;
|
||||
|
||||
for( const COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( const SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path )
|
||||
{
|
||||
|
@ -469,7 +469,7 @@ void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref )
|
|||
bool notInArray = true;
|
||||
|
||||
// check to see if it is already there before inserting it
|
||||
for( COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path )
|
||||
{
|
||||
|
@ -522,7 +522,7 @@ bool SCH_COMPONENT::IsAnnotated( const SCH_SHEET_PATH* aSheet )
|
|||
{
|
||||
KIID_PATH path = aSheet->Path();
|
||||
|
||||
for( const COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( const SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path )
|
||||
return instance.m_Reference.Last() != '?';
|
||||
|
@ -536,7 +536,7 @@ int SCH_COMPONENT::GetUnitSelection( const SCH_SHEET_PATH* aSheet ) const
|
|||
{
|
||||
KIID_PATH path = aSheet->Path();
|
||||
|
||||
for( const COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( const SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path )
|
||||
return instance.m_Unit;
|
||||
|
@ -553,7 +553,7 @@ void SCH_COMPONENT::SetUnitSelection( const SCH_SHEET_PATH* aSheet, int aUnitSel
|
|||
KIID_PATH path = aSheet->Path();
|
||||
|
||||
// check to see if it is already there before inserting it
|
||||
for( COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path )
|
||||
{
|
||||
|
@ -571,7 +571,7 @@ const wxString SCH_COMPONENT::GetValue( const SCH_SHEET_PATH* sheet ) const
|
|||
{
|
||||
KIID_PATH path = sheet->Path();
|
||||
|
||||
for( const COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( const SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path && !instance.m_Value.IsEmpty() )
|
||||
{
|
||||
|
@ -590,7 +590,7 @@ void SCH_COMPONENT::SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValu
|
|||
if( sheet == nullptr )
|
||||
{
|
||||
// Clear instance overrides and set primary field value
|
||||
for( COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
instance.m_Value = wxEmptyString;
|
||||
|
||||
m_Fields[ VALUE_FIELD ].SetText( aValue );
|
||||
|
@ -600,7 +600,7 @@ void SCH_COMPONENT::SetValue( const SCH_SHEET_PATH* sheet, const wxString& aValu
|
|||
KIID_PATH path = sheet->Path();
|
||||
|
||||
// check to see if it is already there before inserting it
|
||||
for( COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path )
|
||||
{
|
||||
|
@ -618,7 +618,7 @@ const wxString SCH_COMPONENT::GetFootprint( const SCH_SHEET_PATH* sheet ) const
|
|||
{
|
||||
KIID_PATH path = sheet->Path();
|
||||
|
||||
for( const COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( const SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path && !instance.m_Footprint.IsEmpty() )
|
||||
{
|
||||
|
@ -637,7 +637,7 @@ void SCH_COMPONENT::SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& a
|
|||
if( sheet == nullptr )
|
||||
{
|
||||
// Clear instance overrides and set primary field value
|
||||
for( COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
instance.m_Footprint = wxEmptyString;
|
||||
|
||||
m_Fields[ FOOTPRINT_FIELD ].SetText( aFootprint );
|
||||
|
@ -647,7 +647,7 @@ void SCH_COMPONENT::SetFootprint( const SCH_SHEET_PATH* sheet, const wxString& a
|
|||
KIID_PATH path = sheet->Path();
|
||||
|
||||
// check to see if it is already there before inserting it
|
||||
for( COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path )
|
||||
{
|
||||
|
@ -990,7 +990,7 @@ void SCH_COMPONENT::ClearAnnotation( const SCH_SHEET_PATH* aSheetPath )
|
|||
{
|
||||
KIID_PATH path = aSheetPath->Path();
|
||||
|
||||
for( COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
if( instance.m_Path == path )
|
||||
instance.m_Reference = defRef;
|
||||
|
@ -998,7 +998,7 @@ void SCH_COMPONENT::ClearAnnotation( const SCH_SHEET_PATH* aSheetPath )
|
|||
}
|
||||
else
|
||||
{
|
||||
for( COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
instance.m_Reference = defRef;
|
||||
}
|
||||
|
||||
|
@ -1020,7 +1020,7 @@ bool SCH_COMPONENT::AddSheetPathReferenceEntryIfMissing( const KIID_PATH& aSheet
|
|||
|
||||
wxString reference_path;
|
||||
|
||||
for( const COMPONENT_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
for( const SYMBOL_INSTANCE_REFERENCE& instance : m_instanceReferences )
|
||||
{
|
||||
// if aSheetPath is found, nothing to do:
|
||||
if( instance.m_Path == aSheetPath )
|
||||
|
@ -1037,7 +1037,7 @@ bool SCH_COMPONENT::ReplaceInstanceSheetPath( const KIID_PATH& aOldSheetPath,
|
|||
const KIID_PATH& aNewSheetPath )
|
||||
{
|
||||
auto it = std::find_if( m_instanceReferences.begin(), m_instanceReferences.end(),
|
||||
[ aOldSheetPath ]( COMPONENT_INSTANCE_REFERENCE& r )->bool
|
||||
[ aOldSheetPath ]( SYMBOL_INSTANCE_REFERENCE& r )->bool
|
||||
{
|
||||
return aOldSheetPath == r.m_Path;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ private:
|
|||
|
||||
// Defines the hierarchical path and reference of the component. This allows support
|
||||
// for multiple references to a single sub-sheet.
|
||||
std::vector<COMPONENT_INSTANCE_REFERENCE> m_instanceReferences;
|
||||
std::vector<SYMBOL_INSTANCE_REFERENCE> m_instanceReferences;
|
||||
|
||||
void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||
|
||||
|
@ -162,7 +162,7 @@ public:
|
|||
return wxT( "SCH_COMPONENT" );
|
||||
}
|
||||
|
||||
const std::vector<COMPONENT_INSTANCE_REFERENCE>& GetInstanceReferences()
|
||||
const std::vector<SYMBOL_INSTANCE_REFERENCE>& GetInstanceReferences()
|
||||
{
|
||||
return m_instanceReferences;
|
||||
}
|
||||
|
|
|
@ -600,17 +600,17 @@ bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
|
|||
{
|
||||
auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false );
|
||||
|
||||
if( symbolEditor && !symbolEditor->Close() ) // Can close component editor?
|
||||
if( symbolEditor && !symbolEditor->Close() ) // Can close symbol editor?
|
||||
return false;
|
||||
|
||||
auto* symbolViewer = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false );
|
||||
|
||||
if( symbolViewer && !symbolViewer->Close() ) // Can close component viewer?
|
||||
if( symbolViewer && !symbolViewer->Close() ) // Can close symbol viewer?
|
||||
return false;
|
||||
|
||||
symbolViewer = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER_MODAL, false );
|
||||
|
||||
if( symbolViewer && !symbolViewer->Close() ) // Can close modal component viewer?
|
||||
if( symbolViewer && !symbolViewer->Close() ) // Can close modal symbol viewer?
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1095,7 +1095,7 @@ 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* parentComponent = nullptr;
|
||||
SCH_COMPONENT* parentSymbol = nullptr;
|
||||
SCH_ITEM* undoItem = aItem;
|
||||
|
||||
if( aItem->Type() == SCH_SHEET_PIN_T )
|
||||
|
@ -1103,19 +1103,19 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM*
|
|||
parentSheet = (SCH_SHEET*) aItem->GetParent();
|
||||
|
||||
wxCHECK_RET( parentSheet && parentSheet->Type() == SCH_SHEET_T,
|
||||
wxT( "Cannot place sheet pin in invalid schematic sheet object." ) );
|
||||
wxT( "Cannot place sheet pin in invalid schematic sheet." ) );
|
||||
|
||||
undoItem = parentSheet;
|
||||
}
|
||||
|
||||
else if( aItem->Type() == SCH_FIELD_T )
|
||||
{
|
||||
parentComponent = (SCH_COMPONENT*) aItem->GetParent();
|
||||
parentSymbol = (SCH_COMPONENT*) aItem->GetParent();
|
||||
|
||||
wxCHECK_RET( parentComponent && parentComponent->Type() == SCH_COMPONENT_T,
|
||||
wxT( "Cannot place field in invalid schematic component object." ) );
|
||||
wxCHECK_RET( parentSymbol && parentSymbol->Type() == SCH_COMPONENT_T,
|
||||
wxT( "Cannot place field in invalid schematic symbol." ) );
|
||||
|
||||
undoItem = parentComponent;
|
||||
undoItem = parentSymbol;
|
||||
}
|
||||
|
||||
if( aItem->IsNew() )
|
||||
|
@ -1129,8 +1129,8 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM*
|
|||
}
|
||||
else if( aItem->Type() == SCH_FIELD_T )
|
||||
{
|
||||
// Component fields are also owned by their parent, but new component fields
|
||||
// are handled elsewhere.
|
||||
// Symbol fields are also owned by their parent, but new symbol fields are
|
||||
// handled elsewhere.
|
||||
wxLogMessage( wxT( "addCurrentItemToScreen: unexpected new SCH_FIELD" ) );
|
||||
}
|
||||
else
|
||||
|
@ -1499,9 +1499,9 @@ const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
|
|||
{
|
||||
if( item->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
// For components we need to get the bounding box without invisible text
|
||||
SCH_COMPONENT* comp = static_cast<SCH_COMPONENT*>( item );
|
||||
bBoxItems.Merge( comp->GetBoundingBox( false ) );
|
||||
// For symbols we need to get the bounding box without invisible text
|
||||
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
|
||||
bBoxItems.Merge( symbol->GetBoundingBox( false ) );
|
||||
}
|
||||
else
|
||||
bBoxItems.Merge( item->GetBoundingBox() );
|
||||
|
|
|
@ -109,12 +109,12 @@ wxString SCH_FIELD::GetShownText( int aDepth ) const
|
|||
}
|
||||
else
|
||||
{
|
||||
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
|
||||
if( component->ResolveTextVar( token, aDepth + 1 ) )
|
||||
if( parentSymbol->ResolveTextVar( token, aDepth + 1 ) )
|
||||
return true;
|
||||
|
||||
SCHEMATIC* schematic = component->Schematic();
|
||||
SCHEMATIC* schematic = parentSymbol->Schematic();
|
||||
SCH_SHEET* sheet = schematic ? schematic->CurrentSheet().Last() : nullptr;
|
||||
|
||||
if( sheet && sheet->ResolveTextVar( token, aDepth + 1 ) )
|
||||
|
@ -156,14 +156,14 @@ wxString SCH_FIELD::GetShownText( int aDepth ) const
|
|||
|
||||
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
|
||||
if( m_id == REFERENCE_FIELD )
|
||||
{
|
||||
// For more than one part per package, we must add the part selection
|
||||
// A, B, ... or 1, 2, .. to the reference.
|
||||
if( component->GetUnitCount() > 1 )
|
||||
text << LIB_PART::SubReference( component->GetUnit() );
|
||||
if( parentSymbol->GetUnitCount() > 1 )
|
||||
text << LIB_PART::SubReference( parentSymbol->GetUnit() );
|
||||
}
|
||||
}
|
||||
else if( m_parent && m_parent->Type() == SCH_SHEET_T )
|
||||
|
@ -193,14 +193,14 @@ void SCH_FIELD::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
|||
if( ( !IsVisible() && !IsForceVisible() ) || IsVoid() )
|
||||
return;
|
||||
|
||||
// Calculate the text orientation according to the component orientation.
|
||||
// Calculate the text orientation according to the symbol orientation.
|
||||
orient = GetTextAngle();
|
||||
|
||||
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
|
||||
if( parentComponent && parentComponent->GetTransform().y1 ) // Rotate component 90 degrees.
|
||||
if( parentSymbol && parentSymbol->GetTransform().y1 ) // Rotate symbol 90 degrees.
|
||||
{
|
||||
if( orient == TEXT_ANGLE_HORIZ )
|
||||
orient = TEXT_ANGLE_VERT;
|
||||
|
@ -209,16 +209,15 @@ void SCH_FIELD::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
|||
}
|
||||
}
|
||||
|
||||
/* Calculate the text justification, according to the component
|
||||
* orientation/mirror this is a bit complicated due to cumulative
|
||||
* calculations:
|
||||
/*
|
||||
* Calculate the text justification, according to the symbol orientation/mirror.
|
||||
* This is a bit complicated due to cumulative calculations:
|
||||
* - numerous cases (mirrored or not, rotation)
|
||||
* - the DrawGraphicText function recalculate also H and H justifications
|
||||
* according to the text orientation.
|
||||
* - When a component is mirrored, the text is not mirrored and
|
||||
* justifications are complicated to calculate
|
||||
* so the more easily way is to use no justifications ( Centered text )
|
||||
* and use GetBoundaryBox to know the text coordinate considered as centered
|
||||
* - the GRText function will also recalculate H and V justifications according to the text
|
||||
* orientation.
|
||||
* - When a symbol is mirrored, the text is not mirrored and justifications are complicated
|
||||
* to calculate so the more easily way is to use no justifications (centered text) and use
|
||||
* GetBoundingBox to know the text coordinate considered as centered
|
||||
*/
|
||||
EDA_RECT boundaryBox = GetBoundingBox();
|
||||
textpos = boundaryBox.Centre() + aOffset;
|
||||
|
@ -260,19 +259,19 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const
|
|||
RotatePoint( &begin, pos, GetTextAngle() );
|
||||
RotatePoint( &end, pos, GetTextAngle() );
|
||||
|
||||
// Now, apply the component transform (mirror/rot)
|
||||
// Now, apply the symbol transform (mirror/rot)
|
||||
TRANSFORM transform;
|
||||
|
||||
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
|
||||
// Due to the Y axis direction, we must mirror the bounding box,
|
||||
// relative to the text position:
|
||||
MIRROR( begin.y, pos.y );
|
||||
MIRROR( end.y, pos.y );
|
||||
|
||||
transform = parentComponent->GetTransform();
|
||||
transform = parentSymbol->GetTransform();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -331,20 +330,20 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
|
|||
if( searchAndReplace && !replaceReferences )
|
||||
return false;
|
||||
|
||||
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
wxASSERT( aAuxData );
|
||||
|
||||
// Take sheet path into account which effects the reference field and the unit for
|
||||
// components with multiple parts.
|
||||
// symbols with multiple parts.
|
||||
if( aAuxData )
|
||||
{
|
||||
text = parentComponent->GetRef( (SCH_SHEET_PATH*) aAuxData );
|
||||
text = parentSymbol->GetRef((SCH_SHEET_PATH*) aAuxData );
|
||||
|
||||
if( SCH_ITEM::Matches( text, aSearchData ) )
|
||||
return true;
|
||||
|
||||
if( parentComponent->GetUnitCount() > 1 )
|
||||
text << LIB_PART::SubReference( parentComponent->GetUnit() );
|
||||
if( parentSymbol->GetUnitCount() > 1 )
|
||||
text << LIB_PART::SubReference( parentSymbol->GetUnit() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -356,11 +355,11 @@ bool SCH_FIELD::IsReplaceable() const
|
|||
{
|
||||
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
|
||||
if( m_id == VALUE_FIELD )
|
||||
{
|
||||
LIB_PART* part = parentComponent->GetPartRef().get();
|
||||
LIB_PART* part = parentSymbol->GetPartRef().get();
|
||||
|
||||
if( part && part->IsPower() )
|
||||
return false;
|
||||
|
@ -383,7 +382,7 @@ bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData )
|
|||
|
||||
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
|
||||
if( m_id == REFERENCE_FIELD )
|
||||
{
|
||||
|
@ -393,12 +392,12 @@ bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData )
|
|||
if( !( aSearchData.GetFlags() & FR_REPLACE_REFERENCES ) )
|
||||
return false;
|
||||
|
||||
wxString text = parentComponent->GetRef( (SCH_SHEET_PATH*) aAuxData );
|
||||
wxString text = parentSymbol->GetRef((SCH_SHEET_PATH*) aAuxData );
|
||||
|
||||
isReplaced = EDA_ITEM::Replace( aSearchData, text );
|
||||
|
||||
if( isReplaced )
|
||||
parentComponent->SetRef( (SCH_SHEET_PATH*) aAuxData, text );
|
||||
parentSymbol->SetRef((SCH_SHEET_PATH*) aAuxData, text );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -540,14 +539,14 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
|
|||
if( IsVoid() )
|
||||
return;
|
||||
|
||||
// Calculate the text orientation, according to the component orientation/mirror
|
||||
// Calculate the text orientation, according to the symbol orientation/mirror
|
||||
int orient = GetTextAngle();
|
||||
|
||||
if( m_parent && m_parent->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
SCH_COMPONENT* parentSymbol = static_cast<SCH_COMPONENT*>( m_parent );
|
||||
|
||||
if( parentComponent->GetTransform().y1 ) // Rotate component 90 deg.
|
||||
if( parentSymbol->GetTransform().y1 ) // Rotate symbol 90 deg.
|
||||
{
|
||||
if( orient == TEXT_ANGLE_HORIZ )
|
||||
orient = TEXT_ANGLE_VERT;
|
||||
|
@ -557,15 +556,14 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
|
|||
}
|
||||
|
||||
/*
|
||||
* Calculate the text justification, according to the component orientation/mirror
|
||||
* this is a bit complicated due to cumulative calculations:
|
||||
* Calculate the text justification, according to the symbol orientation/mirror.
|
||||
* This is a bit complicated due to cumulative calculations:
|
||||
* - numerous cases (mirrored or not, rotation)
|
||||
* - the DrawGraphicText function also recalculates H and H justifications according to the
|
||||
* text orientation.
|
||||
* - When a component is mirrored, the text is not mirrored and justifications are
|
||||
* complicated to calculate
|
||||
* so the easier way is to use no justifications (centered text) and use GetBoundaryBox to
|
||||
* know the text coordinate considered as centered
|
||||
* - the plotter's Text function will also recalculate H and V justifications according to
|
||||
* the text orientation.
|
||||
* - When a symbol is mirrored, the text is not mirrored and justifications are complicated
|
||||
* to calculate so the easier way is to use no justifications (centered text) and use
|
||||
* GetBoundingBox to know the text coordinate considered as centered
|
||||
*/
|
||||
EDA_RECT BoundaryBox = GetBoundingBox();
|
||||
EDA_TEXT_HJUSTIFY_T hjustify = GR_TEXT_HJUSTIFY_CENTER;
|
||||
|
|
|
@ -86,12 +86,12 @@ SCH_ITEM* SCH_ITEM::Duplicate( bool doClone ) const
|
|||
|
||||
if( newItem->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
SCH_COMPONENT* component = (SCH_COMPONENT*) newItem;
|
||||
SCH_COMPONENT* symbol = (SCH_COMPONENT*) newItem;
|
||||
|
||||
for( SCH_PIN* pin : component->GetPins() )
|
||||
for( SCH_PIN* pin : symbol->GetPins() )
|
||||
pin->ClearFlags( SELECTED | BRIGHTENED );
|
||||
|
||||
for( SCH_FIELD& field : component->GetFields() )
|
||||
for( SCH_FIELD& field : symbol->GetFields() )
|
||||
field.ClearFlags( SELECTED | BRIGHTENED );
|
||||
}
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ public:
|
|||
* @return true for items which are moved with the anchor point at mouse cursor
|
||||
* and false for items moved with no reference to anchor
|
||||
* Usually return true for small items (labels, junctions) and false for
|
||||
* items which can be large (hierarchical sheets, compoments)
|
||||
* items which can be large (hierarchical sheets, symbols)
|
||||
*/
|
||||
virtual bool IsMovableFromAnchorPoint() { return true; }
|
||||
|
||||
|
@ -254,7 +254,7 @@ public:
|
|||
* Searches the item hierarchy to find a SCHEMATIC
|
||||
*
|
||||
* Every SCH_ITEM that lives on a SCH_SCREEN should be parented to either that screen
|
||||
* or another SCH_ITEM on the same screen (for example, pins to their components).
|
||||
* or another SCH_ITEM on the same screen (for example, pins to their symbols).
|
||||
*
|
||||
* Every SCH_SCREEN should be parented to the SCHEMATIC.
|
||||
* Note that this hierarchy is not the same as the sheet hierarchy!
|
||||
|
@ -456,8 +456,7 @@ public:
|
|||
*
|
||||
* Fields that have been moved by hand are not automatically placed.
|
||||
*
|
||||
* @param aScreen is the SCH_SCREEN associated with the current instance of the
|
||||
* component.
|
||||
* @param aScreen is the SCH_SCREEN associated with the current instance of the symbol.
|
||||
*/
|
||||
void AutoAutoplaceFields( SCH_SCREEN* aScreen )
|
||||
{
|
||||
|
|
|
@ -120,7 +120,7 @@ EESCHEMA_SETTINGS* eeconfig()
|
|||
|
||||
/**
|
||||
* Used when a LIB_PART is not found in library to draw a dummy shape.
|
||||
* This component is a 400 mils square with the text "??"
|
||||
* This symbol is a 400 mils square with the text "??"
|
||||
*
|
||||
* DEF DUMMY U 0 40 Y Y 1 0 N
|
||||
* F0 "U" 0 -350 60 H V
|
||||
|
@ -1422,13 +1422,13 @@ static void orientPart( LIB_PART* part, int orientation )
|
|||
}
|
||||
|
||||
|
||||
void SCH_PAINTER::draw( SCH_COMPONENT *aComp, int aLayer )
|
||||
void SCH_PAINTER::draw( SCH_COMPONENT *aSymbol, int aLayer )
|
||||
{
|
||||
int unit = aComp->GetUnitSelection( &m_schematic->CurrentSheet() );
|
||||
int convert = aComp->GetConvert();
|
||||
int unit = aSymbol->GetUnitSelection( &m_schematic->CurrentSheet() );
|
||||
int convert = aSymbol->GetConvert();
|
||||
|
||||
// Use dummy part if the actual couldn't be found (or couldn't be locked).
|
||||
LIB_PART* originalPart = aComp->GetPartRef() ? aComp->GetPartRef().get() : dummy();
|
||||
LIB_PART* originalPart = aSymbol->GetPartRef() ? aSymbol->GetPartRef().get() : dummy();
|
||||
LIB_PINS originalPins;
|
||||
originalPart->GetPins( originalPins, unit, convert );
|
||||
|
||||
|
@ -1437,37 +1437,37 @@ void SCH_PAINTER::draw( SCH_COMPONENT *aComp, int aLayer )
|
|||
LIB_PINS tempPins;
|
||||
tempPart.GetPins( tempPins, unit, convert );
|
||||
|
||||
tempPart.SetFlags( aComp->GetFlags() );
|
||||
tempPart.SetFlags( aSymbol->GetFlags() );
|
||||
|
||||
orientPart( &tempPart, aComp->GetOrientation() );
|
||||
orientPart( &tempPart, aSymbol->GetOrientation() );
|
||||
|
||||
for( auto& tempItem : tempPart.GetDrawItems() )
|
||||
{
|
||||
tempItem.SetFlags( aComp->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
|
||||
tempItem.MoveTo( tempItem.GetPosition() + (wxPoint) mapCoords( aComp->GetPosition() ) );
|
||||
tempItem.SetFlags( aSymbol->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
|
||||
tempItem.MoveTo( tempItem.GetPosition() + (wxPoint) mapCoords( aSymbol->GetPosition() ) );
|
||||
}
|
||||
|
||||
// Copy the pin info from the component to the temp pins
|
||||
// Copy the pin info from the symbol to the temp pins
|
||||
for( unsigned i = 0; i < tempPins.size(); ++ i )
|
||||
{
|
||||
SCH_PIN* compPin = aComp->GetPin( originalPins[ i ] );
|
||||
SCH_PIN* symbolPin = aSymbol->GetPin( originalPins[ i ] );
|
||||
LIB_PIN* tempPin = tempPins[ i ];
|
||||
|
||||
tempPin->ClearFlags();
|
||||
tempPin->SetFlags( compPin->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
|
||||
tempPin->SetFlags( symbolPin->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
|
||||
|
||||
tempPin->SetName( compPin->GetName() );
|
||||
tempPin->SetType( compPin->GetType() );
|
||||
tempPin->SetShape( compPin->GetShape() );
|
||||
tempPin->SetName( symbolPin->GetName() );
|
||||
tempPin->SetType( symbolPin->GetType() );
|
||||
tempPin->SetShape( symbolPin->GetShape() );
|
||||
|
||||
if( compPin->IsDangling() )
|
||||
if( symbolPin->IsDangling() )
|
||||
tempPin->SetFlags( IS_DANGLING );
|
||||
}
|
||||
|
||||
draw( &tempPart, aLayer, false, aComp->GetUnit(), aComp->GetConvert() );
|
||||
draw( &tempPart, aLayer, false, aSymbol->GetUnit(), aSymbol->GetConvert() );
|
||||
|
||||
// The fields are SCH_COMPONENT-specific so don't need to be copied/oriented/translated
|
||||
for( SCH_FIELD& field : aComp->GetFields() )
|
||||
for( SCH_FIELD& field : aSymbol->GetFields() )
|
||||
draw( &field, aLayer );
|
||||
}
|
||||
|
||||
|
@ -1507,7 +1507,7 @@ void SCH_PAINTER::draw( SCH_FIELD *aField, int aLayer )
|
|||
{
|
||||
if( static_cast<SCH_COMPONENT*>( aField->GetParent() )->GetTransform().y1 )
|
||||
{
|
||||
// Rotate component 90 degrees.
|
||||
// Rotate symbol 90 degrees.
|
||||
if( orient == TEXT_ANGLE_HORIZ )
|
||||
orient = TEXT_ANGLE_VERT;
|
||||
else
|
||||
|
@ -1515,15 +1515,15 @@ void SCH_PAINTER::draw( SCH_FIELD *aField, int aLayer )
|
|||
}
|
||||
}
|
||||
|
||||
/* Calculate the text justification, according to the component orientation/mirror.
|
||||
/*
|
||||
* Calculate the text justification, according to the symbol orientation/mirror.
|
||||
* This is a bit complicated due to cumulative calculations:
|
||||
* - numerous cases (mirrored or not, rotation)
|
||||
* - the DrawGraphicText function recalculate also H and H justifications according to the
|
||||
* text orientation.
|
||||
* - When a component is mirrored, the text is not mirrored and justifications are
|
||||
* complicated to calculate
|
||||
* so the easier way is to use no justifications (centered text) and use GetBoundingBox
|
||||
* to know the text coordinate considered as centered
|
||||
* - when symbol is mirrored, the text is not mirrored and justifications are complicated
|
||||
* to calculate so the easier way is to use no justifications (centered text) and use
|
||||
* GetBoundingBox to know the text coordinate considered as centered
|
||||
*/
|
||||
EDA_RECT boundaryBox = aField->GetBoundingBox();
|
||||
wxPoint textpos = boundaryBox.Centre();
|
||||
|
|
|
@ -165,7 +165,7 @@ private:
|
|||
void draw( LIB_FIELD* aField, int aLayer );
|
||||
void draw( LIB_TEXT* aText, int aLayer );
|
||||
void draw( LIB_BEZIER* aCurve, int aLayer );
|
||||
void draw( SCH_COMPONENT* aComp, int aLayer );
|
||||
void draw( SCH_COMPONENT* aSymbol, int aLayer );
|
||||
void draw( SCH_JUNCTION* aJct, int aLayer );
|
||||
void draw( SCH_FIELD* aField, int aLayer );
|
||||
void draw( SCH_TEXT* aText, int aLayer );
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
#include <sch_edit_frame.h>
|
||||
|
||||
|
||||
SCH_PIN::SCH_PIN( LIB_PIN* aLibPin, SCH_COMPONENT* aParentComponent ) :
|
||||
SCH_ITEM( aParentComponent, SCH_PIN_T )
|
||||
SCH_PIN::SCH_PIN( LIB_PIN* aLibPin, SCH_COMPONENT* aParentSymbol ) :
|
||||
SCH_ITEM( aParentSymbol, SCH_PIN_T )
|
||||
{
|
||||
m_alt = wxEmptyString;
|
||||
m_number = aLibPin->GetNumber();
|
||||
|
@ -41,9 +41,8 @@ SCH_PIN::SCH_PIN( LIB_PIN* aLibPin, SCH_COMPONENT* aParentComponent ) :
|
|||
* 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).
|
||||
*/
|
||||
SCH_PIN::SCH_PIN( SCH_COMPONENT* aParentComponent, const wxString& aNumber,
|
||||
const wxString& aAlt ) :
|
||||
SCH_ITEM( aParentComponent, SCH_PIN_T )
|
||||
SCH_PIN::SCH_PIN( SCH_COMPONENT* aParentSymbol, const wxString& aNumber, const wxString& aAlt ) :
|
||||
SCH_ITEM( aParentSymbol, SCH_PIN_T )
|
||||
{
|
||||
m_alt = aAlt;
|
||||
m_number = aNumber;
|
||||
|
@ -248,7 +247,7 @@ wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH& aPath )
|
|||
|
||||
bool annotated = true;
|
||||
|
||||
// Add timestamp for uninitialized components
|
||||
// Add timestamp for uninitialized symbols
|
||||
if( name.Last() == '?' )
|
||||
{
|
||||
name << GetParentSymbol()->m_Uuid.AsString();
|
||||
|
|
|
@ -46,9 +46,9 @@ class SCH_PIN : public SCH_ITEM
|
|||
std::map<const SCH_SHEET_PATH, wxString> m_net_name_map;
|
||||
|
||||
public:
|
||||
SCH_PIN( LIB_PIN* aLibPin, SCH_COMPONENT* aParentComponent );
|
||||
SCH_PIN( LIB_PIN* aLibPin, SCH_COMPONENT* aParentSymbol );
|
||||
|
||||
SCH_PIN( SCH_COMPONENT* aParentComponent, const wxString& aNumber, const wxString& aAlt );
|
||||
SCH_PIN( SCH_COMPONENT* aParentSymbol, const wxString& aNumber, const wxString& aAlt );
|
||||
|
||||
SCH_PIN( const SCH_PIN& aPin );
|
||||
|
||||
|
|
|
@ -1878,7 +1878,7 @@ void SCH_SEXPR_PARSER::parseSchSymbolInstances( SCH_SCREEN* aScreen )
|
|||
{
|
||||
NeedSYMBOL();
|
||||
|
||||
COMPONENT_INSTANCE_REFERENCE instance;
|
||||
SYMBOL_INSTANCE_REFERENCE instance;
|
||||
|
||||
instance.m_Path = KIID_PATH( FromUTF8() );
|
||||
|
||||
|
|
|
@ -768,7 +768,7 @@ void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
|
|||
m_out->Print( 0, "\n" );
|
||||
m_out->Print( 1, "(symbol_instances\n" );
|
||||
|
||||
for( const COMPONENT_INSTANCE_REFERENCE& instance : screen->m_symbolInstances )
|
||||
for( const SYMBOL_INSTANCE_REFERENCE& instance : screen->m_symbolInstances )
|
||||
{
|
||||
m_out->Print( 2, "(path %s (reference %s) (unit %d))\n",
|
||||
m_out->Quotew( instance.m_Path.AsString() ).c_str(),
|
||||
|
|
|
@ -1997,7 +1997,7 @@ void SCH_LEGACY_PLUGIN::saveComponent( SCH_COMPONENT* aComponent )
|
|||
// This is redundant with the AR entries below, but it makes the files backwards-compatible.
|
||||
if( aComponent->GetInstanceReferences().size() > 0 )
|
||||
{
|
||||
const COMPONENT_INSTANCE_REFERENCE& instance = aComponent->GetInstanceReferences()[0];
|
||||
const SYMBOL_INSTANCE_REFERENCE& instance = aComponent->GetInstanceReferences()[0];
|
||||
name1 = toUTFTildaText( instance.m_Reference );
|
||||
}
|
||||
else
|
||||
|
@ -2040,7 +2040,7 @@ void SCH_LEGACY_PLUGIN::saveComponent( SCH_COMPONENT* aComponent )
|
|||
*/
|
||||
if( aComponent->GetInstanceReferences().size() > 1 )
|
||||
{
|
||||
for( const COMPONENT_INSTANCE_REFERENCE& instance : aComponent->GetInstanceReferences() )
|
||||
for( const SYMBOL_INSTANCE_REFERENCE& instance : aComponent->GetInstanceReferences() )
|
||||
{
|
||||
/*format:
|
||||
* AR Path="/140/2" Ref="C99" Part="1"
|
||||
|
|
|
@ -176,7 +176,7 @@ public:
|
|||
*
|
||||
* for( auto item : rtree.OfType( SCH_COMPONENT_T ) )
|
||||
*
|
||||
* and iterate over the RTree items that are components only
|
||||
* and iterate over the RTree items that are symbols only
|
||||
*/
|
||||
struct EE_TYPE
|
||||
{
|
||||
|
|
|
@ -836,36 +836,36 @@ void SCH_SCREEN::ClearDrawingState()
|
|||
}
|
||||
|
||||
|
||||
LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponent,
|
||||
LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aSymbol,
|
||||
bool aEndPointOnly )
|
||||
{
|
||||
SCH_COMPONENT* component = NULL;
|
||||
SCH_COMPONENT* candidate = NULL;
|
||||
LIB_PIN* pin = NULL;
|
||||
|
||||
for( SCH_ITEM* item : Items().Overlapping( SCH_COMPONENT_T, aPosition ) )
|
||||
{
|
||||
component = static_cast<SCH_COMPONENT*>( item );
|
||||
candidate = static_cast<SCH_COMPONENT*>( item );
|
||||
|
||||
if( aEndPointOnly )
|
||||
{
|
||||
pin = NULL;
|
||||
|
||||
if( !component->GetPartRef() )
|
||||
if( !candidate->GetPartRef() )
|
||||
continue;
|
||||
|
||||
for( pin = component->GetPartRef()->GetNextPin(); pin;
|
||||
pin = component->GetPartRef()->GetNextPin( pin ) )
|
||||
for( pin = candidate->GetPartRef()->GetNextPin(); pin;
|
||||
pin = candidate->GetPartRef()->GetNextPin( pin ) )
|
||||
{
|
||||
// Skip items not used for this part.
|
||||
if( component->GetUnit() && pin->GetUnit() &&
|
||||
( pin->GetUnit() != component->GetUnit() ) )
|
||||
if( candidate->GetUnit() && pin->GetUnit() &&
|
||||
( pin->GetUnit() != candidate->GetUnit() ) )
|
||||
continue;
|
||||
|
||||
if( component->GetConvert() && pin->GetConvert() &&
|
||||
( pin->GetConvert() != component->GetConvert() ) )
|
||||
if( candidate->GetConvert() && pin->GetConvert() &&
|
||||
( pin->GetConvert() != candidate->GetConvert() ) )
|
||||
continue;
|
||||
|
||||
if(component->GetPinPhysicalPosition( pin ) == aPosition )
|
||||
if( candidate->GetPinPhysicalPosition( pin ) == aPosition )
|
||||
break;
|
||||
}
|
||||
if( pin )
|
||||
|
@ -873,15 +873,15 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aComponen
|
|||
}
|
||||
else
|
||||
{
|
||||
pin = (LIB_PIN*) component->GetDrawItem( aPosition, LIB_PIN_T );
|
||||
pin = (LIB_PIN*) candidate->GetDrawItem( aPosition, LIB_PIN_T );
|
||||
|
||||
if( pin )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( pin && aComponent )
|
||||
*aComponent = component;
|
||||
if( pin && aSymbol )
|
||||
*aSymbol = candidate;
|
||||
|
||||
return pin;
|
||||
}
|
||||
|
@ -924,9 +924,9 @@ void SCH_SCREEN::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
|
|||
|
||||
for( SCH_ITEM* item : Items().OfType( SCH_COMPONENT_T ) )
|
||||
{
|
||||
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
|
||||
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
|
||||
|
||||
component->ClearAnnotation( aSheetPath );
|
||||
symbol->ClearAnnotation( aSheetPath );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -938,11 +938,11 @@ void SCH_SCREEN::EnsureAlternateReferencesExist()
|
|||
|
||||
for( SCH_ITEM* item : Items().OfType( SCH_COMPONENT_T ) )
|
||||
{
|
||||
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
|
||||
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
|
||||
|
||||
// Add (when not existing) all sheet path entries
|
||||
for( const SCH_SHEET_PATH& sheet : GetClientSheetPaths() )
|
||||
component->AddSheetPathReferenceEntryIfMissing( sheet.Path() );
|
||||
symbol->AddSheetPathReferenceEntryIfMissing( sheet.Path() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1206,8 +1206,7 @@ void SCH_SCREENS::ClearAnnotationOfNewSheetPaths( SCH_SHEET_LIST& aInitialSheetP
|
|||
|
||||
wxCHECK_RET( sch, "Null schematic in SCH_SCREENS::ClearAnnotationOfNewSheetPaths" );
|
||||
|
||||
// Clear the annotation for the components inside new sheetpaths
|
||||
// not already in aInitialSheetList
|
||||
// Clear the annotation for symbols inside new sheetpaths not already in aInitialSheetList
|
||||
SCH_SCREENS screensList( sch->Root() ); // The list of screens, shared by sheet paths
|
||||
screensList.BuildClientSheetPathList(); // build the shared by sheet paths, by screen
|
||||
|
||||
|
@ -1392,7 +1391,7 @@ bool SCH_SCREENS::HasNoFullyDefinedLibIds()
|
|||
for( auto item : screen->Items().OfType( SCH_COMPONENT_T ) )
|
||||
{
|
||||
cnt++;
|
||||
auto symbol = static_cast<SCH_COMPONENT*>( item );
|
||||
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
|
||||
|
||||
if( !symbol->GetLibId().GetLibNickname().empty() )
|
||||
return false;
|
||||
|
@ -1409,8 +1408,8 @@ size_t SCH_SCREENS::GetLibNicknames( wxArrayString& aLibNicknames )
|
|||
{
|
||||
for( auto item : screen->Items().OfType( SCH_COMPONENT_T ) )
|
||||
{
|
||||
auto symbol = static_cast<SCH_COMPONENT*>( item );
|
||||
auto& nickname = symbol->GetLibId().GetLibNickname();
|
||||
SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
|
||||
const UTF8& nickname = symbol->GetLibId().GetLibNickname();
|
||||
|
||||
if( !nickname.empty() && ( aLibNicknames.Index( nickname ) == wxNOT_FOUND ) )
|
||||
aLibNicknames.Add( nickname );
|
||||
|
|
|
@ -136,7 +136,7 @@ private:
|
|||
* schematic file is loaded. It is read only and it is only written to non-root
|
||||
* schematic files.
|
||||
*/
|
||||
std::vector<COMPONENT_INSTANCE_REFERENCE> m_symbolInstances;
|
||||
std::vector<SYMBOL_INSTANCE_REFERENCE> m_symbolInstances;
|
||||
std::vector<SCH_SHEET_INSTANCE> m_sheetInstances;
|
||||
|
||||
friend SCH_EDIT_FRAME; // Only to populate m_symbolInstances.
|
||||
|
@ -369,12 +369,12 @@ public:
|
|||
* Test the screen for a component pin item at \a aPosition.
|
||||
*
|
||||
* @param aPosition Position to test.
|
||||
* @param aComponent The component if a pin was found, otherwise NULL.
|
||||
* @param aSymbol The component 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** aComponent = NULL,
|
||||
LIB_PIN* GetPin( const wxPoint& aPosition, SCH_COMPONENT** aSymbol = NULL,
|
||||
bool aEndPointOnly = false );
|
||||
|
||||
/**
|
||||
|
@ -493,7 +493,7 @@ public:
|
|||
return m_aliases;
|
||||
}
|
||||
|
||||
const std::vector<COMPONENT_INSTANCE_REFERENCE>& GetSymbolInstances() const
|
||||
const std::vector<SYMBOL_INSTANCE_REFERENCE>& GetSymbolInstances() const
|
||||
{
|
||||
return m_symbolInstances;
|
||||
}
|
||||
|
|
|
@ -605,7 +605,7 @@ wxPoint SCH_SHEET::GetRotationCenter() const
|
|||
}
|
||||
|
||||
|
||||
int SCH_SHEET::ComponentCount() const
|
||||
int SCH_SHEET::SymbolCount() const
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
|
@ -613,14 +613,14 @@ int SCH_SHEET::ComponentCount() const
|
|||
{
|
||||
for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_COMPONENT_T ) )
|
||||
{
|
||||
SCH_COMPONENT* comp = (SCH_COMPONENT*) aItem;
|
||||
SCH_COMPONENT* symbol = (SCH_COMPONENT*) aItem;
|
||||
|
||||
if( comp->GetField( VALUE_FIELD )->GetText().GetChar( 0 ) != '#' )
|
||||
if( symbol->GetField( VALUE_FIELD )->GetText().GetChar( 0 ) != '#' )
|
||||
n++;
|
||||
}
|
||||
|
||||
for( SCH_ITEM* aItem : m_screen->Items().OfType( SCH_SHEET_T ) )
|
||||
n += static_cast<const SCH_SHEET*>( aItem )->ComponentCount();
|
||||
n += static_cast<const SCH_SHEET*>( aItem )->SymbolCount();
|
||||
}
|
||||
|
||||
return n;
|
||||
|
|
|
@ -460,7 +460,7 @@ public:
|
|||
*
|
||||
* @return the component count.
|
||||
*/
|
||||
int ComponentCount() const;
|
||||
int SymbolCount() const;
|
||||
|
||||
/**
|
||||
* Search the existing hierarchy for an instance of screen loaded from \a aFileName.
|
||||
|
|
|
@ -774,7 +774,7 @@ SCH_SHEET_PATH* SCH_SHEET_LIST::FindSheetForScreen( SCH_SCREEN* aScreen )
|
|||
|
||||
|
||||
void SCH_SHEET_LIST::UpdateSymbolInstances(
|
||||
const std::vector<COMPONENT_INSTANCE_REFERENCE>& aSymbolInstances )
|
||||
const std::vector<SYMBOL_INSTANCE_REFERENCE>& aSymbolInstances )
|
||||
{
|
||||
SCH_REFERENCE_LIST symbolInstances;
|
||||
|
||||
|
@ -800,7 +800,7 @@ void SCH_SHEET_LIST::UpdateSymbolInstances(
|
|||
wxString path = symbolInstances[i].GetPath();
|
||||
|
||||
auto it = std::find_if( aSymbolInstances.begin(), aSymbolInstances.end(),
|
||||
[ path, &getName ]( const COMPONENT_INSTANCE_REFERENCE& r ) -> bool
|
||||
[ path, &getName ]( const SYMBOL_INSTANCE_REFERENCE& r ) -> bool
|
||||
{
|
||||
return path == getName( r.m_Path );
|
||||
} );
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
/**
|
||||
* A simple container for schematic symbol instance infromation.
|
||||
*/
|
||||
struct COMPONENT_INSTANCE_REFERENCE
|
||||
struct SYMBOL_INSTANCE_REFERENCE
|
||||
{
|
||||
KIID_PATH m_Path;
|
||||
|
||||
|
@ -68,45 +68,38 @@ struct SCH_SHEET_INSTANCE
|
|||
/**
|
||||
* Complex hierarchies
|
||||
*
|
||||
* A hierarchical schematic uses sheets (hierarchical sheets) included in a
|
||||
* given sheet. Each sheet corresponds to a schematic drawing handled by a
|
||||
* SCH_SCREEN structure. A SCH_SCREEN structure contains drawings, and have
|
||||
* a filename to write it's data. Also a SCH_SCREEN display a sheet number
|
||||
* and the name of the sheet.
|
||||
* A hierarchical schematic uses sheets (hierarchical sheets) included in a given sheet.
|
||||
* Each sheet corresponds to a schematic drawing handled by a SCH_SCREEN structure. A
|
||||
* SCH_SCREEN structure contains drawings, and have a filename to write it's data. Also a
|
||||
* SCH_SCREEN displays a sheet number and the name of the sheet.
|
||||
*
|
||||
* In simple (and flat) hierarchies a sheet is linked to a SCH_SCREEN,
|
||||
* and a SCH_SCREEN is used by only one hierarchical sheet.
|
||||
* In simple (and flat) hierarchies a sheet is linked to a SCH_SCREEN, and a SCH_SCREEN is
|
||||
* used by the single hierarchical sheet.
|
||||
*
|
||||
* In complex hierarchies the same SCH_SCREEN (and its data) is shared between
|
||||
* more than one sheet. Therefore subsheets (like subsheets in a SCH_SCREEN
|
||||
* shared by many sheets) can be also shared. So the same SCH_SCREEN must
|
||||
* handle different components references and parts selection depending on
|
||||
* which sheet is currently selected, and how a given subsheet is selected.
|
||||
* 2 sheets share the same SCH_SCREEN (the same drawings) if they have the
|
||||
* same filename.
|
||||
* In complex hierarchies the same SCH_SCREEN (and its data) is shared by more than one sheet.
|
||||
* Therefore subsheets (like subsheets in a SCH_SCREEN shared by many sheets) can also be
|
||||
* shared. So the same SCH_SCREEN must handle different symbol references and unit selections
|
||||
* depending on which sheet is currently selected, and how a given subsheet is selected. Two
|
||||
* sheets share the same SCH_SCREEN (the same drawings) if they have the same filename.
|
||||
*
|
||||
* In KiCad each component and sheet receives (when created) an unique
|
||||
* identification called Time Stamp. So each sheet has 2 ids: its time stamp
|
||||
* (that cannot change) and its name ( that can be edited and therefore is
|
||||
* not reliable for strong identification). KiCad uses Time Stamp ( a unique
|
||||
* 32 bit id), to identify sheets in hierarchies.
|
||||
* A given sheet in a hierarchy is fully labeled by its path (or sheet path)
|
||||
* that is the list of time stamp found to access it through the hierarchy
|
||||
* the root sheet is /. All other sheets have a path like /1234ABCD or
|
||||
* /4567FEDC/AA2233DD/. This path can be displayed as human readable sheet
|
||||
* name like: / or /sheet1/include_sheet/ or /sheet2/include_sheet/
|
||||
* In KiCad each symbol and sheet receives (when created) a uuid. So each sheet has 2 id: its
|
||||
* uuid (which cannot change) and its name (that can be edited and therefore is not reliable
|
||||
* for strong identification).
|
||||
* A given sheet in a hierarchy is fully labeled by its path (or sheet path) that is the list
|
||||
* of uuids found to access it through the hierarchy. The root sheet is /. All other sheets
|
||||
* have a path like /1234ABCD or /4567FEDC/AA2233DD/. This path can be displayed as human
|
||||
* readable sheet name like: / or /sheet1/include_sheet/ or /sheet2/include_sheet/
|
||||
*
|
||||
* So to know for a given SCH_SCREEN (a given schematic drawings) we must:
|
||||
* 1) Handle all references possibilities.
|
||||
* 2) When acceded by a given selected sheet, display (update) the
|
||||
* corresponding references and sheet path
|
||||
*
|
||||
* The class SCH_SHEET_PATH handles paths used to access a sheet. The class
|
||||
* SCH_SHEET_LIST allows one to handle the full (or partial) list of sheets and
|
||||
* their paths in a complex hierarchy. The class EDA_ScreenList allows one
|
||||
* to handle the list of SCH_SCREEN. It is useful to clear or save data,
|
||||
* but is not suitable to handle the full complex hierarchy possibilities
|
||||
* (usable in flat and simple hierarchies).
|
||||
* The class SCH_SHEET_PATH handles paths used to access a sheet. The class SCH_SHEET_LIST
|
||||
* allows one to handle the full (or partial) list of sheets and their paths in a complex
|
||||
* hierarchy. The class EDA_ScreenList allows one to handle the list of SCH_SCREEN. It is
|
||||
* useful to clear or save data, but is not suitable to handle the full complex hierarchy
|
||||
* possibilities (usable in flat and simple hierarchies).
|
||||
*/
|
||||
|
||||
|
||||
|
@ -457,7 +450,7 @@ public:
|
|||
* WARNING: Do not call this on anything other than the full hierarchy.
|
||||
* @param aSymbolInstances is the symbol path information loaded from the root schematic.
|
||||
*/
|
||||
void UpdateSymbolInstances( const std::vector<COMPONENT_INSTANCE_REFERENCE>& aSymbolInstances );
|
||||
void UpdateSymbolInstances( const std::vector<SYMBOL_INSTANCE_REFERENCE>& aSymbolInstances );
|
||||
|
||||
/**
|
||||
* Update all of the sheet instance information using \a aSheetInstances.
|
||||
|
|
|
@ -425,10 +425,17 @@ public:
|
|||
wxPoint GetIrefSavedPosition() { return m_savedIrefPos; }
|
||||
void SetIrefSavedPosition( wxPoint pos ) { m_savedIrefPos = pos; }
|
||||
|
||||
bool IsPointClickableAnchor( const wxPoint& aPos ) const override { return m_isDangling && GetPosition() == aPos; }
|
||||
bool IsPointClickableAnchor( const wxPoint& aPos ) const override
|
||||
{
|
||||
return m_isDangling && GetPosition() == aPos;
|
||||
}
|
||||
|
||||
private:
|
||||
bool doIsConnected( const wxPoint& aPosition ) const override { return EDA_TEXT::GetTextPos() == aPosition; }
|
||||
bool doIsConnected( const wxPoint& aPosition ) const override
|
||||
{
|
||||
return EDA_TEXT::GetTextPos() == aPosition;
|
||||
}
|
||||
|
||||
SCH_IREF* m_iref;
|
||||
wxPoint m_savedIrefPos;
|
||||
};
|
||||
|
|
|
@ -105,11 +105,10 @@ public:
|
|||
case S_SEGMENT:
|
||||
case S_ARC:
|
||||
case S_CURVE:
|
||||
case S_LAST: // Make CLang compiler happy
|
||||
return false;
|
||||
|
||||
case S_LAST: // Sentinel
|
||||
break;
|
||||
case S_LAST: // Make CLang compiler happy
|
||||
return false;
|
||||
}
|
||||
|
||||
return false; // Make GCC compiler happy
|
||||
|
|
|
@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE( Default )
|
|||
|
||||
BOOST_CHECK_EQUAL( m_csheet.GetScreenCount(), 0 );
|
||||
|
||||
BOOST_CHECK_EQUAL( m_sheet.ComponentCount(), 0 );
|
||||
BOOST_CHECK_EQUAL( m_sheet.SymbolCount(), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue