pcbnew Flip: Filter selection for free pads, select footprint instead
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9875
This commit is contained in:
parent
a03e6e4926
commit
34a0d1947a
|
@ -1697,6 +1697,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
|
||||||
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
|
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
|
||||||
{
|
{
|
||||||
sTool->FilterCollectorForHierarchy( aCollector, true );
|
sTool->FilterCollectorForHierarchy( aCollector, true );
|
||||||
|
sTool->FilterCollectorForFreePads( aCollector, true );
|
||||||
},
|
},
|
||||||
!m_dragging /* prompt user regarding locked items */ );
|
!m_dragging /* prompt user regarding locked items */ );
|
||||||
|
|
||||||
|
|
|
@ -2656,6 +2656,31 @@ void PCB_SELECTION_TOOL::FilterCollectorForHierarchy( GENERAL_COLLECTOR& aCollec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PCB_SELECTION_TOOL::FilterCollectorForFreePads( GENERAL_COLLECTOR& aCollector,
|
||||||
|
bool aMultiselect ) const
|
||||||
|
{
|
||||||
|
std::set<BOARD_ITEM*> to_add;
|
||||||
|
|
||||||
|
// Iterate from the back so we don't have to worry about removals.
|
||||||
|
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
|
||||||
|
{
|
||||||
|
BOARD_ITEM* item = aCollector[i];
|
||||||
|
|
||||||
|
if( !IsFootprintEditor() && item->Type() == PCB_PAD_T
|
||||||
|
&& !frame()->Settings().m_AllowFreePads )
|
||||||
|
{
|
||||||
|
if( !aCollector.HasItem( item->GetParent() ) )
|
||||||
|
to_add.insert( item->GetParent() );
|
||||||
|
|
||||||
|
aCollector.Remove( item );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( BOARD_ITEM* item : to_add )
|
||||||
|
aCollector.Append( item );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int PCB_SELECTION_TOOL::updateSelection( const TOOL_EVENT& aEvent )
|
int PCB_SELECTION_TOOL::updateSelection( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
getView()->Update( &m_selection );
|
getView()->Update( &m_selection );
|
||||||
|
|
|
@ -203,6 +203,12 @@ public:
|
||||||
*/
|
*/
|
||||||
void FilterCollectorForHierarchy( GENERAL_COLLECTOR& aCollector, bool aMultiselect ) const;
|
void FilterCollectorForHierarchy( GENERAL_COLLECTOR& aCollector, bool aMultiselect ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check the "allow free pads" setting and if disabled, upgrade any pad selection to the
|
||||||
|
* selection of its parent footprint.
|
||||||
|
*/
|
||||||
|
void FilterCollectorForFreePads( GENERAL_COLLECTOR& aCollector, bool aMultiselect ) const;
|
||||||
|
|
||||||
///< Apply the SELECTION_FILTER_OPTIONS to a collection of items
|
///< Apply the SELECTION_FILTER_OPTIONS to a collection of items
|
||||||
void FilterCollectedItems( GENERAL_COLLECTOR& aCollector, bool aMultiSelect );
|
void FilterCollectedItems( GENERAL_COLLECTOR& aCollector, bool aMultiSelect );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue