From c1d6e44413809fdb1616beabc859b42f2032ef5c Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 18 Dec 2013 15:09:09 +0100 Subject: [PATCH] Speed optimization during selection of multiple items. Removed debug output. --- pcbnew/tools/edit_tool.cpp | 6 ------ pcbnew/tools/selection_tool.cpp | 6 ++---- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index e8accb4ca7..a51d9dccf9 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -129,12 +129,6 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent ) else { // Prepare to drag - save items, so changes can be undone - for( unsigned int i = 0; i < selection.items.GetCount(); ++i ) - { - BOARD_ITEM* item = static_cast( selection.items.GetPickedItem( i ) ); - std::cout << "saved " << (unsigned long) item << std::endl; - } - editFrame->OnModify(); editFrame->SaveCopyInUndoList( selection.items, UR_CHANGED ); diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index dabf03dda8..540ea5cb3d 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -503,7 +503,6 @@ void SELECTION_TOOL::select( BOARD_ITEM* aItem ) { MODULE* module = static_cast( aItem ); module->RunOnChildren( std::bind1st( std::mem_fun( &SELECTION_TOOL::selectVisually ), this ) ); - } selectVisually( aItem ); @@ -519,8 +518,8 @@ void SELECTION_TOOL::select( BOARD_ITEM* aItem ) // Now the context menu should be enabled SetContextMenu( &m_menu, CMENU_BUTTON ); } - else - { + else if( m_selection.Size() == 2 ) // Check only for 2, so it will not be + { // called for every next selected item // If multiple items are selected, do not show the information about the selected item getEditFrame()->SetCurItem( NULL, true ); } @@ -535,7 +534,6 @@ void SELECTION_TOOL::deselect( BOARD_ITEM* aItem ) { MODULE* module = static_cast( aItem ); module->RunOnChildren( std::bind1st( std::mem_fun( &SELECTION_TOOL::deselectVisually ), this ) ); - } deselectVisually( aItem );