Left Mouse Button: use same modifiers for Pcbnew, Eeschema and pleditor for selection.

It also means the "force disambiguation menu" uses now Ctrl in Eeschema and pleditor.
This commit is contained in:
jean-pierre charras 2021-02-24 20:26:50 +01:00
parent bba7fae104
commit 9797bc5f25
6 changed files with 131 additions and 35 deletions

View File

@ -105,7 +105,7 @@ PANEL_EESCHEMA_EDITING_OPTIONS_BASE::PANEL_EESCHEMA_EDITING_OPTIONS_BASE( wxWind
m_staticText101->Wrap( -1 );
fgSizerCmdsWinLin->Add( m_staticText101, 0, wxALL, 5 );
m_staticText131 = new wxStaticText( m_mouseCmdsWinLin->GetStaticBox(), wxID_ANY, _("Ctrl"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText131 = new wxStaticText( m_mouseCmdsWinLin->GetStaticBox(), wxID_ANY, _("Alt"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText131->Wrap( -1 );
fgSizerCmdsWinLin->Add( m_staticText131, 0, wxALL, 5 );
@ -113,7 +113,7 @@ PANEL_EESCHEMA_EDITING_OPTIONS_BASE::PANEL_EESCHEMA_EDITING_OPTIONS_BASE( wxWind
m_staticText141->Wrap( -1 );
fgSizerCmdsWinLin->Add( m_staticText141, 0, wxALL, 5 );
m_staticText151 = new wxStaticText( m_mouseCmdsWinLin->GetStaticBox(), wxID_ANY, _("Ctrl+Shift"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText151 = new wxStaticText( m_mouseCmdsWinLin->GetStaticBox(), wxID_ANY, _("Alt+Shift"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText151->Wrap( -1 );
fgSizerCmdsWinLin->Add( m_staticText151, 0, wxALL, 5 );
@ -121,7 +121,7 @@ PANEL_EESCHEMA_EDITING_OPTIONS_BASE::PANEL_EESCHEMA_EDITING_OPTIONS_BASE( wxWind
m_staticText161->Wrap( -1 );
fgSizerCmdsWinLin->Add( m_staticText161, 0, wxALL, 5 );
m_staticText111 = new wxStaticText( m_mouseCmdsWinLin->GetStaticBox(), wxID_ANY, _("Alt"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText111 = new wxStaticText( m_mouseCmdsWinLin->GetStaticBox(), wxID_ANY, _("Ctrl"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText111->Wrap( -1 );
fgSizerCmdsWinLin->Add( m_staticText111, 0, wxALL, 5 );

View File

@ -43,7 +43,7 @@
<property name="minimum_size"></property>
<property name="name">PANEL_EESCHEMA_EDITING_OPTIONS_BASE</property>
<property name="pos"></property>
<property name="size">661,584</property>
<property name="size">661,649</property>
<property name="subclass">; forward_declare</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
@ -929,7 +929,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Ctrl</property>
<property name="label">Alt</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@ -1051,7 +1051,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Ctrl+Shift</property>
<property name="label">Alt+Shift</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@ -1173,7 +1173,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Alt</property>
<property name="label">Ctrl</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>

View File

@ -80,7 +80,7 @@ class PANEL_EESCHEMA_EDITING_OPTIONS_BASE : public wxPanel
public:
PANEL_EESCHEMA_EDITING_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 661,584 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_EESCHEMA_EDITING_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 661,649 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_EESCHEMA_EDITING_OPTIONS_BASE();
};

View File

@ -324,22 +324,73 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
bool displayBusCursor = false;
bool displayLineCursor = false;
KIID rolloverItem = lastRolloverItem;
m_additive = m_subtractive = m_exclusive_or = false;
if( evt->Modifier( MD_SHIFT ) && evt->Modifier( MD_CTRL ) )
m_subtractive = true;
else if( evt->Modifier( MD_SHIFT ) )
m_additive = true;
else if( evt->Modifier( MD_CTRL ) )
m_exclusive_or = true;
// on left click, a selection is made, depending on modifiers ALT, SHIFT, CTRL:
// Due to the fact ALT key modifier cannot be useed freely on Winows and Linux,
// actions are different on OSX and others OS
// Especially, ALT key cannot be used to force showing the full selection choice
// context menu (the menu is immediately closed on Windows )
//
// No modifier = select items and deselect previous selection
// ALT (on OSX) = skip heuristic and show full selection choice
// ALT (on others) = exclusive OR of selected items (inverse selection)
//
// CTRL/CMD (on OSX) = exclusive OR of selected items (inverse selection)
// CTRL (on others) = skip heuristic and show full selection choice
//
// SHIFT = add selected items to the current selection
//
// CTRL/CMD+SHIFT (on OSX) = remove selected items to the current selection
// CTRL+SHIFT (on others) = unused (can be used for a new action)
//
// CTRL/CMT+ALT (on OSX) = unused (can be used for a new action)
// CTRL+ALT (on others) = do nothing (same as no modifier)
//
// SHIFT+ALT (on OSX) = do nothing (same as no modifier)
// SHIFT+ALT (on others) = remove selected items to the current selection
bool modifier_enabled = m_subtractive || m_additive || m_exclusive_or;
MOUSE_DRAG_ACTION drag_action = m_frame->GetDragAction();
#ifdef __WXOSX_MAC__
m_subtractive = evt->Modifier( MD_CTRL ) &&
evt->Modifier( MD_SHIFT ) &&
!evt->Modifier( MD_ALT );
m_additive = evt->Modifier( MD_SHIFT ) &&
!evt->Modifier( MD_CTRL ) &&
!evt->Modifier( MD_ALT );
m_exclusive_or = evt->Modifier( MD_CTRL ) &&
!evt->Modifier( MD_SHIFT ) &&
!evt->Modifier( MD_ALT );
m_skip_heuristics = evt->Modifier( MD_ALT ) &&
!evt->Modifier( MD_SHIFT ) &&
!evt->Modifier( MD_CTRL );
#else
m_subtractive = evt->Modifier( MD_SHIFT )
&& !evt->Modifier( MD_CTRL )
&& evt->Modifier( MD_ALT );
m_additive = evt->Modifier( MD_SHIFT )
&& !evt->Modifier( MD_CTRL )
&& !evt->Modifier( MD_ALT );
m_exclusive_or = !evt->Modifier( MD_SHIFT )
&& !evt->Modifier( MD_CTRL )
&& evt->Modifier( MD_ALT );
// Is the user requesting that the selection list include all possible
// items without removing less likely selection candidates
m_skip_heuristics = !!evt->Modifier( MD_ALT );
// Cannot use the Alt key on windows or the disambiguation context menu is immediately
// dismissed rendering it useless.
m_skip_heuristics = evt->Modifier( MD_CTRL )
&& !evt->Modifier( MD_SHIFT )
&& !evt->Modifier( MD_ALT );
#endif
bool modifier_enabled = m_subtractive || m_additive || m_exclusive_or;
MOUSE_DRAG_ACTION drag_action = m_frame->GetDragAction();
EE_GRID_HELPER grid( m_toolMgr );
// Single click? Select single object

View File

@ -14,10 +14,9 @@
<property name="file">properties_frame_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">properties_frame</property>
<property name="name">properties_frame_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
@ -26,7 +25,6 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
@ -45,7 +43,7 @@
<property name="minimum_size"></property>
<property name="name">PANEL_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="size">309,888</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
@ -4016,7 +4014,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -4979,7 +4976,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@ -5869,7 +5865,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 CERN
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2021 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
@ -106,20 +106,70 @@ int PL_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
// Main loop: keep receiving events
while( TOOL_EVENT* evt = Wait() )
{
m_additive = m_subtractive = m_exclusive_or = false;
// on left click, a selection is made, depending on modifiers ALT, SHIFT, CTRL:
// Due to the fact ALT key modifier cannot be useed freely on Winows and Linux,
// actions are different on OSX and others OS
// Especially, ALT key cannot be used to force showing the full selection choice
// context menu (the menu is immediately closed on Windows )
//
// No modifier = select items and deselect previous selection
// ALT (on OSX) = skip heuristic and show full selection choice
// ALT (on others) = exclusive OR of selected items (inverse selection)
//
// CTRL/CMD (on OSX) = exclusive OR of selected items (inverse selection)
// CTRL (on others) = skip heuristic and show full selection choice
//
// SHIFT = add selected items to the current selection
//
// CTRL/CMD+SHIFT (on OSX) = remove selected items to the current selection
// CTRL+SHIFT (on others) = unused (can be used for a new action)
//
// CTRL/CMT+ALT (on OSX) = unused (can be used for a new action)
// CTRL+ALT (on others) = do nothing (same as no modifier)
//
// SHIFT+ALT (on OSX) = do nothing (same as no modifier)
// SHIFT+ALT (on others) = remove selected items to the current selection
if( evt->Modifier( MD_SHIFT ) && evt->Modifier( MD_CTRL ) )
m_subtractive = true;
else if( evt->Modifier( MD_SHIFT ) )
m_additive = true;
else if( evt->Modifier( MD_CTRL ) )
m_exclusive_or = true;
#ifdef __WXOSX_MAC__
m_subtractive = evt->Modifier( MD_CTRL ) &&
evt->Modifier( MD_SHIFT ) &&
!evt->Modifier( MD_ALT );
bool modifier_enabled = m_subtractive || m_additive || m_exclusive_or;
m_additive = evt->Modifier( MD_SHIFT ) &&
!evt->Modifier( MD_CTRL ) &&
!evt->Modifier( MD_ALT );
m_exclusive_or = evt->Modifier( MD_CTRL ) &&
!evt->Modifier( MD_SHIFT ) &&
!evt->Modifier( MD_ALT );
m_skip_heuristics = evt->Modifier( MD_ALT ) &&
!evt->Modifier( MD_SHIFT ) &&
!evt->Modifier( MD_CTRL );
#else
m_subtractive = evt->Modifier( MD_SHIFT )
&& !evt->Modifier( MD_CTRL )
&& evt->Modifier( MD_ALT );
m_additive = evt->Modifier( MD_SHIFT )
&& !evt->Modifier( MD_CTRL )
&& !evt->Modifier( MD_ALT );
m_exclusive_or = !evt->Modifier( MD_SHIFT )
&& !evt->Modifier( MD_CTRL )
&& evt->Modifier( MD_ALT );
// Is the user requesting that the selection list include all possible
// items without removing less likely selection candidates
m_skip_heuristics = !!evt->Modifier( MD_ALT );
// Cannot use the Alt key on windows or the disambiguation context menu is immediately
// dismissed rendering it useless.
m_skip_heuristics = evt->Modifier( MD_CTRL )
&& !evt->Modifier( MD_SHIFT )
&& !evt->Modifier( MD_ALT );
#endif
bool modifier_enabled = m_subtractive || m_additive || m_exclusive_or;
// Single click? Select single object
if( evt->IsClick( BUT_LEFT ) )