Browse Source

Allow DRC markers to be selected with area selection

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19258
pcb_db
JamesJCode 12 months ago
parent
commit
29798a6400
  1. 11
      common/marker_base.cpp
  2. 5
      include/marker_base.h
  3. 6
      pcbnew/pcb_draw_panel_gal.cpp
  4. 8
      pcbnew/pcb_marker.h
  5. 1
      pcbnew/tools/pcb_selection_tool.cpp

11
common/marker_base.cpp

@ -106,6 +106,17 @@ bool MARKER_BASE::HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) c
}
bool MARKER_BASE::HitTestMarker( const BOX2I& aRect, bool aContained, int aAccuracy ) const
{
const BOX2I bbox = GetBoundingBoxMarker().GetInflated( aAccuracy );
if( aContained )
return aRect.Contains( bbox );
return aRect.Intersects( bbox );
}
void MARKER_BASE::ShapeToPolygon( SHAPE_LINE_CHAIN& aPolygon, int aScale ) const
{
if( aScale < 0 )

5
include/marker_base.h

@ -119,6 +119,11 @@ public:
*/
bool HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const;
/**
* Test if the given BOX2I intersects or contains the bounds of this object
*/
bool HitTestMarker( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const;
/**
* Return the orthogonal, bounding box of this object for display purposes.
*

6
pcbnew/pcb_draw_panel_gal.cpp

@ -703,11 +703,11 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
m_view->SetLayerDisplayOnly( LAYER_RATSNEST );
m_view->SetLayerTarget( LAYER_DRC_ERROR, KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( LAYER_DRC_ERROR );
//m_view->SetLayerDisplayOnly( LAYER_DRC_ERROR );
m_view->SetLayerTarget( LAYER_DRC_WARNING, KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( LAYER_DRC_WARNING );
//m_view->SetLayerDisplayOnly( LAYER_DRC_WARNING );
m_view->SetLayerTarget( LAYER_DRC_EXCLUSION, KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( LAYER_DRC_EXCLUSION );
//m_view->SetLayerDisplayOnly( LAYER_DRC_EXCLUSION );
m_view->SetLayerTarget( LAYER_MARKER_SHADOWS, KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( LAYER_MARKER_SHADOWS );
m_view->SetLayerTarget( LAYER_DRC_SHAPE1, KIGFX::TARGET_OVERLAY );

8
pcbnew/pcb_marker.h

@ -82,6 +82,14 @@ public:
return HitTestMarker( aPosition, aAccuracy );
}
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override
{
if( GetMarkerType() == MARKER_RATSNEST )
return false;
return HitTestMarker( aRect, aContained, aAccuracy );
}
EDA_ITEM* Clone() const override
{
return new PCB_MARKER( *this );

1
pcbnew/tools/pcb_selection_tool.cpp

@ -1163,7 +1163,6 @@ bool PCB_SELECTION_TOOL::selectMultiple()
{
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( candidate.first );
if( item && Selectable( item ) && item->HitTest( selectionRect, !greedySelection )
&& ( greedySelection || !group_items.count( item ) ) )
{

Loading…
Cancel
Save