From a417da4ce085ba22c4abf21f2d38d7ea030f5be4 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sat, 15 Aug 2020 14:18:04 -0400 Subject: [PATCH] Split selecteditemmodified to a selecteditemmoved to reduce updatemsgpanel spam --- common/tool/actions.cpp | 1 + include/tool/actions.h | 4 ++++ pcbnew/tools/edit_tool.cpp | 4 ++-- pcbnew/tools/selection_tool.cpp | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/common/tool/actions.cpp b/common/tool/actions.cpp index 308eedc18f..a4b7401415 100644 --- a/common/tool/actions.cpp +++ b/common/tool/actions.cpp @@ -623,4 +623,5 @@ const TOOL_EVENT EVENTS::UnselectedEvent( TC_MESSAGE, TA_ACTION, "common.Interac const TOOL_EVENT EVENTS::ClearedEvent( TC_MESSAGE, TA_ACTION, "common.Interactive.cleared" ); const TOOL_EVENT EVENTS::SelectedItemsModified( TC_MESSAGE, TA_ACTION, "common.Interactive.modified" ); +const TOOL_EVENT EVENTS::SelectedItemsMoved( TC_MESSAGE, TA_ACTION, "common.Interactive.moved" ); diff --git a/include/tool/actions.h b/include/tool/actions.h index 706622416e..39c3f5d058 100644 --- a/include/tool/actions.h +++ b/include/tool/actions.h @@ -204,7 +204,11 @@ public: const static TOOL_EVENT UnselectedEvent; const static TOOL_EVENT ClearedEvent; + //< Selected item had a property changed (except movement) const static TOOL_EVENT SelectedItemsModified; + + //< Selected items were moved, this can be very high frequency on the canvas, use with care + const static TOOL_EVENT SelectedItemsMoved; }; #endif // __ACTIONS_H diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 4c387ce21d..181fb92550 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -436,6 +436,8 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference ) if( !item->GetParent() || !item->GetParent()->IsSelected() ) static_cast( item )->Move( movement ); } + + m_toolMgr->PostEvent( EVENTS::SelectedItemsMoved ); } else if( !m_dragging ) // Prepare to start dragging { @@ -546,8 +548,6 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference ) prevPos = m_cursor; controls->SetAutoPan( true ); - - // only post event while we arent dragging m_toolMgr->PostEvent( EVENTS::SelectedItemsModified ); } diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 05a6866f52..8d25565ba9 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -2606,4 +2606,5 @@ void SELECTION_TOOL::setTransitions() Go( &SELECTION_TOOL::selectSameSheet, PCB_ACTIONS::selectSameSheet.MakeEvent() ); Go( &SELECTION_TOOL::selectSheetContents, PCB_ACTIONS::selectOnSheetFromEeschema.MakeEvent() ); Go( &SELECTION_TOOL::updateSelection, EVENTS::SelectedItemsModified ); + Go( &SELECTION_TOOL::updateSelection, EVENTS::SelectedItemsMoved ); }