KiCad PCB EDA Suite
EE_SELECTION_TOOL Class Reference

#include <ee_selection_tool.h>

Inheritance diagram for EE_SELECTION_TOOL:
SELECTION_TOOL TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 EE_SELECTION_TOOL ()
 
 ~EE_SELECTION_TOOL ()
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
int UpdateMenu (const TOOL_EVENT &aEvent)
 
int Main (const TOOL_EVENT &aEvent)
 The main loop. More...
 
void OnIdle (wxIdleEvent &aEvent)
 
EE_SELECTIONGetSelection ()
 Return the set of currently selected items. More...
 
EE_SELECTIONRequestSelection (const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
 Return either an existing selection (filtered), or the selection at the current cursor if the existing selection is empty. More...
 
bool SelectPoint (const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, EDA_ITEM **aItem=nullptr, bool *aSelectionCancelledFlag=nullptr, bool aCheckLocked=false, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
 This overload of SelectPoint will create an EE_COLLECTOR and collect hits at location aWhere before calling the primary SelectPoint method. More...
 
int AddItemToSel (const TOOL_EVENT &aEvent)
 
void AddItemToSel (EDA_ITEM *aItem, bool aQuietMode=false)
 
int AddItemsToSel (const TOOL_EVENT &aEvent)
 
void AddItemsToSel (EDA_ITEMS *aList, bool aQuietMode=false)
 
int RemoveItemFromSel (const TOOL_EVENT &aEvent)
 
void RemoveItemFromSel (EDA_ITEM *aItem, bool aQuietMode=false)
 
int RemoveItemsFromSel (const TOOL_EVENT &aEvent)
 
void RemoveItemsFromSel (EDA_ITEMS *aList, bool aQuietMode=false)
 
void RemoveItemsFromSel (std::vector< KIID > *aList, bool aQuietMode=false)
 A safer version of RemoveItemsFromSel( EDA_ITEMS ) which doesn't require the items to still exist. More...
 
void BrightenItem (EDA_ITEM *aItem)
 
void UnbrightenItem (EDA_ITEM *aItem)
 
void SelectHighlightItem (EDA_ITEM *aItem)
 Find (but don't select) node under cursor. More...
 
EDA_ITEMGetNode (VECTOR2I aPosition)
 Select node under cursor. More...
 
int SelectNode (const TOOL_EVENT &aEvent)
 If node selected then expand to connection, otherwise select connection under cursor. More...
 
int SelectConnection (const TOOL_EVENT &aEvent)
 Clear current selection event handler. More...
 
int ClearSelection (const TOOL_EVENT &aEvent)
 Select all visible items in sheet. More...
 
int SelectAll (const TOOL_EVENT &aEvent)
 
void ClearSelection ()
 
bool Selectable (const EDA_ITEM *aItem, const VECTOR2I *aPos=nullptr, bool checkVisibilityOnly=false) const
 Check conditions for an item to be selected. More...
 
void GuessSelectionCandidates (EE_COLLECTOR &collector, const VECTOR2I &aPos)
 Apply heuristics to try and determine a single object when multiple are found under the cursor. More...
 
int SelectionMenu (const TOOL_EVENT &aEvent)
 Show a popup menu to trim the COLLECTOR passed as aEvent's parameter down to a single item. More...
 
void RebuildSelection ()
 Rebuild the selection from the EDA_ITEMs' selection flags. More...
 
bool CollectHits (EE_COLLECTOR &aCollector, const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
 Select one or more items at the location given by parameter aWhere. More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

void setModifiersState (bool aShiftState, bool aCtrlState, bool aAltState)
 Set the configuration of m_additive, m_subtractive, m_exclusive_or, m_skip_heuristics from the state of modifier keys SHIFT, CTRL, ALT and depending on the OS. More...
 
void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

bool m_additive
 
bool m_subtractive
 
bool m_exclusive_or
 
bool m_multiple
 
bool m_skip_heuristics
 
bool m_highlight_modifier
 
bool m_drag_additive
 
bool m_drag_subtractive
 
bool m_canceledMenu
 
wxTimer m_disambiguateTimer
 
VECTOR2I m_originalCursor
 
TOOL_MENU m_menu
 The functions below are not yet implemented - their interface may change. More...
 
TOOL_TYPE m_type
 Unique identifier for the tool, assigned by a TOOL_MANAGER instance. More...
 
TOOL_ID m_toolId
 Name of the tool. More...
 
std::string m_toolName
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

void narrowSelection (EE_COLLECTOR &collector, const VECTOR2I &aWhere, bool aCheckLocked, bool aSelectPoints)
 Apply rules to narrow the collection down to selectable objects, and then heuristics to try and narrow it to a single object. More...
 
bool selectPoint (EE_COLLECTOR &aCollector, EDA_ITEM **aItem=nullptr, bool *aSelectionCancelledFlag=nullptr, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
 This is the primary SelectPoint method that will prompt the user with a menu to disambiguate multiple selections and then finish by adding, subtracting or toggling the item(s) to the actual selection group. More...
 
bool selectMultiple ()
 Handle drawing a selection box that allows one to select many items at the same time. More...
 
bool doSelectionMenu (EE_COLLECTOR *aItems)
 Allow the selection of a single item from a list via pop-up menu. More...
 
void onDisambiguationExpire (wxTimerEvent &aEvent)
 Start the process to show our disambiguation menu once the user has kept the mouse down for the minimum time. More...
 
int disambiguateCursor (const TOOL_EVENT &aEvent)
 Handle disambiguation actions including displaying the menu. More...
 
void select (EDA_ITEM *aItem)
 Take necessary action mark an item as selected. More...
 
void unselect (EDA_ITEM *aItem)
 Take necessary action mark an item as unselected. More...
 
void highlight (EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
 Highlight the item visually. More...
 
void unhighlight (EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
 Unhighlight the item visually. More...
 
void updateReferencePoint ()
 Set the reference point to the anchor of the top-left item. More...
 
bool selectionContains (const VECTOR2I &aPoint) const
 Set up handlers for various events. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 

Private Attributes

SCH_BASE_FRAMEm_frame
 
EE_SELECTION m_selection
 
KICURSOR m_nonModifiedCursor
 
bool m_isSymbolEditor
 
bool m_isSymbolViewer
 
int m_unit
 
int m_convert
 

Detailed Description

Definition at line 56 of file ee_selection_tool.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 77 of file tool_base.h.

78  {
79  RUN,
80  MODEL_RELOAD,
81  GAL_SWITCH
82  };
Model changes (required full reload)
Definition: tool_base.h:80
Tool is invoked after being inactive.
Definition: tool_base.h:79
Rendering engine changes.
Definition: tool_base.h:81

Constructor & Destructor Documentation

◆ EE_SELECTION_TOOL()

EE_SELECTION_TOOL::EE_SELECTION_TOOL ( )

Definition at line 123 of file ee_selection_tool.cpp.

123  :
124  TOOL_INTERACTIVE( "eeschema.InteractiveSelection" ),
125  m_frame( nullptr ),
127  m_isSymbolEditor( false ),
128  m_isSymbolViewer( false ),
129  m_unit( 0 ),
130  m_convert( 0 )
131 {
132  m_selection.Clear();
133 }
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:83
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.
SCH_BASE_FRAME * m_frame
EE_SELECTION m_selection

References ARROW, SELECTION::Clear(), and m_selection.

◆ ~EE_SELECTION_TOOL()

EE_SELECTION_TOOL::~EE_SELECTION_TOOL ( )

Definition at line 136 of file ee_selection_tool.cpp.

137 {
138  getView()->Remove( &m_selection );
139 }
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:350
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
EE_SELECTION m_selection

References TOOL_BASE::getView(), m_selection, and KIGFX::VIEW::Remove().

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

After activation, the tool starts receiving events until it is finished.

Definition at line 51 of file tool_interactive.cpp.

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.

References TOOL_MANAGER::InvokeTool(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_TREE::onContextMenu(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ AddItemsToSel() [1/2]

int EE_SELECTION_TOOL::AddItemsToSel ( const TOOL_EVENT aEvent)

Definition at line 1449 of file ee_selection_tool.cpp.

1450 {
1451  AddItemsToSel( aEvent.Parameter<EDA_ITEMS*>(), false );
1452  m_selection.SetIsHover( false );
1453  return 0;
1454 }
int AddItemsToSel(const TOOL_EVENT &aEvent)
void SetIsHover(bool aIsHover)
Definition: selection.h:69
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:506
EE_SELECTION m_selection

References m_selection, TOOL_EVENT::Parameter(), and SELECTION::SetIsHover().

Referenced by setTransitions().

◆ AddItemsToSel() [2/2]

void EE_SELECTION_TOOL::AddItemsToSel ( EDA_ITEMS aList,
bool  aQuietMode = false 
)

Definition at line 1457 of file ee_selection_tool.cpp.

1458 {
1459  if( aList )
1460  {
1461  for( EDA_ITEM* item : *aList )
1462  select( item );
1463 
1464  // Inform other potentially interested tools
1465  if( !aQuietMode )
1467  }
1468 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:200
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void select(EDA_ITEM *aItem)
Take necessary action mark an item as selected.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99

References TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), select(), and EVENTS::SelectedEvent.

◆ AddItemToSel() [1/2]

◆ AddItemToSel() [2/2]

void EE_SELECTION_TOOL::AddItemToSel ( EDA_ITEM aItem,
bool  aQuietMode = false 
)

Definition at line 1436 of file ee_selection_tool.cpp.

1437 {
1438  if( aItem )
1439  {
1440  select( aItem );
1441 
1442  // Inform other potentially interested tools
1443  if( !aQuietMode )
1445  }
1446 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:200
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void select(EDA_ITEM *aItem)
Take necessary action mark an item as selected.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).

References TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), select(), and EVENTS::SelectedEvent.

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ BrightenItem()

void EE_SELECTION_TOOL::BrightenItem ( EDA_ITEM aItem)

Definition at line 1528 of file ee_selection_tool.cpp.

1529 {
1530  highlight( aItem, BRIGHTENED );
1531 }
void highlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Highlight the item visually.
#define BRIGHTENED
item is drawn with a bright contour

References BRIGHTENED, and highlight().

Referenced by SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ ClearSelection() [1/2]

int EE_SELECTION_TOOL::ClearSelection ( const TOOL_EVENT aEvent)

◆ ClearSelection() [2/2]

void EE_SELECTION_TOOL::ClearSelection ( )

Definition at line 1822 of file ee_selection_tool.cpp.

1823 {
1824  if( m_selection.Empty() )
1825  return;
1826 
1827  while( m_selection.GetSize() )
1829 
1830  getView()->Update( &m_selection );
1831 
1832  m_selection.SetIsHover( false );
1834 
1835  // Inform other potentially interested tools
1837 }
void ClearReferencePoint()
Definition: selection.h:197
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void SetIsHover(bool aIsHover)
Definition: selection.h:69
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
Definition: actions.h:202
#define SELECTED
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:88
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
EE_SELECTION m_selection
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Unhighlight the item visually.
EDA_ITEM * Front() const
Definition: selection.h:145
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1570

References EVENTS::ClearedEvent, SELECTION::ClearReferencePoint(), SELECTION::Empty(), SELECTION::Front(), SELECTION::GetSize(), TOOL_BASE::getView(), m_selection, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), SELECTED, SELECTION::SetIsHover(), unhighlight(), and KIGFX::VIEW::Update().

Referenced by ClearSelection(), Main(), RequestSelection(), Reset(), selectMultiple(), selectPoint(), and setTransitions().

◆ CollectHits()

bool EE_SELECTION_TOOL::CollectHits ( EE_COLLECTOR aCollector,
const VECTOR2I aWhere,
const KICAD_T aFilterList = EE_COLLECTOR::AllItems 
)

Select one or more items at the location given by parameter aWhere.

This method does not attempt to disambiguate multiple items and is simply "collecting"

Parameters
aCollectoris the collector object that will store found item(s)
aWhereis the place where the item should be selected.
aFilterListis a list of items that are acceptable for collection
aCheckLockedindicates if locked items should be excluded.

Definition at line 804 of file ee_selection_tool.cpp.

806 {
807  int pixelThreshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
808  int gridThreshold = KiROUND( getView()->GetGAL()->GetGridSize().EuclideanNorm() / 2 );
809  aCollector.m_Threshold = std::max( pixelThreshold, gridThreshold );
810 
811  if( m_isSymbolEditor )
812  {
813  LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
814 
815  if( !symbol )
816  return false;
817 
818  aCollector.Collect( symbol->GetDrawItems(), aFilterList, (wxPoint) aWhere, m_unit,
819  m_convert );
820  }
821  else
822  {
823  aCollector.Collect( m_frame->GetScreen(), aFilterList, (wxPoint) aWhere, m_unit,
824  m_convert );
825  }
826 
827  return aCollector.GetCount() > 0;
828 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:146
int m_Threshold
Definition: collector.h:241
void Collect(SCH_SCREEN *aScreen, const KICAD_T aFilterList[], const wxPoint &aPos, int aUnit=0, int aConvert=0)
Scan a EDA_ITEM using this class's Inspector method which does the collection.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
#define HITTEST_THRESHOLD_PIXELS
Define a library symbol object.
Definition: lib_symbol.h:96
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:82
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:484
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
SCH_BASE_FRAME * m_frame
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73

References EE_COLLECTOR::Collect(), EuclideanNorm(), COLLECTOR::GetCount(), LIB_SYMBOL::GetDrawItems(), SCH_BASE_FRAME::GetScreen(), TOOL_BASE::getView(), HITTEST_THRESHOLD_PIXELS, KiROUND(), m_convert, m_frame, m_isSymbolEditor, COLLECTOR::m_Threshold, and m_unit.

Referenced by SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), Main(), and SelectPoint().

◆ disambiguateCursor()

int EE_SELECTION_TOOL::disambiguateCursor ( const TOOL_EVENT aEvent)
private

Handle disambiguation actions including displaying the menu.

Definition at line 755 of file ee_selection_tool.cpp.

756 {
757  wxMouseState keyboardState = wxGetMouseState();
758 
759  setModifiersState( keyboardState.ShiftDown(), keyboardState.ControlDown(),
760  keyboardState.AltDown() );
761 
762  m_skip_heuristics = true;
765  m_skip_heuristics = false;
766 
767  return 0;
768 }
void setModifiersState(bool aShiftState, bool aCtrlState, bool aAltState)
Set the configuration of m_additive, m_subtractive, m_exclusive_or, m_skip_heuristics from the state ...
bool SelectPoint(const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, EDA_ITEM **aItem=nullptr, bool *aSelectionCancelledFlag=nullptr, bool aCheckLocked=false, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
This overload of SelectPoint will create an EE_COLLECTOR and collect hits at location aWhere before c...
static const KICAD_T AllItems[]
Definition: ee_collectors.h:42
VECTOR2I m_originalCursor

References EE_COLLECTOR::AllItems, SELECTION_TOOL::m_additive, SELECTION_TOOL::m_canceledMenu, SELECTION_TOOL::m_exclusive_or, SELECTION_TOOL::m_originalCursor, SELECTION_TOOL::m_skip_heuristics, SELECTION_TOOL::m_subtractive, SelectPoint(), and SELECTION_TOOL::setModifiersState().

Referenced by setTransitions().

◆ doSelectionMenu()

bool EE_SELECTION_TOOL::doSelectionMenu ( EE_COLLECTOR aItems)
private

Allow the selection of a single item from a list via pop-up menu.

The items are highlighted on the canvas when hovered in the menu. The collector is trimmed to the picked item.

Returns
true if an item was picked

The user has requested the full, non-limited list of selection items

Definition at line 1601 of file ee_selection_tool.cpp.

1602 {
1603  EDA_ITEM* current = nullptr;
1604  bool selectAll = false;
1605  bool expandSelection = false;
1606 
1607  do
1608  {
1610  if( expandSelection )
1611  aCollector->Combine();
1612 
1613  expandSelection = false;
1614 
1615  int limit = std::min( 9, aCollector->GetCount() );
1616  ACTION_MENU menu( true );
1617 
1618  for( int i = 0; i < limit; ++i )
1619  {
1620  wxString text;
1621  EDA_ITEM* item = ( *aCollector )[i];
1623 
1624  wxString menuText = wxString::Format( wxT( "&%d. %s\t%d" ), i + 1, text, i + 1 );
1625  menu.Add( menuText, i + 1, item->GetMenuImage() );
1626  }
1627 
1628  menu.AppendSeparator();
1629  menu.Add( _( "Select &All\tA" ), limit + 1, BITMAPS::INVALID_BITMAP );
1630 
1631  if( !expandSelection && aCollector->HasAdditionalItems() )
1632  menu.Add( _( "&Expand Selection\tE" ), limit + 2, BITMAPS::INVALID_BITMAP );
1633 
1634  if( aCollector->m_MenuTitle.Length() )
1635  {
1636  menu.SetTitle( aCollector->m_MenuTitle );
1637  menu.SetIcon( BITMAPS::info );
1638  menu.DisplayTitle( true );
1639  }
1640  else
1641  {
1642  menu.DisplayTitle( false );
1643  }
1644 
1645  SetContextMenu( &menu, CMENU_NOW );
1646 
1647  while( TOOL_EVENT* evt = Wait() )
1648  {
1649  if( evt->Action() == TA_CHOICE_MENU_UPDATE )
1650  {
1651  if( selectAll )
1652  {
1653  for( int i = 0; i < aCollector->GetCount(); ++i )
1654  unhighlight( ( *aCollector )[i], BRIGHTENED );
1655  }
1656  else if( current )
1657  {
1658  unhighlight( current, BRIGHTENED );
1659  }
1660 
1661  int id = *evt->GetCommandId();
1662 
1663  // User has pointed an item, so show it in a different way
1664  if( id > 0 && id <= limit )
1665  {
1666  current = ( *aCollector )[id - 1];
1667  highlight( current, BRIGHTENED );
1668  }
1669  else
1670  {
1671  current = nullptr;
1672  }
1673 
1674  // User has pointed on the "Select All" option
1675  if( id == limit + 1 )
1676  {
1677  for( int i = 0; i < aCollector->GetCount(); ++i )
1678  highlight( ( *aCollector )[i], BRIGHTENED );
1679  selectAll = true;
1680  }
1681  else
1682  {
1683  selectAll = false;
1684  }
1685  }
1686  else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
1687  {
1688  if( selectAll )
1689  {
1690  for( int i = 0; i < aCollector->GetCount(); ++i )
1691  unhighlight( ( *aCollector )[i], BRIGHTENED );
1692  }
1693  else if( current )
1694  unhighlight( current, BRIGHTENED );
1695 
1696  OPT<int> id = evt->GetCommandId();
1697 
1698  // User has selected the "Select All" option
1699  if( id == limit + 1 )
1700  {
1701  selectAll = true;
1702  current = nullptr;
1703  }
1704  else if( id == limit + 2 )
1705  {
1706  selectAll = false;
1707  current = nullptr;
1708  expandSelection = true;
1709  }
1710  // User has selected an item, so this one will be returned
1711  else if( id && ( *id > 0 ) && ( *id <= limit ) )
1712  {
1713  selectAll = false;
1714  current = ( *aCollector )[*id - 1];
1715  }
1716  // User has cancelled the menu (either by <esc> or clicking out of it)
1717  else
1718  {
1719  selectAll = false;
1720  current = nullptr;
1721  }
1722  }
1723  else if( evt->Action() == TA_CHOICE_MENU_CLOSED )
1724  {
1725  break;
1726  }
1727 
1728  getView()->UpdateItems();
1729  m_frame->GetCanvas()->Refresh();
1730  }
1731  } while( expandSelection );
1732 
1733  if( selectAll )
1734  return true;
1735  else if( current )
1736  {
1737  unhighlight( current, BRIGHTENED );
1738 
1739  getView()->UpdateItems();
1740  m_frame->GetCanvas()->Refresh();
1741 
1742  aCollector->Empty();
1743  aCollector->Append( current );
1744  return true;
1745  }
1746 
1747  return false;
1748 }
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:48
void SetContextMenu(ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Assign a context menu and tells when it should be activated.
void highlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Highlight the item visually.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Generic, UI-independent tool event.
Definition: tool_event.h:152
#define _(s)
void UpdateItems()
Iterate through the list of items that asked for updating and updates them.
Definition: view.cpp:1402
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
SCH_BASE_FRAME * m_frame
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: eda_item.cpp:109
virtual BITMAPS GetMenuImage() const
Return a pointer to an image to be used in menus.
Definition: eda_item.cpp:274
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
boost::optional< T > OPT
Definition: optional.h:7
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Unhighlight the item visually.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
#define BRIGHTENED
item is drawn with a bright contour

References _, COLLECTOR::Append(), BRIGHTENED, CMENU_NOW, COLLECTOR::Combine(), COLLECTOR::Empty(), Format(), SCH_BASE_FRAME::GetCanvas(), COLLECTOR::GetCount(), EDA_ITEM::GetMenuImage(), EDA_ITEM::GetSelectMenuText(), EDA_BASE_FRAME::GetUserUnits(), TOOL_BASE::getView(), COLLECTOR::HasAdditionalItems(), highlight(), info, INVALID_BITMAP, m_frame, COLLECTOR::m_MenuTitle, EDA_DRAW_PANEL_GAL::Refresh(), TOOL_INTERACTIVE::SetContextMenu(), TA_CHOICE_MENU_CHOICE, TA_CHOICE_MENU_CLOSED, TA_CHOICE_MENU_UPDATE, text, unhighlight(), KIGFX::VIEW::UpdateItems(), and TOOL_INTERACTIVE::Wait().

Referenced by SelectionMenu(), and selectPoint().

◆ getEditFrame()

template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Return the application window object, casted to requested user type.

Definition at line 184 of file tool_base.h.

185  {
186 #if !defined( QA_TEST ) // Dynamic casts give the linker a seizure in the test framework
187  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
188 #endif
189  return static_cast<T*>( getToolHolderInt() );
190  }
TOOLS_HOLDER * getToolHolderInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 120 of file tool_base.h.

121  {
122  return m_toolId;
123  }
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209

References TOOL_BASE::m_toolId.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::isActive(), TOOL_MANAGER::RegisterTool(), ACTION_MANAGER::RunHotKey(), TOOL_MANAGER::runTool(), TOOL_MANAGER::saveViewControls(), and TOOL_MANAGER::ShutdownTool().

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Return the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER or NULL if there is no associated tool manager.

Definition at line 143 of file tool_base.h.

144  {
145  return m_toolMgr;
146  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), LIB_TREE::onContextMenu(), ZONE_CREATE_HELPER::OnFirstPoint(), ACTION_MENU::OnMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ getModel()

template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 196 of file tool_base.h.

References TOOL_BASE::getModelInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), and ZONE_CREATE_HELPER::createZoneFromExisting().

◆ GetName()

const std::string& TOOL_BASE::GetName ( void  ) const
inlineinherited

Return the name of the tool.

Tool names are expected to obey the format: application.ToolName (eg. pcbnew.InteractiveSelection).

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

134  {
135  return m_toolName;
136  }
std::string m_toolName
Definition: tool_base.h:213

References TOOL_BASE::m_toolName.

Referenced by TOOL_MANAGER::dispatchInternal(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), TOOL_MANAGER::RegisterTool(), and TOOL_MANAGER::runTool().

◆ GetNode()

EDA_ITEM * EE_SELECTION_TOOL::GetNode ( VECTOR2I  aPosition)

Select node under cursor.

Definition at line 1371 of file ee_selection_tool.cpp.

1372 {
1373  EE_COLLECTOR collector;
1374 
1375  //TODO(snh): Reimplement after exposing KNN interface
1376  int pixelThreshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
1377  int gridThreshold = KiROUND( getView()->GetGAL()->GetGridSize().EuclideanNorm() );
1378  int thresholdMax = std::max( pixelThreshold, gridThreshold );
1379 
1380  for( int threshold : { 0, thresholdMax/4, thresholdMax/2, thresholdMax } )
1381  {
1382  collector.m_Threshold = threshold;
1383  collector.Collect( m_frame->GetScreen(), nodeTypes, (wxPoint) aPosition );
1384 
1385  if( collector.GetCount() > 0 )
1386  break;
1387  }
1388 
1389  return collector.GetCount() ? collector[ 0 ] : nullptr;
1390 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:146
int m_Threshold
Definition: collector.h:241
void Collect(SCH_SCREEN *aScreen, const KICAD_T aFilterList[], const wxPoint &aPos, int aUnit=0, int aConvert=0)
Scan a EDA_ITEM using this class's Inspector method which does the collection.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
#define HITTEST_THRESHOLD_PIXELS
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:82
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
static KICAD_T nodeTypes[]
SCH_BASE_FRAME * m_frame
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73

References EE_COLLECTOR::Collect(), EuclideanNorm(), COLLECTOR::GetCount(), SCH_BASE_FRAME::GetScreen(), TOOL_BASE::getView(), HITTEST_THRESHOLD_PIXELS, KiROUND(), m_frame, COLLECTOR::m_Threshold, and nodeTypes.

◆ GetSelection()

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 108 of file tool_base.h.

109  {
110  return m_type;
111  }
TOOL_TYPE m_type
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:206

References TOOL_BASE::m_type.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InvokeTool(), TOOL_MANAGER::ResetTools(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::ShutdownTool().

◆ getView()

KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Returns the instance of #VIEW object used in the application.

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

37 {
38  return m_toolMgr->GetView();
39 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:283
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

References TOOL_MANAGER::GetView(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), GERBVIEW_CONTROL::ClearAllLayers(), PL_SELECTION_TOOL::ClearSelection(), ClearSelection(), CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), ROUTER_TOOL::handleCommonEvents(), PL_SELECTION_TOOL::highlight(), highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), PL_EDIT_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), ROUTER_TOOL::prepareInteractive(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), BOARD_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), Reset(), PCB_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::SelectAll(), SelectAll(), PL_SELECTION_TOOL::selectionContains(), selectionContains(), PL_SELECTION_TOOL::selectMultiple(), selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), PL_SELECTION_TOOL::unhighlight(), unhighlight(), PCB_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), PCB_SELECTION_TOOL::zoomFitSelection(), ~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL().

◆ getViewControls()

KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Return the instance of VIEW_CONTROLS object used in the application.

It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.).

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

43 {
44  return m_toolMgr->GetViewControls();
45 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:285

References TOOL_MANAGER::GetViewControls(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), SCH_DRAWING_TOOLS::createSheetPin(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_DRAWING_TOOLS::GetCanvasFreeAreaPixels(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), RequestSelection(), PCB_POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), PCB_SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PCB_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), PL_POINT_EDITOR::setEditedPoint(), EE_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), PL_EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Define which state (aStateFunc) to go when a certain event arrives (aConditions).

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

149 {
150  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
151 
152  goInternal( sptr, aConditions );
153 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by AUTOPLACE_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), ROUTER_TOOL::setTransitions(), SCRIPTING_TOOL::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), PAD_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_MOVE_TOOL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), DRC_TOOL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), PCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), and setTransitions().

