KiCad PCB EDA Suite
footprint_editor_tools.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2014-2019 CERN
5  * @author Maciej Suminski <maciej.suminski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include "footprint_editor_tools.h"
26 #include "kicad_clipboard.h"
27 #include "selection_tool.h"
28 #include "pcb_actions.h"
29 
30 #include <core/optional.h>
31 
32 #include <tool/tool_manager.h>
33 
34 #include <class_draw_panel_gal.h>
35 #include <view/view_controls.h>
36 #include <view/view_group.h>
37 #include <pcb_painter.h>
38 #include <origin_viewitem.h>
39 #include <status_popup.h>
40 
41 #include <kicad_plugin.h>
42 #include <pcbnew_id.h>
43 #include <collectors.h>
44 #include <confirm.h>
46 #include <hotkeys.h>
47 #include <bitmaps.h>
48 
49 #include <pcb_edit_frame.h>
50 #include <class_board.h>
51 #include <class_module.h>
52 #include <class_edge_mod.h>
53 #include <board_commit.h>
54 
55 #include <tools/tool_event_utils.h>
56 
57 #include <functional>
58 using namespace std::placeholders;
59 #include <wx/defs.h>
60 
61 // Module editor tools
62 TOOL_ACTION PCB_ACTIONS::placePad( "pcbnew.ModuleEditor.placePad",
63  AS_GLOBAL, 0,
64  _( "Add Pad" ), _( "Add a pad" ), NULL, AF_ACTIVATE );
65 
66 TOOL_ACTION PCB_ACTIONS::createPadFromShapes( "pcbnew.ModuleEditor.createPadFromShapes",
67  AS_CONTEXT, 0,
68  _( "Create Pad from Selected Shapes" ),
69  _( "Creates a custom-shaped pads from a set of selected shapes" ),
70  primitives_to_custom_pad_xpm );
71 
72 TOOL_ACTION PCB_ACTIONS::explodePadToShapes( "pcbnew.ModuleEditor.explodePadToShapes",
73  AS_CONTEXT, 0,
74  _( "Explode Pad to Graphic Shapes" ),
75  _( "Converts a custom-shaped pads to a set of graphical shapes" ),
76  custom_pad_to_primitives_xpm );
77 
78 TOOL_ACTION PCB_ACTIONS::enumeratePads( "pcbnew.ModuleEditor.enumeratePads",
79  AS_GLOBAL, 0,
80  _( "Renumber Pads..." ), _( "Renumber pads by clicking on them in the desired order" ), pad_enumerate_xpm, AF_ACTIVATE );
81 
82 
84  PCB_TOOL( "pcbnew.ModuleEditor" )
85 {
86 }
87 
88 
90 {
91 }
92 
93 
95 {
96 }
97 
98 
99 
101 {
102  struct PAD_PLACER : public INTERACTIVE_PLACER_BASE
103  {
104  std::unique_ptr<BOARD_ITEM> CreateItem() override
105  {
106  D_PAD* pad = new D_PAD ( m_board->m_Modules );
107  m_frame->Import_Pad_Settings( pad, false ); // use the global settings for pad
108  pad->IncrementPadName( true, true );
109  return std::unique_ptr<BOARD_ITEM>( pad );
110  }
111 
112  bool PlaceItem( BOARD_ITEM *aItem, BOARD_COMMIT& aCommit ) override
113  {
114  D_PAD* pad = dynamic_cast<D_PAD*>( aItem );
115 
116  if( pad )
117  {
118  m_frame->Export_Pad_Settings( pad );
119  pad->SetLocalCoord();
120  aCommit.Add( aItem );
121  return true;
122  }
123 
124  return false;
125  }
126  };
127 
128  PAD_PLACER placer;
129 
130  frame()->SetToolID( ID_MODEDIT_PAD_TOOL, wxCURSOR_PENCIL, _( "Add pads" ) );
131 
132  wxASSERT( board()->m_Modules );
133 
134  doInteractiveItemPlacement( &placer, _( "Place pad" ), IPO_REPEAT | IPO_SINGLE_CLICK | IPO_ROTATE | IPO_FLIP );
135 
137 
138  return 0;
139 }
140 
141 
143 {
144  if( !board()->m_Modules || !board()->m_Modules->PadsList() )
145  return 0;
146 
147  DIALOG_ENUM_PADS settingsDlg( frame() );
148 
149  if( settingsDlg.ShowModal() != wxID_OK )
150  return 0;
151 
152  Activate();
153 
154  GENERAL_COLLECTOR collector;
155  const KICAD_T types[] = { PCB_PAD_T, EOT };
156 
158  guide.SetIgnoreMTextsMarkedNoShow( true );
159  guide.SetIgnoreMTextsOnBack( true );
160  guide.SetIgnoreMTextsOnFront( true );
161  guide.SetIgnoreModulesVals( true );
162  guide.SetIgnoreModulesRefs( true );
163 
164  int seqPadNum = settingsDlg.GetStartNumber();
165  wxString padPrefix = settingsDlg.GetPrefix();
166  std::deque<int> storedPadNumbers;
167 
168  frame()->SetToolID( ID_MODEDIT_PAD_TOOL, wxCURSOR_HAND,
169  _( "Click on successive pads to renumber them" ) );
170 
172  getViewControls()->ShowCursor( true );
173 
175  VECTOR2I oldCursorPos; // store the previous mouse cursor position, during mouse drag
176  std::list<D_PAD*> selectedPads;
177  BOARD_COMMIT commit( frame() );
178  std::map<wxString, std::pair<int, wxString>> oldNames;
179  bool isFirstPoint = true; // used to be sure oldCursorPos will be initialized at least once.
180 
181  STATUS_TEXT_POPUP statusPopup( frame() );
182  statusPopup.SetText( wxString::Format(
183  _( "Click on pad %s%d\nPress Escape to cancel or double-click to commit" ),
184  padPrefix.c_str(), seqPadNum ) );
185  statusPopup.Popup();
186  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
187 
188  while( OPT_TOOL_EVENT evt = Wait() )
189  {
190  if( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
191  {
192  selectedPads.clear();
193  VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
194 
195  // Be sure the old cursor mouse position was initialized:
196  if( isFirstPoint )
197  {
198  oldCursorPos = cursorPos;
199  isFirstPoint = false;
200  }
201 
202  // wxWidgets deliver mouse move events not frequently enough, resulting in skipping
203  // pads if the user moves cursor too fast. To solve it, create a line that approximates
204  // the mouse move and search pads that are on the line.
205  int distance = ( cursorPos - oldCursorPos ).EuclideanNorm();
206  // Search will be made every 0.1 mm:
207  int segments = distance / int( 0.1*IU_PER_MM ) + 1;
208  const wxPoint line_step( ( cursorPos - oldCursorPos ) / segments );
209 
210  collector.Empty();
211 
212  for( int j = 0; j < segments; ++j )
213  {
214  wxPoint testpoint( cursorPos.x - j * line_step.x,
215  cursorPos.y - j * line_step.y );
216  collector.Collect( board(), types, testpoint, guide );
217 
218  for( int i = 0; i < collector.GetCount(); ++i )
219  {
220  selectedPads.push_back( static_cast<D_PAD*>( collector[i] ) );
221  }
222  }
223 
224  selectedPads.unique();
225 
226  for( D_PAD* pad : selectedPads )
227  {
228  // If pad was not selected, then enumerate it
229  if( !pad->IsSelected() )
230  {
231  commit.Modify( pad );
232 
233  // Rename pad and store the old name
234  int newval;
235 
236  if( storedPadNumbers.size() > 0 )
237  {
238  newval = storedPadNumbers.front();
239  storedPadNumbers.pop_front();
240  }
241  else
242  newval = seqPadNum++;
243 
244  wxString newName = wxString::Format( wxT( "%s%d" ), padPrefix.c_str(), newval );
245  oldNames[newName] = { newval, pad->GetName() };
246  pad->SetName( newName );
247  pad->SetSelected();
248  getView()->Update( pad );
249 
250  // Ensure the popup text shows the correct next value
251  if( storedPadNumbers.size() > 0 )
252  newval = storedPadNumbers.front();
253  else
254  newval = seqPadNum;
255 
256  statusPopup.SetText( wxString::Format(
257  _( "Click on pad %s%d\nPress Escape to cancel or double-click to commit" ),
258  padPrefix.c_str(), newval ) );
259  }
260 
261  // ..or restore the old name if it was enumerated and clicked again
262  else if( pad->IsSelected() && evt->IsClick( BUT_LEFT ) )
263  {
264  auto it = oldNames.find( pad->GetName() );
265  wxASSERT( it != oldNames.end() );
266 
267  if( it != oldNames.end() )
268  {
269  storedPadNumbers.push_back( it->second.first );
270  pad->SetName( it->second.second );
271  oldNames.erase( it );
272 
273  statusPopup.SetText( wxString::Format(
274  _( "Click on pad %s%d\nPress Escape to cancel or double-click to commit" ),
275  padPrefix.c_str(), storedPadNumbers.front() ) );
276  }
277 
278  pad->ClearSelected();
279  getView()->Update( pad );
280  }
281  }
282  }
283 
284  else if( ( evt->IsKeyPressed() && evt->KeyCode() == WXK_RETURN ) ||
285  evt->IsDblClick( BUT_LEFT ) )
286  {
287  commit.Push( _( "Renumber pads" ) );
288  break;
289  }
290 
291  // This is a cancel-current-action (ie: <esc>).
292  // Note that this must go before IsCancelInteractive() as it also checks IsCancel().
293  else if( evt->IsCancel() )
294  {
295  // Clear current selection list to avoid selection of deleted items
297 
298  commit.Revert();
299  break;
300  }
301 
302  // Now that cancel-current-action has been handled, check for cancel-tool.
303  else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
304  {
305  commit.Push( _( "Renumber pads" ) );
306  break;
307  }
308 
309  else if( evt->IsClick( BUT_RIGHT ) )
310  {
312  }
313 
314  // Prepare the next loop by updating the old cursor mouse position
315  // to this last mouse cursor position
316  oldCursorPos = getViewControls()->GetCursorPosition();
317  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
318  }
319 
320  for( auto p : board()->m_Modules->Pads() )
321  {
322  p->ClearSelected();
323  view->Update( p );
324  }
325 
326  statusPopup.Hide();
328  frame()->GetGalCanvas()->SetCursor( wxCURSOR_ARROW );
329 
330  return 0;
331 }
332 
333 
335 {
336  SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
337  BOARD_COMMIT commit( frame() );
338 
339  if( selection.Size() != 1 )
340  return 0;
341 
342  if( selection[0]->Type() != PCB_PAD_T )
343  return 0;
344 
345  auto pad = static_cast<D_PAD*>( selection[0] );
346 
347  if( pad->GetShape() != PAD_SHAPE_CUSTOM )
348  return 0;
349 
350  commit.Modify( pad );
351 
352  wxPoint anchor = pad->GetPosition();
353 
354  for( auto prim : pad->GetPrimitives() )
355  {
356  auto ds = new EDGE_MODULE( board()->m_Modules );
357 
358  prim.ExportTo( ds ); // ExportTo exports to a DRAWSEGMENT
359  // Fix an arbitray draw layer for this EDGE_MODULE
360  ds->SetLayer( Dwgs_User ); //pad->GetLayer() );
361  ds->Move( anchor );
362 
363  commit.Add( ds );
364  }
365 
366  pad->SetShape( pad->GetAnchorPadShape() );
367  // Cleanup the pad primitives data, because the initial pad was a custom
368  // shaped pad, and it contains primitives, that does not exist in non custom pads,
369  // and can create issues later:
370  if( pad->GetShape() != PAD_SHAPE_CUSTOM ) // should be always the case
371  {
372  pad->DeletePrimitivesList();
373  }
374 
375  commit.Push( _("Explode pad to shapes") );
376 
378 
379  return 0;
380 }
381 
382 
384 {
385  SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
386 
387  std::unique_ptr<D_PAD> pad ( new D_PAD ( board()->m_Modules ) );
388  D_PAD *refPad = nullptr;
389  bool multipleRefPadsFound = false;
390  bool illegalItemsFound = false;
391 
392  std::vector<PAD_CS_PRIMITIVE> shapes;
393 
394  BOARD_COMMIT commit( frame() );
395 
396  for( auto item : selection )
397  {
398  switch( item->Type() )
399  {
400  case PCB_PAD_T:
401  {
402  if( refPad )
403  multipleRefPadsFound = true;
404 
405  refPad = static_cast<D_PAD*>( item );
406  break;
407  }
408 
409  case PCB_MODULE_EDGE_T:
410  {
411  auto em = static_cast<EDGE_MODULE*> ( item );
412 
413  // Currently, S_CURVE shape is not supported. so warn the user
414  if( em->GetShape() == S_CURVE )
415  {
416  illegalItemsFound = true;
417  break;
418  }
419 
420  PAD_CS_PRIMITIVE shape( em->GetShape() );
421  shape.m_Start = em->GetStart();
422  shape.m_End = em->GetEnd();
423  shape.m_Radius = em->GetRadius();
424  shape.m_Thickness = em->GetWidth();
425  shape.m_ArcAngle = em->GetAngle();
426  shape.m_Poly = em->BuildPolyPointsList();
427 
428  shapes.push_back(shape);
429 
430  break;
431  }
432 
433  default:
434  {
435  illegalItemsFound = true;
436  break;
437  }
438  }
439  }
440 
441  if( refPad && selection.Size() == 1 )
442  {
443  // don't convert a pad into itself...
444  return 0;
445  }
446 
447  if( multipleRefPadsFound )
448  {
450  _( "Cannot convert items to a custom-shaped pad:\n"
451  "selection contains more than one reference pad." ) );
452  return 0;
453  }
454 
455  if( illegalItemsFound )
456  {
458  _( "Cannot convert items to a custom-shaped pad:\n"
459  "selection contains unsupported items.\n"
460  "Only graphical lines, circles, arcs and polygons are allowed." ) );
461  return 0;
462  }
463 
464  if( refPad )
465  {
466  pad.reset( static_cast<D_PAD*>( refPad->Clone() ) );
467 
468  if( refPad->GetShape() == PAD_SHAPE_RECT )
469  pad->SetAnchorPadShape( PAD_SHAPE_RECT );
470 
471  // ignore the pad orientation and offset for the moment. Makes more trouble than it's worth.
472  pad->SetOrientation( 0 );
473  pad->SetOffset( wxPoint( 0, 0 ) );
474  }
475  else
476  {
477  // Create a default pad anchor:
478  pad->SetAnchorPadShape( PAD_SHAPE_CIRCLE );
479  pad->SetAttribute( PAD_ATTRIB_SMD );
480  pad->SetLayerSet( D_PAD::SMDMask() );
481  int radius = Millimeter2iu( 0.2 );
482  pad->SetSize ( wxSize( radius, radius ) );
483  pad->IncrementPadName( true, true );
484  pad->SetOrientation( 0 );
485  }
486 
487  pad->SetShape ( PAD_SHAPE_CUSTOM );
488 
489  OPT<VECTOR2I> anchor;
490  VECTOR2I tmp;
491 
492  if( refPad )
493  {
494  anchor = VECTOR2I( pad->GetPosition() );
495  }
496  else if( pad->GetBestAnchorPosition( tmp ) )
497  {
498  anchor = tmp;
499  }
500 
501  if( !anchor )
502  {
504  _( "Cannot convert items to a custom-shaped pad:\n"
505  "unable to determine the anchor point position.\n"
506  "Consider adding a small anchor pad to the selection and try again.") );
507  return 0;
508  }
509 
510 
511  // relocate the shapes, they are relative to the anchor pad position
512  for( auto& shape : shapes )
513  {
514  shape.Move( wxPoint( -anchor->x, -anchor->y ) );
515  }
516 
517 
518  pad->SetPosition( wxPoint( anchor->x, anchor->y ) );
519  pad->AddPrimitives( shapes );
520  pad->ClearFlags();
521 
522  bool result = pad->MergePrimitivesAsPolygon();
523 
524  if( !result )
525  {
527  _( "Cannot convert items to a custom-shaped pad:\n"
528  "selected items do not form a single solid shape.") );
529  return 0;
530  }
531 
532  auto padPtr = pad.release();
533 
534  commit.Add( padPtr );
535  for ( auto item : selection )
536  {
537  commit.Remove( item );
538  }
539 
541  commit.Push(_("Create Pad from Selected Shapes") );
542  m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, padPtr );
543 
544  return 0;
545 }
546 
548 {
553 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:112
void Empty()
Function Empty sets the list to empty.
Definition: collector.h:123
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
bool IncrementPadName(bool aSkipUnconnectable, bool aFillSequenceGaps)
Function IncrementPadName.
Definition: class_pad.cpp:577
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:252
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_pad.cpp:1302
COMMIT & Modify(EDA_ITEM *aItem)
Modifies a given item in the model.
Definition: commit.h:103
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Set the tool command ID to aId and sets the cursor to aCursor.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:257
TOOL_MENU m_menu
Menu model displayed by the tool.
Definition: pcb_tool.h:148
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:91
This file is part of the common library.
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition: class_pad.cpp:108
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
VIEW_CONTROLS class definition.
void Collect(BOARD_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
Definition: collectors.cpp:482
void SetIgnoreModulesVals(bool ignore)
Definition: collectors.h:595
Class SELECTION_TOOL.
Class BOARD to handle a board.
Class STATUS_TEXT_POPUP.
Definition: status_popup.h:79
virtual void Revert() override
Revertes the commit by restoring the modifed items state.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:935
const SELECTION & selection() const
Definition: pcb_tool.cpp:251
wxPoint m_Start
angle of an arc, from its starting point, in 0.1 deg
Definition: class_pad.h:100
KIGFX::PCB_VIEW * view() const
Definition: pcb_tool.h:137
static TOOL_ACTION explodePadToShapes
Definition: pcb_actions.h:317
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static TOOL_ACTION enumeratePads
Tool for quick pad enumeration.
Definition: pcb_actions.h:320
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:62
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
void SetIgnoreModulesRefs(bool ignore)
Definition: collectors.h:601
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
Definition: pcb_actions.h:314
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
int CreatePadFromShapes(const TOOL_EVENT &aEvent)
Function CreatePadFromShapes()
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
Implementing DIALOG_ENUM_PADS_BASE.
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
void SetLocalCoord()
Set relative coordinates.
Definition: class_pad.cpp:405
Pcbnew hotkeys.
int ExplodePadToShapes(const TOOL_EVENT &aEvent)
Function ExplodePadToShapes()
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:114
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
Function GetCollectorsGuide.
int PlacePad(const TOOL_EVENT &aEvent)
Function PlacePad() Places a pad in module editor.
void SetIgnoreMTextsOnBack(bool ignore)
Definition: collectors.h:553
void SetIgnoreMTextsOnFront(bool ignore)
Definition: collectors.h:559
BOARD * board() const
Definition: pcb_tool.h:140
Class TOOL_EVENT.
Definition: tool_event.h:168
Helper class to handle a primitive (basic shape: polygon, segment, circle or arc) to build a custom p...
Definition: class_pad.h:91
wxString GetPrefix() const
Returns common prefix for all enumerated pads.
void setTransitions() override
Sets up handlers for various events.
virtual void Popup(wxWindow *aFocus=nullptr)
VIEW_GROUP extends VIEW_ITEM by possibility of grouping items into a single object.
COMMIT & Remove(EDA_ITEM *aItem)
Removes a new item from the model
Definition: commit.h:90
Bezier Curve.
virtual void Move(const wxPoint &aWhere)
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
All active tools
Definition: tool_event.h:144
void SetIgnoreMTextsMarkedNoShow(bool ignore)
Definition: collectors.h:547
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1539
Subclass of DIALOG_ENUM_PADS_BASE, which is generated by wxFormBuilder.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
static TOOL_ACTION createPadFromShapes
Definition: pcb_actions.h:316
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
int EnumeratePads(const TOOL_EVENT &aEvent)
Function EnumeratePads() Tool for quick pad enumeration.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:245
Class TOOL_ACTION.
Definition: tool_action.h:46
size_t i
Definition: json11.cpp:597
static TOOL_ACTION selectItem
Selects an item (specified as the event parameter).
Definition: pcb_actions.h:56
int Size() const
Returns the number of selected parts.
Definition: selection.h:122
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Executes the changes.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:139
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:80
boost::optional< T > OPT
Definition: optional.h:7
void Activate()
Function Activate() Runs the tool.
int GetStartNumber() const
Returns the starting number that is going to be used for the first enumerated pad.
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:216
Module description (excepted pads)
void doInteractiveItemPlacement(INTERACTIVE_PLACER_BASE *aPlacer, const wxString &aCommitMessage, int aOptions=IPO_ROTATE|IPO_FLIP|IPO_REPEAT)
Helper function for performing a common interactive idiom: wait for a left click, place an item there...
Definition: pcb_tool.cpp:39
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
Class VIEW.
Definition: view.h:61
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:391
EDGE_MODULE class definition.
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:62
void SetText(const wxString &aText)
Display a text.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:495