2013-08-02 14:53:50 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2017-01-17 16:46:33 +00:00
|
|
|
* Copyright (C) 2013-2017 CERN
|
2013-08-02 14:53:50 +00:00
|
|
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
2013-09-19 15:02:57 +00:00
|
|
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
2020-02-20 12:11:04 +00:00
|
|
|
* Copyright (C) 2017-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
2013-08-02 14:53:50 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SELECTION_TOOL_H
|
|
|
|
#define __SELECTION_TOOL_H
|
|
|
|
|
2016-11-04 21:29:47 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2013-08-02 14:53:50 +00:00
|
|
|
#include <math/vector2d.h>
|
2020-07-11 17:40:23 +00:00
|
|
|
#include <project/board_project_settings.h>
|
2019-05-14 11:14:00 +00:00
|
|
|
#include <tool/action_menu.h>
|
2017-02-28 03:04:44 +00:00
|
|
|
#include <tool/tool_menu.h>
|
2020-07-11 17:40:23 +00:00
|
|
|
#include <tools/pcb_selection_conditions.h>
|
|
|
|
#include <tools/pcb_tool_base.h>
|
|
|
|
#include <tools/pcbnew_selection.h>
|
2014-07-09 13:10:32 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
class PCB_BASE_FRAME;
|
2013-08-02 14:53:50 +00:00
|
|
|
class BOARD_ITEM;
|
|
|
|
class GENERAL_COLLECTOR;
|
|
|
|
|
2013-10-14 14:13:35 +00:00
|
|
|
namespace KIGFX
|
2013-10-02 08:21:05 +00:00
|
|
|
{
|
2016-11-04 21:29:47 +00:00
|
|
|
class GAL;
|
2013-10-02 08:21:05 +00:00
|
|
|
}
|
|
|
|
|
2015-02-18 00:10:20 +00:00
|
|
|
|
2020-08-11 19:37:07 +00:00
|
|
|
typedef void (*CLIENT_SELECTION_FILTER)( const VECTOR2I&, GENERAL_COLLECTOR&, SELECTION_TOOL* );
|
2018-01-05 23:44:37 +00:00
|
|
|
|
2018-01-28 09:35:33 +00:00
|
|
|
|
2013-08-02 14:53:50 +00:00
|
|
|
/**
|
2020-01-10 14:31:00 +00:00
|
|
|
* SELECTION_TOOL
|
2013-08-02 14:53:50 +00:00
|
|
|
*
|
|
|
|
* Our sample selection tool: currently supports:
|
|
|
|
* - pick single objects (click LMB)
|
|
|
|
* - add objects to existing selection (Shift+LMB)
|
|
|
|
* - draw selection box (drag LMB)
|
2014-07-09 11:50:27 +00:00
|
|
|
* - handles MODULEs properly (i.e. selects either MODULE or its PADs, TEXTs, etc.)
|
2013-09-19 15:02:57 +00:00
|
|
|
* - takes into account high-contrast & layer visibility settings
|
2013-12-03 15:09:03 +00:00
|
|
|
* - invokes InteractiveEdit tool when user starts to drag selected items
|
2013-08-02 14:53:50 +00:00
|
|
|
*/
|
2019-05-12 11:49:58 +00:00
|
|
|
class SELECTION_TOOL : public PCB_TOOL_BASE
|
2013-08-02 14:53:50 +00:00
|
|
|
{
|
2013-08-06 07:31:08 +00:00
|
|
|
public:
|
2013-08-09 13:04:10 +00:00
|
|
|
SELECTION_TOOL();
|
|
|
|
~SELECTION_TOOL();
|
2013-08-02 14:53:50 +00:00
|
|
|
|
2015-04-30 08:46:05 +00:00
|
|
|
/// @copydoc TOOL_BASE::Init()
|
2016-09-24 18:53:15 +00:00
|
|
|
bool Init() override;
|
2015-04-30 08:46:05 +00:00
|
|
|
|
|
|
|
/// @copydoc TOOL_BASE::Reset()
|
2016-09-24 18:53:15 +00:00
|
|
|
void Reset( RESET_REASON aReason ) override;
|
2013-09-04 08:56:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Main()
|
|
|
|
*
|
|
|
|
* The main loop.
|
|
|
|
*/
|
2015-02-14 20:28:47 +00:00
|
|
|
int Main( const TOOL_EVENT& aEvent );
|
2013-09-04 08:56:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetSelection()
|
|
|
|
*
|
|
|
|
* Returns the set of currently selected items.
|
|
|
|
*/
|
2019-06-08 21:48:22 +00:00
|
|
|
PCBNEW_SELECTION& GetSelection();
|
2013-08-02 14:53:50 +00:00
|
|
|
|
2017-03-03 12:42:28 +00:00
|
|
|
/**
|
|
|
|
* Function RequestSelection()
|
|
|
|
*
|
2018-01-05 23:44:37 +00:00
|
|
|
* Returns the current selection set, filtered according to aFlags
|
|
|
|
* and aClientFilter.
|
2017-03-03 12:42:28 +00:00
|
|
|
* If the set is empty, performs the legacy-style hover selection.
|
2018-12-13 01:22:27 +00:00
|
|
|
* @param aFiltered is an optional vector, that is filled with items removed by the filter
|
2017-03-03 12:42:28 +00:00
|
|
|
*/
|
2019-06-08 21:48:22 +00:00
|
|
|
PCBNEW_SELECTION& RequestSelection( CLIENT_SELECTION_FILTER aClientFilter,
|
2019-06-05 19:15:57 +00:00
|
|
|
std::vector<BOARD_ITEM*>* aFiltered = nullptr, bool aConfirmLockedItems = false );
|
2015-04-30 08:46:08 +00:00
|
|
|
|
2014-07-09 14:50:31 +00:00
|
|
|
///> Checks if the user has agreed to modify locked items for the given selection.
|
2015-02-18 00:10:20 +00:00
|
|
|
SELECTION_LOCK_FLAGS CheckLock();
|
2014-07-09 14:50:31 +00:00
|
|
|
|
2014-11-21 10:49:28 +00:00
|
|
|
///> Select a single item under cursor event handler.
|
2015-02-14 20:28:47 +00:00
|
|
|
int CursorSelection( const TOOL_EVENT& aEvent );
|
2014-07-09 14:50:31 +00:00
|
|
|
|
|
|
|
///> Clear current selection event handler.
|
2015-02-14 20:28:47 +00:00
|
|
|
int ClearSelection( const TOOL_EVENT& aEvent );
|
2019-09-08 18:43:54 +00:00
|
|
|
void ClearSelection( bool aQuietMode = false );
|
2014-07-09 14:50:31 +00:00
|
|
|
|
2014-11-21 10:50:13 +00:00
|
|
|
///> Item selection event handler.
|
2015-02-14 20:28:47 +00:00
|
|
|
int SelectItem( const TOOL_EVENT& aEvent );
|
2019-06-25 13:01:22 +00:00
|
|
|
void AddItemToSel( BOARD_ITEM* aItem, bool aQuietMode = false );
|
2014-11-21 10:50:13 +00:00
|
|
|
|
2020-08-19 22:15:44 +00:00
|
|
|
///> Select all items on the board
|
|
|
|
int SelectAll( const TOOL_EVENT& aEvent );
|
|
|
|
|
2017-06-12 09:16:30 +00:00
|
|
|
///> Multiple item selection event handler
|
|
|
|
int SelectItems( const TOOL_EVENT& aEvent );
|
|
|
|
|
2014-11-21 10:50:13 +00:00
|
|
|
///> Item unselection event handler.
|
2015-02-14 20:28:47 +00:00
|
|
|
int UnselectItem( const TOOL_EVENT& aEvent );
|
2019-11-16 22:31:18 +00:00
|
|
|
void RemoveItemFromSel( BOARD_ITEM* aItem, bool aQuietMode = false );
|
2014-11-21 10:50:13 +00:00
|
|
|
|
2017-06-12 09:16:30 +00:00
|
|
|
///> Multiple item unselection event handler
|
|
|
|
int UnselectItems( const TOOL_EVENT& aEvent );
|
|
|
|
|
2019-06-25 13:01:22 +00:00
|
|
|
void BrightenItem( BOARD_ITEM* aItem );
|
|
|
|
void UnbrightenItem( BOARD_ITEM* aItem );
|
|
|
|
|
2020-08-11 19:37:07 +00:00
|
|
|
/**
|
|
|
|
* Function select()
|
|
|
|
* Takes necessary action mark an item as selected.
|
|
|
|
*
|
|
|
|
* @param aItem is an item to be selected.
|
|
|
|
*/
|
|
|
|
void select( BOARD_ITEM* aItem );
|
|
|
|
|
2019-05-11 10:06:28 +00:00
|
|
|
/**
|
2019-07-28 18:30:56 +00:00
|
|
|
* Function selectable()
|
|
|
|
* Checks conditions for an item to be selected.
|
|
|
|
*
|
|
|
|
* @return True if the item fulfills conditions to be selected.
|
2019-05-11 10:06:28 +00:00
|
|
|
*/
|
2019-07-28 18:30:56 +00:00
|
|
|
bool Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOnly = false ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function guessSelectionCandidates()
|
|
|
|
* Tries to guess best selection candidates in case multiple items are clicked, by doing
|
|
|
|
* some brain-dead heuristics.
|
|
|
|
* @param aCollector is the collector that has a list of items to be queried.
|
|
|
|
* @param aWhere is the selection point to consider
|
|
|
|
*/
|
|
|
|
void GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector, const VECTOR2I& aWhere ) const;
|
2019-05-11 10:06:28 +00:00
|
|
|
|
2018-01-28 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Function SelectionMenu()
|
2019-04-23 12:51:48 +00:00
|
|
|
* Shows a popup menu to trim the COLLECTOR passed as aEvent's parameter down to a single
|
|
|
|
* item.
|
|
|
|
*
|
|
|
|
* NOTE: this routine DOES NOT modify the selection.
|
2018-01-28 09:35:33 +00:00
|
|
|
*/
|
|
|
|
int SelectionMenu( const TOOL_EVENT& aEvent );
|
|
|
|
|
2019-07-28 18:30:56 +00:00
|
|
|
/**
|
|
|
|
* Rebuilds the selection from the EDA_ITEMs' selection flags. Commonly called after
|
|
|
|
* rolling back an undo state to make sure there aren't any stale pointers.
|
|
|
|
*/
|
|
|
|
void RebuildSelection();
|
|
|
|
|
2020-06-27 22:48:34 +00:00
|
|
|
SELECTION_FILTER_OPTIONS& GetFilter()
|
|
|
|
{
|
|
|
|
return m_filter;
|
|
|
|
}
|
|
|
|
|
2015-04-30 08:46:03 +00:00
|
|
|
///> Sets up handlers for various events.
|
2017-07-31 12:30:51 +00:00
|
|
|
void setTransitions() override;
|
2015-04-30 08:46:03 +00:00
|
|
|
|
2017-03-02 23:42:23 +00:00
|
|
|
///> Zooms the screen to center and fit the current selection.
|
2018-11-11 20:06:23 +00:00
|
|
|
void zoomFitSelection();
|
2017-03-02 23:42:23 +00:00
|
|
|
|
2020-10-27 11:03:35 +00:00
|
|
|
BOARD* GetBoard() const
|
2020-08-11 19:37:07 +00:00
|
|
|
{
|
|
|
|
return board();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EnterGroup();
|
2020-09-02 01:09:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Leave the currently entered group.
|
|
|
|
*
|
|
|
|
* @param aSelectGroup when true will select the group after leaving
|
|
|
|
*/
|
|
|
|
void ExitGroup( bool aSelectGroup = false );
|
|
|
|
|
2020-08-11 19:37:07 +00:00
|
|
|
void FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector ) const;
|
|
|
|
|
2020-08-12 11:23:30 +00:00
|
|
|
PCB_GROUP* GetEnteredGroup() { return m_enteredGroup; }
|
2020-08-19 22:15:44 +00:00
|
|
|
|
2020-10-13 01:07:57 +00:00
|
|
|
///> Applies the SELECTION_FILTER_OPTIONS to a collection of items
|
|
|
|
void FilterCollectedItems( GENERAL_COLLECTOR& aCollector );
|
|
|
|
|
2013-08-06 07:31:08 +00:00
|
|
|
private:
|
2020-09-02 01:09:34 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
/**
|
2015-07-09 15:11:34 +00:00
|
|
|
* Function selectPoint()
|
2014-07-09 11:50:27 +00:00
|
|
|
* Selects an item pointed by the parameter aWhere. If there is more than one item at that
|
2018-07-08 12:12:38 +00:00
|
|
|
* place, there is a menu displayed that allows one to choose the item.
|
2014-07-09 11:50:27 +00:00
|
|
|
*
|
|
|
|
* @param aWhere is the place where the item should be selected.
|
2018-01-01 20:50:50 +00:00
|
|
|
* @param aOnDrag indicates whether a drag operation is being performed.
|
|
|
|
* @param aSelectionCancelledFlag allows the function to inform its caller that a selection
|
|
|
|
* was cancelled (for instance, by clicking outside of the disambiguation menu).
|
2018-01-05 23:44:37 +00:00
|
|
|
* @param aClientFilter allows the client to perform tool- or action-specific filtering.
|
2014-07-09 11:50:27 +00:00
|
|
|
* @return True if an item was selected, false otherwise.
|
|
|
|
*/
|
2018-01-01 20:50:50 +00:00
|
|
|
bool selectPoint( const VECTOR2I& aWhere, bool aOnDrag = false,
|
2018-01-05 23:44:37 +00:00
|
|
|
bool* aSelectionCancelledFlag = NULL,
|
|
|
|
CLIENT_SELECTION_FILTER aClientFilter = NULL );
|
2015-07-09 15:11:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function selectCursor()
|
|
|
|
* Selects an item under the cursor unless there is something already selected or aSelectAlways
|
|
|
|
* is true.
|
2019-04-21 23:45:34 +00:00
|
|
|
* @param aForceSelect forces to select an item even if there is an item already selected.
|
2018-01-05 23:44:37 +00:00
|
|
|
* @param aClientFilter allows the client to perform tool- or action-specific filtering.
|
2015-07-09 15:11:34 +00:00
|
|
|
* @return true if eventually there is an item selected, false otherwise.
|
|
|
|
*/
|
2019-04-21 23:45:34 +00:00
|
|
|
bool selectCursor( bool aForceSelect = false,
|
2018-01-05 23:44:37 +00:00
|
|
|
CLIENT_SELECTION_FILTER aClientFilter = NULL );
|
2014-07-09 11:50:27 +00:00
|
|
|
|
2013-09-04 08:56:06 +00:00
|
|
|
/**
|
|
|
|
* Function selectMultiple()
|
2018-07-08 12:12:38 +00:00
|
|
|
* Handles drawing a selection box that allows one to select many items at
|
|
|
|
* the same time.
|
2013-09-06 14:04:12 +00:00
|
|
|
*
|
2014-07-09 09:59:24 +00:00
|
|
|
* @return true if the function was cancelled (i.e. CancelEvent was received).
|
2013-09-04 08:56:06 +00:00
|
|
|
*/
|
2013-09-06 14:04:12 +00:00
|
|
|
bool selectMultiple();
|
2013-09-04 08:56:06 +00:00
|
|
|
|
2018-01-28 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Allows the selection of a single item from a list via pop-up menu. The items are
|
2019-04-21 23:45:34 +00:00
|
|
|
* highlighted on the canvas when hovered in the menu. The collector is trimmed to
|
|
|
|
* the picked item.
|
2018-01-28 09:35:33 +00:00
|
|
|
* @param aTitle (optional) Allows the menu to be titled (ie: "Clarify Selection").
|
2019-04-21 23:45:34 +00:00
|
|
|
* @return true if an item was picked
|
2018-01-28 09:35:33 +00:00
|
|
|
*/
|
2019-04-21 23:45:34 +00:00
|
|
|
bool doSelectionMenu( GENERAL_COLLECTOR* aItems, const wxString& aTitle );
|
2018-01-28 09:35:33 +00:00
|
|
|
|
2019-11-22 19:29:07 +00:00
|
|
|
/**
|
|
|
|
* Expands the current track selection to the next boundary (junctions, pads, or all)
|
|
|
|
*/
|
2019-05-14 19:21:10 +00:00
|
|
|
int expandConnection( const TOOL_EVENT& aEvent );
|
2018-02-13 10:20:14 +00:00
|
|
|
|
2017-02-04 06:44:17 +00:00
|
|
|
/**
|
|
|
|
* Selects all copper connections belonging to the same net(s) as the
|
|
|
|
* items in the selection
|
|
|
|
*/
|
2015-03-10 08:36:04 +00:00
|
|
|
int selectNet( const TOOL_EVENT& aEvent );
|
|
|
|
|
2020-03-27 21:56:39 +00:00
|
|
|
enum STOP_CONDITION
|
|
|
|
{
|
|
|
|
/** Stop at any place where more than two traces meet
|
|
|
|
*
|
|
|
|
* Because vias are also traces, this makes selection stop at a
|
|
|
|
* via if there is a trace on another layer as well, but a via
|
|
|
|
* with only one connection will be selected. */
|
|
|
|
STOP_AT_JUNCTION,
|
|
|
|
/** Stop when reaching a pad */
|
|
|
|
STOP_AT_PAD,
|
|
|
|
/** Select the entire net */
|
|
|
|
STOP_NEVER
|
|
|
|
};
|
|
|
|
|
2017-02-04 06:44:17 +00:00
|
|
|
/**
|
2019-11-22 17:31:03 +00:00
|
|
|
* Selects connecteed tracks and vias.
|
|
|
|
*
|
2020-03-27 21:56:39 +00:00
|
|
|
* @param aStopCondition where to stop selecting more items
|
2017-02-04 06:44:17 +00:00
|
|
|
*/
|
2020-03-27 21:56:39 +00:00
|
|
|
void selectConnectedTracks( BOARD_CONNECTED_ITEM& aSourceItem, STOP_CONDITION aStopCondition );
|
2017-02-04 06:44:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Selects all items with the given net code
|
2020-09-16 23:09:12 +00:00
|
|
|
* @param aNetCode is the target net to select
|
|
|
|
* @param aSelect is true to add the items to the selection, false to remove them (deselect)
|
2017-02-04 06:44:17 +00:00
|
|
|
*/
|
2020-09-16 23:09:12 +00:00
|
|
|
void selectAllItemsOnNet( int aNetCode, bool aSelect = true );
|
2017-02-04 06:44:17 +00:00
|
|
|
|
2017-03-02 21:07:45 +00:00
|
|
|
/**
|
2020-04-02 12:20:28 +00:00
|
|
|
* Selects all items with the given sheet timestamp/UUID name
|
2017-03-04 10:11:33 +00:00
|
|
|
* (the sheet path)
|
2020-04-02 12:20:28 +00:00
|
|
|
* The path of the root sheet is "/"
|
2017-03-02 21:07:45 +00:00
|
|
|
*/
|
2020-04-02 12:20:28 +00:00
|
|
|
void selectAllItemsOnSheet( wxString& aSheetPath );
|
2017-03-02 23:42:23 +00:00
|
|
|
|
2020-10-21 03:48:06 +00:00
|
|
|
///> Selects all footprints belonging to same sheet, from Eeschema,
|
2017-03-04 16:30:44 +00:00
|
|
|
///> using crossprobing
|
2019-05-14 19:21:10 +00:00
|
|
|
int selectSheetContents( const TOOL_EVENT& aEvent );
|
2017-03-02 21:07:45 +00:00
|
|
|
|
2020-10-21 03:48:06 +00:00
|
|
|
///> Selects all footprints belonging to same hierarchical sheet
|
2020-04-02 12:20:28 +00:00
|
|
|
///> as the selected footprint (same sheet path).
|
2017-02-08 16:32:41 +00:00
|
|
|
int selectSameSheet( const TOOL_EVENT& aEvent );
|
|
|
|
|
2014-10-13 13:25:16 +00:00
|
|
|
///> Find dialog callback.
|
|
|
|
void findCallback( BOARD_ITEM* aItem );
|
|
|
|
|
|
|
|
///> Find an item.
|
2015-02-14 20:28:47 +00:00
|
|
|
int find( const TOOL_EVENT& aEvent );
|
2014-10-13 13:25:16 +00:00
|
|
|
|
2017-02-07 06:40:38 +00:00
|
|
|
///> Invoke filter dialog and modify current selection
|
|
|
|
int filterSelection( const TOOL_EVENT& aEvent );
|
|
|
|
|
2020-06-27 22:48:34 +00:00
|
|
|
///> Returns true if the given item passes the current SELECTION_FILTER_OPTIONS
|
|
|
|
bool itemPassesFilter( BOARD_ITEM* aItem );
|
|
|
|
|
2013-09-04 08:56:06 +00:00
|
|
|
/**
|
|
|
|
* Function pickSmallestComponent()
|
2018-04-08 10:28:58 +00:00
|
|
|
* Allows one to find the smallest (in terms of bounding box area) item from the list.
|
2013-09-04 08:56:06 +00:00
|
|
|
*
|
|
|
|
* @param aCollector containes the list of items.
|
|
|
|
*/
|
2013-08-06 07:31:08 +00:00
|
|
|
BOARD_ITEM* pickSmallestComponent( GENERAL_COLLECTOR* aCollector );
|
2013-09-04 08:56:06 +00:00
|
|
|
|
2013-09-26 16:38:58 +00:00
|
|
|
/**
|
2015-04-03 09:13:06 +00:00
|
|
|
* Function unselect()
|
2014-11-21 10:49:54 +00:00
|
|
|
* Takes necessary action mark an item as unselected.
|
2013-09-26 16:38:58 +00:00
|
|
|
*
|
2014-11-21 10:49:54 +00:00
|
|
|
* @param aItem is an item to be unselected.
|
2013-09-26 16:38:58 +00:00
|
|
|
*/
|
2014-11-21 10:49:54 +00:00
|
|
|
void unselect( BOARD_ITEM* aItem );
|
2013-12-18 13:33:34 +00:00
|
|
|
|
|
|
|
/**
|
2019-04-21 23:45:34 +00:00
|
|
|
* Function highlight()
|
2018-01-28 09:35:33 +00:00
|
|
|
* Highlights the item visually.
|
|
|
|
* @param aItem is an item to be be highlighted.
|
|
|
|
* @param aHighlightMode should be either SELECTED or BRIGHTENED
|
|
|
|
* @param aGroup is the group to add the item to in the BRIGHTENED mode.
|
2013-12-18 13:33:34 +00:00
|
|
|
*/
|
2019-06-25 13:01:22 +00:00
|
|
|
void highlight( BOARD_ITEM* aItem, int aHighlightMode, PCBNEW_SELECTION* aGroup = nullptr );
|
2013-12-18 13:33:34 +00:00
|
|
|
|
|
|
|
/**
|
2019-04-21 23:45:34 +00:00
|
|
|
* Function unhighlight()
|
2018-01-28 09:35:33 +00:00
|
|
|
* Unhighlights the item visually.
|
|
|
|
* @param aItem is an item to be be highlighted.
|
|
|
|
* @param aHighlightMode should be either SELECTED or BRIGHTENED
|
|
|
|
* @param aGroup is the group to remove the item from.
|
2013-12-18 13:33:34 +00:00
|
|
|
*/
|
2019-06-25 13:01:22 +00:00
|
|
|
void unhighlight( BOARD_ITEM* aItem, int aHighlightMode, PCBNEW_SELECTION* aGroup = nullptr );
|
2013-09-26 16:38:58 +00:00
|
|
|
|
2013-09-19 15:02:57 +00:00
|
|
|
/**
|
2015-04-03 09:13:06 +00:00
|
|
|
* Function selectionContains()
|
2019-08-20 17:22:30 +00:00
|
|
|
* @return True if the given point is contained in any of selected items' bounding box.
|
2013-09-19 15:02:57 +00:00
|
|
|
*/
|
2014-02-27 15:13:27 +00:00
|
|
|
bool selectionContains( const VECTOR2I& aPoint ) const;
|
2013-09-19 15:02:57 +00:00
|
|
|
|
2017-04-20 10:06:58 +00:00
|
|
|
/**
|
|
|
|
* Event handler to update the selection VIEW_ITEM.
|
|
|
|
*/
|
|
|
|
int updateSelection( const TOOL_EVENT& aEvent );
|
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
/**
|
|
|
|
* Pass the selection to a conditional menu for updating.
|
|
|
|
*/
|
|
|
|
int UpdateMenu( const TOOL_EVENT& aEvent );
|
|
|
|
|
2017-10-31 15:13:41 +00:00
|
|
|
const GENERAL_COLLECTORS_GUIDE getCollectorsGuide() const;
|
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
private:
|
2020-09-24 01:05:46 +00:00
|
|
|
void highlightInternal( BOARD_ITEM* aItem, int aHighlightMode, PCBNEW_SELECTION* aSelectionViewGroup,
|
2020-08-11 19:37:07 +00:00
|
|
|
bool isChild);
|
|
|
|
|
2020-09-24 01:05:46 +00:00
|
|
|
void unhighlightInternal( BOARD_ITEM* aItem, int aHighlightMode, PCBNEW_SELECTION* aSelectionViewGroup,
|
2020-08-11 19:37:07 +00:00
|
|
|
bool isChild);
|
|
|
|
|
2019-06-08 21:48:22 +00:00
|
|
|
PCB_BASE_FRAME* m_frame; // Pointer to the parent frame
|
|
|
|
PCBNEW_SELECTION m_selection; // Current state of selection
|
|
|
|
|
2020-06-27 22:48:34 +00:00
|
|
|
SELECTION_FILTER_OPTIONS m_filter;
|
|
|
|
|
2019-06-08 21:48:22 +00:00
|
|
|
bool m_additive; // Items should be added to selection (instead of replacing)
|
|
|
|
bool m_subtractive; // Items should be removed from selection
|
2019-07-09 19:50:40 +00:00
|
|
|
bool m_exclusive_or; // Items' selection state should be toggled
|
2019-06-08 21:48:22 +00:00
|
|
|
bool m_multiple; // Multiple selection mode is active
|
|
|
|
bool m_skip_heuristics; // Heuristics are not allowed when choosing item under cursor
|
|
|
|
bool m_locked; // Other tools are not allowed to modify locked items
|
2020-09-25 21:48:07 +00:00
|
|
|
|
|
|
|
PCB_GROUP* m_enteredGroup; // If non-null, selections are limited to
|
|
|
|
// members of this group
|
|
|
|
KIGFX::VIEW_GROUP m_enteredGroupOverlay; // Overlay for the entered group's frame.
|
|
|
|
|
2014-07-09 14:50:31 +00:00
|
|
|
|
2017-02-07 06:40:38 +00:00
|
|
|
/// Private state (opaque pointer/compilation firewall)
|
|
|
|
class PRIV;
|
|
|
|
std::unique_ptr<PRIV> m_priv;
|
2013-08-02 14:53:50 +00:00
|
|
|
};
|
|
|
|
|
2020-10-27 11:03:35 +00:00
|
|
|
#endif /* __SELECTION_TOOL_H */
|