Allow delete whole track in GAL

This commit wires up the as-yet-unused "remove alternate" tool action
and uses it to select copper connections (normally 'U') before deleting
segments.

THis also reverses the sense of Delete and Backspace (Delete used to be
'remove' and Backpace was 'remove alt', now it is reversed). This means
that backspace is the key that removes a segment and Delete removes the
track. This is the same as legacy behaviour. Other delete actions are,
for now, the same between Delete and Backspace.

Fixes: lp:1517213
* https://bugs.launchpad.net/kicad/+bug/1517213
This commit is contained in:
John Beard 2017-02-04 14:45:52 +08:00 committed by Maciej Suminski
parent 0cd121049f
commit 1f9c483535
3 changed files with 22 additions and 4 deletions

View File

@ -136,12 +136,14 @@ TOOL_ACTION COMMON_ACTIONS::mirror( "pcbnew.InteractiveEdit.mirror",
_( "Mirror" ), _( "Mirrors selected item" ), mirror_h_xpm ); _( "Mirror" ), _( "Mirrors selected item" ), mirror_h_xpm );
TOOL_ACTION COMMON_ACTIONS::remove( "pcbnew.InteractiveEdit.remove", TOOL_ACTION COMMON_ACTIONS::remove( "pcbnew.InteractiveEdit.remove",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DELETE ), AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_BACK_SPACE ),
_( "Remove" ), _( "Deletes selected item(s)" ), delete_xpm ); _( "Remove" ), _( "Deletes selected item(s)" ), delete_xpm,
AF_NONE, (void*) REMOVE_FLAGS::NORMAL );
TOOL_ACTION COMMON_ACTIONS::removeAlt( "pcbnew.InteractiveEdit.removeAlt", TOOL_ACTION COMMON_ACTIONS::removeAlt( "pcbnew.InteractiveEdit.removeAlt",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_BACK_SPACE ), AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DELETE ),
_( "Remove (Alternative)" ), _( "Deletes selected item(s)" ), delete_xpm ); _( "Remove (Alternative)" ), _( "Deletes selected item(s)" ), delete_xpm,
AF_NONE, (void*) REMOVE_FLAGS::ALT );
TOOL_ACTION COMMON_ACTIONS::exchangeFootprints( "pcbnew.InteractiveEdit.ExchangeFootprints", TOOL_ACTION COMMON_ACTIONS::exchangeFootprints( "pcbnew.InteractiveEdit.ExchangeFootprints",
AS_GLOBAL, 0, AS_GLOBAL, 0,

View File

@ -359,6 +359,9 @@ public:
///> Cursor control event types ///> Cursor control event types
enum CURSOR_EVENT_TYPE { CURSOR_UP, CURSOR_DOWN, CURSOR_LEFT, CURSOR_RIGHT, enum CURSOR_EVENT_TYPE { CURSOR_UP, CURSOR_DOWN, CURSOR_LEFT, CURSOR_RIGHT,
CURSOR_CLICK, CURSOR_DBL_CLICK, CURSOR_FAST_MOVE = 0x8000 }; CURSOR_CLICK, CURSOR_DBL_CLICK, CURSOR_FAST_MOVE = 0x8000 };
///> Remove event modifier flags
enum class REMOVE_FLAGS { NORMAL = 0x00, ALT = 0x01 };
}; };
void registerAllTools( TOOL_MANAGER* aToolManager ); void registerAllTools( TOOL_MANAGER* aToolManager );

View File

@ -575,6 +575,18 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
if( !hoverSelection() || m_selectionTool->CheckLock() == SELECTION_LOCKED ) if( !hoverSelection() || m_selectionTool->CheckLock() == SELECTION_LOCKED )
return 0; return 0;
// is this "alternative" remove?
const bool isAlt = aEvent.Parameter<intptr_t>() ==
(int) COMMON_ACTIONS::REMOVE_FLAGS::ALT;
// in "alternative" mode, deletion is not just a simple list
// of selected items, it is:
// - whole tracks, not just segments
if( isAlt )
{
m_toolMgr->RunAction( COMMON_ACTIONS::selectConnection, true );
}
// Get a copy instead of a reference, as we are going to clear current selection // Get a copy instead of a reference, as we are going to clear current selection
auto selection = m_selectionTool->GetSelection().GetItems(); auto selection = m_selectionTool->GetSelection().GetItems();
@ -830,6 +842,7 @@ void EDIT_TOOL::SetTransitions()
Go( &EDIT_TOOL::Rotate, COMMON_ACTIONS::rotateCcw.MakeEvent() ); Go( &EDIT_TOOL::Rotate, COMMON_ACTIONS::rotateCcw.MakeEvent() );
Go( &EDIT_TOOL::Flip, COMMON_ACTIONS::flip.MakeEvent() ); Go( &EDIT_TOOL::Flip, COMMON_ACTIONS::flip.MakeEvent() );
Go( &EDIT_TOOL::Remove, COMMON_ACTIONS::remove.MakeEvent() ); Go( &EDIT_TOOL::Remove, COMMON_ACTIONS::remove.MakeEvent() );
Go( &EDIT_TOOL::Remove, COMMON_ACTIONS::removeAlt.MakeEvent() );
Go( &EDIT_TOOL::Properties, COMMON_ACTIONS::properties.MakeEvent() ); Go( &EDIT_TOOL::Properties, COMMON_ACTIONS::properties.MakeEvent() );
Go( &EDIT_TOOL::MoveExact, COMMON_ACTIONS::moveExact.MakeEvent() ); Go( &EDIT_TOOL::MoveExact, COMMON_ACTIONS::moveExact.MakeEvent() );
Go( &EDIT_TOOL::Duplicate, COMMON_ACTIONS::duplicate.MakeEvent() ); Go( &EDIT_TOOL::Duplicate, COMMON_ACTIONS::duplicate.MakeEvent() );