From 77f74646af49897715bfdce041bccea52cdd8a65 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Mon, 5 Sep 2016 12:21:17 +0200 Subject: [PATCH] Auto update ratsnest data on net change --- pcbnew/class_board_connected_item.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pcbnew/class_board_connected_item.cpp b/pcbnew/class_board_connected_item.cpp index e996648b1b..b7162e7884 100644 --- a/pcbnew/class_board_connected_item.cpp +++ b/pcbnew/class_board_connected_item.cpp @@ -34,6 +34,8 @@ #include #include +#include + BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) : BOARD_ITEM( aParent, idtype ), m_netinfo( &NETINFO_LIST::ORPHANED_ITEM ), m_Subnet( 0 ), m_ZoneSubnet( 0 ) @@ -48,6 +50,11 @@ bool BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode, bool aNoAssert ) // set the m_netinfo to the dummy NETINFO_LIST::ORPHANED BOARD* board = GetBoard(); + RN_DATA* ratsnest = board ? board->GetRatsnest() : NULL; + bool addRatsnest = false; + + if( ratsnest ) + addRatsnest = ratsnest->Remove( this ); if( ( aNetCode >= 0 ) && board ) m_netinfo = board->FindNet( aNetCode ); @@ -57,6 +64,10 @@ bool BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode, bool aNoAssert ) if( !aNoAssert ) assert( m_netinfo ); + // Add only if it was previously added to the ratsnest + if( addRatsnest ) + ratsnest->Add( this ); + return ( m_netinfo != NULL ); }