← Back to team overview

kicad-developers team mailing list archive

Re: [FEATURE] Partial selection in pcbnew

 

Maciej,

That was it! Thanks for the hint.

#0016 attached, which fixes both issues:

a) No more double-selection of module and module-items (pads / lines / etc)
in PCBNEW
b) Disable selection of entire module in MODEDIT

As far as I can tell this patchset is now working very well.

Regards,
Oliver

On Sat, May 6, 2017 at 10:21 PM, Oliver Walters <
oliver.henry.walters@xxxxxxxxx> wrote:

> Maciej,
>
> Thanks, I'll look into that. If you have a chance to look over what I've
> done, I'd appreciate that :)
>
> On Sat, May 6, 2017 at 10:17 PM, Maciej Suminski <maciej.suminski@xxxxxxx>
> wrote:
>
>> Hi Oliver,
>>
>> I have not tested the patches yet, but my gut feeling says that you miss
>> calling SELECTION_TOOL::selectable() to filter out redundant items.
>>
>> Regards,
>> Orson
>>
>> On 05/06/2017 09:21 AM, Oliver Walters wrote:
>> > Three further patch files attached:
>> >
>> > - Different color select box based on direction
>> > - Fixed HitTest for EDA_TEXT
>> > - Control modifier unselects anything in rectangle.
>> >
>> > The major piece of feedback I need right now is how to perfect the
>> > behaviour of the tool in PCBNEW and MODEDIT:
>> >
>> > a) PCBNEW
>> >
>> > Selecting part of a MODULE (right to left) will select both the entire
>> > module and also any parts of the module that you touched (lines, pads,
>> > etc). Then, when you move the module, the doubly-selected items are
>> moved
>> > twice! It is hard to describe properly but if you try this you will see
>> > what I mean.
>> >
>> > b) MODEDIT
>> >
>> > Selecting any item in the footprint selects the entire footprint, which
>> is
>> > highly undesirable. In this case I think the best approach is to filter
>> the
>> > MODULE from the selection entirely. But I am not sure how to do this.
>> >
>> > Feedback welcome :)
>> >
>> > Regards,
>> > Oliver
>> >
>> > On Tue, May 2, 2017 at 5:25 PM, Oliver Walters <
>> > oliver.henry.walters@xxxxxxxxx> wrote:
>> >
>> >> I have attached a patch-set that implements "partial selection" of
>> objects
>> >> when the selection box is dragged right-to-left.
>> >>
>> >> L -> R = Objects must be completely enclosed to be selected
>> >> R -> L = Objects that intersect the selection rectangle will be
>> selected.
>> >>
>> >> To achieve this I had to fix a lot of the HitTest implementations as
>> this
>> >> was broken for most shapes, under a variety of edge cases (some HitTest
>> >> code did not work at all).
>> >>
>> >> There are two issues I see as outstanding, and am unsure how to
>> proceed:
>> >>
>> >> 1. When editing a PCB, selecting part of a footprint (e.g. a line of
>> the
>> >> courtyard) selects both that line and the entire footprint. This causes
>> >> some issues when the footprint is dragged around the PCB. I believe
>> that
>> >> the line should not be selected separately, but the entire footprint
>> should.
>> >>
>> >> 2. The inverse of 1. In the footprint editor, selecting a single
>> graphical
>> >> item selects the entire footprint. Somehow I would like to filter the
>> >> selection such that individual items are selected but NOT the entire
>> >> footprint.
>> >>
>> >> Feedback please! :)
>> >>
>> >> I have fixed hit testing (both for wxPoint and EDA_RECT comparison)
>> for:
>> >>
>> >> - Pads (all shapes)
>> >> - Lines
>> >> - Circles
>> >> - Arcs
>> >> - Text items
>> >> - Zones
>> >> - Footprints
>> >>
>> >> Cheers,
>> >> Oliver
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> > _______________________________________________
>> > Mailing list: https://launchpad.net/~kicad-developers
>> > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> > Unsubscribe : https://launchpad.net/~kicad-developers
>> > More help   : https://help.launchpad.net/ListHelp
>> >
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>
From ce86d7d9399a4def2d23b112b6f91baf56fd65ef Mon Sep 17 00:00:00 2001
From: Oliver Walters <oliver.henry.walters@xxxxxxxxx>
Date: Sun, 7 May 2017 10:09:03 +1000
Subject: [PATCH] Fixed selection filtering

- Fixed "double selection" of pads and pad parents in PCBNEW
- Disabled selection of entire module in MODEDIT
---
 pcbnew/tools/selection_tool.cpp | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp
index a77e53e..ec4e980 100644
--- a/pcbnew/tools/selection_tool.cpp
+++ b/pcbnew/tools/selection_tool.cpp
@@ -166,7 +166,8 @@ public:
 
 SELECTION_TOOL::SELECTION_TOOL() :
         PCB_TOOL( "pcbnew.InteractiveSelection" ),
-        m_frame( NULL ), m_additive( false ), m_multiple( false ),
+        m_frame( NULL ), m_additive( false ), m_subtractive( false ),
+        m_multiple( false ),
         m_locked( true ), m_menu( *this ),
         m_priv( std::make_unique<PRIV>() )
 {
@@ -526,6 +527,9 @@ bool SELECTION_TOOL::selectMultiple()
             {
                 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( it->first );
 
+                if( !item || !selectable( item ) )
+                    continue;
+
                 /* Selection mode depends on direction of drag-selection:
                  * Left > Right : Select objects that are fully enclosed by selection
                  * Right > Left : Select objects that are crossed by selection
@@ -1329,6 +1333,14 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) const
         break;
 
     case PCB_MODULE_T:
+
+        // In the module editor, we do not want to select the module itself
+        // rather, the module sub-components should be selected individually
+        if( m_editModules )
+        {
+            return false;
+        }
+
         if( aItem->IsOnLayer( F_Cu ) && board()->IsElementVisible( LAYER_MOD_FR ) )
             return !m_editModules;
 
-- 
2.7.4


Follow ups

References