◆ GuessSelectionCandidates()

void EE_SELECTION_TOOL::GuessSelectionCandidates ( EE_COLLECTOR collector,
const VECTOR2I aPos 
)

Apply heuristics to try and determine a single object when multiple are found under the cursor.

Definition at line 1002 of file ee_selection_tool.cpp.

1003 {
1004  // Prefer exact hits to sloppy ones
1005  std::set<EDA_ITEM*> exactHits;
1006 
1007  for( int i = collector.GetCount() - 1; i >= 0; --i )
1008  {
1009  EDA_ITEM* item = collector[ i ];
1010  SCH_LINE* line = dynamic_cast<SCH_LINE*>( item );
1011  LIB_SHAPE* shape = dynamic_cast<LIB_SHAPE*>( item );
1012 
1013  // Lines are hard to hit. Give them a bit more slop to still be considered "exact".
1014 
1015  if( line || ( shape && shape->GetShape() == SHAPE_T::POLY ) )
1016  {
1017  if( item->HitTest( (wxPoint) aPos, Mils2iu( DANGLING_SYMBOL_SIZE ) ) )
1018  exactHits.insert( item );
1019  }
1020  else
1021  {
1022  if( item->HitTest( (wxPoint) aPos, 0 ) )
1023  exactHits.insert( item );
1024  }
1025  }
1026 
1027  if( exactHits.size() > 0 && exactHits.size() < (unsigned) collector.GetCount() )
1028  {
1029  for( int i = collector.GetCount() - 1; i >= 0; --i )
1030  {
1031  EDA_ITEM* item = collector[ i ];
1032 
1033  if( !exactHits.count( item ) )
1034  collector.Transfer( item );
1035  }
1036  }
1037 
1038  // Find the closest item. (Note that at this point all hits are either exact or non-exact.)
1039  wxPoint pos( aPos );
1040  SEG poss( m_isSymbolEditor ? mapCoords( pos ) : pos,
1041  m_isSymbolEditor ? mapCoords( pos ) : pos );
1042  EDA_ITEM* closest = nullptr;
1043  int closestDist = INT_MAX / 2;
1044 
1045  for( EDA_ITEM* item : collector )
1046  {
1047  EDA_RECT bbox = item->GetBoundingBox();
1048  int dist = INT_MAX / 2;
1049 
1050  if( exactHits.count( item ) )
1051  {
1052  if( item->Type() == SCH_PIN_T || item->Type() == SCH_JUNCTION_T )
1053  {
1054  closest = item;
1055  break;
1056  }
1057 
1058  SCH_LINE* line = dynamic_cast<SCH_LINE*>( item );
1059  EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( item );
1060  SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item );
1061 
1062  if( line )
1063  {
1064  dist = DistanceLinePoint( line->GetStartPoint(), line->GetEndPoint(), pos );
1065  }
1066  else if( text )
1067  {
1068  text->GetEffectiveTextShape()->Collide( poss, closestDist, &dist );
1069  }
1070  else if( symbol )
1071  {
1072  try
1073  {
1074  bbox = symbol->GetBodyBoundingBox();
1075  }
1076  catch( const boost::bad_pointer& exc )
1077  {
1078  // This may be overkill and could be an assertion but we are more likely to
1079  // find any boost pointer container errors this way.
1080  wxLogError( wxT( "Boost bad pointer exception '%s' occurred." ), exc.what() );
1081  }
1082 
1083  SHAPE_RECT rect( bbox.GetPosition(), bbox.GetWidth(), bbox.GetHeight() );
1084 
1085  if( bbox.Contains( pos ) )
1086  dist = EuclideanNorm( bbox.GetCenter() - pos );
1087  else
1088  rect.Collide( poss, closestDist, &dist );
1089  }
1090  else
1091  {
1092  dist = EuclideanNorm( bbox.GetCenter() - pos );
1093  }
1094  }
1095  else
1096  {
1097  SHAPE_RECT rect( bbox.GetPosition(), bbox.GetWidth(), bbox.GetHeight() );
1098  rect.Collide( poss, collector.m_Threshold, &dist );
1099  }
1100 
1101  if( dist < closestDist )
1102  {
1103  closestDist = dist;
1104  closest = item;
1105  }
1106  }
1107 
1108  // Construct a tight box (1/2 height and width) around the center of the closest item.
1109  // All items which exist at least partly outside this box have sufficient other areas
1110  // for selection and can be dropped.
1111  if( closest ) // Don't try and get a tight bbox if nothing is near the mouse pointer
1112  {
1113  EDA_RECT tightBox = closest->GetBoundingBox();
1114  tightBox.Inflate( -tightBox.GetWidth() / 4, -tightBox.GetHeight() / 4 );
1115 
1116  for( int i = collector.GetCount() - 1; i >= 0; --i )
1117  {
1118  EDA_ITEM* item = collector[i];
1119 
1120  if( item == closest )
1121  continue;
1122 
1123  if( !item->HitTest( tightBox, true ) )
1124  collector.Transfer( item );
1125  }
1126  }
1127 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:146
bool Collide(const SHAPE *aShape, int aClearance, VECTOR2I *aMTV) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
Definition: shape_rect.h:98
wxPoint GetStartPoint() const
Definition: sch_line.h:90
int GetWidth() const
Definition: eda_rect.h:118
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:140
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Test if aPosition is inside or on the boundary of this item.
Definition: eda_item.h:224
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:82
void Transfer(int aIndex)
Move the item at aIndex (first position is 0) to the backup list.
Definition: collector.h:152
#define DANGLING_SYMBOL_SIZE
< The size of the rectangle indicating an unconnected wire or label
const wxPoint GetPosition() const
Definition: eda_rect.h:111
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the pins or fields.
static VECTOR2D mapCoords(const wxPoint &aCoord)
int GetHeight() const
Definition: eda_rect.h:119
Definition: seg.h:40
Schematic symbol object.
Definition: sch_symbol.h:78
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
Handle the component boundary box.
Definition: eda_rect.h:42
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
SHAPE_T GetShape() const
Definition: eda_shape.h:101
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:75
const wxPoint GetCenter() const
Definition: eda_rect.h:113
double DistanceLinePoint(const wxPoint &linePointA, const wxPoint &linePointB, const wxPoint &referencePoint)
Compute the distance between a line and a reference point Reference: http://mathworld....
Definition: trigo.h:163
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
wxPoint GetEndPoint() const
Definition: sch_line.h:93

