pcbnew: Fix launching of action plugins from an action menu

The action menu handler was capturing too many menuitem events.
Only context menuitem highlight events and some popup menu events need to be captured
Any id < 0 (like automatically assigned menuitem id) is no longer captured.

Fixes: lp:1831669
https://bugs.launchpad.net/kicad/+bug/1831669
This commit is contained in:
jean-pierre charras 2019-06-05 11:14:31 +02:00
parent 3cb90063a1
commit 6f8a0a4eed
1 changed files with 5 additions and 1 deletions

View File

@ -399,7 +399,11 @@ void ACTION_MENU::OnMenuEvent( wxMenuEvent& aEvent )
// Handling non-action menu entries (e.g. items in clarification list)
// in some context menus, that have IDs explicitly chosen between
// ID_POPUP_MENU_START and ID_POPUP_MENU_END
if( !evt && ( m_selected < wxID_LOWEST ||
// Note also items in clarification list have an id >= 0 and < wxID_LOWEST
// in fact 0 to n-1 for n items in clarification list)
// id < 0 are automatically created for menuitems created with wxID_ANY
#define ID_CONTEXT_MENU_ID_MAX wxID_LOWEST /* = 100 should be enough and better */
if( !evt && ( ( m_selected >=0 && m_selected < ID_CONTEXT_MENU_ID_MAX ) ||
( m_selected >= ID_POPUP_MENU_START &&
m_selected <= ID_POPUP_MENU_END )
)