Handle de-highlighting items outside selection when selection changes.
Also adds selection cleared event to handled events. And a small performance boost to not scan items for selection changes when find is not seleciton-based.
This commit is contained in:
parent
d9a77e6a64
commit
ddf8d115c4
|
@ -64,11 +64,9 @@ int SCH_FIND_REPLACE_TOOL::UpdateFind( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if( aEvent.IsAction( &ACTIONS::find ) || aEvent.IsAction( &ACTIONS::findAndReplace )
|
auto visitAll =
|
||||||
|| aEvent.IsAction( &ACTIONS::updateFind ) )
|
[&]()
|
||||||
{
|
{
|
||||||
m_foundItemHighlighted = false;
|
|
||||||
|
|
||||||
for( SCH_ITEM* item : m_frame->GetScreen()->Items() )
|
for( SCH_ITEM* item : m_frame->GetScreen()->Items() )
|
||||||
{
|
{
|
||||||
visit( item, &m_frame->GetCurrentSheet() );
|
visit( item, &m_frame->GetCurrentSheet() );
|
||||||
|
@ -79,35 +77,37 @@ int SCH_FIND_REPLACE_TOOL::UpdateFind( const TOOL_EVENT& aEvent )
|
||||||
visit( aChild, &m_frame->GetCurrentSheet() );
|
visit( aChild, &m_frame->GetCurrentSheet() );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if( aEvent.IsAction( &ACTIONS::find ) || aEvent.IsAction( &ACTIONS::findAndReplace )
|
||||||
|
|| aEvent.IsAction( &ACTIONS::updateFind ) )
|
||||||
|
{
|
||||||
|
m_foundItemHighlighted = false;
|
||||||
|
visitAll();
|
||||||
}
|
}
|
||||||
else if( aEvent.Matches( EVENTS::SelectedItemsModified )
|
else if( aEvent.Matches( EVENTS::SelectedItemsModified ) )
|
||||||
|| aEvent.Matches( EVENTS::PointSelectedEvent )
|
{
|
||||||
|
for( EDA_ITEM* item : m_selectionTool->GetSelection() )
|
||||||
|
visit( item, &m_frame->GetCurrentSheet() );
|
||||||
|
}
|
||||||
|
else if( aEvent.Matches( EVENTS::PointSelectedEvent )
|
||||||
|| aEvent.Matches( EVENTS::SelectedEvent )
|
|| aEvent.Matches( EVENTS::SelectedEvent )
|
||||||
|| aEvent.Matches( EVENTS::UnselectedEvent ) )
|
|| aEvent.Matches( EVENTS::UnselectedEvent )
|
||||||
|
|| aEvent.Matches( EVENTS::ClearedEvent ) )
|
||||||
{
|
{
|
||||||
// Normal find modifies the selection, but selection-based find does
|
// Normal find modifies the selection, but selection-based find does
|
||||||
// not so we want to start over in the items we are searching through when
|
// not so we want to start over in the items we are searching through when
|
||||||
// the selection changes
|
// the selection changes
|
||||||
if( selectedOnly )
|
if( selectedOnly )
|
||||||
|
{
|
||||||
m_afterItem = nullptr;
|
m_afterItem = nullptr;
|
||||||
|
visitAll();
|
||||||
for( EDA_ITEM* item : m_selectionTool->GetSelection() )
|
}
|
||||||
visit( item, &m_frame->GetCurrentSheet() );
|
|
||||||
}
|
}
|
||||||
else if( m_foundItemHighlighted )
|
else if( m_foundItemHighlighted )
|
||||||
{
|
{
|
||||||
m_foundItemHighlighted = false;
|
m_foundItemHighlighted = false;
|
||||||
|
visitAll();
|
||||||
for( SCH_ITEM* item : m_frame->GetScreen()->Items() )
|
|
||||||
{
|
|
||||||
visit( item, &m_frame->GetCurrentSheet() );
|
|
||||||
|
|
||||||
item->RunOnChildren(
|
|
||||||
[&]( SCH_ITEM* aChild )
|
|
||||||
{
|
|
||||||
visit( aChild, &m_frame->GetCurrentSheet() );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getView()->UpdateItems();
|
getView()->UpdateItems();
|
||||||
|
|
Loading…
Reference in New Issue