Enable user layers in footprint editor.

Fixes: lp:1746279
* https://bugs.launchpad.net/kicad/+bug/1746279
This commit is contained in:
Jeff Young 2018-08-26 18:58:27 +01:00
parent c88b43e356
commit a860a8db54
3 changed files with 25 additions and 10 deletions

View File

@ -783,6 +783,13 @@ LSET LSET::BackMask()
}
LSET LSET::ForbiddenFootprintLayers()
{
static const LSET saved = InternalCuMask().set( Edge_Cuts ).set( Margin );
return saved;
}
LSET LSET::ForbiddenTextLayers()
{
static const LSET saved( 2, Edge_Cuts, Margin );

View File

@ -523,6 +523,18 @@ public:
static LSET UserMask();
/**
* Function ForbiddenFootprintLayers
* Layers which are not allowed within footprint definitions. Currently internal
* copper layers, Edge.Cuts and Margin.
*/
static LSET ForbiddenFootprintLayers();
/**
* Function ForbiddenTextLayers
* Layers which are now allowed to have text on them. Currently Edge.Cuts and Margin.
*/
static LSET ForbiddenTextLayers();
/**

View File

@ -156,9 +156,7 @@ bool PCB_LAYER_WIDGET::isAllowedInFpMode( int aId )
bool PCB_LAYER_WIDGET::isLayerAllowedInFpMode( PCB_LAYER_ID aLayer )
{
static LSET allowed = LSET::AllTechMask();
// Currently not in use because putting a graphic item on a copper layer
// is not currently supported by DRC.
// allowed.set( F_Cu ).set( B_Cu );
allowed.set( F_Cu ).set( B_Cu );
return allowed.test( aLayer );
}
@ -519,11 +517,10 @@ void PCB_LAYER_WIDGET::ReFill()
brd->GetLayerName( layer ), layer, myframe->Settings().Colors().GetLayerColor( layer ),
dsc, true ) );
if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) )
if( m_fp_editor_mode && LSET::ForbiddenFootprintLayers().test( layer ) )
{
getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false );
getLayerComp( GetLayerRowCount()-1,
COLUMN_COLORBM )->SetToolTip( wxEmptyString );
getLayerComp( GetLayerRowCount()-1, COLUMN_COLORBM )->SetToolTip( wxEmptyString );
}
}
@ -568,11 +565,10 @@ void PCB_LAYER_WIDGET::ReFill()
brd->GetLayerName( layer ), layer, myframe->Settings().Colors().GetLayerColor( layer ),
wxGetTranslation( non_cu_seq[i].tooltip ), true ) );
if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) )
if( m_fp_editor_mode && LSET::ForbiddenFootprintLayers().test( layer ) )
{
getLayerComp( GetLayerRowCount()-1, COLUMN_COLOR_LYRNAME )->Enable( false );
getLayerComp( GetLayerRowCount()-1,
COLUMN_COLORBM )->SetToolTip( wxEmptyString );
getLayerComp( GetLayerRowCount()-1, COLUMN_COLORBM )->SetToolTip( wxEmptyString );
}
}
}
@ -616,7 +612,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer )
// false from this function.
PCB_LAYER_ID layer = ToLAYER_ID( aLayer );
if( m_fp_editor_mode && !isLayerAllowedInFpMode( layer ) )
if( m_fp_editor_mode && LSET::ForbiddenFootprintLayers().test( layer ) )
return false;
myframe->SetActiveLayer( layer );