diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index cf778afb7d..6402908820 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -164,7 +164,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a board->Add( boardItem ); // handles connectivity } - if( boardItem->Type() != PCB_NETINFO_T ) + if( boardItem->Type() != PCB_NETINFO_T && boardItem->Type() != PCB_GROUP_T ) view->Add( boardItem ); break; diff --git a/pcbnew/class_pcb_group.cpp b/pcbnew/class_pcb_group.cpp index 19be81a722..4e85b9a1c0 100644 --- a/pcbnew/class_pcb_group.cpp +++ b/pcbnew/class_pcb_group.cpp @@ -29,7 +29,8 @@ #include #include -PCB_GROUP::PCB_GROUP( BOARD*aParent ) : BOARD_ITEM( aParent, PCB_GROUP_T ) +PCB_GROUP::PCB_GROUP( BOARD*aParent ) : + BOARD_ITEM( aParent, PCB_GROUP_T ) { } diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index a1de659c3d..7208560ab6 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -31,7 +31,6 @@ using namespace std::placeholders; #include #include #include -#include #include #include #include @@ -55,8 +54,6 @@ using namespace std::placeholders; #include "pcb_bright_box.h" #include "pcb_actions.h" -#include "kicad_plugin.h" - class SELECT_MENU : public ACTION_MENU { @@ -105,7 +102,7 @@ SELECTION_TOOL::SELECTION_TOOL() : m_multiple( false ), m_skip_heuristics( false ), m_locked( true ), - m_enteredGroup( NULL ), + m_enteredGroup( nullptr ), m_priv( std::make_unique() ) { m_filter.lockedItems = true; @@ -125,6 +122,7 @@ SELECTION_TOOL::SELECTION_TOOL() : SELECTION_TOOL::~SELECTION_TOOL() { getView()->Remove( &m_selection ); + getView()->Remove( &m_enteredGroupOverlay ); } @@ -177,7 +175,7 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason ) m_frame = getEditFrame(); m_locked = true; - if( m_enteredGroup != NULL ) + if( m_enteredGroup ) ExitGroup(); if( aReason == TOOL_BASE::MODEL_RELOAD ) @@ -199,6 +197,9 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason ) // Reinsert the VIEW_GROUP, in case it was removed from the VIEW view()->Remove( &m_selection ); view()->Add( &m_selection ); + + view()->Remove( &m_enteredGroupOverlay ); + view()->Add( &m_enteredGroupOverlay ); } @@ -326,7 +327,7 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) { m_frame->FocusOnItem( nullptr ); - if( m_enteredGroup != NULL ) + if( m_enteredGroup ) ExitGroup(); ClearSelection(); @@ -358,6 +359,8 @@ void SELECTION_TOOL::EnterGroup() { select( titem ); } ); + + m_enteredGroupOverlay.Add( m_enteredGroup ); } @@ -372,7 +375,8 @@ void SELECTION_TOOL::ExitGroup( bool aSelectGroup ) if( aSelectGroup ) select( m_enteredGroup ); - m_enteredGroup = NULL; + m_enteredGroupOverlay.Clear(); + m_enteredGroup = nullptr; } @@ -2597,6 +2601,7 @@ void SELECTION_TOOL::FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector ) c int SELECTION_TOOL::updateSelection( const TOOL_EVENT& aEvent ) { getView()->Update( &m_selection ); + getView()->Update( &m_enteredGroupOverlay ); return 0; } diff --git a/pcbnew/tools/selection_tool.h b/pcbnew/tools/selection_tool.h index 28d4a4039c..82e41b4e77 100644 --- a/pcbnew/tools/selection_tool.h +++ b/pcbnew/tools/selection_tool.h @@ -383,7 +383,11 @@ private: bool m_multiple; // Multiple selection mode is active bool m_skip_heuristics; // Heuristics are not allowed when choosing item under cursor bool m_locked; // Other tools are not allowed to modify locked items - PCB_GROUP* m_enteredGroup; // If non-null, selections are limited to members of this group + + PCB_GROUP* m_enteredGroup; // If non-null, selections are limited to + // members of this group + KIGFX::VIEW_GROUP m_enteredGroupOverlay; // Overlay for the entered group's frame. + /// Private state (opaque pointer/compilation firewall) class PRIV;