KiCad PCB EDA Suite
PL_SELECTION_TOOL Class Reference

#include <pl_selection_tool.h>

Inheritance diagram for PL_SELECTION_TOOL:
SELECTION_TOOL TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 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 setModifiersState (bool aShiftState, bool aCtrlState, bool aAltState)
 Set the configuration of m_additive, m_subtractive, m_exclusive_or, m_skip_heuristics from the state of modifier keys SHIFT, CTRL, ALT and depending on the OS. More...
 
void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

bool m_additive
 
bool m_subtractive
 
bool m_exclusive_or
 
bool m_multiple
 
bool m_skip_heuristics
 
bool m_highlight_modifier
 
bool m_drag_additive
 
bool m_drag_subtractive
 
bool m_canceledMenu
 
wxTimer m_disambiguateTimer
 
VECTOR2I m_originalCursor
 
TOOL_MENU m_menu
 The functions below are not yet implemented - their interface may change. More...
 
TOOL_TYPE m_type
 Unique identifier for the tool, assigned by a TOOL_MANAGER instance. More...
 
TOOL_ID m_toolId
 Name of the tool. More...
 
std::string m_toolName
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

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 onDisambiguationExpire (wxTimerEvent &aEvent)
 Start the process to show our disambiguation menu once the user has kept the mouse down for the minimum time. More...
 
int disambiguateCursor (const TOOL_EVENT &aEvent)
 Handle disambiguation actions including displaying the menu. More...
 
void select (EDA_ITEM *aItem)
 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
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ PL_SELECTION_TOOL()

PL_SELECTION_TOOL::PL_SELECTION_TOOL ( )

Definition at line 52 of file pl_selection_tool.cpp.

52  :
53  TOOL_INTERACTIVE( "plEditor.InteractiveSelection" ),
54  m_frame( nullptr )
55 {
56 }
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 47 of file pl_selection_tool.h.

47 { }

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

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

Definition at line 51 of file tool_interactive.cpp.

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

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

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

◆ AddItemsToSel() [1/2]

int PL_SELECTION_TOOL::AddItemsToSel ( const TOOL_EVENT aEvent)

Definition at line 491 of file pl_selection_tool.cpp.

492 {
493  AddItemsToSel( aEvent.Parameter<EDA_ITEMS*>(), false );
494  return 0;
495 }
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:506
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 498 of file pl_selection_tool.cpp.

