Implement expanding Select Connection.
Fixes https://gitlab.com/kicad/code/kicad/issues/8579
This commit is contained in:
parent
155620cc9a
commit
d5d8d36d86
|
@ -355,7 +355,7 @@ SCH_ITEM* SCH_SCREEN::GetItem( const VECTOR2I& aPosition, int aAccuracy, KICAD_T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::set<SCH_ITEM*> SCH_SCREEN::MarkConnections( SCH_LINE* aSegment )
|
std::set<SCH_ITEM*> SCH_SCREEN::MarkConnections( SCH_LINE* aSegment, bool aIgnorePins )
|
||||||
{
|
{
|
||||||
std::set<SCH_ITEM*> retval;
|
std::set<SCH_ITEM*> retval;
|
||||||
std::stack<SCH_LINE*> to_search;
|
std::stack<SCH_LINE*> to_search;
|
||||||
|
@ -384,9 +384,9 @@ std::set<SCH_ITEM*> SCH_SCREEN::MarkConnections( SCH_LINE* aSegment )
|
||||||
SCH_LINE* line = static_cast<SCH_LINE*>( item );
|
SCH_LINE* line = static_cast<SCH_LINE*>( item );
|
||||||
|
|
||||||
if( ( test_item->IsEndPoint( line->GetStartPoint() )
|
if( ( test_item->IsEndPoint( line->GetStartPoint() )
|
||||||
&& !GetPin( line->GetStartPoint(), nullptr, true ) )
|
&& ( aIgnorePins || !GetPin( line->GetStartPoint(), nullptr, true ) ) )
|
||||||
|| ( test_item->IsEndPoint( line->GetEndPoint() )
|
|| ( test_item->IsEndPoint( line->GetEndPoint() )
|
||||||
&& !GetPin( line->GetEndPoint(), nullptr, true ) ) )
|
&& ( aIgnorePins || !GetPin( line->GetEndPoint(), nullptr, true ) ) ) )
|
||||||
{
|
{
|
||||||
auto result = retval.insert( line );
|
auto result = retval.insert( line );
|
||||||
|
|
||||||
|
|
|
@ -301,7 +301,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param aSegment The segment to test for connections.
|
* @param aSegment The segment to test for connections.
|
||||||
*/
|
*/
|
||||||
std::set<SCH_ITEM*> MarkConnections( SCH_LINE* aSegment );
|
std::set<SCH_ITEM*> MarkConnections( SCH_LINE* aSegment, bool aIgnorePins );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the state flags of all the items in the screen.
|
* Clear the state flags of all the items in the screen.
|
||||||
|
|
|
@ -1430,12 +1430,26 @@ int EE_SELECTION_TOOL::SelectConnection( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
SCH_LINE* line = (SCH_LINE*) m_selection.Front();
|
SCH_LINE* line = (SCH_LINE*) m_selection.Front();
|
||||||
EDA_ITEMS items;
|
EDA_ITEMS items;
|
||||||
|
unsigned done = false;
|
||||||
|
|
||||||
m_frame->GetScreen()->ClearDrawingState();
|
m_frame->GetScreen()->ClearDrawingState();
|
||||||
std::set<SCH_ITEM*> conns = m_frame->GetScreen()->MarkConnections( line );
|
std::set<SCH_ITEM*> conns = m_frame->GetScreen()->MarkConnections( line, false );
|
||||||
|
|
||||||
|
for( SCH_ITEM* item : conns )
|
||||||
|
{
|
||||||
|
if( item->IsType( wiresAndBuses ) && !item->IsSelected() )
|
||||||
|
done = true;
|
||||||
|
|
||||||
|
select( item );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !done )
|
||||||
|
{
|
||||||
|
conns = m_frame->GetScreen()->MarkConnections( line, true );
|
||||||
|
|
||||||
for( SCH_ITEM* item : conns )
|
for( SCH_ITEM* item : conns )
|
||||||
select( item );
|
select( item );
|
||||||
|
}
|
||||||
|
|
||||||
if( m_selection.GetSize() > 1 )
|
if( m_selection.GetSize() > 1 )
|
||||||
m_toolMgr->ProcessEvent( EVENTS::SelectedEvent );
|
m_toolMgr->ProcessEvent( EVENTS::SelectedEvent );
|
||||||
|
|
Loading…
Reference in New Issue