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  * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
6  * @author Maciej Suminski <maciej.suminski@cern.ch>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 #include "footprint_editor_tools.h"
27 #include "kicad_clipboard.h"
28 #include "selection_tool.h"
29 #include "pcb_actions.h"
30 #include <core/optional.h>
31 #include <tool/tool_manager.h>
32 #include <class_draw_panel_gal.h>
33 #include <view/view_controls.h>
34 #include <view/view_group.h>
35 #include <pcb_painter.h>
36 #include <origin_viewitem.h>
37 #include <status_popup.h>
38 #include <footprint_edit_frame.h>
39 #include <kicad_plugin.h>
40 #include <pcbnew_id.h>
41 #include <collectors.h>
42 #include <confirm.h>
43 #include <bitmaps.h>
44 #include <pcb_edit_frame.h>
45 #include <class_board.h>
46 #include <class_module.h>
47 #include <class_edge_mod.h>
48 #include <board_commit.h>
49 #include <project.h>
50 #include <tools/tool_event_utils.h>
51 #include <fp_lib_table.h>
52 #include <functional>
53 using namespace std::placeholders;
54 #include <wx/defs.h>
55 
56 
58  PCB_TOOL_BASE( "pcbnew.ModuleEditor" ),
59  m_frame( nullptr )
60 {
61 }
62 
63 
65 {
66 }
67 
68 
70 {
71  m_frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
72 }
73 
74 
76 {
77  // Build a context menu for the footprint tree
78  //
79  CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
80 
81  auto libSelectedCondition = [ this ] ( const SELECTION& aSel ) {
82  LIB_ID sel = m_frame->GetTreeFPID();
83  return !sel.GetLibNickname().empty() && sel.GetLibItemName().empty();
84  };
85  auto fpSelectedCondition = [ this ] ( const SELECTION& aSel ) {
86  LIB_ID sel = m_frame->GetTreeFPID();
87  return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
88  };
89 
92  ctxMenu.AddItem( ACTIONS::save, libSelectedCondition );
93  ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition );
94  ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition );
95 
96  ctxMenu.AddSeparator();
98 #ifdef KICAD_SCRIPTING
100 #endif
101  ctxMenu.AddItem( PCB_ACTIONS::editFootprint, fpSelectedCondition );
102 
103  ctxMenu.AddSeparator();
104  ctxMenu.AddItem( ACTIONS::save, fpSelectedCondition );
105  ctxMenu.AddItem( ACTIONS::saveCopyAs, fpSelectedCondition );
106  ctxMenu.AddItem( PCB_ACTIONS::deleteFootprint, fpSelectedCondition );
107  ctxMenu.AddItem( ACTIONS::revert, fpSelectedCondition );
108 
109  ctxMenu.AddSeparator();
110  ctxMenu.AddItem( PCB_ACTIONS::cutFootprint, fpSelectedCondition );
111  ctxMenu.AddItem( PCB_ACTIONS::copyFootprint, fpSelectedCondition );
113 
114  ctxMenu.AddSeparator();
116  ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpSelectedCondition );
117 
118  return true;
119 }
120 
121 
123 {
124  wxCommandEvent evt( wxEVT_NULL, ID_MODEDIT_NEW_MODULE );
125  getEditFrame<FOOTPRINT_EDIT_FRAME>()->Process_Special_Functions( evt );
126  return 0;
127 }
128 
129 
131 {
132  wxCommandEvent evt( wxEVT_NULL, ID_MODEDIT_NEW_MODULE_FROM_WIZARD );
133  getEditFrame<FOOTPRINT_EDIT_FRAME>()->Process_Special_Functions( evt );
134  return 0;
135 }
136 
137 
139 {
140  wxCommandEvent evt( wxEVT_NULL, ID_MODEDIT_SAVE );
141  getEditFrame<FOOTPRINT_EDIT_FRAME>()->Process_Special_Functions( evt );
142  return 0;
143 }
144 
145 
147 {
148  wxCommandEvent evt( wxEVT_NULL, ID_MODEDIT_SAVE_AS );
149  getEditFrame<FOOTPRINT_EDIT_FRAME>()->Process_Special_Functions( evt );
150  return 0;
151 }
152 
153 
155 {
156  getEditFrame<FOOTPRINT_EDIT_FRAME>()->RevertFootprint();
157  return 0;
158 }
159 
160 
162 {
163  LIB_ID fpID = m_frame->GetTreeFPID();
164 
165  if( fpID == m_frame->GetLoadedFPID() )
166  m_copiedModule.reset( new MODULE( *m_frame->GetBoard()->GetFirstModule() ) );
167  else
168  m_copiedModule.reset( m_frame->LoadFootprint( fpID ) );
169 
170  if( aEvent.IsAction( &PCB_ACTIONS::cutFootprint ) )
171  DeleteFootprint(aEvent );
172 
173  return 0;
174 }
175 
176 
178 {
180  {
181  wxString newLib = m_frame->GetTreeFPID().GetLibNickname();
182  MODULE* newModule( m_copiedModule.get() );
183  wxString newName = newModule->GetFPID().GetLibItemName();
184 
185  while( m_frame->Prj().PcbFootprintLibs()->FootprintExists( newLib, newName ) )
186  newName += _( "_copy" );
187 
188  newModule->SetFPID( LIB_ID( newLib, newName ) );
189  m_frame->SaveFootprintInLibrary( newModule, newLib );
190 
191  m_frame->SyncLibraryTree( true );
192  m_frame->FocusOnLibID( newModule->GetFPID() );
193  }
194 
195  return 0;
196 }
197 
198 
200 {
201  FOOTPRINT_EDIT_FRAME* frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
202 
203  if( frame->DeleteModuleFromLibrary( frame->GetTargetFPID(), true ) )
204  {
205  if( frame->GetTargetFPID() == frame->GetLoadedFPID() )
206  frame->Clear_Pcb( false );
207 
208  frame->SyncLibraryTree( true );
209  }
210 
211  return 0;
212 }
213 
214 
216 {
217  if( !m_frame->Clear_Pcb( true ) )
218  return -1; // this command is aborted
219 
222 
223  if( m_frame->GetBoard()->GetFirstModule() )
225 
226  // Clear undo and redo lists because we don't have handling to in
227  // FP editor to undo across imports (the module _is_ the board with the stack)
228  // todo: Abstract undo/redo stack to a higher element or keep consistent board item in fpeditor
230 
232  m_frame->OnModify();
233  return 0;
234 }
235 
236 
238 {
239  LIB_ID fpID = m_frame->GetTreeFPID();
240  MODULE* fp;
241 
242  if( !fpID.IsValid() )
243  fp = m_frame->GetBoard()->GetFirstModule();
244  else
245  fp = m_frame->LoadFootprint( fpID );
246 
247  m_frame->Export_Module( fp );
248  return 0;
249 }
250 
251 
253 {
255  return 0;
256 }
257 
258 
260 {
262  return 0;
263 }
264 
265 
267 {
268  MODULE* footprint = m_frame->GetBoard()->GetFirstModule();
269 
270  if( footprint )
271  {
272  getEditFrame<FOOTPRINT_EDIT_FRAME>()->OnEditItemRequest( footprint );
273  m_frame->GetCanvas()->Refresh();
274  }
275  return 0;
276 }
277 
278 
280 {
281  getEditFrame<FOOTPRINT_EDIT_FRAME>()->InstallPadOptionsFrame( nullptr );
282  return 0;
283 }
284 
285 
287 {
288  if( !m_frame->GetBoard()->GetFirstModule() )
289  return 0;
290 
291  struct PAD_PLACER : public INTERACTIVE_PLACER_BASE
292  {
293  std::unique_ptr<BOARD_ITEM> CreateItem() override
294  {
295  D_PAD* pad = new D_PAD( m_board->GetFirstModule() );
297  pad->IncrementPadName( true, true );
298  return std::unique_ptr<BOARD_ITEM>( pad );
299  }
300 
301  bool PlaceItem( BOARD_ITEM *aItem, BOARD_COMMIT& aCommit ) override
302  {
303  D_PAD* pad = dynamic_cast<D_PAD*>( aItem );
304 
305  if( pad )
306  {
308  pad->SetLocalCoord();
309  aCommit.Add( aItem );
310  return true;
311  }
312 
313  return false;
314  }
315  };
316 
317  PAD_PLACER placer;
318 
319  doInteractiveItemPlacement( aEvent.GetCommandStr().get(), &placer, _( "Place pad" ),
321 
322  return 0;
323 }
324 
325 
327 {
329  BOARD_COMMIT commit( m_frame );
330 
331  if( selection.Size() != 1 )
332  return 0;
333 
334  if( selection[0]->Type() != PCB_PAD_T )
335  return 0;
336 
337  auto pad = static_cast<D_PAD*>( selection[0] );
338 
339  if( pad->GetShape() != PAD_SHAPE_CUSTOM )
340  return 0;
341 
342  commit.Modify( pad );
343 
344  wxPoint anchor = pad->GetPosition();
345 
346  for( auto prim : pad->GetPrimitives() )
347  {
348  auto ds = new EDGE_MODULE( board()->GetFirstModule() );
349 
350  prim.ExportTo( ds ); // ExportTo exports to a DRAWSEGMENT
351  // Fix an arbitray draw layer for this EDGE_MODULE
352  ds->SetLayer( Dwgs_User ); //pad->GetLayer() );
353  ds->Move( anchor );
354  ds->Rotate( anchor, pad->GetOrientation() );
355 
356  commit.Add( ds );
357  }
358 
359  pad->SetShape( pad->GetAnchorPadShape() );
360  // Cleanup the pad primitives data, because the initial pad was a custom
361  // shaped pad, and it contains primitives, that does not exist in non custom pads,
362  // and can create issues later:
363  if( pad->GetShape() != PAD_SHAPE_CUSTOM ) // should be always the case
364  {
365  pad->DeletePrimitivesList();
366  }
367 
368  commit.Push( _("Explode pad to shapes") );
369 
371 
372  return 0;
373 }
374 
375 
377 {
379 
380  std::unique_ptr<D_PAD> pad( new D_PAD( board()->GetFirstModule() ) );
381  D_PAD *refPad = nullptr;
382  bool multipleRefPadsFound = false;
383  bool illegalItemsFound = false;
384 
385  std::vector<PAD_CS_PRIMITIVE> shapes;
386 
387  BOARD_COMMIT commit( m_frame );
388 
389  for( auto item : selection )
390  {
391  switch( item->Type() )
392  {
393  case PCB_PAD_T:
394  {
395  if( refPad )
396  multipleRefPadsFound = true;
397 
398  refPad = static_cast<D_PAD*>( item );
399  break;
400  }
401 
402  case PCB_MODULE_EDGE_T:
403  {
404  auto em = static_cast<EDGE_MODULE*> ( item );
405 
406  PAD_CS_PRIMITIVE shape( em->GetShape() );
407  shape.m_Start = em->GetStart();
408  shape.m_End = em->GetEnd();
409  shape.m_Radius = em->GetRadius();
410  shape.m_Thickness = em->GetWidth();
411  shape.m_ArcAngle = em->GetAngle();
412  shape.m_Ctrl1 = em->GetBezControl1();
413  shape.m_Ctrl2 = em->GetBezControl2();
414  shape.m_Poly = em->BuildPolyPointsList();
415 
416  shapes.push_back(shape);
417 
418  break;
419  }
420 
421  default:
422  {
423  illegalItemsFound = true;
424  break;
425  }
426  }
427  }
428 
429  if( refPad && selection.Size() == 1 )
430  {
431  // don't convert a pad into itself...
432  return 0;
433  }
434 
435  if( multipleRefPadsFound )
436  {
437  DisplayErrorMessage( m_frame, _( "Cannot convert items to a custom-shaped pad:\n"
438  "selection contains more than one reference pad." ) );
439  return 0;
440  }
441 
442  if( illegalItemsFound )
443  {
444  DisplayErrorMessage( m_frame, _( "Cannot convert items to a custom-shaped pad:\n"
445  "selection contains unsupported items.\n"
446  "Only graphical lines, circles, arcs and polygons "
447  "are allowed." ) );
448  return 0;
449  }
450 
451  double refOrientation = 0.0;
452 
453  if( refPad )
454  {
455  pad.reset( static_cast<D_PAD*>( refPad->Clone() ) );
456 
457  if( refPad->GetShape() == PAD_SHAPE_RECT )
458  pad->SetAnchorPadShape( PAD_SHAPE_RECT );
459 
460  // ignore the pad offset for the moment. Makes more trouble than it's worth.
461  pad->SetOffset( wxPoint( 0, 0 ) );
462  refOrientation = pad->GetOrientation();
463  pad->SetOrientation( 0.0 );
464  }
465  else
466  {
467  // Create a default pad anchor:
468  pad->SetAnchorPadShape( PAD_SHAPE_CIRCLE );
469  pad->SetAttribute( PAD_ATTRIB_SMD );
470  pad->SetLayerSet( D_PAD::SMDMask() );
471  int radius = Millimeter2iu( 0.2 );
472  pad->SetSize ( wxSize( radius, radius ) );
473  pad->IncrementPadName( true, true );
474  pad->SetOrientation( 0 );
475  }
476 
477  pad->SetShape ( PAD_SHAPE_CUSTOM );
478 
479  OPT<VECTOR2I> anchor;
480  VECTOR2I tmp;
481 
482  if( refPad )
483  {
484  anchor = VECTOR2I( pad->GetPosition() );
485  }
486  else if( pad->GetBestAnchorPosition( tmp ) )
487  {
488  anchor = tmp;
489  }
490 
491  if( !anchor )
492  {
493  DisplayErrorMessage( m_frame, _( "Cannot convert items to a custom-shaped pad:\n"
494  "unable to determine the anchor point position.\n"
495  "Consider adding a small anchor pad to the selection "
496  "and try again.") );
497  return 0;
498  }
499 
500 
501  // relocate the shapes, they are relative to the anchor pad position
502  for( auto& shape : shapes )
503  {
504  shape.Move( wxPoint( -anchor->x, -anchor->y ) );
505  shape.Rotate( wxPoint( 0, 0 ), -refOrientation );
506  }
507 
508  pad->SetPosition( wxPoint( anchor->x, anchor->y ) );
509  pad->AddPrimitives( shapes );
510  pad->ClearFlags();
511 
512  bool result = pad->MergePrimitivesAsPolygon();
513  pad->Rotate( wxPoint( anchor->x, anchor->y ), refOrientation );
514 
515  if( !result )
516  {
517  DisplayErrorMessage( m_frame, _( "Cannot convert items to a custom-shaped pad:\n"
518  "selected items do not form a single solid shape.") );
519  return 0;
520  }
521 
522  auto padPtr = pad.release();
523 
524  commit.Add( padPtr );
525  for ( auto item : selection )
526  {
527  commit.Remove( item );
528  }
529 
531  commit.Push(_("Create Pad from Selected Shapes") );
532  m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, padPtr );
533 
534  return 0;
535 }
536 
538 {
541  Go( &MODULE_EDITOR_TOOLS::Save, ACTIONS::save.MakeEvent() );
548 
553 
556 
560 
564 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
bool IncrementPadName(bool aSkipUnconnectable, bool aFillSequenceGaps)
Function IncrementPadName.
Definition: class_pad.cpp:585
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
static TOOL_ACTION saveToBoard
Definition: pcb_actions.h:344
int DefaultPadProperties(const TOOL_EVENT &aEvent)
Edit the properties used for new pad creation.
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_pad.cpp:1294
COMMIT & Modify(EDA_ITEM *aItem)
Modifies a given item in the model.
Definition: commit.h:103
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
static TOOL_ACTION footprintProperties
Definition: pcb_actions.h:355
int Properties(const TOOL_EVENT &aEvent)
int DeleteFootprint(const TOOL_EVENT &aEvent)
BOARD * board() const
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:249
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
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:109
COMMIT & Add(EDA_ITEM *aItem)
Adds a new item to the model
Definition: commit.h:78
int CutCopyFootprint(const TOOL_EVENT &aEvent)
int EditFootprint(const TOOL_EVENT &aEvent)
VIEW_CONTROLS class definition.
Class SELECTION_TOOL.
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
wxPoint m_Start
angle of an arc, from its starting point, in 0.1 deg
Definition: class_pad.h:98
static TOOL_ACTION explodePadToShapes
Definition: pcb_actions.h:362
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
FOOTPRINT_EDIT_FRAME * m_frame
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:62
void LoadModuleFromLibrary(LIB_ID aFPID)
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
Definition: pcb_actions.h:359
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
const LIB_ID & GetFPID() const
Definition: class_module.h:206
int CreatePadFromShapes(const TOOL_EVENT &aEvent)
Function CreatePadFromShapes()
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
bool IsValid() const
Definition: lib_id.h:171
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
void SetLocalCoord()
Set relative coordinates.
Definition: class_pad.cpp:406
static TOOL_ACTION createFootprint
Definition: pcb_actions.h:340
static TOOL_ACTION saveCopyAs
Definition: actions.h:56
static TOOL_ACTION cutFootprint
Definition: pcb_actions.h:349
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:63
static TOOL_ACTION copyFootprint
Definition: pcb_actions.h:350
int ImportFootprint(const TOOL_EVENT &aEvent)
PCB_BASE_EDIT_FRAME * frame() const
int ExplodePadToShapes(const TOOL_EVENT &aEvent)
Function ExplodePadToShapes()
int Revert(const TOOL_EVENT &aEvent)
void SyncLibraryTree(bool aProgress)
Synchronize the footprint library tree to the current state of the footprint library table.
int SaveAs(const TOOL_EVENT &aEvent)
bool Clear_Pcb(bool aQuery)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:98
static TOOL_ACTION toggleFootprintTree
Definition: pcb_actions.h:333
const PCBNEW_SELECTION & selection() const
int PlacePad(const TOOL_EVENT &aEvent)
Function PlacePad() Places a pad in module editor.
int Save(const TOOL_EVENT &aEvent)
VECTOR2< double > VECTOR2D
Definition: vector2d.h:586
void OnModify() override
Must be called after a footprint change in order to set the "modify" flag of the current screen and p...
static TOOL_ACTION exportFootprint
Definition: pcb_actions.h:353
void FocusOnLibID(const LIB_ID &aLibID)
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
static TOOL_ACTION editFootprint
Definition: pcb_actions.h:347
static TOOL_ACTION save
Definition: actions.h:54
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:89
virtual void ClearUndoRedoList()
Function ClearUndoRedoList clear undo and redo list, using ClearUndoORRedoList() picked items are del...
int NewFootprint(const TOOL_EVENT &aEvent)
int ExportFootprint(const TOOL_EVENT &aEvent)
MODULE * GetFirstModule() const
Gets the first module in the list (used in footprint viewer/editor) or NULL if none.
Definition: class_board.h:285
int PasteFootprint(const TOOL_EVENT &aEvent)
void setTransitions() override
Sets up handlers for various events.
static TOOL_ACTION addLibrary
Definition: actions.h:52
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
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
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Moves the graphic crosshair cursor to the requested position expressed in world coordinates.
#define _(s)
static TOOL_ACTION newLibrary
Definition: actions.h:51
static TOOL_ACTION importFootprint
Definition: pcb_actions.h:352
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void Export_Module(MODULE *aModule)
Create a file containing only one footprint.
void AddSeparator(int aOrder=ANY_ORDER)
Function AddSeparator()
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
bool SaveFootprintInLibrary(MODULE *aModule, const wxString &aLibraryName)
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:455
static TOOL_ACTION saveToLibrary
Definition: pcb_actions.h:345
static TOOL_ACTION createPadFromShapes
Definition: pcb_actions.h:361
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
static TOOL_ACTION defaultPadProperties
Definition: pcb_actions.h:356
MODULE * LoadFootprint(const LIB_ID &aFootprintId)
Function LoadFootprint attempts to load aFootprintId from the footprint library table.
static TOOL_ACTION saveAs
Definition: actions.h:55
LIB_ID GetLoadedFPID() const
Return the LIB_ID of the part being edited.
void ImportSettingsFrom(const D_PAD &aMasterPad)
Imports the pad settings from aMasterPad.
Definition: class_pad.cpp:1467
static TOOL_ACTION selectItem
Selects an item (specified as the event parameter).
Definition: pcb_actions.h:76
D_PAD m_Pad_Master
A dummy pad to store all default parameters.
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Executes the changes.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
int CreateFootprint(const TOOL_EVENT &aEvent)
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:79
boost::optional< T > OPT
Definition: optional.h:7
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:266
static TOOL_ACTION pasteFootprint
Definition: pcb_actions.h:351
std::unique_ptr< MODULE > m_copiedModule
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:221
Module description (excepted pads)
void doInteractiveItemPlacement(const std::string &aTool, 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...
BOARD * GetBoard() const
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
EDGE_MODULE class definition.
MODULE * Import_Module(const wxString &aName=wxT(""))
Read a file containing only one footprint.
int ToggleFootprintTree(const TOOL_EVENT &aEvent)
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
static TOOL_ACTION deleteFootprint
Definition: pcb_actions.h:348
bool FootprintExists(const wxString &aNickname, const wxString &aFootprintName)
Function FootprintExists.
LIB_ID GetTreeFPID() const
Return the LIB_ID of the part or library selected in the footprint tree.
static TOOL_ACTION revert
Definition: actions.h:58
static TOOL_ACTION newFootprint
Definition: pcb_actions.h:337
bool empty() const
Definition: utf8.h:108