diff --git a/common/dialog_shim.cpp b/common/dialog_shim.cpp index 348c899159..40cfb3720c 100644 --- a/common/dialog_shim.cpp +++ b/common/dialog_shim.cpp @@ -100,7 +100,7 @@ DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& titl { TOOL_MANAGER* toolMgr = static_cast( kiwayHolder )->GetToolManager(); - if( toolMgr ) + if( toolMgr && toolMgr->IsContextMenuActive() ) toolMgr->VetoContextMenuMouseWarp(); } diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp index 6f71fe2cd8..194556cb9d 100644 --- a/common/tool/tool_manager.cpp +++ b/common/tool/tool_manager.cpp @@ -195,6 +195,7 @@ TOOL_MANAGER::TOOL_MANAGER() : m_view( NULL ), m_viewControls( NULL ), m_frame( NULL ), + m_warpMouseAfterContextMenu( true ), m_menuActive( false ), m_menuOwner( -1 ), m_activeState( nullptr ) @@ -487,7 +488,7 @@ void TOOL_MANAGER::ScheduleNextState( TOOL_BASE* aTool, TOOL_STATE_FUNC& aHandle { TOOL_STATE* st = m_toolState[aTool]; - st->transitions.push_back( TRANSITION( aConditions, aHandler ) ); + st->transitions.emplace_back( TRANSITION( aConditions, aHandler ) ); } @@ -634,7 +635,7 @@ bool TOOL_MANAGER::dispatchActivation( const TOOL_EVENT& aEvent ) { wxString cmdStr( *aEvent.GetCommandStr() ); - std::map::iterator tool = m_toolNameIndex.find( *aEvent.GetCommandStr() ); + auto tool = m_toolNameIndex.find( *aEvent.GetCommandStr() ); if( tool != m_toolNameIndex.end() ) { diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index b307166722..c2f998998c 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -80,6 +80,8 @@ private: EE_SELECTION& selection = selTool->GetSelection(); SCH_COMPONENT* component = dynamic_cast( selection.Front() ); + Clear(); + if( !component ) { Append( ID_POPUP_SCH_UNFOLD_BUS, _( "no symbol selected" ), wxEmptyString ); diff --git a/include/tool/tool_manager.h b/include/tool/tool_manager.h index 4cdfa64ead..402329a075 100644 --- a/include/tool/tool_manager.h +++ b/include/tool/tool_manager.h @@ -351,6 +351,14 @@ public: */ const KIGFX::VC_SETTINGS& GetCurrentToolVC() const; + /** + * True while processing a context menu. + */ + bool IsContextMenuActive() + { + return m_menuActive; + } + /** * Disables mouse warping after the current context menu is closed. * Must be called before invoking each context menu.