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 <view/view_controls.h>
49 #include <widgets/lib_tree.h>
51 #include <dialog_pad_properties.h>
52 
53 #include "fp_tree_model_adapter.h"
54 
55 
56 static wxArrayString s_FootprintHistoryList;
57 static unsigned s_FootprintHistoryMaxCount = 8;
58 
59 static void AddFootprintToHistory( const wxString& aName )
60 {
61  // Remove duplicates
62  for( int ii = s_FootprintHistoryList.GetCount() - 1; ii >= 0; --ii )
63  {
64  if( s_FootprintHistoryList[ ii ] == aName )
65  s_FootprintHistoryList.RemoveAt((size_t) ii );
66  }
67 
68  // Add the new name at the beginning of the history list
69  s_FootprintHistoryList.Insert( aName, 0 );
70 
71  // Remove extra names
73  s_FootprintHistoryList.RemoveAt( s_FootprintHistoryList.GetCount() - 1 );
74 }
75 
76 
77 #include <bitmaps.h>
79 {
80  bool is_last_fp_from_brd = IsCurrentFPFromBoard();
81 
82  FOOTPRINT* newFootprint = nullptr;
84 
85  if( frame == nullptr ) // happens if no board editor opened
86  return false;
87 
88  if( aFootprint == nullptr )
89  {
90  if( !frame->GetBoard() || !frame->GetBoard()->GetFirstFootprint() )
91  return false;
92 
93  aFootprint = SelectFootprintFromBoard( frame->GetBoard() );
94  }
95 
96  if( aFootprint == nullptr )
97  return false;
98 
99  // Ensure we do not have the pad editor open (that is apseudo modal dlg).
100  // LoadFootprintFromBoard() can be called from the board editor, and we must ensure
101  // no footprint item is currently in edit
102  if( wxWindow::FindWindowByName( PAD_PROPERTIES_DLG_NAME ) )
103  wxWindow::FindWindowByName( PAD_PROPERTIES_DLG_NAME )->Close();
104 
105  if( !Clear_Pcb( true ) )
106  return false;
107 
108  m_boardFootprintUuids.clear();
109 
110  auto recordAndUpdateUuid =
111  [&]( BOARD_ITEM* aItem )
112  {
113  KIID newId;
114  m_boardFootprintUuids[ newId ] = aItem->m_Uuid;
115  const_cast<KIID&>( aItem->m_Uuid ) = newId;
116  };
117 
118  newFootprint = (FOOTPRINT*) aFootprint->Clone(); // Keep existing uuids
119  newFootprint->SetParent( GetBoard() );
120  newFootprint->SetLink( aFootprint->m_Uuid );
121 
122  newFootprint->ClearFlags();
123  recordAndUpdateUuid( newFootprint );
124  newFootprint->RunOnChildren(
125  [&]( BOARD_ITEM* aItem )
126  {
127  if( aItem->Type() == PCB_PAD_T )
128  aItem->SetLocked( false );
129 
130  aItem->ClearFlags();
131  recordAndUpdateUuid( aItem );
132  } );
133 
134  AddFootprintToBoard( newFootprint );
135 
136  // Clear references to any net info, because the footprint editor does know any thing about
137  // nets handled by the current edited board.
138  // Moreover we do not want to save any reference to an unknown net when saving the footprint
139  // in lib cache so we force the ORPHANED dummy net info for all pads.
140  newFootprint->ClearAllNets();
141 
142  GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
143  PlaceFootprint( newFootprint );
144  newFootprint->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not yet be initialized
145 
146  // Put it on FRONT layer,
147  // because this is the default in Footprint Editor, and in libs
148  if( newFootprint->GetLayer() != F_Cu )
149  newFootprint->Flip( newFootprint->GetPosition(), frame->Settings().m_FlipLeftRight );
150 
151  // Put it in orientation 0,
152  // because this is the default orientation in Footprint Editor, and in libs
153  newFootprint->SetOrientation( 0 );
154 
155  Zoom_Automatique( false );
156 
157  m_adapter->SetPreselectNode( newFootprint->GetFPID(), 0 );
158 
159  ClearUndoRedoList();
160  GetScreen()->SetContentModified( false );
161 
162  // Update the save items if needed.
163  if( !is_last_fp_from_brd )
164  {
165  ReCreateMenuBar();
166  ReCreateHToolbar();
167 
168  if( IsSearchTreeShown() )
169  ToggleSearchTree();
170  }
171 
172  Update3DView( true, true );
173  UpdateView();
174  GetCanvas()->Refresh();
175  m_treePane->GetLibTree()->RefreshLibTree(); // update any previously-highlighted items
176 
177  return true;
178 }
179 
180 
182 {
183  // Close the current non-modal Lib browser if opened, and open a new one, in "modal" mode:
184  FOOTPRINT_VIEWER_FRAME* viewer;
186 
187  if( viewer )
188  {
189  viewer->Destroy();
190  // Destroy() does not immediately delete the viewer, if some events are pending.
191  // (for this reason delete operator cannot be used blindly with "top level" windows)
192  // so gives a slice of time to delete the viewer frame.
193  // This is especially important in OpenGL mode to avoid recreating context before
194  // the old one is deleted.
195  wxSafeYield();
196  }
197 
198  SetFocus();
199 
200  // Creates the modal Lib browser:
202 
203  wxString fpid;
204  int ret = viewer->ShowModal( &fpid, this );
205  (void) ret; // make static analyser quiet
206 
207  viewer->Destroy();
208 
209  return fpid;
210 }
211 
212 
214 {
215  FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs();
216  wxString footprintName;
217  LIB_ID fpid;
218  FOOTPRINT* footprint = nullptr;
219 
220  static wxString lastComponentName;
221 
222  // Load footprint files:
223  WX_PROGRESS_REPORTER* progressReporter = new WX_PROGRESS_REPORTER( this,
224  _( "Loading Footprint Libraries" ), 3 );
225  GFootprintList.ReadFootprintFiles( fpTable, nullptr, progressReporter );
226  bool cancel = progressReporter->WasCancelled();
227 
228  // Force immediate deletion of the WX_PROGRESS_REPORTER. Do not use Destroy(), or use
229  // Destroy() followed by wxSafeYield() because on Windows, APP_PROGRESS_DIALOG and
230  // WX_PROGRESS_REPORTER have some side effects on the event loop manager. For instance, a
231  // subsequent call to ShowModal() or ShowQuasiModal() for a dialog following the use of a
232  // WX_PROGRESS_REPORTER results in incorrect modal or quasi modal behavior.
233  delete progressReporter;
234 
235  if( cancel )
236  return nullptr;
237 
240 
241  wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> ptr = FP_TREE_MODEL_ADAPTER::Create( this, fpTable );
242  FP_TREE_MODEL_ADAPTER* adapter = static_cast<FP_TREE_MODEL_ADAPTER*>( ptr.get() );
243 
244  std::vector<LIB_TREE_ITEM*> historyInfos;
245 
246  for( const wxString& item : s_FootprintHistoryList )
247  {
248  LIB_TREE_ITEM* fp_info = GFootprintList.GetFootprintInfo( item );
249 
250  // this can be null, for example, if the footprint has been deleted from a library.
251  if( fp_info != nullptr )
252  historyInfos.push_back( fp_info );
253  }
254 
255  adapter->DoAddLibrary( "-- " + _( "Recently Used" ) + " --", wxEmptyString, historyInfos, true );
256 
257  if( aPreselect.IsValid() )
258  adapter->SetPreselectNode( aPreselect, 0 );
259  else if( historyInfos.size() )
260  adapter->SetPreselectNode( historyInfos[0]->GetLibId(), 0 );
261 
262  adapter->AddLibraries();
263 
264  wxString title;
265  title.Printf( _( "Choose Footprint (%d items loaded)" ), adapter->GetItemCount() );
266 
267  DIALOG_CHOOSE_FOOTPRINT dialog( this, title, ptr );
268 
269  if( dialog.ShowQuasiModal() == wxID_CANCEL )
270  return nullptr;
271 
272  if( dialog.IsExternalBrowserSelected() )
273  {
274  // SelectFootprintFromLibBrowser() returns the "full" footprint name, i.e.
275  // <lib_name>/<footprint name> or LIB_ID format "lib_name:fp_name:rev#"
276  footprintName = SelectFootprintFromLibBrowser();
277 
278  if( footprintName.IsEmpty() ) // Cancel command
279  return nullptr;
280  else
281  fpid.Parse( footprintName );
282  }
283  else
284  {
285  fpid = dialog.GetSelectedLibId();
286 
287  if( !fpid.IsValid() )
288  return nullptr;
289  else
290  footprintName = fpid.Format();
291  }
292 
293  try
294  {
295  footprint = loadFootprint( fpid );
296  }
297  catch( const IO_ERROR& )
298  {
299  }
300 
301  if( footprint )
302  {
303  lastComponentName = footprintName;
304  AddFootprintToHistory( footprintName );
305  }
306 
307  return footprint;
308 }
309 
310 
312 {
313  FOOTPRINT* footprint = nullptr;
314 
315  try
316  {
317  footprint = loadFootprint( aFootprintId );
318  }
319  catch( const IO_ERROR& )
320  {
321  }
322 
323  return footprint;
324 }
325 
326 
328 {
329  FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
330 
331  wxCHECK_MSG( fptbl, nullptr, wxT( "Cannot look up LIB_ID in NULL FP_LIB_TABLE." ) );
332 
333  FOOTPRINT *footprint = nullptr;
334 
335  // When loading a footprint from a library in the footprint editor
336  // the items UUIDs must be keep and not reinitialized
337  bool keepUUID = IsType( FRAME_FOOTPRINT_EDITOR );
338 
339  try
340  {
341  footprint = fptbl->FootprintLoadWithOptionalNickname( aFootprintId, keepUUID );
342  }
343  catch( const IO_ERROR& )
344  {
345  }
346 
347  // If the footprint is found, clear all net info to be sure there are no broken links to
348  // any netinfo list (should be not needed, but it can be edited from the footprint editor )
349  if( footprint )
350  footprint->ClearAllNets();
351 
352  return footprint;
353 }
354 
355 
357 {
358  static wxString oldName; // Save name of last footprint selected.
359 
360  wxString fpname;
361  wxString msg;
362  wxArrayString listnames;
363 
364  for( FOOTPRINT* footprint : aPcb->Footprints() )
365  listnames.Add( footprint->GetReference() );
366 
367  msg.Printf( _( "Footprints [%u items]" ), (unsigned) listnames.GetCount() );
368 
369  wxArrayString headers;
370 
371  headers.Add( _( "Footprint" ) );
372 
373  std::vector<wxArrayString> itemsToDisplay;
374 
375  // Conversion from wxArrayString to vector of ArrayString
376  for( unsigned i = 0; i < listnames.GetCount(); i++ )
377  {
378  wxArrayString item;
379 
380  item.Add( listnames[i] );
381  itemsToDisplay.push_back( item );
382  }
383 
384  EDA_LIST_DIALOG dlg( this, msg, headers, itemsToDisplay, wxEmptyString );
385 
386  if( dlg.ShowModal() == wxID_OK )
387  fpname = dlg.GetTextSelection();
388  else
389  return nullptr;
390 
391  oldName = fpname;
392 
393  for( auto mod : aPcb->Footprints() )
394  {
395  if( fpname == mod->GetReference() )
396  return mod;
397  }
398 
399  return nullptr;
400 }
401 
402 
403 bool FOOTPRINT_EDIT_FRAME::SaveLibraryAs( const wxString& aLibraryPath )
404 {
405  const wxString& curLibPath = aLibraryPath;
406  wxString dstLibPath = CreateNewLibrary( wxEmptyString, aLibraryPath );
407 
408  if( !dstLibPath )
409  return false; // user aborted in CreateNewLibrary()
410 
411  wxBusyCursor dummy;
412  wxString msg;
413 
416 
417  try
418  {
419  PLUGIN::RELEASER cur( IO_MGR::PluginFind( curType ) );
420  PLUGIN::RELEASER dst( IO_MGR::PluginFind( dstType ) );
421 
422  wxArrayString footprints;
423 
424  cur->FootprintEnumerate( footprints, curLibPath, false );
425 
426  for( unsigned i = 0; i < footprints.size(); ++i )
427  {
428  const FOOTPRINT* footprint = cur->GetEnumeratedFootprint( curLibPath, footprints[i] );
429  dst->FootprintSave( dstLibPath, footprint );
430 
431  msg = wxString::Format( _( "Footprint '%s' saved." ), footprints[i] );
432  SetStatusText( msg );
433  }
434  }
435  catch( const IO_ERROR& ioe )
436  {
437  DisplayError( this, ioe.What() );
438  return false;
439  }
440 
441  msg = wxString::Format( _( "Footprint library '%s' saved as '%s'." ),
442  curLibPath,
443  dstLibPath );
444 
445  DisplayInfoMessage( this, msg );
446 
447  SetStatusText( wxEmptyString );
448  return true;
449 }
450 
451 
452 static FOOTPRINT* s_FootprintInitialCopy = nullptr; // Copy of footprint for abort/undo command
453 
454 static PICKED_ITEMS_LIST s_PickedList; // A pick-list to save initial footprint
455  // and dragged tracks
456 
457 
459 {
460  wxString footprintName;
461  wxArrayString fplist;
462 
463  // Build list of available fp references, to display them in dialog
464  for( auto fp : GetBoard()->Footprints() )
465  fplist.Add( fp->GetReference() + wxT(" ( ") + fp->GetValue() + wxT(" )") );
466 
467  fplist.Sort();
468 
469  DIALOG_GET_FOOTPRINT_BY_NAME dlg( this, fplist );
470 
471  if( dlg.ShowModal() != wxID_OK ) //Aborted by user
472  return nullptr;
473 
474  footprintName = dlg.GetValue();
475  footprintName.Trim( true );
476  footprintName.Trim( false );
477 
478  if( !footprintName.IsEmpty() )
479  {
480  for( auto mod : GetBoard()->Footprints() )
481  {
482  if( mod->GetReference().CmpNoCase( footprintName ) == 0 )
483  return mod;
484  }
485  }
486 
487  return nullptr;
488 }
489 
490 
491 void PCB_BASE_FRAME::PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsnest )
492 {
493  if( aFootprint == nullptr )
494  return;
495 
496  OnModify();
497 
498  if( aFootprint->IsNew() )
499  {
500  SaveCopyInUndoList( aFootprint, UNDO_REDO::NEWITEM );
501  }
502  else if( aFootprint->IsMoving() )
503  {
504  ITEM_PICKER picker( nullptr, aFootprint, UNDO_REDO::CHANGED );
506  s_PickedList.PushItem( picker );
507  s_FootprintInitialCopy = nullptr; // the picker is now owner of s_ModuleInitialCopy.
508  }
509 
510  if( s_PickedList.GetCount() )
511  {
512  SaveCopyInUndoList( s_PickedList, UNDO_REDO::UNSPECIFIED );
513 
514  // Clear list, but DO NOT delete items, because they are owned by the saved undo
515  // list and they therefore in use
517  }
518 
519  aFootprint->SetPosition((wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition() );
520  aFootprint->ClearFlags();
521 
522  delete s_FootprintInitialCopy;
523  s_FootprintInitialCopy = nullptr;
524 
525  if( aRecreateRatsnest )
526  m_pcb->GetConnectivity()->Update( aFootprint );
527 
528  if( aRecreateRatsnest )
529  Compile_Ratsnest( true );
530 
531  SetMsgPanel( aFootprint );
532 }
533 
534 
void DoAddLibrary(wxString const &aNodeName, wxString const &aDesc, std::vector< LIB_TREE_ITEM * > const &aItemList, bool presorted)
Add the given list of symbols 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:463
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:80
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:38
PROJECT & Prj()
Definition: kicad.cpp:403
void SetPreselectNode(LIB_ID const &aLibId, int aUnit)
Set the symbol name to be selected if there are no search results.
static PICKED_ITEMS_LIST s_PickedList
bool IsMoving() const
Definition: eda_item.h:120
FOOTPRINT_LIST_IMPL GFootprintList
The global footprint info table.
Definition: cvpcb.cpp:140
Component library viewer main window.
static wxArrayString s_FootprintHistoryList
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:382
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:252
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:159
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:116
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:119
FOOTPRINT * SelectFootprintFromBoard(BOARD *aPcb)
Display the list of footprints currently existing on the BOARD.
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:71
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
Definition: io_mgr.h:555
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 symbols 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 parallel reporting back of...
FOOTPRINT * loadFootprint(const LIB_ID &aFootprintId)
Attempts to load aFootprintId from the footprint library table.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:317
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
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:1571
FOOTPRINTS & Footprints()
Definition: board.h:233
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1381
LIB_ID GetSelectedLibId() const
To be called after this dialog returns from ShowModal().
Helper dialog and control classes.
#define _(s)
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:154
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:185
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.
void DisplayErrors(wxTopLevelWindow *aCaller=nullptr)
UTF8 Format() const
Definition: lib_id.cpp:116
static void AddFootprintToHistory(const wxString &aName)
BOARD * GetBoard()
const KIID m_Uuid
Definition: eda_item.h:475
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:283
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:527
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:49
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
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:177
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 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:1189
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:472
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1452
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:1183
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:53
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:171
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:113
KIWAY Kiway