KiCad PCB EDA Suite
load_select_footprint.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) 2018 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
5  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
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 <functional>
27 using namespace std::placeholders;
28 
29 #include <board.h>
30 #include <footprint.h>
31 #include <confirm.h>
35 #include <dialog_helpers.h>
36 #include <footprint_edit_frame.h>
37 #include <footprint_info_impl.h>
38 #include <footprint_tree_pane.h>
39 #include <footprint_viewer_frame.h>
40 #include <fp_lib_table.h>
41 #include <io_mgr.h>
42 #include <kicad_string.h>
43 #include <kiway.h>
44 #include <lib_id.h>
45 #include <macros.h>
46 #include <pcb_edit_frame.h>
47 #include <pcbnew_settings.h>
48 #include <pgm_base.h>
49 #include <view/view_controls.h>
50 #include <widgets/lib_tree.h>
52 #include <dialog_pad_properties.h>
53 
54 #include "fp_tree_model_adapter.h"
55 
56 
57 static wxArrayString s_FootprintHistoryList;
58 static unsigned s_FootprintHistoryMaxCount = 8;
59 
60 static void AddFootprintToHistory( const wxString& aName )
61 {
62  // Remove duplicates
63  for( int ii = s_FootprintHistoryList.GetCount() - 1; ii >= 0; --ii )
64  {
65  if( s_FootprintHistoryList[ ii ] == aName )
66  s_FootprintHistoryList.RemoveAt((size_t) ii );
67  }
68 
69  // Add the new name at the beginning of the history list
70  s_FootprintHistoryList.Insert( aName, 0 );
71 
72  // Remove extra names
74  s_FootprintHistoryList.RemoveAt( s_FootprintHistoryList.GetCount() - 1 );
75 }
76 
77 
78 #include <bitmaps.h>
80 {
81  bool is_last_fp_from_brd = IsCurrentFPFromBoard();
82 
83  FOOTPRINT* newFootprint = nullptr;
85 
86  if( frame == nullptr ) // happens if no board editor opened
87  return false;
88 
89  if( aFootprint == nullptr )
90  {
91  if( !frame->GetBoard() || !frame->GetBoard()->GetFirstFootprint() )
92  return false;
93 
94  aFootprint = SelectFootprintFromBoard( frame->GetBoard() );
95  }
96 
97  if( aFootprint == nullptr )
98  return false;
99 
100  // Ensure we do not have the pad editor open (that is apseudo modal dlg).
101  // LoadFootprintFromBoard() can be called from the board editor, and we must ensure
102  // no footprint item is currently in edit
103  if( wxWindow::FindWindowByName( PAD_PROPERTIES_DLG_NAME ) )
104  wxWindow::FindWindowByName( PAD_PROPERTIES_DLG_NAME )->Close();
105 
106  if( !Clear_Pcb( true ) )
107  return false;
108 
109  m_boardFootprintUuids.clear();
110 
111  auto recordAndUpdateUuid =
112  [&]( BOARD_ITEM* aItem )
113  {
114  KIID newId;
115  m_boardFootprintUuids[ newId ] = aItem->m_Uuid;
116  const_cast<KIID&>( aItem->m_Uuid ) = newId;
117  };
118 
119  newFootprint = (FOOTPRINT*) aFootprint->Clone(); // Keep existing uuids
120  newFootprint->SetParent( GetBoard() );
121  newFootprint->SetLink( aFootprint->m_Uuid );
122 
123  newFootprint->ClearFlags();
124  recordAndUpdateUuid( newFootprint );
125  newFootprint->RunOnChildren(
126  [&]( BOARD_ITEM* aItem )
127  {
128  if( aItem->Type() == PCB_PAD_T )
129  aItem->SetLocked( false );
130 
131  aItem->ClearFlags();
132  recordAndUpdateUuid( aItem );
133  } );
134 
135  AddFootprintToBoard( newFootprint );
136 
137  // Clear references to any net info, because the footprint editor does know any thing about
138  // nets handled by the current edited board.
139  // Morever we do not want to save any reference to an unknown net when saving the footprint
140  // in lib cache so we force the ORPHANED dummy net info for all pads.
141  newFootprint->ClearAllNets();
142 
143  GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
144  PlaceFootprint( newFootprint );
145  newFootprint->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not yet be initialized
146 
147  // Put it on FRONT layer,
148  // because this is the default in Footprint Editor, and in libs
149  if( newFootprint->GetLayer() != F_Cu )
150  newFootprint->Flip( newFootprint->GetPosition(), frame->Settings().m_FlipLeftRight );
151 
152  // Put it in orientation 0,
153  // because this is the default orientation in Footprint Editor, and in libs
154  newFootprint->SetOrientation( 0 );
155 
156  Zoom_Automatique( false );
157 
158  m_adapter->SetPreselectNode( newFootprint->GetFPID(), 0 );
159 
160  ClearUndoRedoList();
161  GetScreen()->ClrModify();
162 
163  // Update the save items if needed.
164  if( !is_last_fp_from_brd )
165  {
166  ReCreateMenuBar();
167  ReCreateHToolbar();
168 
169  if( IsSearchTreeShown() )
170  ToggleSearchTree();
171  }
172 
173  Update3DView( true, true );
174  UpdateView();
175  GetCanvas()->Refresh();
176  m_treePane->GetLibTree()->RefreshLibTree(); // update any previously-highlighted items
177 
178  return true;
179 }
180 
181 
183 {
184  // Close the current non-modal Lib browser if opened, and open a new one, in "modal" mode:
185  FOOTPRINT_VIEWER_FRAME* viewer;
187 
188  if( viewer )
189  {
190  viewer->Destroy();
191  // Destroy() does not immediately delete the viewer, if some events are pending.
192  // (for this reason delete operator cannot be used blindly with "top level" windows)
193  // so gives a slice of time to delete the viewer frame.
194  // This is especially important in OpenGL mode to avoid recreating context before
195  // the old one is deleted.
196  wxSafeYield();
197  }
198 
199  SetFocus();
200 
201  // Creates the modal Lib browser:
203 
204  wxString fpid;
205  int ret = viewer->ShowModal( &fpid, this );
206  (void) ret; // make static analyser quiet
207 
208  viewer->Destroy();
209 
210  return fpid;
211 }
212 
213 
215 {
216  FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs();
217  wxString footprintName;
218  LIB_ID fpid;
219  FOOTPRINT* footprint = nullptr;
220 
221  static wxString lastComponentName;
222 
223  // Load footprint files:
224  WX_PROGRESS_REPORTER* progressReporter = new WX_PROGRESS_REPORTER( this,
225  _( "Loading Footprint Libraries" ), 3 );
226  GFootprintList.ReadFootprintFiles( fpTable, nullptr, progressReporter );
227  bool cancel = progressReporter->WasCancelled();
228 
229  // Force immediate deletion of the WX_PROGRESS_REPORTER. Do not use Destroy(), or use
230  // Destroy() followed by wxSafeYield() because on Windows, APP_PROGRESS_DIALOG and
231  // WX_PROGRESS_REPORTER have some side effects on the event loop manager. For instance, a
232  // subsequent call to ShowModal() or ShowQuasiModal() for a dialog following the use of a
233  // WX_PROGRESS_REPORTER results in incorrect modal or quasi modal behavior.
234  delete progressReporter;
235 
236  if( cancel )
237  return nullptr;
238 
241 
242  wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> ptr = FP_TREE_MODEL_ADAPTER::Create( this, fpTable );
243  FP_TREE_MODEL_ADAPTER* adapter = static_cast<FP_TREE_MODEL_ADAPTER*>( ptr.get() );
244 
245  std::vector<LIB_TREE_ITEM*> historyInfos;
246 
247  for( const wxString& item : s_FootprintHistoryList )
248  {
249  LIB_TREE_ITEM* fp_info = GFootprintList.GetFootprintInfo( item );
250 
251  // this can be null, for example, if the footprint has been deleted from a library.
252  if( fp_info != nullptr )
253  historyInfos.push_back( fp_info );
254  }
255 
256  adapter->DoAddLibrary( "-- " + _( "Recently Used" ) + " --", wxEmptyString, historyInfos, true );
257 
258  if( aPreselect.IsValid() )
259  adapter->SetPreselectNode( aPreselect, 0 );
260  else if( historyInfos.size() )
261  adapter->SetPreselectNode( historyInfos[0]->GetLibId(), 0 );
262 
263  adapter->AddLibraries();
264 
265  wxString title;
266  title.Printf( _( "Choose Footprint (%d items loaded)" ), adapter->GetItemCount() );
267 
268  DIALOG_CHOOSE_FOOTPRINT dialog( this, title, ptr );
269 
270  if( dialog.ShowQuasiModal() == wxID_CANCEL )
271  return nullptr;
272 
273  if( dialog.IsExternalBrowserSelected() )
274  {
275  // SelectFootprintFromLibBrowser() returns the "full" footprint name, i.e.
276  // <lib_name>/<footprint name> or LIB_ID format "lib_name:fp_name:rev#"
277  footprintName = SelectFootprintFromLibBrowser();
278 
279  if( footprintName.IsEmpty() ) // Cancel command
280  return nullptr;
281  else
282  fpid.Parse( footprintName );
283  }
284  else
285  {
286  fpid = dialog.GetSelectedLibId();
287 
288  if( !fpid.IsValid() )
289  return nullptr;
290  else
291  footprintName = fpid.Format();
292  }
293 
294  try
295  {
296  footprint = loadFootprint( fpid );
297  }
298  catch( const IO_ERROR& )
299  {
300  }
301 
302  if( footprint )
303  {
304  lastComponentName = footprintName;
305  AddFootprintToHistory( footprintName );
306  }
307 
308  return footprint;
309 }
310 
311 
313 {
314  FOOTPRINT* footprint = nullptr;
315 
316  try
317  {
318  footprint = loadFootprint( aFootprintId );
319  }
320  catch( const IO_ERROR& )
321  {
322  }
323 
324  return footprint;
325 }
326 
327 
329 {
330  FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
331 
332  wxCHECK_MSG( fptbl, nullptr, wxT( "Cannot look up LIB_ID in NULL FP_LIB_TABLE." ) );
333 
334  FOOTPRINT *footprint = nullptr;
335 
336  // When loading a footprint from a library in the footprint editor
337  // the items UUIDs must be keep and not reinitialized
338  bool keepUUID = IsType( FRAME_FOOTPRINT_EDITOR );
339 
340  try
341  {
342  footprint = fptbl->FootprintLoadWithOptionalNickname( aFootprintId, keepUUID );
343  }
344  catch( const IO_ERROR& )
345  {
346  }
347 
348  // If the footprint is found, clear all net info to be sure there are no broken links to
349  // any netinfo list (should be not needed, but it can be edited from the footprint editor )
350  if( footprint )
351  footprint->ClearAllNets();
352 
353  return footprint;
354 }
355 
356 
358 {
359  static wxString oldName; // Save name of last footprint selected.
360 
361  wxString fpname;
362  wxString msg;
363  wxArrayString listnames;
364 
365  for( FOOTPRINT* footprint : aPcb->Footprints() )
366  listnames.Add( footprint->GetReference() );
367 
368  msg.Printf( _( "Footprints [%u items]" ), (unsigned) listnames.GetCount() );
369 
370  wxArrayString headers;
371 
372  headers.Add( _( "Footprint" ) );
373 
374  std::vector<wxArrayString> itemsToDisplay;
375 
376  // Conversion from wxArrayString to vector of ArrayString
377  for( unsigned i = 0; i < listnames.GetCount(); i++ )
378  {
379  wxArrayString item;
380 
381  item.Add( listnames[i] );
382  itemsToDisplay.push_back( item );
383  }
384 
385  EDA_LIST_DIALOG dlg( this, msg, headers, itemsToDisplay, wxEmptyString );
386 
387  if( dlg.ShowModal() == wxID_OK )
388  fpname = dlg.GetTextSelection();
389  else
390  return nullptr;
391 
392  oldName = fpname;
393 
394  for( auto mod : aPcb->Footprints() )
395  {
396  if( fpname == mod->GetReference() )
397  return mod;
398  }
399 
400  return nullptr;
401 }
402 
403 
404 bool FOOTPRINT_EDIT_FRAME::SaveLibraryAs( const wxString& aLibraryPath )
405 {
406  const wxString& curLibPath = aLibraryPath;
407  wxString dstLibPath = CreateNewLibrary( wxEmptyString, aLibraryPath );
408 
409  if( !dstLibPath )
410  return false; // user aborted in CreateNewLibrary()
411 
412  wxBusyCursor dummy;
413  wxString msg;
414 
417 
418  try
419  {
420  PLUGIN::RELEASER cur( IO_MGR::PluginFind( curType ) );
421  PLUGIN::RELEASER dst( IO_MGR::PluginFind( dstType ) );
422 
423  wxArrayString footprints;
424 
425  cur->FootprintEnumerate( footprints, curLibPath, false );
426 
427  for( unsigned i = 0; i < footprints.size(); ++i )
428  {
429  const FOOTPRINT* footprint = cur->GetEnumeratedFootprint( curLibPath, footprints[i] );
430  dst->FootprintSave( dstLibPath, footprint );
431 
432  msg = wxString::Format( _( "Footprint \"%s\" saved" ), footprints[i] );
433  SetStatusText( msg );
434  }
435  }
436  catch( const IO_ERROR& ioe )
437  {
438  DisplayError( this, ioe.What() );
439  return false;
440  }
441 
442  msg = wxString::Format( _( "Footprint library \"%s\" saved as \"%s\"." ),
443  curLibPath,
444  dstLibPath );
445 
446  DisplayInfoMessage( this, msg );
447 
448  SetStatusText( wxEmptyString );
449  return true;
450 }
451 
452 
453 static FOOTPRINT* s_FootprintInitialCopy = nullptr; // Copy of footprint for abort/undo command
454 
455 static PICKED_ITEMS_LIST s_PickedList; // A pick-list to save initial footprint
456  // and dragged tracks
457 
458 
460 {
461  wxString footprintName;
462  wxArrayString fplist;
463 
464  // Build list of available fp references, to display them in dialog
465  for( auto fp : GetBoard()->Footprints() )
466  fplist.Add( fp->GetReference() + wxT(" ( ") + fp->GetValue() + wxT(" )") );
467 
468  fplist.Sort();
469 
470  DIALOG_GET_FOOTPRINT_BY_NAME dlg( this, fplist );
471 
472  if( dlg.ShowModal() != wxID_OK ) //Aborted by user
473  return nullptr;
474 
475  footprintName = dlg.GetValue();
476  footprintName.Trim( true );
477  footprintName.Trim( false );
478 
479  if( !footprintName.IsEmpty() )
480  {
481  for( auto mod : GetBoard()->Footprints() )
482  {
483  if( mod->GetReference().CmpNoCase( footprintName ) == 0 )
484  return mod;
485  }
486  }
487 
488  return nullptr;
489 }
490 
491 
492 void PCB_BASE_FRAME::PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsnest )
493 {
494  if( aFootprint == nullptr )
495  return;
496 
497  OnModify();
498 
499  if( aFootprint->IsNew() )
500  {
501  SaveCopyInUndoList( aFootprint, UNDO_REDO::NEWITEM );
502  }
503  else if( aFootprint->IsMoving() )
504  {
505  ITEM_PICKER picker( nullptr, aFootprint, UNDO_REDO::CHANGED );
507  s_PickedList.PushItem( picker );
508  s_FootprintInitialCopy = nullptr; // the picker is now owner of s_ModuleInitialCopy.
509  }
510 
511  if( s_PickedList.GetCount() )
512  {
513  SaveCopyInUndoList( s_PickedList, UNDO_REDO::UNSPECIFIED );
514 
515  // Clear list, but DO NOT delete items, because they are owned by the saved undo
516  // list and they therefore in use
518  }
519 
520  aFootprint->SetPosition((wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition() );
521  aFootprint->ClearFlags();
522 
523  delete s_FootprintInitialCopy;
524  s_FootprintInitialCopy = nullptr;
525 
526  if( aRecreateRatsnest )
527  m_pcb->GetConnectivity()->Update( aFootprint );
528 
529  if( aRecreateRatsnest )
530  Compile_Ratsnest( true );
531 
532  SetMsgPanel( aFootprint );
533 }
534 
535 
void DoAddLibrary(wxString const &aNodeName, wxString const &aDesc, std::vector< LIB_TREE_ITEM * > const &aItemList, bool presorted)
Add the given list of components by alias.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:252
wxString SelectFootprintFromLibBrowser()
Launch the footprint viewer to select the name of a footprint to load.
void ClearAllNets()
Clear (i.e.
Definition: footprint.cpp:459
bool ShowModal(wxString *aFootprint, wxWindow *aParent) override
Run the footprint viewer as a modal dialog.
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
bool IsExternalBrowserSelected() const
Function IsExternalBrowserSelected.
FOOTPRINT * SelectFootprintFromLibTree(LIB_ID aPreselect=LIB_ID())
Open a dialog to select a footprint.
This file is part of the common library.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
FOOTPRINT * FootprintLoadWithOptionalNickname(const LIB_ID &aFootprintId, bool aKeepUUID=false)
Load a footprint having aFootprintId with possibly an empty nickname.
A mix-in to provide polymorphism between items stored in libraries (symbols, aliases and footprints).
Definition: lib_tree_item.h:39
PROJECT & Prj()
Definition: kicad.cpp:403
void SetPreselectNode(LIB_ID const &aLibId, int aUnit)
Set the component name to be selected if there are no search results.
static PICKED_ITEMS_LIST s_PickedList
bool IsMoving() const
Definition: eda_item.h:170
FOOTPRINT_LIST_IMPL GFootprintList
The global footprint info table.
Definition: pcbnew.cpp:339
Component library viewer main window.
void DisplayErrors(wxTopLevelWindow *aCaller=NULL)
static wxArrayString s_FootprintHistoryList
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:368
A dialog which shows:
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
class PAD, a pad in a footprint
Definition: typeinfo.h:89
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
Definition: board_item.h:257
Dialog class to select a footprint from the libraries.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:168
void SetLink(EDA_ITEM *aItem)
unsigned GetCount() const
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Return a plugin type given a footprint library's libPath.
Definition: io_mgr.cpp:124
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:166
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true)
Places aFootprint at the current cursor position and updates footprint coordinates with the new posit...
This file contains miscellaneous commonly used macros and functions.
bool IsNew() const
Definition: eda_item.h:169
FOOTPRINT * SelectFootprintFromBoard(BOARD *aPcb)
Display the list of footprints currently existing on the BOARD.
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
Definition: io_mgr.h:550
DIALOG_GET_FOOTPRINT_BY_NAME is a helper dialog to select a footprint by its reference One can enter ...
Definition: kiid.h:44
int GetItemCount() const
Return the number of components loaded in the tree.
#define PAD_PROPERTIES_DLG_NAME
DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder.
Multi-thread safe progress reporter dialog, intended for use of tasks that paralleize reporting back ...
FOOTPRINT * loadFootprint(const LIB_ID &aFootprintId)
Attempts to load aFootprintId from the footprint library table.
FOOTPRINT * GetFirstFootprint() const
Gets the first footprint on the board or nullptr.
Definition: board.h:382
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
bool SaveLibraryAs(const wxString &aLibraryPath)
Save a library to a new name and/or library type.
int ShowQuasiModal()
void SetOrientation(double aNewAngle)
Definition: footprint.cpp:1557
FOOTPRINTS & Footprints()
Definition: board.h:305
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1367
LIB_ID GetSelectedLibId() const
To be called after this dialog returns from ShowModal().
Helper dialog and control classes.
FOOTPRINT * LoadFootprint(const LIB_ID &aFootprintId)
Attempt to load aFootprintId from the footprint library table.
FOOTPRINT_INFO * GetFootprintInfo(const wxString &aFootprintName)
Get info for a footprint by id.
const LIB_ID & GetFPID() const
Definition: footprint.h:190
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(EDA_BASE_FRAME *aParent, LIB_TABLE *aLibs)
Factory function: create a model adapter in a reference-counting container.
A holder to handle information on schematic or board items.
UTF8 Format() const
Definition: lib_id.cpp:233
static void AddFootprintToHistory(const wxString &aName)
BOARD * GetBoard()
const KIID m_Uuid
Definition: eda_item.h:525
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:285
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
void LoadFootprintFromBoard(wxCommandEvent &event)
Called from the main toolbar to load a footprint from board mainly to edit it.
void SetLink(const KIID &aLink)
Definition: footprint.h:532
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:122
see class PGM_BASE
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
#define _(s)
Definition: 3d_actions.cpp:33
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Return a PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: io_mgr.cpp:58
The main frame for Pcbnew.
PCBNEW_SETTINGS & Settings()
unsigned GetErrorCount() const
void ClearItemsList()
Delete only the list of pickers NOT the picked data itself.
wxPoint GetPosition() const override
Definition: footprint.h:182
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
bool ReadFootprintFiles(FP_LIB_TABLE *aTable, const wxString *aNickname=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr) override
Read all the footprints provided by the combination of aTable and aNickname.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:204
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all BOARD_ITEMs that belong to the footprint (pads, drawings,...
Definition: footprint.cpp:1175
static FOOTPRINT * s_FootprintInitialCopy
BOARD * GetBoard() const
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Removes an item from the container.
Definition: footprint.cpp:468
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1438
static unsigned s_FootprintHistoryMaxCount
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1169
PCB_FILE_T
The set of file types that the IO_MGR knows about, and for which there has been a plugin written.
Definition: io_mgr.h:52
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:280
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:173
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
FOOTPRINT * GetFootprintFromBoardByReference()
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163
KIWAY Kiway