Add action for context menu (right-mouse-click).
Fixes: lp:1663595 * https://bugs.launchpad.net/kicad/+bug/1663595
This commit is contained in:
parent
e1d5cf1a87
commit
fbfcba6e4d
|
@ -119,6 +119,12 @@ TOOL_ACTION ACTIONS::cancelInteractive( "common.Interactive.cancel",
|
|||
_( "Cancel" ), _( "Cancel current tool" ),
|
||||
cancel_xpm, AF_NONE );
|
||||
|
||||
TOOL_ACTION ACTIONS::showContextMenu( "common.Control.showContextMenu",
|
||||
AS_GLOBAL,
|
||||
0, "",
|
||||
_( "Show Context Menu" ), _( "Perform the right-mouse-button action" ),
|
||||
nullptr, AF_NONE, (void*) CURSOR_RIGHT_CLICK );
|
||||
|
||||
TOOL_ACTION ACTIONS::updateMenu( "common.Interactive.updateMenu",
|
||||
AS_GLOBAL );
|
||||
|
||||
|
|
|
@ -77,28 +77,30 @@ int COMMON_TOOLS::CursorControl( const TOOL_EVENT& aEvent )
|
|||
|
||||
case ACTIONS::CURSOR_CLICK: // fall through
|
||||
case ACTIONS::CURSOR_DBL_CLICK:
|
||||
case ACTIONS::CURSOR_RIGHT_CLICK:
|
||||
{
|
||||
TOOL_ACTIONS action = TA_NONE;
|
||||
TOOL_ACTIONS action = TA_MOUSE_CLICK;
|
||||
TOOL_MOUSE_BUTTONS button = BUT_LEFT;
|
||||
int modifiers = 0;
|
||||
|
||||
modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;
|
||||
modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0;
|
||||
modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0;
|
||||
|
||||
if( type == ACTIONS::CURSOR_CLICK )
|
||||
action = TA_MOUSE_CLICK;
|
||||
else if( type == ACTIONS::CURSOR_DBL_CLICK )
|
||||
if( type == ACTIONS::CURSOR_DBL_CLICK )
|
||||
action = TA_MOUSE_DBLCLICK;
|
||||
else
|
||||
wxFAIL;
|
||||
|
||||
TOOL_EVENT evt( TC_MOUSE, action, BUT_LEFT | modifiers );
|
||||
if( type == ACTIONS::CURSOR_RIGHT_CLICK )
|
||||
button = BUT_RIGHT;
|
||||
|
||||
TOOL_EVENT evt( TC_MOUSE, action, button | modifiers );
|
||||
evt.SetMousePosition( getViewControls()->GetCursorPosition() );
|
||||
m_toolMgr->ProcessEvent( evt );
|
||||
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
wxFAIL_MSG( "CursorControl(): unexpected request" );
|
||||
}
|
||||
|
||||
getViewControls()->SetCursorPosition( cursor, true, true );
|
||||
|
@ -521,6 +523,7 @@ void COMMON_TOOLS::setTransitions()
|
|||
|
||||
Go( &COMMON_TOOLS::CursorControl, ACTIONS::cursorClick.MakeEvent() );
|
||||
Go( &COMMON_TOOLS::CursorControl, ACTIONS::cursorDblClick.MakeEvent() );
|
||||
Go( &COMMON_TOOLS::CursorControl, ACTIONS::showContextMenu.MakeEvent() );
|
||||
|
||||
// Pan control
|
||||
Go( &COMMON_TOOLS::PanControl, ACTIONS::panUp.MakeEvent() );
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
|
||||
// Generic edit actions
|
||||
static TOOL_ACTION cancelInteractive;
|
||||
static TOOL_ACTION updateMenu;
|
||||
static TOOL_ACTION showContextMenu;
|
||||
static TOOL_ACTION undo;
|
||||
static TOOL_ACTION redo;
|
||||
static TOOL_ACTION cut;
|
||||
|
@ -71,7 +71,6 @@ public:
|
|||
static TOOL_ACTION paste;
|
||||
static TOOL_ACTION duplicate;
|
||||
static TOOL_ACTION doDelete; // sadly 'delete' is a reserved word
|
||||
static TOOL_ACTION activatePointEditor;
|
||||
|
||||
// Find and Replace
|
||||
static TOOL_ACTION find;
|
||||
|
@ -149,6 +148,10 @@ public:
|
|||
static TOOL_ACTION acceleratedGraphics;
|
||||
static TOOL_ACTION standardGraphics;
|
||||
|
||||
// Internal
|
||||
static TOOL_ACTION updateMenu;
|
||||
static TOOL_ACTION activatePointEditor;
|
||||
|
||||
// Suite
|
||||
static TOOL_ACTION configurePaths;
|
||||
static TOOL_ACTION showSymbolLibTable;
|
||||
|
@ -169,7 +172,8 @@ public:
|
|||
|
||||
///> Cursor control event types
|
||||
enum CURSOR_EVENT_TYPE { CURSOR_UP, CURSOR_DOWN, CURSOR_LEFT, CURSOR_RIGHT,
|
||||
CURSOR_CLICK, CURSOR_DBL_CLICK, CURSOR_FAST_MOVE = 0x8000 };
|
||||
CURSOR_CLICK, CURSOR_DBL_CLICK, CURSOR_RIGHT_CLICK,
|
||||
CURSOR_FAST_MOVE = 0x8000 };
|
||||
|
||||
///> Remove event modifier flags
|
||||
enum class REMOVE_FLAGS { NORMAL = 0x00, ALT = 0x01, CUT = 0x02 };
|
||||
|
|
Loading…
Reference in New Issue