Fix a bunch of issues with hotkeys, IDs and event processing.
Fixes: lp:1827894 * https://bugs.launchpad.net/kicad/+bug/1827894
This commit is contained in:
parent
e5151ed639
commit
cd2bd23c37
|
@ -162,6 +162,20 @@ const std::string TOOL_EVENT_LIST::Format() const
|
|||
}
|
||||
|
||||
|
||||
bool TOOL_EVENT::IsClick( int aButtonMask ) const
|
||||
{
|
||||
return IsAction( &ACTIONS::cursorClick )
|
||||
|| ( m_actions == TA_MOUSE_CLICK && ( m_mouseButtons & aButtonMask ) == aButtonMask );
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_EVENT::IsDblClick( int aButtonMask ) const
|
||||
{
|
||||
return IsAction( &ACTIONS::cursorDblClick )
|
||||
|| ( m_actions == TA_MOUSE_DBLCLICK && ( m_mouseButtons & aButtonMask ) == aButtonMask );
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_EVT_UTILS::IsCancelInteractive( const TOOL_EVENT& aEvt )
|
||||
{
|
||||
return aEvt.IsAction( &ACTIONS::cancelInteractive )
|
||||
|
|
|
@ -68,6 +68,7 @@ enum id_eeschema_frm
|
|||
|
||||
/* Schematic editor horizontal toolbar IDs */
|
||||
ID_HIERARCHY,
|
||||
ID_SCH_LEAVE_SHEET,
|
||||
ID_TO_LIBVIEW,
|
||||
ID_GET_ANNOTATE,
|
||||
ID_GET_ERC,
|
||||
|
@ -127,31 +128,12 @@ enum id_eeschema_frm
|
|||
ID_TB_OPTIONS_HIDDEN_PINS,
|
||||
ID_TB_OPTIONS_BUS_WIRES_ORIENT,
|
||||
|
||||
/* Schematic editor context menu IDs. */
|
||||
ID_POPUP_START_RANGE,
|
||||
ID_POPUP_SCH_BREAK_WIRE,
|
||||
ID_POPUP_SCH_BEGIN_WIRE,
|
||||
ID_POPUP_SCH_BEGIN_BUS,
|
||||
ID_POPUP_SCH_BEGIN_LINES,
|
||||
ID_POPUP_SCH_RESIZE_SHEET,
|
||||
ID_POPUP_SCH_CLEANUP_SHEET,
|
||||
ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN,
|
||||
ID_POPUP_SCH_EDIT_CONVERT_CMP,
|
||||
ID_POPUP_SCH_ENTER_SHEET,
|
||||
ID_POPUP_SCH_LEAVE_SHEET,
|
||||
ID_POPUP_SCH_SELECT_ON_PCB,
|
||||
ID_POPUP_SCH_ADD_JUNCTION,
|
||||
ID_POPUP_SCH_ADD_LABEL,
|
||||
ID_POPUP_SCH_ADD_GLABEL,
|
||||
ID_POPUP_SCH_ADD_HLABEL,
|
||||
ID_POPUP_END_RANGE,
|
||||
|
||||
// Dynamically bound in AddMenusForBus()
|
||||
ID_POPUP_SCH_UNFOLD_BUS,
|
||||
ID_POPUP_SCH_UNFOLD_BUS_END = ID_POPUP_SCH_UNFOLD_BUS + 64,
|
||||
|
||||
ID_POPUP_SCH_DISPLAYDOC_CMP,
|
||||
ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP,
|
||||
ID_SCH_DISPLAYDOC_CMP,
|
||||
ID_SCH_CALL_LIBEDIT_AND_LOAD_CMP,
|
||||
|
||||
// Unit select context menus command IDs.
|
||||
ID_POPUP_SCH_SELECT_UNIT_CMP,
|
||||
|
@ -180,6 +162,7 @@ enum id_eeschema_frm
|
|||
ID_SCH_DELETE,
|
||||
ID_SCH_END_LINE_WIRE_OR_BUS,
|
||||
ID_SCH_UNFOLD_BUS,
|
||||
ID_SCH_RESIZE_SHEET,
|
||||
|
||||
ID_AUTOPLACE_FIELDS,
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <id.h>
|
||||
#include <eeschema_id.h>
|
||||
#include <hotkeys.h>
|
||||
#include <sch_edit_frame.h>
|
||||
|
@ -117,11 +118,13 @@ static EDA_HOTKEY HkHelp( _HKI( "List Hotkeys" ), HK_HELP, GR_KB_CTRL + WXK_F1 )
|
|||
static EDA_HOTKEY HkPreferences( _HKI( "Preferences" ), HK_PREFERENCES, GR_KB_CTRL + ',', (int) wxID_PREFERENCES );
|
||||
static EDA_HOTKEY HkResetLocalCoord( _HKI( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
|
||||
static EDA_HOTKEY HkLeaveSheet( _HKI( "Leave Sheet" ), HK_LEAVE_SHEET, GR_KB_ALT + WXK_BACK,
|
||||
ID_POPUP_SCH_LEAVE_SHEET );
|
||||
ID_SCH_LEAVE_SHEET );
|
||||
|
||||
// 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 HkMouseLeftClick( _HKI( "Mouse Left Click" ), HK_LEFT_CLICK, WXK_RETURN,
|
||||
ID_MOUSE_CLICK );
|
||||
static EDA_HOTKEY HkMouseLeftDClick( _HKI( "Mouse Left Double Click" ), HK_LEFT_DCLICK, WXK_END,
|
||||
ID_MOUSE_DOUBLECLICK );
|
||||
|
||||
// Schematic editor
|
||||
static EDA_HOTKEY HkBeginWire( _HKI( "Begin Wire" ), HK_BEGIN_WIRE, 'W', ID_WIRE_BUTT );
|
||||
|
@ -167,10 +170,10 @@ static EDA_HOTKEY HkEditComponentFootprint( _HKI( "Edit Symbol Footprint" ),
|
|||
ID_SCH_EDIT_COMPONENT_FOOTPRINT );
|
||||
static EDA_HOTKEY HkShowComponentDatasheet( _HKI( "Show Symbol Datasheet" ),
|
||||
HK_SHOW_COMPONENT_DATASHEET, 'D',
|
||||
ID_POPUP_SCH_DISPLAYDOC_CMP );
|
||||
ID_SCH_DISPLAYDOC_CMP );
|
||||
static EDA_HOTKEY HkEditComponentWithLibedit( _HKI( "Edit with Symbol Editor" ),
|
||||
HK_EDIT_COMPONENT_WITH_LIBEDIT, 'E' + GR_KB_CTRL,
|
||||
ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP );
|
||||
ID_SCH_CALL_LIBEDIT_AND_LOAD_CMP );
|
||||
|
||||
static EDA_HOTKEY HkMove( _HKI( "Move Schematic Item" ), HK_MOVE, 'M',
|
||||
ID_SCH_MOVE );
|
||||
|
|
|
@ -75,8 +75,6 @@ enum hotkey_id_command {
|
|||
HK_ADD_GRAPHIC_TEXT,
|
||||
HK_ADD_GRAPHIC_POLYLINE,
|
||||
HK_ADD_NOCONN_FLAG,
|
||||
HK_LEFT_CLICK,
|
||||
HK_LEFT_DCLICK,
|
||||
HK_LEAVE_SHEET,
|
||||
HK_DELETE_NODE,
|
||||
HK_AUTOPLACE_FIELDS,
|
||||
|
|
|
@ -341,11 +341,9 @@ void LIB_EDIT_FRAME::setupTools()
|
|||
|
||||
// Run the selection tool, it is supposed to be always active
|
||||
// JEY TODO: not ready for modern toolset event processing yet....
|
||||
#if 0
|
||||
m_toolManager->InvokeTool( "eeschema.InteractiveSelection" );
|
||||
//m_toolManager->InvokeTool( "eeschema.InteractiveSelection" );
|
||||
|
||||
GetCanvas()->SetEventDispatcher( m_toolDispatcher );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ void prepareViewMenu( wxMenu* aParentMenu )
|
|||
|
||||
text = AddHotkeyName( _( "&Leave Sheet" ), g_Schematic_Hotkeys_Descr, HK_LEAVE_SHEET );
|
||||
AddMenuItem( aParentMenu,
|
||||
ID_POPUP_SCH_LEAVE_SHEET, text,
|
||||
ID_SCH_LEAVE_SHEET, text,
|
||||
_( "Return to parent schematic sheet" ),
|
||||
KiBitmap( leave_sheet_xpm ) );
|
||||
|
||||
|
|
|
@ -269,6 +269,10 @@ void SCH_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
if( !screen )
|
||||
return;
|
||||
|
||||
// JEY TODO: this whole routine can go once libEdit is moved over to modern toolset
|
||||
if( dynamic_cast<SCH_EDIT_FRAME*>( m_parent ) )
|
||||
return;
|
||||
|
||||
/* Adjust value to filter mouse displacement before consider the drag
|
||||
* mouse is really a drag command, not just a movement while click
|
||||
*/
|
||||
|
|
|
@ -295,7 +295,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
SCH_EDIT_FRAME::OnUpdateSelectTool )
|
||||
EVT_UPDATE_UI( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnUpdateSave )
|
||||
EVT_UPDATE_UI( ID_UPDATE_ONE_SHEET, SCH_EDIT_FRAME::OnUpdateSaveSheet )
|
||||
EVT_UPDATE_UI( ID_POPUP_SCH_LEAVE_SHEET, SCH_EDIT_FRAME::OnUpdateHierarchySheet )
|
||||
EVT_UPDATE_UI( ID_SCH_LEAVE_SHEET, SCH_EDIT_FRAME::OnUpdateHierarchySheet )
|
||||
EVT_UPDATE_UI( ID_REMAP_SYMBOLS, SCH_EDIT_FRAME::OnUpdateRemapSymbols )
|
||||
EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, SCH_EDIT_FRAME::OnUpdateSwitchCanvas )
|
||||
EVT_UPDATE_UI( ID_MENU_CANVAS_OPENGL, SCH_EDIT_FRAME::OnUpdateSwitchCanvas )
|
||||
|
|
|
@ -132,7 +132,7 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
|
|||
_( "Navigate schematic hierarchy" ) );
|
||||
|
||||
|
||||
m_mainToolBar->AddTool( ID_POPUP_SCH_LEAVE_SHEET, wxEmptyString,
|
||||
m_mainToolBar->AddTool( ID_SCH_LEAVE_SHEET, wxEmptyString,
|
||||
KiScaledBitmap( leave_sheet_xpm, this ), _( "Leave sheet" ) );
|
||||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
|
|
|
@ -196,7 +196,7 @@ OPT<TOOL_EVENT> SCH_ACTIONS::TranslateLegacyId( int aId )
|
|||
case ID_AUTOPLACE_FIELDS:
|
||||
return SCH_ACTIONS::autoplaceFields.MakeEvent();
|
||||
|
||||
case ID_POPUP_SCH_LEAVE_SHEET:
|
||||
case ID_SCH_LEAVE_SHEET:
|
||||
return SCH_ACTIONS::leaveSheet.MakeEvent();
|
||||
|
||||
case ID_HOTKEY_SELECT_NODE:
|
||||
|
@ -207,6 +207,12 @@ OPT<TOOL_EVENT> SCH_ACTIONS::TranslateLegacyId( int aId )
|
|||
|
||||
case ID_SCH_UNFOLD_BUS:
|
||||
return SCH_ACTIONS::unfoldBus.MakeEvent();
|
||||
|
||||
case ID_MOUSE_CLICK:
|
||||
return SCH_ACTIONS::cursorClick.MakeEvent();
|
||||
|
||||
case ID_MOUSE_DOUBLECLICK:
|
||||
return SCH_ACTIONS::cursorDblClick.MakeEvent();
|
||||
}
|
||||
|
||||
return OPT<TOOL_EVENT>();
|
||||
|
|
|
@ -780,7 +780,7 @@ int SCH_DRAWING_TOOL::ResizeSheet( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
SCH_SHEET* sheet = (SCH_SHEET*) selection.Front();
|
||||
|
||||
m_frame->SetToolID( ID_POPUP_SCH_RESIZE_SHEET, wxCURSOR_PENCIL, _( "Resize sheet" ) );
|
||||
m_frame->SetToolID( ID_SCH_RESIZE_SHEET, wxCURSOR_PENCIL, _( "Resize sheet" ) );
|
||||
doDrawSheet( sheet );
|
||||
}
|
||||
|
||||
|
@ -818,7 +818,7 @@ int SCH_DRAWING_TOOL::doDrawSheet( SCH_SHEET *aSheet )
|
|||
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection, true );
|
||||
m_view->ClearPreview();
|
||||
|
||||
if( m_frame->GetToolId() == ID_POPUP_SCH_RESIZE_SHEET )
|
||||
if( m_frame->GetToolId() == ID_SCH_RESIZE_SHEET )
|
||||
{
|
||||
m_frame->RollbackSchematicFromUndo();
|
||||
// resize sheet is a single-shot command, when we're done we're done
|
||||
|
@ -871,7 +871,7 @@ int SCH_DRAWING_TOOL::doDrawSheet( SCH_SHEET *aSheet )
|
|||
|
||||
aSheet = nullptr;
|
||||
|
||||
if( m_frame->GetToolId() == ID_POPUP_SCH_RESIZE_SHEET )
|
||||
if( m_frame->GetToolId() == ID_SCH_RESIZE_SHEET )
|
||||
break; // resize sheet is a single-shot command; when we're done we're done
|
||||
}
|
||||
}
|
||||
|
|
|
@ -399,6 +399,9 @@ bool SCH_EDIT_TOOL::Init()
|
|||
drawingTool->GetToolMenu().AddSubMenu( symUnitMenu2 );
|
||||
drawMenu.AddMenu( symUnitMenu2.get(), false, SCH_CONDITIONS::SingleMultiUnitSymbol, 1 );
|
||||
|
||||
drawMenu.AddItem( SCH_ACTIONS::editWithSymbolEditor,
|
||||
singleComponentCondition && SCH_CONDITIONS::Idle, 200 );
|
||||
|
||||
drawMenu.AddItem( SCH_ACTIONS::toShapeSlash, entryCondition, 200 );
|
||||
drawMenu.AddItem( SCH_ACTIONS::toShapeBackslash, entryCondition, 200 );
|
||||
drawMenu.AddItem( SCH_ACTIONS::toLabel, anyTextTool && SCH_CONDITIONS::Idle, 200 );
|
||||
|
@ -432,6 +435,9 @@ bool SCH_EDIT_TOOL::Init()
|
|||
m_selectionTool->GetToolMenu().AddSubMenu( symUnitMenu3 );
|
||||
selToolMenu.AddMenu( symUnitMenu3.get(), false, SCH_CONDITIONS::SingleMultiUnitSymbol, 1 );
|
||||
|
||||
selToolMenu.AddItem( SCH_ACTIONS::editWithSymbolEditor,
|
||||
singleComponentCondition && SCH_CONDITIONS::Idle, 200 );
|
||||
|
||||
selToolMenu.AddItem( SCH_ACTIONS::toShapeSlash, entryCondition, 200 );
|
||||
selToolMenu.AddItem( SCH_ACTIONS::toShapeBackslash, entryCondition, 200 );
|
||||
selToolMenu.AddItem( SCH_ACTIONS::toLabel, toLabelCondition, 200 );
|
||||
|
|
|
@ -417,7 +417,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
selection.ClearReferencePoint();
|
||||
|
||||
for( auto item : selection )
|
||||
item->ClearFlags( IS_MOVED );
|
||||
item->ClearFlags( item->GetEditFlags() );
|
||||
|
||||
if( unselect )
|
||||
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection, true );
|
||||
|
|
|
@ -284,6 +284,8 @@ enum common_hotkey_id_command {
|
|||
HK_ZOOM_CENTER,
|
||||
HK_ZOOM_AUTO,
|
||||
HK_ZOOM_SELECTION,
|
||||
HK_LEFT_CLICK,
|
||||
HK_LEFT_DCLICK,
|
||||
HK_PREFERENCES,
|
||||
HK_TOGGLE_CURSOR,
|
||||
HK_MEASURE_TOOL,
|
||||
|
|
|
@ -258,6 +258,7 @@ enum main_id
|
|||
ID_PAN_LEFT,
|
||||
ID_PAN_RIGHT,
|
||||
|
||||
ID_MOUSE_CLICK,
|
||||
ID_MOUSE_DOUBLECLICK,
|
||||
|
||||
ID_GET_NETLIST,
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <iterator>
|
||||
|
||||
#include <math/vector2d.h>
|
||||
|
||||
#include <core/optional.h>
|
||||
|
||||
#ifdef WX_COMPATIBILITY
|
||||
|
@ -274,26 +273,18 @@ public:
|
|||
return m_mouseButtons;
|
||||
}
|
||||
|
||||
bool IsClick( int aButtonMask = BUT_ANY ) const
|
||||
{
|
||||
return ( m_actions == TA_MOUSE_CLICK )
|
||||
&& ( ( m_mouseButtons & aButtonMask ) == aButtonMask );
|
||||
}
|
||||
bool IsClick( int aButtonMask = BUT_ANY ) const;
|
||||
|
||||
bool IsDblClick( int aButtonMask = BUT_ANY ) const
|
||||
{
|
||||
return ( m_actions == TA_MOUSE_DBLCLICK )
|
||||
&& ( ( m_mouseButtons & aButtonMask ) == aButtonMask );
|
||||
}
|
||||
bool IsDblClick( int aButtonMask = BUT_ANY ) const;
|
||||
|
||||
bool IsDrag( int aButtonMask = BUT_ANY ) const
|
||||
{
|
||||
return ( m_actions == TA_MOUSE_DRAG ) && ( ( m_mouseButtons & aButtonMask ) == aButtonMask );
|
||||
return m_actions == TA_MOUSE_DRAG && ( m_mouseButtons & aButtonMask ) == aButtonMask;
|
||||
}
|
||||
|
||||
bool IsMouseUp( int aButtonMask = BUT_ANY ) const
|
||||
{
|
||||
return ( m_actions == TA_MOUSE_UP ) && ( ( m_mouseButtons & aButtonMask ) == aButtonMask );
|
||||
return m_actions == TA_MOUSE_UP && ( m_mouseButtons & aButtonMask ) == aButtonMask;
|
||||
}
|
||||
|
||||
bool IsMotion() const
|
||||
|
|
|
@ -40,9 +40,7 @@ enum hotkey_id_command {
|
|||
HK_MOVE_START_POINT,
|
||||
HK_MOVE_END_POINT,
|
||||
HK_PLACE_ITEM,
|
||||
HK_DELETE_ITEM,
|
||||
HK_LEFT_CLICK,
|
||||
HK_LEFT_DCLICK
|
||||
HK_DELETE_ITEM
|
||||
};
|
||||
|
||||
// List of hotkey descriptors for PlEditor.
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <footprint_viewer_frame.h>
|
||||
#include <footprint_wizard_frame.h>
|
||||
#include <pcbnew_id.h>
|
||||
|
||||
#include <hotkeys.h>
|
||||
|
||||
// Remark: the hotkey message info is used as keyword in hotkey config files and
|
||||
|
|
|
@ -116,8 +116,6 @@ enum hotkey_id_command {
|
|||
HK_CANVAS_LEGACY,
|
||||
HK_CANVAS_OPENGL,
|
||||
HK_CANVAS_CAIRO,
|
||||
HK_LEFT_CLICK,
|
||||
HK_LEFT_DCLICK,
|
||||
HK_ZONE_FILL_OR_REFILL,
|
||||
HK_ZONE_REMOVE_FILLED,
|
||||
HK_INC_LAYER_ALPHA,
|
||||
|
|
Loading…
Reference in New Issue