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 }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 PL_SELECTION_TOOL ()
 
 ~PL_SELECTION_TOOL () override
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
int UpdateMenu (const TOOL_EVENT &aEvent)
 
int Main (const TOOL_EVENT &aEvent)
 The main loop. More...
 
PL_SELECTIONGetSelection ()
 Return the set of currently selected items. More...
 
PL_SELECTIONRequestSelection ()
 Return either an existing selection (filtered), or the selection at the current cursor if the existing selection is empty. More...
 
void SelectPoint (const VECTOR2I &aWhere, bool *aSelectionCancelledFlag=nullptr)
 Select 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)
 Shows a popup menu to trim the COLLECTOR passed as aEvent's parameter down to a single item. More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

TOOL_MENU m_menu
 The functions below are not yet implemented - their interface may change. More...
 
TOOL_TYPE m_type
 Unique identifier for the tool, assigned by a TOOL_MANAGER instance. More...
 
TOOL_ID m_toolId
 Name of the tool. More...
 
std::string m_toolName
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

bool selectMultiple ()
 Handle 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)
 Allow the selection of a single item from a list via pop-up menu. More...
 
void select (EDA_ITEM *aItem)
 Takes necessary action mark an item as selected. More...
 
void unselect (EDA_ITEM *aItem)
 Take necessary action mark an item as unselected. More...
 
