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)
 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 55 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 108 of file ee_selection_tool.cpp.

108  :
109  TOOL_INTERACTIVE( "eeschema.InteractiveSelection" ),
110  m_frame( nullptr ),
112  m_isSymbolEditor( false ),
113  m_isSymbolViewer( false ),
114  m_unit( 0 ),
115  m_convert( 0 )
116 {
117  m_selection.Clear();
118 }
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:82
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 121 of file ee_selection_tool.cpp.

122 {
123  getView()->Remove( &m_selection );
124 }
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:353
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 1367 of file ee_selection_tool.cpp.

1368 {
1369  AddItemsToSel( aEvent.Parameter<EDA_ITEMS*>(), false );
1370  m_selection.SetIsHover( false );
1371  return 0;
1372 }
int AddItemsToSel(const TOOL_EVENT &aEvent)
void SetIsHover(bool aIsHover)
Definition: selection.h:68
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:507
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 1375 of file ee_selection_tool.cpp.

1376 {
1377  if( aList )
1378  {
1379  for( EDA_ITEM* item : *aList )
1380  select( item );
1381 
1382  // Inform other potentially interested tools
1383  if( !aQuietMode )
1385  }
1386 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:199
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:100

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 1354 of file ee_selection_tool.cpp.

1355 {
1356  if( aItem )
1357  {
1358  select( aItem );
1359 
1360  // Inform other potentially interested tools
1361  if( !aQuietMode )
1363  }
1364 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:199
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 1446 of file ee_selection_tool.cpp.

1447 {
1448  highlight( aItem, BRIGHTENED );
1449 }
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 1744 of file ee_selection_tool.cpp.

1745 {
1746  if( m_selection.Empty() )
1747  return;
1748 
1749  while( m_selection.GetSize() )
1751 
1752  getView()->Update( &m_selection );
1753 
1754  m_selection.SetIsHover( false );
1756 
1757  // Inform other potentially interested tools
1759 }
void ClearReferencePoint()
Definition: selection.h:191
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void SetIsHover(bool aIsHover)
Definition: selection.h:68
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:201
#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:97
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:87
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
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:144
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:1518

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 781 of file ee_selection_tool.cpp.

783 {
784  int pixelThreshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
785  int gridThreshold = KiROUND( getView()->GetGAL()->GetGridSize().EuclideanNorm() );
786  aCollector.m_Threshold = std::max( pixelThreshold, gridThreshold );
787 
788  if( m_isSymbolEditor )
789  {
790  LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
791 
792  if( !symbol )
793  return false;
794 
795  aCollector.Collect( symbol->GetDrawItems(), aFilterList, (wxPoint) aWhere, m_unit,
796  m_convert );
797  }
798  else
799  {
800  aCollector.Collect( m_frame->GetScreen(), aFilterList, (wxPoint) aWhere, m_unit,
801  m_convert );
802  }
803 
804  return aCollector.GetCount() > 0;
805 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:146
int m_Threshold
Definition: collector.h:248
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:87
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Definition: lib_symbol.h:473
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 732 of file ee_selection_tool.cpp.

733 {
735 
736  if( pos != m_originalCursor )
737  return 0;
738 
739  m_skip_heuristics = true;
742  m_skip_heuristics = false;
743 
744  return 0;
745 }
VECTOR2D GetMousePosition() const
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
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, TOOL_MANAGER::GetMousePosition(), 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, TOOL_BASE::m_toolMgr, and SelectPoint().

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 1519 of file ee_selection_tool.cpp.

1520 {
1521  EDA_ITEM* current = nullptr;
1522  bool selectAll = false;
1523  bool expandSelection = false;
1524 
1525  do
1526  {
1528  if( expandSelection )
1529  aCollector->Combine();
1530 
1531  expandSelection = false;
1532 
1533  int limit = std::min( 9, aCollector->GetCount() );
1534  ACTION_MENU menu( true );
1535 
1536  for( int i = 0; i < limit; ++i )
1537  {
1538  wxString text;
1539  EDA_ITEM* item = ( *aCollector )[i];
1541 
1542  wxString menuText = wxString::Format( "&%d. %s\t%d", i + 1, text, i + 1 );
1543  menu.Add( menuText, i + 1, item->GetMenuImage() );
1544  }
1545 
1546  menu.AppendSeparator();
1547  menu.Add( _( "Select &All\tA" ), limit + 1, BITMAPS::INVALID_BITMAP );
1548 
1549  if( !expandSelection && aCollector->HasAdditionalItems() )
1550  menu.Add( _( "&Expand Selection\tE" ), limit + 2, BITMAPS::INVALID_BITMAP );
1551 
1552  if( aCollector->m_MenuTitle.Length() )
1553  {
1554  menu.SetTitle( aCollector->m_MenuTitle );
1555  menu.SetIcon( BITMAPS::info );
1556  menu.DisplayTitle( true );
1557  }
1558  else
1559  {
1560  menu.DisplayTitle( false );
1561  }
1562 
1563  SetContextMenu( &menu, CMENU_NOW );
1564 
1565  while( TOOL_EVENT* evt = Wait() )
1566  {
1567  if( evt->Action() == TA_CHOICE_MENU_UPDATE )
1568  {
1569  if( selectAll )
1570  {
1571  for( int i = 0; i < aCollector->GetCount(); ++i )
1572  unhighlight( ( *aCollector )[i], BRIGHTENED );
1573  }
1574  else if( current )
1575  {
1576  unhighlight( current, BRIGHTENED );
1577  }
1578 
1579  int id = *evt->GetCommandId();
1580 
1581  // User has pointed an item, so show it in a different way
1582  if( id > 0 && id <= limit )
1583  {
1584  current = ( *aCollector )[id - 1];
1585  highlight( current, BRIGHTENED );
1586  }
1587  else
1588  {
1589  current = nullptr;
1590  }
1591 
1592  // User has pointed on the "Select All" option
1593  if( id == limit + 1 )
1594  {
1595  for( int i = 0; i < aCollector->GetCount(); ++i )
1596  highlight( ( *aCollector )[i], BRIGHTENED );
1597  selectAll = true;
1598  }
1599  else
1600  {
1601  selectAll = false;
1602  }
1603  }
1604  else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
1605  {
1606  if( selectAll )
1607  {
1608  for( int i = 0; i < aCollector->GetCount(); ++i )
1609  unhighlight( ( *aCollector )[i], BRIGHTENED );
1610  }
1611  else if( current )
1612  unhighlight( current, BRIGHTENED );
1613 
1614  OPT<int> id = evt->GetCommandId();
1615 
1616  // User has selected the "Select All" option
1617  if( id == limit + 1 )
1618  {
1619  selectAll = true;
1620  current = nullptr;
1621  }
1622  else if( id == limit + 2 )
1623  {
1624  selectAll = false;
1625  current = nullptr;
1626  expandSelection = true;
1627  }
1628  // User has selected an item, so this one will be returned
1629  else if( id && ( *id > 0 ) && ( *id <= limit ) )
1630  {
1631  selectAll = false;
1632  current = ( *aCollector )[*id - 1];
1633  }
1634  // User has cancelled the menu (either by <esc> or clicking out of it)
1635  else
1636  {
1637  selectAll = false;
1638  current = nullptr;
1639  }
1640  }
1641  else if( evt->Action() == TA_CHOICE_MENU_CLOSED )
1642  {
1643  break;
1644  }
1645 
1646  getView()->UpdateItems();
1647  m_frame->GetCanvas()->Refresh();
1648  }
1649  } while( expandSelection );
1650 
1651  if( selectAll )
1652  return true;
1653  else if( current )
1654  {
1655  unhighlight( current, BRIGHTENED );
1656 
1657  getView()->UpdateItems();
1658  m_frame->GetCanvas()->Refresh();
1659 
1660  aCollector->Empty();
1661  aCollector->Append( current );
1662  return true;
1663  }
1664 
1665  return false;
1666 }
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:1412
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:211
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:100
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 1289 of file ee_selection_tool.cpp.

1290 {
1291  EE_COLLECTOR collector;
1292 
1293  //TODO(snh): Reimplement after exposing KNN interface
1294  int pixelThreshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
1295  int gridThreshold = KiROUND( getView()->GetGAL()->GetGridSize().EuclideanNorm() );
1296  int thresholdMax = std::max( pixelThreshold, gridThreshold );
1297 
1298  for( int threshold : { 0, thresholdMax/4, thresholdMax/2, thresholdMax } )
1299  {
1300  collector.m_Threshold = threshold;
1301  collector.Collect( m_frame->GetScreen(), nodeTypes, (wxPoint) aPosition );
1302 
1303  if( collector.GetCount() > 0 )
1304  break;
1305  }
1306 
1307  return collector.GetCount() ? collector[ 0 ] : nullptr;
1308 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:146
int m_Threshold
Definition: collector.h:248
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:87
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(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_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(), 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::updateParentItem(), 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(), EE_POINT_EDITOR::setEditedPoint(), PL_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(), ROUTER_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(), SCRIPTING_TOOL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), COMMON_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(), PAD_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), PCB_CONTROL::setTransitions(), DRC_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::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 976 of file ee_selection_tool.cpp.

977 {
978  // Prefer exact hits to sloppy ones
979  std::set<EDA_ITEM*> exactHits;
980 
981  for( int i = collector.GetCount() - 1; i >= 0; --i )
982  {
983  EDA_ITEM* item = collector[ i ];
984  SCH_LINE* line = dynamic_cast<SCH_LINE*>( item );
985 
986  // Lines are hard to hit. Give them a bit more slop to still be considered "exact".
987 
988  if( line )
989  {
990  if( line->HitTest( (wxPoint) aPos, Mils2iu( DANGLING_SYMBOL_SIZE ) ) )
991  exactHits.insert( line );
992  }
993  else
994  {
995  if( item->HitTest( (wxPoint) aPos, 0 ) )
996  exactHits.insert( item );
997  }
998  }
999 
1000  if( exactHits.size() > 0 && exactHits.size() < (unsigned) collector.GetCount() )
1001  {
1002  for( int i = collector.GetCount() - 1; i >= 0; --i )
1003  {
1004  EDA_ITEM* item = collector[ i ];
1005 
1006  if( !exactHits.count( item ) )
1007  collector.Transfer( item );
1008  }
1009  }
1010 
1011  // Find the closest item. (Note that at this point all hits are either exact or non-exact.)
1012  EDA_ITEM* closest = nullptr;
1013  int closestDist = INT_MAX;
1014 
1015  for( EDA_ITEM* item : collector )
1016  {
1017  EDA_RECT bbox = item->GetBoundingBox();
1018  int dist;
1019 
1020  if( exactHits.count( item ) )
1021  {
1022  wxPoint pos( aPos );
1023  SCH_LINE* line = dynamic_cast<SCH_LINE*>( item );
1024 
1025  if( line )
1026  dist = DistanceLinePoint( line->GetStartPoint(), line->GetEndPoint(), pos );
1027  else
1028  dist = EuclideanNorm( bbox.GetCenter() - pos ) * 2;
1029  }
1030  else
1031  {
1032  SHAPE_RECT rect( bbox.GetPosition(), bbox.GetWidth(), bbox.GetHeight() );
1033  rect.Collide( SEG( aPos, aPos ), collector.m_Threshold, &dist );
1034  }
1035 
1036  if( item->IsType( EE_COLLECTOR::FieldOwners ) )
1037  dist += INT_MAX / 4;
1038 
1039  if( dist < closestDist )
1040  {
1041  closestDist = dist;
1042  closest = item;
1043  }
1044  }
1045 
1046  // Construct a tight box (1/2 height and width) around the center of the closest item.
1047  // All items which exist at least partly outside this box have sufficient other areas
1048  // for selection and can be dropped.
1049  if( closest ) // Don't try and get a tight bbox if nothing is near the mouse pointer
1050  {
1051  EDA_RECT tightBox = closest->GetBoundingBox();
1052  tightBox.Inflate( -tightBox.GetWidth() / 4, -tightBox.GetHeight() / 4 );
1053 
1054  for( int i = collector.GetCount() - 1; i >= 0; --i )
1055  {
1056  EDA_ITEM* item = collector[i];
1057 
1058  if( item == closest )
1059  continue;
1060 
1061  if( !item->HitTest( tightBox, true ) )
1062  collector.Transfer( item );
1063  }
1064  }
1065 }
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:109
static const KICAD_T FieldOwners[]
Definition: ee_collectors.h:48
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
Definition: sch_line.cpp:780
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Test if aPosition is contained within or on the bounding box of an item.
Definition: eda_item.h:225
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
void Transfer(int aIndex)
Move the item at aIndex (first position is 0) to the backup list.
Definition: collector.h:159
#define DANGLING_SYMBOL_SIZE
< The size of the rectangle indicating an unconnected wire or label
const wxPoint GetPosition() const
Definition: eda_rect.h:102
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
Definition: eda_item.h:183
int GetHeight() const
Definition: eda_rect.h:110
Definition: seg.h:40
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:100
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:104
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
wxPoint GetEndPoint() const
Definition: sch_line.h:93

References SHAPE_RECT::Collide(), DANGLING_SYMBOL_SIZE, DistanceLinePoint(), EuclideanNorm(), EE_COLLECTOR::FieldOwners, EDA_ITEM::GetBoundingBox(), EDA_RECT::GetCenter(), COLLECTOR::GetCount(), SCH_LINE::GetEndPoint(), EDA_RECT::GetHeight(), EDA_RECT::GetPosition(), SCH_LINE::GetStartPoint(), EDA_RECT::GetWidth(), EDA_ITEM::HitTest(), SCH_LINE::HitTest(), EDA_RECT::Inflate(), 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 1774 of file ee_selection_tool.cpp.

1775 {
1776  KICAD_T itemType = aItem->Type();
1777 
1778  if( aMode == SELECTED )
1779  aItem->SetSelected();
1780  else if( aMode == BRIGHTENED )
1781  aItem->SetBrightened();
1782 
1783  if( aGroup )
1784  aGroup->Add( aItem );
1785 
1786  // Highlight pins and fields. (All the other symbol children are currently only
1787  // represented in the LIB_SYMBOL and will inherit the settings of the parent symbol.)
1788  if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
1789  {
1790  sch_item->RunOnChildren(
1791  [&]( SCH_ITEM* aChild )
1792  {
1793  if( aMode == SELECTED )
1794  aChild->SetSelected();
1795  else if( aMode == BRIGHTENED )
1796  aChild->SetBrightened();
1797  } );
1798  }
1799 
1800  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
1801  getView()->Update( aItem->GetParent() );
1802  else
1803  getView()->Update( aItem );
1804 }
virtual void Add(EDA_ITEM *aItem)
Definition: selection.cpp:31
void SetBrightened()
Definition: eda_item.h:130
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
void SetSelected()
Definition: eda_item.h:129
EDA_ITEM * GetParent() const
Definition: eda_item.h:115
#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:193
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:1518
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113
#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 130 of file ee_selection_tool.cpp.

131 {
132  m_frame = getEditFrame<SCH_BASE_FRAME>();
133 
134  SYMBOL_VIEWER_FRAME* symbolViewerFrame = dynamic_cast<SYMBOL_VIEWER_FRAME*>( m_frame );
135  SYMBOL_EDIT_FRAME* symbolEditorFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
136 
137  if( symbolEditorFrame )
138  {
139  m_isSymbolEditor = true;
140  m_unit = symbolEditorFrame->GetUnit();
141  m_convert = symbolEditorFrame->GetConvert();
142  }
143  else
144  {
145  m_isSymbolViewer = symbolViewerFrame != nullptr;
146  }
147 
148  static KICAD_T wireOrBusTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
149  static KICAD_T connectedTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T,
152 
153  auto wireSelection = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_WIRE_T );
154  auto busSelection = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_BUS_T );
155  auto wireOrBusSelection = E_C::MoreThan( 0 ) && E_C::OnlyTypes( wireOrBusTypes );
156  auto connectedSelection = E_C::MoreThan( 0 ) && E_C::OnlyTypes( connectedTypes );
157  auto sheetSelection = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
158 
159  auto schEditSheetPageNumberCondition =
160  [&] ( const SELECTION& aSel )
161  {
163  return false;
164 
165  return E_C::LessThan( 2 )( aSel ) && E_C::OnlyType( SCH_SHEET_T )( aSel );
166  };
167 
168  auto schEditCondition =
169  [this] ( const SELECTION& aSel )
170  {
172  };
173 
174  auto belowRootSheetCondition =
175  [&]( const SELECTION& aSel )
176  {
177  SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
178 
179  return editFrame
180  && editFrame->GetCurrentSheet().Last() != &editFrame->Schematic().Root();
181  };
182 
183  auto haveSymbolCondition =
184  [&]( const SELECTION& sel )
185  {
186  return m_isSymbolEditor &&
187  static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
188  };
189 
190  auto& menu = m_menu.GetMenu();
191 
192  menu.AddItem( EE_ACTIONS::enterSheet, sheetSelection && EE_CONDITIONS::Idle, 1 );
193  menu.AddItem( EE_ACTIONS::explicitCrossProbe, sheetSelection && EE_CONDITIONS::Idle, 1 );
194  menu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 1 );
195 
196  menu.AddSeparator( 100 );
197  menu.AddItem( EE_ACTIONS::drawWire, schEditCondition && EE_CONDITIONS::Empty, 100 );
198  menu.AddItem( EE_ACTIONS::drawBus, schEditCondition && EE_CONDITIONS::Empty, 100 );
199 
200  menu.AddSeparator( 100 );
202 
203  menu.AddSeparator( 100 );
205 
206  menu.AddSeparator( 200 );
207  menu.AddItem( EE_ACTIONS::selectConnection, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
208  menu.AddItem( EE_ACTIONS::placeJunction, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
209  menu.AddItem( EE_ACTIONS::placeLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
210  menu.AddItem( EE_ACTIONS::placeGlobalLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
211  menu.AddItem( EE_ACTIONS::placeHierLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
212  menu.AddItem( EE_ACTIONS::breakWire, wireSelection && EE_CONDITIONS::Idle, 250 );
213  menu.AddItem( EE_ACTIONS::breakBus, busSelection && EE_CONDITIONS::Idle, 250 );
214  menu.AddItem( EE_ACTIONS::importSingleSheetPin, sheetSelection && EE_CONDITIONS::Idle, 250 );
215  menu.AddItem( EE_ACTIONS::assignNetclass, connectedSelection && EE_CONDITIONS::Idle, 250 );
216  menu.AddItem( EE_ACTIONS::editPageNumber, schEditSheetPageNumberCondition, 250 );
217 
218  menu.AddSeparator( 400 );
219  menu.AddItem( EE_ACTIONS::symbolProperties,
220  haveSymbolCondition && EE_CONDITIONS::Empty, 400 );
221  menu.AddItem( EE_ACTIONS::pinTable,
222  haveSymbolCondition && EE_CONDITIONS::Empty, 400 );
223 
224  menu.AddSeparator( 1000 );
226 
227  m_disambiguateTimer.SetOwner( this );
228  Connect( wxEVT_TIMER, wxTimerEventHandler( EE_SELECTION_TOOL::onDisambiguationExpire ), nullptr, this );
229 
230  return true;
231 }
static TOOL_ACTION editPageNumber
Definition: ee_actions.h:151
static TOOL_ACTION pinTable
Definition: ee_actions.h:142
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:131
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
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:84
static TOOL_ACTION placeJunction
Definition: ee_actions.h:80
static TOOL_ACTION selectConnection
If current selection is a wire or bus, expand to entire connection.
Definition: ee_actions.h:50
Symbol library viewer main window.
Schematic editor (Eeschema) main window.
static TOOL_ACTION importSingleSheetPin
Definition: ee_actions.h:184
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:130
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:181
static TOOL_ACTION drawWire
Definition: ee_actions.h:76
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:195
static TOOL_ACTION symbolProperties
Definition: ee_actions.h:141
SCHEMATIC & Schematic() const
wxTimer m_disambiguateTimer
static bool IsDrawingBus(const SELECTION &aSelection)
static TOOL_ACTION drawBus
Definition: ee_actions.h:77
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:82
SCH_SHEET & Root() const
Definition: schematic.h:92
SCH_BASE_FRAME * m_frame
static TOOL_ACTION assignNetclass
Definition: ee_actions.h:148
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:180
SCH_SHEET_PATH & GetCurrentSheet() const
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:83
static TOOL_ACTION finishBus
Definition: ee_actions.h:92
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:91
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, SELECTION_CONDITIONS::MoreThan(), 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 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 324 of file ee_selection_tool.cpp.

325 {
327 
328  KIID lastRolloverItem = niluuid;
329 
330  // Main loop: keep receiving events
331  while( TOOL_EVENT* evt = Wait() )
332  {
333  bool displayWireCursor = false;
334  bool displayBusCursor = false;
335  bool displayLineCursor = false;
336  KIID rolloverItem = lastRolloverItem;
337 
338  // on left click, a selection is made, depending on modifiers ALT, SHIFT, CTRL:
339  setModifiersState( evt->Modifier( MD_SHIFT ), evt->Modifier( MD_CTRL ),
340  evt->Modifier( MD_ALT ) );
341 
342  bool modifier_enabled = m_subtractive || m_additive || m_exclusive_or;
343 
344  MOUSE_DRAG_ACTION drag_action = m_frame->GetDragAction();
346 
347  if( evt->IsMouseDown( BUT_LEFT ) )
348  {
349  // Avoid triggering when running under other tools
350  if( m_frame->ToolStackIsEmpty() )
351  {
353  m_disambiguateTimer.StartOnce( 500 );
354  }
355  }
356  // Single click? Select single object
357  else if( evt->IsClick( BUT_LEFT ) )
358  {
359  // If the timer has stopped, then we have already run the disambiguate routine
360  // and we don't want to register an extra click here
361  if( !m_disambiguateTimer.IsRunning() )
362  {
363  evt->SetPassEvent();
364  continue;
365  }
366 
367  m_disambiguateTimer.Stop();
368 
369 
370  if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
371  schframe->FocusOnItem( nullptr );
372 
373  EE_COLLECTOR collector;
374  bool continueSelect = true;
375 
376  // Collect items at the clicked location (doesn't select them yet)
377  if( CollectHits( collector, evt->Position()) )
378  {
379  narrowSelection( collector, evt->Position(), false );
380 
381  if( collector.GetCount() == 1 && !m_isSymbolEditor && !modifier_enabled )
382  {
383  // Check if we want to auto start wires
384  VECTOR2I snappedCursorPos = grid.BestSnapAnchor( evt->Position(),
385  LAYER_CONNECTABLE, nullptr );
386 
388  && collector[0]->IsPointClickableAnchor( (wxPoint) snappedCursorPos ) )
389  {
390  OPT_TOOL_EVENT newEvt;
391  SCH_CONNECTION* connection = collector[0]->Connection();
392 
393  if( ( connection && ( connection->IsNet() || connection->IsUnconnected() ) )
394  || collector[0]->Type() == SCH_SYMBOL_T )
395  {
396  newEvt = EE_ACTIONS::drawWire.MakeEvent();
397  }
398  else if( connection && connection->IsBus() )
399  {
400  newEvt = EE_ACTIONS::drawBus.MakeEvent();
401  }
402  else if( collector[0]->Type() == SCH_LINE_T
403  && static_cast<SCH_LINE*>( collector[0] )->IsGraphicLine() )
404  {
405  newEvt = EE_ACTIONS::drawLines.MakeEvent();
406  }
407 
408  auto* params = newEvt->Parameter<DRAW_SEGMENT_EVENT_PARAMS*>();
409  auto* newParams = new DRAW_SEGMENT_EVENT_PARAMS();
410 
411  *newParams= *params;
412  newParams->quitOnDraw = true;
413  newEvt->SetParameter( newParams );
414 
415  getViewControls()->ForceCursorPosition( true, snappedCursorPos );
416  newEvt->SetMousePosition( snappedCursorPos );
417  newEvt->SetHasPosition( true );
418  newEvt->SetForceImmediate( true );
419  m_toolMgr->ProcessEvent( *newEvt );
420 
421  continueSelect = false;
422  }
423  else if( collector[0]->IsHypertext() )
424  {
425  collector[0]->DoHypertextMenu( m_frame );
426  continueSelect = false;
427  }
428  }
429  }
430 
431  if( continueSelect )
432  {
433  // If we didn't click on an anchor, we perform a normal select, pass in the
434  // items we previously collected
435  selectPoint( collector, nullptr, nullptr, m_additive, m_subtractive,
436  m_exclusive_or );
437  }
438  }
439  else if( evt->IsClick( BUT_RIGHT ) )
440  {
441  m_disambiguateTimer.Stop();
442 
443  // right click? if there is any object - show the context menu
444  bool selectionCancelled = false;
445 
446  if( m_selection.Empty() )
447  {
448  ClearSelection();
449  SelectPoint( evt->Position(), EE_COLLECTOR::AllItems, nullptr,
450  &selectionCancelled );
451  m_selection.SetIsHover( true );
452  }
453  // If the cursor has moved off the bounding box of the selection by more than
454  // a grid square, check to see if there is another item available for selection
455  // under the cursor. If there is, the user likely meant to get the context menu
456  // for that item. If there is no new item, then keep the original selection and
457  // show the context menu for it.
458  else if( !m_selection.GetBoundingBox().Inflate(
459  grid.GetGrid().x, grid.GetGrid().y ).Contains(
460  (wxPoint) evt->Position() ) )
461  {
462  EE_SELECTION saved_selection = m_selection;
463 
464  for( const auto& item : saved_selection )
465  RemoveItemFromSel( item, true );
466 
467  SelectPoint( evt->Position(), EE_COLLECTOR::AllItems, nullptr,
468  &selectionCancelled );
469 
470  if( m_selection.Empty() )
471  {
472  m_selection.SetIsHover( false );
473 
474  for( const auto& item : saved_selection )
475  AddItemToSel( item, true);
476  }
477  else
478  {
479  m_selection.SetIsHover( true );
480  }
481  }
482 
483  if( !selectionCancelled )
485  }
486  else if( evt->IsDblClick( BUT_LEFT ) )
487  {
488  m_disambiguateTimer.Stop();
489 
490  // double click? Display the properties window
491  if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
492  schframe->FocusOnItem( nullptr );
493 
494  if( m_selection.Empty() )
495  SelectPoint( evt->Position() );
496 
497  EDA_ITEM* item = m_selection.Front();
498 
499  if( item && item->Type() == SCH_SHEET_T )
501  else
503  }
504  else if( evt->IsDblClick( BUT_MIDDLE ) )
505  {
506  m_disambiguateTimer.Stop();
507 
508  // Middle double click? Do zoom to fit or zoom to objects
509  if( evt->Modifier( MD_CTRL ) ) // Is CTRL key down?
511  else
513  }
514  else if( evt->IsDrag( BUT_LEFT ) )
515  {
516  m_disambiguateTimer.Stop();
517 
518  // Is another tool already moving a new object? Don't allow a drag start
519  if( !m_selection.Empty() && m_selection[0]->HasFlag( IS_NEW | IS_MOVING ) )
520  {
521  evt->SetPassEvent();
522  continue;
523  }
524 
525  // drag with LMB? Select multiple objects (or at least draw a selection box) or
526  // drag them
527  if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
528  schframe->FocusOnItem( nullptr );
529 
530  if( modifier_enabled || drag_action == MOUSE_DRAG_ACTION::SELECT )
531  {
532  selectMultiple();
533  }
534  else if( m_selection.Empty() && drag_action != MOUSE_DRAG_ACTION::DRAG_ANY )
535  {
536  selectMultiple();
537  }
538  else
539  {
540  if( m_isSymbolEditor )
541  {
542  if( static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->IsSymbolAlias() )
544  else
546  }
547  else
548  {
550  }
551 
552  // Check if dragging has started within any of selected items bounding box
553  if( selectionContains( evt->Position() ) )
554  {
555  // Yes -> run the move tool and wait till it finishes
556  if( m_isSymbolEditor )
557  m_toolMgr->InvokeTool( "eeschema.SymbolMoveTool" );
558  else
559  m_toolMgr->InvokeTool( "eeschema.InteractiveMove" );
560  }
561  else
562  {
563  // No -> drag a selection box
564  selectMultiple();
565  }
566  }
567  }
568  else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
569  {
570  m_disambiguateTimer.Stop();
571 
572  // context sub-menu selection? Handle unit selection or bus unfolding
573  if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
574  && evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_SYM_MAX )
575  {
576  SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( m_selection.Front() );
577  int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;
578 
579  if( symbol )
580  static_cast<SCH_EDIT_FRAME*>( m_frame )->SelectUnit( symbol, unit );
581  }
582  else if( evt->GetCommandId().get() >= ID_POPUP_SCH_UNFOLD_BUS
583  && evt->GetCommandId().get() <= ID_POPUP_SCH_UNFOLD_BUS_END )
584  {
585  wxString* net = new wxString( *evt->Parameter<wxString*>() );
587  }
588 
589  }
590  else if( evt->IsCancelInteractive() )
591  {
592  m_disambiguateTimer.Stop();
593 
594  if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
595  schframe->FocusOnItem( nullptr );
596 
597  ClearSelection();
598  }
599  else if( evt->Action() == TA_UNDO_REDO_PRE )
600  {
601  if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
602  schframe->FocusOnItem( nullptr );
603 
604  ClearSelection();
605  }
606  else if( evt->IsMotion() && !m_isSymbolEditor && m_frame->ToolStackIsEmpty() )
607  {
608  rolloverItem = niluuid;
609  EE_COLLECTOR collector;
610 
611  // We are checking if we should display a pencil when hovering over anchors
612  // for "auto starting" wires when clicked
613  if( CollectHits( collector, evt->Position() ) )
614  {
615  narrowSelection( collector, evt->Position(), false );
616 
617  if( collector.GetCount() == 1 && !modifier_enabled )
618  {
619  VECTOR2I snappedCursorPos = grid.BestSnapAnchor( evt->Position(),
620  LAYER_CONNECTABLE, nullptr );
621 
623  && collector[0]->IsPointClickableAnchor( (wxPoint) snappedCursorPos ) )
624  {
625  SCH_CONNECTION* connection = collector[0]->Connection();
626 
627  if( ( connection && ( connection->IsNet() || connection->IsUnconnected() ) )
628  || collector[0]->Type() == SCH_SYMBOL_T )
629  {
630  displayWireCursor = true;
631  }
632  else if( connection && connection->IsBus() )
633  {
634  displayBusCursor = true;
635  }
636  else if( collector[0]->Type() == SCH_LINE_T
637  && static_cast<SCH_LINE*>( collector[0] )->IsGraphicLine() )
638  {
639  displayLineCursor = true;
640  }
641 
642  getViewControls()->ForceCursorPosition( true, snappedCursorPos );
643  }
644  else if( collector[0]->IsHypertext()
645  && !collector[0]->IsSelected()
647  {
648  rolloverItem = collector[0]->m_Uuid;
649  }
650  }
651  }
652  else
653  {
655  }
656  }
657  else
658  {
659  evt->SetPassEvent();
660  }
661 
662  if( rolloverItem != lastRolloverItem )
663  {
664  EDA_ITEM* item = m_frame->GetItem( lastRolloverItem );
665 
666  if( item )
667  {
668  item->ClearFlags( IS_ROLLOVER );
669  lastRolloverItem = niluuid;
670 
671  if( item->Type() == SCH_FIELD_T )
672  m_frame->GetCanvas()->GetView()->Update( item->GetParent() );
673  else
674  m_frame->GetCanvas()->GetView()->Update( item );
675  }
676 
677  item = m_frame->GetItem( rolloverItem );
678 
679  if( item )
680  {
681  item->SetFlags( IS_ROLLOVER );
682  lastRolloverItem = rolloverItem;
683 
684  if( item->Type() == SCH_FIELD_T )
685  m_frame->GetCanvas()->GetView()->Update( item->GetParent() );
686  else
687  m_frame->GetCanvas()->GetView()->Update( item );
688  }
689  }
690 
691  if( m_frame->ToolStackIsEmpty() )
692  {
693  if( displayWireCursor )
694  {
696  }
697  else if( displayBusCursor )
698  {
700  }
701  else if( displayLineCursor )
702  {
704  }
705  else if( rolloverItem != niluuid )
706  {
708  }
709  else if( !m_selection.Empty()
710  && drag_action == MOUSE_DRAG_ACTION::DRAG_SELECTED
711  && evt->HasPosition()
712  && selectionContains( evt->Position() ) ) //move/drag option prediction
713  {
715  }
716  else
717  {
719  }
720  }
721  }
722 
723  m_disambiguateTimer.Stop();
724 
725  // Shutting down; clear the selection
726  m_selection.Clear();
727 
728  return 0;
729 }
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:117
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:82
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
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:78
static TOOL_ACTION zoomFitScreen
Definition: actions.h:96
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:153
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:68
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:87
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...
void narrowSelection(EE_COLLECTOR &collector, const VECTOR2I &aWhere, bool aCheckLocked)
Apply rules to narrow the collection down to selectable objects, and then heuristics to try and narro...
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:76
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
bool ToolStackIsEmpty()
Definition: tools_holder.h:116
EDA_ITEM * GetParent() const
Definition: eda_item.h:115
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:154
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:97
static TOOL_ACTION drawBus
Definition: ee_actions.h:77
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.
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:100
static TOOL_ACTION enterSheet
Definition: ee_actions.h:180
VECTOR2I m_originalCursor
static TOOL_ACTION drawLines
Definition: ee_actions.h:88
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:144
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:1518
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:113

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(), SCH_DRAW_PANEL::GetView(), TOOL_BASE::getViewControls(), grid, HAND, 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 
)
private

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

Definition at line 808 of file ee_selection_tool.cpp.

810 {
811  for( int i = collector.GetCount() - 1; i >= 0; --i )
812  {
813  if( !Selectable( collector[i], &aWhere ) )
814  {
815  collector.Remove( i );
816  continue;
817  }
818 
819  if( aCheckLocked && collector[i]->IsLocked() )
820  {
821  collector.Remove( i );
822  continue;
823  }
824 
825  // SelectPoint, unlike other selection routines, can select line ends
826  if( collector[i]->Type() == SCH_LINE_T )
827  {
828  SCH_LINE* line = (SCH_LINE*) collector[i];
829  line->ClearFlags( STARTPOINT | ENDPOINT );
830 
831  if( HitTestPoints( line->GetStartPoint(), (wxPoint) aWhere, collector.m_Threshold ) )
832  line->SetFlags( STARTPOINT );
833  else if( HitTestPoints( line->GetEndPoint(), (wxPoint) aWhere, collector.m_Threshold ) )
834  line->SetFlags( ENDPOINT );
835  else
836  line->SetFlags( STARTPOINT | ENDPOINT );
837  }
838  }
839 
840  // Apply some ugly heuristics to avoid disambiguation menus whenever possible
841  if( collector.GetCount() > 1 && !m_skip_heuristics )
842  {
843  GuessSelectionCandidates( collector, aWhere );
844  }
845 }
int m_Threshold
Definition: collector.h:248
#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:153
#define ENDPOINT
ends. (Used to support dragging.)
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:115
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:87
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:154
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 748 of file ee_selection_tool.cpp.

749 {
751 }
static const TOOL_EVENT DisambiguatePoint
Definition: actions.h:214
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 754 of file ee_selection_tool.cpp.

755 {
756  if( m_frame->ToolStackIsEmpty() && !m_multiple )
757  {
758  wxMouseState keyboardState = wxGetMouseState();
759 
760  setModifiersState( keyboardState.ShiftDown(), keyboardState.ControlDown(),
761  keyboardState.AltDown() );
762 
763  if( m_additive )
765  else if( m_subtractive )
767  else if( m_exclusive_or )
769  else
771  }
772 }
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 1466 of file ee_selection_tool.cpp.

1467 {
1468  m_selection.Clear();
1469 
1470  if( m_isSymbolEditor )
1471  {
1472  LIB_SYMBOL* start = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
1473 
1474  for( LIB_ITEM& item : start->GetDrawItems() )
1475  {
1476  if( item.IsSelected() )
1477  select( static_cast<EDA_ITEM*>( &item ) );
1478  }
1479  }
1480  else
1481  {
1482  for( SCH_ITEM* item : m_frame->GetScreen()->Items() )
1483  {
1484  // If the field and symbol are selected, only use the symbol
1485  if( item->IsSelected() )
1486  {
1487  select( item );
1488  }
1489  else
1490  {
1491  item->RunOnChildren(
1492  [&]( SCH_ITEM* aChild )
1493  {
1494  if( aChild->IsSelected() )
1495  select( aChild );
1496  } );
1497  }
1498  }
1499  }
1500 
1502 
1503  // Inform other potentially interested tools
1505 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:199
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:82
bool IsSelected() const
Definition: eda_item.h:123
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:473
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:193

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 1389 of file ee_selection_tool.cpp.

1390 {
1391  RemoveItemFromSel( aEvent.Parameter<EDA_ITEM*>() );
1392  m_selection.SetIsHover( false );
1393  return 0;
1394 }
void SetIsHover(bool aIsHover)
Definition: selection.h:68
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:100
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 1397 of file ee_selection_tool.cpp.

1398 {
1399  if( aItem )
1400  {
1401  unselect( aItem );
1402 
1403  // Inform other potentially interested tools
1404  if( !aQuietMode )
1406  }
1407 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:200
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 1410 of file ee_selection_tool.cpp.

1411 {
1412  RemoveItemsFromSel( aEvent.Parameter<EDA_ITEMS*>(), false );
1413  m_selection.SetIsHover( false );
1414  return 0;
1415 }
void SetIsHover(bool aIsHover)
Definition: selection.h:68
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:507
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 1418 of file ee_selection_tool.cpp.

1419 {
1420  if( aList )
1421  {
1422  for( EDA_ITEM* item : *aList )
1423  unselect( item );
1424 
1425  // Inform other potentially interested tools
1426  if( !aQuietMode )
1428  }
1429 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:200
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:100

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 1432 of file ee_selection_tool.cpp.

1433 {
1434  EDA_ITEMS removeItems;
1435 
1436  for( EDA_ITEM* item : m_selection )
1437  {
1438  if( alg::contains( *aList, item->m_Uuid ) )
1439  removeItems.push_back( item );
1440  }
1441 
1442  RemoveItemsFromSel( &removeItems, aQuietMode );
1443 }
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:507
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:100
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 1068 of file ee_selection_tool.cpp.

1069 {
1070  if( m_selection.Empty() )
1071  {
1072  VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true );
1073 
1074  ClearSelection();
1075  SelectPoint( cursorPos, aFilterList );
1076  m_selection.SetIsHover( true );
1078  }
1079  else // Trim an existing selection by aFilterList
1080  {
1081  for( int i = (int) m_selection.GetSize() - 1; i >= 0; --i )
1082  {
1083  EDA_ITEM* item = (EDA_ITEM*) m_selection.GetItem( i );
1084 
1085  if( !item->IsType( aFilterList ) )
1086  {
1087  unselect( item );
1089  }
1090  }
1091  }
1092 
1094 
1095  return m_selection;
1096 }
void ClearReferencePoint()
Definition: selection.h:191
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:200
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void SetIsHover(bool aIsHover)
Definition: selection.h:68
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:183
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:97
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:87
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:52
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
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(), SCH_EDIT_FRAME::SaveSymbolToSchematic(), 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 234 of file ee_selection_tool.cpp.

235 {
236  m_frame = getEditFrame<SCH_BASE_FRAME>();
237 
238  if( aReason == TOOL_BASE::MODEL_RELOAD )
239  {
240  // Remove pointers to the selected items from containers without changing their
241  // properties (as they are already deleted while a new sheet is loaded)
242  m_selection.Clear();
243  getView()->GetPainter()->GetSettings()->SetHighlight( false );
244 
245  SYMBOL_EDIT_FRAME* symbolEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
246  SYMBOL_VIEWER_FRAME* symbolViewerFrame = dynamic_cast<SYMBOL_VIEWER_FRAME*>( m_frame );
247 
248  if( symbolEditFrame )
249  {
250  m_isSymbolEditor = true;
251  m_unit = symbolEditFrame->GetUnit();
252  m_convert = symbolEditFrame->GetConvert();
253  }
254  else
255  m_isSymbolViewer = symbolViewerFrame != nullptr;
256  }
257  else
258  // Restore previous properties of selected items and remove them from containers
259  ClearSelection();
260 
261  // Reinsert the VIEW_GROUP, in case it was removed from the VIEW
262  getView()->Remove( &m_selection );
263  getView()->Add( &m_selection );
264 }
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:82
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:353
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:323
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 1762 of file ee_selection_tool.cpp.

1763 {
1764  highlight( aItem, SELECTED, &m_selection );
1765 }
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 1669 of file ee_selection_tool.cpp.

1671 {
1672  // NOTE: in the future this is where Eeschema layer/itemtype visibility will be handled
1673 
1674  SYMBOL_EDIT_FRAME* symEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
1675 
1676  // Do not allow selection of anything except fields when the current symbol in the symbol
1677  // editor is a derived symbol.
1678  if( symEditFrame && symEditFrame->IsSymbolAlias() && aItem->Type() != LIB_FIELD_T )
1679  return false;
1680 
1681  switch( aItem->Type() )
1682  {
1683  case SCH_PIN_T:
1684  {
1685  const SCH_PIN* pin = static_cast<const SCH_PIN*>( aItem );
1686 
1687  if( !pin->IsVisible() && !m_frame->GetShowAllPins() )
1688  return false;
1689 
1691  {
1692  // Pin anchors have to be allowed for auto-starting wires.
1693  if( aPos )
1694  {
1696  VECTOR2I cursorPos = grid.BestSnapAnchor( *aPos, LAYER_CONNECTABLE, nullptr );
1697 
1698  if( pin->IsPointClickableAnchor( (wxPoint) cursorPos ) )
1699  return true;
1700  }
1701 
1702  return false;
1703  }
1704  }
1705  break;
1706 
1707  case LIB_SYMBOL_T: // In symbol_editor we do not want to select the symbol itself.
1708  return false;
1709 
1710  case LIB_FIELD_T: // LIB_FIELD object can always be edited.
1711  break;
1712 
1713  case LIB_ARC_T:
1714  case LIB_CIRCLE_T:
1715  case LIB_TEXT_T:
1716  case LIB_RECTANGLE_T:
1717  case LIB_POLYLINE_T:
1718  case LIB_BEZIER_T:
1719  case LIB_PIN_T:
1720  if( symEditFrame )
1721  {
1722  LIB_ITEM* lib_item = (LIB_ITEM*) aItem;
1723 
1724  if( lib_item->GetUnit() && lib_item->GetUnit() != symEditFrame->GetUnit() )
1725  return false;
1726 
1727  if( lib_item->GetConvert() && lib_item->GetConvert() != symEditFrame->GetConvert() )
1728  return false;
1729  }
1730 
1731  break;
1732 
1733  case SCH_MARKER_T: // Always selectable
1734  return true;
1735 
1736  default: // Suppress warnings
1737  break;
1738  }
1739 
1740  return true;
1741 }
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:272
bool IsSymbolAlias() const
Restore the empty editor screen, without any symbol or library selected.
int GetConvert() const
Definition: lib_item.h:275
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:113
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_ARC_T, LIB_BEZIER_T, LIB_CIRCLE_T, LIB_FIELD_T, LIB_PIN_T, LIB_POLYLINE_T, LIB_RECTANGLE_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 930 of file ee_selection_tool.cpp.

931 {
932  m_multiple = true; // Multiple selection mode is active
933  KIGFX::VIEW* view = getView();
934 
935  // hold all visible items
936  std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
937  std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> sheetPins;
938 
939  // Filter the view items based on the selection box
940  BOX2I selectionBox;
941 
942  selectionBox.SetMaximum();
943  view->Query( selectionBox, selectedItems ); // Get the list of selected items
944 
945  // Sheet pins aren't in the view; add them by hand
946  for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : selectedItems )
947  {
948  SCH_SHEET* sheet = dynamic_cast<SCH_SHEET*>( pair.first );
949 
950  if( sheet )
951  {
952  int layer = pair.second;
953 
954  for( SCH_SHEET_PIN* pin : sheet->GetPins() )
955  sheetPins.emplace_back( KIGFX::VIEW::LAYER_ITEM_PAIR( pin, layer ) );
956  }
957  }
958 
959  selectedItems.insert( selectedItems.end(), sheetPins.begin(), sheetPins.end() );
960 
961  for( const std::pair<KIGFX::VIEW_ITEM*, int>& item_pair : selectedItems )
962  {
963  if( EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( item_pair.first ) )
964  {
965  if( Selectable( item ) )
966  select( item );
967  }
968  }
969 
970  m_multiple = false;
971 
972  return 0;
973 }
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:184
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:100
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:429
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 1321 of file ee_selection_tool.cpp.

1322 {
1323  static KICAD_T wiresAndBuses[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
1324 
1325  RequestSelection( wiresAndBuses );
1326 
1327  if( m_selection.Empty() )
1328  return 0;
1329 
1330  SCH_LINE* line = (SCH_LINE*) m_selection.Front();
1331  EDA_ITEMS items;
1332 
1334  std::set<SCH_ITEM*> conns = m_frame->GetScreen()->MarkConnections( line );
1335 
1336  for( SCH_ITEM* item : conns )
1337  select( item );
1338 
1339  if( m_selection.GetSize() > 1 )
1341 
1342  return 0;
1343 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:199
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:507
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:97
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:87
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:825
EE_SELECTION m_selection
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:193
EDA_ITEM * Front() const
Definition: selection.h:144
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:356

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 126 of file ee_selection_tool.h.

References highlight(), and SELECTED.

Referenced by SCH_EDIT_FRAME::SaveSymbolToSchematic().

◆ 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 1840 of file ee_selection_tool.cpp.

1841 {
1842  const unsigned GRIP_MARGIN = 20;
1843  VECTOR2I margin = getView()->ToWorld( VECTOR2I( GRIP_MARGIN, GRIP_MARGIN ), false );
1844 
1845  // Check if the point is located within any of the currently selected items bounding boxes
1846  for( EDA_ITEM* item : m_selection )
1847  {
1848  BOX2I itemBox = item->ViewBBox();
1849  itemBox.Inflate( margin.x, margin.y ); // Give some margin for gripping an item
1850 
1851  if( itemBox.Contains( aPoint ) )
1852  return true;
1853  }
1854 
1855  return false;
1856 }
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:452
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
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:100
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 1508 of file ee_selection_tool.cpp.

1509 {
1510  EE_COLLECTOR* collector = aEvent.Parameter<EE_COLLECTOR*>();
1511 
1512  if( !doSelectionMenu( collector ) )
1513  collector->m_MenuCancelled = true;
1514 
1515  return 0;
1516 }
bool m_MenuCancelled
Definition: collector.h:251
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 1115 of file ee_selection_tool.cpp.

1116 {
1117  bool cancelled = false; // Was the tool canceled while it was running?
1118  m_multiple = true; // Multiple selection mode is active
1119  KIGFX::VIEW* view = getView();
1120 
1122  view->Add( &area );
1123 
1124  while( TOOL_EVENT* evt = Wait() )
1125  {
1126  int width = area.GetEnd().x - area.GetOrigin().x;
1127 
1128  /* Selection mode depends on direction of drag-selection:
1129  * Left > Right : Select objects that are fully enclosed by selection
1130  * Right > Left : Select objects that are crossed by selection
1131  */
1132  bool windowSelection = width >= 0;
1133 
1134  if( view->IsMirroredX() )
1135  windowSelection = !windowSelection;
1136 
1139 
1140  if( evt->IsCancelInteractive() || evt->IsActivate() )
1141  {
1142  cancelled = true;
1143  break;
1144  }
1145 
1146  if( evt->IsDrag( BUT_LEFT ) )
1147  {
1149  ClearSelection();
1150 
1151  // Start drawing a selection box
1152  area.SetOrigin( evt->DragOrigin() );
1153  area.SetEnd( evt->Position() );
1154  area.SetAdditive( m_drag_additive );
1156  area.SetExclusiveOr( false );
1157 
1158  view->SetVisible( &area, true );
1159  view->Update( &area );
1160  getViewControls()->SetAutoPan( true );
1161  }
1162 
1163  if( evt->IsMouseUp( BUT_LEFT ) )
1164  {
1165  getViewControls()->SetAutoPan( false );
1166 
1167  // End drawing the selection box
1168  view->SetVisible( &area, false );
1169 
1170  // Mark items within the selection box as selected
1171  std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
1172  std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> children;
1173 
1174  // Filter the view items based on the selection box
1175  BOX2I selectionBox = area.ViewBBox();
1176  view->Query( selectionBox, selectedItems ); // Get the list of selected items
1177 
1178  // Some children aren't in the view; add them by hand.
1179  // DO NOT add them directly to selectedItems. If we add enough to cause the vector
1180  // to grow it will re-allocate and invalidate the top-level for-loop iterator.
1181  for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : selectedItems )
1182  {
1183  SCH_SHEET* sheet = dynamic_cast<SCH_SHEET*>( pair.first );
1184 
1185  if( sheet )
1186  {
1187  int layer = pair.second;
1188 
1189  for( SCH_SHEET_PIN* pin : sheet->GetPins() )
1190  children.emplace_back( KIGFX::VIEW::LAYER_ITEM_PAIR( pin, layer ) );
1191  }
1192 
1193  SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( pair.first );
1194 
1195  if( symbol )
1196  {
1197  int layer = pair.second;
1198 
1199  for( SCH_FIELD& field : symbol->GetFields() )
1200  children.emplace_back( KIGFX::VIEW::LAYER_ITEM_PAIR( &field, layer ) );
1201  }
1202 
1203  SCH_GLOBALLABEL* gLabel = dynamic_cast<SCH_GLOBALLABEL*>( pair.first );
1204 
1205  if( gLabel )
1206  {
1207  int layer = pair.second;
1208  SCH_FIELD* intersheetRef = gLabel->GetIntersheetRefs();
1209 
1210  children.emplace_back( KIGFX::VIEW::LAYER_ITEM_PAIR( intersheetRef, layer ) );
1211  }
1212  }
1213 
1214  selectedItems.insert( selectedItems.end(), children.begin(), children.end() );
1215 
1216  int height = area.GetEnd().y - area.GetOrigin().y;
1217 
1218  bool anyAdded = false;
1219  bool anySubtracted = false;
1220 
1221  // Construct an EDA_RECT to determine EDA_ITEM selection
1222  EDA_RECT selectionRect( (wxPoint) area.GetOrigin(), wxSize( width, height ) );
1223 
1224  selectionRect.Normalize();
1225 
1226  for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : selectedItems )
1227  {
1228  EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( pair.first );
1229 
1230  if( item && Selectable( item ) && item->HitTest( selectionRect, windowSelection ) )
1231  {
1232  if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
1233  {
1234  unselect( item );
1235  anySubtracted = true;
1236  }
1237  else
1238  {
1239  select( item );
1240  item->SetFlags( STARTPOINT | ENDPOINT );
1241  anyAdded = true;
1242  }
1243  }
1244  }
1245 
1246  m_selection.SetIsHover( false );
1247 
1248  // Inform other potentially interested tools
1249  if( anyAdded )
1251 
1252  if( anySubtracted )
1254 
1255  break; // Stop waiting for events
1256  }
1257  }
1258 
1259  getViewControls()->SetAutoPan( false );
1260 
1261  // Stop drawing the selection box
1262  view->Remove( &area );
1263  m_multiple = false; // Multiple selection mode is inactive
1264 
1265  if( !cancelled )
1267 
1268  return cancelled;
1269 }
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
void ClearReferencePoint()
Definition: selection.h:191
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:49
static const TOOL_EVENT SelectedEvent
Definition: actions.h:199
#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.
bool IsSelected() const
Definition: eda_item.h:123
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:200
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
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:353
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
Definition: sch_symbol.cpp:711
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:153
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:68
void SetAdditive(bool aAdditive)
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Test if aPosition is contained within or on the bounding box of an item.
Definition: eda_item.h:225
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)
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
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:54
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:238
void SetSubtractive(bool aSubtractive)
std::vector< SCH_SHEET_PIN * > & GetPins()
Definition: sch_sheet.h:184
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
SCH_FIELD * GetIntersheetRefs()
Definition: sch_text.h:413
void unselect(EDA_ITEM *aItem)
Take necessary action mark an item as unselected.
Schematic symbol object.
Definition: sch_symbol.h:78
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:100
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Definition: view.cpp:1464
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:323
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:429
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
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:1518

References KIGFX::VIEW::Add(), BUT_LEFT, SELECTION::ClearReferencePoint(), ClearSelection(), ENDPOINT, SCH_BASE_FRAME::GetCanvas(), KIGFX::PREVIEW::SELECTION_AREA::GetEnd(), SCH_SYMBOL::GetFields(), SCH_GLOBALLABEL::GetIntersheetRefs(), KIGFX::PREVIEW::SELECTION_AREA::GetOrigin(), SCH_SHEET::GetPins(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), EDA_ITEM::HitTest(), KIGFX::VIEW::IsMirroredX(), EDA_ITEM::IsSelected(), 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(), pin, 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(), EDA_ITEM::SetFlags(), SELECTION::SetIsHover(), KIGFX::PREVIEW::SELECTION_AREA::SetOrigin(), KIGFX::PREVIEW::SELECTION_AREA::SetSubtractive(), KIGFX::VIEW::SetVisible(), STARTPOINT, 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 1311 of file ee_selection_tool.cpp.

1312 {
1313  VECTOR2I cursorPos = getViewControls()->GetCursorPosition( false );
1314 
1315  SelectPoint( cursorPos, nodeTypes );
1316 
1317  return 0;
1318 }
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 914 of file ee_selection_tool.cpp.

918 {
919  EE_COLLECTOR collector;
920 
921  if( !CollectHits( collector, aWhere, aFilterList ) )
922  return false;
923 
924  narrowSelection( collector, aWhere, aCheckLocked );
925 
926  return selectPoint( collector, aItem, aSelectionCancelledFlag, aAdd, aSubtract, aExclusiveOr );
927 }
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)
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 848 of file ee_selection_tool.cpp.

851 {
853 
854  // If still more than one item we're going to have to ask the user.
855  if( aCollector.GetCount() > 1 )
856  {
857  // Try to call selectionMenu via RunAction() to avoid event-loop contention
858  // But it we cannot handle the event, then we don't have an active tool loop, so
859  // handle it directly.
860  if( !m_toolMgr->RunAction( EE_ACTIONS::selectionMenu, true, &aCollector ) )
861  doSelectionMenu( &aCollector );
862 
863  if( aCollector.m_MenuCancelled )
864  {
865  if( aSelectionCancelledFlag )
866  *aSelectionCancelledFlag = true;
867 
868  return false;
869  }
870  }
871 
872  if( !aAdd && !aSubtract && !aExclusiveOr )
873  ClearSelection();
874 
875  bool anyAdded = false;
876  bool anySubtracted = false;
877 
878  if( aCollector.GetCount() > 0 )
879  {
880  for( int i = 0; i < aCollector.GetCount(); ++i )
881  {
882  if( aSubtract || ( aExclusiveOr && aCollector[i]->IsSelected() ) )
883  {
884  unselect( aCollector[i] );
885  anySubtracted = true;
886  }
887  else
888  {
889  select( aCollector[i] );
890  anyAdded = true;
891  }
892  }
893  }
894 
895  if( anyAdded )
896  {
898 
899  if( aItem && aCollector.GetCount() == 1 )
900  *aItem = aCollector[0];
901 
902  return true;
903  }
904  else if( anySubtracted )
905  {
907  return true;
908  }
909 
910  return false;
911 }
void ClearReferencePoint()
Definition: selection.h:191
static const TOOL_EVENT SelectedEvent
Definition: actions.h:199
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:200
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:251
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
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:64
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. It doesn't hurt
59  // to also have this option.
60  m_skip_heuristics = aAltState;
61 }
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::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 1859 of file ee_selection_tool.cpp.

1860 {
1862 
1867 
1873 
1875 
1877 }
int UpdateMenu(const TOOL_EVENT &aEvent)
int SelectAll(const TOOL_EVENT &aEvent)
static const TOOL_EVENT DisambiguatePoint
Definition: actions.h:214
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
Definition: ee_actions.h:60
static TOOL_ACTION selectConnection
If current selection is a wire or bus, expand to entire connection.
Definition: ee_actions.h:50
int AddItemsToSel(const TOOL_EVENT &aEvent)
static TOOL_ACTION removeItemsFromSel
Definition: ee_actions.h:61
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:57
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:56
int SelectConnection(const TOOL_EVENT &aEvent)
Clear current selection event handler.
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: ee_actions.h:43
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:53
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:64
static TOOL_ACTION selectNode
Select the junction, wire or bus segment under the cursor.
Definition: ee_actions.h:46
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 1452 of file ee_selection_tool.cpp.

1453 {
1454  unhighlight( aItem, BRIGHTENED );
1455 }
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 1807 of file ee_selection_tool.cpp.

1808 {
1809  KICAD_T itemType = aItem->Type();
1810 
1811  if( aMode == SELECTED )
1812  aItem->ClearSelected();
1813  else if( aMode == BRIGHTENED )
1814  aItem->ClearBrightened();
1815 
1816  if( aGroup )
1817  aGroup->Remove( aItem );
1818 
1819  // Unhighlight pins and fields. (All the other symbol children are currently only
1820  // represented in the LIB_SYMBOL.)
1821  if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
1822  {
1823  sch_item->RunOnChildren(
1824  [&]( SCH_ITEM* aChild )
1825  {
1826  if( aMode == SELECTED )
1827  aChild->ClearSelected();
1828  else if( aMode == BRIGHTENED )
1829  aChild->ClearBrightened();
1830  } );
1831  }
1832 
1833  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
1834  getView()->Update( aItem->GetParent() );
1835  else
1836  getView()->Update( aItem );
1837 }
void ClearSelected()
Definition: eda_item.h:132
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
void ClearBrightened()
Definition: eda_item.h:133
EDA_ITEM * GetParent() const
Definition: eda_item.h:115
#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:43
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:193
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:1518
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113
#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 1768 of file ee_selection_tool.cpp.

