KiCad PCB EDA Suite
EE_SELECTION_TOOL Class Reference

#include <ee_selection_tool.h>

Inheritance diagram for EE_SELECTION_TOOL:
TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 EE_SELECTION_TOOL ()
 
 ~EE_SELECTION_TOOL ()
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
int UpdateMenu (const TOOL_EVENT &aEvent)
 
int Main (const TOOL_EVENT &aEvent)
 Function Main() More...
 
EE_SELECTIONGetSelection ()
 Function GetSelection() More...
 
EE_SELECTIONRequestSelection (const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
 Function RequestSelection() More...
 
EDA_ITEMSelectPoint (const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, bool *aSelectionCancelledFlag=NULL, bool aCheckLocked=false, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
 Function selectPoint() Selects an item pointed by the parameter aWhere. 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 BrightenItem (EDA_ITEM *aItem)
 
void UnbrightenItem (EDA_ITEM *aItem)
 
EDA_ITEMGetNode (VECTOR2I aPosition)
 

Find (but don't select) node under cursor

More...
 
int SelectNode (const TOOL_EVENT &aEvent)
 

Select node under cursor

More...
 
int SelectConnection (const TOOL_EVENT &aEvent)
 

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

More...
 
int ClearSelection (const TOOL_EVENT &aEvent)
 

Clear current selection event handler.

More...
 
void ClearSelection ()
 
bool Selectable (const EDA_ITEM *aItem, bool checkVisibilityOnly=false) const
 Function Selectable() Checks 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)
 Function SelectionMenu() Shows a popup menu to trim the COLLECTOR passed as aEvent's parameter down to a single item. More...
 
void RebuildSelection ()
 Rebuilds the selection from the EDA_ITEMs' selection flags. More...
 
void Activate ()
 Function Activate() Runs the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
TOOL_SETTINGSGetSettings ()
 
bool IsToolActive () const
 

Protected Member Functions

void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

TOOL_MENU m_menu
 functions below are not yet implemented - their interface may change More...
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

bool selectMultiple ()
 Function selectMultiple() Handles drawing a selection box that allows one to select many items at the same time. More...
 
bool doSelectionMenu (EE_COLLECTOR *aItems)
 Allows the selection of a single item from a list via pop-up menu. More...
 
void select (EDA_ITEM *aItem)
 Function select() Takes necessary action mark an item as selected. More...
 
void unselect (EDA_ITEM *aItem)
 Function unselect() Takes necessary action mark an item as unselected. More...
 
void highlight (EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
 Function highlight() Highlights the item visually. More...
 
void unhighlight (EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
 Function unhighlight() Unhighlights the item visually. More...
 
void updateReferencePoint ()
 Sets the reference point to the anchor of the top-left item. More...
 
bool selectionContains (const VECTOR2I &aPoint) const
 Function selectionContains() More...
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 

Private Attributes

SCH_BASE_FRAMEm_frame
 
EE_SELECTION m_selection
 
bool m_additive
 
bool m_subtractive
 
bool m_exclusive_or
 
bool m_multiple
 
bool m_skip_heuristics
 
bool m_isLibEdit
 
bool m_isLibView
 
int m_unit
 
int m_convert
 

Detailed Description

Definition at line 57 of file ee_selection_tool.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determines 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 79 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ EE_SELECTION_TOOL()

EE_SELECTION_TOOL::EE_SELECTION_TOOL ( )

Definition at line 123 of file ee_selection_tool.cpp.

123  :
124  TOOL_INTERACTIVE( "eeschema.InteractiveSelection" ),
125  m_frame( nullptr ),
126  m_additive( false ),
127  m_subtractive( false ),
128  m_exclusive_or( false ),
129  m_multiple( false ),
130  m_skip_heuristics( false ),
131  m_isLibEdit( false ),
132  m_isLibView( false ),
133  m_unit( 0 ),
134  m_convert( 0 )
135 {
136 }
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Constructor.
SCH_BASE_FRAME * m_frame

◆ ~EE_SELECTION_TOOL()

EE_SELECTION_TOOL::~EE_SELECTION_TOOL ( )

Definition at line 139 of file ee_selection_tool.cpp.

140 {
141  getView()->Remove( &m_selection );
142 }
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
KIGFX::VIEW * getView() const
Function getView()
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

Function Activate() Runs 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:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls 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(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), LIB_TREE::onContextMenu(), POINT_EDITOR::OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_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 876 of file ee_selection_tool.cpp.

877 {
878  AddItemsToSel( aEvent.Parameter<EDA_ITEMS*>(), false );
879  m_selection.SetIsHover( false );
880  return 0;
881 }
int AddItemsToSel(const TOOL_EVENT &aEvent)
void SetIsHover(bool aIsHover)
Definition: selection.h:64
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: base_struct.h:623
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:427
EE_SELECTION m_selection

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

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

◆ AddItemsToSel() [2/2]

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

Definition at line 884 of file ee_selection_tool.cpp.

885 {
886  if( aList )
887  {
888  for( EDA_ITEM* item : *aList )
889  select( item );
890 
891  // Inform other potentially interested tools
892  if( !aQuietMode )
894  }
895 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:197
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163

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

◆ AddItemToSel() [1/2]

int EE_SELECTION_TOOL::AddItemToSel ( const TOOL_EVENT aEvent)

◆ AddItemToSel() [2/2]

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

Definition at line 863 of file ee_selection_tool.cpp.

864 {
865  if( aItem )
866  {
867  select( aItem );
868 
869  // Inform other potentially interested tools
870  if( !aQuietMode )
872  }
873 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:197
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates 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

Function attachManager()

Sets 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  m_toolSettings = TOOL_SETTINGS( this );
64 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:220
friend class TOOL_SETTINGS
Definition: tool_base.h:154

References TOOL_BASE::m_toolMgr, TOOL_BASE::m_toolSettings, and TOOL_BASE::TOOL_SETTINGS.

Referenced by TOOL_MANAGER::RegisterTool().

◆ BrightenItem()

void EE_SELECTION_TOOL::BrightenItem ( EDA_ITEM aItem)

Definition at line 941 of file ee_selection_tool.cpp.

942 {
943  highlight( aItem, BRIGHTENED );
944 }
void highlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Function highlight() Highlights the item visually.
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143

References BRIGHTENED, and highlight().

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

◆ ClearSelection() [1/2]

int EE_SELECTION_TOOL::ClearSelection ( const TOOL_EVENT aEvent)

Clear current selection event handler.

Definition at line 953 of file ee_selection_tool.cpp.

954 {
955  ClearSelection();
956 
957  return 0;
958 }

References ClearSelection().

Referenced by SCH_EDITOR_CONTROL::FindNext(), LIB_EDIT_TOOL::Paste(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ ClearSelection() [2/2]

void EE_SELECTION_TOOL::ClearSelection ( )

Definition at line 1124 of file ee_selection_tool.cpp.

1125 {
1126  if( m_selection.Empty() )
1127  return;
1128 
1129  while( m_selection.GetSize() )
1131 
1132  getView()->Update( &m_selection );
1133 
1134  m_selection.SetIsHover( false );
1136 
1137  // Inform other potentially interested tools
1139 }
void ClearReferencePoint()
Definition: selection.h:248
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void SetIsHover(bool aIsHover)
Definition: selection.h:64
#define SELECTED
Definition: base_struct.h:127
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
static const TOOL_EVENT ClearedEvent
Definition: actions.h:199
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:98
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
EE_SELECTION m_selection
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Function unhighlight() Unhighlights the item visually.
EDA_ITEM * Front() const
Definition: selection.h:182

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().

◆ doSelectionMenu()

bool EE_SELECTION_TOOL::doSelectionMenu ( EE_COLLECTOR aItems)
private

Allows 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

Definition at line 1000 of file ee_selection_tool.cpp.

1001 {
1002  EDA_ITEM* current = nullptr;
1003  ACTION_MENU menu( true );
1004 
1005  int limit = std::min( MAX_SELECT_ITEM_IDS, aCollector->GetCount() );
1006 
1007  for( int i = 0; i < limit; ++i )
1008  {
1009  wxString text;
1010  EDA_ITEM* item = ( *aCollector )[i];
1011  text = item->GetSelectMenuText( m_frame->GetUserUnits() );
1012 
1013  wxString menuText = wxString::Format("&%d. %s", i + 1, text );
1014  menu.Add( menuText, i + 1, item->GetMenuImage() );
1015  }
1016 
1017  if( aCollector->m_MenuTitle.Length() )
1018  menu.SetTitle( aCollector->m_MenuTitle );
1019 
1020  menu.SetIcon( info_xpm );
1021  menu.DisplayTitle( true );
1022  SetContextMenu( &menu, CMENU_NOW );
1023 
1024  while( TOOL_EVENT* evt = Wait() )
1025  {
1026  if( evt->Action() == TA_CHOICE_MENU_UPDATE )
1027  {
1028  if( current )
1029  unhighlight( current, BRIGHTENED );
1030 
1031  int id = *evt->GetCommandId();
1032 
1033  // User has pointed an item, so show it in a different way
1034  if( id > 0 && id <= limit )
1035  {
1036  current = ( *aCollector )[id - 1];
1037  highlight( current, BRIGHTENED );
1038  }
1039  else
1040  {
1041  current = nullptr;
1042  }
1043  }
1044  else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
1045  {
1046  if( current )
1047  unhighlight( current, BRIGHTENED );
1048 
1049  OPT<int> id = evt->GetCommandId();
1050 
1051  // User has selected an item, so this one will be returned
1052  if( id && ( *id > 0 ) )
1053  current = ( *aCollector )[*id - 1];
1054  else
1055  current = nullptr;
1056 
1057  break;
1058  }
1059 
1060  getView()->UpdateItems();
1061  m_frame->GetCanvas()->Refresh();
1062  }
1063 
1064  if( current )
1065  {
1066  unhighlight( current, BRIGHTENED );
1067 
1068  getView()->UpdateItems();
1069  m_frame->GetCanvas()->Refresh();
1070 
1071  aCollector->Empty();
1072  aCollector->Append( current );
1073  return true;
1074  }
1075 
1076  return false;
1077 }
#define MAX_SELECT_ITEM_IDS
The maximum number of items in the clarify selection context menu.
Definition: eeschema_id.h:37
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
Class ACTION_MENU.
Definition: action_menu.h:43
void SetContextMenu(ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Function SetContextMenu()
void highlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Function highlight() Highlights the item visually.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Class TOOL_EVENT.
Definition: tool_event.h:168
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
void UpdateItems()
Function UpdateItems() Iterates through the list of items that asked for updating and updates them.
Definition: view.cpp:1421
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
EDA_UNITS_T GetUserUnits() const
Return the user units currently in use.
SCH_BASE_FRAME * m_frame
size_t i
Definition: json11.cpp:597
virtual wxString GetSelectMenuText(EDA_UNITS_T aUnits) const
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
boost::optional< T > OPT
Definition: optional.h:7
virtual BITMAP_DEF GetMenuImage() const
Function GetMenuImage returns a pointer to an image to be used in menus.
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Function unhighlight() Unhighlights the item visually.
#define min(a, b)
Definition: auxiliary.h:85

References ACTION_MENU::Add(), COLLECTOR::Append(), BRIGHTENED, CMENU_NOW, ACTION_MENU::DisplayTitle(), COLLECTOR::Empty(), Format(), SCH_BASE_FRAME::GetCanvas(), COLLECTOR::GetCount(), EDA_ITEM::GetMenuImage(), EDA_ITEM::GetSelectMenuText(), EDA_BASE_FRAME::GetUserUnits(), TOOL_BASE::getView(), highlight(), i, m_frame, COLLECTOR::m_MenuTitle, MAX_SELECT_ITEM_IDS, min, EDA_DRAW_PANEL_GAL::Refresh(), TOOL_INTERACTIVE::SetContextMenu(), ACTION_MENU::SetIcon(), ACTION_MENU::SetTitle(), TA_CHOICE_MENU_CHOICE, TA_CHOICE_MENU_UPDATE, unhighlight(), KIGFX::VIEW::UpdateItems(), and TOOL_INTERACTIVE::Wait().

Referenced by SelectionMenu().

◆ getEditFrame()

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

Function getEditFrame()

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

Definition at line 187 of file tool_base.h.

188  {
189 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
190  wxASSERT( dynamic_cast<T*>( getEditFrameInt() ) );
191 #endif
192  return static_cast<T*>( getEditFrameInt() );
193  }
EDA_BASE_FRAME * getEditFrameInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getEditFrameInt().

Referenced by ZONE_CREATE_HELPER::createNewZone(), and TOOL_SETTINGS::getConfigBase().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Function GetId() Returns the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

122  {
123  return m_toolId;
124  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214

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(), and TOOL_MANAGER::saveViewControls().

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER. If there is no TOOL_MANAGER associated, it returns NULL.

Definition at line 143 of file tool_base.h.

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

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

202  {
203  EDA_ITEM* m = getModelInt();
204 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
205  wxASSERT( dynamic_cast<T*>( m ) );
206 #endif
207  return static_cast<T*>( m );
208  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:54
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Function GetName() Returns 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 132 of file tool_base.h.

133  {
134  return m_toolName;
135  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:218

References TOOL_BASE::m_toolName.

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

◆ GetNode()

EDA_ITEM * EE_SELECTION_TOOL::GetNode ( VECTOR2I  aPosition)

Find (but don't select) node under cursor

Definition at line 795 of file ee_selection_tool.cpp.

796 {
797  if( m_frame->GetScreen()->GetDrawItems() == nullptr ) // Empty schematics
798  return nullptr;
799 
800  EE_COLLECTOR collector;
801 
802  int thresholdMax = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
803 
804  for( int threshold : { 0, thresholdMax/2, thresholdMax } )
805  {
806  collector.m_Threshold = threshold;
807  collector.Collect( m_frame->GetScreen()->GetDrawItems(), nodeTypes, (wxPoint) aPosition );
808 
809  if( collector.GetCount() > 0 )
810  break;
811  }
812 
813  return collector.GetCount() ? collector[ 0 ] : nullptr;
814 }
int m_Threshold
Definition: collector.h:68
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
#define HITTEST_THRESHOLD_PIXELS
Class EE_COLLECTOR.
Definition: ee_collectors.h:39
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:113
void Collect(EDA_ITEM *aItem, const KICAD_T aFilterList[], const wxPoint &aPos, int aUnit=0, int aConvert=0)
Function Collect scans a EDA_ITEM using this class's Inspector method, which does the collection.
KIGFX::VIEW * getView() const
Function getView()
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: common.h:114
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:152

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

◆ GetSelection()

◆ GetSettings()

TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 78 of file tool_base.cpp.

79 {
80  return m_toolSettings;
81 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:220

References TOOL_BASE::m_toolSettings.

Referenced by ROUTER_TOOL::Init(), GERBVIEW_SELECTION_TOOL::selectable(), and ROUTER_TOOL::~ROUTER_TOOL().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 110 of file tool_base.h.

111  {
112  return m_type;
113  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:211

References TOOL_BASE::m_type.

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

◆ getView()

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

Function getView()

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:241
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

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(), PL_SELECTION_TOOL::ClearSelection(), ClearSelection(), COMMON_TOOLS::CursorControl(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), PL_SELECTION_TOOL::doSelectionMenu(), doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PL_DRAWING_TOOLS::DrawShape(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), GetNode(), ROUTER_TOOL::getStartLayer(), COMMON_TOOLS::GridPreset(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::GuessSelectionCandidates(), PL_SELECTION_TOOL::highlight(), highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::highlightNet(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), Reset(), SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), GERBVIEW_SELECTION_TOOL::selectable(), PL_SELECTION_TOOL::selectionContains(), selectionContains(), SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), selectMultiple(), SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), PL_EDITOR_CONTROL::ToggleBackgroundColor(), COMMON_TOOLS::ToggleGrid(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), PL_SELECTION_TOOL::unhighlight(), unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PCBNEW_CONTROL::updateGrid(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_TOOL_BASE::view(), COMMON_TOOLS::ZoomFitScreen(), SELECTION_TOOL::zoomFitSelection(), ~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

◆ getViewControls()

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

Function getViewControls()

Returns 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:219
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:246

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

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), COMMON_TOOLS::GridPreset(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), MODULE_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), selectMultiple(), SELECTION_TOOL::selectMultiple(), SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), PL_EDIT_TOOL::updateModificationPoint(), 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

Function Go()

Defines which state (aStateFunc) to go when a certain event arrives (aConditions). No conditions means any event.

Definition at line 129 of file tool_interactive.h.

131 {
132  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
133 
134  goInternal( sptr, aConditions );
135 }
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 LENGTH_TUNER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_CONTROL::setTransitions(), LIB_PIN_TOOL::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), COMMON_CONTROL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), SCH_MOVE_TOOL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), LIB_CONTROL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), MODULE_EDITOR_TOOLS::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), PCBNEW_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), setTransitions(), and DRC::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 516 of file ee_selection_tool.cpp.

517 {
518  // There are certain parent/child and enclosure combinations that can be handled
519  // automatically.
520 
521  // Prefer exact hits to sloppy ones
522  int exactHits = 0;
523 
524  for( int i = collector.GetCount() - 1; i >= 0; --i )
525  {
526  EDA_ITEM* item = collector[ i ];
527 
528  if( item->HitTest( (wxPoint) aPos, 0 ) )
529  exactHits++;
530  }
531 
532  if( exactHits > 0 && exactHits < collector.GetCount() )
533  {
534  for( int i = collector.GetCount() - 1; i >= 0; --i )
535  {
536  EDA_ITEM* item = collector[ i ];
537 
538  if( !item->HitTest( (wxPoint) aPos, 0 ) )
539  collector.Remove( item );
540  }
541  }
542 
543  // Prefer a non-sheet to a sheet
544  for( int i = 0; collector.GetCount() == 2 && i < 2; ++i )
545  {
546  EDA_ITEM* item = collector[ i ];
547  EDA_ITEM* other = collector[ ( i + 1 ) % 2 ];
548 
549  if( item->Type() != SCH_SHEET_T && other->Type() == SCH_SHEET_T )
550  collector.Remove( other );
551  }
552 
553  // Prefer a symbol to a pin
554  for( int i = 0; collector.GetCount() == 2 && i < 2; ++i )
555  {
556  EDA_ITEM* item = collector[ i ];
557  EDA_ITEM* other = collector[ ( i + 1 ) % 2 ];
558 
559  if( item->Type() == SCH_COMPONENT_T && other->Type() == SCH_PIN_T )
560  collector.Remove( other );
561  }
562 
563  // Prefer a field to a symbol
564  for( int i = 0; collector.GetCount() == 2 && i < 2; ++i )
565  {
566  EDA_ITEM* item = collector[ i ];
567  EDA_ITEM* other = collector[ ( i + 1 ) % 2 ];
568 
569  if( item->Type() == SCH_FIELD_T && other->Type() == SCH_COMPONENT_T )
570  collector.Remove( other );
571  }
572 
573  // No need for multiple wires at a single point; if there's a junction select that;
574  // otherwise any of the wires will do
575  bool junction = false;
576  bool wiresOnly = true;
577 
578  for( EDA_ITEM* item : collector )
579  {
580  if( item->Type() == SCH_JUNCTION_T )
581  junction = true;
582  else if( item->Type() != SCH_LINE_T )
583  wiresOnly = false;
584  }
585 
586  if( wiresOnly )
587  {
588  for( int j = collector.GetCount() - 1; j >= 0; --j )
589  {
590  if( junction && collector[ j ]->Type() != SCH_JUNCTION_T )
591  collector.Remove( j );
592  else if( !junction && j > 0 )
593  collector.Remove( j );
594  }
595  }
596 }
void Remove(int aIndex)
Function Remove removes the item at aIndex (first position is 0);.
Definition: collector.h:142
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
Definition: base_struct.h:340
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:113
size_t i
Definition: json11.cpp:597
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

References COLLECTOR::GetCount(), EDA_ITEM::HitTest(), i, COLLECTOR::Remove(), SCH_COMPONENT_T, SCH_FIELD_T, SCH_JUNCTION_T, SCH_LINE_T, SCH_PIN_T, SCH_SHEET_T, and EDA_ITEM::Type().

Referenced by LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), and SelectPoint().

◆ highlight()

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

Function highlight() Highlights 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 1154 of file ee_selection_tool.cpp.

1155 {
1156  KICAD_T itemType = aItem->Type();
1157 
1158  if( aMode == SELECTED )
1159  aItem->SetSelected();
1160  else if( aMode == BRIGHTENED )
1161  aItem->SetBrightened();
1162 
1163  if( aGroup )
1164  aGroup->Add( aItem );
1165 
1166  // Highlight pins and fields. (All the other component children are currently only
1167  // represented in the LIB_PART and will inherit the settings of the parent component.)
1168  if( itemType == SCH_COMPONENT_T )
1169  {
1170  SCH_PINS& pins = static_cast<SCH_COMPONENT*>( aItem )->GetPins();
1171 
1172  for( SCH_PIN& pin : pins )
1173  {
1174  if( aMode == SELECTED )
1175  pin.SetSelected();
1176  else if( aMode == BRIGHTENED )
1177  pin.SetBrightened();
1178  }
1179 
1180  std::vector<SCH_FIELD*> fields;
1181  static_cast<SCH_COMPONENT*>( aItem )->GetFields( fields, false );
1182 
1183  for( SCH_FIELD* field : fields )
1184  {
1185  if( aMode == SELECTED )
1186  field->SetSelected();
1187  else if( aMode == BRIGHTENED )
1188  field->SetBrightened();
1189  }
1190  }
1191  else if( itemType == SCH_SHEET_T )
1192  {
1193  SCH_SHEET_PINS& pins = static_cast<SCH_SHEET*>( aItem )->GetPins();
1194 
1195  for( SCH_SHEET_PIN& pin : pins )
1196  {
1197  if( aMode == SELECTED )
1198  pin.SetSelected();
1199  else if( aMode == BRIGHTENED )
1200  pin.SetBrightened();
1201  }
1202  }
1203 
1204  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
1205  getView()->Update( aItem->GetParent() );
1206  else
1207  getView()->Update( aItem );
1208 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
std::vector< SCH_PIN > SCH_PINS
A container for several SCH_PIN items.
Definition: sch_component.h:51
void SetBrightened()
Definition: base_struct.h:241
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:74
#define SELECTED
Definition: base_struct.h:127
void SetSelected()
Definition: base_struct.h:239
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
EDA_ITEM * GetParent() const
Definition: base_struct.h:220
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:75
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
boost::ptr_vector< SCH_SHEET_PIN > SCH_SHEET_PINS
Definition: sch_sheet.h:203
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

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

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

◆ Init()

bool EE_SELECTION_TOOL::Init ( )
overridevirtual

Function Init() 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 146 of file ee_selection_tool.cpp.

147 {
148  m_frame = getEditFrame<SCH_BASE_FRAME>();
149 
150  LIB_VIEW_FRAME* libViewFrame = dynamic_cast<LIB_VIEW_FRAME*>( m_frame );
151  LIB_EDIT_FRAME* libEditFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
152 
153  if( libEditFrame )
154  {
155  m_isLibEdit = true;
156  m_unit = libEditFrame->GetUnit();
157  m_convert = libEditFrame->GetConvert();
158  }
159  else
160  m_isLibView = libViewFrame != nullptr;
161 
162 
163  static KICAD_T wireOrBusTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
164 
165  auto wireSelection = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_WIRE_T );
166  auto busSelection = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_BUS_T );
167  auto wireOrBusSelection = E_C::MoreThan( 0 ) && E_C::OnlyTypes( wireOrBusTypes );
168  auto sheetSelection = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
169  auto schEditCondition = [this] ( const SELECTION& aSel ) {
170  return !m_isLibEdit && !m_isLibView;
171  };
172  auto belowRootSheetCondition = [this] ( const SELECTION& aSel ) {
174  };
175  auto havePartCondition = [ this ] ( const SELECTION& sel ) {
176  return m_isLibEdit && ( (LIB_EDIT_FRAME*) m_frame )->GetCurPart();
177  };
178 
179  auto& menu = m_menu.GetMenu();
180 
181  menu.AddItem( EE_ACTIONS::enterSheet, sheetSelection && EE_CONDITIONS::Idle, 1 );
182  menu.AddItem( EE_ACTIONS::explicitCrossProbe, sheetSelection && EE_CONDITIONS::Idle, 1 );
183  menu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 1 );
184 
185  menu.AddSeparator( 100 );
186  menu.AddItem( EE_ACTIONS::drawWire, schEditCondition && EE_CONDITIONS::Empty, 100 );
187  menu.AddItem( EE_ACTIONS::drawBus, schEditCondition && EE_CONDITIONS::Empty, 100 );
188 
189  menu.AddSeparator( 100 );
191 
192  menu.AddSeparator( 100 );
194 
195  menu.AddSeparator( 200 );
196  menu.AddItem( EE_ACTIONS::selectConnection, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
197  menu.AddItem( EE_ACTIONS::placeJunction, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
198  menu.AddItem( EE_ACTIONS::placeLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
199  menu.AddItem( EE_ACTIONS::placeGlobalLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
200  menu.AddItem( EE_ACTIONS::placeHierLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
201  menu.AddItem( EE_ACTIONS::breakWire, wireSelection && EE_CONDITIONS::Idle, 250 );
202  menu.AddItem( EE_ACTIONS::breakBus, busSelection && EE_CONDITIONS::Idle, 250 );
203  menu.AddItem( EE_ACTIONS::placeSheetPin, sheetSelection && EE_CONDITIONS::Idle, 250 );
204  menu.AddItem( EE_ACTIONS::importSheetPin, sheetSelection && EE_CONDITIONS::Idle, 250 );
205 
206  menu.AddSeparator( 400 );
207  menu.AddItem( EE_ACTIONS::symbolProperties, havePartCondition && EE_CONDITIONS::Empty, 400 );
208  menu.AddItem( EE_ACTIONS::pinTable, havePartCondition && EE_CONDITIONS::Empty, 400 );
209 
210  menu.AddSeparator( 1000 );
212 
213  return true;
214 }
static TOOL_ACTION pinTable
Definition: ee_actions.h:150
void AddStandardSubMenus(TOOL_MENU &aMenu)
Function CreateBasicMenu.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
static bool IsDrawingWire(const SELECTION &aSelection)
static TOOL_ACTION breakBus
Definition: ee_actions.h:138
int GetConvert() const
SCH_SHEET * Last() const
Function Last returns a pointer to the last sheet of the list One can see the others sheet as the "pa...
static SELECTION_CONDITION MoreThan(int aNumber)
Function MoreThan Creates a functor that tests if the number of selected items is greater than the va...
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Function OnlyTypes Creates a functor that tests if the selected items are only of given types.
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:90
static TOOL_ACTION placeJunction
Definition: ee_actions.h:85
static TOOL_ACTION selectConnection
If current selection is a wire or bus, expand to entire connection.
Definition: ee_actions.h:55
static SELECTION_CONDITION Idle
static SELECTION_CONDITION Count(int aNumber)
Function Count Creates a functor that tests if the number of selected items is equal to the value giv...
Symbol library viewer main window.
Definition: viewlib_frame.h:43
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
static TOOL_ACTION breakWire
Definition: ee_actions.h:137
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:177
int GetUnit() const
static SELECTION_CONDITION Empty
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:47
SCH_SHEET_PATH * g_CurrentSheet
With the new connectivity algorithm, many more places than before want to know what the current sheet...
static TOOL_ACTION drawWire
Definition: ee_actions.h:81
static TOOL_ACTION placeSheetPin
Definition: ee_actions.h:92
static TOOL_ACTION explicitCrossProbe
Definition: ee_actions.h:186
static TOOL_ACTION symbolProperties
Definition: ee_actions.h:149
static TOOL_ACTION importSheetPin
Definition: ee_actions.h:93
static bool IsDrawingBus(const SELECTION &aSelection)
static TOOL_ACTION drawBus
Definition: ee_actions.h:82
static TOOL_ACTION placeLabel
Definition: ee_actions.h:88
The symbol library editor main window.
SCH_BASE_FRAME * m_frame
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Function OnlyType Creates a functor that tests if the selected items are only of given type.
static TOOL_ACTION enterSheet
Definition: ee_actions.h:176
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:89
static TOOL_ACTION finishBus
Definition: ee_actions.h:99
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
static TOOL_ACTION finishWire
Definition: ee_actions.h:98

References CONDITIONAL_MENU::AddItem(), EDA_DRAW_FRAME::AddStandardSubMenus(), EE_ACTIONS::breakBus, EE_ACTIONS::breakWire, SELECTION_CONDITIONS::Count(), EE_ACTIONS::drawBus, EE_ACTIONS::drawWire, EE_CONDITIONS::Empty, EE_ACTIONS::enterSheet, EOT, EE_ACTIONS::explicitCrossProbe, EE_ACTIONS::finishBus, EE_ACTIONS::finishWire, g_CurrentSheet, g_RootSheet, LIB_EDIT_FRAME::GetConvert(), TOOL_MENU::GetMenu(), LIB_EDIT_FRAME::GetUnit(), EE_CONDITIONS::Idle, EE_ACTIONS::importSheetPin, SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), SCH_SHEET_PATH::Last(), EE_ACTIONS::leaveSheet, m_convert, m_frame, m_isLibEdit, m_isLibView, TOOL_INTERACTIVE::m_menu, m_unit, SELECTION_CONDITIONS::MoreThan(), SELECTION_CONDITIONS::OnlyType(), SELECTION_CONDITIONS::OnlyTypes(), EE_ACTIONS::pinTable, EE_ACTIONS::placeGlobalLabel, EE_ACTIONS::placeHierLabel, EE_ACTIONS::placeJunction, EE_ACTIONS::placeLabel, EE_ACTIONS::placeSheetPin, SCH_LINE_LOCATE_BUS_T, SCH_LINE_LOCATE_WIRE_T, SCH_SHEET_T, 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:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing)

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

◆ Main()

int EE_SELECTION_TOOL::Main ( const TOOL_EVENT aEvent)

Function Main()

The main loop.

Definition at line 265 of file ee_selection_tool.cpp.

266 {
267  const KICAD_T movableItems[] =
268  {
269  SCH_MARKER_T,
274  SCH_LINE_T,
275  SCH_BITMAP_T,
276  SCH_TEXT_T,
277  SCH_LABEL_T,
280  SCH_FIELD_T,
283  SCH_SHEET_T,
284  EOT
285  };
286 
287  // Main loop: keep receiving events
288  while( TOOL_EVENT* evt = Wait() )
289  {
290  if( m_frame->ToolStackIsEmpty() )
291  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
292 
294 
295  if( evt->Modifier( MD_SHIFT ) && evt->Modifier( MD_CTRL ) )
296  m_subtractive = true;
297  else if( evt->Modifier( MD_SHIFT ) )
298  m_additive = true;
299  else if( evt->Modifier( MD_CTRL ) )
300  m_exclusive_or = true;
301 
302  // Is the user requesting that the selection list include all possible
303  // items without removing less likely selection candidates
304  m_skip_heuristics = !!evt->Modifier( MD_ALT );
305 
306  // Single click? Select single object
307  if( evt->IsClick( BUT_LEFT ) )
308  {
309  SelectPoint( evt->Position(), EE_COLLECTOR::AllItems, nullptr, false,
311  }
312 
313  // right click? if there is any object - show the context menu
314  else if( evt->IsClick( BUT_RIGHT ) )
315  {
316  bool selectionCancelled = false;
317 
318  if( m_selection.Empty() )
319  {
320  SelectPoint( evt->Position(), EE_COLLECTOR::AllItems, &selectionCancelled );
321  m_selection.SetIsHover( true );
322  }
323 
324  if( !selectionCancelled )
326  }
327 
328  // double click? Display the properties window
329  else if( evt->IsDblClick( BUT_LEFT ) )
330  {
331  if( m_selection.Empty() )
332  SelectPoint( evt->Position());
333 
334  EDA_ITEM* item = m_selection.Front();
335 
336  if( item && item->Type() == SCH_SHEET_T )
338  else
340  }
341 
342  // drag with LMB? Select multiple objects (or at least draw a selection box) or drag them
343  else if( evt->IsDrag( BUT_LEFT ) )
344  {
346  {
347  selectMultiple();
348  }
349  else
350  {
351  // selection is empty? try to start dragging the item under the point where drag
352  // started
353  if( m_selection.Empty() )
354  m_selection = RequestSelection( movableItems );
355 
356  // Check if dragging has started within any of selected items bounding box
357  if( selectionContains( evt->Position() ) )
358  {
359  // Yes -> run the move tool and wait till it finishes
360  m_toolMgr->InvokeTool( "eeschema.InteractiveMove" );
361  }
362  else
363  {
364  // No -> drag a selection box
365  selectMultiple();
366  }
367  }
368  }
369 
370  // context sub-menu selection? Handle unit selection or bus unfolding
371  else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
372  {
373  if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
374  && evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_CMP_MAX )
375  {
376  SCH_COMPONENT* component = dynamic_cast<SCH_COMPONENT*>( m_selection.Front() );
377  int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;
378 
379  if( component )
380  static_cast<SCH_EDIT_FRAME*>( m_frame )->SelectUnit( component, unit );
381  }
382  else if( evt->GetCommandId().get() >= ID_POPUP_SCH_UNFOLD_BUS
383  && evt->GetCommandId().get() <= ID_POPUP_SCH_UNFOLD_BUS_END )
384  {
385  wxString* net = new wxString( *evt->Parameter<wxString*>() );
387  }
388 
389  }
390 
391  else if( evt->IsCancelInteractive() )
392  {
393  ClearSelection();
394  }
395 
396  else if( evt->Action() == TA_UNDO_REDO_PRE )
397  {
398  ClearSelection();
399  }
400 
401  else
402  evt->SetPassEvent();
403  }
404 
405  // This tool is supposed to be active forever
406  assert( false );
407 
408  return 0;
409 }
static TOOL_ACTION properties
Definition: ee_actions.h:122
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
bool selectionContains(const VECTOR2I &aPoint) const
Function selectionContains()
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool selectMultiple()
Function selectMultiple() Handles drawing a selection box that allows one to select many items at the...
static TOOL_ACTION unfoldBus
Definition: ee_actions.h:83
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
void SetIsHover(bool aIsHover)
Definition: selection.h:64
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Class TOOL_EVENT.
Definition: tool_event.h:168
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119
bool ToolStackIsEmpty()
SCH_BASE_FRAME * m_frame
static const KICAD_T AllItems[]
Definition: ee_collectors.h:42
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:73
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
static TOOL_ACTION enterSheet
Definition: ee_actions.h:176
EDA_ITEM * SelectPoint(const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, bool *aSelectionCancelledFlag=NULL, bool aCheckLocked=false, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
Function selectPoint() Selects an item pointed by the parameter aWhere.
EE_SELECTION m_selection
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
bool GetDragSelects() const
Indicates that a drag should draw a selection rectangle, even when started over an item.
EDA_ITEM * Front() const
Definition: selection.h:182
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

References EE_COLLECTOR::AllItems, BUT_LEFT, BUT_RIGHT, ClearSelection(), SELECTION::Empty(), EE_ACTIONS::enterSheet, EOT, SELECTION::Front(), SCH_BASE_FRAME::GetCanvas(), EDA_BASE_FRAME::GetDragSelects(), ID_POPUP_SCH_SELECT_UNIT_CMP, ID_POPUP_SCH_SELECT_UNIT_CMP_MAX, ID_POPUP_SCH_UNFOLD_BUS, ID_POPUP_SCH_UNFOLD_BUS_END, TOOL_MANAGER::InvokeTool(), m_additive, m_exclusive_or, m_frame, TOOL_INTERACTIVE::m_menu, m_selection, m_skip_heuristics, m_subtractive, TOOL_BASE::m_toolMgr, MD_ALT, MD_CTRL, MD_SHIFT, EE_ACTIONS::properties, RequestSelection(), TOOL_MANAGER::RunAction(), SCH_BITMAP_T, SCH_BUS_BUS_ENTRY_T, SCH_BUS_WIRE_ENTRY_T, SCH_COMPONENT_T, SCH_FIELD_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_LINE_T, SCH_MARKER_T, SCH_NO_CONNECT_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_TEXT_T, selectionContains(), selectMultiple(), SelectPoint(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), SELECTION::SetIsHover(), TOOL_MENU::ShowContextMenu(), TA_CHOICE_MENU_CHOICE, TA_UNDO_REDO_PRE, TC_COMMAND, EDA_BASE_FRAME::ToolStackIsEmpty(), EDA_ITEM::Type(), EE_ACTIONS::unfoldBus, and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ RebuildSelection()

void EE_SELECTION_TOOL::RebuildSelection ( )

Rebuilds the selection from the EDA_ITEMs' selection flags.

Commonly called after rolling back an undo state to make sure there aren't any stale pointers.

Definition at line 961 of file ee_selection_tool.cpp.

962 {
963  m_selection.Clear();
964 
965  EDA_ITEM* start = nullptr;
966 
967  if( m_isLibEdit )
968  start = static_cast<LIB_EDIT_FRAME*>( m_frame )->GetCurPart();
969  else
970  start = m_frame->GetScreen()->GetDrawItems();
971 
972  INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
973  {
974  if( item->IsSelected() )
975  select( item );
976 
977  return SEARCH_CONTINUE;
978  };
979 
980  EDA_ITEM::IterateForward( start, inspector, nullptr, EE_COLLECTOR::AllItems );
981 
983 
984  // Inform other potentially interested tools
986 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:197
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:93
std::function< SEARCH_RESULT(EDA_ITEM *aItem, void *aTestData) > INSPECTOR_FUNC
Typedef INSPECTOR is used to inspect and possibly collect the (search) results of iterating over a li...
Definition: base_struct.h:83
bool IsSelected() const
Definition: base_struct.h:233
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
void updateReferencePoint()
Sets the reference point to the anchor of the top-left item.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
static SEARCH_RESULT IterateForward(EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function IterateForward walks through the object tree calling the inspector() on each object type req...
Definition: base_struct.h:418
SCH_BASE_FRAME * m_frame
static const KICAD_T AllItems[]
Definition: ee_collectors.h:42
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
EE_SELECTION m_selection
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:152

References EE_COLLECTOR::AllItems, SELECTION::Clear(), SCH_SCREEN::GetDrawItems(), SCH_BASE_FRAME::GetScreen(), EDA_ITEM::IsSelected(), EDA_ITEM::IterateForward(), m_frame, m_isLibEdit, m_selection, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), SEARCH_CONTINUE, select(), EVENTS::SelectedEvent, and updateReferencePoint().

Referenced by SCH_MOVE_TOOL::Main(), LIB_EDIT_TOOL::Paste(), SCH_EDIT_FRAME::PutDataInPreviousState(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), LIB_EDIT_FRAME::RollbackPartFromUndo(), LIB_EDIT_TOOL::Undo(), and SCH_EDITOR_CONTROL::Undo().

◆ RemoveItemFromSel() [1/2]

int EE_SELECTION_TOOL::RemoveItemFromSel ( const TOOL_EVENT aEvent)

Definition at line 898 of file ee_selection_tool.cpp.

899 {
900  RemoveItemFromSel( aEvent.Parameter<EDA_ITEM*>() );
901  m_selection.SetIsHover( false );
902  return 0;
903 }
void SetIsHover(bool aIsHover)
Definition: selection.h:64
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:427
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
EE_SELECTION m_selection

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

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

◆ RemoveItemFromSel() [2/2]

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

Definition at line 906 of file ee_selection_tool.cpp.

907 {
908  if( aItem )
909  {
910  unselect( aItem );
911 
912  // Inform other potentially interested tools
913  if( !aQuietMode )
915  }
916 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:198
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
void unselect(EDA_ITEM *aItem)
Function unselect() Takes necessary action mark an item as unselected.

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

◆ RemoveItemsFromSel() [1/2]

int EE_SELECTION_TOOL::RemoveItemsFromSel ( const TOOL_EVENT aEvent)

Definition at line 919 of file ee_selection_tool.cpp.

920 {
921  RemoveItemsFromSel( aEvent.Parameter<EDA_ITEMS*>(), false );
922  m_selection.SetIsHover( false );
923  return 0;
924 }
void SetIsHover(bool aIsHover)
Definition: selection.h:64
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: base_struct.h:623
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:427
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(), and setTransitions().

◆ RemoveItemsFromSel() [2/2]

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

Definition at line 927 of file ee_selection_tool.cpp.

928 {
929  if( aList )
930  {
931  for( EDA_ITEM* item : *aList )
932  unselect( item );
933 
934  // Inform other potentially interested tools
935  if( !aQuietMode )
937  }
938 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:198
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
void unselect(EDA_ITEM *aItem)
Function unselect() Takes necessary action mark an item as unselected.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163

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

◆ RequestSelection()

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

Function RequestSelection()

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

Definition at line 599 of file ee_selection_tool.cpp.

600 {
601  // Filter an existing selection
602  if( !m_selection.Empty() )
603  {
604  for( int i = m_selection.GetSize() - 1; i >= 0; --i )
605  {
606  EDA_ITEM* item = (EDA_ITEM*) m_selection.GetItem( i );
607 
608  if( !item->IsType( aFilterList ) )
609  {
610  unselect( item );
612  }
613  }
614 
615  }
616 
617  // If nothing was selected, or we filtered everything out, do a hover selection
618  if( m_selection.Empty() )
619  {
620  VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true );
621 
622  ClearSelection();
623  SelectPoint( cursorPos, aFilterList );
624  m_selection.SetIsHover( true );
626  }
627 
629 
630  return m_selection;
631 }
void ClearReferencePoint()
Definition: selection.h:248
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:198
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual bool IsType(const KICAD_T aScanTypes[])
Function IsType Checks whether the item is one of the listed types.
Definition: base_struct.h:294
void SetIsHover(bool aIsHover)
Definition: selection.h:64
void updateReferencePoint()
Sets the reference point to the anchor of the top-left item.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:103
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:98
void unselect(EDA_ITEM *aItem)
Function unselect() Takes necessary action mark an item as unselected.
size_t i
Definition: json11.cpp:597
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
EDA_ITEM * SelectPoint(const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, bool *aSelectionCancelledFlag=NULL, bool aCheckLocked=false, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
Function selectPoint() Selects an item pointed by the parameter aWhere.
EE_SELECTION m_selection
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

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

Referenced by SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::ChangeTextType(), SCH_EDIT_TOOL::CleanupSheetPins(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::Main(), Main(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), SelectConnection(), EE_INSPECTION_TOOL::ShowDatasheet(), and BUS_UNFOLD_MENU::update().

◆ Reset()

void EE_SELECTION_TOOL::Reset ( RESET_REASON  aReason)
overridevirtual

Function Reset() Brings 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 217 of file ee_selection_tool.cpp.

218 {
219  m_frame = getEditFrame<SCH_BASE_FRAME>();
220 
221  if( aReason == TOOL_BASE::MODEL_RELOAD )
222  {
223  // Remove pointers to the selected items from containers without changing their
224  // properties (as they are already deleted while a new sheet is loaded)
225  m_selection.Clear();
226  getView()->GetPainter()->GetSettings()->SetHighlight( false );
227 
228  LIB_EDIT_FRAME* libEditFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
229  LIB_VIEW_FRAME* libViewFrame = dynamic_cast<LIB_VIEW_FRAME*>( m_frame );
230 
231  if( libEditFrame )
232  {
233  m_isLibEdit = true;
234  m_unit = libEditFrame->GetUnit();
235  m_convert = libEditFrame->GetConvert();
236  }
237  else
238  m_isLibView = libViewFrame != nullptr;
239  }
240  else
241  // Restore previous properties of selected items and remove them from containers
242  ClearSelection();
243 
244  // Reinsert the VIEW_GROUP, in case it was removed from the VIEW
245  getView()->Remove( &m_selection );
246  getView()->Add( &m_selection );
247 }
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:93
int GetConvert() const
Model changes (required full reload)
Definition: tool_base.h:82
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
Symbol library viewer main window.
Definition: viewlib_frame.h:43
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
int GetUnit() const
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aHighlightItems=false)
Function SetHighlight Turns on/off highlighting - it may be done for the active layer,...
Definition: painter.h:141
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
The symbol library editor main window.
SCH_BASE_FRAME * m_frame
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
EE_SELECTION m_selection

References KIGFX::VIEW::Add(), SELECTION::Clear(), ClearSelection(), LIB_EDIT_FRAME::GetConvert(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), LIB_EDIT_FRAME::GetUnit(), TOOL_BASE::getView(), m_convert, m_frame, m_isLibEdit, m_isLibView, 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

Function RunMainStack()

Calls 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:219
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

Function select() Takes necessary action mark an item as selected.

Parameters
aItemis an item to be selected.

Definition at line 1142 of file ee_selection_tool.cpp.

1143 {
1144  highlight( aItem, SELECTED, &m_selection );
1145 }
#define SELECTED
Definition: base_struct.h:127
void highlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Function highlight() Highlights the item visually.
EE_SELECTION m_selection

References highlight(), m_selection, and SELECTED.

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

◆ Selectable()

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

Function Selectable() Checks conditions for an item to be selected.

Returns
True if the item fulfills conditions to be selected.

Definition at line 1080 of file ee_selection_tool.cpp.

1081 {
1082  // NOTE: in the future this is where eeschema layer/itemtype visibility will be handled
1083 
1084  switch( aItem->Type() )
1085  {
1086  case SCH_PIN_T:
1087  if( !static_cast<const SCH_PIN*>( aItem )->IsVisible() && !m_frame->GetShowAllPins() )
1088  return false;
1089  break;
1090 
1091  case LIB_PART_T: // In libedit we do not want to select the symbol itself.
1092  return false;
1093 
1094  case LIB_ARC_T:
1095  case LIB_CIRCLE_T:
1096  case LIB_TEXT_T:
1097  case LIB_RECTANGLE_T:
1098  case LIB_POLYLINE_T:
1099  case LIB_BEZIER_T:
1100  case LIB_PIN_T:
1101  {
1102  LIB_EDIT_FRAME* editFrame = (LIB_EDIT_FRAME*) m_frame;
1103  LIB_ITEM* lib_item = (LIB_ITEM*) aItem;
1104 
1105  if( lib_item->GetUnit() && lib_item->GetUnit() != editFrame->GetUnit() )
1106  return false;
1107 
1108  if( lib_item->GetConvert() && lib_item->GetConvert() != editFrame->GetConvert() )
1109  return false;
1110 
1111  break;
1112  }
1113  case SCH_MARKER_T: // Always selectable
1114  return true;
1115 
1116  default: // Suppress warnings
1117  break;
1118  }
1119 
1120  return true;
1121 }
int GetConvert() const
The base class for drawable items used by schematic library components.
Definition: lib_item.h:61
int GetUnit() const
Definition: lib_item.h:301
int GetUnit() const
int GetConvert() const
Definition: lib_item.h:304
The symbol library editor main window.
virtual bool GetShowAllPins() const
Allow some frames to show/hide hidden pins.
SCH_BASE_FRAME * m_frame
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

References LIB_EDIT_FRAME::GetConvert(), LIB_ITEM::GetConvert(), SCH_BASE_FRAME::GetShowAllPins(), LIB_EDIT_FRAME::GetUnit(), LIB_ITEM::GetUnit(), LIB_ARC_T, LIB_BEZIER_T, LIB_CIRCLE_T, LIB_PART_T, LIB_PIN_T, LIB_POLYLINE_T, LIB_RECTANGLE_T, LIB_TEXT_T, m_frame, SCH_MARKER_T, SCH_PIN_T, and EDA_ITEM::Type().

Referenced by LIB_EDIT_TOOL::DeleteItemCursor(), selectMultiple(), and SelectPoint().

◆ SelectConnection()

int EE_SELECTION_TOOL::SelectConnection ( const TOOL_EVENT aEvent)

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

Definition at line 827 of file ee_selection_tool.cpp.

828 {
829  static KICAD_T wiresAndBusses[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
830 
831  RequestSelection( wiresAndBusses );
832 
833  if( m_selection.Empty() )
834  return 0;
835 
836  SCH_LINE* line = (SCH_LINE*) m_selection.Front();
837  EDA_ITEMS items;
838 
840  m_frame->GetScreen()->MarkConnections( line );
841 
842  for( EDA_ITEM* item = m_frame->GetScreen()->GetDrawItems(); item; item = item->Next() )
843  {
844  if( item->HasFlag( CANDIDATE ) )
845  select( item );
846  }
847 
848  if( m_selection.GetSize() > 1 )
850 
851  return 0;
852 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:197
SCH_ITEM * Next() const
Definition: sch_item.h:153
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:130
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
EE_SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates 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: base_struct.h:623
void MarkConnections(SCH_LINE *aSegment)
Add all wires and junctions connected to aSegment which are not connected any component pin to aItemL...
Definition: sch_screen.cpp:305
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119
virtual unsigned int GetSize() const override
Function GetSize() Returns the number of stored items.
Definition: selection.h:98
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
SCH_BASE_FRAME * m_frame
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
void ClearDrawingState()
Clear the state flags of all the items in the screen.
Definition: sch_screen.cpp:613
EE_SELECTION m_selection
EDA_ITEM * Front() const
Definition: selection.h:182
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:152

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

Referenced by setTransitions().

◆ selectionContains()

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

Function selectionContains()

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

Definition at line 1268 of file ee_selection_tool.cpp.

1269 {
1270  const unsigned GRIP_MARGIN = 20;
1271  VECTOR2I margin = getView()->ToWorld( VECTOR2I( GRIP_MARGIN, GRIP_MARGIN ), false );
1272 
1273  // Check if the point is located within any of the currently selected items bounding boxes
1274  for( auto item : m_selection )
1275  {
1276  BOX2I itemBox = item->ViewBBox();
1277  itemBox.Inflate( margin.x, margin.y ); // Give some margin for gripping an item
1278 
1279  if( itemBox.Contains( aPoint ) )
1280  return true;
1281  }
1282 
1283  return false;
1284 }
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:475
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
bool Contains(const Vec &aPoint) const
Function Contains.
Definition: box2.h:149
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:300
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)

Function SelectionMenu() Shows a popup menu to trim the COLLECTOR passed as aEvent's parameter down to a single item.

NOTE: this routine DOES NOT modify the selection.

Definition at line 989 of file ee_selection_tool.cpp.

990 {
991  EE_COLLECTOR* collector = aEvent.Parameter<EE_COLLECTOR*>();
992 
993  if( !doSelectionMenu( collector ) )
994  collector->m_MenuCancelled = true;
995 
996  return 0;
997 }
Class EE_COLLECTOR.
Definition: ee_collectors.h:39
bool m_MenuCancelled
Definition: collector.h:71
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:427
bool doSelectionMenu(EE_COLLECTOR *aItems)
Allows 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

Function selectMultiple() Handles drawing a selection box that allows one to select many items at the same time.

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

Definition at line 650 of file ee_selection_tool.cpp.

651 {
652  bool cancelled = false; // Was the tool cancelled while it was running?
653  m_multiple = true; // Multiple selection mode is active
654  KIGFX::VIEW* view = getView();
655 
657  view->Add( &area );
658 
659  while( TOOL_EVENT* evt = Wait() )
660  {
661  if( evt->IsCancelInteractive() || evt->IsActivate() )
662  {
663  cancelled = true;
664  break;
665  }
666 
667  if( evt->IsDrag( BUT_LEFT ) )
668  {
670  ClearSelection();
671 
672  // Start drawing a selection box
673  area.SetOrigin( evt->DragOrigin() );
674  area.SetEnd( evt->Position() );
675  area.SetAdditive( m_additive );
678 
679  view->SetVisible( &area, true );
680  view->Update( &area );
681  getViewControls()->SetAutoPan( true );
682  }
683 
684  if( evt->IsMouseUp( BUT_LEFT ) )
685  {
686  getViewControls()->SetAutoPan( false );
687 
688  // End drawing the selection box
689  view->SetVisible( &area, false );
690 
691  // Mark items within the selection box as selected
692  std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
693  std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> sheetPins;
694 
695  // Filter the view items based on the selection box
696  BOX2I selectionBox = area.ViewBBox();
697  view->Query( selectionBox, selectedItems ); // Get the list of selected items
698 
699  // Sheet pins aren't in the view; add them by hand
700  for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : selectedItems )
701  {
702  SCH_SHEET* sheet = dynamic_cast<SCH_SHEET*>( pair.first );
703 
704  if( sheet )
705  {
706  int layer = pair.second;
707 
708  for( SCH_SHEET_PIN& pin : sheet->GetPins() )
709  sheetPins.emplace_back( KIGFX::VIEW::LAYER_ITEM_PAIR( &pin, layer ) );
710  }
711  }
712 
713  selectedItems.insert( selectedItems.end(), sheetPins.begin(), sheetPins.end() );
714 
715  int width = area.GetEnd().x - area.GetOrigin().x;
716  int height = area.GetEnd().y - area.GetOrigin().y;
717 
718  /* Selection mode depends on direction of drag-selection:
719  * Left > Right : Select objects that are fully enclosed by selection
720  * Right > Left : Select objects that are crossed by selection
721  */
722  bool windowSelection = width >= 0;
723  bool anyAdded = false;
724  bool anySubtracted = false;
725 
726  if( view->IsMirroredX() )
727  windowSelection = !windowSelection;
728 
729  // Construct an EDA_RECT to determine EDA_ITEM selection
730  EDA_RECT selectionRect( (wxPoint) area.GetOrigin(), wxSize( width, height ) );
731 
732  selectionRect.Normalize();
733 
734  for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : selectedItems )
735  {
736  EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( pair.first );
737 
738  if( item && Selectable( item ) && item->HitTest( selectionRect, windowSelection ) )
739  {
740  if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
741  {
742  unselect( item );
743  anySubtracted = true;
744  }
745  else
746  {
747  select( item );
748  item->SetFlags( STARTPOINT | ENDPOINT );
749  anyAdded = true;
750  }
751  }
752  }
753 
754  m_selection.SetIsHover( false );
755 
756  // Inform other potentially interested tools
757  if( anyAdded )
759 
760  if( anySubtracted )
762 
763  break; // Stop waiting for events
764  }
765  }
766 
767  getViewControls()->SetAutoPan( false );
768 
769  // Stop drawing the selection box
770  view->Remove( &area );
771  m_multiple = false; // Multiple selection mode is inactive
772 
773  if( !cancelled )
775 
776  return cancelled;
777 }
void ClearReferencePoint()
Definition: selection.h:248
static const TOOL_EVENT SelectedEvent
Definition: actions.h:197
void SetEnd(VECTOR2I aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:335
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
bool IsSelected() const
Definition: base_struct.h:233
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:198
void SetOrigin(VECTOR2I aOrigin)
Set the origin of the rectange (the fixed corner)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
void SetExclusiveOr(bool aExclusiveOr)
bool Selectable(const EDA_ITEM *aItem, bool checkVisibilityOnly=false) const
Function Selectable() Checks conditions for an item to be selected.
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
void SetIsHover(bool aIsHover)
Definition: selection.h:64
void SetAdditive(bool aAdditive)
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
Definition: base_struct.h:340
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:265
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
Class TOOL_EVENT.
Definition: tool_event.h:168
const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:75
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns 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:209
bool IsMirroredX() const
Function IsMirroredX() Returns true if view is flipped across the X axis.
Definition: view.h:230
void SetSubtractive(bool aSubtractive)
void Normalize()
Function Normalize ensures that the height ant width are positive.
void unselect(EDA_ITEM *aItem)
Function unselect() Takes necessary action mark an item as unselected.
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
Definition: view.h:66
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1486
Class SELECTION_AREA.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
virtual int Query(const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
Function Query() Finds all visible items that touch or are within the rectangle aRect.
Definition: view.cpp:452
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
Class VIEW.
Definition: view.h:61
EE_SELECTION m_selection
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125

References KIGFX::VIEW::Add(), BUT_LEFT, SELECTION::ClearReferencePoint(), ClearSelection(), ENDPOINT, KIGFX::PREVIEW::SELECTION_AREA::GetEnd(), KIGFX::PREVIEW::SELECTION_AREA::GetOrigin(), SCH_SHEET::GetPins(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), EDA_ITEM::HitTest(), KIGFX::VIEW::IsMirroredX(), EDA_ITEM::IsSelected(), m_additive, m_exclusive_or, m_multiple, m_selection, m_subtractive, TOOL_BASE::m_toolMgr, EDA_RECT::Normalize(), TOOL_MANAGER::ProcessEvent(), KIGFX::VIEW::Query(), KIGFX::VIEW::Remove(), select(), Selectable(), EVENTS::SelectedEvent, KIGFX::PREVIEW::SELECTION_AREA::SetAdditive(), KIGFX::VIEW_CONTROLS::SetAutoPan(), 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)

Select node under cursor

Definition at line 817 of file ee_selection_tool.cpp.

818 {
819  VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
820 
821  SelectPoint( cursorPos, nodeTypes );
822 
823  return 0;
824 }
int Modifier(int aMask=MD_MODIFIER_MASK) const
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:334
static KICAD_T nodeTypes[]
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
EDA_ITEM * SelectPoint(const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, bool *aSelectionCancelledFlag=NULL, bool aCheckLocked=false, bool aAdd=false, bool aSubtract=false, bool aExclusiveOr=false)
Function selectPoint() Selects an item pointed by the parameter aWhere.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

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

Referenced by setTransitions().

◆ SelectPoint()

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

Function selectPoint() Selects an item pointed by the parameter aWhere.

If there is more than one item at that place, there is a menu displayed that allows one to choose the item.

Parameters
aWhereis the place where the item should be selected.
aSelectionCancelledFlagallows the function to inform its caller that a selection was cancelled (for instance, by clicking outside of the disambiguation menu).
aCheckLockedindicates if locked items should be excluded

Definition at line 418 of file ee_selection_tool.cpp.

421 {
422  EDA_ITEM* start;
423  EE_COLLECTOR collector;
424 
425  if( m_isLibEdit )
426  start = static_cast<LIB_EDIT_FRAME*>( m_frame )->GetCurPart();
427  else
428  start = m_frame->GetScreen()->GetDrawItems();
429 
430  // Empty schematics have no draw items
431  if( !start )
432  return nullptr;
433 
434  collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
435  collector.Collect( start, aFilterList, (wxPoint) aWhere, m_unit, m_convert );
436 
437  // Post-process collected items
438  for( int i = collector.GetCount() - 1; i >= 0; --i )
439  {
440  if( !Selectable( collector[ i ] ) )
441  {
442  collector.Remove( i );
443  continue;
444  }
445 
446  if( aCheckLocked && collector[ i ]->IsLocked() )
447  {
448  collector.Remove( i );
449  continue;
450  }
451 
452  // SelectPoint, unlike other selection routines, can select line ends
453  if( collector[ i ]->Type() == SCH_LINE_T )
454  {
455  SCH_LINE* line = (SCH_LINE*) collector[ i ];
456  line->ClearFlags( STARTPOINT | ENDPOINT );
457 
458  if( HitTestPoints( line->GetStartPoint(), (wxPoint) aWhere, collector.m_Threshold ) )
459  line->SetFlags( STARTPOINT );
460  else if (HitTestPoints( line->GetEndPoint(), (wxPoint) aWhere, collector.m_Threshold ) )
461  line->SetFlags( ENDPOINT );
462  else
463  line->SetFlags( STARTPOINT | ENDPOINT );
464  }
465  }
466 
468 
469  // Apply some ugly heuristics to avoid disambiguation menus whenever possible
470  if( collector.GetCount() > 1 && !m_skip_heuristics )
471  {
472  GuessSelectionCandidates( collector, aWhere );
473  }
474 
475  // If still more than one item we're going to have to ask the user.
476  if( collector.GetCount() > 1 )
477  {
478  collector.m_MenuTitle = _( "Clarify Selection" );
479  // Must call selectionMenu via RunAction() to avoid event-loop contention
480  m_toolMgr->RunAction( EE_ACTIONS::selectionMenu, true, &collector );
481 
482  if( collector.m_MenuCancelled )
483  {
484  if( aSelectionCancelledFlag )
485  *aSelectionCancelledFlag = true;
486 
487  return nullptr;
488  }
489  }
490 
491  if( !aAdd && !aSubtract && !aExclusiveOr )
492  ClearSelection();
493 
494  if( collector.GetCount() == 1 )
495  {
496  EDA_ITEM* item = collector[ 0 ];
497 
498  if( aSubtract || ( aExclusiveOr && item->IsSelected() ) )
499  {
500  unselect( item );
502  return nullptr;
503  }
504  else
505  {
506  select( item );
508  return item;
509  }
510  }
511 
512  return nullptr;
513 }
void ClearReferencePoint()
Definition: selection.h:248
static const TOOL_EVENT SelectedEvent
Definition: actions.h:197
int m_Threshold
Definition: collector.h:68
wxPoint GetStartPoint() const
Definition: sch_line.h:95
bool IsSelected() const
Definition: base_struct.h:233
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:198
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
#define HITTEST_THRESHOLD_PIXELS
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
Class EE_COLLECTOR.
Definition: ee_collectors.h:39
bool Selectable(const EDA_ITEM *aItem, bool checkVisibilityOnly=false) const
Function Selectable() Checks conditions for an item to be selected.
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
void Remove(int aIndex)
Function Remove removes the item at aIndex (first position is 0);.
Definition: collector.h:142
void GuessSelectionCandidates(EE_COLLECTOR &collector, const VECTOR2I &aPos)
Apply heuristics to try and determine a single object when multiple are found under the cursor.
bool m_MenuCancelled
Definition: collector.h:71
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:113
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:265
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
void Collect(EDA_ITEM *aItem, const KICAD_T aFilterList[], const wxPoint &aPos, int aUnit=0, int aConvert=0)
Function Collect scans a EDA_ITEM using this class's Inspector method, which does the collection.
#define _(s)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
wxString m_MenuTitle
Definition: collector.h:70
void unselect(EDA_ITEM *aItem)
Function unselect() Takes necessary action mark an item as unselected.
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:37
SCH_BASE_FRAME * m_frame
bool HitTestPoints(const wxPoint &pointA, const wxPoint &pointB, double threshold)
Test, if two points are near each other.
Definition: trigo.h:161
static TOOL_ACTION selectionMenu
Runs a selection menu to select from a list of items.
Definition: ee_actions.h:69
size_t i
Definition: json11.cpp:597
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:266
EE_SELECTION m_selection
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:114
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:152
wxPoint GetEndPoint() const
Definition: sch_line.h:98

References _, EDA_ITEM::ClearFlags(), SELECTION::ClearReferencePoint(), ClearSelection(), EE_COLLECTOR::Collect(), ENDPOINT, COLLECTOR::GetCount(), SCH_SCREEN::GetDrawItems(), SCH_LINE::GetEndPoint(), SCH_BASE_FRAME::GetScreen(), SCH_LINE::GetStartPoint(), TOOL_BASE::getView(), GuessSelectionCandidates(), HITTEST_THRESHOLD_PIXELS, HitTestPoints(), i, EDA_ITEM::IsSelected(), KiROUND(), m_convert, m_frame, m_isLibEdit, COLLECTOR::m_MenuCancelled, COLLECTOR::m_MenuTitle, m_selection, m_skip_heuristics, COLLECTOR::m_Threshold, TOOL_BASE::m_toolMgr, m_unit, TOOL_MANAGER::ProcessEvent(), COLLECTOR::Remove(), TOOL_MANAGER::RunAction(), SCH_LINE_T, select(), Selectable(), EVENTS::SelectedEvent, EE_ACTIONS::selectionMenu, EDA_ITEM::SetFlags(), STARTPOINT, unselect(), and EVENTS::UnselectedEvent.

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

◆ SetContextMenu()

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

Function SetContextMenu()

Assigns 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:219
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour 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(), SELECTION_TOOL::doSelectionMenu(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void EE_SELECTION_TOOL::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 1287 of file ee_selection_tool.cpp.

1288 {
1290 
1295 
1301 }
int UpdateMenu(const TOOL_EVENT &aEvent)
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
Definition: ee_actions.h:65
static TOOL_ACTION selectConnection
If current selection is a wire or bus, expand to entire connection.
Definition: ee_actions.h:55
int AddItemsToSel(const TOOL_EVENT &aEvent)
static TOOL_ACTION removeItemsFromSel
Definition: ee_actions.h:66
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION removeItemFromSel
Definition: ee_actions.h:62
int SelectNode(const TOOL_EVENT &aEvent)
Select node under cursor
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: ee_actions.h:61
int SelectConnection(const TOOL_EVENT &aEvent)
If node selected then expand to connection, otherwise select connection under cursor
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: ee_actions.h:48
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:58
static TOOL_ACTION updateMenu
Definition: actions.h:158
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
int AddItemToSel(const TOOL_EVENT &aEvent)
int SelectionMenu(const TOOL_EVENT &aEvent)
Function SelectionMenu() Shows a popup menu to trim the COLLECTOR passed as aEvent's parameter down t...
static TOOL_ACTION selectionMenu
Runs a selection menu to select from a list of items.
Definition: ee_actions.h:69
static TOOL_ACTION selectNode
Select the junction, wire or bus segment under the cursor.
Definition: ee_actions.h:51
int RemoveItemsFromSel(const TOOL_EVENT &aEvent)
int Main(const TOOL_EVENT &aEvent)
Function Main()

References EE_ACTIONS::addItemsToSel, AddItemsToSel(), EE_ACTIONS::addItemToSel, AddItemToSel(), EE_ACTIONS::clearSelection, ClearSelection(), TOOL_INTERACTIVE::Go(), Main(), EE_ACTIONS::removeItemFromSel, RemoveItemFromSel(), EE_ACTIONS::removeItemsFromSel, RemoveItemsFromSel(), 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 947 of file ee_selection_tool.cpp.

948 {
949  unhighlight( aItem, BRIGHTENED );
950 }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Function unhighlight() Unhighlights the item visually.

References BRIGHTENED, and unhighlight().

Referenced by LIB_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

Function unhighlight() Unhighlights 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 1211 of file ee_selection_tool.cpp.

1212 {
1213  KICAD_T itemType = aItem->Type();
1214 
1215  if( aMode == SELECTED )
1216  aItem->ClearSelected();
1217  else if( aMode == BRIGHTENED )
1218  aItem->ClearBrightened();
1219 
1220  if( aGroup )
1221  aGroup->Remove( aItem );
1222 
1223  // Unhighlight pins and fields. (All the other component children are currently only
1224  // represented in the LIB_PART.)
1225  if( itemType == SCH_COMPONENT_T )
1226  {
1227  SCH_PINS& pins = static_cast<SCH_COMPONENT*>( aItem )->GetPins();
1228 
1229  for( SCH_PIN& pin : pins )
1230  {
1231  if( aMode == SELECTED )
1232  pin.ClearSelected();
1233  else if( aMode == BRIGHTENED )
1234  pin.ClearBrightened();
1235  }
1236 
1237  std::vector<SCH_FIELD*> fields;
1238  static_cast<SCH_COMPONENT*>( aItem )->GetFields( fields, false );
1239 
1240  for( SCH_FIELD* field : fields )
1241  {
1242  if( aMode == SELECTED )
1243  field->ClearSelected();
1244  else if( aMode == BRIGHTENED )
1245  field->ClearBrightened();
1246  }
1247  }
1248  else if( itemType == SCH_SHEET_T )
1249  {
1250  SCH_SHEET_PINS& pins = static_cast<SCH_SHEET*>( aItem )->GetPins();
1251 
1252  for( SCH_SHEET_PIN& pin : pins )
1253  {
1254  if( aMode == SELECTED )
1255  pin.ClearSelected();
1256  else if( aMode == BRIGHTENED )
1257  pin.ClearBrightened();
1258  }
1259  }
1260 
1261  if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
1262  getView()->Update( aItem->GetParent() );
1263  else
1264  getView()->Update( aItem );
1265 }
Class SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
std::vector< SCH_PIN > SCH_PINS
A container for several SCH_PIN items.
Definition: sch_component.h:51
void ClearSelected()
Definition: base_struct.h:243
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
void ClearBrightened()
Definition: base_struct.h:245
#define SELECTED
Definition: base_struct.h:127
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
EDA_ITEM * GetParent() const
Definition: base_struct.h:220
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:75
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
boost::ptr_vector< SCH_SHEET_PIN > SCH_SHEET_PINS
Definition: sch_sheet.h:203
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.h:85

References BRIGHTENED, EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearSelected(), EDA_ITEM::GetParent(), TOOL_BASE::getView(), SELECTION::Remove(), SCH_COMPONENT_T, SCH_FIELD_T, SCH_PIN_T, SCH_SHEET_PIN_T, SCH_SHEET_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

Function unselect() Takes necessary action mark an item as unselected.

Parameters
aItemis an item to be unselected.

Definition at line 1148 of file ee_selection_tool.cpp.

1149 {
1150  unhighlight( aItem, SELECTED, &m_selection );
1151 }
#define SELECTED
Definition: base_struct.h:127
EE_SELECTION m_selection
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, EE_SELECTION *aGroup=nullptr)
Function unhighlight() Unhighlights 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 250 of file ee_selection_tool.cpp.

251 {
252  ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
253  CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
254 
255  if( conditionalMenu )
256  conditionalMenu->Evaluate( m_selection );
257 
258  if( actionMenu )
259  actionMenu->UpdateAll();
260 
261  return 0;
262 }
Class ACTION_MENU.
Definition: action_menu.h:43
void UpdateAll()
Function UpdateAll() Runs update handlers for the menu and its submenus.
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:427
EE_SELECTION m_selection

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

Referenced by setTransitions().

◆ updateReferencePoint()

void EE_SELECTION_TOOL::updateReferencePoint ( )
private

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

Definition at line 634 of file ee_selection_tool.cpp.

635 {
636  VECTOR2I refP( 0, 0 );
637 
638  if( m_selection.Size() > 0 )
639  {
640  if( m_isLibEdit )
641  refP = static_cast<LIB_ITEM*>( m_selection.GetTopLeftItem() )->GetPosition();
642  else
643  refP = static_cast<SCH_ITEM*>( m_selection.GetTopLeftItem() )->GetPosition();
644  }
645 
647 }
void SetReferencePoint(const VECTOR2I &aP)
Definition: selection.h:243
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
EE_SELECTION m_selection

References EE_SELECTION::GetTopLeftItem(), m_isLibEdit, 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

Function Wait()

Suspends 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:219
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pauses 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(), PL_SELECTION_TOOL::doSelectionMenu(), doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), PL_SELECTION_TOOL::selectMultiple(), selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_additive

bool EE_SELECTION_TOOL::m_additive
private

Definition at line 233 of file ee_selection_tool.h.

Referenced by Main(), and selectMultiple().

◆ m_convert

int EE_SELECTION_TOOL::m_convert
private

Definition at line 242 of file ee_selection_tool.h.

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

◆ m_exclusive_or

bool EE_SELECTION_TOOL::m_exclusive_or
private

Definition at line 235 of file ee_selection_tool.h.

Referenced by Main(), and selectMultiple().

◆ m_frame

SCH_BASE_FRAME* EE_SELECTION_TOOL::m_frame
private

◆ m_isLibEdit

bool EE_SELECTION_TOOL::m_isLibEdit
private

Definition at line 239 of file ee_selection_tool.h.

Referenced by Init(), RebuildSelection(), Reset(), SelectPoint(), and updateReferencePoint().

◆ m_isLibView

bool EE_SELECTION_TOOL::m_isLibView
private

Definition at line 240 of file ee_selection_tool.h.

Referenced by Init(), and Reset().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 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(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), LIB_DRAWING_TOOLS::Init(), MODULE_EDITOR_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), PL_SELECTION_TOOL::Init(), Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), EDIT_TOOL::Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::Main(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), Main(), SELECTION_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_multiple

bool EE_SELECTION_TOOL::m_multiple
private

Definition at line 236 of file ee_selection_tool.h.

Referenced by selectMultiple().

◆ m_selection

◆ m_skip_heuristics

bool EE_SELECTION_TOOL::m_skip_heuristics
private

Definition at line 237 of file ee_selection_tool.h.

Referenced by Main(), and SelectPoint().

◆ m_subtractive

bool EE_SELECTION_TOOL::m_subtractive
private

Definition at line 234 of file ee_selection_tool.h.

Referenced by Main(), and selectMultiple().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

Definition at line 214 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 219 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), AddItemToSel(), SELECTION_TOOL::AddItemToSel(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), SELECTION_TOOL::ClearSelection(), PL_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::editComponentFieldText(), EDIT_TOOL::EditFpInFpEditor(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), POINT_EDITOR::finishItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::getEditFrameInt(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_INSPECTION_TOOL::HighlightItem(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), MODULE_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), LIB_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), PAD_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PL_POINT_EDITOR::Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCBNEW_CONTROL::Print(), GERBVIEW_CONTROL::Print(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), RebuildSelection(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PL_SELECTION_TOOL::RemoveItemFromSel(), RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), RequestSelection(), SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC::RunTests(), SelectConnection(), SELECTION_TOOL::selectCopper(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), SelectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), LIB_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GERBVIEW_SELECTION_TOOL::UnselectItem(), SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_toolSettings

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 220 of file tool_base.h.

Referenced by TOOL_BASE::attachManager(), and TOOL_BASE::GetSettings().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 211 of file tool_base.h.

Referenced by TOOL_BASE::GetType().

◆ m_unit

int EE_SELECTION_TOOL::m_unit
private

Definition at line 241 of file ee_selection_tool.h.

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


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