From 0bbb7bdb0c8c4bf45aa86ddaf57fa7ad52ce54d6 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Thu, 26 Nov 2020 14:45:22 -0500 Subject: [PATCH] Allow selecting graphic footprints in high-contrast mode Fixes https://gitlab.com/kicad/code/kicad/-/issues/6490 --- pcbnew/footprint.cpp | 23 +++++++++++++++++++++++ pcbnew/footprint.h | 7 +++++++ 2 files changed, 30 insertions(+) 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