References SHAPE_RECT::Collide(), EDA_RECT::Contains(), DANGLING_SYMBOL_SIZE, DistanceLinePoint(), EuclideanNorm(), SCH_SYMBOL::GetBodyBoundingBox(), EDA_ITEM::GetBoundingBox(), EDA_RECT::GetCenter(), COLLECTOR::GetCount(), SCH_LINE::GetEndPoint(), EDA_RECT::GetHeight(), EDA_RECT::GetPosition(), EDA_SHAPE::GetShape(), SCH_LINE::GetStartPoint(), EDA_RECT::GetWidth(), EDA_ITEM::HitTest(), EDA_RECT::Inflate(), m_isSymbolEditor, KIGFX::mapCoords(), POLY, SCH_JUNCTION_T, SCH_PIN_T, text, and COLLECTOR::Transfer().

Referenced by SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), and narrowSelection().

◆ highlight()

void EE_SELECTION_TOOL::highlight ( EDA_ITEM aItem,
int  aHighlightMode,
EE_SELECTION aGroup = nullptr 
)
private

Highlight the item visually.

Parameters
aItemis an item to be be highlighted.
aHighlightModeshould be either SELECTED or BRIGHTENED
aGroupis the group to add the item to in the BRIGHTENED mode.

Definition at line 1852 of file ee_selection_tool.cpp.

1853 {
1854  KICAD_T itemType = aItem->Type();
1855 
1856  if( aMode == SELECTED )
1857  aItem->SetSelected();
1858  else if( aMode == BRIGHTENED )
1859  aItem->SetBrightened();
1860 
1861  if( aGroup )
1862  aGroup->Add( aItem );
1863 
1864  // Highlight pins and fields. (All the other symbol children are currently only
1865  // represented in the LIB_SYMBOL and will inherit the settings of the parent symbol.)
1866  if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
1867  {
1868  sch_item->RunOnChildren(
1869  [&]( SCH_ITEM* aChild )
1870  {
1871  if( aMode == SELECTED )
1872  aChild->SetSelected();
1873  else if( aMode == BRIGHTENED )
1874  aChild->SetBrightened();
1875  } );
1876  }
1877 
1878  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
1879  getView()->Update( aItem->GetParent() );
1880  else
1881  getView()->Update( aItem );
1882 }
virtual void Add(EDA_ITEM *aItem)
Definition: selection.cpp:32
void SetBrightened()
Definition: eda_item.h:129
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
void SetSelected()
Definition: eda_item.h:128
EDA_ITEM * GetParent() const
Definition: eda_item.h:114
#define SELECTED
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1570
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
#define BRIGHTENED
item is drawn with a bright contour

References SELECTION::Add(), BRIGHTENED, EDA_ITEM::GetParent(), TOOL_BASE::getView(), SCH_FIELD_T, SCH_PIN_T, SCH_SHEET_PIN_T, SELECTED, EDA_ITEM::SetBrightened(), EDA_ITEM::SetSelected(), EDA_ITEM::Type(), and KIGFX::VIEW::Update().

Referenced by BrightenItem(), doSelectionMenu(), select(), and SelectHighlightItem().

◆ Init()

bool EE_SELECTION_TOOL::Init ( )
overridevirtual

Init() is called once upon a registration of the tool.

Returns
True if the initialization went fine, false - otherwise.

Reimplemented from TOOL_BASE.

Definition at line 145 of file ee_selection_tool.cpp.