499 {
500  if( aList )
501  {
502  for( EDA_ITEM* item : *aList )
503  select( item );
504 
505  // Inform other potentially interested tools
506  if( !aQuietMode )
508  }
509 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:200
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
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:99

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

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

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

479 {
480  if( aItem )
481  {
482  select( aItem );
483 
484  // Inform other potentially interested tools
485  if( !aQuietMode )
487  }
488 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:200
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
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:214

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ BrightenItem()

void PL_SELECTION_TOOL::BrightenItem ( EDA_ITEM aItem)

Definition at line 553 of file pl_selection_tool.cpp.

554 {
555  highlight( aItem, BRIGHTENED );
556 }
void highlight(EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
Highlight the item visually.
#define BRIGHTENED
item is drawn with a bright contour

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

735 {
736  if( m_selection.Empty() )
737  return;
738 
739  while( m_selection.GetSize() )
741 
742  getView()->Update( &m_selection );
743 
744  m_selection.SetIsHover( false );
746 
747  // Inform other potentially interested tools
749 }
void ClearReferencePoint()
Definition: selection.h:194
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
void SetIsHover(bool aIsHover)
Definition: selection.h:69
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
Definition: actions.h:202
#define SELECTED
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
virtual unsigned int GetSize() const override
Return the number of stored items.
Definition: selection.h:88
PL_SELECTION m_selection
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
Unhighlight the item visually.
EDA_ITEM * Front() const
Definition: selection.h:145
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:1570

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

◆ disambiguateCursor()

int PL_SELECTION_TOOL::disambiguateCursor ( const TOOL_EVENT aEvent)
private

Handle disambiguation actions including displaying the menu.

Definition at line 236 of file pl_selection_tool.cpp.

237 {
238  m_skip_heuristics = true;
240  m_skip_heuristics = false;
241 
242  return 0;
243 }
void SelectPoint(const VECTOR2I &aWhere, bool *aSelectionCancelledFlag=nullptr)
Select an item pointed by the parameter aWhere.
VECTOR2I m_originalCursor

References SELECTION_TOOL::m_canceledMenu, SELECTION_TOOL::m_originalCursor, SELECTION_TOOL::m_skip_heuristics, and SelectPoint().

Referenced by 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 598 of file pl_selection_tool.cpp.

599 {
600  EDA_ITEM* current = nullptr;
601  ACTION_MENU menu( true );
602 
603  // ID limit is `MAX_SELECT_ITEM_IDS+1` because the last item is "select all"
604  // and the first item has ID of 1.
605  int limit = std::min( MAX_SELECT_ITEM_IDS + 1, aCollector->GetCount() );
606 
607  for( int i = 0; i < limit; ++i )
608  {
609  wxString text;
610  EDA_ITEM* item = ( *aCollector )[i];
612 
613  wxString menuText = wxString::Format( "&%d. %s\t%d", i + 1, text, i + 1 );
614  menu.Add( menuText, i + 1, item->GetMenuImage() );
615  }
616 
617  menu.AppendSeparator();
618  menu.Add( _( "Select &All\tA" ), limit + 1, BITMAPS::INVALID_BITMAP );
619 
620  if( aCollector->m_MenuTitle.Length() )
621  {
622  menu.SetTitle( aCollector->m_MenuTitle );
623  menu.SetIcon( BITMAPS::info );
624  menu.DisplayTitle( true );
625  }
626  else
627  {
628  menu.DisplayTitle( false );
629  }
630 
631  SetContextMenu( &menu, CMENU_NOW );
632 
633  bool selectAll = false;
634 
635  while( TOOL_EVENT* evt = Wait() )
636  {
637  if( evt->Action() == TA_CHOICE_MENU_UPDATE )
638  {
639  if( selectAll )
640  {
641  for( int i = 0; i < aCollector->GetCount(); ++i )
642  unhighlight( ( *aCollector )[i], BRIGHTENED );
643  }
644  else if( current )
645  {
646  unhighlight( current, BRIGHTENED );
647  }
648 
649  int id = *evt->GetCommandId();
650 
651  // User has pointed an item, so show it in a different way
652  if( id > 0 && id <= limit )
653  {
654  current = ( *aCollector )[id - 1];
655  highlight( current, BRIGHTENED );
656  }
657  else
658  {
659  current = nullptr;
660  }
661 
662  if( id == limit + 1 )
663  {
664  for( int i = 0; i < aCollector->GetCount(); ++i )
665  highlight( ( *aCollector )[i], BRIGHTENED );
666 
667  selectAll = true;
668  }
669  else
670  {
671  selectAll = false;
672  }
673  }
674  else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
675  {
676  if( selectAll )
677  {
678  for( int i = 0; i < aCollector->GetCount(); ++i )
679  unhighlight( ( *aCollector )[i], BRIGHTENED );
680  }
681  else if( current )
682  {
683  unhighlight( current, BRIGHTENED );
684  }
685 
686  OPT<int> id = evt->GetCommandId();
687 
688  // User has selected an item, so this one will be returned
689  if( id == limit + 1 )
690  {
691  selectAll = true;
692  current = nullptr;
693  }
694  else if( id && ( *id > 0 ) && ( *id <= limit ) )
695  {
696  selectAll = false;
697  current = ( *aCollector )[*id - 1];
698  }
699  else
700  {
701  selectAll = false;
702  current = nullptr;
703  }
704  }
705  else if( evt->Action() == TA_CHOICE_MENU_CLOSED )
706  {
707  break;
708  }
709 
710  getView()->UpdateItems();
711  m_frame->GetCanvas()->Refresh();
712  }
713 
714  if( selectAll )
715  {
716  return true;
717  }
718  else if( current )
719  {
720  unhighlight( current, BRIGHTENED );
721 
722  getView()->UpdateItems();
723  m_frame->GetCanvas()->Refresh();
724 
725  aCollector->Empty();
726  aCollector->Append( current );
727  return true;
728  }
729 
730  return false;
731 }
#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:48
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
Generic, UI-independent tool event.
Definition: tool_event.h:152
#define _(s)
void UpdateItems()
Iterate through the list of items that asked for updating and updates them.
Definition: view.cpp:1402
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: eda_item.cpp:109
virtual BITMAPS GetMenuImage() const
Return a pointer to an image to be used in menus.
Definition: eda_item.cpp:274
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99
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.
#define BRIGHTENED
item is drawn with a bright contour

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

◆ getEditFrame()

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

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

Definition at line 184 of file tool_base.h.

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

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 120 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 143 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 196 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Return the name of the tool.

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

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

134  {
135  return m_toolName;
136  }
std::string m_toolName
Definition: tool_base.h:213

References TOOL_BASE::m_toolName.

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

◆ GetSelection()

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 108 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

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

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), GERBVIEW_CONTROL::ClearAllLayers(), 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(), PCB_TOOL_BASE::doInteractiveItemPlacement(), 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::FindSymbolAndItem(), EE_SELECTION_TOOL::GetNode(), 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(), PL_EDIT_TOOL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), ROUTER_TOOL::prepareInteractive(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), BOARD_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), 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::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:214
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:285

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

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), SCH_DRAWING_TOOLS::createSheetPin(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_DRAWING_TOOLS::GetCanvasFreeAreaPixels(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), 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(), PL_POINT_EDITOR::setEditedPoint(), EE_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), PL_EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

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

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

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

149 {
150  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
151 
152  goInternal( sptr, aConditions );
153 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by AUTOPLACE_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), 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(), ROUTER_TOOL::setTransitions(), SCRIPTING_TOOL::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PAD_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), DRC_TOOL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), PCB_CONTROL::setTransitions(), CVPCB_CONTROL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), setTransitions(), DRAWING_TOOL::setTransitions(), SCH_EDITOR_CONTROL::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 333 of file pl_selection_tool.cpp.

334 {
335  // There are certain conditions that can be handled automatically.
336 
337  // Prefer an exact hit to a sloppy one
338  for( int i = 0; collector.GetCount() == 2 && i < 2; ++i )
339  {
340  EDA_ITEM* item = collector[ i ];
341  EDA_ITEM* other = collector[ ( i + 1 ) % 2 ];
342 
343  if( item->HitTest( (wxPoint) aPos, 0 ) && !other->HitTest( (wxPoint) aPos, 0 ) )
344  collector.Transfer( other );
345  }
346 }
virtual bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const
Test if aPosition is inside or on the boundary of this item.
Definition: eda_item.h:224
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:82
void Transfer(int aIndex)
Move the item at aIndex (first position is 0) to the backup list.
Definition: collector.h:152
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99

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

765 {
766  if( aMode == SELECTED )
767  aItem->SetSelected();
768  else if( aMode == BRIGHTENED )
769  aItem->SetBrightened();
770 
771  if( aGroup )
772  aGroup->Add( aItem );
773 
774  getView()->Update( aItem );
775 }
virtual void Add(EDA_ITEM *aItem)
Definition: selection.cpp:32
void SetBrightened()
Definition: eda_item.h:129
void SetSelected()
Definition: eda_item.h:128
#define SELECTED
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:1570
#define BRIGHTENED
item is drawn with a bright contour

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

60 {
61  m_frame = getEditFrame<PL_EDITOR_FRAME>();
62 
63  auto& menu = m_menu.GetMenu();
64 
65  menu.AddSeparator( 200 );
70 
71  menu.AddSeparator( 1000 );
73 
74  m_disambiguateTimer.SetOwner( this );
75  Connect( wxEVT_TIMER, wxTimerEventHandler( PL_SELECTION_TOOL::onDisambiguationExpire ), nullptr, this );
76 
77  return true;
78 }
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:61
static TOOL_ACTION placeImage
Definition: pl_actions.h:59
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
static TOOL_ACTION placeText
Definition: pl_actions.h:58
PL_EDITOR_FRAME * m_frame
static TOOL_ACTION drawRectangle
Definition: pl_actions.h:60
wxTimer m_disambiguateTimer
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.
void onDisambiguationExpire(wxTimerEvent &aEvent)
Start the process to show our disambiguation menu once the user has kept the mouse down for the minim...

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

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

Referenced by EDIT_TOOL::Drag(), 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 103 of file pl_selection_tool.cpp.

