KiCad PCB EDA Suite
panel_fp_lib_table.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 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
5  * Copyright (C) 2013-2021 CERN
6  * Copyright (C) 2012-2021 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 
27 /* TODO:
28 
29 *) After any change to uri, reparse the environment variables.
30 
31 */
32 
33 
34 #include <set>
35 #include <wx/regex.h>
36 #include <wx/grid.h>
37 
38 #include <project.h>
39 #include <3d_viewer/eda_3d_viewer.h> // for KICAD6_3DMODEL_DIR
40 #include <panel_fp_lib_table.h>
41 #include <lib_id.h>
42 #include <fp_lib_table.h>
43 #include <lib_table_lexer.h>
44 #include <invoke_pcb_dialog.h>
45 #include <bitmaps.h>
46 #include <grid_tricks.h>
47 #include <widgets/wx_grid.h>
48 #include <confirm.h>
49 #include <lib_table_grid.h>
51 #include <pgm_base.h>
52 #include <pcb_edit_frame.h>
53 #include <env_paths.h>
55 #include <footprint_viewer_frame.h>
56 #include <footprint_edit_frame.h>
57 #include <kiway.h>
60 #include <pcbnew_id.h> // For ID_PCBNEW_END_LIST
62 #include <paths.h>
63 
64 // clang-format off
65 
70 {
71  wxString m_Description;
72  wxString m_FileFilter;
73  wxString m_FolderSearchExtension;
74  bool m_IsFile;
76 };
77 
81 enum {
86 };
87 
93 static const std::map<int, SUPPORTED_FILE_TYPE>& fileTypes()
94 {
95  /*
96  * TODO(C++20): Clean this up
97  * This is wrapped inside a function to prevent a static initialization order fiasco
98  * with the file extension variables. Once C++20 is allowed in KiCad code, those file
99  * extensions can be made constexpr and this can be removed from a function call and
100  * placed in the file normally.
101  */
102  static const std::map<int, SUPPORTED_FILE_TYPE> fileTypes =
103  {
105  {
106  "KiCad (folder with .kicad_mod files)", "", KiCadFootprintFileExtension,
107  false, IO_MGR::KICAD_SEXP
108  }
109  },
111  {
112  "Eagle 6.x (*.lbr)", EagleFootprintLibPathWildcard(), "", true, IO_MGR::EAGLE
113  }
114  },
116  {
117  "KiCad legacy (*.mod)", LegacyFootprintLibPathWildcard(), "", true, IO_MGR::LEGACY
118  }
119  },
121  {
122  "Geda (folder with *.fp files)", "", GedaPcbFootprintLibFileExtension, false,
124  }
125  },
126  };
127 
128  return fileTypes;
129 }
130 // clang-format on
131 
132 
137 class LIBRARY_TRAVERSER : public wxDirTraverser
138 {
139 public:
140  LIBRARY_TRAVERSER( wxString aSearchExtension, wxString aInitialDir )
141  : m_searchExtension( aSearchExtension ),
142  m_currentDir( aInitialDir )
143  {
144  }
145 
146  virtual wxDirTraverseResult OnFile( const wxString& aFileName ) override
147  {
148  wxFileName file( aFileName );
149 
150  if( m_searchExtension.IsSameAs( file.GetExt(), false ) )
151  m_foundDirs.insert( { m_currentDir, 1 } );
152 
153  return wxDIR_CONTINUE;
154  }
155 
156  virtual wxDirTraverseResult OnOpenError( const wxString& aOpenErrorName ) override
157  {
158  m_failedDirs.insert( { aOpenErrorName, 1 } );
159  return wxDIR_IGNORE;
160  }
161 
163  {
164  return m_failedDirs.size() > 0;
165  }
166 
167  virtual wxDirTraverseResult OnDir( const wxString& aDirName ) override
168  {
169  m_currentDir = aDirName;
170  return wxDIR_CONTINUE;
171  }
172 
173  void GetPaths( wxArrayString& aPathArray )
174  {
175  for( std::pair<const wxString, int>& foundDirsPair : m_foundDirs )
176  aPathArray.Add( foundDirsPair.first );
177  }
178 
179  void GetFailedPaths( wxArrayString& aPathArray )
180  {
181  for( std::pair<const wxString, int>& failedDirsPair : m_failedDirs )
182  aPathArray.Add( failedDirsPair.first );
183  }
184 
185 private:
187  wxString m_currentDir;
188  std::unordered_map<wxString, int> m_foundDirs;
189  std::unordered_map<wxString, int> m_failedDirs;
190 };
191 
192 
197 {
198  friend class PANEL_FP_LIB_TABLE;
199  friend class FP_GRID_TRICKS;
200 
201 protected:
202  LIB_TABLE_ROW* at( size_t aIndex ) override { return &rows.at( aIndex ); }
203 
204  size_t size() const override { return rows.size(); }
205 
207  {
208  return dynamic_cast< LIB_TABLE_ROW* >( new FP_LIB_TABLE_ROW );
209  }
210 
211  LIB_TABLE_ROWS_ITER begin() override { return rows.begin(); }
212 
214  {
215  return rows.insert( aIterator, aRow );
216  }
217 
218  void push_back( LIB_TABLE_ROW* aRow ) override { rows.push_back( aRow ); }
219 
221  {
222  return rows.erase( aFirst, aLast );
223  }
224 
225 public:
226 
227  FP_LIB_TABLE_GRID( const FP_LIB_TABLE& aTableToEdit )
228  {
229  rows = aTableToEdit.rows;
230  }
231 };
232 
233 
234 #define MYID_OPTIONS_EDITOR 15151
235 
236 
238 {
239 public:
241  GRID_TRICKS( aGrid ),
242  m_dialog( aParent )
243  { }
244 
245 protected:
247 
248  void optionsEditor( int aRow )
249  {
250  FP_LIB_TABLE_GRID* tbl = (FP_LIB_TABLE_GRID*) m_grid->GetTable();
251 
252  if( tbl->GetNumberRows() > aRow )
253  {
254  LIB_TABLE_ROW* row = tbl->at( (size_t) aRow );
255  const wxString& options = row->GetOptions();
256  wxString result = options;
257 
258  InvokePluginOptionsEditor( m_dialog, row->GetNickName(), row->GetType(), options,
259  &result );
260 
261  if( options != result )
262  {
263  row->SetOptions( result );
264  m_grid->Refresh();
265  }
266  }
267  }
268 
269  bool handleDoubleClick( wxGridEvent& aEvent ) override
270  {
271  if( aEvent.GetCol() == COL_OPTIONS )
272  {
273  optionsEditor( aEvent.GetRow() );
274  return true;
275  }
276 
277  return false;
278  }
279 
280  void showPopupMenu( wxMenu& menu ) override
281  {
282  if( m_grid->GetGridCursorCol() == COL_OPTIONS )
283  {
284  menu.Append( MYID_OPTIONS_EDITOR, _( "Options Editor..." ), _( "Edit options" ) );
285  menu.AppendSeparator();
286  }
287 
289  }
290 
291  void doPopupSelection( wxCommandEvent& event ) override
292  {
293  if( event.GetId() == MYID_OPTIONS_EDITOR )
294  optionsEditor( m_grid->GetGridCursorRow() );
295  else
297  }
298 
301  void paste_text( const wxString& cb_text ) override
302  {
303  FP_LIB_TABLE_GRID* tbl = (FP_LIB_TABLE_GRID*) m_grid->GetTable();
304  size_t ndx = cb_text.find( "(fp_lib_table" );
305 
306  if( ndx != std::string::npos )
307  {
308  // paste the FP_LIB_TABLE_ROWs of s-expression (fp_lib_table), starting
309  // at column 0 regardless of current cursor column.
310 
311  STRING_LINE_READER slr( TO_UTF8( cb_text ), "Clipboard" );
312  LIB_TABLE_LEXER lexer( &slr );
313  FP_LIB_TABLE tmp_tbl;
314  bool parsed = true;
315 
316  try
317  {
318  tmp_tbl.Parse( &lexer );
319  }
320  catch( PARSE_ERROR& pe )
321  {
322  DisplayError( m_dialog, pe.What() );
323  parsed = false;
324  }
325 
326  if( parsed )
327  {
328  // make sure the table is big enough...
329  if( tmp_tbl.GetCount() > (unsigned) tbl->GetNumberRows() )
330  tbl->AppendRows( tmp_tbl.GetCount() - tbl->GetNumberRows() );
331 
332  for( unsigned i = 0; i < tmp_tbl.GetCount(); ++i )
333  tbl->rows.replace( i, tmp_tbl.At( i ).clone() );
334  }
335 
336  m_grid->AutoSizeColumns( false );
337  }
338  else
339  {
340  // paste spreadsheet formatted text.
341  GRID_TRICKS::paste_text( cb_text );
342 
343  m_grid->AutoSizeColumns( false );
344  }
345  }
346 };
347 
348 
350  FP_LIB_TABLE* aGlobal, const wxString& aGlobalTblPath,
351  FP_LIB_TABLE* aProject, const wxString& aProjectTblPath,
352  const wxString& aProjectBasePath ) :
353  PANEL_FP_LIB_TABLE_BASE( aParent ),
354  m_global( aGlobal ),
355  m_project( aProject ),
356  m_projectBasePath( aProjectBasePath ),
357  m_parent( aParent )
358 {
359  m_global_grid->SetTable( new FP_LIB_TABLE_GRID( *aGlobal ), true );
360 
361  // add Cut, Copy, and Paste to wxGrids
362  m_path_subs_grid->PushEventHandler( new GRID_TRICKS( m_path_subs_grid ) );
363 
364  wxArrayString choices;
365 
366  choices.Add( IO_MGR::ShowType( IO_MGR::KICAD_SEXP ) );
367  choices.Add( IO_MGR::ShowType( IO_MGR::LEGACY ) );
368  choices.Add( IO_MGR::ShowType( IO_MGR::EAGLE ) );
369  choices.Add( IO_MGR::ShowType( IO_MGR::GEDA_PCB ) );
370 
371  /* PCAD_PLUGIN does not support Footprint*() functions
372  choices.Add( IO_MGR::ShowType( IO_MGR::PCAD ) );
373  */
374  PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
375 
376  if( cfg->m_lastFootprintLibDir.IsEmpty() )
378 
380 
381  auto setupGrid =
382  [&]( WX_GRID* aGrid )
383  {
384  // Give a bit more room for wxChoice editors
385  aGrid->SetDefaultRowSize( aGrid->GetDefaultRowSize() + 4 );
386 
387  // add Cut, Copy, and Paste to wxGrids
388  aGrid->PushEventHandler( new FP_GRID_TRICKS( m_parent, aGrid ) );
389 
390  aGrid->SetSelectionMode( wxGrid::wxGridSelectRows );
391  aGrid->AutoSizeColumns( false );
392 
393  wxGridCellAttr* attr;
394 
395  attr = new wxGridCellAttr;
396  attr->SetEditor( new GRID_CELL_PATH_EDITOR( m_parent, aGrid,
397  &cfg->m_lastFootprintLibDir,
398  wxEmptyString, true,
399  m_projectBasePath ) );
400  aGrid->SetColAttr( COL_URI, attr );
401 
402  attr = new wxGridCellAttr;
403  attr->SetEditor( new wxGridCellChoiceEditor( choices ) );
404  aGrid->SetColAttr( COL_TYPE, attr );
405 
406  attr = new wxGridCellAttr;
407  attr->SetRenderer( new wxGridCellBoolRenderer() );
408  attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
409  aGrid->SetColAttr( COL_ENABLED, attr );
410 
411  // all but COL_OPTIONS, which is edited with Option Editor anyways.
412  aGrid->AutoSizeColumn( COL_NICKNAME, false );
413  aGrid->AutoSizeColumn( COL_TYPE, false );
414  aGrid->AutoSizeColumn( COL_URI, false );
415  aGrid->AutoSizeColumn( COL_DESCR, false );
416 
417  // would set this to width of title, if it was easily known.
418  aGrid->SetColSize( COL_OPTIONS, 80 );
419 
420  // Gives a selection to each grid, mainly for delete button. wxGrid's wake up with
421  // a currentCell which is sometimes not highlighted.
422  if( aGrid->GetNumberRows() > 0 )
423  aGrid->SelectRow( 0 );
424  };
425 
426  setupGrid( m_global_grid );
427 
429 
430  if( aProject )
431  {
432  m_project_grid->SetTable( new FP_LIB_TABLE_GRID( *aProject ), true );
433  setupGrid( m_project_grid );
434  }
435  else
436  {
437  m_pageNdx = 0;
438  m_notebook->DeletePage( 1 );
439  m_project_grid = nullptr;
440  }
441 
442  m_path_subs_grid->SetColLabelValue( 0, _( "Name" ) );
443  m_path_subs_grid->SetColLabelValue( 1, _( "Value" ) );
444 
445  // select the last selected page
446  m_notebook->SetSelection( m_pageNdx );
448 
449  // for ALT+A handling, we want the initial focus to be on the first selected grid.
451 
452  // Configure button logos
453  m_append_button->SetBitmap( KiBitmap( small_plus_xpm ) );
454  m_delete_button->SetBitmap( KiBitmap( small_trash_xpm ) );
455  m_move_up_button->SetBitmap( KiBitmap( small_up_xpm ) );
456  m_move_down_button->SetBitmap( KiBitmap( small_down_xpm ) );
458 
459  // For aesthetic reasons, we must set the size of m_browseButton to match the other bitmaps
460  // manually (for instance m_append_button)
461  Layout(); // Needed at least on MSW to compute the actual buttons sizes, after initializing
462  // their bitmaps
463  wxSize buttonSize = m_append_button->GetSize();
464 
466  m_browseButton->SetMinSize( buttonSize );
467 
468  // Populate the browse library options
469  wxMenu* browseMenu = m_browseButton->GetSplitButtonMenu();
470 
471  for( const std::pair<const int, SUPPORTED_FILE_TYPE>& fileType : fileTypes() )
472  {
473  browseMenu->Append( fileType.first, fileType.second.m_Description );
474 
475  browseMenu->Bind( wxEVT_COMMAND_MENU_SELECTED, &PANEL_FP_LIB_TABLE::browseLibrariesHandler,
476  this, fileType.first );
477  }
478 
479  Layout();
480 
481  // Hack to make buttons lay out correctly the first time on Mac
482  wxSize hackSize = m_buttonsPanel->GetSize();
483  m_buttonsPanel->SetSize( wxSize( hackSize.x - 5, hackSize.y ) );
484  Layout();
485 
486  // This is the button only press for the browse button instead of the menu
487  m_browseButton->Bind( wxEVT_BUTTON, &PANEL_FP_LIB_TABLE::browseLibrariesHandler, this );
488 }
489 
490 
492 {
493  // When the dialog is closed it will hide the current notebook page first, which will
494  // in turn select the other one. We then end up saving its index as the "current page".
495  // So flip them back again:
496  m_pageNdx = m_pageNdx == 1 ? 0 : 1;
497 
498  // Delete the GRID_TRICKS.
499  // Any additional event handlers should be popped before the window is deleted.
500  m_global_grid->PopEventHandler( true );
501 
502  if( m_project_grid )
503  m_project_grid->PopEventHandler( true );
504 
505  m_path_subs_grid->PopEventHandler( true );
506 }
507 
508 
510 {
511  for( FP_LIB_TABLE_GRID* model : { global_model(), project_model() } )
512  {
513  if( !model )
514  continue;
515 
516  for( int r = 0; r < model->GetNumberRows(); )
517  {
518  wxString nick = model->GetValue( r, COL_NICKNAME ).Trim( false ).Trim();
519  wxString uri = model->GetValue( r, COL_URI ).Trim( false ).Trim();
520  unsigned illegalCh = 0;
521 
522  if( !nick || !uri )
523  {
524  // Delete the "empty" row, where empty means missing nick or uri.
525  // This also updates the UI which could be slow, but there should only be a few
526  // rows to delete, unless the user fell asleep on the Add Row
527  // button.
528  model->DeleteRows( r, 1 );
529  }
530  else if( ( illegalCh = LIB_ID::FindIllegalLibraryNameChar( nick ) ) )
531  {
532  wxString msg = wxString::Format( _( "Illegal character '%c' in nickname '%s'." ),
533  illegalCh,
534  nick );
535 
536  // show the tabbed panel holding the grid we have flunked:
537  if( model != cur_model() )
538  m_notebook->SetSelection( model == global_model() ? 0 : 1 );
539 
540  m_cur_grid->MakeCellVisible( r, 0 );
541  m_cur_grid->SetGridCursor( r, 1 );
542 
543  wxMessageDialog errdlg( this, msg, _( "Library Nickname Error" ) );
544  errdlg.ShowModal();
545  return false;
546  }
547  else
548  {
549  // set the trimmed values back into the table so they get saved to disk.
550  model->SetValue( r, COL_NICKNAME, nick );
551  model->SetValue( r, COL_URI, uri );
552  ++r; // this row was OK.
553  }
554  }
555  }
556 
557  // check for duplicate nickNames, separately in each table.
558  for( FP_LIB_TABLE_GRID* model : { global_model(), project_model() } )
559  {
560  if( !model )
561  continue;
562 
563  for( int r1 = 0; r1 < model->GetNumberRows() - 1; ++r1 )
564  {
565  wxString nick1 = model->GetValue( r1, COL_NICKNAME );
566 
567  for( int r2 = r1 + 1; r2 < model->GetNumberRows(); ++r2 )
568  {
569  wxString nick2 = model->GetValue( r2, COL_NICKNAME );
570 
571  if( nick1 == nick2 )
572  {
573  wxString msg = wxString::Format( _( "Multiple libraries cannot share the same "
574  "nickname ('%s')." ),
575  nick1 );
576 
577  // show the tabbed panel holding the grid we have flunked:
578  if( model != cur_model() )
579  m_notebook->SetSelection( model == global_model() ? 0 : 1 );
580 
581  // go to the lower of the two rows, it is technically the duplicate:
582  m_cur_grid->MakeCellVisible( r2, 0 );
583  m_cur_grid->SetGridCursor( r2, 1 );
584 
585  wxMessageDialog errdlg( this, msg, _( "Library Nickname Error" ) );
586  errdlg.ShowModal();
587  return false;
588  }
589  }
590  }
591  }
592 
593  return true;
594 }
595 
596 
597 void PANEL_FP_LIB_TABLE::OnUpdateUI( wxUpdateUIEvent& event )
598 {
599  m_pageNdx = (unsigned) std::max( 0, m_notebook->GetSelection() );
601 }
602 
603 
604 void PANEL_FP_LIB_TABLE::appendRowHandler( wxCommandEvent& event )
605 {
607  return;
608 
609  if( m_cur_grid->AppendRows( 1 ) )
610  {
611  int last_row = m_cur_grid->GetNumberRows() - 1;
612 
613  // wx documentation is wrong, SetGridCursor does not make visible.
614  m_cur_grid->MakeCellVisible( last_row, 0 );
615  m_cur_grid->SetGridCursor( last_row, 1 );
616  m_cur_grid->EnableCellEditControl( true );
617  m_cur_grid->ShowCellEditControl();
618  }
619 }
620 
621 
622 void PANEL_FP_LIB_TABLE::deleteRowHandler( wxCommandEvent& event )
623 {
625  return;
626 
627  int curRow = m_cur_grid->GetGridCursorRow();
628  int curCol = m_cur_grid->GetGridCursorCol();
629 
630  // In a wxGrid, collect rows that have a selected cell, or are selected
631  // It is not so easy: it depends on the way the selection was made.
632  // Here, we collect rows selected by clicking on a row label, and rows that contain any
633  // previously-selected cells.
634  // If no candidate, just delete the row with the grid cursor.
635  wxArrayInt selectedRows = m_cur_grid->GetSelectedRows();
636  wxGridCellCoordsArray cells = m_cur_grid->GetSelectedCells();
637  wxGridCellCoordsArray blockTopLeft = m_cur_grid->GetSelectionBlockTopLeft();
638  wxGridCellCoordsArray blockBotRight = m_cur_grid->GetSelectionBlockBottomRight();
639 
640  // Add all row having cell selected to list:
641  for( unsigned ii = 0; ii < cells.GetCount(); ii++ )
642  selectedRows.Add( cells[ii].GetRow() );
643 
644  // Handle block selection
645  if( !blockTopLeft.IsEmpty() && !blockBotRight.IsEmpty() )
646  {
647  for( int i = blockTopLeft[0].GetRow(); i <= blockBotRight[0].GetRow(); ++i )
648  selectedRows.Add( i );
649  }
650 
651  // Use the row having the grid cursor only if we have no candidate:
652  if( selectedRows.size() == 0 && m_cur_grid->GetGridCursorRow() >= 0 )
653  selectedRows.Add( m_cur_grid->GetGridCursorRow() );
654 
655  if( selectedRows.size() == 0 )
656  {
657  wxBell();
658  return;
659  }
660 
661  std::sort( selectedRows.begin(), selectedRows.end() );
662 
663  // Remove selected rows (note: a row can be stored more than once in list)
664  int last_row = -1;
665 
666  for( int ii = selectedRows.GetCount()-1; ii >= 0; ii-- )
667  {
668  int row = selectedRows[ii];
669 
670  if( row != last_row )
671  {
672  last_row = row;
673  m_cur_grid->DeleteRows( row, 1 );
674  }
675  }
676 
677  if( m_cur_grid->GetNumberRows() > 0 && curRow >= 0 )
678  m_cur_grid->SetGridCursor( std::min( curRow, m_cur_grid->GetNumberRows() - 1 ), curCol );
679 }
680 
681 
682 void PANEL_FP_LIB_TABLE::moveUpHandler( wxCommandEvent& event )
683 {
685  return;
686 
687  FP_LIB_TABLE_GRID* tbl = cur_model();
688  int curRow = m_cur_grid->GetGridCursorRow();
689 
690  // @todo: add multiple selection moves.
691  if( curRow >= 1 )
692  {
693  boost::ptr_vector< LIB_TABLE_ROW >::auto_type move_me =
694  tbl->rows.release( tbl->rows.begin() + curRow );
695 
696  --curRow;
697  tbl->rows.insert( tbl->rows.begin() + curRow, move_me.release() );
698 
699  if( tbl->GetView() )
700  {
701  // Update the wxGrid
702  wxGridTableMessage msg( tbl, wxGRIDTABLE_NOTIFY_ROWS_INSERTED, curRow, 0 );
703  tbl->GetView()->ProcessTableMessage( msg );
704  }
705 
706  m_cur_grid->MakeCellVisible( curRow, m_cur_grid->GetGridCursorCol() );
707  m_cur_grid->SetGridCursor( curRow, m_cur_grid->GetGridCursorCol() );
708  }
709 }
710 
711 
712 void PANEL_FP_LIB_TABLE::moveDownHandler( wxCommandEvent& event )
713 {
715  return;
716 
717  FP_LIB_TABLE_GRID* tbl = cur_model();
718  int curRow = m_cur_grid->GetGridCursorRow();
719 
720  // @todo: add multiple selection moves.
721  if( unsigned( curRow + 1 ) < tbl->rows.size() )
722  {
723  boost::ptr_vector< LIB_TABLE_ROW >::auto_type move_me =
724  tbl->rows.release( tbl->rows.begin() + curRow );
725 
726  ++curRow;
727  tbl->rows.insert( tbl->rows.begin() + curRow, move_me.release() );
728 
729  if( tbl->GetView() )
730  {
731  // Update the wxGrid
732  wxGridTableMessage msg( tbl, wxGRIDTABLE_NOTIFY_ROWS_INSERTED, curRow - 1, 0 );
733  tbl->GetView()->ProcessTableMessage( msg );
734  }
735 
736  m_cur_grid->MakeCellVisible( curRow, m_cur_grid->GetGridCursorCol() );
737  m_cur_grid->SetGridCursor( curRow, m_cur_grid->GetGridCursorCol() );
738  }
739 }
740 
741 
742 void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
743 {
745  return;
746 
747  std::map<int, SUPPORTED_FILE_TYPE>::const_iterator fileTypeIt;
748 
749  // We are bound both to the menu and button with this one handler
750  // So we must set the file type based on it
751  if( event.GetEventType() == wxEVT_BUTTON )
752  {
753  // Let's default to adding a kicad footprint file for just the footprint
754  fileTypeIt = fileTypes().find( ID_PANEL_FPLIB_ADD_KICADMOD );
755  }
756  else
757  {
758  fileTypeIt = fileTypes().find( event.GetId() );
759  }
760 
761  if( fileTypeIt == fileTypes().end() )
762  {
763  wxLogWarning( "File type selection event received but could not find the file type in the table" );
764  return;
765  }
766 
767  SUPPORTED_FILE_TYPE fileType = fileTypeIt->second;
768 
769  PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
770 
771  wxArrayString files;
772 
773  wxString title;
774 
775  title.Printf( _( "Select %s Library" ), fileType.m_Description );
776 
777  wxString openDir = cfg->m_lastFootprintLibDir;
778  if( m_cur_grid == m_project_grid )
779  {
780  openDir = m_lastProjectLibDir;
781  }
782 
783  if( fileType.m_IsFile )
784  {
785  wxFileDialog dlg( this, title, openDir, wxEmptyString,
786  fileType.m_FileFilter,
787  wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE );
788 
789  int result = dlg.ShowModal();
790 
791  if( result == wxID_CANCEL )
792  return;
793 
794  dlg.GetPaths( files );
795 
796  cfg->m_lastFootprintLibDir = dlg.GetDirectory();
797  }
798  else
799  {
800  wxDirDialog dlg( nullptr, title, openDir,
801  wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
802 
803  int result = dlg.ShowModal();
804 
805  if( result == wxID_CANCEL )
806  return;
807 
808  // is there a file extension configured to hunt out their containing folders?
809  if( fileType.m_FolderSearchExtension != "" )
810  {
811  wxDir rootDir( dlg.GetPath() );
812 
813  LIBRARY_TRAVERSER traverser( fileType.m_FolderSearchExtension, rootDir.GetName() );
814  rootDir.Traverse( traverser );
815 
816  traverser.GetPaths( files );
817 
818  if( traverser.HasDirectoryOpenFailures() )
819  {
820  wxArrayString failedDirs;
821  traverser.GetPaths( failedDirs );
822  wxString detailedMsg = _( "The following directories could not be opened: \n" );
823 
824  for( const wxString& path : failedDirs )
825  detailedMsg << path << "\n";
826 
827  DisplayErrorMessage( this, _( "Failed to open directories to look for libraries" ),
828  detailedMsg );
829  }
830  }
831  else
832  {
833  files.Add( dlg.GetPath() );
834  }
835 
836  if( m_cur_grid == m_global_grid )
837  {
838  cfg->m_lastFootprintLibDir = dlg.GetPath();
839  }
840  else
841  {
842  m_lastProjectLibDir = dlg.GetPath();
843  }
844  }
845 
846  // Drop the last directory if the path is a .pretty folder
848  cfg->m_lastFootprintLibDir = cfg->m_lastFootprintLibDir.BeforeLast( wxFileName::GetPathSeparator() );
849 
850  const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
851  bool addDuplicates = false;
852  bool applyToAll = false;
853  wxString warning = _( "Warning: Duplicate Nicknames" );
854  wxString msg = _( "A library nicknamed '%s' already exists." );
855  wxString detailedMsg = _( "One of the nicknames will need to be changed after "
856  "adding this library." );
857 
858  for( const wxString& filePath : files )
859  {
860  wxFileName fn( filePath );
861  wxString nickname = LIB_ID::FixIllegalChars( fn.GetName() );
862  bool doAdd = true;
863 
864  if( cur_model()->ContainsNickname( nickname ) )
865  {
866  if( !applyToAll )
867  {
868  // The cancel button adds the library to the table anyway
869  addDuplicates = OKOrCancelDialog( this, warning, wxString::Format( msg, nickname ),
870  detailedMsg, _( "Skip" ), _( "Add Anyway" ),
871  &applyToAll ) == wxID_CANCEL;
872  }
873 
874  doAdd = addDuplicates;
875  }
876 
877  if( doAdd && m_cur_grid->AppendRows( 1 ) )
878  {
879  int last_row = m_cur_grid->GetNumberRows() - 1;
880 
881  m_cur_grid->SetCellValue( last_row, COL_NICKNAME, nickname );
882 
883  m_cur_grid->SetCellValue( last_row, COL_TYPE, IO_MGR::ShowType( fileType.m_Plugin ) );
884 
885  // try to use path normalized to an environmental variable or project path
886  wxString path = NormalizePath( filePath, &envVars, m_projectBasePath );
887 
888  // Do not use the project path in the global library table. This will almost
889  // assuredly be wrong for a different project.
890  if( path.IsEmpty() || ( m_pageNdx == 0 && path.Contains( "${KIPRJMOD}" ) ) )
891  path = fn.GetFullPath();
892 
893  m_cur_grid->SetCellValue( last_row, COL_URI, path );
894  }
895  }
896 
897  if( !files.IsEmpty() )
898  {
899  int new_row = m_cur_grid->GetNumberRows() - 1;
900  m_cur_grid->MakeCellVisible( new_row, m_cur_grid->GetGridCursorCol() );
901  m_cur_grid->SetGridCursor( new_row, m_cur_grid->GetGridCursorCol() );
902  }
903 }
904 
905 
907 {
908  // Account for scroll bars
909  aWidth -= ( m_path_subs_grid->GetSize().x - m_path_subs_grid->GetClientSize().x );
910 
911  m_path_subs_grid->AutoSizeColumn( 0 );
912 
913  if( aWidth - m_path_subs_grid->GetColSize( 0 ) < 60 )
914  m_path_subs_grid->SetColSize( 0, aWidth / 2 );
915 
916  m_path_subs_grid->SetColSize( 1, aWidth - m_path_subs_grid->GetColSize( 0 ) );
917 }
918 
919 
920 void PANEL_FP_LIB_TABLE::onSizeGrid( wxSizeEvent& event )
921 {
922  adjustPathSubsGridColumns( event.GetSize().GetX() );
923 
924  event.Skip();
925 }
926 
927 
929 {
931  return false;
932 
933  if( verifyTables() )
934  {
935  if( *global_model() != *m_global )
936  {
938 
939  m_global->Clear();
940  m_global->rows.transfer( m_global->rows.end(), global_model()->rows.begin(),
941  global_model()->rows.end(), global_model()->rows );
942  m_global->reindex();
943  }
944 
945  if( project_model() && *project_model() != *m_project )
946  {
948 
949  m_project->Clear();
950  m_project->rows.transfer( m_project->rows.end(), project_model()->rows.begin(),
951  project_model()->rows.end(), project_model()->rows );
952  m_project->reindex();
953  }
954 
955  return true;
956  }
957 
958  return false;
959 }
960 
961 
965 {
966  wxRegEx re( ".*?(\\$\\{(.+?)\\})|(\\$\\((.+?)\\)).*?", wxRE_ADVANCED );
967  wxASSERT( re.IsValid() ); // wxRE_ADVANCED is required.
968 
969  std::set< wxString > unique;
970 
971  // clear the table
972  m_path_subs_grid->DeleteRows( 0, m_path_subs_grid->GetNumberRows() );
973 
974  for( FP_LIB_TABLE_GRID* tbl : { global_model(), project_model() } )
975  {
976  if( !tbl )
977  continue;
978 
979  for( int row = 0; row < tbl->GetNumberRows(); ++row )
980  {
981  wxString uri = tbl->GetValue( row, COL_URI );
982 
983  while( re.Matches( uri ) )
984  {
985  wxString envvar = re.GetMatch( uri, 2 );
986 
987  // if not ${...} form then must be $(...)
988  if( envvar.IsEmpty() )
989  envvar = re.GetMatch( uri, 4 );
990 
991  // ignore duplicates
992  unique.insert( envvar );
993 
994  // delete the last match and search again
995  uri.Replace( re.GetMatch( uri, 0 ), wxEmptyString );
996  }
997  }
998  }
999 
1000  // Make sure this special environment variable shows up even if it was
1001  // not used yet. It is automatically set by KiCad to the directory holding
1002  // the current project.
1003  unique.insert( PROJECT_VAR_NAME );
1004  unique.insert( FP_LIB_TABLE::GlobalPathEnvVariableName() );
1005  // This special environment variable is used to locate 3d shapes
1006  unique.insert( KICAD6_3DMODEL_DIR );
1007 
1008  for( const wxString& evName : unique )
1009  {
1010  int row = m_path_subs_grid->GetNumberRows();
1011  m_path_subs_grid->AppendRows( 1 );
1012 
1013  m_path_subs_grid->SetCellValue( row, 0, wxT( "${" ) + evName + wxT( "}" ) );
1014  m_path_subs_grid->SetCellEditor( row, 0, new GRID_CELL_READONLY_TEXT_EDITOR() );
1015 
1016  wxString evValue;
1017  wxGetEnv( evName, &evValue );
1018  m_path_subs_grid->SetCellValue( row, 1, evValue );
1019  m_path_subs_grid->SetCellEditor( row, 1, new GRID_CELL_READONLY_TEXT_EDITOR() );
1020  }
1021 
1022  // No combobox editors here, but it looks better if its consistent with the other
1023  // grids in the dialog.
1024  m_path_subs_grid->SetDefaultRowSize( m_path_subs_grid->GetDefaultRowSize() + 2 );
1025 
1026  adjustPathSubsGridColumns( m_path_subs_grid->GetRect().GetWidth() );
1027 }
1028 
1029 //-----</event handlers>---------------------------------
1030 
1031 
1032 
1034 
1035 
1036 void InvokePcbLibTableEditor( KIWAY* aKiway, wxWindow* aCaller )
1037 {
1038  FP_LIB_TABLE* globalTable = &GFootprintTable;
1039  wxString globalTablePath = FP_LIB_TABLE::GetGlobalTableFileName();
1040  FP_LIB_TABLE* projectTable = aKiway->Prj().PcbFootprintLibs();
1041  wxString projectTablePath = aKiway->Prj().FootprintLibTblName();
1042  wxString msg;
1043 
1044  DIALOG_EDIT_LIBRARY_TABLES dlg( aCaller, _( "Footprint Libraries" ) );
1045  dlg.SetKiway( &dlg, aKiway );
1046 
1047  if( aKiway->Prj().IsNullProject() )
1048  projectTable = nullptr;
1049 
1050  dlg.InstallPanel( new PANEL_FP_LIB_TABLE( &dlg, globalTable, globalTablePath,
1051  projectTable, projectTablePath,
1052  aKiway->Prj().GetProjectPath() ) );
1053 
1054  if( dlg.ShowModal() == wxID_CANCEL )
1055  return;
1056 
1057  if( dlg.m_GlobalTableChanged )
1058  {
1059  try
1060  {
1061  globalTable->Save( globalTablePath );
1062  }
1063  catch( const IO_ERROR& ioe )
1064  {
1065  msg.Printf( _( "Error saving global library table:\n\n%s" ), ioe.What() );
1066  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
1067  }
1068  }
1069 
1070  if( projectTable && dlg.m_ProjectTableChanged )
1071  {
1072  try
1073  {
1074  projectTable->Save( projectTablePath );
1075  }
1076  catch( const IO_ERROR& ioe )
1077  {
1078  msg.Printf( _( "Error saving project-specific library table:\n\n%s" ), ioe.What() );
1079  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
1080  }
1081  }
1082 
1083  auto editor = (FOOTPRINT_EDIT_FRAME*) aKiway->Player( FRAME_FOOTPRINT_EDITOR, false );
1084 
1085  if( editor )
1086  editor->SyncLibraryTree( true );
1087 
1088  auto viewer = (FOOTPRINT_VIEWER_FRAME*) aKiway->Player( FRAME_FOOTPRINT_VIEWER, false );
1089 
1090  if( viewer )
1091  viewer->ReCreateLibraryList();
1092 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:253
FP_GRID_TRICKS(DIALOG_EDIT_LIBRARY_TABLES *aParent, WX_GRID *aGrid)
void SetKiway(wxWindow *aDest, KIWAY *aKiway)
It is only used for debugging, since "this" is not a wxWindow*.
static UTF8 FixIllegalChars(const UTF8 &aLibItemName, bool aLib=false)
Replace illegal LIB_ID item name characters with underscores '_'.
Definition: lib_id.cpp:347
void push_back(LIB_TABLE_ROW *aRow) override
const wxString & GetOptions() const
Return the options string, which may hold a password or anything else needed to instantiate the under...
void moveDownHandler(wxCommandEvent &event) override
wxString EagleFootprintLibPathWildcard()
void InvokePluginOptionsEditor(wxWindow *aCaller, const wxString &aNickname, const wxString &aPluginType, const wxString &aOptions, wxString *aResult)
Function InvokePluginOptionsEditor calls DIALOG_FP_PLUGIN_OPTIONS dialog so that plugin options set c...
void SetBitmap(const wxBitmap &aBmp)
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
FP_LIB_TABLE GFootprintTable
!!!!!!!!!!!!!! This code is obsolete because of the merge into pcbnew, don't bother with it.
Definition: cvpcb.cpp:120
Container that describes file type info for the add a library options.
void Clear()
Delete all rows.
void GetFailedPaths(wxArrayString &aPathArray)
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:266
#define KICAD6_3DMODEL_DIR
A variable name whose value holds the path of 3D shape files.
Definition: eda_3d_viewer.h:45
Hold a record identifying a library accessed by the appropriate footprint library PLUGIN object in th...
Definition: fp_lib_table.h:40
wxMenu * GetSplitButtonMenu()
This file is part of the common library.
const BITMAP_OPAQUE small_folder_xpm[1]
void showPopupMenu(wxMenu &menu) override
void reindex()
const std::string KiCadFootprintFileExtension
FP_LIB_TABLE * m_project
bool ContainsNickname(const wxString &aNickname)
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:174
unsigned GetCount() const
Get the number of rows contained in the table.
virtual wxDirTraverseResult OnFile(const wxString &aFileName) override
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
Definition: project.h:38
Component library viewer main window.
void appendRowHandler(wxCommandEvent &event) override
void SetMinSize(const wxSize &aSize) override
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition: grid_tricks.h:52
void adjustPathSubsGridColumns(int aWidth)
#define MYID_OPTIONS_EDITOR
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:345
static const std::map< int, SUPPORTED_FILE_TYPE > & fileTypes()
Map with event id as the key to supported file types that will be listed for the add a library option...
IO_MGR::PCB_FILE_T m_Plugin
LIB_TABLE_ROWS rows
void SetTable(wxGridTableBase *table, bool aTakeOwnership=false)
Hide wxGrid's SetTable() method with one which doesn't mess up the grid column widths when setting th...
Definition: wx_grid.cpp:65
static const wxString ShowType(PCB_FILE_T aFileType)
Return a brief name for a plugin given aFileType enum.
Definition: io_mgr.cpp:77
virtual const wxString GetType() const =0
Return the type of library represented by this row.
int GetNumberRows() override
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
wxString LegacyFootprintLibPathWildcard()
virtual const wxString GetProjectPath() const
Return the full path of the project.
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:98
Geda PCB file formats.
Definition: io_mgr.h:63
size_t size() const override
This abstract base class mixes any object derived from LIB_TABLE into wxGridTableBase so the result c...
LIB_TABLE_ROWS_ITER insert(LIB_TABLE_ROWS_ITER aIterator, LIB_TABLE_ROW *aRow) override
void InvokePcbLibTableEditor(KIWAY *aKiway, wxWindow *aCaller)
Function InvokePcbLibTableEditor shows the modal DIALOG_FP_LIB_TABLE for purposes of editing the glob...
WX_GRID * m_grid
I don't own the grid, but he owns me.
Definition: grid_tricks.h:81
virtual void paste_text(const wxString &cb_text)
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
static size_t m_pageNdx
void moveUpHandler(wxCommandEvent &event) override
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:82
const wxString & GetNickName() const
static const wxString GlobalPathEnvVariableName()
Return the name of the environment variable used to hold the directory of locally installed "KiCad sp...
LIB_TABLE_ROW * clone() const
virtual void Parse(LIB_TABLE_LEXER *aLexer) override
Parse the #LIB_TABLE_LEXER s-expression library table format into the appropriate LIB_TABLE_ROW objec...
PANEL_FP_LIB_TABLE(DIALOG_EDIT_LIBRARY_TABLES *aParent, FP_LIB_TABLE *aGlobal, const wxString &aGlobalTblPath, FP_LIB_TABLE *aProject, const wxString &aProjectTblPath, const wxString &aProjectBasePath)
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
Definition: pgm_base.h:113
FP_LIB_TABLE_GRID * global_model() const
DIALOG_EDIT_LIBRARY_TABLES * m_dialog
std::unordered_map< wxString, int > m_foundDirs
FP_LIB_TABLE_GRID * project_model() const
FP_LIB_TABLE_GRID * cur_model() const
const BITMAP_OPAQUE small_down_xpm[1]
Definition: small_down.cpp:23
void paste_text(const wxString &cb_text) override
handle specialized clipboard text, with leading "(fp_lib_table", OR spreadsheet formatted text.
Definition of file extensions used in Kicad.
bool m_IsFile
Whether the library is a folder or a file.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:260
void deleteRowHandler(wxCommandEvent &event) override
Editor for wxGrid cells that adds a file/folder browser to the grid input field.
bool CommitPendingChanges(bool aQuietMode=false)
Close any open cell edit controls.
Definition: wx_grid.cpp:182
bool AppendRows(size_t aNumRows=1) override
void optionsEditor(int aRow)
FormatType fileType(const char *aFileName)
Definition: loadmodel.cpp:273
const BITMAP_OPAQUE small_up_xpm[1]
Definition: small_up.cpp:23
virtual bool IsNullProject() const
Check if this project is a null project (i.e.
void browseLibrariesHandler(wxCommandEvent &event)
bool verifyTables()
Trim important fields, removes blank row entries, and checks for duplicates.
const BITMAP_OPAQUE small_trash_xpm[1]
Definition: small_trash.cpp:23
void SetWidthPadding(int aPadding)
Class PANEL_FP_LIB_TABLE_BASE.
LIB_TABLE_ROWS_ITER begin() override
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
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 OnUpdateUI(wxUpdateUIEvent &event) override
wxString m_FolderSearchExtension
In case of folders it stands for extensions of files stored inside.
int OKOrCancelDialog(wxWindow *aParent, const wxString &aWarning, const wxString &aMessage, wxString aDetailedMessage, wxString aOKLabel, wxString aCancelLabel, bool *aApplyToAll)
Display a warning dialog with aMessage and returns the user response.
Definition: confirm.cpp:221
bool TransferDataFromWindow() override
virtual wxDirTraverseResult OnDir(const wxString &aDirName) override
LIBRARY_TRAVERSER(wxString aSearchExtension, wxString aInitialDir)
static wxString GetDefaultUserFootprintsPath()
Gets the default path we point users to create projects.
Definition: paths.cpp:107
A filename or source description, a problem input line, a line number, a byte offset,...
Definition: ki_exception.h:118
Legacy Pcbnew file formats prior to s-expression.
Definition: io_mgr.h:54
see class PGM_BASE
virtual void doPopupSelection(wxCommandEvent &event)
Declaration of the eda_3d_viewer class.
LIB_TABLE_ROW & At(unsigned aIndex)
Get the 'n'th LIB_TABLE_ROW object.
LIB_TABLE_ROW * makeNewRow() override
virtual void showPopupMenu(wxMenu &menu)
FP_LIB_TABLE_GRID(const FP_LIB_TABLE &aTableToEdit)
#define _(s)
Definition: 3d_actions.cpp:33
virtual wxDirTraverseResult OnOpenError(const wxString &aOpenErrorName) override
void GetPaths(wxArrayString &aPathArray)
LIB_TABLE_ROWS::iterator LIB_TABLE_ROWS_ITER
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
Traverser implementation that looks to find any and all "folder" libraries by looking for files with ...
LIB_TABLE_ROWS_ITER erase(LIB_TABLE_ROWS_ITER aFirst, LIB_TABLE_ROWS_ITER aLast) override
This class builds a wxGridTableBase by wrapping an FP_LIB_TABLE object.
const std::string GedaPcbFootprintLibFileExtension
DIALOG_EDIT_LIBRARY_TABLES * m_parent
void SetOptions(const wxString &aOptions)
Change the library options strings.
void onSizeGrid(wxSizeEvent &event) override
FP_LIB_TABLE * m_global
Dialog to show and edit symbol library tables.
wxString m_Description
Description shown in the file picker dialog.
wxString m_lastFootprintLibDir
wxString m_FileFilter
Filter used for file pickers if m_IsFile is true.
std::unordered_map< wxString, int > m_failedDirs
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
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:237
bool handleDoubleClick(wxGridEvent &aEvent) override
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
const std::string KiCadFootprintLibPathExtension
const BITMAP_OPAQUE small_plus_xpm[1]
Definition: small_plus.cpp:18
void doPopupSelection(wxCommandEvent &event) override
LIB_TABLE_ROW * at(size_t aIndex) override
virtual const wxString FootprintLibTblName() const
Returns the path and filename of this project's footprint library table.
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
Definition: env_paths.cpp:67
static wxString GetGlobalTableFileName()
void populateEnvironReadOnlyTable()
Populate the readonly environment variable table with names and values by examining all the full_uri ...
S-expression Pcbnew file format.
Definition: io_mgr.h:55
static unsigned FindIllegalLibraryNameChar(const UTF8 &aLibraryName)
Looks for characters that are illegal in library nicknames.
Definition: lib_id.cpp:398