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...
 
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
 
PCB_BASE_FRAMEm_frame
 

Detailed Description

Definition at line 36 of file placement_tool.h.

Member Enumeration Documentation

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 80 of file tool_base.h.

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

Constructor & Destructor Documentation

ALIGN_DISTRIBUTE_TOOL::ALIGN_DISTRIBUTE_TOOL ( )

Definition at line 82 of file placement_tool.cpp.

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

Definition at line 88 of file placement_tool.cpp.

References m_placementMenu.

89 {
90  delete m_placementMenu;
91 }
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 AUTOPLACE_TOOL::autoplace(), PCBNEW_CONTROL::DeleteItemCursor(), EDIT_TOOL::doCopyToClipboard(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), EDIT_TOOL::pickCopyReferencePoint(), DRAWING_TOOL::PlaceImportedGraphics(), 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 226 of file placement_tool.cpp.

References CHT_MODIFY, EditToolSelectionFilter(), EXCLUDE_LOCKED, EXCLUDE_TRANSIENTS, FRAME_PCB, GetBoundingBoxes(), BOARD_ITEM::GetParent(), i, EDA_BASE_FRAME::IsType(), m_frame, m_selectionTool, BOARD_ITEM::Move(), PCB_PAD_T, SELECTION_TOOL::RequestSelection(), SELECTION::Size(), SortBottommostY(), and EDA_ITEM::Type().

Referenced by Reset(), and setTransitions().

227 {
229  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
231 
232  if( selection.Size() <= 1 )
233  return 0;
234 
235  auto itemsToAlign = GetBoundingBoxes( selection );
236  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortBottommostY );
237 
238  BOARD_COMMIT commit( m_frame );
239  commit.StageItems( selection, CHT_MODIFY );
240 
241  // after sorting, the fist item acts as the target for all others
242  const int targetBottom = itemsToAlign.begin()->second.GetBottom();
243 
244  // Move the selected items
245  for( auto& i : itemsToAlign )
246  {
247  int difference = targetBottom - i.second.GetBottom();
248  BOARD_ITEM* item = i.first;
249 
250  // Don't move a pad by itself unless editing the footprint
251  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB ) )
252  item = item->GetParent();
253 
254  item->Move( wxPoint( 0, difference ) );
255  }
256 
257  commit.Push( _( "Align to bottom" ) );
258 
259  return 0;
260 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
BOARD_ITEM_CONTAINER * GetParent() const
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
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.
#define EXCLUDE_TRANSIENTS
Definition: edit_tool.h:47
PCB_BASE_FRAME * m_frame
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:245
size_t i
Definition: json11.cpp:597
SELECTION_TOOL * m_selectionTool
int Size() const
Returns the number of selected parts.
Definition: selection.h:122
bool IsType(FRAME_T aType) const
#define EXCLUDE_LOCKED
Function EditToolSelectionFilter.
Definition: edit_tool.h:45
void EditToolSelectionFilter(GENERAL_COLLECTOR &aCollector, int aFlags)
Definition: edit_tool.cpp:173
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 367 of file placement_tool.cpp.

References CHT_MODIFY, EditToolSelectionFilter(), EXCLUDE_LOCKED, EXCLUDE_TRANSIENTS, FRAME_PCB, GetBoundingBoxes(), BOARD_ITEM::GetParent(), i, EDA_BASE_FRAME::IsType(), m_frame, m_selectionTool, BOARD_ITEM::Move(), PCB_PAD_T, SELECTION_TOOL::RequestSelection(), SELECTION::Size(), SortCenterX(), and EDA_ITEM::Type().

Referenced by Reset(), and setTransitions().

368 {
370  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
372 
373  if( selection.Size() <= 1 )
374  return 0;
375 
376  auto itemsToAlign = GetBoundingBoxes( selection );
377  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortCenterX );
378 
379  BOARD_COMMIT commit( m_frame );
380  commit.StageItems( selection, CHT_MODIFY );
381 
382  // after sorting use the center x coordinate of the leftmost item as a target
383  // for all other items
384  const int targetX = itemsToAlign.begin()->second.GetCenter().x;
385 
386  // Move the selected items
387  for( auto& i : itemsToAlign )
388  {
389  int difference = targetX - i.second.GetCenter().x;
390  BOARD_ITEM* item = i.first;
391 
392  // Don't move a pad by itself unless editing the footprint
393  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB ) )
394  item = item->GetParent();
395 
396  item->Move( wxPoint( difference, 0 ) );
397  }
398 
399  commit.Push( _( "Align to middle" ) );
400 
401  return 0;
402 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
BOARD_ITEM_CONTAINER * GetParent() const
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
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.
#define EXCLUDE_TRANSIENTS
Definition: edit_tool.h:47
PCB_BASE_FRAME * m_frame
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:245
size_t i
Definition: json11.cpp:597
SELECTION_TOOL * m_selectionTool
int Size() const
Returns the number of selected parts.
Definition: selection.h:122
bool IsType(FRAME_T aType) const
#define EXCLUDE_LOCKED
Function EditToolSelectionFilter.
Definition: edit_tool.h:45
void EditToolSelectionFilter(GENERAL_COLLECTOR &aCollector, int aFlags)
Definition: edit_tool.cpp:173
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 405 of file placement_tool.cpp.

References CHT_MODIFY, EditToolSelectionFilter(), EXCLUDE_LOCKED, EXCLUDE_TRANSIENTS, FRAME_PCB, GetBoundingBoxes(), BOARD_ITEM::GetParent(), i, EDA_BASE_FRAME::IsType(), m_frame, m_selectionTool, BOARD_ITEM::Move(), PCB_PAD_T, SELECTION_TOOL::RequestSelection(), SELECTION::Size(), SortCenterY(), and EDA_ITEM::Type().

Referenced by Reset(), and setTransitions().

406 {
408  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
410 
411  if( selection.Size() <= 1 )
412  return 0;
413 
414  auto itemsToAlign = GetBoundingBoxes( selection );
415  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortCenterY );
416 
417  BOARD_COMMIT commit( m_frame );
418  commit.StageItems( selection, CHT_MODIFY );
419 
420  // after sorting use the center y coordinate of the top-most item as a target
421  // for all other items
422  const int targetY = itemsToAlign.begin()->second.GetCenter().y;
423 
424  // Move the selected items
425  for( auto& i : itemsToAlign )
426  {
427  int difference = targetY - i.second.GetCenter().y;
428  BOARD_ITEM* item = i.first;
429 
430  // Don't move a pad by itself unless editing the footprint
431  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB ) )
432  item = item->GetParent();
433 
434  item->Move( wxPoint( 0, difference ) );
435  }
436 
437  commit.Push( _( "Align to center" ) );
438 
439  return 0;
440 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
BOARD_ITEM_CONTAINER * GetParent() const
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
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.
#define EXCLUDE_TRANSIENTS
Definition: edit_tool.h:47
PCB_BASE_FRAME * m_frame
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:245
size_t i
Definition: json11.cpp:597
SELECTION_TOOL * m_selectionTool
int Size() const
Returns the number of selected parts.
Definition: selection.h:122
bool IsType(FRAME_T aType) const
#define EXCLUDE_LOCKED
Function EditToolSelectionFilter.
Definition: edit_tool.h:45
void EditToolSelectionFilter(GENERAL_COLLECTOR &aCollector, int aFlags)
Definition: edit_tool.cpp:173
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 263 of file placement_tool.cpp.

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

Referenced by Reset(), and setTransitions().

264 {
265  // Because this tool uses bounding boxes and they aren't mirrored even when
266  // the view is mirrored, we need to call the other one if mirrored.
267  if( getView()->IsMirroredX() )
268  {
269  return doAlignRight();
270  }
271  else
272  {
273  return doAlignLeft();
274  }
275 }
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 315 of file placement_tool.cpp.

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

Referenced by Reset(), and setTransitions().

316 {
317  // Because this tool uses bounding boxes and they aren't mirrored even when
318  // the view is mirrored, we need to call the other one if mirrored.
319  if( getView()->IsMirroredX() )
320  {
321  return doAlignLeft();
322  }
323  else
324  {
325  return doAlignRight();
326  }
327 }
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 189 of file placement_tool.cpp.

References CHT_MODIFY, EditToolSelectionFilter(), EXCLUDE_LOCKED, EXCLUDE_TRANSIENTS, FRAME_PCB, GetBoundingBoxes(), BOARD_ITEM::GetParent(), i, EDA_BASE_FRAME::IsType(), m_frame, m_selectionTool, BOARD_ITEM::Move(), PCB_PAD_T, SELECTION_TOOL::RequestSelection(), SELECTION::Size(), SortTopmostY(), and EDA_ITEM::Type().

Referenced by Reset(), and setTransitions().

190 {
192  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
194 
195  if( selection.Size() <= 1 )
196  return 0;
197 
198  auto itemsToAlign = GetBoundingBoxes( selection );
199  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortTopmostY );
200 
201  BOARD_COMMIT commit( m_frame );
202  commit.StageItems( selection, CHT_MODIFY );
203 
204  // after sorting, the fist item acts as the target for all others
205  const int targetTop = itemsToAlign.begin()->second.GetY();
206 
207  // Move the selected items
208  for( auto& i : itemsToAlign )
209  {
210  int difference = targetTop - i.second.GetY();
211  BOARD_ITEM* item = i.first;
212 
213  // Don't move a pad by itself unless editing the footprint
214  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB ) )
215  item = item->GetParent();
216 
217  item->Move( wxPoint( 0, difference ) );
218  }
219 
220  commit.Push( _( "Align to top" ) );
221 
222  return 0;
223 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
BOARD_ITEM_CONTAINER * GetParent() const
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
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.
#define EXCLUDE_TRANSIENTS
Definition: edit_tool.h:47
PCB_BASE_FRAME * m_frame
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:245
size_t i
Definition: json11.cpp:597
SELECTION_TOOL * m_selectionTool
int Size() const
Returns the number of selected parts.
Definition: selection.h:122
bool IsType(FRAME_T aType) const
#define EXCLUDE_LOCKED
Function EditToolSelectionFilter.
Definition: edit_tool.h:45
void EditToolSelectionFilter(GENERAL_COLLECTOR &aCollector, int aFlags)
Definition: edit_tool.cpp:173
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

int ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally ( const TOOL_EVENT aEvent)

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

Definition at line 443 of file placement_tool.cpp.

References CHT_MODIFY, doDistributeCentersHorizontally(), doDistributeGapsHorizontally(), EditToolSelectionFilter(), EXCLUDE_LOCKED, EXCLUDE_TRANSIENTS, GetBoundingBoxes(), i, m_frame, m_selectionTool, BOARD_COMMIT::Push(), SELECTION_TOOL::RequestSelection(), SELECTION::Size(), SortLeftmostX(), SortRightmostX(), and COMMIT::StageItems().

Referenced by Reset(), and setTransitions().

444 {
446  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
448 
449  if( selection.Size() <= 1 )
450  return 0;
451 
452  BOARD_COMMIT commit( m_frame );
453  commit.StageItems( selection, CHT_MODIFY );
454 
455  auto itemsToDistribute = GetBoundingBoxes( selection );
456 
457  // find the last item by reverse sorting
458  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortRightmostX );
459  const auto lastItem = itemsToDistribute.begin()->first;
460 
461  const auto maxRight = itemsToDistribute.begin()->second.GetRight();
462 
463  // sort to get starting order
464  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortLeftmostX );
465  const auto minX = itemsToDistribute.begin()->second.GetX();
466  auto totalGap = maxRight - minX;
467  int totalWidth = 0;
468 
469  for( auto& i : itemsToDistribute )
470  {
471  totalWidth += i.second.GetWidth();
472  }
473 
474  if( totalGap < totalWidth )
475  {
476  // the width of the items exceeds the gap (overlapping items) -> use center point spacing
477  doDistributeCentersHorizontally( itemsToDistribute );
478  }
479  else
480  {
481  totalGap -= totalWidth;
482  doDistributeGapsHorizontally( itemsToDistribute, lastItem, totalGap );
483  }
484 
485  commit.Push( _( "Distribute horizontally" ) );
486 
487  return 0;
488 }
bool SortRightmostX(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
bool SortLeftmostX(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
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)
#define EXCLUDE_TRANSIENTS
Definition: edit_tool.h:47
PCB_BASE_FRAME * m_frame
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:245
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 Size() const
Returns the number of selected parts.
Definition: selection.h:122
#define EXCLUDE_LOCKED
Function EditToolSelectionFilter.
Definition: edit_tool.h:45
void EditToolSelectionFilter(GENERAL_COLLECTOR &aCollector, int aFlags)
Definition: edit_tool.cpp:173
int ALIGN_DISTRIBUTE_TOOL::DistributeVertically ( const TOOL_EVENT aEvent)

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

Definition at line 539 of file placement_tool.cpp.

References CHT_MODIFY, doDistributeCentersVertically(), doDistributeGapsVertically(), EditToolSelectionFilter(), EXCLUDE_LOCKED, EXCLUDE_TRANSIENTS, GetBoundingBoxes(), i, m_frame, m_selectionTool, BOARD_COMMIT::Push(), SELECTION_TOOL::RequestSelection(), SELECTION::Size(), SortBottommostY(), SortTopmostY(), and COMMIT::StageItems().

Referenced by Reset(), and setTransitions().

540 {
542  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
544 
545  if( selection.Size() <= 1 )
546  return 0;
547 
548  BOARD_COMMIT commit( m_frame );
549  commit.StageItems( selection, CHT_MODIFY );
550 
551  auto itemsToDistribute = GetBoundingBoxes( selection );
552 
553  // find the last item by reverse sorting
554  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortBottommostY );
555  const auto maxBottom = itemsToDistribute.begin()->second.GetBottom();
556  const auto lastItem = itemsToDistribute.begin()->first;
557 
558  // sort to get starting order
559  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortTopmostY );
560  auto minY = itemsToDistribute.begin()->second.GetY();
561 
562  auto totalGap = maxBottom - minY;
563  int totalHeight = 0;
564 
565  for( auto& i : itemsToDistribute )
566  {
567  totalHeight += i.second.GetHeight();
568  }
569 
570  if( totalGap < totalHeight )
571  {
572  // the width of the items exceeds the gap (overlapping items) -> use center point spacing
573  doDistributeCentersVertically( itemsToDistribute );
574  }
575  else
576  {
577  totalGap -= totalHeight;
578  doDistributeGapsVertically( itemsToDistribute, lastItem, totalGap );
579  }
580 
581  commit.Push( _( "Distribute vertically" ) );
582 
583  return 0;
584 }
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
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)
#define EXCLUDE_TRANSIENTS
Definition: edit_tool.h:47
PCB_BASE_FRAME * m_frame
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:245
size_t i
Definition: json11.cpp:597
SELECTION_TOOL * m_selectionTool
int Size() const
Returns the number of selected parts.
Definition: selection.h:122
#define EXCLUDE_LOCKED
Function EditToolSelectionFilter.
Definition: edit_tool.h:45
void EditToolSelectionFilter(GENERAL_COLLECTOR &aCollector, int aFlags)
Definition: edit_tool.cpp:173
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 278 of file placement_tool.cpp.

References CHT_MODIFY, EditToolSelectionFilter(), EXCLUDE_LOCKED, EXCLUDE_TRANSIENTS, FRAME_PCB, GetBoundingBoxes(), BOARD_ITEM::GetParent(), i, EDA_BASE_FRAME::IsType(), m_frame, m_selectionTool, BOARD_ITEM::Move(), PCB_PAD_T, SELECTION_TOOL::RequestSelection(), SELECTION::Size(), SortLeftmostX(), and EDA_ITEM::Type().

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

279 {
281  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
283 
284  if( selection.Size() <= 1 )
285  return 0;
286 
287  auto itemsToAlign = GetBoundingBoxes( selection );
288  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortLeftmostX );
289 
290  BOARD_COMMIT commit( m_frame );
291  commit.StageItems( selection, CHT_MODIFY );
292 
293  // after sorting, the fist item acts as the target for all others
294  const int targetLeft = itemsToAlign.begin()->second.GetX();
295 
296  // Move the selected items
297  for( auto& i : itemsToAlign )
298  {
299  int difference = targetLeft - i.second.GetX();
300  BOARD_ITEM* item = i.first;
301 
302  // Don't move a pad by itself unless editing the footprint
303  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB ) )
304  item = item->GetParent();
305 
306  item->Move( wxPoint( difference, 0 ) );
307  }
308 
309  commit.Push( _( "Align to left" ) );
310 
311  return 0;
312 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
bool SortLeftmostX(const std::pair< BOARD_ITEM *, EDA_RECT > left, const std::pair< BOARD_ITEM *, EDA_RECT > right)
BOARD_ITEM_CONTAINER * GetParent() const
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
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.
#define EXCLUDE_TRANSIENTS
Definition: edit_tool.h:47
PCB_BASE_FRAME * m_frame
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:245
size_t i
Definition: json11.cpp:597
SELECTION_TOOL * m_selectionTool
int Size() const
Returns the number of selected parts.
Definition: selection.h:122
bool IsType(FRAME_T aType) const
#define EXCLUDE_LOCKED
Function EditToolSelectionFilter.
Definition: edit_tool.h:45
void EditToolSelectionFilter(GENERAL_COLLECTOR &aCollector, int aFlags)
Definition: edit_tool.cpp:173
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 330 of file placement_tool.cpp.

References CHT_MODIFY, EditToolSelectionFilter(), EXCLUDE_LOCKED, EXCLUDE_TRANSIENTS, FRAME_PCB, GetBoundingBoxes(), BOARD_ITEM::GetParent(), i, EDA_BASE_FRAME::IsType(), m_frame, m_selectionTool, BOARD_ITEM::Move(), PCB_PAD_T, SELECTION_TOOL::RequestSelection(), SELECTION::Size(), SortRightmostX(), and EDA_ITEM::Type().

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

331 {
333  []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
335 
336  if( selection.Size() <= 1 )
337  return 0;
338 
339  auto itemsToAlign = GetBoundingBoxes( selection );
340  std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortRightmostX );
341 
342  BOARD_COMMIT commit( m_frame );
343  commit.StageItems( selection, CHT_MODIFY );
344 
345  // after sorting, the fist item acts as the target for all others
346  const int targetRight = itemsToAlign.begin()->second.GetRight();
347 
348  // Move the selected items
349  for( auto& i : itemsToAlign )
350  {
351  int difference = targetRight - i.second.GetRight();
352  BOARD_ITEM* item = i.first;
353 
354  // Don't move a pad by itself unless editing the footprint
355  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB ) )
356  item = item->GetParent();
357 
358  item->Move( wxPoint( difference, 0 ) );
359  }
360 
361  commit.Push( _( "Align to right" ) );
362 
363  return 0;
364 }
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:201
BOARD_ITEM_CONTAINER * GetParent() const
SELECTION & RequestSelection(CLIENT_SELECTION_FILTER aClientFilter)
Function RequestSelection()
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
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.
#define EXCLUDE_TRANSIENTS
Definition: edit_tool.h:47
PCB_BASE_FRAME * m_frame
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:245
size_t i
Definition: json11.cpp:597
SELECTION_TOOL * m_selectionTool
int Size() const
Returns the number of selected parts.
Definition: selection.h:122
bool IsType(FRAME_T aType) const
#define EXCLUDE_LOCKED
Function EditToolSelectionFilter.
Definition: edit_tool.h:45
void EditToolSelectionFilter(GENERAL_COLLECTOR &aCollector, int aFlags)
Definition: edit_tool.cpp:173
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 516 of file placement_tool.cpp.

References FRAME_PCB, BOARD_ITEM::GetParent(), i, EDA_BASE_FRAME::IsType(), m_frame, BOARD_ITEM::Move(), PCB_PAD_T, SortCenterX(), and EDA_ITEM::Type().

Referenced by DistributeHorizontally().

517 {
518  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortCenterX );
519  const auto totalGap = ( itemsToDistribute.end()-1 )->second.GetCenter().x
520  - itemsToDistribute.begin()->second.GetCenter().x;
521  const auto itemGap = totalGap / ( itemsToDistribute.size() - 1 );
522  auto targetX = itemsToDistribute.begin()->second.GetCenter().x;
523 
524  for( auto& i : itemsToDistribute )
525  {
526  BOARD_ITEM* item = i.first;
527 
528  // Don't move a pad by itself unless editing the footprint
529  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB ) )
530  item = item->GetParent();
531 
532  int difference = targetX - i.second.GetCenter().x;
533  item->Move( wxPoint( difference, 0 ) );
534  targetX += ( itemGap );
535  }
536 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
BOARD_ITEM_CONTAINER * GetParent() const
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
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
PCB_BASE_FRAME * m_frame
size_t i
Definition: json11.cpp:597
bool IsType(FRAME_T aType) const
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 612 of file placement_tool.cpp.

References FRAME_PCB, BOARD_ITEM::GetParent(), i, EDA_BASE_FRAME::IsType(), m_frame, BOARD_ITEM::Move(), PCB_PAD_T, SortCenterY(), and EDA_ITEM::Type().

Referenced by DistributeVertically().

613 {
614  std::sort( itemsToDistribute.begin(), itemsToDistribute.end(), SortCenterY );
615  const auto totalGap = ( itemsToDistribute.end()-1 )->second.GetCenter().y
616  - itemsToDistribute.begin()->second.GetCenter().y;
617  const auto itemGap = totalGap / ( itemsToDistribute.size() - 1 );
618  auto targetY = itemsToDistribute.begin()->second.GetCenter().y;
619 
620  for( auto& i : itemsToDistribute )
621  {
622  BOARD_ITEM* item = i.first;
623 
624  // Don't move a pad by itself unless editing the footprint
625  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB ) )
626  item = item->GetParent();
627 
628  int difference = targetY - i.second.GetCenter().y;
629  item->Move( wxPoint( 0, difference ) );
630  targetY += ( itemGap );
631  }
632 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
BOARD_ITEM_CONTAINER * GetParent() const
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
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.
PCB_BASE_FRAME * m_frame
size_t i
Definition: json11.cpp:597
bool IsType(FRAME_T aType) const
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 491 of file placement_tool.cpp.

References FRAME_PCB, BOARD_ITEM::GetParent(), i, EDA_BASE_FRAME::IsType(), m_frame, BOARD_ITEM::Move(), PCB_PAD_T, and EDA_ITEM::Type().

Referenced by DistributeHorizontally().

493 {
494  const auto itemGap = totalGap / ( itemsToDistribute.size() - 1 );
495  auto targetX = itemsToDistribute.begin()->second.GetX();
496 
497  for( auto& i : itemsToDistribute )
498  {
499  BOARD_ITEM* item = i.first;
500 
501  // cover the corner case where the last item is wider than the previous item and gap
502  if( lastItem == item )
503  continue;
504 
505  // Don't move a pad by itself unless editing the footprint
506  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB ) )
507  item = item->GetParent();
508 
509  int difference = targetX - i.second.GetX();
510  item->Move( wxPoint( difference, 0 ) );
511  targetX += ( i.second.GetWidth() + itemGap );
512  }
513 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
BOARD_ITEM_CONTAINER * GetParent() const
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
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.
PCB_BASE_FRAME * m_frame
size_t i
Definition: json11.cpp:597
bool IsType(FRAME_T aType) const
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 587 of file placement_tool.cpp.

References FRAME_PCB, BOARD_ITEM::GetParent(), i, EDA_BASE_FRAME::IsType(), m_frame, PCB_PAD_T, and EDA_ITEM::Type().

Referenced by DistributeVertically().

589 {
590  const auto itemGap = totalGap / ( itemsToDistribute.size() - 1 );
591  auto targetY = itemsToDistribute.begin()->second.GetY();
592 
593  for( auto& i : itemsToDistribute )
594  {
595  BOARD_ITEM* item = i.first;
596 
597  // cover the corner case where the last item is wider than the previous item and gap
598  if( lastItem == item )
599  continue;
600 
601  // Don't move a pad by itself unless editing the footprint
602  if( item->Type() == PCB_PAD_T && m_frame->IsType( FRAME_PCB ) )
603  item = item->GetParent();
604 
605  int difference = targetY - i.second.GetY();
606  i.first->Move( wxPoint( 0, difference ) );
607  targetY += ( i.second.GetHeight() + itemGap );
608  }
609 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
BOARD_ITEM_CONTAINER * GetParent() const
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
PCB_BASE_FRAME * m_frame
size_t i
Definition: json11.cpp:597
bool IsType(FRAME_T aType) const
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
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(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL::doInteractiveItemPlacement(), CONTEXT_MENU::getToolManager(), CONTEXT_MENU::onMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

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

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 199 of file tool_base.h.

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

200  {
201  EDA_ITEM* m = getModelInt();
202 
203  return static_cast<T*>( m );
204  }
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
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(), 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(), COMMON_TOOLS::CenterContents(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), COMMON_TOOLS::CursorControl(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::doSelectionMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findCallback(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::guessSelectionCandidates(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), PNS::TOOL_BASE::pickSingleItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), EDIT_TOOL::Remove(), 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(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), POINT_EDITOR::updateEditedPoint(), COMMON_TOOLS::updateGrid(), PCBNEW_CONTROL::updateGrid(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), CVPCB_SELECTION_TOOL::~CVPCB_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

36 {
37  return m_toolMgr->GetView();
38 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:252
KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Function getViewControls()

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

Returns
The instance of VIEW_CONTROLS.

Definition at line 41 of file tool_base.cpp.

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

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

42 {
43  return m_toolMgr->GetViewControls();
44 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:257
template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited
bool ALIGN_DISTRIBUTE_TOOL::Init ( )
overridevirtual

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

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

Reimplemented from TOOL_BASE.

Definition at line 94 of file placement_tool.cpp.

References 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_frame, m_placementMenu, m_selectionTool, TOOL_BASE::m_toolMgr, SELECTION_CONDITIONS::MoreThan(), and CONTEXT_MENU::SetIcon().

Referenced by Reset().

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

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

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

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 85 of file tool_interactive.cpp.

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

Referenced by DRAWING_TOOL::PlaceText().

86 {
87  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
88 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)
void TOOL_INTERACTIVE::SetContextMenu ( CONTEXT_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Function SetContextMenu()

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

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

Definition at line 74 of file tool_interactive.cpp.

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

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

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

Sets up handlers for various events.

Implements TOOL_INTERACTIVE.

Definition at line 635 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().

636 {
643 
646 }
static TOOL_ACTION alignRight
Align items to the right edge of selection bounding box.
Definition: pcb_actions.h:238
int AlignLeft(const TOOL_EVENT &aEvent)
Function AlignLeft() Sets X coordinate of the selected items to the value of the left-most selected i...
int AlignCenterY(const TOOL_EVENT &aEvent)
Function AlignCenterX() Sets the y coordinate of the midpoint of each of the selected items to the va...
int AlignCenterX(const TOOL_EVENT &aEvent)
Function AlignCenterX() Sets the x coordinate of the midpoint of each of the selected items to the va...
static TOOL_ACTION alignCenterY
Align items to the center of selection bounding box.
Definition: pcb_actions.h:244
int AlignBottom(const TOOL_EVENT &aEvent)
Function AlignBottom() Sets Y coordinate of the selected items to the value of the bottom-most select...
static TOOL_ACTION distributeVertically
Distributes items evenly along the vertical axis.
Definition: pcb_actions.h:250
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static TOOL_ACTION alignBottom
Align items to the bottom edge of selection bounding box.
Definition: pcb_actions.h:232
static TOOL_ACTION distributeHorizontally
Distributes items evenly along the horizontal axis.
Definition: pcb_actions.h:247
int DistributeHorizontally(const TOOL_EVENT &aEvent)
Function DistributeHorizontally() Distributes the selected items along the X axis.
int AlignTop(const TOOL_EVENT &aEvent)
Function AlignTop() Sets Y coordinate of the selected items to the value of the top-most selected ite...
int DistributeVertically(const TOOL_EVENT &aEvent)
Function DistributeVertically() Distributes the selected items along the Y axis.
static TOOL_ACTION alignLeft
Align items to the left edge of selection bounding box.
Definition: pcb_actions.h:235
static TOOL_ACTION alignTop
Align items to the top edge of selection bounding box.
Definition: pcb_actions.h:229
int AlignRight(const TOOL_EVENT &aEvent)
Function AlignRight() Sets X coordinate of the selected items to the value of the right-most selected...
static TOOL_ACTION alignCenterX
Align items to the middle of selection bounding box.
Definition: pcb_actions.h:241
OPT_TOOL_EVENT TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Function Wait()

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

Definition at line 55 of file tool_interactive.cpp.

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

Referenced by PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PCB_TOOL::doInteractiveItemPlacement(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), CVPCB_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EDIT_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), CVPCB_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), 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 121 of file placement_tool.h.

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

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

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

Definition at line 210 of file tool_base.h.

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

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), TOOL_BASE::attachManager(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), PCB_EDITOR_CONTROL::ClearHighlight(), GERBVIEW_SELECTION_TOOL::clearSelection(), SELECTION_TOOL::clearSelection(), PAD_TOOL::copyPadSettings(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_EDITOR_CONTROL::CrossProbePcbToSch(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), COMMON_TOOLS::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(), Init(), PAD_TOOL::Init(), PCB_EDITOR_CONTROL::Init(), POINT_EDITOR::Init(), POSITION_RELATIVE_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), ROUTER_TOOL::mainLoop(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), PCBNEW_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), SELECTION_TOOL::RequestSelection(), CVPCB_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), TOOL_INTERACTIVE::resetTransitions(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), ZONE_FILLER_TOOL::SegzoneDeleteFill(), 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: