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...
 
SELECTIONGetSelection ()
 Function GetSelection() More...
 
TOOL_MENUGetToolMenu ()
 
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)
 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)
 
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...
 
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...
 
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...
 
OPT_TOOL_EVENT Wait (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

const TOOL_EVENT evActivate (std::string aToolName="")
 functions below are not yet implemented - their interface may change More...
 
const TOOL_EVENT evCommand (int aCommandId=-1)
 
const TOOL_EVENT evCommand (std::string aCommandStr="")
 
const TOOL_EVENT evMotion ()
 
const TOOL_EVENT evClick (int aButton=BUT_ANY)
 
const TOOL_EVENT evDrag (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonUp (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonDown (int aButton=BUT_ANY)
 
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_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...
 
void guessSelectionCandidates (EE_COLLECTOR &collector, const VECTOR2I &aWhere)
 Apply heuristics to try and determine a single object when multiple are found under the cursor. More...
 
bool doSelectionMenu (EE_COLLECTOR *aItems)
 Allows the selection of a single item from a list via pop-up menu. More...
 
void clearSelection ()
 Function clearSelection() Clears the current selection. More...
 
void toggleSelection (EDA_ITEM *aItem, bool aForce=false)
 Function toggleSelection() Changes selection status of a given item. More...
 
bool selectable (const EDA_ITEM *aItem, bool checkVisibilityOnly=false) const
 Function selectable() Checks conditions for an item to be selected. 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, SELECTION *aGroup=nullptr)
 Function highlight() Highlights the item visually. More...
 
void unhighlight (EDA_ITEM *aItem, int aHighlightMode, SELECTION *aGroup=nullptr)
 Function unhighlight() Unhighlights the item visually. More...
 
bool selectionContains (const VECTOR2I &aPoint) const
 Function selectionContains() Checks if the given point is placed within any of selected items' bounding box. More...
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 

Private Attributes

SCH_BASE_FRAMEm_frame
 
SELECTION m_selection
 
bool m_additive
 
bool m_subtractive
 
bool m_multiple
 
bool m_skip_heuristics
 
bool m_isLibEdit
 
int m_unit
 
int m_convert
 
TOOL_MENU m_menu
 

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

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

Constructor & Destructor Documentation

◆ EE_SELECTION_TOOL()

EE_SELECTION_TOOL::EE_SELECTION_TOOL ( )

Definition at line 157 of file ee_selection_tool.cpp.

157  :
158  TOOL_INTERACTIVE( "eeschema.InteractiveSelection" ),
159  m_frame( nullptr ),
160  m_additive( false ),
161  m_subtractive( false ),
162  m_multiple( false ),
163  m_skip_heuristics( false ),
164  m_isLibEdit( false ),
165  m_unit( 0 ),
166  m_convert( 0 ),
167  m_menu( *this )
168 {
169 }
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 172 of file ee_selection_tool.cpp.

173 {
174  getView()->Remove( &m_selection );
175 }
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:35

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 49 of file tool_interactive.cpp.

50 {
52 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:211
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(), LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), EDIT_TOOL::doCopyToClipboard(), SCH_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_DRAWING_TOOLS::doPlaceComponent(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EDIT_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), SCH_WIRE_BUS_TOOL::StartBus(), SCH_WIRE_BUS_TOOL::StartWire(), and SCH_WIRE_BUS_TOOL::UnfoldBus().

◆ AddItemsToSel() [1/2]

int EE_SELECTION_TOOL::AddItemsToSel ( const TOOL_EVENT aEvent)

Definition at line 740 of file ee_selection_tool.cpp.

741 {
742  AddItemsToSel( aEvent.Parameter<EDA_ITEMS*>(), false );
743  return 0;
744 }
int AddItemsToSel(const TOOL_EVENT &aEvent)
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: base_struct.h:588
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378

References TOOL_EVENT::Parameter().

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

748 {
749  if( aList )
750  {
751  for( EDA_ITEM* item : *aList )
752  select( item );
753 
754  // Inform other potentially interested tools
755  if( !aQuietMode )
757  }
758 }
static const TOOL_EVENT SelectedEvent
Event sent after an item is selected.
Definition: actions.h:132
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
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:157

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

◆ AddItemToSel() [1/2]

int EE_SELECTION_TOOL::AddItemToSel ( const TOOL_EVENT aEvent)

Definition at line 720 of file ee_selection_tool.cpp.

721 {
722  AddItemToSel( aEvent.Parameter<EDA_ITEM*>() );
723  return 0;
724 }
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378
int AddItemToSel(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:157

References TOOL_EVENT::Parameter().

Referenced by SCH_WIRE_BUS_TOOL::doDrawSegments(), SCH_DRAWING_TOOLS::doPlaceComponent(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_MOVE_TOOL::Main(), SCH_DRAWING_TOOLS::PlaceImage(), SCH_EDIT_TOOL::RepeatDrawItem(), setTransitions(), and SCH_WIRE_BUS_TOOL::startSegments().

◆ AddItemToSel() [2/2]

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

Definition at line 727 of file ee_selection_tool.cpp.

728 {
729  if( aItem )
730  {
731  select( aItem );
732 
733  // Inform other potentially interested tools
734  if( !aQuietMode )
736  }
737 }
static const TOOL_EVENT SelectedEvent
Event sent after an item is selected.
Definition: actions.h:132
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
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 59 of file tool_base.cpp.

60 {
61  m_toolMgr = aManager;
62  m_toolSettings = TOOL_SETTINGS( this );
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:217
friend class TOOL_SETTINGS
Definition: tool_base.h:155

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

Referenced by TOOL_MANAGER::RegisterTool().

◆ ClearSelection()

int EE_SELECTION_TOOL::ClearSelection ( const TOOL_EVENT aEvent)

Clear current selection event handler.

Definition at line 802 of file ee_selection_tool.cpp.

803 {
804  clearSelection();
805 
806  return 0;
807 }
void clearSelection()
Function clearSelection() Clears the current selection.

References clearSelection().

Referenced by setTransitions().

◆ clearSelection()

void EE_SELECTION_TOOL::clearSelection ( )
private

Function clearSelection() Clears the current selection.

Definition at line 970 of file ee_selection_tool.cpp.

971 {
972  if( m_selection.Empty() )
973  return;
974 
975  while( m_selection.GetSize() )
977 
978  getView()->Update( &m_selection );
979 
980  m_selection.SetIsHover( false );
982 
983  // Inform other potentially interested tools
985 }
void ClearReferencePoint()
Definition: selection.h:213
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
void SetIsHover(bool aIsHover)
Definition: selection.h:64
#define SELECTED
Definition: base_struct.h:121
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
static const TOOL_EVENT ClearedEvent
Event sent after selection is cleared.
Definition: actions.h:134
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, SELECTION *aGroup=nullptr)
Function unhighlight() Unhighlights the item visually.
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:1539
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
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:157
EDA_ITEM * Front() const
Definition: selection.h:155

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(), SelectPoint(), and toggleSelection().

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

845 {
846  EDA_ITEM* current = nullptr;
847  ACTION_MENU menu;
848 
849  int limit = std::min( MAX_SELECT_ITEM_IDS, aCollector->GetCount() );
850 
851  for( int i = 0; i < limit; ++i )
852  {
853  wxString text;
854  EDA_ITEM* item = ( *aCollector )[i];
855  text = item->GetSelectMenuText( m_frame->GetUserUnits() );
856 
857  wxString menuText = wxString::Format("&%d. %s", i + 1, text );
858  menu.Add( menuText, i + 1, item->GetMenuImage() );
859  }
860 
861  if( aCollector->m_MenuTitle.Length() )
862  menu.SetTitle( aCollector->m_MenuTitle );
863 
864  menu.SetIcon( info_xpm );
865  menu.DisplayTitle( true );
866  SetContextMenu( &menu, CMENU_NOW );
867 
868  while( OPT_TOOL_EVENT evt = Wait() )
869  {
870  if( evt->Action() == TA_CONTEXT_MENU_UPDATE )
871  {
872  if( current )
873  unhighlight( current, BRIGHTENED );
874 
875  int id = *evt->GetCommandId();
876 
877  // User has pointed an item, so show it in a different way
878  if( id > 0 && id <= limit )
879  {
880  current = ( *aCollector )[id - 1];
881  highlight( current, BRIGHTENED );
882  }
883  else
884  {
885  current = NULL;
886  }
887  }
888  else if( evt->Action() == TA_CONTEXT_MENU_CHOICE )
889  {
890  if( current )
891  unhighlight( current, BRIGHTENED );
892 
893  OPT<int> id = evt->GetCommandId();
894 
895  // User has selected an item, so this one will be returned
896  if( id && ( *id > 0 ) )
897  current = ( *aCollector )[*id - 1];
898  else
899  current = NULL;
900 
901  break;
902  }
903 
904  getView()->UpdateItems();
905  m_frame->GetCanvas()->Refresh();
906  }
907 
908  if( current )
909  {
910  unhighlight( current, BRIGHTENED );
911 
912  getView()->UpdateItems();
913  m_frame->GetCanvas()->Refresh();
914 
915  aCollector->Empty();
916  aCollector->Append( current );
917  return true;
918  }
919 
920  return false;
921 }
#define MAX_SELECT_ITEM_IDS
The maximum number of items in the clarify selection context menu.
Definition: eeschema_id.h:37
void highlight(EDA_ITEM *aItem, int aHighlightMode, SELECTION *aGroup=nullptr)
Function highlight() Highlights the item visually.
Class ACTION_MENU.
Definition: action_menu.h:43
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
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 SetContextMenu(ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Function SetContextMenu()
EDA_UNITS_T GetUserUnits() const override
Return the user units currently in use.
Definition: draw_frame.h:289
SCH_DRAW_PANEL * GetCanvas() const override
void SetIcon(const BITMAP_OPAQUE *aIcon)
Function SetIcon() Assigns an icon for the entry.
Definition: action_menu.cpp:82
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:137
void UpdateItems()
Function UpdateItems() Iterates through the list of items that asked for updating and updates them.
Definition: view.cpp:1420
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, SELECTION *aGroup=nullptr)
Function unhighlight() Unhighlights the item visually.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
void SetTitle(const wxString &aTitle) override
Function SetTitle() Sets title for the menu.
Definition: action_menu.cpp:96
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
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:157
boost::optional< T > OPT
Definition: optional.h:7
wxMenuItem * Add(const wxString &aLabel, int aId, const BITMAP_OPAQUE *aIcon=NULL)
Function Add() Adds an entry to the menu.
virtual BITMAP_DEF GetMenuImage() const
Function GetMenuImage returns a pointer to an image to be used in menus.
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:486
#define min(a, b)
Definition: auxiliary.h:85
void DisplayTitle(bool aDisplay=true)
Function DisplayTitle() Decides whether a title for a pop up menu should be displayed.

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_DRAW_FRAME::GetUserUnits(), TOOL_BASE::getView(), highlight(), i, m_frame, EE_COLLECTOR::m_MenuTitle, MAX_SELECT_ITEM_IDS, min, SCH_DRAW_PANEL::Refresh(), TOOL_INTERACTIVE::SetContextMenu(), ACTION_MENU::SetIcon(), ACTION_MENU::SetTitle(), TA_CONTEXT_MENU_CHOICE, TA_CONTEXT_MENU_UPDATE, unhighlight(), KIGFX::VIEW::UpdateItems(), and TOOL_INTERACTIVE::Wait().

Referenced by SelectionMenu().

◆ evActivate()

const TOOL_EVENT TOOL_INTERACTIVE::evActivate ( std::string  aToolName = "")
protectedinherited

functions below are not yet implemented - their interface may change

◆ evButtonDown()

const TOOL_EVENT TOOL_INTERACTIVE::evButtonDown ( int  aButton = BUT_ANY)
protectedinherited

◆ evButtonUp()

const TOOL_EVENT TOOL_INTERACTIVE::evButtonUp ( int  aButton = BUT_ANY)
protectedinherited

◆ evClick()

const TOOL_EVENT TOOL_INTERACTIVE::evClick ( int  aButton = BUT_ANY)
protectedinherited

◆ evCommand() [1/2]

const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( int  aCommandId = -1)
protectedinherited

◆ evCommand() [2/2]

const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( std::string  aCommandStr = "")
protectedinherited

◆ evDrag()

const TOOL_EVENT TOOL_INTERACTIVE::evDrag ( int  aButton = BUT_ANY)
protectedinherited

◆ evMotion()

const TOOL_EVENT TOOL_INTERACTIVE::evMotion ( )
protectedinherited

◆ 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 188 of file tool_base.h.

189  {
190  return static_cast<T*>( getEditFrameInt() );
191  }
wxWindow * getEditFrameInt() const
Definition: tool_base.cpp:47

References TOOL_BASE::getEditFrameInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), 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 122 of file tool_base.h.

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

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

145  {
146  return m_toolMgr;
147  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), 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 199 of file tool_base.h.

200  {
201  EDA_ITEM* m = getModelInt();
202  wxASSERT( dynamic_cast<T*>( m ) );
203 
204  return static_cast<T*>( m );
205  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:53
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157

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

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

References TOOL_BASE::m_toolName.

Referenced by 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 672 of file ee_selection_tool.cpp.

673 {
674  EE_COLLECTOR collector;
675 
676  collector.Collect( m_frame->GetScreen()->GetDrawItems(), nodeTypes, (wxPoint) aPosition );
677 
678  return collector.GetCount() ? collector[ 0 ] : nullptr;
679 }
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
Class EE_COLLECTOR.
Definition: ee_collectors.h:38
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:114
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.
static KICAD_T nodeTypes[]
SCH_BASE_FRAME * m_frame
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:153

References EE_COLLECTOR::Collect(), COLLECTOR::GetCount(), SCH_SCREEN::GetDrawItems(), SCH_BASE_FRAME::GetScreen(), m_frame, and nodeTypes.

◆ GetSelection()

◆ GetSettings()

TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 77 of file tool_base.cpp.

78 {
79  return m_toolSettings;
80 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:217

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

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

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 35 of file tool_base.cpp.

36 {
37  return m_toolMgr->GetView();
38 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:252
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216

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(), clearSelection(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), COMMON_TOOLS::CursorControl(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), COMMON_TOOLS::doGridPreset(), doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findCallback(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::guessSelectionCandidates(), highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), EE_POINT_EDITOR::Main(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), 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(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::selectable(), GERBVIEW_SELECTION_TOOL::selectionContains(), selectionContains(), SELECTION_TOOL::selectionContains(), GERBVIEW_SELECTION_TOOL::selectMultiple(), selectMultiple(), SELECTION_TOOL::selectMultiple(), SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), COMMON_TOOLS::ToggleGrid(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), PCBNEW_CONTROL::updateGrid(), EE_POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_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(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), CVPCB_SELECTION_TOOL::~CVPCB_SELECTION_TOOL(), ~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 41 of file tool_base.cpp.

42 {
43  return m_toolMgr->GetViewControls();
44 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:257

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_WIRE_BUS_TOOL::doDrawSegments(), SCH_DRAWING_TOOLS::doPlaceComponent(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), COMMON_TOOLS::doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findMove(), SCH_WIRE_BUS_TOOL::finishSegments(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNetCursor(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EE_PICKER_TOOL::Main(), PICKER_TOOL::Main(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EDIT_TOOL::Main(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceImage(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::RepeatDrawItem(), RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), CVPCB_CONTROL::ResetCoords(), GERBVIEW_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), GERBVIEW_SELECTION_TOOL::selectMultiple(), selectMultiple(), SELECTION_TOOL::selectMultiple(), SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), EE_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), SCH_MOVE_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 135 of file tool_interactive.h.

137 {
138  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
139 
140  goInternal( sptr, aConditions );
141 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:59
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), EE_POINT_EDITOR::setTransitions(), LIB_CONTROL::setTransitions(), LIB_PIN_TOOL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), LIB_MOVE_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), CVPCB_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), MODULE_EDITOR_TOOLS::setTransitions(), SCH_WIRE_BUS_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), EE_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), SELECTION_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), and setTransitions().

◆ guessSelectionCandidates()

void EE_SELECTION_TOOL::guessSelectionCandidates ( EE_COLLECTOR collector,
const VECTOR2I aWhere 
)
private

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

Definition at line 506 of file ee_selection_tool.cpp.

507 {
508  // There are certain parent/child and enclosure combinations that can be handled
509  // automatically. Since schematics are meant to be human-readable we don't have
510  // all the various overlap and coverage issues that we do in Pcbnew.
511  if( collector.GetCount() == 2 )
512  {
513  EDA_ITEM* a = collector[ 0 ];
514  EDA_ITEM* b = collector[ 1 ];
515 
516  if( a->GetParent() == b )
517  collector.Remove( b );
518  else if( a == b->GetParent() )
519  collector.Remove( a );
520  else if( a->Type() == SCH_SHEET_T && b->Type() != SCH_SHEET_T )
521  collector.Remove( a );
522  else if( b->Type() == SCH_SHEET_T && a->Type() != SCH_SHEET_T )
523  collector.Remove( b );
524  }
525 }
void Remove(int aIndex)
Function Remove removes the item at aIndex (first position is 0);.
Definition: collector.h:143
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:114
EDA_ITEM * GetParent() const
Definition: base_struct.h:214
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

References COLLECTOR::GetCount(), EDA_ITEM::GetParent(), COLLECTOR::Remove(), SCH_SHEET_T, and EDA_ITEM::Type().

Referenced by SelectPoint().

◆ highlight()

void EE_SELECTION_TOOL::highlight ( EDA_ITEM aItem,
int  aHighlightMode,
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 1029 of file ee_selection_tool.cpp.

1030 {
1031  if( aMode == SELECTED )
1032  aItem->SetSelected();
1033  else if( aMode == BRIGHTENED )
1034  aItem->SetBrightened();
1035 
1036  if( aGroup )
1037  aGroup->Add( aItem );
1038 
1039  // Highlight pins and fields. (All the other component children are currently only
1040  // represented in the LIB_PART and will inherit the settings of the parent component.)
1041  if( aItem->Type() == SCH_COMPONENT_T )
1042  {
1043  SCH_PINS& pins = static_cast<SCH_COMPONENT*>( aItem )->GetPins();
1044 
1045  for( SCH_PIN& pin : pins )
1046  {
1047  if( aMode == SELECTED )
1048  pin.SetSelected();
1049  else if( aMode == BRIGHTENED )
1050  pin.SetBrightened();
1051  }
1052 
1053  std::vector<SCH_FIELD*> fields;
1054  static_cast<SCH_COMPONENT*>( aItem )->GetFields( fields, false );
1055 
1056  for( SCH_FIELD* field : fields )
1057  {
1058  if( aMode == SELECTED )
1059  field->SetSelected();
1060  else if( aMode == BRIGHTENED )
1061  field->SetBrightened();
1062  }
1063  }
1064  else if( aItem->Type() == SCH_SHEET_T )
1065  {
1066  SCH_SHEET_PINS& pins = static_cast<SCH_SHEET*>( aItem )->GetPins();
1067 
1068  for( SCH_SHEET_PIN& pin : pins )
1069  {
1070  if( aMode == SELECTED )
1071  pin.SetSelected();
1072  else if( aMode == BRIGHTENED )
1073  pin.SetBrightened();
1074  }
1075  }
1076 
1077  if( aItem->Type() == SCH_PIN_T || aItem->Type() == SCH_FIELD_T )
1078  getView()->Update( aItem->GetParent() );
1079  else
1080  getView()->Update( aItem );
1081 }
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:235
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:74
#define SELECTED
Definition: base_struct.h:121
void SetSelected()
Definition: base_struct.h:233
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:137
EDA_ITEM * GetParent() const
Definition: base_struct.h:214
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:56
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:1539
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
boost::ptr_vector< SCH_SHEET_PIN > SCH_SHEET_PINS
Definition: sch_sheet.h:195
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

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

Referenced by 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 178 of file ee_selection_tool.cpp.

179 {
180  m_frame = getEditFrame<SCH_BASE_FRAME>();
181 
182  LIB_EDIT_FRAME* libEditFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
183 
184  if( libEditFrame )
185  {
186  m_isLibEdit = true;
187  m_unit = libEditFrame->GetUnit();
188  m_convert = libEditFrame->GetConvert();
189  }
190 
191  static KICAD_T wireOrBusTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
192 
193  auto wireSelection = EE_CONDITIONS::MoreThan( 0 )
195 
196  auto busSelection = EE_CONDITIONS::MoreThan( 0 )
198 
199  auto wireOrBusSelection = EE_CONDITIONS::MoreThan( 0 )
200  && EE_CONDITIONS::OnlyTypes( wireOrBusTypes );
201 
202  auto sheetSelection = SELECTION_CONDITIONS::Count( 1 )
204 
205  auto libEdit = [this] ( const SELECTION& aSel ) {
206  return m_isLibEdit;
207  };
208 
209  auto belowRootSheetCondition = [this] ( const SELECTION& aSel ) {
210  return !m_isLibEdit && g_CurrentSheet->Last() != g_RootSheet;
211  };
212 
213  auto& menu = m_menu.GetMenu();
214 
215  menu.AddItem( EE_ACTIONS::enterSheet, sheetSelection && EE_CONDITIONS::Idle, 1 );
216  menu.AddItem( EE_ACTIONS::explicitCrossProbe, sheetSelection && EE_CONDITIONS::Idle, 1 );
217  menu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 1 );
218 
219  menu.AddSeparator( EE_CONDITIONS::Empty, 100 );
220  menu.AddItem( EE_ACTIONS::startWire, !libEdit && EE_CONDITIONS::Empty, 100 );
221  menu.AddItem( EE_ACTIONS::startBus, !libEdit && EE_CONDITIONS::Empty, 100 );
222 
223  menu.AddSeparator( SCH_WIRE_BUS_TOOL::IsDrawingWire, 100 );
225 
226  menu.AddSeparator( SCH_WIRE_BUS_TOOL::IsDrawingBus, 100 );
228 
229  menu.AddSeparator( EE_CONDITIONS::NotEmpty, 200 );
230  menu.AddItem( EE_ACTIONS::selectConnection, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
231  menu.AddItem( EE_ACTIONS::addJunction, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
232  menu.AddItem( EE_ACTIONS::addLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
233  menu.AddItem( EE_ACTIONS::addGlobalLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
234  menu.AddItem( EE_ACTIONS::addHierLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 200 );
235  menu.AddItem( EE_ACTIONS::breakWire, wireSelection && EE_CONDITIONS::Idle, 200 );
236  menu.AddItem( EE_ACTIONS::breakBus, busSelection && EE_CONDITIONS::Idle, 200 );
237  menu.AddItem( EE_ACTIONS::importSheetPin, sheetSelection && EE_CONDITIONS::Idle, 200 );
238 
239  menu.AddSeparator( libEdit && EE_CONDITIONS::Empty, 400 );
240  menu.AddItem( EE_ACTIONS::symbolProperties, libEdit && EE_CONDITIONS::Empty, 400 );
241  menu.AddItem( EE_ACTIONS::pinTable, libEdit && EE_CONDITIONS::Empty, 400 );
242 
243  menu.AddSeparator( SELECTION_CONDITIONS::ShowAlways, 1000 );
245 
246  return true;
247 }
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
static TOOL_ACTION pinTable
Definition: ee_actions.h:166
void AddStandardSubMenus(EDA_DRAW_FRAME *aFrame)
Function CreateBasicMenu.
Definition: tool_menu.cpp:83
static TOOL_ACTION addHierLabel
Definition: ee_actions.h:135
static TOOL_ACTION breakBus
Definition: ee_actions.h:143
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 selectConnection
If current selection is a wire or bus, expand to entire connection.
Definition: ee_actions.h:54
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...
static bool NotEmpty(const SELECTION &aSelection)
Function NotEmpty Tests if there are any items selected.
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:142
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:161
static SELECTION_CONDITION Empty
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
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 explicitCrossProbe
Definition: ee_actions.h:169
static TOOL_ACTION symbolProperties
Definition: ee_actions.h:165
static TOOL_ACTION addJunction
Definition: ee_actions.h:132
static TOOL_ACTION importSheetPin
Definition: ee_actions.h:94
static bool IsDrawingBus(const SELECTION &aSelection)
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 startWire
Definition: ee_actions.h:80
static TOOL_ACTION enterSheet
Definition: ee_actions.h:160
static TOOL_ACTION startBus
Definition: ee_actions.h:82
static TOOL_ACTION addLabel
Definition: ee_actions.h:133
static TOOL_ACTION addGlobalLabel
Definition: ee_actions.h:134
static TOOL_ACTION finishBus
Definition: ee_actions.h:101
static bool IsDrawingWire(const SELECTION &aSelection)
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
static TOOL_ACTION finishWire
Definition: ee_actions.h:100

References EE_ACTIONS::addGlobalLabel, EE_ACTIONS::addHierLabel, CONDITIONAL_MENU::AddItem(), EE_ACTIONS::addJunction, EE_ACTIONS::addLabel, TOOL_MENU::AddStandardSubMenus(), EE_ACTIONS::breakBus, EE_ACTIONS::breakWire, SELECTION_CONDITIONS::Count(), 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_WIRE_BUS_TOOL::IsDrawingBus(), SCH_WIRE_BUS_TOOL::IsDrawingWire(), SCH_SHEET_PATH::Last(), EE_ACTIONS::leaveSheet, m_convert, m_frame, m_isLibEdit, m_menu, m_unit, SELECTION_CONDITIONS::MoreThan(), SELECTION_CONDITIONS::NotEmpty(), SELECTION_CONDITIONS::OnlyType(), SELECTION_CONDITIONS::OnlyTypes(), EE_ACTIONS::pinTable, SCH_LINE_LOCATE_BUS_T, SCH_LINE_LOCATE_WIRE_T, SCH_SHEET_T, EE_ACTIONS::selectConnection, SELECTION_CONDITIONS::ShowAlways(), EE_ACTIONS::startBus, EE_ACTIONS::startWire, and EE_ACTIONS::symbolProperties.

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 30 of file tool_base.cpp.

31 {
32  return m_toolMgr->IsToolActive( m_toolId );
33 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:211
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 295 of file ee_selection_tool.cpp.

296 {
297  // Main loop: keep receiving events
298  while( OPT_TOOL_EVENT evt = Wait() )
299  {
300  // Should selected items be added to the current selection or
301  // become the new selection (discarding previously selected items)
302  m_additive = evt->Modifier( MD_SHIFT );
303 
304  // Should selected items be REMOVED from the current selection?
305  // This will be ignored if the SHIFT modifier is pressed
306  m_subtractive = !m_additive && evt->Modifier( MD_CTRL );
307 
308  // Is the user requesting that the selection list include all possible
309  // items without removing less likely selection candidates
310  m_skip_heuristics = !!evt->Modifier( MD_ALT );
311 
312  // Single click? Select single object
313  if( evt->IsClick( BUT_LEFT ) )
314  {
315  // JEY TODO: this is a hack, but I can't figure out why it's needed to
316  // keep from getting the first click when running the Place Symbol tool.
318  continue;
319 
320  if( evt->Modifier( MD_CTRL ) && dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
321  {
323  }
324  else
325  {
326  // If no modifier keys are pressed, clear the selection
327  if( !m_additive )
328  clearSelection();
329 
330  SelectPoint( evt->Position());
331  }
332  }
333 
334  // right click? if there is any object - show the context menu
335  else if( evt->IsClick( BUT_RIGHT ) )
336  {
337  bool selectionCancelled = false;
338 
339  if( m_selection.Empty() )
340  {
341  SelectPoint( evt->Position(), EE_COLLECTOR::AllItems, &selectionCancelled );
342  m_selection.SetIsHover( true );
343  }
344 
345  if( !selectionCancelled )
347  }
348 
349  // double click? Display the properties window
350  else if( evt->IsDblClick( BUT_LEFT ) )
351  {
352  if( m_selection.Empty() )
353  SelectPoint( evt->Position());
354 
355  EDA_ITEM* item = m_selection.Front();
356 
357  if( item && item->Type() == SCH_SHEET_T )
359  else
361  }
362 
363  // drag with LMB? Select multiple objects (or at least draw a selection box) or drag them
364  else if( evt->IsDrag( BUT_LEFT ) )
365  {
367  {
368  selectMultiple();
369  }
370  else
371  {
372  // Check if dragging has started within any of selected items bounding box
373  if( selectionContains( evt->Position() ) )
374  {
375  // Yes -> run the move tool and wait till it finishes
376  m_toolMgr->InvokeTool( "eeschema.InteractiveEdit" );
377  }
378  else
379  {
380  // No -> clear the selection list
381  clearSelection();
382  }
383  }
384  }
385 
386  // context sub-menu selection? Handle unit selection or bus unfolding
387  else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CONTEXT_MENU_CHOICE )
388  {
389  if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
390  && evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_CMP_MAX )
391  {
392  SCH_COMPONENT* component = dynamic_cast<SCH_COMPONENT*>( m_selection.Front() );
393  int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;
394 
395  if( component )
396  static_cast<SCH_EDIT_FRAME*>( m_frame )->SelectUnit( component, unit );
397  }
398  else if( evt->GetCommandId().get() >= ID_POPUP_SCH_UNFOLD_BUS
399  && evt->GetCommandId().get() <= ID_POPUP_SCH_UNFOLD_BUS_END )
400  {
401  wxString* net = new wxString( *evt->Parameter<wxString*>() );
403  }
404 
405  }
406 
407  else if( evt->IsAction( &ACTIONS::cancelInteractive ) || evt->IsCancel() )
408  {
409  clearSelection();
411  }
412 
413  else if( evt->Action() == TA_UNDO_REDO_PRE )
414  {
415  clearSelection();
416  }
417 
418  else if( evt->Action() == TA_CONTEXT_MENU_CLOSED )
419  {
420  m_menu.CloseContextMenu( evt );
421  }
422  }
423 
424  // This tool is supposed to be active forever
425  assert( false );
426 
427  return 0;
428 }
static TOOL_ACTION properties
Definition: ee_actions.h:124
bool selectionContains(const VECTOR2I &aPoint) const
Function selectionContains() Checks if the given point is placed within any of selected items' boundi...
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
static TOOL_ACTION cancelInteractive
Definition: actions.h:45
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:84
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.
void SetIsHover(bool aIsHover)
Definition: selection.h:64
void clearSelection()
Function clearSelection() Clears the current selection.
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119
void CloseContextMenu(OPT_TOOL_EVENT &evt)
Function CloseContextMenu.
Definition: tool_menu.cpp:75
SCH_BASE_FRAME * m_frame
static const KICAD_T AllItems[]
Definition: ee_collectors.h:41
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:157
static TOOL_ACTION enterSheet
Definition: ee_actions.h:160
static TOOL_ACTION clearHighlight
Definition: ee_actions.h:183
static TOOL_ACTION highlightNet
Definition: ee_actions.h:182
EDA_ITEM * SelectPoint(const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, bool *aSelectionCancelledFlag=NULL, bool aCheckLocked=false)
Function selectPoint() Selects an item pointed by the parameter aWhere.
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
int GetToolId() const
Definition: draw_frame.h:524
EDA_ITEM * Front() const
Definition: selection.h:155
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:486
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

References EE_COLLECTOR::AllItems, BUT_LEFT, BUT_RIGHT, ACTIONS::cancelInteractive, EE_ACTIONS::clearHighlight, clearSelection(), TOOL_MENU::CloseContextMenu(), SELECTION::Empty(), EE_ACTIONS::enterSheet, SELECTION::Front(), EDA_DRAW_FRAME::GetToolId(), EE_ACTIONS::highlightNet, ID_NO_TOOL_SELECTED, 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_frame, m_menu, m_selection, m_skip_heuristics, m_subtractive, TOOL_BASE::m_toolMgr, MD_ALT, MD_CTRL, MD_SHIFT, EE_ACTIONS::properties, TOOL_MANAGER::RunAction(), SCH_SHEET_T, selectionContains(), selectMultiple(), SelectPoint(), SELECTION::SetIsHover(), TOOL_MENU::ShowContextMenu(), TA_CONTEXT_MENU_CHOICE, TA_CONTEXT_MENU_CLOSED, TA_UNDO_REDO_PRE, TC_COMMAND, 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 810 of file ee_selection_tool.cpp.

811 {
812  m_selection.Clear();
813 
814  EDA_ITEM* start = nullptr;
815 
816  if( m_isLibEdit )
817  start = static_cast<LIB_EDIT_FRAME*>( m_frame )->GetCurPart();
818  else
819  start = m_frame->GetScreen()->GetDrawItems();
820 
821  INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
822  {
823  if( item->IsSelected() )
824  select( item );
825 
826  return SEARCH_CONTINUE;
827  };
828 
829  EDA_ITEM::IterateForward( start, inspector, nullptr, EE_COLLECTOR::AllItems );
830 }
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...
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:77
bool IsSelected() const
Definition: base_struct.h:227
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.
SCH_BASE_FRAME * m_frame
static const KICAD_T AllItems[]
Definition: ee_collectors.h:41
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:157
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:153

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, SEARCH_CONTINUE, and select().

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState(), and LIB_EDIT_FRAME::RollbackPartFromUndo().

◆ RemoveItemFromSel() [1/2]

int EE_SELECTION_TOOL::RemoveItemFromSel ( const TOOL_EVENT aEvent)

Definition at line 761 of file ee_selection_tool.cpp.

762 {
763  RemoveItemFromSel( aEvent.Parameter<EDA_ITEM*>() );
764  return 0;
765 }
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378
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:157

References TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ RemoveItemFromSel() [2/2]

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

Definition at line 768 of file ee_selection_tool.cpp.

769 {
770  if( aItem )
771  {
772  unselect( aItem );
773 
774  // Inform other potentially interested tools
775  if( !aQuietMode )
777  }
778 }
static const TOOL_EVENT UnselectedEvent
Event sent after an item is unselected.
Definition: actions.h:133
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
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 781 of file ee_selection_tool.cpp.

782 {
783  RemoveItemsFromSel( aEvent.Parameter<EDA_ITEMS*>(), false );
784  return 0;
785 }
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: base_struct.h:588
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378
int RemoveItemsFromSel(const TOOL_EVENT &aEvent)

References TOOL_EVENT::Parameter().

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

789 {
790  if( aList )
791  {
792  for( EDA_ITEM* item : *aList )
793  unselect( item );
794 
795  // Inform other potentially interested tools
796  if( !aQuietMode )
798  }
799 }
static const TOOL_EVENT UnselectedEvent
Event sent after an item is unselected.
Definition: actions.h:133
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
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:157

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

◆ RequestSelection()

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

529 {
530  // Filter an existing selection
531  if( !m_selection.Empty() )
532  {
533  for( int i = m_selection.GetSize() - 1; i >= 0; --i )
534  {
535  EDA_ITEM* item = (EDA_ITEM*) m_selection.GetItem( i );
536 
537  if( !item->IsType( aFilterList ) )
538  toggleSelection( item );
539  }
540 
541  }
542 
543  // If nothing was selected, or we filtered everything out, do a hover selection
544  if( m_selection.Empty() )
545  {
546  VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true );
547 
548  clearSelection();
549  SelectPoint( cursorPos, aFilterList );
550  m_selection.SetIsHover( true );
551  }
552 
553  return m_selection;
554 }
virtual bool IsType(const KICAD_T aScanTypes[])
Function IsType Checks whether the item is one of the listed types.
Definition: base_struct.h:287
void SetIsHover(bool aIsHover)
Definition: selection.h:64
void toggleSelection(EDA_ITEM *aItem, bool aForce=false)
Function toggleSelection() Changes selection status of a given item.
void clearSelection()
Function clearSelection() Clears the current selection.
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
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:157
EDA_ITEM * SelectPoint(const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, bool *aSelectionCancelledFlag=NULL, bool aCheckLocked=false)
Function selectPoint() Selects an item pointed by the parameter aWhere.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

References clearSelection(), SELECTION::Empty(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), SELECTION::GetItem(), SELECTION::GetSize(), TOOL_BASE::getViewControls(), i, EDA_ITEM::IsType(), m_selection, SelectPoint(), SELECTION::SetIsHover(), and toggleSelection().

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::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_EDITOR_CONTROL::EnterSheet(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::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 250 of file ee_selection_tool.cpp.

251 {
252  m_frame = getEditFrame<SCH_BASE_FRAME>();
253 
254  if( aReason == TOOL_BASE::MODEL_RELOAD )
255  {
256  // Remove pointers to the selected items from containers without changing their
257  // properties (as they are already deleted while a new sheet is loaded)
258  m_selection.Clear();
259  getView()->GetPainter()->GetSettings()->SetHighlight( false );
260 
261  LIB_EDIT_FRAME* libEditFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
262 
263  if( libEditFrame )
264  {
265  m_isLibEdit = true;
266  m_unit = libEditFrame->GetUnit();
267  m_convert = libEditFrame->GetConvert();
268  }
269  }
270  else
271  // Restore previous properties of selected items and remove them from containers
272  clearSelection();
273 
274  // Reinsert the VIEW_GROUP, in case it was removed from the VIEW
275  getView()->Remove( &m_selection );
276  getView()->Add( &m_selection );
277 }
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:93
Model changes (required full reload)
Definition: tool_base.h:83
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
void clearSelection()
Function clearSelection() Clears the current selection.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
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
void SetHighlight(bool aEnabled, int aNetcode=-1)
Function SetHighlight Turns on/off highlighting - it may be done for the active layer or the specifie...
Definition: painter.h:140

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_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 85 of file tool_interactive.cpp.

86 {
87  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
88 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
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 1017 of file ee_selection_tool.cpp.

1018 {
1019  highlight( aItem, SELECTED, &m_selection );
1020 }
void highlight(EDA_ITEM *aItem, int aHighlightMode, SELECTION *aGroup=nullptr)
Function highlight() Highlights the item visually.
#define SELECTED
Definition: base_struct.h:121

References highlight(), m_selection, and SELECTED.

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

◆ selectable()

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

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

Returns
True if the item fulfills conditions to be selected.

Definition at line 924 of file ee_selection_tool.cpp.

925 {
926  // NOTE: in the future this is where eeschema layer/itemtype visibility will be handled
927 
928  switch( aItem->Type() )
929  {
930  case SCH_PIN_T:
931  if( !static_cast<const SCH_PIN*>( aItem )->IsVisible() && !m_frame->GetShowAllPins() )
932  return false;
933  break;
934 
935  case LIB_PART_T: // In libedit we do not want to select the symbol itself.
936  return false;
937 
938  case LIB_PIN_T:
939  {
940  LIB_EDIT_FRAME* editFrame = (LIB_EDIT_FRAME*) m_frame;
941  LIB_PIN* pin = (LIB_PIN*) aItem;
942 
943  if( ( pin->GetUnit() && pin->GetUnit() != editFrame->GetUnit() )
944  || ( pin->GetConvert() && pin->GetConvert() != editFrame->GetConvert() ) )
945  {
946  // Specific rules for pins:
947  // - do not select pins in other units when synchronized pin edit mode is disabled
948  // - do not select pins in other units when units are not interchangeable
949  // - in other cases verify if the pin belongs to the requested DeMorgan variant
950  if( !editFrame->SynchronizePins()
951  || editFrame->GetCurPart()->UnitsLocked()
952  || ( pin->GetConvert() && pin->GetConvert() != editFrame->GetConvert() ) )
953  {
954  return false;
955  }
956  }
957  break;
958  }
959  case SCH_MARKER_T: // Always selectable
960  return true;
961 
962  default: // Suppress warnings
963  break;
964  }
965 
966  return true;
967 }
LIB_PART * GetCurPart() const
Return the current part being edited or NULL if none selected.
int GetUnit() const
int GetConvert() const
The symbol library editor main window.
virtual bool GetShowAllPins() const
Allow some frames to show/hide hidden pins.
SCH_BASE_FRAME * m_frame
bool SynchronizePins()
Pin editing (add, delete, move...) can be synchronized between units when units are interchangeable b...
bool UnitsLocked() const
Check whether part units are interchangeable.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

References LIB_EDIT_FRAME::GetConvert(), LIB_ITEM::GetConvert(), LIB_EDIT_FRAME::GetCurPart(), SCH_BASE_FRAME::GetShowAllPins(), LIB_EDIT_FRAME::GetUnit(), LIB_ITEM::GetUnit(), LIB_PART_T, LIB_PIN_T, m_frame, SCH_MARKER_T, SCH_PIN_T, LIB_EDIT_FRAME::SynchronizePins(), EDA_ITEM::Type(), and LIB_PART::UnitsLocked().

Referenced by selectMultiple(), SelectPoint(), and toggleSelection().

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

693 {
694  static KICAD_T wiresAndBusses[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
695 
696  RequestSelection( wiresAndBusses );
697 
698  if( m_selection.Empty() )
699  return 0;
700 
701  SCH_LINE* line = (SCH_LINE*) m_selection.Front();
702  EDA_ITEMS items;
703 
705  m_frame->GetScreen()->MarkConnections( line );
706 
707  for( EDA_ITEM* item = m_frame->GetScreen()->GetDrawItems(); item; item = item->Next() )
708  {
709  if( item->GetFlags() & CANDIDATE )
710  select( item );
711  }
712 
713  if( m_selection.GetSize() > 1 )
715 
716  return 0;
717 }
static const TOOL_EVENT SelectedEvent
Event sent after an item is selected.
Definition: actions.h:132
SCH_ITEM * Next() const
Definition: sch_item.h:153
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
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:124
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
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:588
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:308
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:157
void ClearDrawingState()
Clear the state flags of all the items in the screen.
Definition: sch_screen.cpp:604
SELECTION & RequestSelection(const KICAD_T *aFilterList=EE_COLLECTOR::AllItems)
Function RequestSelection()
EDA_ITEM * Front() const
Definition: selection.h:155
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:153

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() Checks if the given point is placed within any of selected items' bounding box.

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

Definition at line 1139 of file ee_selection_tool.cpp.

1140 {
1141  const unsigned GRIP_MARGIN = 20;
1142  VECTOR2I margin = getView()->ToWorld( VECTOR2I( GRIP_MARGIN, GRIP_MARGIN ), false );
1143 
1144  // Check if the point is located within any of the currently selected items bounding boxes
1145  for( auto item : m_selection )
1146  {
1147  BOX2I itemBox = item->ViewBBox();
1148  itemBox.Inflate( margin.x, margin.y ); // Give some margin for gripping an item
1149 
1150  if( itemBox.Contains( aPoint ) )
1151  return true;
1152  }
1153 
1154  return false;
1155 }
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:35
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

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

834 {
835  EE_COLLECTOR* collector = aEvent.Parameter<EE_COLLECTOR*>();
836 
837  if( !doSelectionMenu( collector ) )
838  collector->m_MenuCancelled = true;
839 
840  return 0;
841 }
Class EE_COLLECTOR.
Definition: ee_collectors.h:38
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378
bool m_MenuCancelled
bool doSelectionMenu(EE_COLLECTOR *aItems)
Allows the selection of a single item from a list via pop-up menu.

References doSelectionMenu(), EE_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 557 of file ee_selection_tool.cpp.

558 {
559  bool cancelled = false; // Was the tool cancelled while it was running?
560  m_multiple = true; // Multiple selection mode is active
561  KIGFX::VIEW* view = getView();
562 
564  view->Add( &area );
565 
566  while( OPT_TOOL_EVENT evt = Wait() )
567  {
568  if( evt->IsAction( &ACTIONS::cancelInteractive ) || evt->IsActivate() || evt->IsCancel() )
569  {
570  cancelled = true;
571  break;
572  }
573 
574  if( evt->IsDrag( BUT_LEFT ) )
575  {
576  // Start drawing a selection box
577  area.SetOrigin( evt->DragOrigin() );
578  area.SetEnd( evt->Position() );
579  area.SetAdditive( m_additive );
581 
582  view->SetVisible( &area, true );
583  view->Update( &area );
584  getViewControls()->SetAutoPan( true );
585  }
586 
587  if( evt->IsMouseUp( BUT_LEFT ) )
588  {
589  getViewControls()->SetAutoPan( false );
590 
591  // End drawing the selection box
592  view->SetVisible( &area, false );
593 
594  // Mark items within the selection box as selected
595  std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
596 
597  // Filter the view items based on the selection box
598  BOX2I selectionBox = area.ViewBBox();
599  view->Query( selectionBox, selectedItems ); // Get the list of selected items
600 
601  std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR>::iterator it, it_end;
602 
603  int width = area.GetEnd().x - area.GetOrigin().x;
604  int height = area.GetEnd().y - area.GetOrigin().y;
605 
606  /* Selection mode depends on direction of drag-selection:
607  * Left > Right : Select objects that are fully enclosed by selection
608  * Right > Left : Select objects that are crossed by selection
609  */
610  bool windowSelection = width >= 0 ? true : false;
611 
612  if( view->IsMirroredX() )
613  windowSelection = !windowSelection;
614 
615  // Construct an EDA_RECT to determine EDA_ITEM selection
616  EDA_RECT selectionRect( (wxPoint)area.GetOrigin(), wxSize( width, height ) );
617 
618  selectionRect.Normalize();
619 
620  for( it = selectedItems.begin(), it_end = selectedItems.end(); it != it_end; ++it )
621  {
622  EDA_ITEM* item = static_cast<EDA_ITEM*>( it->first );
623 
624  if( !item || !selectable( item ) )
625  continue;
626 
627  if( item->HitTest( selectionRect, windowSelection ) )
628  {
629  if( m_subtractive )
630  unselect( item );
631  else
632  select( item );
633  }
634  }
635 
636  // Inform other potentially interested tools
637  if( !m_selection.Empty() )
639 
640  break; // Stop waiting for events
641  }
642  }
643 
644  getViewControls()->SetAutoPan( false );
645 
646  // Stop drawing the selection box
647  view->Remove( &area );
648  m_multiple = false; // Multiple selection mode is inactive
649 
650  if( !cancelled )
652 
653  return cancelled;
654 }
void ClearReferencePoint()
Definition: selection.h:213
static const TOOL_EVENT SelectedEvent
Event sent after an item is selected.
Definition: actions.h:132
void SetEnd(VECTOR2I aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
void SetOrigin(VECTOR2I aOrigin)
Set the origin of the rectange (the fixed corner)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
static TOOL_ACTION cancelInteractive
Definition: actions.h:45
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
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:333
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers.
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:1539
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119
bool selectable(const EDA_ITEM *aItem, bool checkVisibilityOnly=false) const
Function selectable() Checks conditions for an item to be selected.
bool IsMirroredX() const
Function IsMirroredX() Returns true if view is flipped across the X axis.
Definition: view.h:230
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.
void SetSubtractive(bool aSubtractive)
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:157
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1485
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:41
Class VIEW.
Definition: view.h:61
void SetAdditive(bool aAdditive)
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:486

References KIGFX::VIEW::Add(), BUT_LEFT, ACTIONS::cancelInteractive, SELECTION::ClearReferencePoint(), SELECTION::Empty(), KIGFX::PREVIEW::SELECTION_AREA::GetEnd(), KIGFX::PREVIEW::SELECTION_AREA::GetOrigin(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), EDA_ITEM::HitTest(), KIGFX::VIEW::IsMirroredX(), m_additive, 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::SetOrigin(), KIGFX::PREVIEW::SELECTION_AREA::SetSubtractive(), KIGFX::VIEW::SetVisible(), unselect(), 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 682 of file ee_selection_tool.cpp.

683 {
684  VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
685 
686  SelectPoint( cursorPos, nodeTypes );
687 
688  return 0;
689 }
int Modifier(int aMask=MD_MODIFIER_MASK) const
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:316
static KICAD_T nodeTypes[]
EDA_ITEM * SelectPoint(const VECTOR2I &aWhere, const KICAD_T *aFilterList=EE_COLLECTOR::AllItems, bool *aSelectionCancelledFlag=NULL, bool aCheckLocked=false)
Function selectPoint() Selects an item pointed by the parameter aWhere.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
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 
)

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

439 {
440  EDA_ITEM* start;
441  EE_COLLECTOR collector;
442 
443  if( m_isLibEdit )
444  start = static_cast<LIB_EDIT_FRAME*>( m_frame )->GetCurPart();
445  else
446  start = m_frame->GetScreen()->GetDrawItems();
447 
448  // Empty schematics have no draw items
449  if( !start )
450  return nullptr;
451 
452  collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
453  collector.Collect( start, aFilterList, (wxPoint) aWhere, m_unit, m_convert );
454 
455  bool anyCollected = collector.GetCount() != 0;
456 
457  // Remove unselectable items
458  for( int i = collector.GetCount() - 1; i >= 0; --i )
459  {
460  if( !selectable( collector[ i ] ) )
461  collector.Remove( i );
462 
463  if( aCheckLocked && collector[ i ]->IsLocked() )
464  collector.Remove( i );
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( collector.GetCount() == 1 )
492  {
493  EDA_ITEM* item = collector[ 0 ];
494 
495  toggleSelection( item );
496  return item;
497  }
498 
499  if( !m_additive && anyCollected )
500  clearSelection();
501 
502  return nullptr;
503 }
wxString m_MenuTitle
void ClearReferencePoint()
Definition: selection.h:213
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:118
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
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:125
Class EE_COLLECTOR.
Definition: ee_collectors.h:38
void Remove(int aIndex)
Function Remove removes the item at aIndex (first position is 0);.
Definition: collector.h:143
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:114
void guessSelectionCandidates(EE_COLLECTOR &collector, const VECTOR2I &aWhere)
Apply heuristics to try and determine a single object when multiple are found under the cursor.
void toggleSelection(EDA_ITEM *aItem, bool aForce=false)
Function toggleSelection() Changes selection status of a given item.
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.
void clearSelection()
Function clearSelection() Clears the current selection.
bool m_MenuCancelled
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
bool selectable(const EDA_ITEM *aItem, bool checkVisibilityOnly=false) const
Function selectable() Checks conditions for an item to be selected.
SCH_BASE_FRAME * m_frame
static TOOL_ACTION selectionMenu
Runs a selection menu to select from a list of items.
Definition: ee_actions.h:68
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:157
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:153

References SELECTION::ClearReferencePoint(), clearSelection(), EE_COLLECTOR::Collect(), COLLECTOR::GetCount(), SCH_SCREEN::GetDrawItems(), SCH_BASE_FRAME::GetScreen(), TOOL_BASE::getView(), guessSelectionCandidates(), HITTEST_THRESHOLD_PIXELS, i, KiROUND(), m_additive, m_convert, m_frame, m_isLibEdit, EE_COLLECTOR::m_MenuCancelled, EE_COLLECTOR::m_MenuTitle, m_selection, m_skip_heuristics, EE_COLLECTOR::m_Threshold, TOOL_BASE::m_toolMgr, m_unit, COLLECTOR::Remove(), TOOL_MANAGER::RunAction(), selectable(), EE_ACTIONS::selectionMenu, and toggleSelection().

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

◆ 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 74 of file tool_interactive.cpp.

75 {
76  if( aMenu )
77  aMenu->SetTool( this );
78  else
79  aTrigger = CMENU_OFF;
80 
81  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
82 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
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(), doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), TOOL_MENU::ShowContextMenu(), and SCH_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void EE_SELECTION_TOOL::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 1158 of file ee_selection_tool.cpp.

1159 {
1161 
1166 
1172 }
int UpdateMenu(const TOOL_EVENT &aEvent)
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
Definition: ee_actions.h:64
static TOOL_ACTION selectConnection
If current selection is a wire or bus, expand to entire connection.
Definition: ee_actions.h:54
int AddItemsToSel(const TOOL_EVENT &aEvent)
static TOOL_ACTION removeItemsFromSel
Definition: ee_actions.h:65
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:61
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:60
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:47
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: ee_actions.h:57
static TOOL_ACTION updateMenu
Definition: actions.h:49
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
int AddItemToSel(const TOOL_EVENT &aEvent)
int ClearSelection(const TOOL_EVENT &aEvent)
Clear current selection event handler.
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:68
static TOOL_ACTION selectNode
Select the junction, wire or bus segment under the cursor.
Definition: ee_actions.h:50
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(), ACTIONS::updateMenu, and UpdateMenu().

◆ toggleSelection()

void EE_SELECTION_TOOL::toggleSelection ( EDA_ITEM aItem,
bool  aForce = false 
)
private

Function toggleSelection() Changes selection status of a given item.

Parameters
aItemis the item to have selection status changed.
aForcecauses the toggle to happen without checking selectability

Definition at line 988 of file ee_selection_tool.cpp.

989 {
990  if( aItem->IsSelected() )
991  {
992  unselect( aItem );
993 
994  // Inform other potentially interested tools
996  }
997  else
998  {
999  if( !m_additive )
1000  clearSelection();
1001 
1002  // Prevent selection of invisible or inactive items
1003  if( aForce || selectable( aItem ) )
1004  {
1005  select( aItem );
1006 
1007  // Inform other potentially interested tools
1009  }
1010  }
1011 
1012  if( m_frame )
1014 }
static const TOOL_EVENT SelectedEvent
Event sent after an item is selected.
Definition: actions.h:132
void ForceRefresh()
Function ForceRefresh() Forces a redraw.
bool IsSelected() const
Definition: base_struct.h:227
static const TOOL_EVENT UnselectedEvent
Event sent after an item is unselected.
Definition: actions.h:133
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:931
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
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).
void clearSelection()
Function clearSelection() Clears the current selection.
bool selectable(const EDA_ITEM *aItem, bool checkVisibilityOnly=false) const
Function selectable() Checks conditions for an item to be selected.
void unselect(EDA_ITEM *aItem)
Function unselect() Takes necessary action mark an item as unselected.
SCH_BASE_FRAME * m_frame

References clearSelection(), EDA_DRAW_PANEL_GAL::ForceRefresh(), EDA_DRAW_FRAME::GetGalCanvas(), EDA_ITEM::IsSelected(), m_additive, m_frame, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), select(), selectable(), EVENTS::SelectedEvent, unselect(), and EVENTS::UnselectedEvent.

Referenced by RequestSelection(), and SelectPoint().

◆ unhighlight()

void EE_SELECTION_TOOL::unhighlight ( EDA_ITEM aItem,
int  aHighlightMode,
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 1084 of file ee_selection_tool.cpp.

1085 {
1086  if( aMode == SELECTED )
1087  aItem->ClearSelected();
1088  else if( aMode == BRIGHTENED )
1089  aItem->ClearBrightened();
1090 
1091  if( aGroup )
1092  aGroup->Remove( aItem );
1093 
1094  // Unhighlight pins and fields. (All the other component children are currently only
1095  // represented in the LIB_PART.)
1096  if( aItem->Type() == SCH_COMPONENT_T )
1097  {
1098  SCH_PINS& pins = static_cast<SCH_COMPONENT*>( aItem )->GetPins();
1099 
1100  for( SCH_PIN& pin : pins )
1101  {
1102  if( aMode == SELECTED )
1103  pin.ClearSelected();
1104  else if( aMode == BRIGHTENED )
1105  pin.ClearBrightened();
1106  }
1107 
1108  std::vector<SCH_FIELD*> fields;
1109  static_cast<SCH_COMPONENT*>( aItem )->GetFields( fields, false );
1110 
1111  for( SCH_FIELD* field : fields )
1112  {
1113  if( aMode == SELECTED )
1114  field->ClearSelected();
1115  else if( aMode == BRIGHTENED )
1116  field->ClearBrightened();
1117  }
1118  }
1119  else if( aItem->Type() == SCH_SHEET_T )
1120  {
1121  SCH_SHEET_PINS& pins = static_cast<SCH_SHEET*>( aItem )->GetPins();
1122 
1123  for( SCH_SHEET_PIN& pin : pins )
1124  {
1125  if( aMode == SELECTED )
1126  pin.ClearSelected();
1127  else if( aMode == BRIGHTENED )
1128  pin.ClearBrightened();
1129  }
1130  }
1131 
1132  if( aItem->Type() == SCH_PIN_T || aItem->Type() == SCH_FIELD_T )
1133  getView()->Update( aItem->GetParent() );
1134  else
1135  getView()->Update( aItem );
1136 }
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:237
void ClearBrightened()
Definition: base_struct.h:239
#define SELECTED
Definition: base_struct.h:121
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:137
EDA_ITEM * GetParent() const
Definition: base_struct.h:214
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:56
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:1539
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
boost::ptr_vector< SCH_SHEET_PIN > SCH_SHEET_PINS
Definition: sch_sheet.h:195
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204
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_T, SELECTED, EDA_ITEM::Type(), and KIGFX::VIEW::Update().

Referenced by clearSelection(), doSelectionMenu(), 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 1023 of file ee_selection_tool.cpp.

1024 {
1025  unhighlight( aItem, SELECTED, &m_selection );
1026 }
#define SELECTED
Definition: base_struct.h:121
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, SELECTION *aGroup=nullptr)
Function unhighlight() Unhighlights the item visually.

References m_selection, SELECTED, and unhighlight().

Referenced by RemoveItemFromSel(), RemoveItemsFromSel(), selectMultiple(), and toggleSelection().

◆ UpdateMenu()

int EE_SELECTION_TOOL::UpdateMenu ( const TOOL_EVENT aEvent)

Definition at line 280 of file ee_selection_tool.cpp.

281 {
282  ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
283  CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
284 
285  if( conditionalMenu )
286  conditionalMenu->Evaluate( m_selection );
287 
288  if( actionMenu )
289  actionMenu->UpdateAll();
290 
291  return 0;
292 }
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:378

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

Referenced by setTransitions().

◆ Wait()

OPT_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 55 of file tool_interactive.cpp.

56 {
57  return m_toolMgr->ScheduleWait( this, aEventList );
58 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:216
OPT< 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 LIB_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_DRAWING_TOOLS::doPlaceComponent(), doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EE_PICKER_TOOL::Main(), PICKER_TOOL::Main(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), Main(), EDIT_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), GERBVIEW_SELECTION_TOOL::selectMultiple(), selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), and SCH_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_additive

bool EE_SELECTION_TOOL::m_additive
private

Definition at line 242 of file ee_selection_tool.h.

Referenced by Main(), selectMultiple(), SelectPoint(), and toggleSelection().

◆ m_convert

int EE_SELECTION_TOOL::m_convert
private

Definition at line 249 of file ee_selection_tool.h.

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

◆ m_frame

SCH_BASE_FRAME* EE_SELECTION_TOOL::m_frame
private

◆ m_isLibEdit

bool EE_SELECTION_TOOL::m_isLibEdit
private

Definition at line 247 of file ee_selection_tool.h.

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

◆ m_menu

TOOL_MENU EE_SELECTION_TOOL::m_menu
private

Definition at line 251 of file ee_selection_tool.h.

Referenced by GetToolMenu(), Init(), and Main().

◆ m_multiple

bool EE_SELECTION_TOOL::m_multiple
private

Definition at line 244 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 245 of file ee_selection_tool.h.

Referenced by Main(), and SelectPoint().

◆ m_subtractive

bool EE_SELECTION_TOOL::m_subtractive
private

Definition at line 243 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 211 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 216 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), AddItemsToSel(), AddItemToSel(), SCH_DRAWING_TOOLS::AddJunction(), SCH_DRAWING_TOOLS::AddLabel(), TOOL_BASE::attachManager(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDITOR_CONTROL::ClearHighlight(), PCB_EDITOR_CONTROL::ClearHighlight(), GERBVIEW_SELECTION_TOOL::clearSelection(), clearSelection(), SELECTION_TOOL::clearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_EDITOR_CONTROL::CrossProbePcbToSch(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), COMMON_TOOLS::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), SCH_EDITOR_CONTROL::Cut(), LIB_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_WIRE_BUS_TOOL::doDrawSegments(), SCH_DRAWING_TOOLS::doPlaceComponent(), SCH_DRAWING_TOOLS::doSingleClickPlace(), LIB_DRAWING_TOOLS::doTwoClickPlace(), SCH_DRAWING_TOOLS::doTwoClickPlace(), DRAWING_TOOL::drawArc(), SCH_WIRE_BUS_TOOL::DrawBusses(), DRAWING_TOOL::DrawDimension(), SCH_WIRE_BUS_TOOL::DrawLines(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_WIRE_BUS_TOOL::DrawWires(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), EDIT_TOOL::editFootprintInFpEditor(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_EDITOR_CONTROL::EnterSheet(), MODULE_EDITOR_TOOLS::EnumeratePads(), EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::findCallback(), SELECTION_TOOL::findMove(), SCH_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), 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(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_EDITOR_CONTROL::HighlightNetCursor(), LIB_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), EDIT_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), ZOOM_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EE_PICKER_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), RemoveItemFromSel(), RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), SELECTION_TOOL::RequestSelection(), CVPCB_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), SelectConnection(), SELECTION_TOOL::selectCopper(), PCB_TOOL_BASE::selection(), GERBVIEW_SELECTION_TOOL::SelectItem(), SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), GERBVIEW_SELECTION_TOOL::selectMultiple(), selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), SelectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), TOOL_INTERACTIVE::SetContextMenu(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), SCH_WIRE_BUS_TOOL::StartBus(), SCH_WIRE_BUS_TOOL::StartLine(), SCH_WIRE_BUS_TOOL::StartWire(), GERBVIEW_SELECTION_TOOL::toggleSelection(), toggleSelection(), SELECTION_TOOL::toggleSelection(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), SCH_EDITOR_CONTROL::Undo(), SCH_WIRE_BUS_TOOL::UnfoldBus(), GERBVIEW_SELECTION_TOOL::UnselectItem(), SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), PCB_EDITOR_CONTROL::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 215 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_toolSettings

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

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

Referenced by TOOL_BASE::GetType().

◆ m_unit

int EE_SELECTION_TOOL::m_unit
private

Definition at line 248 of file ee_selection_tool.h.

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


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