diff --git a/common/dialogs/dialog_hotkeys_editor.cpp b/common/dialogs/dialog_hotkeys_editor.cpp index bb3b85f523..1c249b7f3c 100644 --- a/common/dialogs/dialog_hotkeys_editor.cpp +++ b/common/dialogs/dialog_hotkeys_editor.cpp @@ -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" ), diff --git a/common/hotkey_grid_table.cpp b/common/hotkey_grid_table.cpp index ecb75182aa..c1f82545f3 100644 --- a/common/hotkey_grid_table.cpp +++ b/common/hotkey_grid_table.cpp @@ -1,3 +1,26 @@ +/* + * 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 /* diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp index 968bcb47ca..5724fe94cd 100644 --- a/common/hotkeys_basic.cpp +++ b/common/hotkeys_basic.cpp @@ -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 diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index f6c83a9afa..b3ec06d534 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -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: diff --git a/eeschema/hotkeys.h b/eeschema/hotkeys.h index b434634181..a68a07dd7b 100644 --- a/eeschema/hotkeys.h +++ b/eeschema/hotkeys.h @@ -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 diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 58ed11c90d..086473b394 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -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: diff --git a/pagelayout_editor/hotkeys.cpp b/pagelayout_editor/hotkeys.cpp index 77ea54bccd..49a9d0e395 100644 --- a/pagelayout_editor/hotkeys.cpp +++ b/pagelayout_editor/hotkeys.cpp @@ -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; diff --git a/pagelayout_editor/hotkeys.h b/pagelayout_editor/hotkeys.h index 37a310116b..f06d129d26 100644 --- a/pagelayout_editor/hotkeys.h +++ b/pagelayout_editor/hotkeys.h @@ -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. diff --git a/pagelayout_editor/onrightclick.cpp b/pagelayout_editor/onrightclick.cpp index 50c2ccf475..fffe735b70 100644 --- a/pagelayout_editor/onrightclick.cpp +++ b/pagelayout_editor/onrightclick.cpp @@ -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 ) ); diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index 173b09fffd..6e63856363 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -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, diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h index 6424e713da..c213c13daf 100644 --- a/pcbnew/hotkeys.h +++ b/pcbnew/hotkeys.h @@ -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 diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index b42f2ddb04..d48f77a2eb 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -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; diff --git a/pcbnew/hotkeys_module_editor.cpp b/pcbnew/hotkeys_module_editor.cpp index 08be819c83..dcaed9df75 100644 --- a/pcbnew/hotkeys_module_editor.cpp +++ b/pcbnew/hotkeys_module_editor.cpp @@ -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(); diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 75d704a889..c66adc4c64 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -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 ) ); }