KiCad PCB EDA Suite
ALIGN_DISTRIBUTE_TOOL Class Reference

#include <placement_tool.h>

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

 ALIGN_DISTRIBUTE_TOOL ()
 
virtual ~ALIGN_DISTRIBUTE_TOOL ()
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
int AlignTop (const TOOL_EVENT &aEvent)
 Function AlignTop() Sets Y coordinate of the selected items to the value of the top-most selected item Y coordinate. More...
 
int AlignBottom (const TOOL_EVENT &aEvent)
 Function AlignBottom() Sets Y coordinate of the selected items to the value of the bottom-most selected item Y coordinate. More...
 
int AlignLeft (const TOOL_EVENT &aEvent)
 Function AlignLeft() Sets X coordinate of the selected items to the value of the left-most selected item X coordinate. More...
 
int AlignRight (const TOOL_EVENT &aEvent)
 Function AlignRight() Sets X coordinate of the selected items to the value of the right-most selected item X coordinate. More...
 
int AlignCenterX (const TOOL_EVENT &aEvent)
 Function AlignCenterX() Sets the x coordinate of the midpoint of each of the selected items to the value of the x coordinate of the center of the middle selected item. More...
 
int AlignCenterY (const TOOL_EVENT &aEvent)
 Function AlignCenterX() Sets the y coordinate of the midpoint of each of the selected items to the value of the y coordinate of the center of the middle selected item. More...
 
int DistributeHorizontally (const TOOL_EVENT &aEvent)
 Function DistributeHorizontally() Distributes the selected items along the X axis. More...
 
int DistributeVertically (const TOOL_EVENT &aEvent)
 Function DistributeVertically() Distributes the selected items along the Y axis. More...
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 
void Activate ()
 Function Activate() Runs the tool. More...
 
void SetContextMenu (CONTEXT_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...
 
OPT_TOOL_EVENT Wait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
TOOL_SETTINGSGetSettings ()
 
bool IsToolActive () const
 

Protected Member Functions

const TOOL_EVENT evActivate (std::string aToolName="")
 functions below are not yet implemented - their interface may change More...
 
const TOOL_EVENT evCommand (int aCommandId=-1)
 
const TOOL_EVENT evCommand (std::string aCommandStr="")
 
const TOOL_EVENT evMotion ()
 
const TOOL_EVENT evClick (int aButton=BUT_ANY)
 
const TOOL_EVENT evDrag (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonUp (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonDown (int aButton=BUT_ANY)
 
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_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

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

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

int doAlignLeft ()
 Sets X coordinate of the selected items to the value of the left-most selected item X coordinate. More...
 
int doAlignRight ()
 Aligns selected items using the right edge of their bounding boxes to the right-most item. More...
 
void filterPadsWithModules (SELECTION &selection)
 Remove pads from a multi-unit select that also includes the pads' parents. More...
 
int checkLockedStatus (const SELECTION &selection) const
 Check a selection to ensure locks are valid for alignment. More...
 
void doDistributeCentersHorizontally (ALIGNMENT_RECTS &itemsToDistribute) const
 Distributes selected items using an even spacing between the centers of their bounding boxes. More...
 
void doDistributeCentersVertically (ALIGNMENT_RECTS &itemsToDistribute) const
 Distributes selected items using an even spacing between the centers of their bounding boxes. More...
 
void doDistributeGapsHorizontally (ALIGNMENT_RECTS &itemsToDistribute, const BOARD_ITEM *lastItem, int totalGap) const
 Distributes selected items using an even spacing between their bounding boxes. More...
 
void doDistributeGapsVertically (ALIGNMENT_RECTS &itemsToDistribute, const BOARD_ITEM *lastItem, int totalGap) const
 Distributes selected items using an even spacing between their bounding boxes. More...
 

Private Attributes

SELECTION_TOOLm_selectionTool
 
CONTEXT_MENUm_placementMenu
 

Detailed Description

Definition at line 35 of file placement_tool.h.

Member Enumeration Documentation

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 80 of file tool_base.h.

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

Constructor & Destructor Documentation

ALIGN_DISTRIBUTE_TOOL::ALIGN_DISTRIBUTE_TOOL ( )

Definition at line 82 of file placement_tool.cpp.

82  :
83  TOOL_INTERACTIVE( "pcbnew.Placement" ), m_selectionTool( NULL ), m_placementMenu( NULL )
84 {
85 }
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Constructor.
CONTEXT_MENU * m_placementMenu
SELECTION_TOOL * m_selectionTool
ALIGN_DISTRIBUTE_TOOL::~ALIGN_DISTRIBUTE_TOOL ( )
virtual

Definition at line 87 of file placement_tool.cpp.

References m_placementMenu.

88 {
89  delete m_placementMenu;
90 }
CONTEXT_MENU * m_placementMenu

Member Function Documentation

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

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

Definition at line 49 of file tool_interactive.cpp.

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

Referenced by EDIT_TOOL::copyToClipboard(), PCBNEW_CONTROL::DeleteItemCursor(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), EDIT_TOOL::pickCopyReferencePoint(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), and PCB_EDITOR_CONTROL::ShowLocalRatsnest().

50 {
52 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:210
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID...
int ALIGN_DISTRIBUTE_TOOL::AlignBottom ( const TOOL_EVENT aEvent)

Function AlignBottom() Sets Y coordinate of the selected items to the value of the bottom-most selected item Y coordinate.

Definition at line 296 of file placement_tool.cpp.

References checkLockedStatus(), CHT_MODIFY, EnsureEditableFilter(), filterPadsWithModules(), FRAME_PCB, GetBoundingBoxes(), BOARD_ITEM::GetParent(), i, m_selectionTool, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Push(), SELECTION_TOOL::RequestSelection(), SELECTION_LOCKED, SortBottommostY(), COMMIT::StageItems(), and EDA_ITEM::Type().

Referenced by Reset(), and setTransitions().

297 {
298  auto frame = getEditFrame<PCB_BASE_FRAME>();
300 
301  if( selection.Size() <= 1 )
302  return 0;
303 
304  filterPadsWithModules( selection );
305 
306  auto itemsToAlign = GetBoundingBoxes( selection );
307  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortBottommostY );
308  if( checkLockedStatus( selection ) == SELECTION_LOCKED )
309  return 0;
310 
311  BOARD_COMMIT commit( frame );
312  commit.StageItems( selection, CHT_MODIFY );
313 
314  // after sorting, the fist item acts as the target for all others
315  const int targetBottom = itemsToAlign.begin()->second.GetBottom();
316 
317  // Move the selected items
318  for( auto& i : itemsToAlign )
319  {
320  int difference = targetBottom - i.second.GetBottom();
321  BOARD_ITEM* item = i.first;
322 
323  // Don't move a pad by itself unless editing the footprint
324  if( item->Type() == PCB_PAD_T && frame->IsType( FRAME_PCB ) )
325  item = item->GetParent();
326 
327  item->Move( wxPoint( 0, difference ) );
328  }
329 
330  commit.Push( _( "Align to bottom" ) );
331 
332  return 0;
333 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
BOARD_ITEM_CONTAINER * GetParent() const
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void filterPadsWithModules(SELECTION &selection)
Remove pads from a multi-unit select that also includes the pads&#39; parents.
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
ALIGNMENT_RECTS GetBoundingBoxes(const SELECTION &sel)
bool SortBottommostY(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
void EnsureEditableFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Definition: edit_tool.cpp:232
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
size_t i
Definition: json11.cpp:597
int checkLockedStatus(const SELECTION &selection) const
Check a selection to ensure locks are valid for alignment.
SELECTION_TOOL * m_selectionTool
int ALIGN_DISTRIBUTE_TOOL::AlignCenterX ( const TOOL_EVENT aEvent)

Function AlignCenterX() Sets the x coordinate of the midpoint of each of the selected items to the value of the x coordinate of the center of the middle selected item.

Definition at line 446 of file placement_tool.cpp.

References checkLockedStatus(), CHT_MODIFY, EnsureEditableFilter(), filterPadsWithModules(), FRAME_PCB, GetBoundingBoxes(), BOARD_ITEM::GetParent(), i, m_selectionTool, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Push(), SELECTION_TOOL::RequestSelection(), SELECTION_LOCKED, SortCenterX(), COMMIT::StageItems(), and EDA_ITEM::Type().

Referenced by Reset(), and setTransitions().

447 {
448  auto frame = getEditFrame<PCB_BASE_FRAME>();
450 
451  if( selection.Size() <= 1 )
452  return 0;
453 
454  filterPadsWithModules( selection );
455 
456  auto itemsToAlign = GetBoundingBoxes( selection );
457  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortCenterX );
458  if( checkLockedStatus( selection ) == SELECTION_LOCKED )
459  return 0;
460 
461  BOARD_COMMIT commit( frame );
462  commit.StageItems( selection, CHT_MODIFY );
463 
464  // after sorting use the center x coordinate of the leftmost item as a target
465  // for all other items
466  const int targetX = itemsToAlign.begin()->second.GetCenter().x;
467 
468  // Move the selected items
469  for( auto& i : itemsToAlign )
470  {
471  int difference = targetX - i.second.GetCenter().x;
472  BOARD_ITEM* item = i.first;
473 
474  // Don't move a pad by itself unless editing the footprint
475  if( item->Type() == PCB_PAD_T && frame->IsType( FRAME_PCB ) )
476  item = item->GetParent();
477 
478  item->Move( wxPoint( difference, 0 ) );
479  }
480 
481  commit.Push( _( "Align to middle" ) );
482 
483  return 0;
484 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
BOARD_ITEM_CONTAINER * GetParent() const
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void filterPadsWithModules(SELECTION &selection)
Remove pads from a multi-unit select that also includes the pads&#39; parents.
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
ALIGNMENT_RECTS GetBoundingBoxes(const SELECTION &sel)
void EnsureEditableFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Definition: edit_tool.cpp:232
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
size_t i
Definition: json11.cpp:597
int checkLockedStatus(const SELECTION &selection) const
Check a selection to ensure locks are valid for alignment.
SELECTION_TOOL * m_selectionTool
bool SortCenterX(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
int ALIGN_DISTRIBUTE_TOOL::AlignCenterY ( const TOOL_EVENT aEvent)

Function AlignCenterX() Sets the y coordinate of the midpoint of each of the selected items to the value of the y coordinate of the center of the middle selected item.

Definition at line 487 of file placement_tool.cpp.

References checkLockedStatus(), CHT_MODIFY, EnsureEditableFilter(), filterPadsWithModules(), FRAME_PCB, GetBoundingBoxes(), BOARD_ITEM::GetParent(), i, m_selectionTool, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Push(), SELECTION_TOOL::RequestSelection(), SELECTION_LOCKED, SortCenterY(), COMMIT::StageItems(), and EDA_ITEM::Type().

Referenced by Reset(), and setTransitions().

488 {
489  auto frame = getEditFrame<PCB_BASE_FRAME>();
491 
492  if( selection.Size() <= 1 )
493  return 0;
494 
495  filterPadsWithModules( selection );
496 
497  auto itemsToAlign = GetBoundingBoxes( selection );
498  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortCenterY );
499  if( checkLockedStatus( selection ) == SELECTION_LOCKED )
500  return 0;
501 
502  BOARD_COMMIT commit( frame );
503  commit.StageItems( selection, CHT_MODIFY );
504 
505  // after sorting use the center y coordinate of the top-most item as a target
506  // for all other items
507  const int targetY = itemsToAlign.begin()->second.GetCenter().y;
508 
509  // Move the selected items
510  for( auto& i : itemsToAlign )
511  {
512  int difference = targetY - i.second.GetCenter().y;
513  BOARD_ITEM* item = i.first;
514 
515  // Don't move a pad by itself unless editing the footprint
516  if( item->Type() == PCB_PAD_T && frame->IsType( FRAME_PCB ) )
517  item = item->GetParent();
518 
519  item->Move( wxPoint( 0, difference ) );
520  }
521 
522  commit.Push( _( "Align to center" ) );
523 
524  return 0;
525 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
BOARD_ITEM_CONTAINER * GetParent() const
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void filterPadsWithModules(SELECTION &selection)
Remove pads from a multi-unit select that also includes the pads&#39; parents.
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
ALIGNMENT_RECTS GetBoundingBoxes(const SELECTION &sel)
bool SortCenterY(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
void EnsureEditableFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Definition: edit_tool.cpp:232
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
size_t i
Definition: json11.cpp:597
int checkLockedStatus(const SELECTION &selection) const
Check a selection to ensure locks are valid for alignment.
SELECTION_TOOL * m_selectionTool
int ALIGN_DISTRIBUTE_TOOL::AlignLeft ( const TOOL_EVENT aEvent)

Function AlignLeft() Sets X coordinate of the selected items to the value of the left-most selected item X coordinate.

Definition at line 336 of file placement_tool.cpp.

References doAlignLeft(), doAlignRight(), and TOOL_BASE::getView().

Referenced by Reset(), and setTransitions().

337 {
338  // Because this tool uses bounding boxes and they aren't mirrored even when
339  // the view is mirrored, we need to call the other one if mirrored.
340  if( getView()->IsMirroredX() )
341  {
342  return doAlignRight();
343  }
344  else
345  {
346  return doAlignLeft();
347  }
348 }
int doAlignRight()
Aligns selected items using the right edge of their bounding boxes to the right-most item...
int doAlignLeft()
Sets X coordinate of the selected items to the value of the left-most selected item X coordinate...
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
int ALIGN_DISTRIBUTE_TOOL::AlignRight ( const TOOL_EVENT aEvent)

Function AlignRight() Sets X coordinate of the selected items to the value of the right-most selected item X coordinate.

Definition at line 391 of file placement_tool.cpp.

References doAlignLeft(), doAlignRight(), and TOOL_BASE::getView().

Referenced by Reset(), and setTransitions().

392 {
393  // Because this tool uses bounding boxes and they aren't mirrored even when
394  // the view is mirrored, we need to call the other one if mirrored.
395  if( getView()->IsMirroredX() )
396  {
397  return doAlignLeft();
398  }
399  else
400  {
401  return doAlignRight();
402  }
403 }
int doAlignRight()
Aligns selected items using the right edge of their bounding boxes to the right-most item...
int doAlignLeft()
Sets X coordinate of the selected items to the value of the left-most selected item X coordinate...
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
int ALIGN_DISTRIBUTE_TOOL::AlignTop ( const TOOL_EVENT aEvent)

Function AlignTop() Sets Y coordinate of the selected items to the value of the top-most selected item Y coordinate.

Definition at line 256 of file placement_tool.cpp.

References checkLockedStatus(), CHT_MODIFY, EnsureEditableFilter(), filterPadsWithModules(), FRAME_PCB, GetBoundingBoxes(), BOARD_ITEM::GetParent(), i, m_selectionTool, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Push(), SELECTION_TOOL::RequestSelection(), SELECTION_LOCKED, SortTopmostY(), COMMIT::StageItems(), and EDA_ITEM::Type().

Referenced by Reset(), and setTransitions().

257 {
258  auto frame = getEditFrame<PCB_BASE_FRAME>();
260 
261  if( selection.Size() <= 1 )
262  return 0;
263 
264  filterPadsWithModules( selection );
265 
266  auto itemsToAlign = GetBoundingBoxes( selection );
267  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortTopmostY );
268  if( checkLockedStatus( selection ) == SELECTION_LOCKED )
269  return 0;
270 
271  BOARD_COMMIT commit( frame );
272  commit.StageItems( selection, CHT_MODIFY );
273 
274  // after sorting, the fist item acts as the target for all others
275  const int targetTop = itemsToAlign.begin()->second.GetY();
276 
277  // Move the selected items
278  for( auto& i : itemsToAlign )
279  {
280  int difference = targetTop - i.second.GetY();
281  BOARD_ITEM* item = i.first;
282 
283  // Don't move a pad by itself unless editing the footprint
284  if( item->Type() == PCB_PAD_T && frame->IsType( FRAME_PCB ) )
285  item = item->GetParent();
286 
287  item->Move( wxPoint( 0, difference ) );
288  }
289 
290  commit.Push( _( "Align to top" ) );
291 
292  return 0;
293 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
BOARD_ITEM_CONTAINER * GetParent() const
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void filterPadsWithModules(SELECTION &selection)
Remove pads from a multi-unit select that also includes the pads&#39; parents.
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
ALIGNMENT_RECTS GetBoundingBoxes(const SELECTION &sel)
void EnsureEditableFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Definition: edit_tool.cpp:232
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
size_t i
Definition: json11.cpp:597
int checkLockedStatus(const SELECTION &selection) const
Check a selection to ensure locks are valid for alignment.
SELECTION_TOOL * m_selectionTool
bool SortTopmostY(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
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 59 of file tool_base.cpp.

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

Referenced by TOOL_MANAGER::RegisterTool().

60 {
61  m_toolMgr = aManager;
62  m_toolSettings = TOOL_SETTINGS( this );
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:216
friend class TOOL_SETTINGS
Definition: tool_base.h:155
int ALIGN_DISTRIBUTE_TOOL::checkLockedStatus ( const SELECTION selection) const
private

Check a selection to ensure locks are valid for alignment.

This is slightly different from the standard lock checking in that we ignore the lock of the first element in the selection as this is meant to be our anchor. We also check the lock of a pad's parent as we will not move pads independently of the parent module

Definition at line 207 of file placement_tool.cpp.

References KIDIALOG::DoNotShowCheckbox(), SELECTION::Front(), PCB_MODULE_EDGE_T, PCB_MODULE_T, PCB_MODULE_TEXT_T, PCB_PAD_T, SELECTION::Remove(), SELECTION_LOCK_OVERRIDE, SELECTION_LOCKED, SELECTION_UNLOCKED, and KIDIALOG::ShowModal().

Referenced by AlignBottom(), AlignCenterX(), AlignCenterY(), AlignTop(), doAlignLeft(), and doAlignRight().

208 {
209  SELECTION moving_items( selection );
210 
211  // Remove the anchor from the list
212  moving_items.Remove( moving_items.Front() );
213 
214  bool containsLocked = false;
215 
216  // Check if the selection contains locked items
217  for( const auto& item : moving_items )
218  {
219  switch ( item->Type() )
220  {
221  case PCB_MODULE_T:
222  if( static_cast< MODULE* >( item )->IsLocked() )
223  containsLocked = true;
224  break;
225 
226  case PCB_PAD_T:
227  case PCB_MODULE_EDGE_T:
228  case PCB_MODULE_TEXT_T:
229  if( static_cast< MODULE* >( item->GetParent() )->IsLocked() )
230  containsLocked = true;
231  break;
232 
233  default: // suppress warnings
234  break;
235  }
236  }
237 
238  if( containsLocked )
239  {
240  KIDIALOG dlg( getEditFrame< PCB_EDIT_FRAME >(),
241  _( "Selection contains locked items. Do you want to continue?" ),
242  _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
243  dlg.SetOKLabel( _( "Continue" ) );
244  dlg.DoNotShowCheckbox();
245 
246  if( dlg.ShowModal() == wxID_OK )
248  else
249  return SELECTION_LOCKED;
250  }
251 
252  return SELECTION_UNLOCKED;
253 }
Helper class to create more flexible dialogs, including &#39;do not show again&#39; checkbox handling...
Definition: confirm.h:44
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
class MODULE, a footprint
Definition: typeinfo.h:89
class TEXTE_MODULE, text in a footprint
Definition: typeinfo.h:93
int ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally ( const TOOL_EVENT aEvent)

Function DistributeHorizontally() Distributes the selected items along the X axis.

Definition at line 528 of file placement_tool.cpp.

References SELECTION_TOOL::CheckLock(), CHT_MODIFY, doDistributeCentersHorizontally(), doDistributeGapsHorizontally(), EnsureEditableFilter(), GetBoundingBoxes(), i, m_selectionTool, BOARD_COMMIT::Push(), SELECTION_TOOL::RequestSelection(), SELECTION_LOCKED, SortLeftmostX(), SortRightmostX(), and COMMIT::StageItems().

Referenced by Reset(), and setTransitions().

529 {
530  auto frame = getEditFrame<PCB_BASE_FRAME>();
532 
533  if( selection.Size() <= 1 )
534  return 0;
535 
537  return 0;
538 
539  BOARD_COMMIT commit( frame );
540  commit.StageItems( selection, CHT_MODIFY );
541 
542  auto itemsToDistribute = GetBoundingBoxes( selection );
543 
544  // find the last item by reverse sorting
545  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortRightmostX );
546  const auto lastItem = itemsToDistribute.begin()->first;
547 
548  const auto maxRight = itemsToDistribute.begin()->second.GetRight();
549 
550  // sort to get starting order
551  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortLeftmostX );
552  const auto minX = itemsToDistribute.begin()->second.GetX();
553  auto totalGap = maxRight - minX;
554  int totalWidth = 0;
555 
556  for( auto& i : itemsToDistribute )
557  {
558  totalWidth += i.second.GetWidth();
559  }
560 
561  if( totalGap < totalWidth )
562  {
563  // the width of the items exceeds the gap (overlapping items) -> use center point spacing
564  doDistributeCentersHorizontally( itemsToDistribute );
565  }
566  else
567  {
568  totalGap -= totalWidth;
569  doDistributeGapsHorizontally( itemsToDistribute, lastItem, totalGap );
570  }
571 
572  commit.Push( _( "Distribute horizontally" ) );
573 
574  return 0;
575 }
bool SortRightmostX(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
bool SortLeftmostX(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
SELECTION_LOCK_FLAGS CheckLock()
Checks if the user has agreed to modify locked items for the given selection.
void doDistributeCentersHorizontally(ALIGNMENT_RECTS &itemsToDistribute) const
Distributes selected items using an even spacing between the centers of their bounding boxes...
ALIGNMENT_RECTS GetBoundingBoxes(const SELECTION &sel)
void EnsureEditableFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Definition: edit_tool.cpp:232
size_t i
Definition: json11.cpp:597
void doDistributeGapsHorizontally(ALIGNMENT_RECTS &itemsToDistribute, const BOARD_ITEM *lastItem, int totalGap) const
Distributes selected items using an even spacing between their bounding boxes.
SELECTION_TOOL * m_selectionTool
int ALIGN_DISTRIBUTE_TOOL::DistributeVertically ( const TOOL_EVENT aEvent)

Function DistributeVertically() Distributes the selected items along the Y axis.

Definition at line 614 of file placement_tool.cpp.

References SELECTION_TOOL::CheckLock(), CHT_MODIFY, doDistributeCentersVertically(), doDistributeGapsVertically(), EnsureEditableFilter(), GetBoundingBoxes(), i, m_selectionTool, BOARD_COMMIT::Push(), SELECTION_TOOL::RequestSelection(), SELECTION_LOCKED, SortBottommostY(), SortTopmostY(), and COMMIT::StageItems().

Referenced by Reset(), and setTransitions().

615 {
616  auto frame = getEditFrame<PCB_BASE_FRAME>();
618 
619  if( selection.Size() <= 1 )
620  return 0;
621 
623  return 0;
624 
625  BOARD_COMMIT commit( frame );
626  commit.StageItems( selection, CHT_MODIFY );
627 
628  auto itemsToDistribute = GetBoundingBoxes( selection );
629 
630  // find the last item by reverse sorting
631  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortBottommostY );
632  const auto maxBottom = itemsToDistribute.begin()->second.GetBottom();
633  const auto lastItem = itemsToDistribute.begin()->first;
634 
635  // sort to get starting order
636  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortTopmostY );
637  auto minY = itemsToDistribute.begin()->second.GetY();
638 
639  auto totalGap = maxBottom - minY;
640  int totalHeight = 0;
641 
642  for( auto& i : itemsToDistribute )
643  {
644  totalHeight += i.second.GetHeight();
645  }
646 
647  if( totalGap < totalHeight )
648  {
649  // the width of the items exceeds the gap (overlapping items) -> use center point spacing
650  doDistributeCentersVertically( itemsToDistribute );
651  }
652  else
653  {
654  totalGap -= totalHeight;
655  doDistributeGapsVertically( itemsToDistribute, lastItem, totalGap );
656  }
657 
658  commit.Push( _( "Distribute vertically" ) );
659 
660  return 0;
661 }
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
SELECTION_LOCK_FLAGS CheckLock()
Checks if the user has agreed to modify locked items for the given selection.
ALIGNMENT_RECTS GetBoundingBoxes(const SELECTION &sel)
void doDistributeCentersVertically(ALIGNMENT_RECTS &itemsToDistribute) const
Distributes selected items using an even spacing between the centers of their bounding boxes...
void doDistributeGapsVertically(ALIGNMENT_RECTS &itemsToDistribute, const BOARD_ITEM *lastItem, int totalGap) const
Distributes selected items using an even spacing between their bounding boxes.
bool SortBottommostY(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
void EnsureEditableFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Definition: edit_tool.cpp:232
size_t i
Definition: json11.cpp:597
SELECTION_TOOL * m_selectionTool
bool SortTopmostY(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
int ALIGN_DISTRIBUTE_TOOL::doAlignLeft ( )
private

Sets X coordinate of the selected items to the value of the left-most selected item X coordinate.

NOTE: Uses the bounding box of items, which do not get mirrored even when the view is mirrored!

Definition at line 351 of file placement_tool.cpp.

References checkLockedStatus(), CHT_MODIFY, EnsureEditableFilter(), filterPadsWithModules(), FRAME_PCB, GetBoundingBoxes(), BOARD_ITEM::GetParent(), i, m_selectionTool, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Push(), SELECTION_TOOL::RequestSelection(), SELECTION_LOCKED, SortLeftmostX(), COMMIT::StageItems(), and EDA_ITEM::Type().

Referenced by AlignLeft(), AlignRight(), and Reset().

352 {
353  auto frame = getEditFrame<PCB_BASE_FRAME>();
355 
356  if( selection.Size() <= 1 )
357  return 0;
358 
359  filterPadsWithModules( selection );
360 
361  auto itemsToAlign = GetBoundingBoxes( selection );
362  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortLeftmostX );
363  if( checkLockedStatus( selection ) == SELECTION_LOCKED )
364  return 0;
365 
366  BOARD_COMMIT commit( frame );
367  commit.StageItems( selection, CHT_MODIFY );
368 
369  // after sorting, the fist item acts as the target for all others
370  const int targetLeft = itemsToAlign.begin()->second.GetX();
371 
372  // Move the selected items
373  for( auto& i : itemsToAlign )
374  {
375  int difference = targetLeft - i.second.GetX();
376  BOARD_ITEM* item = i.first;
377 
378  // Don't move a pad by itself unless editing the footprint
379  if( item->Type() == PCB_PAD_T && frame->IsType( FRAME_PCB ) )
380  item = item->GetParent();
381 
382  item->Move( wxPoint( difference, 0 ) );
383  }
384 
385  commit.Push( _( "Align to left" ) );
386 
387  return 0;
388 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
bool SortLeftmostX(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
BOARD_ITEM_CONTAINER * GetParent() const
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void filterPadsWithModules(SELECTION &selection)
Remove pads from a multi-unit select that also includes the pads&#39; parents.
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
ALIGNMENT_RECTS GetBoundingBoxes(const SELECTION &sel)
void EnsureEditableFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Definition: edit_tool.cpp:232
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
size_t i
Definition: json11.cpp:597
int checkLockedStatus(const SELECTION &selection) const
Check a selection to ensure locks are valid for alignment.
SELECTION_TOOL * m_selectionTool
int ALIGN_DISTRIBUTE_TOOL::doAlignRight ( )
private

Aligns selected items using the right edge of their bounding boxes to the right-most item.

NOTE: Uses the bounding box of items, which do not get mirrored even when the view is mirrored!

Definition at line 406 of file placement_tool.cpp.

References checkLockedStatus(), CHT_MODIFY, EnsureEditableFilter(), filterPadsWithModules(), FRAME_PCB, GetBoundingBoxes(), BOARD_ITEM::GetParent(), i, m_selectionTool, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Push(), SELECTION_TOOL::RequestSelection(), SELECTION_LOCKED, SortRightmostX(), COMMIT::StageItems(), and EDA_ITEM::Type().

Referenced by AlignLeft(), AlignRight(), and Reset().

407 {
408  auto frame = getEditFrame<PCB_BASE_FRAME>();
410 
411  if( selection.Size() <= 1 )
412  return 0;
413 
414  filterPadsWithModules( selection );
415 
416  auto itemsToAlign = GetBoundingBoxes( selection );
417  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortRightmostX );
418  if( checkLockedStatus( selection ) == SELECTION_LOCKED )
419  return 0;
420 
421  BOARD_COMMIT commit( frame );
422  commit.StageItems( selection, CHT_MODIFY );
423 
424  // after sorting, the fist item acts as the target for all others
425  const int targetRight = itemsToAlign.begin()->second.GetRight();
426 
427  // Move the selected items
428  for( auto& i : itemsToAlign )
429  {
430  int difference = targetRight - i.second.GetRight();
431  BOARD_ITEM* item = i.first;
432 
433  // Don't move a pad by itself unless editing the footprint
434  if( item->Type() == PCB_PAD_T && frame->IsType( FRAME_PCB ) )
435  item = item->GetParent();
436 
437  item->Move( wxPoint( difference, 0 ) );
438  }
439 
440  commit.Push( _( "Align to right" ) );
441 
442  return 0;
443 }
bool SortRightmostX(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
BOARD_ITEM_CONTAINER * GetParent() const
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
void filterPadsWithModules(SELECTION &selection)
Remove pads from a multi-unit select that also includes the pads&#39; parents.
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
ALIGNMENT_RECTS GetBoundingBoxes(const SELECTION &sel)
void EnsureEditableFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Definition: edit_tool.cpp:232
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
size_t i
Definition: json11.cpp:597
int checkLockedStatus(const SELECTION &selection) const
Check a selection to ensure locks are valid for alignment.
SELECTION_TOOL * m_selectionTool
void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally ( ALIGNMENT_RECTS itemsToDistribute) const
private

Distributes selected items using an even spacing between the centers of their bounding boxes.

NOTE: Using the centers of bounding box of items can give unsatisfactory visual results since items of differing widths will be placed with different gaps. Is only used if items overlap

Definition at line 597 of file placement_tool.cpp.

References i, and SortCenterX().

Referenced by DistributeHorizontally().

598 {
599  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortCenterX );
600  const auto totalGap = ( itemsToDistribute.end()-1 )->second.GetCenter().x
601  - itemsToDistribute.begin()->second.GetCenter().x;
602  const auto itemGap = totalGap / ( itemsToDistribute.size() - 1 );
603  auto targetX = itemsToDistribute.begin()->second.GetCenter().x;
604 
605  for( auto& i : itemsToDistribute )
606  {
607  int difference = targetX - i.second.GetCenter().x;
608  i.first->Move( wxPoint( difference, 0 ) );
609  targetX += ( itemGap );
610  }
611 }
size_t i
Definition: json11.cpp:597
bool SortCenterX(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically ( ALIGNMENT_RECTS itemsToDistribute) const
private

Distributes selected items using an even spacing between the centers of their bounding boxes.

NOTE: Using the centers of bounding box of items can give unsatisfactory visual results since items of differing widths will be placed with different gaps. Is only used if items overlap

Definition at line 683 of file placement_tool.cpp.

References i, and SortCenterY().

Referenced by DistributeVertically().

684 {
685  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortCenterY );
686  const auto totalGap = ( itemsToDistribute.end()-1 )->second.GetCenter().y
687  - itemsToDistribute.begin()->second.GetCenter().y;
688  const auto itemGap = totalGap / ( itemsToDistribute.size() - 1 );
689  auto targetY = itemsToDistribute.begin()->second.GetCenter().y;
690 
691  for( auto& i : itemsToDistribute )
692  {
693  int difference = targetY - i.second.GetCenter().y;
694  i.first->Move( wxPoint( 0, difference ) );
695  targetY += ( itemGap );
696  }
697 }
bool SortCenterY(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
size_t i
Definition: json11.cpp:597
void ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally ( ALIGNMENT_RECTS itemsToDistribute,
const BOARD_ITEM lastItem,
int  totalGap 
) const
private

Distributes selected items using an even spacing between their bounding boxes.

NOTE: Using the edges of bounding box of items is only possible if there is enough space between them. If this is not the case, use the center spacing method

Definition at line 578 of file placement_tool.cpp.

References i.

Referenced by DistributeHorizontally().

580 {
581  const auto itemGap = totalGap / ( itemsToDistribute.size() - 1 );
582  auto targetX = itemsToDistribute.begin()->second.GetX();
583 
584  for( auto& i : itemsToDistribute )
585  {
586  // cover the corner case where the last item is wider than the previous item and gap
587  if( lastItem == i.first )
588  continue;
589 
590  int difference = targetX - i.second.GetX();
591  i.first->Move( wxPoint( difference, 0 ) );
592  targetX += ( i.second.GetWidth() + itemGap );
593  }
594 }
size_t i
Definition: json11.cpp:597
void ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically ( ALIGNMENT_RECTS itemsToDistribute,
const BOARD_ITEM lastItem,
int  totalGap 
) const
private

Distributes selected items using an even spacing between their bounding boxes.

NOTE: Using the edges of bounding box of items is only possible if there is enough space between them. If this is not the case, use the center spacing method

Definition at line 664 of file placement_tool.cpp.

References i.

Referenced by DistributeVertically().

666 {
667  const auto itemGap = totalGap / ( itemsToDistribute.size() - 1 );
668  auto targetY = itemsToDistribute.begin()->second.GetY();
669 
670  for( auto& i : itemsToDistribute )
671  {
672  // cover the corner case where the last item is wider than the previous item and gap
673  if( lastItem == i.first )
674  continue;
675 
676  int difference = targetY - i.second.GetY();
677  i.first->Move( wxPoint( 0, difference ) );
678  targetY += ( i.second.GetHeight() + itemGap );
679  }
680 }
size_t i
Definition: json11.cpp:597
const TOOL_EVENT TOOL_INTERACTIVE::evActivate ( std::string  aToolName = "")
protectedinherited

functions below are not yet implemented - their interface may change

const TOOL_EVENT TOOL_INTERACTIVE::evButtonDown ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evButtonUp ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evClick ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( int  aCommandId = -1)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( std::string  aCommandStr = "")
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evDrag ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evMotion ( )
protectedinherited
void ALIGN_DISTRIBUTE_TOOL::filterPadsWithModules ( SELECTION selection)
private

Remove pads from a multi-unit select that also includes the pads' parents.

Definition at line 186 of file placement_tool.cpp.

References i, mod, PCB_PAD_T, and MODULE::Remove().

Referenced by AlignBottom(), AlignCenterX(), AlignCenterY(), AlignTop(), doAlignLeft(), and doAlignRight().

187 {
188  std::set<BOARD_ITEM*> rejected;
189  for( auto i : selection )
190  {
191  auto item = static_cast<BOARD_ITEM*>( i );
192  if( item->Type() == PCB_PAD_T )
193  {
194  MODULE* mod = static_cast<MODULE*>( item->GetParent() );
195 
196  // selection contains both the module and its pads - remove the pads
197  if( mod && selection.Contains( mod ) )
198  rejected.insert( item );
199  }
200  }
201 
202  for( BOARD_ITEM* item : rejected )
203  selection.Remove( item );
204 }
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
void Remove(BOARD_ITEM *aItem) override
>
size_t i
Definition: json11.cpp:597
#define mod(a, n)
Definition: greymap.cpp:24
template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Function getEditFrame()

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

Definition at line 188 of file tool_base.h.

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

189  {
190  return static_cast<T*>( getEditFrameInt() );
191  }
wxWindow * getEditFrameInt() const
Definition: tool_base.cpp:47
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 122 of file tool_base.h.

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

123  {
124  return m_toolId;
125  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:210
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 144 of file tool_base.h.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), PCB_TOOL::doInteractiveItemPlacement(), CONTEXT_MENU::getToolManager(), CONTEXT_MENU::onMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

145  {
146  return m_toolMgr;
147  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 199 of file tool_base.h.

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

200  {
201  EDA_ITEM* m = getModelInt();
202 
203  return static_cast<T*>( m );
204  }
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:53
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 133 of file tool_base.h.

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

134  {
135  return m_toolName;
136  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:214
TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 77 of file tool_base.cpp.

Referenced by GERBVIEW_CONTROL::HighlightControl(), ROUTER_TOOL::Init(), SELECTION_TOOL::selectable(), and ROUTER_TOOL::~ROUTER_TOOL().

78 {
79  return m_toolSettings;
80 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:216
TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 111 of file tool_base.h.

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

112  {
113  return m_type;
114  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:207
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 35 of file tool_base.cpp.

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

Referenced by AlignLeft(), AlignRight(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), CVPCB_CONTROL::CursorControl(), PCBNEW_CONTROL::CursorControl(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::doSelectionMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findCallback(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::guessSelectionCandidates(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), CVPCB_CONTROL::PanControl(), PCBNEW_CONTROL::PanControl(), PNS::TOOL_BASE::pickSingleItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), SELECTION_TOOL::Reset(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::selectable(), GERBVIEW_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), POINT_EDITOR::updateEditedPoint(), COMMON_TOOLS::updateGrid(), PCBNEW_CONTROL::updateGrid(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), CVPCB_SELECTION_TOOL::~CVPCB_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

36 {
37  return m_toolMgr->GetView();
38 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:252
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 41 of file tool_base.cpp.

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

Referenced by POINT_EDITOR::addCorner(), CVPCB_CONTROL::CursorControl(), PCBNEW_CONTROL::CursorControl(), COMMON_TOOLS::doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawZone(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findMove(), PCB_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNetCursor(), PICKER_TOOL::Main(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EDIT_TOOL::Main(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), CVPCB_CONTROL::ResetCoords(), GERBVIEW_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), DRAWING_TOOL::runPolygonEventLoop(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), PICKER_TOOL::setControls(), POINT_EDITOR::setEditedPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

42 {
43  return m_toolMgr->GetViewControls();
44 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:257
template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited
bool ALIGN_DISTRIBUTE_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 93 of file placement_tool.cpp.

References CONTEXT_MENU::Add(), CONDITIONAL_MENU::AddMenu(), PCB_ACTIONS::alignBottom, PCB_ACTIONS::alignCenterX, PCB_ACTIONS::alignCenterY, PCB_ACTIONS::alignLeft, PCB_ACTIONS::alignRight, PCB_ACTIONS::alignTop, DisplayError(), PCB_ACTIONS::distributeHorizontally, PCB_ACTIONS::distributeVertically, TOOL_MANAGER::FindTool(), TOOL_MENU::GetMenu(), SELECTION_TOOL::GetToolMenu(), m_placementMenu, m_selectionTool, TOOL_BASE::m_toolMgr, SELECTION_CONDITIONS::MoreThan(), CONTEXT_MENU::SetIcon(), and CONTEXT_MENU::SetTitle().

Referenced by Reset().

94 {
95  // Find the selection tool, so they can cooperate
96  m_selectionTool = static_cast<SELECTION_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveSelection" ) );
97 
98  if( !m_selectionTool )
99  {
100  DisplayError( NULL, wxT( "pcbnew.InteractiveSelection tool is not available" ) );
101  return false;
102  }
103 
104  // Create a context menu and make it available through selection tool
106  m_placementMenu->SetIcon( align_items_xpm );
107  m_placementMenu->SetTitle( _( "Align/Distribute" ) );
108 
109  // Add all align/distribute commands
116  m_placementMenu->AppendSeparator();
119 
122 
123  return true;
124 }
static TOOL_ACTION alignRight
Align items to the right edge of selection bounding box.
Definition: pcb_actions.h:238
TOOL_BASE * FindTool(int aId) const
Function FindTool() Searches for a tool with given ID.
static SELECTION_CONDITION MoreThan(int aNumber)
Function MoreThan Creates a functor that tests if the number of selected items is greater than the va...
Class CONTEXT_MENU.
Definition: context_menu.h:44
Class SELECTION_TOOL.
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:49
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static TOOL_ACTION alignCenterY
Align items to the center of selection bounding box.
Definition: pcb_actions.h:244
static TOOL_ACTION distributeVertically
Distributes items evenly along the vertical axis.
Definition: pcb_actions.h:250
CONTEXT_MENU * m_placementMenu
static TOOL_ACTION alignBottom
Align items to the bottom edge of selection bounding box.
Definition: pcb_actions.h:232
wxMenuItem * Add(const wxString &aLabel, int aId, const BITMAP_OPAQUE *aIcon=NULL)
Function Add() Adds an entry to the menu.
static TOOL_ACTION distributeHorizontally
Distributes items evenly along the horizontal axis.
Definition: pcb_actions.h:247
static TOOL_ACTION alignLeft
Align items to the left edge of selection bounding box.
Definition: pcb_actions.h:235
static TOOL_ACTION alignTop
Align items to the top edge of selection bounding box.
Definition: pcb_actions.h:229
void SetIcon(const BITMAP_OPAQUE *aIcon)
Function SetIcon() Assigns an icon for the entry.
void AddMenu(CONTEXT_MENU *aMenu, bool aExpand=false, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddMenu()
void SetTitle(const wxString &aTitle) override
Function SetTitle() Sets title for the context menu.
SELECTION_TOOL * m_selectionTool
static TOOL_ACTION alignCenterX
Align items to the middle of selection bounding box.
Definition: pcb_actions.h:241
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:233
bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 30 of file tool_base.cpp.

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

31 {
32  return m_toolMgr->IsToolActive( m_toolId );
33 }
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing) ...
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:210
void ALIGN_DISTRIBUTE_TOOL::Reset ( RESET_REASON  aReason)
inlineoverridevirtual

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

References AlignBottom(), AlignCenterX(), AlignCenterY(), AlignLeft(), AlignRight(), AlignTop(), DistributeHorizontally(), DistributeVertically(), doAlignLeft(), doAlignRight(), Init(), and setTransitions().

42 {}
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 85 of file tool_interactive.cpp.

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

Referenced by DRAWING_TOOL::PlaceText().

86 {
87  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
88 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)
void TOOL_INTERACTIVE::SetContextMenu ( CONTEXT_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 74 of file tool_interactive.cpp.

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::doSelectionMenu(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), and TOOL_MENU::ShowContextMenu().

75 {
76  if( aMenu )
77  aMenu->SetTool( this );
78  else
79  aTrigger = CMENU_OFF;
80 
81  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
82 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void ScheduleContextMenu(TOOL_BASE *aTool, CONTEXT_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour of the tool&#39;s context popup menu.
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void ALIGN_DISTRIBUTE_TOOL::setTransitions ( )
overridevirtual

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 700 of file placement_tool.cpp.

References AlignBottom(), PCB_ACTIONS::alignBottom, AlignCenterX(), PCB_ACTIONS::alignCenterX, AlignCenterY(), PCB_ACTIONS::alignCenterY, AlignLeft(), PCB_ACTIONS::alignLeft, AlignRight(), PCB_ACTIONS::alignRight, AlignTop(), PCB_ACTIONS::alignTop, DistributeHorizontally(), PCB_ACTIONS::distributeHorizontally, DistributeVertically(), PCB_ACTIONS::distributeVertically, and TOOL_INTERACTIVE::Go().

Referenced by Reset().

701 {
708 
711 }
static TOOL_ACTION alignRight
Align items to the right edge of selection bounding box.
Definition: pcb_actions.h:238
int AlignLeft(const TOOL_EVENT &aEvent)
Function AlignLeft() Sets X coordinate of the selected items to the value of the left-most selected i...
int AlignCenterY(const TOOL_EVENT &aEvent)
Function AlignCenterX() Sets the y coordinate of the midpoint of each of the selected items to the va...
int AlignCenterX(const TOOL_EVENT &aEvent)
Function AlignCenterX() Sets the x coordinate of the midpoint of each of the selected items to the va...
static TOOL_ACTION alignCenterY
Align items to the center of selection bounding box.
Definition: pcb_actions.h:244
int AlignBottom(const TOOL_EVENT &aEvent)
Function AlignBottom() Sets Y coordinate of the selected items to the value of the bottom-most select...
static TOOL_ACTION distributeVertically
Distributes items evenly along the vertical axis.
Definition: pcb_actions.h:250
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION alignBottom
Align items to the bottom edge of selection bounding box.
Definition: pcb_actions.h:232
static TOOL_ACTION distributeHorizontally
Distributes items evenly along the horizontal axis.
Definition: pcb_actions.h:247
int DistributeHorizontally(const TOOL_EVENT &aEvent)
Function DistributeHorizontally() Distributes the selected items along the X axis.
int AlignTop(const TOOL_EVENT &aEvent)
Function AlignTop() Sets Y coordinate of the selected items to the value of the top-most selected ite...
int DistributeVertically(const TOOL_EVENT &aEvent)
Function DistributeVertically() Distributes the selected items along the Y axis.
static TOOL_ACTION alignLeft
Align items to the left edge of selection bounding box.
Definition: pcb_actions.h:235
static TOOL_ACTION alignTop
Align items to the top edge of selection bounding box.
Definition: pcb_actions.h:229
int AlignRight(const TOOL_EVENT &aEvent)
Function AlignRight() Sets X coordinate of the selected items to the value of the right-most selected...
static TOOL_ACTION alignCenterX
Align items to the middle of selection bounding box.
Definition: pcb_actions.h:241
OPT_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 55 of file tool_interactive.cpp.

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

Referenced by PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PCB_TOOL::doInteractiveItemPlacement(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EDIT_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::runPolygonEventLoop(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), and PCB_EDITOR_CONTROL::ShowLocalRatsnest().

56 {
57  return m_toolMgr->ScheduleWait( this, aEventList );
58 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
OPT< 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.

Member Data Documentation

CONTEXT_MENU* ALIGN_DISTRIBUTE_TOOL::m_placementMenu
private

Definition at line 120 of file placement_tool.h.

Referenced by Init(), and ~ALIGN_DISTRIBUTE_TOOL().

SELECTION_TOOL* ALIGN_DISTRIBUTE_TOOL::m_selectionTool
private
TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

Definition at line 210 of file tool_base.h.

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

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), TOOL_BASE::attachManager(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), GERBVIEW_SELECTION_TOOL::clearSelection(), SELECTION_TOOL::clearSelection(), PAD_TOOL::copyPadSettings(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_EDITOR_CONTROL::CrossProbePcbToSch(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), CVPCB_CONTROL::CursorControl(), PCBNEW_CONTROL::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), PCBNEW_CONTROL::DeleteItemCursor(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), EDIT_TOOL::Duplicate(), EDIT_TOOL::editFootprintInFpEditor(), MODULE_EDITOR_TOOLS::EnumeratePads(), EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandSelectedConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::findCallback(), SELECTION_TOOL::findMove(), EDIT_TOOL::Flip(), TOOL_BASE::getEditFrameInt(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNetCursor(), PICKER_TOOL::Init(), Init(), PAD_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), PCBNEW_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), SELECTION_TOOL::RequestSelection(), CVPCB_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), TOOL_INTERACTIVE::resetTransitions(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), SELECTION_TOOL::selectCopper(), PCB_TOOL::selection(), GERBVIEW_SELECTION_TOOL::SelectItem(), SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), SELECTION_TOOL::selectOnSheetFromEeschema(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), TOOL_INTERACTIVE::SetContextMenu(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), GERBVIEW_SELECTION_TOOL::UnselectItem(), SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), PCB_EDITOR_CONTROL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

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 214 of file tool_base.h.

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 216 of file tool_base.h.

Referenced by TOOL_BASE::attachManager().

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 207 of file tool_base.h.


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