KiCad PCB EDA Suite
GERBVIEW_SELECTION_TOOL Class Reference

GERBVIEW_SELECTION_TOOL. More...

#include <gerbview_selection_tool.h>

Inheritance diagram for GERBVIEW_SELECTION_TOOL:
TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 GERBVIEW_SELECTION_TOOL ()
 
 ~GERBVIEW_SELECTION_TOOL ()
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
int UpdateMenu (const TOOL_EVENT &aEvent)
 
int Main (const TOOL_EVENT &aEvent)
 Function Main() More...
 
GERBVIEW_SELECTIONGetSelection ()
 Function GetSelection() 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)
 
int MeasureTool (const TOOL_EVENT &aEvent)
 

Launches a tool to measure between points

More...
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 
void Activate ()
 Function Activate() Runs the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

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

Protected Attributes

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

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

bool selectPoint (const VECTOR2I &aWhere, bool aOnDrag=false)
 Function selectPoint() Selects an item pointed by the parameter aWhere. More...
 
bool selectCursor (bool aSelectAlways=false)
 Function selectCursor() Selects an item under the cursor unless there is something already selected or aSelectAlways is true. More...
 
void clearSelection ()
 Function clearSelection() Clears the current selection. More...
 
EDA_ITEMdisambiguationMenu (GERBER_COLLECTOR *aItems)
 Function disambiguationMenu() Handles 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
 Function selectable() Checks conditions for an item to be selected. More...
 
void select (EDA_ITEM *aItem)
 Function select() Takes necessary action mark an item as selected. More...
 
void unselect (EDA_ITEM *aItem)
 Function unselect() Takes necessary action mark an item as unselected. More...
 
void selectVisually (EDA_ITEM *aItem)
 Function selectVisually() Marks item as selected, but does not add it to the ITEMS_PICKED_LIST. More...
 
void unselectVisually (EDA_ITEM *aItem)
 Function unselectVisually() Marks 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_additive
 
bool m_subtractive
 
bool m_exclusive_or
 
bool m_preliminary
 

Detailed Description

GERBVIEW_SELECTION_TOOL.

Selection tool for GerbView, based on the one in PcbNew

Definition at line 47 of file gerbview_selection_tool.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 78 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ GERBVIEW_SELECTION_TOOL()

GERBVIEW_SELECTION_TOOL::GERBVIEW_SELECTION_TOOL ( )

Definition at line 108 of file gerbview_selection_tool.cpp.

108  :
109  TOOL_INTERACTIVE( "gerbview.InteractiveSelection" ),
110  m_frame( NULL ),
111  m_additive( false ),
112  m_subtractive( false ),
113  m_exclusive_or( false )
114 {
115  m_preliminary = true;
116 }
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Constructor.
#define NULL

References m_preliminary.

◆ ~GERBVIEW_SELECTION_TOOL()

GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL ( )

Definition at line 134 of file gerbview_selection_tool.cpp.

135 {
136  getView()->Remove( &m_selection );
137 }
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36

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

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

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

Definition at line 51 of file tool_interactive.cpp.

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

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

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

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

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

Definition at line 60 of file tool_base.cpp.

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

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ ClearSelection()

int GERBVIEW_SELECTION_TOOL::ClearSelection ( const TOOL_EVENT aEvent)

Definition at line 326 of file gerbview_selection_tool.cpp.

327 {
328  clearSelection();
329 
330  return 0;
331 }
void clearSelection()
Function clearSelection() Clears the current selection.

References clearSelection().

Referenced by setTransitions().

◆ clearSelection()

void GERBVIEW_SELECTION_TOOL::clearSelection ( )
private

Function clearSelection() Clears the current selection.

Definition at line 402 of file gerbview_selection_tool.cpp.

403 {
404  if( m_selection.Empty() )
405  return;
406 
407  for( auto item : m_selection )
408  unselectVisually( static_cast<EDA_ITEM*>( item ) );
409 
410  m_selection.Clear();
411 
412  // Inform other potentially interested tools
414 }
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:94
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
static const TOOL_EVENT ClearedEvent
Definition: actions.h:203
void unselectVisually(EDA_ITEM *aItem)
Function unselectVisually() Marks 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:120

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

Function disambiguationMenu() Handles 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 417 of file gerbview_selection_tool.cpp.

418 {
419  EDA_ITEM* current = NULL;
420  KIGFX::VIEW_GROUP highlightGroup;
421  ACTION_MENU menu( true );
422 
423  highlightGroup.SetLayer( LAYER_SELECT_OVERLAY );
424  getView()->Add( &highlightGroup );
425 
426  int limit = std::min( 10, aCollector->GetCount() );
427 
428  for( int i = 0; i < limit; ++i )
429  {
430  wxString text;
431  EDA_ITEM* item = ( *aCollector )[i];
432  text = item->GetSelectMenuText( m_frame->GetUserUnits() );
433  menu.Add( text, i + 1, item->GetMenuImage() );
434  }
435 
436  menu.SetTitle( _( "Clarify selection" ) );
437  menu.SetIcon( info_xpm );
438  menu.DisplayTitle( true );
439  SetContextMenu( &menu, CMENU_NOW );
440 
441  while( TOOL_EVENT* evt = Wait() )
442  {
443  if( evt->Action() == TA_CHOICE_MENU_UPDATE )
444  {
445  if( current )
446  {
447  current->ClearBrightened();
448  getView()->Hide( current, false );
449  highlightGroup.Remove( current );
451  }
452 
453  int id = *evt->GetCommandId();
454 
455  // User has pointed an item, so show it in a different way
456  if( id > 0 && id <= limit )
457  {
458  current = ( *aCollector )[id - 1];
459  current->SetBrightened();
460  getView()->Hide( current, true );
461  highlightGroup.Add( current );
463  }
464  else
465  {
466  current = NULL;
467  }
468  }
469  else if( evt->Action() == TA_CHOICE_MENU_CHOICE )
470  {
471  OPT<int> id = evt->GetCommandId();
472 
473  // User has selected an item, so this one will be returned
474  if( id && ( *id > 0 ) )
475  current = ( *aCollector )[*id - 1];
476  else
477  current = NULL;
478 
479  break;
480  }
481  }
482 
483  if( current && current->IsBrightened() )
484  {
485  current->ClearBrightened();
486  getView()->Hide( current, false );
488  }
489 
490  getView()->Remove( &highlightGroup );
491 
492  return current;
493 }
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hides the item in the view (e.g.
Definition: view.cpp:1507
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
ACTION_MENU.
Definition: action_menu.h:43
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
void SetBrightened()
Definition: base_struct.h:233
bool IsBrightened() const
Definition: base_struct.h:228
void SetContextMenu(ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Function SetContextMenu()
void ClearBrightened()
Definition: base_struct.h:237
#define NULL
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
TOOL_EVENT.
Definition: tool_event.h:171
Items that may change while the view stays the same (noncached)
Definition: definitions.h:50
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes an item from the group.
Definition: view_group.cpp:61
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
const BITMAP_OPAQUE info_xpm[1]
Definition: info.cpp:75
virtual void SetLayer(int aLayer)
Function SetLayer() Sets layer used to draw the group.
Definition: view_group.h:115
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
#define _(s)
Definition: 3d_actions.cpp:33
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
currently selected items overlay
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:166
boost::optional< T > OPT
Definition: optional.h:7
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346
virtual BITMAP_DEF GetMenuImage() const
Function GetMenuImage returns a pointer to an image to be used in menus.
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_xpm, EDA_ITEM::IsBrightened(), LAYER_SELECT_OVERLAY, m_frame, KIGFX::VIEW::MarkTargetDirty(), NULL, 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, and TOOL_INTERACTIVE::Wait().

Referenced by selectPoint().

◆ getEditFrame()

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

Function getEditFrame()

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

Definition at line 186 of file tool_base.h.

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

References TOOL_BASE::getEditFrameInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

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

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 120 of file tool_base.h.

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

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

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

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

Definition at line 142 of file tool_base.h.

143  {
144  return m_toolMgr;
145  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 200 of file tool_base.h.

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

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Function GetName() Returns the name of the tool.

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

Returns
The name of the tool.

Definition at line 131 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ GetSelection()

GERBVIEW_SELECTION & GERBVIEW_SELECTION_TOOL::GetSelection ( )

Function GetSelection()

Returns the set of currently selected items.

Definition at line 243 of file gerbview_selection_tool.cpp.

244 {
245  return m_selection;
246 }

References m_selection.

Referenced by GERBVIEW_FRAME::Process_Special_Functions(), and GERBVIEW_CONTROL::UpdateMessagePanel().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

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

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

Function getView()

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

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

◆ getViewControls()

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

Function getViewControls()

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

43 {
44  return m_toolMgr->GetViewControls();
45 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
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(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), COMMON_TOOLS::GridPreset(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), MODULE_EDITOR_TOOLS::ImportFootprint(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), Main(), ROUTER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), selectCursor(), SELECTION_TOOL::selectCursor(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

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

Function Go()

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

Definition at line 129 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

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

◆ Init()

bool GERBVIEW_SELECTION_TOOL::Init ( )
overridevirtual

Function Init() Init() is called once upon a registration of the tool.

Returns
True if the initialization went fine, false - otherwise.

Reimplemented from TOOL_BASE.

Definition at line 140 of file gerbview_selection_tool.cpp.

141 {
142  auto selectMenu = std::make_shared<HIGHLIGHT_MENU>();
143  selectMenu->SetTool( this );
144  m_menu.AddSubMenu( selectMenu );
145 
146  auto& menu = m_menu.GetMenu();
147 
148  menu.AddMenu( selectMenu.get() );
149  menu.AddSeparator( 1000 );
150 
151  getEditFrame<GERBVIEW_FRAME>()->AddStandardSubMenus( m_menu );
152 
153  return true;
154 }
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddMenu()
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Function CreateSubMenu.
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:218
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:213
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing)

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

◆ Main()

int GERBVIEW_SELECTION_TOOL::Main ( const TOOL_EVENT aEvent)

Function Main()

The main loop.

Definition at line 180 of file gerbview_selection_tool.cpp.

181 {
182  // Main loop: keep receiving events
183  while( TOOL_EVENT* evt = Wait() )
184  {
185  if( m_frame->ToolStackIsEmpty() )
186  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
187 
189 
190  if( evt->Modifier( MD_SHIFT ) && evt->Modifier( MD_CTRL ) )
191  m_subtractive = true;
192  else if( evt->Modifier( MD_SHIFT ) )
193  m_additive = true;
194  else if( evt->Modifier( MD_CTRL ) )
195  m_exclusive_or = true;
196 
197  // This is kind of hacky: activate RMB drag on any event.
198  // There doesn't seem to be any other good way to tell when another tool
199  // is canceled and control returns to the selection tool, except by the
200  // fact that the selection tool starts to get events again.
202  {
203  getViewControls()->SetAdditionalPanButtons( false, true );
204  }
205 
206  // Disable RMB pan for other tools; they can re-enable if desired
207  if( evt->IsActivate() )
208  {
209  getViewControls()->SetAdditionalPanButtons( false, false );
210  }
211 
212  // single click? Select single object
213  if( evt->IsClick( BUT_LEFT ) )
214  {
215  selectPoint( evt->Position() );
216  }
217 
218  // right click? if there is any object - show the context menu
219  else if( evt->IsClick( BUT_RIGHT ) )
220  {
221  if( m_selection.Empty() )
222  {
223  selectPoint( evt->Position() );
224  m_selection.SetIsHover( true );
225  }
226 
228  }
229 
230  else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE )
231  {
232  clearSelection();
233  }
234 
235  else
236  evt->SetPassEvent();
237  }
238 
239  return 0;
240 }
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
bool selectPoint(const VECTOR2I &aWhere, bool aOnDrag=false)
Function selectPoint() Selects an item pointed by the parameter aWhere.
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void SetIsHover(bool aIsHover)
Definition: selection.h:65
TOOL_EVENT.
Definition: tool_event.h:171
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:120
void SetAdditionalPanButtons(bool aLeft=false, bool aRight=false)
bool ToolStackIsEmpty()
void clearSelection()
Function clearSelection() Clears the current selection.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
bool IsCurrentTool(const TOOL_ACTION &aAction) const
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
static TOOL_ACTION selectionTool
Definition: actions.h:146

References BUT_LEFT, BUT_RIGHT, clearSelection(), SELECTION::Empty(), EDA_DRAW_FRAME::GetCanvas(), TOOL_BASE::getViewControls(), EDA_BASE_FRAME::IsCurrentTool(), m_additive, m_exclusive_or, m_frame, TOOL_INTERACTIVE::m_menu, m_selection, m_subtractive, MD_CTRL, MD_SHIFT, ACTIONS::selectionTool, selectPoint(), KIGFX::VIEW_CONTROLS::SetAdditionalPanButtons(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), SELECTION::SetIsHover(), TOOL_MENU::ShowContextMenu(), TA_UNDO_REDO_PRE, EDA_BASE_FRAME::ToolStackIsEmpty(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ MeasureTool()

int GERBVIEW_SELECTION_TOOL::MeasureTool ( const TOOL_EVENT aEvent)

Launches a tool to measure between points

Definition at line 568 of file gerbview_selection_tool.cpp.

569 {
570  auto& view = *getView();
571  auto& controls = *getViewControls();
572  auto previous_settings = controls.GetSettings();
573 
574  std::string tool = aEvent.GetCommandStr().get();
575  m_frame->PushTool( tool );
576  Activate();
577 
579  KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, m_frame->GetUserUnits() );
580 
581  view.Add( &ruler );
582  view.SetVisible( &ruler, false );
583 
584  bool originSet = false;
585 
586  controls.ShowCursor( true );
587  controls.SetSnapping( true );
588  controls.SetAdditionalPanButtons( false, true );
589 
590  while( TOOL_EVENT* evt = Wait() )
591  {
592  m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
593  const VECTOR2I cursorPos = controls.GetCursorPosition();
594 
595  auto clearRuler = [&] () {
596  view.SetVisible( &ruler, false );
597  controls.SetAutoPan( false );
598  controls.CaptureCursor( false );
599  originSet = false;
600  };
601 
602  if( evt->IsCancelInteractive() )
603  {
604  if( originSet )
605  clearRuler();
606  else
607  {
608  m_frame->PopTool( tool );
609  break;
610  }
611  }
612 
613  else if( evt->IsActivate() )
614  {
615  if( originSet )
616  clearRuler();
617 
618  if( evt->IsMoveTool() )
619  {
620  // leave ourselves on the stack so we come back after the move
621  break;
622  }
623  else
624  {
625  m_frame->PopTool( tool );
626  break;
627  }
628  }
629 
630  // click or drag starts
631  else if( !originSet && ( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) )
632  {
633  if( !evt->IsDrag( BUT_LEFT ) )
634  {
635  twoPtMgr.SetOrigin( cursorPos );
636  twoPtMgr.SetEnd( cursorPos );
637  }
638 
639  controls.CaptureCursor( true );
640  controls.SetAutoPan( true );
641 
642  originSet = true;
643  }
644 
645  else if( !originSet && evt->IsMotion() )
646  {
647  // make sure the origin is set before a drag starts
648  // otherwise you can miss a step
649  twoPtMgr.SetOrigin( cursorPos );
650  twoPtMgr.SetEnd( cursorPos );
651  }
652 
653  // second click or mouse up after drag ends
654  else if( originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
655  {
656  originSet = false;
657 
658  controls.SetAutoPan( false );
659  controls.CaptureCursor( false );
660 
661  view.SetVisible( &ruler, false );
662  }
663 
664  // move or drag when origin set updates rules
665  else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
666  {
667  twoPtMgr.SetAngleSnap( evt->Modifier( MD_CTRL ) );
668  twoPtMgr.SetEnd( cursorPos );
669 
670  view.SetVisible( &ruler, true );
671  view.Update( &ruler, KIGFX::GEOMETRY );
672  }
673 
674  else if( evt->IsClick( BUT_RIGHT ) )
675  {
677  }
678 
679  else
680  evt->SetPassEvent();
681  }
682 
683  view.SetVisible( &ruler, false );
684  view.Remove( &ruler );
685  controls.ApplySettings( previous_settings );
686  return 0;
687 }
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_EVENT.
Definition: tool_event.h:171
void SetOrigin(const VECTOR2I &aOrigin)
Set the origin of the ruler (the fixed end)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
virtual void PopTool(const std::string &actionName)
void Activate()
Function Activate() Runs the tool.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the end that moves with the cursor.
Color has changed.
Definition: view_item.h:57

References TOOL_INTERACTIVE::Activate(), BUT_LEFT, BUT_RIGHT, KIGFX::GEOMETRY, EDA_DRAW_FRAME::GetCanvas(), TOOL_EVENT::GetCommandStr(), EDA_BASE_FRAME::GetUserUnits(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), m_frame, TOOL_INTERACTIVE::m_menu, m_selection, MD_CTRL, EDA_BASE_FRAME::PopTool(), EDA_BASE_FRAME::PushTool(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetAngleSnap(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetEnd(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetOrigin(), TOOL_MENU::ShowContextMenu(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ Reset()

void GERBVIEW_SELECTION_TOOL::Reset ( RESET_REASON  aReason)
overridevirtual

Function Reset() Brings the tool to a known, initial state.

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

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 157 of file gerbview_selection_tool.cpp.

158 {
159  m_frame = getEditFrame<GERBVIEW_FRAME>();
160  m_preliminary = true;
161 
162  if( aReason == TOOL_BASE::MODEL_RELOAD )
163  {
164  // Remove pointers to the selected items from containers
165  // without changing their properties (as they are already deleted
166  // while a new file is loaded)
167  m_selection.Clear();
168  getView()->GetPainter()->GetSettings()->SetHighlight( false );
169  }
170  else
171  // Restore previous properties of selected items and remove them from containers
172  clearSelection();
173 
174  // Reinsert the VIEW_GROUP, in case it was removed from the VIEW
175  getView()->Remove( &m_selection );
176  getView()->Add( &m_selection );
177 }
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:94
Model changes (required full reload)
Definition: tool_base.h:81
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aHighlightItems=false)
Function SetHighlight Turns on/off highlighting - it may be done for the active layer,...
Definition: painter.h:136
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
void clearSelection()
Function clearSelection() Clears the current selection.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346

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

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

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

Function select() Takes necessary action mark an item as selected.

Parameters
aItemis an item to be selected.

Definition at line 519 of file gerbview_selection_tool.cpp.

520 {
521  if( aItem->IsSelected() )
522  return;
523 
524  m_selection.Add( aItem );
525  getView()->Add( &m_selection, std::numeric_limits<int>::max() );
526  selectVisually( aItem );
527 }
bool IsSelected() const
Definition: base_struct.h:225
void selectVisually(EDA_ITEM *aItem)
Function selectVisually() Marks item as selected, but does not add it to the ITEMS_PICKED_LIST.
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:75
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346

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

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

Returns
True if the item fulfills conditions to be selected.

Definition at line 496 of file gerbview_selection_tool.cpp.

497 {
498  GERBVIEW_FRAME* frame = getEditFrame<GERBVIEW_FRAME>();
499  const GERBER_DRAW_ITEM* item = static_cast<const GERBER_DRAW_ITEM*>( aItem );
500  int layer = item->GetLayer();
501 
502 
503  if( item->GetLayerPolarity() )
504  {
505  // Don't allow selection of invisible negative items
506  auto rs = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( getView()->GetPainter()->GetSettings() );
507  if( !rs->IsShowNegativeItems() )
508  return false;
509  }
510 
511  // We do not want to select items that are in the background
512  if( frame->GetDisplayOptions().m_HighContrastMode && layer != frame->GetActiveLayer() )
513  return false;
514 
515  return frame->IsLayerVisible( layer );
516 }
int GetLayer() const
Function GetLayer returns the layer this item is on.
const GBR_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions returns the display options current in use.
bool m_HighContrastMode
High contrast mode (dim un-highlighted objects)
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
bool IsLayerVisible(int aLayer) const
Function IsLayerVisible tests 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

Function selectCursor() Selects 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 303 of file gerbview_selection_tool.cpp.

304 {
305  if( aSelectAlways || m_selection.Empty() )
306  {
307  clearSelection();
308  selectPoint( getViewControls()->GetCursorPosition( false ) );
309  }
310 
311  return !m_selection.Empty();
312 }
bool selectPoint(const VECTOR2I &aWhere, bool aOnDrag=false)
Function selectPoint() Selects an item pointed by the parameter aWhere.
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:120
void clearSelection()
Function clearSelection() Clears the current selection.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
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 351 of file gerbview_selection_tool.cpp.

352 {
353  // Check if there is an item to be selected
354  EDA_ITEM* item = aEvent.Parameter<EDA_ITEM*>();
355 
356  if( item )
357  {
358  select( item );
359 
360  // Inform other potentially interested tools
362  }
363 
364  return 0;
365 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:201
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:166
void select(EDA_ITEM *aItem)
Function select() Takes 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 334 of file gerbview_selection_tool.cpp.

335 {
336  std::vector<EDA_ITEM*>* items = aEvent.Parameter<std::vector<EDA_ITEM*>*>();
337 
338  if( items )
339  {
340  // Perform individual selection of each item before processing the event.
341  for( auto item : *items )
342  select( item );
343 
345  }
346 
347  return 0;
348 }
static const TOOL_EVENT SelectedEvent
Definition: actions.h:201
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
void select(EDA_ITEM *aItem)
Function select() Takes 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

Function selectPoint() Selects an item pointed by the parameter aWhere.

If there is more than one item at that place, there is a menu displayed that allows one to choose the item.

Parameters
aWhereis the place where the item should be selected.
aAllowDisambiguationdecides what to do in case of disambiguation. If true, then a menu is shown, otherise function finishes without selecting anything.
Returns
True if an item was selected, false otherwise.

Definition at line 249 of file gerbview_selection_tool.cpp.

250 {
251  EDA_ITEM* item = NULL;
252  GERBER_COLLECTOR collector;
253  EDA_ITEM* model = getModel<EDA_ITEM>();
254 
255  collector.Collect( model, GERBER_COLLECTOR::AllItems, wxPoint( aWhere.x, aWhere.y ) );
256 
257  // Remove unselectable items
258  for( int i = collector.GetCount() - 1; i >= 0; --i )
259  {
260  if( !selectable( collector[i] ) )
261  collector.Remove( i );
262  }
263 
264  if( collector.GetCount() > 1 )
265  {
266  if( aOnDrag )
268 
269  item = disambiguationMenu( &collector );
270 
271  if( item )
272  {
273  collector.Empty();
274  collector.Append( item );
275  }
276  }
277 
279  clearSelection();
280 
281  if( collector.GetCount() == 1 )
282  {
283  item = collector[ 0 ];
284 
285  if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
286  {
287  unselect( item );
289  return false;
290  }
291  else
292  {
293  select( item );
295  return true;
296  }
297  }
298 
299  return false;
300 }
void Empty()
Function Empty sets the list to empty.
Definition: collector.h:109
static const TOOL_EVENT SelectedEvent
Definition: actions.h:201
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
bool IsSelected() const
Definition: base_struct.h:225
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:202
bool selectable(const EDA_ITEM *aItem) const
Function selectable() Checks conditions for an item to be selected.
GERBER_COLLECTOR is intended for use when the right click button is pressed, or when the plain "arrow...
EDA_ITEM * disambiguationMenu(GERBER_COLLECTOR *aItems)
Function disambiguationMenu() Handles the menu that allows one to select one of many items in case th...
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
static const KICAD_T AllItems[]
A scan list for all selectable gerber items.
void Remove(int aIndex)
Function Remove removes the item at aIndex (first position is 0);.
Definition: collector.h:129
void Append(EDA_ITEM *item)
Function Append adds an item to the end of the list.
Definition: collector.h:119
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:100
#define NULL
void Collect(EDA_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos)
Function Collect scans an EDA_ITEM using this class's Inspector method, which does the collection.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
TOOL_EVENT.
Definition: tool_event.h:171
void unselect(EDA_ITEM *aItem)
Function unselect() Takes necessary action mark an item as unselected.
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:166
void select(EDA_ITEM *aItem)
Function select() Takes necessary action mark an item as selected.
void clearSelection()
Function clearSelection() Clears the current selection.

References GERBER_COLLECTOR::AllItems, COLLECTOR::Append(), BUT_LEFT, clearSelection(), GERBER_COLLECTOR::Collect(), disambiguationMenu(), COLLECTOR::Empty(), COLLECTOR::GetCount(), EDA_ITEM::IsSelected(), m_additive, m_exclusive_or, m_subtractive, TOOL_BASE::m_toolMgr, NULL, 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

Function selectVisually() Marks item as selected, but does not add it to the ITEMS_PICKED_LIST.

Parameters
aItemis an item to be be marked.

Definition at line 543 of file gerbview_selection_tool.cpp.

544 {
545  // Move the item's layer to the front
546  int layer = static_cast<GERBER_DRAW_ITEM*>( aItem )->GetLayer();
547  m_frame->SetActiveLayer( layer, true );
548 
549  // Hide the original item, so it is shown only on overlay
550  aItem->SetSelected();
551  getView()->Hide( aItem, true );
552 
553  getView()->Update( &m_selection );
554 }
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hides the item in the view (e.g.
Definition: view.cpp:1507
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function SetActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
void SetSelected()
Definition: base_struct.h:231
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36

References 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

Function SetContextMenu()

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

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

Definition at line 76 of file tool_interactive.cpp.

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

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

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

◆ setTransitions()

void GERBVIEW_SELECTION_TOOL::setTransitions ( )
overridevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 315 of file gerbview_selection_tool.cpp.

316 {
323 }
static TOOL_ACTION selectionClear
Clears the current selection.
int Main(const TOOL_EVENT &aEvent)
Function Main()
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))
Function Go()
int UnselectItem(const TOOL_EVENT &aEvent)
static TOOL_ACTION measureTool
Definition: actions.h:147
int UpdateMenu(const TOOL_EVENT &aEvent)
static TOOL_ACTION updateMenu
Definition: actions.h:162
int MeasureTool(const TOOL_EVENT &aEvent)
Launches a tool to measure between points
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(), MeasureTool(), ACTIONS::measureTool, 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

Function unselect() Takes necessary action mark an item as unselected.

Parameters
aItemis an item to be unselected.

Definition at line 530 of file gerbview_selection_tool.cpp.

531 {
532  if( !aItem->IsSelected() )
533  return;
534 
535  unselectVisually( aItem );
536  m_selection.Remove( aItem );
537 
538  if( m_selection.Empty() )
539  getView()->Remove( &m_selection );
540 }
bool IsSelected() const
Definition: base_struct.h:225
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
void unselectVisually(EDA_ITEM *aItem)
Function unselectVisually() Marks item as selected, but does not add it to the ITEMS_PICKED_LIST.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:120
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.h:86

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

386 {
387  // Check if there is an item to be selected
388  EDA_ITEM* item = aEvent.Parameter<EDA_ITEM*>();
389 
390  if( item )
391  {
392  unselect( item );
393 
394  // Inform other potentially interested tools
396  }
397 
398  return 0;
399 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:202
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
void unselect(EDA_ITEM *aItem)
Function unselect() Takes necessary action mark an item as unselected.
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:166

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)

Definition at line 368 of file gerbview_selection_tool.cpp.

369 {
370  std::vector<EDA_ITEM*>* items = aEvent.Parameter<std::vector<EDA_ITEM*>*>();
371 
372  if( items )
373  {
374  // Perform individual unselection of each item before processing the event
375  for( auto item : *items )
376  unselect( item );
377 
379  }
380 
381  return 0;
382 }
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:202
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:218
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
void unselect(EDA_ITEM *aItem)
Function unselect() Takes necessary action mark an item as unselected.

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

Function unselectVisually() Marks item as selected, but does not add it to the ITEMS_PICKED_LIST.

Parameters
aItemis an item to be be marked.

Definition at line 557 of file gerbview_selection_tool.cpp.

558 {
559  // Restore original item visibility
560  aItem->ClearSelected();
561  getView()->Hide( aItem, false );
562  getView()->Update( aItem, KIGFX::ALL );
563 
564  getView()->Update( &m_selection );
565 }
void Hide(VIEW_ITEM *aItem, bool aHide=true)
Temporarily hides the item in the view (e.g.
Definition: view.cpp:1507
void ClearSelected()
Definition: base_struct.h:235
Item needs to be redrawn.
Definition: view_item.h:61
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36

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

120 {
121  ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
122  CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
123 
124  if( conditionalMenu )
125  conditionalMenu->Evaluate( m_selection );
126 
127  if( actionMenu )
128  actionMenu->UpdateAll();
129 
130  return 0;
131 }
ACTION_MENU.
Definition: action_menu.h:43
void UpdateAll()
Function UpdateAll() Runs update handlers for the menu and its submenus.
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435

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

Referenced by setTransitions().

◆ Wait()

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

Function Wait()

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

Definition at line 57 of file tool_interactive.cpp.

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

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

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

Member Data Documentation

◆ m_additive

bool GERBVIEW_SELECTION_TOOL::m_additive
private

Definition at line 168 of file gerbview_selection_tool.h.

Referenced by Main(), and selectPoint().

◆ m_exclusive_or

bool GERBVIEW_SELECTION_TOOL::m_exclusive_or
private

Definition at line 170 of file gerbview_selection_tool.h.

Referenced by Main(), and selectPoint().

◆ m_frame

GERBVIEW_FRAME* GERBVIEW_SELECTION_TOOL::m_frame
private

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 of file tool_interactive.h.

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

◆ m_preliminary

bool GERBVIEW_SELECTION_TOOL::m_preliminary
private

Definition at line 171 of file gerbview_selection_tool.h.

Referenced by GERBVIEW_SELECTION_TOOL(), and Reset().

◆ m_selection

◆ m_subtractive

bool GERBVIEW_SELECTION_TOOL::m_subtractive
private

Definition at line 169 of file gerbview_selection_tool.h.

Referenced by Main(), and selectPoint().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

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

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

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

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

Definition at line 217 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

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