PANEL_SETUP_LAYERS: when removing a layer, do not delete items owned by footprints.
Items owned by footprints are allowed to be on non existing layers on board. Moreover, items owned by footprint cannot be deleted by the board editor. Fixes #17038 https://gitlab.com/kicad/code/kicad/-/issues/17038
This commit is contained in:
parent
012b32e989
commit
01327b24b4
|
@ -503,6 +503,15 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
|
|||
for( int i = 0; i < collector.GetCount(); i++ )
|
||||
{
|
||||
BOARD_ITEM* item = collector[i];
|
||||
|
||||
// Do not remove/change an item owned by a footprint
|
||||
if( dynamic_cast<FOOTPRINT*>( item->GetParentFootprint() ) )
|
||||
continue;
|
||||
|
||||
// Do not remove footprints
|
||||
if( dynamic_cast<FOOTPRINT*>( item ) )
|
||||
continue;
|
||||
|
||||
LSET layers = item->GetLayerSet();
|
||||
|
||||
layers.reset( layer_id );
|
||||
|
@ -728,7 +737,21 @@ LSEQ PANEL_SETUP_LAYERS::getRemovedLayersWithItems()
|
|||
collector.Collect( m_pcb, GENERAL_COLLECTOR::BoardLevelItems );
|
||||
|
||||
if( collector.GetCount() != 0 )
|
||||
removedLayers.push_back( layer_id );
|
||||
{
|
||||
// Skip items owned by footprints and footprints when building
|
||||
// the actual list of removed layers: these items are not removed
|
||||
for( int i = 0; i < collector.GetCount(); i++ )
|
||||
{
|
||||
BOARD_ITEM* item = collector[i];
|
||||
|
||||
if( dynamic_cast<FOOTPRINT*>( item )
|
||||
|| dynamic_cast<FOOTPRINT*>( item->GetParentFootprint() ) )
|
||||
continue;
|
||||
|
||||
removedLayers.push_back( layer_id );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,6 +115,7 @@ private:
|
|||
|
||||
/**
|
||||
* Return a list of layers removed from the board that contain items.
|
||||
* Footprints and items owned by footprints are not taken in account
|
||||
*/
|
||||
LSEQ getRemovedLayersWithItems();
|
||||
|
||||
|
|
Loading…
Reference in New Issue