From dd5275f6c68797bf7149ac4932eaabe1e8cab34f Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 16 Jun 2015 14:51:39 +0200 Subject: [PATCH] Minor SELECTION_TOOL fixes. --- common/tool/action_manager.cpp | 2 +- pcbnew/tools/edit_tool.h | 2 +- pcbnew/tools/selection_tool.cpp | 12 ++---------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/common/tool/action_manager.cpp b/common/tool/action_manager.cpp index 3f5d10d826..16e4bba013 100644 --- a/common/tool/action_manager.cpp +++ b/common/tool/action_manager.cpp @@ -120,7 +120,7 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const // different combination if( it == m_actionHotKeys.end() ) { - it = m_actionHotKeys.find( key | (mod & ~MD_SHIFT) ); + it = m_actionHotKeys.find( key | ( mod & ~MD_SHIFT ) ); if( it == m_actionHotKeys.end() ) return false; // no appropriate action found for the hotkey diff --git a/pcbnew/tools/edit_tool.h b/pcbnew/tools/edit_tool.h index 6bf9a283b1..98b67ef471 100644 --- a/pcbnew/tools/edit_tool.h +++ b/pcbnew/tools/edit_tool.h @@ -220,7 +220,7 @@ private: { const SELECTION& selection = m_selectionTool->GetSelection(); - if( selection.items.GetCount() > 1 ) + if( selection.items.GetCount() != 1 ) return NULL; BOARD_ITEM* item = selection.Item( 0 ); diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 9aa4db8cef..e11abf5547 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -1325,16 +1325,8 @@ bool SELECTION_TOOL::SanitizeSelection() } } - while( !rejected.empty () ) - { - BOARD_ITEM* item = *rejected.begin(); - int itemIdx = m_selection.items.FindItem( item ); - - if( itemIdx >= 0 ) - m_selection.items.RemovePicker( itemIdx ); - - rejected.erase( item ); - } + BOOST_FOREACH( BOARD_ITEM* item, rejected ) + unselect( item ); return true; }