Add reselectItem action.
This commit is contained in:
parent
40f7d5cb52
commit
0fcb36bc2e
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
* Copyright (C) 2021-2023 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
|
||||
|
@ -125,6 +125,18 @@ void SELECTION_TOOL::AddItemToSel( EDA_ITEM* aItem, bool aQuietMode )
|
|||
}
|
||||
|
||||
|
||||
int SELECTION_TOOL::ReselectItem( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
RemoveItemFromSel( aEvent.Parameter<EDA_ITEM*>() );
|
||||
selection().SetIsHover( false );
|
||||
|
||||
AddItemToSel( aEvent.Parameter<EDA_ITEM*>() );
|
||||
selection().SetIsHover( false );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int SELECTION_TOOL::AddItemsToSel( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
AddItemsToSel( aEvent.Parameter<EDA_ITEMS*>(), false );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
* Copyright (C) 2021-2023 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
|
||||
|
@ -54,6 +54,8 @@ public:
|
|||
int RemoveItemsFromSel( const TOOL_EVENT& aEvent );
|
||||
void RemoveItemsFromSel( EDA_ITEMS* aList, bool aQuietMode = false );
|
||||
|
||||
int ReselectItem( const TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* A safer version of RemoveItemsFromSel( EDA_ITEMS ) which doesn't require the items to
|
||||
* still exist.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013-2016 CERN
|
||||
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -2011,6 +2011,10 @@ TOOL_ACTION PCB_ACTIONS::unselectItems( TOOL_ACTION_ARGS()
|
|||
.Name( "pcbnew.InteractiveSelection.UnselectItems" )
|
||||
.Scope( AS_GLOBAL ) );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::reselectItem( TOOL_ACTION_ARGS()
|
||||
.Name( "pcbnew.InteractiveSelection.ReselectItem" )
|
||||
.Scope( AS_GLOBAL ) );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::selectionClear( TOOL_ACTION_ARGS()
|
||||
.Name( "pcbnew.InteractiveSelection.Clear" )
|
||||
.Scope( AS_GLOBAL ) );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013-2016 CERN
|
||||
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
|
@ -70,6 +70,7 @@ public:
|
|||
/// Select an item (specified as the event parameter).
|
||||
static TOOL_ACTION selectItem;
|
||||
static TOOL_ACTION unselectItem;
|
||||
static TOOL_ACTION reselectItem;
|
||||
|
||||
/// Select a list of items (specified as the event parameter)
|
||||
static TOOL_ACTION selectItems;
|
||||
|
|
|
@ -3509,6 +3509,7 @@ void PCB_SELECTION_TOOL::setTransitions()
|
|||
Go( &PCB_SELECTION_TOOL::AddItemsToSel, PCB_ACTIONS::selectItems.MakeEvent() );
|
||||
Go( &PCB_SELECTION_TOOL::RemoveItemFromSel, PCB_ACTIONS::unselectItem.MakeEvent() );
|
||||
Go( &PCB_SELECTION_TOOL::RemoveItemsFromSel, PCB_ACTIONS::unselectItems.MakeEvent() );
|
||||
Go( &PCB_SELECTION_TOOL::ReselectItem, PCB_ACTIONS::reselectItem.MakeEvent() );
|
||||
Go( &PCB_SELECTION_TOOL::SelectionMenu, PCB_ACTIONS::selectionMenu.MakeEvent() );
|
||||
|
||||
Go( &PCB_SELECTION_TOOL::filterSelection, PCB_ACTIONS::filterSelection.MakeEvent() );
|
||||
|
|
Loading…
Reference in New Issue