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