7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

Highlight buses containing net

This closes the tech-debt issue that we did not highlight buses when
their sub nets were highlighted, preventing accurate tracking

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18419
This commit is contained in:
Seth Hillbrand 2024-12-11 13:59:11 -08:00
parent f275509e86
commit b8a141893b
2 changed files with 22 additions and 0 deletions

View File

@ -202,6 +202,12 @@ public:
return m_sheet;
}
const std::unordered_map< std::shared_ptr<SCH_CONNECTION>,
std::unordered_set<CONNECTION_SUBGRAPH*> >& GetBusParents() const
{
return m_bus_parents;
}
void RemoveItem( SCH_ITEM* aItem );
/**

View File

@ -1102,6 +1102,22 @@ int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent )
}
}
}
// Highlight the buses that contain the selected net
for( const auto& [_, bus_sgs] : sg->GetBusParents() )
{
for( const CONNECTION_SUBGRAPH* bus_sg : bus_sgs )
{
for( const SCH_ITEM* item : bus_sg->GetItems() )
{
if( !item || !item->IsType( { SCH_ITEM_LOCATE_BUS_T } ) )
continue;
if( SCH_CONNECTION* connection = item->Connection() )
connNames.emplace( connection->Name() );
}
}
}
}
for( SCH_ITEM* item : screen->Items() )