Allow selecting footprints that are only silkscreen using silk layers

In high-contrast mode, items that don't exist on the current layer are
not selectable, but this is problematic since there are library
components that only exist in the silkscreen layer (logos, etc).

By adding one of the silkscreen layers to the ViewGetLayers() output,
these components are now editable when viewing the silkscreen layer in
high-contrast mode.  Silkscreens attached to footprints that have pads
or drawings on non-silkscreen layers are still not selectable.

Fixes: lp:1741350
* https://bugs.launchpad.net/kicad/+bug/1741350
This commit is contained in:
Jon Evans 2018-01-04 17:39:36 -05:00 committed by Wayne Stambaugh
parent 445fc0000f
commit a4bb6ec3e4
1 changed files with 24 additions and 0 deletions

View File

@ -888,6 +888,30 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
aLayers[1] = LAYER_MOD_BK;
break;
}
// If there are no pads, and only drawings on a silkscreen layer, then
// report the silkscreen layer as well so that the component can be edited
// with the silkscreen layer
bool f_silk = false, b_silk = false, non_silk = false;
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
{
if( item->GetLayer() == F_SilkS )
f_silk = true;
else if( item->GetLayer() == B_SilkS )
b_silk = true;
else
non_silk = true;
}
if( ( f_silk || b_silk ) && !non_silk && m_Pads.GetCount() == 0 )
{
if( f_silk )
aLayers[ aCount++ ] = F_SilkS;
if( b_silk )
aLayers[ aCount++ ] = B_SilkS;
}
}