From e067d44dd414e09e2bccc1f9ff96df8d18d78f64 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 27 Apr 2025 23:43:14 +0100 Subject: [PATCH] Fixes for SCH_GROUPs. --- eeschema/sch_group.cpp | 4 ++-- eeschema/tools/sch_line_wire_bus_tool.cpp | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/eeschema/sch_group.cpp b/eeschema/sch_group.cpp index 0a27d2d136..eba9582131 100644 --- a/eeschema/sch_group.cpp +++ b/eeschema/sch_group.cpp @@ -427,8 +427,8 @@ void SCH_GROUP::RunOnChildren( const std::function& aFunction { aFunction( static_cast( item ) ); - if( item->Type() == SCH_GROUP_T ) - static_cast( item )->RunOnChildren( aFunction, RECURSE_MODE::RECURSE ); + if( item->Type() == SCH_GROUP_T && aMode == RECURSE_MODE::RECURSE ) + static_cast( item )->RunOnChildren( aFunction, RECURSE_MODE::RECURSE ); } } catch( std::bad_function_call& ) diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp index 82f8c753ca..0baeacb78a 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -1321,9 +1322,24 @@ int SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires( SCH_COMMIT* aCommit, SCH_SELEC int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( SCH_COMMIT* aCommit, SCH_SELECTION* aSelection ) { - SCH_SCREEN* screen = m_frame->GetScreen(); + SCH_SCREEN* screen = m_frame->GetScreen(); + std::deque allItems; - for( const VECTOR2I& point : screen->GetNeededJunctions( aSelection->Items() ) ) + for( EDA_ITEM* item : aSelection->Items() ) + { + allItems.push_back( item ); + + if( item->Type() == SCH_GROUP_T ) + { + static_cast( item )->RunOnChildren( + [&]( SCH_ITEM* child ) + { + allItems.push_back( child ); + }, RECURSE_MODE::RECURSE ); + } + } + + for( const VECTOR2I& point : screen->GetNeededJunctions( allItems ) ) m_frame->AddJunction( aCommit, m_frame->GetScreen(), point ); return 0;