Allow selecting graphic footprints in high-contrast mode

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6490
This commit is contained in:
Jon Evans 2020-11-26 14:45:22 -05:00
parent 6f3b0c452f
commit 0bbb7bdb0c
2 changed files with 30 additions and 0 deletions

View File

@ -790,6 +790,29 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
}
bool FOOTPRINT::IsOnLayer( PCB_LAYER_ID aLayer ) const
{
// If we have any pads, fall back on normal checking
if( !m_pads.empty() )
return m_layer == aLayer;
// No pads? Check if this entire footprint exists on the given layer
for( FP_ZONE* zone : m_fp_zones )
{
if( !zone->IsOnLayer( aLayer ) )
return false;
}
for( BOARD_ITEM* item : m_drawings )
{
if( !item->IsOnLayer( aLayer ) )
return false;
}
return true;
}
bool FOOTPRINT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
EDA_RECT rect = m_boundingBox;//.GetBoundingBoxRotated( GetPosition(), m_Orient );

View File

@ -281,6 +281,13 @@ public:
*/
bool IsFlipped() const { return GetLayer() == B_Cu; }
/**
* A special IsOnLayer for footprints: return true if the footprint contains only items on the
* given layer, even if that layer is not one of the valid footprint layers F_Cu and B_Cu.
* This allows selection of "graphic" footprints that contain only silkscreen, for example.
*/
bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
// m_footprintStatus bits:
#define FP_is_LOCKED 0x01 ///< footprint LOCKED: no autoplace allowed
#define FP_is_PLACED 0x02 ///< In autoplace: footprint automatically placed