1769 {
1770  unhighlight( aItem, SELECTED, &m_selection );
1771 }
#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 267 of file ee_selection_tool.cpp.

268 {
269  ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
270  CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
271 
272  if( conditionalMenu )
273  conditionalMenu->Evaluate( m_selection );
274 
275  if( actionMenu )
276  actionMenu->UpdateAll();
277 
278  return 0;
279 }
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 1099 of file ee_selection_tool.cpp.

1100 {
1101  VECTOR2I refP( 0, 0 );
1102 
1103  if( m_selection.Size() > 0 )
1104  {
1105  if( m_isSymbolEditor )
1106  refP = static_cast<LIB_ITEM*>( m_selection.GetTopLeftItem() )->GetPosition();
1107  else
1108  refP = static_cast<SCH_ITEM*>( m_selection.GetTopLeftItem() )->GetPosition();
1109  }
1110 
1112 }
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:186
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
int Size() const
Returns the number of selected parts.
Definition: selection.h:103
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(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::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 297 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 295 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(), SCH_MOVE_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PL_SELECTION_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 292 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(), MICROWAVE_TOOL::createInductorBetween(), 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(), PL_SELECTION_TOOL::disambiguateCursor(), disambiguateCursor(), PCB_SELECTION_TOOL::disambiguateCursor(), 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(), 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(), SYMBOL_EDITOR_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), 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::isInteractiveDragEnabled(), 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(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_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(), PL_EDIT_TOOL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), 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(), 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(), 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 296 of file ee_selection_tool.h.

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


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