diff --git a/common/preview_items/selection_area.cpp b/common/preview_items/selection_area.cpp index a1a4813c22..001e6df6a3 100644 --- a/common/preview_items/selection_area.cpp +++ b/common/preview_items/selection_area.cpp @@ -30,8 +30,8 @@ using namespace KIGFX::PREVIEW; // Selection area colours -const COLOR4D SELECT_COLOR_L2R( 0.3, 0.3, 0.5, 0.3 ); // Slight blue -const COLOR4D SELECT_COLOR_R2L( 0.3, 0.5, 0.3, 0.3 ); // Slight green +const COLOR4D SELECT_COLOR_L2R( 0.3, 0.3, 0.6, 0.3 ); // Slight blue +const COLOR4D SELECT_COLOR_R2L( 0.3, 0.6, 0.3, 0.3 ); // Slight green SELECTION_AREA::SELECTION_AREA() diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 0ea9529b1a..a77e53e418 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -230,6 +230,10 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) // become the new selection (discarding previously selected items) m_additive = evt->Modifier( MD_SHIFT ); + // Should selected items be REMOVED from the current selection? + // This will be ignored if the SHIFT modifier is pressed + m_subtractive = !m_additive && evt->Modifier( MD_CTRL ); + // single click? Select single object if( evt->IsClick( BUT_LEFT ) ) { @@ -269,7 +273,7 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) // drag with LMB? Select multiple objects (or at least draw a selection box) or drag them else if( evt->IsDrag( BUT_LEFT ) ) { - if( m_additive ) + if( m_additive || m_subtractive ) { selectMultiple(); } @@ -483,8 +487,10 @@ bool SELECTION_TOOL::selectMultiple() if( evt->IsDrag( BUT_LEFT ) ) { - if( !m_additive ) + if( !m_additive && !m_subtractive ) + { clearSelection(); + } // Start drawing a selection box area.SetOrigin( evt->DragOrigin() ); @@ -529,14 +535,20 @@ bool SELECTION_TOOL::selectMultiple() { if( selectionBox.Contains( item->ViewBBox() ) ) { - select( item ); + if( m_subtractive ) + unselect( item ); + else + select( item ); } } else { if( item->HitTest( selectionRect, false ) ) { - select( item ); + if( m_subtractive ) + unselect( item ); + else + select( item ); } } diff --git a/pcbnew/tools/selection_tool.h b/pcbnew/tools/selection_tool.h index a285370aba..642842d6f5 100644 --- a/pcbnew/tools/selection_tool.h +++ b/pcbnew/tools/selection_tool.h @@ -323,6 +323,9 @@ private: /// Flag saying if items should be added to the current selection or rather replace it. bool m_additive; + /// Flag saying if items should be removed from the current selection + bool m_subtractive; + /// Flag saying if multiple selection mode is active. bool m_multiple;