Commit 9b99ac2a authored by jean-pierre charras's avatar jean-pierre charras

All: add 2 hotkeys to simulate a mouse left click (key return) and left dclick (key end)

parent 4eec9fd0
......@@ -175,7 +175,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event )
/** OnRightClickOnCell
* If a cell is selected, display a list of keys for selection
* The list is restricted to keys that cannot be entered:
* tab, home ... because these keys have special functions in dialogs
* tab, home, return ... because these keys have special functions in dialogs
*/
void HOTKEYS_EDITOR_DIALOG::OnRightClickOnCell( wxGridEvent& event )
{
......@@ -186,8 +186,8 @@ void HOTKEYS_EDITOR_DIALOG::OnRightClickOnCell( wxGridEvent& event )
return;
// Do not translate these key names. They are internally used.
//ee hotkeys_basic.cpp
#define C_COUNT 8
// See hotkeys_basic.cpp
#define C_COUNT 9
wxString choices[C_COUNT] =
{
wxT("End")
......@@ -198,6 +198,7 @@ void HOTKEYS_EDITOR_DIALOG::OnRightClickOnCell( wxGridEvent& event )
wxT("Space"),
wxT("Ctrl+Space"),
wxT("Alt+Space"),
wxT("Return")
};
wxString keyname = wxGetSingleChoice( _( "Special keys only. For others keys, use keyboard" ),
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <hotkey_grid_table.h>
/*
......
......@@ -133,6 +133,8 @@ static struct hotkey_name_descr s_Hotkey_Name_List[] =
{ wxT( "Left" ), WXK_LEFT },
{ wxT( "Right" ), WXK_RIGHT },
{ wxT( "Return" ), WXK_RETURN },
{ wxT( "Space" ), WXK_SPACE },
// Do not change this line: end of list
......
......@@ -128,6 +128,10 @@ static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL + 'Z'
(int) wxID_REDO );
#endif
// mouse click command:
static EDA_HOTKEY HkMouseLeftClick( wxT( "Mouse Left Click" ), HK_LEFT_CLICK, WXK_RETURN, 0 );
static EDA_HOTKEY HkMouseLeftDClick( wxT( "Mouse Left DClick" ), HK_LEFT_DCLICK, WXK_END, 0 );
// Schematic editor
static EDA_HOTKEY HkBeginWire( wxT( "Begin Wire" ), HK_BEGIN_WIRE, 'W', ID_WIRE_BUTT );
static EDA_HOTKEY HkBeginBus( wxT( "Begin Bus" ), HK_BEGIN_BUS, 'B', ID_BUS_BUTT );
......@@ -191,6 +195,8 @@ static EDA_HOTKEY HkDelete( wxT( "Delete Item" ), HK_DELETE, WXK_DELETE );
static EDA_HOTKEY HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL, ID_FIND_ITEMS );
static EDA_HOTKEY HkFindNextItem( wxT( "Find Next Item" ), HK_FIND_NEXT_ITEM, WXK_F5,
wxEVT_COMMAND_FIND );
static EDA_HOTKEY HkFindReplace( wxT( "Find and Replace" ), HK_FIND_REPLACE,
'F' + GR_KB_CTRL + GR_KB_ALT, wxID_REPLACE );
static EDA_HOTKEY HkFindNextDrcMarker( wxT( "Find Next DRC Marker" ), HK_FIND_NEXT_DRC_MARKER,
WXK_F5 + GR_KB_SHIFT, EVT_COMMAND_FIND_DRC_MARKER );
......@@ -220,6 +226,8 @@ EDA_HOTKEY* s_Common_Hotkey_List[] =
&HkDrag,
&HkUndo,
&HkRedo,
&HkMouseLeftClick,
&HkMouseLeftDClick,
NULL
};
......@@ -231,6 +239,7 @@ EDA_HOTKEY* s_Schematic_Hotkey_List[] =
&HkFindItem,
&HkFindNextItem,
&HkFindNextDrcMarker,
&HkFindReplace,
&HkInsert,
&HkMove2Drag,
&HkSaveBlock,
......@@ -361,6 +370,15 @@ void SCH_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:
......@@ -395,6 +413,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
case HK_UNDO:
case HK_REDO:
case HK_FIND_ITEM:
case HK_FIND_REPLACE:
if( notBusy )
{
cmd.SetId( hotKey->m_IdMenuEvent );
......@@ -558,6 +577,15 @@ void 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:
......
......@@ -13,6 +13,7 @@ enum hotkey_id_commnand {
HK_FIND_NEXT_ITEM = HK_COMMON_END,
HK_FIND_NEXT_DRC_MARKER,
HK_FIND_ITEM,
HK_FIND_REPLACE,
HK_DELETE,
HK_REPEAT_LAST,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM,
......@@ -48,7 +49,9 @@ enum hotkey_id_commnand {
HK_ADD_NOCONN_FLAG,
HK_SAVE_LIB,
HK_SAVE_SCH,
HK_LOAD_SCH
HK_LOAD_SCH,
HK_LEFT_CLICK,
HK_LEFT_DCLICK
};
// List of hotkey descriptors for Eeschema
......
......@@ -213,7 +213,9 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
AddMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND, KiBitmap( find_xpm ) );
// Find/Replace
AddMenuItem( editMenu, wxID_REPLACE, _( "Find and Re&place\tCtrl+Shift+F" ), HELP_REPLACE,
text = AddHotkeyName( _( "Find and Re&place" ), s_Schematic_Hokeys_Descr,
HK_FIND_REPLACE );
AddMenuItem( editMenu, wxID_REPLACE, text, HELP_REPLACE,
KiBitmap( find_replace_xpm ) );
// Import footprint association from the CvPcb cmp file:
......
......@@ -55,8 +55,12 @@
* and see this list for some ascii keys (space ...)
*/
/* local variables */
/* Hotkey list: */
// Hotkey list:
// mouse click command:
static EDA_HOTKEY HkMouseLeftClick( wxT( "Mouse Left Click" ), HK_LEFT_CLICK, WXK_RETURN, 0 );
static EDA_HOTKEY HkMouseLeftDClick( wxT( "Mouse Left DClick" ), HK_LEFT_DCLICK, WXK_END, 0 );
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ),
HK_RESET_LOCAL_COORD, ' ' );
static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME, ID_ZOOM_PAGE );
......@@ -67,6 +71,7 @@ static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_POPUP
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_POPUP_ZOOM_IN );
static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
static EDA_HOTKEY HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M', ID_POPUP_ITEM_MOVE );
static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P', ID_POPUP_ITEM_PLACE );
static EDA_HOTKEY HkMoveStartPoint( wxT( "Move Start Point" ), HK_MOVE_START_POINT, 'S',
ID_POPUP_ITEM_MOVE_START_POINT );
static EDA_HOTKEY HkMoveEndPoint( wxT( "Move End Point" ), HK_MOVE_END_POINT, 'E',
......@@ -85,13 +90,17 @@ EDA_HOTKEY* s_Common_Hotkey_List[] =
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkZoomAuto, &HkResetLocalCoord,
&HkUndo, &HkRedo,
&HkMouseLeftClick,
&HkMouseLeftDClick,
NULL
};
EDA_HOTKEY* s_PlEditor_Hotkey_List[] =
{
&HkMoveItem, &HkMoveStartPoint,
&HkMoveEndPoint, &HkDeleteItem,
&HkMoveEndPoint,
&HkPlaceItem,
&HkDeleteItem,
NULL
};
......@@ -142,6 +151,15 @@ void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode,
case HK_NOT_FOUND:
return;
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_HELP: // Display Current hotkey list
DisplayHotkeyList( this, s_PlEditor_Hokeys_Descr );
break;
......@@ -208,6 +226,14 @@ void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode,
GetEventHandler()->ProcessEvent( cmd );
break;
case HK_PLACE_ITEM:
if( busy )
{
cmd.SetId( HK_Descr->m_IdMenuEvent );
GetEventHandler()->ProcessEvent( cmd );
}
break;
default:
wxMessageBox( wxT("Unknown hotkey") );
return;
......
......@@ -39,7 +39,10 @@ enum hotkey_id_commnand {
HK_MOVE_ITEM,
HK_MOVE_START_POINT,
HK_MOVE_END_POINT,
HK_DELETE_ITEM
HK_PLACE_ITEM,
HK_DELETE_ITEM,
HK_LEFT_CLICK,
HK_LEFT_DCLICK
};
// List of hotkey descriptors for PlEditor.
......
......@@ -108,7 +108,9 @@ bool PL_EDITOR_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
}
else // An item is currently in edit
{
AddMenuItem( aPopMenu, ID_POPUP_ITEM_PLACE, _( "Place" ),
msg = AddHotkeyName( _( "Place Item" ), s_PlEditor_Hokeys_Descr,
HK_PLACE_ITEM );
AddMenuItem( aPopMenu, ID_POPUP_ITEM_PLACE, msg,
KiBitmap( move_xpm ) );
AddMenuItem( aPopMenu, ID_POPUP_ITEM_PLACE_CANCEL, _( "Cancel" ),
KiBitmap( cancel_xpm ) );
......
......@@ -29,8 +29,14 @@
* and see this list for some ascii keys (space ...)
*/
/* local variables */
/* Hotkey list: */
// Hotkey list:
// mouse click command:
static EDA_HOTKEY HkMouseLeftClick( wxT( "Mouse Left Click" ),
HK_LEFT_CLICK, WXK_RETURN, 0 );
static EDA_HOTKEY HkMouseLeftDClick( wxT( "Mouse Left DClick" ),
HK_LEFT_DCLICK, WXK_END, 0 );
static EDA_HOTKEY HkSwitch2CopperLayer( wxT( "Switch to Copper layer" ),
HK_SWITCH_LAYER_TO_COPPER, WXK_PAGEDOWN );
static EDA_HOTKEY HkSwitch2ComponentLayer( wxT( "Switch to Component layer" ),
......@@ -70,7 +76,6 @@ static EDA_HOTKEY HkSelLayerAndAddBlindBuriedVia( wxT( "Sel Layer and Add Blind/
static EDA_HOTKEY HkSwitchTrackPosture( wxT( "Switch Track Posture" ), HK_SWITCH_TRACK_POSTURE, '/' );
static EDA_HOTKEY HkDragTrackKeepSlope( wxT( "Drag track keep slope" ), HK_DRAG_TRACK_KEEP_SLOPE, 'D' );
static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' );
static EDA_HOTKEY HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
static EDA_HOTKEY HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' );
static EDA_HOTKEY HkFlipItem( wxT( "Flip Item" ), HK_FLIP_ITEM, 'F' );
static EDA_HOTKEY HkRotateItem( wxT( "Rotate Item" ), HK_ROTATE_ITEM, 'R' );
......@@ -211,6 +216,8 @@ EDA_HOTKEY* common_Hotkey_List[] =
&HkZoomRedraw, &HkZoomCenter, &HkZoomAuto,
&HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin, &HkResetGridOrigin,
&HkUndo, &HkRedo,
&HkMouseLeftClick,
&HkMouseLeftDClick,
NULL
};
......@@ -225,7 +232,8 @@ EDA_HOTKEY* board_edit_Hotkey_List[] =
&HkSwitchTrackPosture,
&HkDragTrackKeepSlope,
&HkPlaceItem, &HkCopyItem,
&HkEndTrack, &HkMoveItem, &HkFlipItem,
&HkMoveItem,
&HkFlipItem,
&HkRotateItem, &HkDragFootprint,
&HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile, &HkSavefileAs,
&HkLoadfile, &HkFindItem, &HkEditBoardItem,
......
......@@ -28,7 +28,6 @@ enum hotkey_id_commnand {
HK_ADD_MICROVIA,
HK_SWITCH_TRACK_POSTURE,
HK_DRAG_TRACK_KEEP_SLOPE,
HK_END_TRACK,
HK_SAVE_BOARD,
HK_SAVE_BOARD_AS,
HK_LOAD_BOARD,
......@@ -90,6 +89,8 @@ enum hotkey_id_commnand {
HK_CANVAS_DEFAULT,
HK_CANVAS_OPENGL,
HK_CANVAS_CAIRO,
HK_LEFT_CLICK,
HK_LEFT_DCLICK
};
// Full list of hotkey descriptors for board editor and footprint editor
......
......@@ -161,6 +161,15 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
return;
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_RECORD_MACROS_0:
case HK_RECORD_MACROS_1:
case HK_RECORD_MACROS_2:
......@@ -428,16 +437,6 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break;
case HK_END_TRACK:
if( itemCurrentlyEdited && GetCurItem()->IsTrack() && GetCurItem()->IsNew() )
{
// A new track is in progress: call to End_Route()
m_canvas->MoveCursorToCrossHair();
End_Route( (TRACK*) GetCurItem(), aDC );
}
break;
case HK_GET_AND_MOVE_FOOTPRINT:
if( !itemCurrentlyEdited )
evt_type = ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST;
......
......@@ -58,6 +58,15 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
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_SET_GRID_ORIGIN:
SetGridOrigin( GetCrossHairPosition() );
m_canvas->Refresh();
......
......@@ -520,7 +520,7 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
{
if( flags & IS_NEW )
{
msg = AddHotkeyName( _( "End Track" ), g_Board_Editor_Hokeys_Descr, HK_END_TRACK );
msg = AddHotkeyName( _( "End Track" ), g_Board_Editor_Hokeys_Descr, HK_LEFT_DCLICK );
AddMenuItem( PopMenu, ID_POPUP_PCB_END_TRACK, msg, KiBitmap( checked_ok_xpm ) );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment