KiCad PCB EDA Suite
loadcmp.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) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
5  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 1992-2017 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 
31 #include <functional>
32 using namespace std::placeholders;
33 
34 #include <fctsys.h>
35 #include <class_drawpanel.h>
36 #include <pcb_draw_panel_gal.h>
37 #include <confirm.h>
38 #include <eda_doc.h>
39 #include <kicad_string.h>
40 #include <pgm_base.h>
41 #include <kiway.h>
42 #include <wxPcbStruct.h>
43 #include <dialog_helpers.h>
44 #include <filter_reader.h>
45 #include <gr_basic.h>
46 #include <macros.h>
47 #include <fp_lib_table.h>
48 #include <lib_id.h>
49 
50 #include <class_board.h>
51 #include <class_module.h>
52 #include <io_mgr.h>
53 
54 #include <pcbnew.h>
55 #include <module_editor_frame.h>
56 #include <footprint_info.h>
57 #include <footprint_info_impl.h>
58 #include <dialog_get_component.h>
59 #include <modview_frame.h>
61 #include <class_pcb_layer_widget.h>
62 
63 
64 static void DisplayCmpDoc( wxString& aName, void* aData );
65 
66 // Use the _IMPL class directly here because this is static - don't want to yank
67 // a static through kiface.
69 
70 static void clearModuleItemFlags( BOARD_ITEM* aItem )
71 {
72  aItem->ClearFlags();
73 }
74 
76 {
77  MODULE* newModule;
78  PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
79 
80  if( frame == NULL ) // happens if no board editor opened
81  return false;
82 
83  if( aModule == NULL )
84  {
85  if( ! frame->GetBoard() || ! frame->GetBoard()->m_Modules )
86  return false;
87 
88  aModule = SelectFootprint( frame->GetBoard() );
89  }
90 
91  if( aModule == NULL )
92  return false;
93 
94  SetCurItem( NULL );
95 
96  Clear_Pcb( false );
97 
98  GetBoard()->m_Status_Pcb = 0;
99  newModule = new MODULE( *aModule );
100  newModule->SetParent( GetBoard() );
101  newModule->SetLink( aModule->GetTimeStamp() );
102 
103  aModule = newModule;
104 
105  newModule->ClearFlags();
106  newModule->RunOnChildren( std::bind( &clearModuleItemFlags, _1 ) );
107 
108  GetBoard()->Add( newModule );
109 
110  // Clear references to any net info, because the footprint editor
111  // does know any thing about nets handled by the current edited board.
112  // Morever we do not want to save any reference to an unknown net when
113  // saving the footprint in lib cache
114  // so we force the ORPHANED dummy net info for all pads
115  newModule->ClearAllNets();
116 
117  SetCrossHairPosition( wxPoint( 0, 0 ) );
118  PlaceModule( newModule, NULL );
119  newModule->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized at the moment
120 
121  // Put it on FRONT layer,
122  // because this is the default in ModEdit, and in libs
123  if( newModule->GetLayer() != F_Cu )
124  newModule->Flip( newModule->GetPosition() );
125 
126  // Put it in orientation 0,
127  // because this is the default orientation in ModEdit, and in libs
128  Rotate_Module( NULL, newModule, 0, false );
129  GetScreen()->ClrModify();
130  Zoom_Automatique( false );
131 
132  if( IsGalCanvasActive() )
133  updateView();
134 
135  return true;
136 }
137 
138 
140 {
141  // Close the current non-modal Lib browser if opened, and open a new one, in "modal" mode:
142  FOOTPRINT_VIEWER_FRAME* viewer;
144 
145  if( viewer )
146  viewer->Destroy();
147 
148  SetFocus();
149 
150  // Creates the modal Lib browser:
152 
153  wxString fpid;
154  int ret = viewer->ShowModal( &fpid, this );
155  (void) ret; // make static analyser quiet
156 
157  viewer->Destroy();
158 
159  return fpid;
160 }
161 
162 
164  FP_LIB_TABLE* aTable,
165  bool aUseFootprintViewer,
166  wxDC* aDC )
167 {
168  MODULE* module = NULL;
169  wxPoint curspos = GetCrossHairPosition();
170  wxString moduleName, keys;
171  wxString libName = aLibrary;
172  bool allowWildSeach = true;
173 
174  static wxArrayString HistoryList;
175  static wxString lastComponentName;
176 
177  // Ask for a component name or key words
178  DIALOG_GET_COMPONENT dlg( this, HistoryList, _( "Load Footprint" ), aUseFootprintViewer );
179 
180  dlg.SetComponentName( lastComponentName );
181 
182  if( dlg.ShowModal() == wxID_CANCEL )
183  return NULL;
184 
185  if( dlg.m_GetExtraFunction )
186  {
187  // SelectFootprintFromLibBrowser() returns the "full" footprint name, i.e.
188  // <lib_name>/<footprint name> or LIB_ID format "lib_name:fp_name:rev#"
189  moduleName = SelectFootprintFromLibBrowser();
190  }
191  else
192  {
193  moduleName = dlg.GetComponentName();
194  }
195 
196  if( moduleName.IsEmpty() ) // Cancel command
197  {
198  m_canvas->MoveCursorToCrossHair();
199  return NULL;
200  }
201 
202  if( dlg.IsKeyword() ) // Selection by keywords
203  {
204  allowWildSeach = false;
205  keys = moduleName;
206  moduleName = SelectFootprint( this, libName, wxEmptyString, keys, aTable );
207 
208  if( moduleName.IsEmpty() ) // Cancel command
209  {
210  m_canvas->MoveCursorToCrossHair();
211  return NULL;
212  }
213  }
214  else if( moduleName.Contains( wxT( "?" ) )
215  || moduleName.Contains( wxT( "*" ) ) ) // Selection wild card
216  {
217  allowWildSeach = false;
218  moduleName = SelectFootprint( this, libName, moduleName, wxEmptyString, aTable );
219 
220  if( moduleName.IsEmpty() )
221  {
222  m_canvas->MoveCursorToCrossHair();
223  return NULL; // Cancel command.
224  }
225  }
226 
227  LIB_ID fpid;
228 
229  wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL,
230  wxString::Format( wxT( "Could not parse LIB_ID string '%s'." ),
231  GetChars( moduleName ) ) );
232 
233  try
234  {
235  module = loadFootprint( fpid );
236  }
237  catch( const IO_ERROR& ioe )
238  {
239  wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
240  fpid.Format().c_str(), GetChars( ioe.What() ) );
241  }
242 
243  if( !module && allowWildSeach ) // Search with wild card
244  {
245  allowWildSeach = false;
246 
247  wxString wildname = wxChar( '*' ) + moduleName + wxChar( '*' );
248  moduleName = wildname;
249 
250  moduleName = SelectFootprint( this, libName, moduleName, wxEmptyString, aTable );
251 
252  if( moduleName.IsEmpty() )
253  {
254  m_canvas->MoveCursorToCrossHair();
255  return NULL; // Cancel command.
256  }
257  else
258  {
259  wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL,
260  wxString::Format( wxT( "Could not parse LIB_ID string '%s'." ),
261  GetChars( moduleName ) ) );
262 
263  try
264  {
265  module = loadFootprint( fpid );
266  }
267  catch( const IO_ERROR& ioe )
268  {
269  wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
270  fpid.Format().c_str(), GetChars( ioe.What() ) );
271  }
272  }
273  }
274 
275  SetCrossHairPosition( curspos );
276  m_canvas->MoveCursorToCrossHair();
277 
278  if( module )
279  {
280  GetBoard()->Add( module, ADD_APPEND );
281 
282  lastComponentName = moduleName;
283  AddHistoryComponentName( HistoryList, moduleName );
284 
285  module->SetFlags( IS_NEW );
286  module->SetLink( 0 );
287 
288  if( IsGalCanvasActive() )
289  module->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized at the moment
290  else
291  module->SetPosition( curspos );
292 
293  module->SetTimeStamp( GetNewTimeStamp() );
294  GetBoard()->m_Status_Pcb = 0;
295 
296  // Put it on FRONT layer,
297  // (Can be stored flipped if the lib is an archive built from a board)
298  if( module->IsFlipped() )
299  module->Flip( module->GetPosition() );
300 
301  // Place it in orientation 0,
302  // even if it is not saved with orientation 0 in lib
303  // (Can happen if the lib is an archive built from a board)
304  Rotate_Module( NULL, module, 0, false );
305 
306  //RecalculateAllTracksNetcode();
307 
308  if( aDC )
309  module->Draw( m_canvas, aDC, GR_OR );
310  }
311 
312  return module;
313 }
314 
315 
317 {
318  MODULE* module = NULL;
319 
320  try
321  {
322  module = loadFootprint( aFootprintId );
323  }
324  catch( const IO_ERROR& ioe )
325  {
326  wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
327  aFootprintId.Format().c_str(), GetChars( ioe.What() ) );
328  }
329 
330  return module;
331 }
332 
333 
335 {
336  FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
337 
338  wxCHECK_MSG( fptbl, NULL, wxT( "Cannot look up LIB_ID in NULL FP_LIB_TABLE." ) );
339 
340  MODULE *module = nullptr;
341  try
342  {
343  module = fptbl->FootprintLoadWithOptionalNickname( aFootprintId );
344  }
345  catch( const IO_ERROR& ioe )
346  {
347  wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
348  aFootprintId.Format().c_str(), GetChars( ioe.What() ) );
349  }
350 
351  // If the module is found, clear all net info,
352  // to be sure there is no broken links
353  // to any netinfo list (should be not needed, but it can be edited from
354  // the footprint editor )
355  if( module )
356  module->ClearAllNets();
357 
358  return module;
359 }
360 
361 
363  const wxString& aLibraryName,
364  const wxString& aMask,
365  const wxString& aKeyWord,
366  FP_LIB_TABLE* aTable )
367 {
368  static wxString oldName; // Save the name of the last module loaded.
369 
370  wxString fpname;
371  wxString msg;
372  wxArrayString libraries;
373 
374  std::vector< wxArrayString > rows;
375 
376  wxASSERT( aTable != NULL );
377 
378  MList.ReadFootprintFiles( aTable, !aLibraryName ? NULL : &aLibraryName );
379 
380  if( MList.GetErrorCount() )
381  {
382  MList.DisplayErrors( this );
383  return wxEmptyString;
384  }
385 
386  if( MList.GetCount() == 0 )
387  {
388  wxString tmp;
389 
390  for( unsigned i = 0; i < libraries.GetCount(); i++ )
391  {
392  tmp += libraries[i] + wxT( "\n" );
393  }
394 
395  msg.Printf( _( "No footprints could be read from library file(s):\n\n%s\nin any of "
396  "the library search paths. Verify your system is configured properly "
397  "so the footprint libraries can be found." ), GetChars( tmp ) );
398  DisplayError( aWindow, msg );
399  return wxEmptyString;
400  }
401 
402  if( !aKeyWord.IsEmpty() ) // Create a list of modules found by keyword.
403  {
404  for( unsigned ii = 0; ii < MList.GetCount(); ii++ )
405  {
406  if( KeyWordOk( aKeyWord, MList.GetItem( ii ).GetKeywords() ) )
407  {
408  wxArrayString cols;
409  cols.Add( MList.GetItem( ii ).GetFootprintName() );
410  cols.Add( MList.GetItem( ii ).GetNickname() );
411  rows.push_back( cols );
412  }
413  }
414  }
415  else if( !aMask.IsEmpty() ) // Create a list of modules found by pattern
416  {
417  for( unsigned ii = 0; ii < MList.GetCount(); ii++ )
418  {
419  const wxString& candidate = MList.GetItem( ii ).GetFootprintName();
420 
421  if( WildCompareString( aMask, candidate, false ) )
422  {
423  wxArrayString cols;
424  cols.Add( MList.GetItem( ii ).GetFootprintName() );
425  cols.Add( MList.GetItem( ii ).GetNickname() );
426  rows.push_back( cols );
427  }
428  }
429  }
430  else // Create the full list of modules
431  {
432  for( unsigned ii = 0; ii < MList.GetCount(); ii++ )
433  {
434  wxArrayString cols;
435  cols.Add( MList.GetItem( ii ).GetFootprintName() );
436  cols.Add( MList.GetItem( ii ).GetNickname() );
437  rows.push_back( cols );
438  }
439  }
440 
441  if( !rows.empty() )
442  {
443  wxArrayString headers;
444 
445  headers.Add( _( "Footprint" ) );
446  headers.Add( _( "Library" ) );
447 
448  msg.Printf( _( "Footprints [%d items]" ), (int) rows.size() );
449 
450  EDA_LIST_DIALOG dlg( aWindow, msg, headers, rows, oldName, DisplayCmpDoc );
451 
452  if( dlg.ShowModal() == wxID_OK )
453  {
454  fpname = dlg.GetTextSelection();
455 
456  fpname = dlg.GetTextSelection( 1 ) + wxT( ":" ) + fpname;
457 
458  SkipNextLeftButtonReleaseEvent();
459  }
460  else
461  fpname.Empty();
462  }
463  else
464  {
465  DisplayError( aWindow, _( "No footprint found." ) );
466  fpname.Empty();
467  }
468 
469  if( fpname != wxEmptyString )
470  oldName = fpname;
471 
472  wxLogDebug( wxT( "Footprint '%s' was selected." ), GetChars( fpname ) );
473 
474  return fpname;
475 }
476 
477 
478 static void DisplayCmpDoc( wxString& aName, void* aData )
479 {
480  FOOTPRINT_INFO* module_info = MList.GetModuleInfo( aName );
481 
482  if( !module_info )
483  {
484  aName.Empty();
485  return;
486  }
487 
488  aName = _( "Description: " ) + module_info->GetDoc();
489  aName += _( "\nKey words: " ) + module_info->GetKeywords();
490 }
491 
492 
494 {
495  static wxString oldName; // Save name of last module selected.
496 
497  wxString fpname;
498  wxString msg;
499  wxArrayString listnames;
500  MODULE* module = aPcb->m_Modules;
501 
502  for( ; module; module = module->Next() )
503  listnames.Add( module->GetReference() );
504 
505  msg.Printf( _( "Footprints [%u items]" ), (unsigned) listnames.GetCount() );
506 
507  wxArrayString headers;
508 
509  headers.Add( _( "Footprint" ) );
510 
511  std::vector<wxArrayString> itemsToDisplay;
512 
513  // Conversion from wxArrayString to vector of ArrayString
514  for( unsigned i = 0; i < listnames.GetCount(); i++ )
515  {
516  wxArrayString item;
517 
518  item.Add( listnames[i] );
519  itemsToDisplay.push_back( item );
520  }
521 
522  EDA_LIST_DIALOG dlg( this, msg, headers, itemsToDisplay, wxEmptyString, NULL, NULL, SORT_LIST );
523 
524  if( dlg.ShowModal() == wxID_OK )
525  fpname = dlg.GetTextSelection();
526  else
527  return NULL;
528 
529  oldName = fpname;
530 
531  module = aPcb->m_Modules;
532 
533  for( ; module; module = module->Next() )
534  {
535  if( fpname == module->GetReference() )
536  break;
537  }
538 
539  return module;
540 }
541 
542 
543 void FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs( wxCommandEvent& aEvent )
544 {
545  wxString curLibPath = getLibPath();
546  wxString dstLibPath = CreateNewLibrary();
547 
548  if( !dstLibPath )
549  return; // user aborted in CreateNewLibrary()
550 
551  wxBusyCursor dummy;
552  wxString msg;
553 
556 
557  try
558  {
559  PLUGIN::RELEASER cur( IO_MGR::PluginFind( curType ) );
560  PLUGIN::RELEASER dst( IO_MGR::PluginFind( dstType ) );
561 
562  wxArrayString mods;
563 
564  cur->FootprintEnumerate( mods, curLibPath );
565 
566  for( unsigned i = 0; i < mods.size(); ++i )
567  {
568  std::unique_ptr<MODULE> m( cur->FootprintLoad( curLibPath, mods[i] ) );
569  dst->FootprintSave( dstLibPath, m.get() );
570 
571  msg = wxString::Format( _( "Footprint '%s' saved" ),
572  GetChars( mods[i] ) );
573  SetStatusText( msg );
574 
575  // m is deleted here by unique_ptr.
576  }
577  }
578  catch( const IO_ERROR& ioe )
579  {
580  DisplayError( this, ioe.What() );
581  return;
582  }
583 
584  msg = wxString::Format(
585  _( "Footprint library '%s' saved as '%s'." ),
586  GetChars( curLibPath ), GetChars( dstLibPath ) );
587 
588  DisplayInfoMessage( this, msg );
589 
590  SetStatusText( wxEmptyString );
591 }
wxString SelectFootprintFromLibBrowser()
Function SelectFootprintFromLibBrowser launches the footprint viewer to select the name of a footprin...
Definition: loadcmp.cpp:139
Definition of class FOOTPRINT_EDIT_FRAME.
void RunOnChildren(std::function< void(BOARD_ITEM *)> aFunction)
Function RunOnChildren.
const wxString & GetFootprintName() const
wxString GetTextSelection(int aColumn=0)
Function GetTextSelection return the selected text from aColumn in the wxListCtrl in the dialog...
Definition: displlst.cpp:137
virtual void FootprintEnumerate(wxArrayString &aFootprintNames, const wxString &aLibraryPath, const PROPERTIES *aProperties=NULL)
Return a list of footprint names contained within the library at aLibraryPath.
Definition: plugin.cpp:61
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...
void AddHistoryComponentName(wxArrayString &aHistoryList, const wxString &aName)
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
This file is part of the common library.
PROJECT & Prj()
Definition: kicad.cpp:270
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw draws the footprint to the aDC.
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
Class BOARD to handle a board.
const wxPoint & GetPosition() const override
Definition: class_module.h:175
virtual void FootprintSave(const wxString &aLibraryPath, const MODULE *aFootprint, const PROPERTIES *aProperties=NULL)
Function FootprintSave will write aModule to an existing library located at aLibraryPath.
Definition: plugin.cpp:85
Component library viewer main window.
Definition: modview_frame.h:44
MODULE * Next() const
Definition: class_module.h:120
void DisplayErrors(wxTopLevelWindow *aCaller=NULL)
time_t GetNewTimeStamp()
Definition: common.cpp:166
static void DisplayCmpDoc(wxString &aName, void *aData)
Definition: loadcmp.cpp:478
MODULE * LoadModuleFromLibrary(const wxString &aLibrary, FP_LIB_TABLE *aTable, bool aUseFootprintViewer=true, wxDC *aDC=NULL)
Function LoadModuleFromLibrary opens a dialog to select a footprint, and loads it into current board...
Definition: loadcmp.cpp:163
BOARD * GetBoard() const
class EDA_LIST_DIALOG
void OnSaveLibraryAs(wxCommandEvent &aEvent)
Function OnSaveLibraryAs saves the current library to a new name and/or library type.
Definition: loadcmp.cpp:543
This file is part of the common libary.
int Parse(const UTF8 &aId)
Function Parse.
Definition: lib_id.cpp:122
MODULE * SelectFootprint(BOARD *aPcb)
Function SelectFootprint Display the list of modules currently existing on the BOARD.
Definition: loadcmp.cpp:493
Class LIB_ID.
Definition: lib_id.h:56
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:54
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Function GuessPluginTypeFromLibPath returns a plugin type given a footprint library's libPath...
Definition: io_mgr.cpp:132
static void clearModuleItemFlags(BOARD_ITEM *aItem)
Definition: loadcmp.cpp:70
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:217
This file contains miscellaneous commonly used macros and functions.
#define IS_NEW
New item, just created.
Definition: base_struct.h:127
Class RELEASER releases a PLUGIN in the context of a potential thrown exception, through its destruct...
Definition: io_mgr.h:546
int KeyWordOk(const wxString &KeyList, const wxString &Database)
Function KeyWordOk searches aKeyList for any words found in aDatabase.
Definition: eda_doc.cpp:211
unsigned GetCount() const
void ClearAllNets()
Function ClearAllNets Clear (i.e.
FOOTPRINT_INFO * GetModuleInfo(const wxString &aFootprintName)
Get info for a module by name.
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, KIWAY_PLAYER *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:302
static FOOTPRINT_LIST_IMPL MList
Definition: loadcmp.cpp:68
const wxString & GetDoc()
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
virtual MODULE * FootprintLoad(const wxString &aLibraryPath, const wxString &aFootprintName, const PROPERTIES *aProperties=NULL)
Function FootprintLoad loads a footprint having aFootprintName from the aLibraryPath containing a lib...
Definition: plugin.cpp:76
FOOTPRINT_INFO & GetItem(unsigned aIdx)
Get info for a module by index.
void SetComponentName(const wxString &name)
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:227
bool WildCompareString(const wxString &pattern, const wxString &string_to_tst, bool case_sensitive)
Function WildCompareString compares a string against wild card (* and ?) pattern using the usual rule...
Definition: string.cpp:305
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:247
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
bool IsKeyword(void)
Function IsKeyword.
The common library.
Helper dialog and control classes.
bool Load_Module_From_BOARD(MODULE *Module)
Function Load_Module_From_BOARD load in Modedit a footprint from the main board.
Definition: loadcmp.cpp:75
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:104
const wxString & GetKeywords()
void SetPosition(const wxPoint &aPos) override
time_t GetTimeStamp() const
Definition: base_struct.h:218
BOARD * GetBoard()
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: gr_basic.h:42
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
see class PGM_BASE
MODULE * LoadFootprint(const LIB_ID &aFootprintId)
Function LoadFootprint attempts to load aFootprintId from the footprint library table.
Definition: loadcmp.cpp:316
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
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
#define SORT_LIST
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:439
DLIST< MODULE > m_Modules
Definition: class_board.h:245
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Function PluginFind returns a PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: io_mgr.cpp:58
const char * c_str() const
Definition: utf8.h:107
void SetLink(time_t aLink)
Definition: class_module.h:548
wxString GetComponentName(void)
Function GetComponentName.
unsigned GetErrorCount() const
UTF8 Format() const
Function Format.
Definition: lib_id.cpp:263
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
MODULE * FootprintLoadWithOptionalNickname(const LIB_ID &aFootprintId)
Function FootprintLoadWithOptionalNickname loads a footprint having aFootprintId with possibly an emp...
const wxString & GetNickname() const
Module description (excepted pads)
PCB_FILE_T
Enum PCB_FILE_T is a set of file types that the IO_MGR knows about, and for which there has been a pl...
Definition: io_mgr.h:51
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:73
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
MODULE * loadFootprint(const LIB_ID &aFootprintId)
Function loadFootprint attempts to load aFootprintId from the footprint library table.
Definition: loadcmp.cpp:334
VTBL_ENTRY bool ShowModal(wxString *aResult=NULL, wxWindow *aResultantFocusWindow=NULL)
Function ShowModal puts up this wxFrame as if it were a modal dialog, with all other instantiated wxF...
virtual bool ReadFootprintFiles(FP_LIB_TABLE *aTable, const wxString *aNickname=NULL) override
Read all the footprints provided by the combination of aTable and aNickname.
wxString SelectFootprint(EDA_DRAW_FRAME *aWindow, const wxString &aLibraryName, const wxString &aMask, const wxString &aKeyWord, FP_LIB_TABLE *aTable)
Function SelectFootprint displays a list of modules found in all libraries or a given library...
Definition: loadcmp.cpp:362
KIWAY Kiway
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:237