104 {
105  // Main loop: keep receiving events
106  while( TOOL_EVENT* evt = Wait() )
107  {
108  // on left click, a selection is made, depending on modifiers ALT, SHIFT, CTRL:
109  setModifiersState( evt->Modifier( MD_SHIFT ), evt->Modifier( MD_CTRL ),
110  evt->Modifier( MD_ALT ) );
111 
112  bool modifier_enabled = m_subtractive || m_additive || m_exclusive_or;
113 
114  if( evt->IsMouseDown( BUT_LEFT ) )
115  {
116  // Avoid triggering when running under other tools
118 
119  if( m_frame->ToolStackIsEmpty() && pt_tool && !pt_tool->HasPoint() )
120  {
122  m_disambiguateTimer.StartOnce( 500 );
123  }
124  }
125  // Single click? Select single object
126  else if( evt->IsClick( BUT_LEFT ) )
127  {
128  // If the timer has stopped, then we have already run the disambiguate routine
129  // and we don't want to register an extra click here
130  if( !m_disambiguateTimer.IsRunning() )
131  {
132  evt->SetPassEvent();
133  continue;
134  }
135 
136  m_disambiguateTimer.Stop();
137  SelectPoint( evt->Position() );
138  }
139 
140  // right click? if there is any object - show the context menu
141  else if( evt->IsClick( BUT_RIGHT ) )
142  {
143  m_disambiguateTimer.Stop();
144  bool selectionCancelled = false;
145 
146  if( m_selection.Empty() )
147  {
148  SelectPoint( evt->Position(), &selectionCancelled );
149  m_selection.SetIsHover( true );
150  }
151 
152  if( !selectionCancelled )
154  }
155 
156  // double click? Display the properties window
157  else if( evt->IsDblClick( BUT_LEFT ) )
158  {
159  // No double-click actions currently defined
160  }
161 
162  // drag with LMB? Select multiple objects (or at least draw a selection box) or drag them
163  else if( evt->IsDrag( BUT_LEFT ) )
164  {
165  m_disambiguateTimer.Stop();
166 
167  if( modifier_enabled || m_selection.Empty() )
168  {
169  selectMultiple();
170  }
171  else
172  {
173  // Check if dragging has started within any of selected items bounding box
174  if( selectionContains( evt->Position() ) )
175  {
176  // Yes -> run the move tool and wait till it finishes
177  m_toolMgr->RunAction( "plEditor.InteractiveMove.move", true );
178  }
179  else
180  {
181  // No -> clear the selection list
182  ClearSelection();
183  }
184  }
185  }
186 
187  // Middle double click? Do zoom to fit or zoom to objects
188  else if( evt->IsDblClick( BUT_MIDDLE ) )
189  {
191  }
192 
193  else if( evt->IsCancelInteractive() )
194  {
195  m_disambiguateTimer.Stop();
196  ClearSelection();
197  }
198 
199  else if( evt->Action() == TA_UNDO_REDO_PRE )
200  {
201  ClearSelection();
202  }
203 
204  else
205  evt->SetPassEvent();
206 
207 
208  if( m_frame->ToolStackIsEmpty() )
209  {
210  if( !modifier_enabled
211  && !m_selection.Empty()
213  && evt->HasPosition()
214  && selectionContains( evt->Position() ) )
215  {
217  }
218  else
219  {
220  if( m_additive )
222  else if( m_subtractive )
224  else if( m_exclusive_or )
226  else
228  }
229  }
230  }
231 
232  return 0;
233 }
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.
VECTOR2D GetMousePosition() const
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
static TOOL_ACTION zoomFitScreen
Definition: actions.h:96
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
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:69
void setModifiersState(bool aShiftState, bool aCtrlState, bool aAltState)
Set the configuration of m_additive, m_subtractive, m_exclusive_or, m_skip_heuristics from the state ...
bool HasPoint()
Indicate the cursor is over an edit point.
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:135
Generic, UI-independent tool event.
Definition: tool_event.h:152
bool ToolStackIsEmpty()
Definition: tools_holder.h:116
wxTimer m_disambiguateTimer
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
PL_SELECTION m_selection
VECTOR2I m_originalCursor
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
Tool that displays edit points allowing to modify items by dragging the points.

References ADD, ARROW, BUT_LEFT, BUT_MIDDLE, BUT_RIGHT, ClearSelection(), DRAG_SELECTED, SELECTION::Empty(), PL_EDITOR_FRAME::GetCanvas(), TOOLS_HOLDER::GetDragAction(), TOOL_MANAGER::GetMousePosition(), TOOL_MANAGER::GetTool(), PL_POINT_EDITOR::HasPoint(), SELECTION_TOOL::m_additive, SELECTION_TOOL::m_disambiguateTimer, SELECTION_TOOL::m_exclusive_or, m_frame, TOOL_INTERACTIVE::m_menu, SELECTION_TOOL::m_originalCursor, m_selection, SELECTION_TOOL::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(), SELECTION_TOOL::setModifiersState(), TOOL_MENU::ShowContextMenu(), SUBTRACT, TA_UNDO_REDO_PRE, TOOLS_HOLDER::ToolStackIsEmpty(), TOOL_INTERACTIVE::Wait(), XOR, and ACTIONS::zoomFitScreen.

