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

Public Member Functions

 ALIGN_DISTRIBUTE_TOOL ()
 
virtual ~ALIGN_DISTRIBUTE_TOOL ()
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
int AlignTop (const TOOL_EVENT &aEvent)
 Set Y coordinate of the selected items to the value of the top-most selected item Y coordinate. More...
 
int AlignBottom (const TOOL_EVENT &aEvent)
 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)
 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)
 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)
 Set 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)
 Set 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)
 Distribute the selected items along the X axis. More...
 
int DistributeVertically (const TOOL_EVENT &aEvent)
 Distribute the selected items along the Y axis. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

template<typename T >
size_t GetSelections (ALIGNMENT_RECTS &aItemsToAlign, ALIGNMENT_RECTS &aLockedItems, T aCompare)
 Populate two vectors with the sorted selection and sorted locked items. More...
 
template<typename T >
int selectTarget (ALIGNMENT_RECTS &aItems, ALIGNMENT_RECTS &aLocked, T aGetValue)
 
int doAlignLeft ()
 Sets X coordinate of the selected items to the value of the left-most selected item X coordinate. More...
 
int doAlignRight ()
 Align selected items using the right edge of their bounding boxes to the right-most item. More...
 
void doDistributeCentersHorizontally (ALIGNMENT_RECTS &itemsToDistribute, BOARD_COMMIT &aCommit) const
 Distribute selected items using an even spacing between the centers of their bounding boxes. More...
 
void doDistributeCentersVertically (ALIGNMENT_RECTS &itemsToDistribute, BOARD_COMMIT &aCommit) const
 Distribute selected items using an even spacing between the centers of their bounding boxes. More...
 
void doDistributeGapsHorizontally (ALIGNMENT_RECTS &itemsToDistribute, BOARD_COMMIT &aCommit, const BOARD_ITEM *lastItem, int totalGap) const
 Distributes selected items using an even spacing between their bounding boxes. More...
 
void doDistributeGapsVertically (ALIGNMENT_RECTS &itemsToDistribute, BOARD_COMMIT &aCommit, const BOARD_ITEM *lastItem, int totalGap) const
 Distributes selected items using an even spacing between their bounding boxes. More...
 

Private Attributes

PCB_SELECTION_TOOLm_selectionTool
 
ACTION_MENUm_placementMenu
 
PCB_BASE_FRAMEm_frame
 

Detailed Description

Definition at line 40 of file placement_tool.h.

Member Enumeration Documentation

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine the reason of reset for a tool.

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 78 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ ALIGN_DISTRIBUTE_TOOL()

ALIGN_DISTRIBUTE_TOOL::ALIGN_DISTRIBUTE_TOOL ( )

Definition at line 41 of file placement_tool.cpp.

41  :
42  TOOL_INTERACTIVE( "pcbnew.Placement" ), m_selectionTool( NULL ), m_placementMenu( NULL ),
43  m_frame( NULL )
44 {
45 }
PCB_SELECTION_TOOL * m_selectionTool
ACTION_MENU * m_placementMenu
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.
#define NULL
PCB_BASE_FRAME * m_frame

◆ ~ALIGN_DISTRIBUTE_TOOL()

ALIGN_DISTRIBUTE_TOOL::~ALIGN_DISTRIBUTE_TOOL ( )
virtual

Definition at line 47 of file placement_tool.cpp.

48 {
49  delete m_placementMenu;
50 }
ACTION_MENU * m_placementMenu

References m_placementMenu.

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run the tool.

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

Definition at line 51 of file tool_interactive.cpp.

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

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

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

◆ AlignBottom()

int ALIGN_DISTRIBUTE_TOOL::AlignBottom ( const TOOL_EVENT aEvent)

Sets Y coordinate of the selected items to the value of the bottom-most selected item Y coordinate.

Definition at line 236 of file placement_tool.cpp.

237 {
238  ALIGNMENT_RECTS itemsToAlign;
239  ALIGNMENT_RECTS locked_items;
240 
241  if( !GetSelections( itemsToAlign, locked_items,
242  []( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
243  {
244  return ( left.second.GetBottom() < right.second.GetBottom() );
245  } ) )
246  {
247  return 0;
248  }
249 
250  BOARD_COMMIT commit( m_frame );
251 
252  int targetBottom = selectTarget( itemsToAlign, locked_items,
253  []( const ALIGNMENT_RECT& aVal )
254  {
255  return aVal.second.GetBottom();
256  } );
257 
258  // Move the selected items
259  for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToAlign )
260  {
261  int difference = targetBottom - i.second.GetBottom();
262  BOARD_ITEM* item = i.first;
263 
264  if( item->GetParent() && item->GetParent()->IsSelected() )
265  continue;
266 
267  // Don't move a pad by itself unless editing the footprint
268  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
269  item = item->GetParent();
270 
271  commit.Stage( item, CHT_MODIFY );
272  item->Move( wxPoint( 0, difference ) );
273  }
274 
275  commit.Push( _( "Align to bottom" ) );
276 
277  return 0;
278 }
int selectTarget(ALIGNMENT_RECTS &aItems, ALIGNMENT_RECTS &aLocked, T aGetValue)
bool IsSelected() const
Definition: eda_item.h:173
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class PAD, a pad in a footprint
Definition: typeinfo.h:89
std::vector< ALIGNMENT_RECT > ALIGNMENT_RECTS
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277
PCB_BASE_FRAME * m_frame
bool IsType(FRAME_T aType) const
#define _(s)
Definition: 3d_actions.cpp:33
std::pair< BOARD_ITEM *, EDA_RECT > ALIGNMENT_RECT
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
size_t GetSelections(ALIGNMENT_RECTS &aItemsToAlign, ALIGNMENT_RECTS &aLockedItems, T aCompare)
Populate two vectors with the sorted selection and sorted locked items.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References _, CHT_MODIFY, FRAME_PCB_EDITOR, BOARD_ITEM::GetParent(), GetSelections(), EDA_ITEM::IsSelected(), EDA_BASE_FRAME::IsType(), left, m_frame, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Push(), right, selectTarget(), BOARD_COMMIT::Stage(), and EDA_ITEM::Type().

Referenced by setTransitions().

◆ AlignCenterX()

int ALIGN_DISTRIBUTE_TOOL::AlignCenterX ( const TOOL_EVENT aEvent)

Set 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 401 of file placement_tool.cpp.

402 {
403  ALIGNMENT_RECTS itemsToAlign;
404  ALIGNMENT_RECTS locked_items;
405 
406  if( !GetSelections( itemsToAlign, locked_items,
407  []( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
408  {
409  return ( left.second.GetCenter().x < right.second.GetCenter().x );
410  } ) )
411  {
412  return 0;
413  }
414 
415  BOARD_COMMIT commit( m_frame );
416 
417  int targetX = selectTarget( itemsToAlign, locked_items,
418  []( const ALIGNMENT_RECT& aVal )
419  {
420  return aVal.second.GetCenter().x;
421  } );
422 
423  // Move the selected items
424  for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToAlign )
425  {
426  int difference = targetX - i.second.GetCenter().x;
427  BOARD_ITEM* item = i.first;
428 
429  if( item->GetParent() && item->GetParent()->IsSelected() )
430  continue;
431 
432  // Don't move a pad by itself unless editing the footprint
433  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
434  item = item->GetParent();
435 
436  commit.Stage( item, CHT_MODIFY );
437  item->Move( wxPoint( difference, 0 ) );
438  }
439 
440  commit.Push( _( "Align to middle" ) );
441 
442  return 0;
443 }
int selectTarget(ALIGNMENT_RECTS &aItems, ALIGNMENT_RECTS &aLocked, T aGetValue)
bool IsSelected() const
Definition: eda_item.h:173
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class PAD, a pad in a footprint
Definition: typeinfo.h:89
std::vector< ALIGNMENT_RECT > ALIGNMENT_RECTS
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277
PCB_BASE_FRAME * m_frame
bool IsType(FRAME_T aType) const
#define _(s)
Definition: 3d_actions.cpp:33
std::pair< BOARD_ITEM *, EDA_RECT > ALIGNMENT_RECT
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
size_t GetSelections(ALIGNMENT_RECTS &aItemsToAlign, ALIGNMENT_RECTS &aLockedItems, T aCompare)
Populate two vectors with the sorted selection and sorted locked items.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References _, CHT_MODIFY, FRAME_PCB_EDITOR, BOARD_ITEM::GetParent(), GetSelections(), EDA_ITEM::IsSelected(), EDA_BASE_FRAME::IsType(), left, m_frame, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Push(), right, selectTarget(), BOARD_COMMIT::Stage(), and EDA_ITEM::Type().

Referenced by setTransitions().

◆ AlignCenterY()

int ALIGN_DISTRIBUTE_TOOL::AlignCenterY ( const TOOL_EVENT aEvent)

Set 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 446 of file placement_tool.cpp.

447 {
448  ALIGNMENT_RECTS itemsToAlign;
449  ALIGNMENT_RECTS locked_items;
450 
451  if( !GetSelections( itemsToAlign, locked_items,
452  []( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
453  {
454  return ( left.second.GetCenter().y < right.second.GetCenter().y );
455  } ) )
456  {
457  return 0;
458  }
459 
460  BOARD_COMMIT commit( m_frame );
461 
462  int targetY = selectTarget( itemsToAlign, locked_items,
463  []( const ALIGNMENT_RECT& aVal )
464  {
465  return aVal.second.GetCenter().y;
466  } );
467 
468  // Move the selected items
469  for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToAlign )
470  {
471  int difference = targetY - i.second.GetCenter().y;
472  BOARD_ITEM* item = i.first;
473 
474  if( item->GetParent() && item->GetParent()->IsSelected() )
475  continue;
476 
477  // Don't move a pad by itself unless editing the footprint
478  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
479  item = item->GetParent();
480 
481  commit.Stage( item, CHT_MODIFY );
482  item->Move( wxPoint( 0, difference ) );
483  }
484 
485  commit.Push( _( "Align to center" ) );
486 
487  return 0;
488 }
int selectTarget(ALIGNMENT_RECTS &aItems, ALIGNMENT_RECTS &aLocked, T aGetValue)
bool IsSelected() const
Definition: eda_item.h:173
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class PAD, a pad in a footprint
Definition: typeinfo.h:89
std::vector< ALIGNMENT_RECT > ALIGNMENT_RECTS
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277
PCB_BASE_FRAME * m_frame
bool IsType(FRAME_T aType) const
#define _(s)
Definition: 3d_actions.cpp:33
std::pair< BOARD_ITEM *, EDA_RECT > ALIGNMENT_RECT
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
size_t GetSelections(ALIGNMENT_RECTS &aItemsToAlign, ALIGNMENT_RECTS &aLockedItems, T aCompare)
Populate two vectors with the sorted selection and sorted locked items.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References _, CHT_MODIFY, FRAME_PCB_EDITOR, BOARD_ITEM::GetParent(), GetSelections(), EDA_ITEM::IsSelected(), EDA_BASE_FRAME::IsType(), left, m_frame, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Push(), right, selectTarget(), BOARD_COMMIT::Stage(), and EDA_ITEM::Type().

Referenced by setTransitions().

◆ AlignLeft()

int ALIGN_DISTRIBUTE_TOOL::AlignLeft ( const TOOL_EVENT aEvent)

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

Definition at line 281 of file placement_tool.cpp.

282 {
283  // Because this tool uses bounding boxes and they aren't mirrored even when
284  // the view is mirrored, we need to call the other one if mirrored.
285  if( getView()->IsMirroredX() )
286  {
287  return doAlignRight();
288  }
289  else
290  {
291  return doAlignLeft();
292  }
293 }
int doAlignRight()
Align 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
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36

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

Referenced by setTransitions().

◆ AlignRight()

int ALIGN_DISTRIBUTE_TOOL::AlignRight ( const TOOL_EVENT aEvent)

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

Definition at line 341 of file placement_tool.cpp.

342 {
343  // Because this tool uses bounding boxes and they aren't mirrored even when
344  // the view is mirrored, we need to call the other one if mirrored.
345  if( getView()->IsMirroredX() )
346  {
347  return doAlignLeft();
348  }
349  else
350  {
351  return doAlignRight();
352  }
353 }
int doAlignRight()
Align 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
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36

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

Referenced by setTransitions().

◆ AlignTop()

int ALIGN_DISTRIBUTE_TOOL::AlignTop ( const TOOL_EVENT aEvent)

Set Y coordinate of the selected items to the value of the top-most selected item Y coordinate.

Definition at line 191 of file placement_tool.cpp.

192 {
193  ALIGNMENT_RECTS itemsToAlign;
194  ALIGNMENT_RECTS locked_items;
195 
196  if( !GetSelections( itemsToAlign, locked_items,
197  []( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
198  {
199  return ( left.second.GetTop() < right.second.GetTop() );
200  } ) )
201  {
202  return 0;
203  }
204 
205  BOARD_COMMIT commit( m_frame );
206 
207  int targetTop = selectTarget( itemsToAlign, locked_items,
208  []( const ALIGNMENT_RECT& aVal )
209  {
210  return aVal.second.GetTop();
211  } );
212 
213  // Move the selected items
214  for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToAlign )
215  {
216  BOARD_ITEM* item = i.first;
217  int difference = targetTop - i.second.GetTop();
218 
219  if( item->GetParent() && item->GetParent()->IsSelected() )
220  continue;
221 
222  // Don't move a pad by itself unless editing the footprint
223  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
224  item = item->GetParent();
225 
226  commit.Stage( item, CHT_MODIFY );
227  item->Move( wxPoint( 0, difference ) );
228  }
229 
230  commit.Push( _( "Align to top" ) );
231 
232  return 0;
233 }
int selectTarget(ALIGNMENT_RECTS &aItems, ALIGNMENT_RECTS &aLocked, T aGetValue)
bool IsSelected() const
Definition: eda_item.h:173
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class PAD, a pad in a footprint
Definition: typeinfo.h:89
std::vector< ALIGNMENT_RECT > ALIGNMENT_RECTS
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277
PCB_BASE_FRAME * m_frame
bool IsType(FRAME_T aType) const
#define _(s)
Definition: 3d_actions.cpp:33
std::pair< BOARD_ITEM *, EDA_RECT > ALIGNMENT_RECT
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
size_t GetSelections(ALIGNMENT_RECTS &aItemsToAlign, ALIGNMENT_RECTS &aLockedItems, T aCompare)
Populate two vectors with the sorted selection and sorted locked items.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References _, CHT_MODIFY, FRAME_PCB_EDITOR, BOARD_ITEM::GetParent(), GetSelections(), EDA_ITEM::IsSelected(), EDA_BASE_FRAME::IsType(), left, m_frame, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Push(), right, selectTarget(), BOARD_COMMIT::Stage(), and EDA_ITEM::Type().

Referenced by setTransitions().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set the TOOL_MANAGER the tool will belong to.

Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

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

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ DistributeHorizontally()

int ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally ( const TOOL_EVENT aEvent)

Distribute the selected items along the X axis.

Definition at line 491 of file placement_tool.cpp.

492 {
494  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
495  {
496  // Iterate from the back so we don't have to worry about removals.
497  for( int i = aCollector.GetCount() - 1; i >= 0; --i )
498  {
499  BOARD_ITEM* item = aCollector[i];
500 
501  if( item->Type() == PCB_MARKER_T )
502  aCollector.Remove( item );
503  }
504  },
505  m_frame->IsType( FRAME_PCB_EDITOR ) /* prompt user regarding locked items */ );
506 
507  if( selection.Size() <= 1 )
508  return 0;
509 
510  BOARD_COMMIT commit( m_frame );
511  ALIGNMENT_RECTS itemsToDistribute = GetBoundingBoxes( selection );
512 
513  // find the last item by reverse sorting
514  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(),
515  [] ( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
516  {
517  return ( left.second.GetRight() > right.second.GetRight() );
518  } );
519 
520  BOARD_ITEM* lastItem = itemsToDistribute.begin()->first;
521  const int maxRight = itemsToDistribute.begin()->second.GetRight();
522 
523  // sort to get starting order
524  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(),
525  [] ( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
526  {
527  return ( left.second.GetX() < right.second.GetX() );
528  } );
529 
530  const int minX = itemsToDistribute.begin()->second.GetX();
531  int totalGap = maxRight - minX;
532  int totalWidth = 0;
533 
534  for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToDistribute )
535  totalWidth += i.second.GetWidth();
536 
537  if( totalGap < totalWidth )
538  {
539  // the width of the items exceeds the gap (overlapping items) -> use center point spacing
540  doDistributeCentersHorizontally( itemsToDistribute, commit );
541  }
542  else
543  {
544  totalGap -= totalWidth;
545  doDistributeGapsHorizontally( itemsToDistribute, commit, lastItem, totalGap );
546  }
547 
548  commit.Push( _( "Distribute horizontally" ) );
549 
550  return 0;
551 }
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
PCB_SELECTION_TOOL * m_selectionTool
void doDistributeCentersHorizontally(ALIGNMENT_RECTS &itemsToDistribute, BOARD_COMMIT &aCommit) const
Distribute selected items using an even spacing between the centers of their bounding boxes.
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:115
ALIGNMENT_RECTS GetBoundingBoxes(const T &aItems)
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
void doDistributeGapsHorizontally(ALIGNMENT_RECTS &itemsToDistribute, BOARD_COMMIT &aCommit, const BOARD_ITEM *lastItem, int totalGap) const
Distributes selected items using an even spacing between their bounding boxes.
std::vector< ALIGNMENT_RECT > ALIGNMENT_RECTS
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:98
PCB_SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter, bool aConfirmLockedItems=false)
Return the current selection set, filtered according to aFlags and aClientFilter.
int GetX() const
Definition: board_item.h:97
PCB_BASE_FRAME * m_frame
bool IsType(FRAME_T aType) const
#define _(s)
Definition: 3d_actions.cpp:33
std::pair< BOARD_ITEM *, EDA_RECT > ALIGNMENT_RECT
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:241
int Size() const
Returns the number of selected parts.
Definition: selection.h:128
The selection tool: currently supports:
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References _, doDistributeCentersHorizontally(), doDistributeGapsHorizontally(), FRAME_PCB_EDITOR, GetBoundingBoxes(), COLLECTOR::GetCount(), BOARD_ITEM::GetX(), EDA_BASE_FRAME::IsType(), left, m_frame, m_selectionTool, PCB_MARKER_T, BOARD_COMMIT::Push(), COLLECTOR::Remove(), PCB_SELECTION_TOOL::RequestSelection(), right, SELECTION::Size(), and EDA_ITEM::Type().

Referenced by setTransitions().

◆ DistributeVertically()

int ALIGN_DISTRIBUTE_TOOL::DistributeVertically ( const TOOL_EVENT aEvent)

Distribute the selected items along the Y axis.

Set up handlers for various events.

Definition at line 618 of file placement_tool.cpp.

619 {
621  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
622  {
623  // Iterate from the back so we don't have to worry about removals.
624  for( int i = aCollector.GetCount() - 1; i >= 0; --i )
625  {
626  BOARD_ITEM* item = aCollector[i];
627 
628  if( item->Type() == PCB_MARKER_T )
629  aCollector.Remove( item );
630  }
631  },
632  m_frame->IsType( FRAME_PCB_EDITOR ) /* prompt user regarding locked items */ );
633 
634  if( selection.Size() <= 1 )
635  return 0;
636 
637  BOARD_COMMIT commit( m_frame );
638  ALIGNMENT_RECTS itemsToDistribute = GetBoundingBoxes( selection );
639 
640  // find the last item by reverse sorting
641  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(),
642  [] ( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
643  {
644  return ( left.second.GetBottom() > right.second.GetBottom() );
645  } );
646 
647  BOARD_ITEM* lastItem = itemsToDistribute.begin()->first;
648  const int maxBottom = itemsToDistribute.begin()->second.GetBottom();
649 
650  // sort to get starting order
651  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(),
652  [] ( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
653  {
654  return ( left.second.GetCenter().y < right.second.GetCenter().y );
655  } );
656 
657  int minY = itemsToDistribute.begin()->second.GetY();
658  int totalGap = maxBottom - minY;
659  int totalHeight = 0;
660 
661  for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToDistribute )
662  totalHeight += i.second.GetHeight();
663 
664  if( totalGap < totalHeight )
665  {
666  // the width of the items exceeds the gap (overlapping items) -> use center point spacing
667  doDistributeCentersVertically( itemsToDistribute, commit );
668  }
669  else
670  {
671  totalGap -= totalHeight;
672  doDistributeGapsVertically( itemsToDistribute, commit, lastItem, totalGap );
673  }
674 
675  commit.Push( _( "Distribute vertically" ) );
676 
677  return 0;
678 }
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
PCB_SELECTION_TOOL * m_selectionTool
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:115
ALIGNMENT_RECTS GetBoundingBoxes(const T &aItems)
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
int GetY() const
Definition: board_item.h:103
std::vector< ALIGNMENT_RECT > ALIGNMENT_RECTS
void doDistributeGapsVertically(ALIGNMENT_RECTS &itemsToDistribute, BOARD_COMMIT &aCommit, const BOARD_ITEM *lastItem, int totalGap) const
Distributes selected items using an even spacing between their bounding boxes.
void doDistributeCentersVertically(ALIGNMENT_RECTS &itemsToDistribute, BOARD_COMMIT &aCommit) const
Distribute selected items using an even spacing between the centers of their bounding boxes.
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:98
PCB_SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter, bool aConfirmLockedItems=false)
Return the current selection set, filtered according to aFlags and aClientFilter.
PCB_BASE_FRAME * m_frame
bool IsType(FRAME_T aType) const
#define _(s)
Definition: 3d_actions.cpp:33
std::pair< BOARD_ITEM *, EDA_RECT > ALIGNMENT_RECT
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:241
int Size() const
Returns the number of selected parts.
Definition: selection.h:128
The selection tool: currently supports:
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References _, doDistributeCentersVertically(), doDistributeGapsVertically(), FRAME_PCB_EDITOR, GetBoundingBoxes(), COLLECTOR::GetCount(), BOARD_ITEM::GetY(), EDA_BASE_FRAME::IsType(), left, m_frame, m_selectionTool, PCB_MARKER_T, BOARD_COMMIT::Push(), COLLECTOR::Remove(), PCB_SELECTION_TOOL::RequestSelection(), right, SELECTION::Size(), and EDA_ITEM::Type().

Referenced by setTransitions().

◆ doAlignLeft()

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 296 of file placement_tool.cpp.

297 {
298  ALIGNMENT_RECTS itemsToAlign;
299  ALIGNMENT_RECTS locked_items;
300 
301  if( !GetSelections( itemsToAlign, locked_items,
302  []( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
303  {
304  return ( left.second.GetLeft() < right.second.GetLeft() );
305  } ) )
306  {
307  return 0;
308  }
309 
310  BOARD_COMMIT commit( m_frame );
311 
312  int targetLeft = selectTarget( itemsToAlign, locked_items,
313  []( const ALIGNMENT_RECT& aVal )
314  {
315  return aVal.second.GetLeft();
316  } );
317 
318  // Move the selected items
319  for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToAlign )
320  {
321  int difference = targetLeft - i.second.GetLeft();
322  BOARD_ITEM* item = i.first;
323 
324  if( item->GetParent() && item->GetParent()->IsSelected() )
325  continue;
326 
327  // Don't move a pad by itself unless editing the footprint
328  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
329  item = item->GetParent();
330 
331  commit.Stage( item, CHT_MODIFY );
332  item->Move( wxPoint( difference, 0 ) );
333  }
334 
335  commit.Push( _( "Align to left" ) );
336 
337  return 0;
338 }
int selectTarget(ALIGNMENT_RECTS &aItems, ALIGNMENT_RECTS &aLocked, T aGetValue)
bool IsSelected() const
Definition: eda_item.h:173
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class PAD, a pad in a footprint
Definition: typeinfo.h:89
std::vector< ALIGNMENT_RECT > ALIGNMENT_RECTS
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277
PCB_BASE_FRAME * m_frame
bool IsType(FRAME_T aType) const
#define _(s)
Definition: 3d_actions.cpp:33
std::pair< BOARD_ITEM *, EDA_RECT > ALIGNMENT_RECT
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
size_t GetSelections(ALIGNMENT_RECTS &aItemsToAlign, ALIGNMENT_RECTS &aLockedItems, T aCompare)
Populate two vectors with the sorted selection and sorted locked items.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References _, CHT_MODIFY, FRAME_PCB_EDITOR, BOARD_ITEM::GetParent(), GetSelections(), EDA_ITEM::IsSelected(), EDA_BASE_FRAME::IsType(), left, m_frame, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Push(), right, selectTarget(), BOARD_COMMIT::Stage(), and EDA_ITEM::Type().

Referenced by AlignLeft(), and AlignRight().

◆ doAlignRight()

int ALIGN_DISTRIBUTE_TOOL::doAlignRight ( )
private

Align 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 356 of file placement_tool.cpp.

357 {
358  ALIGNMENT_RECTS itemsToAlign;
359  ALIGNMENT_RECTS locked_items;
360 
361  if( !GetSelections( itemsToAlign, locked_items,
362  []( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
363  {
364  return ( left.second.GetRight() < right.second.GetRight() );
365  } ) )
366  {
367  return 0;
368  }
369 
370  BOARD_COMMIT commit( m_frame );
371 
372  int targetRight = selectTarget( itemsToAlign, locked_items,
373  []( const ALIGNMENT_RECT& aVal )
374  {
375  return aVal.second.GetRight();
376  } );
377 
378  // Move the selected items
379  for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToAlign )
380  {
381  int difference = targetRight - i.second.GetRight();
382  BOARD_ITEM* item = i.first;
383 
384  if( item->GetParent() && item->GetParent()->IsSelected() )
385  continue;
386 
387  // Don't move a pad by itself unless editing the footprint
388  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
389  item = item->GetParent();
390 
391  commit.Stage( item, CHT_MODIFY );
392  item->Move( wxPoint( difference, 0 ) );
393  }
394 
395  commit.Push( _( "Align to right" ) );
396 
397  return 0;
398 }
int selectTarget(ALIGNMENT_RECTS &aItems, ALIGNMENT_RECTS &aLocked, T aGetValue)
bool IsSelected() const
Definition: eda_item.h:173
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class PAD, a pad in a footprint
Definition: typeinfo.h:89
std::vector< ALIGNMENT_RECT > ALIGNMENT_RECTS
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277
PCB_BASE_FRAME * m_frame
bool IsType(FRAME_T aType) const
#define _(s)
Definition: 3d_actions.cpp:33
std::pair< BOARD_ITEM *, EDA_RECT > ALIGNMENT_RECT
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
size_t GetSelections(ALIGNMENT_RECTS &aItemsToAlign, ALIGNMENT_RECTS &aLockedItems, T aCompare)
Populate two vectors with the sorted selection and sorted locked items.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References _, CHT_MODIFY, FRAME_PCB_EDITOR, BOARD_ITEM::GetParent(), GetSelections(), EDA_ITEM::IsSelected(), EDA_BASE_FRAME::IsType(), left, m_frame, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Push(), right, selectTarget(), BOARD_COMMIT::Stage(), and EDA_ITEM::Type().

Referenced by AlignLeft(), and AlignRight().

◆ doDistributeCentersHorizontally()

void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally ( ALIGNMENT_RECTS itemsToDistribute,
BOARD_COMMIT aCommit 
) const
private

Distribute 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 585 of file placement_tool.cpp.

587 {
588  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(),
589  [] ( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
590  {
591  return ( left.second.GetCenter().x < right.second.GetCenter().x );
592  } );
593 
594  const int totalGap = ( itemsToDistribute.end()-1 )->second.GetCenter().x
595  - itemsToDistribute.begin()->second.GetCenter().x;
596  const int itemGap = totalGap / ( itemsToDistribute.size() - 1 );
597  int targetX = itemsToDistribute.begin()->second.GetCenter().x;
598 
599  for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToDistribute )
600  {
601  BOARD_ITEM* item = i.first;
602 
603  if( item->GetParent() && item->GetParent()->IsSelected() )
604  continue;
605 
606  // Don't move a pad by itself unless editing the footprint
607  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
608  item = item->GetParent();
609 
610  int difference = targetX - i.second.GetCenter().x;
611  aCommit.Stage( item, CHT_MODIFY );
612  item->Move( wxPoint( difference, 0 ) );
613  targetX += ( itemGap );
614  }
615 }
bool IsSelected() const
Definition: eda_item.h:173
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class PAD, a pad in a footprint
Definition: typeinfo.h:89
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277
virtual wxPoint GetCenter() const
This defaults to the center of the bounding box if not overridden.
Definition: board_item.h:114
PCB_BASE_FRAME * m_frame
bool IsType(FRAME_T aType) const
std::pair< BOARD_ITEM *, EDA_RECT > ALIGNMENT_RECT
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType) override
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References CHT_MODIFY, FRAME_PCB_EDITOR, BOARD_ITEM::GetCenter(), BOARD_ITEM::GetParent(), EDA_ITEM::IsSelected(), EDA_BASE_FRAME::IsType(), left, m_frame, BOARD_ITEM::Move(), PCB_PAD_T, right, BOARD_COMMIT::Stage(), and EDA_ITEM::Type().

Referenced by DistributeHorizontally().

◆ doDistributeCentersVertically()

void ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically ( ALIGNMENT_RECTS itemsToDistribute,
BOARD_COMMIT aCommit 
) const
private

Distribute 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 712 of file placement_tool.cpp.

714 {
715  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(),
716  [] ( const ALIGNMENT_RECT left, const ALIGNMENT_RECT right)
717  {
718  return ( left.second.GetCenter().y < right.second.GetCenter().y );
719  } );
720 
721  const int totalGap = ( itemsToDistribute.end()-1 )->second.GetCenter().y
722  - itemsToDistribute.begin()->second.GetCenter().y;
723  const int itemGap = totalGap / ( itemsToDistribute.size() - 1 );
724  int targetY = itemsToDistribute.begin()->second.GetCenter().y;
725 
726  for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToDistribute )
727  {
728  BOARD_ITEM* item = i.first;
729 
730  if( item->GetParent() && item->GetParent()->IsSelected() )
731  continue;
732 
733  // Don't move a pad by itself unless editing the footprint
734  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
735  item = item->GetParent();
736 
737  int difference = targetY - i.second.GetCenter().y;
738  aCommit.Stage( item, CHT_MODIFY );
739  item->Move( wxPoint( 0, difference ) );
740  targetY += ( itemGap );
741  }
742 }
bool IsSelected() const
Definition: eda_item.h:173
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class PAD, a pad in a footprint
Definition: typeinfo.h:89
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277
virtual wxPoint GetCenter() const
This defaults to the center of the bounding box if not overridden.
Definition: board_item.h:114
PCB_BASE_FRAME * m_frame
bool IsType(FRAME_T aType) const
std::pair< BOARD_ITEM *, EDA_RECT > ALIGNMENT_RECT
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType) override
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References CHT_MODIFY, FRAME_PCB_EDITOR, BOARD_ITEM::GetCenter(), BOARD_ITEM::GetParent(), EDA_ITEM::IsSelected(), EDA_BASE_FRAME::IsType(), left, m_frame, BOARD_ITEM::Move(), PCB_PAD_T, right, BOARD_COMMIT::Stage(), and EDA_ITEM::Type().

Referenced by DistributeVertically().

◆ doDistributeGapsHorizontally()

void ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally ( ALIGNMENT_RECTS itemsToDistribute,
BOARD_COMMIT aCommit,
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 554 of file placement_tool.cpp.

558 {
559  const int itemGap = totalGap / ( itemsToDistribute.size() - 1 );
560  int targetX = itemsToDistribute.begin()->second.GetX();
561 
562  for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToDistribute )
563  {
564  BOARD_ITEM* item = i.first;
565 
566  // cover the corner case where the last item is wider than the previous item and gap
567  if( lastItem == item )
568  continue;
569 
570  if( item->GetParent() && item->GetParent()->IsSelected() )
571  continue;
572 
573  // Don't move a pad by itself unless editing the footprint
574  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
575  item = item->GetParent();
576 
577  int difference = targetX - i.second.GetX();
578  aCommit.Stage( item, CHT_MODIFY );
579  item->Move( wxPoint( difference, 0 ) );
580  targetX += ( i.second.GetWidth() + itemGap );
581  }
582 }
bool IsSelected() const
Definition: eda_item.h:173
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class PAD, a pad in a footprint
Definition: typeinfo.h:89
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277
int GetX() const
Definition: board_item.h:97
PCB_BASE_FRAME * m_frame
bool IsType(FRAME_T aType) const
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType) override
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References CHT_MODIFY, FRAME_PCB_EDITOR, BOARD_ITEM::GetParent(), BOARD_ITEM::GetX(), EDA_ITEM::IsSelected(), EDA_BASE_FRAME::IsType(), m_frame, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Stage(), and EDA_ITEM::Type().

Referenced by DistributeHorizontally().

◆ doDistributeGapsVertically()

void ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically ( ALIGNMENT_RECTS itemsToDistribute,
BOARD_COMMIT aCommit,
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 681 of file placement_tool.cpp.

685 {
686  const int itemGap = totalGap / ( itemsToDistribute.size() - 1 );
687  int targetY = itemsToDistribute.begin()->second.GetY();
688 
689  for( std::pair<BOARD_ITEM*, EDA_RECT>& i : itemsToDistribute )
690  {
691  BOARD_ITEM* item = i.first;
692 
693  // cover the corner case where the last item is wider than the previous item and gap
694  if( lastItem == item )
695  continue;
696 
697  if( item->GetParent() && item->GetParent()->IsSelected() )
698  continue;
699 
700  // Don't move a pad by itself unless editing the footprint
701  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB_EDITOR ) )
702  item = item->GetParent();
703 
704  int difference = targetY - i.second.GetY();
705  aCommit.Stage( item, CHT_MODIFY );
706  item->Move( wxPoint( 0, difference ) );
707  targetY += ( i.second.GetHeight() + itemGap );
708  }
709 }
bool IsSelected() const
Definition: eda_item.h:173
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
class PAD, a pad in a footprint
Definition: typeinfo.h:89
int GetY() const
Definition: board_item.h:103
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277
PCB_BASE_FRAME * m_frame
bool IsType(FRAME_T aType) const
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType) override
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References CHT_MODIFY, FRAME_PCB_EDITOR, BOARD_ITEM::GetParent(), BOARD_ITEM::GetY(), EDA_ITEM::IsSelected(), EDA_BASE_FRAME::IsType(), m_frame, BOARD_ITEM::Move(), PCB_PAD_T, BOARD_COMMIT::Stage(), and EDA_ITEM::Type().

Referenced by DistributeVertically().

◆ getEditFrame()

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

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

Definition at line 185 of file tool_base.h.

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

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

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

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

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

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

Definition at line 144 of file tool_base.h.

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

References TOOL_BASE::m_toolMgr.

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

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 197 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ GetName()

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

Return the name of the tool.

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

Returns
The name of the tool.

Definition at line 134 of file tool_base.h.

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

References TOOL_BASE::m_toolName.

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

◆ GetSelections()

template<typename T >
size_t ALIGN_DISTRIBUTE_TOOL::GetSelections ( ALIGNMENT_RECTS aItemsToAlign,
ALIGNMENT_RECTS aLockedItems,
aCompare 
)
private

Populate two vectors with the sorted selection and sorted locked items.

Returns the size of aItemsToAlign()

Definition at line 141 of file placement_tool.cpp.

143 {
145  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
146  {
147  // Iterate from the back so we don't have to worry about removals.
148  for( int i = aCollector.GetCount() - 1; i >= 0; --i )
149  {
150  BOARD_ITEM* item = aCollector[i];
151 
152  if( item->Type() == PCB_MARKER_T )
153  aCollector.Remove( item );
154  }
155  } );
156 
157  std::vector<BOARD_ITEM*> lockedItems;
158  std::vector<BOARD_ITEM*> itemsToAlign;
159 
160  for( EDA_ITEM* item : selection )
161  {
162  BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
163 
164  if( boardItem->IsLocked() )
165  {
166  // Locking a pad but not the footprint means that we align the footprint using
167  // the pad position. So we test for footprint locking here
168  if( m_frame->IsType( FRAME_PCB_EDITOR ) && boardItem->Type() == PCB_PAD_T
169  && !boardItem->GetParent()->IsLocked() )
170  {
171  itemsToAlign.push_back( boardItem );
172  }
173  else
174  {
175  lockedItems.push_back( boardItem );
176  }
177  }
178  else
179  itemsToAlign.push_back( boardItem );
180  }
181 
182  aItemsToAlign = GetBoundingBoxes( itemsToAlign );
183  aLockedItems = GetBoundingBoxes( lockedItems );
184  std::sort( aItemsToAlign.begin(), aItemsToAlign.end(), aCompare );
185  std::sort( aLockedItems.begin(), aLockedItems.end(), aCompare );
186 
187  return aItemsToAlign.size();
188 }
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
PCB_SELECTION_TOOL * m_selectionTool
class PAD, a pad in a footprint
Definition: typeinfo.h:89
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:115
ALIGNMENT_RECTS GetBoundingBoxes(const T &aItems)
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
virtual bool IsLocked() const
Definition: board_item.h:249
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:98
PCB_SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter, bool aConfirmLockedItems=false)
Return the current selection set, filtered according to aFlags and aClientFilter.
PCB_BASE_FRAME * m_frame
bool IsType(FRAME_T aType) const
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:241
The selection tool: currently supports:
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References FRAME_PCB_EDITOR, GetBoundingBoxes(), COLLECTOR::GetCount(), BOARD_ITEM::GetParent(), BOARD_ITEM::IsLocked(), EDA_BASE_FRAME::IsType(), m_frame, m_selectionTool, PCB_MARKER_T, PCB_PAD_T, COLLECTOR::Remove(), PCB_SELECTION_TOOL::RequestSelection(), and EDA_ITEM::Type().

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

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

References TOOL_BASE::m_type.

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

◆ getView()

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

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

It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

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

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

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

◆ getViewControls()

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

Return the instance of VIEW_CONTROLS object used in the application.

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

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

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

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

◆ Go()

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

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

No conditions means any event.

Definition at line 128 of file tool_interactive.h.

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

References TOOL_INTERACTIVE::goInternal().

Referenced by AUTOPLACE_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_MOVE_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), setTransitions(), COMMON_TOOLS::setTransitions(), PCB_CONTROL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), DRC_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ Init()

bool ALIGN_DISTRIBUTE_TOOL::Init ( void  )
overridevirtual

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

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

Reimplemented from TOOL_BASE.

Definition at line 53 of file placement_tool.cpp.

54 {
55  // Find the selection tool, so they can cooperate
57  m_frame = getEditFrame<PCB_BASE_FRAME>();
58 
59  // Create a context menu and make it available through selection tool
60  m_placementMenu = new ACTION_MENU( true, this );
62  m_placementMenu->SetTitle( _( "Align/Distribute" ) );
63 
64  // Add all align/distribute commands
68 
69  m_placementMenu->AppendSeparator();
73 
74  m_placementMenu->AppendSeparator();
77 
80 
81  return true;
82 }
static TOOL_ACTION alignRight
Definition: pcb_actions.h:230
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Add a submenu to the menu.
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:47
PCB_SELECTION_TOOL * m_selectionTool
void SetIcon(BITMAPS aIcon)
Assign an icon for the entry.
Definition: action_menu.cpp:72
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
ACTION_MENU * m_placementMenu
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static TOOL_ACTION alignCenterY
Definition: pcb_actions.h:232
TOOL_MENU & GetToolMenu()
static TOOL_ACTION distributeVertically
Definition: pcb_actions.h:234
static TOOL_ACTION alignBottom
Definition: pcb_actions.h:228
static TOOL_ACTION distributeHorizontally
Definition: pcb_actions.h:233
static TOOL_ACTION alignLeft
Definition: pcb_actions.h:229
static TOOL_ACTION alignTop
Definition: pcb_actions.h:227
void SetTitle(const wxString &aTitle) override
Set title for the menu.
Definition: action_menu.cpp:90
PCB_BASE_FRAME * m_frame
#define _(s)
Definition: 3d_actions.cpp:33
wxMenuItem * Add(const wxString &aLabel, int aId, BITMAPS aIcon)
Add a wxWidgets-style entry to the menu.
The selection tool: currently supports:
static TOOL_ACTION alignCenterX
Definition: pcb_actions.h:231

References _, ACTION_MENU::Add(), CONDITIONAL_MENU::AddMenu(), align_items, PCB_ACTIONS::alignBottom, PCB_ACTIONS::alignCenterX, PCB_ACTIONS::alignCenterY, PCB_ACTIONS::alignLeft, PCB_ACTIONS::alignRight, PCB_ACTIONS::alignTop, PCB_ACTIONS::distributeHorizontally, PCB_ACTIONS::distributeVertically, TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOL_INTERACTIVE::GetToolMenu(), m_frame, m_placementMenu, m_selectionTool, TOOL_BASE::m_toolMgr, SELECTION_CONDITIONS::MoreThan(), ACTION_MENU::SetIcon(), and ACTION_MENU::SetTitle().

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

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

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

◆ Reset()

void ALIGN_DISTRIBUTE_TOOL::Reset ( RESET_REASON  aReason)
inlineoverridevirtual

Bring the tool to a known, initial state.

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

Parameters
aReasoncontains information about the reason of tool reset.

Implements TOOL_BASE.

Definition at line 47 of file placement_tool.h.

47 {}

◆ RunMainStack()

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

Call a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

88 {
89  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

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

Referenced by DRAWING_TOOL::PlaceText().

◆ selectTarget()

template<typename T >
int ALIGN_DISTRIBUTE_TOOL::selectTarget ( ALIGNMENT_RECTS aItems,
ALIGNMENT_RECTS aLocked,
aGetValue 
)
private

Definition at line 111 of file placement_tool.cpp.

113 {
114  wxPoint curPos = (wxPoint) getViewControls()->GetCursorPosition();
115 
116  // Prefer locked items to unlocked items.
117  // Secondly, prefer items under the cursor to other items.
118 
119  if( aLocked.size() >= 1 )
120  {
121  for( const ALIGNMENT_RECT& item : aLocked )
122  {
123  if( item.second.Contains( curPos ) )
124  return aGetValue( item );
125  }
126 
127  return aGetValue( aLocked.front() );
128  }
129 
130  for( const ALIGNMENT_RECT& item : aItems )
131  {
132  if( item.second.Contains( curPos ) )
133  return aGetValue( item );
134  }
135 
136  return aGetValue( aItems.front() );
137 }
std::pair< BOARD_ITEM *, EDA_RECT > ALIGNMENT_RECT
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.

References KIGFX::VIEW_CONTROLS::GetCursorPosition(), and TOOL_BASE::getViewControls().

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

◆ SetContextMenu()

void TOOL_INTERACTIVE::SetContextMenu ( ACTION_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

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

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

Definition at line 76 of file tool_interactive.cpp.

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

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

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

◆ setTransitions()

void ALIGN_DISTRIBUTE_TOOL::setTransitions ( )
overridevirtual

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

It is called every time tool is reset or finished.

Implements TOOL_INTERACTIVE.

Definition at line 745 of file placement_tool.cpp.

746 {
753 
756 }
static TOOL_ACTION alignRight
Definition: pcb_actions.h:230
int AlignLeft(const TOOL_EVENT &aEvent)
Sets X coordinate of the selected items to the value of the left-most selected item X coordinate.
int AlignCenterY(const TOOL_EVENT &aEvent)
Set the y coordinate of the midpoint of each of the selected items to the value of the y coordinate o...
int AlignCenterX(const TOOL_EVENT &aEvent)
Set the x coordinate of the midpoint of each of the selected items to the value of the x coordinate o...
static TOOL_ACTION alignCenterY
Definition: pcb_actions.h:232
int AlignBottom(const TOOL_EVENT &aEvent)
Sets Y coordinate of the selected items to the value of the bottom-most selected item Y coordinate.
static TOOL_ACTION distributeVertically
Definition: pcb_actions.h:234
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
static TOOL_ACTION alignBottom
Definition: pcb_actions.h:228
static TOOL_ACTION distributeHorizontally
Definition: pcb_actions.h:233
int DistributeHorizontally(const TOOL_EVENT &aEvent)
Distribute the selected items along the X axis.
int AlignTop(const TOOL_EVENT &aEvent)
Set Y coordinate of the selected items to the value of the top-most selected item Y coordinate.
int DistributeVertically(const TOOL_EVENT &aEvent)
Distribute the selected items along the Y axis.
static TOOL_ACTION alignLeft
Definition: pcb_actions.h:229
static TOOL_ACTION alignTop
Definition: pcb_actions.h:227
int AlignRight(const TOOL_EVENT &aEvent)
Sets X coordinate of the selected items to the value of the right-most selected item X coordinate.
static TOOL_ACTION alignCenterX
Definition: pcb_actions.h:231

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

◆ Wait()

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

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

No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

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

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

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

Member Data Documentation

◆ m_frame

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

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

Definition at line 106 of file tool_interactive.h.

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

◆ m_placementMenu

ACTION_MENU* ALIGN_DISTRIBUTE_TOOL::m_placementMenu
private

Definition at line 173 of file placement_tool.h.

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

◆ m_selectionTool

PCB_SELECTION_TOOL* ALIGN_DISTRIBUTE_TOOL::m_selectionTool
private

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

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

Definition at line 210 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

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

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 207 of file tool_base.h.

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


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