diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index dae260a30b..968aa5bc38 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -305,10 +305,7 @@ void CONNECTION_SUBGRAPH::UpdateItemConnections() SCH_CONNECTION* item_conn = item->Connection( m_sheet ); if( !item_conn ) - { - item_conn = item->InitializeConnection( m_sheet ); - item_conn->SetGraph( m_graph ); - } + item_conn = item->InitializeConnection( m_sheet, m_graph ); if( ( m_driver_connection->IsBus() && item_conn->IsNet() ) || ( m_driver_connection->IsNet() && item_conn->IsBus() ) ) @@ -444,7 +441,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet, for( SCH_SHEET_PIN* pin : static_cast( item )->GetPins() ) { if( !pin->Connection( aSheet ) ) - pin->InitializeConnection( aSheet )->SetGraph( this ); + pin->InitializeConnection( aSheet, this ); pin->ConnectedItems( aSheet ).clear(); pin->Connection( aSheet )->Reset(); @@ -466,7 +463,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet, for( SCH_PIN* pin : component->GetSchPins( &aSheet ) ) { - pin->InitializeConnection( aSheet )->SetGraph( this ); + pin->InitializeConnection( aSheet, this ); wxPoint pos = pin->GetPosition(); @@ -486,8 +483,7 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet, else { m_items.insert( item ); - auto conn = item->InitializeConnection( aSheet ); - conn->SetGraph( this ); + auto conn = item->InitializeConnection( aSheet, this ); // Set bus/net property here so that the propagation code uses it switch( item->Type() ) @@ -688,10 +684,7 @@ void CONNECTION_GRAPH::buildConnectionGraph() auto* conn = aItem->Connection( sheet ); if( !conn ) - { - conn = aItem->InitializeConnection( sheet ); - conn->SetGraph( this ); - } + conn = aItem->InitializeConnection( sheet, this ); return ( conn->SubgraphCode() == 0 ); }; @@ -936,10 +929,7 @@ void CONNECTION_GRAPH::buildConnectionGraph() SCH_CONNECTION* connection = pin->Connection( sheet ); if( !connection ) - { - connection = pin->InitializeConnection( sheet ); - connection->SetGraph( this ); - } + connection = pin->InitializeConnection( sheet, this ); // If this pin already has a subgraph, don't need to process if( connection->SubgraphCode() > 0 ) diff --git a/eeschema/sch_connection.cpp b/eeschema/sch_connection.cpp index c72f6d5e26..add71ef2b6 100644 --- a/eeschema/sch_connection.cpp +++ b/eeschema/sch_connection.cpp @@ -167,6 +167,7 @@ void SCH_CONNECTION::ConfigureFromLabel( const wxString& aLabel ) { auto member = std::make_shared< SCH_CONNECTION >( m_parent, m_sheet ); member->SetPrefix( prefix ); + member->SetGraph( m_graph ); member->ConfigureFromLabel( alias_member ); m_members.push_back( member ); } @@ -175,6 +176,7 @@ void SCH_CONNECTION::ConfigureFromLabel( const wxString& aLabel ) { auto member = std::make_shared< SCH_CONNECTION >( m_parent, m_sheet ); member->SetPrefix( prefix ); + member->SetGraph( m_graph ); member->ConfigureFromLabel( group_member ); m_members.push_back( member ); } @@ -764,4 +766,4 @@ bool SCH_CONNECTION::IsMemberOfBus( SCH_CONNECTION* aOther ) const return true; return false; -} \ No newline at end of file +} diff --git a/eeschema/sch_item.cpp b/eeschema/sch_item.cpp index faed03bfd9..25e612cb4b 100644 --- a/eeschema/sch_item.cpp +++ b/eeschema/sch_item.cpp @@ -166,7 +166,8 @@ void SCH_ITEM::AddConnectionTo( const SCH_SHEET_PATH& aSheet, SCH_ITEM* aItem ) } -SCH_CONNECTION* SCH_ITEM::InitializeConnection( const SCH_SHEET_PATH& aSheet ) +SCH_CONNECTION* SCH_ITEM::InitializeConnection( const SCH_SHEET_PATH& aSheet, + CONNECTION_GRAPH* aGraph ) { if( Connection( aSheet ) ) { @@ -178,6 +179,8 @@ SCH_CONNECTION* SCH_ITEM::InitializeConnection( const SCH_SHEET_PATH& aSheet ) auto connection = new SCH_CONNECTION( this ); connection->SetSheet( aSheet ); m_connection_map.insert( std::make_pair( aSheet, connection ) ); + connection->SetGraph( aGraph ); + return connection; } diff --git a/eeschema/sch_item.h b/eeschema/sch_item.h index f88a6a7ac2..b1190b2518 100644 --- a/eeschema/sch_item.h +++ b/eeschema/sch_item.h @@ -38,6 +38,7 @@ #include #include +class CONNECTION_GRAPH; class SCH_CONNECTION; class SCH_SHEET_PATH; class SCHEMATIC; @@ -414,7 +415,7 @@ public: * * @param aPath is the sheet path to initialize */ - SCH_CONNECTION* InitializeConnection( const SCH_SHEET_PATH& aPath ); + SCH_CONNECTION* InitializeConnection( const SCH_SHEET_PATH& aPath, CONNECTION_GRAPH* aGraph ); /** * Returns true if this item should propagate connection info to aItem