From ce1f0c164df63c87e3e12673c17b6f8e366c8f8d Mon Sep 17 00:00:00 2001 From: Mudit Joshi Date: Wed, 4 Jul 2018 18:39:56 +0530 Subject: [PATCH] Eeschema: Add shortcut for opening context menu NEW: Adds shortcut in eeschema to open context menu Fixes: lp:1663595 * https://bugs.launchpad.net/kicad/+bug/1663595 --- eeschema/hotkeys.cpp | 20 ++++++++++++++++++++ eeschema/hotkeys.h | 1 + 2 files changed, 21 insertions(+) diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index d3bafd253..7afcf7c0e 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -43,6 +43,7 @@ #include #include +#include // Remark: the hotkey message info is used as keyword in hotkey config files and // as comments in help windows, therefore translated only when displayed @@ -123,6 +124,7 @@ static EDA_HOTKEY HkLeaveSheet( _HKI( "Leave Sheet" ), HK_LEAVE_SHEET, GR_KB_ALT // mouse click command: static EDA_HOTKEY HkMouseLeftClick( _HKI( "Mouse Left Click" ), HK_LEFT_CLICK, WXK_RETURN, 0 ); static EDA_HOTKEY HkMouseLeftDClick( _HKI( "Mouse Left Double Click" ), HK_LEFT_DCLICK, WXK_END, 0 ); +static EDA_HOTKEY HkMouseRightClick( _HKI( "Mouse Right Click" ), HK_RIGHT_CLICK, 'D', 0); // Schematic editor static EDA_HOTKEY HkBeginWire( _HKI( "Begin Wire" ), HK_BEGIN_WIRE, 'W', ID_WIRE_BUTT ); @@ -262,6 +264,7 @@ static EDA_HOTKEY* common_Hotkey_List[] = &HkDrag, &HkMouseLeftClick, &HkMouseLeftDClick, + &HkMouseRightClick, NULL }; @@ -277,6 +280,7 @@ static EDA_HOTKEY* common_basic_Hotkey_List[] = &HkResetLocalCoord, &HkMouseLeftClick, &HkMouseLeftDClick, + &HkMouseRightClick, NULL }; @@ -470,6 +474,22 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, OnLeftDClick( aDC, aPosition ); } break; + case HK_RIGHT_CLICK: + { + wxMenu MasterMenu; + wxPoint pos1 = wxGetMousePosition() , pos2 = GetScreenPosition(); + wxPoint pos = pos1 - pos2; + + if( !OnRightClick( aPosition, &MasterMenu ) ) + return false; + + AddMenuZoomAndGrid( &MasterMenu ); + + m_canvas->SetIgnoreMouseEvents(true); + PopupMenu( &MasterMenu, pos ); + m_canvas->SetIgnoreMouseEvents(false); + } + break; case HK_ZOOM_IN: case HK_ZOOM_OUT: diff --git a/eeschema/hotkeys.h b/eeschema/hotkeys.h index 5b2395349..431ce0b8f 100644 --- a/eeschema/hotkeys.h +++ b/eeschema/hotkeys.h @@ -74,6 +74,7 @@ enum hotkey_id_commnand { HK_SAVE_ALL_LIBS, HK_LEFT_CLICK, HK_LEFT_DCLICK, + HK_RIGHT_CLICK, HK_LEAVE_SHEET, HK_DELETE_NODE, HK_AUTOPLACE_FIELDS, -- 2.18.0