Don't allow duplication of footprint items outside of footprint editor.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15487
(cherry picked from commit 9bba8e5956
)
This commit is contained in:
parent
02a95b958d
commit
61ef88a0ac
|
@ -2217,6 +2217,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|||
const PCB_SELECTION& selection = m_selectionTool->RequestSelection(
|
||||
[]( const VECTOR2I&, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
|
||||
{
|
||||
sTool->FilterCollectorForFreePads( aCollector, true );
|
||||
sTool->FilterCollectorForMarkers( aCollector );
|
||||
sTool->FilterCollectorForHierarchy( aCollector, true );
|
||||
} );
|
||||
|
@ -2257,10 +2258,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( orig_item->GetParent() && orig_item->GetParent()->Type() == PCB_FOOTPRINT_T )
|
||||
{
|
||||
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( orig_item->GetParent() );
|
||||
|
||||
m_commit->Modify( parentFootprint );
|
||||
dupe_item = parentFootprint->DuplicateItem( orig_item, true /* add to parent */ );
|
||||
// No sub-footprint modifications allowed outside of footprint editor
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -201,7 +201,7 @@ int EDIT_TOOL::PackAndMoveFootprints( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
sTool->FilterCollectorForMarkers( aCollector );
|
||||
sTool->FilterCollectorForHierarchy( aCollector, true );
|
||||
sTool->FilterCollectorForFreePads( aCollector );
|
||||
sTool->FilterCollectorForFreePads( aCollector, true );
|
||||
|
||||
// Iterate from the back so we don't have to worry about removals.
|
||||
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
|
||||
|
|
|
@ -3161,7 +3161,8 @@ void PCB_SELECTION_TOOL::FilterCollectorForHierarchy( GENERAL_COLLECTOR& aCollec
|
|||
}
|
||||
|
||||
|
||||
void PCB_SELECTION_TOOL::FilterCollectorForFreePads( GENERAL_COLLECTOR& aCollector ) const
|
||||
void PCB_SELECTION_TOOL::FilterCollectorForFreePads( GENERAL_COLLECTOR& aCollector,
|
||||
bool aForcePromotion ) const
|
||||
{
|
||||
std::set<BOARD_ITEM*> to_add;
|
||||
|
||||
|
@ -3171,7 +3172,7 @@ void PCB_SELECTION_TOOL::FilterCollectorForFreePads( GENERAL_COLLECTOR& aCollect
|
|||
BOARD_ITEM* item = aCollector[i];
|
||||
|
||||
if( !m_isFootprintEditor && item->Type() == PCB_PAD_T
|
||||
&& !frame()->GetPcbNewSettings()->m_AllowFreePads )
|
||||
&& ( !frame()->GetPcbNewSettings()->m_AllowFreePads || aForcePromotion ) )
|
||||
{
|
||||
if( !aCollector.HasItem( item->GetParent() ) )
|
||||
to_add.insert( item->GetParent() );
|
||||
|
|
|
@ -199,7 +199,8 @@ public:
|
|||
* Check the "allow free pads" setting and if disabled, replace any pads in the collector
|
||||
* with their parent footprints.
|
||||
*/
|
||||
void FilterCollectorForFreePads( GENERAL_COLLECTOR& aCollector ) const;
|
||||
void FilterCollectorForFreePads( GENERAL_COLLECTOR& aCollector,
|
||||
bool aForcePromotion = false ) const;
|
||||
|
||||
/**
|
||||
* Drop any PCB_MARKERs from the collector.
|
||||
|
|
Loading…
Reference in New Issue