pcbnew: Add context menu for measure tool

Fixes: lp:1831063
* https://bugs.launchpad.net/kicad/+bug/1831063
This commit is contained in:
Ian McInerney 2019-06-02 11:15:54 +01:00 committed by Seth Hillbrand
parent 81842fc9d0
commit 006d7ddd31
1 changed files with 15 additions and 0 deletions

View File

@ -290,6 +290,21 @@ bool EDIT_TOOL::Init()
menu.AddItem( PCB_ACTIONS::updateFootprints, singleModuleCondition ); menu.AddItem( PCB_ACTIONS::updateFootprints, singleModuleCondition );
menu.AddItem( PCB_ACTIONS::exchangeFootprints, 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<PCB_BASE_FRAME>();
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; return true;
} }