diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 3fa06da7c5..1c06b04aac 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -790,6 +790,29 @@ void FOOTPRINT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorIsOnLayer( 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 ); diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index a54771fd34..be4c69ec15 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -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