Referenced by setTransitions().

◆ onDisambiguationExpire()

void PL_SELECTION_TOOL::onDisambiguationExpire ( wxTimerEvent &  aEvent)
private

Start the process to show our disambiguation menu once the user has kept the mouse down for the minimum time.

Parameters
aEvent

Definition at line 246 of file pl_selection_tool.cpp.

247 {
249 }
static const TOOL_EVENT DisambiguatePoint
Definition: actions.h:215
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).

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

Referenced by Init().

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

573 {
574  m_selection.Clear();
575 
576  for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
577  {
578  for( DS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
579  {
580  if( item->IsSelected() )
581  select( item );
582  }
583  }
584 }
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:83
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::DisplayDrawingSheet(), 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 512 of file pl_selection_tool.cpp.

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

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

520 {
521  if( aItem )
522  {
523  unselect( aItem );
524 
525  // Inform other potentially interested tools
526  if( !aQuietMode )
528  }
529 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:201
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
void unselect(EDA_ITEM *aItem)
Take necessary action mark an item as unselected.

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

◆ RemoveItemsFromSel() [1/2]

int PL_SELECTION_TOOL::RemoveItemsFromSel ( const TOOL_EVENT aEvent)

Definition at line 532 of file pl_selection_tool.cpp.

533 {
534  RemoveItemsFromSel( aEvent.Parameter<EDA_ITEMS*>(), false );
535  return 0;
536 }
int RemoveItemsFromSel(const TOOL_EVENT &aEvent)
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
Definition: eda_item.h:506

References TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ RemoveItemsFromSel() [2/2]

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

Definition at line 539 of file pl_selection_tool.cpp.

540 {
541  if( aList )
542  {
543  for( EDA_ITEM* item : *aList )
544  unselect( item );
545 
546  // Inform other potentially interested tools
547  if( !aQuietMode )
549  }
550 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:201
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
void unselect(EDA_ITEM *aItem)
Take necessary action mark an item as unselected.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:99

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

350 {
351  // If nothing is selected do a hover selection
352  if( m_selection.Empty() )
353  {
354  VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true );
355 
356  ClearSelection();
357  SelectPoint( cursorPos );
358  m_selection.SetIsHover( true );
359  }
360 
361  return m_selection;
362 }
void SelectPoint(const VECTOR2I &aWhere, bool *aSelectionCancelledFlag=nullptr)
Select an item pointed by the parameter aWhere.
void SetIsHover(bool aIsHover)
Definition: selection.h:69
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:98
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 81 of file pl_selection_tool.cpp.

82 {
83  if( aReason == MODEL_RELOAD )
84  m_frame = getEditFrame<PL_EDITOR_FRAME>();
85 }
Model changes (required full reload)
Definition: tool_base.h:80
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:214
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

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

Referenced by DRAWING_TOOL::PlaceText().

◆ select()

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

753 {
754  highlight( aItem, SELECTED, &m_selection );
755 }
#define SELECTED
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 792 of file pl_selection_tool.cpp.

793 {
794  const unsigned GRIP_MARGIN = 20;
795  VECTOR2I margin = getView()->ToWorld( VECTOR2I( GRIP_MARGIN, GRIP_MARGIN ), false );
796 
797  // Check if the point is located within any of the currently selected items bounding boxes
798  for( auto item : m_selection )
799  {
800  BOX2I itemBox = item->ViewBBox();
801  itemBox.Inflate( margin.x, margin.y ); // Give some margin for gripping an item
802 
803  if( itemBox.Contains( aPoint ) )
804  return true;
805  }
806 
807  return false;
808 }
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:449
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
bool Contains(const Vec &aPoint) const
Definition: box2.h:134
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:281
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 587 of file pl_selection_tool.cpp.

588 {
589  COLLECTOR* collector = aEvent.Parameter<COLLECTOR*>();
590 
591  if( !doSelectionMenu( collector ) )
592  collector->m_MenuCancelled = true;
593 
594  return 0;
595 }
bool m_MenuCancelled
Definition: collector.h:244
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:432
An abstract class that will find and hold all the objects according to an inspection done by the Insp...
Definition: collector.h:48

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

366 {
367  bool cancelled = false; // Was the tool cancelled while it was running?
368  m_multiple = true; // Multiple selection mode is active
369  KIGFX::VIEW* view = getView();
370 
372  view->Add( &area );
373 
374  while( TOOL_EVENT* evt = Wait() )
375  {
376  int width = area.GetEnd().x - area.GetOrigin().x;
377 
378  /* Selection mode depends on direction of drag-selection:
379  * Left > Right : Select objects that are fully enclosed by selection
380  * Right > Left : Select objects that are crossed by selection
381  */
382  bool windowSelection = width >= 0 ? true : false;
383 
385  windowSelection ? KICURSOR::SELECT_WINDOW : KICURSOR::SELECT_LASSO );
386 
387  if( evt->IsCancelInteractive() || evt->IsActivate() )
388  {
389  cancelled = true;
390  break;
391  }
392 
393  if( evt->IsDrag( BUT_LEFT ) )
394  {
396  ClearSelection();
397 
398  // Start drawing a selection box
399  area.SetOrigin( evt->DragOrigin() );
400  area.SetEnd( evt->Position() );
403  area.SetExclusiveOr( false );
404 
405  view->SetVisible( &area, true );
406  view->Update( &area );
407  getViewControls()->SetAutoPan( true );
408  }
409 
410  if( evt->IsMouseUp( BUT_LEFT ) )
411  {
412  getViewControls()->SetAutoPan( false );
413 
414  // End drawing the selection box
415  view->SetVisible( &area, false );
416 
417  int height = area.GetEnd().y - area.GetOrigin().y;
418 
419  bool anyAdded = false;
420  bool anySubtracted = false;
421 
422  // Construct an EDA_RECT to determine EDA_ITEM selection
423  EDA_RECT selectionRect( (wxPoint)area.GetOrigin(), wxSize( width, height ) );
424 
425  selectionRect.Normalize();
426 
427  for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
428  {
429  for( DS_DRAW_ITEM_BASE* item : dataItem->GetDrawItems() )
430  {
431  if( item->HitTest( selectionRect, windowSelection ) )
432  {
433  if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
434  {
435  unselect( item );
436  anySubtracted = true;
437  }
438  else
439  {
440  select( item );
441  anyAdded = true;
442  }
443  }
444  }
445  }
446 
447  // Inform other potentially interested tools
448  if( anyAdded )
450 
451  if( anySubtracted )
453 
454  break; // Stop waiting for events
455  }
456  }
457 
458  getViewControls()->SetAutoPan( false );
459 
460  // Stop drawing the selection box
461  view->Remove( &area );
462  m_multiple = false; // Multiple selection mode is inactive
463 
464  if( !cancelled )
466 
467  return cancelled;
468 }
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the corner that moves with the cursor.
void ClearReferencePoint()
Definition: selection.h:194
static const TOOL_EVENT SelectedEvent
Definition: actions.h:200
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:201
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:350
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
void SetOrigin(const VECTOR2I &aOrigin)
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:152
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:1516
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:320
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
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:1570

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(), SELECTION_TOOL::m_drag_additive, SELECTION_TOOL::m_drag_subtractive, SELECTION_TOOL::m_exclusive_or, m_frame, SELECTION_TOOL::m_multiple, m_selection, SELECTION_TOOL::m_subtractive, TOOL_BASE::m_toolMgr, EDA_RECT::Normalize(), 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 258 of file pl_selection_tool.cpp.

259 {
260  int threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
261 
262  // locate items.
263  COLLECTOR collector;
264 
265  for( DS_DATA_ITEM* dataItem : DS_DATA_MODEL::GetTheInstance().GetItems() )
266  {
267  for( DS_DRAW_ITEM_BASE* drawItem : dataItem->GetDrawItems() )
268  {
269  if( drawItem->HitTest( (wxPoint) aWhere, threshold ) )
270  collector.Append( drawItem );
271  }
272  }
273 
275 
276  // Apply some ugly heuristics to avoid disambiguation menus whenever possible
277  if( collector.GetCount() > 1 && !m_skip_heuristics )
278  {
279  guessSelectionCandidates( collector, aWhere );
280  }
281 
282  // If still more than one item we're going to have to ask the user.
283  if( collector.GetCount() > 1 )
284  {
285  doSelectionMenu( &collector );
286 
287  if( collector.m_MenuCancelled )
288  {
289  if( aSelectionCancelledFlag )
290  *aSelectionCancelledFlag = true;
291 
292  return;
293  }
294  }
295 
296  bool anyAdded = false;
297  bool anySubtracted = false;
298 
299 
301  {
302  if( collector.GetCount() == 0 )
303  anySubtracted = true;
304 
305  ClearSelection();
306  }
307 
308  if( collector.GetCount() > 0 )
309  {
310  for( int i = 0; i < collector.GetCount(); ++i )
311  {
312  if( m_subtractive || ( m_exclusive_or && collector[i]->IsSelected() ) )
313  {
314  unselect( collector[i] );
315  anySubtracted = true;
316  }
317  else
318  {
319  select( collector[i] );
320  anyAdded = true;
321  }
322  }
323  }
324 
325  if( anyAdded )
327 
328  if( anySubtracted )
330 }
void ClearReferencePoint()
Definition: selection.h:194
static const TOOL_EVENT SelectedEvent
Definition: actions.h:200
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:201
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
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:100
bool m_MenuCancelled
Definition: collector.h:244
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:82
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
bool doSelectionMenu(COLLECTOR *aItems)
Allow the selection of a single item from a list via pop-up menu.
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.
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:73
An abstract class that will find and hold all the objects according to an inspection done by the Insp...
Definition: collector.h:48
#define HITTEST_THRESHOLD_PIXELS

References COLLECTOR::Append(), SELECTION::ClearReferencePoint(), ClearSelection(), doSelectionMenu(), COLLECTOR::GetCount(), DS_DATA_MODEL::GetTheInstance(), TOOL_BASE::getView(), guessSelectionCandidates(), HITTEST_THRESHOLD_PIXELS, KiROUND(), SELECTION_TOOL::m_additive, SELECTION_TOOL::m_exclusive_or, COLLECTOR::m_MenuCancelled, m_selection, SELECTION_TOOL::m_skip_heuristics, SELECTION_TOOL::m_subtractive, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), select(), EVENTS::SelectedEvent, unselect(), and EVENTS::UnselectedEvent.

Referenced by disambiguateCursor(), 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:214
void SetTool(TOOL_INTERACTIVE *aTool)
Set a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Set behavior of the tool's context popup menu.

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

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

◆ setModifiersState()

void SELECTION_TOOL::setModifiersState ( bool  aShiftState,
bool  aCtrlState,
bool  aAltState 
)
protectedinherited

Set the configuration of m_additive, m_subtractive, m_exclusive_or, m_skip_heuristics from the state of modifier keys SHIFT, CTRL, ALT and depending on the OS.

Definition at line 40 of file selection_tool.cpp.

41 {
42  // Set the configuration of m_additive, m_subtractive, m_exclusive_or from the state of
43  // modifier keys SHIFT and CTRL
44 
45  // ALT key cannot be used on MSW because of a conflict with the system menu
46 
47  m_subtractive = aCtrlState && aShiftState;
48  m_additive = !aCtrlState && aShiftState;
49  m_exclusive_or = false;
50  m_highlight_modifier = aCtrlState && !aShiftState;
51 
52  // Drag is more forgiving and allows either Ctrl+Drag or Shift+Drag to add to the selection
53  // Note, however that we cannot provide disambiguation at the same time as the box selection
54  m_drag_additive = ( aCtrlState || aShiftState ) && !aAltState;
55  m_drag_subtractive = aCtrlState && aShiftState && !aAltState;
56 
57  // While the ALT key has some conflicts under MSW (and some flavors of Linux WMs), it remains
58  // useful for users who only use tap-click rather than holding the button. We disable it for
59  // windows because it flashes the disambiguation menu without showing data
60 #ifndef __WINDOWS__
61  m_skip_heuristics = aAltState;
62 #else
63  m_skip_heuristics = false;
64 #endif
65 
66 }
bool m_highlight_modifier

References SELECTION_TOOL::m_additive, SELECTION_TOOL::m_drag_additive, SELECTION_TOOL::m_drag_subtractive, SELECTION_TOOL::m_exclusive_or, SELECTION_TOOL::m_highlight_modifier, SELECTION_TOOL::m_skip_heuristics, and SELECTION_TOOL::m_subtractive.

Referenced by Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::OnIdle(), and PCB_SELECTION_TOOL::OnIdle().

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

812 {
814 
817 
823 
825 }
int RemoveItemFromSel(const TOOL_EVENT &aEvent)
static const TOOL_EVENT DisambiguatePoint
Definition: actions.h:215
static TOOL_ACTION addItemsToSel
Select a list of items (specified as the event parameter)
Definition: pl_actions.h:50
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:40
static TOOL_ACTION addItemToSel
Select an item (specified as the event parameter).
Definition: pl_actions.h:46
static TOOL_ACTION removeItemsFromSel
Definition: pl_actions.h:51
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:54
static TOOL_ACTION updateMenu
Definition: actions.h:167
static TOOL_ACTION clearSelection
Clear the current selection.
Definition: pl_actions.h:43
static TOOL_ACTION removeItemFromSel
Definition: pl_actions.h:47
int Main(const TOOL_EVENT &aEvent)
The main loop.
int AddItemsToSel(const TOOL_EVENT &aEvent)
int disambiguateCursor(const TOOL_EVENT &aEvent)
Handle disambiguation actions including displaying the menu.

References PL_ACTIONS::addItemsToSel, AddItemsToSel(), PL_ACTIONS::addItemToSel, AddItemToSel(), PL_ACTIONS::clearSelection, ClearSelection(), disambiguateCursor(), EVENTS::DisambiguatePoint, 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 559 of file pl_selection_tool.cpp.

560 {
561  unhighlight( aItem, BRIGHTENED );
562 }
void unhighlight(EDA_ITEM *aItem, int aHighlightMode, PL_SELECTION *aGroup=nullptr)
Unhighlight the item visually.
#define BRIGHTENED
item is drawn with a bright contour

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

779 {
780  if( aMode == SELECTED )
781  aItem->ClearSelected();
782  else if( aMode == BRIGHTENED )
783  aItem->ClearBrightened();
784 
785  if( aGroup )
786  aGroup->Remove( aItem );
787 
788  getView()->Update( aItem );
789 }
void ClearSelected()
Definition: eda_item.h:131
void ClearBrightened()
Definition: eda_item.h:132
#define SELECTED
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.cpp:44
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:1570
#define BRIGHTENED
item is drawn with a bright contour

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

759 {
760  unhighlight( aItem, SELECTED, &m_selection );
761 }
#define SELECTED
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 88 of file pl_selection_tool.cpp.

89 {
90  ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
91  CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
92 
93  if( conditionalMenu )
94  conditionalMenu->Evaluate( m_selection );
95 
96  if( actionMenu )
97  actionMenu->UpdateAll();
98 
99  return 0;
100 }
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:48
void UpdateAll()
Run update handlers for the menu and its submenus.
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
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:214
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pause execution of a given tool until one or more events matching aConditions arrives.

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), 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

◆ m_canceledMenu

bool SELECTION_TOOL::m_canceledMenu
protectedinherited

◆ m_disambiguateTimer

wxTimer SELECTION_TOOL::m_disambiguateTimer
protectedinherited

◆ m_drag_additive

bool SELECTION_TOOL::m_drag_additive
protectedinherited

◆ m_drag_subtractive

bool SELECTION_TOOL::m_drag_subtractive
protectedinherited

◆ m_exclusive_or

◆ m_frame

PL_EDITOR_FRAME* PL_SELECTION_TOOL::m_frame
private

Definition at line 190 of file pl_selection_tool.h.

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

◆ m_highlight_modifier

bool SELECTION_TOOL::m_highlight_modifier
protectedinherited

Definition at line 53 of file selection_tool.h.

Referenced by PCB_SELECTION_TOOL::Main(), and SELECTION_TOOL::setModifiersState().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 125 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), ROUTER_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), Init(), SCH_DRAWING_TOOLS::Init(), BOARD_EDITOR_CONTROL::Init(), GERBVIEW_SELECTION_TOOL::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(), EDA_3D_CONTROLLER::Main(), 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

◆ m_originalCursor

◆ m_selection

◆ m_skip_heuristics

◆ m_subtractive

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

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

Definition at line 209 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), 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(), EDIT_TOOL::CreateArray(), MICROWAVE_TOOL::createInductorBetween(), DRC_TOOL::CrossProbe(), 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(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::FindItem(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_REANNOTATE_TOOL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), GROUP_TOOL::Init(), CONVERT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), GLOBAL_EDIT_TOOL::Init(), PL_POINT_EDITOR::Init(), BOARD_INSPECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PCB_POINT_EDITOR::Init(), BOARD_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::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(), SYMBOL_EDITOR_MOVE_TOOL::Main(), CVPCB_CONTROL::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(), onDisambiguationExpire(), EE_SELECTION_TOOL::onDisambiguationExpire(), PCB_SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), 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::Selectable(), 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(), EDIT_TOOL::updateModificationPoint(), EE_POINT_EDITOR::updateParentItem(), BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest(), PNS::TOOL_BASE::updateStartItem(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 213 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 206 of file tool_base.h.

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


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