146 {
147  m_frame = getEditFrame<SCH_BASE_FRAME>();
148 
149  SYMBOL_VIEWER_FRAME* symbolViewerFrame = dynamic_cast<SYMBOL_VIEWER_FRAME*>( m_frame );
150  SYMBOL_EDIT_FRAME* symbolEditorFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
151 
152  if( symbolEditorFrame )
153  {
154  m_isSymbolEditor = true;
155  m_unit = symbolEditorFrame->GetUnit();
156  m_convert = symbolEditorFrame->GetConvert();
157  }
158  else
159  {
160  m_isSymbolViewer = symbolViewerFrame != nullptr;
161  }
162 
163  static KICAD_T wireOrBusTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
164  static KICAD_T connectedTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T,
167 
168  auto wireSelection = E_C::Count( 1 ) && E_C::OnlyType( SCH_LINE_LOCATE_WIRE_T );
169  auto busSelection = E_C::Count( 1 ) && E_C::OnlyType( SCH_LINE_LOCATE_BUS_T );
170  auto wireOrBusSelection = E_C::Count( 1 ) && E_C::OnlyTypes( wireOrBusTypes );
171  auto connectedSelection = E_C::Count( 1 ) && E_C::OnlyTypes( connectedTypes );
172  auto sheetSelection = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
173 
174  auto schEditSheetPageNumberCondition =
175  [&] ( const SELECTION& aSel )
176  {
178  return false;
179 
180  return E_C::LessThan( 2 )( aSel ) && E_C::OnlyType( SCH_SHEET_T )( aSel );
181  };
182 
183  auto schEditCondition =
184  [this] ( const SELECTION& aSel )
185  {
187  };
188 
189  auto belowRootSheetCondition =
190  [&]( const SELECTION& aSel )
191  {
192  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
193 
194  return editFrame
195  && editFrame->GetCurrentSheet().Last() != &editFrame->Schematic().Root();
196  };
197 
198  auto haveSymbolCondition =
199  [&]( const SELECTION& sel )
200  {
201  return m_isSymbolEditor &&
202  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
203  };
204 
205  auto& menu = m_menu.GetMenu();
206 
207  menu.AddItem( EE_ACTIONS::enterSheet, sheetSelection && EE_CONDITIONS::Idle, 1 );
208  menu.AddItem( EE_ACTIONS::explicitCrossProbe, sheetSelection && EE_CONDITIONS::Idle, 1 );
209  menu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 1 );
210 
211  menu.AddSeparator( 100 );
212  menu.AddItem( EE_ACTIONS::drawWire, schEditCondition && EE_CONDITIONS::Empty, 100 );
213  menu.AddItem( EE_ACTIONS::drawBus, schEditCondition && EE_CONDITIONS::Empty, 100 );
214 
215  menu.AddSeparator( 100 );
217 
218  menu.AddSeparator( 100 );
220 
221  menu.AddSeparator( 200 );
222  menu.AddItem( EE_ACTIONS::selectConnection, connectedSelection && EE_CONDITIONS::Idle, 250 );
223  menu.AddItem( EE_ACTIONS::placeJunction, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
224  menu.AddItem( EE_ACTIONS::placeLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
225  menu.AddItem( EE_ACTIONS::placeGlobalLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
226  menu.AddItem( EE_ACTIONS::placeHierLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
227  menu.AddItem( EE_ACTIONS::breakWire, wireSelection && EE_CONDITIONS::Idle, 250 );
228  menu.AddItem( EE_ACTIONS::breakBus, busSelection && EE_CONDITIONS::Idle, 250 );
229  menu.AddItem( EE_ACTIONS::importSingleSheetPin, sheetSelection && EE_CONDITIONS::Idle, 250 );
230  menu.AddItem( EE_ACTIONS::assignNetclass, connectedSelection && EE_CONDITIONS::Idle, 250 );
231  menu.AddItem( EE_ACTIONS::editPageNumber, schEditSheetPageNumberCondition, 250 );
232 
233  menu.AddSeparator( 400 );
234  menu.AddItem( EE_ACTIONS::symbolProperties,
235  haveSymbolCondition && EE_CONDITIONS::Empty, 400 );
236  menu.AddItem( EE_ACTIONS::pinTable,
237  haveSymbolCondition && EE_CONDITIONS::Empty, 400 );
238 
239  menu.AddSeparator( 1000 );
241 
242  m_disambiguateTimer.SetOwner( this );
243  Connect( wxEVT_TIMER, wxTimerEventHandler( EE_SELECTION_TOOL::onDisambiguationExpire ), nullptr, this );
244 
245  return true;
246 }
static TOOL_ACTION editPageNumber
Definition: ee_actions.h:155
static TOOL_ACTION pinTable
Definition: ee_actions.h:146
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
static bool IsDrawingWire(const SELECTION &aSelection)
static TOOL_ACTION breakBus
Definition: ee_actions.h:135
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Create a functor that tests if the selected items are only of given types.
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:88
static TOOL_ACTION placeJunction
Definition: ee_actions.h:84
static TOOL_ACTION selectConnection
If current selection is a wire or bus, expand to entire connection.
Definition: ee_actions.h:53
Symbol library viewer main window.
Schematic editor (Eeschema) main window.
static TOOL_ACTION importSingleSheetPin
Definition: ee_actions.h:189
static SELECTION_CONDITION Count(int aNumber)
Create a functor that tests if the number of selected items is equal to the value given as parameter.
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
static TOOL_ACTION breakWire
Definition: ee_actions.h:134
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:186
static TOOL_ACTION drawWire
Definition: ee_actions.h:80
static SELECTION_CONDITION LessThan(int aNumber)
Create a functor that tests if the number of selected items is smaller than the value given as parame...
static TOOL_ACTION explicitCrossProbe
Definition: ee_actions.h:200
static TOOL_ACTION symbolProperties
Definition: ee_actions.h:145
SCHEMATIC & Schematic() const
wxTimer m_disambiguateTimer
static bool IsDrawingBus(const SELECTION &aSelection)
static TOOL_ACTION drawBus
Definition: ee_actions.h:81
void onDisambiguationExpire(wxTimerEvent &aEvent)
Start the process to show our disambiguation menu once the user has kept the mouse down for the minim...
static TOOL_ACTION placeLabel
Definition: ee_actions.h:86
SCH_SHEET & Root() const
Definition: schematic.h:92
SCH_BASE_FRAME * m_frame
static TOOL_ACTION assignNetclass
Definition: ee_actions.h:152
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Create a functor that tests if the selected items are only of given type.
static bool Empty(const SELECTION &aSelection)
Test if there are no items selected.
static TOOL_ACTION enterSheet
Definition: ee_actions.h:185
SCH_SHEET_PATH & GetCurrentSheet() const
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:87
static TOOL_ACTION finishBus
Definition: ee_actions.h:96
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.
static TOOL_ACTION finishWire
Definition: ee_actions.h:95
The symbol library editor main window.

References CONDITIONAL_MENU::AddItem(), EDA_DRAW_FRAME::AddStandardSubMenus(), EE_ACTIONS::assignNetclass, EE_ACTIONS::breakBus, EE_ACTIONS::breakWire, SELECTION_CONDITIONS::Count(), EE_ACTIONS::drawBus, EE_ACTIONS::drawWire, EE_ACTIONS::editPageNumber, SELECTION_CONDITIONS::Empty(), EE_ACTIONS::enterSheet, EOT, EE_ACTIONS::explicitCrossProbe, EE_ACTIONS::finishBus, EE_ACTIONS::finishWire, SYMBOL_EDIT_FRAME::GetConvert(), SCH_EDIT_FRAME::GetCurrentSheet(), TOOL_MENU::GetMenu(), SYMBOL_EDIT_FRAME::GetUnit(), SELECTION_CONDITIONS::Idle(), EE_ACTIONS::importSingleSheetPin, SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), SCH_SHEET_PATH::Last(), EE_ACTIONS::leaveSheet, SELECTION_CONDITIONS::LessThan(), m_convert, SELECTION_TOOL::m_disambiguateTimer, m_frame, m_isSymbolEditor, m_isSymbolViewer, TOOL_INTERACTIVE::m_menu, m_unit, onDisambiguationExpire(), SELECTION_CONDITIONS::OnlyType(), SELECTION_CONDITIONS::OnlyTypes(), EE_ACTIONS::pinTable, EE_ACTIONS::placeGlobalLabel, EE_ACTIONS::placeHierLabel, EE_ACTIONS::placeJunction, EE_ACTIONS::placeLabel, SCHEMATIC::Root(), SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_LINE_LOCATE_BUS_T, SCH_LINE_LOCATE_WIRE_T, SCH_PIN_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_EDIT_FRAME::Schematic(), EE_ACTIONS::selectConnection, and EE_ACTIONS::symbolProperties.

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

References TOOL_MANAGER::IsToolActive(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by EDIT_TOOL::Drag(), ROUTER_TOOL::handleLayerSwitch(), EDIT_TOOL::isRouterActive(), PCB_SELECTION_TOOL::Main(), BOARD_EDITOR_CONTROL::TrackWidthDec(), and BOARD_EDITOR_CONTROL::TrackWidthInc().

◆ Main()

int EE_SELECTION_TOOL::Main ( const TOOL_EVENT aEvent)

The main loop.

Definition at line 335 of file ee_selection_tool.cpp.

336 {
338 
339  KIID lastRolloverItem = niluuid;
340 
341  // Main loop: keep receiving events
342  while( TOOL_EVENT* evt = Wait() )
343  {
344  bool displayWireCursor = false;
345  bool displayBusCursor = false;
346  bool displayLineCursor = false;
347  KIID rolloverItem = lastRolloverItem;
348 
349  // on left click, a selection is made, depending on modifiers ALT, SHIFT, CTRL:
350  setModifiersState( evt->Modifier( MD_SHIFT ), evt->Modifier( MD_CTRL ),
351  evt->Modifier( MD_ALT ) );
352 
353  bool modifier_enabled = m_subtractive || m_additive || m_exclusive_or;
354 
355  MOUSE_DRAG_ACTION drag_action = m_frame->GetDragAction();
357 
358  if( evt->IsMouseDown( BUT_LEFT ) )
359  {
360  // Avoid triggering when running under other tools
362 
363  if( m_frame->ToolStackIsEmpty() && pt_tool && !pt_tool->HasPoint() )
364  {
366  m_disambiguateTimer.StartOnce( 500 );
367  }
368  }
369  // Single click? Select single object
370  else if( evt->IsClick( BUT_LEFT ) )
371  {
372  // If the timer has stopped, then we have already run the disambiguate routine
373  // and we don't want to register an extra click here
374  if( !m_disambiguateTimer.IsRunning() )
375  {
376  evt->SetPassEvent();
377  continue;
378  }
379 
380  m_disambiguateTimer.Stop();
381 
382  if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
383  schframe->FocusOnItem( nullptr );
384 
385  EE_COLLECTOR collector;
386  bool continueSelect = true;
387 
388  // Collect items at the clicked location (doesn't select them yet)
389  if( CollectHits( collector, evt->Position() ) )
390  {
391  narrowSelection( collector, evt->Position(), false, false );
392 
393  if( collector.GetCount() == 1 && !m_isSymbolEditor && !modifier_enabled )
394  {
395  // Check if we want to auto start wires
396  VECTOR2I snappedCursorPos = grid.BestSnapAnchor( evt->Position(),
397  LAYER_CONNECTABLE, nullptr );
398 
400 
402  && pt_tool && !pt_tool->HasPoint()
403  && collector[0]->IsPointClickableAnchor( (wxPoint) snappedCursorPos ) )
404  {
405  OPT_TOOL_EVENT newEvt;
406  SCH_CONNECTION* connection = collector[0]->Connection();
407 
408  if( ( connection && ( connection->IsNet() || connection->IsUnconnected() ) )
409  || collector[0]->Type() == SCH_SYMBOL_T )
410  {
411  newEvt = EE_ACTIONS::drawWire.MakeEvent();
412  }
413  else if( connection && connection->IsBus() )
414  {
415  newEvt = EE_ACTIONS::drawBus.MakeEvent();
416  }
417  else if( collector[0]->Type() == SCH_LINE_T
418  && static_cast<SCH_LINE*>( collector[0] )->IsGraphicLine() )
419  {
420  newEvt = EE_ACTIONS::drawLines.MakeEvent();
421  }
422  else
423  {
424  newEvt = EE_ACTIONS::drawLines.MakeEvent();
425  }
426 
427  auto* params = newEvt->Parameter<DRAW_SEGMENT_EVENT_PARAMS*>();
428  auto* newParams = new DRAW_SEGMENT_EVENT_PARAMS();
429 
430  *newParams= *params;
431  newParams->quitOnDraw = true;
432  newEvt->SetParameter( newParams );
433 
434  getViewControls()->ForceCursorPosition( true, snappedCursorPos );
435  newEvt->SetMousePosition( snappedCursorPos );
436  newEvt->SetHasPosition( true );
437  newEvt->SetForceImmediate( true );
438  m_toolMgr->ProcessEvent( *newEvt );
439 
440  continueSelect = false;
441  }
442  else if( collector[0]->IsHypertext() )
443  {
444  collector[0]->DoHypertextMenu( m_frame );
445  continueSelect = false;
446  }
447  }
448  }
449 
450  if( continueSelect )
451  {
452  // If we didn't click on an anchor, we perform a normal select, pass in the
453  // items we previously collected
454  selectPoint( collector, nullptr, nullptr, m_additive, m_subtractive,
455  m_exclusive_or );
456 
457  m_selection.SetIsHover( false );
458  }
459  }
460  else if( evt->IsClick( BUT_RIGHT ) )
461  {
462  m_disambiguateTimer.Stop();
463 
464  // right click? if there is any object - show the context menu
465  bool selectionCancelled = false;
466 
467  if( m_selection.Empty() )
468  {
469  ClearSelection();
470  SelectPoint( evt->Position(), EE_COLLECTOR::AllItems, nullptr,
471  &selectionCancelled );
472  m_selection.SetIsHover( true );
473  }
474  // If the cursor has moved off the bounding box of the selection by more than
475  // a grid square, check to see if there is another item available for selection
476  // under the cursor. If there is, the user likely meant to get the context menu
477  // for that item. If there is no new item, then keep the original selection and
478  // show the context menu for it.
479  else if( !m_selection.GetBoundingBox().Inflate(
480  grid.GetGrid().x, grid.GetGrid().y ).Contains(
481  (wxPoint) evt->Position() ) )
482  {
483  EE_SELECTION saved_selection = m_selection;
484 
485  for( const auto& item : saved_selection )
486  RemoveItemFromSel( item, true );
487 
488  SelectPoint( evt->Position(), EE_COLLECTOR::AllItems, nullptr,
489  &selectionCancelled );
490 
491  if( m_selection.Empty() )
492  {
493  m_selection.SetIsHover( false );
494 
495  for( const auto& item : saved_selection )
496  AddItemToSel( item, true);
497  }
498  else
499  {
500  m_selection.SetIsHover( true );
501  }
502  }
503 
504  if( !selectionCancelled )
506  }
507  else if( evt->IsDblClick( BUT_LEFT ) )
508  {
509  m_disambiguateTimer.Stop();
510 
511  // double click? Display the properties window
512  if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
513  schframe->FocusOnItem( nullptr );
514 
515  if( m_selection.Empty() )
516  SelectPoint( evt->Position() );
517 
518  EDA_ITEM* item = m_selection.Front();
519 
520  if( item && item->Type() == SCH_SHEET_T )
522  else
524  }
525  else if( evt->IsDblClick( BUT_MIDDLE ) )
526  {
527  m_disambiguateTimer.Stop();
528 
529  // Middle double click? Do zoom to fit or zoom to objects
530  if( evt->Modifier( MD_CTRL ) ) // Is CTRL key down?
532  else
534  }
535  else if( evt->IsDrag( BUT_LEFT ) )
536  {
537  m_disambiguateTimer.Stop();
538 
539  // Is another tool already moving a new object? Don't allow a drag start
540  if( !m_selection.Empty() && m_selection[0]->HasFlag( IS_NEW | IS_MOVING ) )
541  {
542  evt->SetPassEvent();
543  continue;
544  }
545 
546  // drag with LMB? Select multiple objects (or at least draw a selection box) or
547  // drag them
548  if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
549  schframe->FocusOnItem( nullptr );
550 
551  if( modifier_enabled || drag_action == MOUSE_DRAG_ACTION::SELECT )
552  {
553  selectMultiple();
554  }
555  else if( m_selection.Empty() && drag_action != MOUSE_DRAG_ACTION::DRAG_ANY )
556  {
557  selectMultiple();
558  }
559  else
560  {
561  if( m_isSymbolEditor )
562  {
563  if( static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->IsSymbolAlias() )
565  else
567  }
568  else
569  {
571  }
572 
573  // Check if dragging has started within any of selected items bounding box
574  if( selectionContains( evt->Position() ) )
575  {
576  // Yes -> run the move tool and wait till it finishes
577  if( m_isSymbolEditor )
578  m_toolMgr->InvokeTool( "eeschema.SymbolMoveTool" );
579  else
580  m_toolMgr->InvokeTool( "eeschema.InteractiveMove" );
581  }
582  else
583  {
584  // No -> drag a selection box
585  selectMultiple();
586  }
587  }
588  }
589  else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
590  {
591  m_disambiguateTimer.Stop();
592 
593  // context sub-menu selection? Handle unit selection or bus unfolding
594  if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
595  && evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_SYM_MAX )
596  {
597  SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( m_selection.Front() );
598  int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;
599 
600  if( symbol )
601  static_cast<SCH_EDIT_FRAME*>( m_frame )->SelectUnit( symbol, unit );
602  }
603  else if( evt->GetCommandId().get() >= ID_POPUP_SCH_UNFOLD_BUS
604  && evt->GetCommandId().get() <= ID_POPUP_SCH_UNFOLD_BUS_END )
605  {
606  wxString* net = new wxString( *evt->Parameter<wxString*>() );
608  }
609 
610  }
611  else if( evt->IsCancelInteractive() )
612  {
613  m_disambiguateTimer.Stop();
614 
615  if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
616  schframe->FocusOnItem( nullptr );
617 
618  ClearSelection();
619  }
620  else if( evt->Action() == TA_UNDO_REDO_PRE )
621  {
622  if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
623  schframe->FocusOnItem( nullptr );
624 
625  ClearSelection();
626  }
627  else if( evt->IsMotion() && !m_isSymbolEditor && m_frame->ToolStackIsEmpty() )
628  {
629  rolloverItem = niluuid;
630  EE_COLLECTOR collector;
631 
632  // We are checking if we should display a pencil when hovering over anchors
633  // for "auto starting" wires when clicked
635 
636  if( CollectHits( collector, evt->Position() ) )
637  {
638  narrowSelection( collector, evt->Position(), false, false );
639 
640  if( collector.GetCount() == 1 && !modifier_enabled )
641  {
642  VECTOR2I snappedCursorPos = grid.BestSnapAnchor( evt->Position(),
643  LAYER_CONNECTABLE, nullptr );
644 
646 
648  && pt_tool && !pt_tool->HasPoint()
649  && !collector[0]->IsConnectivityDirty()
650  && collector[0]->IsPointClickableAnchor( (wxPoint) snappedCursorPos ) )
651  {
652  SCH_CONNECTION* connection = collector[0]->Connection();
653 
654  if( ( connection && ( connection->IsNet() || connection->IsUnconnected() ) )
655  || collector[0]->Type() == SCH_SYMBOL_T )
656  {
657  displayWireCursor = true;
658  }
659  else if( connection && connection->IsBus() )
660  {
661  displayBusCursor = true;
662  }
663  else if( collector[0]->Type() == SCH_LINE_T
664  && static_cast<SCH_LINE*>( collector[0] )->IsGraphicLine() )
665  {
666  displayLineCursor = true;
667  }
668 
669  getViewControls()->ForceCursorPosition( true, snappedCursorPos );
670  }
671  else if( collector[0]->IsHypertext()
672  && !collector[0]->IsSelected()
674  {
675  rolloverItem = collector[0]->m_Uuid;
676  }
677  }
678  }
679  }
680  else
681  {
682  evt->SetPassEvent();
683  }
684 
685  if( rolloverItem != lastRolloverItem )
686  {
687  EDA_ITEM* item = m_frame->GetItem( lastRolloverItem );
688 
689  if( item )
690  {
691  item->ClearFlags( IS_ROLLOVER );
692  lastRolloverItem = niluuid;
693 
694  if( item->Type() == SCH_FIELD_T )
695  m_frame->GetCanvas()->GetView()->Update( item->GetParent() );
696  else
697  m_frame->GetCanvas()->GetView()->Update( item );
698  }
699 
700  item = m_frame->GetItem( rolloverItem );
701 
702  if( item )
703  {
704  item->SetFlags( IS_ROLLOVER );
705  lastRolloverItem = rolloverItem;
706 
707  if( item->Type() == SCH_FIELD_T )
708  m_frame->GetCanvas()->GetView()->Update( item->GetParent() );
709  else
710  m_frame->GetCanvas()->GetView()->Update( item );
711  }
712  }
713 
714  if( m_frame->ToolStackIsEmpty() )
715  {
716  if( displayWireCursor )
717  {
719  }
720  else if( displayBusCursor )
721  {
723  }
724  else if( displayLineCursor )
725  {
727  }
728  else if( rolloverItem != niluuid )
729  {
731  }
732  else if( !m_selection.Empty()
733  && drag_action == MOUSE_DRAG_ACTION::DRAG_SELECTED
734  && evt->HasPosition()
735  && selectionContains( evt->Position() ) ) //move/drag option prediction
736  {
738  }
739  else
740  {
742  }
743  }
744  }
745 
746  m_disambiguateTimer.Stop();
747 
748  // Shutting down; clear the selection
749  m_selection.Clear();
750 
751  return 0;
752 }
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
static TOOL_ACTION properties
Definition: ee_actions.h:121
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
bool selectionContains(const VECTOR2I &aPoint) const
Set up handlers for various events.
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:83
KIID niluuid(0)
bool IsUnconnected() const
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
#define IS_NEW
New item, just created.
EDA_RECT GetBoundingBox() const override
VECTOR2D GetMousePosition() const
bool HasPoint()
Indicate the cursor is over an edit point.
const KICAD_T movableSymbolAliasItems[]
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool selectMultiple()
Handle drawing a selection box that allows one to select many items at the same time.
static TOOL_ACTION unfoldBus
Definition: ee_actions.h:82
static TOOL_ACTION zoomFitScreen
Definition: actions.h:96
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:152
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
Schematic editor (Eeschema) main window.
static TOOL_ACTION zoomFitObjects
Definition: actions.h:97
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.
void SetIsHover(bool aIsHover)
Definition: selection.h:69
void setModifiersState(bool aShiftState, bool aCtrlState, bool aAltState)
Set the configuration of m_additive, m_subtractive, m_exclusive_or, m_skip_heuristics from the state ...
const KICAD_T movableSymbolItems[]
EESCHEMA_SETTINGS * eeconfig() const
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:82
Definition: kiid.h:44
MOUSE_DRAG_ACTION
bool selectPoint(EE_COLLECTOR &aCollector, EDA_ITEM **aItem=nullptr, bool *aSelectionCancelledFlag=nullptr, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
This is the primary SelectPoint method that will prompt the user with a menu to disambiguate multiple...
MOUSE_DRAG_ACTION GetDragAction() const
Indicates whether a drag should draw a selection rectangle or drag selected (or unselected) objects.
Definition: tools_holder.h:135
#define IS_MOVING
Item being moved.
static TOOL_ACTION drawWire
Definition: ee_actions.h:80
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Generic, UI-independent tool event.
Definition: tool_event.h:152
void narrowSelection(EE_COLLECTOR &collector, const VECTOR2I &aWhere, bool aCheckLocked, bool aSelectPoints)
Apply rules to narrow the collection down to selectable objects, and then heuristics to try and narro...
bool ToolStackIsEmpty()
Definition: tools_holder.h:116
EDA_ITEM * GetParent() const
Definition: eda_item.h:114
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:153
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
bool CollectHits(EE_COLLECTOR &aCollector, const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Select one or more items at the location given by parameter aWhere.
wxTimer m_disambiguateTimer
virtual EDA_ITEM * GetItem(const KIID &aId) const
Fetch an item by KIID.
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
static TOOL_ACTION drawBus
Definition: ee_actions.h:81
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
bool IsNet() const
Schematic symbol object.
Definition: sch_symbol.h:78
int AddItemToSel(const TOOL_EVENT &aEvent)
bool SelectPoint(const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, EDA_ITEM **aItem=nullptr, bool *aSelectionCancelledFlag=nullptr, bool aCheckLocked=false, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
This overload of SelectPoint will create an EE_COLLECTOR and collect hits at location aWhere before c...
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
#define IS_ROLLOVER
Rollover active. Used for hyperlink highlighting.
Tool that displays edit points allowing to modify items by dragging the points.
SCH_BASE_FRAME * m_frame
static const KICAD_T AllItems[]
Definition: ee_collectors.h:42
TOOL_EVENT MakeEvent() const
Return the event associated with the action (i.e.
Definition: tool_action.cpp:72
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
static TOOL_ACTION enterSheet
Definition: ee_actions.h:185
VECTOR2I m_originalCursor
static TOOL_ACTION drawLines
Definition: ee_actions.h:92
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
bool IsBus() const
EE_SELECTION m_selection
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59
EDA_ITEM * Front() const
Definition: selection.h:145
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1570
const KICAD_T movableSchematicItems[]
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:548
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112

References AddItemToSel(), EE_COLLECTOR::AllItems, ARROW, EESCHEMA_SETTINGS::DRAWING::auto_start_wires, BUT_LEFT, BUT_MIDDLE, BUT_RIGHT, SELECTION::Clear(), EDA_ITEM::ClearFlags(), ClearSelection(), CollectHits(), DRAG_ANY, DRAG_SELECTED, EE_ACTIONS::drawBus, EE_ACTIONS::drawLines, EE_ACTIONS::drawWire, SCH_BASE_FRAME::eeconfig(), SELECTION::Empty(), EE_ACTIONS::enterSheet, KIGFX::VIEW_CONTROLS::ForceCursorPosition(), SELECTION::Front(), EE_SELECTION::GetBoundingBox(), SCH_BASE_FRAME::GetCanvas(), COLLECTOR::GetCount(), TOOLS_HOLDER::GetDragAction(), EDA_DRAW_FRAME::GetItem(), TOOL_MANAGER::GetMousePosition(), EDA_ITEM::GetParent(), TOOL_MANAGER::GetTool(), SCH_DRAW_PANEL::GetView(), TOOL_BASE::getViewControls(), grid, HAND, EE_POINT_EDITOR::HasPoint(), ID_POPUP_SCH_SELECT_UNIT_CMP, ID_POPUP_SCH_SELECT_UNIT_SYM_MAX, ID_POPUP_SCH_UNFOLD_BUS, ID_POPUP_SCH_UNFOLD_BUS_END, EDA_RECT::Inflate(), TOOL_MANAGER::InvokeTool(), IS_MOVING, IS_NEW, IS_ROLLOVER, SCH_CONNECTION::IsBus(), SCH_CONNECTION::IsNet(), SCH_CONNECTION::IsUnconnected(), LAYER_CONNECTABLE, LINE_BUS, LINE_GRAPHIC, LINE_WIRE_ADD, SELECTION_TOOL::m_additive, SELECTION_TOOL::m_disambiguateTimer, EESCHEMA_SETTINGS::m_Drawing, SELECTION_TOOL::m_exclusive_or, m_frame, m_isSymbolEditor, TOOL_INTERACTIVE::m_menu, m_nonModifiedCursor, SELECTION_TOOL::m_originalCursor, m_selection, SELECTION_TOOL::m_subtractive, TOOL_BASE::m_toolMgr, TOOL_ACTION::MakeEvent(), MD_ALT, MD_CTRL, MD_SHIFT, movableSchematicItems, movableSymbolAliasItems, movableSymbolItems, MOVING, narrowSelection(), niluuid, TOOL_EVENT::Parameter(), TOOL_MANAGER::ProcessEvent(), EE_ACTIONS::properties, DRAW_SEGMENT_EVENT_PARAMS::quitOnDraw, RemoveItemFromSel(), RequestSelection(), TOOL_MANAGER::RunAction(), SCH_FIELD_T, SCH_LINE_T, SCH_SHEET_T, SCH_SYMBOL_T, SELECT, selectionContains(), selectMultiple(), SelectPoint(), selectPoint(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), EDA_ITEM::SetFlags(), SELECTION::SetIsHover(), SELECTION_TOOL::setModifiersState(), TOOL_MENU::ShowContextMenu(), TA_CHOICE_MENU_CHOICE, TA_UNDO_REDO_PRE, TC_COMMAND, TOOLS_HOLDER::ToolStackIsEmpty(), EDA_ITEM::Type(), EE_ACTIONS::unfoldBus, KIGFX::VIEW::Update(), TOOL_INTERACTIVE::Wait(), ACTIONS::zoomFitObjects, and ACTIONS::zoomFitScreen.

Referenced by setTransitions().

◆ narrowSelection()

void EE_SELECTION_TOOL::narrowSelection ( EE_COLLECTOR collector,
const VECTOR2I aWhere,
bool  aCheckLocked,
bool  aSelectPoints 
)
private

Apply rules to narrow the collection down to selectable objects, and then heuristics to try and narrow it to a single object.

Parameters
collectorEE_COLLECTOR with elements to filter
aWherepoint where we should narrow (if relevant)
aCheckLockedIf false, remove locked elements from #collector
aSelectPointsIf true, set STARTPOINT/ENDPOINT flags on individual wires

Definition at line 831 of file ee_selection_tool.cpp.

833 {
834  for( int i = collector.GetCount() - 1; i >= 0; --i )
835  {
836  if( !Selectable( collector[i], &aWhere ) )
837  {
838  collector.Remove( i );
839  continue;
840  }
841 
842  if( aCheckLocked && collector[i]->IsLocked() )
843  {
844  collector.Remove( i );
845  continue;
846  }
847 
848  // SelectPoint, unlike other selection routines, can select line ends
849  if( aSelectPoints && collector[i]->Type() == SCH_LINE_T )
850  {
851  SCH_LINE* line = (SCH_LINE*) collector[i];
852  line->ClearFlags( STARTPOINT | ENDPOINT );
853 
854  if( HitTestPoints( line->GetStartPoint(), (wxPoint) aWhere, collector.m_Threshold ) )
855  line->SetFlags( STARTPOINT );
856  else if( HitTestPoints( line->GetEndPoint(), (wxPoint) aWhere, collector.m_Threshold ) )
857  line->SetFlags( ENDPOINT );
858  else
859  line->SetFlags( STARTPOINT | ENDPOINT );
860  }
861  }
862 
863  // Apply some ugly heuristics to avoid disambiguation menus whenever possible
864  if( collector.GetCount() > 1 && !m_skip_heuristics )
865  {
866  GuessSelectionCandidates( collector, aWhere );
867  }
868 }
int m_Threshold
Definition: collector.h:241
#define STARTPOINT
When a line is selected, these flags indicate which.
wxPoint GetStartPoint() const
Definition: sch_line.h:90
bool Selectable(const EDA_ITEM *aItem, const VECTOR2I *aPos=nullptr, bool checkVisibilityOnly=false) const
Check conditions for an item to be selected.
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:152
#define ENDPOINT
ends. (Used to support dragging.)
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:110
void GuessSelectionCandidates(EE_COLLECTOR &collector, const VECTOR2I &aPos)
Apply heuristics to try and determine a single object when multiple are found under the cursor.
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:82
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:153
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
bool HitTestPoints(const wxPoint &pointA, const wxPoint &pointB, double threshold)
Test, if two points are near each other.
Definition: trigo.h:184
wxPoint GetEndPoint() const
Definition: sch_line.h:93

References EDA_ITEM::ClearFlags(), ENDPOINT, COLLECTOR::GetCount(), SCH_LINE::GetEndPoint(), SCH_LINE::GetStartPoint(), GuessSelectionCandidates(), HitTestPoints(), SELECTION_TOOL::m_skip_heuristics, COLLECTOR::m_Threshold, COLLECTOR::Remove(), SCH_LINE_T, Selectable(), EDA_ITEM::SetFlags(), and STARTPOINT.

Referenced by Main(), and SelectPoint().

◆ onDisambiguationExpire()

void EE_SELECTION_TOOL::onDisambiguationExpire ( wxTimerEvent &  aEvent)
private

Start the process to show our disambiguation menu once the user has kept the mouse down for the minimum time.

Parameters
aEvent

Definition at line 771 of file ee_selection_tool.cpp.

772 {
774 }
static const TOOL_EVENT DisambiguatePoint
Definition: actions.h:215
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).

References EVENTS::DisambiguatePoint, TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ProcessEvent().

Referenced by Init().

◆ OnIdle()

void EE_SELECTION_TOOL::OnIdle ( wxIdleEvent &  aEvent)

Definition at line 777 of file ee_selection_tool.cpp.

778 {
779  if( m_frame->ToolStackIsEmpty() && !m_multiple )
780  {
781  wxMouseState keyboardState = wxGetMouseState();
782 
783  setModifiersState( keyboardState.ShiftDown(), keyboardState.ControlDown(),
784  keyboardState.AltDown() );
785 
786  if( m_additive )
788  else if( m_subtractive )
790  else if( m_exclusive_or )
792  else
794  }
795 }
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
void setModifiersState(bool aShiftState, bool aCtrlState, bool aAltState)
Set the configuration of m_additive, m_subtractive, m_exclusive_or, m_skip_heuristics from the state ...
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
bool ToolStackIsEmpty()
Definition: tools_holder.h:116
SCH_BASE_FRAME * m_frame

References ADD, SCH_BASE_FRAME::GetCanvas(), SELECTION_TOOL::m_additive, SELECTION_TOOL::m_exclusive_or, m_frame, SELECTION_TOOL::m_multiple, m_nonModifiedCursor, SELECTION_TOOL::m_subtractive, EDA_DRAW_PANEL_GAL::SetCurrentCursor(), SELECTION_TOOL::setModifiersState(), SUBTRACT, TOOLS_HOLDER::ToolStackIsEmpty(), and XOR.

Referenced by SCH_BASE_FRAME::SCH_BASE_FRAME().

◆ RebuildSelection()

void EE_SELECTION_TOOL::RebuildSelection ( )

Rebuild 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.

Definition at line 1548 of file ee_selection_tool.cpp.

1549 {
1550  m_selection.Clear();
1551 
1552  if( m_isSymbolEditor )
1553  {
1554  LIB_SYMBOL* start = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
1555 
1556  for( LIB_ITEM& item : start->GetDrawItems() )
1557  {
1558  if( item.IsSelected() )
1559  select( static_cast<EDA_ITEM*>( &item ) );
1560  }
1561  }
1562  else
1563  {
1564  for( SCH_ITEM* item : m_frame->GetScreen()->Items() )
1565  {
1566  // If the field and symbol are selected, only use the symbol
1567  if( item->IsSelected() )
1568  {
1569  select( item );
1570  }
1571  else
1572  {
1573  item->RunOnChildren(
1574  [&]( SCH_ITEM* aChild )
1575  {
1576  if( aChild->IsSelected() )
1577  select( aChild );
1578  } );
1579  }
1580  }
1581  }
1582 
1584 
1585  // Inform other potentially interested tools
1587 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:200
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:83
bool IsSelected() const
Definition: eda_item.h:122
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void select(EDA_ITEM *aItem)
Take necessary action mark an item as selected.
Define a library symbol object.
Definition: lib_symbol.h:96
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
void updateReferencePoint()
Set the reference point to the anchor of the top-left item.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:484
SCH_BASE_FRAME * m_frame
EE_RTREE & Items()
Gets the full RTree, usually for iterating.
Definition: sch_screen.h:110
EE_SELECTION m_selection
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182

References SELECTION::Clear(), LIB_SYMBOL::GetDrawItems(), SCH_BASE_FRAME::GetScreen(), EDA_ITEM::IsSelected(), SCH_SCREEN::Items(), m_frame, m_isSymbolEditor, m_selection, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), select(), EVENTS::SelectedEvent, and updateReferencePoint().

Referenced by SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), and SYMBOL_EDITOR_EDIT_TOOL::Undo().

◆ RemoveItemFromSel() [1/2]

int EE_SELECTION_TOOL::RemoveItemFromSel ( const TOOL_EVENT aEvent)

Definition at line 1471 of file ee_selection_tool.cpp.

1472 {
1473  RemoveItemFromSel( aEvent.Parameter<EDA_ITEM*>() );
1474  m_selection.SetIsHover( false );
1475  return 0;
1476 }
void SetIsHover(bool aIsHover)
Definition: selection.h:69
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
EE_SELECTION m_selection

References m_selection, TOOL_EVENT::Parameter(), and SELECTION::SetIsHover().

Referenced by SCH_EDIT_FRAME::DeleteJunction(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), Main(), SCH_EDIT_FRAME::SchematicCleanUp(), and setTransitions().

◆ RemoveItemFromSel() [2/2]

void EE_SELECTION_TOOL::RemoveItemFromSel ( EDA_ITEM aItem,
bool  aQuietMode = false 
)

Definition at line 1479 of file ee_selection_tool.cpp.

1480 {
1481  if( aItem )
1482  {
1483  unselect( aItem );
1484 
1485  // Inform other potentially interested tools
1486  if( !aQuietMode )
1488  }
1489 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:201
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
void unselect(EDA_ITEM *aItem)
Take necessary action mark an item as unselected.

References TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), unselect(), and EVENTS::UnselectedEvent.

◆ RemoveItemsFromSel() [1/3]

int EE_SELECTION_TOOL::RemoveItemsFromSel ( const TOOL_EVENT aEvent)

Definition at line 1492 of file ee_selection_tool.cpp.

1493 {
1494  RemoveItemsFromSel( aEvent.Parameter<EDA_ITEMS*>(), false );
1495  m_selection.SetIsHover( false );
1496  return 0;
1497 }
void SetIsHover(bool aIsHover)
Definition: selection.h:69
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:506
int RemoveItemsFromSel(const TOOL_EVENT &aEvent)
EE_SELECTION m_selection

References m_selection, TOOL_EVENT::Parameter(), and SELECTION::SetIsHover().

Referenced by SCH_MOVE_TOOL::Main(), RemoveItemsFromSel(), and setTransitions().

◆ RemoveItemsFromSel() [2/3]

void EE_SELECTION_TOOL::RemoveItemsFromSel ( EDA_ITEMS aList,
bool  aQuietMode = false 
)

Definition at line 1500 of file ee_selection_tool.cpp.

1501 {
1502  if( aList )
1503  {
1504  for( EDA_ITEM* item : *aList )
1505  unselect( item );
1506 
1507  // Inform other potentially interested tools
1508  if( !aQuietMode )
1510  }
1511 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:201
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
void unselect(EDA_ITEM *aItem)
Take necessary action mark an item as unselected.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99

References TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), unselect(), and EVENTS::UnselectedEvent.

◆ RemoveItemsFromSel() [3/3]

void EE_SELECTION_TOOL::RemoveItemsFromSel ( std::vector< KIID > *  aList,
bool  aQuietMode = false 
)

A safer version of RemoveItemsFromSel( EDA_ITEMS ) which doesn't require the items to still exist.

Definition at line 1514 of file ee_selection_tool.cpp.

1515 {
1516  EDA_ITEMS removeItems;
1517 
1518  for( EDA_ITEM* item : m_selection )
1519  {
1520  if( alg::contains( *aList, item->m_Uuid ) )
1521  removeItems.push_back( item );
1522  }
1523 
1524  RemoveItemsFromSel( &removeItems, aQuietMode );
1525 }
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:506
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:99
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
int RemoveItemsFromSel(const TOOL_EVENT &aEvent)
EE_SELECTION m_selection

References alg::contains(), m_selection, and RemoveItemsFromSel().

◆ RequestSelection()

EE_SELECTION & EE_SELECTION_TOOL::RequestSelection ( const KICAD_T aFilterList = EE_COLLECTOR::AllItems)

Return either an existing selection (filtered), or the selection at the current cursor if the existing selection is empty.

Definition at line 1130 of file ee_selection_tool.cpp.

1131 {
1132  if( m_selection.Empty() )
1133  {
1134  VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true );
1135 
1136  ClearSelection();
1137  SelectPoint( cursorPos, aFilterList );
1138  m_selection.SetIsHover( true );
1140  }
1141  else // Trim an existing selection by aFilterList
1142  {
1143  bool isMoving = false;
1144 
1145  for( int i = (int) m_selection.GetSize() - 1; i >= 0; --i )
1146  {
1147  EDA_ITEM* item = (EDA_ITEM*) m_selection.GetItem( i );
1148  isMoving |= static_cast<SCH_ITEM*>( item )->IsMoving();
1149 
1150  if( !item->IsType( aFilterList ) )
1151  {
1152  unselect( item );
1154  }
1155  }
1156 
1157  if( !isMoving )
1159  }
1160 
1161  return m_selection;
1162 }
void ClearReferencePoint()
Definition: selection.h:197
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:201
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void SetIsHover(bool aIsHover)
Definition: selection.h:69
void updateReferencePoint()
Set the reference point to the anchor of the top-left item.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
Definition: eda_item.h:182
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:88
void unselect(EDA_ITEM *aItem)
Take necessary action mark an item as unselected.
bool SelectPoint(const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, EDA_ITEM **aItem=nullptr, bool *aSelectionCancelledFlag=nullptr, bool aCheckLocked=false, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
This overload of SelectPoint will create an EE_COLLECTOR and collect hits at location aWhere before c...
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.cpp:53
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
EE_SELECTION m_selection
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

References SELECTION::ClearReferencePoint(), ClearSelection(), SELECTION::Empty(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SELECTION::GetItem(), SELECTION::GetSize(), TOOL_BASE::getViewControls(), EDA_ITEM::IsType(), m_selection, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), SelectPoint(), SELECTION::SetIsHover(), unselect(), EVENTS::UnselectedEvent, and updateReferencePoint().

Referenced by SCH_MOVE_TOOL::AlignElements(), SCH_EDIT_FRAME::AnnotateSymbols(), SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::BreakWire(), SCH_EDIT_TOOL::ChangeSymbols(), SCH_EDIT_TOOL::ChangeTextType(), SCH_EDIT_FRAME::CheckAnnotate(), SCH_EDIT_TOOL::CleanupSheetPins(), SCH_EDIT_TOOL::ConvertDeMorgan(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), SCH_EDIT_FRAME::DeleteAnnotation(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::EditPageNumber(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), Main(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), SelectConnection(), EE_INSPECTION_TOOL::ShowDatasheet(), and BUS_UNFOLD_MENU::update().

◆ Reset()

void EE_SELECTION_TOOL::Reset ( RESET_REASON  aReason)
overridevirtual

Bring the tool to a known, initial state.

If the tool claimed anything from the model or the view, it must release it when its reset.

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 249 of file ee_selection_tool.cpp.

250 {
251  m_frame = getEditFrame<SCH_BASE_FRAME>();
252 
253  if( aReason == TOOL_BASE::MODEL_RELOAD )
254  {
255  // Remove pointers to the selected items from containers without changing their
256  // properties (as they are already deleted while a new sheet is loaded)
257  m_selection.Clear();
258  getView()->GetPainter()->GetSettings()->SetHighlight( false );
259 
260  SYMBOL_EDIT_FRAME* symbolEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
261  SYMBOL_VIEWER_FRAME* symbolViewerFrame = dynamic_cast<SYMBOL_VIEWER_FRAME*>( m_frame );
262 
263  if( symbolEditFrame )
264  {
265  m_isSymbolEditor = true;
266  m_unit = symbolEditFrame->GetUnit();
267  m_convert = symbolEditFrame->GetConvert();
268  }
269  else
270  m_isSymbolViewer = symbolViewerFrame != nullptr;
271  }
272  else
273  // Restore previous properties of selected items and remove them from containers
274  ClearSelection();
275 
276  // Reinsert the VIEW_GROUP, in case it was removed from the VIEW
277  getView()->Remove( &m_selection );
278  getView()->Add( &m_selection );
279 }
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:83
Model changes (required full reload)
Definition: tool_base.h:80
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:350
Symbol library viewer main window.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
SCH_BASE_FRAME * m_frame
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320
EE_SELECTION m_selection
The symbol library editor main window.

References KIGFX::VIEW::Add(), SELECTION::Clear(), ClearSelection(), SYMBOL_EDIT_FRAME::GetConvert(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), SYMBOL_EDIT_FRAME::GetUnit(), TOOL_BASE::getView(), m_convert, m_frame, m_isSymbolEditor, m_isSymbolViewer, m_selection, m_unit, TOOL_BASE::MODEL_RELOAD, KIGFX::VIEW::Remove(), and KIGFX::RENDER_SETTINGS::SetHighlight().

◆ RunMainStack()

void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

88 {
89  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::RunMainStack().

Referenced by DRAWING_TOOL::PlaceText().

◆ select()

void EE_SELECTION_TOOL::select ( EDA_ITEM aItem)
private

Take necessary action mark an item as selected.

Parameters
aItemis an item to be selected.

Definition at line 1840 of file ee_selection_tool.cpp.

1841 {
1842  highlight( aItem, SELECTED, &m_selection );
1843 }
void highlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Highlight the item visually.
#define SELECTED
EE_SELECTION m_selection

References highlight(), m_selection, and SELECTED.

Referenced by AddItemsToSel(), AddItemToSel(), RebuildSelection(), SelectAll(), SelectConnection(), selectMultiple(), and selectPoint().

◆ Selectable()

bool EE_SELECTION_TOOL::Selectable ( const EDA_ITEM aItem,
const VECTOR2I aPos = nullptr,
bool  checkVisibilityOnly = false 
) const

Check conditions for an item to be selected.

Returns
True if the item fulfills conditions to be selected.

Definition at line 1751 of file ee_selection_tool.cpp.

1753 {
1754  // NOTE: in the future this is where Eeschema layer/itemtype visibility will be handled
1755 
1756  SYMBOL_EDIT_FRAME* symEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
1757 
1758  // Do not allow selection of anything except fields when the current symbol in the symbol
1759  // editor is a derived symbol.
1760  if( symEditFrame && symEditFrame->IsSymbolAlias() && aItem->Type() != LIB_FIELD_T )
1761  return false;
1762 
1763  switch( aItem->Type() )
1764  {
1765  case SCH_PIN_T:
1766  {
1767  const SCH_PIN* pin = static_cast<const SCH_PIN*>( aItem );
1768 
1769  if( !pin->IsVisible() && !m_frame->GetShowAllPins() )
1770  return false;
1771 
1773  {
1774  // Pin anchors have to be allowed for auto-starting wires.
1775  if( aPos )
1776  {
1778  VECTOR2I cursorPos = grid.BestSnapAnchor( *aPos, LAYER_CONNECTABLE, nullptr );
1779 
1780  if( pin->IsPointClickableAnchor( (wxPoint) cursorPos ) )
1781  return true;
1782  }
1783 
1784  return false;
1785  }
1786  }
1787  break;
1788 
1789  case LIB_SYMBOL_T: // In symbol_editor we do not want to select the symbol itself.
1790  return false;
1791 
1792  case LIB_FIELD_T: // LIB_FIELD object can always be edited.
1793  break;
1794 
1795  case LIB_SHAPE_T:
1796  case LIB_TEXT_T:
1797  case LIB_PIN_T:
1798  if( symEditFrame )
1799  {
1800  LIB_ITEM* lib_item = (LIB_ITEM*) aItem;
1801 
1802  if( lib_item->GetUnit() && lib_item->GetUnit() != symEditFrame->GetUnit() )
1803  return false;
1804 
1805  if( lib_item->GetConvert() && lib_item->GetConvert() != symEditFrame->GetConvert() )
1806  return false;
1807  }
1808 
1809  break;
1810 
1811  case SCH_MARKER_T: // Always selectable
1812  return true;
1813 
1814  default: // Suppress warnings
1815  break;
1816  }
1817 
1818  return true;
1819 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
The base class for drawable items used by schematic library symbols.
Definition: lib_item.h:61
EESCHEMA_SETTINGS * eeconfig() const
int GetUnit() const
Definition: lib_item.h:266
bool IsSymbolAlias() const
Restore the empty editor screen, without any symbol or library selected.
int GetConvert() const
Definition: lib_item.h:269
virtual bool GetShowAllPins() const
Allow some frames to show/hide hidden pins.
SCH_BASE_FRAME * m_frame
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
The symbol library editor main window.

References SCH_BASE_FRAME::eeconfig(), SYMBOL_EDIT_FRAME::GetConvert(), LIB_ITEM::GetConvert(), SCH_BASE_FRAME::GetShowAllPins(), SYMBOL_EDIT_FRAME::GetUnit(), LIB_ITEM::GetUnit(), grid, SYMBOL_EDIT_FRAME::IsSymbolAlias(), LAYER_CONNECTABLE, LIB_FIELD_T, LIB_PIN_T, LIB_SHAPE_T, LIB_SYMBOL_T, LIB_TEXT_T, m_frame, EESCHEMA_SETTINGS::m_Selection, TOOL_BASE::m_toolMgr, pin, SCH_MARKER_T, SCH_PIN_T, EESCHEMA_SETTINGS::SELECTION::select_pin_selects_symbol, and EDA_ITEM::Type().

Referenced by SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), narrowSelection(), SelectAll(), and selectMultiple().

◆ SelectAll()

int EE_SELECTION_TOOL::SelectAll ( const TOOL_EVENT aEvent)

Definition at line 956 of file ee_selection_tool.cpp.

957 {
958  m_multiple = true; // Multiple selection mode is active
959  KIGFX::VIEW* view = getView();
960 
961  // hold all visible items
962  std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
963  std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> sheetPins;
964 
965  // Filter the view items based on the selection box
966  BOX2I selectionBox;
967 
968  selectionBox.SetMaximum();
969  view->Query( selectionBox, selectedItems ); // Get the list of selected items
970 
971  // Sheet pins aren't in the view; add them by hand
972  for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : selectedItems )
973  {
974  SCH_SHEET* sheet = dynamic_cast<SCH_SHEET*>( pair.first );
975 
976  if( sheet )
977  {
978  int layer = pair.second;
979 
980  for( SCH_SHEET_PIN* pin : sheet->GetPins() )
981  sheetPins.emplace_back( KIGFX::VIEW::LAYER_ITEM_PAIR( pin, layer ) );
982  }
983  }
984 
985  selectedItems.insert( selectedItems.end(), sheetPins.begin(), sheetPins.end() );
986 
987  for( const std::pair<KIGFX::VIEW_ITEM*, int>& item_pair : selectedItems )
988  {
989  if( EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( item_pair.first ) )
990  {
991  if( Selectable( item ) )
992  select( item );
993  }
994  }
995 
996  m_multiple = false;
997 
998  return 0;
999 }
bool Selectable(const EDA_ITEM *aItem, const VECTOR2I *aPos=nullptr, bool checkVisibilityOnly=false) const
Check conditions for an item to be selected.
void select(EDA_ITEM *aItem)
Take necessary action mark an item as selected.
void SetMaximum()
Definition: box2.h:57
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:65
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
std::vector< SCH_SHEET_PIN * > & GetPins()
Definition: sch_sheet.h:183
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
Definition: view.h:73
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
virtual int Query(const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
Find all visible items that touch or are within the rectangle aRect.
Definition: view.cpp:426
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68

References SCH_SHEET::GetPins(), TOOL_BASE::getView(), SELECTION_TOOL::m_multiple, pin, KIGFX::VIEW::Query(), select(), Selectable(), and BOX2< Vec >::SetMaximum().

Referenced by setTransitions().

◆ SelectConnection()

int EE_SELECTION_TOOL::SelectConnection ( const TOOL_EVENT aEvent)

Clear current selection event handler.

Definition at line 1403 of file ee_selection_tool.cpp.

1404 {
1405  static KICAD_T wiresAndBuses[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
1406 
1407  RequestSelection( wiresAndBuses );
1408 
1409  if( m_selection.Empty() )
1410  return 0;
1411 
1412  SCH_LINE* line = (SCH_LINE*) m_selection.Front();
1413  EDA_ITEMS items;
1414 
1416  std::set<SCH_ITEM*> conns = m_frame->GetScreen()->MarkConnections( line );
1417 
1418  for( SCH_ITEM* item : conns )
1419  select( item );
1420 
1421  if( m_selection.GetSize() > 1 )
1423 
1424  return 0;
1425 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:200
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void select(EDA_ITEM *aItem)
Take necessary action mark an item as selected.
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Return either an existing selection (filtered), or the selection at the current cursor if the existin...
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:506
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:88
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
SCH_BASE_FRAME * m_frame
void ClearDrawingState()
Clear the state flags of all the items in the screen.
Definition: sch_screen.cpp:893
EE_SELECTION m_selection
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
EDA_ITEM * Front() const
Definition: selection.h:145
std::set< SCH_ITEM * > MarkConnections(SCH_LINE *aSegment)
Return all wires and junctions connected to aSegment which are not connected any symbol pin.
Definition: sch_screen.cpp:358

References SCH_SCREEN::ClearDrawingState(), SELECTION::Empty(), EOT, SELECTION::Front(), SCH_BASE_FRAME::GetScreen(), SELECTION::GetSize(), m_frame, m_selection, TOOL_BASE::m_toolMgr, SCH_SCREEN::MarkConnections(), TOOL_MANAGER::ProcessEvent(), RequestSelection(), SCH_LINE_LOCATE_BUS_T, SCH_LINE_LOCATE_WIRE_T, select(), and EVENTS::SelectedEvent.

Referenced by setTransitions().

◆ SelectHighlightItem()

void EE_SELECTION_TOOL::SelectHighlightItem ( EDA_ITEM aItem)
inline

Find (but don't select) node under cursor.

Definition at line 127 of file ee_selection_tool.h.

References highlight(), and SELECTED.

◆ selectionContains()

bool EE_SELECTION_TOOL::selectionContains ( const VECTOR2I aPoint) const
private

Set up handlers for various events.

Returns
True if the given point is contained in any of selected items' bounding box.

Definition at line 1918 of file ee_selection_tool.cpp.

1919 {
1920  const unsigned GRIP_MARGIN = 20;
1921  VECTOR2I margin = getView()->ToWorld( VECTOR2I( GRIP_MARGIN, GRIP_MARGIN ), false );
1922 
1923  // Check if the point is located within any of the currently selected items bounding boxes
1924  for( EDA_ITEM* item : m_selection )
1925  {
1926  BOX2I itemBox = item->ViewBBox();
1927  itemBox.Inflate( margin.x, margin.y ); // Give some margin for gripping an item
1928 
1929  if( itemBox.Contains( aPoint ) )
1930  return true;
1931  }
1932 
1933  return false;
1934 }
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:449
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
bool Contains(const Vec &aPoint) const
Definition: box2.h:134
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:281
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
EE_SELECTION m_selection

References BOX2< Vec >::Contains(), TOOL_BASE::getView(), BOX2< Vec >::Inflate(), m_selection, KIGFX::VIEW::ToWorld(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Main().

◆ SelectionMenu()

int EE_SELECTION_TOOL::SelectionMenu ( const TOOL_EVENT aEvent)

Show 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.

Definition at line 1590 of file ee_selection_tool.cpp.

1591 {
1592  EE_COLLECTOR* collector = aEvent.Parameter<EE_COLLECTOR*>();
1593 
1594  if( !doSelectionMenu( collector ) )
1595  collector->m_MenuCancelled = true;
1596 
1597  return 0;
1598 }
bool m_MenuCancelled
Definition: collector.h:244
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
bool doSelectionMenu(EE_COLLECTOR *aItems)
Allow the selection of a single item from a list via pop-up menu.

References doSelectionMenu(), COLLECTOR::m_MenuCancelled, and TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ selectMultiple()

bool EE_SELECTION_TOOL::selectMultiple ( )
private

Handle drawing a selection box that allows one to select many items at the same time.

Returns
true if the function was canceled (i.e. CancelEvent was received).

Definition at line 1194 of file ee_selection_tool.cpp.

1195 {
1196  bool cancelled = false; // Was the tool canceled while it was running?
1197  m_multiple = true; // Multiple selection mode is active
1198  KIGFX::VIEW* view = getView();
1199 
1201  view->Add( &area );
1202 
1203  while( TOOL_EVENT* evt = Wait() )
1204  {
1205  int width = area.GetEnd().x - area.GetOrigin().x;
1206  int height = area.GetEnd().y - area.GetOrigin().y;
1207 
1208  /* Selection mode depends on direction of drag-selection:
1209  * Left > Right : Select objects that are fully enclosed by selection
1210  * Right > Left : Select objects that are crossed by selection
1211  */
1212  bool isWindowSelection = width >= 0;
1213 
1214  if( view->IsMirroredX() )
1215  isWindowSelection = !isWindowSelection;
1216 
1219 
1220  if( evt->IsCancelInteractive() || evt->IsActivate() )
1221  {
1222  cancelled = true;
1223  break;
1224  }
1225 
1226  if( evt->IsDrag( BUT_LEFT ) )
1227  {
1229  ClearSelection();
1230 
1231  // Start drawing a selection box
1232  area.SetOrigin( evt->DragOrigin() );
1233  area.SetEnd( evt->Position() );
1234  area.SetAdditive( m_drag_additive );
1236  area.SetExclusiveOr( false );
1237 
1238  view->SetVisible( &area, true );
1239  view->Update( &area );
1240  getViewControls()->SetAutoPan( true );
1241  }
1242 
1243  if( evt->IsMouseUp( BUT_LEFT ) )
1244  {
1245  getViewControls()->SetAutoPan( false );
1246 
1247  // End drawing the selection box
1248  view->SetVisible( &area, false );
1249 
1250  // Fetch items from the RTree that are in our area of interest
1251  std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> nearbyViewItems;
1252  view->Query( area.ViewBBox(), nearbyViewItems );
1253 
1254  // Build lists of nearby items and their children
1255  std::vector<EDA_ITEM*> nearbyItems;
1256  std::vector<EDA_ITEM*> nearbyChildren;
1257 
1258  for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : nearbyViewItems )
1259  {
1260  EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( pair.first );
1261 
1262  if( item )
1263  {
1265  nearbyItems.push_back( item );
1266  }
1267 
1268  if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item ) )
1269  {
1270  sch_item->RunOnChildren(
1271  [&]( SCH_ITEM* aChild )
1272  {
1273  nearbyChildren.push_back( aChild );
1274  } );
1275  }
1276  }
1277 
1278  EDA_RECT selectionRect( (wxPoint) area.GetOrigin(), wxSize( width, height ) );
1279  selectionRect.Normalize();
1280 
1281  bool anyAdded = false;
1282  bool anySubtracted = false;
1283  auto selectItem =
1284  [&]( EDA_ITEM* aItem )
1285  {
1286  if( m_subtractive || ( m_exclusive_or && aItem->IsSelected() ) )
1287  {
1288  unselect( aItem );
1289  anySubtracted = true;
1290  }
1291  else
1292  {
1293  select( aItem );
1294  aItem->SetFlags( STARTPOINT | ENDPOINT );
1295  anyAdded = true;
1296  }
1297  };
1298 
1299  for( EDA_ITEM* item : nearbyItems )
1300  {
1301  if( Selectable( item ) && item->HitTest( selectionRect, isWindowSelection ) )
1302  {
1303  item->SetFlags( TEMP_SELECTED );
1304  selectItem( item );
1305  }
1306  }
1307 
1308  for( EDA_ITEM* item : nearbyChildren )
1309  {
1310  if( Selectable( item )
1311  && !item->GetParent()->HasFlag( TEMP_SELECTED )
1312  && item->HitTest( selectionRect, isWindowSelection ) )
1313  {
1314  selectItem( item );
1315  }
1316  }
1317 
1318  m_selection.SetIsHover( false );
1319 
1320  // Inform other potentially interested tools
1321  if( anyAdded )
1323 
1324  if( anySubtracted )
1326 
1327  break; // Stop waiting for events
1328  }
1329 
1330  // Allow some actions for navigation
1331  for( int i = 0; allowedActions[i]; ++i )
1332  {
1333  if( evt->IsAction( allowedActions[i] ) )
1334  {
1335  evt->SetPassEvent();
1336  break;
1337  }
1338  }
1339  }
1340 
1341  getViewControls()->SetAutoPan( false );
1342 
1343  // Stop drawing the selection box
1344  view->Remove( &area );
1345  m_multiple = false; // Multiple selection mode is inactive
1346 
1347  if( !cancelled )
1349 
1350  return cancelled;
1351 }
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
void ClearReferencePoint()
Definition: selection.h:197
static const TOOL_EVENT SelectedEvent
Definition: actions.h:200
#define STARTPOINT
When a line is selected, these flags indicate which.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:201
bool Selectable(const EDA_ITEM *aItem, const VECTOR2I *aPos=nullptr, bool checkVisibilityOnly=false) const
Check conditions for an item to be selected.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
Definition: eda_item.h:155
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:350
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:152
void SetExclusiveOr(bool aExclusiveOr)
void select(EDA_ITEM *aItem)
Take necessary action mark an item as selected.
#define ENDPOINT
ends. (Used to support dragging.)
void SetIsHover(bool aIsHover)
Definition: selection.h:69
void SetAdditive(bool aAdditive)
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Test if aPosition is inside or on the boundary of this item.
Definition: eda_item.h:224
void SetOrigin(const VECTOR2I &aOrigin)
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Generic, UI-independent tool event.
Definition: tool_event.h:152
const BOX2I ViewBBox() const override
Set the origin of the rectangle (the fixed corner)
EDA_ITEM * GetParent() const
Definition: eda_item.h:114
const TOOL_ACTION * allowedActions[]
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:153
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:238
void SetSubtractive(bool aSubtractive)
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
void unselect(EDA_ITEM *aItem)
Take necessary action mark an item as unselected.
#define TEMP_SELECTED
flag indicating that the structure has already selected
SCH_BASE_FRAME * m_frame
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
Definition: view.h:73
Handle the component boundary box.
Definition: eda_rect.h:42
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Definition: view.cpp:1516
Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between two poin...
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320
virtual int Query(const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
Find all visible items that touch or are within the rectangle aRect.
Definition: view.cpp:426
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
EE_SELECTION m_selection
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1570

References KIGFX::VIEW::Add(), allowedActions, BUT_LEFT, EDA_ITEM::ClearFlags(), SELECTION::ClearReferencePoint(), ClearSelection(), ENDPOINT, SCH_BASE_FRAME::GetCanvas(), KIGFX::PREVIEW::SELECTION_AREA::GetEnd(), KIGFX::PREVIEW::SELECTION_AREA::GetOrigin(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), KIGFX::VIEW::IsMirroredX(), SELECTION_TOOL::m_drag_additive, SELECTION_TOOL::m_drag_subtractive, SELECTION_TOOL::m_exclusive_or, m_frame, SELECTION_TOOL::m_multiple, m_selection, SELECTION_TOOL::m_subtractive, TOOL_BASE::m_toolMgr, EDA_RECT::Normalize(), TOOL_MANAGER::ProcessEvent(), KIGFX::VIEW::Query(), KIGFX::VIEW::Remove(), select(), SELECT_LASSO, SELECT_WINDOW, Selectable(), EVENTS::SelectedEvent, KIGFX::PREVIEW::SELECTION_AREA::SetAdditive(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::PREVIEW::SELECTION_AREA::SetEnd(), KIGFX::PREVIEW::SELECTION_AREA::SetExclusiveOr(), SELECTION::SetIsHover(), KIGFX::PREVIEW::SELECTION_AREA::SetOrigin(), KIGFX::PREVIEW::SELECTION_AREA::SetSubtractive(), KIGFX::VIEW::SetVisible(), STARTPOINT, TEMP_SELECTED, unselect(), EVENTS::UnselectedEvent, KIGFX::VIEW::Update(), KIGFX::PREVIEW::SELECTION_AREA::ViewBBox(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Main().

◆ SelectNode()

int EE_SELECTION_TOOL::SelectNode ( const TOOL_EVENT aEvent)

If node selected then expand to connection, otherwise select connection under cursor.

Definition at line 1393 of file ee_selection_tool.cpp.

1394 {
1395  VECTOR2I cursorPos = getViewControls()->GetCursorPosition( false );
1396 
1397  SelectPoint( cursorPos, nodeTypes );
1398 
1399  return 0;
1400 }
static KICAD_T nodeTypes[]
bool SelectPoint(const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, EDA_ITEM **aItem=nullptr, bool *aSelectionCancelledFlag=nullptr, bool aCheckLocked=false, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
This overload of SelectPoint will create an EE_COLLECTOR and collect hits at location aWhere before c...
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

References KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_BASE::getViewControls(), nodeTypes, and SelectPoint().

Referenced by setTransitions().

◆ SelectPoint()

bool EE_SELECTION_TOOL::SelectPoint ( const VECTOR2I aWhere,
const KICAD_T aFilterList = EE_COLLECTOR::AllItems,
EDA_ITEM **  aItem = nullptr,
bool *  aSelectionCancelledFlag = nullptr,
bool  aCheckLocked = false,
bool  aAdd = false,
bool  aSubtract = false,
bool  aExclusiveOr = false 
)

This overload of SelectPoint will create an EE_COLLECTOR and collect hits at location aWhere before calling the primary SelectPoint method.

Parameters
aWhereis the location where the item(s) should be collected
aItemis set to the newly selected item if only one was selected, otherwise is unchanged.
aSelectionCancelledFlagallows the function to inform its caller that a selection was canceled (for instance, by clicking outside of the disambiguation menu).
aCheckLockedindicates if locked items should be excluded.
aAddindicates if found item(s) should be added to the selection
aSubtractindicates if found item(s) should be subtracted from the selection
aExclusiveOrindicates if found item(s) should be toggle in the selection

Definition at line 940 of file ee_selection_tool.cpp.

944 {
945  EE_COLLECTOR collector;
946 
947  if( !CollectHits( collector, aWhere, aFilterList ) )
948  return false;
949 
950  narrowSelection( collector, aWhere, aCheckLocked, true );
951 
952  return selectPoint( collector, aItem, aSelectionCancelledFlag, aAdd, aSubtract, aExclusiveOr );
953 }
bool selectPoint(EE_COLLECTOR &aCollector, EDA_ITEM **aItem=nullptr, bool *aSelectionCancelledFlag=nullptr, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
This is the primary SelectPoint method that will prompt the user with a menu to disambiguate multiple...
void narrowSelection(EE_COLLECTOR &collector, const VECTOR2I &aWhere, bool aCheckLocked, bool aSelectPoints)
Apply rules to narrow the collection down to selectable objects, and then heuristics to try and narro...
bool CollectHits(EE_COLLECTOR &aCollector, const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Select one or more items at the location given by parameter aWhere.

References CollectHits(), narrowSelection(), and selectPoint().

Referenced by disambiguateCursor(), Main(), RequestSelection(), SelectNode(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ selectPoint()

bool EE_SELECTION_TOOL::selectPoint ( EE_COLLECTOR aCollector,
EDA_ITEM **  aItem = nullptr,
bool *  aSelectionCancelledFlag = nullptr,
bool  aAdd = false,
bool  aSubtract = false,
bool  aExclusiveOr = false 
)
private

This is the primary SelectPoint method that will prompt the user with a menu to disambiguate multiple selections and then finish by adding, subtracting or toggling the item(s) to the actual selection group.

Parameters
aCollectoris an EE_COLLECTOR that already has collected items
aItemis set to the newly selected item if only one was selected, otherwise is unchanged.
aSelectionCancelledFlagallows the function to inform its caller that a selection was canceled (for instance, by clicking outside of the disambiguation menu).
aAddindicates if found item(s) should be added to the selection
aSubtractindicates if found item(s) should be subtracted from the selection
aExclusiveOrindicates if found item(s) should be toggle in the selection

Definition at line 871 of file ee_selection_tool.cpp.

874 {
876 
877  // If still more than one item we're going to have to ask the user.
878  if( aCollector.GetCount() > 1 )
879  {
880  // Try to call selectionMenu via RunAction() to avoid event-loop contention
881  // But it we cannot handle the event, then we don't have an active tool loop, so
882  // handle it directly.
883  if( !m_toolMgr->RunAction( EE_ACTIONS::selectionMenu, true, &aCollector ) )
884  {
885  if( !doSelectionMenu( &aCollector ) )
886  aCollector.m_MenuCancelled = true;
887  }
888 
889  if( aCollector.m_MenuCancelled )
890  {
891  if( aSelectionCancelledFlag )
892  *aSelectionCancelledFlag = true;
893 
894  return false;
895  }
896  }
897 
898  if( !aAdd && !aSubtract && !aExclusiveOr )
899  ClearSelection();
900 
901  bool anyAdded = false;
902  bool anySubtracted = false;
903 
904  if( aCollector.GetCount() > 0 )
905  {
906  for( int i = 0; i < aCollector.GetCount(); ++i )
907  {
908  if( aSubtract || ( aExclusiveOr && aCollector[i]->IsSelected() ) )
909  {
910  unselect( aCollector[i] );
911  anySubtracted = true;
912  }
913  else
914  {
915  select( aCollector[i] );
916  anyAdded = true;
917  }
918  }
919  }
920 
921  if( anyAdded )
922  {
924 
925  if( aItem && aCollector.GetCount() == 1 )
926  *aItem = aCollector[0];
927 
928  return true;
929  }
930  else if( anySubtracted )
931  {
933  return true;
934  }
935 
936  return false;
937 }
void ClearReferencePoint()
Definition: selection.h:197
static const TOOL_EVENT SelectedEvent
Definition: actions.h:200
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:201
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
void select(EDA_ITEM *aItem)
Take necessary action mark an item as selected.
bool m_MenuCancelled
Definition: collector.h:244
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:82
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
void unselect(EDA_ITEM *aItem)
Take necessary action mark an item as unselected.
bool doSelectionMenu(EE_COLLECTOR *aItems)
Allow the selection of a single item from a list via pop-up menu.
static TOOL_ACTION selectionMenu
Runs a selection menu to select from a list of items.
Definition: ee_actions.h:67
EE_SELECTION m_selection

References SELECTION::ClearReferencePoint(), ClearSelection(), doSelectionMenu(), COLLECTOR::GetCount(), COLLECTOR::m_MenuCancelled, m_selection, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), TOOL_MANAGER::RunAction(), select(), EVENTS::SelectedEvent, EE_ACTIONS::selectionMenu, unselect(), and EVENTS::UnselectedEvent.

Referenced by Main(), and SelectPoint().

◆ SetContextMenu()

void TOOL_INTERACTIVE::SetContextMenu ( ACTION_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Assign a context menu and tells when it should be activated.

Parameters
aMenuis the menu to be assigned.
aTriggerdetermines conditions upon which the context menu is activated.

Definition at line 76 of file tool_interactive.cpp.

77 {
78  if( aMenu )
79  aMenu->SetTool( this );
80  else
81  aTrigger = CMENU_OFF;
82 
83  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
84 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void SetTool(TOOL_INTERACTIVE *aTool)
Set a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Set behavior of the tool's context popup menu.

References CMENU_OFF, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ScheduleContextMenu(), and ACTION_MENU::SetTool().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setModifiersState()

void SELECTION_TOOL::setModifiersState ( bool  aShiftState,
bool  aCtrlState,
bool  aAltState 
)
protectedinherited

Set the configuration of m_additive, m_subtractive, m_exclusive_or, m_skip_heuristics from the state of modifier keys SHIFT, CTRL, ALT and depending on the OS.

Definition at line 40 of file selection_tool.cpp.

41 {
42  // Set the configuration of m_additive, m_subtractive, m_exclusive_or from the state of
43  // modifier keys SHIFT and CTRL
44 
45  // ALT key cannot be used on MSW because of a conflict with the system menu
46 
47  m_subtractive = aCtrlState && aShiftState;
48  m_additive = !aCtrlState && aShiftState;
49  m_exclusive_or = false;
50  m_highlight_modifier = aCtrlState && !aShiftState;
51 
52  // Drag is more forgiving and allows either Ctrl+Drag or Shift+Drag to add to the selection
53  // Note, however that we cannot provide disambiguation at the same time as the box selection
54  m_drag_additive = ( aCtrlState || aShiftState ) && !aAltState;
55  m_drag_subtractive = aCtrlState && aShiftState && !aAltState;
56 
57  // While the ALT key has some conflicts under MSW (and some flavors of Linux WMs), it remains
58  // useful for users who only use tap-click rather than holding the button. We disable it for
59  // windows because it flashes the disambiguation menu without showing data
60 #ifndef __WINDOWS__
61  m_skip_heuristics = aAltState;
62 #else
63  m_skip_heuristics = false;
64 #endif
65 
66 }
bool m_highlight_modifier

References SELECTION_TOOL::m_additive, SELECTION_TOOL::m_drag_additive, SELECTION_TOOL::m_drag_subtractive, SELECTION_TOOL::m_exclusive_or, SELECTION_TOOL::m_highlight_modifier, SELECTION_TOOL::m_skip_heuristics, and SELECTION_TOOL::m_subtractive.

Referenced by PL_SELECTION_TOOL::disambiguateCursor(), disambiguateCursor(), PCB_SELECTION_TOOL::disambiguateCursor(), PL_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), Main(), PCB_SELECTION_TOOL::Main(), OnIdle(), and PCB_SELECTION_TOOL::OnIdle().

◆ setTransitions()

void EE_SELECTION_TOOL::setTransitions ( )
overrideprivatevirtual

This method is meant to be overridden in order to specify handlers for events.

It is called every time tool is reset or finished.

Implements TOOL_INTERACTIVE.

Definition at line 1937 of file ee_selection_tool.cpp.

1938 {
1940 
1945 
1951 
1953 
1955 }
int UpdateMenu(const TOOL_EVENT &aEvent)
int SelectAll(const TOOL_EVENT &aEvent)
static const TOOL_EVENT DisambiguatePoint
Definition: actions.h:215
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
Definition: ee_actions.h:63
static TOOL_ACTION selectConnection
If current selection is a wire or bus, expand to entire connection.
Definition: ee_actions.h:53
int AddItemsToSel(const TOOL_EVENT &aEvent)
static TOOL_ACTION removeItemsFromSel
Definition: ee_actions.h:64
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
int disambiguateCursor(const TOOL_EVENT &aEvent)
Handle disambiguation actions including displaying the menu.
static TOOL_ACTION removeItemFromSel
Definition: ee_actions.h:60
int SelectNode(const TOOL_EVENT &aEvent)
If node selected then expand to connection, otherwise select connection under cursor.
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: ee_actions.h:59
int SelectConnection(const TOOL_EVENT &aEvent)
Clear current selection event handler.
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: ee_actions.h:46
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:56
static TOOL_ACTION updateMenu
Definition: actions.h:167
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
int AddItemToSel(const TOOL_EVENT &aEvent)
int SelectionMenu(const TOOL_EVENT &aEvent)
Show a popup menu to trim the COLLECTOR passed as aEvent's parameter down to a single item.
static TOOL_ACTION selectionMenu
Runs a selection menu to select from a list of items.
Definition: ee_actions.h:67
static TOOL_ACTION selectNode
Select the junction, wire or bus segment under the cursor.
Definition: ee_actions.h:49
int RemoveItemsFromSel(const TOOL_EVENT &aEvent)
static TOOL_ACTION selectAll
Definition: actions.h:70
int Main(const TOOL_EVENT &aEvent)
The main loop.

References EE_ACTIONS::addItemsToSel, AddItemsToSel(), EE_ACTIONS::addItemToSel, AddItemToSel(), EE_ACTIONS::clearSelection, ClearSelection(), disambiguateCursor(), EVENTS::DisambiguatePoint, TOOL_INTERACTIVE::Go(), Main(), EE_ACTIONS::removeItemFromSel, RemoveItemFromSel(), EE_ACTIONS::removeItemsFromSel, RemoveItemsFromSel(), ACTIONS::selectAll, SelectAll(), EE_ACTIONS::selectConnection, SelectConnection(), EE_ACTIONS::selectionActivate, EE_ACTIONS::selectionMenu, SelectionMenu(), EE_ACTIONS::selectNode, SelectNode(), UpdateMenu(), and ACTIONS::updateMenu.

◆ UnbrightenItem()

void EE_SELECTION_TOOL::UnbrightenItem ( EDA_ITEM aItem)

Definition at line 1534 of file ee_selection_tool.cpp.

1535 {
1536  unhighlight( aItem, BRIGHTENED );
1537 }
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Unhighlight the item visually.
#define BRIGHTENED
item is drawn with a bright contour

References BRIGHTENED, and unhighlight().

Referenced by SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ unhighlight()

void EE_SELECTION_TOOL::unhighlight ( EDA_ITEM aItem,
int  aHighlightMode,
EE_SELECTION aGroup = nullptr 
)
private

Unhighlight the item visually.

Parameters
aItemis an item to be be highlighted.
aHighlightModeshould be either SELECTED or BRIGHTENED
aGroupis the group to remove the item from.

Definition at line 1885 of file ee_selection_tool.cpp.

1886 {
1887  KICAD_T itemType = aItem->Type();
1888 
1889  if( aMode == SELECTED )
1890  aItem->ClearSelected();
1891  else if( aMode == BRIGHTENED )
1892  aItem->ClearBrightened();
1893 
1894  if( aGroup )
1895  aGroup->Remove( aItem );
1896 
1897  // Unhighlight pins and fields. (All the other symbol children are currently only
1898  // represented in the LIB_SYMBOL.)
1899  if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
1900  {
1901  sch_item->RunOnChildren(
1902  [&]( SCH_ITEM* aChild )
1903  {
1904  if( aMode == SELECTED )
1905  aChild->ClearSelected();
1906  else if( aMode == BRIGHTENED )
1907  aChild->ClearBrightened();
1908  } );
1909  }
1910 
1911  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
1912  getView()->Update( aItem->GetParent() );
1913  else
1914  getView()->Update( aItem );
1915 }
void ClearSelected()
Definition: eda_item.h:131
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
void ClearBrightened()
Definition: eda_item.h:132
EDA_ITEM * GetParent() const
Definition: eda_item.h:114
#define SELECTED
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.cpp:44
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:182
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1570
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:112
#define BRIGHTENED
item is drawn with a bright contour

References BRIGHTENED, EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearSelected(), EDA_ITEM::GetParent(), TOOL_BASE::getView(), SELECTION::Remove(), SCH_FIELD_T, SCH_PIN_T, SCH_SHEET_PIN_T, SELECTED, EDA_ITEM::Type(), and KIGFX::VIEW::Update().

Referenced by ClearSelection(), doSelectionMenu(), UnbrightenItem(), and unselect().

◆ unselect()

void EE_SELECTION_TOOL::unselect ( EDA_ITEM aItem)
private

Take necessary action mark an item as unselected.

Parameters
aItemis an item to be unselected.

Definition at line 1846 of file ee_selection_tool.cpp.

1847 {
1848  unhighlight( aItem, SELECTED, &m_selection );
1849 }
#define SELECTED
EE_SELECTION m_selection
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Unhighlight the item visually.

References m_selection, SELECTED, and unhighlight().

Referenced by RemoveItemFromSel(), RemoveItemsFromSel(), RequestSelection(), selectMultiple(), and selectPoint().

◆ UpdateMenu()

int EE_SELECTION_TOOL::UpdateMenu ( const TOOL_EVENT aEvent)

Definition at line 282 of file ee_selection_tool.cpp.

283 {
284  ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
285  CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
286 
287  if( conditionalMenu )
288  conditionalMenu->Evaluate( m_selection );
289 
290  if( actionMenu )
291  actionMenu->UpdateAll();
292 
293  return 0;
294 }
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:48
void UpdateAll()
Run update handlers for the menu and its submenus.
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
EE_SELECTION m_selection

References m_selection, TOOL_EVENT::Parameter(), and ACTION_MENU::UpdateAll().

Referenced by setTransitions().

◆ updateReferencePoint()

void EE_SELECTION_TOOL::updateReferencePoint ( )
private

Set the reference point to the anchor of the top-left item.

Definition at line 1165 of file ee_selection_tool.cpp.

1166 {
1167  VECTOR2I refP( 0, 0 );
1168 
1169  if( m_selection.Size() > 0 )
1170  {
1171  if( m_isSymbolEditor )
1172  refP = static_cast<LIB_ITEM*>( m_selection.GetTopLeftItem() )->GetPosition();
1173  else
1174  refP = static_cast<SCH_ITEM*>( m_selection.GetTopLeftItem() )->GetPosition();
1175  }
1176 
1178 }
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:192
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
int Size() const
Returns the number of selected parts.
Definition: selection.h:104
EE_SELECTION m_selection

References EE_SELECTION::GetTopLeftItem(), m_isSymbolEditor, m_selection, SELECTION::SetReferencePoint(), and SELECTION::Size().

Referenced by RebuildSelection(), and RequestSelection().

◆ Wait()

TOOL_EVENT * TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Suspend execution of the tool until an event specified in aEventList arrives.

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

58 {
59  return m_toolMgr->ScheduleWait( this, aEventList );
60 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pause execution of a given tool until one or more events matching aConditions arrives.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ScheduleWait().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), ZOOM_TOOL::Main(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), PL_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PL_SELECTION_TOOL::selectMultiple(), selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_additive

◆ m_canceledMenu

bool SELECTION_TOOL::m_canceledMenu
protectedinherited

◆ m_convert

int EE_SELECTION_TOOL::m_convert
private

Definition at line 303 of file ee_selection_tool.h.

Referenced by CollectHits(), Init(), and Reset().

◆ m_disambiguateTimer

wxTimer SELECTION_TOOL::m_disambiguateTimer
protectedinherited

◆ m_drag_additive

bool SELECTION_TOOL::m_drag_additive
protectedinherited

◆ m_drag_subtractive

bool SELECTION_TOOL::m_drag_subtractive
protectedinherited

◆ m_exclusive_or

◆ m_frame

◆ m_highlight_modifier

bool SELECTION_TOOL::m_highlight_modifier
protectedinherited

Definition at line 53 of file selection_tool.h.

Referenced by PCB_SELECTION_TOOL::Main(), and SELECTION_TOOL::setModifiersState().

◆ m_isSymbolEditor

bool EE_SELECTION_TOOL::m_isSymbolEditor
private

◆ m_isSymbolViewer

bool EE_SELECTION_TOOL::m_isSymbolViewer
private

Definition at line 301 of file ee_selection_tool.h.

Referenced by Init(), and Reset().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

The functions below are not yet implemented - their interface may change.

Definition at line 125 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), ROUTER_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PL_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), BOARD_EDITOR_CONTROL::Init(), GERBVIEW_SELECTION_TOOL::Init(), EDA_3D_CONTROLLER::Init(), DRAWING_TOOL::Init(), Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), PCB_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PICKER_TOOL::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_PICKER_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PL_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_multiple

◆ m_nonModifiedCursor

KICURSOR EE_SELECTION_TOOL::m_nonModifiedCursor
private

Definition at line 298 of file ee_selection_tool.h.

Referenced by Main(), and OnIdle().

◆ m_originalCursor

◆ m_selection

◆ m_skip_heuristics

◆ m_subtractive

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

Names are expected to obey the format application.ToolName (eg. pcbnew.InteractiveSelection).

Definition at line 209 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), TOOL_BASE::GetId(), and TOOL_BASE::IsToolActive().

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), PCB_SELECTION_TOOL::AddItemToSel(), AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), BOARD_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), PL_EDIT_TOOL::Copy(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MICROWAVE_TOOL::createInductorBetween(), DRC_TOOL::CrossProbe(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::FindItem(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_REANNOTATE_TOOL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), CONVERT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), GLOBAL_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), PL_POINT_EDITOR::Init(), BOARD_INSPECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PCB_POINT_EDITOR::Init(), BOARD_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), SCH_NAVIGATE_TOOL::LeaveSheet(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), CVPCB_CONTROL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), PL_SELECTION_TOOL::onDisambiguationExpire(), onDisambiguationExpire(), PCB_SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_CONTROL::Print(), GERBVIEW_CONTROL::Print(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), RebuildSelection(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), PL_SELECTION_TOOL::RemoveItemFromSel(), RemoveItemFromSel(), PCB_SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), RequestSelection(), PCB_SELECTION_TOOL::RequestSelection(), PAD_TOOL::Reset(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), Selectable(), SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), PCB_SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), EDA_3D_CONTROLLER::SetMaterial(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GROUP_TOOL::Ungroup(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PCB_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), EE_POINT_EDITOR::updateParentItem(), BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest(), PNS::TOOL_BASE::updateStartItem(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 213 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

Definition at line 206 of file tool_base.h.

Referenced by TOOL_BASE::GetType(), and BOARD_COMMIT::Push().

◆ m_unit

int EE_SELECTION_TOOL::m_unit
private

Definition at line 302 of file ee_selection_tool.h.

Referenced by CollectHits(), Init(), and Reset().


The documentation for this class was generated from the following files: