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

81  :
82  TOOL_INTERACTIVE( "pcbnew.Placement" ), m_selectionTool( NULL ), m_placementMenu( NULL )
83 {
84 }
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 86 of file placement_tool.cpp.

References m_placementMenu.

87 {
88  delete m_placementMenu;
89 }
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(), 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 292 of file placement_tool.cpp.

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

Referenced by Reset(), and setTransitions().

293 {
294  auto frame = getEditFrame<PCB_BASE_FRAME>();
296 
297  if( selection.Size() <= 1 )
298  return 0;
299 
300  filterPadsWithModules( selection );
301 
302  auto itemsToAlign = GetBoundingBoxes( selection );
303  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortBottommostY );
304  if( checkLockedStatus( selection ) == SELECTION_LOCKED )
305  return 0;
306 
307  BOARD_COMMIT commit( frame );
308  commit.StageItems( selection, CHT_MODIFY );
309 
310  // after sorting, the fist item acts as the target for all others
311  const int targetBottom = itemsToAlign.begin()->second.GetBottom();
312 
313  // Move the selected items
314  for( auto& i : itemsToAlign )
315  {
316  int difference = targetBottom - i.second.GetBottom();
317  BOARD_ITEM* item = i.first;
318 
319  // Don't move a pad by itself unless editing the footprint
320  if( item->Type() == PCB_PAD_T && frame->IsType( FRAME_PCB ) )
321  item = item->GetParent();
322 
323  item->Move( wxPoint( 0, difference ) );
324  }
325 
326  commit.Push( _( "Align to bottom" ) );
327 
328  return 0;
329 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
BOARD_ITEM_CONTAINER * GetParent() const
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)
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
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 442 of file placement_tool.cpp.

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

Referenced by Reset(), and setTransitions().

443 {
444  auto frame = getEditFrame<PCB_BASE_FRAME>();
446 
447  if( selection.Size() <= 1 )
448  return 0;
449 
450  filterPadsWithModules( selection );
451 
452  auto itemsToAlign = GetBoundingBoxes( selection );
453  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortCenterX );
454  if( checkLockedStatus( selection ) == SELECTION_LOCKED )
455  return 0;
456 
457  BOARD_COMMIT commit( frame );
458  commit.StageItems( selection, CHT_MODIFY );
459 
460  // after sorting use the center x coordinate of the leftmost item as a target
461  // for all other items
462  const int targetX = itemsToAlign.begin()->second.GetCenter().x;
463 
464  // Move the selected items
465  for( auto& i : itemsToAlign )
466  {
467  int difference = targetX - i.second.GetCenter().x;
468  BOARD_ITEM* item = i.first;
469 
470  // Don't move a pad by itself unless editing the footprint
471  if( item->Type() == PCB_PAD_T && frame->IsType( FRAME_PCB ) )
472  item = item->GetParent();
473 
474  item->Move( wxPoint( difference, 0 ) );
475  }
476 
477  commit.Push( _( "Align to middle" ) );
478 
479  return 0;
480 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
BOARD_ITEM_CONTAINER * GetParent() const
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)
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
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 483 of file placement_tool.cpp.

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

Referenced by Reset(), and setTransitions().

484 {
485  auto frame = getEditFrame<PCB_BASE_FRAME>();
487 
488  if( selection.Size() <= 1 )
489  return 0;
490 
491  filterPadsWithModules( selection );
492 
493  auto itemsToAlign = GetBoundingBoxes( selection );
494  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortCenterY );
495  if( checkLockedStatus( selection ) == SELECTION_LOCKED )
496  return 0;
497 
498  BOARD_COMMIT commit( frame );
499  commit.StageItems( selection, CHT_MODIFY );
500 
501  // after sorting use the center y coordinate of the top-most item as a target
502  // for all other items
503  const int targetY = itemsToAlign.begin()->second.GetCenter().y;
504 
505  // Move the selected items
506  for( auto& i : itemsToAlign )
507  {
508  int difference = targetY - i.second.GetCenter().y;
509  BOARD_ITEM* item = i.first;
510 
511  // Don't move a pad by itself unless editing the footprint
512  if( item->Type() == PCB_PAD_T && frame->IsType( FRAME_PCB ) )
513  item = item->GetParent();
514 
515  item->Move( wxPoint( 0, difference ) );
516  }
517 
518  commit.Push( _( "Align to center" ) );
519 
520  return 0;
521 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
BOARD_ITEM_CONTAINER * GetParent() const
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)
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
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 332 of file placement_tool.cpp.

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

