KiCad PCB EDA Suite
PL_SELECTION_TOOL Class Reference

#include <pl_selection_tool.h>

Inheritance diagram for PL_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

 PL_SELECTION_TOOL ()
 
 ~PL_SELECTION_TOOL () override
 
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...
 
PL_SELECTIONGetSelection ()
 Function GetSelection() More...
 
PL_SELECTIONRequestSelection ()
 Function RequestSelection() More...
 
EDA_ITEMSelectPoint (const VECTOR2I &aWhere, bool *aSelectionCancelledFlag=nullptr)
 Function selectPoint() Selects an item pointed by the parameter aWhere. More...
 
int AddItemToSel (const TOOL_EVENT &aEvent)
 
void AddItemToSel (EDA_ITEM *aItem, bool aQuietMode=false)
 
int AddItemsToSel (const TOOL_EVENT &aEvent)
 
void AddItemsToSel (EDA_ITEMS *aList, bool aQuietMode=false)
 
int RemoveItemFromSel (const TOOL_EVENT &aEvent)
 
void RemoveItemFromSel (EDA_ITEM *aItem, bool aQuietMode=false)
 
int RemoveItemsFromSel (const TOOL_EVENT &aEvent)
 
void RemoveItemsFromSel (EDA_ITEMS *aList, bool aQuietMode=false)
 
void BrightenItem (EDA_ITEM *aItem)
 
void UnbrightenItem (EDA_ITEM *aItem)
 
int ClearSelection (const TOOL_EVENT &aEvent)
 
void ClearSelection ()
 
void RebuildSelection ()
 Rebuild the selection from the flags in the view items. 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 Activate ()
 Function Activate() Runs the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
TOOL_SETTINGSGetSettings ()
 
bool IsToolActive () const
 

Protected Member Functions

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

Protected Attributes

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

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

bool selectMultiple ()
 Function selectMultiple() Handles drawing a selection box that allows one to select many items at the same time. More...
 
void guessSelectionCandidates (COLLECTOR &collector, const VECTOR2I &aWhere)
 Apply heuristics to try and determine a single object when multiple are found under the cursor. More...
 
bool doSelectionMenu (COLLECTOR *aItems)
 Allows the selection of a single item from a list via pop-up menu. More...
 
void select (EDA_ITEM *aItem)
 Function select() Takes necessary action mark an item as selected. More...
 
void unselect (EDA_ITEM *aItem)
 Function unselect() Takes necessary action mark an item as unselected. More...
 
void highlight (EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
 Function highlight() Highlights the item visually. More...
 
void unhighlight (EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
 Function unhighlight() Unhighlights the item visually. More...
 
bool selectionContains (const VECTOR2I &aPoint) const
 Function selectionContains() More...
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 

Private Attributes

PL_EDITOR_FRAMEm_frame
 
PL_SELECTION m_selection
 
bool m_additive
 
bool m_subtractive
 
bool m_exclusive_or
 
bool m_multiple
 
bool m_skip_heuristics
 

Detailed Description

Definition at line 49 of file pl_selection_tool.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 79 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ PL_SELECTION_TOOL()

PL_SELECTION_TOOL::PL_SELECTION_TOOL ( )

Definition at line 56 of file pl_selection_tool.cpp.

56  :
57  TOOL_INTERACTIVE( "plEditor.InteractiveSelection" ),
58  m_frame( nullptr ),
59  m_additive( false ),
60  m_subtractive( false ),
61  m_exclusive_or( false ),
62  m_multiple( false ),
63  m_skip_heuristics( false )
64 {
65 }
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Constructor.
PL_EDITOR_FRAME * m_frame

◆ ~PL_SELECTION_TOOL()

PL_SELECTION_TOOL::~PL_SELECTION_TOOL ( )
inlineoverride

Definition at line 53 of file pl_selection_tool.h.

53 { }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

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

Definition at line 51 of file tool_interactive.cpp.

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.

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

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), LIB_TREE::onContextMenu(), POINT_EDITOR::OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ AddItemsToSel() [1/2]

int PL_SELECTION_TOOL::AddItemsToSel ( const TOOL_EVENT aEvent)

Definition at line 427 of file pl_selection_tool.cpp.

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

References TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ AddItemsToSel() [2/2]

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

Definition at line 434 of file pl_selection_tool.cpp.

435 {
436  if( aList )
437  {
438  for( EDA_ITEM* item : *aList )
439  select( item );
440 
441  // Inform other potentially interested tools
442  if( !aQuietMode )
444  }
445 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:197
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163

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

◆ AddItemToSel() [1/2]

int PL_SELECTION_TOOL::AddItemToSel ( const TOOL_EVENT aEvent)

Definition at line 407 of file pl_selection_tool.cpp.

408 {
409  AddItemToSel( aEvent.Parameter<EDA_ITEM*>() );
410  return 0;
411 }
int AddItemToSel(const TOOL_EVENT &aEvent)
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163

References TOOL_EVENT::Parameter().

Referenced by PL_EDIT_TOOL::DeleteItemCursor(), PL_DRAWING_TOOLS::DrawShape(), DIALOG_INSPECTOR::onCellClicked(), PL_DRAWING_TOOLS::PlaceItem(), and setTransitions().

◆ AddItemToSel() [2/2]

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

Definition at line 414 of file pl_selection_tool.cpp.

415 {
416  if( aItem )
417  {
418  select( aItem );
419 
420  // Inform other potentially interested tools
421  if( !aQuietMode )
423  }
424 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:197
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).

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

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

Sets the TOOL_MANAGER the tool will belong to. Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63  m_toolSettings = TOOL_SETTINGS( this );
64 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:220
friend class TOOL_SETTINGS
Definition: tool_base.h:154

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

Referenced by TOOL_MANAGER::RegisterTool().

◆ BrightenItem()

void PL_SELECTION_TOOL::BrightenItem ( EDA_ITEM aItem)

Definition at line 489 of file pl_selection_tool.cpp.

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

References BRIGHTENED, and highlight().

Referenced by PL_EDIT_TOOL::DeleteItemCursor().

◆ ClearSelection() [1/2]

int PL_SELECTION_TOOL::ClearSelection ( const TOOL_EVENT aEvent)

◆ ClearSelection() [2/2]

void PL_SELECTION_TOOL::ClearSelection ( )

Definition at line 614 of file pl_selection_tool.cpp.

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

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

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

◆ doSelectionMenu()

bool PL_SELECTION_TOOL::doSelectionMenu ( 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 534 of file pl_selection_tool.cpp.

535 {
536  EDA_ITEM* current = nullptr;
537  ACTION_MENU menu( true );
538 
539  int limit = std::min( MAX_SELECT_ITEM_IDS, aCollector->GetCount() );
540 
541  for( int i = 0; i < limit; ++i )
542  {
543  wxString text;
544  EDA_ITEM* item = ( *aCollector )[i];
545  text = item->GetSelectMenuText( m_frame->GetUserUnits() );
546 
547  wxString menuText = wxString::Format("&%d. %s", i + 1, text );
548  menu.Add( menuText, i + 1, item->GetMenuImage() );
549  }
550 
551  if( aCollector->m_MenuTitle.Length() )
552  menu.SetTitle( aCollector->m_MenuTitle );
553 
554  menu.SetIcon( info_xpm );
555  menu.DisplayTitle( true );
556  SetContextMenu( &menu, CMENU_NOW );
557 
558  while( TOOL_EVENT* evt = Wait() )
559  {
560  if( evt->Action() == TA_CHOICE_MENU_UPDATE )
561  {
562  if( current )
563  unhighlight( current, BRIGHTENED );
564 
565  int id = *evt->GetCommandId();
566 
567  // User has pointed an item, so show it in a different way
568  if( id > 0 && id <= limit )
569  {
570  current = ( *aCollector )[id - 1];
571  highlight( current, BRIGHTENED );
572  }
573  else
574  {
575  current = NULL;
576  }
577  }
578  else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
579  {
580  if( current )
581  unhighlight( current, BRIGHTENED );
582 
583  OPT<int> id = evt->GetCommandId();
584 
585  // User has selected an item, so this one will be returned
586  if( id && ( *id > 0 ) )
587  current = ( *aCollector )[*id - 1];
588  else
589  current = NULL;
590 
591  break;
592  }
593 
594  getView()->UpdateItems();
595  m_frame->GetCanvas()->Refresh();
596  }
597 
598  if( current )
599  {
600  unhighlight( current, BRIGHTENED );
601 
602  getView()->UpdateItems();
603  m_frame->GetCanvas()->Refresh();
604 
605  aCollector->Empty();
606  aCollector->Append( current );
607  return true;
608  }
609 
610  return false;
611 }
#define MAX_SELECT_ITEM_IDS
The maximum number of items in the clarify selection context menu.
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
Class ACTION_MENU.
Definition: action_menu.h:43
void SetContextMenu(ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Function SetContextMenu()
PL_EDITOR_FRAME * m_frame
Class TOOL_EVENT.
Definition: tool_event.h:171
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
void UpdateItems()
Function UpdateItems() Iterates through the list of items that asked for updating and updates them.
Definition: view.cpp:1421
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
EDA_UNITS_T GetUserUnits() const
Return the user units currently in use.
size_t i
Definition: json11.cpp:649
virtual wxString GetSelectMenuText(EDA_UNITS_T aUnits) const
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
void highlight(EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
Function highlight() Highlights the item visually.
boost::optional< T > OPT
Definition: optional.h:7
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
Function unhighlight() Unhighlights the item visually.
virtual BITMAP_DEF GetMenuImage() const
Function GetMenuImage returns a pointer to an image to be used in menus.
#define min(a, b)
Definition: auxiliary.h:85

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

Referenced by SelectionMenu().

◆ getEditFrame()

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

Function getEditFrame()

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

Definition at line 187 of file tool_base.h.

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

References TOOL_BASE::getEditFrameInt().

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

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

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

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 143 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

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

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Function GetName() Returns the name of the tool.

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

Returns
The name of the tool.

Definition at line 132 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ GetSelection()

◆ GetSettings()

TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 78 of file tool_base.cpp.

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

References TOOL_BASE::m_toolSettings.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 110 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

Function getView()

Returns the instance of VIEW object used in the application. It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

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

◆ getViewControls()

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

Function getViewControls()

Returns the instance of VIEW_CONTROLS object used in the application. It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.)

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

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

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

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

◆ Go()

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

Function Go()

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

Definition at line 129 of file tool_interactive.h.

131 {
132  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
133 
134  goInternal( sptr, aConditions );
135 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by LENGTH_TUNER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_CONTROL::setTransitions(), LIB_PIN_TOOL::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), COMMON_CONTROL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), EE_POINT_EDITOR::setTransitions(), SCH_MOVE_TOOL::setTransitions(), PL_POINT_EDITOR::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), LIB_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), MODULE_EDITOR_TOOLS::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), PCBNEW_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), setTransitions(), EE_SELECTION_TOOL::setTransitions(), and DRC::setTransitions().

