From ef2af9145eb057ea18441185cdedda387eb2cf9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= Date: Mon, 28 Jan 2019 14:17:51 +0100 Subject: [PATCH] eeschema: implement left click emulation with Enter/Return key in library editor Fixes: lp:1788075 * https://bugs.launchpad.net/kicad/+bug/1788075 --- eeschema/hotkeys.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index 032a461f56..f09278d9c5 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -714,15 +714,6 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, GetScreen()->m_O_Curseur = GetCrossHairPosition(); break; - case HK_LEFT_CLICK: - OnLeftClick( aDC, aPosition ); - break; - - case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events - OnLeftClick( aDC, aPosition ); - OnLeftDClick( aDC, aPosition ); - break; - case HK_ZOOM_IN: case HK_ZOOM_OUT: case HK_ZOOM_REDRAW: @@ -871,6 +862,23 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, OnOrient( cmd ); } break; + + case HK_LEFT_CLICK: + case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events + if( GetScreen()->m_BlockLocate.GetState() == STATE_BLOCK_MOVE ) + { + GetCanvas()->SetAutoPanRequest( false ); + HandleBlockPlace( aDC ); + } + else if( GetScreen()->m_BlockLocate.GetState() == STATE_NO_BLOCK ) + { + auto pos = GetCrossHairPosition(); + OnLeftClick( aDC, pos ); + + if( hotKey->m_Idcommand == HK_LEFT_DCLICK ) + OnLeftDClick( aDC, pos ); + } + break; } // Hot key handled.