From e9eacbc91c50ee194e61b8aaa18e7f5ea59f19e4 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 5 May 2019 19:09:05 -0400 Subject: [PATCH] Ensure subgraphs with multiple labels get sorted --- eeschema/connection_graph.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index b40e3b148b..eda85f0661 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -110,22 +110,6 @@ bool CONNECTION_SUBGRAPH::ResolveDrivers( bool aCreateMarkers ) { if( candidates.size() > 1 ) { - if( highest_priority == 1 || highest_priority == 5 ) - { - // We have multiple options and they are all component pins. - std::sort( candidates.begin(), candidates.end(), - [this]( SCH_ITEM* a, SCH_ITEM* b) -> bool - { - auto pin_a = static_cast( a ); - auto pin_b = static_cast( b ); - - auto name_a = pin_a->GetDefaultNetName( m_sheet ); - auto name_b = pin_b->GetDefaultNetName( m_sheet ); - - return name_a < name_b; - } ); - } - if( highest_priority == 2 ) { // We have multiple options, and they are all hierarchical @@ -142,6 +126,15 @@ bool CONNECTION_SUBGRAPH::ResolveDrivers( bool aCreateMarkers ) } } } + else + { + // For all other driver types, sort by name + std::sort( candidates.begin(), candidates.end(), + [&] ( SCH_ITEM* a, SCH_ITEM* b) -> bool + { + return GetNameForDriver( a ) < GetNameForDriver( b ); + } ); + } } if( !m_driver )