KiCad PCB EDA Suite
GERBVIEW_SELECTION_TOOL Class Reference

Selection tool for GerbView, based on the one in Pcbnew. More...

#include <gerbview_selection_tool.h>

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

 GERBVIEW_SELECTION_TOOL ()
 
 ~GERBVIEW_SELECTION_TOOL ()
 
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...
 
GERBVIEW_SELECTIONGetSelection ()
 Return the set of currently selected items. More...
 
int ClearSelection (const TOOL_EVENT &aEvent)
 
int SelectItem (const TOOL_EVENT &aEvent)
 
int SelectItems (const TOOL_EVENT &aEvent)
 
int UnselectItem (const TOOL_EVENT &aEvent)
 
int UnselectItems (const TOOL_EVENT &aEvent)
 Sets up handlers for various events. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. 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 selectPoint (const VECTOR2I &aWhere, bool aOnDrag=false)
 Select an item pointed by the parameter aWhere. More...
 
bool selectCursor (bool aSelectAlways=false)
 Select an item under the cursor unless there is something already selected or aSelectAlways is true. More...
 
void clearSelection ()
 Clear the current selection. More...
 
EDA_ITEMdisambiguationMenu (GERBER_COLLECTOR *aItems)
 Handle the menu that allows one to select one of many items in case there is more than one item at the selected point (. More...
 
bool selectable (const EDA_ITEM *aItem) const
 Check conditions for an item to be selected. More...
 
void select (EDA_ITEM *aItem)
 Take necessary action mark an item as selected. More...
 
void unselect (EDA_ITEM *aItem)
 Take necessary action mark an item as unselected. More...
 
void selectVisually (EDA_ITEM *aItem)
 Mark item as selected, but does not add it to the #ITEMS_PICKED_LIST. More...
 
void unselectVisually (EDA_ITEM *aItem)
 Mark item as selected, but does not add it to the #ITEMS_PICKED_LIST. More...
 

Private Attributes

GERBVIEW_FRAMEm_frame
 
GERBVIEW_SELECTION m_selection
 
bool m_preliminary
 

Detailed Description

Selection tool for GerbView, based on the one in Pcbnew.

Definition at line 46 of file gerbview_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

◆ GERBVIEW_SELECTION_TOOL()

GERBVIEW_SELECTION_TOOL::GERBVIEW_SELECTION_TOOL ( )

Definition at line 115 of file gerbview_selection_tool.cpp.

115  :
116  TOOL_INTERACTIVE( "gerbview.InteractiveSelection" ),
117  m_frame( nullptr )
118 {
119  m_preliminary = true;
120 }
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.

References m_preliminary.

◆ ~GERBVIEW_SELECTION_TOOL()

GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL ( )

Definition at line 138 of file gerbview_selection_tool.cpp.

139 {
140  getView()->Remove( &m_selection );
141 }
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:353
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36

References TOOL_BASE::getView(), m_selection, and KIGFX::VIEW::Remove().

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

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

◆ ClearSelection()

int GERBVIEW_SELECTION_TOOL::ClearSelection ( const TOOL_EVENT aEvent)

Definition at line 315 of file gerbview_selection_tool.cpp.

316 {
317  clearSelection();
318 
319  return 0;
320 }
void clearSelection()
Clear the current selection.

References clearSelection().

Referenced by setTransitions().

◆ clearSelection()

void GERBVIEW_SELECTION_TOOL::clearSelection ( )
private

Clear the current selection.

Definition at line 391 of file gerbview_selection_tool.cpp.

392 {
393  if( m_selection.Empty() )
394  return;
395 
396  for( EDA_ITEM* item : m_selection )
397  unselectVisually( item );
398 
399  m_selection.Clear();
400 
401  // Inform other potentially interested tools
403 }
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:82
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).
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
Definition: actions.h:201
void unselectVisually(EDA_ITEM *aItem)
Mark item as selected, but does not add it to the #ITEMS_PICKED_LIST.
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:97
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100