◆ guessSelectionCandidates()

void PL_SELECTION_TOOL::guessSelectionCandidates ( 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 274 of file pl_selection_tool.cpp.

275 {
276  // There are certain conditions that can be handled automatically.
277 
278  // Prefer an exact hit to a sloppy one
279  for( int i = 0; collector.GetCount() == 2 && i < 2; ++i )
280  {
281  EDA_ITEM* item = collector[ i ];
282  EDA_ITEM* other = collector[ ( i + 1 ) % 2 ];
283 
284  if( item->HitTest( (wxPoint) aPos, 0 ) && !other->HitTest( (wxPoint) aPos, 0 ) )
285  collector.Remove( other );
286  }
287 }
void Remove(int aIndex)
Function Remove removes the item at aIndex (first position is 0);.
Definition: collector.h:142
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
Definition: base_struct.h:340
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:113
size_t i
Definition: json11.cpp:649
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163

References COLLECTOR::GetCount(), EDA_ITEM::HitTest(), i, and COLLECTOR::Remove().

Referenced by SelectPoint().

◆ highlight()

void PL_SELECTION_TOOL::highlight ( EDA_ITEM aItem,
int  aHighlightMode,
PL_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 644 of file pl_selection_tool.cpp.

645 {
646  if( aMode == SELECTED )
647  aItem->SetSelected();
648  else if( aMode == BRIGHTENED )
649  aItem->SetBrightened();
650 
651  if( aGroup )
652  aGroup->Add( aItem );
653 
654  getView()->Update( aItem );
655 }
void SetBrightened()
Definition: base_struct.h:241
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:74
#define SELECTED
Definition: base_struct.h:127
void SetSelected()
Definition: base_struct.h:239
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36

References SELECTION::Add(), BRIGHTENED, TOOL_BASE::getView(), SELECTED, EDA_ITEM::SetBrightened(), EDA_ITEM::SetSelected(), and KIGFX::VIEW::Update().

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

◆ Init()

bool PL_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 68 of file pl_selection_tool.cpp.

69 {
70  m_frame = getEditFrame<PL_EDITOR_FRAME>();
71 
72  auto& menu = m_menu.GetMenu();
73 
74  menu.AddSeparator( 200 );
75  menu.AddItem( PL_ACTIONS::drawLine, PL_CONDITIONS::Idle, 250 );
76  menu.AddItem( PL_ACTIONS::drawRectangle, PL_CONDITIONS::Idle, 250 );
77  menu.AddItem( PL_ACTIONS::placeText, PL_CONDITIONS::Idle, 250 );
78  menu.AddItem( PL_ACTIONS::placeImage, PL_CONDITIONS::Idle, 250 );
80 
81  menu.AddSeparator( 1000 );
83 
84  return true;
85 }
void AddStandardSubMenus(TOOL_MENU &aMenu)
Function CreateBasicMenu.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
static TOOL_ACTION drawLine
Definition: pl_actions.h:67
static TOOL_ACTION placeImage
Definition: pl_actions.h:65
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
static SELECTION_CONDITION Idle
static TOOL_ACTION placeText
Definition: pl_actions.h:64
PL_EDITOR_FRAME * m_frame
static TOOL_ACTION drawRectangle
Definition: pl_actions.h:66
void AddSeparator(int aOrder=ANY_ORDER)
Function AddSeparator()
static TOOL_ACTION appendImportedWorksheet
Definition: pl_actions.h:68

References CONDITIONAL_MENU::AddSeparator(), EDA_DRAW_FRAME::AddStandardSubMenus(), PL_ACTIONS::appendImportedWorksheet, PL_ACTIONS::drawLine, PL_ACTIONS::drawRectangle, TOOL_MENU::GetMenu(), PL_CONDITIONS::Idle, m_frame, TOOL_INTERACTIVE::m_menu, PL_ACTIONS::placeImage, and PL_ACTIONS::placeText.

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing)

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

◆ Main()

int PL_SELECTION_TOOL::Main ( const TOOL_EVENT aEvent)

Function Main()

The main loop.

Definition at line 110 of file pl_selection_tool.cpp.

111 {
112  // Main loop: keep receiving events
113  while( TOOL_EVENT* evt = Wait() )
114  {
115  if( m_frame->ToolStackIsEmpty() )
116  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
117 
119 
120  if( evt->Modifier( MD_SHIFT ) && evt->Modifier( MD_CTRL ) )
121  m_subtractive = true;
122  else if( evt->Modifier( MD_SHIFT ) )
123  m_additive = true;
124  else if( evt->Modifier( MD_CTRL ) )
125  m_exclusive_or = true;
126 
127  // Is the user requesting that the selection list include all possible
128  // items without removing less likely selection candidates
129  m_skip_heuristics = !!evt->Modifier( MD_ALT );
130 
131  // Single click? Select single object
132  if( evt->IsClick( BUT_LEFT ) )
133  {
134  SelectPoint( evt->Position());
135  }
136 
137  // right click? if there is any object - show the context menu
138  else if( evt->IsClick( BUT_RIGHT ) )
139  {
140  bool selectionCancelled = false;
141 
142  if( m_selection.Empty() )
143  {
144  SelectPoint( evt->Position(), &selectionCancelled );
145  m_selection.SetIsHover( true );
146  }
147 
148  if( !selectionCancelled )
150  }
151 
152  // double click? Display the properties window
153  else if( evt->IsDblClick( BUT_LEFT ) )
154  {
155  // No double-click actions currently defined
156  }
157 
158  // drag with LMB? Select multiple objects (or at least draw a selection box) or drag them
159  else if( evt->IsDrag( BUT_LEFT ) )
160  {
162  {
163  selectMultiple();
164  }
165  else
166  {
167  // Check if dragging has started within any of selected items bounding box
168  if( selectionContains( evt->Position() ) )
169  {
170  // Yes -> run the move tool and wait till it finishes
171  m_toolMgr->InvokeTool( "plEditor.InteractiveEdit" );
172  }
173  else
174  {
175  // No -> clear the selection list
176  ClearSelection();
177  }
178  }
179  }
180 
181  else if( evt->IsCancelInteractive() )
182  {
183  ClearSelection();
184  }
185 
186  else if( evt->Action() == TA_UNDO_REDO_PRE )
187  {
188  ClearSelection();
189  }
190 
191  else
192  evt->SetPassEvent();
193  }
194 
195  // This tool is supposed to be active forever
196  assert( false );
197 
198  return 0;
199 }
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
PL_EDITOR_FRAME * m_frame
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
bool selectionContains(const VECTOR2I &aPoint) const
Function selectionContains()
Class TOOL_EVENT.
Definition: tool_event.h:171
EDA_ITEM * SelectPoint(const VECTOR2I &aWhere, bool *aSelectionCancelledFlag=nullptr)
Function selectPoint() Selects an item pointed by the parameter aWhere.
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119
PL_SELECTION m_selection
bool ToolStackIsEmpty()
bool selectMultiple()
Function selectMultiple() Handles drawing a selection box that allows one to select many items at the...
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59

References BUT_LEFT, BUT_RIGHT, ClearSelection(), SELECTION::Empty(), PL_EDITOR_FRAME::GetCanvas(), TOOL_MANAGER::InvokeTool(), m_additive, m_exclusive_or, m_frame, TOOL_INTERACTIVE::m_menu, m_selection, m_skip_heuristics, m_subtractive, TOOL_BASE::m_toolMgr, MD_ALT, MD_CTRL, MD_SHIFT, selectionContains(), selectMultiple(), SelectPoint(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), SELECTION::SetIsHover(), TOOL_MENU::ShowContextMenu(), TA_UNDO_REDO_PRE, EDA_BASE_FRAME::ToolStackIsEmpty(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ RebuildSelection()

void PL_SELECTION_TOOL::RebuildSelection ( )

Rebuild the selection from the flags in the view items.

Useful after a hard redraw or an undo or redo operation.

Definition at line 508 of file pl_selection_tool.cpp.

509 {
510  m_selection.Clear();
511 
512  for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
513  {
514  for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
515  {
516  if( item->IsSelected() )
517  select( item );
518  }
519  }
520 }
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:93
Work sheet structure type definitions.
Definition: ws_data_item.h:93
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
PL_SELECTION m_selection

References SELECTION::Clear(), WS_DATA_MODEL::GetTheInstance(), m_selection, and select().

Referenced by PL_DRAW_PANEL_GAL::DisplayWorksheet(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), PL_EDIT_TOOL::Paste(), and PL_EDITOR_FRAME::RollbackFromUndo().

◆ RemoveItemFromSel() [1/2]

int PL_SELECTION_TOOL::RemoveItemFromSel ( const TOOL_EVENT aEvent)

Definition at line 448 of file pl_selection_tool.cpp.

449 {
450  RemoveItemFromSel( aEvent.Parameter<EDA_ITEM*>() );
451  return 0;
452 }
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163

References TOOL_EVENT::Parameter().

Referenced by PL_EDIT_TOOL::DoDelete(), and setTransitions().

◆ RemoveItemFromSel() [2/2]

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

Definition at line 455 of file pl_selection_tool.cpp.

456 {
457  if( aItem )
458  {
459  unselect( aItem );
460 
461  // Inform other potentially interested tools
462  if( !aQuietMode )
464  }
465 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:198
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
void unselect(EDA_ITEM *aItem)
Function unselect() Takes necessary action mark an item as unselected.

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

◆ RemoveItemsFromSel() [1/2]

int PL_SELECTION_TOOL::RemoveItemsFromSel ( const TOOL_EVENT aEvent)

Definition at line 468 of file pl_selection_tool.cpp.

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

References TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ RemoveItemsFromSel() [2/2]

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

Definition at line 475 of file pl_selection_tool.cpp.

476 {
477  if( aList )
478  {
479  for( EDA_ITEM* item : *aList )
480  unselect( item );
481 
482  // Inform other potentially interested tools
483  if( !aQuietMode )
485  }
486 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:198
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
void unselect(EDA_ITEM *aItem)
Function unselect() Takes necessary action mark an item as unselected.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163

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

◆ RequestSelection()

PL_SELECTION & PL_SELECTION_TOOL::RequestSelection ( )

Function RequestSelection()

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

Definition at line 290 of file pl_selection_tool.cpp.

291 {
292  // If nothing is selected do a hover selection
293  if( m_selection.Empty() )
294  {
295  VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true );
296 
297  ClearSelection();
298  SelectPoint( cursorPos );
299  m_selection.SetIsHover( true );
300  }
301 
302  return m_selection;
303 }
void SetIsHover(bool aIsHover)
Definition: selection.h:64
EDA_ITEM * SelectPoint(const VECTOR2I &aWhere, bool *aSelectionCancelledFlag=nullptr)
Function selectPoint() Selects an item pointed by the parameter aWhere.
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:119
PL_SELECTION m_selection
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

References ClearSelection(), SELECTION::Empty(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_BASE::getViewControls(), m_selection, SelectPoint(), and SELECTION::SetIsHover().

Referenced by PL_EDIT_TOOL::Copy(), PL_EDIT_TOOL::DoDelete(), and PL_EDIT_TOOL::Main().

◆ Reset()

void PL_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 88 of file pl_selection_tool.cpp.

89 {
90  if( aReason == MODEL_RELOAD )
91  m_frame = getEditFrame<PL_EDITOR_FRAME>();
92 }
Model changes (required full reload)
Definition: tool_base.h:82
PL_EDITOR_FRAME * m_frame

References m_frame, and TOOL_BASE::MODEL_RELOAD.

◆ RunMainStack()

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

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

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

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

Referenced by DRAWING_TOOL::PlaceText().

◆ select()

void PL_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 632 of file pl_selection_tool.cpp.

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

References highlight(), m_selection, and SELECTED.

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

◆ selectionContains()

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

Function selectionContains()

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

Definition at line 672 of file pl_selection_tool.cpp.

673 {
674  const unsigned GRIP_MARGIN = 20;
675  VECTOR2I margin = getView()->ToWorld( VECTOR2I( GRIP_MARGIN, GRIP_MARGIN ), false );
676 
677  // Check if the point is located within any of the currently selected items bounding boxes
678  for( auto item : m_selection )
679  {
680  BOX2I itemBox = item->ViewBBox();
681  itemBox.Inflate( margin.x, margin.y ); // Give some margin for gripping an item
682 
683  if( itemBox.Contains( aPoint ) )
684  return true;
685  }
686 
687  return false;
688 }
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:475
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
bool Contains(const Vec &aPoint) const
Function Contains.
Definition: box2.h:149
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:300
PL_SELECTION m_selection

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

Referenced by Main().

◆ SelectionMenu()

int PL_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 523 of file pl_selection_tool.cpp.

524 {
525  COLLECTOR* collector = aEvent.Parameter<COLLECTOR*>();
526 
527  if( !doSelectionMenu( collector ) )
528  collector->m_MenuCancelled = true;
529 
530  return 0;
531 }
bool m_MenuCancelled
Definition: collector.h:71
bool doSelectionMenu(COLLECTOR *aItems)
Allows the selection of a single item from a list via pop-up menu.
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
Class COLLECTOR is an abstract class that will find and hold all the objects according to an inspecti...
Definition: collector.h:55

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

Referenced by setTransitions().

◆ selectMultiple()

bool PL_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 306 of file pl_selection_tool.cpp.

307 {
308  bool cancelled = false; // Was the tool cancelled while it was running?
309  m_multiple = true; // Multiple selection mode is active
310  KIGFX::VIEW* view = getView();
311 
313  view->Add( &area );
314 
315  while( TOOL_EVENT* evt = Wait() )
316  {
317  if( evt->IsCancelInteractive() || evt->IsActivate() )
318  {
319  cancelled = true;
320  break;
321  }
322 
323  if( evt->IsDrag( BUT_LEFT ) )
324  {
326  ClearSelection();
327 
328  // Start drawing a selection box
329  area.SetOrigin( evt->DragOrigin() );
330  area.SetEnd( evt->Position() );
331  area.SetAdditive( m_additive );
334 
335  view->SetVisible( &area, true );
336  view->Update( &area );
337  getViewControls()->SetAutoPan( true );
338  }
339 
340  if( evt->IsMouseUp( BUT_LEFT ) )
341  {
342  getViewControls()->SetAutoPan( false );
343 
344  // End drawing the selection box
345  view->SetVisible( &area, false );
346 
347  int width = area.GetEnd().x - area.GetOrigin().x;
348  int height = area.GetEnd().y - area.GetOrigin().y;
349 
350  /* Selection mode depends on direction of drag-selection:
351  * Left > Right : Select objects that are fully enclosed by selection
352  * Right > Left : Select objects that are crossed by selection
353  */
354  bool windowSelection = width >= 0 ? true : false;
355  bool anyAdded = false;
356  bool anySubtracted = false;
357 
358  // Construct an EDA_RECT to determine EDA_ITEM selection
359  EDA_RECT selectionRect( (wxPoint)area.GetOrigin(), wxSize( width, height ) );
360 
361  selectionRect.Normalize();
362 
363  for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
364  {
365  for( WS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
366  {
367  if( item->HitTest( selectionRect, windowSelection ) )
368  {
369  if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
370  {
371  unselect( item );
372  anySubtracted = true;
373  }
374  else
375  {
376  select( item );
377  anyAdded = true;
378  }
379  }
380  }
381  }
382 
383  // Inform other potentially interested tools
384  if( anyAdded )
386 
387  if( anySubtracted )
389 
390  break; // Stop waiting for events
391  }
392  }
393 
394  getViewControls()->SetAutoPan( false );
395 
396  // Stop drawing the selection box
397  view->Remove( &area );
398  m_multiple = false; // Multiple selection mode is inactive
399 
400  if( !cancelled )
402 
403  return cancelled;
404 }
void ClearReferencePoint()
Definition: selection.h:248
static const TOOL_EVENT SelectedEvent
Definition: actions.h:197
void SetEnd(VECTOR2I aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
Work sheet structure type definitions.
Definition: ws_data_item.h:93
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:198
void SetOrigin(VECTOR2I aOrigin)
Set the origin of the rectange (the fixed corner)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
void SetExclusiveOr(bool aExclusiveOr)
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
void SetAdditive(bool aAdditive)
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 TOOL_EVENT.
Definition: tool_event.h:171
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
void SetSubtractive(bool aSubtractive)
void Normalize()
Function Normalize ensures that the height ant width are positive.
PL_SELECTION m_selection
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Sets the item visibility.
Definition: view.cpp:1486
Class SELECTION_AREA.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
Class VIEW.
Definition: view.h:61

References KIGFX::VIEW::Add(), BUT_LEFT, SELECTION::ClearReferencePoint(), ClearSelection(), KIGFX::PREVIEW::SELECTION_AREA::GetEnd(), KIGFX::PREVIEW::SELECTION_AREA::GetOrigin(), WS_DATA_MODEL::GetTheInstance(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), m_additive, m_exclusive_or, m_multiple, m_selection, m_subtractive, TOOL_BASE::m_toolMgr, EDA_RECT::Normalize(), TOOL_MANAGER::ProcessEvent(), KIGFX::VIEW::Remove(), select(), EVENTS::SelectedEvent, KIGFX::PREVIEW::SELECTION_AREA::SetAdditive(), KIGFX::VIEW_CONTROLS::SetAutoPan(), KIGFX::PREVIEW::SELECTION_AREA::SetEnd(), KIGFX::PREVIEW::SELECTION_AREA::SetExclusiveOr(), KIGFX::PREVIEW::SELECTION_AREA::SetOrigin(), KIGFX::PREVIEW::SELECTION_AREA::SetSubtractive(), KIGFX::VIEW::SetVisible(), unselect(), EVENTS::UnselectedEvent, KIGFX::VIEW::Update(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Main().

◆ SelectPoint()

EDA_ITEM * PL_SELECTION_TOOL::SelectPoint ( const VECTOR2I aWhere,
bool *  aSelectionCancelledFlag = nullptr 
)

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

Definition at line 208 of file pl_selection_tool.cpp.

209 {
210  int threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
211 
212  // locate items.
213  COLLECTOR collector;
214 
215  for( WS_DATA_ITEM* dataItem : WS_DATA_MODEL::GetTheInstance().GetItems() )
216  {
217  for( WS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
218  {
219  if( drawItem->HitTest( (wxPoint) aWhere, threshold ) )
220  collector.Append( drawItem );
221  }
222  }
223 
225 
226  // Apply some ugly heuristics to avoid disambiguation menus whenever possible
227  if( collector.GetCount() > 1 && !m_skip_heuristics )
228  {
229  guessSelectionCandidates( collector, aWhere );
230  }
231 
232  // If still more than one item we're going to have to ask the user.
233  if( collector.GetCount() > 1 )
234  {
235  collector.m_MenuTitle = _( "Clarify Selection" );
236 
237  // Must call selectionMenu via RunAction() to avoid event-loop contention
238  m_toolMgr->RunAction( PL_ACTIONS::selectionMenu, true, &collector );
239 
240  if( collector.m_MenuCancelled )
241  {
242  if( aSelectionCancelledFlag )
243  *aSelectionCancelledFlag = true;
244 
245  return nullptr;
246  }
247  }
248 
250  ClearSelection();
251 
252  if( collector.GetCount() == 1 )
253  {
254  EDA_ITEM* item = collector[ 0 ];
255 
256  if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
257  {
258  unselect( item );
260  return nullptr;
261  }
262  else
263  {
264  select( item );
266  return item;
267  }
268  }
269 
270  return nullptr;
271 }
void ClearReferencePoint()
Definition: selection.h:248
static const TOOL_EVENT SelectedEvent
Definition: actions.h:197
Work sheet structure type definitions.
Definition: ws_data_item.h:93
bool IsSelected() const
Definition: base_struct.h:233
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:198
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
static WS_DATA_MODEL & GetTheInstance()
static function: returns the instance of WS_DATA_MODEL used in the application
void Append(EDA_ITEM *item)
Function Append adds an item to the end of the list.
Definition: collector.h:132
bool m_MenuCancelled
Definition: collector.h:71
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:113
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.
void guessSelectionCandidates(COLLECTOR &collector, const VECTOR2I &aWhere)
Apply heuristics to try and determine a single object when multiple are found under the cursor.
static TOOL_ACTION selectionMenu
Runs a selection menu to select from a list of items.
Definition: pl_actions.h:60
#define _(s)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
wxString m_MenuTitle
Definition: collector.h:70
PL_SELECTION m_selection
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
Class COLLECTOR is an abstract class that will find and hold all the objects according to an inspecti...
Definition: collector.h:55
#define HITTEST_THRESHOLD_PIXELS
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:114

References _, COLLECTOR::Append(), SELECTION::ClearReferencePoint(), ClearSelection(), COLLECTOR::GetCount(), WS_DATA_MODEL::GetTheInstance(), TOOL_BASE::getView(), guessSelectionCandidates(), HITTEST_THRESHOLD_PIXELS, EDA_ITEM::IsSelected(), KiROUND(), m_additive, m_exclusive_or, COLLECTOR::m_MenuCancelled, COLLECTOR::m_MenuTitle, m_selection, m_skip_heuristics, m_subtractive, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), TOOL_MANAGER::RunAction(), select(), EVENTS::SelectedEvent, PL_ACTIONS::selectionMenu, unselect(), and EVENTS::UnselectedEvent.

Referenced by Main(), and RequestSelection().

◆ SetContextMenu()

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

Function SetContextMenu()

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

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

Definition at line 76 of file tool_interactive.cpp.

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

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setTransitions()

void PL_SELECTION_TOOL::setTransitions ( )
overrideprivatevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 691 of file pl_selection_tool.cpp.

692 {
694 
697 
703 }
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
static TOOL_ACTION addItemsToSel
Selects a list of items (specified as the event parameter)
Definition: pl_actions.h:56
int UpdateMenu(const TOOL_EVENT &aEvent)
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
int AddItemToSel(const TOOL_EVENT &aEvent)
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: pl_actions.h:46
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
Definition: pl_actions.h:52
static TOOL_ACTION removeItemsFromSel
Definition: pl_actions.h:57
int RemoveItemsFromSel(const TOOL_EVENT &aEvent)
int SelectionMenu(const TOOL_EVENT &aEvent)
Function SelectionMenu() Shows a popup menu to trim the COLLECTOR passed as aEvent's parameter down t...
static TOOL_ACTION selectionMenu
Runs a selection menu to select from a list of items.
Definition: pl_actions.h:60
static TOOL_ACTION updateMenu
Definition: actions.h:158
static TOOL_ACTION clearSelection
Clears the current selection.
Definition: pl_actions.h:49
static TOOL_ACTION removeItemFromSel
Definition: pl_actions.h:53
int Main(const TOOL_EVENT &aEvent)
Function Main()
int AddItemsToSel(const TOOL_EVENT &aEvent)

References PL_ACTIONS::addItemsToSel, AddItemsToSel(), PL_ACTIONS::addItemToSel, AddItemToSel(), PL_ACTIONS::clearSelection, ClearSelection(), TOOL_INTERACTIVE::Go(), Main(), PL_ACTIONS::removeItemFromSel, RemoveItemFromSel(), PL_ACTIONS::removeItemsFromSel, RemoveItemsFromSel(), PL_ACTIONS::selectionActivate, PL_ACTIONS::selectionMenu, SelectionMenu(), UpdateMenu(), and ACTIONS::updateMenu.

◆ UnbrightenItem()

void PL_SELECTION_TOOL::UnbrightenItem ( EDA_ITEM aItem)

Definition at line 495 of file pl_selection_tool.cpp.

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

References BRIGHTENED, and unhighlight().

Referenced by PL_EDIT_TOOL::DeleteItemCursor().

◆ unhighlight()

void PL_SELECTION_TOOL::unhighlight ( EDA_ITEM aItem,
int  aHighlightMode,
PL_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 658 of file pl_selection_tool.cpp.

659 {
660  if( aMode == SELECTED )
661  aItem->ClearSelected();
662  else if( aMode == BRIGHTENED )
663  aItem->ClearBrightened();
664 
665  if( aGroup )
666  aGroup->Remove( aItem );
667 
668  getView()->Update( aItem );
669 }
void ClearSelected()
Definition: base_struct.h:243
void ClearBrightened()
Definition: base_struct.h:245
#define SELECTED
Definition: base_struct.h:127
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.h:85

References BRIGHTENED, EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearSelected(), TOOL_BASE::getView(), SELECTION::Remove(), SELECTED, and KIGFX::VIEW::Update().

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

◆ unselect()

void PL_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 638 of file pl_selection_tool.cpp.

639 {
640  unhighlight( aItem, SELECTED, &m_selection );
641 }
#define SELECTED
Definition: base_struct.h:127
PL_SELECTION m_selection
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
Function unhighlight() Unhighlights the item visually.

References m_selection, SELECTED, and unhighlight().

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

◆ UpdateMenu()

int PL_SELECTION_TOOL::UpdateMenu ( const TOOL_EVENT aEvent)

Definition at line 95 of file pl_selection_tool.cpp.

96 {
97  ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
98  CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
99 
100  if( conditionalMenu )
101  conditionalMenu->Evaluate( m_selection );
102 
103  if( actionMenu )
104  actionMenu->UpdateAll();
105 
106  return 0;
107 }
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:435
PL_SELECTION m_selection

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

Referenced by setTransitions().

◆ Wait()

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

Function Wait()

Suspends execution of the tool until an event specified in aEventList arrives. No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

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

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_additive

bool PL_SELECTION_TOOL::m_additive
private

Definition at line 198 of file pl_selection_tool.h.

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

◆ m_exclusive_or

bool PL_SELECTION_TOOL::m_exclusive_or
private

Definition at line 200 of file pl_selection_tool.h.

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

◆ m_frame

PL_EDITOR_FRAME* PL_SELECTION_TOOL::m_frame
private

Definition at line 195 of file pl_selection_tool.h.

Referenced by doSelectionMenu(), Init(), Main(), and Reset().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), SCH_EDIT_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), LIB_DRAWING_TOOLS::Init(), MODULE_EDITOR_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), Init(), EE_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), EDIT_TOOL::Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::Main(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_multiple

bool PL_SELECTION_TOOL::m_multiple
private

Definition at line 201 of file pl_selection_tool.h.

Referenced by selectMultiple().

◆ m_selection

◆ m_skip_heuristics

bool PL_SELECTION_TOOL::m_skip_heuristics
private

Definition at line 202 of file pl_selection_tool.h.

Referenced by Main(), and SelectPoint().

◆ m_subtractive

bool PL_SELECTION_TOOL::m_subtractive
private

Definition at line 199 of file pl_selection_tool.h.

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

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

Definition at line 214 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 219 of file tool_base.h.

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

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_toolSettings

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 220 of file tool_base.h.

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

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 211 of file tool_base.h.

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


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