void highlight (EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
 Highlight the item visually. More...
 
void unhighlight (EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
 Unhighlight the item visually. More...
 
bool selectionContains (const VECTOR2I &aPoint) const
 Set up handlers for various events. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 

Private Attributes

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 42 of file pl_selection_tool.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 78 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ PL_SELECTION_TOOL()

PL_SELECTION_TOOL::PL_SELECTION_TOOL ( )

Definition at line 51 of file pl_selection_tool.cpp.

51  :
52  TOOL_INTERACTIVE( "plEditor.InteractiveSelection" ),
53  m_frame( nullptr ),
54  m_additive( false ),
55  m_subtractive( false ),
56  m_exclusive_or( false ),
57  m_multiple( false ),
58  m_skip_heuristics( false )
59 {
60 }
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.
PL_EDITOR_FRAME * m_frame

◆ ~PL_SELECTION_TOOL()

PL_SELECTION_TOOL::~PL_SELECTION_TOOL ( )
inlineoverride

Definition at line 46 of file pl_selection_tool.h.

46 { }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

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

Definition at line 51 of file tool_interactive.cpp.

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

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

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

◆ AddItemsToSel() [1/2]

int PL_SELECTION_TOOL::AddItemsToSel ( const TOOL_EVENT aEvent)

Definition at line 506 of file pl_selection_tool.cpp.

507 {
508  AddItemsToSel( aEvent.Parameter<EDA_ITEMS*>(), false );
509  return 0;
510 }
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:443
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:557
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 513 of file pl_selection_tool.cpp.

514 {
515  if( aList )
516  {
517  for( EDA_ITEM* item : *aList )
518  select( item );
519 
520  // Inform other potentially interested tools
521  if( !aQuietMode )
523  }
524 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:201
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void select(EDA_ITEM *aItem)
Takes necessary action mark an item as selected.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150

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 486 of file pl_selection_tool.cpp.

487 {
488  AddItemToSel( aEvent.Parameter<EDA_ITEM*>() );
489  return 0;
490 }
int AddItemToSel(const TOOL_EVENT &aEvent)
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:443
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150

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 493 of file pl_selection_tool.cpp.

494 {
495  if( aItem )
496  {
497  select( aItem );
498 
499  // Inform other potentially interested tools
500  if( !aQuietMode )
502  }
503 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:201
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void select(EDA_ITEM *aItem)
Takes necessary action mark an item as selected.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).

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

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

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

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ BrightenItem()

void PL_SELECTION_TOOL::BrightenItem ( EDA_ITEM aItem)

Definition at line 568 of file pl_selection_tool.cpp.

569 {
570  highlight( aItem, BRIGHTENED );
571 }
#define BRIGHTENED
item is drawn with a bright contour
Definition: eda_item.h:131
void highlight(EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
Highlight 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 749 of file pl_selection_tool.cpp.

750 {
751  if( m_selection.Empty() )
752  return;
753 
754  while( m_selection.GetSize() )
756 
757  getView()->Update( &m_selection );
758 
759  m_selection.SetIsHover( false );
761 
762  // Inform other potentially interested tools
764 }
void ClearReferencePoint()
Definition: selection.h:269
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void SetIsHover(bool aIsHover)
Definition: selection.h:67
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
#define SELECTED
Definition: eda_item.h:114
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
Definition: actions.h:203
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:122
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:101
PL_SELECTION m_selection
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
Unhighlight the item visually.
EDA_ITEM * Front() const
Definition: selection.h:203
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1503

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

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

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

Returns
true if an item was picked.

Definition at line 613 of file pl_selection_tool.cpp.

614 {
615  EDA_ITEM* current = nullptr;
616  ACTION_MENU menu( true );
617 
618  // ID limit is `MAX_SELECT_ITEM_IDS+1` because the last item is "select all"
619  // and the first item has ID of 1.
620  int limit = std::min( MAX_SELECT_ITEM_IDS + 1, aCollector->GetCount() );
621 
622  for( int i = 0; i < limit; ++i )
623  {
624  wxString text;
625  EDA_ITEM* item = ( *aCollector )[i];
627 
628  wxString menuText = wxString::Format( "&%d. %s\t%d", i + 1, text, i + 1 );
629  menu.Add( menuText, i + 1, item->GetMenuImage() );
630  }
631 
632  menu.AppendSeparator();
633  menu.Add( _( "Select &All\tA" ), limit + 1, BITMAPS::INVALID_BITMAP );
634 
635  if( aCollector->m_MenuTitle.Length() )
636  {
637  menu.SetTitle( aCollector->m_MenuTitle );
638  menu.SetIcon( BITMAPS::info );
639  menu.DisplayTitle( true );
640  }
641  else
642  {
643  menu.DisplayTitle( false );
644  }
645 
646  SetContextMenu( &menu, CMENU_NOW );
647 
648  bool selectAll = false;
649 
650  while( TOOL_EVENT* evt = Wait() )
651  {
652  if( evt->Action() == TA_CHOICE_MENU_UPDATE )
653  {
654  if( selectAll )
655  {
656  for( int i = 0; i < aCollector->GetCount(); ++i )
657  unhighlight( ( *aCollector )[i], BRIGHTENED );
658  }
659  else if( current )
660  {
661  unhighlight( current, BRIGHTENED );
662  }
663 
664  int id = *evt->GetCommandId();
665 
666  // User has pointed an item, so show it in a different way
667  if( id > 0 && id <= limit )
668  {
669  current = ( *aCollector )[id - 1];
670  highlight( current, BRIGHTENED );
671  }
672  else
673  {
674  current = nullptr;
675  }
676 
677  if( id == limit + 1 )
678  {
679  for( int i = 0; i < aCollector->GetCount(); ++i )
680  highlight( ( *aCollector )[i], BRIGHTENED );
681 
682  selectAll = true;
683  }
684  else
685  {
686  selectAll = false;
687  }
688  }
689  else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
690  {
691  if( selectAll )
692  {
693  for( int i = 0; i < aCollector->GetCount(); ++i )
694  unhighlight( ( *aCollector )[i], BRIGHTENED );
695  }
696  else if( current )
697  {
698  unhighlight( current, BRIGHTENED );
699  }
700 
701  OPT<int> id = evt->GetCommandId();
702 
703  // User has selected an item, so this one will be returned
704  if( id == limit + 1 )
705  {
706  selectAll = true;
707  current = nullptr;
708  }
709  else if( id && ( *id > 0 ) && ( *id <= limit ) )
710  {
711  selectAll = false;
712  current = ( *aCollector )[*id - 1];
713  }
714  else
715  {
716  selectAll = false;
717  current = nullptr;
718  }
719  }
720  else if( evt->Action() == TA_CHOICE_MENU_CLOSED )
721  {
722  break;
723  }
724 
725  getView()->UpdateItems();
726  m_frame->GetCanvas()->Refresh();
727  }
728 
729  if( selectAll )
730  {
731  return true;
732  }
733  else if( current )
734  {
735  unhighlight( current, BRIGHTENED );
736 
737  getView()->UpdateItems();
738  m_frame->GetCanvas()->Refresh();
739 
740  aCollector->Empty();
741  aCollector->Append( current );
742  return true;
743  }
744 
745  return false;
746 }
#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))
Suspend execution of the tool until an event specified in aEventList arrives.
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:47
void SetContextMenu(ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Assign a context menu and tells when it should be activated.
PL_EDITOR_FRAME * m_frame
#define BRIGHTENED
item is drawn with a bright contour
Definition: eda_item.h:131
Generic, UI-independent tool event.
Definition: tool_event.h:173
void UpdateItems()
Iterate through the list of items that asked for updating and updates them.
Definition: view.cpp:1397
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
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, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
#define _(s)
Definition: 3d_actions.cpp:33
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: eda_item.cpp:107
virtual BITMAPS GetMenuImage() const
Return a pointer to an image to be used in menus.
Definition: eda_item.cpp:206
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
void highlight(EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
Highlight the item visually.
boost::optional< T > OPT
Definition: optional.h:7
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
Unhighlight the item visually.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

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(), info, INVALID_BITMAP, m_frame, COLLECTOR::m_MenuTitle, MAX_SELECT_ITEM_IDS, EDA_DRAW_PANEL_GAL::Refresh(), TOOL_INTERACTIVE::SetContextMenu(), ACTION_MENU::SetIcon(), ACTION_MENU::SetTitle(), TA_CHOICE_MENU_CHOICE, TA_CHOICE_MENU_CLOSED, TA_CHOICE_MENU_UPDATE, text, unhighlight(), KIGFX::VIEW::UpdateItems(), and TOOL_INTERACTIVE::Wait().

Referenced by SelectionMenu().

◆ getEditFrame()

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

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

Definition at line 185 of file tool_base.h.

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

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 144 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 197 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Return the name of the tool.

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

Returns
The name of the tool.

Definition at line 134 of file tool_base.h.

135  {
136  return m_toolName;
137  }
std::string m_toolName
Definition: tool_base.h:214

References TOOL_BASE::m_toolName.

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

◆ GetSelection()

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

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

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

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

◆ getViewControls()

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

Return the instance of VIEW_CONTROLS object used in the application.

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

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

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

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

◆ Go()

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

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

No conditions means any event.

Definition at line 128 of file tool_interactive.h.

130 {
131  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
132 
133  goInternal( sptr, aConditions );
134 }
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 AUTOPLACE_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), PCB_CONTROL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), DRC_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), and EE_SELECTION_TOOL::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 348 of file pl_selection_tool.cpp.

349 {
350  // There are certain conditions that can be handled automatically.
351 
352  // Prefer an exact hit to a sloppy one
353  for( int i = 0; collector.GetCount() == 2 && i < 2; ++i )
354  {
355  EDA_ITEM* item = collector[ i ];
356  EDA_ITEM* other = collector[ ( i + 1 ) % 2 ];
357 
358  if( item->HitTest( (wxPoint) aPos, 0 ) && !other->HitTest( (wxPoint) aPos, 0 ) )
359  collector.Transfer( other );
360  }
361 }
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Test if aPosition is contained within or on the bounding box of an item.
Definition: eda_item.h:275
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
void Transfer(int aIndex)
Move the item at aIndex (first position is 0) to the backup list.
Definition: collector.h:159
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150

References COLLECTOR::GetCount(), EDA_ITEM::HitTest(), and COLLECTOR::Transfer().

Referenced by SelectPoint().

◆ highlight()

void PL_SELECTION_TOOL::highlight ( EDA_ITEM aItem,
int  aHighlightMode,
PL_SELECTION aGroup = nullptr 
)
private

Highlight the item visually.

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

Definition at line 779 of file pl_selection_tool.cpp.

780 {
781  if( aMode == SELECTED )
782  aItem->SetSelected();
783  else if( aMode == BRIGHTENED )
784  aItem->SetBrightened();
785 
786  if( aGroup )
787  aGroup->Add( aItem );
788 
789  getView()->Update( aItem );
790 }
void SetBrightened()
Definition: eda_item.h:180
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:77
#define BRIGHTENED
item is drawn with a bright contour
Definition: eda_item.h:131
void SetSelected()
Definition: eda_item.h:179
#define SELECTED
Definition: eda_item.h:114
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1503

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

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 63 of file pl_selection_tool.cpp.

64 {
65  m_frame = getEditFrame<PL_EDITOR_FRAME>();
66 
67  auto& menu = m_menu.GetMenu();
68 
69  menu.AddSeparator( 200 );
74 
75  menu.AddSeparator( 1000 );
77 
78  return true;
79 }
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
static TOOL_ACTION drawLine
Definition: pl_actions.h:65
static TOOL_ACTION placeImage
Definition: pl_actions.h:63
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
static TOOL_ACTION placeText
Definition: pl_actions.h:62
PL_EDITOR_FRAME * m_frame
static TOOL_ACTION drawRectangle
Definition: pl_actions.h:64
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
static bool Empty(const SELECTION &aSelection)
Test if there are no items selected.

References CONDITIONAL_MENU::AddSeparator(), EDA_DRAW_FRAME::AddStandardSubMenus(), PL_ACTIONS::drawLine, PL_ACTIONS::drawRectangle, SELECTION_CONDITIONS::Empty(), TOOL_MENU::GetMenu(), 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:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

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

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

◆ Main()

int PL_SELECTION_TOOL::Main ( const TOOL_EVENT aEvent)

The main loop.

Definition at line 104 of file pl_selection_tool.cpp.

105 {
106  // Main loop: keep receiving events
107  while( TOOL_EVENT* evt = Wait() )
108  {
109  // on left click, a selection is made, depending on modifiers ALT, SHIFT, CTRL:
110  // Due to the fact ALT key modifier cannot be useed freely on Winows and Linux,
111  // actions are different on OSX and others OS
112  // Especially, ALT key cannot be used to force showing the full selection choice
113  // context menu (the menu is immediately closed on Windows )
114  //
115  // No modifier = select items and deselect previous selection
116  // ALT (on OSX) = skip heuristic and show full selection choice
117  // ALT (on others) = exclusive OR of selected items (inverse selection)
118  //
119  // CTRL/CMD (on OSX) = exclusive OR of selected items (inverse selection)
120  // CTRL (on others) = skip heuristic and show full selection choice
121  //
122  // SHIFT = add selected items to the current selection
123  //
124  // CTRL/CMD+SHIFT (on OSX) = remove selected items to the current selection
125  // CTRL+SHIFT (on others) = unused (can be used for a new action)
126  //
127  // CTRL/CMT+ALT (on OSX) = unused (can be used for a new action)
128  // CTRL+ALT (on others) = do nothing (same as no modifier)
129  //
130  // SHIFT+ALT (on OSX) = do nothing (same as no modifier)
131  // SHIFT+ALT (on others) = remove selected items to the current selection
132 
133 #ifdef __WXOSX_MAC__
134  m_subtractive = evt->Modifier( MD_CTRL ) &&
135  evt->Modifier( MD_SHIFT ) &&
136  !evt->Modifier( MD_ALT );
137 
138  m_additive = evt->Modifier( MD_SHIFT ) &&
139  !evt->Modifier( MD_CTRL ) &&
140  !evt->Modifier( MD_ALT );
141 
142  m_exclusive_or = evt->Modifier( MD_CTRL ) &&
143  !evt->Modifier( MD_SHIFT ) &&
144  !evt->Modifier( MD_ALT );
145 
146  m_skip_heuristics = evt->Modifier( MD_ALT ) &&
147  !evt->Modifier( MD_SHIFT ) &&
148  !evt->Modifier( MD_CTRL );
149 
150 #else
151  m_subtractive = evt->Modifier( MD_SHIFT )
152  && !evt->Modifier( MD_CTRL )
153  && evt->Modifier( MD_ALT );
154 
155  m_additive = evt->Modifier( MD_SHIFT )
156  && !evt->Modifier( MD_CTRL )
157  && !evt->Modifier( MD_ALT );
158 
159  m_exclusive_or = !evt->Modifier( MD_SHIFT )
160  && !evt->Modifier( MD_CTRL )
161  && evt->Modifier( MD_ALT );
162 
163  // Is the user requesting that the selection list include all possible
164  // items without removing less likely selection candidates
165  // Cannot use the Alt key on windows or the disambiguation context menu is immediately
166  // dismissed rendering it useless.
167  m_skip_heuristics = evt->Modifier( MD_CTRL )
168  && !evt->Modifier( MD_SHIFT )
169  && !evt->Modifier( MD_ALT );
170 #endif
171 
172  bool modifier_enabled = m_subtractive || m_additive || m_exclusive_or;
173 
174  // Single click? Select single object
175  if( evt->IsClick( BUT_LEFT ) )
176  {
177  SelectPoint( evt->Position() );
178  }
179 
180  // right click? if there is any object - show the context menu
181  else if( evt->IsClick( BUT_RIGHT ) )
182  {
183  bool selectionCancelled = false;
184 
185  if( m_selection.Empty() )
186  {
187  SelectPoint( evt->Position(), &selectionCancelled );
188  m_selection.SetIsHover( true );
189  }
190 
191  if( !selectionCancelled )
193  }
194 
195  // double click? Display the properties window
196  else if( evt->IsDblClick( BUT_LEFT ) )
197  {
198  // No double-click actions currently defined
199  }
200 
201  // drag with LMB? Select multiple objects (or at least draw a selection box) or drag them
202  else if( evt->IsDrag( BUT_LEFT ) )
203  {
204  if( modifier_enabled || m_selection.Empty() )
205  {
206  selectMultiple();
207  }
208  else
209  {
210  // Check if dragging has started within any of selected items bounding box
211  if( selectionContains( evt->Position() ) )
212  {
213  // Yes -> run the move tool and wait till it finishes
214  m_toolMgr->RunAction( "plEditor.InteractiveMove.move", true );
215  }
216  else
217  {
218  // No -> clear the selection list
219  ClearSelection();
220  }
221  }
222  }
223 
224  // Middle double click? Do zoom to fit or zoom to objects
225  else if( evt->IsDblClick( BUT_MIDDLE ) )
226  {
228  }
229 
230  else if( evt->IsCancelInteractive() )
231  {
232  ClearSelection();
233  }
234 
235  else if( evt->Action() == TA_UNDO_REDO_PRE )
236  {
237  ClearSelection();
238  }
239 
240  else
241  evt->SetPassEvent();
242 
243 
244  if( m_frame->ToolStackIsEmpty() )
245  {
246  if( !modifier_enabled
247  && !m_selection.Empty()
249  && evt->HasPosition()
250  && selectionContains( evt->Position() ) )
251  {
253  }
254  else
255  {
256  if( m_additive )
258  else if( m_subtractive )
260  else if( m_exclusive_or )
262  else
264  }
265  }
266  }
267 
268  return 0;
269 }
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
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))
Suspend execution of the tool until an event specified in aEventList arrives.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void SelectPoint(const VECTOR2I &aWhere, bool *aSelectionCancelledFlag=nullptr)
Select an item pointed by the parameter aWhere.
PL_EDITOR_FRAME * m_frame
void SetIsHover(bool aIsHover)
Definition: selection.h:67
bool selectionContains(const VECTOR2I &aPoint) const
Set up handlers for various events.
MOUSE_DRAG_ACTION GetDragAction() const
Indicates whether a drag should draw a selection rectangle or drag selected (or unselected) objects.
Definition: tools_holder.h:134
Generic, UI-independent tool event.
Definition: tool_event.h:173
bool ToolStackIsEmpty()
Definition: tools_holder.h:117
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:122
PL_SELECTION m_selection
bool selectMultiple()
Handle drawing a selection box that allows one to select many items at the same time.
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59

References ADD, ARROW, BUT_LEFT, BUT_MIDDLE, BUT_RIGHT, ClearSelection(), DRAG_SELECTED, SELECTION::Empty(), PL_EDITOR_FRAME::GetCanvas(), TOOLS_HOLDER::GetDragAction(), 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, MOVING, TOOL_MANAGER::RunAction(), selectionContains(), selectMultiple(), SelectPoint(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), SELECTION::SetIsHover(), TOOL_MENU::ShowContextMenu(), SUBTRACT, TA_UNDO_REDO_PRE, TOOLS_HOLDER::ToolStackIsEmpty(), TOOL_INTERACTIVE::Wait(), XOR, and ACTIONS::zoomFitScreen.

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 587 of file pl_selection_tool.cpp.

588 {
589  m_selection.Clear();
590 
591  for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
592  {
593  for( DS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
594  {
595  if( item->IsSelected() )
596  select( item );
597  }
598  }
599 }
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:96
void select(EDA_ITEM *aItem)
Takes necessary action mark an item as selected.
Base class to handle basic graphic items.
Definition: ds_draw_item.h:58
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
PL_SELECTION m_selection
Drawing sheet structure type definitions.
Definition: ds_data_item.h:95

References SELECTION::Clear(), DS_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 527 of file pl_selection_tool.cpp.

528 {
529  RemoveItemFromSel( aEvent.Parameter<EDA_ITEM*>() );
530  return 0;
531 }
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:443
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150

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 534 of file pl_selection_tool.cpp.

535 {
536  if( aItem )
537  {
538  unselect( aItem );
539 
540  // Inform other potentially interested tools
541  if( !aQuietMode )
543  }
544 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:202
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
void unselect(EDA_ITEM *aItem)
Take necessary action mark an item as unselected.

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

◆ RemoveItemsFromSel() [1/2]

int PL_SELECTION_TOOL::RemoveItemsFromSel ( const TOOL_EVENT aEvent)

Definition at line 547 of file pl_selection_tool.cpp.

548 {
549  RemoveItemsFromSel( aEvent.Parameter<EDA_ITEMS*>(), false );
550  return 0;
551 }
int RemoveItemsFromSel(const TOOL_EVENT &aEvent)
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:443
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:557

References TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ RemoveItemsFromSel() [2/2]

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

Definition at line 554 of file pl_selection_tool.cpp.

555 {
556  if( aList )
557  {
558  for( EDA_ITEM* item : *aList )
559  unselect( item );
560 
561  // Inform other potentially interested tools
562  if( !aQuietMode )
564  }
565 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:202
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
void unselect(EDA_ITEM *aItem)
Take necessary action mark an item as unselected.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150

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

◆ RequestSelection()

PL_SELECTION & PL_SELECTION_TOOL::RequestSelection ( )

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

Definition at line 364 of file pl_selection_tool.cpp.

365 {
366  // If nothing is selected do a hover selection
367  if( m_selection.Empty() )
368  {
369  VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true );
370 
371  ClearSelection();
372  SelectPoint( cursorPos );
373  m_selection.SetIsHover( true );
374  }
375 
376  return m_selection;
377 }
void SelectPoint(const VECTOR2I &aWhere, bool *aSelectionCancelledFlag=nullptr)
Select an item pointed by the parameter aWhere.
void SetIsHover(bool aIsHover)
Definition: selection.h:67
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:122
PL_SELECTION m_selection
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

References 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

Bring the tool to a known, initial state.

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

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 82 of file pl_selection_tool.cpp.

83 {
84  if( aReason == MODEL_RELOAD )
85  m_frame = getEditFrame<PL_EDITOR_FRAME>();
86 }
Model changes (required full reload)
Definition: tool_base.h:81
PL_EDITOR_FRAME * m_frame

References m_frame, and TOOL_BASE::MODEL_RELOAD.

◆ RunMainStack()

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

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

88 {
89  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
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

Takes necessary action mark an item as selected.

Parameters
aItemis an item to be selected.

Definition at line 767 of file pl_selection_tool.cpp.

768 {
769  highlight( aItem, SELECTED, &m_selection );
770 }
#define SELECTED
Definition: eda_item.h:114
PL_SELECTION m_selection
void highlight(EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
Highlight 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

Set up handlers for various events.

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

Definition at line 807 of file pl_selection_tool.cpp.

808 {
809  const unsigned GRIP_MARGIN = 20;
810  VECTOR2I margin = getView()->ToWorld( VECTOR2I( GRIP_MARGIN, GRIP_MARGIN ), false );
811 
812  // Check if the point is located within any of the currently selected items bounding boxes
813  for( auto item : m_selection )
814  {
815  BOX2I itemBox = item->ViewBBox();
816  itemBox.Inflate( margin.x, margin.y ); // Give some margin for gripping an item
817 
818  if( itemBox.Contains( aPoint ) )
819  return true;
820  }
821 
822  return false;
823 }
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:451
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
bool Contains(const Vec &aPoint) const
Function Contains.
Definition: box2.h:151
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:302
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)

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 602 of file pl_selection_tool.cpp.

603 {
604  COLLECTOR* collector = aEvent.Parameter<COLLECTOR*>();
605 
606  if( !doSelectionMenu( collector ) )
607  collector->m_MenuCancelled = true;
608 
609  return 0;
610 }
bool m_MenuCancelled
Definition: collector.h:251
bool doSelectionMenu(COLLECTOR *aItems)
Allow the selection of a single item from a list via pop-up menu.
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:443
An abstract class that will find and hold all the objects according to an inspection done by the Insp...
Definition: collector.h:53

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

Referenced by setTransitions().

◆ selectMultiple()

bool PL_SELECTION_TOOL::selectMultiple ( )
private

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

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

Definition at line 380 of file pl_selection_tool.cpp.

381 {
382  bool cancelled = false; // Was the tool cancelled while it was running?
383  m_multiple = true; // Multiple selection mode is active
384  KIGFX::VIEW* view = getView();
385 
387  view->Add( &area );
388 
389  while( TOOL_EVENT* evt = Wait() )
390  {
391  int width = area.GetEnd().x - area.GetOrigin().x;
392 
393  /* Selection mode depends on direction of drag-selection:
394  * Left > Right : Select objects that are fully enclosed by selection
395  * Right > Left : Select objects that are crossed by selection
396  */
397  bool windowSelection = width >= 0 ? true : false;
398 
400  windowSelection ? KICURSOR::SELECT_WINDOW : KICURSOR::SELECT_LASSO );
401 
402  if( evt->IsCancelInteractive() || evt->IsActivate() )
403  {
404  cancelled = true;
405  break;
406  }
407 
408  if( evt->IsDrag( BUT_LEFT ) )
409  {
411  ClearSelection();
412 
413  // Start drawing a selection box
414  area.SetOrigin( evt->DragOrigin() );
415  area.SetEnd( evt->Position() );
416  area.SetAdditive( m_additive );
419 
420  view->SetVisible( &area, true );
421  view->Update( &area );
422  getViewControls()->SetAutoPan( true );
423  }
424 
425  if( evt->IsMouseUp( BUT_LEFT ) )
426  {
427  getViewControls()->SetAutoPan( false );
428 
429  // End drawing the selection box
430  view->SetVisible( &area, false );
431 
432  int height = area.GetEnd().y - area.GetOrigin().y;
433 
434  bool anyAdded = false;
435  bool anySubtracted = false;
436 
437  // Construct an EDA_RECT to determine EDA_ITEM selection
438  EDA_RECT selectionRect( (wxPoint)area.GetOrigin(), wxSize( width, height ) );
439 
440  selectionRect.Normalize();
441 
442  for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
443  {
444  for( DS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
445  {
446  if( item->HitTest( selectionRect, windowSelection ) )
447  {
448  if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
449  {
450  unselect( item );
451  anySubtracted = true;
452  }
453  else
454  {
455  select( item );
456  anyAdded = true;
457  }
458  }
459  }
460  }
461 
462  // Inform other potentially interested tools
463  if( anyAdded )
465 
466  if( anySubtracted )
468 
469  break; // Stop waiting for events
470  }
471  }
472 
473  getViewControls()->SetAutoPan( false );
474 
475  // Stop drawing the selection box
476  view->Remove( &area );
477  m_multiple = false; // Multiple selection mode is inactive
478 
479  if( !cancelled )
481 
482  return cancelled;
483 }
void ClearReferencePoint()
Definition: selection.h:269
static const TOOL_EVENT SelectedEvent
Definition: actions.h:201
void SetEnd(VECTOR2I aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
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))
Suspend execution of the tool until an event specified in aEventList arrives.
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:202
void SetOrigin(VECTOR2I aOrigin)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:352
void SetExclusiveOr(bool aExclusiveOr)
void select(EDA_ITEM *aItem)
Takes necessary action mark an item as selected.
PL_EDITOR_FRAME * m_frame
void SetAdditive(bool aAdditive)
Base class to handle basic graphic items.
Definition: ds_draw_item.h:58
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
void unselect(EDA_ITEM *aItem)
Take necessary action mark an item as unselected.
Generic, UI-independent tool event.
Definition: tool_event.h:173
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
void SetSubtractive(bool aSubtractive)
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
PL_SELECTION m_selection
Drawing sheet structure type definitions.
Definition: ds_data_item.h:95
Handle the component boundary box.
Definition: eda_rect.h:42
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Definition: view.cpp:1449
Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between two poin...
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:322
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1503

References KIGFX::VIEW::Add(), BUT_LEFT, SELECTION::ClearReferencePoint(), ClearSelection(), PL_EDITOR_FRAME::GetCanvas(), KIGFX::PREVIEW::SELECTION_AREA::GetEnd(), KIGFX::PREVIEW::SELECTION_AREA::GetOrigin(), DS_DATA_MODEL::GetTheInstance(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), m_additive, m_exclusive_or, m_frame, m_multiple, m_selection, m_subtractive, TOOL_BASE::m_toolMgr, EDA_RECT::Normalize(), TOOL_MANAGER::ProcessEvent(), KIGFX::VIEW::Remove(), select(), SELECT_LASSO, SELECT_WINDOW, EVENTS::SelectedEvent, KIGFX::PREVIEW::SELECTION_AREA::SetAdditive(), KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::PREVIEW::SELECTION_AREA::SetEnd(), KIGFX::PREVIEW::SELECTION_AREA::SetExclusiveOr(), 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()

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

Select 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 canceled (for instance, by clicking outside of the disambiguation menu).

Definition at line 278 of file pl_selection_tool.cpp.

279 {
280  int threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
281 
282  // locate items.
283  COLLECTOR collector;
284 
285  for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
286  {
287  for( DS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
288  {
289  if( drawItem->HitTest( (wxPoint) aWhere, threshold ) )
290  collector.Append( drawItem );
291  }
292  }
293 
295 
296  // Apply some ugly heuristics to avoid disambiguation menus whenever possible
297  if( collector.GetCount() > 1 && !m_skip_heuristics )
298  {
299  guessSelectionCandidates( collector, aWhere );
300  }
301 
302  // If still more than one item we're going to have to ask the user.
303  if( collector.GetCount() > 1 )
304  {
305  // Must call selectionMenu via RunAction() to avoid event-loop contention
306  m_toolMgr->RunAction( PL_ACTIONS::selectionMenu, true, &collector );
307 
308  if( collector.m_MenuCancelled )
309  {
310  if( aSelectionCancelledFlag )
311  *aSelectionCancelledFlag = true;
312 
313  return;
314  }
315  }
316 
318  ClearSelection();
319 
320  bool anyAdded = false;
321  bool anySubtracted = false;
322 
323  if( collector.GetCount() > 0 )
324  {
325  for( int i = 0; i < collector.GetCount(); ++i )
326  {
327  if( m_subtractive || ( m_exclusive_or && collector[i]->IsSelected() ) )
328  {
329  unselect( collector[i] );
330  anySubtracted = true;
331  }
332  else
333  {
334  select( collector[i] );
335  anyAdded = true;
336  }
337  }
338  }
339 
340  if( anyAdded )
342 
343  if( anySubtracted )
345 }
void ClearReferencePoint()
Definition: selection.h:269
static const TOOL_EVENT SelectedEvent
Definition: actions.h:201
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:202
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
void select(EDA_ITEM *aItem)
Takes necessary action mark an item as selected.
void Append(EDA_ITEM *item)
Add an item to the end of the list.
Definition: collector.h:105
bool m_MenuCancelled
Definition: collector.h:251
Base class to handle basic graphic items.
Definition: ds_draw_item.h:58
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
void unselect(EDA_ITEM *aItem)
Take necessary action mark an item as unselected.
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
Run a selection menu to select from a list of items.
Definition: pl_actions.h:58
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
PL_SELECTION m_selection
Drawing sheet structure type definitions.
Definition: ds_data_item.h:95
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
An abstract class that will find and hold all the objects according to an inspection done by the Insp...
Definition: collector.h:53
#define HITTEST_THRESHOLD_PIXELS

References COLLECTOR::Append(), SELECTION::ClearReferencePoint(), ClearSelection(), COLLECTOR::GetCount(), DS_DATA_MODEL::GetTheInstance(), TOOL_BASE::getView(), guessSelectionCandidates(), HITTEST_THRESHOLD_PIXELS, KiROUND(), m_additive, m_exclusive_or, COLLECTOR::m_MenuCancelled, 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

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

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

Definition at line 76 of file tool_interactive.cpp.

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

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

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

◆ setTransitions()

void PL_SELECTION_TOOL::setTransitions ( )
overrideprivatevirtual

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

It is called every time tool is reset or finished.

Implements TOOL_INTERACTIVE.

Definition at line 826 of file pl_selection_tool.cpp.

827 {
829 
832 
838 }
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
static TOOL_ACTION addItemsToSel
Select a list of items (specified as the event parameter)
Definition: pl_actions.h:54
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))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
int AddItemToSel(const TOOL_EVENT &aEvent)
static TOOL_ACTION selectionActivate
Activation of the selection tool.
Definition: pl_actions.h:44
static TOOL_ACTION addItemToSel
Select an item (specified as the event parameter).
Definition: pl_actions.h:50
static TOOL_ACTION removeItemsFromSel
Definition: pl_actions.h:55
int RemoveItemsFromSel(const TOOL_EVENT &aEvent)
int SelectionMenu(const TOOL_EVENT &aEvent)
Shows a popup menu to trim the COLLECTOR passed as aEvent's parameter down to a single item.
static TOOL_ACTION selectionMenu
Run a selection menu to select from a list of items.
Definition: pl_actions.h:58
static TOOL_ACTION updateMenu
Definition: actions.h:170
static TOOL_ACTION clearSelection
Clear the current selection.
Definition: pl_actions.h:47
static TOOL_ACTION removeItemFromSel
Definition: pl_actions.h:51
int Main(const TOOL_EVENT &aEvent)
The main loop.
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 574 of file pl_selection_tool.cpp.

575 {
576  unhighlight( aItem, BRIGHTENED );
577 }
#define BRIGHTENED
item is drawn with a bright contour
Definition: eda_item.h:131
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
Unhighlight 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

Unhighlight the item visually.

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

Definition at line 793 of file pl_selection_tool.cpp.

794 {
795  if( aMode == SELECTED )
796  aItem->ClearSelected();
797  else if( aMode == BRIGHTENED )
798  aItem->ClearBrightened();
799 
800  if( aGroup )
801  aGroup->Remove( aItem );
802 
803  getView()->Update( aItem );
804 }
void ClearSelected()
Definition: eda_item.h:182
void ClearBrightened()
Definition: eda_item.h:183
#define BRIGHTENED
item is drawn with a bright contour
Definition: eda_item.h:131
#define SELECTED
Definition: eda_item.h:114
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1503
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.h:88

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

Take necessary action mark an item as unselected.

Parameters
aItemis an item to be unselected.

Definition at line 773 of file pl_selection_tool.cpp.

774 {
775  unhighlight( aItem, SELECTED, &m_selection );
776 }
#define SELECTED
Definition: eda_item.h:114
PL_SELECTION m_selection
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
Unhighlight 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 89 of file pl_selection_tool.cpp.

90 {
91  ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
92  CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
93 
94  if( conditionalMenu )
95  conditionalMenu->Evaluate( m_selection );
96 
97  if( actionMenu )
98  actionMenu->UpdateAll();
99 
100  return 0;
101 }
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:47
void UpdateAll()
Run update handlers for the menu and its submenus.
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:443
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

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

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

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

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

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

Member Data Documentation

◆ m_additive

bool PL_SELECTION_TOOL::m_additive
private

Definition at line 180 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 182 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 177 of file pl_selection_tool.h.

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

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 106 of file tool_interactive.h.

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

◆ m_multiple

bool PL_SELECTION_TOOL::m_multiple
private

Definition at line 183 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 184 of file pl_selection_tool.h.

Referenced by Main(), and SelectPoint().

◆ m_subtractive

bool PL_SELECTION_TOOL::m_subtractive
private

Definition at line 181 of file pl_selection_tool.h.

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

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

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

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

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

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 207 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: