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