References SELECTION::Clear(), EVENTS::ClearedEvent, SELECTION::Empty(), m_selection, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), and unselectVisually().

Referenced by ClearSelection(), Main(), Reset(), selectCursor(), and selectPoint().

◆ disambiguationMenu()

EDA_ITEM * GERBVIEW_SELECTION_TOOL::disambiguationMenu ( GERBER_COLLECTOR aItems)
private

Handle the menu that allows one to select one of many items in case there is more than one item at the selected point (.

See also
selectCursor()).
Parameters
aItemscontains list of items that are displayed to the user.

Definition at line 406 of file gerbview_selection_tool.cpp.

407 {
408  EDA_ITEM* current = nullptr;
409  KIGFX::VIEW_GROUP highlightGroup;
410  ACTION_MENU menu( true );
411 
412  highlightGroup.SetLayer( LAYER_SELECT_OVERLAY );
413  getView()->Add( &highlightGroup );
414 
415  int limit = std::min( 10, aCollector->GetCount() );
416 
417  for( int i = 0; i < limit; ++i )
418  {
419  wxString text;
420  EDA_ITEM* item = ( *aCollector )[i];
422  menu.Add( text, i + 1, item->GetMenuImage() );
423  }
424 
425  if( aCollector->m_MenuTitle.Length() )
426  {
427  menu.SetTitle( aCollector->m_MenuTitle );
428  menu.SetIcon( BITMAPS::info );
429  menu.DisplayTitle( true );
430  }
431  else
432  {
433  menu.DisplayTitle( false );
434  }
435 
436  SetContextMenu( &menu, CMENU_NOW );
437 
438  while( TOOL_EVENT* evt = Wait() )
439  {
440  if( evt->Action() == TA_CHOICE_MENU_UPDATE )
441  {
442  if( current )
443  {
444  current->ClearBrightened();
445  getView()->Hide( current, false );
446  highlightGroup.Remove( current );
448  }
449 
450  int id = *evt->GetCommandId();
451 
452  // User has pointed an item, so show it in a different way
453  if( id > 0 && id <= limit )
454  {
455  current = ( *aCollector )[id - 1];
456  current->SetBrightened();
457  getView()->Hide( current, true );
458  highlightGroup.Add( current );
460  }
461  else
462  {
463  current = nullptr;
464  }
465  }
466  else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
467  {
468  OPT<int> id = evt->GetCommandId();
469 
470  // User has selected an item, so this one will be returned
471  if( id && ( *id > 0 ) )
472  current = ( *aCollector )[*id - 1];
473  else
474  current = nullptr;
475 
476  break;
477  }
478  }
479 
480  if( current && current->IsBrightened() )
481  {
482  current->ClearBrightened();
483  getView()->Hide( current, false );
485  }
486 
487  getView()->Remove( &highlightGroup );
488 
489  return current;
490 }
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hide the item in the view (e.g.
Definition: view.cpp:1485
currently selected items overlay
Definition: layer_ids.h:214
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
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:353
void SetBrightened()
Definition: eda_item.h:130
bool IsBrightened() const
Definition: eda_item.h:126
void SetContextMenu(ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Assign a context menu and tells when it should be activated.
void ClearBrightened()
Definition: eda_item.h:133
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:609
Generic, UI-independent tool event.
Definition: tool_event.h:152
Extend VIEW_ITEM by possibility of grouping items into a single object.
Definition: view_group.h:46
Items that may change while the view stays the same (noncached)
Definition: definitions.h:50
virtual void Remove(VIEW_ITEM *aItem)
Remove an item from the group.
Definition: view_group.cpp:62
virtual void Add(VIEW_ITEM *aItem)
Add an item to the group.
Definition: view_group.cpp:56
virtual void SetLayer(int aLayer)
Set layer used to draw the group.
Definition: view_group.h:108
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
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:211
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
boost::optional< T > OPT
Definition: optional.h:7
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:323
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References KIGFX::VIEW_GROUP::Add(), ACTION_MENU::Add(), KIGFX::VIEW::Add(), EDA_ITEM::ClearBrightened(), CMENU_NOW, ACTION_MENU::DisplayTitle(), COLLECTOR::GetCount(), EDA_ITEM::GetMenuImage(), EDA_ITEM::GetSelectMenuText(), EDA_BASE_FRAME::GetUserUnits(), TOOL_BASE::getView(), KIGFX::VIEW::Hide(), info, EDA_ITEM::IsBrightened(), LAYER_SELECT_OVERLAY, m_frame, COLLECTOR::m_MenuTitle, KIGFX::VIEW::MarkTargetDirty(), KIGFX::VIEW_GROUP::Remove(), KIGFX::VIEW::Remove(), EDA_ITEM::SetBrightened(), TOOL_INTERACTIVE::SetContextMenu(), ACTION_MENU::SetIcon(), KIGFX::VIEW_GROUP::SetLayer(), ACTION_MENU::SetTitle(), TA_CHOICE_MENU_CHOICE, TA_CHOICE_MENU_UPDATE, KIGFX::TARGET_OVERLAY, text, and TOOL_INTERACTIVE::Wait().

Referenced by 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()

GERBVIEW_SELECTION & GERBVIEW_SELECTION_TOOL::GetSelection ( )

Return the set of currently selected items.

Definition at line 233 of file gerbview_selection_tool.cpp.

234 {
235  return m_selection;
236 }

References m_selection.

Referenced by GERBVIEW_CONTROL::UpdateMessagePanel().

◆ 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(), PL_SELECTION_TOOL::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(), disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::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(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), 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(), Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), PCB_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), select(), selectable(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SCH_DRAWING_TOOLS::TwoClickPlace(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlight(), unselect(), unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), PCB_SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), ~GERBVIEW_SELECTION_TOOL(), 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(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), PCB_POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), selectCursor(), PCB_SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PCB_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), PL_EDIT_TOOL::updateModificationPoint(), 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(), ROUTER_TOOL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), 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_EDIT_TOOL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), PCB_CONTROL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), DRC_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ Init()

bool GERBVIEW_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 144 of file gerbview_selection_tool.cpp.

145 {
146  auto selectMenu = std::make_shared<HIGHLIGHT_MENU>();
147  selectMenu->SetTool( this );
148  m_menu.AddSubMenu( selectMenu );
149 
150  auto& menu = m_menu.GetMenu();
151 
152  menu.AddMenu( selectMenu.get() );
153  menu.AddSeparator( 1000 );
154 
155  getEditFrame<GERBVIEW_FRAME>()->AddStandardSubMenus( m_menu );
156 
157  return true;
158 }
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Add a submenu to the menu.
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Store a submenu of this menu model.
Definition: tool_menu.cpp:52

References CONDITIONAL_MENU::AddMenu(), TOOL_MENU::AddSubMenu(), TOOL_MENU::GetMenu(), and TOOL_INTERACTIVE::m_menu.

◆ 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 ROUTER_TOOL::handleLayerSwitch(), EDIT_TOOL::isRouterActive(), PCB_SELECTION_TOOL::Main(), BOARD_EDITOR_CONTROL::TrackWidthDec(), and BOARD_EDITOR_CONTROL::TrackWidthInc().

◆ Main()

int GERBVIEW_SELECTION_TOOL::Main ( const TOOL_EVENT aEvent)

The main loop.

Definition at line 186 of file gerbview_selection_tool.cpp.

187 {
188  // Main loop: keep receiving events
189  while( TOOL_EVENT* evt = Wait() )
190  {
191  if( m_frame->ToolStackIsEmpty() )
193 
194  // on left click, a selection is made, depending on modifiers ALT, SHIFT, CTRL:
195  setModifiersState( evt->Modifier( MD_SHIFT ), evt->Modifier( MD_CTRL ),
196  evt->Modifier( MD_ALT ) );
197 
198  // single click? Select single object
199  if( evt->IsClick( BUT_LEFT ) )
200  {
201  selectPoint( evt->Position() );
202  }
203  else if( evt->IsClick( BUT_RIGHT ) )
204  {
205  // right click? if there is any object - show the context menu
206  if( m_selection.Empty() )
207  {
208  selectPoint( evt->Position() );
209  m_selection.SetIsHover( true );
210  }
211 
213  }
214  else if( evt->IsDblClick( BUT_MIDDLE ) )
215  {
216  // Middle double click? Do zoom to fit
218  }
219  else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE )
220  {
221  clearSelection();
222  }
223  else
224  {
225  evt->SetPassEvent();
226  }
227  }
228 
229  return 0;
230 }
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.
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.
bool selectPoint(const VECTOR2I &aWhere, bool aOnDrag=false)
Select an item pointed by the parameter aWhere.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
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 SetIsHover(bool aIsHover)
Definition: selection.h:68
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 ...
Generic, UI-independent tool event.
Definition: tool_event.h:152
bool ToolStackIsEmpty()
Definition: tools_holder.h:116
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:97
void clearSelection()
Clear the current selection.
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59

References ARROW, BUT_LEFT, BUT_MIDDLE, BUT_RIGHT, clearSelection(), SELECTION::Empty(), EDA_DRAW_FRAME::GetCanvas(), m_frame, TOOL_INTERACTIVE::m_menu, m_selection, TOOL_BASE::m_toolMgr, MD_ALT, MD_CTRL, MD_SHIFT, TOOL_MANAGER::RunAction(), selectPoint(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), SELECTION::SetIsHover(), SELECTION_TOOL::setModifiersState(), TOOL_MENU::ShowContextMenu(), TA_UNDO_REDO_PRE, TOOLS_HOLDER::ToolStackIsEmpty(), TOOL_INTERACTIVE::Wait(), and ACTIONS::zoomFitScreen.

Referenced by setTransitions().

◆ Reset()

void GERBVIEW_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 161 of file gerbview_selection_tool.cpp.

162 {
163  m_frame = getEditFrame<GERBVIEW_FRAME>();
164  m_preliminary = true;
165 
166  if( aReason == TOOL_BASE::MODEL_RELOAD )
167  {
168  // Remove pointers to the selected items from containers
169  // without changing their properties (as they are already deleted
170  // while a new file is loaded)
171  m_selection.Clear();
172  getView()->GetPainter()->GetSettings()->SetHighlight( false );
173  }
174  else
175  {
176  // Restore previous properties of selected items and remove them from containers
177  clearSelection();
178  }
179 
180  // Reinsert the VIEW_GROUP, in case it was removed from the VIEW
181  getView()->Remove( &m_selection );
182  getView()->Add( &m_selection );
183 }
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:82
Model changes (required full reload)
Definition: tool_base.h:80
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:353
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
void clearSelection()
Clear the current selection.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:323

References KIGFX::VIEW::Add(), SELECTION::Clear(), clearSelection(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), TOOL_BASE::getView(), m_frame, m_preliminary, m_selection, TOOL_BASE::MODEL_RELOAD, KIGFX::VIEW::Remove(), and KIGFX::RENDER_SETTINGS::SetHighlight().

◆ 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 GERBVIEW_SELECTION_TOOL::select ( EDA_ITEM aItem)
private

Take necessary action mark an item as selected.

Parameters
aItemis an item to be selected.

Definition at line 517 of file gerbview_selection_tool.cpp.

518 {
519  if( aItem->IsSelected() )
520  return;
521 
522  m_selection.Add( aItem );
523  getView()->Add( &m_selection, std::numeric_limits<int>::max() );
524  selectVisually( aItem );
525 }
bool IsSelected() const
Definition: eda_item.h:123
virtual void Add(EDA_ITEM *aItem)
Definition: selection.cpp:31
void selectVisually(EDA_ITEM *aItem)
Mark item as selected, but does not add it to the #ITEMS_PICKED_LIST.
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:323

References SELECTION::Add(), KIGFX::VIEW::Add(), TOOL_BASE::getView(), EDA_ITEM::IsSelected(), m_selection, and selectVisually().

Referenced by SelectItem(), SelectItems(), and selectPoint().

◆ selectable()

bool GERBVIEW_SELECTION_TOOL::selectable ( const EDA_ITEM aItem) const
private

Check conditions for an item to be selected.

Returns
True if the item fulfills conditions to be selected.

Definition at line 493 of file gerbview_selection_tool.cpp.

494 {
495  GERBVIEW_FRAME* frame = getEditFrame<GERBVIEW_FRAME>();
496  const GERBER_DRAW_ITEM* item = static_cast<const GERBER_DRAW_ITEM*>( aItem );
497  int layer = item->GetLayer();
498 
499 
500  if( item->GetLayerPolarity() )
501  {
502  // Don't allow selection of invisible negative items
503  auto rs = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( getView()->GetPainter()->GetSettings() );
504 
505  if( !rs->IsShowNegativeItems() )
506  return false;
507  }
508 
509  // We do not want to select items that are in the background
510  if( frame->GetDisplayOptions().m_HighContrastMode && layer != frame->GetActiveLayer() )
511  return false;
512 
513  return frame->IsLayerVisible( layer );
514 }
int GetLayer() const
Return the layer this item is on.
const GBR_DISPLAY_OPTIONS & GetDisplayOptions() const
bool m_HighContrastMode
High contrast mode (dim un-highlighted objects)
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
int GetActiveLayer() const
Return the active layer.
bool IsLayerVisible(int aLayer) const
Test whether a given layer is visible.
bool GetLayerPolarity() const

References GERBVIEW_FRAME::GetActiveLayer(), GERBVIEW_FRAME::GetDisplayOptions(), GERBER_DRAW_ITEM::GetLayer(), GERBER_DRAW_ITEM::GetLayerPolarity(), TOOL_BASE::getView(), GERBVIEW_FRAME::IsLayerVisible(), and GBR_DISPLAY_OPTIONS::m_HighContrastMode.

Referenced by selectPoint().

◆ selectCursor()

bool GERBVIEW_SELECTION_TOOL::selectCursor ( bool  aSelectAlways = false)
private

Select an item under the cursor unless there is something already selected or aSelectAlways is true.

Parameters
aSelectAlwaysforces to select an item even if there is an item already selected.
Returns
true if eventually there is an item selected, false otherwise.

Definition at line 293 of file gerbview_selection_tool.cpp.

294 {
295  if( aSelectAlways || m_selection.Empty() )
296  {
297  clearSelection();
298  selectPoint( getViewControls()->GetCursorPosition( false ) );
299  }
300 
301  return !m_selection.Empty();
302 }
bool selectPoint(const VECTOR2I &aWhere, bool aOnDrag=false)
Select an item pointed by the parameter aWhere.
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:97
void clearSelection()
Clear the current selection.
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42

References clearSelection(), SELECTION::Empty(), TOOL_BASE::getViewControls(), m_selection, and selectPoint().

◆ SelectItem()

int GERBVIEW_SELECTION_TOOL::SelectItem ( const TOOL_EVENT aEvent)

Definition at line 340 of file gerbview_selection_tool.cpp.

341 {
342  // Check if there is an item to be selected
343  EDA_ITEM* item = aEvent.Parameter<EDA_ITEM*>();
344 
345  if( item )
346  {
347  select( item );
348 
349  // Inform other potentially interested tools
351  }
352 
353  return 0;
354 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:199
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).
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:100
void select(EDA_ITEM *aItem)
Take necessary action mark an item as selected.

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

Referenced by setTransitions().

◆ SelectItems()

int GERBVIEW_SELECTION_TOOL::SelectItems ( const TOOL_EVENT aEvent)

Definition at line 323 of file gerbview_selection_tool.cpp.

324 {
325  std::vector<EDA_ITEM*>* items = aEvent.Parameter<std::vector<EDA_ITEM*>*>();
326 
327  if( items )
328  {
329  // Perform individual selection of each item before processing the event.
330  for( EDA_ITEM* item : *items )
331  select( item );
332 
334  }
335 
336  return 0;
337 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:199
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).
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:100
void select(EDA_ITEM *aItem)
Take necessary action mark an item as selected.

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

◆ selectPoint()

bool GERBVIEW_SELECTION_TOOL::selectPoint ( const VECTOR2I aWhere,
bool  aOnDrag = false 
)
private

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.
aAllowDisambiguationdecides what to do in case of disambiguation. If true, then a menu is shown, otherwise function finishes without selecting anything.
Returns
True if an item was selected, false otherwise.

Definition at line 239 of file gerbview_selection_tool.cpp.

240 {
241  EDA_ITEM* item = nullptr;
242  GERBER_COLLECTOR collector;
243  EDA_ITEM* model = getModel<EDA_ITEM>();
244 
245  collector.Collect( model, GERBER_COLLECTOR::AllItems, wxPoint( aWhere.x, aWhere.y ) );
246 
247  // Remove unselectable items
248  for( int i = collector.GetCount() - 1; i >= 0; --i )
249  {
250  if( !selectable( collector[i] ) )
251  collector.Remove( i );
252  }
253 
254  if( collector.GetCount() > 1 )
255  {
256  if( aOnDrag )
258 
259  item = disambiguationMenu( &collector );
260 
261  if( item )
262  {
263  collector.Empty();
264  collector.Append( item );
265  }
266  }
267 
269  clearSelection();
270 
271  if( collector.GetCount() == 1 )
272  {
273  item = collector[ 0 ];
274 
275  if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
276  {
277  unselect( item );
279  return false;
280  }
281  else
282  {
283  select( item );
285  return true;
286  }
287  }
288 
289  return false;
290 }
void Empty()
Clear the list.
Definition: collector.h:95
static const TOOL_EVENT SelectedEvent
Definition: actions.h:199
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.
bool IsSelected() const
Definition: eda_item.h:123
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:200
bool selectable(const EDA_ITEM *aItem) const
Check conditions for an item to be selected.
Use when the right click button is pressed or when the select tool is in effect.
EDA_ITEM * disambiguationMenu(GERBER_COLLECTOR *aItems)
Handle the menu that allows one to select one of many items in case there is more than one item at th...
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
static const KICAD_T AllItems[]
A scan list for all selectable gerber items.
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:115
void Append(EDA_ITEM *item)
Add an item to the end of the list.
Definition: collector.h:105
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
void Collect(EDA_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos)
Scan an EDA_ITEM using this class's Inspector method, which does the collection.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
Generic, UI-independent tool event.
Definition: tool_event.h:152
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:100
void select(EDA_ITEM *aItem)
Take necessary action mark an item as selected.
void clearSelection()
Clear the current selection.

References GERBER_COLLECTOR::AllItems, COLLECTOR::Append(), BUT_LEFT, clearSelection(), GERBER_COLLECTOR::Collect(), disambiguationMenu(), COLLECTOR::Empty(), COLLECTOR::GetCount(), EDA_ITEM::IsSelected(), SELECTION_TOOL::m_additive, SELECTION_TOOL::m_exclusive_or, SELECTION_TOOL::m_subtractive, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ProcessEvent(), COLLECTOR::Remove(), select(), selectable(), EVENTS::SelectedEvent, TA_MOUSE_UP, TC_ANY, unselect(), EVENTS::UnselectedEvent, TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Main(), and selectCursor().

◆ selectVisually()

void GERBVIEW_SELECTION_TOOL::selectVisually ( EDA_ITEM aItem)
private

Mark item as selected, but does not add it to the #ITEMS_PICKED_LIST.

Parameters
aItemis an item to be be marked.

Definition at line 541 of file gerbview_selection_tool.cpp.

542 {
543  // Move the item's layer to the front
544  int layer = static_cast<GERBER_DRAW_ITEM*>( aItem )->GetLayer();
545  m_frame->SetActiveLayer( layer, true );
546 
547  // Hide the original item, so it is shown only on overlay
548  aItem->SetSelected();
549  getView()->Hide( aItem, true );
550 
551  getView()->Update( &m_selection );
552 }
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hide the item in the view (e.g.
Definition: view.cpp:1485
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
change the currently active layer to aLayer and update the GERBER_LAYER_WIDGET.
void SetSelected()
Definition: eda_item.h:129
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:1518

References TOOL_BASE::getView(), KIGFX::VIEW::Hide(), m_frame, m_selection, GERBVIEW_FRAME::SetActiveLayer(), EDA_ITEM::SetSelected(), and KIGFX::VIEW::Update().

Referenced by select().

◆ 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 disambiguationMenu(), PL_SELECTION_TOOL::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. It doesn't hurt
59  // to also have this option.
60  m_skip_heuristics = aAltState;
61 }
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 PL_SELECTION_TOOL::Main(), Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::OnIdle(), and PCB_SELECTION_TOOL::OnIdle().

◆ setTransitions()

void GERBVIEW_SELECTION_TOOL::setTransitions ( )
overridevirtual

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 305 of file gerbview_selection_tool.cpp.

306 {
312 }
static TOOL_ACTION selectionClear
Clear the current selection.
int Main(const TOOL_EVENT &aEvent)
The main loop.
static TOOL_ACTION selectItem
Selects an item (specified as the event parameter).
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 UnselectItem(const TOOL_EVENT &aEvent)
int UpdateMenu(const TOOL_EVENT &aEvent)
static TOOL_ACTION updateMenu
Definition: actions.h:167
int SelectItem(const TOOL_EVENT &aEvent)
static TOOL_ACTION selectionActivate
Activation of the selection tool.
static TOOL_ACTION unselectItem
Unselects an item (specified as the event parameter).
int ClearSelection(const TOOL_EVENT &aEvent)

References ClearSelection(), TOOL_INTERACTIVE::Go(), Main(), GERBVIEW_ACTIONS::selectionActivate, GERBVIEW_ACTIONS::selectionClear, GERBVIEW_ACTIONS::selectItem, SelectItem(), GERBVIEW_ACTIONS::unselectItem, UnselectItem(), UpdateMenu(), and ACTIONS::updateMenu.

◆ unselect()

void GERBVIEW_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 528 of file gerbview_selection_tool.cpp.

529 {
530  if( !aItem->IsSelected() )
531  return;
532 
533  unselectVisually( aItem );
534  m_selection.Remove( aItem );
535 
536  if( m_selection.Empty() )
537  getView()->Remove( &m_selection );
538 }
bool IsSelected() const
Definition: eda_item.h:123
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:353
void unselectVisually(EDA_ITEM *aItem)
Mark item as selected, but does not add it to the #ITEMS_PICKED_LIST.
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:97
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.cpp:43

References SELECTION::Empty(), TOOL_BASE::getView(), EDA_ITEM::IsSelected(), m_selection, SELECTION::Remove(), KIGFX::VIEW::Remove(), and unselectVisually().

Referenced by selectPoint(), UnselectItem(), and UnselectItems().

◆ UnselectItem()

int GERBVIEW_SELECTION_TOOL::UnselectItem ( const TOOL_EVENT aEvent)

Definition at line 374 of file gerbview_selection_tool.cpp.

375 {
376  // Check if there is an item to be selected
377  EDA_ITEM* item = aEvent.Parameter<EDA_ITEM*>();
378 
379  if( item )
380  {
381  unselect( item );
382 
383  // Inform other potentially interested tools
385  }
386 
387  return 0;
388 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:200
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).
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
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:100

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

Referenced by setTransitions().

◆ UnselectItems()

int GERBVIEW_SELECTION_TOOL::UnselectItems ( const TOOL_EVENT aEvent)

Sets up handlers for various events.

Definition at line 357 of file gerbview_selection_tool.cpp.

358 {
359  std::vector<EDA_ITEM*>* items = aEvent.Parameter<std::vector<EDA_ITEM*>*>();
360 
361  if( items )
362  {
363  // Perform individual unselection of each item before processing the event
364  for( EDA_ITEM* item : *items )
365  unselect( item );
366 
368  }
369 
370  return 0;
371 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:200
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).
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
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:100

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

◆ unselectVisually()

void GERBVIEW_SELECTION_TOOL::unselectVisually ( EDA_ITEM aItem)
private

Mark item as selected, but does not add it to the #ITEMS_PICKED_LIST.

Parameters
aItemis an item to be be marked.

Definition at line 555 of file gerbview_selection_tool.cpp.

556 {
557  // Restore original item visibility
558  aItem->ClearSelected();
559  getView()->Hide( aItem, false );
560  getView()->Update( aItem, KIGFX::ALL );
561 
562  getView()->Update( &m_selection );
563 }
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hide the item in the view (e.g.
Definition: view.cpp:1485
void ClearSelected()
Definition: eda_item.h:132
All except INITIAL_ADD.
Definition: view_item.h:58
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:1518

References KIGFX::ALL, EDA_ITEM::ClearSelected(), TOOL_BASE::getView(), KIGFX::VIEW::Hide(), m_selection, and KIGFX::VIEW::Update().

Referenced by clearSelection(), and unselect().

◆ UpdateMenu()

int GERBVIEW_SELECTION_TOOL::UpdateMenu ( const TOOL_EVENT aEvent)

Definition at line 123 of file gerbview_selection_tool.cpp.

124 {
125  ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
126  CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
127 
128  if( conditionalMenu )
129  conditionalMenu->Evaluate( m_selection );
130 
131  if( actionMenu )
132  actionMenu->UpdateAll();
133 
134  return 0;
135 }
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

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 disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::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(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), 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(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), 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

GERBVIEW_FRAME* GERBVIEW_SELECTION_TOOL::m_frame
private

Definition at line 151 of file gerbview_selection_tool.h.

Referenced by disambiguationMenu(), Main(), Reset(), and selectVisually().

◆ 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(), PL_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), BOARD_EDITOR_CONTROL::Init(), 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(), PL_SELECTION_TOOL::Main(), 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_preliminary

bool GERBVIEW_SELECTION_TOOL::m_preliminary
private

Definition at line 154 of file gerbview_selection_tool.h.

Referenced by GERBVIEW_SELECTION_TOOL(), and Reset().

◆ 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(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::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(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), PL_EDIT_TOOL::Copy(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), BOARD_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), PL_SELECTION_TOOL::disambiguateCursor(), EE_SELECTION_TOOL::disambiguateCursor(), PCB_SELECTION_TOOL::disambiguateCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SYMBOL_EDITOR_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), 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(), GROUP_TOOL::Init(), PAD_TOOL::Init(), CONVERT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), GLOBAL_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::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::isInteractiveDragEnabled(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), SCH_NAVIGATE_TOOL::LeaveSheet(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), 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(), PL_SELECTION_TOOL::onDisambiguationExpire(), EE_SELECTION_TOOL::onDisambiguationExpire(), PCB_SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), PL_EDIT_TOOL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_CONTROL::Print(), GERBVIEW_CONTROL::Print(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), PCB_SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::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(), SelectItem(), SelectItems(), PCB_SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), 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(), UnselectItem(), 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(), 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: