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>
|
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>
|
2016-05-10 16:09:39 +00:00
|
|
|
#include <tools/pcb_tool.h>
|
2013-09-26 16:38:58 +00:00
|
|
|
#include <tool/context_menu.h>
|
2013-08-02 14:53:50 +00:00
|
|
|
|
2014-07-09 13:10:32 +00:00
|
|
|
#include "selection_conditions.h"
|
2017-01-11 17:22:53 +00:00
|
|
|
#include "tool_menu.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 SELECTION_AREA;
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2017-01-18 21:04:35 +00:00
|
|
|
struct SELECTION : public KIGFX::VIEW_GROUP
|
2014-07-09 13:10:32 +00:00
|
|
|
{
|
2016-11-04 21:29:47 +00:00
|
|
|
public:
|
2016-12-09 11:04:32 +00:00
|
|
|
using ITER = std::set<BOARD_ITEM*>::iterator;
|
|
|
|
using CITER = std::set<BOARD_ITEM*>::const_iterator;
|
2016-11-04 21:29:47 +00:00
|
|
|
|
|
|
|
ITER begin() { return m_items.begin(); }
|
|
|
|
ITER end() { return m_items.end(); }
|
|
|
|
CITER begin() const { return m_items.cbegin(); }
|
|
|
|
CITER end() const { return m_items.cend(); }
|
|
|
|
|
2017-01-18 21:04:35 +00:00
|
|
|
virtual void Add( BOARD_ITEM* aItem )
|
2016-11-04 21:29:47 +00:00
|
|
|
{
|
2016-12-09 11:04:32 +00:00
|
|
|
m_items.insert( aItem );
|
2016-11-04 21:29:47 +00:00
|
|
|
}
|
|
|
|
|
2017-01-18 21:04:35 +00:00
|
|
|
virtual void Remove( BOARD_ITEM *aItem )
|
2016-11-04 21:29:47 +00:00
|
|
|
{
|
2016-12-09 11:04:32 +00:00
|
|
|
m_items.erase( aItem );
|
2016-11-04 21:29:47 +00:00
|
|
|
}
|
|
|
|
|
2017-01-18 21:04:35 +00:00
|
|
|
virtual void Clear() override
|
2016-11-04 21:29:47 +00:00
|
|
|
{
|
|
|
|
m_items.clear();
|
|
|
|
}
|
|
|
|
|
2017-01-18 21:04:35 +00:00
|
|
|
virtual unsigned int GetSize() const override
|
2016-11-04 21:29:47 +00:00
|
|
|
{
|
|
|
|
return m_items.size();
|
|
|
|
}
|
2014-07-09 13:10:32 +00:00
|
|
|
|
2017-01-18 21:04:35 +00:00
|
|
|
virtual KIGFX::VIEW_ITEM* GetItem( unsigned int idx ) const override
|
2016-11-04 21:29:47 +00:00
|
|
|
{
|
|
|
|
auto iter = m_items.begin();
|
2016-12-09 11:04:32 +00:00
|
|
|
|
2016-12-20 10:29:28 +00:00
|
|
|
std::advance( iter, idx );
|
2016-11-04 21:29:47 +00:00
|
|
|
|
|
|
|
return *iter;
|
|
|
|
}
|
|
|
|
|
2016-12-09 11:04:32 +00:00
|
|
|
bool Contains( BOARD_ITEM* aItem ) const
|
2016-11-04 21:29:47 +00:00
|
|
|
{
|
2016-12-09 11:04:32 +00:00
|
|
|
return m_items.find( aItem ) != m_items.end();
|
2016-11-04 21:29:47 +00:00
|
|
|
}
|
2014-07-09 13:10:32 +00:00
|
|
|
|
|
|
|
/// Checks if there is anything selected
|
|
|
|
bool Empty() const
|
|
|
|
{
|
2016-11-04 21:29:47 +00:00
|
|
|
return ( m_items.size() == 0 );
|
2014-07-09 13:10:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Returns the number of selected parts
|
|
|
|
int Size() const
|
|
|
|
{
|
2016-11-04 21:29:47 +00:00
|
|
|
return m_items.size();
|
2014-07-09 13:10:32 +00:00
|
|
|
}
|
|
|
|
|
2016-12-09 11:04:32 +00:00
|
|
|
const std::set<BOARD_ITEM*> GetItems() const
|
2014-07-09 13:10:32 +00:00
|
|
|
{
|
2016-11-04 21:29:47 +00:00
|
|
|
return m_items;
|
2014-07-09 13:10:32 +00:00
|
|
|
}
|
|
|
|
|
2015-07-09 11:35:51 +00:00
|
|
|
/// Returns the center point of the selection area bounding box.
|
2015-02-20 10:40:36 +00:00
|
|
|
VECTOR2I GetCenter() const;
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2016-12-20 10:29:28 +00:00
|
|
|
BOARD_ITEM* operator[]( const int index ) const
|
2016-11-04 21:29:47 +00:00
|
|
|
{
|
2016-12-20 10:29:28 +00:00
|
|
|
if( index < 0 || (unsigned int) index >= m_items.size() )
|
2016-11-04 21:29:47 +00:00
|
|
|
return nullptr;
|
|
|
|
|
2016-12-20 10:29:28 +00:00
|
|
|
auto iter = m_items.begin();
|
|
|
|
std::advance( iter, index );
|
|
|
|
return *iter;
|
2016-11-04 21:29:47 +00:00
|
|
|
}
|
|
|
|
|
2016-12-09 11:04:32 +00:00
|
|
|
BOARD_ITEM* Front() const
|
2016-11-04 21:29:47 +00:00
|
|
|
{
|
|
|
|
if ( !m_items.size() )
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
return *m_items.begin();
|
|
|
|
}
|
|
|
|
|
2016-12-09 11:04:32 +00:00
|
|
|
std::set<BOARD_ITEM*>& Items()
|
2015-07-09 11:35:51 +00:00
|
|
|
{
|
2016-11-04 21:29:47 +00:00
|
|
|
return m_items;
|
2015-07-09 11:35:51 +00:00
|
|
|
}
|
|
|
|
|
2017-01-18 21:04:35 +00:00
|
|
|
virtual const VIEW_GROUP::ITEMS updateDrawList() const override;
|
2016-11-04 21:29:47 +00:00
|
|
|
|
2014-07-09 13:10:32 +00:00
|
|
|
private:
|
2017-01-17 16:46:33 +00:00
|
|
|
/// Set of selected items
|
|
|
|
std::set<BOARD_ITEM*> m_items;
|
2014-07-09 13:10:32 +00:00
|
|
|
|
2017-01-18 21:04:35 +00:00
|
|
|
// mute hidden overloaded virtual function warnings
|
|
|
|
using VIEW_GROUP::Add;
|
|
|
|
using VIEW_GROUP::Remove;
|
|
|
|
};
|
2017-01-17 16:46:33 +00:00
|
|
|
|
2015-02-18 00:10:20 +00:00
|
|
|
enum SELECTION_LOCK_FLAGS
|
2015-03-10 08:36:04 +00:00
|
|
|
{
|
2015-02-18 00:10:20 +00:00
|
|
|
SELECTION_UNLOCKED = 0,
|
|
|
|
SELECTION_LOCK_OVERRIDE = 1,
|
|
|
|
SELECTION_LOCKED = 2
|
|
|
|
};
|
|
|
|
|
2013-08-02 14:53:50 +00:00
|
|
|
/**
|
2013-08-06 07:31:08 +00:00
|
|
|
* Class 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
|
|
|
*/
|
2016-05-10 16:09:39 +00:00
|
|
|
class SELECTION_TOOL : public PCB_TOOL
|
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.
|
|
|
|
*/
|
2016-11-04 21:29:47 +00:00
|
|
|
SELECTION& GetSelection();
|
2013-08-02 14:53:50 +00:00
|
|
|
|
2017-01-12 10:07:52 +00:00
|
|
|
inline TOOL_MENU& GetToolMenu()
|
2015-04-30 08:46:08 +00:00
|
|
|
{
|
2017-01-12 10:07:52 +00:00
|
|
|
return m_menu;
|
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 );
|
2014-07-09 14:50:31 +00:00
|
|
|
|
2015-04-30 08:46:07 +00:00
|
|
|
///> Makes sure a group selection does not contain items that would cause
|
|
|
|
///> conflicts when moving/rotating together (e.g. a footprint and one of the same footprint's pads)
|
2015-02-18 16:53:46 +00:00
|
|
|
bool SanitizeSelection();
|
2015-02-18 00:10:20 +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 );
|
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 );
|
2014-11-21 10:50:13 +00:00
|
|
|
|
2014-03-18 10:04:52 +00:00
|
|
|
///> Event sent after an item is selected.
|
2015-02-14 20:28:47 +00:00
|
|
|
static const TOOL_EVENT SelectedEvent;
|
2014-03-18 10:04:52 +00:00
|
|
|
|
2014-11-21 10:49:54 +00:00
|
|
|
///> Event sent after an item is unselected.
|
2015-02-14 20:28:47 +00:00
|
|
|
static const TOOL_EVENT UnselectedEvent;
|
2014-03-18 10:04:52 +00:00
|
|
|
|
|
|
|
///> Event sent after selection is cleared.
|
2015-02-14 20:28:47 +00:00
|
|
|
static const TOOL_EVENT ClearedEvent;
|
2014-02-27 16:27:58 +00:00
|
|
|
|
2015-04-30 08:46:03 +00:00
|
|
|
///> Sets up handlers for various events.
|
2016-09-24 18:53:15 +00:00
|
|
|
void SetTransitions() override;
|
2015-04-30 08:46:03 +00:00
|
|
|
|
2013-08-06 07:31:08 +00:00
|
|
|
private:
|
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
|
|
|
|
* place, there is a menu displayed that allows to choose the item.
|
|
|
|
*
|
|
|
|
* @param aWhere is the place where the item should be selected.
|
|
|
|
* @param aAllowDisambiguation decides what to do in case of disambiguation. If true, then
|
|
|
|
* a menu is shown, otherise function finishes without selecting anything.
|
|
|
|
* @return True if an item was selected, false otherwise.
|
|
|
|
*/
|
2015-07-09 15:11:34 +00:00
|
|
|
bool selectPoint( const VECTOR2I& aWhere, bool aOnDrag = false );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function selectCursor()
|
|
|
|
* Selects an item under the cursor unless there is something already selected or aSelectAlways
|
|
|
|
* is true.
|
|
|
|
* @param aSelectAlways forces to select an item even if there is an item already selected.
|
|
|
|
* @return true if eventually there is an item selected, false otherwise.
|
|
|
|
*/
|
|
|
|
bool selectCursor( bool aSelectAlways = false );
|
2014-07-09 11:50:27 +00:00
|
|
|
|
2013-09-04 08:56:06 +00:00
|
|
|
/**
|
|
|
|
* Function selectMultiple()
|
|
|
|
* Handles drawing a selection box that allows 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
|
|
|
|
2017-02-04 06:44:17 +00:00
|
|
|
///> Selects a trivial connection (between two junctions) of items in selection
|
2015-03-10 08:36:04 +00:00
|
|
|
int selectConnection( const TOOL_EVENT& aEvent );
|
|
|
|
|
2017-02-04 06:44:17 +00:00
|
|
|
///> Selects items with a continuous copper connection to items in selection
|
2015-05-18 11:48:10 +00:00
|
|
|
int selectCopper( const TOOL_EVENT& aEvent );
|
|
|
|
|
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 );
|
|
|
|
|
2017-02-04 06:44:17 +00:00
|
|
|
/**
|
|
|
|
* Selects all items connected by copper tracks to the given TRACK
|
|
|
|
*/
|
|
|
|
void selectAllItemsConnectedToTrack( TRACK& aSourceTrack );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Selects all items connected (by copper) to the given item
|
|
|
|
*/
|
|
|
|
void selectAllItemsConnectedToItem( BOARD_CONNECTED_ITEM& aSourceItem );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Selects all items with the given net code
|
|
|
|
*/
|
|
|
|
void selectAllItemsOnNet( int aNetCode );
|
|
|
|
|
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
|
|
|
|
2014-10-13 13:22:14 +00:00
|
|
|
///> Find an item and start moving.
|
2015-02-14 20:28:47 +00:00
|
|
|
int findMove( const TOOL_EVENT& aEvent );
|
2014-10-13 13:22:14 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
/**
|
2015-04-03 09:13:06 +00:00
|
|
|
* Function clearSelection()
|
2014-07-09 11:50:27 +00:00
|
|
|
* Clears the current selection.
|
|
|
|
*/
|
|
|
|
void clearSelection();
|
|
|
|
|
2013-09-04 08:56:06 +00:00
|
|
|
/**
|
|
|
|
* Function disambiguationMenu()
|
|
|
|
* Handles the menu that allows to select one of many items in case there is more than one
|
2014-11-21 10:49:28 +00:00
|
|
|
* item at the selected point (@see selectCursor()).
|
2013-09-04 08:56:06 +00:00
|
|
|
*
|
|
|
|
* @param aItems contains list of items that are displayed to the user.
|
|
|
|
*/
|
2013-08-06 08:30:09 +00:00
|
|
|
BOARD_ITEM* disambiguationMenu( GENERAL_COLLECTOR* aItems );
|
2013-09-04 08:56:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function pickSmallestComponent()
|
|
|
|
* Allows to find the smallest (in terms of bounding box area) item from the list.
|
|
|
|
*
|
|
|
|
* @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
|
|
|
|
|
|
|
/**
|
|
|
|
* Function toggleSelection()
|
|
|
|
* Changes selection status of a given item.
|
|
|
|
*
|
|
|
|
* @param aItem is the item to have selection status changed.
|
|
|
|
*/
|
2013-08-09 08:18:48 +00:00
|
|
|
void toggleSelection( BOARD_ITEM* aItem );
|
2013-09-04 08:56:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function selectable()
|
|
|
|
* Checks conditions for an item to be selected.
|
|
|
|
*
|
|
|
|
* @return True if the item fulfills conditions to be selected.
|
|
|
|
*/
|
2013-09-26 12:09:56 +00:00
|
|
|
bool selectable( const BOARD_ITEM* aItem ) const;
|
2013-09-04 08:56:06 +00:00
|
|
|
|
2016-01-20 14:22:09 +00:00
|
|
|
/**
|
|
|
|
* Function modifiable()
|
|
|
|
* Checks if an item might be modified. This function is used to filter out items
|
|
|
|
* from the selection when it is passed to other tools.
|
|
|
|
*
|
|
|
|
* @return True if the item fulfills conditions to be modified.
|
|
|
|
*/
|
|
|
|
bool modifiable( const BOARD_ITEM* aItem ) const;
|
|
|
|
|
2013-09-26 16:38:58 +00:00
|
|
|
/**
|
2015-04-03 09:13:06 +00:00
|
|
|
* Function select()
|
2013-09-26 16:38:58 +00:00
|
|
|
* Takes necessary action mark an item as selected.
|
|
|
|
*
|
|
|
|
* @param aItem is an item to be selected.
|
|
|
|
*/
|
2013-12-18 13:33:34 +00:00
|
|
|
void select( BOARD_ITEM* aItem );
|
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
|
|
|
|
|
|
|
/**
|
2015-04-03 09:13:06 +00:00
|
|
|
* Function selectVisually()
|
2013-12-18 13:33:34 +00:00
|
|
|
* Marks item as selected, but does not add it to the ITEMS_PICKED_LIST.
|
|
|
|
* @param aItem is an item to be be marked.
|
|
|
|
*/
|
|
|
|
void selectVisually( BOARD_ITEM* aItem ) const;
|
|
|
|
|
|
|
|
/**
|
2014-11-21 10:49:54 +00:00
|
|
|
* Function unselectVisually()
|
2013-12-18 13:33:34 +00:00
|
|
|
* Marks item as selected, but does not add it to the ITEMS_PICKED_LIST.
|
|
|
|
* @param aItem is an item to be be marked.
|
|
|
|
*/
|
2014-11-21 10:49:54 +00:00
|
|
|
void unselectVisually( BOARD_ITEM* aItem ) const;
|
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()
|
2013-09-19 15:02:57 +00:00
|
|
|
* Checks if the given point is placed within any of selected items' bounding box.
|
|
|
|
*
|
|
|
|
* @return True if the given point is contained in any of selected items' bouding box.
|
|
|
|
*/
|
2014-02-27 15:13:27 +00:00
|
|
|
bool selectionContains( const VECTOR2I& aPoint ) const;
|
2013-09-19 15:02:57 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
/**
|
2015-02-18 00:10:20 +00:00
|
|
|
* Function guessSelectionCandidates()
|
|
|
|
* Tries to guess best selection candidates in case multiple items are clicked, by
|
|
|
|
* doing some braindead heuristics.
|
2014-05-13 09:22:51 +00:00
|
|
|
* @param aCollector is the collector that has a list of items to be queried.
|
|
|
|
*/
|
2015-02-18 00:10:20 +00:00
|
|
|
void guessSelectionCandidates( GENERAL_COLLECTOR& aCollector ) const;
|
2014-05-13 09:22:51 +00:00
|
|
|
|
2014-07-09 11:50:27 +00:00
|
|
|
/// Pointer to the parent frame.
|
|
|
|
PCB_BASE_FRAME* m_frame;
|
|
|
|
|
2014-07-09 13:10:32 +00:00
|
|
|
/// Current state of selection.
|
2013-10-02 08:21:05 +00:00
|
|
|
SELECTION m_selection;
|
|
|
|
|
2014-07-09 13:10:32 +00:00
|
|
|
/// Flag saying if items should be added to the current selection or rather replace it.
|
2013-08-09 08:18:48 +00:00
|
|
|
bool m_additive;
|
2013-09-09 08:10:02 +00:00
|
|
|
|
2014-07-09 13:10:32 +00:00
|
|
|
/// Flag saying if multiple selection mode is active.
|
2013-09-09 08:10:02 +00:00
|
|
|
bool m_multiple;
|
2013-09-19 15:02:57 +00:00
|
|
|
|
2014-07-09 14:50:31 +00:00
|
|
|
/// Can other tools modify locked items.
|
|
|
|
bool m_locked;
|
|
|
|
|
2015-04-30 08:46:07 +00:00
|
|
|
/// Determines if the selection is preliminary or final.
|
|
|
|
bool m_preliminary;
|
|
|
|
|
2017-01-11 17:22:53 +00:00
|
|
|
/// Menu model displayed by the tool.
|
|
|
|
TOOL_MENU m_menu;
|
2013-08-02 14:53:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|