Handle module keepout zones on internal layers.

Make sure the Keepout Zone dialog allows specifiying them and make
sure they're selectable.

Fixes https://gitlab.com/kicad/code/kicad/issues/5113
This commit is contained in:
Jeff Young 2020-08-09 00:23:11 +01:00
parent 30d42ca95a
commit 5c3fddffa6
2 changed files with 9 additions and 17 deletions

View File

@ -1705,29 +1705,17 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn
case PCB_ZONE_AREA_T:
case PCB_MODULE_ZONE_AREA_T:
{
const ZONE_CONTAINER* zone = static_cast<const ZONE_CONTAINER*>( aItem );
// Check to see if this keepout is part of a footprint
// If it is, and we are not editing the footprint, it should not be selectable
const bool zoneInFootprint =
aItem->GetParent() != nullptr && aItem->GetParent()->Type() == PCB_MODULE_T;
bool zoneInFootprint = zone->GetParent() && zone->GetParent()->Type() == PCB_MODULE_T;
if( zoneInFootprint && !m_editModules && !checkVisibilityOnly )
return false;
// zones can exist on multiple layers!
{
auto* zone = static_cast<const ZONE_CONTAINER*>( aItem );
auto zoneLayers = zone->GetLayerSet().Seq();
for( unsigned int i = 0; i < zoneLayers.size(); i++ )
{
if( board()->IsLayerVisible( zoneLayers[i] ) )
{
return true;
}
}
// No active layers selected!
return false;
}
return ( zone->GetLayerSet() & board()->GetVisibleLayers() ).any();
}
break;

View File

@ -195,6 +195,9 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME*
LSET layers = aShowCopper ? LSET::AllCuMask( board->GetCopperLayerCount() )
: LSET::AllNonCuMask();
if( aFpEditorMode )
layers.set( In1_Cu ); // a proxy for "all inner layers"
wxDataViewColumn* checkColumn = aList->AppendToggleColumn( wxEmptyString );
wxDataViewColumn* layerColumn = aList->AppendIconTextColumn( wxEmptyString );
wxDataViewColumn* layerIDColumn = aList->AppendTextColumn( wxEmptyString );
@ -206,6 +209,7 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME*
{
PCB_LAYER_ID layerID = *layer;
wxString layerName = board->GetLayerName( layerID );
if( aFpEditorMode && layerID == In1_Cu )
layerName = _( "Inner layers" );