diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 0685bfff25..c9aa312036 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -290,6 +290,21 @@ bool EDIT_TOOL::Init() menu.AddItem( PCB_ACTIONS::updateFootprints, singleModuleCondition ); menu.AddItem( PCB_ACTIONS::exchangeFootprints, singleModuleCondition ); + // Populate the context menu displayed during the edit tool (primarily the measure tool) + auto activeToolCondition = [ this ] ( const SELECTION& aSel ) { + return ( frame()->GetToolId() != ID_NO_TOOL_SELECTED ); + }; + + auto frame = getEditFrame(); + auto& ctxMenu = m_menu.GetMenu(); + + // "Cancel" goes at the top of the context menu when a tool is active + ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1000 ); + ctxMenu.AddSeparator( activeToolCondition, 1000 ); + + if( frame ) + m_menu.AddStandardSubMenus( *frame ); + return true; }