Referenced by Reset(), and setTransitions().

333 {
334  // Because this tool uses bounding boxes and they aren't mirrored even when
335  // the view is mirrored, we need to call the other one if mirrored.
336  if( getView()->IsMirroredX() )
337  {
338  return doAlignRight();
339  }
340  else
341  {
342  return doAlignLeft();
343  }
344 }
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 387 of file placement_tool.cpp.

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

Referenced by Reset(), and setTransitions().

388 {
389  // Because this tool uses bounding boxes and they aren't mirrored even when
390  // the view is mirrored, we need to call the other one if mirrored.
391  if( getView()->IsMirroredX() )
392  {
393  return doAlignLeft();
394  }
395  else
396  {
397  return doAlignRight();
398  }
399 }
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 252 of file placement_tool.cpp.

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

Referenced by Reset(), and setTransitions().

253 {
254  auto frame = getEditFrame<PCB_BASE_FRAME>();
256 
257  if( selection.Size() <= 1 )
258  return 0;
259 
260  filterPadsWithModules( selection );
261 
262  auto itemsToAlign = GetBoundingBoxes( selection );
263  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortTopmostY );
264  if( checkLockedStatus( selection ) == SELECTION_LOCKED )
265  return 0;
266 
267  BOARD_COMMIT commit( frame );
268  commit.StageItems( selection, CHT_MODIFY );
269 
270  // after sorting, the fist item acts as the target for all others
271  const int targetTop = itemsToAlign.begin()->second.GetY();
272 
273  // Move the selected items
274  for( auto& i : itemsToAlign )
275  {
276  int difference = targetTop - i.second.GetY();
277  BOARD_ITEM* item = i.first;
278 
279  // Don't move a pad by itself unless editing the footprint
280  if( item->Type() == PCB_PAD_T && frame->IsType( FRAME_PCB ) )
281  item = item->GetParent();
282 
283  item->Move( wxPoint( 0, difference ) );
284  }
285 
286  commit.Push( _( "Align to top" ) );
287 
288  return 0;
289 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
BOARD_ITEM_CONTAINER * GetParent() const
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)
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
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 206 of file placement_tool.cpp.

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

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

207 {
208  SELECTION moving_items( selection );
209 
210  // Remove the anchor from the list
211  moving_items.Remove( moving_items.Front() );
212 
213  bool containsLocked = false;
214 
215  // Check if the selection contains locked items
216  for( const auto& item : moving_items )
217  {
218  switch ( item->Type() )
219  {
220  case PCB_MODULE_T:
221  if( static_cast< MODULE* >( item )->IsLocked() )
222  containsLocked = true;
223  break;
224 
225  case PCB_PAD_T:
226  case PCB_MODULE_EDGE_T:
227  case PCB_MODULE_TEXT_T:
228  if( static_cast< MODULE* >( item->GetParent() )->IsLocked() )
229  containsLocked = true;
230  break;
231 
232  default: // suppress warnings
233  break;
234  }
235  }
236 
237  if( containsLocked )
238  {
239  if( IsOK( getEditFrame< PCB_EDIT_FRAME >(),
240  _( "Selection contains locked items. Do you want to continue?" ) ) )
241  {
243  }
244  else
245  return SELECTION_LOCKED;
246  }
247 
248  return SELECTION_UNLOCKED;
249 }
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
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:233
int ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally ( const TOOL_EVENT aEvent)

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

Definition at line 524 of file placement_tool.cpp.

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

Referenced by Reset(), and setTransitions().

525 {
526  auto frame = getEditFrame<PCB_BASE_FRAME>();
529 
530  if( selection.Size() <= 1 )
531  return 0;
532 
534  return 0;
535 
536  BOARD_COMMIT commit( frame );
537  commit.StageItems( selection, CHT_MODIFY );
538 
539  auto itemsToDistribute = GetBoundingBoxes( selection );
540 
541  // find the last item by reverse sorting
542  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortRightmostX );
543  const auto lastItem = itemsToDistribute.begin()->first;
544 
545  const auto maxRight = itemsToDistribute.begin()->second.GetRight();
546 
547  // sort to get starting order
548  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortLeftmostX );
549  const auto minX = itemsToDistribute.begin()->second.GetX();
550  auto totalGap = maxRight - minX;
551  int totalWidth = 0;
552 
553  for( auto& i : itemsToDistribute )
554  {
555  totalWidth += i.second.GetWidth();
556  }
557 
558  if( totalGap < totalWidth )
559  {
560  // the width of the items exceeds the gap (overlapping items) -> use center point spacing
561  doDistributeCentersHorizontally( itemsToDistribute );
562  }
563  else
564  {
565  totalGap -= totalWidth;
566  doDistributeGapsHorizontally( itemsToDistribute, lastItem, totalGap );
567  }
568 
569  commit.Push( _( "Distribute horizontally" ) );
570 
571  return 0;
572 }
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_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)
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
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 611 of file placement_tool.cpp.

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

Referenced by Reset(), and setTransitions().

612 {
613  auto frame = getEditFrame<PCB_BASE_FRAME>();
616 
617  if( selection.Size() <= 1 )
618  return 0;
619 
621  return 0;
622 
623  BOARD_COMMIT commit( frame );
624  commit.StageItems( selection, CHT_MODIFY );
625 
626  auto itemsToDistribute = GetBoundingBoxes( selection );
627 
628  // find the last item by reverse sorting
629  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortBottommostY );
630  const auto maxBottom = itemsToDistribute.begin()->second.GetBottom();
631  const auto lastItem = itemsToDistribute.begin()->first;
632 
633  // sort to get starting order
634  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortTopmostY );
635  auto minY = itemsToDistribute.begin()->second.GetY();
636 
637  auto totalGap = maxBottom - minY;
638  int totalHeight = 0;
639 
640  for( auto& i : itemsToDistribute )
641  {
642  totalHeight += i.second.GetHeight();
643  }
644 
645  if( totalGap < totalHeight )
646  {
647  // the width of the items exceeds the gap (overlapping items) -> use center point spacing
648  doDistributeCentersVertically( itemsToDistribute );
649  }
650  else
651  {
652  totalGap -= totalHeight;
653  doDistributeGapsVertically( itemsToDistribute, lastItem, totalGap );
654  }
655 
656  commit.Push( _( "Distribute vertically" ) );
657 
658  return 0;
659 }
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)
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
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 347 of file placement_tool.cpp.

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

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

348 {
349  auto frame = getEditFrame<PCB_BASE_FRAME>();
351 
352  if( selection.Size() <= 1 )
353  return 0;
354 
355  filterPadsWithModules( selection );
356 
357  auto itemsToAlign = GetBoundingBoxes( selection );
358  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortLeftmostX );
359  if( checkLockedStatus( selection ) == SELECTION_LOCKED )
360  return 0;
361 
362  BOARD_COMMIT commit( frame );
363  commit.StageItems( selection, CHT_MODIFY );
364 
365  // after sorting, the fist item acts as the target for all others
366  const int targetLeft = itemsToAlign.begin()->second.GetX();
367 
368  // Move the selected items
369  for( auto& i : itemsToAlign )
370  {
371  int difference = targetLeft - i.second.GetX();
372  BOARD_ITEM* item = i.first;
373 
374  // Don't move a pad by itself unless editing the footprint
375  if( item->Type() == PCB_PAD_T && frame->IsType( FRAME_PCB ) )
376  item = item->GetParent();
377 
378  item->Move( wxPoint( difference, 0 ) );
379  }
380 
381  commit.Push( _( "Align to left" ) );
382 
383  return 0;
384 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
bool SortLeftmostX(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
BOARD_ITEM_CONTAINER * GetParent() const
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)
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
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 402 of file placement_tool.cpp.

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

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

