KiCad PCB EDA Suite
pad_tool.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) 2017 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 
25 #include "pad_tool.h"
26 
27 #include <pcb_base_edit_frame.h>
28 #include <class_draw_panel_gal.h>
29 #include <view/view_controls.h>
30 #include <view/view.h>
31 #include <tool/tool_manager.h>
32 #include <bitmaps.h>
33 #include <class_board_item.h>
34 #include <class_module.h>
35 #include <board_commit.h>
37 #include <tools/pcb_actions.h>
38 #include <tools/pcbnew_selection.h>
39 #include <tools/selection_tool.h>
41 #include <tools/edit_tool.h>
43 #include "pcbnew_id.h"
44 
45 
47 {
48 public:
49 
50  using SHOW_FUNCTOR = std::function<bool()>;
51 
52  PAD_CONTEXT_MENU( bool aEditingFootprint, SHOW_FUNCTOR aHaveGlobalPadSetting ) :
53  ACTION_MENU( true ),
54  m_editingFootprint( aEditingFootprint ),
55  m_haveGlobalPadSettings( std::move( aHaveGlobalPadSetting ) )
56  {
57  SetIcon( pad_xpm );
58  SetTitle( _( "Pads" ) );
59 
63 
64  // show modedit-specific items
65  if( m_editingFootprint )
66  {
67  AppendSeparator();
69  }
70  }
71 
72 protected:
73 
74  ACTION_MENU* create() const override
75  {
77  }
78 
79 private:
80 
81  struct ENABLEMENTS
82  {
83  bool canImport;
84  bool canExport;
85  bool canPush;
86  };
87 
88  ENABLEMENTS getEnablements( const SELECTION& aSelection )
89  {
90  using S_C = SELECTION_CONDITIONS;
91  ENABLEMENTS enablements;
92 
93  auto anyPadSel = S_C::HasType( PCB_PAD_T );
94  auto singlePadSel = S_C::Count( 1 ) && S_C::OnlyType( PCB_PAD_T );
95 
96  // Apply pads enabled when any pads selected (it applies to each one
97  // individually), plus need a valid global pad setting
98  enablements.canImport = m_haveGlobalPadSettings() && ( anyPadSel )( aSelection );
99 
100  // Copy pads item enabled only when there is a single pad selected
101  // (otherwise how would we know which one to copy?)
102  enablements.canExport = ( singlePadSel )( aSelection );
103 
104  // Push pads available when there is a single pad to push from
105  enablements.canPush = ( singlePadSel )( aSelection );
106 
107  return enablements;
108  }
109 
110  void update() override
111  {
112  auto selTool = getToolManager()->GetTool<SELECTION_TOOL>();
113  const PCBNEW_SELECTION& selection = selTool->GetSelection();
114 
115  auto enablements = getEnablements( selection );
116 
117  Enable( getMenuId( PCB_ACTIONS::applyPadSettings ), enablements.canImport );
118  Enable( getMenuId( PCB_ACTIONS::copyPadSettings ), enablements.canExport );
119  Enable( getMenuId( PCB_ACTIONS::pushPadSettings ), enablements.canPush );
120  }
121 
124 };
125 
126 
128  PCB_TOOL_BASE( "pcbnew.PadTool" ),
129  m_padCopied( false )
130 {}
131 
132 
134 {}
135 
136 
138 {
139  m_padCopied = false;
140 }
141 
142 
144 {
145  auto& board = *getModel<BOARD>();
146  return board.Modules().size() > 0;
147 }
148 
149 
151 {
152  auto ctxMenu = std::make_shared<PAD_CONTEXT_MENU>( EditingModules(),
153  [this]() { return m_padCopied; } );
154  ctxMenu->SetTool( this );
155 
157 
158  if( selTool )
159  {
160  TOOL_MENU& toolMenu = selTool->GetToolMenu();
161  CONDITIONAL_MENU& menu = toolMenu.GetMenu();
162 
163  toolMenu.AddSubMenu( ctxMenu );
164 
165  auto canShowMenuCond = [this, ctxMenu] ( const SELECTION& aSel ) {
166  ctxMenu->UpdateAll();
167  return frame()->ToolStackIsEmpty() && haveFootprints() && ctxMenu->HasEnabledItems();
168  };
169 
170  // show menu when there is a footprint, and the menu has any items
171  auto showCond = canShowMenuCond &&
173 
174  menu.AddMenu( ctxMenu.get(), showCond, 1000 );
175 
176  // we need a separator only when the selection is empty
177  auto separatorCond = canShowMenuCond && SELECTION_CONDITIONS::Count( 0 );
178  menu.AddSeparator( 1000 );
179  }
180 
181  return true;
182 }
183 
184 
186 {
187  auto& selTool = *m_toolMgr->GetTool<SELECTION_TOOL>();
188  const auto& selection = selTool.GetSelection();
189  const D_PAD& masterPad = frame()->GetDesignSettings().m_Pad_Master;
190 
191  BOARD_COMMIT commit( frame() );
192 
193  // for every selected pad, paste global settings
194  for( auto item : selection )
195  {
196  if( item->Type() == PCB_PAD_T )
197  {
198  commit.Modify( item );
199  static_cast<D_PAD&>( *item ).ImportSettingsFrom( masterPad );
200  }
201  }
202 
203  commit.Push( _( "Paste Pad Properties" ) );
204 
206  frame()->Refresh();
207 
208  return 0;
209 }
210 
211 
213 {
214  auto& selTool = *m_toolMgr->GetTool<SELECTION_TOOL>();
215  const auto& selection = selTool.GetSelection();
216 
217  D_PAD& masterPad = frame()->GetDesignSettings().m_Pad_Master;
218 
219  // can only copy from a single pad
220  if( selection.Size() == 1 )
221  {
222  auto item = selection[0];
223 
224  if( item->Type() == PCB_PAD_T )
225  {
226  const auto& selPad = static_cast<const D_PAD&>( *item );
227  masterPad.ImportSettingsFrom( selPad );
228  m_padCopied = true;
229  }
230  }
231 
232  return 0;
233 }
234 
235 
236 static void doPushPadProperties( BOARD& board, const D_PAD& aSrcPad, BOARD_COMMIT& commit,
237  bool aSameFootprints,
238  bool aPadShapeFilter,
239  bool aPadOrientFilter,
240  bool aPadLayerFilter )
241 {
242  const MODULE* moduleRef = aSrcPad.GetParent();
243 
244  double pad_orient = aSrcPad.GetOrientation() - moduleRef->GetOrientation();
245 
246  for( auto module : board.Modules() )
247  {
248  if( !aSameFootprints && ( module != moduleRef ) )
249  continue;
250 
251  if( module->GetFPID() != moduleRef->GetFPID() )
252  continue;
253 
254  for( auto pad : module->Pads() )
255  {
256  if( aPadShapeFilter && ( pad->GetShape() != aSrcPad.GetShape() ) )
257  continue;
258 
259  double currpad_orient = pad->GetOrientation() - module->GetOrientation();
260 
261  if( aPadOrientFilter && ( currpad_orient != pad_orient ) )
262  continue;
263 
264  if( aPadLayerFilter && ( pad->GetLayerSet() != aSrcPad.GetLayerSet() ) )
265  continue;
266 
267  if( aPadLayerFilter && ( pad->GetLayerSet() != aSrcPad.GetLayerSet() ) )
268  continue;
269 
270  commit.Modify( pad );
271 
272  // Apply source pad settings to this pad
273  pad->ImportSettingsFrom( aSrcPad );
274  }
275  }
276 }
277 
278 
280 {
281  auto& selTool = *m_toolMgr->GetTool<SELECTION_TOOL>();
282  const auto& selection = selTool.GetSelection();
283  D_PAD* srcPad;
284 
285  if( selection.Size() == 1 && selection[0]->Type() == PCB_PAD_T )
286  srcPad = static_cast<D_PAD*>( selection[0] );
287  else
288  return 0;
289 
290  MODULE* module = srcPad->GetParent();
291 
292  if( !module )
293  return 0;
294 
295  frame()->SetMsgPanel( module );
296 
298  int dialogRet = dlg.ShowModal();
299 
300  if( dialogRet == wxID_CANCEL )
301  return 0;
302 
303  const bool edit_Same_Modules = (dialogRet == 1);
304 
305  BOARD_COMMIT commit( frame() );
306 
307  doPushPadProperties( *getModel<BOARD>(), *srcPad, commit, edit_Same_Modules,
311 
312  commit.Push( _( "Push Pad Settings" ) );
313 
315  frame()->Refresh();
316 
317  return 0;
318 }
319 
320 
322 {
323  if( !board()->GetFirstModule() || board()->GetFirstModule()->Pads().empty() )
324  return 0;
325 
326  DIALOG_ENUM_PADS settingsDlg( frame() );
327 
328  if( settingsDlg.ShowModal() != wxID_OK )
329  return 0;
330 
331  std::string tool = aEvent.GetCommandStr().get();
332  frame()->PushTool( tool );
333  Activate();
334 
335  GENERAL_COLLECTOR collector;
336  const KICAD_T types[] = { PCB_PAD_T, EOT };
337 
339  guide.SetIgnoreMTextsMarkedNoShow( true );
340  guide.SetIgnoreMTextsOnBack( true );
341  guide.SetIgnoreMTextsOnFront( true );
342  guide.SetIgnoreModulesVals( true );
343  guide.SetIgnoreModulesRefs( true );
344 
345  int seqPadNum = settingsDlg.GetStartNumber();
346  wxString padPrefix = settingsDlg.GetPrefix();
347  std::deque<int> storedPadNumbers;
348 
350  getViewControls()->ShowCursor( true );
351 
353  VECTOR2I oldCursorPos; // store the previous mouse cursor position, during mouse drag
354  std::list<D_PAD*> selectedPads;
355  BOARD_COMMIT commit( frame() );
356  std::map<wxString, std::pair<int, wxString>> oldNames;
357  bool isFirstPoint = true; // used to be sure oldCursorPos will be initialized at least once.
358 
359  STATUS_TEXT_POPUP statusPopup( frame() );
360  wxString msg = _( "Click on pad %s%d\nPress <esc> to cancel or double-click to commit" );
361  statusPopup.SetText( wxString::Format( msg, padPrefix, seqPadNum ) );
362  statusPopup.Popup();
363  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
364 
365  while( TOOL_EVENT* evt = Wait() )
366  {
367  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_BULLSEYE );
368 
369  if( evt->IsCancelInteractive() )
370  {
372  commit.Revert();
373 
374  frame()->PopTool( tool );
375  break;
376  }
377 
378  else if( evt->IsActivate() )
379  {
380  commit.Push( _( "Renumber pads" ) );
381 
382  frame()->PopTool( tool );
383  break;
384  }
385 
386  else if( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
387  {
388  selectedPads.clear();
389  VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
390 
391  // Be sure the old cursor mouse position was initialized:
392  if( isFirstPoint )
393  {
394  oldCursorPos = cursorPos;
395  isFirstPoint = false;
396  }
397 
398  // wxWidgets deliver mouse move events not frequently enough, resulting in skipping
399  // pads if the user moves cursor too fast. To solve it, create a line that approximates
400  // the mouse move and search pads that are on the line.
401  int distance = ( cursorPos - oldCursorPos ).EuclideanNorm();
402  // Search will be made every 0.1 mm:
403  int segments = distance / int( 0.1*IU_PER_MM ) + 1;
404  const wxPoint line_step( ( cursorPos - oldCursorPos ) / segments );
405 
406  collector.Empty();
407 
408  for( int j = 0; j < segments; ++j )
409  {
410  wxPoint testpoint( cursorPos.x - j * line_step.x,
411  cursorPos.y - j * line_step.y );
412  collector.Collect( board(), types, testpoint, guide );
413 
414  for( int i = 0; i < collector.GetCount(); ++i )
415  {
416  selectedPads.push_back( static_cast<D_PAD*>( collector[i] ) );
417  }
418  }
419 
420  selectedPads.unique();
421 
422  for( D_PAD* pad : selectedPads )
423  {
424  // If pad was not selected, then enumerate it
425  if( !pad->IsSelected() )
426  {
427  commit.Modify( pad );
428 
429  // Rename pad and store the old name
430  int newval;
431 
432  if( storedPadNumbers.size() > 0 )
433  {
434  newval = storedPadNumbers.front();
435  storedPadNumbers.pop_front();
436  }
437  else
438  newval = seqPadNum++;
439 
440  wxString newName = wxString::Format( wxT( "%s%d" ), padPrefix, newval );
441  oldNames[newName] = { newval, pad->GetName() };
442  pad->SetName( newName );
443  pad->SetSelected();
444  getView()->Update( pad );
445 
446  // Ensure the popup text shows the correct next value
447  if( storedPadNumbers.size() > 0 )
448  newval = storedPadNumbers.front();
449  else
450  newval = seqPadNum;
451 
452  statusPopup.SetText( wxString::Format( msg, padPrefix, newval ) );
453  }
454 
455  // ... or restore the old name if it was enumerated and clicked again
456  else if( pad->IsSelected() && evt->IsClick( BUT_LEFT ) )
457  {
458  auto it = oldNames.find( pad->GetName() );
459  wxASSERT( it != oldNames.end() );
460 
461  if( it != oldNames.end() )
462  {
463  storedPadNumbers.push_back( it->second.first );
464  pad->SetName( it->second.second );
465  oldNames.erase( it );
466 
467  int newval = storedPadNumbers.front();
468 
469  statusPopup.SetText( wxString::Format( msg, padPrefix, newval ) );
470  }
471 
472  pad->ClearSelected();
473  getView()->Update( pad );
474  }
475  }
476  }
477 
478  else if( ( evt->IsKeyPressed() && evt->KeyCode() == WXK_RETURN ) ||
479  evt->IsDblClick( BUT_LEFT ) )
480  {
481  commit.Push( _( "Renumber pads" ) );
482  frame()->PopTool( tool );
483  break;
484  }
485 
486  else if( evt->IsClick( BUT_RIGHT ) )
487  {
489  }
490 
491  else
492  evt->SetPassEvent();
493 
494  // Prepare the next loop by updating the old cursor mouse position
495  // to this last mouse cursor position
496  oldCursorPos = getViewControls()->GetCursorPosition();
497  statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
498  }
499 
500  for( auto p : board()->GetFirstModule()->Pads() )
501  {
502  p->ClearSelected();
503  view->Update( p );
504  }
505 
506  statusPopup.Hide();
507  return 0;
508 }
509 
510 
512 {
516 
518 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:123
void Empty()
Function Empty sets the list to empty.
Definition: collector.h:122
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
void update() override
Update menu state stub.
Definition: pad_tool.cpp:110
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddMenu()
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
wxMenuItem * Add(const wxString &aLabel, int aId, const BITMAP_OPAQUE *aIcon)
Function Add() Adds a wxWidgets-style entry to the menu.
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:241
double GetOrientation() const
Definition: class_module.h:193
COMMIT & Modify(EDA_ITEM *aItem)
Modifies a given item in the model.
Definition: commit.h:103
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
BOARD * board() const
static int getMenuId(const TOOL_ACTION &aAction)
Returns the corresponding wxMenuItem identifier for a TOOL_ACTION object.
Definition: action_menu.h:161
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
Class ACTION_MENU.
Definition: action_menu.h:43
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
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:474
Classes BOARD_ITEM and BOARD_CONNECTED_ITEM.
void SetIgnoreModulesVals(bool ignore)
Definition: collectors.h:589
Class SELECTION_TOOL.
Class STATUS_TEXT_POPUP.
Definition: status_popup.h:79
virtual void Revert() override
Revertes the commit by restoring the modifed items state.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
Class TOOL_MENU.
Definition: tool_menu.h:47
static TOOL_ACTION enumeratePads
Tool for quick pad enumeration.
Definition: pcb_actions.h:364
TOOL_MENU & GetToolMenu()
void SetIgnoreModulesRefs(bool ignore)
Definition: collectors.h:595
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
static SELECTION_CONDITION HasType(KICAD_T aType)
Function HasType Creates a functor that tests if among the selected items there is at least one of a ...
Class that groups generic conditions for selected items.
bool m_padCopied
Flag to indicate there are valid settings stored in the Master Pad object
Definition: pad_tool.h:72
ENABLEMENTS getEnablements(const SELECTION &aSelection)
Definition: pad_tool.cpp:88
Template specialization to enable wxStrings for certain containers (e.g. unordered_map)
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
const LIB_ID & GetFPID() const
Definition: class_module.h:197
static SELECTION_CONDITION Count(int aNumber)
Function Count Creates a functor that tests if the number of selected items is equal to the value giv...
void Reset(RESET_REASON aReason) override
React to model/view changes
Definition: pad_tool.cpp:137
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
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
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:200
PCB_BASE_EDIT_FRAME * frame() const
static TOOL_ACTION pushPadSettings
Copy the current pad's settings to other pads in the module or on the board.
Definition: pcb_actions.h:381
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:113
bool m_editingFootprint
Definition: pad_tool.cpp:122
PAD_CONTEXT_MENU(bool aEditingFootprint, SHOW_FUNCTOR aHaveGlobalPadSetting)
Definition: pad_tool.cpp:52
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
Function GetCollectorsGuide.
const PCBNEW_SELECTION & selection() const
int pushPadSettings(const TOOL_EVENT &aEvent)
Push pad settings from a pad to other pads on board or module
Definition: pad_tool.cpp:279
void SetIgnoreMTextsOnBack(bool ignore)
Definition: collectors.h:547
static TOOL_ACTION copyPadSettings
Copy the selected pad's settings to the board design settings.
Definition: pcb_actions.h:375
MODULES & Modules()
Definition: class_board.h:236
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagates an event to tools that requested events of matching type(s).
void SetIgnoreMTextsOnFront(bool ignore)
Definition: collectors.h:553
std::function< bool()> SHOW_FUNCTOR
Definition: pad_tool.cpp:50
void SetIcon(const BITMAP_OPAQUE *aIcon)
Function SetIcon() Assigns an icon for the entry.
Definition: action_menu.cpp:68
static void doPushPadProperties(BOARD &board, const D_PAD &aSrcPad, BOARD_COMMIT &commit, bool aSameFootprints, bool aPadShapeFilter, bool aPadOrientFilter, bool aPadLayerFilter)
Definition: pad_tool.cpp:236
Class TOOL_EVENT.
Definition: tool_event.h:168
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:426
wxString GetPrefix() const
Returns common prefix for all enumerated pads.
static TOOL_ACTION applyPadSettings
Copy the default pad settings to the selected pad.
Definition: pcb_actions.h:378
SHOW_FUNCTOR m_haveGlobalPadSettings
Definition: pad_tool.cpp:123
int pastePadProperties(const TOOL_EVENT &aEvent)
Apply pad settings from board design settings to a pad
Definition: pad_tool.cpp:185
KIGFX::PCB_VIEW * view() const
virtual void Popup(wxWindow *aFocus=nullptr)
virtual void Move(const wxPoint &aWhere)
void SetIgnoreMTextsMarkedNoShow(bool ignore)
Definition: collectors.h:541
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:1540
int EnumeratePads(const TOOL_EVENT &aEvent)
Function EnumeratePads() Tool for quick pad enumeration.
Definition: pad_tool.cpp:321
#define _(s)
Subclass of DIALOG_ENUM_PADS_BASE, which is generated by wxFormBuilder.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
bool EditingModules() const
void AddSeparator(int aOrder=ANY_ORDER)
Function AddSeparator()
MODULE * GetParent() const
Definition: class_pad.h:167
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:455
void SetTitle(const wxString &aTitle) override
Function SetTitle() Sets title for the menu.
Definition: action_menu.cpp:86
bool ToolStackIsEmpty()
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
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:161
MODULE * module() const
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:406
TOOL_MANAGER * getToolManager() const
Returns an instance of TOOL_MANAGER class.
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:240
void ImportSettingsFrom(const D_PAD &aMasterPad)
Imports the pad settings from aMasterPad.
Definition: class_pad.cpp:1467
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Function CreateSubMenu.
Definition: tool_menu.cpp:52
size_t i
Definition: json11.cpp:597
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
static bool empty(const wxTextEntryBase *aCtrl)
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Executes the changes.
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:79
bool haveFootprints()
Determine if there are any footprints on the board
Definition: pad_tool.cpp:143
virtual void PopTool(const std::string &actionName)
void Activate()
Function Activate() Runs the tool.
ACTION_MENU * create() const override
Returns an instance of this class. It has to be overridden in inheriting classes.
Definition: pad_tool.cpp:74
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:221
Module description (excepted pads)
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
Class VIEW.
Definition: view.h:61
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:385
bool Init() override
Basic initalization
Definition: pad_tool.cpp:150
void setTransitions() override
Bind handlers to corresponding TOOL_ACTIONs
Definition: pad_tool.cpp:511
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
void SetText(const wxString &aText)
Display a text.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
int copyPadSettings(const TOOL_EVENT &aEvent)
Copy pad settings from a pad to the board design settings
Definition: pad_tool.cpp:212