403 {
404  auto frame = getEditFrame<PCB_BASE_FRAME>();
406 
407  if( selection.Size() <= 1 )
408  return 0;
409 
410  filterPadsWithModules( selection );
411 
412  auto itemsToAlign = GetBoundingBoxes( selection );
413  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortRightmostX );
414  if( checkLockedStatus( selection ) == SELECTION_LOCKED )
415  return 0;
416 
417  BOARD_COMMIT commit( frame );
418  commit.StageItems( selection, CHT_MODIFY );
419 
420  // after sorting, the fist item acts as the target for all others
421  const int targetRight = itemsToAlign.begin()->second.GetRight();
422 
423  // Move the selected items
424  for( auto& i : itemsToAlign )
425  {
426  int difference = targetRight - i.second.GetRight();
427  BOARD_ITEM* item = i.first;
428 
429  // Don't move a pad by itself unless editing the footprint
430  if( item->Type() == PCB_PAD_T && frame->IsType( FRAME_PCB ) )
431  item = item->GetParent();
432 
433  item->Move( wxPoint( difference, 0 ) );
434  }
435 
436  commit.Push( _( "Align to right" ) );
437 
438  return 0;
439 }
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:209
BOARD_ITEM_CONTAINER * GetParent() const
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)
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
SELECTION & RequestSelection(int aFlags=SELECTION_DEFAULT, CLIENT_SELECTION_FILTER aClientFilter=NULL)
Function RequestSelection()
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 594 of file placement_tool.cpp.

References i, and SortCenterX().

Referenced by DistributeHorizontally().

595 {
596  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortCenterX );
597  const auto totalGap = ( itemsToDistribute.end()-1 )->second.GetCenter().x
598  - itemsToDistribute.begin()->second.GetCenter().x;
599  const auto itemGap = totalGap / ( itemsToDistribute.size() - 1 );
600  auto targetX = itemsToDistribute.begin()->second.GetCenter().x;
601 
602  for( auto& i : itemsToDistribute )
603  {
604  int difference = targetX - i.second.GetCenter().x;
605  i.first->Move( wxPoint( difference, 0 ) );
606  targetX += ( itemGap );
607  }
608 }
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 681 of file placement_tool.cpp.

References i, and SortCenterY().

Referenced by DistributeVertically().

682 {
683  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortCenterY );
684  const auto totalGap = ( itemsToDistribute.end()-1 )->second.GetCenter().y
685  - itemsToDistribute.begin()->second.GetCenter().y;
686  const auto itemGap = totalGap / ( itemsToDistribute.size() - 1 );
687  auto targetY = itemsToDistribute.begin()->second.GetCenter().y;
688 
689  for( auto& i : itemsToDistribute )
690  {
691  int difference = targetY - i.second.GetCenter().y;
692  i.first->Move( wxPoint( 0, difference ) );
693  targetY += ( itemGap );
694  }
695 }
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 575 of file placement_tool.cpp.

References i.

Referenced by DistributeHorizontally().

577 {
578  const auto itemGap = totalGap / ( itemsToDistribute.size() - 1 );
579  auto targetX = itemsToDistribute.begin()->second.GetX();
580 
581  for( auto& i : itemsToDistribute )
582  {
583  // cover the corner case where the last item is wider than the previous item and gap
584  if( lastItem == i.first )
585  continue;
586 
587  int difference = targetX - i.second.GetX();
588  i.first->Move( wxPoint( difference, 0 ) );
589  targetX += ( i.second.GetWidth() + itemGap );
590  }
591 }
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 662 of file placement_tool.cpp.

References i.

Referenced by DistributeVertically().

664 {
665  const auto itemGap = totalGap / ( itemsToDistribute.size() - 1 );
666  auto targetY = itemsToDistribute.begin()->second.GetY();
667 
668  for( auto& i : itemsToDistribute )
669  {
670  // cover the corner case where the last item is wider than the previous item and gap
671  if( lastItem == i.first )
672  continue;
673 
674  int difference = targetY - i.second.GetY();
675  i.first->Move( wxPoint( 0, difference ) );
676  targetY += ( i.second.GetHeight() + itemGap );
677  }
678 }
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 185 of file placement_tool.cpp.

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

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

186 {
187  std::set<BOARD_ITEM*> rejected;
188  for( auto i : selection )
189  {
190  auto item = static_cast<BOARD_ITEM*>( i );
191  if( item->Type() == PCB_PAD_T )
192  {
193  MODULE* mod = static_cast<MODULE*>( item->GetParent() );
194 
195  // selection contains both the module and its pads - remove the pads
196  if( mod && selection.Contains( mod ) )
197  rejected.insert( item );
198  }
199  }
200 
201  for( BOARD_ITEM* item : rejected )
202  selection.Remove( item );
203 }
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(), EDIT_TOOL::MeasureTool(), and CONTEXT_MENU::onMenuEvent().

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:162
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(), PCBNEW_CONTROL::CursorControl(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), 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(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), 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(), DRAWING_TOOL::Reset(), GERBVIEW_SELECTION_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(), 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(), 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(), 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(), EDIT_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), ROUTER_TOOL::mainLoop(), 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(), 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

Function Go()

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

Definition at line 135 of file tool_interactive.h.

References TOOL_INTERACTIVE::goInternal().

Referenced by ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PAD_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), COMMON_TOOLS::setTransitions(), GERBVIEW_CONTROL::setTransitions(), MODULE_EDITOR_TOOLS::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), setTransitions(), PCBNEW_CONTROL::setTransitions(), PICKER_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), SELECTION_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), and DRAWING_TOOL::setTransitions().

137 {
138  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
139 
140  goInternal( sptr, aConditions );
141 }
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)
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 92 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().

93 {
94  // Find the selection tool, so they can cooperate
95  m_selectionTool = static_cast<SELECTION_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveSelection" ) );
96 
97  if( !m_selectionTool )
98  {
99  DisplayError( NULL, wxT( "pcbnew.InteractiveSelection tool is not available" ) );
100  return false;
101  }
102 
103  // Create a context menu and make it available through selection tool
105  m_placementMenu->SetIcon( align_items_xpm );
106  m_placementMenu->SetTitle( _( "Align/Distribute" ) );
107 
108  // Add all align/distribute commands
115  m_placementMenu->AppendSeparator();
118 
121 
122  return true;
123 }
static TOOL_ACTION alignRight
Align items to the right edge of selection bounding box.
Definition: pcb_actions.h:235
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:241
static TOOL_ACTION distributeVertically
Distributes items evenly along the vertical axis.
Definition: pcb_actions.h:247
CONTEXT_MENU * m_placementMenu
static TOOL_ACTION alignBottom
Align items to the bottom edge of selection bounding box.
Definition: pcb_actions.h:229
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:244
static TOOL_ACTION alignLeft
Align items to the left edge of selection bounding box.
Definition: pcb_actions.h:232
static TOOL_ACTION alignTop
Align items to the top edge of selection bounding box.
Definition: pcb_actions.h:226
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:238
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
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::disambiguationMenu(), 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 698 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().

699 {
706 
709 }
static TOOL_ACTION alignRight
Align items to the right edge of selection bounding box.
Definition: pcb_actions.h:235
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:241
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:247
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:229
static TOOL_ACTION distributeHorizontally
Distributes items evenly along the horizontal axis.
Definition: pcb_actions.h:244
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:232
static TOOL_ACTION alignTop
Align items to the top edge of selection bounding box.
Definition: pcb_actions.h:226
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:238
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(), SELECTION_TOOL::disambiguationMenu(), PCB_TOOL::doInteractiveItemPlacement(), 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(), EDIT_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), 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(), PAD_TOOL::applyPadSettings(), 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(), 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(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::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(), 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(), GERBVIEW_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), PCBNEW_CONTROL::ResetCoords(), TOOL_INTERACTIVE::resetTransitions(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), SELECTION_TOOL::SanitizeSelection(), 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: